1 /* Generated by Cython 0.29.12 */
2 
3 /* BEGIN: Cython Metadata
4 {
5     "distutils": {
6         "depends": [
7             "yt/utilities/lib/cykdtree/c_utils.hpp"
8         ],
9         "extra_compile_args": [
10             "-std=c++03"
11         ],
12         "include_dirs": [
13             "yt/utilities/lib/cykdtree"
14         ],
15         "language": "c++",
16         "libraries": [
17             "m"
18         ],
19         "name": "yt.utilities.lib.cykdtree.utils",
20         "sources": [
21             "yt/utilities/lib/cykdtree/utils.pyx",
22             "yt/utilities/lib/cykdtree/c_utils.cpp"
23         ]
24     },
25     "module_name": "yt.utilities.lib.cykdtree.utils"
26 }
27 END: Cython Metadata */
28 
29 #define PY_SSIZE_T_CLEAN
30 #include "Python.h"
31 #ifndef Py_PYTHON_H
32     #error Python headers needed to compile C extensions, please install development version of Python.
33 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
34     #error Cython requires Python 2.6+ or Python 3.3+.
35 #else
36 #define CYTHON_ABI "0_29_12"
37 #define CYTHON_HEX_VERSION 0x001D0CF0
38 #define CYTHON_FUTURE_DIVISION 0
39 #include <stddef.h>
40 #ifndef offsetof
41   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
42 #endif
43 #if !defined(WIN32) && !defined(MS_WINDOWS)
44   #ifndef __stdcall
45     #define __stdcall
46   #endif
47   #ifndef __cdecl
48     #define __cdecl
49   #endif
50   #ifndef __fastcall
51     #define __fastcall
52   #endif
53 #endif
54 #ifndef DL_IMPORT
55   #define DL_IMPORT(t) t
56 #endif
57 #ifndef DL_EXPORT
58   #define DL_EXPORT(t) t
59 #endif
60 #define __PYX_COMMA ,
61 #ifndef HAVE_LONG_LONG
62   #if PY_VERSION_HEX >= 0x02070000
63     #define HAVE_LONG_LONG
64   #endif
65 #endif
66 #ifndef PY_LONG_LONG
67   #define PY_LONG_LONG LONG_LONG
68 #endif
69 #ifndef Py_HUGE_VAL
70   #define Py_HUGE_VAL HUGE_VAL
71 #endif
72 #ifdef PYPY_VERSION
73   #define CYTHON_COMPILING_IN_PYPY 1
74   #define CYTHON_COMPILING_IN_PYSTON 0
75   #define CYTHON_COMPILING_IN_CPYTHON 0
76   #undef CYTHON_USE_TYPE_SLOTS
77   #define CYTHON_USE_TYPE_SLOTS 0
78   #undef CYTHON_USE_PYTYPE_LOOKUP
79   #define CYTHON_USE_PYTYPE_LOOKUP 0
80   #if PY_VERSION_HEX < 0x03050000
81     #undef CYTHON_USE_ASYNC_SLOTS
82     #define CYTHON_USE_ASYNC_SLOTS 0
83   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
84     #define CYTHON_USE_ASYNC_SLOTS 1
85   #endif
86   #undef CYTHON_USE_PYLIST_INTERNALS
87   #define CYTHON_USE_PYLIST_INTERNALS 0
88   #undef CYTHON_USE_UNICODE_INTERNALS
89   #define CYTHON_USE_UNICODE_INTERNALS 0
90   #undef CYTHON_USE_UNICODE_WRITER
91   #define CYTHON_USE_UNICODE_WRITER 0
92   #undef CYTHON_USE_PYLONG_INTERNALS
93   #define CYTHON_USE_PYLONG_INTERNALS 0
94   #undef CYTHON_AVOID_BORROWED_REFS
95   #define CYTHON_AVOID_BORROWED_REFS 1
96   #undef CYTHON_ASSUME_SAFE_MACROS
97   #define CYTHON_ASSUME_SAFE_MACROS 0
98   #undef CYTHON_UNPACK_METHODS
99   #define CYTHON_UNPACK_METHODS 0
100   #undef CYTHON_FAST_THREAD_STATE
101   #define CYTHON_FAST_THREAD_STATE 0
102   #undef CYTHON_FAST_PYCALL
103   #define CYTHON_FAST_PYCALL 0
104   #undef CYTHON_PEP489_MULTI_PHASE_INIT
105   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
106   #undef CYTHON_USE_TP_FINALIZE
107   #define CYTHON_USE_TP_FINALIZE 0
108   #undef CYTHON_USE_DICT_VERSIONS
109   #define CYTHON_USE_DICT_VERSIONS 0
110   #undef CYTHON_USE_EXC_INFO_STACK
111   #define CYTHON_USE_EXC_INFO_STACK 0
112 #elif defined(PYSTON_VERSION)
113   #define CYTHON_COMPILING_IN_PYPY 0
114   #define CYTHON_COMPILING_IN_PYSTON 1
115   #define CYTHON_COMPILING_IN_CPYTHON 0
116   #ifndef CYTHON_USE_TYPE_SLOTS
117     #define CYTHON_USE_TYPE_SLOTS 1
118   #endif
119   #undef CYTHON_USE_PYTYPE_LOOKUP
120   #define CYTHON_USE_PYTYPE_LOOKUP 0
121   #undef CYTHON_USE_ASYNC_SLOTS
122   #define CYTHON_USE_ASYNC_SLOTS 0
123   #undef CYTHON_USE_PYLIST_INTERNALS
124   #define CYTHON_USE_PYLIST_INTERNALS 0
125   #ifndef CYTHON_USE_UNICODE_INTERNALS
126     #define CYTHON_USE_UNICODE_INTERNALS 1
127   #endif
128   #undef CYTHON_USE_UNICODE_WRITER
129   #define CYTHON_USE_UNICODE_WRITER 0
130   #undef CYTHON_USE_PYLONG_INTERNALS
131   #define CYTHON_USE_PYLONG_INTERNALS 0
132   #ifndef CYTHON_AVOID_BORROWED_REFS
133     #define CYTHON_AVOID_BORROWED_REFS 0
134   #endif
135   #ifndef CYTHON_ASSUME_SAFE_MACROS
136     #define CYTHON_ASSUME_SAFE_MACROS 1
137   #endif
138   #ifndef CYTHON_UNPACK_METHODS
139     #define CYTHON_UNPACK_METHODS 1
140   #endif
141   #undef CYTHON_FAST_THREAD_STATE
142   #define CYTHON_FAST_THREAD_STATE 0
143   #undef CYTHON_FAST_PYCALL
144   #define CYTHON_FAST_PYCALL 0
145   #undef CYTHON_PEP489_MULTI_PHASE_INIT
146   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
147   #undef CYTHON_USE_TP_FINALIZE
148   #define CYTHON_USE_TP_FINALIZE 0
149   #undef CYTHON_USE_DICT_VERSIONS
150   #define CYTHON_USE_DICT_VERSIONS 0
151   #undef CYTHON_USE_EXC_INFO_STACK
152   #define CYTHON_USE_EXC_INFO_STACK 0
153 #else
154   #define CYTHON_COMPILING_IN_PYPY 0
155   #define CYTHON_COMPILING_IN_PYSTON 0
156   #define CYTHON_COMPILING_IN_CPYTHON 1
157   #ifndef CYTHON_USE_TYPE_SLOTS
158     #define CYTHON_USE_TYPE_SLOTS 1
159   #endif
160   #if PY_VERSION_HEX < 0x02070000
161     #undef CYTHON_USE_PYTYPE_LOOKUP
162     #define CYTHON_USE_PYTYPE_LOOKUP 0
163   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
164     #define CYTHON_USE_PYTYPE_LOOKUP 1
165   #endif
166   #if PY_MAJOR_VERSION < 3
167     #undef CYTHON_USE_ASYNC_SLOTS
168     #define CYTHON_USE_ASYNC_SLOTS 0
169   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
170     #define CYTHON_USE_ASYNC_SLOTS 1
171   #endif
172   #if PY_VERSION_HEX < 0x02070000
173     #undef CYTHON_USE_PYLONG_INTERNALS
174     #define CYTHON_USE_PYLONG_INTERNALS 0
175   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
176     #define CYTHON_USE_PYLONG_INTERNALS 1
177   #endif
178   #ifndef CYTHON_USE_PYLIST_INTERNALS
179     #define CYTHON_USE_PYLIST_INTERNALS 1
180   #endif
181   #ifndef CYTHON_USE_UNICODE_INTERNALS
182     #define CYTHON_USE_UNICODE_INTERNALS 1
183   #endif
184   #if PY_VERSION_HEX < 0x030300F0
185     #undef CYTHON_USE_UNICODE_WRITER
186     #define CYTHON_USE_UNICODE_WRITER 0
187   #elif !defined(CYTHON_USE_UNICODE_WRITER)
188     #define CYTHON_USE_UNICODE_WRITER 1
189   #endif
190   #ifndef CYTHON_AVOID_BORROWED_REFS
191     #define CYTHON_AVOID_BORROWED_REFS 0
192   #endif
193   #ifndef CYTHON_ASSUME_SAFE_MACROS
194     #define CYTHON_ASSUME_SAFE_MACROS 1
195   #endif
196   #ifndef CYTHON_UNPACK_METHODS
197     #define CYTHON_UNPACK_METHODS 1
198   #endif
199   #ifndef CYTHON_FAST_THREAD_STATE
200     #define CYTHON_FAST_THREAD_STATE 1
201   #endif
202   #ifndef CYTHON_FAST_PYCALL
203     #define CYTHON_FAST_PYCALL 1
204   #endif
205   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
206     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
207   #endif
208   #ifndef CYTHON_USE_TP_FINALIZE
209     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
210   #endif
211   #ifndef CYTHON_USE_DICT_VERSIONS
212     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
213   #endif
214   #ifndef CYTHON_USE_EXC_INFO_STACK
215     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
216   #endif
217 #endif
218 #if !defined(CYTHON_FAST_PYCCALL)
219 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
220 #endif
221 #if CYTHON_USE_PYLONG_INTERNALS
222   #include "longintrepr.h"
223   #undef SHIFT
224   #undef BASE
225   #undef MASK
226   #ifdef SIZEOF_VOID_P
227     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
228   #endif
229 #endif
230 #ifndef __has_attribute
231   #define __has_attribute(x) 0
232 #endif
233 #ifndef __has_cpp_attribute
234   #define __has_cpp_attribute(x) 0
235 #endif
236 #ifndef CYTHON_RESTRICT
237   #if defined(__GNUC__)
238     #define CYTHON_RESTRICT __restrict__
239   #elif defined(_MSC_VER) && _MSC_VER >= 1400
240     #define CYTHON_RESTRICT __restrict
241   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
242     #define CYTHON_RESTRICT restrict
243   #else
244     #define CYTHON_RESTRICT
245   #endif
246 #endif
247 #ifndef CYTHON_UNUSED
248 # if defined(__GNUC__)
249 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
250 #     define CYTHON_UNUSED __attribute__ ((__unused__))
251 #   else
252 #     define CYTHON_UNUSED
253 #   endif
254 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
255 #   define CYTHON_UNUSED __attribute__ ((__unused__))
256 # else
257 #   define CYTHON_UNUSED
258 # endif
259 #endif
260 #ifndef CYTHON_MAYBE_UNUSED_VAR
261 #  if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)262      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
263 #  else
264 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
265 #  endif
266 #endif
267 #ifndef CYTHON_NCP_UNUSED
268 # if CYTHON_COMPILING_IN_CPYTHON
269 #  define CYTHON_NCP_UNUSED
270 # else
271 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
272 # endif
273 #endif
274 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
275 #ifdef _MSC_VER
276     #ifndef _MSC_STDINT_H_
277         #if _MSC_VER < 1300
278            typedef unsigned char     uint8_t;
279            typedef unsigned int      uint32_t;
280         #else
281            typedef unsigned __int8   uint8_t;
282            typedef unsigned __int32  uint32_t;
283         #endif
284     #endif
285 #else
286    #include <stdint.h>
287 #endif
288 #ifndef CYTHON_FALLTHROUGH
289   #if defined(__cplusplus) && __cplusplus >= 201103L
290     #if __has_cpp_attribute(fallthrough)
291       #define CYTHON_FALLTHROUGH [[fallthrough]]
292     #elif __has_cpp_attribute(clang::fallthrough)
293       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
294     #elif __has_cpp_attribute(gnu::fallthrough)
295       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
296     #endif
297   #endif
298   #ifndef CYTHON_FALLTHROUGH
299     #if __has_attribute(fallthrough)
300       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
301     #else
302       #define CYTHON_FALLTHROUGH
303     #endif
304   #endif
305   #if defined(__clang__ ) && defined(__apple_build_version__)
306     #if __apple_build_version__ < 7000000
307       #undef  CYTHON_FALLTHROUGH
308       #define CYTHON_FALLTHROUGH
309     #endif
310   #endif
311 #endif
312 
313 #ifndef __cplusplus
314   #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
315 #endif
316 #ifndef CYTHON_INLINE
317   #if defined(__clang__)
318     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
319   #else
320     #define CYTHON_INLINE inline
321   #endif
322 #endif
323 template<typename T>
__Pyx_call_destructor(T & x)324 void __Pyx_call_destructor(T& x) {
325     x.~T();
326 }
327 template<typename T>
328 class __Pyx_FakeReference {
329   public:
__Pyx_FakeReference()330     __Pyx_FakeReference() : ptr(NULL) { }
__Pyx_FakeReference(const T & ref)331     __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
operator ->()332     T *operator->() { return ptr; }
operator &()333     T *operator&() { return ptr; }
operator T&()334     operator T&() { return *ptr; }
operator ==(U other)335     template<typename U> bool operator ==(U other) { return *ptr == other; }
operator !=(U other)336     template<typename U> bool operator !=(U other) { return *ptr != other; }
337   private:
338     T *ptr;
339 };
340 
341 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
342   #define Py_OptimizeFlag 0
343 #endif
344 #define __PYX_BUILD_PY_SSIZE_T "n"
345 #define CYTHON_FORMAT_SSIZE_T "z"
346 #if PY_MAJOR_VERSION < 3
347   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
348   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
349           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
350   #define __Pyx_DefaultClassType PyClass_Type
351 #else
352   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
353 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
354   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
355           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
356 #else
357   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
358           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
359 #endif
360   #define __Pyx_DefaultClassType PyType_Type
361 #endif
362 #ifndef Py_TPFLAGS_CHECKTYPES
363   #define Py_TPFLAGS_CHECKTYPES 0
364 #endif
365 #ifndef Py_TPFLAGS_HAVE_INDEX
366   #define Py_TPFLAGS_HAVE_INDEX 0
367 #endif
368 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
369   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
370 #endif
371 #ifndef Py_TPFLAGS_HAVE_FINALIZE
372   #define Py_TPFLAGS_HAVE_FINALIZE 0
373 #endif
374 #ifndef METH_STACKLESS
375   #define METH_STACKLESS 0
376 #endif
377 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
378   #ifndef METH_FASTCALL
379      #define METH_FASTCALL 0x80
380   #endif
381   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
382   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
383                                                           Py_ssize_t nargs, PyObject *kwnames);
384 #else
385   #define __Pyx_PyCFunctionFast _PyCFunctionFast
386   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
387 #endif
388 #if CYTHON_FAST_PYCCALL
389 #define __Pyx_PyFastCFunction_Check(func)\
390     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
391 #else
392 #define __Pyx_PyFastCFunction_Check(func) 0
393 #endif
394 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
395   #define PyObject_Malloc(s)   PyMem_Malloc(s)
396   #define PyObject_Free(p)     PyMem_Free(p)
397   #define PyObject_Realloc(p)  PyMem_Realloc(p)
398 #endif
399 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
400   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
401   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
402   #define PyMem_RawFree(p)             PyMem_Free(p)
403 #endif
404 #if CYTHON_COMPILING_IN_PYSTON
405   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
406   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
407 #else
408   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
409   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
410 #endif
411 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
412   #define __Pyx_PyThreadState_Current PyThreadState_GET()
413 #elif PY_VERSION_HEX >= 0x03060000
414   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
415 #elif PY_VERSION_HEX >= 0x03000000
416   #define __Pyx_PyThreadState_Current PyThreadState_GET()
417 #else
418   #define __Pyx_PyThreadState_Current _PyThreadState_Current
419 #endif
420 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
421 #include "pythread.h"
422 #define Py_tss_NEEDS_INIT 0
423 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)424 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
425   *key = PyThread_create_key();
426   return 0;
427 }
PyThread_tss_alloc(void)428 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
429   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
430   *key = Py_tss_NEEDS_INIT;
431   return key;
432 }
PyThread_tss_free(Py_tss_t * key)433 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
434   PyObject_Free(key);
435 }
PyThread_tss_is_created(Py_tss_t * key)436 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
437   return *key != Py_tss_NEEDS_INIT;
438 }
PyThread_tss_delete(Py_tss_t * key)439 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
440   PyThread_delete_key(*key);
441   *key = Py_tss_NEEDS_INIT;
442 }
PyThread_tss_set(Py_tss_t * key,void * value)443 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
444   return PyThread_set_key_value(*key, value);
445 }
PyThread_tss_get(Py_tss_t * key)446 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
447   return PyThread_get_key_value(*key);
448 }
449 #endif
450 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
451 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
452 #else
453 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
454 #endif
455 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
456   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
457   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
458 #else
459   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
460   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
461 #endif
462 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
463 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
464 #else
465 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
466 #endif
467 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
468   #define CYTHON_PEP393_ENABLED 1
469   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
470                                               0 : _PyUnicode_Ready((PyObject *)(op)))
471   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
472   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
473   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
474   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
475   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
476   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
477   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
478   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
479 #else
480   #define CYTHON_PEP393_ENABLED 0
481   #define PyUnicode_1BYTE_KIND  1
482   #define PyUnicode_2BYTE_KIND  2
483   #define PyUnicode_4BYTE_KIND  4
484   #define __Pyx_PyUnicode_READY(op)       (0)
485   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
486   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
487   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
488   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
489   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
490   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
491   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
492   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
493 #endif
494 #if CYTHON_COMPILING_IN_PYPY
495   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
496   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
497 #else
498   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
499   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
500       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
501 #endif
502 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
503   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
504 #endif
505 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
506   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
507 #endif
508 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
509   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
510 #endif
511 #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))
512 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
513 #if PY_MAJOR_VERSION >= 3
514   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
515 #else
516   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
517 #endif
518 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
519   #define PyObject_ASCII(o)            PyObject_Repr(o)
520 #endif
521 #if PY_MAJOR_VERSION >= 3
522   #define PyBaseString_Type            PyUnicode_Type
523   #define PyStringObject               PyUnicodeObject
524   #define PyString_Type                PyUnicode_Type
525   #define PyString_Check               PyUnicode_Check
526   #define PyString_CheckExact          PyUnicode_CheckExact
527   #define PyObject_Unicode             PyObject_Str
528 #endif
529 #if PY_MAJOR_VERSION >= 3
530   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
531   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
532 #else
533   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
534   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
535 #endif
536 #ifndef PySet_CheckExact
537   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
538 #endif
539 #if CYTHON_ASSUME_SAFE_MACROS
540   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
541 #else
542   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
543 #endif
544 #if PY_MAJOR_VERSION >= 3
545   #define PyIntObject                  PyLongObject
546   #define PyInt_Type                   PyLong_Type
547   #define PyInt_Check(op)              PyLong_Check(op)
548   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
549   #define PyInt_FromString             PyLong_FromString
550   #define PyInt_FromUnicode            PyLong_FromUnicode
551   #define PyInt_FromLong               PyLong_FromLong
552   #define PyInt_FromSize_t             PyLong_FromSize_t
553   #define PyInt_FromSsize_t            PyLong_FromSsize_t
554   #define PyInt_AsLong                 PyLong_AsLong
555   #define PyInt_AS_LONG                PyLong_AS_LONG
556   #define PyInt_AsSsize_t              PyLong_AsSsize_t
557   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
558   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
559   #define PyNumber_Int                 PyNumber_Long
560 #endif
561 #if PY_MAJOR_VERSION >= 3
562   #define PyBoolObject                 PyLongObject
563 #endif
564 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
565   #ifndef PyUnicode_InternFromString
566     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
567   #endif
568 #endif
569 #if PY_VERSION_HEX < 0x030200A4
570   typedef long Py_hash_t;
571   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
572   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
573 #else
574   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
575   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
576 #endif
577 #if PY_MAJOR_VERSION >= 3
578   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
579 #else
580   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
581 #endif
582 #if CYTHON_USE_ASYNC_SLOTS
583   #if PY_VERSION_HEX >= 0x030500B1
584     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
585     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
586   #else
587     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
588   #endif
589 #else
590   #define __Pyx_PyType_AsAsync(obj) NULL
591 #endif
592 #ifndef __Pyx_PyAsyncMethodsStruct
593     typedef struct {
594         unaryfunc am_await;
595         unaryfunc am_aiter;
596         unaryfunc am_anext;
597     } __Pyx_PyAsyncMethodsStruct;
598 #endif
599 
600 #if defined(WIN32) || defined(MS_WINDOWS)
601   #define _USE_MATH_DEFINES
602 #endif
603 #include <math.h>
604 #ifdef NAN
605 #define __PYX_NAN() ((float) NAN)
606 #else
__PYX_NAN()607 static CYTHON_INLINE float __PYX_NAN() {
608   float value;
609   memset(&value, 0xFF, sizeof(value));
610   return value;
611 }
612 #endif
613 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
614 #define __Pyx_truncl trunc
615 #else
616 #define __Pyx_truncl truncl
617 #endif
618 
619 
620 #define __PYX_ERR(f_index, lineno, Ln_error) \
621 { \
622   __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
623 }
624 
625 #ifndef __PYX_EXTERN_C
626   #ifdef __cplusplus
627     #define __PYX_EXTERN_C extern "C"
628   #else
629     #define __PYX_EXTERN_C extern
630   #endif
631 #endif
632 
633 #define __PYX_HAVE__yt__utilities__lib__cykdtree__utils
634 #define __PYX_HAVE_API__yt__utilities__lib__cykdtree__utils
635 /* Early includes */
636 #include <string.h>
637 #include <stdio.h>
638 #include "numpy/arrayobject.h"
639 #include "numpy/ufuncobject.h"
640 #include <stdint.h>
641 #include "ios"
642 #include "new"
643 #include "stdexcept"
644 #include "typeinfo"
645 #include <utility>
646 #include <vector>
647 #include "c_utils.hpp"
648 #include "pythread.h"
649 #include <stdlib.h>
650 #include "pystate.h"
651 #ifdef _OPENMP
652 #include <omp.h>
653 #endif /* _OPENMP */
654 
655 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
656 #define CYTHON_WITHOUT_ASSERTIONS
657 #endif
658 
659 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
660                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
661 
662 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
663 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
664 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
665 #define __PYX_DEFAULT_STRING_ENCODING ""
666 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
667 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
668 #define __Pyx_uchar_cast(c) ((unsigned char)c)
669 #define __Pyx_long_cast(x) ((long)x)
670 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
671     (sizeof(type) < sizeof(Py_ssize_t))  ||\
672     (sizeof(type) > sizeof(Py_ssize_t) &&\
673           likely(v < (type)PY_SSIZE_T_MAX ||\
674                  v == (type)PY_SSIZE_T_MAX)  &&\
675           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
676                                 v == (type)PY_SSIZE_T_MIN)))  ||\
677     (sizeof(type) == sizeof(Py_ssize_t) &&\
678           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
679                                v == (type)PY_SSIZE_T_MAX)))  )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)680 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
681     return (size_t) i < (size_t) limit;
682 }
683 #if defined (__cplusplus) && __cplusplus >= 201103L
684     #include <cstdlib>
685     #define __Pyx_sst_abs(value) std::abs(value)
686 #elif SIZEOF_INT >= SIZEOF_SIZE_T
687     #define __Pyx_sst_abs(value) abs(value)
688 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
689     #define __Pyx_sst_abs(value) labs(value)
690 #elif defined (_MSC_VER)
691     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
692 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
693     #define __Pyx_sst_abs(value) llabs(value)
694 #elif defined (__GNUC__)
695     #define __Pyx_sst_abs(value) __builtin_llabs(value)
696 #else
697     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
698 #endif
699 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
700 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
701 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
702 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
703 #define __Pyx_PyBytes_FromString        PyBytes_FromString
704 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
705 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
706 #if PY_MAJOR_VERSION < 3
707     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
708     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
709 #else
710     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
711     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
712 #endif
713 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
714 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
715 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
716 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
717 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
718 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
719 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
720 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
721 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
722 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
723 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
724 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
725 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
726 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
727 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
728 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)729 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
730     const Py_UNICODE *u_end = u;
731     while (*u_end++) ;
732     return (size_t)(u_end - u - 1);
733 }
734 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
735 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
736 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
737 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
738 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
739 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
740 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
741 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
742 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
743 #define __Pyx_PySequence_Tuple(obj)\
744     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
745 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
746 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
747 #if CYTHON_ASSUME_SAFE_MACROS
748 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
749 #else
750 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
751 #endif
752 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
753 #if PY_MAJOR_VERSION >= 3
754 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
755 #else
756 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
757 #endif
758 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
759 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
760 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)761 static int __Pyx_init_sys_getdefaultencoding_params(void) {
762     PyObject* sys;
763     PyObject* default_encoding = NULL;
764     PyObject* ascii_chars_u = NULL;
765     PyObject* ascii_chars_b = NULL;
766     const char* default_encoding_c;
767     sys = PyImport_ImportModule("sys");
768     if (!sys) goto bad;
769     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
770     Py_DECREF(sys);
771     if (!default_encoding) goto bad;
772     default_encoding_c = PyBytes_AsString(default_encoding);
773     if (!default_encoding_c) goto bad;
774     if (strcmp(default_encoding_c, "ascii") == 0) {
775         __Pyx_sys_getdefaultencoding_not_ascii = 0;
776     } else {
777         char ascii_chars[128];
778         int c;
779         for (c = 0; c < 128; c++) {
780             ascii_chars[c] = c;
781         }
782         __Pyx_sys_getdefaultencoding_not_ascii = 1;
783         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
784         if (!ascii_chars_u) goto bad;
785         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
786         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
787             PyErr_Format(
788                 PyExc_ValueError,
789                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
790                 default_encoding_c);
791             goto bad;
792         }
793         Py_DECREF(ascii_chars_u);
794         Py_DECREF(ascii_chars_b);
795     }
796     Py_DECREF(default_encoding);
797     return 0;
798 bad:
799     Py_XDECREF(default_encoding);
800     Py_XDECREF(ascii_chars_u);
801     Py_XDECREF(ascii_chars_b);
802     return -1;
803 }
804 #endif
805 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
806 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
807 #else
808 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
809 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
810 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)811 static int __Pyx_init_sys_getdefaultencoding_params(void) {
812     PyObject* sys;
813     PyObject* default_encoding = NULL;
814     char* default_encoding_c;
815     sys = PyImport_ImportModule("sys");
816     if (!sys) goto bad;
817     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
818     Py_DECREF(sys);
819     if (!default_encoding) goto bad;
820     default_encoding_c = PyBytes_AsString(default_encoding);
821     if (!default_encoding_c) goto bad;
822     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
823     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
824     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
825     Py_DECREF(default_encoding);
826     return 0;
827 bad:
828     Py_XDECREF(default_encoding);
829     return -1;
830 }
831 #endif
832 #endif
833 
834 
835 /* Test for GCC > 2.95 */
836 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
837   #define likely(x)   __builtin_expect(!!(x), 1)
838   #define unlikely(x) __builtin_expect(!!(x), 0)
839 #else /* !__GNUC__ or GCC < 2.95 */
840   #define likely(x)   (x)
841   #define unlikely(x) (x)
842 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)843 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
844 
845 static PyObject *__pyx_m = NULL;
846 static PyObject *__pyx_d;
847 static PyObject *__pyx_b;
848 static PyObject *__pyx_cython_runtime = NULL;
849 static PyObject *__pyx_empty_tuple;
850 static PyObject *__pyx_empty_bytes;
851 static PyObject *__pyx_empty_unicode;
852 static int __pyx_lineno;
853 static int __pyx_clineno = 0;
854 static const char * __pyx_cfilenm= __FILE__;
855 static const char *__pyx_filename;
856 
857 /* Header.proto */
858 #if !defined(CYTHON_CCOMPLEX)
859   #if defined(__cplusplus)
860     #define CYTHON_CCOMPLEX 1
861   #elif defined(_Complex_I)
862     #define CYTHON_CCOMPLEX 1
863   #else
864     #define CYTHON_CCOMPLEX 0
865   #endif
866 #endif
867 #if CYTHON_CCOMPLEX
868   #ifdef __cplusplus
869     #include <complex>
870   #else
871     #include <complex.h>
872   #endif
873 #endif
874 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
875   #undef _Complex_I
876   #define _Complex_I 1.0fj
877 #endif
878 
879 
880 static const char *__pyx_f[] = {
881   "yt/utilities/lib/cykdtree/utils.pyx",
882   "__init__.pxd",
883   "stringsource",
884   "type.pxd",
885 };
886 /* BufferFormatStructs.proto */
887 #define IS_UNSIGNED(type) (((type) -1) > 0)
888 struct __Pyx_StructField_;
889 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
890 typedef struct {
891   const char* name;
892   struct __Pyx_StructField_* fields;
893   size_t size;
894   size_t arraysize[8];
895   int ndim;
896   char typegroup;
897   char is_unsigned;
898   int flags;
899 } __Pyx_TypeInfo;
900 typedef struct __Pyx_StructField_ {
901   __Pyx_TypeInfo* type;
902   const char* name;
903   size_t offset;
904 } __Pyx_StructField;
905 typedef struct {
906   __Pyx_StructField* field;
907   size_t parent_offset;
908 } __Pyx_BufFmt_StackElem;
909 typedef struct {
910   __Pyx_StructField root;
911   __Pyx_BufFmt_StackElem* head;
912   size_t fmt_offset;
913   size_t new_count, enc_count;
914   size_t struct_alignment;
915   int is_complex;
916   char enc_type;
917   char new_packmode;
918   char enc_packmode;
919   char is_valid_array;
920 } __Pyx_BufFmt_Context;
921 
922 /* MemviewSliceStruct.proto */
923 struct __pyx_memoryview_obj;
924 typedef struct {
925   struct __pyx_memoryview_obj *memview;
926   char *data;
927   Py_ssize_t shape[8];
928   Py_ssize_t strides[8];
929   Py_ssize_t suboffsets[8];
930 } __Pyx_memviewslice;
931 #define __Pyx_MemoryView_Len(m)  (m.shape[0])
932 
933 /* Atomics.proto */
934 #include <pythread.h>
935 #ifndef CYTHON_ATOMICS
936     #define CYTHON_ATOMICS 1
937 #endif
938 #define __pyx_atomic_int_type int
939 #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
940                     (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
941                     !defined(__i386__)
942     #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
943     #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
944     #ifdef __PYX_DEBUG_ATOMICS
945         #warning "Using GNU atomics"
946     #endif
947 #elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
948     #include <Windows.h>
949     #undef __pyx_atomic_int_type
950     #define __pyx_atomic_int_type LONG
951     #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
952     #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
953     #ifdef __PYX_DEBUG_ATOMICS
954         #pragma message ("Using MSVC atomics")
955     #endif
956 #elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
957     #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
958     #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
959     #ifdef __PYX_DEBUG_ATOMICS
960         #warning "Using Intel atomics"
961     #endif
962 #else
963     #undef CYTHON_ATOMICS
964     #define CYTHON_ATOMICS 0
965     #ifdef __PYX_DEBUG_ATOMICS
966         #warning "Not using atomics"
967     #endif
968 #endif
969 typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
970 #if CYTHON_ATOMICS
971     #define __pyx_add_acquisition_count(memview)\
972              __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
973     #define __pyx_sub_acquisition_count(memview)\
974             __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
975 #else
976     #define __pyx_add_acquisition_count(memview)\
977             __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
978     #define __pyx_sub_acquisition_count(memview)\
979             __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
980 #endif
981 
982 /* ForceInitThreads.proto */
983 #ifndef __PYX_FORCE_INIT_THREADS
984   #define __PYX_FORCE_INIT_THREADS 0
985 #endif
986 
987 /* NoFastGil.proto */
988 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
989 #define __Pyx_PyGILState_Release PyGILState_Release
990 #define __Pyx_FastGIL_Remember()
991 #define __Pyx_FastGIL_Forget()
992 #define __Pyx_FastGilFuncInit()
993 
994 
995 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":776
996  * # in Cython to enable them only on the right systems.
997  *
998  * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
999  * ctypedef npy_int16      int16_t
1000  * ctypedef npy_int32      int32_t
1001  */
1002 typedef npy_int8 __pyx_t_5numpy_int8_t;
1003 
1004 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":777
1005  *
1006  * ctypedef npy_int8       int8_t
1007  * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
1008  * ctypedef npy_int32      int32_t
1009  * ctypedef npy_int64      int64_t
1010  */
1011 typedef npy_int16 __pyx_t_5numpy_int16_t;
1012 
1013 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":778
1014  * ctypedef npy_int8       int8_t
1015  * ctypedef npy_int16      int16_t
1016  * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
1017  * ctypedef npy_int64      int64_t
1018  * #ctypedef npy_int96      int96_t
1019  */
1020 typedef npy_int32 __pyx_t_5numpy_int32_t;
1021 
1022 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":779
1023  * ctypedef npy_int16      int16_t
1024  * ctypedef npy_int32      int32_t
1025  * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
1026  * #ctypedef npy_int96      int96_t
1027  * #ctypedef npy_int128     int128_t
1028  */
1029 typedef npy_int64 __pyx_t_5numpy_int64_t;
1030 
1031 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":783
1032  * #ctypedef npy_int128     int128_t
1033  *
1034  * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
1035  * ctypedef npy_uint16     uint16_t
1036  * ctypedef npy_uint32     uint32_t
1037  */
1038 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1039 
1040 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":784
1041  *
1042  * ctypedef npy_uint8      uint8_t
1043  * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
1044  * ctypedef npy_uint32     uint32_t
1045  * ctypedef npy_uint64     uint64_t
1046  */
1047 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1048 
1049 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":785
1050  * ctypedef npy_uint8      uint8_t
1051  * ctypedef npy_uint16     uint16_t
1052  * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
1053  * ctypedef npy_uint64     uint64_t
1054  * #ctypedef npy_uint96     uint96_t
1055  */
1056 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1057 
1058 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":786
1059  * ctypedef npy_uint16     uint16_t
1060  * ctypedef npy_uint32     uint32_t
1061  * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
1062  * #ctypedef npy_uint96     uint96_t
1063  * #ctypedef npy_uint128    uint128_t
1064  */
1065 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1066 
1067 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":790
1068  * #ctypedef npy_uint128    uint128_t
1069  *
1070  * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
1071  * ctypedef npy_float64    float64_t
1072  * #ctypedef npy_float80    float80_t
1073  */
1074 typedef npy_float32 __pyx_t_5numpy_float32_t;
1075 
1076 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":791
1077  *
1078  * ctypedef npy_float32    float32_t
1079  * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
1080  * #ctypedef npy_float80    float80_t
1081  * #ctypedef npy_float128   float128_t
1082  */
1083 typedef npy_float64 __pyx_t_5numpy_float64_t;
1084 
1085 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":800
1086  * # The int types are mapped a bit surprising --
1087  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1088  * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
1089  * ctypedef npy_longlong   long_t
1090  * ctypedef npy_longlong   longlong_t
1091  */
1092 typedef npy_long __pyx_t_5numpy_int_t;
1093 
1094 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":801
1095  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1096  * ctypedef npy_long       int_t
1097  * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
1098  * ctypedef npy_longlong   longlong_t
1099  *
1100  */
1101 typedef npy_longlong __pyx_t_5numpy_long_t;
1102 
1103 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":802
1104  * ctypedef npy_long       int_t
1105  * ctypedef npy_longlong   long_t
1106  * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
1107  *
1108  * ctypedef npy_ulong      uint_t
1109  */
1110 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1111 
1112 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":804
1113  * ctypedef npy_longlong   longlong_t
1114  *
1115  * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
1116  * ctypedef npy_ulonglong  ulong_t
1117  * ctypedef npy_ulonglong  ulonglong_t
1118  */
1119 typedef npy_ulong __pyx_t_5numpy_uint_t;
1120 
1121 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":805
1122  *
1123  * ctypedef npy_ulong      uint_t
1124  * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
1125  * ctypedef npy_ulonglong  ulonglong_t
1126  *
1127  */
1128 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1129 
1130 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":806
1131  * ctypedef npy_ulong      uint_t
1132  * ctypedef npy_ulonglong  ulong_t
1133  * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
1134  *
1135  * ctypedef npy_intp       intp_t
1136  */
1137 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1138 
1139 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":808
1140  * ctypedef npy_ulonglong  ulonglong_t
1141  *
1142  * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
1143  * ctypedef npy_uintp      uintp_t
1144  *
1145  */
1146 typedef npy_intp __pyx_t_5numpy_intp_t;
1147 
1148 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":809
1149  *
1150  * ctypedef npy_intp       intp_t
1151  * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
1152  *
1153  * ctypedef npy_double     float_t
1154  */
1155 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1156 
1157 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":811
1158  * ctypedef npy_uintp      uintp_t
1159  *
1160  * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
1161  * ctypedef npy_double     double_t
1162  * ctypedef npy_longdouble longdouble_t
1163  */
1164 typedef npy_double __pyx_t_5numpy_float_t;
1165 
1166 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":812
1167  *
1168  * ctypedef npy_double     float_t
1169  * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
1170  * ctypedef npy_longdouble longdouble_t
1171  *
1172  */
1173 typedef npy_double __pyx_t_5numpy_double_t;
1174 
1175 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":813
1176  * ctypedef npy_double     float_t
1177  * ctypedef npy_double     double_t
1178  * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
1179  *
1180  * ctypedef npy_cfloat      cfloat_t
1181  */
1182 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1183 /* Declarations.proto */
1184 #if CYTHON_CCOMPLEX
1185   #ifdef __cplusplus
1186     typedef ::std::complex< float > __pyx_t_float_complex;
1187   #else
1188     typedef float _Complex __pyx_t_float_complex;
1189   #endif
1190 #else
1191     typedef struct { float real, imag; } __pyx_t_float_complex;
1192 #endif
1193 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1194 
1195 /* Declarations.proto */
1196 #if CYTHON_CCOMPLEX
1197   #ifdef __cplusplus
1198     typedef ::std::complex< double > __pyx_t_double_complex;
1199   #else
1200     typedef double _Complex __pyx_t_double_complex;
1201   #endif
1202 #else
1203     typedef struct { double real, imag; } __pyx_t_double_complex;
1204 #endif
1205 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1206 
1207 
1208 /*--- Type declarations ---*/
1209 struct __pyx_array_obj;
1210 struct __pyx_MemviewEnum_obj;
1211 struct __pyx_memoryview_obj;
1212 struct __pyx_memoryviewslice_obj;
1213 
1214 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":815
1215  * ctypedef npy_longdouble longdouble_t
1216  *
1217  * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
1218  * ctypedef npy_cdouble     cdouble_t
1219  * ctypedef npy_clongdouble clongdouble_t
1220  */
1221 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1222 
1223 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":816
1224  *
1225  * ctypedef npy_cfloat      cfloat_t
1226  * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
1227  * ctypedef npy_clongdouble clongdouble_t
1228  *
1229  */
1230 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1231 
1232 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":817
1233  * ctypedef npy_cfloat      cfloat_t
1234  * ctypedef npy_cdouble     cdouble_t
1235  * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
1236  *
1237  * ctypedef npy_cdouble     complex_t
1238  */
1239 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1240 
1241 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":819
1242  * ctypedef npy_clongdouble clongdouble_t
1243  *
1244  * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
1245  *
1246  * cdef inline object PyArray_MultiIterNew1(a):
1247  */
1248 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1249 
1250 /* "View.MemoryView":105
1251  *
1252  * @cname("__pyx_array")
1253  * cdef class array:             # <<<<<<<<<<<<<<
1254  *
1255  *     cdef:
1256  */
1257 struct __pyx_array_obj {
1258   PyObject_HEAD
1259   struct __pyx_vtabstruct_array *__pyx_vtab;
1260   char *data;
1261   Py_ssize_t len;
1262   char *format;
1263   int ndim;
1264   Py_ssize_t *_shape;
1265   Py_ssize_t *_strides;
1266   Py_ssize_t itemsize;
1267   PyObject *mode;
1268   PyObject *_format;
1269   void (*callback_free_data)(void *);
1270   int free_data;
1271   int dtype_is_object;
1272 };
1273 
1274 
1275 /* "View.MemoryView":279
1276  *
1277  * @cname('__pyx_MemviewEnum')
1278  * cdef class Enum(object):             # <<<<<<<<<<<<<<
1279  *     cdef object name
1280  *     def __init__(self, name):
1281  */
1282 struct __pyx_MemviewEnum_obj {
1283   PyObject_HEAD
1284   PyObject *name;
1285 };
1286 
1287 
1288 /* "View.MemoryView":330
1289  *
1290  * @cname('__pyx_memoryview')
1291  * cdef class memoryview(object):             # <<<<<<<<<<<<<<
1292  *
1293  *     cdef object obj
1294  */
1295 struct __pyx_memoryview_obj {
1296   PyObject_HEAD
1297   struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1298   PyObject *obj;
1299   PyObject *_size;
1300   PyObject *_array_interface;
1301   PyThread_type_lock lock;
1302   __pyx_atomic_int acquisition_count[2];
1303   __pyx_atomic_int *acquisition_count_aligned_p;
1304   Py_buffer view;
1305   int flags;
1306   int dtype_is_object;
1307   __Pyx_TypeInfo *typeinfo;
1308 };
1309 
1310 
1311 /* "View.MemoryView":961
1312  *
1313  * @cname('__pyx_memoryviewslice')
1314  * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
1315  *     "Internal class for passing memoryview slices to Python"
1316  *
1317  */
1318 struct __pyx_memoryviewslice_obj {
1319   struct __pyx_memoryview_obj __pyx_base;
1320   __Pyx_memviewslice from_slice;
1321   PyObject *from_object;
1322   PyObject *(*to_object_func)(char *);
1323   int (*to_dtype_func)(char *, PyObject *);
1324 };
1325 
1326 
1327 
1328 /* "View.MemoryView":105
1329  *
1330  * @cname("__pyx_array")
1331  * cdef class array:             # <<<<<<<<<<<<<<
1332  *
1333  *     cdef:
1334  */
1335 
1336 struct __pyx_vtabstruct_array {
1337   PyObject *(*get_memview)(struct __pyx_array_obj *);
1338 };
1339 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1340 
1341 
1342 /* "View.MemoryView":330
1343  *
1344  * @cname('__pyx_memoryview')
1345  * cdef class memoryview(object):             # <<<<<<<<<<<<<<
1346  *
1347  *     cdef object obj
1348  */
1349 
1350 struct __pyx_vtabstruct_memoryview {
1351   char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
1352   PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
1353   PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1354   PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
1355   PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1356   PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
1357   PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
1358 };
1359 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1360 
1361 
1362 /* "View.MemoryView":961
1363  *
1364  * @cname('__pyx_memoryviewslice')
1365  * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
1366  *     "Internal class for passing memoryview slices to Python"
1367  *
1368  */
1369 
1370 struct __pyx_vtabstruct__memoryviewslice {
1371   struct __pyx_vtabstruct_memoryview __pyx_base;
1372 };
1373 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1374 
1375 /* --- Runtime support code (head) --- */
1376 /* Refnanny.proto */
1377 #ifndef CYTHON_REFNANNY
1378   #define CYTHON_REFNANNY 0
1379 #endif
1380 #if CYTHON_REFNANNY
1381   typedef struct {
1382     void (*INCREF)(void*, PyObject*, int);
1383     void (*DECREF)(void*, PyObject*, int);
1384     void (*GOTREF)(void*, PyObject*, int);
1385     void (*GIVEREF)(void*, PyObject*, int);
1386     void* (*SetupContext)(const char*, int, const char*);
1387     void (*FinishContext)(void**);
1388   } __Pyx_RefNannyAPIStruct;
1389   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1390   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1391   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1392 #ifdef WITH_THREAD
1393   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1394           if (acquire_gil) {\
1395               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1396               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1397               PyGILState_Release(__pyx_gilstate_save);\
1398           } else {\
1399               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1400           }
1401 #else
1402   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1403           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1404 #endif
1405   #define __Pyx_RefNannyFinishContext()\
1406           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1407   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1408   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1409   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1410   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1411   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1412   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1413   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1414   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1415 #else
1416   #define __Pyx_RefNannyDeclarations
1417   #define __Pyx_RefNannySetupContext(name, acquire_gil)
1418   #define __Pyx_RefNannyFinishContext()
1419   #define __Pyx_INCREF(r) Py_INCREF(r)
1420   #define __Pyx_DECREF(r) Py_DECREF(r)
1421   #define __Pyx_GOTREF(r)
1422   #define __Pyx_GIVEREF(r)
1423   #define __Pyx_XINCREF(r) Py_XINCREF(r)
1424   #define __Pyx_XDECREF(r) Py_XDECREF(r)
1425   #define __Pyx_XGOTREF(r)
1426   #define __Pyx_XGIVEREF(r)
1427 #endif
1428 #define __Pyx_XDECREF_SET(r, v) do {\
1429         PyObject *tmp = (PyObject *) r;\
1430         r = v; __Pyx_XDECREF(tmp);\
1431     } while (0)
1432 #define __Pyx_DECREF_SET(r, v) do {\
1433         PyObject *tmp = (PyObject *) r;\
1434         r = v; __Pyx_DECREF(tmp);\
1435     } while (0)
1436 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1437 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1438 
1439 /* PyObjectGetAttrStr.proto */
1440 #if CYTHON_USE_TYPE_SLOTS
1441 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1442 #else
1443 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1444 #endif
1445 
1446 /* GetBuiltinName.proto */
1447 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1448 
1449 /* ArgTypeTest.proto */
1450 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1451     ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1452         __Pyx__ArgTypeTest(obj, type, name, exact))
1453 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1454 
1455 /* IsLittleEndian.proto */
1456 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
1457 
1458 /* BufferFormatCheck.proto */
1459 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
1460 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
1461                               __Pyx_BufFmt_StackElem* stack,
1462                               __Pyx_TypeInfo* type);
1463 
1464 /* BufferGetAndValidate.proto */
1465 #define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
1466     ((obj == Py_None || obj == NULL) ?\
1467     (__Pyx_ZeroBuffer(buf), 0) :\
1468     __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
1469 static int  __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
1470     __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
1471 static void __Pyx_ZeroBuffer(Py_buffer* buf);
1472 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
1473 static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
1474 static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
1475 
1476 /* BufferIndexError.proto */
1477 static void __Pyx_RaiseBufferIndexError(int axis);
1478 
1479 #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
1480 /* PyDictVersioning.proto */
1481 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1482 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1483 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1484 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1485     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1486     (cache_var) = (value);
1487 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1488     static PY_UINT64_T __pyx_dict_version = 0;\
1489     static PyObject *__pyx_dict_cached_value = NULL;\
1490     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1491         (VAR) = __pyx_dict_cached_value;\
1492     } else {\
1493         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1494         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1495     }\
1496 }
1497 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1498 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1499 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1500 #else
1501 #define __PYX_GET_DICT_VERSION(dict)  (0)
1502 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1503 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1504 #endif
1505 
1506 /* GetModuleGlobalName.proto */
1507 #if CYTHON_USE_DICT_VERSIONS
1508 #define __Pyx_GetModuleGlobalName(var, name)  {\
1509     static PY_UINT64_T __pyx_dict_version = 0;\
1510     static PyObject *__pyx_dict_cached_value = NULL;\
1511     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1512         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1513         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1514 }
1515 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1516     PY_UINT64_T __pyx_dict_version;\
1517     PyObject *__pyx_dict_cached_value;\
1518     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1519 }
1520 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1521 #else
1522 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1523 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1524 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1525 #endif
1526 
1527 /* PyFunctionFastCall.proto */
1528 #if CYTHON_FAST_PYCALL
1529 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1530     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1531 #if 1 || PY_VERSION_HEX < 0x030600B1
1532 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1533 #else
1534 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1535 #endif
1536 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1537     (sizeof(char [1 - 2*!(cond)]) - 1)
1538 #ifndef Py_MEMBER_SIZE
1539 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1540 #endif
1541   static size_t __pyx_pyframe_localsplus_offset = 0;
1542   #include "frameobject.h"
1543   #define __Pxy_PyFrame_Initialize_Offsets()\
1544     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1545      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1546   #define __Pyx_PyFrame_GetLocalsplus(frame)\
1547     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1548 #endif
1549 
1550 /* PyCFunctionFastCall.proto */
1551 #if CYTHON_FAST_PYCCALL
1552 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1553 #else
1554 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1555 #endif
1556 
1557 /* PyObjectCall.proto */
1558 #if CYTHON_COMPILING_IN_CPYTHON
1559 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1560 #else
1561 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1562 #endif
1563 
1564 /* ExtTypeTest.proto */
1565 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1566 
1567 #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
1568 /* PyThreadStateGet.proto */
1569 #if CYTHON_FAST_THREAD_STATE
1570 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
1571 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
1572 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
1573 #else
1574 #define __Pyx_PyThreadState_declare
1575 #define __Pyx_PyThreadState_assign
1576 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
1577 #endif
1578 
1579 /* PyErrFetchRestore.proto */
1580 #if CYTHON_FAST_THREAD_STATE
1581 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1582 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1583 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1584 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1585 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1586 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1587 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1588 #if CYTHON_COMPILING_IN_CPYTHON
1589 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1590 #else
1591 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1592 #endif
1593 #else
1594 #define __Pyx_PyErr_Clear() PyErr_Clear()
1595 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1596 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
1597 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
1598 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
1599 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
1600 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
1601 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
1602 #endif
1603 
1604 /* RaiseArgTupleInvalid.proto */
1605 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1606     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1607 
1608 /* RaiseDoubleKeywords.proto */
1609 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1610 
1611 /* ParseKeywords.proto */
1612 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1613     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1614     const char* function_name);
1615 
1616 /* PyObjectCallMethO.proto */
1617 #if CYTHON_COMPILING_IN_CPYTHON
1618 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1619 #endif
1620 
1621 /* PyObjectCallOneArg.proto */
1622 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1623 
1624 /* RaiseException.proto */
1625 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1626 
1627 /* MemviewSliceInit.proto */
1628 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
1629 #define __Pyx_MEMVIEW_DIRECT   1
1630 #define __Pyx_MEMVIEW_PTR      2
1631 #define __Pyx_MEMVIEW_FULL     4
1632 #define __Pyx_MEMVIEW_CONTIG   8
1633 #define __Pyx_MEMVIEW_STRIDED  16
1634 #define __Pyx_MEMVIEW_FOLLOW   32
1635 #define __Pyx_IS_C_CONTIG 1
1636 #define __Pyx_IS_F_CONTIG 2
1637 static int __Pyx_init_memviewslice(
1638                 struct __pyx_memoryview_obj *memview,
1639                 int ndim,
1640                 __Pyx_memviewslice *memviewslice,
1641                 int memview_is_new_reference);
1642 static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
1643     __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1644 static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
1645     __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1646 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
1647 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
1648 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
1649 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
1650 static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
1651 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
1652 
1653 /* PyObjectCall2Args.proto */
1654 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1655 
1656 /* BufferFallbackError.proto */
1657 static void __Pyx_RaiseBufferFallbackError(void);
1658 
1659 /* DictGetItem.proto */
1660 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1661 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1662 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1663     (likely(PyDict_CheckExact(obj)) ?\
1664      __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1665 #else
1666 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1667 #define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
1668 #endif
1669 
1670 /* RaiseTooManyValuesToUnpack.proto */
1671 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1672 
1673 /* RaiseNeedMoreValuesToUnpack.proto */
1674 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1675 
1676 /* RaiseNoneIterError.proto */
1677 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1678 
1679 /* GetTopmostException.proto */
1680 #if CYTHON_USE_EXC_INFO_STACK
1681 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1682 #endif
1683 
1684 /* SaveResetException.proto */
1685 #if CYTHON_FAST_THREAD_STATE
1686 #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1687 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1688 #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1689 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1690 #else
1691 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1692 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1693 #endif
1694 
1695 /* PyErrExceptionMatches.proto */
1696 #if CYTHON_FAST_THREAD_STATE
1697 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1698 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1699 #else
1700 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1701 #endif
1702 
1703 /* GetException.proto */
1704 #if CYTHON_FAST_THREAD_STATE
1705 #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
1706 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1707 #else
1708 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1709 #endif
1710 
1711 /* IncludeStringH.proto */
1712 #include <string.h>
1713 
1714 /* BytesEquals.proto */
1715 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1716 
1717 /* UnicodeEquals.proto */
1718 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1719 
1720 /* StrEquals.proto */
1721 #if PY_MAJOR_VERSION >= 3
1722 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1723 #else
1724 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1725 #endif
1726 
1727 /* None.proto */
1728 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
1729 
1730 /* UnaryNegOverflows.proto */
1731 #define UNARY_NEG_WOULD_OVERFLOW(x)\
1732         (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1733 
1734 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1735 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
1736 /* GetAttr.proto */
1737 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1738 
1739 /* GetItemInt.proto */
1740 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1741     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1742     __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1743     (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1744                __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1745 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1746     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1747     __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1748     (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1749 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1750                                                               int wraparound, int boundscheck);
1751 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1752     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1753     __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1754     (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1755 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1756                                                               int wraparound, int boundscheck);
1757 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1758 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1759                                                      int is_list, int wraparound, int boundscheck);
1760 
1761 /* ObjectGetItem.proto */
1762 #if CYTHON_USE_TYPE_SLOTS
1763 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1764 #else
1765 #define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
1766 #endif
1767 
1768 /* decode_c_string_utf16.proto */
__Pyx_PyUnicode_DecodeUTF16(const char * s,Py_ssize_t size,const char * errors)1769 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
1770     int byteorder = 0;
1771     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1772 }
__Pyx_PyUnicode_DecodeUTF16LE(const char * s,Py_ssize_t size,const char * errors)1773 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
1774     int byteorder = -1;
1775     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1776 }
__Pyx_PyUnicode_DecodeUTF16BE(const char * s,Py_ssize_t size,const char * errors)1777 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
1778     int byteorder = 1;
1779     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1780 }
1781 
1782 /* decode_c_string.proto */
1783 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
1784          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
1785          const char* encoding, const char* errors,
1786          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
1787 
1788 /* GetAttr3.proto */
1789 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1790 
1791 /* SwapException.proto */
1792 #if CYTHON_FAST_THREAD_STATE
1793 #define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1794 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1795 #else
1796 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1797 #endif
1798 
1799 /* Import.proto */
1800 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1801 
1802 /* FastTypeChecks.proto */
1803 #if CYTHON_COMPILING_IN_CPYTHON
1804 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1805 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1806 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1807 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1808 #else
1809 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1810 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1811 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1812 #endif
1813 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1814 
1815 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1816 /* ListCompAppend.proto */
1817 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_ListComp_Append(PyObject * list,PyObject * x)1818 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1819     PyListObject* L = (PyListObject*) list;
1820     Py_ssize_t len = Py_SIZE(list);
1821     if (likely(L->allocated > len)) {
1822         Py_INCREF(x);
1823         PyList_SET_ITEM(list, len, x);
1824         Py_SIZE(list) = len+1;
1825         return 0;
1826     }
1827     return PyList_Append(list, x);
1828 }
1829 #else
1830 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1831 #endif
1832 
1833 /* PyIntBinop.proto */
1834 #if !CYTHON_COMPILING_IN_PYPY
1835 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1836 #else
1837 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1838     (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1839 #endif
1840 
1841 /* ListExtend.proto */
__Pyx_PyList_Extend(PyObject * L,PyObject * v)1842 static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
1843 #if CYTHON_COMPILING_IN_CPYTHON
1844     PyObject* none = _PyList_Extend((PyListObject*)L, v);
1845     if (unlikely(!none))
1846         return -1;
1847     Py_DECREF(none);
1848     return 0;
1849 #else
1850     return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
1851 #endif
1852 }
1853 
1854 /* ListAppend.proto */
1855 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_PyList_Append(PyObject * list,PyObject * x)1856 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1857     PyListObject* L = (PyListObject*) list;
1858     Py_ssize_t len = Py_SIZE(list);
1859     if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1860         Py_INCREF(x);
1861         PyList_SET_ITEM(list, len, x);
1862         Py_SIZE(list) = len+1;
1863         return 0;
1864     }
1865     return PyList_Append(list, x);
1866 }
1867 #else
1868 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1869 #endif
1870 
1871 /* None.proto */
1872 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
1873 
1874 /* None.proto */
1875 static CYTHON_INLINE long __Pyx_div_long(long, long);
1876 
1877 /* WriteUnraisableException.proto */
1878 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1879                                   int lineno, const char *filename,
1880                                   int full_traceback, int nogil);
1881 
1882 /* ImportFrom.proto */
1883 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1884 
1885 /* HasAttr.proto */
1886 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1887 
1888 /* PyObject_GenericGetAttrNoDict.proto */
1889 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1890 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1891 #else
1892 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1893 #endif
1894 
1895 /* PyObject_GenericGetAttr.proto */
1896 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1897 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1898 #else
1899 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1900 #endif
1901 
1902 /* SetVTable.proto */
1903 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1904 
1905 /* SetupReduce.proto */
1906 static int __Pyx_setup_reduce(PyObject* type_obj);
1907 
1908 /* TypeImport.proto */
1909 #ifndef __PYX_HAVE_RT_ImportType_proto
1910 #define __PYX_HAVE_RT_ImportType_proto
1911 enum __Pyx_ImportType_CheckSize {
1912    __Pyx_ImportType_CheckSize_Error = 0,
1913    __Pyx_ImportType_CheckSize_Warn = 1,
1914    __Pyx_ImportType_CheckSize_Ignore = 2
1915 };
1916 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1917 #endif
1918 
1919 /* CLineInTraceback.proto */
1920 #ifdef CYTHON_CLINE_IN_TRACEBACK
1921 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1922 #else
1923 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1924 #endif
1925 
1926 /* CodeObjectCache.proto */
1927 typedef struct {
1928     PyCodeObject* code_object;
1929     int code_line;
1930 } __Pyx_CodeObjectCacheEntry;
1931 struct __Pyx_CodeObjectCache {
1932     int count;
1933     int max_count;
1934     __Pyx_CodeObjectCacheEntry* entries;
1935 };
1936 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1937 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1938 static PyCodeObject *__pyx_find_code_object(int code_line);
1939 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1940 
1941 /* AddTraceback.proto */
1942 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1943                                int py_line, const char *filename);
1944 
1945 #if PY_MAJOR_VERSION < 3
1946     static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1947     static void __Pyx_ReleaseBuffer(Py_buffer *view);
1948 #else
1949     #define __Pyx_GetBuffer PyObject_GetBuffer
1950     #define __Pyx_ReleaseBuffer PyBuffer_Release
1951 #endif
1952 
1953 
1954 /* BufferStructDeclare.proto */
1955 typedef struct {
1956   Py_ssize_t shape, strides, suboffsets;
1957 } __Pyx_Buf_DimInfo;
1958 typedef struct {
1959   size_t refcount;
1960   Py_buffer pybuffer;
1961 } __Pyx_Buffer;
1962 typedef struct {
1963   __Pyx_Buffer *rcbuffer;
1964   char *data;
1965   __Pyx_Buf_DimInfo diminfo[8];
1966 } __Pyx_LocalBuf_ND;
1967 
1968 /* MemviewSliceIsContig.proto */
1969 static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);
1970 
1971 /* OverlappingSlices.proto */
1972 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
1973                                 __Pyx_memviewslice *slice2,
1974                                 int ndim, size_t itemsize);
1975 
1976 /* Capsule.proto */
1977 static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
1978 
1979 /* TypeInfoCompare.proto */
1980 static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
1981 
1982 /* MemviewSliceValidateAndInit.proto */
1983 static int __Pyx_ValidateAndInit_memviewslice(
1984                 int *axes_specs,
1985                 int c_or_f_flag,
1986                 int buf_flags,
1987                 int ndim,
1988                 __Pyx_TypeInfo *dtype,
1989                 __Pyx_BufFmt_StackElem stack[],
1990                 __Pyx_memviewslice *memviewslice,
1991                 PyObject *original_obj);
1992 
1993 /* ObjectToMemviewSlice.proto */
1994 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn_uint64_t(PyObject *, int writable_flag);
1995 
1996 /* CIntToPy.proto */
1997 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value);
1998 
1999 /* CIntToPy.proto */
2000 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
2001 
2002 /* CIntToPy.proto */
2003 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);
2004 
2005 /* CIntToPy.proto */
2006 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_uint64(npy_uint64 value);
2007 
2008 /* CIntToPy.proto */
2009 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value);
2010 
2011 /* MemviewDtypeToObject.proto */
2012 static CYTHON_INLINE PyObject *__pyx_memview_get_nn_uint64_t(const char *itemp);
2013 static CYTHON_INLINE int __pyx_memview_set_nn_uint64_t(const char *itemp, PyObject *obj);
2014 
2015 /* CIntToPy.proto */
2016 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int64_t(int64_t value);
2017 
2018 /* RealImag.proto */
2019 #if CYTHON_CCOMPLEX
2020   #ifdef __cplusplus
2021     #define __Pyx_CREAL(z) ((z).real())
2022     #define __Pyx_CIMAG(z) ((z).imag())
2023   #else
2024     #define __Pyx_CREAL(z) (__real__(z))
2025     #define __Pyx_CIMAG(z) (__imag__(z))
2026   #endif
2027 #else
2028     #define __Pyx_CREAL(z) ((z).real)
2029     #define __Pyx_CIMAG(z) ((z).imag)
2030 #endif
2031 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
2032         && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
2033     #define __Pyx_SET_CREAL(z,x) ((z).real(x))
2034     #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
2035 #else
2036     #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
2037     #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
2038 #endif
2039 
2040 /* Arithmetic.proto */
2041 #if CYTHON_CCOMPLEX
2042     #define __Pyx_c_eq_float(a, b)   ((a)==(b))
2043     #define __Pyx_c_sum_float(a, b)  ((a)+(b))
2044     #define __Pyx_c_diff_float(a, b) ((a)-(b))
2045     #define __Pyx_c_prod_float(a, b) ((a)*(b))
2046     #define __Pyx_c_quot_float(a, b) ((a)/(b))
2047     #define __Pyx_c_neg_float(a)     (-(a))
2048   #ifdef __cplusplus
2049     #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
2050     #define __Pyx_c_conj_float(z)    (::std::conj(z))
2051     #if 1
2052         #define __Pyx_c_abs_float(z)     (::std::abs(z))
2053         #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
2054     #endif
2055   #else
2056     #define __Pyx_c_is_zero_float(z) ((z)==0)
2057     #define __Pyx_c_conj_float(z)    (conjf(z))
2058     #if 1
2059         #define __Pyx_c_abs_float(z)     (cabsf(z))
2060         #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
2061     #endif
2062  #endif
2063 #else
2064     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
2065     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
2066     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
2067     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
2068     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
2069     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
2070     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
2071     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
2072     #if 1
2073         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
2074         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
2075     #endif
2076 #endif
2077 
2078 /* Arithmetic.proto */
2079 #if CYTHON_CCOMPLEX
2080     #define __Pyx_c_eq_double(a, b)   ((a)==(b))
2081     #define __Pyx_c_sum_double(a, b)  ((a)+(b))
2082     #define __Pyx_c_diff_double(a, b) ((a)-(b))
2083     #define __Pyx_c_prod_double(a, b) ((a)*(b))
2084     #define __Pyx_c_quot_double(a, b) ((a)/(b))
2085     #define __Pyx_c_neg_double(a)     (-(a))
2086   #ifdef __cplusplus
2087     #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
2088     #define __Pyx_c_conj_double(z)    (::std::conj(z))
2089     #if 1
2090         #define __Pyx_c_abs_double(z)     (::std::abs(z))
2091         #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
2092     #endif
2093   #else
2094     #define __Pyx_c_is_zero_double(z) ((z)==0)
2095     #define __Pyx_c_conj_double(z)    (conj(z))
2096     #if 1
2097         #define __Pyx_c_abs_double(z)     (cabs(z))
2098         #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
2099     #endif
2100  #endif
2101 #else
2102     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
2103     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
2104     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
2105     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
2106     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
2107     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
2108     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
2109     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
2110     #if 1
2111         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
2112         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
2113     #endif
2114 #endif
2115 
2116 /* CIntToPy.proto */
2117 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
2118 
2119 /* MemviewSliceCopyTemplate.proto */
2120 static __Pyx_memviewslice
2121 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
2122                                  const char *mode, int ndim,
2123                                  size_t sizeof_dtype, int contig_flag,
2124                                  int dtype_is_object);
2125 
2126 /* CIntFromPy.proto */
2127 static CYTHON_INLINE npy_uint32 __Pyx_PyInt_As_npy_uint32(PyObject *);
2128 
2129 /* CIntFromPy.proto */
2130 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
2131 
2132 /* CIntFromPy.proto */
2133 static CYTHON_INLINE npy_int64 __Pyx_PyInt_As_npy_int64(PyObject *);
2134 
2135 /* CIntFromPy.proto */
2136 static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *);
2137 
2138 /* CIntFromPy.proto */
2139 static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *);
2140 
2141 /* CIntFromPy.proto */
2142 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
2143 
2144 /* CIntToPy.proto */
2145 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
2146 
2147 /* CIntFromPy.proto */
2148 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
2149 
2150 /* CheckBinaryVersion.proto */
2151 static int __Pyx_check_binary_version(void);
2152 
2153 /* InitStrings.proto */
2154 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2155 
2156 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
2157 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
2158 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
2159 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
2160 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*/
2161 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
2162 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2163 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2164 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2165 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2166 
2167 /* Module declarations from 'cpython.buffer' */
2168 
2169 /* Module declarations from 'libc.string' */
2170 
2171 /* Module declarations from 'libc.stdio' */
2172 
2173 /* Module declarations from '__builtin__' */
2174 
2175 /* Module declarations from 'cpython.type' */
2176 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2177 
2178 /* Module declarations from 'cpython' */
2179 
2180 /* Module declarations from 'cpython.object' */
2181 
2182 /* Module declarations from 'cpython.ref' */
2183 
2184 /* Module declarations from 'cpython.mem' */
2185 
2186 /* Module declarations from 'numpy' */
2187 
2188 /* Module declarations from 'numpy' */
2189 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
2190 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
2191 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
2192 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
2193 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
2194 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
2195 
2196 /* Module declarations from 'libc.stdint' */
2197 
2198 /* Module declarations from 'libcpp' */
2199 
2200 /* Module declarations from 'libcpp.utility' */
2201 
2202 /* Module declarations from 'libcpp.pair' */
2203 
2204 /* Module declarations from 'libcpp.vector' */
2205 
2206 /* Module declarations from 'cython.view' */
2207 
2208 /* Module declarations from 'cython' */
2209 
2210 /* Module declarations from 'yt.utilities.lib.cykdtree.utils' */
2211 static PyTypeObject *__pyx_array_type = 0;
2212 static PyTypeObject *__pyx_MemviewEnum_type = 0;
2213 static PyTypeObject *__pyx_memoryview_type = 0;
2214 static PyTypeObject *__pyx_memoryviewslice_type = 0;
2215 static PyObject *generic = 0;
2216 static PyObject *strided = 0;
2217 static PyObject *indirect = 0;
2218 static PyObject *contiguous = 0;
2219 static PyObject *indirect_contiguous = 0;
2220 static int __pyx_memoryview_thread_locks_used;
2221 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2222 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
2223 static void *__pyx_align_pointer(void *, size_t); /*proto*/
2224 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
2225 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
2226 static PyObject *_unellipsify(PyObject *, int); /*proto*/
2227 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
2228 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
2229 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*/
2230 static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
2231 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
2232 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
2233 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2234 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2235 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
2236 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2237 static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
2238 static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
2239 static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
2240 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
2241 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
2242 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
2243 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
2244 static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
2245 static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
2246 static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
2247 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
2248 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
2249 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
2250 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2251 static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2252 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
2253 static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
2254 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
2255 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 };
2256 static __Pyx_TypeInfo __Pyx_TypeInfo_nn_uint64_t = { "uint64_t", NULL, sizeof(uint64_t), { 0 }, 0, IS_UNSIGNED(uint64_t) ? 'U' : 'I', IS_UNSIGNED(uint64_t), 0 };
2257 #define __Pyx_MODULE_NAME "yt.utilities.lib.cykdtree.utils"
2258 extern int __pyx_module_is_main_yt__utilities__lib__cykdtree__utils;
2259 int __pyx_module_is_main_yt__utilities__lib__cykdtree__utils = 0;
2260 
2261 /* Implementation of 'yt.utilities.lib.cykdtree.utils' */
2262 static PyObject *__pyx_builtin_range;
2263 static PyObject *__pyx_builtin_ValueError;
2264 static PyObject *__pyx_builtin_RuntimeError;
2265 static PyObject *__pyx_builtin_ImportError;
2266 static PyObject *__pyx_builtin_MemoryError;
2267 static PyObject *__pyx_builtin_enumerate;
2268 static PyObject *__pyx_builtin_TypeError;
2269 static PyObject *__pyx_builtin_Ellipsis;
2270 static PyObject *__pyx_builtin_id;
2271 static PyObject *__pyx_builtin_IndexError;
2272 static const char __pyx_k_O[] = "O";
2273 static const char __pyx_k_c[] = "c";
2274 static const char __pyx_k_d[] = "d";
2275 static const char __pyx_k_i[] = "i";
2276 static const char __pyx_k_l[] = "l";
2277 static const char __pyx_k_m[] = "m";
2278 static const char __pyx_k_n[] = "n";
2279 static const char __pyx_k_p[] = "p";
2280 static const char __pyx_k_q[] = "q";
2281 static const char __pyx_k_r[] = "r";
2282 static const char __pyx_k_t[] = "t";
2283 static const char __pyx_k_id[] = "id";
2284 static const char __pyx_k_np[] = "np";
2285 static const char __pyx_k_idx[] = "idx";
2286 static const char __pyx_k_max[] = "max";
2287 static const char __pyx_k_min[] = "min";
2288 static const char __pyx_k_new[] = "__new__";
2289 static const char __pyx_k_obj[] = "obj";
2290 static const char __pyx_k_out[] = "out";
2291 static const char __pyx_k_pos[] = "pos";
2292 static const char __pyx_k_Lidx[] = "Lidx";
2293 static const char __pyx_k_Ridx[] = "Ridx";
2294 static const char __pyx_k_axis[] = "axis";
2295 static const char __pyx_k_base[] = "base";
2296 static const char __pyx_k_copy[] = "copy";
2297 static const char __pyx_k_cout[] = "cout";
2298 static const char __pyx_k_dict[] = "__dict__";
2299 static const char __pyx_k_main[] = "__main__";
2300 static const char __pyx_k_maxs[] = "maxs";
2301 static const char __pyx_k_mins[] = "mins";
2302 static const char __pyx_k_mode[] = "mode";
2303 static const char __pyx_k_name[] = "name";
2304 static const char __pyx_k_ndim[] = "ndim";
2305 static const char __pyx_k_npts[] = "npts";
2306 static const char __pyx_k_pack[] = "pack";
2307 static const char __pyx_k_pval[] = "pval";
2308 static const char __pyx_k_size[] = "size";
2309 static const char __pyx_k_step[] = "step";
2310 static const char __pyx_k_stop[] = "stop";
2311 static const char __pyx_k_test[] = "__test__";
2312 static const char __pyx_k_ASCII[] = "ASCII";
2313 static const char __pyx_k_Lidx0[] = "Lidx0";
2314 static const char __pyx_k_Ridx0[] = "Ridx0";
2315 static const char __pyx_k_class[] = "__class__";
2316 static const char __pyx_k_error[] = "error";
2317 static const char __pyx_k_flags[] = "flags";
2318 static const char __pyx_k_numpy[] = "numpy";
2319 static const char __pyx_k_range[] = "range";
2320 static const char __pyx_k_shape[] = "shape";
2321 static const char __pyx_k_start[] = "start";
2322 static const char __pyx_k_zeros[] = "zeros";
2323 static const char __pyx_k_arange[] = "arange";
2324 static const char __pyx_k_astype[] = "astype";
2325 static const char __pyx_k_dsplit[] = "dsplit";
2326 static const char __pyx_k_encode[] = "encode";
2327 static const char __pyx_k_format[] = "format";
2328 static const char __pyx_k_import[] = "__import__";
2329 static const char __pyx_k_name_2[] = "__name__";
2330 static const char __pyx_k_pickle[] = "pickle";
2331 static const char __pyx_k_reduce[] = "__reduce__";
2332 static const char __pyx_k_struct[] = "struct";
2333 static const char __pyx_k_uint64[] = "uint64";
2334 static const char __pyx_k_unpack[] = "unpack";
2335 static const char __pyx_k_update[] = "update";
2336 static const char __pyx_k_float64[] = "float64";
2337 static const char __pyx_k_fortran[] = "fortran";
2338 static const char __pyx_k_memview[] = "memview";
2339 static const char __pyx_k_ptr_idx[] = "ptr_idx";
2340 static const char __pyx_k_ptr_pos[] = "ptr_pos";
2341 static const char __pyx_k_Ellipsis[] = "Ellipsis";
2342 static const char __pyx_k_getstate[] = "__getstate__";
2343 static const char __pyx_k_itemsize[] = "itemsize";
2344 static const char __pyx_k_ptr_maxs[] = "ptr_maxs";
2345 static const char __pyx_k_ptr_mins[] = "ptr_mins";
2346 static const char __pyx_k_py_pivot[] = "py_pivot";
2347 static const char __pyx_k_py_split[] = "py_split";
2348 static const char __pyx_k_pyx_type[] = "__pyx_type";
2349 static const char __pyx_k_setstate[] = "__setstate__";
2350 static const char __pyx_k_TypeError[] = "TypeError";
2351 static const char __pyx_k_enumerate[] = "enumerate";
2352 static const char __pyx_k_py_select[] = "py_select";
2353 static const char __pyx_k_pyx_state[] = "__pyx_state";
2354 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
2355 static const char __pyx_k_split_val[] = "split_val";
2356 static const char __pyx_k_IndexError[] = "IndexError";
2357 static const char __pyx_k_ValueError[] = "ValueError";
2358 static const char __pyx_k_py_max_pts[] = "py_max_pts";
2359 static const char __pyx_k_py_min_pts[] = "py_min_pts";
2360 static const char __pyx_k_pyx_result[] = "__pyx_result";
2361 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
2362 static const char __pyx_k_ImportError[] = "ImportError";
2363 static const char __pyx_k_MemoryError[] = "MemoryError";
2364 static const char __pyx_k_PickleError[] = "PickleError";
2365 static const char __pyx_k_RuntimeError[] = "RuntimeError";
2366 static const char __pyx_k_py_partition[] = "py_partition";
2367 static const char __pyx_k_py_quickSort[] = "py_quickSort";
2368 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
2369 static const char __pyx_k_stringsource[] = "stringsource";
2370 static const char __pyx_k_py_insertSort[] = "py_insertSort";
2371 static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
2372 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
2373 static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
2374 static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
2375 static const char __pyx_k_c_midpoint_flag[] = "c_midpoint_flag";
2376 static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
2377 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
2378 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
2379 static const char __pyx_k_py_argmax_pts_dim[] = "py_argmax_pts_dim";
2380 static const char __pyx_k_py_argmin_pts_dim[] = "py_argmin_pts_dim";
2381 static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
2382 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2383 static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
2384 static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
2385 static const char __pyx_k_use_sliding_midpoint[] = "use_sliding_midpoint";
2386 static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
2387 static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
2388 static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
2389 static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
2390 static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
2391 static const char __pyx_k_py_partition_given_pivot[] = "py_partition_given_pivot";
2392 static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
2393 static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
2394 static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
2395 static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
2396 static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
2397 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
2398 static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
2399 static const char __pyx_k_yt_utilities_lib_cykdtree_utils[] = "yt/utilities/lib/cykdtree/utils.pyx";
2400 static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
2401 static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
2402 static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
2403 static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
2404 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
2405 static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
2406 static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))";
2407 static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
2408 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
2409 static const char __pyx_k_Left_index_d_exceeds_size_of_pos[] = "Left index (%d) exceeds size of positions array (%d).";
2410 static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
2411 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
2412 static const char __pyx_k_Right_index_d_exceeds_size_of_po[] = "Right index (%d) exceeds size of positions array (%d).";
2413 static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
2414 static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
2415 static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
2416 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
2417 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
2418 static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
2419 static const char __pyx_k_yt_utilities_lib_cykdtree_utils_2[] = "yt.utilities.lib.cykdtree.utils";
2420 static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
2421 static PyObject *__pyx_n_s_ASCII;
2422 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
2423 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
2424 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
2425 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
2426 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
2427 static PyObject *__pyx_n_s_Ellipsis;
2428 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
2429 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
2430 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
2431 static PyObject *__pyx_n_s_ImportError;
2432 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
2433 static PyObject *__pyx_n_s_IndexError;
2434 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
2435 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
2436 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
2437 static PyObject *__pyx_kp_s_Left_index_d_exceeds_size_of_pos;
2438 static PyObject *__pyx_n_s_Lidx;
2439 static PyObject *__pyx_n_s_Lidx0;
2440 static PyObject *__pyx_n_s_MemoryError;
2441 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
2442 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
2443 static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
2444 static PyObject *__pyx_n_b_O;
2445 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
2446 static PyObject *__pyx_n_s_PickleError;
2447 static PyObject *__pyx_n_s_Ridx;
2448 static PyObject *__pyx_n_s_Ridx0;
2449 static PyObject *__pyx_kp_s_Right_index_d_exceeds_size_of_po;
2450 static PyObject *__pyx_n_s_RuntimeError;
2451 static PyObject *__pyx_n_s_TypeError;
2452 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
2453 static PyObject *__pyx_n_s_ValueError;
2454 static PyObject *__pyx_n_s_View_MemoryView;
2455 static PyObject *__pyx_n_s_allocate_buffer;
2456 static PyObject *__pyx_n_s_arange;
2457 static PyObject *__pyx_n_s_astype;
2458 static PyObject *__pyx_n_s_axis;
2459 static PyObject *__pyx_n_s_base;
2460 static PyObject *__pyx_n_s_c;
2461 static PyObject *__pyx_n_u_c;
2462 static PyObject *__pyx_n_s_c_midpoint_flag;
2463 static PyObject *__pyx_n_s_class;
2464 static PyObject *__pyx_n_s_cline_in_traceback;
2465 static PyObject *__pyx_kp_s_contiguous_and_direct;
2466 static PyObject *__pyx_kp_s_contiguous_and_indirect;
2467 static PyObject *__pyx_n_s_copy;
2468 static PyObject *__pyx_n_s_cout;
2469 static PyObject *__pyx_n_s_d;
2470 static PyObject *__pyx_n_s_dict;
2471 static PyObject *__pyx_n_s_dsplit;
2472 static PyObject *__pyx_n_s_dtype_is_object;
2473 static PyObject *__pyx_n_s_encode;
2474 static PyObject *__pyx_n_s_enumerate;
2475 static PyObject *__pyx_n_s_error;
2476 static PyObject *__pyx_n_s_flags;
2477 static PyObject *__pyx_n_s_float64;
2478 static PyObject *__pyx_n_s_format;
2479 static PyObject *__pyx_n_s_fortran;
2480 static PyObject *__pyx_n_u_fortran;
2481 static PyObject *__pyx_n_s_getstate;
2482 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
2483 static PyObject *__pyx_n_s_i;
2484 static PyObject *__pyx_n_s_id;
2485 static PyObject *__pyx_n_s_idx;
2486 static PyObject *__pyx_n_s_import;
2487 static PyObject *__pyx_n_s_itemsize;
2488 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
2489 static PyObject *__pyx_n_s_l;
2490 static PyObject *__pyx_n_s_m;
2491 static PyObject *__pyx_n_s_main;
2492 static PyObject *__pyx_n_s_max;
2493 static PyObject *__pyx_n_s_maxs;
2494 static PyObject *__pyx_n_s_memview;
2495 static PyObject *__pyx_n_s_min;
2496 static PyObject *__pyx_n_s_mins;
2497 static PyObject *__pyx_n_s_mode;
2498 static PyObject *__pyx_n_s_n;
2499 static PyObject *__pyx_n_s_name;
2500 static PyObject *__pyx_n_s_name_2;
2501 static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
2502 static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
2503 static PyObject *__pyx_n_s_ndim;
2504 static PyObject *__pyx_n_s_new;
2505 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2506 static PyObject *__pyx_n_s_np;
2507 static PyObject *__pyx_n_s_npts;
2508 static PyObject *__pyx_n_s_numpy;
2509 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
2510 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
2511 static PyObject *__pyx_n_s_obj;
2512 static PyObject *__pyx_n_s_out;
2513 static PyObject *__pyx_n_s_p;
2514 static PyObject *__pyx_n_s_pack;
2515 static PyObject *__pyx_n_s_pickle;
2516 static PyObject *__pyx_n_s_pos;
2517 static PyObject *__pyx_n_s_ptr_idx;
2518 static PyObject *__pyx_n_s_ptr_maxs;
2519 static PyObject *__pyx_n_s_ptr_mins;
2520 static PyObject *__pyx_n_s_ptr_pos;
2521 static PyObject *__pyx_n_s_pval;
2522 static PyObject *__pyx_n_s_py_argmax_pts_dim;
2523 static PyObject *__pyx_n_s_py_argmin_pts_dim;
2524 static PyObject *__pyx_n_s_py_insertSort;
2525 static PyObject *__pyx_n_s_py_max_pts;
2526 static PyObject *__pyx_n_s_py_min_pts;
2527 static PyObject *__pyx_n_s_py_partition;
2528 static PyObject *__pyx_n_s_py_partition_given_pivot;
2529 static PyObject *__pyx_n_s_py_pivot;
2530 static PyObject *__pyx_n_s_py_quickSort;
2531 static PyObject *__pyx_n_s_py_select;
2532 static PyObject *__pyx_n_s_py_split;
2533 static PyObject *__pyx_n_s_pyx_PickleError;
2534 static PyObject *__pyx_n_s_pyx_checksum;
2535 static PyObject *__pyx_n_s_pyx_getbuffer;
2536 static PyObject *__pyx_n_s_pyx_result;
2537 static PyObject *__pyx_n_s_pyx_state;
2538 static PyObject *__pyx_n_s_pyx_type;
2539 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
2540 static PyObject *__pyx_n_s_pyx_vtable;
2541 static PyObject *__pyx_n_s_q;
2542 static PyObject *__pyx_n_s_r;
2543 static PyObject *__pyx_n_s_range;
2544 static PyObject *__pyx_n_s_reduce;
2545 static PyObject *__pyx_n_s_reduce_cython;
2546 static PyObject *__pyx_n_s_reduce_ex;
2547 static PyObject *__pyx_n_s_setstate;
2548 static PyObject *__pyx_n_s_setstate_cython;
2549 static PyObject *__pyx_n_s_shape;
2550 static PyObject *__pyx_n_s_size;
2551 static PyObject *__pyx_n_s_split_val;
2552 static PyObject *__pyx_n_s_start;
2553 static PyObject *__pyx_n_s_step;
2554 static PyObject *__pyx_n_s_stop;
2555 static PyObject *__pyx_kp_s_strided_and_direct;
2556 static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
2557 static PyObject *__pyx_kp_s_strided_and_indirect;
2558 static PyObject *__pyx_kp_s_stringsource;
2559 static PyObject *__pyx_n_s_struct;
2560 static PyObject *__pyx_n_s_t;
2561 static PyObject *__pyx_n_s_test;
2562 static PyObject *__pyx_n_s_uint64;
2563 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
2564 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
2565 static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
2566 static PyObject *__pyx_n_s_unpack;
2567 static PyObject *__pyx_n_s_update;
2568 static PyObject *__pyx_n_s_use_sliding_midpoint;
2569 static PyObject *__pyx_kp_s_yt_utilities_lib_cykdtree_utils;
2570 static PyObject *__pyx_n_s_yt_utilities_lib_cykdtree_utils_2;
2571 static PyObject *__pyx_n_s_zeros;
2572 static PyObject *__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_py_max_pts(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos); /* proto */
2573 static PyObject *__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_2py_min_pts(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos); /* proto */
2574 static PyObject *__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_4py_argmax_pts_dim(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __Pyx_memviewslice __pyx_v_idx, __pyx_t_5numpy_uint32_t __pyx_v_d, int __pyx_v_Lidx0, int __pyx_v_Ridx0); /* proto */
2575 static PyObject *__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_6py_argmin_pts_dim(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __Pyx_memviewslice __pyx_v_idx, __pyx_t_5numpy_uint32_t __pyx_v_d, int __pyx_v_Lidx0, int __pyx_v_Ridx0); /* proto */
2576 static PyObject *__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_8py_quickSort(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_uint32_t __pyx_v_d); /* proto */
2577 static PyObject *__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_10py_insertSort(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_uint32_t __pyx_v_d); /* proto */
2578 static PyObject *__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_12py_pivot(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_uint32_t __pyx_v_d); /* proto */
2579 static PyObject *__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_14py_partition(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_uint32_t __pyx_v_d, __pyx_t_5numpy_int64_t __pyx_v_p); /* proto */
2580 static PyObject *__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_16py_partition_given_pivot(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_uint32_t __pyx_v_d, __pyx_t_5numpy_float64_t __pyx_v_pval); /* proto */
2581 static PyObject *__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_18py_select(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_uint32_t __pyx_v_d, __pyx_t_5numpy_int64_t __pyx_v_t); /* proto */
2582 static PyObject *__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_20py_split(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, PyArrayObject *__pyx_v_mins, PyArrayObject *__pyx_v_maxs, bool __pyx_v_use_sliding_midpoint); /* proto */
2583 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
2584 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
2585 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 */
2586 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 */
2587 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2588 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2589 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2590 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
2591 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
2592 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 */
2593 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
2594 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 */
2595 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
2596 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2597 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2598 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
2599 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 */
2600 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2601 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
2602 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 */
2603 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 */
2604 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2605 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2606 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2607 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2608 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2609 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2610 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2611 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2612 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2613 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2614 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2615 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2616 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2617 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2618 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2619 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2620 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2621 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 */
2622 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2623 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2624 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2625 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 */
2626 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 */
2627 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2628 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2629 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2630 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2631 static PyObject *__pyx_int_0;
2632 static PyObject *__pyx_int_1;
2633 static PyObject *__pyx_int_184977713;
2634 static PyObject *__pyx_int_neg_1;
2635 static PyObject *__pyx_tuple_;
2636 static PyObject *__pyx_tuple__2;
2637 static PyObject *__pyx_tuple__3;
2638 static PyObject *__pyx_tuple__4;
2639 static PyObject *__pyx_tuple__5;
2640 static PyObject *__pyx_tuple__6;
2641 static PyObject *__pyx_tuple__7;
2642 static PyObject *__pyx_tuple__8;
2643 static PyObject *__pyx_tuple__9;
2644 static PyObject *__pyx_slice__22;
2645 static PyObject *__pyx_tuple__10;
2646 static PyObject *__pyx_tuple__11;
2647 static PyObject *__pyx_tuple__12;
2648 static PyObject *__pyx_tuple__13;
2649 static PyObject *__pyx_tuple__14;
2650 static PyObject *__pyx_tuple__15;
2651 static PyObject *__pyx_tuple__16;
2652 static PyObject *__pyx_tuple__17;
2653 static PyObject *__pyx_tuple__18;
2654 static PyObject *__pyx_tuple__19;
2655 static PyObject *__pyx_tuple__20;
2656 static PyObject *__pyx_tuple__21;
2657 static PyObject *__pyx_tuple__23;
2658 static PyObject *__pyx_tuple__24;
2659 static PyObject *__pyx_tuple__25;
2660 static PyObject *__pyx_tuple__26;
2661 static PyObject *__pyx_tuple__28;
2662 static PyObject *__pyx_tuple__30;
2663 static PyObject *__pyx_tuple__32;
2664 static PyObject *__pyx_tuple__34;
2665 static PyObject *__pyx_tuple__36;
2666 static PyObject *__pyx_tuple__38;
2667 static PyObject *__pyx_tuple__40;
2668 static PyObject *__pyx_tuple__42;
2669 static PyObject *__pyx_tuple__44;
2670 static PyObject *__pyx_tuple__46;
2671 static PyObject *__pyx_tuple__48;
2672 static PyObject *__pyx_tuple__49;
2673 static PyObject *__pyx_tuple__50;
2674 static PyObject *__pyx_tuple__51;
2675 static PyObject *__pyx_tuple__52;
2676 static PyObject *__pyx_tuple__53;
2677 static PyObject *__pyx_codeobj__27;
2678 static PyObject *__pyx_codeobj__29;
2679 static PyObject *__pyx_codeobj__31;
2680 static PyObject *__pyx_codeobj__33;
2681 static PyObject *__pyx_codeobj__35;
2682 static PyObject *__pyx_codeobj__37;
2683 static PyObject *__pyx_codeobj__39;
2684 static PyObject *__pyx_codeobj__41;
2685 static PyObject *__pyx_codeobj__43;
2686 static PyObject *__pyx_codeobj__45;
2687 static PyObject *__pyx_codeobj__47;
2688 static PyObject *__pyx_codeobj__54;
2689 /* Late includes */
2690 
2691 /* "yt/utilities/lib/cykdtree/utils.pyx":18
2692  *
2693  *
2694  * def py_max_pts(np.ndarray[np.float64_t, ndim=2] pos):             # <<<<<<<<<<<<<<
2695  *     r"""Get the maximum of points along each coordinate.
2696  *
2697  */
2698 
2699 /* Python wrapper */
2700 static PyObject *__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_1py_max_pts(PyObject *__pyx_self, PyObject *__pyx_v_pos); /*proto*/
2701 static char __pyx_doc_2yt_9utilities_3lib_8cykdtree_5utils_py_max_pts[] = "Get the maximum of points along each coordinate.\n\n    Args:\n        pos (np.ndarray of float64): (n,m) array of n m-D coordinates.\n\n    Returns:\n        np.ndarray of float64: Maximum of pos along each coordinate.\n\n    ";
2702 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_8cykdtree_5utils_1py_max_pts = {"py_max_pts", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_1py_max_pts, METH_O, __pyx_doc_2yt_9utilities_3lib_8cykdtree_5utils_py_max_pts};
__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_1py_max_pts(PyObject * __pyx_self,PyObject * __pyx_v_pos)2703 static PyObject *__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_1py_max_pts(PyObject *__pyx_self, PyObject *__pyx_v_pos) {
2704   PyObject *__pyx_r = 0;
2705   __Pyx_RefNannyDeclarations
2706   __Pyx_RefNannySetupContext("py_max_pts (wrapper)", 0);
2707   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 1, "pos", 0))) __PYX_ERR(0, 18, __pyx_L1_error)
2708   __pyx_r = __pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_py_max_pts(__pyx_self, ((PyArrayObject *)__pyx_v_pos));
2709 
2710   /* function exit code */
2711   goto __pyx_L0;
2712   __pyx_L1_error:;
2713   __pyx_r = NULL;
2714   __pyx_L0:;
2715   __Pyx_RefNannyFinishContext();
2716   return __pyx_r;
2717 }
2718 
__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_py_max_pts(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_pos)2719 static PyObject *__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_py_max_pts(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos) {
2720   uint64_t __pyx_v_n;
2721   uint32_t __pyx_v_m;
2722   __pyx_t_5numpy_float64_t *__pyx_v_cout;
2723   uint32_t __pyx_v_i;
2724   PyArrayObject *__pyx_v_out = 0;
2725   __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
2726   __Pyx_Buffer __pyx_pybuffer_out;
2727   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos;
2728   __Pyx_Buffer __pyx_pybuffer_pos;
2729   PyObject *__pyx_r = NULL;
2730   __Pyx_RefNannyDeclarations
2731   Py_ssize_t __pyx_t_1;
2732   Py_ssize_t __pyx_t_2;
2733   int __pyx_t_3;
2734   PyObject *__pyx_t_4 = NULL;
2735   PyObject *__pyx_t_5 = NULL;
2736   PyObject *__pyx_t_6 = NULL;
2737   PyObject *__pyx_t_7 = NULL;
2738   PyObject *__pyx_t_8 = NULL;
2739   PyArrayObject *__pyx_t_9 = NULL;
2740   uint32_t __pyx_t_10;
2741   uint32_t __pyx_t_11;
2742   uint32_t __pyx_t_12;
2743   size_t __pyx_t_13;
2744   __Pyx_RefNannySetupContext("py_max_pts", 0);
2745   __pyx_pybuffer_out.pybuffer.buf = NULL;
2746   __pyx_pybuffer_out.refcount = 0;
2747   __pyx_pybuffernd_out.data = NULL;
2748   __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
2749   __pyx_pybuffer_pos.pybuffer.buf = NULL;
2750   __pyx_pybuffer_pos.refcount = 0;
2751   __pyx_pybuffernd_pos.data = NULL;
2752   __pyx_pybuffernd_pos.rcbuffer = &__pyx_pybuffer_pos;
2753   {
2754     __Pyx_BufFmt_StackElem __pyx_stack[1];
2755     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2756   }
2757   __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1];
2758 
2759   /* "yt/utilities/lib/cykdtree/utils.pyx":28
2760  *
2761  *     """
2762  *     cdef uint64_t n = <uint64_t>pos.shape[0]             # <<<<<<<<<<<<<<
2763  *     cdef uint32_t m = <uint32_t>pos.shape[1]
2764  *     cdef np.float64_t* cout = max_pts(&pos[0,0], n, m)
2765  */
2766   __pyx_v_n = ((uint64_t)(__pyx_v_pos->dimensions[0]));
2767 
2768   /* "yt/utilities/lib/cykdtree/utils.pyx":29
2769  *     """
2770  *     cdef uint64_t n = <uint64_t>pos.shape[0]
2771  *     cdef uint32_t m = <uint32_t>pos.shape[1]             # <<<<<<<<<<<<<<
2772  *     cdef np.float64_t* cout = max_pts(&pos[0,0], n, m)
2773  *     cdef uint32_t i = 0
2774  */
2775   __pyx_v_m = ((uint32_t)(__pyx_v_pos->dimensions[1]));
2776 
2777   /* "yt/utilities/lib/cykdtree/utils.pyx":30
2778  *     cdef uint64_t n = <uint64_t>pos.shape[0]
2779  *     cdef uint32_t m = <uint32_t>pos.shape[1]
2780  *     cdef np.float64_t* cout = max_pts(&pos[0,0], n, m)             # <<<<<<<<<<<<<<
2781  *     cdef uint32_t i = 0
2782  *     cdef np.ndarray[np.float64_t] out = np.zeros(m, 'float64')
2783  */
2784   __pyx_t_1 = 0;
2785   __pyx_t_2 = 0;
2786   __pyx_t_3 = -1;
2787   if (__pyx_t_1 < 0) {
2788     __pyx_t_1 += __pyx_pybuffernd_pos.diminfo[0].shape;
2789     if (unlikely(__pyx_t_1 < 0)) __pyx_t_3 = 0;
2790   } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_pos.diminfo[0].shape)) __pyx_t_3 = 0;
2791   if (__pyx_t_2 < 0) {
2792     __pyx_t_2 += __pyx_pybuffernd_pos.diminfo[1].shape;
2793     if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 1;
2794   } else if (unlikely(__pyx_t_2 >= __pyx_pybuffernd_pos.diminfo[1].shape)) __pyx_t_3 = 1;
2795   if (unlikely(__pyx_t_3 != -1)) {
2796     __Pyx_RaiseBufferIndexError(__pyx_t_3);
2797     __PYX_ERR(0, 30, __pyx_L1_error)
2798   }
2799   __pyx_v_cout = max_pts((&(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_pos.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_pos.diminfo[0].strides, __pyx_t_2, __pyx_pybuffernd_pos.diminfo[1].strides))), __pyx_v_n, __pyx_v_m);
2800 
2801   /* "yt/utilities/lib/cykdtree/utils.pyx":31
2802  *     cdef uint32_t m = <uint32_t>pos.shape[1]
2803  *     cdef np.float64_t* cout = max_pts(&pos[0,0], n, m)
2804  *     cdef uint32_t i = 0             # <<<<<<<<<<<<<<
2805  *     cdef np.ndarray[np.float64_t] out = np.zeros(m, 'float64')
2806  *     for i in range(m):
2807  */
2808   __pyx_v_i = 0;
2809 
2810   /* "yt/utilities/lib/cykdtree/utils.pyx":32
2811  *     cdef np.float64_t* cout = max_pts(&pos[0,0], n, m)
2812  *     cdef uint32_t i = 0
2813  *     cdef np.ndarray[np.float64_t] out = np.zeros(m, 'float64')             # <<<<<<<<<<<<<<
2814  *     for i in range(m):
2815  *         out[i] = cout[i]
2816  */
2817   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __pyx_L1_error)
2818   __Pyx_GOTREF(__pyx_t_5);
2819   __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 32, __pyx_L1_error)
2820   __Pyx_GOTREF(__pyx_t_6);
2821   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2822   __pyx_t_5 = __Pyx_PyInt_From_uint32_t(__pyx_v_m); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __pyx_L1_error)
2823   __Pyx_GOTREF(__pyx_t_5);
2824   __pyx_t_7 = NULL;
2825   __pyx_t_3 = 0;
2826   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
2827     __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
2828     if (likely(__pyx_t_7)) {
2829       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
2830       __Pyx_INCREF(__pyx_t_7);
2831       __Pyx_INCREF(function);
2832       __Pyx_DECREF_SET(__pyx_t_6, function);
2833       __pyx_t_3 = 1;
2834     }
2835   }
2836   #if CYTHON_FAST_PYCALL
2837   if (PyFunction_Check(__pyx_t_6)) {
2838     PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_5, __pyx_n_s_float64};
2839     __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_3, 2+__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error)
2840     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
2841     __Pyx_GOTREF(__pyx_t_4);
2842     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2843   } else
2844   #endif
2845   #if CYTHON_FAST_PYCCALL
2846   if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
2847     PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_5, __pyx_n_s_float64};
2848     __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_3, 2+__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error)
2849     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
2850     __Pyx_GOTREF(__pyx_t_4);
2851     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2852   } else
2853   #endif
2854   {
2855     __pyx_t_8 = PyTuple_New(2+__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 32, __pyx_L1_error)
2856     __Pyx_GOTREF(__pyx_t_8);
2857     if (__pyx_t_7) {
2858       __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
2859     }
2860     __Pyx_GIVEREF(__pyx_t_5);
2861     PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_3, __pyx_t_5);
2862     __Pyx_INCREF(__pyx_n_s_float64);
2863     __Pyx_GIVEREF(__pyx_n_s_float64);
2864     PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_3, __pyx_n_s_float64);
2865     __pyx_t_5 = 0;
2866     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error)
2867     __Pyx_GOTREF(__pyx_t_4);
2868     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2869   }
2870   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2871   if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 32, __pyx_L1_error)
2872   __pyx_t_9 = ((PyArrayObject *)__pyx_t_4);
2873   {
2874     __Pyx_BufFmt_StackElem __pyx_stack[1];
2875     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
2876       __pyx_v_out = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_out.rcbuffer->pybuffer.buf = NULL;
2877       __PYX_ERR(0, 32, __pyx_L1_error)
2878     } else {__pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0];
2879     }
2880   }
2881   __pyx_t_9 = 0;
2882   __pyx_v_out = ((PyArrayObject *)__pyx_t_4);
2883   __pyx_t_4 = 0;
2884 
2885   /* "yt/utilities/lib/cykdtree/utils.pyx":33
2886  *     cdef uint32_t i = 0
2887  *     cdef np.ndarray[np.float64_t] out = np.zeros(m, 'float64')
2888  *     for i in range(m):             # <<<<<<<<<<<<<<
2889  *         out[i] = cout[i]
2890  *     #free(cout)
2891  */
2892   __pyx_t_10 = __pyx_v_m;
2893   __pyx_t_11 = __pyx_t_10;
2894   for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
2895     __pyx_v_i = __pyx_t_12;
2896 
2897     /* "yt/utilities/lib/cykdtree/utils.pyx":34
2898  *     cdef np.ndarray[np.float64_t] out = np.zeros(m, 'float64')
2899  *     for i in range(m):
2900  *         out[i] = cout[i]             # <<<<<<<<<<<<<<
2901  *     #free(cout)
2902  *     return out
2903  */
2904     __pyx_t_13 = __pyx_v_i;
2905     __pyx_t_3 = -1;
2906     if (unlikely(__pyx_t_13 >= (size_t)__pyx_pybuffernd_out.diminfo[0].shape)) __pyx_t_3 = 0;
2907     if (unlikely(__pyx_t_3 != -1)) {
2908       __Pyx_RaiseBufferIndexError(__pyx_t_3);
2909       __PYX_ERR(0, 34, __pyx_L1_error)
2910     }
2911     *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_out.diminfo[0].strides) = (__pyx_v_cout[__pyx_v_i]);
2912   }
2913 
2914   /* "yt/utilities/lib/cykdtree/utils.pyx":36
2915  *         out[i] = cout[i]
2916  *     #free(cout)
2917  *     return out             # <<<<<<<<<<<<<<
2918  *
2919  * def py_min_pts(np.ndarray[np.float64_t, ndim=2] pos):
2920  */
2921   __Pyx_XDECREF(__pyx_r);
2922   __Pyx_INCREF(((PyObject *)__pyx_v_out));
2923   __pyx_r = ((PyObject *)__pyx_v_out);
2924   goto __pyx_L0;
2925 
2926   /* "yt/utilities/lib/cykdtree/utils.pyx":18
2927  *
2928  *
2929  * def py_max_pts(np.ndarray[np.float64_t, ndim=2] pos):             # <<<<<<<<<<<<<<
2930  *     r"""Get the maximum of points along each coordinate.
2931  *
2932  */
2933 
2934   /* function exit code */
2935   __pyx_L1_error:;
2936   __Pyx_XDECREF(__pyx_t_4);
2937   __Pyx_XDECREF(__pyx_t_5);
2938   __Pyx_XDECREF(__pyx_t_6);
2939   __Pyx_XDECREF(__pyx_t_7);
2940   __Pyx_XDECREF(__pyx_t_8);
2941   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2942     __Pyx_PyThreadState_declare
2943     __Pyx_PyThreadState_assign
2944     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2945     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
2946     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
2947   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2948   __Pyx_AddTraceback("yt.utilities.lib.cykdtree.utils.py_max_pts", __pyx_clineno, __pyx_lineno, __pyx_filename);
2949   __pyx_r = NULL;
2950   goto __pyx_L2;
2951   __pyx_L0:;
2952   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
2953   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
2954   __pyx_L2:;
2955   __Pyx_XDECREF((PyObject *)__pyx_v_out);
2956   __Pyx_XGIVEREF(__pyx_r);
2957   __Pyx_RefNannyFinishContext();
2958   return __pyx_r;
2959 }
2960 
2961 /* "yt/utilities/lib/cykdtree/utils.pyx":38
2962  *     return out
2963  *
2964  * def py_min_pts(np.ndarray[np.float64_t, ndim=2] pos):             # <<<<<<<<<<<<<<
2965  *     r"""Get the minimum of points along each coordinate.
2966  *
2967  */
2968 
2969 /* Python wrapper */
2970 static PyObject *__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_3py_min_pts(PyObject *__pyx_self, PyObject *__pyx_v_pos); /*proto*/
2971 static char __pyx_doc_2yt_9utilities_3lib_8cykdtree_5utils_2py_min_pts[] = "Get the minimum of points along each coordinate.\n\n    Args:\n        pos (np.ndarray of float64): (n,m) array of n m-D coordinates.\n\n    Returns:\n        np.ndarray of float64: Minimum of pos along each coordinate.\n\n    ";
2972 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_8cykdtree_5utils_3py_min_pts = {"py_min_pts", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_3py_min_pts, METH_O, __pyx_doc_2yt_9utilities_3lib_8cykdtree_5utils_2py_min_pts};
__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_3py_min_pts(PyObject * __pyx_self,PyObject * __pyx_v_pos)2973 static PyObject *__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_3py_min_pts(PyObject *__pyx_self, PyObject *__pyx_v_pos) {
2974   PyObject *__pyx_r = 0;
2975   __Pyx_RefNannyDeclarations
2976   __Pyx_RefNannySetupContext("py_min_pts (wrapper)", 0);
2977   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 1, "pos", 0))) __PYX_ERR(0, 38, __pyx_L1_error)
2978   __pyx_r = __pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_2py_min_pts(__pyx_self, ((PyArrayObject *)__pyx_v_pos));
2979 
2980   /* function exit code */
2981   goto __pyx_L0;
2982   __pyx_L1_error:;
2983   __pyx_r = NULL;
2984   __pyx_L0:;
2985   __Pyx_RefNannyFinishContext();
2986   return __pyx_r;
2987 }
2988 
__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_2py_min_pts(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_pos)2989 static PyObject *__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_2py_min_pts(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos) {
2990   uint64_t __pyx_v_n;
2991   uint32_t __pyx_v_m;
2992   __pyx_t_5numpy_float64_t *__pyx_v_cout;
2993   uint32_t __pyx_v_i;
2994   PyArrayObject *__pyx_v_out = 0;
2995   __Pyx_LocalBuf_ND __pyx_pybuffernd_out;
2996   __Pyx_Buffer __pyx_pybuffer_out;
2997   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos;
2998   __Pyx_Buffer __pyx_pybuffer_pos;
2999   PyObject *__pyx_r = NULL;
3000   __Pyx_RefNannyDeclarations
3001   Py_ssize_t __pyx_t_1;
3002   Py_ssize_t __pyx_t_2;
3003   int __pyx_t_3;
3004   PyObject *__pyx_t_4 = NULL;
3005   PyObject *__pyx_t_5 = NULL;
3006   PyObject *__pyx_t_6 = NULL;
3007   PyObject *__pyx_t_7 = NULL;
3008   PyObject *__pyx_t_8 = NULL;
3009   PyArrayObject *__pyx_t_9 = NULL;
3010   uint32_t __pyx_t_10;
3011   uint32_t __pyx_t_11;
3012   uint32_t __pyx_t_12;
3013   size_t __pyx_t_13;
3014   __Pyx_RefNannySetupContext("py_min_pts", 0);
3015   __pyx_pybuffer_out.pybuffer.buf = NULL;
3016   __pyx_pybuffer_out.refcount = 0;
3017   __pyx_pybuffernd_out.data = NULL;
3018   __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out;
3019   __pyx_pybuffer_pos.pybuffer.buf = NULL;
3020   __pyx_pybuffer_pos.refcount = 0;
3021   __pyx_pybuffernd_pos.data = NULL;
3022   __pyx_pybuffernd_pos.rcbuffer = &__pyx_pybuffer_pos;
3023   {
3024     __Pyx_BufFmt_StackElem __pyx_stack[1];
3025     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 38, __pyx_L1_error)
3026   }
3027   __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1];
3028 
3029   /* "yt/utilities/lib/cykdtree/utils.pyx":48
3030  *
3031  *     """
3032  *     cdef uint64_t n = <uint64_t>pos.shape[0]             # <<<<<<<<<<<<<<
3033  *     cdef uint32_t m = <uint32_t>pos.shape[1]
3034  *     cdef np.float64_t* cout = min_pts(&pos[0,0], n, m)
3035  */
3036   __pyx_v_n = ((uint64_t)(__pyx_v_pos->dimensions[0]));
3037 
3038   /* "yt/utilities/lib/cykdtree/utils.pyx":49
3039  *     """
3040  *     cdef uint64_t n = <uint64_t>pos.shape[0]
3041  *     cdef uint32_t m = <uint32_t>pos.shape[1]             # <<<<<<<<<<<<<<
3042  *     cdef np.float64_t* cout = min_pts(&pos[0,0], n, m)
3043  *     cdef uint32_t i = 0
3044  */
3045   __pyx_v_m = ((uint32_t)(__pyx_v_pos->dimensions[1]));
3046 
3047   /* "yt/utilities/lib/cykdtree/utils.pyx":50
3048  *     cdef uint64_t n = <uint64_t>pos.shape[0]
3049  *     cdef uint32_t m = <uint32_t>pos.shape[1]
3050  *     cdef np.float64_t* cout = min_pts(&pos[0,0], n, m)             # <<<<<<<<<<<<<<
3051  *     cdef uint32_t i = 0
3052  *     cdef np.ndarray[np.float64_t] out = np.zeros(m, 'float64')
3053  */
3054   __pyx_t_1 = 0;
3055   __pyx_t_2 = 0;
3056   __pyx_t_3 = -1;
3057   if (__pyx_t_1 < 0) {
3058     __pyx_t_1 += __pyx_pybuffernd_pos.diminfo[0].shape;
3059     if (unlikely(__pyx_t_1 < 0)) __pyx_t_3 = 0;
3060   } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_pos.diminfo[0].shape)) __pyx_t_3 = 0;
3061   if (__pyx_t_2 < 0) {
3062     __pyx_t_2 += __pyx_pybuffernd_pos.diminfo[1].shape;
3063     if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 1;
3064   } else if (unlikely(__pyx_t_2 >= __pyx_pybuffernd_pos.diminfo[1].shape)) __pyx_t_3 = 1;
3065   if (unlikely(__pyx_t_3 != -1)) {
3066     __Pyx_RaiseBufferIndexError(__pyx_t_3);
3067     __PYX_ERR(0, 50, __pyx_L1_error)
3068   }
3069   __pyx_v_cout = min_pts((&(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_pos.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_pos.diminfo[0].strides, __pyx_t_2, __pyx_pybuffernd_pos.diminfo[1].strides))), __pyx_v_n, __pyx_v_m);
3070 
3071   /* "yt/utilities/lib/cykdtree/utils.pyx":51
3072  *     cdef uint32_t m = <uint32_t>pos.shape[1]
3073  *     cdef np.float64_t* cout = min_pts(&pos[0,0], n, m)
3074  *     cdef uint32_t i = 0             # <<<<<<<<<<<<<<
3075  *     cdef np.ndarray[np.float64_t] out = np.zeros(m, 'float64')
3076  *     for i in range(m):
3077  */
3078   __pyx_v_i = 0;
3079 
3080   /* "yt/utilities/lib/cykdtree/utils.pyx":52
3081  *     cdef np.float64_t* cout = min_pts(&pos[0,0], n, m)
3082  *     cdef uint32_t i = 0
3083  *     cdef np.ndarray[np.float64_t] out = np.zeros(m, 'float64')             # <<<<<<<<<<<<<<
3084  *     for i in range(m):
3085  *         out[i] = cout[i]
3086  */
3087   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 52, __pyx_L1_error)
3088   __Pyx_GOTREF(__pyx_t_5);
3089   __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 52, __pyx_L1_error)
3090   __Pyx_GOTREF(__pyx_t_6);
3091   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3092   __pyx_t_5 = __Pyx_PyInt_From_uint32_t(__pyx_v_m); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 52, __pyx_L1_error)
3093   __Pyx_GOTREF(__pyx_t_5);
3094   __pyx_t_7 = NULL;
3095   __pyx_t_3 = 0;
3096   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
3097     __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
3098     if (likely(__pyx_t_7)) {
3099       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
3100       __Pyx_INCREF(__pyx_t_7);
3101       __Pyx_INCREF(function);
3102       __Pyx_DECREF_SET(__pyx_t_6, function);
3103       __pyx_t_3 = 1;
3104     }
3105   }
3106   #if CYTHON_FAST_PYCALL
3107   if (PyFunction_Check(__pyx_t_6)) {
3108     PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_5, __pyx_n_s_float64};
3109     __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_3, 2+__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L1_error)
3110     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
3111     __Pyx_GOTREF(__pyx_t_4);
3112     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3113   } else
3114   #endif
3115   #if CYTHON_FAST_PYCCALL
3116   if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
3117     PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_5, __pyx_n_s_float64};
3118     __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_3, 2+__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L1_error)
3119     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
3120     __Pyx_GOTREF(__pyx_t_4);
3121     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3122   } else
3123   #endif
3124   {
3125     __pyx_t_8 = PyTuple_New(2+__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 52, __pyx_L1_error)
3126     __Pyx_GOTREF(__pyx_t_8);
3127     if (__pyx_t_7) {
3128       __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
3129     }
3130     __Pyx_GIVEREF(__pyx_t_5);
3131     PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_3, __pyx_t_5);
3132     __Pyx_INCREF(__pyx_n_s_float64);
3133     __Pyx_GIVEREF(__pyx_n_s_float64);
3134     PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_3, __pyx_n_s_float64);
3135     __pyx_t_5 = 0;
3136     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L1_error)
3137     __Pyx_GOTREF(__pyx_t_4);
3138     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3139   }
3140   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3141   if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 52, __pyx_L1_error)
3142   __pyx_t_9 = ((PyArrayObject *)__pyx_t_4);
3143   {
3144     __Pyx_BufFmt_StackElem __pyx_stack[1];
3145     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
3146       __pyx_v_out = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_out.rcbuffer->pybuffer.buf = NULL;
3147       __PYX_ERR(0, 52, __pyx_L1_error)
3148     } else {__pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0];
3149     }
3150   }
3151   __pyx_t_9 = 0;
3152   __pyx_v_out = ((PyArrayObject *)__pyx_t_4);
3153   __pyx_t_4 = 0;
3154 
3155   /* "yt/utilities/lib/cykdtree/utils.pyx":53
3156  *     cdef uint32_t i = 0
3157  *     cdef np.ndarray[np.float64_t] out = np.zeros(m, 'float64')
3158  *     for i in range(m):             # <<<<<<<<<<<<<<
3159  *         out[i] = cout[i]
3160  *     #free(cout)
3161  */
3162   __pyx_t_10 = __pyx_v_m;
3163   __pyx_t_11 = __pyx_t_10;
3164   for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
3165     __pyx_v_i = __pyx_t_12;
3166 
3167     /* "yt/utilities/lib/cykdtree/utils.pyx":54
3168  *     cdef np.ndarray[np.float64_t] out = np.zeros(m, 'float64')
3169  *     for i in range(m):
3170  *         out[i] = cout[i]             # <<<<<<<<<<<<<<
3171  *     #free(cout)
3172  *     return out
3173  */
3174     __pyx_t_13 = __pyx_v_i;
3175     __pyx_t_3 = -1;
3176     if (unlikely(__pyx_t_13 >= (size_t)__pyx_pybuffernd_out.diminfo[0].shape)) __pyx_t_3 = 0;
3177     if (unlikely(__pyx_t_3 != -1)) {
3178       __Pyx_RaiseBufferIndexError(__pyx_t_3);
3179       __PYX_ERR(0, 54, __pyx_L1_error)
3180     }
3181     *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_out.diminfo[0].strides) = (__pyx_v_cout[__pyx_v_i]);
3182   }
3183 
3184   /* "yt/utilities/lib/cykdtree/utils.pyx":56
3185  *         out[i] = cout[i]
3186  *     #free(cout)
3187  *     return out             # <<<<<<<<<<<<<<
3188  *
3189  * def py_argmax_pts_dim(np.ndarray[np.float64_t, ndim=2] pos,
3190  */
3191   __Pyx_XDECREF(__pyx_r);
3192   __Pyx_INCREF(((PyObject *)__pyx_v_out));
3193   __pyx_r = ((PyObject *)__pyx_v_out);
3194   goto __pyx_L0;
3195 
3196   /* "yt/utilities/lib/cykdtree/utils.pyx":38
3197  *     return out
3198  *
3199  * def py_min_pts(np.ndarray[np.float64_t, ndim=2] pos):             # <<<<<<<<<<<<<<
3200  *     r"""Get the minimum of points along each coordinate.
3201  *
3202  */
3203 
3204   /* function exit code */
3205   __pyx_L1_error:;
3206   __Pyx_XDECREF(__pyx_t_4);
3207   __Pyx_XDECREF(__pyx_t_5);
3208   __Pyx_XDECREF(__pyx_t_6);
3209   __Pyx_XDECREF(__pyx_t_7);
3210   __Pyx_XDECREF(__pyx_t_8);
3211   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3212     __Pyx_PyThreadState_declare
3213     __Pyx_PyThreadState_assign
3214     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3215     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
3216     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
3217   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3218   __Pyx_AddTraceback("yt.utilities.lib.cykdtree.utils.py_min_pts", __pyx_clineno, __pyx_lineno, __pyx_filename);
3219   __pyx_r = NULL;
3220   goto __pyx_L2;
3221   __pyx_L0:;
3222   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_out.rcbuffer->pybuffer);
3223   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
3224   __pyx_L2:;
3225   __Pyx_XDECREF((PyObject *)__pyx_v_out);
3226   __Pyx_XGIVEREF(__pyx_r);
3227   __Pyx_RefNannyFinishContext();
3228   return __pyx_r;
3229 }
3230 
3231 /* "yt/utilities/lib/cykdtree/utils.pyx":58
3232  *     return out
3233  *
3234  * def py_argmax_pts_dim(np.ndarray[np.float64_t, ndim=2] pos,             # <<<<<<<<<<<<<<
3235  *                       uint64_t[:] idx,
3236  *                       np.uint32_t d, int Lidx0, int Ridx0):
3237  */
3238 
3239 /* Python wrapper */
3240 static PyObject *__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_5py_argmax_pts_dim(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3241 static char __pyx_doc_2yt_9utilities_3lib_8cykdtree_5utils_4py_argmax_pts_dim[] = "Get the maximum of points along one dimension for a subset of the\n    point indices. This is essentially max(pos[idx[Lidx:(Ridx+1)], d]).\n\n    Args:\n        pos (np.ndarray of float64): (n,m) array of n m-D coordinates.\n        idx (np.ndarray of uint64_t): (n,) array of indices for positions.\n        d (uint32_t): Dimension to compute maximum along.\n        Lidx (int): Index in idx that search should begin at.\n        Ridx (int): Index in idx that search should end at.\n\n    Returns:\n        uint64_t: Index in idx that provides maximum position in the subset\n            indices along dimension d.\n\n    ";
3242 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_8cykdtree_5utils_5py_argmax_pts_dim = {"py_argmax_pts_dim", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_5py_argmax_pts_dim, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2yt_9utilities_3lib_8cykdtree_5utils_4py_argmax_pts_dim};
__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_5py_argmax_pts_dim(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3243 static PyObject *__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_5py_argmax_pts_dim(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3244   PyArrayObject *__pyx_v_pos = 0;
3245   __Pyx_memviewslice __pyx_v_idx = { 0, 0, { 0 }, { 0 }, { 0 } };
3246   __pyx_t_5numpy_uint32_t __pyx_v_d;
3247   int __pyx_v_Lidx0;
3248   int __pyx_v_Ridx0;
3249   PyObject *__pyx_r = 0;
3250   __Pyx_RefNannyDeclarations
3251   __Pyx_RefNannySetupContext("py_argmax_pts_dim (wrapper)", 0);
3252   {
3253     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_idx,&__pyx_n_s_d,&__pyx_n_s_Lidx0,&__pyx_n_s_Ridx0,0};
3254     PyObject* values[5] = {0,0,0,0,0};
3255     if (unlikely(__pyx_kwds)) {
3256       Py_ssize_t kw_args;
3257       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3258       switch (pos_args) {
3259         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3260         CYTHON_FALLTHROUGH;
3261         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3262         CYTHON_FALLTHROUGH;
3263         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3264         CYTHON_FALLTHROUGH;
3265         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3266         CYTHON_FALLTHROUGH;
3267         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3268         CYTHON_FALLTHROUGH;
3269         case  0: break;
3270         default: goto __pyx_L5_argtuple_error;
3271       }
3272       kw_args = PyDict_Size(__pyx_kwds);
3273       switch (pos_args) {
3274         case  0:
3275         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
3276         else goto __pyx_L5_argtuple_error;
3277         CYTHON_FALLTHROUGH;
3278         case  1:
3279         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_idx)) != 0)) kw_args--;
3280         else {
3281           __Pyx_RaiseArgtupleInvalid("py_argmax_pts_dim", 1, 5, 5, 1); __PYX_ERR(0, 58, __pyx_L3_error)
3282         }
3283         CYTHON_FALLTHROUGH;
3284         case  2:
3285         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
3286         else {
3287           __Pyx_RaiseArgtupleInvalid("py_argmax_pts_dim", 1, 5, 5, 2); __PYX_ERR(0, 58, __pyx_L3_error)
3288         }
3289         CYTHON_FALLTHROUGH;
3290         case  3:
3291         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Lidx0)) != 0)) kw_args--;
3292         else {
3293           __Pyx_RaiseArgtupleInvalid("py_argmax_pts_dim", 1, 5, 5, 3); __PYX_ERR(0, 58, __pyx_L3_error)
3294         }
3295         CYTHON_FALLTHROUGH;
3296         case  4:
3297         if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Ridx0)) != 0)) kw_args--;
3298         else {
3299           __Pyx_RaiseArgtupleInvalid("py_argmax_pts_dim", 1, 5, 5, 4); __PYX_ERR(0, 58, __pyx_L3_error)
3300         }
3301       }
3302       if (unlikely(kw_args > 0)) {
3303         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "py_argmax_pts_dim") < 0)) __PYX_ERR(0, 58, __pyx_L3_error)
3304       }
3305     } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
3306       goto __pyx_L5_argtuple_error;
3307     } else {
3308       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3309       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3310       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3311       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3312       values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3313     }
3314     __pyx_v_pos = ((PyArrayObject *)values[0]);
3315     __pyx_v_idx = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_uint64_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_idx.memview)) __PYX_ERR(0, 59, __pyx_L3_error)
3316     __pyx_v_d = __Pyx_PyInt_As_npy_uint32(values[2]); if (unlikely((__pyx_v_d == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L3_error)
3317     __pyx_v_Lidx0 = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_Lidx0 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L3_error)
3318     __pyx_v_Ridx0 = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_Ridx0 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L3_error)
3319   }
3320   goto __pyx_L4_argument_unpacking_done;
3321   __pyx_L5_argtuple_error:;
3322   __Pyx_RaiseArgtupleInvalid("py_argmax_pts_dim", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 58, __pyx_L3_error)
3323   __pyx_L3_error:;
3324   __Pyx_AddTraceback("yt.utilities.lib.cykdtree.utils.py_argmax_pts_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
3325   __Pyx_RefNannyFinishContext();
3326   return NULL;
3327   __pyx_L4_argument_unpacking_done:;
3328   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 1, "pos", 0))) __PYX_ERR(0, 58, __pyx_L1_error)
3329   __pyx_r = __pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_4py_argmax_pts_dim(__pyx_self, __pyx_v_pos, __pyx_v_idx, __pyx_v_d, __pyx_v_Lidx0, __pyx_v_Ridx0);
3330 
3331   /* function exit code */
3332   goto __pyx_L0;
3333   __pyx_L1_error:;
3334   __pyx_r = NULL;
3335   __pyx_L0:;
3336   __Pyx_RefNannyFinishContext();
3337   return __pyx_r;
3338 }
3339 
__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_4py_argmax_pts_dim(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_pos,__Pyx_memviewslice __pyx_v_idx,__pyx_t_5numpy_uint32_t __pyx_v_d,int __pyx_v_Lidx0,int __pyx_v_Ridx0)3340 static PyObject *__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_4py_argmax_pts_dim(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __Pyx_memviewslice __pyx_v_idx, __pyx_t_5numpy_uint32_t __pyx_v_d, int __pyx_v_Lidx0, int __pyx_v_Ridx0) {
3341   __pyx_t_5numpy_intp_t __pyx_v_n;
3342   uint32_t __pyx_v_m;
3343   uint64_t __pyx_v_Lidx;
3344   uint64_t __pyx_v_Ridx;
3345   __pyx_t_5numpy_uint64_t __pyx_v_cout;
3346   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos;
3347   __Pyx_Buffer __pyx_pybuffer_pos;
3348   PyObject *__pyx_r = NULL;
3349   __Pyx_RefNannyDeclarations
3350   int __pyx_t_1;
3351   PyObject *__pyx_t_2 = NULL;
3352   PyObject *__pyx_t_3 = NULL;
3353   PyObject *__pyx_t_4 = NULL;
3354   Py_ssize_t __pyx_t_5;
3355   Py_ssize_t __pyx_t_6;
3356   int __pyx_t_7;
3357   Py_ssize_t __pyx_t_8;
3358   __Pyx_RefNannySetupContext("py_argmax_pts_dim", 0);
3359   __pyx_pybuffer_pos.pybuffer.buf = NULL;
3360   __pyx_pybuffer_pos.refcount = 0;
3361   __pyx_pybuffernd_pos.data = NULL;
3362   __pyx_pybuffernd_pos.rcbuffer = &__pyx_pybuffer_pos;
3363   {
3364     __Pyx_BufFmt_StackElem __pyx_stack[1];
3365     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 58, __pyx_L1_error)
3366   }
3367   __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1];
3368 
3369   /* "yt/utilities/lib/cykdtree/utils.pyx":76
3370  *
3371  *     """
3372  *     cdef np.intp_t n = pos.shape[0]             # <<<<<<<<<<<<<<
3373  *     cdef uint32_t m = <uint32_t>pos.shape[1]
3374  *     cdef uint64_t Lidx = 0
3375  */
3376   __pyx_v_n = (__pyx_v_pos->dimensions[0]);
3377 
3378   /* "yt/utilities/lib/cykdtree/utils.pyx":77
3379  *     """
3380  *     cdef np.intp_t n = pos.shape[0]
3381  *     cdef uint32_t m = <uint32_t>pos.shape[1]             # <<<<<<<<<<<<<<
3382  *     cdef uint64_t Lidx = 0
3383  *     cdef uint64_t Ridx = <uint64_t>(n-1)
3384  */
3385   __pyx_v_m = ((uint32_t)(__pyx_v_pos->dimensions[1]));
3386 
3387   /* "yt/utilities/lib/cykdtree/utils.pyx":78
3388  *     cdef np.intp_t n = pos.shape[0]
3389  *     cdef uint32_t m = <uint32_t>pos.shape[1]
3390  *     cdef uint64_t Lidx = 0             # <<<<<<<<<<<<<<
3391  *     cdef uint64_t Ridx = <uint64_t>(n-1)
3392  *     if (Lidx0 < 0):
3393  */
3394   __pyx_v_Lidx = 0;
3395 
3396   /* "yt/utilities/lib/cykdtree/utils.pyx":79
3397  *     cdef uint32_t m = <uint32_t>pos.shape[1]
3398  *     cdef uint64_t Lidx = 0
3399  *     cdef uint64_t Ridx = <uint64_t>(n-1)             # <<<<<<<<<<<<<<
3400  *     if (Lidx0 < 0):
3401  *         Lidx = <uint64_t>(n + Lidx0)
3402  */
3403   __pyx_v_Ridx = ((uint64_t)(__pyx_v_n - 1));
3404 
3405   /* "yt/utilities/lib/cykdtree/utils.pyx":80
3406  *     cdef uint64_t Lidx = 0
3407  *     cdef uint64_t Ridx = <uint64_t>(n-1)
3408  *     if (Lidx0 < 0):             # <<<<<<<<<<<<<<
3409  *         Lidx = <uint64_t>(n + Lidx0)
3410  *     elif Lidx0 >= n:
3411  */
3412   __pyx_t_1 = ((__pyx_v_Lidx0 < 0) != 0);
3413   if (__pyx_t_1) {
3414 
3415     /* "yt/utilities/lib/cykdtree/utils.pyx":81
3416  *     cdef uint64_t Ridx = <uint64_t>(n-1)
3417  *     if (Lidx0 < 0):
3418  *         Lidx = <uint64_t>(n + Lidx0)             # <<<<<<<<<<<<<<
3419  *     elif Lidx0 >= n:
3420  *         raise Exception("Left index (%d) exceeds size of positions array (%d)."
3421  */
3422     __pyx_v_Lidx = ((uint64_t)(__pyx_v_n + __pyx_v_Lidx0));
3423 
3424     /* "yt/utilities/lib/cykdtree/utils.pyx":80
3425  *     cdef uint64_t Lidx = 0
3426  *     cdef uint64_t Ridx = <uint64_t>(n-1)
3427  *     if (Lidx0 < 0):             # <<<<<<<<<<<<<<
3428  *         Lidx = <uint64_t>(n + Lidx0)
3429  *     elif Lidx0 >= n:
3430  */
3431     goto __pyx_L3;
3432   }
3433 
3434   /* "yt/utilities/lib/cykdtree/utils.pyx":82
3435  *     if (Lidx0 < 0):
3436  *         Lidx = <uint64_t>(n + Lidx0)
3437  *     elif Lidx0 >= n:             # <<<<<<<<<<<<<<
3438  *         raise Exception("Left index (%d) exceeds size of positions array (%d)."
3439  *                             % (Lidx0, n))
3440  */
3441   __pyx_t_1 = ((__pyx_v_Lidx0 >= __pyx_v_n) != 0);
3442   if (unlikely(__pyx_t_1)) {
3443 
3444     /* "yt/utilities/lib/cykdtree/utils.pyx":84
3445  *     elif Lidx0 >= n:
3446  *         raise Exception("Left index (%d) exceeds size of positions array (%d)."
3447  *                             % (Lidx0, n))             # <<<<<<<<<<<<<<
3448  *     else:
3449  *         Lidx = <uint64_t>Lidx0
3450  */
3451     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_Lidx0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error)
3452     __Pyx_GOTREF(__pyx_t_2);
3453     __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error)
3454     __Pyx_GOTREF(__pyx_t_3);
3455     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error)
3456     __Pyx_GOTREF(__pyx_t_4);
3457     __Pyx_GIVEREF(__pyx_t_2);
3458     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
3459     __Pyx_GIVEREF(__pyx_t_3);
3460     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
3461     __pyx_t_2 = 0;
3462     __pyx_t_3 = 0;
3463     __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Left_index_d_exceeds_size_of_pos, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error)
3464     __Pyx_GOTREF(__pyx_t_3);
3465     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3466 
3467     /* "yt/utilities/lib/cykdtree/utils.pyx":83
3468  *         Lidx = <uint64_t>(n + Lidx0)
3469  *     elif Lidx0 >= n:
3470  *         raise Exception("Left index (%d) exceeds size of positions array (%d)."             # <<<<<<<<<<<<<<
3471  *                             % (Lidx0, n))
3472  *     else:
3473  */
3474     __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L1_error)
3475     __Pyx_GOTREF(__pyx_t_4);
3476     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3477     __Pyx_Raise(__pyx_t_4, 0, 0, 0);
3478     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3479     __PYX_ERR(0, 83, __pyx_L1_error)
3480 
3481     /* "yt/utilities/lib/cykdtree/utils.pyx":82
3482  *     if (Lidx0 < 0):
3483  *         Lidx = <uint64_t>(n + Lidx0)
3484  *     elif Lidx0 >= n:             # <<<<<<<<<<<<<<
3485  *         raise Exception("Left index (%d) exceeds size of positions array (%d)."
3486  *                             % (Lidx0, n))
3487  */
3488   }
3489 
3490   /* "yt/utilities/lib/cykdtree/utils.pyx":86
3491  *                             % (Lidx0, n))
3492  *     else:
3493  *         Lidx = <uint64_t>Lidx0             # <<<<<<<<<<<<<<
3494  *     if (Ridx0 < 0):
3495  *         Ridx = <uint64_t>(n + Ridx0)
3496  */
3497   /*else*/ {
3498     __pyx_v_Lidx = ((uint64_t)__pyx_v_Lidx0);
3499   }
3500   __pyx_L3:;
3501 
3502   /* "yt/utilities/lib/cykdtree/utils.pyx":87
3503  *     else:
3504  *         Lidx = <uint64_t>Lidx0
3505  *     if (Ridx0 < 0):             # <<<<<<<<<<<<<<
3506  *         Ridx = <uint64_t>(n + Ridx0)
3507  *     elif Ridx0 >= n:
3508  */
3509   __pyx_t_1 = ((__pyx_v_Ridx0 < 0) != 0);
3510   if (__pyx_t_1) {
3511 
3512     /* "yt/utilities/lib/cykdtree/utils.pyx":88
3513  *         Lidx = <uint64_t>Lidx0
3514  *     if (Ridx0 < 0):
3515  *         Ridx = <uint64_t>(n + Ridx0)             # <<<<<<<<<<<<<<
3516  *     elif Ridx0 >= n:
3517  *         raise Exception("Right index (%d) exceeds size of positions array (%d)."
3518  */
3519     __pyx_v_Ridx = ((uint64_t)(__pyx_v_n + __pyx_v_Ridx0));
3520 
3521     /* "yt/utilities/lib/cykdtree/utils.pyx":87
3522  *     else:
3523  *         Lidx = <uint64_t>Lidx0
3524  *     if (Ridx0 < 0):             # <<<<<<<<<<<<<<
3525  *         Ridx = <uint64_t>(n + Ridx0)
3526  *     elif Ridx0 >= n:
3527  */
3528     goto __pyx_L4;
3529   }
3530 
3531   /* "yt/utilities/lib/cykdtree/utils.pyx":89
3532  *     if (Ridx0 < 0):
3533  *         Ridx = <uint64_t>(n + Ridx0)
3534  *     elif Ridx0 >= n:             # <<<<<<<<<<<<<<
3535  *         raise Exception("Right index (%d) exceeds size of positions array (%d)."
3536  *                             % (Ridx0, n))
3537  */
3538   __pyx_t_1 = ((__pyx_v_Ridx0 >= __pyx_v_n) != 0);
3539   if (unlikely(__pyx_t_1)) {
3540 
3541     /* "yt/utilities/lib/cykdtree/utils.pyx":91
3542  *     elif Ridx0 >= n:
3543  *         raise Exception("Right index (%d) exceeds size of positions array (%d)."
3544  *                             % (Ridx0, n))             # <<<<<<<<<<<<<<
3545  *     else:
3546  *         Ridx = <uint64_t>Ridx0
3547  */
3548     __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_Ridx0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error)
3549     __Pyx_GOTREF(__pyx_t_4);
3550     __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error)
3551     __Pyx_GOTREF(__pyx_t_3);
3552     __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error)
3553     __Pyx_GOTREF(__pyx_t_2);
3554     __Pyx_GIVEREF(__pyx_t_4);
3555     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
3556     __Pyx_GIVEREF(__pyx_t_3);
3557     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
3558     __pyx_t_4 = 0;
3559     __pyx_t_3 = 0;
3560     __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Right_index_d_exceeds_size_of_po, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error)
3561     __Pyx_GOTREF(__pyx_t_3);
3562     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3563 
3564     /* "yt/utilities/lib/cykdtree/utils.pyx":90
3565  *         Ridx = <uint64_t>(n + Ridx0)
3566  *     elif Ridx0 >= n:
3567  *         raise Exception("Right index (%d) exceeds size of positions array (%d)."             # <<<<<<<<<<<<<<
3568  *                             % (Ridx0, n))
3569  *     else:
3570  */
3571     __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error)
3572     __Pyx_GOTREF(__pyx_t_2);
3573     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3574     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
3575     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3576     __PYX_ERR(0, 90, __pyx_L1_error)
3577 
3578     /* "yt/utilities/lib/cykdtree/utils.pyx":89
3579  *     if (Ridx0 < 0):
3580  *         Ridx = <uint64_t>(n + Ridx0)
3581  *     elif Ridx0 >= n:             # <<<<<<<<<<<<<<
3582  *         raise Exception("Right index (%d) exceeds size of positions array (%d)."
3583  *                             % (Ridx0, n))
3584  */
3585   }
3586 
3587   /* "yt/utilities/lib/cykdtree/utils.pyx":93
3588  *                             % (Ridx0, n))
3589  *     else:
3590  *         Ridx = <uint64_t>Ridx0             # <<<<<<<<<<<<<<
3591  *     cdef np.uint64_t cout = Lidx
3592  *     if (Ridx > Lidx):
3593  */
3594   /*else*/ {
3595     __pyx_v_Ridx = ((uint64_t)__pyx_v_Ridx0);
3596   }
3597   __pyx_L4:;
3598 
3599   /* "yt/utilities/lib/cykdtree/utils.pyx":94
3600  *     else:
3601  *         Ridx = <uint64_t>Ridx0
3602  *     cdef np.uint64_t cout = Lidx             # <<<<<<<<<<<<<<
3603  *     if (Ridx > Lidx):
3604  *         cout = argmax_pts_dim(&pos[0,0], &idx[0], m, d, Lidx, Ridx)
3605  */
3606   __pyx_v_cout = __pyx_v_Lidx;
3607 
3608   /* "yt/utilities/lib/cykdtree/utils.pyx":95
3609  *         Ridx = <uint64_t>Ridx0
3610  *     cdef np.uint64_t cout = Lidx
3611  *     if (Ridx > Lidx):             # <<<<<<<<<<<<<<
3612  *         cout = argmax_pts_dim(&pos[0,0], &idx[0], m, d, Lidx, Ridx)
3613  *     return cout
3614  */
3615   __pyx_t_1 = ((__pyx_v_Ridx > __pyx_v_Lidx) != 0);
3616   if (__pyx_t_1) {
3617 
3618     /* "yt/utilities/lib/cykdtree/utils.pyx":96
3619  *     cdef np.uint64_t cout = Lidx
3620  *     if (Ridx > Lidx):
3621  *         cout = argmax_pts_dim(&pos[0,0], &idx[0], m, d, Lidx, Ridx)             # <<<<<<<<<<<<<<
3622  *     return cout
3623  *
3624  */
3625     __pyx_t_5 = 0;
3626     __pyx_t_6 = 0;
3627     __pyx_t_7 = -1;
3628     if (__pyx_t_5 < 0) {
3629       __pyx_t_5 += __pyx_pybuffernd_pos.diminfo[0].shape;
3630       if (unlikely(__pyx_t_5 < 0)) __pyx_t_7 = 0;
3631     } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_pos.diminfo[0].shape)) __pyx_t_7 = 0;
3632     if (__pyx_t_6 < 0) {
3633       __pyx_t_6 += __pyx_pybuffernd_pos.diminfo[1].shape;
3634       if (unlikely(__pyx_t_6 < 0)) __pyx_t_7 = 1;
3635     } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_pos.diminfo[1].shape)) __pyx_t_7 = 1;
3636     if (unlikely(__pyx_t_7 != -1)) {
3637       __Pyx_RaiseBufferIndexError(__pyx_t_7);
3638       __PYX_ERR(0, 96, __pyx_L1_error)
3639     }
3640     __pyx_t_8 = 0;
3641     __pyx_t_7 = -1;
3642     if (__pyx_t_8 < 0) {
3643       __pyx_t_8 += __pyx_v_idx.shape[0];
3644       if (unlikely(__pyx_t_8 < 0)) __pyx_t_7 = 0;
3645     } else if (unlikely(__pyx_t_8 >= __pyx_v_idx.shape[0])) __pyx_t_7 = 0;
3646     if (unlikely(__pyx_t_7 != -1)) {
3647       __Pyx_RaiseBufferIndexError(__pyx_t_7);
3648       __PYX_ERR(0, 96, __pyx_L1_error)
3649     }
3650     __pyx_v_cout = argmax_pts_dim((&(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_pos.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_pos.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_pos.diminfo[1].strides))), (&(*((uint64_t *) ( /* dim=0 */ (__pyx_v_idx.data + __pyx_t_8 * __pyx_v_idx.strides[0]) )))), __pyx_v_m, __pyx_v_d, __pyx_v_Lidx, __pyx_v_Ridx);
3651 
3652     /* "yt/utilities/lib/cykdtree/utils.pyx":95
3653  *         Ridx = <uint64_t>Ridx0
3654  *     cdef np.uint64_t cout = Lidx
3655  *     if (Ridx > Lidx):             # <<<<<<<<<<<<<<
3656  *         cout = argmax_pts_dim(&pos[0,0], &idx[0], m, d, Lidx, Ridx)
3657  *     return cout
3658  */
3659   }
3660 
3661   /* "yt/utilities/lib/cykdtree/utils.pyx":97
3662  *     if (Ridx > Lidx):
3663  *         cout = argmax_pts_dim(&pos[0,0], &idx[0], m, d, Lidx, Ridx)
3664  *     return cout             # <<<<<<<<<<<<<<
3665  *
3666  * def py_argmin_pts_dim(np.ndarray[np.float64_t, ndim=2] pos,
3667  */
3668   __Pyx_XDECREF(__pyx_r);
3669   __pyx_t_2 = __Pyx_PyInt_From_npy_uint64(__pyx_v_cout); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error)
3670   __Pyx_GOTREF(__pyx_t_2);
3671   __pyx_r = __pyx_t_2;
3672   __pyx_t_2 = 0;
3673   goto __pyx_L0;
3674 
3675   /* "yt/utilities/lib/cykdtree/utils.pyx":58
3676  *     return out
3677  *
3678  * def py_argmax_pts_dim(np.ndarray[np.float64_t, ndim=2] pos,             # <<<<<<<<<<<<<<
3679  *                       uint64_t[:] idx,
3680  *                       np.uint32_t d, int Lidx0, int Ridx0):
3681  */
3682 
3683   /* function exit code */
3684   __pyx_L1_error:;
3685   __Pyx_XDECREF(__pyx_t_2);
3686   __Pyx_XDECREF(__pyx_t_3);
3687   __Pyx_XDECREF(__pyx_t_4);
3688   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3689     __Pyx_PyThreadState_declare
3690     __Pyx_PyThreadState_assign
3691     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3692     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
3693   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3694   __Pyx_AddTraceback("yt.utilities.lib.cykdtree.utils.py_argmax_pts_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
3695   __pyx_r = NULL;
3696   goto __pyx_L2;
3697   __pyx_L0:;
3698   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
3699   __pyx_L2:;
3700   __PYX_XDEC_MEMVIEW(&__pyx_v_idx, 1);
3701   __Pyx_XGIVEREF(__pyx_r);
3702   __Pyx_RefNannyFinishContext();
3703   return __pyx_r;
3704 }
3705 
3706 /* "yt/utilities/lib/cykdtree/utils.pyx":99
3707  *     return cout
3708  *
3709  * def py_argmin_pts_dim(np.ndarray[np.float64_t, ndim=2] pos,             # <<<<<<<<<<<<<<
3710  *                       uint64_t[:] idx,
3711  *                       np.uint32_t d, int Lidx0, int Ridx0):
3712  */
3713 
3714 /* Python wrapper */
3715 static PyObject *__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_7py_argmin_pts_dim(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3716 static char __pyx_doc_2yt_9utilities_3lib_8cykdtree_5utils_6py_argmin_pts_dim[] = "Get the minimum of points along one dimension for a subset of the\n    point indices. This is essentially min(pos[idx[Lidx:(Ridx+1)], d]).\n\n    Args:\n        pos (np.ndarray of float64): (n,m) array of n m-D coordinates.\n        idx (np.ndarray of uint64_t): (n,) array of indices for positions.\n        d (uint32_t): Dimension to compute minimum along.\n        Lidx (int): Index in idx that search should begin at.\n        Ridx (int): Index in idx that search should end at.\n\n    Returns:\n        uint64_t: Index in idx that provides minimum position in the subset\n            indices along dimension d.\n\n    ";
3717 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_8cykdtree_5utils_7py_argmin_pts_dim = {"py_argmin_pts_dim", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_7py_argmin_pts_dim, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2yt_9utilities_3lib_8cykdtree_5utils_6py_argmin_pts_dim};
__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_7py_argmin_pts_dim(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3718 static PyObject *__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_7py_argmin_pts_dim(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3719   PyArrayObject *__pyx_v_pos = 0;
3720   __Pyx_memviewslice __pyx_v_idx = { 0, 0, { 0 }, { 0 }, { 0 } };
3721   __pyx_t_5numpy_uint32_t __pyx_v_d;
3722   int __pyx_v_Lidx0;
3723   int __pyx_v_Ridx0;
3724   PyObject *__pyx_r = 0;
3725   __Pyx_RefNannyDeclarations
3726   __Pyx_RefNannySetupContext("py_argmin_pts_dim (wrapper)", 0);
3727   {
3728     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_idx,&__pyx_n_s_d,&__pyx_n_s_Lidx0,&__pyx_n_s_Ridx0,0};
3729     PyObject* values[5] = {0,0,0,0,0};
3730     if (unlikely(__pyx_kwds)) {
3731       Py_ssize_t kw_args;
3732       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3733       switch (pos_args) {
3734         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3735         CYTHON_FALLTHROUGH;
3736         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3737         CYTHON_FALLTHROUGH;
3738         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3739         CYTHON_FALLTHROUGH;
3740         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3741         CYTHON_FALLTHROUGH;
3742         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3743         CYTHON_FALLTHROUGH;
3744         case  0: break;
3745         default: goto __pyx_L5_argtuple_error;
3746       }
3747       kw_args = PyDict_Size(__pyx_kwds);
3748       switch (pos_args) {
3749         case  0:
3750         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
3751         else goto __pyx_L5_argtuple_error;
3752         CYTHON_FALLTHROUGH;
3753         case  1:
3754         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_idx)) != 0)) kw_args--;
3755         else {
3756           __Pyx_RaiseArgtupleInvalid("py_argmin_pts_dim", 1, 5, 5, 1); __PYX_ERR(0, 99, __pyx_L3_error)
3757         }
3758         CYTHON_FALLTHROUGH;
3759         case  2:
3760         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
3761         else {
3762           __Pyx_RaiseArgtupleInvalid("py_argmin_pts_dim", 1, 5, 5, 2); __PYX_ERR(0, 99, __pyx_L3_error)
3763         }
3764         CYTHON_FALLTHROUGH;
3765         case  3:
3766         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Lidx0)) != 0)) kw_args--;
3767         else {
3768           __Pyx_RaiseArgtupleInvalid("py_argmin_pts_dim", 1, 5, 5, 3); __PYX_ERR(0, 99, __pyx_L3_error)
3769         }
3770         CYTHON_FALLTHROUGH;
3771         case  4:
3772         if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Ridx0)) != 0)) kw_args--;
3773         else {
3774           __Pyx_RaiseArgtupleInvalid("py_argmin_pts_dim", 1, 5, 5, 4); __PYX_ERR(0, 99, __pyx_L3_error)
3775         }
3776       }
3777       if (unlikely(kw_args > 0)) {
3778         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "py_argmin_pts_dim") < 0)) __PYX_ERR(0, 99, __pyx_L3_error)
3779       }
3780     } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
3781       goto __pyx_L5_argtuple_error;
3782     } else {
3783       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3784       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3785       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3786       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3787       values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3788     }
3789     __pyx_v_pos = ((PyArrayObject *)values[0]);
3790     __pyx_v_idx = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_uint64_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_idx.memview)) __PYX_ERR(0, 100, __pyx_L3_error)
3791     __pyx_v_d = __Pyx_PyInt_As_npy_uint32(values[2]); if (unlikely((__pyx_v_d == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L3_error)
3792     __pyx_v_Lidx0 = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_Lidx0 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L3_error)
3793     __pyx_v_Ridx0 = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_Ridx0 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L3_error)
3794   }
3795   goto __pyx_L4_argument_unpacking_done;
3796   __pyx_L5_argtuple_error:;
3797   __Pyx_RaiseArgtupleInvalid("py_argmin_pts_dim", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 99, __pyx_L3_error)
3798   __pyx_L3_error:;
3799   __Pyx_AddTraceback("yt.utilities.lib.cykdtree.utils.py_argmin_pts_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
3800   __Pyx_RefNannyFinishContext();
3801   return NULL;
3802   __pyx_L4_argument_unpacking_done:;
3803   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 1, "pos", 0))) __PYX_ERR(0, 99, __pyx_L1_error)
3804   __pyx_r = __pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_6py_argmin_pts_dim(__pyx_self, __pyx_v_pos, __pyx_v_idx, __pyx_v_d, __pyx_v_Lidx0, __pyx_v_Ridx0);
3805 
3806   /* function exit code */
3807   goto __pyx_L0;
3808   __pyx_L1_error:;
3809   __pyx_r = NULL;
3810   __pyx_L0:;
3811   __Pyx_RefNannyFinishContext();
3812   return __pyx_r;
3813 }
3814 
__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_6py_argmin_pts_dim(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_pos,__Pyx_memviewslice __pyx_v_idx,__pyx_t_5numpy_uint32_t __pyx_v_d,int __pyx_v_Lidx0,int __pyx_v_Ridx0)3815 static PyObject *__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_6py_argmin_pts_dim(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __Pyx_memviewslice __pyx_v_idx, __pyx_t_5numpy_uint32_t __pyx_v_d, int __pyx_v_Lidx0, int __pyx_v_Ridx0) {
3816   uint64_t __pyx_v_n;
3817   uint32_t __pyx_v_m;
3818   uint64_t __pyx_v_Lidx;
3819   uint64_t __pyx_v_Ridx;
3820   __pyx_t_5numpy_uint64_t __pyx_v_cout;
3821   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos;
3822   __Pyx_Buffer __pyx_pybuffer_pos;
3823   PyObject *__pyx_r = NULL;
3824   __Pyx_RefNannyDeclarations
3825   int __pyx_t_1;
3826   Py_ssize_t __pyx_t_2;
3827   Py_ssize_t __pyx_t_3;
3828   int __pyx_t_4;
3829   Py_ssize_t __pyx_t_5;
3830   PyObject *__pyx_t_6 = NULL;
3831   __Pyx_RefNannySetupContext("py_argmin_pts_dim", 0);
3832   __pyx_pybuffer_pos.pybuffer.buf = NULL;
3833   __pyx_pybuffer_pos.refcount = 0;
3834   __pyx_pybuffernd_pos.data = NULL;
3835   __pyx_pybuffernd_pos.rcbuffer = &__pyx_pybuffer_pos;
3836   {
3837     __Pyx_BufFmt_StackElem __pyx_stack[1];
3838     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 99, __pyx_L1_error)
3839   }
3840   __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1];
3841 
3842   /* "yt/utilities/lib/cykdtree/utils.pyx":117
3843  *
3844  *     """
3845  *     cdef uint64_t n = <uint64_t>pos.shape[0]             # <<<<<<<<<<<<<<
3846  *     cdef uint32_t m = <uint32_t>pos.shape[1]
3847  *     cdef uint64_t Lidx = 0
3848  */
3849   __pyx_v_n = ((uint64_t)(__pyx_v_pos->dimensions[0]));
3850 
3851   /* "yt/utilities/lib/cykdtree/utils.pyx":118
3852  *     """
3853  *     cdef uint64_t n = <uint64_t>pos.shape[0]
3854  *     cdef uint32_t m = <uint32_t>pos.shape[1]             # <<<<<<<<<<<<<<
3855  *     cdef uint64_t Lidx = 0
3856  *     cdef uint64_t Ridx = n
3857  */
3858   __pyx_v_m = ((uint32_t)(__pyx_v_pos->dimensions[1]));
3859 
3860   /* "yt/utilities/lib/cykdtree/utils.pyx":119
3861  *     cdef uint64_t n = <uint64_t>pos.shape[0]
3862  *     cdef uint32_t m = <uint32_t>pos.shape[1]
3863  *     cdef uint64_t Lidx = 0             # <<<<<<<<<<<<<<
3864  *     cdef uint64_t Ridx = n
3865  *     if (Lidx0 < 0):
3866  */
3867   __pyx_v_Lidx = 0;
3868 
3869   /* "yt/utilities/lib/cykdtree/utils.pyx":120
3870  *     cdef uint32_t m = <uint32_t>pos.shape[1]
3871  *     cdef uint64_t Lidx = 0
3872  *     cdef uint64_t Ridx = n             # <<<<<<<<<<<<<<
3873  *     if (Lidx0 < 0):
3874  *         Lidx = <uint64_t>(<int>n + Lidx0)
3875  */
3876   __pyx_v_Ridx = __pyx_v_n;
3877 
3878   /* "yt/utilities/lib/cykdtree/utils.pyx":121
3879  *     cdef uint64_t Lidx = 0
3880  *     cdef uint64_t Ridx = n
3881  *     if (Lidx0 < 0):             # <<<<<<<<<<<<<<
3882  *         Lidx = <uint64_t>(<int>n + Lidx0)
3883  *     else:
3884  */
3885   __pyx_t_1 = ((__pyx_v_Lidx0 < 0) != 0);
3886   if (__pyx_t_1) {
3887 
3888     /* "yt/utilities/lib/cykdtree/utils.pyx":122
3889  *     cdef uint64_t Ridx = n
3890  *     if (Lidx0 < 0):
3891  *         Lidx = <uint64_t>(<int>n + Lidx0)             # <<<<<<<<<<<<<<
3892  *     else:
3893  *         Lidx = <uint64_t>Lidx0
3894  */
3895     __pyx_v_Lidx = ((uint64_t)(((int)__pyx_v_n) + __pyx_v_Lidx0));
3896 
3897     /* "yt/utilities/lib/cykdtree/utils.pyx":121
3898  *     cdef uint64_t Lidx = 0
3899  *     cdef uint64_t Ridx = n
3900  *     if (Lidx0 < 0):             # <<<<<<<<<<<<<<
3901  *         Lidx = <uint64_t>(<int>n + Lidx0)
3902  *     else:
3903  */
3904     goto __pyx_L3;
3905   }
3906 
3907   /* "yt/utilities/lib/cykdtree/utils.pyx":124
3908  *         Lidx = <uint64_t>(<int>n + Lidx0)
3909  *     else:
3910  *         Lidx = <uint64_t>Lidx0             # <<<<<<<<<<<<<<
3911  *     if (Ridx0 < 0):
3912  *         Ridx = <uint64_t>(<int>n + Ridx0)
3913  */
3914   /*else*/ {
3915     __pyx_v_Lidx = ((uint64_t)__pyx_v_Lidx0);
3916   }
3917   __pyx_L3:;
3918 
3919   /* "yt/utilities/lib/cykdtree/utils.pyx":125
3920  *     else:
3921  *         Lidx = <uint64_t>Lidx0
3922  *     if (Ridx0 < 0):             # <<<<<<<<<<<<<<
3923  *         Ridx = <uint64_t>(<int>n + Ridx0)
3924  *     else:
3925  */
3926   __pyx_t_1 = ((__pyx_v_Ridx0 < 0) != 0);
3927   if (__pyx_t_1) {
3928 
3929     /* "yt/utilities/lib/cykdtree/utils.pyx":126
3930  *         Lidx = <uint64_t>Lidx0
3931  *     if (Ridx0 < 0):
3932  *         Ridx = <uint64_t>(<int>n + Ridx0)             # <<<<<<<<<<<<<<
3933  *     else:
3934  *         Ridx = <uint64_t>Ridx0
3935  */
3936     __pyx_v_Ridx = ((uint64_t)(((int)__pyx_v_n) + __pyx_v_Ridx0));
3937 
3938     /* "yt/utilities/lib/cykdtree/utils.pyx":125
3939  *     else:
3940  *         Lidx = <uint64_t>Lidx0
3941  *     if (Ridx0 < 0):             # <<<<<<<<<<<<<<
3942  *         Ridx = <uint64_t>(<int>n + Ridx0)
3943  *     else:
3944  */
3945     goto __pyx_L4;
3946   }
3947 
3948   /* "yt/utilities/lib/cykdtree/utils.pyx":128
3949  *         Ridx = <uint64_t>(<int>n + Ridx0)
3950  *     else:
3951  *         Ridx = <uint64_t>Ridx0             # <<<<<<<<<<<<<<
3952  *     cdef np.uint64_t cout = Lidx
3953  *     if (Ridx > Lidx):
3954  */
3955   /*else*/ {
3956     __pyx_v_Ridx = ((uint64_t)__pyx_v_Ridx0);
3957   }
3958   __pyx_L4:;
3959 
3960   /* "yt/utilities/lib/cykdtree/utils.pyx":129
3961  *     else:
3962  *         Ridx = <uint64_t>Ridx0
3963  *     cdef np.uint64_t cout = Lidx             # <<<<<<<<<<<<<<
3964  *     if (Ridx > Lidx):
3965  *         cout = argmin_pts_dim(&pos[0,0], &idx[0], m, d, Lidx, Ridx)
3966  */
3967   __pyx_v_cout = __pyx_v_Lidx;
3968 
3969   /* "yt/utilities/lib/cykdtree/utils.pyx":130
3970  *         Ridx = <uint64_t>Ridx0
3971  *     cdef np.uint64_t cout = Lidx
3972  *     if (Ridx > Lidx):             # <<<<<<<<<<<<<<
3973  *         cout = argmin_pts_dim(&pos[0,0], &idx[0], m, d, Lidx, Ridx)
3974  *     return cout
3975  */
3976   __pyx_t_1 = ((__pyx_v_Ridx > __pyx_v_Lidx) != 0);
3977   if (__pyx_t_1) {
3978 
3979     /* "yt/utilities/lib/cykdtree/utils.pyx":131
3980  *     cdef np.uint64_t cout = Lidx
3981  *     if (Ridx > Lidx):
3982  *         cout = argmin_pts_dim(&pos[0,0], &idx[0], m, d, Lidx, Ridx)             # <<<<<<<<<<<<<<
3983  *     return cout
3984  *
3985  */
3986     __pyx_t_2 = 0;
3987     __pyx_t_3 = 0;
3988     __pyx_t_4 = -1;
3989     if (__pyx_t_2 < 0) {
3990       __pyx_t_2 += __pyx_pybuffernd_pos.diminfo[0].shape;
3991       if (unlikely(__pyx_t_2 < 0)) __pyx_t_4 = 0;
3992     } else if (unlikely(__pyx_t_2 >= __pyx_pybuffernd_pos.diminfo[0].shape)) __pyx_t_4 = 0;
3993     if (__pyx_t_3 < 0) {
3994       __pyx_t_3 += __pyx_pybuffernd_pos.diminfo[1].shape;
3995       if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 1;
3996     } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_pos.diminfo[1].shape)) __pyx_t_4 = 1;
3997     if (unlikely(__pyx_t_4 != -1)) {
3998       __Pyx_RaiseBufferIndexError(__pyx_t_4);
3999       __PYX_ERR(0, 131, __pyx_L1_error)
4000     }
4001     __pyx_t_5 = 0;
4002     __pyx_t_4 = -1;
4003     if (__pyx_t_5 < 0) {
4004       __pyx_t_5 += __pyx_v_idx.shape[0];
4005       if (unlikely(__pyx_t_5 < 0)) __pyx_t_4 = 0;
4006     } else if (unlikely(__pyx_t_5 >= __pyx_v_idx.shape[0])) __pyx_t_4 = 0;
4007     if (unlikely(__pyx_t_4 != -1)) {
4008       __Pyx_RaiseBufferIndexError(__pyx_t_4);
4009       __PYX_ERR(0, 131, __pyx_L1_error)
4010     }
4011     __pyx_v_cout = argmin_pts_dim((&(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_pos.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_pos.diminfo[0].strides, __pyx_t_3, __pyx_pybuffernd_pos.diminfo[1].strides))), (&(*((uint64_t *) ( /* dim=0 */ (__pyx_v_idx.data + __pyx_t_5 * __pyx_v_idx.strides[0]) )))), __pyx_v_m, __pyx_v_d, __pyx_v_Lidx, __pyx_v_Ridx);
4012 
4013     /* "yt/utilities/lib/cykdtree/utils.pyx":130
4014  *         Ridx = <uint64_t>Ridx0
4015  *     cdef np.uint64_t cout = Lidx
4016  *     if (Ridx > Lidx):             # <<<<<<<<<<<<<<
4017  *         cout = argmin_pts_dim(&pos[0,0], &idx[0], m, d, Lidx, Ridx)
4018  *     return cout
4019  */
4020   }
4021 
4022   /* "yt/utilities/lib/cykdtree/utils.pyx":132
4023  *     if (Ridx > Lidx):
4024  *         cout = argmin_pts_dim(&pos[0,0], &idx[0], m, d, Lidx, Ridx)
4025  *     return cout             # <<<<<<<<<<<<<<
4026  *
4027  * def py_quickSort(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d):
4028  */
4029   __Pyx_XDECREF(__pyx_r);
4030   __pyx_t_6 = __Pyx_PyInt_From_npy_uint64(__pyx_v_cout); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 132, __pyx_L1_error)
4031   __Pyx_GOTREF(__pyx_t_6);
4032   __pyx_r = __pyx_t_6;
4033   __pyx_t_6 = 0;
4034   goto __pyx_L0;
4035 
4036   /* "yt/utilities/lib/cykdtree/utils.pyx":99
4037  *     return cout
4038  *
4039  * def py_argmin_pts_dim(np.ndarray[np.float64_t, ndim=2] pos,             # <<<<<<<<<<<<<<
4040  *                       uint64_t[:] idx,
4041  *                       np.uint32_t d, int Lidx0, int Ridx0):
4042  */
4043 
4044   /* function exit code */
4045   __pyx_L1_error:;
4046   __Pyx_XDECREF(__pyx_t_6);
4047   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4048     __Pyx_PyThreadState_declare
4049     __Pyx_PyThreadState_assign
4050     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4051     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
4052   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4053   __Pyx_AddTraceback("yt.utilities.lib.cykdtree.utils.py_argmin_pts_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
4054   __pyx_r = NULL;
4055   goto __pyx_L2;
4056   __pyx_L0:;
4057   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
4058   __pyx_L2:;
4059   __PYX_XDEC_MEMVIEW(&__pyx_v_idx, 1);
4060   __Pyx_XGIVEREF(__pyx_r);
4061   __Pyx_RefNannyFinishContext();
4062   return __pyx_r;
4063 }
4064 
4065 /* "yt/utilities/lib/cykdtree/utils.pyx":134
4066  *     return cout
4067  *
4068  * def py_quickSort(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d):             # <<<<<<<<<<<<<<
4069  *     r"""Get the indices required to sort coordinates along one dimension.
4070  *
4071  */
4072 
4073 /* Python wrapper */
4074 static PyObject *__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_9py_quickSort(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4075 static char __pyx_doc_2yt_9utilities_3lib_8cykdtree_5utils_8py_quickSort[] = "Get the indices required to sort coordinates along one dimension.\n\n    Args:\n        pos (np.ndarray of float64): (n,m) array of n m-D coordinates.\n        d (np.uint32_t): Dimension that pos should be sorted along.\n\n    Returns:\n        np.ndarray of uint64: Indices that sort pos along dimension d.\n\n    ";
4076 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_8cykdtree_5utils_9py_quickSort = {"py_quickSort", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_9py_quickSort, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2yt_9utilities_3lib_8cykdtree_5utils_8py_quickSort};
__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_9py_quickSort(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4077 static PyObject *__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_9py_quickSort(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4078   PyArrayObject *__pyx_v_pos = 0;
4079   __pyx_t_5numpy_uint32_t __pyx_v_d;
4080   PyObject *__pyx_r = 0;
4081   __Pyx_RefNannyDeclarations
4082   __Pyx_RefNannySetupContext("py_quickSort (wrapper)", 0);
4083   {
4084     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_d,0};
4085     PyObject* values[2] = {0,0};
4086     if (unlikely(__pyx_kwds)) {
4087       Py_ssize_t kw_args;
4088       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4089       switch (pos_args) {
4090         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4091         CYTHON_FALLTHROUGH;
4092         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4093         CYTHON_FALLTHROUGH;
4094         case  0: break;
4095         default: goto __pyx_L5_argtuple_error;
4096       }
4097       kw_args = PyDict_Size(__pyx_kwds);
4098       switch (pos_args) {
4099         case  0:
4100         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
4101         else goto __pyx_L5_argtuple_error;
4102         CYTHON_FALLTHROUGH;
4103         case  1:
4104         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
4105         else {
4106           __Pyx_RaiseArgtupleInvalid("py_quickSort", 1, 2, 2, 1); __PYX_ERR(0, 134, __pyx_L3_error)
4107         }
4108       }
4109       if (unlikely(kw_args > 0)) {
4110         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "py_quickSort") < 0)) __PYX_ERR(0, 134, __pyx_L3_error)
4111       }
4112     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4113       goto __pyx_L5_argtuple_error;
4114     } else {
4115       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4116       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4117     }
4118     __pyx_v_pos = ((PyArrayObject *)values[0]);
4119     __pyx_v_d = __Pyx_PyInt_As_npy_uint32(values[1]); if (unlikely((__pyx_v_d == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 134, __pyx_L3_error)
4120   }
4121   goto __pyx_L4_argument_unpacking_done;
4122   __pyx_L5_argtuple_error:;
4123   __Pyx_RaiseArgtupleInvalid("py_quickSort", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 134, __pyx_L3_error)
4124   __pyx_L3_error:;
4125   __Pyx_AddTraceback("yt.utilities.lib.cykdtree.utils.py_quickSort", __pyx_clineno, __pyx_lineno, __pyx_filename);
4126   __Pyx_RefNannyFinishContext();
4127   return NULL;
4128   __pyx_L4_argument_unpacking_done:;
4129   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 1, "pos", 0))) __PYX_ERR(0, 134, __pyx_L1_error)
4130   __pyx_r = __pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_8py_quickSort(__pyx_self, __pyx_v_pos, __pyx_v_d);
4131 
4132   /* function exit code */
4133   goto __pyx_L0;
4134   __pyx_L1_error:;
4135   __pyx_r = NULL;
4136   __pyx_L0:;
4137   __Pyx_RefNannyFinishContext();
4138   return __pyx_r;
4139 }
4140 
__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_8py_quickSort(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_pos,__pyx_t_5numpy_uint32_t __pyx_v_d)4141 static PyObject *__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_8py_quickSort(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_uint32_t __pyx_v_d) {
4142   __pyx_t_5numpy_intp_t __pyx_v_ndim;
4143   int64_t __pyx_v_l;
4144   int64_t __pyx_v_r;
4145   __Pyx_memviewslice __pyx_v_idx = { 0, 0, { 0 }, { 0 }, { 0 } };
4146   double *__pyx_v_ptr_pos;
4147   uint64_t *__pyx_v_ptr_idx;
4148   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos;
4149   __Pyx_Buffer __pyx_pybuffer_pos;
4150   PyObject *__pyx_r = NULL;
4151   __Pyx_RefNannyDeclarations
4152   PyObject *__pyx_t_1 = NULL;
4153   PyObject *__pyx_t_2 = NULL;
4154   PyObject *__pyx_t_3 = NULL;
4155   PyObject *__pyx_t_4 = NULL;
4156   PyObject *__pyx_t_5 = NULL;
4157   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
4158   int __pyx_t_7;
4159   Py_ssize_t __pyx_t_8;
4160   Py_ssize_t __pyx_t_9;
4161   int __pyx_t_10;
4162   Py_ssize_t __pyx_t_11;
4163   __Pyx_RefNannySetupContext("py_quickSort", 0);
4164   __pyx_pybuffer_pos.pybuffer.buf = NULL;
4165   __pyx_pybuffer_pos.refcount = 0;
4166   __pyx_pybuffernd_pos.data = NULL;
4167   __pyx_pybuffernd_pos.rcbuffer = &__pyx_pybuffer_pos;
4168   {
4169     __Pyx_BufFmt_StackElem __pyx_stack[1];
4170     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 134, __pyx_L1_error)
4171   }
4172   __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1];
4173 
4174   /* "yt/utilities/lib/cykdtree/utils.pyx":145
4175  *
4176  *     """
4177  *     cdef np.intp_t ndim = pos.shape[1]             # <<<<<<<<<<<<<<
4178  *     cdef int64_t l = 0
4179  *     cdef int64_t r = pos.shape[0]-1
4180  */
4181   __pyx_v_ndim = (__pyx_v_pos->dimensions[1]);
4182 
4183   /* "yt/utilities/lib/cykdtree/utils.pyx":146
4184  *     """
4185  *     cdef np.intp_t ndim = pos.shape[1]
4186  *     cdef int64_t l = 0             # <<<<<<<<<<<<<<
4187  *     cdef int64_t r = pos.shape[0]-1
4188  *     cdef uint64_t[:] idx
4189  */
4190   __pyx_v_l = 0;
4191 
4192   /* "yt/utilities/lib/cykdtree/utils.pyx":147
4193  *     cdef np.intp_t ndim = pos.shape[1]
4194  *     cdef int64_t l = 0
4195  *     cdef int64_t r = pos.shape[0]-1             # <<<<<<<<<<<<<<
4196  *     cdef uint64_t[:] idx
4197  *     idx = np.arange(pos.shape[0]).astype('uint64')
4198  */
4199   __pyx_v_r = ((__pyx_v_pos->dimensions[0]) - 1);
4200 
4201   /* "yt/utilities/lib/cykdtree/utils.pyx":149
4202  *     cdef int64_t r = pos.shape[0]-1
4203  *     cdef uint64_t[:] idx
4204  *     idx = np.arange(pos.shape[0]).astype('uint64')             # <<<<<<<<<<<<<<
4205  *     cdef double *ptr_pos = NULL
4206  *     cdef uint64_t *ptr_idx = NULL
4207  */
4208   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 149, __pyx_L1_error)
4209   __Pyx_GOTREF(__pyx_t_3);
4210   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_arange); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 149, __pyx_L1_error)
4211   __Pyx_GOTREF(__pyx_t_4);
4212   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4213   __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_pos->dimensions[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 149, __pyx_L1_error)
4214   __Pyx_GOTREF(__pyx_t_3);
4215   __pyx_t_5 = NULL;
4216   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
4217     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
4218     if (likely(__pyx_t_5)) {
4219       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4220       __Pyx_INCREF(__pyx_t_5);
4221       __Pyx_INCREF(function);
4222       __Pyx_DECREF_SET(__pyx_t_4, function);
4223     }
4224   }
4225   __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);
4226   __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4227   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4228   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error)
4229   __Pyx_GOTREF(__pyx_t_2);
4230   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4231   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 149, __pyx_L1_error)
4232   __Pyx_GOTREF(__pyx_t_4);
4233   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4234   __pyx_t_2 = NULL;
4235   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
4236     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
4237     if (likely(__pyx_t_2)) {
4238       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4239       __Pyx_INCREF(__pyx_t_2);
4240       __Pyx_INCREF(function);
4241       __Pyx_DECREF_SET(__pyx_t_4, function);
4242     }
4243   }
4244   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_n_s_uint64) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_s_uint64);
4245   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4246   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error)
4247   __Pyx_GOTREF(__pyx_t_1);
4248   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4249   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_uint64_t(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 149, __pyx_L1_error)
4250   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4251   __pyx_v_idx = __pyx_t_6;
4252   __pyx_t_6.memview = NULL;
4253   __pyx_t_6.data = NULL;
4254 
4255   /* "yt/utilities/lib/cykdtree/utils.pyx":150
4256  *     cdef uint64_t[:] idx
4257  *     idx = np.arange(pos.shape[0]).astype('uint64')
4258  *     cdef double *ptr_pos = NULL             # <<<<<<<<<<<<<<
4259  *     cdef uint64_t *ptr_idx = NULL
4260  *     if pos.shape[0] != 0:
4261  */
4262   __pyx_v_ptr_pos = NULL;
4263 
4264   /* "yt/utilities/lib/cykdtree/utils.pyx":151
4265  *     idx = np.arange(pos.shape[0]).astype('uint64')
4266  *     cdef double *ptr_pos = NULL
4267  *     cdef uint64_t *ptr_idx = NULL             # <<<<<<<<<<<<<<
4268  *     if pos.shape[0] != 0:
4269  *         ptr_pos = &pos[0,0]
4270  */
4271   __pyx_v_ptr_idx = NULL;
4272 
4273   /* "yt/utilities/lib/cykdtree/utils.pyx":152
4274  *     cdef double *ptr_pos = NULL
4275  *     cdef uint64_t *ptr_idx = NULL
4276  *     if pos.shape[0] != 0:             # <<<<<<<<<<<<<<
4277  *         ptr_pos = &pos[0,0]
4278  *         ptr_idx = &idx[0]
4279  */
4280   __pyx_t_7 = (((__pyx_v_pos->dimensions[0]) != 0) != 0);
4281   if (__pyx_t_7) {
4282 
4283     /* "yt/utilities/lib/cykdtree/utils.pyx":153
4284  *     cdef uint64_t *ptr_idx = NULL
4285  *     if pos.shape[0] != 0:
4286  *         ptr_pos = &pos[0,0]             # <<<<<<<<<<<<<<
4287  *         ptr_idx = &idx[0]
4288  *     quickSort(ptr_pos, ptr_idx, ndim, d, l, r)
4289  */
4290     __pyx_t_8 = 0;
4291     __pyx_t_9 = 0;
4292     __pyx_t_10 = -1;
4293     if (__pyx_t_8 < 0) {
4294       __pyx_t_8 += __pyx_pybuffernd_pos.diminfo[0].shape;
4295       if (unlikely(__pyx_t_8 < 0)) __pyx_t_10 = 0;
4296     } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_pos.diminfo[0].shape)) __pyx_t_10 = 0;
4297     if (__pyx_t_9 < 0) {
4298       __pyx_t_9 += __pyx_pybuffernd_pos.diminfo[1].shape;
4299       if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 1;
4300     } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_pos.diminfo[1].shape)) __pyx_t_10 = 1;
4301     if (unlikely(__pyx_t_10 != -1)) {
4302       __Pyx_RaiseBufferIndexError(__pyx_t_10);
4303       __PYX_ERR(0, 153, __pyx_L1_error)
4304     }
4305     __pyx_v_ptr_pos = (&(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_pos.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_pos.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_pos.diminfo[1].strides)));
4306 
4307     /* "yt/utilities/lib/cykdtree/utils.pyx":154
4308  *     if pos.shape[0] != 0:
4309  *         ptr_pos = &pos[0,0]
4310  *         ptr_idx = &idx[0]             # <<<<<<<<<<<<<<
4311  *     quickSort(ptr_pos, ptr_idx, ndim, d, l, r)
4312  *     return idx
4313  */
4314     __pyx_t_11 = 0;
4315     __pyx_t_10 = -1;
4316     if (__pyx_t_11 < 0) {
4317       __pyx_t_11 += __pyx_v_idx.shape[0];
4318       if (unlikely(__pyx_t_11 < 0)) __pyx_t_10 = 0;
4319     } else if (unlikely(__pyx_t_11 >= __pyx_v_idx.shape[0])) __pyx_t_10 = 0;
4320     if (unlikely(__pyx_t_10 != -1)) {
4321       __Pyx_RaiseBufferIndexError(__pyx_t_10);
4322       __PYX_ERR(0, 154, __pyx_L1_error)
4323     }
4324     __pyx_v_ptr_idx = (&(*((uint64_t *) ( /* dim=0 */ (__pyx_v_idx.data + __pyx_t_11 * __pyx_v_idx.strides[0]) ))));
4325 
4326     /* "yt/utilities/lib/cykdtree/utils.pyx":152
4327  *     cdef double *ptr_pos = NULL
4328  *     cdef uint64_t *ptr_idx = NULL
4329  *     if pos.shape[0] != 0:             # <<<<<<<<<<<<<<
4330  *         ptr_pos = &pos[0,0]
4331  *         ptr_idx = &idx[0]
4332  */
4333   }
4334 
4335   /* "yt/utilities/lib/cykdtree/utils.pyx":155
4336  *         ptr_pos = &pos[0,0]
4337  *         ptr_idx = &idx[0]
4338  *     quickSort(ptr_pos, ptr_idx, ndim, d, l, r)             # <<<<<<<<<<<<<<
4339  *     return idx
4340  *
4341  */
4342   quickSort(__pyx_v_ptr_pos, __pyx_v_ptr_idx, __pyx_v_ndim, __pyx_v_d, __pyx_v_l, __pyx_v_r);
4343 
4344   /* "yt/utilities/lib/cykdtree/utils.pyx":156
4345  *         ptr_idx = &idx[0]
4346  *     quickSort(ptr_pos, ptr_idx, ndim, d, l, r)
4347  *     return idx             # <<<<<<<<<<<<<<
4348  *
4349  * def py_insertSort(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d):
4350  */
4351   __Pyx_XDECREF(__pyx_r);
4352   __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_idx, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn_uint64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn_uint64_t, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
4353   __Pyx_GOTREF(__pyx_t_1);
4354   __pyx_r = __pyx_t_1;
4355   __pyx_t_1 = 0;
4356   goto __pyx_L0;
4357 
4358   /* "yt/utilities/lib/cykdtree/utils.pyx":134
4359  *     return cout
4360  *
4361  * def py_quickSort(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d):             # <<<<<<<<<<<<<<
4362  *     r"""Get the indices required to sort coordinates along one dimension.
4363  *
4364  */
4365 
4366   /* function exit code */
4367   __pyx_L1_error:;
4368   __Pyx_XDECREF(__pyx_t_1);
4369   __Pyx_XDECREF(__pyx_t_2);
4370   __Pyx_XDECREF(__pyx_t_3);
4371   __Pyx_XDECREF(__pyx_t_4);
4372   __Pyx_XDECREF(__pyx_t_5);
4373   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
4374   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4375     __Pyx_PyThreadState_declare
4376     __Pyx_PyThreadState_assign
4377     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4378     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
4379   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4380   __Pyx_AddTraceback("yt.utilities.lib.cykdtree.utils.py_quickSort", __pyx_clineno, __pyx_lineno, __pyx_filename);
4381   __pyx_r = NULL;
4382   goto __pyx_L2;
4383   __pyx_L0:;
4384   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
4385   __pyx_L2:;
4386   __PYX_XDEC_MEMVIEW(&__pyx_v_idx, 1);
4387   __Pyx_XGIVEREF(__pyx_r);
4388   __Pyx_RefNannyFinishContext();
4389   return __pyx_r;
4390 }
4391 
4392 /* "yt/utilities/lib/cykdtree/utils.pyx":158
4393  *     return idx
4394  *
4395  * def py_insertSort(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d):             # <<<<<<<<<<<<<<
4396  *     r"""Get the indices required to sort coordinates along one dimension.
4397  *
4398  */
4399 
4400 /* Python wrapper */
4401 static PyObject *__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_11py_insertSort(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4402 static char __pyx_doc_2yt_9utilities_3lib_8cykdtree_5utils_10py_insertSort[] = "Get the indices required to sort coordinates along one dimension.\n\n    Args:\n        pos (np.ndarray of float64): (n,m) array of n m-D coordinates.\n        d (np.uint32_t): Dimension that pos should be sorted along.\n\n    Returns:\n        np.ndarray of uint64: Indices that sort pos along dimension d.\n\n    ";
4403 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_8cykdtree_5utils_11py_insertSort = {"py_insertSort", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_11py_insertSort, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2yt_9utilities_3lib_8cykdtree_5utils_10py_insertSort};
__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_11py_insertSort(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4404 static PyObject *__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_11py_insertSort(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4405   PyArrayObject *__pyx_v_pos = 0;
4406   __pyx_t_5numpy_uint32_t __pyx_v_d;
4407   PyObject *__pyx_r = 0;
4408   __Pyx_RefNannyDeclarations
4409   __Pyx_RefNannySetupContext("py_insertSort (wrapper)", 0);
4410   {
4411     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_d,0};
4412     PyObject* values[2] = {0,0};
4413     if (unlikely(__pyx_kwds)) {
4414       Py_ssize_t kw_args;
4415       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4416       switch (pos_args) {
4417         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4418         CYTHON_FALLTHROUGH;
4419         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4420         CYTHON_FALLTHROUGH;
4421         case  0: break;
4422         default: goto __pyx_L5_argtuple_error;
4423       }
4424       kw_args = PyDict_Size(__pyx_kwds);
4425       switch (pos_args) {
4426         case  0:
4427         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
4428         else goto __pyx_L5_argtuple_error;
4429         CYTHON_FALLTHROUGH;
4430         case  1:
4431         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
4432         else {
4433           __Pyx_RaiseArgtupleInvalid("py_insertSort", 1, 2, 2, 1); __PYX_ERR(0, 158, __pyx_L3_error)
4434         }
4435       }
4436       if (unlikely(kw_args > 0)) {
4437         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "py_insertSort") < 0)) __PYX_ERR(0, 158, __pyx_L3_error)
4438       }
4439     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4440       goto __pyx_L5_argtuple_error;
4441     } else {
4442       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4443       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4444     }
4445     __pyx_v_pos = ((PyArrayObject *)values[0]);
4446     __pyx_v_d = __Pyx_PyInt_As_npy_uint32(values[1]); if (unlikely((__pyx_v_d == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 158, __pyx_L3_error)
4447   }
4448   goto __pyx_L4_argument_unpacking_done;
4449   __pyx_L5_argtuple_error:;
4450   __Pyx_RaiseArgtupleInvalid("py_insertSort", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 158, __pyx_L3_error)
4451   __pyx_L3_error:;
4452   __Pyx_AddTraceback("yt.utilities.lib.cykdtree.utils.py_insertSort", __pyx_clineno, __pyx_lineno, __pyx_filename);
4453   __Pyx_RefNannyFinishContext();
4454   return NULL;
4455   __pyx_L4_argument_unpacking_done:;
4456   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 1, "pos", 0))) __PYX_ERR(0, 158, __pyx_L1_error)
4457   __pyx_r = __pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_10py_insertSort(__pyx_self, __pyx_v_pos, __pyx_v_d);
4458 
4459   /* function exit code */
4460   goto __pyx_L0;
4461   __pyx_L1_error:;
4462   __pyx_r = NULL;
4463   __pyx_L0:;
4464   __Pyx_RefNannyFinishContext();
4465   return __pyx_r;
4466 }
4467 
__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_10py_insertSort(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_pos,__pyx_t_5numpy_uint32_t __pyx_v_d)4468 static PyObject *__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_10py_insertSort(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_uint32_t __pyx_v_d) {
4469   __pyx_t_5numpy_intp_t __pyx_v_ndim;
4470   int64_t __pyx_v_l;
4471   int64_t __pyx_v_r;
4472   __Pyx_memviewslice __pyx_v_idx = { 0, 0, { 0 }, { 0 }, { 0 } };
4473   double *__pyx_v_ptr_pos;
4474   uint64_t *__pyx_v_ptr_idx;
4475   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos;
4476   __Pyx_Buffer __pyx_pybuffer_pos;
4477   PyObject *__pyx_r = NULL;
4478   __Pyx_RefNannyDeclarations
4479   PyObject *__pyx_t_1 = NULL;
4480   PyObject *__pyx_t_2 = NULL;
4481   PyObject *__pyx_t_3 = NULL;
4482   PyObject *__pyx_t_4 = NULL;
4483   PyObject *__pyx_t_5 = NULL;
4484   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
4485   int __pyx_t_7;
4486   Py_ssize_t __pyx_t_8;
4487   Py_ssize_t __pyx_t_9;
4488   int __pyx_t_10;
4489   Py_ssize_t __pyx_t_11;
4490   __Pyx_RefNannySetupContext("py_insertSort", 0);
4491   __pyx_pybuffer_pos.pybuffer.buf = NULL;
4492   __pyx_pybuffer_pos.refcount = 0;
4493   __pyx_pybuffernd_pos.data = NULL;
4494   __pyx_pybuffernd_pos.rcbuffer = &__pyx_pybuffer_pos;
4495   {
4496     __Pyx_BufFmt_StackElem __pyx_stack[1];
4497     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 158, __pyx_L1_error)
4498   }
4499   __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1];
4500 
4501   /* "yt/utilities/lib/cykdtree/utils.pyx":169
4502  *
4503  *     """
4504  *     cdef np.intp_t ndim = pos.shape[1]             # <<<<<<<<<<<<<<
4505  *     cdef int64_t l = 0
4506  *     cdef int64_t r = pos.shape[0]-1
4507  */
4508   __pyx_v_ndim = (__pyx_v_pos->dimensions[1]);
4509 
4510   /* "yt/utilities/lib/cykdtree/utils.pyx":170
4511  *     """
4512  *     cdef np.intp_t ndim = pos.shape[1]
4513  *     cdef int64_t l = 0             # <<<<<<<<<<<<<<
4514  *     cdef int64_t r = pos.shape[0]-1
4515  *     cdef uint64_t[:] idx
4516  */
4517   __pyx_v_l = 0;
4518 
4519   /* "yt/utilities/lib/cykdtree/utils.pyx":171
4520  *     cdef np.intp_t ndim = pos.shape[1]
4521  *     cdef int64_t l = 0
4522  *     cdef int64_t r = pos.shape[0]-1             # <<<<<<<<<<<<<<
4523  *     cdef uint64_t[:] idx
4524  *     idx = np.arange(pos.shape[0]).astype('uint64')
4525  */
4526   __pyx_v_r = ((__pyx_v_pos->dimensions[0]) - 1);
4527 
4528   /* "yt/utilities/lib/cykdtree/utils.pyx":173
4529  *     cdef int64_t r = pos.shape[0]-1
4530  *     cdef uint64_t[:] idx
4531  *     idx = np.arange(pos.shape[0]).astype('uint64')             # <<<<<<<<<<<<<<
4532  *     cdef double *ptr_pos = NULL
4533  *     cdef uint64_t *ptr_idx = NULL
4534  */
4535   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error)
4536   __Pyx_GOTREF(__pyx_t_3);
4537   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_arange); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 173, __pyx_L1_error)
4538   __Pyx_GOTREF(__pyx_t_4);
4539   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4540   __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_pos->dimensions[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error)
4541   __Pyx_GOTREF(__pyx_t_3);
4542   __pyx_t_5 = NULL;
4543   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
4544     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
4545     if (likely(__pyx_t_5)) {
4546       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4547       __Pyx_INCREF(__pyx_t_5);
4548       __Pyx_INCREF(function);
4549       __Pyx_DECREF_SET(__pyx_t_4, function);
4550     }
4551   }
4552   __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);
4553   __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4554   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4555   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error)
4556   __Pyx_GOTREF(__pyx_t_2);
4557   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4558   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 173, __pyx_L1_error)
4559   __Pyx_GOTREF(__pyx_t_4);
4560   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4561   __pyx_t_2 = NULL;
4562   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
4563     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
4564     if (likely(__pyx_t_2)) {
4565       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4566       __Pyx_INCREF(__pyx_t_2);
4567       __Pyx_INCREF(function);
4568       __Pyx_DECREF_SET(__pyx_t_4, function);
4569     }
4570   }
4571   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_n_s_uint64) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_s_uint64);
4572   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4573   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error)
4574   __Pyx_GOTREF(__pyx_t_1);
4575   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4576   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_uint64_t(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 173, __pyx_L1_error)
4577   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4578   __pyx_v_idx = __pyx_t_6;
4579   __pyx_t_6.memview = NULL;
4580   __pyx_t_6.data = NULL;
4581 
4582   /* "yt/utilities/lib/cykdtree/utils.pyx":174
4583  *     cdef uint64_t[:] idx
4584  *     idx = np.arange(pos.shape[0]).astype('uint64')
4585  *     cdef double *ptr_pos = NULL             # <<<<<<<<<<<<<<
4586  *     cdef uint64_t *ptr_idx = NULL
4587  *     if pos.shape[0] != 0:
4588  */
4589   __pyx_v_ptr_pos = NULL;
4590 
4591   /* "yt/utilities/lib/cykdtree/utils.pyx":175
4592  *     idx = np.arange(pos.shape[0]).astype('uint64')
4593  *     cdef double *ptr_pos = NULL
4594  *     cdef uint64_t *ptr_idx = NULL             # <<<<<<<<<<<<<<
4595  *     if pos.shape[0] != 0:
4596  *         ptr_pos = &pos[0,0]
4597  */
4598   __pyx_v_ptr_idx = NULL;
4599 
4600   /* "yt/utilities/lib/cykdtree/utils.pyx":176
4601  *     cdef double *ptr_pos = NULL
4602  *     cdef uint64_t *ptr_idx = NULL
4603  *     if pos.shape[0] != 0:             # <<<<<<<<<<<<<<
4604  *         ptr_pos = &pos[0,0]
4605  *         ptr_idx = &idx[0]
4606  */
4607   __pyx_t_7 = (((__pyx_v_pos->dimensions[0]) != 0) != 0);
4608   if (__pyx_t_7) {
4609 
4610     /* "yt/utilities/lib/cykdtree/utils.pyx":177
4611  *     cdef uint64_t *ptr_idx = NULL
4612  *     if pos.shape[0] != 0:
4613  *         ptr_pos = &pos[0,0]             # <<<<<<<<<<<<<<
4614  *         ptr_idx = &idx[0]
4615  *     insertSort(ptr_pos, ptr_idx, ndim, d, l, r)
4616  */
4617     __pyx_t_8 = 0;
4618     __pyx_t_9 = 0;
4619     __pyx_t_10 = -1;
4620     if (__pyx_t_8 < 0) {
4621       __pyx_t_8 += __pyx_pybuffernd_pos.diminfo[0].shape;
4622       if (unlikely(__pyx_t_8 < 0)) __pyx_t_10 = 0;
4623     } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_pos.diminfo[0].shape)) __pyx_t_10 = 0;
4624     if (__pyx_t_9 < 0) {
4625       __pyx_t_9 += __pyx_pybuffernd_pos.diminfo[1].shape;
4626       if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 1;
4627     } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_pos.diminfo[1].shape)) __pyx_t_10 = 1;
4628     if (unlikely(__pyx_t_10 != -1)) {
4629       __Pyx_RaiseBufferIndexError(__pyx_t_10);
4630       __PYX_ERR(0, 177, __pyx_L1_error)
4631     }
4632     __pyx_v_ptr_pos = (&(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_pos.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_pos.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_pos.diminfo[1].strides)));
4633 
4634     /* "yt/utilities/lib/cykdtree/utils.pyx":178
4635  *     if pos.shape[0] != 0:
4636  *         ptr_pos = &pos[0,0]
4637  *         ptr_idx = &idx[0]             # <<<<<<<<<<<<<<
4638  *     insertSort(ptr_pos, ptr_idx, ndim, d, l, r)
4639  *     return idx
4640  */
4641     __pyx_t_11 = 0;
4642     __pyx_t_10 = -1;
4643     if (__pyx_t_11 < 0) {
4644       __pyx_t_11 += __pyx_v_idx.shape[0];
4645       if (unlikely(__pyx_t_11 < 0)) __pyx_t_10 = 0;
4646     } else if (unlikely(__pyx_t_11 >= __pyx_v_idx.shape[0])) __pyx_t_10 = 0;
4647     if (unlikely(__pyx_t_10 != -1)) {
4648       __Pyx_RaiseBufferIndexError(__pyx_t_10);
4649       __PYX_ERR(0, 178, __pyx_L1_error)
4650     }
4651     __pyx_v_ptr_idx = (&(*((uint64_t *) ( /* dim=0 */ (__pyx_v_idx.data + __pyx_t_11 * __pyx_v_idx.strides[0]) ))));
4652 
4653     /* "yt/utilities/lib/cykdtree/utils.pyx":176
4654  *     cdef double *ptr_pos = NULL
4655  *     cdef uint64_t *ptr_idx = NULL
4656  *     if pos.shape[0] != 0:             # <<<<<<<<<<<<<<
4657  *         ptr_pos = &pos[0,0]
4658  *         ptr_idx = &idx[0]
4659  */
4660   }
4661 
4662   /* "yt/utilities/lib/cykdtree/utils.pyx":179
4663  *         ptr_pos = &pos[0,0]
4664  *         ptr_idx = &idx[0]
4665  *     insertSort(ptr_pos, ptr_idx, ndim, d, l, r)             # <<<<<<<<<<<<<<
4666  *     return idx
4667  *
4668  */
4669   insertSort(__pyx_v_ptr_pos, __pyx_v_ptr_idx, __pyx_v_ndim, __pyx_v_d, __pyx_v_l, __pyx_v_r);
4670 
4671   /* "yt/utilities/lib/cykdtree/utils.pyx":180
4672  *         ptr_idx = &idx[0]
4673  *     insertSort(ptr_pos, ptr_idx, ndim, d, l, r)
4674  *     return idx             # <<<<<<<<<<<<<<
4675  *
4676  * def py_pivot(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d):
4677  */
4678   __Pyx_XDECREF(__pyx_r);
4679   __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_idx, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn_uint64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn_uint64_t, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
4680   __Pyx_GOTREF(__pyx_t_1);
4681   __pyx_r = __pyx_t_1;
4682   __pyx_t_1 = 0;
4683   goto __pyx_L0;
4684 
4685   /* "yt/utilities/lib/cykdtree/utils.pyx":158
4686  *     return idx
4687  *
4688  * def py_insertSort(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d):             # <<<<<<<<<<<<<<
4689  *     r"""Get the indices required to sort coordinates along one dimension.
4690  *
4691  */
4692 
4693   /* function exit code */
4694   __pyx_L1_error:;
4695   __Pyx_XDECREF(__pyx_t_1);
4696   __Pyx_XDECREF(__pyx_t_2);
4697   __Pyx_XDECREF(__pyx_t_3);
4698   __Pyx_XDECREF(__pyx_t_4);
4699   __Pyx_XDECREF(__pyx_t_5);
4700   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
4701   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4702     __Pyx_PyThreadState_declare
4703     __Pyx_PyThreadState_assign
4704     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4705     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
4706   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4707   __Pyx_AddTraceback("yt.utilities.lib.cykdtree.utils.py_insertSort", __pyx_clineno, __pyx_lineno, __pyx_filename);
4708   __pyx_r = NULL;
4709   goto __pyx_L2;
4710   __pyx_L0:;
4711   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
4712   __pyx_L2:;
4713   __PYX_XDEC_MEMVIEW(&__pyx_v_idx, 1);
4714   __Pyx_XGIVEREF(__pyx_r);
4715   __Pyx_RefNannyFinishContext();
4716   return __pyx_r;
4717 }
4718 
4719 /* "yt/utilities/lib/cykdtree/utils.pyx":182
4720  *     return idx
4721  *
4722  * def py_pivot(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d):             # <<<<<<<<<<<<<<
4723  *     r"""Get the index of the median of medians along one dimension and indices
4724  *     that partition pos according to the median of medians.
4725  */
4726 
4727 /* Python wrapper */
4728 static PyObject *__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_13py_pivot(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4729 static char __pyx_doc_2yt_9utilities_3lib_8cykdtree_5utils_12py_pivot[] = "Get the index of the median of medians along one dimension and indices\n    that partition pos according to the median of medians.\n\n    Args:\n        pos (np.ndarray of float64): (n,m) array of n m-D coordinates.\n        d (np.uint32_t): Dimension that pos should be partitioned along.\n\n    Returns:\n        tuple of int64 and np.ndarray of uint64: Index q of idx that is the\n            pivot. All elements of idx before the pivot will be less than\n            the pivot. If there is an odd number of points, the pivot will\n            be the median.\n\n    ";
4730 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_8cykdtree_5utils_13py_pivot = {"py_pivot", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_13py_pivot, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2yt_9utilities_3lib_8cykdtree_5utils_12py_pivot};
__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_13py_pivot(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4731 static PyObject *__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_13py_pivot(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4732   PyArrayObject *__pyx_v_pos = 0;
4733   __pyx_t_5numpy_uint32_t __pyx_v_d;
4734   PyObject *__pyx_r = 0;
4735   __Pyx_RefNannyDeclarations
4736   __Pyx_RefNannySetupContext("py_pivot (wrapper)", 0);
4737   {
4738     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_d,0};
4739     PyObject* values[2] = {0,0};
4740     if (unlikely(__pyx_kwds)) {
4741       Py_ssize_t kw_args;
4742       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4743       switch (pos_args) {
4744         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4745         CYTHON_FALLTHROUGH;
4746         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4747         CYTHON_FALLTHROUGH;
4748         case  0: break;
4749         default: goto __pyx_L5_argtuple_error;
4750       }
4751       kw_args = PyDict_Size(__pyx_kwds);
4752       switch (pos_args) {
4753         case  0:
4754         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
4755         else goto __pyx_L5_argtuple_error;
4756         CYTHON_FALLTHROUGH;
4757         case  1:
4758         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
4759         else {
4760           __Pyx_RaiseArgtupleInvalid("py_pivot", 1, 2, 2, 1); __PYX_ERR(0, 182, __pyx_L3_error)
4761         }
4762       }
4763       if (unlikely(kw_args > 0)) {
4764         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "py_pivot") < 0)) __PYX_ERR(0, 182, __pyx_L3_error)
4765       }
4766     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4767       goto __pyx_L5_argtuple_error;
4768     } else {
4769       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4770       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4771     }
4772     __pyx_v_pos = ((PyArrayObject *)values[0]);
4773     __pyx_v_d = __Pyx_PyInt_As_npy_uint32(values[1]); if (unlikely((__pyx_v_d == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L3_error)
4774   }
4775   goto __pyx_L4_argument_unpacking_done;
4776   __pyx_L5_argtuple_error:;
4777   __Pyx_RaiseArgtupleInvalid("py_pivot", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 182, __pyx_L3_error)
4778   __pyx_L3_error:;
4779   __Pyx_AddTraceback("yt.utilities.lib.cykdtree.utils.py_pivot", __pyx_clineno, __pyx_lineno, __pyx_filename);
4780   __Pyx_RefNannyFinishContext();
4781   return NULL;
4782   __pyx_L4_argument_unpacking_done:;
4783   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 1, "pos", 0))) __PYX_ERR(0, 182, __pyx_L1_error)
4784   __pyx_r = __pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_12py_pivot(__pyx_self, __pyx_v_pos, __pyx_v_d);
4785 
4786   /* function exit code */
4787   goto __pyx_L0;
4788   __pyx_L1_error:;
4789   __pyx_r = NULL;
4790   __pyx_L0:;
4791   __Pyx_RefNannyFinishContext();
4792   return __pyx_r;
4793 }
4794 
__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_12py_pivot(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_pos,__pyx_t_5numpy_uint32_t __pyx_v_d)4795 static PyObject *__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_12py_pivot(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_uint32_t __pyx_v_d) {
4796   __pyx_t_5numpy_intp_t __pyx_v_ndim;
4797   int64_t __pyx_v_l;
4798   int64_t __pyx_v_r;
4799   __Pyx_memviewslice __pyx_v_idx = { 0, 0, { 0 }, { 0 }, { 0 } };
4800   double *__pyx_v_ptr_pos;
4801   uint64_t *__pyx_v_ptr_idx;
4802   int64_t __pyx_v_q;
4803   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos;
4804   __Pyx_Buffer __pyx_pybuffer_pos;
4805   PyObject *__pyx_r = NULL;
4806   __Pyx_RefNannyDeclarations
4807   PyObject *__pyx_t_1 = NULL;
4808   PyObject *__pyx_t_2 = NULL;
4809   PyObject *__pyx_t_3 = NULL;
4810   PyObject *__pyx_t_4 = NULL;
4811   PyObject *__pyx_t_5 = NULL;
4812   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
4813   int __pyx_t_7;
4814   Py_ssize_t __pyx_t_8;
4815   Py_ssize_t __pyx_t_9;
4816   int __pyx_t_10;
4817   Py_ssize_t __pyx_t_11;
4818   __Pyx_RefNannySetupContext("py_pivot", 0);
4819   __pyx_pybuffer_pos.pybuffer.buf = NULL;
4820   __pyx_pybuffer_pos.refcount = 0;
4821   __pyx_pybuffernd_pos.data = NULL;
4822   __pyx_pybuffernd_pos.rcbuffer = &__pyx_pybuffer_pos;
4823   {
4824     __Pyx_BufFmt_StackElem __pyx_stack[1];
4825     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 182, __pyx_L1_error)
4826   }
4827   __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1];
4828 
4829   /* "yt/utilities/lib/cykdtree/utils.pyx":197
4830  *
4831  *     """
4832  *     cdef np.intp_t ndim = pos.shape[1]             # <<<<<<<<<<<<<<
4833  *     cdef int64_t l = 0
4834  *     cdef int64_t r = pos.shape[0]-1
4835  */
4836   __pyx_v_ndim = (__pyx_v_pos->dimensions[1]);
4837 
4838   /* "yt/utilities/lib/cykdtree/utils.pyx":198
4839  *     """
4840  *     cdef np.intp_t ndim = pos.shape[1]
4841  *     cdef int64_t l = 0             # <<<<<<<<<<<<<<
4842  *     cdef int64_t r = pos.shape[0]-1
4843  *     cdef uint64_t[:] idx
4844  */
4845   __pyx_v_l = 0;
4846 
4847   /* "yt/utilities/lib/cykdtree/utils.pyx":199
4848  *     cdef np.intp_t ndim = pos.shape[1]
4849  *     cdef int64_t l = 0
4850  *     cdef int64_t r = pos.shape[0]-1             # <<<<<<<<<<<<<<
4851  *     cdef uint64_t[:] idx
4852  *     idx = np.arange(pos.shape[0]).astype('uint64')
4853  */
4854   __pyx_v_r = ((__pyx_v_pos->dimensions[0]) - 1);
4855 
4856   /* "yt/utilities/lib/cykdtree/utils.pyx":201
4857  *     cdef int64_t r = pos.shape[0]-1
4858  *     cdef uint64_t[:] idx
4859  *     idx = np.arange(pos.shape[0]).astype('uint64')             # <<<<<<<<<<<<<<
4860  *     cdef double *ptr_pos = NULL
4861  *     cdef uint64_t *ptr_idx = NULL
4862  */
4863   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error)
4864   __Pyx_GOTREF(__pyx_t_3);
4865   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_arange); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 201, __pyx_L1_error)
4866   __Pyx_GOTREF(__pyx_t_4);
4867   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4868   __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_pos->dimensions[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error)
4869   __Pyx_GOTREF(__pyx_t_3);
4870   __pyx_t_5 = NULL;
4871   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
4872     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
4873     if (likely(__pyx_t_5)) {
4874       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4875       __Pyx_INCREF(__pyx_t_5);
4876       __Pyx_INCREF(function);
4877       __Pyx_DECREF_SET(__pyx_t_4, function);
4878     }
4879   }
4880   __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);
4881   __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4882   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4883   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error)
4884   __Pyx_GOTREF(__pyx_t_2);
4885   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4886   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 201, __pyx_L1_error)
4887   __Pyx_GOTREF(__pyx_t_4);
4888   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4889   __pyx_t_2 = NULL;
4890   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
4891     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
4892     if (likely(__pyx_t_2)) {
4893       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4894       __Pyx_INCREF(__pyx_t_2);
4895       __Pyx_INCREF(function);
4896       __Pyx_DECREF_SET(__pyx_t_4, function);
4897     }
4898   }
4899   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_n_s_uint64) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_s_uint64);
4900   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4901   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
4902   __Pyx_GOTREF(__pyx_t_1);
4903   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4904   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_uint64_t(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 201, __pyx_L1_error)
4905   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4906   __pyx_v_idx = __pyx_t_6;
4907   __pyx_t_6.memview = NULL;
4908   __pyx_t_6.data = NULL;
4909 
4910   /* "yt/utilities/lib/cykdtree/utils.pyx":202
4911  *     cdef uint64_t[:] idx
4912  *     idx = np.arange(pos.shape[0]).astype('uint64')
4913  *     cdef double *ptr_pos = NULL             # <<<<<<<<<<<<<<
4914  *     cdef uint64_t *ptr_idx = NULL
4915  *     if pos.shape[0] != 0:
4916  */
4917   __pyx_v_ptr_pos = NULL;
4918 
4919   /* "yt/utilities/lib/cykdtree/utils.pyx":203
4920  *     idx = np.arange(pos.shape[0]).astype('uint64')
4921  *     cdef double *ptr_pos = NULL
4922  *     cdef uint64_t *ptr_idx = NULL             # <<<<<<<<<<<<<<
4923  *     if pos.shape[0] != 0:
4924  *         ptr_pos = &pos[0,0]
4925  */
4926   __pyx_v_ptr_idx = NULL;
4927 
4928   /* "yt/utilities/lib/cykdtree/utils.pyx":204
4929  *     cdef double *ptr_pos = NULL
4930  *     cdef uint64_t *ptr_idx = NULL
4931  *     if pos.shape[0] != 0:             # <<<<<<<<<<<<<<
4932  *         ptr_pos = &pos[0,0]
4933  *         ptr_idx = &idx[0]
4934  */
4935   __pyx_t_7 = (((__pyx_v_pos->dimensions[0]) != 0) != 0);
4936   if (__pyx_t_7) {
4937 
4938     /* "yt/utilities/lib/cykdtree/utils.pyx":205
4939  *     cdef uint64_t *ptr_idx = NULL
4940  *     if pos.shape[0] != 0:
4941  *         ptr_pos = &pos[0,0]             # <<<<<<<<<<<<<<
4942  *         ptr_idx = &idx[0]
4943  *     cdef int64_t q = pivot(ptr_pos, ptr_idx, ndim, d, l, r)
4944  */
4945     __pyx_t_8 = 0;
4946     __pyx_t_9 = 0;
4947     __pyx_t_10 = -1;
4948     if (__pyx_t_8 < 0) {
4949       __pyx_t_8 += __pyx_pybuffernd_pos.diminfo[0].shape;
4950       if (unlikely(__pyx_t_8 < 0)) __pyx_t_10 = 0;
4951     } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_pos.diminfo[0].shape)) __pyx_t_10 = 0;
4952     if (__pyx_t_9 < 0) {
4953       __pyx_t_9 += __pyx_pybuffernd_pos.diminfo[1].shape;
4954       if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 1;
4955     } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_pos.diminfo[1].shape)) __pyx_t_10 = 1;
4956     if (unlikely(__pyx_t_10 != -1)) {
4957       __Pyx_RaiseBufferIndexError(__pyx_t_10);
4958       __PYX_ERR(0, 205, __pyx_L1_error)
4959     }
4960     __pyx_v_ptr_pos = (&(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_pos.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_pos.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_pos.diminfo[1].strides)));
4961 
4962     /* "yt/utilities/lib/cykdtree/utils.pyx":206
4963  *     if pos.shape[0] != 0:
4964  *         ptr_pos = &pos[0,0]
4965  *         ptr_idx = &idx[0]             # <<<<<<<<<<<<<<
4966  *     cdef int64_t q = pivot(ptr_pos, ptr_idx, ndim, d, l, r)
4967  *     return q, idx
4968  */
4969     __pyx_t_11 = 0;
4970     __pyx_t_10 = -1;
4971     if (__pyx_t_11 < 0) {
4972       __pyx_t_11 += __pyx_v_idx.shape[0];
4973       if (unlikely(__pyx_t_11 < 0)) __pyx_t_10 = 0;
4974     } else if (unlikely(__pyx_t_11 >= __pyx_v_idx.shape[0])) __pyx_t_10 = 0;
4975     if (unlikely(__pyx_t_10 != -1)) {
4976       __Pyx_RaiseBufferIndexError(__pyx_t_10);
4977       __PYX_ERR(0, 206, __pyx_L1_error)
4978     }
4979     __pyx_v_ptr_idx = (&(*((uint64_t *) ( /* dim=0 */ (__pyx_v_idx.data + __pyx_t_11 * __pyx_v_idx.strides[0]) ))));
4980 
4981     /* "yt/utilities/lib/cykdtree/utils.pyx":204
4982  *     cdef double *ptr_pos = NULL
4983  *     cdef uint64_t *ptr_idx = NULL
4984  *     if pos.shape[0] != 0:             # <<<<<<<<<<<<<<
4985  *         ptr_pos = &pos[0,0]
4986  *         ptr_idx = &idx[0]
4987  */
4988   }
4989 
4990   /* "yt/utilities/lib/cykdtree/utils.pyx":207
4991  *         ptr_pos = &pos[0,0]
4992  *         ptr_idx = &idx[0]
4993  *     cdef int64_t q = pivot(ptr_pos, ptr_idx, ndim, d, l, r)             # <<<<<<<<<<<<<<
4994  *     return q, idx
4995  *
4996  */
4997   __pyx_v_q = pivot(__pyx_v_ptr_pos, __pyx_v_ptr_idx, __pyx_v_ndim, __pyx_v_d, __pyx_v_l, __pyx_v_r);
4998 
4999   /* "yt/utilities/lib/cykdtree/utils.pyx":208
5000  *         ptr_idx = &idx[0]
5001  *     cdef int64_t q = pivot(ptr_pos, ptr_idx, ndim, d, l, r)
5002  *     return q, idx             # <<<<<<<<<<<<<<
5003  *
5004  * def py_partition(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d,
5005  */
5006   __Pyx_XDECREF(__pyx_r);
5007   __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_q); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error)
5008   __Pyx_GOTREF(__pyx_t_1);
5009   __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_idx, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn_uint64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn_uint64_t, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 208, __pyx_L1_error)
5010   __Pyx_GOTREF(__pyx_t_4);
5011   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L1_error)
5012   __Pyx_GOTREF(__pyx_t_2);
5013   __Pyx_GIVEREF(__pyx_t_1);
5014   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
5015   __Pyx_GIVEREF(__pyx_t_4);
5016   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
5017   __pyx_t_1 = 0;
5018   __pyx_t_4 = 0;
5019   __pyx_r = __pyx_t_2;
5020   __pyx_t_2 = 0;
5021   goto __pyx_L0;
5022 
5023   /* "yt/utilities/lib/cykdtree/utils.pyx":182
5024  *     return idx
5025  *
5026  * def py_pivot(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d):             # <<<<<<<<<<<<<<
5027  *     r"""Get the index of the median of medians along one dimension and indices
5028  *     that partition pos according to the median of medians.
5029  */
5030 
5031   /* function exit code */
5032   __pyx_L1_error:;
5033   __Pyx_XDECREF(__pyx_t_1);
5034   __Pyx_XDECREF(__pyx_t_2);
5035   __Pyx_XDECREF(__pyx_t_3);
5036   __Pyx_XDECREF(__pyx_t_4);
5037   __Pyx_XDECREF(__pyx_t_5);
5038   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
5039   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5040     __Pyx_PyThreadState_declare
5041     __Pyx_PyThreadState_assign
5042     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5043     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
5044   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5045   __Pyx_AddTraceback("yt.utilities.lib.cykdtree.utils.py_pivot", __pyx_clineno, __pyx_lineno, __pyx_filename);
5046   __pyx_r = NULL;
5047   goto __pyx_L2;
5048   __pyx_L0:;
5049   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
5050   __pyx_L2:;
5051   __PYX_XDEC_MEMVIEW(&__pyx_v_idx, 1);
5052   __Pyx_XGIVEREF(__pyx_r);
5053   __Pyx_RefNannyFinishContext();
5054   return __pyx_r;
5055 }
5056 
5057 /* "yt/utilities/lib/cykdtree/utils.pyx":210
5058  *     return q, idx
5059  *
5060  * def py_partition(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d,             # <<<<<<<<<<<<<<
5061  *                  np.int64_t p):
5062  *     r"""Get the indices required to partition coordinates along one dimension.
5063  */
5064 
5065 /* Python wrapper */
5066 static PyObject *__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_15py_partition(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5067 static char __pyx_doc_2yt_9utilities_3lib_8cykdtree_5utils_14py_partition[] = "Get the indices required to partition coordinates along one dimension.\n\n    Args:\n        pos (np.ndarray of float64): (n,m) array of n m-D coordinates.\n        d (np.uint32_t): Dimension that pos should be partitioned along.\n        p (np.int64_t): Element of pos[:,d] that should be used as the pivot\n            to partition pos.\n\n    Returns:\n        tuple of int64 and np.ndarray of uint64: Location of the pivot in the\n            partitioned array and the indices required to partition the array\n            such that elements before the pivot are smaller and elements after\n            the pivot are larger.\n\n    ";
5068 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_8cykdtree_5utils_15py_partition = {"py_partition", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_15py_partition, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2yt_9utilities_3lib_8cykdtree_5utils_14py_partition};
__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_15py_partition(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)5069 static PyObject *__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_15py_partition(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5070   PyArrayObject *__pyx_v_pos = 0;
5071   __pyx_t_5numpy_uint32_t __pyx_v_d;
5072   __pyx_t_5numpy_int64_t __pyx_v_p;
5073   PyObject *__pyx_r = 0;
5074   __Pyx_RefNannyDeclarations
5075   __Pyx_RefNannySetupContext("py_partition (wrapper)", 0);
5076   {
5077     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_d,&__pyx_n_s_p,0};
5078     PyObject* values[3] = {0,0,0};
5079     if (unlikely(__pyx_kwds)) {
5080       Py_ssize_t kw_args;
5081       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5082       switch (pos_args) {
5083         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5084         CYTHON_FALLTHROUGH;
5085         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5086         CYTHON_FALLTHROUGH;
5087         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5088         CYTHON_FALLTHROUGH;
5089         case  0: break;
5090         default: goto __pyx_L5_argtuple_error;
5091       }
5092       kw_args = PyDict_Size(__pyx_kwds);
5093       switch (pos_args) {
5094         case  0:
5095         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
5096         else goto __pyx_L5_argtuple_error;
5097         CYTHON_FALLTHROUGH;
5098         case  1:
5099         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
5100         else {
5101           __Pyx_RaiseArgtupleInvalid("py_partition", 1, 3, 3, 1); __PYX_ERR(0, 210, __pyx_L3_error)
5102         }
5103         CYTHON_FALLTHROUGH;
5104         case  2:
5105         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
5106         else {
5107           __Pyx_RaiseArgtupleInvalid("py_partition", 1, 3, 3, 2); __PYX_ERR(0, 210, __pyx_L3_error)
5108         }
5109       }
5110       if (unlikely(kw_args > 0)) {
5111         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "py_partition") < 0)) __PYX_ERR(0, 210, __pyx_L3_error)
5112       }
5113     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
5114       goto __pyx_L5_argtuple_error;
5115     } else {
5116       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5117       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5118       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5119     }
5120     __pyx_v_pos = ((PyArrayObject *)values[0]);
5121     __pyx_v_d = __Pyx_PyInt_As_npy_uint32(values[1]); if (unlikely((__pyx_v_d == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 210, __pyx_L3_error)
5122     __pyx_v_p = __Pyx_PyInt_As_npy_int64(values[2]); if (unlikely((__pyx_v_p == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 211, __pyx_L3_error)
5123   }
5124   goto __pyx_L4_argument_unpacking_done;
5125   __pyx_L5_argtuple_error:;
5126   __Pyx_RaiseArgtupleInvalid("py_partition", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 210, __pyx_L3_error)
5127   __pyx_L3_error:;
5128   __Pyx_AddTraceback("yt.utilities.lib.cykdtree.utils.py_partition", __pyx_clineno, __pyx_lineno, __pyx_filename);
5129   __Pyx_RefNannyFinishContext();
5130   return NULL;
5131   __pyx_L4_argument_unpacking_done:;
5132   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 1, "pos", 0))) __PYX_ERR(0, 210, __pyx_L1_error)
5133   __pyx_r = __pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_14py_partition(__pyx_self, __pyx_v_pos, __pyx_v_d, __pyx_v_p);
5134 
5135   /* function exit code */
5136   goto __pyx_L0;
5137   __pyx_L1_error:;
5138   __pyx_r = NULL;
5139   __pyx_L0:;
5140   __Pyx_RefNannyFinishContext();
5141   return __pyx_r;
5142 }
5143 
__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_14py_partition(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_pos,__pyx_t_5numpy_uint32_t __pyx_v_d,__pyx_t_5numpy_int64_t __pyx_v_p)5144 static PyObject *__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_14py_partition(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_uint32_t __pyx_v_d, __pyx_t_5numpy_int64_t __pyx_v_p) {
5145   __pyx_t_5numpy_intp_t __pyx_v_ndim;
5146   int64_t __pyx_v_l;
5147   int64_t __pyx_v_r;
5148   __Pyx_memviewslice __pyx_v_idx = { 0, 0, { 0 }, { 0 }, { 0 } };
5149   double *__pyx_v_ptr_pos;
5150   uint64_t *__pyx_v_ptr_idx;
5151   int64_t __pyx_v_q;
5152   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos;
5153   __Pyx_Buffer __pyx_pybuffer_pos;
5154   PyObject *__pyx_r = NULL;
5155   __Pyx_RefNannyDeclarations
5156   PyObject *__pyx_t_1 = NULL;
5157   PyObject *__pyx_t_2 = NULL;
5158   PyObject *__pyx_t_3 = NULL;
5159   PyObject *__pyx_t_4 = NULL;
5160   PyObject *__pyx_t_5 = NULL;
5161   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
5162   int __pyx_t_7;
5163   Py_ssize_t __pyx_t_8;
5164   Py_ssize_t __pyx_t_9;
5165   int __pyx_t_10;
5166   Py_ssize_t __pyx_t_11;
5167   __Pyx_RefNannySetupContext("py_partition", 0);
5168   __pyx_pybuffer_pos.pybuffer.buf = NULL;
5169   __pyx_pybuffer_pos.refcount = 0;
5170   __pyx_pybuffernd_pos.data = NULL;
5171   __pyx_pybuffernd_pos.rcbuffer = &__pyx_pybuffer_pos;
5172   {
5173     __Pyx_BufFmt_StackElem __pyx_stack[1];
5174     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 210, __pyx_L1_error)
5175   }
5176   __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1];
5177 
5178   /* "yt/utilities/lib/cykdtree/utils.pyx":227
5179  *
5180  *     """
5181  *     cdef np.intp_t ndim = pos.shape[1]             # <<<<<<<<<<<<<<
5182  *     cdef int64_t l = 0
5183  *     cdef int64_t r = pos.shape[0]-1
5184  */
5185   __pyx_v_ndim = (__pyx_v_pos->dimensions[1]);
5186 
5187   /* "yt/utilities/lib/cykdtree/utils.pyx":228
5188  *     """
5189  *     cdef np.intp_t ndim = pos.shape[1]
5190  *     cdef int64_t l = 0             # <<<<<<<<<<<<<<
5191  *     cdef int64_t r = pos.shape[0]-1
5192  *     cdef uint64_t[:] idx
5193  */
5194   __pyx_v_l = 0;
5195 
5196   /* "yt/utilities/lib/cykdtree/utils.pyx":229
5197  *     cdef np.intp_t ndim = pos.shape[1]
5198  *     cdef int64_t l = 0
5199  *     cdef int64_t r = pos.shape[0]-1             # <<<<<<<<<<<<<<
5200  *     cdef uint64_t[:] idx
5201  *     idx = np.arange(pos.shape[0]).astype('uint64')
5202  */
5203   __pyx_v_r = ((__pyx_v_pos->dimensions[0]) - 1);
5204 
5205   /* "yt/utilities/lib/cykdtree/utils.pyx":231
5206  *     cdef int64_t r = pos.shape[0]-1
5207  *     cdef uint64_t[:] idx
5208  *     idx = np.arange(pos.shape[0]).astype('uint64')             # <<<<<<<<<<<<<<
5209  *     cdef double *ptr_pos = NULL
5210  *     cdef uint64_t *ptr_idx = NULL
5211  */
5212   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 231, __pyx_L1_error)
5213   __Pyx_GOTREF(__pyx_t_3);
5214   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_arange); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 231, __pyx_L1_error)
5215   __Pyx_GOTREF(__pyx_t_4);
5216   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5217   __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_pos->dimensions[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 231, __pyx_L1_error)
5218   __Pyx_GOTREF(__pyx_t_3);
5219   __pyx_t_5 = NULL;
5220   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
5221     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
5222     if (likely(__pyx_t_5)) {
5223       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
5224       __Pyx_INCREF(__pyx_t_5);
5225       __Pyx_INCREF(function);
5226       __Pyx_DECREF_SET(__pyx_t_4, function);
5227     }
5228   }
5229   __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);
5230   __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5231   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5232   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 231, __pyx_L1_error)
5233   __Pyx_GOTREF(__pyx_t_2);
5234   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5235   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 231, __pyx_L1_error)
5236   __Pyx_GOTREF(__pyx_t_4);
5237   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5238   __pyx_t_2 = NULL;
5239   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
5240     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
5241     if (likely(__pyx_t_2)) {
5242       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
5243       __Pyx_INCREF(__pyx_t_2);
5244       __Pyx_INCREF(function);
5245       __Pyx_DECREF_SET(__pyx_t_4, function);
5246     }
5247   }
5248   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_n_s_uint64) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_s_uint64);
5249   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5250   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __pyx_L1_error)
5251   __Pyx_GOTREF(__pyx_t_1);
5252   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5253   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_uint64_t(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 231, __pyx_L1_error)
5254   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5255   __pyx_v_idx = __pyx_t_6;
5256   __pyx_t_6.memview = NULL;
5257   __pyx_t_6.data = NULL;
5258 
5259   /* "yt/utilities/lib/cykdtree/utils.pyx":232
5260  *     cdef uint64_t[:] idx
5261  *     idx = np.arange(pos.shape[0]).astype('uint64')
5262  *     cdef double *ptr_pos = NULL             # <<<<<<<<<<<<<<
5263  *     cdef uint64_t *ptr_idx = NULL
5264  *     if pos.shape[0] != 0:
5265  */
5266   __pyx_v_ptr_pos = NULL;
5267 
5268   /* "yt/utilities/lib/cykdtree/utils.pyx":233
5269  *     idx = np.arange(pos.shape[0]).astype('uint64')
5270  *     cdef double *ptr_pos = NULL
5271  *     cdef uint64_t *ptr_idx = NULL             # <<<<<<<<<<<<<<
5272  *     if pos.shape[0] != 0:
5273  *         ptr_pos = &pos[0,0]
5274  */
5275   __pyx_v_ptr_idx = NULL;
5276 
5277   /* "yt/utilities/lib/cykdtree/utils.pyx":234
5278  *     cdef double *ptr_pos = NULL
5279  *     cdef uint64_t *ptr_idx = NULL
5280  *     if pos.shape[0] != 0:             # <<<<<<<<<<<<<<
5281  *         ptr_pos = &pos[0,0]
5282  *         ptr_idx = &idx[0]
5283  */
5284   __pyx_t_7 = (((__pyx_v_pos->dimensions[0]) != 0) != 0);
5285   if (__pyx_t_7) {
5286 
5287     /* "yt/utilities/lib/cykdtree/utils.pyx":235
5288  *     cdef uint64_t *ptr_idx = NULL
5289  *     if pos.shape[0] != 0:
5290  *         ptr_pos = &pos[0,0]             # <<<<<<<<<<<<<<
5291  *         ptr_idx = &idx[0]
5292  *     cdef int64_t q = partition(ptr_pos, ptr_idx, ndim, d, l, r, p)
5293  */
5294     __pyx_t_8 = 0;
5295     __pyx_t_9 = 0;
5296     __pyx_t_10 = -1;
5297     if (__pyx_t_8 < 0) {
5298       __pyx_t_8 += __pyx_pybuffernd_pos.diminfo[0].shape;
5299       if (unlikely(__pyx_t_8 < 0)) __pyx_t_10 = 0;
5300     } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_pos.diminfo[0].shape)) __pyx_t_10 = 0;
5301     if (__pyx_t_9 < 0) {
5302       __pyx_t_9 += __pyx_pybuffernd_pos.diminfo[1].shape;
5303       if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 1;
5304     } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_pos.diminfo[1].shape)) __pyx_t_10 = 1;
5305     if (unlikely(__pyx_t_10 != -1)) {
5306       __Pyx_RaiseBufferIndexError(__pyx_t_10);
5307       __PYX_ERR(0, 235, __pyx_L1_error)
5308     }
5309     __pyx_v_ptr_pos = (&(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_pos.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_pos.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_pos.diminfo[1].strides)));
5310 
5311     /* "yt/utilities/lib/cykdtree/utils.pyx":236
5312  *     if pos.shape[0] != 0:
5313  *         ptr_pos = &pos[0,0]
5314  *         ptr_idx = &idx[0]             # <<<<<<<<<<<<<<
5315  *     cdef int64_t q = partition(ptr_pos, ptr_idx, ndim, d, l, r, p)
5316  *     return q, idx
5317  */
5318     __pyx_t_11 = 0;
5319     __pyx_t_10 = -1;
5320     if (__pyx_t_11 < 0) {
5321       __pyx_t_11 += __pyx_v_idx.shape[0];
5322       if (unlikely(__pyx_t_11 < 0)) __pyx_t_10 = 0;
5323     } else if (unlikely(__pyx_t_11 >= __pyx_v_idx.shape[0])) __pyx_t_10 = 0;
5324     if (unlikely(__pyx_t_10 != -1)) {
5325       __Pyx_RaiseBufferIndexError(__pyx_t_10);
5326       __PYX_ERR(0, 236, __pyx_L1_error)
5327     }
5328     __pyx_v_ptr_idx = (&(*((uint64_t *) ( /* dim=0 */ (__pyx_v_idx.data + __pyx_t_11 * __pyx_v_idx.strides[0]) ))));
5329 
5330     /* "yt/utilities/lib/cykdtree/utils.pyx":234
5331  *     cdef double *ptr_pos = NULL
5332  *     cdef uint64_t *ptr_idx = NULL
5333  *     if pos.shape[0] != 0:             # <<<<<<<<<<<<<<
5334  *         ptr_pos = &pos[0,0]
5335  *         ptr_idx = &idx[0]
5336  */
5337   }
5338 
5339   /* "yt/utilities/lib/cykdtree/utils.pyx":237
5340  *         ptr_pos = &pos[0,0]
5341  *         ptr_idx = &idx[0]
5342  *     cdef int64_t q = partition(ptr_pos, ptr_idx, ndim, d, l, r, p)             # <<<<<<<<<<<<<<
5343  *     return q, idx
5344  *
5345  */
5346   __pyx_v_q = partition(__pyx_v_ptr_pos, __pyx_v_ptr_idx, __pyx_v_ndim, __pyx_v_d, __pyx_v_l, __pyx_v_r, __pyx_v_p);
5347 
5348   /* "yt/utilities/lib/cykdtree/utils.pyx":238
5349  *         ptr_idx = &idx[0]
5350  *     cdef int64_t q = partition(ptr_pos, ptr_idx, ndim, d, l, r, p)
5351  *     return q, idx             # <<<<<<<<<<<<<<
5352  *
5353  * def py_partition_given_pivot(np.ndarray[np.float64_t, ndim=2] pos,
5354  */
5355   __Pyx_XDECREF(__pyx_r);
5356   __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_q); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error)
5357   __Pyx_GOTREF(__pyx_t_1);
5358   __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_idx, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn_uint64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn_uint64_t, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __pyx_L1_error)
5359   __Pyx_GOTREF(__pyx_t_4);
5360   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __pyx_L1_error)
5361   __Pyx_GOTREF(__pyx_t_2);
5362   __Pyx_GIVEREF(__pyx_t_1);
5363   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
5364   __Pyx_GIVEREF(__pyx_t_4);
5365   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
5366   __pyx_t_1 = 0;
5367   __pyx_t_4 = 0;
5368   __pyx_r = __pyx_t_2;
5369   __pyx_t_2 = 0;
5370   goto __pyx_L0;
5371 
5372   /* "yt/utilities/lib/cykdtree/utils.pyx":210
5373  *     return q, idx
5374  *
5375  * def py_partition(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d,             # <<<<<<<<<<<<<<
5376  *                  np.int64_t p):
5377  *     r"""Get the indices required to partition coordinates along one dimension.
5378  */
5379 
5380   /* function exit code */
5381   __pyx_L1_error:;
5382   __Pyx_XDECREF(__pyx_t_1);
5383   __Pyx_XDECREF(__pyx_t_2);
5384   __Pyx_XDECREF(__pyx_t_3);
5385   __Pyx_XDECREF(__pyx_t_4);
5386   __Pyx_XDECREF(__pyx_t_5);
5387   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
5388   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5389     __Pyx_PyThreadState_declare
5390     __Pyx_PyThreadState_assign
5391     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5392     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
5393   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5394   __Pyx_AddTraceback("yt.utilities.lib.cykdtree.utils.py_partition", __pyx_clineno, __pyx_lineno, __pyx_filename);
5395   __pyx_r = NULL;
5396   goto __pyx_L2;
5397   __pyx_L0:;
5398   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
5399   __pyx_L2:;
5400   __PYX_XDEC_MEMVIEW(&__pyx_v_idx, 1);
5401   __Pyx_XGIVEREF(__pyx_r);
5402   __Pyx_RefNannyFinishContext();
5403   return __pyx_r;
5404 }
5405 
5406 /* "yt/utilities/lib/cykdtree/utils.pyx":240
5407  *     return q, idx
5408  *
5409  * def py_partition_given_pivot(np.ndarray[np.float64_t, ndim=2] pos,             # <<<<<<<<<<<<<<
5410  *                              np.uint32_t d, np.float64_t pval):
5411  *     r"""Get the indices required to partition coordinates along one dimension.
5412  */
5413 
5414 /* Python wrapper */
5415 static PyObject *__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_17py_partition_given_pivot(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5416 static char __pyx_doc_2yt_9utilities_3lib_8cykdtree_5utils_16py_partition_given_pivot[] = "Get the indices required to partition coordinates along one dimension.\n\n    Args:\n        pos (np.ndarray of float64): (n,m) array of n m-D coordinates.\n        d (np.uint32_t): Dimension that pos should be partitioned along.\n        pval (np.float64_t): Value that should be used to partition pos.\n\n    Returns:\n        tuple of int64 and np.ndarray of uint64: Location of the largest value\n            that is smaller than pval in partitioned array and the indices\n            required to partition the array such that elements before the pivot\n            are smaller and elements after the pivot are larger.\n\n    ";
5417 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_8cykdtree_5utils_17py_partition_given_pivot = {"py_partition_given_pivot", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_17py_partition_given_pivot, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2yt_9utilities_3lib_8cykdtree_5utils_16py_partition_given_pivot};
__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_17py_partition_given_pivot(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)5418 static PyObject *__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_17py_partition_given_pivot(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5419   PyArrayObject *__pyx_v_pos = 0;
5420   __pyx_t_5numpy_uint32_t __pyx_v_d;
5421   __pyx_t_5numpy_float64_t __pyx_v_pval;
5422   PyObject *__pyx_r = 0;
5423   __Pyx_RefNannyDeclarations
5424   __Pyx_RefNannySetupContext("py_partition_given_pivot (wrapper)", 0);
5425   {
5426     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_d,&__pyx_n_s_pval,0};
5427     PyObject* values[3] = {0,0,0};
5428     if (unlikely(__pyx_kwds)) {
5429       Py_ssize_t kw_args;
5430       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5431       switch (pos_args) {
5432         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5433         CYTHON_FALLTHROUGH;
5434         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5435         CYTHON_FALLTHROUGH;
5436         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5437         CYTHON_FALLTHROUGH;
5438         case  0: break;
5439         default: goto __pyx_L5_argtuple_error;
5440       }
5441       kw_args = PyDict_Size(__pyx_kwds);
5442       switch (pos_args) {
5443         case  0:
5444         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
5445         else goto __pyx_L5_argtuple_error;
5446         CYTHON_FALLTHROUGH;
5447         case  1:
5448         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
5449         else {
5450           __Pyx_RaiseArgtupleInvalid("py_partition_given_pivot", 1, 3, 3, 1); __PYX_ERR(0, 240, __pyx_L3_error)
5451         }
5452         CYTHON_FALLTHROUGH;
5453         case  2:
5454         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pval)) != 0)) kw_args--;
5455         else {
5456           __Pyx_RaiseArgtupleInvalid("py_partition_given_pivot", 1, 3, 3, 2); __PYX_ERR(0, 240, __pyx_L3_error)
5457         }
5458       }
5459       if (unlikely(kw_args > 0)) {
5460         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "py_partition_given_pivot") < 0)) __PYX_ERR(0, 240, __pyx_L3_error)
5461       }
5462     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
5463       goto __pyx_L5_argtuple_error;
5464     } else {
5465       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5466       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5467       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5468     }
5469     __pyx_v_pos = ((PyArrayObject *)values[0]);
5470     __pyx_v_d = __Pyx_PyInt_As_npy_uint32(values[1]); if (unlikely((__pyx_v_d == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L3_error)
5471     __pyx_v_pval = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_pval == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L3_error)
5472   }
5473   goto __pyx_L4_argument_unpacking_done;
5474   __pyx_L5_argtuple_error:;
5475   __Pyx_RaiseArgtupleInvalid("py_partition_given_pivot", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 240, __pyx_L3_error)
5476   __pyx_L3_error:;
5477   __Pyx_AddTraceback("yt.utilities.lib.cykdtree.utils.py_partition_given_pivot", __pyx_clineno, __pyx_lineno, __pyx_filename);
5478   __Pyx_RefNannyFinishContext();
5479   return NULL;
5480   __pyx_L4_argument_unpacking_done:;
5481   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 1, "pos", 0))) __PYX_ERR(0, 240, __pyx_L1_error)
5482   __pyx_r = __pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_16py_partition_given_pivot(__pyx_self, __pyx_v_pos, __pyx_v_d, __pyx_v_pval);
5483 
5484   /* function exit code */
5485   goto __pyx_L0;
5486   __pyx_L1_error:;
5487   __pyx_r = NULL;
5488   __pyx_L0:;
5489   __Pyx_RefNannyFinishContext();
5490   return __pyx_r;
5491 }
5492 
__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_16py_partition_given_pivot(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_pos,__pyx_t_5numpy_uint32_t __pyx_v_d,__pyx_t_5numpy_float64_t __pyx_v_pval)5493 static PyObject *__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_16py_partition_given_pivot(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_uint32_t __pyx_v_d, __pyx_t_5numpy_float64_t __pyx_v_pval) {
5494   __pyx_t_5numpy_intp_t __pyx_v_ndim;
5495   int64_t __pyx_v_l;
5496   int64_t __pyx_v_r;
5497   __Pyx_memviewslice __pyx_v_idx = { 0, 0, { 0 }, { 0 }, { 0 } };
5498   double *__pyx_v_ptr_pos;
5499   uint64_t *__pyx_v_ptr_idx;
5500   int64_t __pyx_v_q;
5501   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos;
5502   __Pyx_Buffer __pyx_pybuffer_pos;
5503   PyObject *__pyx_r = NULL;
5504   __Pyx_RefNannyDeclarations
5505   PyObject *__pyx_t_1 = NULL;
5506   PyObject *__pyx_t_2 = NULL;
5507   PyObject *__pyx_t_3 = NULL;
5508   PyObject *__pyx_t_4 = NULL;
5509   PyObject *__pyx_t_5 = NULL;
5510   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
5511   int __pyx_t_7;
5512   Py_ssize_t __pyx_t_8;
5513   Py_ssize_t __pyx_t_9;
5514   int __pyx_t_10;
5515   Py_ssize_t __pyx_t_11;
5516   __Pyx_RefNannySetupContext("py_partition_given_pivot", 0);
5517   __pyx_pybuffer_pos.pybuffer.buf = NULL;
5518   __pyx_pybuffer_pos.refcount = 0;
5519   __pyx_pybuffernd_pos.data = NULL;
5520   __pyx_pybuffernd_pos.rcbuffer = &__pyx_pybuffer_pos;
5521   {
5522     __Pyx_BufFmt_StackElem __pyx_stack[1];
5523     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 240, __pyx_L1_error)
5524   }
5525   __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1];
5526 
5527   /* "yt/utilities/lib/cykdtree/utils.pyx":256
5528  *
5529  *     """
5530  *     cdef np.intp_t ndim = pos.shape[1]             # <<<<<<<<<<<<<<
5531  *     cdef int64_t l = 0
5532  *     cdef int64_t r = pos.shape[0]-1
5533  */
5534   __pyx_v_ndim = (__pyx_v_pos->dimensions[1]);
5535 
5536   /* "yt/utilities/lib/cykdtree/utils.pyx":257
5537  *     """
5538  *     cdef np.intp_t ndim = pos.shape[1]
5539  *     cdef int64_t l = 0             # <<<<<<<<<<<<<<
5540  *     cdef int64_t r = pos.shape[0]-1
5541  *     cdef uint64_t[:] idx
5542  */
5543   __pyx_v_l = 0;
5544 
5545   /* "yt/utilities/lib/cykdtree/utils.pyx":258
5546  *     cdef np.intp_t ndim = pos.shape[1]
5547  *     cdef int64_t l = 0
5548  *     cdef int64_t r = pos.shape[0]-1             # <<<<<<<<<<<<<<
5549  *     cdef uint64_t[:] idx
5550  *     idx = np.arange(pos.shape[0]).astype('uint64')
5551  */
5552   __pyx_v_r = ((__pyx_v_pos->dimensions[0]) - 1);
5553 
5554   /* "yt/utilities/lib/cykdtree/utils.pyx":260
5555  *     cdef int64_t r = pos.shape[0]-1
5556  *     cdef uint64_t[:] idx
5557  *     idx = np.arange(pos.shape[0]).astype('uint64')             # <<<<<<<<<<<<<<
5558  *     cdef double *ptr_pos = NULL
5559  *     cdef uint64_t *ptr_idx = NULL
5560  */
5561   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error)
5562   __Pyx_GOTREF(__pyx_t_3);
5563   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_arange); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 260, __pyx_L1_error)
5564   __Pyx_GOTREF(__pyx_t_4);
5565   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5566   __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_pos->dimensions[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 260, __pyx_L1_error)
5567   __Pyx_GOTREF(__pyx_t_3);
5568   __pyx_t_5 = NULL;
5569   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
5570     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
5571     if (likely(__pyx_t_5)) {
5572       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
5573       __Pyx_INCREF(__pyx_t_5);
5574       __Pyx_INCREF(function);
5575       __Pyx_DECREF_SET(__pyx_t_4, function);
5576     }
5577   }
5578   __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);
5579   __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5580   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5581   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 260, __pyx_L1_error)
5582   __Pyx_GOTREF(__pyx_t_2);
5583   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5584   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 260, __pyx_L1_error)
5585   __Pyx_GOTREF(__pyx_t_4);
5586   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5587   __pyx_t_2 = NULL;
5588   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
5589     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
5590     if (likely(__pyx_t_2)) {
5591       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
5592       __Pyx_INCREF(__pyx_t_2);
5593       __Pyx_INCREF(function);
5594       __Pyx_DECREF_SET(__pyx_t_4, function);
5595     }
5596   }
5597   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_n_s_uint64) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_s_uint64);
5598   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5599   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error)
5600   __Pyx_GOTREF(__pyx_t_1);
5601   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5602   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_uint64_t(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 260, __pyx_L1_error)
5603   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5604   __pyx_v_idx = __pyx_t_6;
5605   __pyx_t_6.memview = NULL;
5606   __pyx_t_6.data = NULL;
5607 
5608   /* "yt/utilities/lib/cykdtree/utils.pyx":261
5609  *     cdef uint64_t[:] idx
5610  *     idx = np.arange(pos.shape[0]).astype('uint64')
5611  *     cdef double *ptr_pos = NULL             # <<<<<<<<<<<<<<
5612  *     cdef uint64_t *ptr_idx = NULL
5613  *     if pos.shape[0] != 0:
5614  */
5615   __pyx_v_ptr_pos = NULL;
5616 
5617   /* "yt/utilities/lib/cykdtree/utils.pyx":262
5618  *     idx = np.arange(pos.shape[0]).astype('uint64')
5619  *     cdef double *ptr_pos = NULL
5620  *     cdef uint64_t *ptr_idx = NULL             # <<<<<<<<<<<<<<
5621  *     if pos.shape[0] != 0:
5622  *         ptr_pos = &pos[0,0]
5623  */
5624   __pyx_v_ptr_idx = NULL;
5625 
5626   /* "yt/utilities/lib/cykdtree/utils.pyx":263
5627  *     cdef double *ptr_pos = NULL
5628  *     cdef uint64_t *ptr_idx = NULL
5629  *     if pos.shape[0] != 0:             # <<<<<<<<<<<<<<
5630  *         ptr_pos = &pos[0,0]
5631  *         ptr_idx = &idx[0]
5632  */
5633   __pyx_t_7 = (((__pyx_v_pos->dimensions[0]) != 0) != 0);
5634   if (__pyx_t_7) {
5635 
5636     /* "yt/utilities/lib/cykdtree/utils.pyx":264
5637  *     cdef uint64_t *ptr_idx = NULL
5638  *     if pos.shape[0] != 0:
5639  *         ptr_pos = &pos[0,0]             # <<<<<<<<<<<<<<
5640  *         ptr_idx = &idx[0]
5641  *     cdef int64_t q = partition_given_pivot(ptr_pos, ptr_idx, ndim, d, l, r,
5642  */
5643     __pyx_t_8 = 0;
5644     __pyx_t_9 = 0;
5645     __pyx_t_10 = -1;
5646     if (__pyx_t_8 < 0) {
5647       __pyx_t_8 += __pyx_pybuffernd_pos.diminfo[0].shape;
5648       if (unlikely(__pyx_t_8 < 0)) __pyx_t_10 = 0;
5649     } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_pos.diminfo[0].shape)) __pyx_t_10 = 0;
5650     if (__pyx_t_9 < 0) {
5651       __pyx_t_9 += __pyx_pybuffernd_pos.diminfo[1].shape;
5652       if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 1;
5653     } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_pos.diminfo[1].shape)) __pyx_t_10 = 1;
5654     if (unlikely(__pyx_t_10 != -1)) {
5655       __Pyx_RaiseBufferIndexError(__pyx_t_10);
5656       __PYX_ERR(0, 264, __pyx_L1_error)
5657     }
5658     __pyx_v_ptr_pos = (&(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_pos.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_pos.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_pos.diminfo[1].strides)));
5659 
5660     /* "yt/utilities/lib/cykdtree/utils.pyx":265
5661  *     if pos.shape[0] != 0:
5662  *         ptr_pos = &pos[0,0]
5663  *         ptr_idx = &idx[0]             # <<<<<<<<<<<<<<
5664  *     cdef int64_t q = partition_given_pivot(ptr_pos, ptr_idx, ndim, d, l, r,
5665  *                                            pval)
5666  */
5667     __pyx_t_11 = 0;
5668     __pyx_t_10 = -1;
5669     if (__pyx_t_11 < 0) {
5670       __pyx_t_11 += __pyx_v_idx.shape[0];
5671       if (unlikely(__pyx_t_11 < 0)) __pyx_t_10 = 0;
5672     } else if (unlikely(__pyx_t_11 >= __pyx_v_idx.shape[0])) __pyx_t_10 = 0;
5673     if (unlikely(__pyx_t_10 != -1)) {
5674       __Pyx_RaiseBufferIndexError(__pyx_t_10);
5675       __PYX_ERR(0, 265, __pyx_L1_error)
5676     }
5677     __pyx_v_ptr_idx = (&(*((uint64_t *) ( /* dim=0 */ (__pyx_v_idx.data + __pyx_t_11 * __pyx_v_idx.strides[0]) ))));
5678 
5679     /* "yt/utilities/lib/cykdtree/utils.pyx":263
5680  *     cdef double *ptr_pos = NULL
5681  *     cdef uint64_t *ptr_idx = NULL
5682  *     if pos.shape[0] != 0:             # <<<<<<<<<<<<<<
5683  *         ptr_pos = &pos[0,0]
5684  *         ptr_idx = &idx[0]
5685  */
5686   }
5687 
5688   /* "yt/utilities/lib/cykdtree/utils.pyx":266
5689  *         ptr_pos = &pos[0,0]
5690  *         ptr_idx = &idx[0]
5691  *     cdef int64_t q = partition_given_pivot(ptr_pos, ptr_idx, ndim, d, l, r,             # <<<<<<<<<<<<<<
5692  *                                            pval)
5693  *     return q, idx
5694  */
5695   __pyx_v_q = partition_given_pivot(__pyx_v_ptr_pos, __pyx_v_ptr_idx, __pyx_v_ndim, __pyx_v_d, __pyx_v_l, __pyx_v_r, __pyx_v_pval);
5696 
5697   /* "yt/utilities/lib/cykdtree/utils.pyx":268
5698  *     cdef int64_t q = partition_given_pivot(ptr_pos, ptr_idx, ndim, d, l, r,
5699  *                                            pval)
5700  *     return q, idx             # <<<<<<<<<<<<<<
5701  *
5702  * def py_select(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d,
5703  */
5704   __Pyx_XDECREF(__pyx_r);
5705   __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_q); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L1_error)
5706   __Pyx_GOTREF(__pyx_t_1);
5707   __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_idx, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn_uint64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn_uint64_t, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 268, __pyx_L1_error)
5708   __Pyx_GOTREF(__pyx_t_4);
5709   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 268, __pyx_L1_error)
5710   __Pyx_GOTREF(__pyx_t_2);
5711   __Pyx_GIVEREF(__pyx_t_1);
5712   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
5713   __Pyx_GIVEREF(__pyx_t_4);
5714   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
5715   __pyx_t_1 = 0;
5716   __pyx_t_4 = 0;
5717   __pyx_r = __pyx_t_2;
5718   __pyx_t_2 = 0;
5719   goto __pyx_L0;
5720 
5721   /* "yt/utilities/lib/cykdtree/utils.pyx":240
5722  *     return q, idx
5723  *
5724  * def py_partition_given_pivot(np.ndarray[np.float64_t, ndim=2] pos,             # <<<<<<<<<<<<<<
5725  *                              np.uint32_t d, np.float64_t pval):
5726  *     r"""Get the indices required to partition coordinates along one dimension.
5727  */
5728 
5729   /* function exit code */
5730   __pyx_L1_error:;
5731   __Pyx_XDECREF(__pyx_t_1);
5732   __Pyx_XDECREF(__pyx_t_2);
5733   __Pyx_XDECREF(__pyx_t_3);
5734   __Pyx_XDECREF(__pyx_t_4);
5735   __Pyx_XDECREF(__pyx_t_5);
5736   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
5737   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5738     __Pyx_PyThreadState_declare
5739     __Pyx_PyThreadState_assign
5740     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5741     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
5742   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5743   __Pyx_AddTraceback("yt.utilities.lib.cykdtree.utils.py_partition_given_pivot", __pyx_clineno, __pyx_lineno, __pyx_filename);
5744   __pyx_r = NULL;
5745   goto __pyx_L2;
5746   __pyx_L0:;
5747   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
5748   __pyx_L2:;
5749   __PYX_XDEC_MEMVIEW(&__pyx_v_idx, 1);
5750   __Pyx_XGIVEREF(__pyx_r);
5751   __Pyx_RefNannyFinishContext();
5752   return __pyx_r;
5753 }
5754 
5755 /* "yt/utilities/lib/cykdtree/utils.pyx":270
5756  *     return q, idx
5757  *
5758  * def py_select(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d,             # <<<<<<<<<<<<<<
5759  *               np.int64_t t):
5760  *     r"""Get the indices required to partition coordiantes such that the first
5761  */
5762 
5763 /* Python wrapper */
5764 static PyObject *__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_19py_select(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5765 static char __pyx_doc_2yt_9utilities_3lib_8cykdtree_5utils_18py_select[] = "Get the indices required to partition coordiantes such that the first\n    t elements in pos[:,d] are the smallest t elements in pos[:,d].\n\n    Args:\n        pos (np.ndarray of float64): (n,m) array of n m-D coordinates.\n        d (np.uint32_t): Dimension that pos should be partitioned along.\n        t (np.int64_t): Number of smallest elements in pos[:,d] that should be\n            partitioned.\n\n    Returns:\n        tuple of int64 and np.ndarray of uint64: Location of element t in the\n            partitioned array and the indices required to partition the array\n            such that elements before element t are smaller and elements after\n            the pivot are larger.\n\n    ";
5766 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_8cykdtree_5utils_19py_select = {"py_select", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_19py_select, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2yt_9utilities_3lib_8cykdtree_5utils_18py_select};
__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_19py_select(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)5767 static PyObject *__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_19py_select(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5768   PyArrayObject *__pyx_v_pos = 0;
5769   __pyx_t_5numpy_uint32_t __pyx_v_d;
5770   __pyx_t_5numpy_int64_t __pyx_v_t;
5771   PyObject *__pyx_r = 0;
5772   __Pyx_RefNannyDeclarations
5773   __Pyx_RefNannySetupContext("py_select (wrapper)", 0);
5774   {
5775     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_d,&__pyx_n_s_t,0};
5776     PyObject* values[3] = {0,0,0};
5777     if (unlikely(__pyx_kwds)) {
5778       Py_ssize_t kw_args;
5779       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5780       switch (pos_args) {
5781         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5782         CYTHON_FALLTHROUGH;
5783         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5784         CYTHON_FALLTHROUGH;
5785         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5786         CYTHON_FALLTHROUGH;
5787         case  0: break;
5788         default: goto __pyx_L5_argtuple_error;
5789       }
5790       kw_args = PyDict_Size(__pyx_kwds);
5791       switch (pos_args) {
5792         case  0:
5793         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
5794         else goto __pyx_L5_argtuple_error;
5795         CYTHON_FALLTHROUGH;
5796         case  1:
5797         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
5798         else {
5799           __Pyx_RaiseArgtupleInvalid("py_select", 1, 3, 3, 1); __PYX_ERR(0, 270, __pyx_L3_error)
5800         }
5801         CYTHON_FALLTHROUGH;
5802         case  2:
5803         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
5804         else {
5805           __Pyx_RaiseArgtupleInvalid("py_select", 1, 3, 3, 2); __PYX_ERR(0, 270, __pyx_L3_error)
5806         }
5807       }
5808       if (unlikely(kw_args > 0)) {
5809         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "py_select") < 0)) __PYX_ERR(0, 270, __pyx_L3_error)
5810       }
5811     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
5812       goto __pyx_L5_argtuple_error;
5813     } else {
5814       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5815       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5816       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5817     }
5818     __pyx_v_pos = ((PyArrayObject *)values[0]);
5819     __pyx_v_d = __Pyx_PyInt_As_npy_uint32(values[1]); if (unlikely((__pyx_v_d == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 270, __pyx_L3_error)
5820     __pyx_v_t = __Pyx_PyInt_As_npy_int64(values[2]); if (unlikely((__pyx_v_t == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 271, __pyx_L3_error)
5821   }
5822   goto __pyx_L4_argument_unpacking_done;
5823   __pyx_L5_argtuple_error:;
5824   __Pyx_RaiseArgtupleInvalid("py_select", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 270, __pyx_L3_error)
5825   __pyx_L3_error:;
5826   __Pyx_AddTraceback("yt.utilities.lib.cykdtree.utils.py_select", __pyx_clineno, __pyx_lineno, __pyx_filename);
5827   __Pyx_RefNannyFinishContext();
5828   return NULL;
5829   __pyx_L4_argument_unpacking_done:;
5830   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 1, "pos", 0))) __PYX_ERR(0, 270, __pyx_L1_error)
5831   __pyx_r = __pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_18py_select(__pyx_self, __pyx_v_pos, __pyx_v_d, __pyx_v_t);
5832 
5833   /* function exit code */
5834   goto __pyx_L0;
5835   __pyx_L1_error:;
5836   __pyx_r = NULL;
5837   __pyx_L0:;
5838   __Pyx_RefNannyFinishContext();
5839   return __pyx_r;
5840 }
5841 
__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_18py_select(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_pos,__pyx_t_5numpy_uint32_t __pyx_v_d,__pyx_t_5numpy_int64_t __pyx_v_t)5842 static PyObject *__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_18py_select(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_uint32_t __pyx_v_d, __pyx_t_5numpy_int64_t __pyx_v_t) {
5843   __pyx_t_5numpy_intp_t __pyx_v_ndim;
5844   int64_t __pyx_v_l;
5845   int64_t __pyx_v_r;
5846   __Pyx_memviewslice __pyx_v_idx = { 0, 0, { 0 }, { 0 }, { 0 } };
5847   double *__pyx_v_ptr_pos;
5848   uint64_t *__pyx_v_ptr_idx;
5849   int64_t __pyx_v_q;
5850   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos;
5851   __Pyx_Buffer __pyx_pybuffer_pos;
5852   PyObject *__pyx_r = NULL;
5853   __Pyx_RefNannyDeclarations
5854   PyObject *__pyx_t_1 = NULL;
5855   PyObject *__pyx_t_2 = NULL;
5856   PyObject *__pyx_t_3 = NULL;
5857   PyObject *__pyx_t_4 = NULL;
5858   PyObject *__pyx_t_5 = NULL;
5859   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
5860   int __pyx_t_7;
5861   Py_ssize_t __pyx_t_8;
5862   Py_ssize_t __pyx_t_9;
5863   int __pyx_t_10;
5864   Py_ssize_t __pyx_t_11;
5865   __Pyx_RefNannySetupContext("py_select", 0);
5866   __pyx_pybuffer_pos.pybuffer.buf = NULL;
5867   __pyx_pybuffer_pos.refcount = 0;
5868   __pyx_pybuffernd_pos.data = NULL;
5869   __pyx_pybuffernd_pos.rcbuffer = &__pyx_pybuffer_pos;
5870   {
5871     __Pyx_BufFmt_StackElem __pyx_stack[1];
5872     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 270, __pyx_L1_error)
5873   }
5874   __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1];
5875 
5876   /* "yt/utilities/lib/cykdtree/utils.pyx":288
5877  *
5878  *     """
5879  *     cdef np.intp_t ndim = pos.shape[1]             # <<<<<<<<<<<<<<
5880  *     cdef int64_t l = 0
5881  *     cdef int64_t r = pos.shape[0]-1
5882  */
5883   __pyx_v_ndim = (__pyx_v_pos->dimensions[1]);
5884 
5885   /* "yt/utilities/lib/cykdtree/utils.pyx":289
5886  *     """
5887  *     cdef np.intp_t ndim = pos.shape[1]
5888  *     cdef int64_t l = 0             # <<<<<<<<<<<<<<
5889  *     cdef int64_t r = pos.shape[0]-1
5890  *     cdef uint64_t[:] idx
5891  */
5892   __pyx_v_l = 0;
5893 
5894   /* "yt/utilities/lib/cykdtree/utils.pyx":290
5895  *     cdef np.intp_t ndim = pos.shape[1]
5896  *     cdef int64_t l = 0
5897  *     cdef int64_t r = pos.shape[0]-1             # <<<<<<<<<<<<<<
5898  *     cdef uint64_t[:] idx
5899  *     idx = np.arange(pos.shape[0]).astype('uint64')
5900  */
5901   __pyx_v_r = ((__pyx_v_pos->dimensions[0]) - 1);
5902 
5903   /* "yt/utilities/lib/cykdtree/utils.pyx":292
5904  *     cdef int64_t r = pos.shape[0]-1
5905  *     cdef uint64_t[:] idx
5906  *     idx = np.arange(pos.shape[0]).astype('uint64')             # <<<<<<<<<<<<<<
5907  *     cdef double *ptr_pos = NULL
5908  *     cdef uint64_t *ptr_idx = NULL
5909  */
5910   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error)
5911   __Pyx_GOTREF(__pyx_t_3);
5912   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_arange); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 292, __pyx_L1_error)
5913   __Pyx_GOTREF(__pyx_t_4);
5914   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5915   __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_pos->dimensions[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error)
5916   __Pyx_GOTREF(__pyx_t_3);
5917   __pyx_t_5 = NULL;
5918   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
5919     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
5920     if (likely(__pyx_t_5)) {
5921       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
5922       __Pyx_INCREF(__pyx_t_5);
5923       __Pyx_INCREF(function);
5924       __Pyx_DECREF_SET(__pyx_t_4, function);
5925     }
5926   }
5927   __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);
5928   __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5929   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5930   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 292, __pyx_L1_error)
5931   __Pyx_GOTREF(__pyx_t_2);
5932   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5933   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 292, __pyx_L1_error)
5934   __Pyx_GOTREF(__pyx_t_4);
5935   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5936   __pyx_t_2 = NULL;
5937   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
5938     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
5939     if (likely(__pyx_t_2)) {
5940       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
5941       __Pyx_INCREF(__pyx_t_2);
5942       __Pyx_INCREF(function);
5943       __Pyx_DECREF_SET(__pyx_t_4, function);
5944     }
5945   }
5946   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_n_s_uint64) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_s_uint64);
5947   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5948   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error)
5949   __Pyx_GOTREF(__pyx_t_1);
5950   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5951   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_uint64_t(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 292, __pyx_L1_error)
5952   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5953   __pyx_v_idx = __pyx_t_6;
5954   __pyx_t_6.memview = NULL;
5955   __pyx_t_6.data = NULL;
5956 
5957   /* "yt/utilities/lib/cykdtree/utils.pyx":293
5958  *     cdef uint64_t[:] idx
5959  *     idx = np.arange(pos.shape[0]).astype('uint64')
5960  *     cdef double *ptr_pos = NULL             # <<<<<<<<<<<<<<
5961  *     cdef uint64_t *ptr_idx = NULL
5962  *     if pos.shape[0] != 0:
5963  */
5964   __pyx_v_ptr_pos = NULL;
5965 
5966   /* "yt/utilities/lib/cykdtree/utils.pyx":294
5967  *     idx = np.arange(pos.shape[0]).astype('uint64')
5968  *     cdef double *ptr_pos = NULL
5969  *     cdef uint64_t *ptr_idx = NULL             # <<<<<<<<<<<<<<
5970  *     if pos.shape[0] != 0:
5971  *         ptr_pos = &pos[0,0]
5972  */
5973   __pyx_v_ptr_idx = NULL;
5974 
5975   /* "yt/utilities/lib/cykdtree/utils.pyx":295
5976  *     cdef double *ptr_pos = NULL
5977  *     cdef uint64_t *ptr_idx = NULL
5978  *     if pos.shape[0] != 0:             # <<<<<<<<<<<<<<
5979  *         ptr_pos = &pos[0,0]
5980  *         ptr_idx = &idx[0]
5981  */
5982   __pyx_t_7 = (((__pyx_v_pos->dimensions[0]) != 0) != 0);
5983   if (__pyx_t_7) {
5984 
5985     /* "yt/utilities/lib/cykdtree/utils.pyx":296
5986  *     cdef uint64_t *ptr_idx = NULL
5987  *     if pos.shape[0] != 0:
5988  *         ptr_pos = &pos[0,0]             # <<<<<<<<<<<<<<
5989  *         ptr_idx = &idx[0]
5990  *     cdef int64_t q = select(ptr_pos, ptr_idx, ndim, d, l, r, t)
5991  */
5992     __pyx_t_8 = 0;
5993     __pyx_t_9 = 0;
5994     __pyx_t_10 = -1;
5995     if (__pyx_t_8 < 0) {
5996       __pyx_t_8 += __pyx_pybuffernd_pos.diminfo[0].shape;
5997       if (unlikely(__pyx_t_8 < 0)) __pyx_t_10 = 0;
5998     } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_pos.diminfo[0].shape)) __pyx_t_10 = 0;
5999     if (__pyx_t_9 < 0) {
6000       __pyx_t_9 += __pyx_pybuffernd_pos.diminfo[1].shape;
6001       if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 1;
6002     } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_pos.diminfo[1].shape)) __pyx_t_10 = 1;
6003     if (unlikely(__pyx_t_10 != -1)) {
6004       __Pyx_RaiseBufferIndexError(__pyx_t_10);
6005       __PYX_ERR(0, 296, __pyx_L1_error)
6006     }
6007     __pyx_v_ptr_pos = (&(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_pos.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_pos.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_pos.diminfo[1].strides)));
6008 
6009     /* "yt/utilities/lib/cykdtree/utils.pyx":297
6010  *     if pos.shape[0] != 0:
6011  *         ptr_pos = &pos[0,0]
6012  *         ptr_idx = &idx[0]             # <<<<<<<<<<<<<<
6013  *     cdef int64_t q = select(ptr_pos, ptr_idx, ndim, d, l, r, t)
6014  *     return q, idx
6015  */
6016     __pyx_t_11 = 0;
6017     __pyx_t_10 = -1;
6018     if (__pyx_t_11 < 0) {
6019       __pyx_t_11 += __pyx_v_idx.shape[0];
6020       if (unlikely(__pyx_t_11 < 0)) __pyx_t_10 = 0;
6021     } else if (unlikely(__pyx_t_11 >= __pyx_v_idx.shape[0])) __pyx_t_10 = 0;
6022     if (unlikely(__pyx_t_10 != -1)) {
6023       __Pyx_RaiseBufferIndexError(__pyx_t_10);
6024       __PYX_ERR(0, 297, __pyx_L1_error)
6025     }
6026     __pyx_v_ptr_idx = (&(*((uint64_t *) ( /* dim=0 */ (__pyx_v_idx.data + __pyx_t_11 * __pyx_v_idx.strides[0]) ))));
6027 
6028     /* "yt/utilities/lib/cykdtree/utils.pyx":295
6029  *     cdef double *ptr_pos = NULL
6030  *     cdef uint64_t *ptr_idx = NULL
6031  *     if pos.shape[0] != 0:             # <<<<<<<<<<<<<<
6032  *         ptr_pos = &pos[0,0]
6033  *         ptr_idx = &idx[0]
6034  */
6035   }
6036 
6037   /* "yt/utilities/lib/cykdtree/utils.pyx":298
6038  *         ptr_pos = &pos[0,0]
6039  *         ptr_idx = &idx[0]
6040  *     cdef int64_t q = select(ptr_pos, ptr_idx, ndim, d, l, r, t)             # <<<<<<<<<<<<<<
6041  *     return q, idx
6042  *
6043  */
6044   __pyx_v_q = select(__pyx_v_ptr_pos, __pyx_v_ptr_idx, __pyx_v_ndim, __pyx_v_d, __pyx_v_l, __pyx_v_r, __pyx_v_t);
6045 
6046   /* "yt/utilities/lib/cykdtree/utils.pyx":299
6047  *         ptr_idx = &idx[0]
6048  *     cdef int64_t q = select(ptr_pos, ptr_idx, ndim, d, l, r, t)
6049  *     return q, idx             # <<<<<<<<<<<<<<
6050  *
6051  *
6052  */
6053   __Pyx_XDECREF(__pyx_r);
6054   __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_q); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 299, __pyx_L1_error)
6055   __Pyx_GOTREF(__pyx_t_1);
6056   __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_idx, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn_uint64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn_uint64_t, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 299, __pyx_L1_error)
6057   __Pyx_GOTREF(__pyx_t_4);
6058   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 299, __pyx_L1_error)
6059   __Pyx_GOTREF(__pyx_t_2);
6060   __Pyx_GIVEREF(__pyx_t_1);
6061   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
6062   __Pyx_GIVEREF(__pyx_t_4);
6063   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
6064   __pyx_t_1 = 0;
6065   __pyx_t_4 = 0;
6066   __pyx_r = __pyx_t_2;
6067   __pyx_t_2 = 0;
6068   goto __pyx_L0;
6069 
6070   /* "yt/utilities/lib/cykdtree/utils.pyx":270
6071  *     return q, idx
6072  *
6073  * def py_select(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d,             # <<<<<<<<<<<<<<
6074  *               np.int64_t t):
6075  *     r"""Get the indices required to partition coordiantes such that the first
6076  */
6077 
6078   /* function exit code */
6079   __pyx_L1_error:;
6080   __Pyx_XDECREF(__pyx_t_1);
6081   __Pyx_XDECREF(__pyx_t_2);
6082   __Pyx_XDECREF(__pyx_t_3);
6083   __Pyx_XDECREF(__pyx_t_4);
6084   __Pyx_XDECREF(__pyx_t_5);
6085   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
6086   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
6087     __Pyx_PyThreadState_declare
6088     __Pyx_PyThreadState_assign
6089     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
6090     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
6091   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
6092   __Pyx_AddTraceback("yt.utilities.lib.cykdtree.utils.py_select", __pyx_clineno, __pyx_lineno, __pyx_filename);
6093   __pyx_r = NULL;
6094   goto __pyx_L2;
6095   __pyx_L0:;
6096   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
6097   __pyx_L2:;
6098   __PYX_XDEC_MEMVIEW(&__pyx_v_idx, 1);
6099   __Pyx_XGIVEREF(__pyx_r);
6100   __Pyx_RefNannyFinishContext();
6101   return __pyx_r;
6102 }
6103 
6104 /* "yt/utilities/lib/cykdtree/utils.pyx":302
6105  *
6106  *
6107  * def py_split(np.ndarray[np.float64_t, ndim=2] pos,             # <<<<<<<<<<<<<<
6108  *              np.ndarray[np.float64_t, ndim=1] mins = None,
6109  *              np.ndarray[np.float64_t, ndim=1] maxs = None,
6110  */
6111 
6112 /* Python wrapper */
6113 static PyObject *__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_21py_split(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6114 static char __pyx_doc_2yt_9utilities_3lib_8cykdtree_5utils_20py_split[] = "Get the indices required to split the positions equally along the\n    largest dimension.\n\n    Args:\n        pos (np.ndarray of float64): (n,m) array of n m-D coordinates.\n        mins (np.ndarray of float64, optional): (m,) array of mins. Defaults\n            to None and is set to mins of pos along each dimension.\n        maxs (np.ndarray of float64, optional): (m,) array of maxs. Defaults\n            to None and is set to maxs of pos along each dimension.\n        use_sliding_midpoint (bool, optional): If True, the sliding midpoint\n             rule is used to split the positions. Defaults to False.\n\n    Returns:\n        tuple(int64, uint32, np.ndarray of uint64): The index of the split in\n            the partitioned array, the dimension of the split, and the indices\n            required to partition the array.\n\n    ";
6115 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_8cykdtree_5utils_21py_split = {"py_split", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_21py_split, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2yt_9utilities_3lib_8cykdtree_5utils_20py_split};
__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_21py_split(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)6116 static PyObject *__pyx_pw_2yt_9utilities_3lib_8cykdtree_5utils_21py_split(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6117   PyArrayObject *__pyx_v_pos = 0;
6118   PyArrayObject *__pyx_v_mins = 0;
6119   PyArrayObject *__pyx_v_maxs = 0;
6120   bool __pyx_v_use_sliding_midpoint;
6121   PyObject *__pyx_r = 0;
6122   __Pyx_RefNannyDeclarations
6123   __Pyx_RefNannySetupContext("py_split (wrapper)", 0);
6124   {
6125     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_mins,&__pyx_n_s_maxs,&__pyx_n_s_use_sliding_midpoint,0};
6126     PyObject* values[4] = {0,0,0,0};
6127 
6128     /* "yt/utilities/lib/cykdtree/utils.pyx":303
6129  *
6130  * def py_split(np.ndarray[np.float64_t, ndim=2] pos,
6131  *              np.ndarray[np.float64_t, ndim=1] mins = None,             # <<<<<<<<<<<<<<
6132  *              np.ndarray[np.float64_t, ndim=1] maxs = None,
6133  *              bool use_sliding_midpoint = False):
6134  */
6135     values[1] = (PyObject *)((PyArrayObject *)Py_None);
6136 
6137     /* "yt/utilities/lib/cykdtree/utils.pyx":304
6138  * def py_split(np.ndarray[np.float64_t, ndim=2] pos,
6139  *              np.ndarray[np.float64_t, ndim=1] mins = None,
6140  *              np.ndarray[np.float64_t, ndim=1] maxs = None,             # <<<<<<<<<<<<<<
6141  *              bool use_sliding_midpoint = False):
6142  *     r"""Get the indices required to split the positions equally along the
6143  */
6144     values[2] = (PyObject *)((PyArrayObject *)Py_None);
6145     if (unlikely(__pyx_kwds)) {
6146       Py_ssize_t kw_args;
6147       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6148       switch (pos_args) {
6149         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6150         CYTHON_FALLTHROUGH;
6151         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6152         CYTHON_FALLTHROUGH;
6153         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6154         CYTHON_FALLTHROUGH;
6155         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6156         CYTHON_FALLTHROUGH;
6157         case  0: break;
6158         default: goto __pyx_L5_argtuple_error;
6159       }
6160       kw_args = PyDict_Size(__pyx_kwds);
6161       switch (pos_args) {
6162         case  0:
6163         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
6164         else goto __pyx_L5_argtuple_error;
6165         CYTHON_FALLTHROUGH;
6166         case  1:
6167         if (kw_args > 0) {
6168           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mins);
6169           if (value) { values[1] = value; kw_args--; }
6170         }
6171         CYTHON_FALLTHROUGH;
6172         case  2:
6173         if (kw_args > 0) {
6174           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxs);
6175           if (value) { values[2] = value; kw_args--; }
6176         }
6177         CYTHON_FALLTHROUGH;
6178         case  3:
6179         if (kw_args > 0) {
6180           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_sliding_midpoint);
6181           if (value) { values[3] = value; kw_args--; }
6182         }
6183       }
6184       if (unlikely(kw_args > 0)) {
6185         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "py_split") < 0)) __PYX_ERR(0, 302, __pyx_L3_error)
6186       }
6187     } else {
6188       switch (PyTuple_GET_SIZE(__pyx_args)) {
6189         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6190         CYTHON_FALLTHROUGH;
6191         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6192         CYTHON_FALLTHROUGH;
6193         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6194         CYTHON_FALLTHROUGH;
6195         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6196         break;
6197         default: goto __pyx_L5_argtuple_error;
6198       }
6199     }
6200     __pyx_v_pos = ((PyArrayObject *)values[0]);
6201     __pyx_v_mins = ((PyArrayObject *)values[1]);
6202     __pyx_v_maxs = ((PyArrayObject *)values[2]);
6203     if (values[3]) {
6204       __pyx_v_use_sliding_midpoint = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_use_sliding_midpoint == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 305, __pyx_L3_error)
6205     } else {
6206 
6207       /* "yt/utilities/lib/cykdtree/utils.pyx":305
6208  *              np.ndarray[np.float64_t, ndim=1] mins = None,
6209  *              np.ndarray[np.float64_t, ndim=1] maxs = None,
6210  *              bool use_sliding_midpoint = False):             # <<<<<<<<<<<<<<
6211  *     r"""Get the indices required to split the positions equally along the
6212  *     largest dimension.
6213  */
6214       __pyx_v_use_sliding_midpoint = ((bool)0);
6215     }
6216   }
6217   goto __pyx_L4_argument_unpacking_done;
6218   __pyx_L5_argtuple_error:;
6219   __Pyx_RaiseArgtupleInvalid("py_split", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 302, __pyx_L3_error)
6220   __pyx_L3_error:;
6221   __Pyx_AddTraceback("yt.utilities.lib.cykdtree.utils.py_split", __pyx_clineno, __pyx_lineno, __pyx_filename);
6222   __Pyx_RefNannyFinishContext();
6223   return NULL;
6224   __pyx_L4_argument_unpacking_done:;
6225   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 1, "pos", 0))) __PYX_ERR(0, 302, __pyx_L1_error)
6226   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mins), __pyx_ptype_5numpy_ndarray, 1, "mins", 0))) __PYX_ERR(0, 303, __pyx_L1_error)
6227   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_maxs), __pyx_ptype_5numpy_ndarray, 1, "maxs", 0))) __PYX_ERR(0, 304, __pyx_L1_error)
6228   __pyx_r = __pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_20py_split(__pyx_self, __pyx_v_pos, __pyx_v_mins, __pyx_v_maxs, __pyx_v_use_sliding_midpoint);
6229 
6230   /* "yt/utilities/lib/cykdtree/utils.pyx":302
6231  *
6232  *
6233  * def py_split(np.ndarray[np.float64_t, ndim=2] pos,             # <<<<<<<<<<<<<<
6234  *              np.ndarray[np.float64_t, ndim=1] mins = None,
6235  *              np.ndarray[np.float64_t, ndim=1] maxs = None,
6236  */
6237 
6238   /* function exit code */
6239   goto __pyx_L0;
6240   __pyx_L1_error:;
6241   __pyx_r = NULL;
6242   __pyx_L0:;
6243   __Pyx_RefNannyFinishContext();
6244   return __pyx_r;
6245 }
6246 
__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_20py_split(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_pos,PyArrayObject * __pyx_v_mins,PyArrayObject * __pyx_v_maxs,bool __pyx_v_use_sliding_midpoint)6247 static PyObject *__pyx_pf_2yt_9utilities_3lib_8cykdtree_5utils_20py_split(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, PyArrayObject *__pyx_v_mins, PyArrayObject *__pyx_v_maxs, bool __pyx_v_use_sliding_midpoint) {
6248   __pyx_t_5numpy_intp_t __pyx_v_npts;
6249   __pyx_t_5numpy_intp_t __pyx_v_ndim;
6250   uint64_t __pyx_v_Lidx;
6251   __Pyx_memviewslice __pyx_v_idx = { 0, 0, { 0 }, { 0 }, { 0 } };
6252   double *__pyx_v_ptr_pos;
6253   uint64_t *__pyx_v_ptr_idx;
6254   double *__pyx_v_ptr_mins;
6255   double *__pyx_v_ptr_maxs;
6256   int64_t __pyx_v_q;
6257   double __pyx_v_split_val;
6258   bool __pyx_v_c_midpoint_flag;
6259   uint32_t __pyx_v_dsplit;
6260   __Pyx_LocalBuf_ND __pyx_pybuffernd_maxs;
6261   __Pyx_Buffer __pyx_pybuffer_maxs;
6262   __Pyx_LocalBuf_ND __pyx_pybuffernd_mins;
6263   __Pyx_Buffer __pyx_pybuffer_mins;
6264   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos;
6265   __Pyx_Buffer __pyx_pybuffer_pos;
6266   PyObject *__pyx_r = NULL;
6267   __Pyx_RefNannyDeclarations
6268   PyObject *__pyx_t_1 = NULL;
6269   PyObject *__pyx_t_2 = NULL;
6270   PyObject *__pyx_t_3 = NULL;
6271   PyObject *__pyx_t_4 = NULL;
6272   PyObject *__pyx_t_5 = NULL;
6273   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
6274   int __pyx_t_7;
6275   int __pyx_t_8;
6276   PyArrayObject *__pyx_t_9 = NULL;
6277   int __pyx_t_10;
6278   PyObject *__pyx_t_11 = NULL;
6279   PyObject *__pyx_t_12 = NULL;
6280   PyObject *__pyx_t_13 = NULL;
6281   PyArrayObject *__pyx_t_14 = NULL;
6282   Py_ssize_t __pyx_t_15;
6283   Py_ssize_t __pyx_t_16;
6284   Py_ssize_t __pyx_t_17;
6285   Py_ssize_t __pyx_t_18;
6286   Py_ssize_t __pyx_t_19;
6287   __Pyx_RefNannySetupContext("py_split", 0);
6288   __Pyx_INCREF((PyObject *)__pyx_v_mins);
6289   __Pyx_INCREF((PyObject *)__pyx_v_maxs);
6290   __pyx_pybuffer_pos.pybuffer.buf = NULL;
6291   __pyx_pybuffer_pos.refcount = 0;
6292   __pyx_pybuffernd_pos.data = NULL;
6293   __pyx_pybuffernd_pos.rcbuffer = &__pyx_pybuffer_pos;
6294   __pyx_pybuffer_mins.pybuffer.buf = NULL;
6295   __pyx_pybuffer_mins.refcount = 0;
6296   __pyx_pybuffernd_mins.data = NULL;
6297   __pyx_pybuffernd_mins.rcbuffer = &__pyx_pybuffer_mins;
6298   __pyx_pybuffer_maxs.pybuffer.buf = NULL;
6299   __pyx_pybuffer_maxs.refcount = 0;
6300   __pyx_pybuffernd_maxs.data = NULL;
6301   __pyx_pybuffernd_maxs.rcbuffer = &__pyx_pybuffer_maxs;
6302   {
6303     __Pyx_BufFmt_StackElem __pyx_stack[1];
6304     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 302, __pyx_L1_error)
6305   }
6306   __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1];
6307   {
6308     __Pyx_BufFmt_StackElem __pyx_stack[1];
6309     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mins.rcbuffer->pybuffer, (PyObject*)__pyx_v_mins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 302, __pyx_L1_error)
6310   }
6311   __pyx_pybuffernd_mins.diminfo[0].strides = __pyx_pybuffernd_mins.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mins.diminfo[0].shape = __pyx_pybuffernd_mins.rcbuffer->pybuffer.shape[0];
6312   {
6313     __Pyx_BufFmt_StackElem __pyx_stack[1];
6314     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_maxs.rcbuffer->pybuffer, (PyObject*)__pyx_v_maxs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 302, __pyx_L1_error)
6315   }
6316   __pyx_pybuffernd_maxs.diminfo[0].strides = __pyx_pybuffernd_maxs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_maxs.diminfo[0].shape = __pyx_pybuffernd_maxs.rcbuffer->pybuffer.shape[0];
6317 
6318   /* "yt/utilities/lib/cykdtree/utils.pyx":324
6319  *
6320  *     """
6321  *     cdef np.intp_t npts = pos.shape[0]             # <<<<<<<<<<<<<<
6322  *     cdef np.intp_t ndim = pos.shape[1]
6323  *     cdef uint64_t Lidx = 0
6324  */
6325   __pyx_v_npts = (__pyx_v_pos->dimensions[0]);
6326 
6327   /* "yt/utilities/lib/cykdtree/utils.pyx":325
6328  *     """
6329  *     cdef np.intp_t npts = pos.shape[0]
6330  *     cdef np.intp_t ndim = pos.shape[1]             # <<<<<<<<<<<<<<
6331  *     cdef uint64_t Lidx = 0
6332  *     cdef uint64_t[:] idx
6333  */
6334   __pyx_v_ndim = (__pyx_v_pos->dimensions[1]);
6335 
6336   /* "yt/utilities/lib/cykdtree/utils.pyx":326
6337  *     cdef np.intp_t npts = pos.shape[0]
6338  *     cdef np.intp_t ndim = pos.shape[1]
6339  *     cdef uint64_t Lidx = 0             # <<<<<<<<<<<<<<
6340  *     cdef uint64_t[:] idx
6341  *     idx = np.arange(pos.shape[0]).astype('uint64')
6342  */
6343   __pyx_v_Lidx = 0;
6344 
6345   /* "yt/utilities/lib/cykdtree/utils.pyx":328
6346  *     cdef uint64_t Lidx = 0
6347  *     cdef uint64_t[:] idx
6348  *     idx = np.arange(pos.shape[0]).astype('uint64')             # <<<<<<<<<<<<<<
6349  *     cdef double *ptr_pos = NULL
6350  *     cdef uint64_t *ptr_idx = NULL
6351  */
6352   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 328, __pyx_L1_error)
6353   __Pyx_GOTREF(__pyx_t_3);
6354   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_arange); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 328, __pyx_L1_error)
6355   __Pyx_GOTREF(__pyx_t_4);
6356   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6357   __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_pos->dimensions[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 328, __pyx_L1_error)
6358   __Pyx_GOTREF(__pyx_t_3);
6359   __pyx_t_5 = NULL;
6360   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
6361     __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
6362     if (likely(__pyx_t_5)) {
6363       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
6364       __Pyx_INCREF(__pyx_t_5);
6365       __Pyx_INCREF(function);
6366       __Pyx_DECREF_SET(__pyx_t_4, function);
6367     }
6368   }
6369   __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);
6370   __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
6371   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6372   if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 328, __pyx_L1_error)
6373   __Pyx_GOTREF(__pyx_t_2);
6374   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6375   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 328, __pyx_L1_error)
6376   __Pyx_GOTREF(__pyx_t_4);
6377   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6378   __pyx_t_2 = NULL;
6379   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
6380     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
6381     if (likely(__pyx_t_2)) {
6382       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
6383       __Pyx_INCREF(__pyx_t_2);
6384       __Pyx_INCREF(function);
6385       __Pyx_DECREF_SET(__pyx_t_4, function);
6386     }
6387   }
6388   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_n_s_uint64) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_s_uint64);
6389   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6390   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 328, __pyx_L1_error)
6391   __Pyx_GOTREF(__pyx_t_1);
6392   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6393   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_uint64_t(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 328, __pyx_L1_error)
6394   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6395   __pyx_v_idx = __pyx_t_6;
6396   __pyx_t_6.memview = NULL;
6397   __pyx_t_6.data = NULL;
6398 
6399   /* "yt/utilities/lib/cykdtree/utils.pyx":329
6400  *     cdef uint64_t[:] idx
6401  *     idx = np.arange(pos.shape[0]).astype('uint64')
6402  *     cdef double *ptr_pos = NULL             # <<<<<<<<<<<<<<
6403  *     cdef uint64_t *ptr_idx = NULL
6404  *     cdef double *ptr_mins = NULL
6405  */
6406   __pyx_v_ptr_pos = NULL;
6407 
6408   /* "yt/utilities/lib/cykdtree/utils.pyx":330
6409  *     idx = np.arange(pos.shape[0]).astype('uint64')
6410  *     cdef double *ptr_pos = NULL
6411  *     cdef uint64_t *ptr_idx = NULL             # <<<<<<<<<<<<<<
6412  *     cdef double *ptr_mins = NULL
6413  *     cdef double *ptr_maxs = NULL
6414  */
6415   __pyx_v_ptr_idx = NULL;
6416 
6417   /* "yt/utilities/lib/cykdtree/utils.pyx":331
6418  *     cdef double *ptr_pos = NULL
6419  *     cdef uint64_t *ptr_idx = NULL
6420  *     cdef double *ptr_mins = NULL             # <<<<<<<<<<<<<<
6421  *     cdef double *ptr_maxs = NULL
6422  *     if (npts != 0) and (ndim != 0):
6423  */
6424   __pyx_v_ptr_mins = NULL;
6425 
6426   /* "yt/utilities/lib/cykdtree/utils.pyx":332
6427  *     cdef uint64_t *ptr_idx = NULL
6428  *     cdef double *ptr_mins = NULL
6429  *     cdef double *ptr_maxs = NULL             # <<<<<<<<<<<<<<
6430  *     if (npts != 0) and (ndim != 0):
6431  *         if mins is None:
6432  */
6433   __pyx_v_ptr_maxs = NULL;
6434 
6435   /* "yt/utilities/lib/cykdtree/utils.pyx":333
6436  *     cdef double *ptr_mins = NULL
6437  *     cdef double *ptr_maxs = NULL
6438  *     if (npts != 0) and (ndim != 0):             # <<<<<<<<<<<<<<
6439  *         if mins is None:
6440  *             mins = np.min(pos, axis=0)
6441  */
6442   __pyx_t_8 = ((__pyx_v_npts != 0) != 0);
6443   if (__pyx_t_8) {
6444   } else {
6445     __pyx_t_7 = __pyx_t_8;
6446     goto __pyx_L4_bool_binop_done;
6447   }
6448   __pyx_t_8 = ((__pyx_v_ndim != 0) != 0);
6449   __pyx_t_7 = __pyx_t_8;
6450   __pyx_L4_bool_binop_done:;
6451   if (__pyx_t_7) {
6452 
6453     /* "yt/utilities/lib/cykdtree/utils.pyx":334
6454  *     cdef double *ptr_maxs = NULL
6455  *     if (npts != 0) and (ndim != 0):
6456  *         if mins is None:             # <<<<<<<<<<<<<<
6457  *             mins = np.min(pos, axis=0)
6458  *         if maxs is None:
6459  */
6460     __pyx_t_7 = (((PyObject *)__pyx_v_mins) == Py_None);
6461     __pyx_t_8 = (__pyx_t_7 != 0);
6462     if (__pyx_t_8) {
6463 
6464       /* "yt/utilities/lib/cykdtree/utils.pyx":335
6465  *     if (npts != 0) and (ndim != 0):
6466  *         if mins is None:
6467  *             mins = np.min(pos, axis=0)             # <<<<<<<<<<<<<<
6468  *         if maxs is None:
6469  *             maxs = np.max(pos, axis=0)
6470  */
6471       __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 335, __pyx_L1_error)
6472       __Pyx_GOTREF(__pyx_t_1);
6473       __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_min); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 335, __pyx_L1_error)
6474       __Pyx_GOTREF(__pyx_t_4);
6475       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6476       __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 335, __pyx_L1_error)
6477       __Pyx_GOTREF(__pyx_t_1);
6478       __Pyx_INCREF(((PyObject *)__pyx_v_pos));
6479       __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
6480       PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_pos));
6481       __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 335, __pyx_L1_error)
6482       __Pyx_GOTREF(__pyx_t_2);
6483       if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 335, __pyx_L1_error)
6484       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 335, __pyx_L1_error)
6485       __Pyx_GOTREF(__pyx_t_3);
6486       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6487       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6488       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6489       if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 335, __pyx_L1_error)
6490       __pyx_t_9 = ((PyArrayObject *)__pyx_t_3);
6491       {
6492         __Pyx_BufFmt_StackElem __pyx_stack[1];
6493         __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mins.rcbuffer->pybuffer);
6494         __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mins.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
6495         if (unlikely(__pyx_t_10 < 0)) {
6496           PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
6497           if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mins.rcbuffer->pybuffer, (PyObject*)__pyx_v_mins, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
6498             Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13);
6499             __Pyx_RaiseBufferFallbackError();
6500           } else {
6501             PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
6502           }
6503           __pyx_t_11 = __pyx_t_12 = __pyx_t_13 = 0;
6504         }
6505         __pyx_pybuffernd_mins.diminfo[0].strides = __pyx_pybuffernd_mins.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mins.diminfo[0].shape = __pyx_pybuffernd_mins.rcbuffer->pybuffer.shape[0];
6506         if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 335, __pyx_L1_error)
6507       }
6508       __pyx_t_9 = 0;
6509       __Pyx_DECREF_SET(__pyx_v_mins, ((PyArrayObject *)__pyx_t_3));
6510       __pyx_t_3 = 0;
6511 
6512       /* "yt/utilities/lib/cykdtree/utils.pyx":334
6513  *     cdef double *ptr_maxs = NULL
6514  *     if (npts != 0) and (ndim != 0):
6515  *         if mins is None:             # <<<<<<<<<<<<<<
6516  *             mins = np.min(pos, axis=0)
6517  *         if maxs is None:
6518  */
6519     }
6520 
6521     /* "yt/utilities/lib/cykdtree/utils.pyx":336
6522  *         if mins is None:
6523  *             mins = np.min(pos, axis=0)
6524  *         if maxs is None:             # <<<<<<<<<<<<<<
6525  *             maxs = np.max(pos, axis=0)
6526  *         ptr_pos = &pos[0,0]
6527  */
6528     __pyx_t_8 = (((PyObject *)__pyx_v_maxs) == Py_None);
6529     __pyx_t_7 = (__pyx_t_8 != 0);
6530     if (__pyx_t_7) {
6531 
6532       /* "yt/utilities/lib/cykdtree/utils.pyx":337
6533  *             mins = np.min(pos, axis=0)
6534  *         if maxs is None:
6535  *             maxs = np.max(pos, axis=0)             # <<<<<<<<<<<<<<
6536  *         ptr_pos = &pos[0,0]
6537  *         ptr_idx = &idx[0]
6538  */
6539       __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 337, __pyx_L1_error)
6540       __Pyx_GOTREF(__pyx_t_3);
6541       __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_max); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 337, __pyx_L1_error)
6542       __Pyx_GOTREF(__pyx_t_2);
6543       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6544       __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 337, __pyx_L1_error)
6545       __Pyx_GOTREF(__pyx_t_3);
6546       __Pyx_INCREF(((PyObject *)__pyx_v_pos));
6547       __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
6548       PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_pos));
6549       __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 337, __pyx_L1_error)
6550       __Pyx_GOTREF(__pyx_t_1);
6551       if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 337, __pyx_L1_error)
6552       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 337, __pyx_L1_error)
6553       __Pyx_GOTREF(__pyx_t_4);
6554       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6555       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6556       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6557       if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 337, __pyx_L1_error)
6558       __pyx_t_14 = ((PyArrayObject *)__pyx_t_4);
6559       {
6560         __Pyx_BufFmt_StackElem __pyx_stack[1];
6561         __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_maxs.rcbuffer->pybuffer);
6562         __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_maxs.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
6563         if (unlikely(__pyx_t_10 < 0)) {
6564           PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
6565           if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_maxs.rcbuffer->pybuffer, (PyObject*)__pyx_v_maxs, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
6566             Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11);
6567             __Pyx_RaiseBufferFallbackError();
6568           } else {
6569             PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11);
6570           }
6571           __pyx_t_13 = __pyx_t_12 = __pyx_t_11 = 0;
6572         }
6573         __pyx_pybuffernd_maxs.diminfo[0].strides = __pyx_pybuffernd_maxs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_maxs.diminfo[0].shape = __pyx_pybuffernd_maxs.rcbuffer->pybuffer.shape[0];
6574         if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 337, __pyx_L1_error)
6575       }
6576       __pyx_t_14 = 0;
6577       __Pyx_DECREF_SET(__pyx_v_maxs, ((PyArrayObject *)__pyx_t_4));
6578       __pyx_t_4 = 0;
6579 
6580       /* "yt/utilities/lib/cykdtree/utils.pyx":336
6581  *         if mins is None:
6582  *             mins = np.min(pos, axis=0)
6583  *         if maxs is None:             # <<<<<<<<<<<<<<
6584  *             maxs = np.max(pos, axis=0)
6585  *         ptr_pos = &pos[0,0]
6586  */
6587     }
6588 
6589     /* "yt/utilities/lib/cykdtree/utils.pyx":338
6590  *         if maxs is None:
6591  *             maxs = np.max(pos, axis=0)
6592  *         ptr_pos = &pos[0,0]             # <<<<<<<<<<<<<<
6593  *         ptr_idx = &idx[0]
6594  *         ptr_mins = &mins[0]
6595  */
6596     __pyx_t_15 = 0;
6597     __pyx_t_16 = 0;
6598     __pyx_t_10 = -1;
6599     if (__pyx_t_15 < 0) {
6600       __pyx_t_15 += __pyx_pybuffernd_pos.diminfo[0].shape;
6601       if (unlikely(__pyx_t_15 < 0)) __pyx_t_10 = 0;
6602     } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_pos.diminfo[0].shape)) __pyx_t_10 = 0;
6603     if (__pyx_t_16 < 0) {
6604       __pyx_t_16 += __pyx_pybuffernd_pos.diminfo[1].shape;
6605       if (unlikely(__pyx_t_16 < 0)) __pyx_t_10 = 1;
6606     } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_pos.diminfo[1].shape)) __pyx_t_10 = 1;
6607     if (unlikely(__pyx_t_10 != -1)) {
6608       __Pyx_RaiseBufferIndexError(__pyx_t_10);
6609       __PYX_ERR(0, 338, __pyx_L1_error)
6610     }
6611     __pyx_v_ptr_pos = (&(*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_pos.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_pos.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_pos.diminfo[1].strides)));
6612 
6613     /* "yt/utilities/lib/cykdtree/utils.pyx":339
6614  *             maxs = np.max(pos, axis=0)
6615  *         ptr_pos = &pos[0,0]
6616  *         ptr_idx = &idx[0]             # <<<<<<<<<<<<<<
6617  *         ptr_mins = &mins[0]
6618  *         ptr_maxs = &maxs[0]
6619  */
6620     __pyx_t_17 = 0;
6621     __pyx_t_10 = -1;
6622     if (__pyx_t_17 < 0) {
6623       __pyx_t_17 += __pyx_v_idx.shape[0];
6624       if (unlikely(__pyx_t_17 < 0)) __pyx_t_10 = 0;
6625     } else if (unlikely(__pyx_t_17 >= __pyx_v_idx.shape[0])) __pyx_t_10 = 0;
6626     if (unlikely(__pyx_t_10 != -1)) {
6627       __Pyx_RaiseBufferIndexError(__pyx_t_10);
6628       __PYX_ERR(0, 339, __pyx_L1_error)
6629     }
6630     __pyx_v_ptr_idx = (&(*((uint64_t *) ( /* dim=0 */ (__pyx_v_idx.data + __pyx_t_17 * __pyx_v_idx.strides[0]) ))));
6631 
6632     /* "yt/utilities/lib/cykdtree/utils.pyx":340
6633  *         ptr_pos = &pos[0,0]
6634  *         ptr_idx = &idx[0]
6635  *         ptr_mins = &mins[0]             # <<<<<<<<<<<<<<
6636  *         ptr_maxs = &maxs[0]
6637  *     cdef int64_t q = 0
6638  */
6639     __pyx_t_18 = 0;
6640     __pyx_t_10 = -1;
6641     if (__pyx_t_18 < 0) {
6642       __pyx_t_18 += __pyx_pybuffernd_mins.diminfo[0].shape;
6643       if (unlikely(__pyx_t_18 < 0)) __pyx_t_10 = 0;
6644     } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_mins.diminfo[0].shape)) __pyx_t_10 = 0;
6645     if (unlikely(__pyx_t_10 != -1)) {
6646       __Pyx_RaiseBufferIndexError(__pyx_t_10);
6647       __PYX_ERR(0, 340, __pyx_L1_error)
6648     }
6649     __pyx_v_ptr_mins = (&(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mins.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_mins.diminfo[0].strides)));
6650 
6651     /* "yt/utilities/lib/cykdtree/utils.pyx":341
6652  *         ptr_idx = &idx[0]
6653  *         ptr_mins = &mins[0]
6654  *         ptr_maxs = &maxs[0]             # <<<<<<<<<<<<<<
6655  *     cdef int64_t q = 0
6656  *     cdef double split_val = 0.0
6657  */
6658     __pyx_t_19 = 0;
6659     __pyx_t_10 = -1;
6660     if (__pyx_t_19 < 0) {
6661       __pyx_t_19 += __pyx_pybuffernd_maxs.diminfo[0].shape;
6662       if (unlikely(__pyx_t_19 < 0)) __pyx_t_10 = 0;
6663     } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_maxs.diminfo[0].shape)) __pyx_t_10 = 0;
6664     if (unlikely(__pyx_t_10 != -1)) {
6665       __Pyx_RaiseBufferIndexError(__pyx_t_10);
6666       __PYX_ERR(0, 341, __pyx_L1_error)
6667     }
6668     __pyx_v_ptr_maxs = (&(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_maxs.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_maxs.diminfo[0].strides)));
6669 
6670     /* "yt/utilities/lib/cykdtree/utils.pyx":333
6671  *     cdef double *ptr_mins = NULL
6672  *     cdef double *ptr_maxs = NULL
6673  *     if (npts != 0) and (ndim != 0):             # <<<<<<<<<<<<<<
6674  *         if mins is None:
6675  *             mins = np.min(pos, axis=0)
6676  */
6677   }
6678 
6679   /* "yt/utilities/lib/cykdtree/utils.pyx":342
6680  *         ptr_mins = &mins[0]
6681  *         ptr_maxs = &maxs[0]
6682  *     cdef int64_t q = 0             # <<<<<<<<<<<<<<
6683  *     cdef double split_val = 0.0
6684  *     cdef cbool c_midpoint_flag = <cbool>use_sliding_midpoint
6685  */
6686   __pyx_v_q = 0;
6687 
6688   /* "yt/utilities/lib/cykdtree/utils.pyx":343
6689  *         ptr_maxs = &maxs[0]
6690  *     cdef int64_t q = 0
6691  *     cdef double split_val = 0.0             # <<<<<<<<<<<<<<
6692  *     cdef cbool c_midpoint_flag = <cbool>use_sliding_midpoint
6693  *     cdef uint32_t dsplit = split(ptr_pos, ptr_idx, Lidx, npts, ndim,
6694  */
6695   __pyx_v_split_val = 0.0;
6696 
6697   /* "yt/utilities/lib/cykdtree/utils.pyx":344
6698  *     cdef int64_t q = 0
6699  *     cdef double split_val = 0.0
6700  *     cdef cbool c_midpoint_flag = <cbool>use_sliding_midpoint             # <<<<<<<<<<<<<<
6701  *     cdef uint32_t dsplit = split(ptr_pos, ptr_idx, Lidx, npts, ndim,
6702  *                                  ptr_mins, ptr_maxs, q, split_val,
6703  */
6704   __pyx_v_c_midpoint_flag = ((bool)__pyx_v_use_sliding_midpoint);
6705 
6706   /* "yt/utilities/lib/cykdtree/utils.pyx":345
6707  *     cdef double split_val = 0.0
6708  *     cdef cbool c_midpoint_flag = <cbool>use_sliding_midpoint
6709  *     cdef uint32_t dsplit = split(ptr_pos, ptr_idx, Lidx, npts, ndim,             # <<<<<<<<<<<<<<
6710  *                                  ptr_mins, ptr_maxs, q, split_val,
6711  *                                  c_midpoint_flag)
6712  */
6713   __pyx_v_dsplit = split(__pyx_v_ptr_pos, __pyx_v_ptr_idx, __pyx_v_Lidx, __pyx_v_npts, __pyx_v_ndim, __pyx_v_ptr_mins, __pyx_v_ptr_maxs, __pyx_v_q, __pyx_v_split_val, __pyx_v_c_midpoint_flag);
6714 
6715   /* "yt/utilities/lib/cykdtree/utils.pyx":348
6716  *                                  ptr_mins, ptr_maxs, q, split_val,
6717  *                                  c_midpoint_flag)
6718  *     return q, dsplit, idx             # <<<<<<<<<<<<<<
6719  */
6720   __Pyx_XDECREF(__pyx_r);
6721   __pyx_t_4 = __Pyx_PyInt_From_int64_t(__pyx_v_q); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 348, __pyx_L1_error)
6722   __Pyx_GOTREF(__pyx_t_4);
6723   __pyx_t_1 = __Pyx_PyInt_From_uint32_t(__pyx_v_dsplit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __pyx_L1_error)
6724   __Pyx_GOTREF(__pyx_t_1);
6725   __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_idx, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn_uint64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn_uint64_t, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 348, __pyx_L1_error)
6726   __Pyx_GOTREF(__pyx_t_3);
6727   __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 348, __pyx_L1_error)
6728   __Pyx_GOTREF(__pyx_t_2);
6729   __Pyx_GIVEREF(__pyx_t_4);
6730   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
6731   __Pyx_GIVEREF(__pyx_t_1);
6732   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
6733   __Pyx_GIVEREF(__pyx_t_3);
6734   PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_3);
6735   __pyx_t_4 = 0;
6736   __pyx_t_1 = 0;
6737   __pyx_t_3 = 0;
6738   __pyx_r = __pyx_t_2;
6739   __pyx_t_2 = 0;
6740   goto __pyx_L0;
6741 
6742   /* "yt/utilities/lib/cykdtree/utils.pyx":302
6743  *
6744  *
6745  * def py_split(np.ndarray[np.float64_t, ndim=2] pos,             # <<<<<<<<<<<<<<
6746  *              np.ndarray[np.float64_t, ndim=1] mins = None,
6747  *              np.ndarray[np.float64_t, ndim=1] maxs = None,
6748  */
6749 
6750   /* function exit code */
6751   __pyx_L1_error:;
6752   __Pyx_XDECREF(__pyx_t_1);
6753   __Pyx_XDECREF(__pyx_t_2);
6754   __Pyx_XDECREF(__pyx_t_3);
6755   __Pyx_XDECREF(__pyx_t_4);
6756   __Pyx_XDECREF(__pyx_t_5);
6757   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
6758   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
6759     __Pyx_PyThreadState_declare
6760     __Pyx_PyThreadState_assign
6761     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
6762     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_maxs.rcbuffer->pybuffer);
6763     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mins.rcbuffer->pybuffer);
6764     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
6765   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
6766   __Pyx_AddTraceback("yt.utilities.lib.cykdtree.utils.py_split", __pyx_clineno, __pyx_lineno, __pyx_filename);
6767   __pyx_r = NULL;
6768   goto __pyx_L2;
6769   __pyx_L0:;
6770   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_maxs.rcbuffer->pybuffer);
6771   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mins.rcbuffer->pybuffer);
6772   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
6773   __pyx_L2:;
6774   __PYX_XDEC_MEMVIEW(&__pyx_v_idx, 1);
6775   __Pyx_XDECREF((PyObject *)__pyx_v_mins);
6776   __Pyx_XDECREF((PyObject *)__pyx_v_maxs);
6777   __Pyx_XGIVEREF(__pyx_r);
6778   __Pyx_RefNannyFinishContext();
6779   return __pyx_r;
6780 }
6781 
6782 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":258
6783  *         # experimental exception made for __getbuffer__ and __releasebuffer__
6784  *         # -- the details of this may change.
6785  *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
6786  *             # This implementation of getbuffer is geared towards Cython
6787  *             # requirements, and does not yet fulfill the PEP.
6788  */
6789 
6790 /* Python wrapper */
6791 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)6792 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
6793   int __pyx_r;
6794   __Pyx_RefNannyDeclarations
6795   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
6796   __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
6797 
6798   /* function exit code */
6799   __Pyx_RefNannyFinishContext();
6800   return __pyx_r;
6801 }
6802 
__pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)6803 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
6804   int __pyx_v_i;
6805   int __pyx_v_ndim;
6806   int __pyx_v_endian_detector;
6807   int __pyx_v_little_endian;
6808   int __pyx_v_t;
6809   char *__pyx_v_f;
6810   PyArray_Descr *__pyx_v_descr = 0;
6811   int __pyx_v_offset;
6812   int __pyx_r;
6813   __Pyx_RefNannyDeclarations
6814   int __pyx_t_1;
6815   int __pyx_t_2;
6816   PyObject *__pyx_t_3 = NULL;
6817   int __pyx_t_4;
6818   int __pyx_t_5;
6819   int __pyx_t_6;
6820   PyArray_Descr *__pyx_t_7;
6821   PyObject *__pyx_t_8 = NULL;
6822   char *__pyx_t_9;
6823   if (__pyx_v_info == NULL) {
6824     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
6825     return -1;
6826   }
6827   __Pyx_RefNannySetupContext("__getbuffer__", 0);
6828   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
6829   __Pyx_GIVEREF(__pyx_v_info->obj);
6830 
6831   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":265
6832  *
6833  *             cdef int i, ndim
6834  *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
6835  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
6836  *
6837  */
6838   __pyx_v_endian_detector = 1;
6839 
6840   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":266
6841  *             cdef int i, ndim
6842  *             cdef int endian_detector = 1
6843  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
6844  *
6845  *             ndim = PyArray_NDIM(self)
6846  */
6847   __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
6848 
6849   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":268
6850  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
6851  *
6852  *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
6853  *
6854  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
6855  */
6856   __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
6857 
6858   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
6859  *             ndim = PyArray_NDIM(self)
6860  *
6861  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
6862  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
6863  *                 raise ValueError(u"ndarray is not C contiguous")
6864  */
6865   __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
6866   if (__pyx_t_2) {
6867   } else {
6868     __pyx_t_1 = __pyx_t_2;
6869     goto __pyx_L4_bool_binop_done;
6870   }
6871 
6872   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":271
6873  *
6874  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
6875  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
6876  *                 raise ValueError(u"ndarray is not C contiguous")
6877  *
6878  */
6879   __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0);
6880   __pyx_t_1 = __pyx_t_2;
6881   __pyx_L4_bool_binop_done:;
6882 
6883   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
6884  *             ndim = PyArray_NDIM(self)
6885  *
6886  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
6887  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
6888  *                 raise ValueError(u"ndarray is not C contiguous")
6889  */
6890   if (unlikely(__pyx_t_1)) {
6891 
6892     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272
6893  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
6894  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
6895  *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
6896  *
6897  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
6898  */
6899     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 272, __pyx_L1_error)
6900     __Pyx_GOTREF(__pyx_t_3);
6901     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6902     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6903     __PYX_ERR(1, 272, __pyx_L1_error)
6904 
6905     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
6906  *             ndim = PyArray_NDIM(self)
6907  *
6908  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
6909  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
6910  *                 raise ValueError(u"ndarray is not C contiguous")
6911  */
6912   }
6913 
6914   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
6915  *                 raise ValueError(u"ndarray is not C contiguous")
6916  *
6917  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
6918  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
6919  *                 raise ValueError(u"ndarray is not Fortran contiguous")
6920  */
6921   __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
6922   if (__pyx_t_2) {
6923   } else {
6924     __pyx_t_1 = __pyx_t_2;
6925     goto __pyx_L7_bool_binop_done;
6926   }
6927 
6928   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":275
6929  *
6930  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
6931  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
6932  *                 raise ValueError(u"ndarray is not Fortran contiguous")
6933  *
6934  */
6935   __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0);
6936   __pyx_t_1 = __pyx_t_2;
6937   __pyx_L7_bool_binop_done:;
6938 
6939   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
6940  *                 raise ValueError(u"ndarray is not C contiguous")
6941  *
6942  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
6943  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
6944  *                 raise ValueError(u"ndarray is not Fortran contiguous")
6945  */
6946   if (unlikely(__pyx_t_1)) {
6947 
6948     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276
6949  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
6950  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
6951  *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
6952  *
6953  *             info.buf = PyArray_DATA(self)
6954  */
6955     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __pyx_L1_error)
6956     __Pyx_GOTREF(__pyx_t_3);
6957     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6958     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6959     __PYX_ERR(1, 276, __pyx_L1_error)
6960 
6961     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
6962  *                 raise ValueError(u"ndarray is not C contiguous")
6963  *
6964  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
6965  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
6966  *                 raise ValueError(u"ndarray is not Fortran contiguous")
6967  */
6968   }
6969 
6970   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":278
6971  *                 raise ValueError(u"ndarray is not Fortran contiguous")
6972  *
6973  *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
6974  *             info.ndim = ndim
6975  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
6976  */
6977   __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
6978 
6979   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":279
6980  *
6981  *             info.buf = PyArray_DATA(self)
6982  *             info.ndim = ndim             # <<<<<<<<<<<<<<
6983  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
6984  *                 # Allocate new buffer for strides and shape info.
6985  */
6986   __pyx_v_info->ndim = __pyx_v_ndim;
6987 
6988   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280
6989  *             info.buf = PyArray_DATA(self)
6990  *             info.ndim = ndim
6991  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
6992  *                 # Allocate new buffer for strides and shape info.
6993  *                 # This is allocated as one block, strides first.
6994  */
6995   __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
6996   if (__pyx_t_1) {
6997 
6998     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":283
6999  *                 # Allocate new buffer for strides and shape info.
7000  *                 # This is allocated as one block, strides first.
7001  *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)             # <<<<<<<<<<<<<<
7002  *                 info.shape = info.strides + ndim
7003  *                 for i in range(ndim):
7004  */
7005     __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim))));
7006 
7007     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":284
7008  *                 # This is allocated as one block, strides first.
7009  *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
7010  *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
7011  *                 for i in range(ndim):
7012  *                     info.strides[i] = PyArray_STRIDES(self)[i]
7013  */
7014     __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
7015 
7016     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":285
7017  *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
7018  *                 info.shape = info.strides + ndim
7019  *                 for i in range(ndim):             # <<<<<<<<<<<<<<
7020  *                     info.strides[i] = PyArray_STRIDES(self)[i]
7021  *                     info.shape[i] = PyArray_DIMS(self)[i]
7022  */
7023     __pyx_t_4 = __pyx_v_ndim;
7024     __pyx_t_5 = __pyx_t_4;
7025     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
7026       __pyx_v_i = __pyx_t_6;
7027 
7028       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":286
7029  *                 info.shape = info.strides + ndim
7030  *                 for i in range(ndim):
7031  *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
7032  *                     info.shape[i] = PyArray_DIMS(self)[i]
7033  *             else:
7034  */
7035       (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
7036 
7037       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":287
7038  *                 for i in range(ndim):
7039  *                     info.strides[i] = PyArray_STRIDES(self)[i]
7040  *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
7041  *             else:
7042  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
7043  */
7044       (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
7045     }
7046 
7047     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280
7048  *             info.buf = PyArray_DATA(self)
7049  *             info.ndim = ndim
7050  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
7051  *                 # Allocate new buffer for strides and shape info.
7052  *                 # This is allocated as one block, strides first.
7053  */
7054     goto __pyx_L9;
7055   }
7056 
7057   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":289
7058  *                     info.shape[i] = PyArray_DIMS(self)[i]
7059  *             else:
7060  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
7061  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
7062  *             info.suboffsets = NULL
7063  */
7064   /*else*/ {
7065     __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
7066 
7067     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":290
7068  *             else:
7069  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
7070  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)             # <<<<<<<<<<<<<<
7071  *             info.suboffsets = NULL
7072  *             info.itemsize = PyArray_ITEMSIZE(self)
7073  */
7074     __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
7075   }
7076   __pyx_L9:;
7077 
7078   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":291
7079  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
7080  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
7081  *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
7082  *             info.itemsize = PyArray_ITEMSIZE(self)
7083  *             info.readonly = not PyArray_ISWRITEABLE(self)
7084  */
7085   __pyx_v_info->suboffsets = NULL;
7086 
7087   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":292
7088  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
7089  *             info.suboffsets = NULL
7090  *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
7091  *             info.readonly = not PyArray_ISWRITEABLE(self)
7092  *
7093  */
7094   __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
7095 
7096   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":293
7097  *             info.suboffsets = NULL
7098  *             info.itemsize = PyArray_ITEMSIZE(self)
7099  *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
7100  *
7101  *             cdef int t
7102  */
7103   __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
7104 
7105   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":296
7106  *
7107  *             cdef int t
7108  *             cdef char* f = NULL             # <<<<<<<<<<<<<<
7109  *             cdef dtype descr = <dtype>PyArray_DESCR(self)
7110  *             cdef int offset
7111  */
7112   __pyx_v_f = NULL;
7113 
7114   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":297
7115  *             cdef int t
7116  *             cdef char* f = NULL
7117  *             cdef dtype descr = <dtype>PyArray_DESCR(self)             # <<<<<<<<<<<<<<
7118  *             cdef int offset
7119  *
7120  */
7121   __pyx_t_7 = PyArray_DESCR(__pyx_v_self);
7122   __pyx_t_3 = ((PyObject *)__pyx_t_7);
7123   __Pyx_INCREF(__pyx_t_3);
7124   __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
7125   __pyx_t_3 = 0;
7126 
7127   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":300
7128  *             cdef int offset
7129  *
7130  *             info.obj = self             # <<<<<<<<<<<<<<
7131  *
7132  *             if not PyDataType_HASFIELDS(descr):
7133  */
7134   __Pyx_INCREF(((PyObject *)__pyx_v_self));
7135   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
7136   __Pyx_GOTREF(__pyx_v_info->obj);
7137   __Pyx_DECREF(__pyx_v_info->obj);
7138   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
7139 
7140   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302
7141  *             info.obj = self
7142  *
7143  *             if not PyDataType_HASFIELDS(descr):             # <<<<<<<<<<<<<<
7144  *                 t = descr.type_num
7145  *                 if ((descr.byteorder == c'>' and little_endian) or
7146  */
7147   __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0);
7148   if (__pyx_t_1) {
7149 
7150     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":303
7151  *
7152  *             if not PyDataType_HASFIELDS(descr):
7153  *                 t = descr.type_num             # <<<<<<<<<<<<<<
7154  *                 if ((descr.byteorder == c'>' and little_endian) or
7155  *                     (descr.byteorder == c'<' and not little_endian)):
7156  */
7157     __pyx_t_4 = __pyx_v_descr->type_num;
7158     __pyx_v_t = __pyx_t_4;
7159 
7160     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
7161  *             if not PyDataType_HASFIELDS(descr):
7162  *                 t = descr.type_num
7163  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
7164  *                     (descr.byteorder == c'<' and not little_endian)):
7165  *                     raise ValueError(u"Non-native byte order not supported")
7166  */
7167     __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
7168     if (!__pyx_t_2) {
7169       goto __pyx_L15_next_or;
7170     } else {
7171     }
7172     __pyx_t_2 = (__pyx_v_little_endian != 0);
7173     if (!__pyx_t_2) {
7174     } else {
7175       __pyx_t_1 = __pyx_t_2;
7176       goto __pyx_L14_bool_binop_done;
7177     }
7178     __pyx_L15_next_or:;
7179 
7180     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":305
7181  *                 t = descr.type_num
7182  *                 if ((descr.byteorder == c'>' and little_endian) or
7183  *                     (descr.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
7184  *                     raise ValueError(u"Non-native byte order not supported")
7185  *                 if   t == NPY_BYTE:        f = "b"
7186  */
7187     __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
7188     if (__pyx_t_2) {
7189     } else {
7190       __pyx_t_1 = __pyx_t_2;
7191       goto __pyx_L14_bool_binop_done;
7192     }
7193     __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
7194     __pyx_t_1 = __pyx_t_2;
7195     __pyx_L14_bool_binop_done:;
7196 
7197     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
7198  *             if not PyDataType_HASFIELDS(descr):
7199  *                 t = descr.type_num
7200  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
7201  *                     (descr.byteorder == c'<' and not little_endian)):
7202  *                     raise ValueError(u"Non-native byte order not supported")
7203  */
7204     if (unlikely(__pyx_t_1)) {
7205 
7206       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":306
7207  *                 if ((descr.byteorder == c'>' and little_endian) or
7208  *                     (descr.byteorder == c'<' and not little_endian)):
7209  *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
7210  *                 if   t == NPY_BYTE:        f = "b"
7211  *                 elif t == NPY_UBYTE:       f = "B"
7212  */
7213       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 306, __pyx_L1_error)
7214       __Pyx_GOTREF(__pyx_t_3);
7215       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7216       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7217       __PYX_ERR(1, 306, __pyx_L1_error)
7218 
7219       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
7220  *             if not PyDataType_HASFIELDS(descr):
7221  *                 t = descr.type_num
7222  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
7223  *                     (descr.byteorder == c'<' and not little_endian)):
7224  *                     raise ValueError(u"Non-native byte order not supported")
7225  */
7226     }
7227 
7228     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":307
7229  *                     (descr.byteorder == c'<' and not little_endian)):
7230  *                     raise ValueError(u"Non-native byte order not supported")
7231  *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
7232  *                 elif t == NPY_UBYTE:       f = "B"
7233  *                 elif t == NPY_SHORT:       f = "h"
7234  */
7235     switch (__pyx_v_t) {
7236       case NPY_BYTE:
7237       __pyx_v_f = ((char *)"b");
7238       break;
7239       case NPY_UBYTE:
7240 
7241       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":308
7242  *                     raise ValueError(u"Non-native byte order not supported")
7243  *                 if   t == NPY_BYTE:        f = "b"
7244  *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
7245  *                 elif t == NPY_SHORT:       f = "h"
7246  *                 elif t == NPY_USHORT:      f = "H"
7247  */
7248       __pyx_v_f = ((char *)"B");
7249       break;
7250       case NPY_SHORT:
7251 
7252       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":309
7253  *                 if   t == NPY_BYTE:        f = "b"
7254  *                 elif t == NPY_UBYTE:       f = "B"
7255  *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
7256  *                 elif t == NPY_USHORT:      f = "H"
7257  *                 elif t == NPY_INT:         f = "i"
7258  */
7259       __pyx_v_f = ((char *)"h");
7260       break;
7261       case NPY_USHORT:
7262 
7263       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":310
7264  *                 elif t == NPY_UBYTE:       f = "B"
7265  *                 elif t == NPY_SHORT:       f = "h"
7266  *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
7267  *                 elif t == NPY_INT:         f = "i"
7268  *                 elif t == NPY_UINT:        f = "I"
7269  */
7270       __pyx_v_f = ((char *)"H");
7271       break;
7272       case NPY_INT:
7273 
7274       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":311
7275  *                 elif t == NPY_SHORT:       f = "h"
7276  *                 elif t == NPY_USHORT:      f = "H"
7277  *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
7278  *                 elif t == NPY_UINT:        f = "I"
7279  *                 elif t == NPY_LONG:        f = "l"
7280  */
7281       __pyx_v_f = ((char *)"i");
7282       break;
7283       case NPY_UINT:
7284 
7285       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":312
7286  *                 elif t == NPY_USHORT:      f = "H"
7287  *                 elif t == NPY_INT:         f = "i"
7288  *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
7289  *                 elif t == NPY_LONG:        f = "l"
7290  *                 elif t == NPY_ULONG:       f = "L"
7291  */
7292       __pyx_v_f = ((char *)"I");
7293       break;
7294       case NPY_LONG:
7295 
7296       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":313
7297  *                 elif t == NPY_INT:         f = "i"
7298  *                 elif t == NPY_UINT:        f = "I"
7299  *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
7300  *                 elif t == NPY_ULONG:       f = "L"
7301  *                 elif t == NPY_LONGLONG:    f = "q"
7302  */
7303       __pyx_v_f = ((char *)"l");
7304       break;
7305       case NPY_ULONG:
7306 
7307       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":314
7308  *                 elif t == NPY_UINT:        f = "I"
7309  *                 elif t == NPY_LONG:        f = "l"
7310  *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
7311  *                 elif t == NPY_LONGLONG:    f = "q"
7312  *                 elif t == NPY_ULONGLONG:   f = "Q"
7313  */
7314       __pyx_v_f = ((char *)"L");
7315       break;
7316       case NPY_LONGLONG:
7317 
7318       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":315
7319  *                 elif t == NPY_LONG:        f = "l"
7320  *                 elif t == NPY_ULONG:       f = "L"
7321  *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
7322  *                 elif t == NPY_ULONGLONG:   f = "Q"
7323  *                 elif t == NPY_FLOAT:       f = "f"
7324  */
7325       __pyx_v_f = ((char *)"q");
7326       break;
7327       case NPY_ULONGLONG:
7328 
7329       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":316
7330  *                 elif t == NPY_ULONG:       f = "L"
7331  *                 elif t == NPY_LONGLONG:    f = "q"
7332  *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
7333  *                 elif t == NPY_FLOAT:       f = "f"
7334  *                 elif t == NPY_DOUBLE:      f = "d"
7335  */
7336       __pyx_v_f = ((char *)"Q");
7337       break;
7338       case NPY_FLOAT:
7339 
7340       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":317
7341  *                 elif t == NPY_LONGLONG:    f = "q"
7342  *                 elif t == NPY_ULONGLONG:   f = "Q"
7343  *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
7344  *                 elif t == NPY_DOUBLE:      f = "d"
7345  *                 elif t == NPY_LONGDOUBLE:  f = "g"
7346  */
7347       __pyx_v_f = ((char *)"f");
7348       break;
7349       case NPY_DOUBLE:
7350 
7351       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":318
7352  *                 elif t == NPY_ULONGLONG:   f = "Q"
7353  *                 elif t == NPY_FLOAT:       f = "f"
7354  *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
7355  *                 elif t == NPY_LONGDOUBLE:  f = "g"
7356  *                 elif t == NPY_CFLOAT:      f = "Zf"
7357  */
7358       __pyx_v_f = ((char *)"d");
7359       break;
7360       case NPY_LONGDOUBLE:
7361 
7362       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":319
7363  *                 elif t == NPY_FLOAT:       f = "f"
7364  *                 elif t == NPY_DOUBLE:      f = "d"
7365  *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
7366  *                 elif t == NPY_CFLOAT:      f = "Zf"
7367  *                 elif t == NPY_CDOUBLE:     f = "Zd"
7368  */
7369       __pyx_v_f = ((char *)"g");
7370       break;
7371       case NPY_CFLOAT:
7372 
7373       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":320
7374  *                 elif t == NPY_DOUBLE:      f = "d"
7375  *                 elif t == NPY_LONGDOUBLE:  f = "g"
7376  *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
7377  *                 elif t == NPY_CDOUBLE:     f = "Zd"
7378  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
7379  */
7380       __pyx_v_f = ((char *)"Zf");
7381       break;
7382       case NPY_CDOUBLE:
7383 
7384       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":321
7385  *                 elif t == NPY_LONGDOUBLE:  f = "g"
7386  *                 elif t == NPY_CFLOAT:      f = "Zf"
7387  *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
7388  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
7389  *                 elif t == NPY_OBJECT:      f = "O"
7390  */
7391       __pyx_v_f = ((char *)"Zd");
7392       break;
7393       case NPY_CLONGDOUBLE:
7394 
7395       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":322
7396  *                 elif t == NPY_CFLOAT:      f = "Zf"
7397  *                 elif t == NPY_CDOUBLE:     f = "Zd"
7398  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
7399  *                 elif t == NPY_OBJECT:      f = "O"
7400  *                 else:
7401  */
7402       __pyx_v_f = ((char *)"Zg");
7403       break;
7404       case NPY_OBJECT:
7405 
7406       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":323
7407  *                 elif t == NPY_CDOUBLE:     f = "Zd"
7408  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
7409  *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
7410  *                 else:
7411  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
7412  */
7413       __pyx_v_f = ((char *)"O");
7414       break;
7415       default:
7416 
7417       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":325
7418  *                 elif t == NPY_OBJECT:      f = "O"
7419  *                 else:
7420  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
7421  *                 info.format = f
7422  *                 return
7423  */
7424       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error)
7425       __Pyx_GOTREF(__pyx_t_3);
7426       __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 325, __pyx_L1_error)
7427       __Pyx_GOTREF(__pyx_t_8);
7428       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7429       __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error)
7430       __Pyx_GOTREF(__pyx_t_3);
7431       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7432       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7433       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7434       __PYX_ERR(1, 325, __pyx_L1_error)
7435       break;
7436     }
7437 
7438     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":326
7439  *                 else:
7440  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
7441  *                 info.format = f             # <<<<<<<<<<<<<<
7442  *                 return
7443  *             else:
7444  */
7445     __pyx_v_info->format = __pyx_v_f;
7446 
7447     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":327
7448  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
7449  *                 info.format = f
7450  *                 return             # <<<<<<<<<<<<<<
7451  *             else:
7452  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
7453  */
7454     __pyx_r = 0;
7455     goto __pyx_L0;
7456 
7457     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302
7458  *             info.obj = self
7459  *
7460  *             if not PyDataType_HASFIELDS(descr):             # <<<<<<<<<<<<<<
7461  *                 t = descr.type_num
7462  *                 if ((descr.byteorder == c'>' and little_endian) or
7463  */
7464   }
7465 
7466   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":329
7467  *                 return
7468  *             else:
7469  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
7470  *                 info.format[0] = c'^' # Native data types, manual alignment
7471  *                 offset = 0
7472  */
7473   /*else*/ {
7474     __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF));
7475 
7476     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":330
7477  *             else:
7478  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
7479  *                 info.format[0] = c'^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
7480  *                 offset = 0
7481  *                 f = _util_dtypestring(descr, info.format + 1,
7482  */
7483     (__pyx_v_info->format[0]) = '^';
7484 
7485     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":331
7486  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
7487  *                 info.format[0] = c'^' # Native data types, manual alignment
7488  *                 offset = 0             # <<<<<<<<<<<<<<
7489  *                 f = _util_dtypestring(descr, info.format + 1,
7490  *                                       info.format + _buffer_format_string_len,
7491  */
7492     __pyx_v_offset = 0;
7493 
7494     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":332
7495  *                 info.format[0] = c'^' # Native data types, manual alignment
7496  *                 offset = 0
7497  *                 f = _util_dtypestring(descr, info.format + 1,             # <<<<<<<<<<<<<<
7498  *                                       info.format + _buffer_format_string_len,
7499  *                                       &offset)
7500  */
7501     __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 332, __pyx_L1_error)
7502     __pyx_v_f = __pyx_t_9;
7503 
7504     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":335
7505  *                                       info.format + _buffer_format_string_len,
7506  *                                       &offset)
7507  *                 f[0] = c'\0' # Terminate format string             # <<<<<<<<<<<<<<
7508  *
7509  *         def __releasebuffer__(ndarray self, Py_buffer* info):
7510  */
7511     (__pyx_v_f[0]) = '\x00';
7512   }
7513 
7514   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":258
7515  *         # experimental exception made for __getbuffer__ and __releasebuffer__
7516  *         # -- the details of this may change.
7517  *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
7518  *             # This implementation of getbuffer is geared towards Cython
7519  *             # requirements, and does not yet fulfill the PEP.
7520  */
7521 
7522   /* function exit code */
7523   __pyx_r = 0;
7524   goto __pyx_L0;
7525   __pyx_L1_error:;
7526   __Pyx_XDECREF(__pyx_t_3);
7527   __Pyx_XDECREF(__pyx_t_8);
7528   __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7529   __pyx_r = -1;
7530   if (__pyx_v_info->obj != NULL) {
7531     __Pyx_GOTREF(__pyx_v_info->obj);
7532     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
7533   }
7534   goto __pyx_L2;
7535   __pyx_L0:;
7536   if (__pyx_v_info->obj == Py_None) {
7537     __Pyx_GOTREF(__pyx_v_info->obj);
7538     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
7539   }
7540   __pyx_L2:;
7541   __Pyx_XDECREF((PyObject *)__pyx_v_descr);
7542   __Pyx_RefNannyFinishContext();
7543   return __pyx_r;
7544 }
7545 
7546 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":337
7547  *                 f[0] = c'\0' # Terminate format string
7548  *
7549  *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
7550  *             if PyArray_HASFIELDS(self):
7551  *                 PyObject_Free(info.format)
7552  */
7553 
7554 /* Python wrapper */
7555 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)7556 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
7557   __Pyx_RefNannyDeclarations
7558   __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
7559   __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
7560 
7561   /* function exit code */
7562   __Pyx_RefNannyFinishContext();
7563 }
7564 
__pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject * __pyx_v_self,Py_buffer * __pyx_v_info)7565 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
7566   __Pyx_RefNannyDeclarations
7567   int __pyx_t_1;
7568   __Pyx_RefNannySetupContext("__releasebuffer__", 0);
7569 
7570   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":338
7571  *
7572  *         def __releasebuffer__(ndarray self, Py_buffer* info):
7573  *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
7574  *                 PyObject_Free(info.format)
7575  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
7576  */
7577   __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
7578   if (__pyx_t_1) {
7579 
7580     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":339
7581  *         def __releasebuffer__(ndarray self, Py_buffer* info):
7582  *             if PyArray_HASFIELDS(self):
7583  *                 PyObject_Free(info.format)             # <<<<<<<<<<<<<<
7584  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
7585  *                 PyObject_Free(info.strides)
7586  */
7587     PyObject_Free(__pyx_v_info->format);
7588 
7589     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":338
7590  *
7591  *         def __releasebuffer__(ndarray self, Py_buffer* info):
7592  *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
7593  *                 PyObject_Free(info.format)
7594  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
7595  */
7596   }
7597 
7598   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":340
7599  *             if PyArray_HASFIELDS(self):
7600  *                 PyObject_Free(info.format)
7601  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
7602  *                 PyObject_Free(info.strides)
7603  *                 # info.shape was stored after info.strides in the same block
7604  */
7605   __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
7606   if (__pyx_t_1) {
7607 
7608     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":341
7609  *                 PyObject_Free(info.format)
7610  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
7611  *                 PyObject_Free(info.strides)             # <<<<<<<<<<<<<<
7612  *                 # info.shape was stored after info.strides in the same block
7613  *
7614  */
7615     PyObject_Free(__pyx_v_info->strides);
7616 
7617     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":340
7618  *             if PyArray_HASFIELDS(self):
7619  *                 PyObject_Free(info.format)
7620  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
7621  *                 PyObject_Free(info.strides)
7622  *                 # info.shape was stored after info.strides in the same block
7623  */
7624   }
7625 
7626   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":337
7627  *                 f[0] = c'\0' # Terminate format string
7628  *
7629  *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
7630  *             if PyArray_HASFIELDS(self):
7631  *                 PyObject_Free(info.format)
7632  */
7633 
7634   /* function exit code */
7635   __Pyx_RefNannyFinishContext();
7636 }
7637 
7638 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":821
7639  * ctypedef npy_cdouble     complex_t
7640  *
7641  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
7642  *     return PyArray_MultiIterNew(1, <void*>a)
7643  *
7644  */
7645 
__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject * __pyx_v_a)7646 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
7647   PyObject *__pyx_r = NULL;
7648   __Pyx_RefNannyDeclarations
7649   PyObject *__pyx_t_1 = NULL;
7650   __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
7651 
7652   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":822
7653  *
7654  * cdef inline object PyArray_MultiIterNew1(a):
7655  *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
7656  *
7657  * cdef inline object PyArray_MultiIterNew2(a, b):
7658  */
7659   __Pyx_XDECREF(__pyx_r);
7660   __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 822, __pyx_L1_error)
7661   __Pyx_GOTREF(__pyx_t_1);
7662   __pyx_r = __pyx_t_1;
7663   __pyx_t_1 = 0;
7664   goto __pyx_L0;
7665 
7666   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":821
7667  * ctypedef npy_cdouble     complex_t
7668  *
7669  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
7670  *     return PyArray_MultiIterNew(1, <void*>a)
7671  *
7672  */
7673 
7674   /* function exit code */
7675   __pyx_L1_error:;
7676   __Pyx_XDECREF(__pyx_t_1);
7677   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
7678   __pyx_r = 0;
7679   __pyx_L0:;
7680   __Pyx_XGIVEREF(__pyx_r);
7681   __Pyx_RefNannyFinishContext();
7682   return __pyx_r;
7683 }
7684 
7685 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":824
7686  *     return PyArray_MultiIterNew(1, <void*>a)
7687  *
7688  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
7689  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
7690  *
7691  */
7692 
__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject * __pyx_v_a,PyObject * __pyx_v_b)7693 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
7694   PyObject *__pyx_r = NULL;
7695   __Pyx_RefNannyDeclarations
7696   PyObject *__pyx_t_1 = NULL;
7697   __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
7698 
7699   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":825
7700  *
7701  * cdef inline object PyArray_MultiIterNew2(a, b):
7702  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
7703  *
7704  * cdef inline object PyArray_MultiIterNew3(a, b, c):
7705  */
7706   __Pyx_XDECREF(__pyx_r);
7707   __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 825, __pyx_L1_error)
7708   __Pyx_GOTREF(__pyx_t_1);
7709   __pyx_r = __pyx_t_1;
7710   __pyx_t_1 = 0;
7711   goto __pyx_L0;
7712 
7713   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":824
7714  *     return PyArray_MultiIterNew(1, <void*>a)
7715  *
7716  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
7717  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
7718  *
7719  */
7720 
7721   /* function exit code */
7722   __pyx_L1_error:;
7723   __Pyx_XDECREF(__pyx_t_1);
7724   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
7725   __pyx_r = 0;
7726   __pyx_L0:;
7727   __Pyx_XGIVEREF(__pyx_r);
7728   __Pyx_RefNannyFinishContext();
7729   return __pyx_r;
7730 }
7731 
7732 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827
7733  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
7734  *
7735  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
7736  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
7737  *
7738  */
7739 
__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c)7740 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
7741   PyObject *__pyx_r = NULL;
7742   __Pyx_RefNannyDeclarations
7743   PyObject *__pyx_t_1 = NULL;
7744   __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
7745 
7746   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":828
7747  *
7748  * cdef inline object PyArray_MultiIterNew3(a, b, c):
7749  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
7750  *
7751  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
7752  */
7753   __Pyx_XDECREF(__pyx_r);
7754   __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 828, __pyx_L1_error)
7755   __Pyx_GOTREF(__pyx_t_1);
7756   __pyx_r = __pyx_t_1;
7757   __pyx_t_1 = 0;
7758   goto __pyx_L0;
7759 
7760   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827
7761  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
7762  *
7763  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
7764  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
7765  *
7766  */
7767 
7768   /* function exit code */
7769   __pyx_L1_error:;
7770   __Pyx_XDECREF(__pyx_t_1);
7771   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
7772   __pyx_r = 0;
7773   __pyx_L0:;
7774   __Pyx_XGIVEREF(__pyx_r);
7775   __Pyx_RefNannyFinishContext();
7776   return __pyx_r;
7777 }
7778 
7779 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":830
7780  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
7781  *
7782  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
7783  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
7784  *
7785  */
7786 
__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c,PyObject * __pyx_v_d)7787 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) {
7788   PyObject *__pyx_r = NULL;
7789   __Pyx_RefNannyDeclarations
7790   PyObject *__pyx_t_1 = NULL;
7791   __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
7792 
7793   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":831
7794  *
7795  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
7796  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
7797  *
7798  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
7799  */
7800   __Pyx_XDECREF(__pyx_r);
7801   __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 831, __pyx_L1_error)
7802   __Pyx_GOTREF(__pyx_t_1);
7803   __pyx_r = __pyx_t_1;
7804   __pyx_t_1 = 0;
7805   goto __pyx_L0;
7806 
7807   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":830
7808  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
7809  *
7810  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
7811  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
7812  *
7813  */
7814 
7815   /* function exit code */
7816   __pyx_L1_error:;
7817   __Pyx_XDECREF(__pyx_t_1);
7818   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
7819   __pyx_r = 0;
7820   __pyx_L0:;
7821   __Pyx_XGIVEREF(__pyx_r);
7822   __Pyx_RefNannyFinishContext();
7823   return __pyx_r;
7824 }
7825 
7826 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":833
7827  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
7828  *
7829  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
7830  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
7831  *
7832  */
7833 
__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)7834 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) {
7835   PyObject *__pyx_r = NULL;
7836   __Pyx_RefNannyDeclarations
7837   PyObject *__pyx_t_1 = NULL;
7838   __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
7839 
7840   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":834
7841  *
7842  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
7843  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
7844  *
7845  * cdef inline tuple PyDataType_SHAPE(dtype d):
7846  */
7847   __Pyx_XDECREF(__pyx_r);
7848   __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 834, __pyx_L1_error)
7849   __Pyx_GOTREF(__pyx_t_1);
7850   __pyx_r = __pyx_t_1;
7851   __pyx_t_1 = 0;
7852   goto __pyx_L0;
7853 
7854   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":833
7855  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
7856  *
7857  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
7858  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
7859  *
7860  */
7861 
7862   /* function exit code */
7863   __pyx_L1_error:;
7864   __Pyx_XDECREF(__pyx_t_1);
7865   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
7866   __pyx_r = 0;
7867   __pyx_L0:;
7868   __Pyx_XGIVEREF(__pyx_r);
7869   __Pyx_RefNannyFinishContext();
7870   return __pyx_r;
7871 }
7872 
7873 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":836
7874  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
7875  *
7876  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
7877  *     if PyDataType_HASSUBARRAY(d):
7878  *         return <tuple>d.subarray.shape
7879  */
7880 
__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr * __pyx_v_d)7881 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
7882   PyObject *__pyx_r = NULL;
7883   __Pyx_RefNannyDeclarations
7884   int __pyx_t_1;
7885   __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
7886 
7887   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837
7888  *
7889  * cdef inline tuple PyDataType_SHAPE(dtype d):
7890  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
7891  *         return <tuple>d.subarray.shape
7892  *     else:
7893  */
7894   __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
7895   if (__pyx_t_1) {
7896 
7897     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":838
7898  * cdef inline tuple PyDataType_SHAPE(dtype d):
7899  *     if PyDataType_HASSUBARRAY(d):
7900  *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
7901  *     else:
7902  *         return ()
7903  */
7904     __Pyx_XDECREF(__pyx_r);
7905     __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
7906     __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
7907     goto __pyx_L0;
7908 
7909     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837
7910  *
7911  * cdef inline tuple PyDataType_SHAPE(dtype d):
7912  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
7913  *         return <tuple>d.subarray.shape
7914  *     else:
7915  */
7916   }
7917 
7918   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":840
7919  *         return <tuple>d.subarray.shape
7920  *     else:
7921  *         return ()             # <<<<<<<<<<<<<<
7922  *
7923  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
7924  */
7925   /*else*/ {
7926     __Pyx_XDECREF(__pyx_r);
7927     __Pyx_INCREF(__pyx_empty_tuple);
7928     __pyx_r = __pyx_empty_tuple;
7929     goto __pyx_L0;
7930   }
7931 
7932   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":836
7933  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
7934  *
7935  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
7936  *     if PyDataType_HASSUBARRAY(d):
7937  *         return <tuple>d.subarray.shape
7938  */
7939 
7940   /* function exit code */
7941   __pyx_L0:;
7942   __Pyx_XGIVEREF(__pyx_r);
7943   __Pyx_RefNannyFinishContext();
7944   return __pyx_r;
7945 }
7946 
7947 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842
7948  *         return ()
7949  *
7950  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
7951  *     # Recursive utility function used in __getbuffer__ to get format
7952  *     # string. The new location in the format string is returned.
7953  */
7954 
__pyx_f_5numpy__util_dtypestring(PyArray_Descr * __pyx_v_descr,char * __pyx_v_f,char * __pyx_v_end,int * __pyx_v_offset)7955 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) {
7956   PyArray_Descr *__pyx_v_child = 0;
7957   int __pyx_v_endian_detector;
7958   int __pyx_v_little_endian;
7959   PyObject *__pyx_v_fields = 0;
7960   PyObject *__pyx_v_childname = NULL;
7961   PyObject *__pyx_v_new_offset = NULL;
7962   PyObject *__pyx_v_t = NULL;
7963   char *__pyx_r;
7964   __Pyx_RefNannyDeclarations
7965   PyObject *__pyx_t_1 = NULL;
7966   Py_ssize_t __pyx_t_2;
7967   PyObject *__pyx_t_3 = NULL;
7968   PyObject *__pyx_t_4 = NULL;
7969   int __pyx_t_5;
7970   int __pyx_t_6;
7971   int __pyx_t_7;
7972   long __pyx_t_8;
7973   char *__pyx_t_9;
7974   __Pyx_RefNannySetupContext("_util_dtypestring", 0);
7975 
7976   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":847
7977  *
7978  *     cdef dtype child
7979  *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
7980  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
7981  *     cdef tuple fields
7982  */
7983   __pyx_v_endian_detector = 1;
7984 
7985   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":848
7986  *     cdef dtype child
7987  *     cdef int endian_detector = 1
7988  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
7989  *     cdef tuple fields
7990  *
7991  */
7992   __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
7993 
7994   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851
7995  *     cdef tuple fields
7996  *
7997  *     for childname in descr.names:             # <<<<<<<<<<<<<<
7998  *         fields = descr.fields[childname]
7999  *         child, new_offset = fields
8000  */
8001   if (unlikely(__pyx_v_descr->names == Py_None)) {
8002     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
8003     __PYX_ERR(1, 851, __pyx_L1_error)
8004   }
8005   __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
8006   for (;;) {
8007     if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
8008     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8009     __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 851, __pyx_L1_error)
8010     #else
8011     __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 851, __pyx_L1_error)
8012     __Pyx_GOTREF(__pyx_t_3);
8013     #endif
8014     __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
8015     __pyx_t_3 = 0;
8016 
8017     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":852
8018  *
8019  *     for childname in descr.names:
8020  *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
8021  *         child, new_offset = fields
8022  *
8023  */
8024     if (unlikely(__pyx_v_descr->fields == Py_None)) {
8025       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8026       __PYX_ERR(1, 852, __pyx_L1_error)
8027     }
8028     __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __pyx_L1_error)
8029     __Pyx_GOTREF(__pyx_t_3);
8030     if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 852, __pyx_L1_error)
8031     __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
8032     __pyx_t_3 = 0;
8033 
8034     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":853
8035  *     for childname in descr.names:
8036  *         fields = descr.fields[childname]
8037  *         child, new_offset = fields             # <<<<<<<<<<<<<<
8038  *
8039  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
8040  */
8041     if (likely(__pyx_v_fields != Py_None)) {
8042       PyObject* sequence = __pyx_v_fields;
8043       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
8044       if (unlikely(size != 2)) {
8045         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
8046         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
8047         __PYX_ERR(1, 853, __pyx_L1_error)
8048       }
8049       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8050       __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
8051       __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
8052       __Pyx_INCREF(__pyx_t_3);
8053       __Pyx_INCREF(__pyx_t_4);
8054       #else
8055       __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 853, __pyx_L1_error)
8056       __Pyx_GOTREF(__pyx_t_3);
8057       __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error)
8058       __Pyx_GOTREF(__pyx_t_4);
8059       #endif
8060     } else {
8061       __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 853, __pyx_L1_error)
8062     }
8063     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 853, __pyx_L1_error)
8064     __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
8065     __pyx_t_3 = 0;
8066     __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
8067     __pyx_t_4 = 0;
8068 
8069     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855
8070  *         child, new_offset = fields
8071  *
8072  *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
8073  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
8074  *
8075  */
8076     __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error)
8077     __Pyx_GOTREF(__pyx_t_4);
8078     __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error)
8079     __Pyx_GOTREF(__pyx_t_3);
8080     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8081     __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 855, __pyx_L1_error)
8082     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8083     __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
8084     if (unlikely(__pyx_t_6)) {
8085 
8086       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856
8087  *
8088  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
8089  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
8090  *
8091  *         if ((child.byteorder == c'>' and little_endian) or
8092  */
8093       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 856, __pyx_L1_error)
8094       __Pyx_GOTREF(__pyx_t_3);
8095       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8096       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8097       __PYX_ERR(1, 856, __pyx_L1_error)
8098 
8099       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855
8100  *         child, new_offset = fields
8101  *
8102  *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
8103  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
8104  *
8105  */
8106     }
8107 
8108     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
8109  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
8110  *
8111  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
8112  *             (child.byteorder == c'<' and not little_endian)):
8113  *             raise ValueError(u"Non-native byte order not supported")
8114  */
8115     __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
8116     if (!__pyx_t_7) {
8117       goto __pyx_L8_next_or;
8118     } else {
8119     }
8120     __pyx_t_7 = (__pyx_v_little_endian != 0);
8121     if (!__pyx_t_7) {
8122     } else {
8123       __pyx_t_6 = __pyx_t_7;
8124       goto __pyx_L7_bool_binop_done;
8125     }
8126     __pyx_L8_next_or:;
8127 
8128     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":859
8129  *
8130  *         if ((child.byteorder == c'>' and little_endian) or
8131  *             (child.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
8132  *             raise ValueError(u"Non-native byte order not supported")
8133  *             # One could encode it in the format string and have Cython
8134  */
8135     __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
8136     if (__pyx_t_7) {
8137     } else {
8138       __pyx_t_6 = __pyx_t_7;
8139       goto __pyx_L7_bool_binop_done;
8140     }
8141     __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
8142     __pyx_t_6 = __pyx_t_7;
8143     __pyx_L7_bool_binop_done:;
8144 
8145     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
8146  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
8147  *
8148  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
8149  *             (child.byteorder == c'<' and not little_endian)):
8150  *             raise ValueError(u"Non-native byte order not supported")
8151  */
8152     if (unlikely(__pyx_t_6)) {
8153 
8154       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":860
8155  *         if ((child.byteorder == c'>' and little_endian) or
8156  *             (child.byteorder == c'<' and not little_endian)):
8157  *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
8158  *             # One could encode it in the format string and have Cython
8159  *             # complain instead, BUT: < and > in format strings also imply
8160  */
8161       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 860, __pyx_L1_error)
8162       __Pyx_GOTREF(__pyx_t_3);
8163       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8164       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8165       __PYX_ERR(1, 860, __pyx_L1_error)
8166 
8167       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
8168  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
8169  *
8170  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
8171  *             (child.byteorder == c'<' and not little_endian)):
8172  *             raise ValueError(u"Non-native byte order not supported")
8173  */
8174     }
8175 
8176     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":870
8177  *
8178  *         # Output padding bytes
8179  *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
8180  *             f[0] = 120 # "x"; pad byte
8181  *             f += 1
8182  */
8183     while (1) {
8184       __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 870, __pyx_L1_error)
8185       __Pyx_GOTREF(__pyx_t_3);
8186       __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 870, __pyx_L1_error)
8187       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8188       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 870, __pyx_L1_error)
8189       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8190       if (!__pyx_t_6) break;
8191 
8192       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":871
8193  *         # Output padding bytes
8194  *         while offset[0] < new_offset:
8195  *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
8196  *             f += 1
8197  *             offset[0] += 1
8198  */
8199       (__pyx_v_f[0]) = 0x78;
8200 
8201       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":872
8202  *         while offset[0] < new_offset:
8203  *             f[0] = 120 # "x"; pad byte
8204  *             f += 1             # <<<<<<<<<<<<<<
8205  *             offset[0] += 1
8206  *
8207  */
8208       __pyx_v_f = (__pyx_v_f + 1);
8209 
8210       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":873
8211  *             f[0] = 120 # "x"; pad byte
8212  *             f += 1
8213  *             offset[0] += 1             # <<<<<<<<<<<<<<
8214  *
8215  *         offset[0] += child.itemsize
8216  */
8217       __pyx_t_8 = 0;
8218       (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
8219     }
8220 
8221     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":875
8222  *             offset[0] += 1
8223  *
8224  *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
8225  *
8226  *         if not PyDataType_HASFIELDS(child):
8227  */
8228     __pyx_t_8 = 0;
8229     (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
8230 
8231     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":877
8232  *         offset[0] += child.itemsize
8233  *
8234  *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
8235  *             t = child.type_num
8236  *             if end - f < 5:
8237  */
8238     __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
8239     if (__pyx_t_6) {
8240 
8241       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":878
8242  *
8243  *         if not PyDataType_HASFIELDS(child):
8244  *             t = child.type_num             # <<<<<<<<<<<<<<
8245  *             if end - f < 5:
8246  *                 raise RuntimeError(u"Format string allocated too short.")
8247  */
8248       __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 878, __pyx_L1_error)
8249       __Pyx_GOTREF(__pyx_t_4);
8250       __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
8251       __pyx_t_4 = 0;
8252 
8253       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":879
8254  *         if not PyDataType_HASFIELDS(child):
8255  *             t = child.type_num
8256  *             if end - f < 5:             # <<<<<<<<<<<<<<
8257  *                 raise RuntimeError(u"Format string allocated too short.")
8258  *
8259  */
8260       __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
8261       if (unlikely(__pyx_t_6)) {
8262 
8263         /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":880
8264  *             t = child.type_num
8265  *             if end - f < 5:
8266  *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
8267  *
8268  *             # Until ticket #99 is fixed, use integers to avoid warnings
8269  */
8270         __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 880, __pyx_L1_error)
8271         __Pyx_GOTREF(__pyx_t_4);
8272         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
8273         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8274         __PYX_ERR(1, 880, __pyx_L1_error)
8275 
8276         /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":879
8277  *         if not PyDataType_HASFIELDS(child):
8278  *             t = child.type_num
8279  *             if end - f < 5:             # <<<<<<<<<<<<<<
8280  *                 raise RuntimeError(u"Format string allocated too short.")
8281  *
8282  */
8283       }
8284 
8285       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":883
8286  *
8287  *             # Until ticket #99 is fixed, use integers to avoid warnings
8288  *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
8289  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
8290  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
8291  */
8292       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 883, __pyx_L1_error)
8293       __Pyx_GOTREF(__pyx_t_4);
8294       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 883, __pyx_L1_error)
8295       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8296       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 883, __pyx_L1_error)
8297       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8298       if (__pyx_t_6) {
8299         (__pyx_v_f[0]) = 98;
8300         goto __pyx_L15;
8301       }
8302 
8303       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":884
8304  *             # Until ticket #99 is fixed, use integers to avoid warnings
8305  *             if   t == NPY_BYTE:        f[0] =  98 #"b"
8306  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
8307  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
8308  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
8309  */
8310       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 884, __pyx_L1_error)
8311       __Pyx_GOTREF(__pyx_t_3);
8312       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 884, __pyx_L1_error)
8313       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8314       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 884, __pyx_L1_error)
8315       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8316       if (__pyx_t_6) {
8317         (__pyx_v_f[0]) = 66;
8318         goto __pyx_L15;
8319       }
8320 
8321       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":885
8322  *             if   t == NPY_BYTE:        f[0] =  98 #"b"
8323  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
8324  *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
8325  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
8326  *             elif t == NPY_INT:         f[0] = 105 #"i"
8327  */
8328       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 885, __pyx_L1_error)
8329       __Pyx_GOTREF(__pyx_t_4);
8330       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 885, __pyx_L1_error)
8331       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8332       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 885, __pyx_L1_error)
8333       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8334       if (__pyx_t_6) {
8335         (__pyx_v_f[0]) = 0x68;
8336         goto __pyx_L15;
8337       }
8338 
8339       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":886
8340  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
8341  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
8342  *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
8343  *             elif t == NPY_INT:         f[0] = 105 #"i"
8344  *             elif t == NPY_UINT:        f[0] =  73 #"I"
8345  */
8346       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 886, __pyx_L1_error)
8347       __Pyx_GOTREF(__pyx_t_3);
8348       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 886, __pyx_L1_error)
8349       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8350       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 886, __pyx_L1_error)
8351       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8352       if (__pyx_t_6) {
8353         (__pyx_v_f[0]) = 72;
8354         goto __pyx_L15;
8355       }
8356 
8357       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":887
8358  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
8359  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
8360  *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
8361  *             elif t == NPY_UINT:        f[0] =  73 #"I"
8362  *             elif t == NPY_LONG:        f[0] = 108 #"l"
8363  */
8364       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 887, __pyx_L1_error)
8365       __Pyx_GOTREF(__pyx_t_4);
8366       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 887, __pyx_L1_error)
8367       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8368       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 887, __pyx_L1_error)
8369       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8370       if (__pyx_t_6) {
8371         (__pyx_v_f[0]) = 0x69;
8372         goto __pyx_L15;
8373       }
8374 
8375       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":888
8376  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
8377  *             elif t == NPY_INT:         f[0] = 105 #"i"
8378  *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
8379  *             elif t == NPY_LONG:        f[0] = 108 #"l"
8380  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
8381  */
8382       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 888, __pyx_L1_error)
8383       __Pyx_GOTREF(__pyx_t_3);
8384       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 888, __pyx_L1_error)
8385       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8386       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 888, __pyx_L1_error)
8387       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8388       if (__pyx_t_6) {
8389         (__pyx_v_f[0]) = 73;
8390         goto __pyx_L15;
8391       }
8392 
8393       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":889
8394  *             elif t == NPY_INT:         f[0] = 105 #"i"
8395  *             elif t == NPY_UINT:        f[0] =  73 #"I"
8396  *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
8397  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
8398  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
8399  */
8400       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 889, __pyx_L1_error)
8401       __Pyx_GOTREF(__pyx_t_4);
8402       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 889, __pyx_L1_error)
8403       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8404       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 889, __pyx_L1_error)
8405       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8406       if (__pyx_t_6) {
8407         (__pyx_v_f[0]) = 0x6C;
8408         goto __pyx_L15;
8409       }
8410 
8411       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":890
8412  *             elif t == NPY_UINT:        f[0] =  73 #"I"
8413  *             elif t == NPY_LONG:        f[0] = 108 #"l"
8414  *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
8415  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
8416  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
8417  */
8418       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 890, __pyx_L1_error)
8419       __Pyx_GOTREF(__pyx_t_3);
8420       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 890, __pyx_L1_error)
8421       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8422       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 890, __pyx_L1_error)
8423       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8424       if (__pyx_t_6) {
8425         (__pyx_v_f[0]) = 76;
8426         goto __pyx_L15;
8427       }
8428 
8429       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":891
8430  *             elif t == NPY_LONG:        f[0] = 108 #"l"
8431  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
8432  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
8433  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
8434  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
8435  */
8436       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 891, __pyx_L1_error)
8437       __Pyx_GOTREF(__pyx_t_4);
8438       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 891, __pyx_L1_error)
8439       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8440       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 891, __pyx_L1_error)
8441       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8442       if (__pyx_t_6) {
8443         (__pyx_v_f[0]) = 0x71;
8444         goto __pyx_L15;
8445       }
8446 
8447       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":892
8448  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
8449  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
8450  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
8451  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
8452  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
8453  */
8454       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 892, __pyx_L1_error)
8455       __Pyx_GOTREF(__pyx_t_3);
8456       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 892, __pyx_L1_error)
8457       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8458       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 892, __pyx_L1_error)
8459       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8460       if (__pyx_t_6) {
8461         (__pyx_v_f[0]) = 81;
8462         goto __pyx_L15;
8463       }
8464 
8465       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":893
8466  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
8467  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
8468  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
8469  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
8470  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
8471  */
8472       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 893, __pyx_L1_error)
8473       __Pyx_GOTREF(__pyx_t_4);
8474       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 893, __pyx_L1_error)
8475       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8476       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 893, __pyx_L1_error)
8477       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8478       if (__pyx_t_6) {
8479         (__pyx_v_f[0]) = 0x66;
8480         goto __pyx_L15;
8481       }
8482 
8483       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":894
8484  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
8485  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
8486  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
8487  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
8488  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
8489  */
8490       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 894, __pyx_L1_error)
8491       __Pyx_GOTREF(__pyx_t_3);
8492       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 894, __pyx_L1_error)
8493       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8494       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 894, __pyx_L1_error)
8495       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8496       if (__pyx_t_6) {
8497         (__pyx_v_f[0]) = 0x64;
8498         goto __pyx_L15;
8499       }
8500 
8501       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":895
8502  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
8503  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
8504  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
8505  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
8506  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
8507  */
8508       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 895, __pyx_L1_error)
8509       __Pyx_GOTREF(__pyx_t_4);
8510       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 895, __pyx_L1_error)
8511       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8512       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 895, __pyx_L1_error)
8513       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8514       if (__pyx_t_6) {
8515         (__pyx_v_f[0]) = 0x67;
8516         goto __pyx_L15;
8517       }
8518 
8519       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":896
8520  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
8521  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
8522  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
8523  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
8524  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
8525  */
8526       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 896, __pyx_L1_error)
8527       __Pyx_GOTREF(__pyx_t_3);
8528       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 896, __pyx_L1_error)
8529       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8530       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 896, __pyx_L1_error)
8531       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8532       if (__pyx_t_6) {
8533         (__pyx_v_f[0]) = 90;
8534         (__pyx_v_f[1]) = 0x66;
8535         __pyx_v_f = (__pyx_v_f + 1);
8536         goto __pyx_L15;
8537       }
8538 
8539       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":897
8540  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
8541  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
8542  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
8543  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
8544  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
8545  */
8546       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 897, __pyx_L1_error)
8547       __Pyx_GOTREF(__pyx_t_4);
8548       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 897, __pyx_L1_error)
8549       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8550       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 897, __pyx_L1_error)
8551       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8552       if (__pyx_t_6) {
8553         (__pyx_v_f[0]) = 90;
8554         (__pyx_v_f[1]) = 0x64;
8555         __pyx_v_f = (__pyx_v_f + 1);
8556         goto __pyx_L15;
8557       }
8558 
8559       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":898
8560  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
8561  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
8562  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
8563  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
8564  *             else:
8565  */
8566       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 898, __pyx_L1_error)
8567       __Pyx_GOTREF(__pyx_t_3);
8568       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 898, __pyx_L1_error)
8569       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8570       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 898, __pyx_L1_error)
8571       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8572       if (__pyx_t_6) {
8573         (__pyx_v_f[0]) = 90;
8574         (__pyx_v_f[1]) = 0x67;
8575         __pyx_v_f = (__pyx_v_f + 1);
8576         goto __pyx_L15;
8577       }
8578 
8579       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":899
8580  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
8581  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
8582  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
8583  *             else:
8584  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
8585  */
8586       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 899, __pyx_L1_error)
8587       __Pyx_GOTREF(__pyx_t_4);
8588       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 899, __pyx_L1_error)
8589       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8590       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 899, __pyx_L1_error)
8591       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8592       if (likely(__pyx_t_6)) {
8593         (__pyx_v_f[0]) = 79;
8594         goto __pyx_L15;
8595       }
8596 
8597       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":901
8598  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
8599  *             else:
8600  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
8601  *             f += 1
8602  *         else:
8603  */
8604       /*else*/ {
8605         __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 901, __pyx_L1_error)
8606         __Pyx_GOTREF(__pyx_t_3);
8607         __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 901, __pyx_L1_error)
8608         __Pyx_GOTREF(__pyx_t_4);
8609         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8610         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
8611         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8612         __PYX_ERR(1, 901, __pyx_L1_error)
8613       }
8614       __pyx_L15:;
8615 
8616       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":902
8617  *             else:
8618  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
8619  *             f += 1             # <<<<<<<<<<<<<<
8620  *         else:
8621  *             # Cython ignores struct boundary information ("T{...}"),
8622  */
8623       __pyx_v_f = (__pyx_v_f + 1);
8624 
8625       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":877
8626  *         offset[0] += child.itemsize
8627  *
8628  *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
8629  *             t = child.type_num
8630  *             if end - f < 5:
8631  */
8632       goto __pyx_L13;
8633     }
8634 
8635     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":906
8636  *             # Cython ignores struct boundary information ("T{...}"),
8637  *             # so don't output it
8638  *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
8639  *     return f
8640  *
8641  */
8642     /*else*/ {
8643       __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 906, __pyx_L1_error)
8644       __pyx_v_f = __pyx_t_9;
8645     }
8646     __pyx_L13:;
8647 
8648     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851
8649  *     cdef tuple fields
8650  *
8651  *     for childname in descr.names:             # <<<<<<<<<<<<<<
8652  *         fields = descr.fields[childname]
8653  *         child, new_offset = fields
8654  */
8655   }
8656   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8657 
8658   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":907
8659  *             # so don't output it
8660  *             f = _util_dtypestring(child, f, end, offset)
8661  *     return f             # <<<<<<<<<<<<<<
8662  *
8663  *
8664  */
8665   __pyx_r = __pyx_v_f;
8666   goto __pyx_L0;
8667 
8668   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842
8669  *         return ()
8670  *
8671  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
8672  *     # Recursive utility function used in __getbuffer__ to get format
8673  *     # string. The new location in the format string is returned.
8674  */
8675 
8676   /* function exit code */
8677   __pyx_L1_error:;
8678   __Pyx_XDECREF(__pyx_t_1);
8679   __Pyx_XDECREF(__pyx_t_3);
8680   __Pyx_XDECREF(__pyx_t_4);
8681   __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
8682   __pyx_r = NULL;
8683   __pyx_L0:;
8684   __Pyx_XDECREF((PyObject *)__pyx_v_child);
8685   __Pyx_XDECREF(__pyx_v_fields);
8686   __Pyx_XDECREF(__pyx_v_childname);
8687   __Pyx_XDECREF(__pyx_v_new_offset);
8688   __Pyx_XDECREF(__pyx_v_t);
8689   __Pyx_RefNannyFinishContext();
8690   return __pyx_r;
8691 }
8692 
8693 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022
8694  *     int _import_umath() except -1
8695  *
8696  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
8697  *     Py_INCREF(base) # important to do this before stealing the reference below!
8698  *     PyArray_SetBaseObject(arr, base)
8699  */
8700 
__pyx_f_5numpy_set_array_base(PyArrayObject * __pyx_v_arr,PyObject * __pyx_v_base)8701 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
8702   __Pyx_RefNannyDeclarations
8703   __Pyx_RefNannySetupContext("set_array_base", 0);
8704 
8705   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1023
8706  *
8707  * cdef inline void set_array_base(ndarray arr, object base):
8708  *     Py_INCREF(base) # important to do this before stealing the reference below!             # <<<<<<<<<<<<<<
8709  *     PyArray_SetBaseObject(arr, base)
8710  *
8711  */
8712   Py_INCREF(__pyx_v_base);
8713 
8714   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1024
8715  * cdef inline void set_array_base(ndarray arr, object base):
8716  *     Py_INCREF(base) # important to do this before stealing the reference below!
8717  *     PyArray_SetBaseObject(arr, base)             # <<<<<<<<<<<<<<
8718  *
8719  * cdef inline object get_array_base(ndarray arr):
8720  */
8721   (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
8722 
8723   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022
8724  *     int _import_umath() except -1
8725  *
8726  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
8727  *     Py_INCREF(base) # important to do this before stealing the reference below!
8728  *     PyArray_SetBaseObject(arr, base)
8729  */
8730 
8731   /* function exit code */
8732   __Pyx_RefNannyFinishContext();
8733 }
8734 
8735 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1026
8736  *     PyArray_SetBaseObject(arr, base)
8737  *
8738  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
8739  *     base = PyArray_BASE(arr)
8740  *     if base is NULL:
8741  */
8742 
__pyx_f_5numpy_get_array_base(PyArrayObject * __pyx_v_arr)8743 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
8744   PyObject *__pyx_v_base;
8745   PyObject *__pyx_r = NULL;
8746   __Pyx_RefNannyDeclarations
8747   int __pyx_t_1;
8748   __Pyx_RefNannySetupContext("get_array_base", 0);
8749 
8750   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1027
8751  *
8752  * cdef inline object get_array_base(ndarray arr):
8753  *     base = PyArray_BASE(arr)             # <<<<<<<<<<<<<<
8754  *     if base is NULL:
8755  *         return None
8756  */
8757   __pyx_v_base = PyArray_BASE(__pyx_v_arr);
8758 
8759   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1028
8760  * cdef inline object get_array_base(ndarray arr):
8761  *     base = PyArray_BASE(arr)
8762  *     if base is NULL:             # <<<<<<<<<<<<<<
8763  *         return None
8764  *     return <object>base
8765  */
8766   __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
8767   if (__pyx_t_1) {
8768 
8769     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1029
8770  *     base = PyArray_BASE(arr)
8771  *     if base is NULL:
8772  *         return None             # <<<<<<<<<<<<<<
8773  *     return <object>base
8774  *
8775  */
8776     __Pyx_XDECREF(__pyx_r);
8777     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8778     goto __pyx_L0;
8779 
8780     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1028
8781  * cdef inline object get_array_base(ndarray arr):
8782  *     base = PyArray_BASE(arr)
8783  *     if base is NULL:             # <<<<<<<<<<<<<<
8784  *         return None
8785  *     return <object>base
8786  */
8787   }
8788 
8789   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1030
8790  *     if base is NULL:
8791  *         return None
8792  *     return <object>base             # <<<<<<<<<<<<<<
8793  *
8794  * # Versions of the import_* functions which are more suitable for
8795  */
8796   __Pyx_XDECREF(__pyx_r);
8797   __Pyx_INCREF(((PyObject *)__pyx_v_base));
8798   __pyx_r = ((PyObject *)__pyx_v_base);
8799   goto __pyx_L0;
8800 
8801   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1026
8802  *     PyArray_SetBaseObject(arr, base)
8803  *
8804  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
8805  *     base = PyArray_BASE(arr)
8806  *     if base is NULL:
8807  */
8808 
8809   /* function exit code */
8810   __pyx_L0:;
8811   __Pyx_XGIVEREF(__pyx_r);
8812   __Pyx_RefNannyFinishContext();
8813   return __pyx_r;
8814 }
8815 
8816 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1034
8817  * # Versions of the import_* functions which are more suitable for
8818  * # Cython code.
8819  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
8820  *     try:
8821  *         _import_array()
8822  */
8823 
__pyx_f_5numpy_import_array(void)8824 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
8825   int __pyx_r;
8826   __Pyx_RefNannyDeclarations
8827   PyObject *__pyx_t_1 = NULL;
8828   PyObject *__pyx_t_2 = NULL;
8829   PyObject *__pyx_t_3 = NULL;
8830   int __pyx_t_4;
8831   PyObject *__pyx_t_5 = NULL;
8832   PyObject *__pyx_t_6 = NULL;
8833   PyObject *__pyx_t_7 = NULL;
8834   PyObject *__pyx_t_8 = NULL;
8835   __Pyx_RefNannySetupContext("import_array", 0);
8836 
8837   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
8838  * # Cython code.
8839  * cdef inline int import_array() except -1:
8840  *     try:             # <<<<<<<<<<<<<<
8841  *         _import_array()
8842  *     except Exception:
8843  */
8844   {
8845     __Pyx_PyThreadState_declare
8846     __Pyx_PyThreadState_assign
8847     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
8848     __Pyx_XGOTREF(__pyx_t_1);
8849     __Pyx_XGOTREF(__pyx_t_2);
8850     __Pyx_XGOTREF(__pyx_t_3);
8851     /*try:*/ {
8852 
8853       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1036
8854  * cdef inline int import_array() except -1:
8855  *     try:
8856  *         _import_array()             # <<<<<<<<<<<<<<
8857  *     except Exception:
8858  *         raise ImportError("numpy.core.multiarray failed to import")
8859  */
8860       __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1036, __pyx_L3_error)
8861 
8862       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
8863  * # Cython code.
8864  * cdef inline int import_array() except -1:
8865  *     try:             # <<<<<<<<<<<<<<
8866  *         _import_array()
8867  *     except Exception:
8868  */
8869     }
8870     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
8871     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
8872     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8873     goto __pyx_L8_try_end;
8874     __pyx_L3_error:;
8875 
8876     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1037
8877  *     try:
8878  *         _import_array()
8879  *     except Exception:             # <<<<<<<<<<<<<<
8880  *         raise ImportError("numpy.core.multiarray failed to import")
8881  *
8882  */
8883     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
8884     if (__pyx_t_4) {
8885       __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
8886       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1037, __pyx_L5_except_error)
8887       __Pyx_GOTREF(__pyx_t_5);
8888       __Pyx_GOTREF(__pyx_t_6);
8889       __Pyx_GOTREF(__pyx_t_7);
8890 
8891       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1038
8892  *         _import_array()
8893  *     except Exception:
8894  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
8895  *
8896  * cdef inline int import_umath() except -1:
8897  */
8898       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1038, __pyx_L5_except_error)
8899       __Pyx_GOTREF(__pyx_t_8);
8900       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
8901       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8902       __PYX_ERR(1, 1038, __pyx_L5_except_error)
8903     }
8904     goto __pyx_L5_except_error;
8905     __pyx_L5_except_error:;
8906 
8907     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
8908  * # Cython code.
8909  * cdef inline int import_array() except -1:
8910  *     try:             # <<<<<<<<<<<<<<
8911  *         _import_array()
8912  *     except Exception:
8913  */
8914     __Pyx_XGIVEREF(__pyx_t_1);
8915     __Pyx_XGIVEREF(__pyx_t_2);
8916     __Pyx_XGIVEREF(__pyx_t_3);
8917     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
8918     goto __pyx_L1_error;
8919     __pyx_L8_try_end:;
8920   }
8921 
8922   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1034
8923  * # Versions of the import_* functions which are more suitable for
8924  * # Cython code.
8925  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
8926  *     try:
8927  *         _import_array()
8928  */
8929 
8930   /* function exit code */
8931   __pyx_r = 0;
8932   goto __pyx_L0;
8933   __pyx_L1_error:;
8934   __Pyx_XDECREF(__pyx_t_5);
8935   __Pyx_XDECREF(__pyx_t_6);
8936   __Pyx_XDECREF(__pyx_t_7);
8937   __Pyx_XDECREF(__pyx_t_8);
8938   __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
8939   __pyx_r = -1;
8940   __pyx_L0:;
8941   __Pyx_RefNannyFinishContext();
8942   return __pyx_r;
8943 }
8944 
8945 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1040
8946  *         raise ImportError("numpy.core.multiarray failed to import")
8947  *
8948  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
8949  *     try:
8950  *         _import_umath()
8951  */
8952 
__pyx_f_5numpy_import_umath(void)8953 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
8954   int __pyx_r;
8955   __Pyx_RefNannyDeclarations
8956   PyObject *__pyx_t_1 = NULL;
8957   PyObject *__pyx_t_2 = NULL;
8958   PyObject *__pyx_t_3 = NULL;
8959   int __pyx_t_4;
8960   PyObject *__pyx_t_5 = NULL;
8961   PyObject *__pyx_t_6 = NULL;
8962   PyObject *__pyx_t_7 = NULL;
8963   PyObject *__pyx_t_8 = NULL;
8964   __Pyx_RefNannySetupContext("import_umath", 0);
8965 
8966   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
8967  *
8968  * cdef inline int import_umath() except -1:
8969  *     try:             # <<<<<<<<<<<<<<
8970  *         _import_umath()
8971  *     except Exception:
8972  */
8973   {
8974     __Pyx_PyThreadState_declare
8975     __Pyx_PyThreadState_assign
8976     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
8977     __Pyx_XGOTREF(__pyx_t_1);
8978     __Pyx_XGOTREF(__pyx_t_2);
8979     __Pyx_XGOTREF(__pyx_t_3);
8980     /*try:*/ {
8981 
8982       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1042
8983  * cdef inline int import_umath() except -1:
8984  *     try:
8985  *         _import_umath()             # <<<<<<<<<<<<<<
8986  *     except Exception:
8987  *         raise ImportError("numpy.core.umath failed to import")
8988  */
8989       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1042, __pyx_L3_error)
8990 
8991       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
8992  *
8993  * cdef inline int import_umath() except -1:
8994  *     try:             # <<<<<<<<<<<<<<
8995  *         _import_umath()
8996  *     except Exception:
8997  */
8998     }
8999     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
9000     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
9001     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9002     goto __pyx_L8_try_end;
9003     __pyx_L3_error:;
9004 
9005     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1043
9006  *     try:
9007  *         _import_umath()
9008  *     except Exception:             # <<<<<<<<<<<<<<
9009  *         raise ImportError("numpy.core.umath failed to import")
9010  *
9011  */
9012     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
9013     if (__pyx_t_4) {
9014       __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
9015       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1043, __pyx_L5_except_error)
9016       __Pyx_GOTREF(__pyx_t_5);
9017       __Pyx_GOTREF(__pyx_t_6);
9018       __Pyx_GOTREF(__pyx_t_7);
9019 
9020       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1044
9021  *         _import_umath()
9022  *     except Exception:
9023  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
9024  *
9025  * cdef inline int import_ufunc() except -1:
9026  */
9027       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1044, __pyx_L5_except_error)
9028       __Pyx_GOTREF(__pyx_t_8);
9029       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
9030       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9031       __PYX_ERR(1, 1044, __pyx_L5_except_error)
9032     }
9033     goto __pyx_L5_except_error;
9034     __pyx_L5_except_error:;
9035 
9036     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
9037  *
9038  * cdef inline int import_umath() except -1:
9039  *     try:             # <<<<<<<<<<<<<<
9040  *         _import_umath()
9041  *     except Exception:
9042  */
9043     __Pyx_XGIVEREF(__pyx_t_1);
9044     __Pyx_XGIVEREF(__pyx_t_2);
9045     __Pyx_XGIVEREF(__pyx_t_3);
9046     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
9047     goto __pyx_L1_error;
9048     __pyx_L8_try_end:;
9049   }
9050 
9051   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1040
9052  *         raise ImportError("numpy.core.multiarray failed to import")
9053  *
9054  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
9055  *     try:
9056  *         _import_umath()
9057  */
9058 
9059   /* function exit code */
9060   __pyx_r = 0;
9061   goto __pyx_L0;
9062   __pyx_L1_error:;
9063   __Pyx_XDECREF(__pyx_t_5);
9064   __Pyx_XDECREF(__pyx_t_6);
9065   __Pyx_XDECREF(__pyx_t_7);
9066   __Pyx_XDECREF(__pyx_t_8);
9067   __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
9068   __pyx_r = -1;
9069   __pyx_L0:;
9070   __Pyx_RefNannyFinishContext();
9071   return __pyx_r;
9072 }
9073 
9074 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046
9075  *         raise ImportError("numpy.core.umath failed to import")
9076  *
9077  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
9078  *     try:
9079  *         _import_umath()
9080  */
9081 
__pyx_f_5numpy_import_ufunc(void)9082 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
9083   int __pyx_r;
9084   __Pyx_RefNannyDeclarations
9085   PyObject *__pyx_t_1 = NULL;
9086   PyObject *__pyx_t_2 = NULL;
9087   PyObject *__pyx_t_3 = NULL;
9088   int __pyx_t_4;
9089   PyObject *__pyx_t_5 = NULL;
9090   PyObject *__pyx_t_6 = NULL;
9091   PyObject *__pyx_t_7 = NULL;
9092   PyObject *__pyx_t_8 = NULL;
9093   __Pyx_RefNannySetupContext("import_ufunc", 0);
9094 
9095   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
9096  *
9097  * cdef inline int import_ufunc() except -1:
9098  *     try:             # <<<<<<<<<<<<<<
9099  *         _import_umath()
9100  *     except Exception:
9101  */
9102   {
9103     __Pyx_PyThreadState_declare
9104     __Pyx_PyThreadState_assign
9105     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
9106     __Pyx_XGOTREF(__pyx_t_1);
9107     __Pyx_XGOTREF(__pyx_t_2);
9108     __Pyx_XGOTREF(__pyx_t_3);
9109     /*try:*/ {
9110 
9111       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1048
9112  * cdef inline int import_ufunc() except -1:
9113  *     try:
9114  *         _import_umath()             # <<<<<<<<<<<<<<
9115  *     except Exception:
9116  *         raise ImportError("numpy.core.umath failed to import")
9117  */
9118       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1048, __pyx_L3_error)
9119 
9120       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
9121  *
9122  * cdef inline int import_ufunc() except -1:
9123  *     try:             # <<<<<<<<<<<<<<
9124  *         _import_umath()
9125  *     except Exception:
9126  */
9127     }
9128     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
9129     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
9130     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9131     goto __pyx_L8_try_end;
9132     __pyx_L3_error:;
9133 
9134     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1049
9135  *     try:
9136  *         _import_umath()
9137  *     except Exception:             # <<<<<<<<<<<<<<
9138  *         raise ImportError("numpy.core.umath failed to import")
9139  */
9140     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
9141     if (__pyx_t_4) {
9142       __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
9143       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1049, __pyx_L5_except_error)
9144       __Pyx_GOTREF(__pyx_t_5);
9145       __Pyx_GOTREF(__pyx_t_6);
9146       __Pyx_GOTREF(__pyx_t_7);
9147 
9148       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1050
9149  *         _import_umath()
9150  *     except Exception:
9151  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
9152  */
9153       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1050, __pyx_L5_except_error)
9154       __Pyx_GOTREF(__pyx_t_8);
9155       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
9156       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9157       __PYX_ERR(1, 1050, __pyx_L5_except_error)
9158     }
9159     goto __pyx_L5_except_error;
9160     __pyx_L5_except_error:;
9161 
9162     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
9163  *
9164  * cdef inline int import_ufunc() except -1:
9165  *     try:             # <<<<<<<<<<<<<<
9166  *         _import_umath()
9167  *     except Exception:
9168  */
9169     __Pyx_XGIVEREF(__pyx_t_1);
9170     __Pyx_XGIVEREF(__pyx_t_2);
9171     __Pyx_XGIVEREF(__pyx_t_3);
9172     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
9173     goto __pyx_L1_error;
9174     __pyx_L8_try_end:;
9175   }
9176 
9177   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046
9178  *         raise ImportError("numpy.core.umath failed to import")
9179  *
9180  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
9181  *     try:
9182  *         _import_umath()
9183  */
9184 
9185   /* function exit code */
9186   __pyx_r = 0;
9187   goto __pyx_L0;
9188   __pyx_L1_error:;
9189   __Pyx_XDECREF(__pyx_t_5);
9190   __Pyx_XDECREF(__pyx_t_6);
9191   __Pyx_XDECREF(__pyx_t_7);
9192   __Pyx_XDECREF(__pyx_t_8);
9193   __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
9194   __pyx_r = -1;
9195   __pyx_L0:;
9196   __Pyx_RefNannyFinishContext();
9197   return __pyx_r;
9198 }
9199 
9200 /* "View.MemoryView":122
9201  *         cdef bint dtype_is_object
9202  *
9203  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
9204  *                   mode="c", bint allocate_buffer=True):
9205  *
9206  */
9207 
9208 /* Python wrapper */
9209 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)9210 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9211   PyObject *__pyx_v_shape = 0;
9212   Py_ssize_t __pyx_v_itemsize;
9213   PyObject *__pyx_v_format = 0;
9214   PyObject *__pyx_v_mode = 0;
9215   int __pyx_v_allocate_buffer;
9216   int __pyx_r;
9217   __Pyx_RefNannyDeclarations
9218   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
9219   {
9220     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};
9221     PyObject* values[5] = {0,0,0,0,0};
9222     values[3] = ((PyObject *)__pyx_n_s_c);
9223     if (unlikely(__pyx_kwds)) {
9224       Py_ssize_t kw_args;
9225       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9226       switch (pos_args) {
9227         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
9228         CYTHON_FALLTHROUGH;
9229         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
9230         CYTHON_FALLTHROUGH;
9231         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9232         CYTHON_FALLTHROUGH;
9233         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9234         CYTHON_FALLTHROUGH;
9235         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9236         CYTHON_FALLTHROUGH;
9237         case  0: break;
9238         default: goto __pyx_L5_argtuple_error;
9239       }
9240       kw_args = PyDict_Size(__pyx_kwds);
9241       switch (pos_args) {
9242         case  0:
9243         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
9244         else goto __pyx_L5_argtuple_error;
9245         CYTHON_FALLTHROUGH;
9246         case  1:
9247         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
9248         else {
9249           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 122, __pyx_L3_error)
9250         }
9251         CYTHON_FALLTHROUGH;
9252         case  2:
9253         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
9254         else {
9255           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 122, __pyx_L3_error)
9256         }
9257         CYTHON_FALLTHROUGH;
9258         case  3:
9259         if (kw_args > 0) {
9260           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
9261           if (value) { values[3] = value; kw_args--; }
9262         }
9263         CYTHON_FALLTHROUGH;
9264         case  4:
9265         if (kw_args > 0) {
9266           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
9267           if (value) { values[4] = value; kw_args--; }
9268         }
9269       }
9270       if (unlikely(kw_args > 0)) {
9271         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 122, __pyx_L3_error)
9272       }
9273     } else {
9274       switch (PyTuple_GET_SIZE(__pyx_args)) {
9275         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
9276         CYTHON_FALLTHROUGH;
9277         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
9278         CYTHON_FALLTHROUGH;
9279         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9280         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9281         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9282         break;
9283         default: goto __pyx_L5_argtuple_error;
9284       }
9285     }
9286     __pyx_v_shape = ((PyObject*)values[0]);
9287     __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 122, __pyx_L3_error)
9288     __pyx_v_format = values[2];
9289     __pyx_v_mode = values[3];
9290     if (values[4]) {
9291       __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 123, __pyx_L3_error)
9292     } else {
9293 
9294       /* "View.MemoryView":123
9295  *
9296  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
9297  *                   mode="c", bint allocate_buffer=True):             # <<<<<<<<<<<<<<
9298  *
9299  *         cdef int idx
9300  */
9301       __pyx_v_allocate_buffer = ((int)1);
9302     }
9303   }
9304   goto __pyx_L4_argument_unpacking_done;
9305   __pyx_L5_argtuple_error:;
9306   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 122, __pyx_L3_error)
9307   __pyx_L3_error:;
9308   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9309   __Pyx_RefNannyFinishContext();
9310   return -1;
9311   __pyx_L4_argument_unpacking_done:;
9312   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 122, __pyx_L1_error)
9313   if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
9314     PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 122, __pyx_L1_error)
9315   }
9316   __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);
9317 
9318   /* "View.MemoryView":122
9319  *         cdef bint dtype_is_object
9320  *
9321  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
9322  *                   mode="c", bint allocate_buffer=True):
9323  *
9324  */
9325 
9326   /* function exit code */
9327   goto __pyx_L0;
9328   __pyx_L1_error:;
9329   __pyx_r = -1;
9330   __pyx_L0:;
9331   __Pyx_RefNannyFinishContext();
9332   return __pyx_r;
9333 }
9334 
__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)9335 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) {
9336   int __pyx_v_idx;
9337   Py_ssize_t __pyx_v_i;
9338   Py_ssize_t __pyx_v_dim;
9339   PyObject **__pyx_v_p;
9340   char __pyx_v_order;
9341   int __pyx_r;
9342   __Pyx_RefNannyDeclarations
9343   Py_ssize_t __pyx_t_1;
9344   int __pyx_t_2;
9345   PyObject *__pyx_t_3 = NULL;
9346   int __pyx_t_4;
9347   PyObject *__pyx_t_5 = NULL;
9348   PyObject *__pyx_t_6 = NULL;
9349   char *__pyx_t_7;
9350   int __pyx_t_8;
9351   Py_ssize_t __pyx_t_9;
9352   PyObject *__pyx_t_10 = NULL;
9353   Py_ssize_t __pyx_t_11;
9354   __Pyx_RefNannySetupContext("__cinit__", 0);
9355   __Pyx_INCREF(__pyx_v_format);
9356 
9357   /* "View.MemoryView":129
9358  *         cdef PyObject **p
9359  *
9360  *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
9361  *         self.itemsize = itemsize
9362  *
9363  */
9364   if (unlikely(__pyx_v_shape == Py_None)) {
9365     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
9366     __PYX_ERR(2, 129, __pyx_L1_error)
9367   }
9368   __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 129, __pyx_L1_error)
9369   __pyx_v_self->ndim = ((int)__pyx_t_1);
9370 
9371   /* "View.MemoryView":130
9372  *
9373  *         self.ndim = <int> len(shape)
9374  *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
9375  *
9376  *         if not self.ndim:
9377  */
9378   __pyx_v_self->itemsize = __pyx_v_itemsize;
9379 
9380   /* "View.MemoryView":132
9381  *         self.itemsize = itemsize
9382  *
9383  *         if not self.ndim:             # <<<<<<<<<<<<<<
9384  *             raise ValueError("Empty shape tuple for cython.array")
9385  *
9386  */
9387   __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
9388   if (unlikely(__pyx_t_2)) {
9389 
9390     /* "View.MemoryView":133
9391  *
9392  *         if not self.ndim:
9393  *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
9394  *
9395  *         if itemsize <= 0:
9396  */
9397     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 133, __pyx_L1_error)
9398     __Pyx_GOTREF(__pyx_t_3);
9399     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
9400     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9401     __PYX_ERR(2, 133, __pyx_L1_error)
9402 
9403     /* "View.MemoryView":132
9404  *         self.itemsize = itemsize
9405  *
9406  *         if not self.ndim:             # <<<<<<<<<<<<<<
9407  *             raise ValueError("Empty shape tuple for cython.array")
9408  *
9409  */
9410   }
9411 
9412   /* "View.MemoryView":135
9413  *             raise ValueError("Empty shape tuple for cython.array")
9414  *
9415  *         if itemsize <= 0:             # <<<<<<<<<<<<<<
9416  *             raise ValueError("itemsize <= 0 for cython.array")
9417  *
9418  */
9419   __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
9420   if (unlikely(__pyx_t_2)) {
9421 
9422     /* "View.MemoryView":136
9423  *
9424  *         if itemsize <= 0:
9425  *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
9426  *
9427  *         if not isinstance(format, bytes):
9428  */
9429     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 136, __pyx_L1_error)
9430     __Pyx_GOTREF(__pyx_t_3);
9431     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
9432     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9433     __PYX_ERR(2, 136, __pyx_L1_error)
9434 
9435     /* "View.MemoryView":135
9436  *             raise ValueError("Empty shape tuple for cython.array")
9437  *
9438  *         if itemsize <= 0:             # <<<<<<<<<<<<<<
9439  *             raise ValueError("itemsize <= 0 for cython.array")
9440  *
9441  */
9442   }
9443 
9444   /* "View.MemoryView":138
9445  *             raise ValueError("itemsize <= 0 for cython.array")
9446  *
9447  *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
9448  *             format = format.encode('ASCII')
9449  *         self._format = format  # keep a reference to the byte string
9450  */
9451   __pyx_t_2 = PyBytes_Check(__pyx_v_format);
9452   __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
9453   if (__pyx_t_4) {
9454 
9455     /* "View.MemoryView":139
9456  *
9457  *         if not isinstance(format, bytes):
9458  *             format = format.encode('ASCII')             # <<<<<<<<<<<<<<
9459  *         self._format = format  # keep a reference to the byte string
9460  *         self.format = self._format
9461  */
9462     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 139, __pyx_L1_error)
9463     __Pyx_GOTREF(__pyx_t_5);
9464     __pyx_t_6 = NULL;
9465     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
9466       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
9467       if (likely(__pyx_t_6)) {
9468         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
9469         __Pyx_INCREF(__pyx_t_6);
9470         __Pyx_INCREF(function);
9471         __Pyx_DECREF_SET(__pyx_t_5, function);
9472       }
9473     }
9474     __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);
9475     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9476     if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 139, __pyx_L1_error)
9477     __Pyx_GOTREF(__pyx_t_3);
9478     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9479     __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
9480     __pyx_t_3 = 0;
9481 
9482     /* "View.MemoryView":138
9483  *             raise ValueError("itemsize <= 0 for cython.array")
9484  *
9485  *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
9486  *             format = format.encode('ASCII')
9487  *         self._format = format  # keep a reference to the byte string
9488  */
9489   }
9490 
9491   /* "View.MemoryView":140
9492  *         if not isinstance(format, bytes):
9493  *             format = format.encode('ASCII')
9494  *         self._format = format  # keep a reference to the byte string             # <<<<<<<<<<<<<<
9495  *         self.format = self._format
9496  *
9497  */
9498   if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(2, 140, __pyx_L1_error)
9499   __pyx_t_3 = __pyx_v_format;
9500   __Pyx_INCREF(__pyx_t_3);
9501   __Pyx_GIVEREF(__pyx_t_3);
9502   __Pyx_GOTREF(__pyx_v_self->_format);
9503   __Pyx_DECREF(__pyx_v_self->_format);
9504   __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
9505   __pyx_t_3 = 0;
9506 
9507   /* "View.MemoryView":141
9508  *             format = format.encode('ASCII')
9509  *         self._format = format  # keep a reference to the byte string
9510  *         self.format = self._format             # <<<<<<<<<<<<<<
9511  *
9512  *
9513  */
9514   if (unlikely(__pyx_v_self->_format == Py_None)) {
9515     PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
9516     __PYX_ERR(2, 141, __pyx_L1_error)
9517   }
9518   __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 141, __pyx_L1_error)
9519   __pyx_v_self->format = __pyx_t_7;
9520 
9521   /* "View.MemoryView":144
9522  *
9523  *
9524  *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)             # <<<<<<<<<<<<<<
9525  *         self._strides = self._shape + self.ndim
9526  *
9527  */
9528   __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
9529 
9530   /* "View.MemoryView":145
9531  *
9532  *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
9533  *         self._strides = self._shape + self.ndim             # <<<<<<<<<<<<<<
9534  *
9535  *         if not self._shape:
9536  */
9537   __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
9538 
9539   /* "View.MemoryView":147
9540  *         self._strides = self._shape + self.ndim
9541  *
9542  *         if not self._shape:             # <<<<<<<<<<<<<<
9543  *             raise MemoryError("unable to allocate shape and strides.")
9544  *
9545  */
9546   __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
9547   if (unlikely(__pyx_t_4)) {
9548 
9549     /* "View.MemoryView":148
9550  *
9551  *         if not self._shape:
9552  *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
9553  *
9554  *
9555  */
9556     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 148, __pyx_L1_error)
9557     __Pyx_GOTREF(__pyx_t_3);
9558     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
9559     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9560     __PYX_ERR(2, 148, __pyx_L1_error)
9561 
9562     /* "View.MemoryView":147
9563  *         self._strides = self._shape + self.ndim
9564  *
9565  *         if not self._shape:             # <<<<<<<<<<<<<<
9566  *             raise MemoryError("unable to allocate shape and strides.")
9567  *
9568  */
9569   }
9570 
9571   /* "View.MemoryView":151
9572  *
9573  *
9574  *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
9575  *             if dim <= 0:
9576  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
9577  */
9578   __pyx_t_8 = 0;
9579   __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
9580   for (;;) {
9581     if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
9582     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9583     __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(2, 151, __pyx_L1_error)
9584     #else
9585     __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 151, __pyx_L1_error)
9586     __Pyx_GOTREF(__pyx_t_5);
9587     #endif
9588     __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 151, __pyx_L1_error)
9589     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9590     __pyx_v_dim = __pyx_t_9;
9591     __pyx_v_idx = __pyx_t_8;
9592     __pyx_t_8 = (__pyx_t_8 + 1);
9593 
9594     /* "View.MemoryView":152
9595  *
9596  *         for idx, dim in enumerate(shape):
9597  *             if dim <= 0:             # <<<<<<<<<<<<<<
9598  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
9599  *             self._shape[idx] = dim
9600  */
9601     __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
9602     if (unlikely(__pyx_t_4)) {
9603 
9604       /* "View.MemoryView":153
9605  *         for idx, dim in enumerate(shape):
9606  *             if dim <= 0:
9607  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))             # <<<<<<<<<<<<<<
9608  *             self._shape[idx] = dim
9609  *
9610  */
9611       __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 153, __pyx_L1_error)
9612       __Pyx_GOTREF(__pyx_t_5);
9613       __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error)
9614       __Pyx_GOTREF(__pyx_t_6);
9615       __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
9616       __Pyx_GOTREF(__pyx_t_10);
9617       __Pyx_GIVEREF(__pyx_t_5);
9618       PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
9619       __Pyx_GIVEREF(__pyx_t_6);
9620       PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
9621       __pyx_t_5 = 0;
9622       __pyx_t_6 = 0;
9623       __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error)
9624       __Pyx_GOTREF(__pyx_t_6);
9625       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
9626       __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
9627       __Pyx_GOTREF(__pyx_t_10);
9628       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9629       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
9630       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
9631       __PYX_ERR(2, 153, __pyx_L1_error)
9632 
9633       /* "View.MemoryView":152
9634  *
9635  *         for idx, dim in enumerate(shape):
9636  *             if dim <= 0:             # <<<<<<<<<<<<<<
9637  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
9638  *             self._shape[idx] = dim
9639  */
9640     }
9641 
9642     /* "View.MemoryView":154
9643  *             if dim <= 0:
9644  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
9645  *             self._shape[idx] = dim             # <<<<<<<<<<<<<<
9646  *
9647  *         cdef char order
9648  */
9649     (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
9650 
9651     /* "View.MemoryView":151
9652  *
9653  *
9654  *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
9655  *             if dim <= 0:
9656  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
9657  */
9658   }
9659   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9660 
9661   /* "View.MemoryView":157
9662  *
9663  *         cdef char order
9664  *         if mode == 'fortran':             # <<<<<<<<<<<<<<
9665  *             order = b'F'
9666  *             self.mode = u'fortran'
9667  */
9668   __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 157, __pyx_L1_error)
9669   if (__pyx_t_4) {
9670 
9671     /* "View.MemoryView":158
9672  *         cdef char order
9673  *         if mode == 'fortran':
9674  *             order = b'F'             # <<<<<<<<<<<<<<
9675  *             self.mode = u'fortran'
9676  *         elif mode == 'c':
9677  */
9678     __pyx_v_order = 'F';
9679 
9680     /* "View.MemoryView":159
9681  *         if mode == 'fortran':
9682  *             order = b'F'
9683  *             self.mode = u'fortran'             # <<<<<<<<<<<<<<
9684  *         elif mode == 'c':
9685  *             order = b'C'
9686  */
9687     __Pyx_INCREF(__pyx_n_u_fortran);
9688     __Pyx_GIVEREF(__pyx_n_u_fortran);
9689     __Pyx_GOTREF(__pyx_v_self->mode);
9690     __Pyx_DECREF(__pyx_v_self->mode);
9691     __pyx_v_self->mode = __pyx_n_u_fortran;
9692 
9693     /* "View.MemoryView":157
9694  *
9695  *         cdef char order
9696  *         if mode == 'fortran':             # <<<<<<<<<<<<<<
9697  *             order = b'F'
9698  *             self.mode = u'fortran'
9699  */
9700     goto __pyx_L10;
9701   }
9702 
9703   /* "View.MemoryView":160
9704  *             order = b'F'
9705  *             self.mode = u'fortran'
9706  *         elif mode == 'c':             # <<<<<<<<<<<<<<
9707  *             order = b'C'
9708  *             self.mode = u'c'
9709  */
9710   __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 160, __pyx_L1_error)
9711   if (likely(__pyx_t_4)) {
9712 
9713     /* "View.MemoryView":161
9714  *             self.mode = u'fortran'
9715  *         elif mode == 'c':
9716  *             order = b'C'             # <<<<<<<<<<<<<<
9717  *             self.mode = u'c'
9718  *         else:
9719  */
9720     __pyx_v_order = 'C';
9721 
9722     /* "View.MemoryView":162
9723  *         elif mode == 'c':
9724  *             order = b'C'
9725  *             self.mode = u'c'             # <<<<<<<<<<<<<<
9726  *         else:
9727  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
9728  */
9729     __Pyx_INCREF(__pyx_n_u_c);
9730     __Pyx_GIVEREF(__pyx_n_u_c);
9731     __Pyx_GOTREF(__pyx_v_self->mode);
9732     __Pyx_DECREF(__pyx_v_self->mode);
9733     __pyx_v_self->mode = __pyx_n_u_c;
9734 
9735     /* "View.MemoryView":160
9736  *             order = b'F'
9737  *             self.mode = u'fortran'
9738  *         elif mode == 'c':             # <<<<<<<<<<<<<<
9739  *             order = b'C'
9740  *             self.mode = u'c'
9741  */
9742     goto __pyx_L10;
9743   }
9744 
9745   /* "View.MemoryView":164
9746  *             self.mode = u'c'
9747  *         else:
9748  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)             # <<<<<<<<<<<<<<
9749  *
9750  *         self.len = fill_contig_strides_array(self._shape, self._strides,
9751  */
9752   /*else*/ {
9753     __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 164, __pyx_L1_error)
9754     __Pyx_GOTREF(__pyx_t_3);
9755     __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 164, __pyx_L1_error)
9756     __Pyx_GOTREF(__pyx_t_10);
9757     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9758     __Pyx_Raise(__pyx_t_10, 0, 0, 0);
9759     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
9760     __PYX_ERR(2, 164, __pyx_L1_error)
9761   }
9762   __pyx_L10:;
9763 
9764   /* "View.MemoryView":166
9765  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
9766  *
9767  *         self.len = fill_contig_strides_array(self._shape, self._strides,             # <<<<<<<<<<<<<<
9768  *                                              itemsize, self.ndim, order)
9769  *
9770  */
9771   __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);
9772 
9773   /* "View.MemoryView":169
9774  *                                              itemsize, self.ndim, order)
9775  *
9776  *         self.free_data = allocate_buffer             # <<<<<<<<<<<<<<
9777  *         self.dtype_is_object = format == b'O'
9778  *         if allocate_buffer:
9779  */
9780   __pyx_v_self->free_data = __pyx_v_allocate_buffer;
9781 
9782   /* "View.MemoryView":170
9783  *
9784  *         self.free_data = allocate_buffer
9785  *         self.dtype_is_object = format == b'O'             # <<<<<<<<<<<<<<
9786  *         if allocate_buffer:
9787  *
9788  */
9789   __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 170, __pyx_L1_error)
9790   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 170, __pyx_L1_error)
9791   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
9792   __pyx_v_self->dtype_is_object = __pyx_t_4;
9793 
9794   /* "View.MemoryView":171
9795  *         self.free_data = allocate_buffer
9796  *         self.dtype_is_object = format == b'O'
9797  *         if allocate_buffer:             # <<<<<<<<<<<<<<
9798  *
9799  *
9800  */
9801   __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
9802   if (__pyx_t_4) {
9803 
9804     /* "View.MemoryView":174
9805  *
9806  *
9807  *             self.data = <char *>malloc(self.len)             # <<<<<<<<<<<<<<
9808  *             if not self.data:
9809  *                 raise MemoryError("unable to allocate array data.")
9810  */
9811     __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
9812 
9813     /* "View.MemoryView":175
9814  *
9815  *             self.data = <char *>malloc(self.len)
9816  *             if not self.data:             # <<<<<<<<<<<<<<
9817  *                 raise MemoryError("unable to allocate array data.")
9818  *
9819  */
9820     __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
9821     if (unlikely(__pyx_t_4)) {
9822 
9823       /* "View.MemoryView":176
9824  *             self.data = <char *>malloc(self.len)
9825  *             if not self.data:
9826  *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
9827  *
9828  *             if self.dtype_is_object:
9829  */
9830       __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 176, __pyx_L1_error)
9831       __Pyx_GOTREF(__pyx_t_10);
9832       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
9833       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
9834       __PYX_ERR(2, 176, __pyx_L1_error)
9835 
9836       /* "View.MemoryView":175
9837  *
9838  *             self.data = <char *>malloc(self.len)
9839  *             if not self.data:             # <<<<<<<<<<<<<<
9840  *                 raise MemoryError("unable to allocate array data.")
9841  *
9842  */
9843     }
9844 
9845     /* "View.MemoryView":178
9846  *                 raise MemoryError("unable to allocate array data.")
9847  *
9848  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
9849  *                 p = <PyObject **> self.data
9850  *                 for i in range(self.len / itemsize):
9851  */
9852     __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
9853     if (__pyx_t_4) {
9854 
9855       /* "View.MemoryView":179
9856  *
9857  *             if self.dtype_is_object:
9858  *                 p = <PyObject **> self.data             # <<<<<<<<<<<<<<
9859  *                 for i in range(self.len / itemsize):
9860  *                     p[i] = Py_None
9861  */
9862       __pyx_v_p = ((PyObject **)__pyx_v_self->data);
9863 
9864       /* "View.MemoryView":180
9865  *             if self.dtype_is_object:
9866  *                 p = <PyObject **> self.data
9867  *                 for i in range(self.len / itemsize):             # <<<<<<<<<<<<<<
9868  *                     p[i] = Py_None
9869  *                     Py_INCREF(Py_None)
9870  */
9871       if (unlikely(__pyx_v_itemsize == 0)) {
9872         PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
9873         __PYX_ERR(2, 180, __pyx_L1_error)
9874       }
9875       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))) {
9876         PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
9877         __PYX_ERR(2, 180, __pyx_L1_error)
9878       }
9879       __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
9880       __pyx_t_9 = __pyx_t_1;
9881       for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
9882         __pyx_v_i = __pyx_t_11;
9883 
9884         /* "View.MemoryView":181
9885  *                 p = <PyObject **> self.data
9886  *                 for i in range(self.len / itemsize):
9887  *                     p[i] = Py_None             # <<<<<<<<<<<<<<
9888  *                     Py_INCREF(Py_None)
9889  *
9890  */
9891         (__pyx_v_p[__pyx_v_i]) = Py_None;
9892 
9893         /* "View.MemoryView":182
9894  *                 for i in range(self.len / itemsize):
9895  *                     p[i] = Py_None
9896  *                     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
9897  *
9898  *     @cname('getbuffer')
9899  */
9900         Py_INCREF(Py_None);
9901       }
9902 
9903       /* "View.MemoryView":178
9904  *                 raise MemoryError("unable to allocate array data.")
9905  *
9906  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
9907  *                 p = <PyObject **> self.data
9908  *                 for i in range(self.len / itemsize):
9909  */
9910     }
9911 
9912     /* "View.MemoryView":171
9913  *         self.free_data = allocate_buffer
9914  *         self.dtype_is_object = format == b'O'
9915  *         if allocate_buffer:             # <<<<<<<<<<<<<<
9916  *
9917  *
9918  */
9919   }
9920 
9921   /* "View.MemoryView":122
9922  *         cdef bint dtype_is_object
9923  *
9924  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
9925  *                   mode="c", bint allocate_buffer=True):
9926  *
9927  */
9928 
9929   /* function exit code */
9930   __pyx_r = 0;
9931   goto __pyx_L0;
9932   __pyx_L1_error:;
9933   __Pyx_XDECREF(__pyx_t_3);
9934   __Pyx_XDECREF(__pyx_t_5);
9935   __Pyx_XDECREF(__pyx_t_6);
9936   __Pyx_XDECREF(__pyx_t_10);
9937   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9938   __pyx_r = -1;
9939   __pyx_L0:;
9940   __Pyx_XDECREF(__pyx_v_format);
9941   __Pyx_RefNannyFinishContext();
9942   return __pyx_r;
9943 }
9944 
9945 /* "View.MemoryView":185
9946  *
9947  *     @cname('getbuffer')
9948  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
9949  *         cdef int bufmode = -1
9950  *         if self.mode == u"c":
9951  */
9952 
9953 /* Python wrapper */
9954 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)9955 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
9956   int __pyx_r;
9957   __Pyx_RefNannyDeclarations
9958   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
9959   __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));
9960 
9961   /* function exit code */
9962   __Pyx_RefNannyFinishContext();
9963   return __pyx_r;
9964 }
9965 
__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)9966 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) {
9967   int __pyx_v_bufmode;
9968   int __pyx_r;
9969   __Pyx_RefNannyDeclarations
9970   int __pyx_t_1;
9971   int __pyx_t_2;
9972   PyObject *__pyx_t_3 = NULL;
9973   char *__pyx_t_4;
9974   Py_ssize_t __pyx_t_5;
9975   int __pyx_t_6;
9976   Py_ssize_t *__pyx_t_7;
9977   if (__pyx_v_info == NULL) {
9978     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
9979     return -1;
9980   }
9981   __Pyx_RefNannySetupContext("__getbuffer__", 0);
9982   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
9983   __Pyx_GIVEREF(__pyx_v_info->obj);
9984 
9985   /* "View.MemoryView":186
9986  *     @cname('getbuffer')
9987  *     def __getbuffer__(self, Py_buffer *info, int flags):
9988  *         cdef int bufmode = -1             # <<<<<<<<<<<<<<
9989  *         if self.mode == u"c":
9990  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
9991  */
9992   __pyx_v_bufmode = -1;
9993 
9994   /* "View.MemoryView":187
9995  *     def __getbuffer__(self, Py_buffer *info, int flags):
9996  *         cdef int bufmode = -1
9997  *         if self.mode == u"c":             # <<<<<<<<<<<<<<
9998  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
9999  *         elif self.mode == u"fortran":
10000  */
10001   __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 187, __pyx_L1_error)
10002   __pyx_t_2 = (__pyx_t_1 != 0);
10003   if (__pyx_t_2) {
10004 
10005     /* "View.MemoryView":188
10006  *         cdef int bufmode = -1
10007  *         if self.mode == u"c":
10008  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
10009  *         elif self.mode == u"fortran":
10010  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
10011  */
10012     __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
10013 
10014     /* "View.MemoryView":187
10015  *     def __getbuffer__(self, Py_buffer *info, int flags):
10016  *         cdef int bufmode = -1
10017  *         if self.mode == u"c":             # <<<<<<<<<<<<<<
10018  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
10019  *         elif self.mode == u"fortran":
10020  */
10021     goto __pyx_L3;
10022   }
10023 
10024   /* "View.MemoryView":189
10025  *         if self.mode == u"c":
10026  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
10027  *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
10028  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
10029  *         if not (flags & bufmode):
10030  */
10031   __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 189, __pyx_L1_error)
10032   __pyx_t_1 = (__pyx_t_2 != 0);
10033   if (__pyx_t_1) {
10034 
10035     /* "View.MemoryView":190
10036  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
10037  *         elif self.mode == u"fortran":
10038  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
10039  *         if not (flags & bufmode):
10040  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
10041  */
10042     __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
10043 
10044     /* "View.MemoryView":189
10045  *         if self.mode == u"c":
10046  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
10047  *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
10048  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
10049  *         if not (flags & bufmode):
10050  */
10051   }
10052   __pyx_L3:;
10053 
10054   /* "View.MemoryView":191
10055  *         elif self.mode == u"fortran":
10056  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
10057  *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
10058  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
10059  *         info.buf = self.data
10060  */
10061   __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
10062   if (unlikely(__pyx_t_1)) {
10063 
10064     /* "View.MemoryView":192
10065  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
10066  *         if not (flags & bufmode):
10067  *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
10068  *         info.buf = self.data
10069  *         info.len = self.len
10070  */
10071     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 192, __pyx_L1_error)
10072     __Pyx_GOTREF(__pyx_t_3);
10073     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
10074     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10075     __PYX_ERR(2, 192, __pyx_L1_error)
10076 
10077     /* "View.MemoryView":191
10078  *         elif self.mode == u"fortran":
10079  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
10080  *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
10081  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
10082  *         info.buf = self.data
10083  */
10084   }
10085 
10086   /* "View.MemoryView":193
10087  *         if not (flags & bufmode):
10088  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
10089  *         info.buf = self.data             # <<<<<<<<<<<<<<
10090  *         info.len = self.len
10091  *         info.ndim = self.ndim
10092  */
10093   __pyx_t_4 = __pyx_v_self->data;
10094   __pyx_v_info->buf = __pyx_t_4;
10095 
10096   /* "View.MemoryView":194
10097  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
10098  *         info.buf = self.data
10099  *         info.len = self.len             # <<<<<<<<<<<<<<
10100  *         info.ndim = self.ndim
10101  *         info.shape = self._shape
10102  */
10103   __pyx_t_5 = __pyx_v_self->len;
10104   __pyx_v_info->len = __pyx_t_5;
10105 
10106   /* "View.MemoryView":195
10107  *         info.buf = self.data
10108  *         info.len = self.len
10109  *         info.ndim = self.ndim             # <<<<<<<<<<<<<<
10110  *         info.shape = self._shape
10111  *         info.strides = self._strides
10112  */
10113   __pyx_t_6 = __pyx_v_self->ndim;
10114   __pyx_v_info->ndim = __pyx_t_6;
10115 
10116   /* "View.MemoryView":196
10117  *         info.len = self.len
10118  *         info.ndim = self.ndim
10119  *         info.shape = self._shape             # <<<<<<<<<<<<<<
10120  *         info.strides = self._strides
10121  *         info.suboffsets = NULL
10122  */
10123   __pyx_t_7 = __pyx_v_self->_shape;
10124   __pyx_v_info->shape = __pyx_t_7;
10125 
10126   /* "View.MemoryView":197
10127  *         info.ndim = self.ndim
10128  *         info.shape = self._shape
10129  *         info.strides = self._strides             # <<<<<<<<<<<<<<
10130  *         info.suboffsets = NULL
10131  *         info.itemsize = self.itemsize
10132  */
10133   __pyx_t_7 = __pyx_v_self->_strides;
10134   __pyx_v_info->strides = __pyx_t_7;
10135 
10136   /* "View.MemoryView":198
10137  *         info.shape = self._shape
10138  *         info.strides = self._strides
10139  *         info.suboffsets = NULL             # <<<<<<<<<<<<<<
10140  *         info.itemsize = self.itemsize
10141  *         info.readonly = 0
10142  */
10143   __pyx_v_info->suboffsets = NULL;
10144 
10145   /* "View.MemoryView":199
10146  *         info.strides = self._strides
10147  *         info.suboffsets = NULL
10148  *         info.itemsize = self.itemsize             # <<<<<<<<<<<<<<
10149  *         info.readonly = 0
10150  *
10151  */
10152   __pyx_t_5 = __pyx_v_self->itemsize;
10153   __pyx_v_info->itemsize = __pyx_t_5;
10154 
10155   /* "View.MemoryView":200
10156  *         info.suboffsets = NULL
10157  *         info.itemsize = self.itemsize
10158  *         info.readonly = 0             # <<<<<<<<<<<<<<
10159  *
10160  *         if flags & PyBUF_FORMAT:
10161  */
10162   __pyx_v_info->readonly = 0;
10163 
10164   /* "View.MemoryView":202
10165  *         info.readonly = 0
10166  *
10167  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
10168  *             info.format = self.format
10169  *         else:
10170  */
10171   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
10172   if (__pyx_t_1) {
10173 
10174     /* "View.MemoryView":203
10175  *
10176  *         if flags & PyBUF_FORMAT:
10177  *             info.format = self.format             # <<<<<<<<<<<<<<
10178  *         else:
10179  *             info.format = NULL
10180  */
10181     __pyx_t_4 = __pyx_v_self->format;
10182     __pyx_v_info->format = __pyx_t_4;
10183 
10184     /* "View.MemoryView":202
10185  *         info.readonly = 0
10186  *
10187  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
10188  *             info.format = self.format
10189  *         else:
10190  */
10191     goto __pyx_L5;
10192   }
10193 
10194   /* "View.MemoryView":205
10195  *             info.format = self.format
10196  *         else:
10197  *             info.format = NULL             # <<<<<<<<<<<<<<
10198  *
10199  *         info.obj = self
10200  */
10201   /*else*/ {
10202     __pyx_v_info->format = NULL;
10203   }
10204   __pyx_L5:;
10205 
10206   /* "View.MemoryView":207
10207  *             info.format = NULL
10208  *
10209  *         info.obj = self             # <<<<<<<<<<<<<<
10210  *
10211  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
10212  */
10213   __Pyx_INCREF(((PyObject *)__pyx_v_self));
10214   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
10215   __Pyx_GOTREF(__pyx_v_info->obj);
10216   __Pyx_DECREF(__pyx_v_info->obj);
10217   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
10218 
10219   /* "View.MemoryView":185
10220  *
10221  *     @cname('getbuffer')
10222  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
10223  *         cdef int bufmode = -1
10224  *         if self.mode == u"c":
10225  */
10226 
10227   /* function exit code */
10228   __pyx_r = 0;
10229   goto __pyx_L0;
10230   __pyx_L1_error:;
10231   __Pyx_XDECREF(__pyx_t_3);
10232   __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10233   __pyx_r = -1;
10234   if (__pyx_v_info->obj != NULL) {
10235     __Pyx_GOTREF(__pyx_v_info->obj);
10236     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
10237   }
10238   goto __pyx_L2;
10239   __pyx_L0:;
10240   if (__pyx_v_info->obj == Py_None) {
10241     __Pyx_GOTREF(__pyx_v_info->obj);
10242     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
10243   }
10244   __pyx_L2:;
10245   __Pyx_RefNannyFinishContext();
10246   return __pyx_r;
10247 }
10248 
10249 /* "View.MemoryView":211
10250  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
10251  *
10252  *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
10253  *         if self.callback_free_data != NULL:
10254  *             self.callback_free_data(self.data)
10255  */
10256 
10257 /* Python wrapper */
10258 static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_array___dealloc__(PyObject * __pyx_v_self)10259 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
10260   __Pyx_RefNannyDeclarations
10261   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
10262   __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));
10263 
10264   /* function exit code */
10265   __Pyx_RefNannyFinishContext();
10266 }
10267 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj * __pyx_v_self)10268 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
10269   __Pyx_RefNannyDeclarations
10270   int __pyx_t_1;
10271   __Pyx_RefNannySetupContext("__dealloc__", 0);
10272 
10273   /* "View.MemoryView":212
10274  *
10275  *     def __dealloc__(array self):
10276  *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
10277  *             self.callback_free_data(self.data)
10278  *         elif self.free_data:
10279  */
10280   __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
10281   if (__pyx_t_1) {
10282 
10283     /* "View.MemoryView":213
10284  *     def __dealloc__(array self):
10285  *         if self.callback_free_data != NULL:
10286  *             self.callback_free_data(self.data)             # <<<<<<<<<<<<<<
10287  *         elif self.free_data:
10288  *             if self.dtype_is_object:
10289  */
10290     __pyx_v_self->callback_free_data(__pyx_v_self->data);
10291 
10292     /* "View.MemoryView":212
10293  *
10294  *     def __dealloc__(array self):
10295  *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
10296  *             self.callback_free_data(self.data)
10297  *         elif self.free_data:
10298  */
10299     goto __pyx_L3;
10300   }
10301 
10302   /* "View.MemoryView":214
10303  *         if self.callback_free_data != NULL:
10304  *             self.callback_free_data(self.data)
10305  *         elif self.free_data:             # <<<<<<<<<<<<<<
10306  *             if self.dtype_is_object:
10307  *                 refcount_objects_in_slice(self.data, self._shape,
10308  */
10309   __pyx_t_1 = (__pyx_v_self->free_data != 0);
10310   if (__pyx_t_1) {
10311 
10312     /* "View.MemoryView":215
10313  *             self.callback_free_data(self.data)
10314  *         elif self.free_data:
10315  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
10316  *                 refcount_objects_in_slice(self.data, self._shape,
10317  *                                           self._strides, self.ndim, False)
10318  */
10319     __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
10320     if (__pyx_t_1) {
10321 
10322       /* "View.MemoryView":216
10323  *         elif self.free_data:
10324  *             if self.dtype_is_object:
10325  *                 refcount_objects_in_slice(self.data, self._shape,             # <<<<<<<<<<<<<<
10326  *                                           self._strides, self.ndim, False)
10327  *             free(self.data)
10328  */
10329       __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
10330 
10331       /* "View.MemoryView":215
10332  *             self.callback_free_data(self.data)
10333  *         elif self.free_data:
10334  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
10335  *                 refcount_objects_in_slice(self.data, self._shape,
10336  *                                           self._strides, self.ndim, False)
10337  */
10338     }
10339 
10340     /* "View.MemoryView":218
10341  *                 refcount_objects_in_slice(self.data, self._shape,
10342  *                                           self._strides, self.ndim, False)
10343  *             free(self.data)             # <<<<<<<<<<<<<<
10344  *         PyObject_Free(self._shape)
10345  *
10346  */
10347     free(__pyx_v_self->data);
10348 
10349     /* "View.MemoryView":214
10350  *         if self.callback_free_data != NULL:
10351  *             self.callback_free_data(self.data)
10352  *         elif self.free_data:             # <<<<<<<<<<<<<<
10353  *             if self.dtype_is_object:
10354  *                 refcount_objects_in_slice(self.data, self._shape,
10355  */
10356   }
10357   __pyx_L3:;
10358 
10359   /* "View.MemoryView":219
10360  *                                           self._strides, self.ndim, False)
10361  *             free(self.data)
10362  *         PyObject_Free(self._shape)             # <<<<<<<<<<<<<<
10363  *
10364  *     @property
10365  */
10366   PyObject_Free(__pyx_v_self->_shape);
10367 
10368   /* "View.MemoryView":211
10369  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
10370  *
10371  *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
10372  *         if self.callback_free_data != NULL:
10373  *             self.callback_free_data(self.data)
10374  */
10375 
10376   /* function exit code */
10377   __Pyx_RefNannyFinishContext();
10378 }
10379 
10380 /* "View.MemoryView":222
10381  *
10382  *     @property
10383  *     def memview(self):             # <<<<<<<<<<<<<<
10384  *         return self.get_memview()
10385  *
10386  */
10387 
10388 /* Python wrapper */
10389 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)10390 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
10391   PyObject *__pyx_r = 0;
10392   __Pyx_RefNannyDeclarations
10393   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
10394   __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));
10395 
10396   /* function exit code */
10397   __Pyx_RefNannyFinishContext();
10398   return __pyx_r;
10399 }
10400 
__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj * __pyx_v_self)10401 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
10402   PyObject *__pyx_r = NULL;
10403   __Pyx_RefNannyDeclarations
10404   PyObject *__pyx_t_1 = NULL;
10405   __Pyx_RefNannySetupContext("__get__", 0);
10406 
10407   /* "View.MemoryView":223
10408  *     @property
10409  *     def memview(self):
10410  *         return self.get_memview()             # <<<<<<<<<<<<<<
10411  *
10412  *     @cname('get_memview')
10413  */
10414   __Pyx_XDECREF(__pyx_r);
10415   __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 223, __pyx_L1_error)
10416   __Pyx_GOTREF(__pyx_t_1);
10417   __pyx_r = __pyx_t_1;
10418   __pyx_t_1 = 0;
10419   goto __pyx_L0;
10420 
10421   /* "View.MemoryView":222
10422  *
10423  *     @property
10424  *     def memview(self):             # <<<<<<<<<<<<<<
10425  *         return self.get_memview()
10426  *
10427  */
10428 
10429   /* function exit code */
10430   __pyx_L1_error:;
10431   __Pyx_XDECREF(__pyx_t_1);
10432   __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10433   __pyx_r = NULL;
10434   __pyx_L0:;
10435   __Pyx_XGIVEREF(__pyx_r);
10436   __Pyx_RefNannyFinishContext();
10437   return __pyx_r;
10438 }
10439 
10440 /* "View.MemoryView":226
10441  *
10442  *     @cname('get_memview')
10443  *     cdef get_memview(self):             # <<<<<<<<<<<<<<
10444  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
10445  *         return  memoryview(self, flags, self.dtype_is_object)
10446  */
10447 
__pyx_array_get_memview(struct __pyx_array_obj * __pyx_v_self)10448 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
10449   int __pyx_v_flags;
10450   PyObject *__pyx_r = NULL;
10451   __Pyx_RefNannyDeclarations
10452   PyObject *__pyx_t_1 = NULL;
10453   PyObject *__pyx_t_2 = NULL;
10454   PyObject *__pyx_t_3 = NULL;
10455   __Pyx_RefNannySetupContext("get_memview", 0);
10456 
10457   /* "View.MemoryView":227
10458  *     @cname('get_memview')
10459  *     cdef get_memview(self):
10460  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE             # <<<<<<<<<<<<<<
10461  *         return  memoryview(self, flags, self.dtype_is_object)
10462  *
10463  */
10464   __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
10465 
10466   /* "View.MemoryView":228
10467  *     cdef get_memview(self):
10468  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
10469  *         return  memoryview(self, flags, self.dtype_is_object)             # <<<<<<<<<<<<<<
10470  *
10471  *     def __len__(self):
10472  */
10473   __Pyx_XDECREF(__pyx_r);
10474   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __pyx_L1_error)
10475   __Pyx_GOTREF(__pyx_t_1);
10476   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error)
10477   __Pyx_GOTREF(__pyx_t_2);
10478   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 228, __pyx_L1_error)
10479   __Pyx_GOTREF(__pyx_t_3);
10480   __Pyx_INCREF(((PyObject *)__pyx_v_self));
10481   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
10482   PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
10483   __Pyx_GIVEREF(__pyx_t_1);
10484   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
10485   __Pyx_GIVEREF(__pyx_t_2);
10486   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
10487   __pyx_t_1 = 0;
10488   __pyx_t_2 = 0;
10489   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error)
10490   __Pyx_GOTREF(__pyx_t_2);
10491   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10492   __pyx_r = __pyx_t_2;
10493   __pyx_t_2 = 0;
10494   goto __pyx_L0;
10495 
10496   /* "View.MemoryView":226
10497  *
10498  *     @cname('get_memview')
10499  *     cdef get_memview(self):             # <<<<<<<<<<<<<<
10500  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
10501  *         return  memoryview(self, flags, self.dtype_is_object)
10502  */
10503 
10504   /* function exit code */
10505   __pyx_L1_error:;
10506   __Pyx_XDECREF(__pyx_t_1);
10507   __Pyx_XDECREF(__pyx_t_2);
10508   __Pyx_XDECREF(__pyx_t_3);
10509   __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
10510   __pyx_r = 0;
10511   __pyx_L0:;
10512   __Pyx_XGIVEREF(__pyx_r);
10513   __Pyx_RefNannyFinishContext();
10514   return __pyx_r;
10515 }
10516 
10517 /* "View.MemoryView":230
10518  *         return  memoryview(self, flags, self.dtype_is_object)
10519  *
10520  *     def __len__(self):             # <<<<<<<<<<<<<<
10521  *         return self._shape[0]
10522  *
10523  */
10524 
10525 /* Python wrapper */
10526 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
__pyx_array___len__(PyObject * __pyx_v_self)10527 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
10528   Py_ssize_t __pyx_r;
10529   __Pyx_RefNannyDeclarations
10530   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
10531   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));
10532 
10533   /* function exit code */
10534   __Pyx_RefNannyFinishContext();
10535   return __pyx_r;
10536 }
10537 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj * __pyx_v_self)10538 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
10539   Py_ssize_t __pyx_r;
10540   __Pyx_RefNannyDeclarations
10541   __Pyx_RefNannySetupContext("__len__", 0);
10542 
10543   /* "View.MemoryView":231
10544  *
10545  *     def __len__(self):
10546  *         return self._shape[0]             # <<<<<<<<<<<<<<
10547  *
10548  *     def __getattr__(self, attr):
10549  */
10550   __pyx_r = (__pyx_v_self->_shape[0]);
10551   goto __pyx_L0;
10552 
10553   /* "View.MemoryView":230
10554  *         return  memoryview(self, flags, self.dtype_is_object)
10555  *
10556  *     def __len__(self):             # <<<<<<<<<<<<<<
10557  *         return self._shape[0]
10558  *
10559  */
10560 
10561   /* function exit code */
10562   __pyx_L0:;
10563   __Pyx_RefNannyFinishContext();
10564   return __pyx_r;
10565 }
10566 
10567 /* "View.MemoryView":233
10568  *         return self._shape[0]
10569  *
10570  *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
10571  *         return getattr(self.memview, attr)
10572  *
10573  */
10574 
10575 /* Python wrapper */
10576 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)10577 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
10578   PyObject *__pyx_r = 0;
10579   __Pyx_RefNannyDeclarations
10580   __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
10581   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
10582 
10583   /* function exit code */
10584   __Pyx_RefNannyFinishContext();
10585   return __pyx_r;
10586 }
10587 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_attr)10588 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
10589   PyObject *__pyx_r = NULL;
10590   __Pyx_RefNannyDeclarations
10591   PyObject *__pyx_t_1 = NULL;
10592   PyObject *__pyx_t_2 = NULL;
10593   __Pyx_RefNannySetupContext("__getattr__", 0);
10594 
10595   /* "View.MemoryView":234
10596  *
10597  *     def __getattr__(self, attr):
10598  *         return getattr(self.memview, attr)             # <<<<<<<<<<<<<<
10599  *
10600  *     def __getitem__(self, item):
10601  */
10602   __Pyx_XDECREF(__pyx_r);
10603   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 234, __pyx_L1_error)
10604   __Pyx_GOTREF(__pyx_t_1);
10605   __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 234, __pyx_L1_error)
10606   __Pyx_GOTREF(__pyx_t_2);
10607   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10608   __pyx_r = __pyx_t_2;
10609   __pyx_t_2 = 0;
10610   goto __pyx_L0;
10611 
10612   /* "View.MemoryView":233
10613  *         return self._shape[0]
10614  *
10615  *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
10616  *         return getattr(self.memview, attr)
10617  *
10618  */
10619 
10620   /* function exit code */
10621   __pyx_L1_error:;
10622   __Pyx_XDECREF(__pyx_t_1);
10623   __Pyx_XDECREF(__pyx_t_2);
10624   __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10625   __pyx_r = NULL;
10626   __pyx_L0:;
10627   __Pyx_XGIVEREF(__pyx_r);
10628   __Pyx_RefNannyFinishContext();
10629   return __pyx_r;
10630 }
10631 
10632 /* "View.MemoryView":236
10633  *         return getattr(self.memview, attr)
10634  *
10635  *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
10636  *         return self.memview[item]
10637  *
10638  */
10639 
10640 /* Python wrapper */
10641 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)10642 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
10643   PyObject *__pyx_r = 0;
10644   __Pyx_RefNannyDeclarations
10645   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
10646   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
10647 
10648   /* function exit code */
10649   __Pyx_RefNannyFinishContext();
10650   return __pyx_r;
10651 }
10652 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_item)10653 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
10654   PyObject *__pyx_r = NULL;
10655   __Pyx_RefNannyDeclarations
10656   PyObject *__pyx_t_1 = NULL;
10657   PyObject *__pyx_t_2 = NULL;
10658   __Pyx_RefNannySetupContext("__getitem__", 0);
10659 
10660   /* "View.MemoryView":237
10661  *
10662  *     def __getitem__(self, item):
10663  *         return self.memview[item]             # <<<<<<<<<<<<<<
10664  *
10665  *     def __setitem__(self, item, value):
10666  */
10667   __Pyx_XDECREF(__pyx_r);
10668   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 237, __pyx_L1_error)
10669   __Pyx_GOTREF(__pyx_t_1);
10670   __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 237, __pyx_L1_error)
10671   __Pyx_GOTREF(__pyx_t_2);
10672   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10673   __pyx_r = __pyx_t_2;
10674   __pyx_t_2 = 0;
10675   goto __pyx_L0;
10676 
10677   /* "View.MemoryView":236
10678  *         return getattr(self.memview, attr)
10679  *
10680  *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
10681  *         return self.memview[item]
10682  *
10683  */
10684 
10685   /* function exit code */
10686   __pyx_L1_error:;
10687   __Pyx_XDECREF(__pyx_t_1);
10688   __Pyx_XDECREF(__pyx_t_2);
10689   __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10690   __pyx_r = NULL;
10691   __pyx_L0:;
10692   __Pyx_XGIVEREF(__pyx_r);
10693   __Pyx_RefNannyFinishContext();
10694   return __pyx_r;
10695 }
10696 
10697 /* "View.MemoryView":239
10698  *         return self.memview[item]
10699  *
10700  *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
10701  *         self.memview[item] = value
10702  *
10703  */
10704 
10705 /* Python wrapper */
10706 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)10707 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
10708   int __pyx_r;
10709   __Pyx_RefNannyDeclarations
10710   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
10711   __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));
10712 
10713   /* function exit code */
10714   __Pyx_RefNannyFinishContext();
10715   return __pyx_r;
10716 }
10717 
__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)10718 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) {
10719   int __pyx_r;
10720   __Pyx_RefNannyDeclarations
10721   PyObject *__pyx_t_1 = NULL;
10722   __Pyx_RefNannySetupContext("__setitem__", 0);
10723 
10724   /* "View.MemoryView":240
10725  *
10726  *     def __setitem__(self, item, value):
10727  *         self.memview[item] = value             # <<<<<<<<<<<<<<
10728  *
10729  *
10730  */
10731   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 240, __pyx_L1_error)
10732   __Pyx_GOTREF(__pyx_t_1);
10733   if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 240, __pyx_L1_error)
10734   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10735 
10736   /* "View.MemoryView":239
10737  *         return self.memview[item]
10738  *
10739  *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
10740  *         self.memview[item] = value
10741  *
10742  */
10743 
10744   /* function exit code */
10745   __pyx_r = 0;
10746   goto __pyx_L0;
10747   __pyx_L1_error:;
10748   __Pyx_XDECREF(__pyx_t_1);
10749   __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10750   __pyx_r = -1;
10751   __pyx_L0:;
10752   __Pyx_RefNannyFinishContext();
10753   return __pyx_r;
10754 }
10755 
10756 /* "(tree fragment)":1
10757  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
10758  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10759  * def __setstate_cython__(self, __pyx_state):
10760  */
10761 
10762 /* Python wrapper */
10763 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)10764 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
10765   PyObject *__pyx_r = 0;
10766   __Pyx_RefNannyDeclarations
10767   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
10768   __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));
10769 
10770   /* function exit code */
10771   __Pyx_RefNannyFinishContext();
10772   return __pyx_r;
10773 }
10774 
__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj * __pyx_v_self)10775 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
10776   PyObject *__pyx_r = NULL;
10777   __Pyx_RefNannyDeclarations
10778   PyObject *__pyx_t_1 = NULL;
10779   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
10780 
10781   /* "(tree fragment)":2
10782  * def __reduce_cython__(self):
10783  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
10784  * def __setstate_cython__(self, __pyx_state):
10785  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10786  */
10787   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
10788   __Pyx_GOTREF(__pyx_t_1);
10789   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
10790   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10791   __PYX_ERR(2, 2, __pyx_L1_error)
10792 
10793   /* "(tree fragment)":1
10794  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
10795  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10796  * def __setstate_cython__(self, __pyx_state):
10797  */
10798 
10799   /* function exit code */
10800   __pyx_L1_error:;
10801   __Pyx_XDECREF(__pyx_t_1);
10802   __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10803   __pyx_r = NULL;
10804   __Pyx_XGIVEREF(__pyx_r);
10805   __Pyx_RefNannyFinishContext();
10806   return __pyx_r;
10807 }
10808 
10809 /* "(tree fragment)":3
10810  * def __reduce_cython__(self):
10811  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10812  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
10813  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10814  */
10815 
10816 /* Python wrapper */
10817 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)10818 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
10819   PyObject *__pyx_r = 0;
10820   __Pyx_RefNannyDeclarations
10821   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
10822   __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
10823 
10824   /* function exit code */
10825   __Pyx_RefNannyFinishContext();
10826   return __pyx_r;
10827 }
10828 
__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)10829 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) {
10830   PyObject *__pyx_r = NULL;
10831   __Pyx_RefNannyDeclarations
10832   PyObject *__pyx_t_1 = NULL;
10833   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
10834 
10835   /* "(tree fragment)":4
10836  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10837  * def __setstate_cython__(self, __pyx_state):
10838  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
10839  */
10840   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
10841   __Pyx_GOTREF(__pyx_t_1);
10842   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
10843   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10844   __PYX_ERR(2, 4, __pyx_L1_error)
10845 
10846   /* "(tree fragment)":3
10847  * def __reduce_cython__(self):
10848  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10849  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
10850  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
10851  */
10852 
10853   /* function exit code */
10854   __pyx_L1_error:;
10855   __Pyx_XDECREF(__pyx_t_1);
10856   __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10857   __pyx_r = NULL;
10858   __Pyx_XGIVEREF(__pyx_r);
10859   __Pyx_RefNannyFinishContext();
10860   return __pyx_r;
10861 }
10862 
10863 /* "View.MemoryView":244
10864  *
10865  * @cname("__pyx_array_new")
10866  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
10867  *                           char *mode, char *buf):
10868  *     cdef array result
10869  */
10870 
__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)10871 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) {
10872   struct __pyx_array_obj *__pyx_v_result = 0;
10873   struct __pyx_array_obj *__pyx_r = NULL;
10874   __Pyx_RefNannyDeclarations
10875   int __pyx_t_1;
10876   PyObject *__pyx_t_2 = NULL;
10877   PyObject *__pyx_t_3 = NULL;
10878   PyObject *__pyx_t_4 = NULL;
10879   PyObject *__pyx_t_5 = NULL;
10880   __Pyx_RefNannySetupContext("array_cwrapper", 0);
10881 
10882   /* "View.MemoryView":248
10883  *     cdef array result
10884  *
10885  *     if buf == NULL:             # <<<<<<<<<<<<<<
10886  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
10887  *     else:
10888  */
10889   __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
10890   if (__pyx_t_1) {
10891 
10892     /* "View.MemoryView":249
10893  *
10894  *     if buf == NULL:
10895  *         result = array(shape, itemsize, format, mode.decode('ASCII'))             # <<<<<<<<<<<<<<
10896  *     else:
10897  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
10898  */
10899     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 249, __pyx_L1_error)
10900     __Pyx_GOTREF(__pyx_t_2);
10901     __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 249, __pyx_L1_error)
10902     __Pyx_GOTREF(__pyx_t_3);
10903     __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error)
10904     __Pyx_GOTREF(__pyx_t_4);
10905     __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 249, __pyx_L1_error)
10906     __Pyx_GOTREF(__pyx_t_5);
10907     __Pyx_INCREF(__pyx_v_shape);
10908     __Pyx_GIVEREF(__pyx_v_shape);
10909     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
10910     __Pyx_GIVEREF(__pyx_t_2);
10911     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
10912     __Pyx_GIVEREF(__pyx_t_3);
10913     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
10914     __Pyx_GIVEREF(__pyx_t_4);
10915     PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
10916     __pyx_t_2 = 0;
10917     __pyx_t_3 = 0;
10918     __pyx_t_4 = 0;
10919     __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error)
10920     __Pyx_GOTREF(__pyx_t_4);
10921     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10922     __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
10923     __pyx_t_4 = 0;
10924 
10925     /* "View.MemoryView":248
10926  *     cdef array result
10927  *
10928  *     if buf == NULL:             # <<<<<<<<<<<<<<
10929  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
10930  *     else:
10931  */
10932     goto __pyx_L3;
10933   }
10934 
10935   /* "View.MemoryView":251
10936  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
10937  *     else:
10938  *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
10939  *                        allocate_buffer=False)
10940  *         result.data = buf
10941  */
10942   /*else*/ {
10943     __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 251, __pyx_L1_error)
10944     __Pyx_GOTREF(__pyx_t_4);
10945     __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error)
10946     __Pyx_GOTREF(__pyx_t_5);
10947     __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 251, __pyx_L1_error)
10948     __Pyx_GOTREF(__pyx_t_3);
10949     __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 251, __pyx_L1_error)
10950     __Pyx_GOTREF(__pyx_t_2);
10951     __Pyx_INCREF(__pyx_v_shape);
10952     __Pyx_GIVEREF(__pyx_v_shape);
10953     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
10954     __Pyx_GIVEREF(__pyx_t_4);
10955     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
10956     __Pyx_GIVEREF(__pyx_t_5);
10957     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
10958     __Pyx_GIVEREF(__pyx_t_3);
10959     PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
10960     __pyx_t_4 = 0;
10961     __pyx_t_5 = 0;
10962     __pyx_t_3 = 0;
10963 
10964     /* "View.MemoryView":252
10965  *     else:
10966  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
10967  *                        allocate_buffer=False)             # <<<<<<<<<<<<<<
10968  *         result.data = buf
10969  *
10970  */
10971     __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error)
10972     __Pyx_GOTREF(__pyx_t_3);
10973     if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 252, __pyx_L1_error)
10974 
10975     /* "View.MemoryView":251
10976  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
10977  *     else:
10978  *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
10979  *                        allocate_buffer=False)
10980  *         result.data = buf
10981  */
10982     __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error)
10983     __Pyx_GOTREF(__pyx_t_5);
10984     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10985     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10986     __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
10987     __pyx_t_5 = 0;
10988 
10989     /* "View.MemoryView":253
10990  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
10991  *                        allocate_buffer=False)
10992  *         result.data = buf             # <<<<<<<<<<<<<<
10993  *
10994  *     return result
10995  */
10996     __pyx_v_result->data = __pyx_v_buf;
10997   }
10998   __pyx_L3:;
10999 
11000   /* "View.MemoryView":255
11001  *         result.data = buf
11002  *
11003  *     return result             # <<<<<<<<<<<<<<
11004  *
11005  *
11006  */
11007   __Pyx_XDECREF(((PyObject *)__pyx_r));
11008   __Pyx_INCREF(((PyObject *)__pyx_v_result));
11009   __pyx_r = __pyx_v_result;
11010   goto __pyx_L0;
11011 
11012   /* "View.MemoryView":244
11013  *
11014  * @cname("__pyx_array_new")
11015  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
11016  *                           char *mode, char *buf):
11017  *     cdef array result
11018  */
11019 
11020   /* function exit code */
11021   __pyx_L1_error:;
11022   __Pyx_XDECREF(__pyx_t_2);
11023   __Pyx_XDECREF(__pyx_t_3);
11024   __Pyx_XDECREF(__pyx_t_4);
11025   __Pyx_XDECREF(__pyx_t_5);
11026   __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
11027   __pyx_r = 0;
11028   __pyx_L0:;
11029   __Pyx_XDECREF((PyObject *)__pyx_v_result);
11030   __Pyx_XGIVEREF((PyObject *)__pyx_r);
11031   __Pyx_RefNannyFinishContext();
11032   return __pyx_r;
11033 }
11034 
11035 /* "View.MemoryView":281
11036  * cdef class Enum(object):
11037  *     cdef object name
11038  *     def __init__(self, name):             # <<<<<<<<<<<<<<
11039  *         self.name = name
11040  *     def __repr__(self):
11041  */
11042 
11043 /* Python wrapper */
11044 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)11045 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11046   PyObject *__pyx_v_name = 0;
11047   int __pyx_r;
11048   __Pyx_RefNannyDeclarations
11049   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
11050   {
11051     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
11052     PyObject* values[1] = {0};
11053     if (unlikely(__pyx_kwds)) {
11054       Py_ssize_t kw_args;
11055       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11056       switch (pos_args) {
11057         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11058         CYTHON_FALLTHROUGH;
11059         case  0: break;
11060         default: goto __pyx_L5_argtuple_error;
11061       }
11062       kw_args = PyDict_Size(__pyx_kwds);
11063       switch (pos_args) {
11064         case  0:
11065         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
11066         else goto __pyx_L5_argtuple_error;
11067       }
11068       if (unlikely(kw_args > 0)) {
11069         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 281, __pyx_L3_error)
11070       }
11071     } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
11072       goto __pyx_L5_argtuple_error;
11073     } else {
11074       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11075     }
11076     __pyx_v_name = values[0];
11077   }
11078   goto __pyx_L4_argument_unpacking_done;
11079   __pyx_L5_argtuple_error:;
11080   __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 281, __pyx_L3_error)
11081   __pyx_L3_error:;
11082   __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11083   __Pyx_RefNannyFinishContext();
11084   return -1;
11085   __pyx_L4_argument_unpacking_done:;
11086   __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
11087 
11088   /* function exit code */
11089   __Pyx_RefNannyFinishContext();
11090   return __pyx_r;
11091 }
11092 
__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj * __pyx_v_self,PyObject * __pyx_v_name)11093 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
11094   int __pyx_r;
11095   __Pyx_RefNannyDeclarations
11096   __Pyx_RefNannySetupContext("__init__", 0);
11097 
11098   /* "View.MemoryView":282
11099  *     cdef object name
11100  *     def __init__(self, name):
11101  *         self.name = name             # <<<<<<<<<<<<<<
11102  *     def __repr__(self):
11103  *         return self.name
11104  */
11105   __Pyx_INCREF(__pyx_v_name);
11106   __Pyx_GIVEREF(__pyx_v_name);
11107   __Pyx_GOTREF(__pyx_v_self->name);
11108   __Pyx_DECREF(__pyx_v_self->name);
11109   __pyx_v_self->name = __pyx_v_name;
11110 
11111   /* "View.MemoryView":281
11112  * cdef class Enum(object):
11113  *     cdef object name
11114  *     def __init__(self, name):             # <<<<<<<<<<<<<<
11115  *         self.name = name
11116  *     def __repr__(self):
11117  */
11118 
11119   /* function exit code */
11120   __pyx_r = 0;
11121   __Pyx_RefNannyFinishContext();
11122   return __pyx_r;
11123 }
11124 
11125 /* "View.MemoryView":283
11126  *     def __init__(self, name):
11127  *         self.name = name
11128  *     def __repr__(self):             # <<<<<<<<<<<<<<
11129  *         return self.name
11130  *
11131  */
11132 
11133 /* Python wrapper */
11134 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_MemviewEnum___repr__(PyObject * __pyx_v_self)11135 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
11136   PyObject *__pyx_r = 0;
11137   __Pyx_RefNannyDeclarations
11138   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
11139   __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
11140 
11141   /* function exit code */
11142   __Pyx_RefNannyFinishContext();
11143   return __pyx_r;
11144 }
11145 
__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj * __pyx_v_self)11146 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
11147   PyObject *__pyx_r = NULL;
11148   __Pyx_RefNannyDeclarations
11149   __Pyx_RefNannySetupContext("__repr__", 0);
11150 
11151   /* "View.MemoryView":284
11152  *         self.name = name
11153  *     def __repr__(self):
11154  *         return self.name             # <<<<<<<<<<<<<<
11155  *
11156  * cdef generic = Enum("<strided and direct or indirect>")
11157  */
11158   __Pyx_XDECREF(__pyx_r);
11159   __Pyx_INCREF(__pyx_v_self->name);
11160   __pyx_r = __pyx_v_self->name;
11161   goto __pyx_L0;
11162 
11163   /* "View.MemoryView":283
11164  *     def __init__(self, name):
11165  *         self.name = name
11166  *     def __repr__(self):             # <<<<<<<<<<<<<<
11167  *         return self.name
11168  *
11169  */
11170 
11171   /* function exit code */
11172   __pyx_L0:;
11173   __Pyx_XGIVEREF(__pyx_r);
11174   __Pyx_RefNannyFinishContext();
11175   return __pyx_r;
11176 }
11177 
11178 /* "(tree fragment)":1
11179  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
11180  *     cdef tuple state
11181  *     cdef object _dict
11182  */
11183 
11184 /* Python wrapper */
11185 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)11186 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11187   PyObject *__pyx_r = 0;
11188   __Pyx_RefNannyDeclarations
11189   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
11190   __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
11191 
11192   /* function exit code */
11193   __Pyx_RefNannyFinishContext();
11194   return __pyx_r;
11195 }
11196 
__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj * __pyx_v_self)11197 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
11198   PyObject *__pyx_v_state = 0;
11199   PyObject *__pyx_v__dict = 0;
11200   int __pyx_v_use_setstate;
11201   PyObject *__pyx_r = NULL;
11202   __Pyx_RefNannyDeclarations
11203   PyObject *__pyx_t_1 = NULL;
11204   int __pyx_t_2;
11205   int __pyx_t_3;
11206   PyObject *__pyx_t_4 = NULL;
11207   PyObject *__pyx_t_5 = NULL;
11208   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
11209 
11210   /* "(tree fragment)":5
11211  *     cdef object _dict
11212  *     cdef bint use_setstate
11213  *     state = (self.name,)             # <<<<<<<<<<<<<<
11214  *     _dict = getattr(self, '__dict__', None)
11215  *     if _dict is not None:
11216  */
11217   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
11218   __Pyx_GOTREF(__pyx_t_1);
11219   __Pyx_INCREF(__pyx_v_self->name);
11220   __Pyx_GIVEREF(__pyx_v_self->name);
11221   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
11222   __pyx_v_state = ((PyObject*)__pyx_t_1);
11223   __pyx_t_1 = 0;
11224 
11225   /* "(tree fragment)":6
11226  *     cdef bint use_setstate
11227  *     state = (self.name,)
11228  *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
11229  *     if _dict is not None:
11230  *         state += (_dict,)
11231  */
11232   __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error)
11233   __Pyx_GOTREF(__pyx_t_1);
11234   __pyx_v__dict = __pyx_t_1;
11235   __pyx_t_1 = 0;
11236 
11237   /* "(tree fragment)":7
11238  *     state = (self.name,)
11239  *     _dict = getattr(self, '__dict__', None)
11240  *     if _dict is not None:             # <<<<<<<<<<<<<<
11241  *         state += (_dict,)
11242  *         use_setstate = True
11243  */
11244   __pyx_t_2 = (__pyx_v__dict != Py_None);
11245   __pyx_t_3 = (__pyx_t_2 != 0);
11246   if (__pyx_t_3) {
11247 
11248     /* "(tree fragment)":8
11249  *     _dict = getattr(self, '__dict__', None)
11250  *     if _dict is not None:
11251  *         state += (_dict,)             # <<<<<<<<<<<<<<
11252  *         use_setstate = True
11253  *     else:
11254  */
11255     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error)
11256     __Pyx_GOTREF(__pyx_t_1);
11257     __Pyx_INCREF(__pyx_v__dict);
11258     __Pyx_GIVEREF(__pyx_v__dict);
11259     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
11260     __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error)
11261     __Pyx_GOTREF(__pyx_t_4);
11262     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11263     __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
11264     __pyx_t_4 = 0;
11265 
11266     /* "(tree fragment)":9
11267  *     if _dict is not None:
11268  *         state += (_dict,)
11269  *         use_setstate = True             # <<<<<<<<<<<<<<
11270  *     else:
11271  *         use_setstate = self.name is not None
11272  */
11273     __pyx_v_use_setstate = 1;
11274 
11275     /* "(tree fragment)":7
11276  *     state = (self.name,)
11277  *     _dict = getattr(self, '__dict__', None)
11278  *     if _dict is not None:             # <<<<<<<<<<<<<<
11279  *         state += (_dict,)
11280  *         use_setstate = True
11281  */
11282     goto __pyx_L3;
11283   }
11284 
11285   /* "(tree fragment)":11
11286  *         use_setstate = True
11287  *     else:
11288  *         use_setstate = self.name is not None             # <<<<<<<<<<<<<<
11289  *     if use_setstate:
11290  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
11291  */
11292   /*else*/ {
11293     __pyx_t_3 = (__pyx_v_self->name != Py_None);
11294     __pyx_v_use_setstate = __pyx_t_3;
11295   }
11296   __pyx_L3:;
11297 
11298   /* "(tree fragment)":12
11299  *     else:
11300  *         use_setstate = self.name is not None
11301  *     if use_setstate:             # <<<<<<<<<<<<<<
11302  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
11303  *     else:
11304  */
11305   __pyx_t_3 = (__pyx_v_use_setstate != 0);
11306   if (__pyx_t_3) {
11307 
11308     /* "(tree fragment)":13
11309  *         use_setstate = self.name is not None
11310  *     if use_setstate:
11311  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state             # <<<<<<<<<<<<<<
11312  *     else:
11313  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
11314  */
11315     __Pyx_XDECREF(__pyx_r);
11316     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error)
11317     __Pyx_GOTREF(__pyx_t_4);
11318     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error)
11319     __Pyx_GOTREF(__pyx_t_1);
11320     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
11321     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
11322     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
11323     __Pyx_INCREF(__pyx_int_184977713);
11324     __Pyx_GIVEREF(__pyx_int_184977713);
11325     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
11326     __Pyx_INCREF(Py_None);
11327     __Pyx_GIVEREF(Py_None);
11328     PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
11329     __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error)
11330     __Pyx_GOTREF(__pyx_t_5);
11331     __Pyx_GIVEREF(__pyx_t_4);
11332     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
11333     __Pyx_GIVEREF(__pyx_t_1);
11334     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
11335     __Pyx_INCREF(__pyx_v_state);
11336     __Pyx_GIVEREF(__pyx_v_state);
11337     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
11338     __pyx_t_4 = 0;
11339     __pyx_t_1 = 0;
11340     __pyx_r = __pyx_t_5;
11341     __pyx_t_5 = 0;
11342     goto __pyx_L0;
11343 
11344     /* "(tree fragment)":12
11345  *     else:
11346  *         use_setstate = self.name is not None
11347  *     if use_setstate:             # <<<<<<<<<<<<<<
11348  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
11349  *     else:
11350  */
11351   }
11352 
11353   /* "(tree fragment)":15
11354  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
11355  *     else:
11356  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)             # <<<<<<<<<<<<<<
11357  * def __setstate_cython__(self, __pyx_state):
11358  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
11359  */
11360   /*else*/ {
11361     __Pyx_XDECREF(__pyx_r);
11362     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error)
11363     __Pyx_GOTREF(__pyx_t_5);
11364     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error)
11365     __Pyx_GOTREF(__pyx_t_1);
11366     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
11367     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
11368     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
11369     __Pyx_INCREF(__pyx_int_184977713);
11370     __Pyx_GIVEREF(__pyx_int_184977713);
11371     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
11372     __Pyx_INCREF(__pyx_v_state);
11373     __Pyx_GIVEREF(__pyx_v_state);
11374     PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
11375     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error)
11376     __Pyx_GOTREF(__pyx_t_4);
11377     __Pyx_GIVEREF(__pyx_t_5);
11378     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
11379     __Pyx_GIVEREF(__pyx_t_1);
11380     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
11381     __pyx_t_5 = 0;
11382     __pyx_t_1 = 0;
11383     __pyx_r = __pyx_t_4;
11384     __pyx_t_4 = 0;
11385     goto __pyx_L0;
11386   }
11387 
11388   /* "(tree fragment)":1
11389  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
11390  *     cdef tuple state
11391  *     cdef object _dict
11392  */
11393 
11394   /* function exit code */
11395   __pyx_L1_error:;
11396   __Pyx_XDECREF(__pyx_t_1);
11397   __Pyx_XDECREF(__pyx_t_4);
11398   __Pyx_XDECREF(__pyx_t_5);
11399   __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11400   __pyx_r = NULL;
11401   __pyx_L0:;
11402   __Pyx_XDECREF(__pyx_v_state);
11403   __Pyx_XDECREF(__pyx_v__dict);
11404   __Pyx_XGIVEREF(__pyx_r);
11405   __Pyx_RefNannyFinishContext();
11406   return __pyx_r;
11407 }
11408 
11409 /* "(tree fragment)":16
11410  *     else:
11411  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
11412  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
11413  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
11414  */
11415 
11416 /* Python wrapper */
11417 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)11418 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
11419   PyObject *__pyx_r = 0;
11420   __Pyx_RefNannyDeclarations
11421   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
11422   __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
11423 
11424   /* function exit code */
11425   __Pyx_RefNannyFinishContext();
11426   return __pyx_r;
11427 }
11428 
__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj * __pyx_v_self,PyObject * __pyx_v___pyx_state)11429 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
11430   PyObject *__pyx_r = NULL;
11431   __Pyx_RefNannyDeclarations
11432   PyObject *__pyx_t_1 = NULL;
11433   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
11434 
11435   /* "(tree fragment)":17
11436  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
11437  * def __setstate_cython__(self, __pyx_state):
11438  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
11439  */
11440   if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 17, __pyx_L1_error)
11441   __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error)
11442   __Pyx_GOTREF(__pyx_t_1);
11443   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11444 
11445   /* "(tree fragment)":16
11446  *     else:
11447  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
11448  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
11449  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
11450  */
11451 
11452   /* function exit code */
11453   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11454   goto __pyx_L0;
11455   __pyx_L1_error:;
11456   __Pyx_XDECREF(__pyx_t_1);
11457   __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11458   __pyx_r = NULL;
11459   __pyx_L0:;
11460   __Pyx_XGIVEREF(__pyx_r);
11461   __Pyx_RefNannyFinishContext();
11462   return __pyx_r;
11463 }
11464 
11465 /* "View.MemoryView":298
11466  *
11467  * @cname('__pyx_align_pointer')
11468  * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
11469  *     "Align pointer memory on a given boundary"
11470  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
11471  */
11472 
__pyx_align_pointer(void * __pyx_v_memory,size_t __pyx_v_alignment)11473 static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
11474   Py_intptr_t __pyx_v_aligned_p;
11475   size_t __pyx_v_offset;
11476   void *__pyx_r;
11477   int __pyx_t_1;
11478 
11479   /* "View.MemoryView":300
11480  * cdef void *align_pointer(void *memory, size_t alignment) nogil:
11481  *     "Align pointer memory on a given boundary"
11482  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory             # <<<<<<<<<<<<<<
11483  *     cdef size_t offset
11484  *
11485  */
11486   __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
11487 
11488   /* "View.MemoryView":304
11489  *
11490  *     with cython.cdivision(True):
11491  *         offset = aligned_p % alignment             # <<<<<<<<<<<<<<
11492  *
11493  *     if offset > 0:
11494  */
11495   __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
11496 
11497   /* "View.MemoryView":306
11498  *         offset = aligned_p % alignment
11499  *
11500  *     if offset > 0:             # <<<<<<<<<<<<<<
11501  *         aligned_p += alignment - offset
11502  *
11503  */
11504   __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
11505   if (__pyx_t_1) {
11506 
11507     /* "View.MemoryView":307
11508  *
11509  *     if offset > 0:
11510  *         aligned_p += alignment - offset             # <<<<<<<<<<<<<<
11511  *
11512  *     return <void *> aligned_p
11513  */
11514     __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
11515 
11516     /* "View.MemoryView":306
11517  *         offset = aligned_p % alignment
11518  *
11519  *     if offset > 0:             # <<<<<<<<<<<<<<
11520  *         aligned_p += alignment - offset
11521  *
11522  */
11523   }
11524 
11525   /* "View.MemoryView":309
11526  *         aligned_p += alignment - offset
11527  *
11528  *     return <void *> aligned_p             # <<<<<<<<<<<<<<
11529  *
11530  *
11531  */
11532   __pyx_r = ((void *)__pyx_v_aligned_p);
11533   goto __pyx_L0;
11534 
11535   /* "View.MemoryView":298
11536  *
11537  * @cname('__pyx_align_pointer')
11538  * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
11539  *     "Align pointer memory on a given boundary"
11540  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
11541  */
11542 
11543   /* function exit code */
11544   __pyx_L0:;
11545   return __pyx_r;
11546 }
11547 
11548 /* "View.MemoryView":345
11549  *     cdef __Pyx_TypeInfo *typeinfo
11550  *
11551  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
11552  *         self.obj = obj
11553  *         self.flags = flags
11554  */
11555 
11556 /* Python wrapper */
11557 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)11558 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11559   PyObject *__pyx_v_obj = 0;
11560   int __pyx_v_flags;
11561   int __pyx_v_dtype_is_object;
11562   int __pyx_r;
11563   __Pyx_RefNannyDeclarations
11564   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
11565   {
11566     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
11567     PyObject* values[3] = {0,0,0};
11568     if (unlikely(__pyx_kwds)) {
11569       Py_ssize_t kw_args;
11570       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11571       switch (pos_args) {
11572         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11573         CYTHON_FALLTHROUGH;
11574         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11575         CYTHON_FALLTHROUGH;
11576         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11577         CYTHON_FALLTHROUGH;
11578         case  0: break;
11579         default: goto __pyx_L5_argtuple_error;
11580       }
11581       kw_args = PyDict_Size(__pyx_kwds);
11582       switch (pos_args) {
11583         case  0:
11584         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
11585         else goto __pyx_L5_argtuple_error;
11586         CYTHON_FALLTHROUGH;
11587         case  1:
11588         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
11589         else {
11590           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 345, __pyx_L3_error)
11591         }
11592         CYTHON_FALLTHROUGH;
11593         case  2:
11594         if (kw_args > 0) {
11595           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
11596           if (value) { values[2] = value; kw_args--; }
11597         }
11598       }
11599       if (unlikely(kw_args > 0)) {
11600         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 345, __pyx_L3_error)
11601       }
11602     } else {
11603       switch (PyTuple_GET_SIZE(__pyx_args)) {
11604         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11605         CYTHON_FALLTHROUGH;
11606         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11607         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11608         break;
11609         default: goto __pyx_L5_argtuple_error;
11610       }
11611     }
11612     __pyx_v_obj = values[0];
11613     __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __pyx_L3_error)
11614     if (values[2]) {
11615       __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __pyx_L3_error)
11616     } else {
11617       __pyx_v_dtype_is_object = ((int)0);
11618     }
11619   }
11620   goto __pyx_L4_argument_unpacking_done;
11621   __pyx_L5_argtuple_error:;
11622   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 345, __pyx_L3_error)
11623   __pyx_L3_error:;
11624   __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11625   __Pyx_RefNannyFinishContext();
11626   return -1;
11627   __pyx_L4_argument_unpacking_done:;
11628   __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);
11629 
11630   /* function exit code */
11631   __Pyx_RefNannyFinishContext();
11632   return __pyx_r;
11633 }
11634 
__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)11635 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) {
11636   int __pyx_r;
11637   __Pyx_RefNannyDeclarations
11638   int __pyx_t_1;
11639   int __pyx_t_2;
11640   int __pyx_t_3;
11641   int __pyx_t_4;
11642   __Pyx_RefNannySetupContext("__cinit__", 0);
11643 
11644   /* "View.MemoryView":346
11645  *
11646  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
11647  *         self.obj = obj             # <<<<<<<<<<<<<<
11648  *         self.flags = flags
11649  *         if type(self) is memoryview or obj is not None:
11650  */
11651   __Pyx_INCREF(__pyx_v_obj);
11652   __Pyx_GIVEREF(__pyx_v_obj);
11653   __Pyx_GOTREF(__pyx_v_self->obj);
11654   __Pyx_DECREF(__pyx_v_self->obj);
11655   __pyx_v_self->obj = __pyx_v_obj;
11656 
11657   /* "View.MemoryView":347
11658  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
11659  *         self.obj = obj
11660  *         self.flags = flags             # <<<<<<<<<<<<<<
11661  *         if type(self) is memoryview or obj is not None:
11662  *             __Pyx_GetBuffer(obj, &self.view, flags)
11663  */
11664   __pyx_v_self->flags = __pyx_v_flags;
11665 
11666   /* "View.MemoryView":348
11667  *         self.obj = obj
11668  *         self.flags = flags
11669  *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
11670  *             __Pyx_GetBuffer(obj, &self.view, flags)
11671  *             if <PyObject *> self.view.obj == NULL:
11672  */
11673   __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
11674   __pyx_t_3 = (__pyx_t_2 != 0);
11675   if (!__pyx_t_3) {
11676   } else {
11677     __pyx_t_1 = __pyx_t_3;
11678     goto __pyx_L4_bool_binop_done;
11679   }
11680   __pyx_t_3 = (__pyx_v_obj != Py_None);
11681   __pyx_t_2 = (__pyx_t_3 != 0);
11682   __pyx_t_1 = __pyx_t_2;
11683   __pyx_L4_bool_binop_done:;
11684   if (__pyx_t_1) {
11685 
11686     /* "View.MemoryView":349
11687  *         self.flags = flags
11688  *         if type(self) is memoryview or obj is not None:
11689  *             __Pyx_GetBuffer(obj, &self.view, flags)             # <<<<<<<<<<<<<<
11690  *             if <PyObject *> self.view.obj == NULL:
11691  *                 (<__pyx_buffer *> &self.view).obj = Py_None
11692  */
11693     __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 349, __pyx_L1_error)
11694 
11695     /* "View.MemoryView":350
11696  *         if type(self) is memoryview or obj is not None:
11697  *             __Pyx_GetBuffer(obj, &self.view, flags)
11698  *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
11699  *                 (<__pyx_buffer *> &self.view).obj = Py_None
11700  *                 Py_INCREF(Py_None)
11701  */
11702     __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
11703     if (__pyx_t_1) {
11704 
11705       /* "View.MemoryView":351
11706  *             __Pyx_GetBuffer(obj, &self.view, flags)
11707  *             if <PyObject *> self.view.obj == NULL:
11708  *                 (<__pyx_buffer *> &self.view).obj = Py_None             # <<<<<<<<<<<<<<
11709  *                 Py_INCREF(Py_None)
11710  *
11711  */
11712       ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
11713 
11714       /* "View.MemoryView":352
11715  *             if <PyObject *> self.view.obj == NULL:
11716  *                 (<__pyx_buffer *> &self.view).obj = Py_None
11717  *                 Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
11718  *
11719  *         global __pyx_memoryview_thread_locks_used
11720  */
11721       Py_INCREF(Py_None);
11722 
11723       /* "View.MemoryView":350
11724  *         if type(self) is memoryview or obj is not None:
11725  *             __Pyx_GetBuffer(obj, &self.view, flags)
11726  *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
11727  *                 (<__pyx_buffer *> &self.view).obj = Py_None
11728  *                 Py_INCREF(Py_None)
11729  */
11730     }
11731 
11732     /* "View.MemoryView":348
11733  *         self.obj = obj
11734  *         self.flags = flags
11735  *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
11736  *             __Pyx_GetBuffer(obj, &self.view, flags)
11737  *             if <PyObject *> self.view.obj == NULL:
11738  */
11739   }
11740 
11741   /* "View.MemoryView":355
11742  *
11743  *         global __pyx_memoryview_thread_locks_used
11744  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
11745  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
11746  *             __pyx_memoryview_thread_locks_used += 1
11747  */
11748   __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
11749   if (__pyx_t_1) {
11750 
11751     /* "View.MemoryView":356
11752  *         global __pyx_memoryview_thread_locks_used
11753  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
11754  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]             # <<<<<<<<<<<<<<
11755  *             __pyx_memoryview_thread_locks_used += 1
11756  *         if self.lock is NULL:
11757  */
11758     __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
11759 
11760     /* "View.MemoryView":357
11761  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
11762  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
11763  *             __pyx_memoryview_thread_locks_used += 1             # <<<<<<<<<<<<<<
11764  *         if self.lock is NULL:
11765  *             self.lock = PyThread_allocate_lock()
11766  */
11767     __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
11768 
11769     /* "View.MemoryView":355
11770  *
11771  *         global __pyx_memoryview_thread_locks_used
11772  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
11773  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
11774  *             __pyx_memoryview_thread_locks_used += 1
11775  */
11776   }
11777 
11778   /* "View.MemoryView":358
11779  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
11780  *             __pyx_memoryview_thread_locks_used += 1
11781  *         if self.lock is NULL:             # <<<<<<<<<<<<<<
11782  *             self.lock = PyThread_allocate_lock()
11783  *             if self.lock is NULL:
11784  */
11785   __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
11786   if (__pyx_t_1) {
11787 
11788     /* "View.MemoryView":359
11789  *             __pyx_memoryview_thread_locks_used += 1
11790  *         if self.lock is NULL:
11791  *             self.lock = PyThread_allocate_lock()             # <<<<<<<<<<<<<<
11792  *             if self.lock is NULL:
11793  *                 raise MemoryError
11794  */
11795     __pyx_v_self->lock = PyThread_allocate_lock();
11796 
11797     /* "View.MemoryView":360
11798  *         if self.lock is NULL:
11799  *             self.lock = PyThread_allocate_lock()
11800  *             if self.lock is NULL:             # <<<<<<<<<<<<<<
11801  *                 raise MemoryError
11802  *
11803  */
11804     __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
11805     if (unlikely(__pyx_t_1)) {
11806 
11807       /* "View.MemoryView":361
11808  *             self.lock = PyThread_allocate_lock()
11809  *             if self.lock is NULL:
11810  *                 raise MemoryError             # <<<<<<<<<<<<<<
11811  *
11812  *         if flags & PyBUF_FORMAT:
11813  */
11814       PyErr_NoMemory(); __PYX_ERR(2, 361, __pyx_L1_error)
11815 
11816       /* "View.MemoryView":360
11817  *         if self.lock is NULL:
11818  *             self.lock = PyThread_allocate_lock()
11819  *             if self.lock is NULL:             # <<<<<<<<<<<<<<
11820  *                 raise MemoryError
11821  *
11822  */
11823     }
11824 
11825     /* "View.MemoryView":358
11826  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
11827  *             __pyx_memoryview_thread_locks_used += 1
11828  *         if self.lock is NULL:             # <<<<<<<<<<<<<<
11829  *             self.lock = PyThread_allocate_lock()
11830  *             if self.lock is NULL:
11831  */
11832   }
11833 
11834   /* "View.MemoryView":363
11835  *                 raise MemoryError
11836  *
11837  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
11838  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
11839  *         else:
11840  */
11841   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
11842   if (__pyx_t_1) {
11843 
11844     /* "View.MemoryView":364
11845  *
11846  *         if flags & PyBUF_FORMAT:
11847  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')             # <<<<<<<<<<<<<<
11848  *         else:
11849  *             self.dtype_is_object = dtype_is_object
11850  */
11851     __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
11852     if (__pyx_t_2) {
11853     } else {
11854       __pyx_t_1 = __pyx_t_2;
11855       goto __pyx_L11_bool_binop_done;
11856     }
11857     __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
11858     __pyx_t_1 = __pyx_t_2;
11859     __pyx_L11_bool_binop_done:;
11860     __pyx_v_self->dtype_is_object = __pyx_t_1;
11861 
11862     /* "View.MemoryView":363
11863  *                 raise MemoryError
11864  *
11865  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
11866  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
11867  *         else:
11868  */
11869     goto __pyx_L10;
11870   }
11871 
11872   /* "View.MemoryView":366
11873  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
11874  *         else:
11875  *             self.dtype_is_object = dtype_is_object             # <<<<<<<<<<<<<<
11876  *
11877  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
11878  */
11879   /*else*/ {
11880     __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
11881   }
11882   __pyx_L10:;
11883 
11884   /* "View.MemoryView":368
11885  *             self.dtype_is_object = dtype_is_object
11886  *
11887  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(             # <<<<<<<<<<<<<<
11888  *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
11889  *         self.typeinfo = NULL
11890  */
11891   __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));
11892 
11893   /* "View.MemoryView":370
11894  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
11895  *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
11896  *         self.typeinfo = NULL             # <<<<<<<<<<<<<<
11897  *
11898  *     def __dealloc__(memoryview self):
11899  */
11900   __pyx_v_self->typeinfo = NULL;
11901 
11902   /* "View.MemoryView":345
11903  *     cdef __Pyx_TypeInfo *typeinfo
11904  *
11905  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
11906  *         self.obj = obj
11907  *         self.flags = flags
11908  */
11909 
11910   /* function exit code */
11911   __pyx_r = 0;
11912   goto __pyx_L0;
11913   __pyx_L1_error:;
11914   __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11915   __pyx_r = -1;
11916   __pyx_L0:;
11917   __Pyx_RefNannyFinishContext();
11918   return __pyx_r;
11919 }
11920 
11921 /* "View.MemoryView":372
11922  *         self.typeinfo = NULL
11923  *
11924  *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
11925  *         if self.obj is not None:
11926  *             __Pyx_ReleaseBuffer(&self.view)
11927  */
11928 
11929 /* Python wrapper */
11930 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___dealloc__(PyObject * __pyx_v_self)11931 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
11932   __Pyx_RefNannyDeclarations
11933   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
11934   __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));
11935 
11936   /* function exit code */
11937   __Pyx_RefNannyFinishContext();
11938 }
11939 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj * __pyx_v_self)11940 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
11941   int __pyx_v_i;
11942   __Pyx_RefNannyDeclarations
11943   int __pyx_t_1;
11944   int __pyx_t_2;
11945   int __pyx_t_3;
11946   int __pyx_t_4;
11947   int __pyx_t_5;
11948   PyThread_type_lock __pyx_t_6;
11949   PyThread_type_lock __pyx_t_7;
11950   __Pyx_RefNannySetupContext("__dealloc__", 0);
11951 
11952   /* "View.MemoryView":373
11953  *
11954  *     def __dealloc__(memoryview self):
11955  *         if self.obj is not None:             # <<<<<<<<<<<<<<
11956  *             __Pyx_ReleaseBuffer(&self.view)
11957  *
11958  */
11959   __pyx_t_1 = (__pyx_v_self->obj != Py_None);
11960   __pyx_t_2 = (__pyx_t_1 != 0);
11961   if (__pyx_t_2) {
11962 
11963     /* "View.MemoryView":374
11964  *     def __dealloc__(memoryview self):
11965  *         if self.obj is not None:
11966  *             __Pyx_ReleaseBuffer(&self.view)             # <<<<<<<<<<<<<<
11967  *
11968  *         cdef int i
11969  */
11970     __Pyx_ReleaseBuffer((&__pyx_v_self->view));
11971 
11972     /* "View.MemoryView":373
11973  *
11974  *     def __dealloc__(memoryview self):
11975  *         if self.obj is not None:             # <<<<<<<<<<<<<<
11976  *             __Pyx_ReleaseBuffer(&self.view)
11977  *
11978  */
11979   }
11980 
11981   /* "View.MemoryView":378
11982  *         cdef int i
11983  *         global __pyx_memoryview_thread_locks_used
11984  *         if self.lock != NULL:             # <<<<<<<<<<<<<<
11985  *             for i in range(__pyx_memoryview_thread_locks_used):
11986  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
11987  */
11988   __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
11989   if (__pyx_t_2) {
11990 
11991     /* "View.MemoryView":379
11992  *         global __pyx_memoryview_thread_locks_used
11993  *         if self.lock != NULL:
11994  *             for i in range(__pyx_memoryview_thread_locks_used):             # <<<<<<<<<<<<<<
11995  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
11996  *                     __pyx_memoryview_thread_locks_used -= 1
11997  */
11998     __pyx_t_3 = __pyx_memoryview_thread_locks_used;
11999     __pyx_t_4 = __pyx_t_3;
12000     for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
12001       __pyx_v_i = __pyx_t_5;
12002 
12003       /* "View.MemoryView":380
12004  *         if self.lock != NULL:
12005  *             for i in range(__pyx_memoryview_thread_locks_used):
12006  *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
12007  *                     __pyx_memoryview_thread_locks_used -= 1
12008  *                     if i != __pyx_memoryview_thread_locks_used:
12009  */
12010       __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
12011       if (__pyx_t_2) {
12012 
12013         /* "View.MemoryView":381
12014  *             for i in range(__pyx_memoryview_thread_locks_used):
12015  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
12016  *                     __pyx_memoryview_thread_locks_used -= 1             # <<<<<<<<<<<<<<
12017  *                     if i != __pyx_memoryview_thread_locks_used:
12018  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
12019  */
12020         __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
12021 
12022         /* "View.MemoryView":382
12023  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
12024  *                     __pyx_memoryview_thread_locks_used -= 1
12025  *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
12026  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
12027  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
12028  */
12029         __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
12030         if (__pyx_t_2) {
12031 
12032           /* "View.MemoryView":384
12033  *                     if i != __pyx_memoryview_thread_locks_used:
12034  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
12035  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])             # <<<<<<<<<<<<<<
12036  *                     break
12037  *             else:
12038  */
12039           __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
12040           __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
12041 
12042           /* "View.MemoryView":383
12043  *                     __pyx_memoryview_thread_locks_used -= 1
12044  *                     if i != __pyx_memoryview_thread_locks_used:
12045  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (             # <<<<<<<<<<<<<<
12046  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
12047  *                     break
12048  */
12049           (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
12050           (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
12051 
12052           /* "View.MemoryView":382
12053  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
12054  *                     __pyx_memoryview_thread_locks_used -= 1
12055  *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
12056  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
12057  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
12058  */
12059         }
12060 
12061         /* "View.MemoryView":385
12062  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
12063  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
12064  *                     break             # <<<<<<<<<<<<<<
12065  *             else:
12066  *                 PyThread_free_lock(self.lock)
12067  */
12068         goto __pyx_L6_break;
12069 
12070         /* "View.MemoryView":380
12071  *         if self.lock != NULL:
12072  *             for i in range(__pyx_memoryview_thread_locks_used):
12073  *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
12074  *                     __pyx_memoryview_thread_locks_used -= 1
12075  *                     if i != __pyx_memoryview_thread_locks_used:
12076  */
12077       }
12078     }
12079     /*else*/ {
12080 
12081       /* "View.MemoryView":387
12082  *                     break
12083  *             else:
12084  *                 PyThread_free_lock(self.lock)             # <<<<<<<<<<<<<<
12085  *
12086  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
12087  */
12088       PyThread_free_lock(__pyx_v_self->lock);
12089     }
12090     __pyx_L6_break:;
12091 
12092     /* "View.MemoryView":378
12093  *         cdef int i
12094  *         global __pyx_memoryview_thread_locks_used
12095  *         if self.lock != NULL:             # <<<<<<<<<<<<<<
12096  *             for i in range(__pyx_memoryview_thread_locks_used):
12097  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
12098  */
12099   }
12100 
12101   /* "View.MemoryView":372
12102  *         self.typeinfo = NULL
12103  *
12104  *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
12105  *         if self.obj is not None:
12106  *             __Pyx_ReleaseBuffer(&self.view)
12107  */
12108 
12109   /* function exit code */
12110   __Pyx_RefNannyFinishContext();
12111 }
12112 
12113 /* "View.MemoryView":389
12114  *                 PyThread_free_lock(self.lock)
12115  *
12116  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
12117  *         cdef Py_ssize_t dim
12118  *         cdef char *itemp = <char *> self.view.buf
12119  */
12120 
__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index)12121 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
12122   Py_ssize_t __pyx_v_dim;
12123   char *__pyx_v_itemp;
12124   PyObject *__pyx_v_idx = NULL;
12125   char *__pyx_r;
12126   __Pyx_RefNannyDeclarations
12127   Py_ssize_t __pyx_t_1;
12128   PyObject *__pyx_t_2 = NULL;
12129   Py_ssize_t __pyx_t_3;
12130   PyObject *(*__pyx_t_4)(PyObject *);
12131   PyObject *__pyx_t_5 = NULL;
12132   Py_ssize_t __pyx_t_6;
12133   char *__pyx_t_7;
12134   __Pyx_RefNannySetupContext("get_item_pointer", 0);
12135 
12136   /* "View.MemoryView":391
12137  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
12138  *         cdef Py_ssize_t dim
12139  *         cdef char *itemp = <char *> self.view.buf             # <<<<<<<<<<<<<<
12140  *
12141  *         for dim, idx in enumerate(index):
12142  */
12143   __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
12144 
12145   /* "View.MemoryView":393
12146  *         cdef char *itemp = <char *> self.view.buf
12147  *
12148  *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
12149  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
12150  *
12151  */
12152   __pyx_t_1 = 0;
12153   if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
12154     __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
12155     __pyx_t_4 = NULL;
12156   } else {
12157     __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 393, __pyx_L1_error)
12158     __Pyx_GOTREF(__pyx_t_2);
12159     __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 393, __pyx_L1_error)
12160   }
12161   for (;;) {
12162     if (likely(!__pyx_t_4)) {
12163       if (likely(PyList_CheckExact(__pyx_t_2))) {
12164         if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
12165         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12166         __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 393, __pyx_L1_error)
12167         #else
12168         __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 393, __pyx_L1_error)
12169         __Pyx_GOTREF(__pyx_t_5);
12170         #endif
12171       } else {
12172         if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
12173         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12174         __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 393, __pyx_L1_error)
12175         #else
12176         __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 393, __pyx_L1_error)
12177         __Pyx_GOTREF(__pyx_t_5);
12178         #endif
12179       }
12180     } else {
12181       __pyx_t_5 = __pyx_t_4(__pyx_t_2);
12182       if (unlikely(!__pyx_t_5)) {
12183         PyObject* exc_type = PyErr_Occurred();
12184         if (exc_type) {
12185           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
12186           else __PYX_ERR(2, 393, __pyx_L1_error)
12187         }
12188         break;
12189       }
12190       __Pyx_GOTREF(__pyx_t_5);
12191     }
12192     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
12193     __pyx_t_5 = 0;
12194     __pyx_v_dim = __pyx_t_1;
12195     __pyx_t_1 = (__pyx_t_1 + 1);
12196 
12197     /* "View.MemoryView":394
12198  *
12199  *         for dim, idx in enumerate(index):
12200  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)             # <<<<<<<<<<<<<<
12201  *
12202  *         return itemp
12203  */
12204     __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 394, __pyx_L1_error)
12205     __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(2, 394, __pyx_L1_error)
12206     __pyx_v_itemp = __pyx_t_7;
12207 
12208     /* "View.MemoryView":393
12209  *         cdef char *itemp = <char *> self.view.buf
12210  *
12211  *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
12212  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
12213  *
12214  */
12215   }
12216   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12217 
12218   /* "View.MemoryView":396
12219  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
12220  *
12221  *         return itemp             # <<<<<<<<<<<<<<
12222  *
12223  *
12224  */
12225   __pyx_r = __pyx_v_itemp;
12226   goto __pyx_L0;
12227 
12228   /* "View.MemoryView":389
12229  *                 PyThread_free_lock(self.lock)
12230  *
12231  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
12232  *         cdef Py_ssize_t dim
12233  *         cdef char *itemp = <char *> self.view.buf
12234  */
12235 
12236   /* function exit code */
12237   __pyx_L1_error:;
12238   __Pyx_XDECREF(__pyx_t_2);
12239   __Pyx_XDECREF(__pyx_t_5);
12240   __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
12241   __pyx_r = NULL;
12242   __pyx_L0:;
12243   __Pyx_XDECREF(__pyx_v_idx);
12244   __Pyx_RefNannyFinishContext();
12245   return __pyx_r;
12246 }
12247 
12248 /* "View.MemoryView":399
12249  *
12250  *
12251  *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
12252  *         if index is Ellipsis:
12253  *             return self
12254  */
12255 
12256 /* Python wrapper */
12257 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)12258 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
12259   PyObject *__pyx_r = 0;
12260   __Pyx_RefNannyDeclarations
12261   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
12262   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
12263 
12264   /* function exit code */
12265   __Pyx_RefNannyFinishContext();
12266   return __pyx_r;
12267 }
12268 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index)12269 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
12270   PyObject *__pyx_v_have_slices = NULL;
12271   PyObject *__pyx_v_indices = NULL;
12272   char *__pyx_v_itemp;
12273   PyObject *__pyx_r = NULL;
12274   __Pyx_RefNannyDeclarations
12275   int __pyx_t_1;
12276   int __pyx_t_2;
12277   PyObject *__pyx_t_3 = NULL;
12278   PyObject *__pyx_t_4 = NULL;
12279   PyObject *__pyx_t_5 = NULL;
12280   char *__pyx_t_6;
12281   __Pyx_RefNannySetupContext("__getitem__", 0);
12282 
12283   /* "View.MemoryView":400
12284  *
12285  *     def __getitem__(memoryview self, object index):
12286  *         if index is Ellipsis:             # <<<<<<<<<<<<<<
12287  *             return self
12288  *
12289  */
12290   __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
12291   __pyx_t_2 = (__pyx_t_1 != 0);
12292   if (__pyx_t_2) {
12293 
12294     /* "View.MemoryView":401
12295  *     def __getitem__(memoryview self, object index):
12296  *         if index is Ellipsis:
12297  *             return self             # <<<<<<<<<<<<<<
12298  *
12299  *         have_slices, indices = _unellipsify(index, self.view.ndim)
12300  */
12301     __Pyx_XDECREF(__pyx_r);
12302     __Pyx_INCREF(((PyObject *)__pyx_v_self));
12303     __pyx_r = ((PyObject *)__pyx_v_self);
12304     goto __pyx_L0;
12305 
12306     /* "View.MemoryView":400
12307  *
12308  *     def __getitem__(memoryview self, object index):
12309  *         if index is Ellipsis:             # <<<<<<<<<<<<<<
12310  *             return self
12311  *
12312  */
12313   }
12314 
12315   /* "View.MemoryView":403
12316  *             return self
12317  *
12318  *         have_slices, indices = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
12319  *
12320  *         cdef char *itemp
12321  */
12322   __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 403, __pyx_L1_error)
12323   __Pyx_GOTREF(__pyx_t_3);
12324   if (likely(__pyx_t_3 != Py_None)) {
12325     PyObject* sequence = __pyx_t_3;
12326     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
12327     if (unlikely(size != 2)) {
12328       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
12329       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
12330       __PYX_ERR(2, 403, __pyx_L1_error)
12331     }
12332     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12333     __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
12334     __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
12335     __Pyx_INCREF(__pyx_t_4);
12336     __Pyx_INCREF(__pyx_t_5);
12337     #else
12338     __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 403, __pyx_L1_error)
12339     __Pyx_GOTREF(__pyx_t_4);
12340     __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 403, __pyx_L1_error)
12341     __Pyx_GOTREF(__pyx_t_5);
12342     #endif
12343     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12344   } else {
12345     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 403, __pyx_L1_error)
12346   }
12347   __pyx_v_have_slices = __pyx_t_4;
12348   __pyx_t_4 = 0;
12349   __pyx_v_indices = __pyx_t_5;
12350   __pyx_t_5 = 0;
12351 
12352   /* "View.MemoryView":406
12353  *
12354  *         cdef char *itemp
12355  *         if have_slices:             # <<<<<<<<<<<<<<
12356  *             return memview_slice(self, indices)
12357  *         else:
12358  */
12359   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 406, __pyx_L1_error)
12360   if (__pyx_t_2) {
12361 
12362     /* "View.MemoryView":407
12363  *         cdef char *itemp
12364  *         if have_slices:
12365  *             return memview_slice(self, indices)             # <<<<<<<<<<<<<<
12366  *         else:
12367  *             itemp = self.get_item_pointer(indices)
12368  */
12369     __Pyx_XDECREF(__pyx_r);
12370     __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 407, __pyx_L1_error)
12371     __Pyx_GOTREF(__pyx_t_3);
12372     __pyx_r = __pyx_t_3;
12373     __pyx_t_3 = 0;
12374     goto __pyx_L0;
12375 
12376     /* "View.MemoryView":406
12377  *
12378  *         cdef char *itemp
12379  *         if have_slices:             # <<<<<<<<<<<<<<
12380  *             return memview_slice(self, indices)
12381  *         else:
12382  */
12383   }
12384 
12385   /* "View.MemoryView":409
12386  *             return memview_slice(self, indices)
12387  *         else:
12388  *             itemp = self.get_item_pointer(indices)             # <<<<<<<<<<<<<<
12389  *             return self.convert_item_to_object(itemp)
12390  *
12391  */
12392   /*else*/ {
12393     __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(2, 409, __pyx_L1_error)
12394     __pyx_v_itemp = __pyx_t_6;
12395 
12396     /* "View.MemoryView":410
12397  *         else:
12398  *             itemp = self.get_item_pointer(indices)
12399  *             return self.convert_item_to_object(itemp)             # <<<<<<<<<<<<<<
12400  *
12401  *     def __setitem__(memoryview self, object index, object value):
12402  */
12403     __Pyx_XDECREF(__pyx_r);
12404     __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 410, __pyx_L1_error)
12405     __Pyx_GOTREF(__pyx_t_3);
12406     __pyx_r = __pyx_t_3;
12407     __pyx_t_3 = 0;
12408     goto __pyx_L0;
12409   }
12410 
12411   /* "View.MemoryView":399
12412  *
12413  *
12414  *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
12415  *         if index is Ellipsis:
12416  *             return self
12417  */
12418 
12419   /* function exit code */
12420   __pyx_L1_error:;
12421   __Pyx_XDECREF(__pyx_t_3);
12422   __Pyx_XDECREF(__pyx_t_4);
12423   __Pyx_XDECREF(__pyx_t_5);
12424   __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12425   __pyx_r = NULL;
12426   __pyx_L0:;
12427   __Pyx_XDECREF(__pyx_v_have_slices);
12428   __Pyx_XDECREF(__pyx_v_indices);
12429   __Pyx_XGIVEREF(__pyx_r);
12430   __Pyx_RefNannyFinishContext();
12431   return __pyx_r;
12432 }
12433 
12434 /* "View.MemoryView":412
12435  *             return self.convert_item_to_object(itemp)
12436  *
12437  *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
12438  *         if self.view.readonly:
12439  *             raise TypeError("Cannot assign to read-only memoryview")
12440  */
12441 
12442 /* Python wrapper */
12443 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)12444 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
12445   int __pyx_r;
12446   __Pyx_RefNannyDeclarations
12447   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
12448   __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));
12449 
12450   /* function exit code */
12451   __Pyx_RefNannyFinishContext();
12452   return __pyx_r;
12453 }
12454 
__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)12455 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) {
12456   PyObject *__pyx_v_have_slices = NULL;
12457   PyObject *__pyx_v_obj = NULL;
12458   int __pyx_r;
12459   __Pyx_RefNannyDeclarations
12460   int __pyx_t_1;
12461   PyObject *__pyx_t_2 = NULL;
12462   PyObject *__pyx_t_3 = NULL;
12463   PyObject *__pyx_t_4 = NULL;
12464   __Pyx_RefNannySetupContext("__setitem__", 0);
12465   __Pyx_INCREF(__pyx_v_index);
12466 
12467   /* "View.MemoryView":413
12468  *
12469  *     def __setitem__(memoryview self, object index, object value):
12470  *         if self.view.readonly:             # <<<<<<<<<<<<<<
12471  *             raise TypeError("Cannot assign to read-only memoryview")
12472  *
12473  */
12474   __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
12475   if (unlikely(__pyx_t_1)) {
12476 
12477     /* "View.MemoryView":414
12478  *     def __setitem__(memoryview self, object index, object value):
12479  *         if self.view.readonly:
12480  *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
12481  *
12482  *         have_slices, index = _unellipsify(index, self.view.ndim)
12483  */
12484     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 414, __pyx_L1_error)
12485     __Pyx_GOTREF(__pyx_t_2);
12486     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
12487     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12488     __PYX_ERR(2, 414, __pyx_L1_error)
12489 
12490     /* "View.MemoryView":413
12491  *
12492  *     def __setitem__(memoryview self, object index, object value):
12493  *         if self.view.readonly:             # <<<<<<<<<<<<<<
12494  *             raise TypeError("Cannot assign to read-only memoryview")
12495  *
12496  */
12497   }
12498 
12499   /* "View.MemoryView":416
12500  *             raise TypeError("Cannot assign to read-only memoryview")
12501  *
12502  *         have_slices, index = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
12503  *
12504  *         if have_slices:
12505  */
12506   __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 416, __pyx_L1_error)
12507   __Pyx_GOTREF(__pyx_t_2);
12508   if (likely(__pyx_t_2 != Py_None)) {
12509     PyObject* sequence = __pyx_t_2;
12510     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
12511     if (unlikely(size != 2)) {
12512       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
12513       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
12514       __PYX_ERR(2, 416, __pyx_L1_error)
12515     }
12516     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12517     __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
12518     __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
12519     __Pyx_INCREF(__pyx_t_3);
12520     __Pyx_INCREF(__pyx_t_4);
12521     #else
12522     __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 416, __pyx_L1_error)
12523     __Pyx_GOTREF(__pyx_t_3);
12524     __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 416, __pyx_L1_error)
12525     __Pyx_GOTREF(__pyx_t_4);
12526     #endif
12527     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12528   } else {
12529     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 416, __pyx_L1_error)
12530   }
12531   __pyx_v_have_slices = __pyx_t_3;
12532   __pyx_t_3 = 0;
12533   __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
12534   __pyx_t_4 = 0;
12535 
12536   /* "View.MemoryView":418
12537  *         have_slices, index = _unellipsify(index, self.view.ndim)
12538  *
12539  *         if have_slices:             # <<<<<<<<<<<<<<
12540  *             obj = self.is_slice(value)
12541  *             if obj:
12542  */
12543   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 418, __pyx_L1_error)
12544   if (__pyx_t_1) {
12545 
12546     /* "View.MemoryView":419
12547  *
12548  *         if have_slices:
12549  *             obj = self.is_slice(value)             # <<<<<<<<<<<<<<
12550  *             if obj:
12551  *                 self.setitem_slice_assignment(self[index], obj)
12552  */
12553     __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 419, __pyx_L1_error)
12554     __Pyx_GOTREF(__pyx_t_2);
12555     __pyx_v_obj = __pyx_t_2;
12556     __pyx_t_2 = 0;
12557 
12558     /* "View.MemoryView":420
12559  *         if have_slices:
12560  *             obj = self.is_slice(value)
12561  *             if obj:             # <<<<<<<<<<<<<<
12562  *                 self.setitem_slice_assignment(self[index], obj)
12563  *             else:
12564  */
12565     __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 420, __pyx_L1_error)
12566     if (__pyx_t_1) {
12567 
12568       /* "View.MemoryView":421
12569  *             obj = self.is_slice(value)
12570  *             if obj:
12571  *                 self.setitem_slice_assignment(self[index], obj)             # <<<<<<<<<<<<<<
12572  *             else:
12573  *                 self.setitem_slice_assign_scalar(self[index], value)
12574  */
12575       __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 421, __pyx_L1_error)
12576       __Pyx_GOTREF(__pyx_t_2);
12577       __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 421, __pyx_L1_error)
12578       __Pyx_GOTREF(__pyx_t_4);
12579       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12580       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12581 
12582       /* "View.MemoryView":420
12583  *         if have_slices:
12584  *             obj = self.is_slice(value)
12585  *             if obj:             # <<<<<<<<<<<<<<
12586  *                 self.setitem_slice_assignment(self[index], obj)
12587  *             else:
12588  */
12589       goto __pyx_L5;
12590     }
12591 
12592     /* "View.MemoryView":423
12593  *                 self.setitem_slice_assignment(self[index], obj)
12594  *             else:
12595  *                 self.setitem_slice_assign_scalar(self[index], value)             # <<<<<<<<<<<<<<
12596  *         else:
12597  *             self.setitem_indexed(index, value)
12598  */
12599     /*else*/ {
12600       __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 423, __pyx_L1_error)
12601       __Pyx_GOTREF(__pyx_t_4);
12602       if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 423, __pyx_L1_error)
12603       __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 423, __pyx_L1_error)
12604       __Pyx_GOTREF(__pyx_t_2);
12605       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12606       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12607     }
12608     __pyx_L5:;
12609 
12610     /* "View.MemoryView":418
12611  *         have_slices, index = _unellipsify(index, self.view.ndim)
12612  *
12613  *         if have_slices:             # <<<<<<<<<<<<<<
12614  *             obj = self.is_slice(value)
12615  *             if obj:
12616  */
12617     goto __pyx_L4;
12618   }
12619 
12620   /* "View.MemoryView":425
12621  *                 self.setitem_slice_assign_scalar(self[index], value)
12622  *         else:
12623  *             self.setitem_indexed(index, value)             # <<<<<<<<<<<<<<
12624  *
12625  *     cdef is_slice(self, obj):
12626  */
12627   /*else*/ {
12628     __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 425, __pyx_L1_error)
12629     __Pyx_GOTREF(__pyx_t_2);
12630     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12631   }
12632   __pyx_L4:;
12633 
12634   /* "View.MemoryView":412
12635  *             return self.convert_item_to_object(itemp)
12636  *
12637  *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
12638  *         if self.view.readonly:
12639  *             raise TypeError("Cannot assign to read-only memoryview")
12640  */
12641 
12642   /* function exit code */
12643   __pyx_r = 0;
12644   goto __pyx_L0;
12645   __pyx_L1_error:;
12646   __Pyx_XDECREF(__pyx_t_2);
12647   __Pyx_XDECREF(__pyx_t_3);
12648   __Pyx_XDECREF(__pyx_t_4);
12649   __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12650   __pyx_r = -1;
12651   __pyx_L0:;
12652   __Pyx_XDECREF(__pyx_v_have_slices);
12653   __Pyx_XDECREF(__pyx_v_obj);
12654   __Pyx_XDECREF(__pyx_v_index);
12655   __Pyx_RefNannyFinishContext();
12656   return __pyx_r;
12657 }
12658 
12659 /* "View.MemoryView":427
12660  *             self.setitem_indexed(index, value)
12661  *
12662  *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
12663  *         if not isinstance(obj, memoryview):
12664  *             try:
12665  */
12666 
__pyx_memoryview_is_slice(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_obj)12667 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
12668   PyObject *__pyx_r = NULL;
12669   __Pyx_RefNannyDeclarations
12670   int __pyx_t_1;
12671   int __pyx_t_2;
12672   PyObject *__pyx_t_3 = NULL;
12673   PyObject *__pyx_t_4 = NULL;
12674   PyObject *__pyx_t_5 = NULL;
12675   PyObject *__pyx_t_6 = NULL;
12676   PyObject *__pyx_t_7 = NULL;
12677   PyObject *__pyx_t_8 = NULL;
12678   int __pyx_t_9;
12679   __Pyx_RefNannySetupContext("is_slice", 0);
12680   __Pyx_INCREF(__pyx_v_obj);
12681 
12682   /* "View.MemoryView":428
12683  *
12684  *     cdef is_slice(self, obj):
12685  *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
12686  *             try:
12687  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
12688  */
12689   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
12690   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
12691   if (__pyx_t_2) {
12692 
12693     /* "View.MemoryView":429
12694  *     cdef is_slice(self, obj):
12695  *         if not isinstance(obj, memoryview):
12696  *             try:             # <<<<<<<<<<<<<<
12697  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
12698  *                                  self.dtype_is_object)
12699  */
12700     {
12701       __Pyx_PyThreadState_declare
12702       __Pyx_PyThreadState_assign
12703       __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
12704       __Pyx_XGOTREF(__pyx_t_3);
12705       __Pyx_XGOTREF(__pyx_t_4);
12706       __Pyx_XGOTREF(__pyx_t_5);
12707       /*try:*/ {
12708 
12709         /* "View.MemoryView":430
12710  *         if not isinstance(obj, memoryview):
12711  *             try:
12712  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
12713  *                                  self.dtype_is_object)
12714  *             except TypeError:
12715  */
12716         __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 430, __pyx_L4_error)
12717         __Pyx_GOTREF(__pyx_t_6);
12718 
12719         /* "View.MemoryView":431
12720  *             try:
12721  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
12722  *                                  self.dtype_is_object)             # <<<<<<<<<<<<<<
12723  *             except TypeError:
12724  *                 return None
12725  */
12726         __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 431, __pyx_L4_error)
12727         __Pyx_GOTREF(__pyx_t_7);
12728 
12729         /* "View.MemoryView":430
12730  *         if not isinstance(obj, memoryview):
12731  *             try:
12732  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
12733  *                                  self.dtype_is_object)
12734  *             except TypeError:
12735  */
12736         __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 430, __pyx_L4_error)
12737         __Pyx_GOTREF(__pyx_t_8);
12738         __Pyx_INCREF(__pyx_v_obj);
12739         __Pyx_GIVEREF(__pyx_v_obj);
12740         PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
12741         __Pyx_GIVEREF(__pyx_t_6);
12742         PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
12743         __Pyx_GIVEREF(__pyx_t_7);
12744         PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
12745         __pyx_t_6 = 0;
12746         __pyx_t_7 = 0;
12747         __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 430, __pyx_L4_error)
12748         __Pyx_GOTREF(__pyx_t_7);
12749         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12750         __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
12751         __pyx_t_7 = 0;
12752 
12753         /* "View.MemoryView":429
12754  *     cdef is_slice(self, obj):
12755  *         if not isinstance(obj, memoryview):
12756  *             try:             # <<<<<<<<<<<<<<
12757  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
12758  *                                  self.dtype_is_object)
12759  */
12760       }
12761       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
12762       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
12763       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12764       goto __pyx_L9_try_end;
12765       __pyx_L4_error:;
12766       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
12767       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
12768       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
12769 
12770       /* "View.MemoryView":432
12771  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
12772  *                                  self.dtype_is_object)
12773  *             except TypeError:             # <<<<<<<<<<<<<<
12774  *                 return None
12775  *
12776  */
12777       __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
12778       if (__pyx_t_9) {
12779         __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
12780         if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 432, __pyx_L6_except_error)
12781         __Pyx_GOTREF(__pyx_t_7);
12782         __Pyx_GOTREF(__pyx_t_8);
12783         __Pyx_GOTREF(__pyx_t_6);
12784 
12785         /* "View.MemoryView":433
12786  *                                  self.dtype_is_object)
12787  *             except TypeError:
12788  *                 return None             # <<<<<<<<<<<<<<
12789  *
12790  *         return obj
12791  */
12792         __Pyx_XDECREF(__pyx_r);
12793         __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12794         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12795         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
12796         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12797         goto __pyx_L7_except_return;
12798       }
12799       goto __pyx_L6_except_error;
12800       __pyx_L6_except_error:;
12801 
12802       /* "View.MemoryView":429
12803  *     cdef is_slice(self, obj):
12804  *         if not isinstance(obj, memoryview):
12805  *             try:             # <<<<<<<<<<<<<<
12806  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
12807  *                                  self.dtype_is_object)
12808  */
12809       __Pyx_XGIVEREF(__pyx_t_3);
12810       __Pyx_XGIVEREF(__pyx_t_4);
12811       __Pyx_XGIVEREF(__pyx_t_5);
12812       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
12813       goto __pyx_L1_error;
12814       __pyx_L7_except_return:;
12815       __Pyx_XGIVEREF(__pyx_t_3);
12816       __Pyx_XGIVEREF(__pyx_t_4);
12817       __Pyx_XGIVEREF(__pyx_t_5);
12818       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
12819       goto __pyx_L0;
12820       __pyx_L9_try_end:;
12821     }
12822 
12823     /* "View.MemoryView":428
12824  *
12825  *     cdef is_slice(self, obj):
12826  *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
12827  *             try:
12828  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
12829  */
12830   }
12831 
12832   /* "View.MemoryView":435
12833  *                 return None
12834  *
12835  *         return obj             # <<<<<<<<<<<<<<
12836  *
12837  *     cdef setitem_slice_assignment(self, dst, src):
12838  */
12839   __Pyx_XDECREF(__pyx_r);
12840   __Pyx_INCREF(__pyx_v_obj);
12841   __pyx_r = __pyx_v_obj;
12842   goto __pyx_L0;
12843 
12844   /* "View.MemoryView":427
12845  *             self.setitem_indexed(index, value)
12846  *
12847  *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
12848  *         if not isinstance(obj, memoryview):
12849  *             try:
12850  */
12851 
12852   /* function exit code */
12853   __pyx_L1_error:;
12854   __Pyx_XDECREF(__pyx_t_6);
12855   __Pyx_XDECREF(__pyx_t_7);
12856   __Pyx_XDECREF(__pyx_t_8);
12857   __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
12858   __pyx_r = 0;
12859   __pyx_L0:;
12860   __Pyx_XDECREF(__pyx_v_obj);
12861   __Pyx_XGIVEREF(__pyx_r);
12862   __Pyx_RefNannyFinishContext();
12863   return __pyx_r;
12864 }
12865 
12866 /* "View.MemoryView":437
12867  *         return obj
12868  *
12869  *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
12870  *         cdef __Pyx_memviewslice dst_slice
12871  *         cdef __Pyx_memviewslice src_slice
12872  */
12873 
__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_dst,PyObject * __pyx_v_src)12874 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
12875   __Pyx_memviewslice __pyx_v_dst_slice;
12876   __Pyx_memviewslice __pyx_v_src_slice;
12877   PyObject *__pyx_r = NULL;
12878   __Pyx_RefNannyDeclarations
12879   PyObject *__pyx_t_1 = NULL;
12880   int __pyx_t_2;
12881   int __pyx_t_3;
12882   int __pyx_t_4;
12883   __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
12884 
12885   /* "View.MemoryView":441
12886  *         cdef __Pyx_memviewslice src_slice
12887  *
12888  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
12889  *                                  get_slice_from_memview(dst, &dst_slice)[0],
12890  *                                  src.ndim, dst.ndim, self.dtype_is_object)
12891  */
12892   if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 441, __pyx_L1_error)
12893 
12894   /* "View.MemoryView":442
12895  *
12896  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
12897  *                                  get_slice_from_memview(dst, &dst_slice)[0],             # <<<<<<<<<<<<<<
12898  *                                  src.ndim, dst.ndim, self.dtype_is_object)
12899  *
12900  */
12901   if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 442, __pyx_L1_error)
12902 
12903   /* "View.MemoryView":443
12904  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
12905  *                                  get_slice_from_memview(dst, &dst_slice)[0],
12906  *                                  src.ndim, dst.ndim, self.dtype_is_object)             # <<<<<<<<<<<<<<
12907  *
12908  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
12909  */
12910   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 443, __pyx_L1_error)
12911   __Pyx_GOTREF(__pyx_t_1);
12912   __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 443, __pyx_L1_error)
12913   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12914   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 443, __pyx_L1_error)
12915   __Pyx_GOTREF(__pyx_t_1);
12916   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 443, __pyx_L1_error)
12917   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12918 
12919   /* "View.MemoryView":441
12920  *         cdef __Pyx_memviewslice src_slice
12921  *
12922  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
12923  *                                  get_slice_from_memview(dst, &dst_slice)[0],
12924  *                                  src.ndim, dst.ndim, self.dtype_is_object)
12925  */
12926   __pyx_t_4 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice))[0]), __pyx_t_2, __pyx_t_3, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 441, __pyx_L1_error)
12927 
12928   /* "View.MemoryView":437
12929  *         return obj
12930  *
12931  *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
12932  *         cdef __Pyx_memviewslice dst_slice
12933  *         cdef __Pyx_memviewslice src_slice
12934  */
12935 
12936   /* function exit code */
12937   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12938   goto __pyx_L0;
12939   __pyx_L1_error:;
12940   __Pyx_XDECREF(__pyx_t_1);
12941   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
12942   __pyx_r = 0;
12943   __pyx_L0:;
12944   __Pyx_XGIVEREF(__pyx_r);
12945   __Pyx_RefNannyFinishContext();
12946   return __pyx_r;
12947 }
12948 
12949 /* "View.MemoryView":445
12950  *                                  src.ndim, dst.ndim, self.dtype_is_object)
12951  *
12952  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
12953  *         cdef int array[128]
12954  *         cdef void *tmp = NULL
12955  */
12956 
__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj * __pyx_v_self,struct __pyx_memoryview_obj * __pyx_v_dst,PyObject * __pyx_v_value)12957 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) {
12958   int __pyx_v_array[0x80];
12959   void *__pyx_v_tmp;
12960   void *__pyx_v_item;
12961   __Pyx_memviewslice *__pyx_v_dst_slice;
12962   __Pyx_memviewslice __pyx_v_tmp_slice;
12963   PyObject *__pyx_r = NULL;
12964   __Pyx_RefNannyDeclarations
12965   int __pyx_t_1;
12966   PyObject *__pyx_t_2 = NULL;
12967   int __pyx_t_3;
12968   int __pyx_t_4;
12969   char const *__pyx_t_5;
12970   PyObject *__pyx_t_6 = NULL;
12971   PyObject *__pyx_t_7 = NULL;
12972   PyObject *__pyx_t_8 = NULL;
12973   PyObject *__pyx_t_9 = NULL;
12974   PyObject *__pyx_t_10 = NULL;
12975   PyObject *__pyx_t_11 = NULL;
12976   __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);
12977 
12978   /* "View.MemoryView":447
12979  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
12980  *         cdef int array[128]
12981  *         cdef void *tmp = NULL             # <<<<<<<<<<<<<<
12982  *         cdef void *item
12983  *
12984  */
12985   __pyx_v_tmp = NULL;
12986 
12987   /* "View.MemoryView":452
12988  *         cdef __Pyx_memviewslice *dst_slice
12989  *         cdef __Pyx_memviewslice tmp_slice
12990  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)             # <<<<<<<<<<<<<<
12991  *
12992  *         if <size_t>self.view.itemsize > sizeof(array):
12993  */
12994   __pyx_v_dst_slice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice));
12995 
12996   /* "View.MemoryView":454
12997  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
12998  *
12999  *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
13000  *             tmp = PyMem_Malloc(self.view.itemsize)
13001  *             if tmp == NULL:
13002  */
13003   __pyx_t_1 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
13004   if (__pyx_t_1) {
13005 
13006     /* "View.MemoryView":455
13007  *
13008  *         if <size_t>self.view.itemsize > sizeof(array):
13009  *             tmp = PyMem_Malloc(self.view.itemsize)             # <<<<<<<<<<<<<<
13010  *             if tmp == NULL:
13011  *                 raise MemoryError
13012  */
13013     __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
13014 
13015     /* "View.MemoryView":456
13016  *         if <size_t>self.view.itemsize > sizeof(array):
13017  *             tmp = PyMem_Malloc(self.view.itemsize)
13018  *             if tmp == NULL:             # <<<<<<<<<<<<<<
13019  *                 raise MemoryError
13020  *             item = tmp
13021  */
13022     __pyx_t_1 = ((__pyx_v_tmp == NULL) != 0);
13023     if (unlikely(__pyx_t_1)) {
13024 
13025       /* "View.MemoryView":457
13026  *             tmp = PyMem_Malloc(self.view.itemsize)
13027  *             if tmp == NULL:
13028  *                 raise MemoryError             # <<<<<<<<<<<<<<
13029  *             item = tmp
13030  *         else:
13031  */
13032       PyErr_NoMemory(); __PYX_ERR(2, 457, __pyx_L1_error)
13033 
13034       /* "View.MemoryView":456
13035  *         if <size_t>self.view.itemsize > sizeof(array):
13036  *             tmp = PyMem_Malloc(self.view.itemsize)
13037  *             if tmp == NULL:             # <<<<<<<<<<<<<<
13038  *                 raise MemoryError
13039  *             item = tmp
13040  */
13041     }
13042 
13043     /* "View.MemoryView":458
13044  *             if tmp == NULL:
13045  *                 raise MemoryError
13046  *             item = tmp             # <<<<<<<<<<<<<<
13047  *         else:
13048  *             item = <void *> array
13049  */
13050     __pyx_v_item = __pyx_v_tmp;
13051 
13052     /* "View.MemoryView":454
13053  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
13054  *
13055  *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
13056  *             tmp = PyMem_Malloc(self.view.itemsize)
13057  *             if tmp == NULL:
13058  */
13059     goto __pyx_L3;
13060   }
13061 
13062   /* "View.MemoryView":460
13063  *             item = tmp
13064  *         else:
13065  *             item = <void *> array             # <<<<<<<<<<<<<<
13066  *
13067  *         try:
13068  */
13069   /*else*/ {
13070     __pyx_v_item = ((void *)__pyx_v_array);
13071   }
13072   __pyx_L3:;
13073 
13074   /* "View.MemoryView":462
13075  *             item = <void *> array
13076  *
13077  *         try:             # <<<<<<<<<<<<<<
13078  *             if self.dtype_is_object:
13079  *                 (<PyObject **> item)[0] = <PyObject *> value
13080  */
13081   /*try:*/ {
13082 
13083     /* "View.MemoryView":463
13084  *
13085  *         try:
13086  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
13087  *                 (<PyObject **> item)[0] = <PyObject *> value
13088  *             else:
13089  */
13090     __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
13091     if (__pyx_t_1) {
13092 
13093       /* "View.MemoryView":464
13094  *         try:
13095  *             if self.dtype_is_object:
13096  *                 (<PyObject **> item)[0] = <PyObject *> value             # <<<<<<<<<<<<<<
13097  *             else:
13098  *                 self.assign_item_from_object(<char *> item, value)
13099  */
13100       (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
13101 
13102       /* "View.MemoryView":463
13103  *
13104  *         try:
13105  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
13106  *                 (<PyObject **> item)[0] = <PyObject *> value
13107  *             else:
13108  */
13109       goto __pyx_L8;
13110     }
13111 
13112     /* "View.MemoryView":466
13113  *                 (<PyObject **> item)[0] = <PyObject *> value
13114  *             else:
13115  *                 self.assign_item_from_object(<char *> item, value)             # <<<<<<<<<<<<<<
13116  *
13117  *
13118  */
13119     /*else*/ {
13120       __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 466, __pyx_L6_error)
13121       __Pyx_GOTREF(__pyx_t_2);
13122       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13123     }
13124     __pyx_L8:;
13125 
13126     /* "View.MemoryView":470
13127  *
13128  *
13129  *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
13130  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
13131  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
13132  */
13133     __pyx_t_1 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
13134     if (__pyx_t_1) {
13135 
13136       /* "View.MemoryView":471
13137  *
13138  *             if self.view.suboffsets != NULL:
13139  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)             # <<<<<<<<<<<<<<
13140  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
13141  *                                 item, self.dtype_is_object)
13142  */
13143       __pyx_t_2 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 471, __pyx_L6_error)
13144       __Pyx_GOTREF(__pyx_t_2);
13145       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13146 
13147       /* "View.MemoryView":470
13148  *
13149  *
13150  *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
13151  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
13152  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
13153  */
13154     }
13155 
13156     /* "View.MemoryView":472
13157  *             if self.view.suboffsets != NULL:
13158  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
13159  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,             # <<<<<<<<<<<<<<
13160  *                                 item, self.dtype_is_object)
13161  *         finally:
13162  */
13163     __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);
13164   }
13165 
13166   /* "View.MemoryView":475
13167  *                                 item, self.dtype_is_object)
13168  *         finally:
13169  *             PyMem_Free(tmp)             # <<<<<<<<<<<<<<
13170  *
13171  *     cdef setitem_indexed(self, index, value):
13172  */
13173   /*finally:*/ {
13174     /*normal exit:*/{
13175       PyMem_Free(__pyx_v_tmp);
13176       goto __pyx_L7;
13177     }
13178     __pyx_L6_error:;
13179     /*exception exit:*/{
13180       __Pyx_PyThreadState_declare
13181       __Pyx_PyThreadState_assign
13182       __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
13183       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
13184       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
13185       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);
13186       __Pyx_XGOTREF(__pyx_t_6);
13187       __Pyx_XGOTREF(__pyx_t_7);
13188       __Pyx_XGOTREF(__pyx_t_8);
13189       __Pyx_XGOTREF(__pyx_t_9);
13190       __Pyx_XGOTREF(__pyx_t_10);
13191       __Pyx_XGOTREF(__pyx_t_11);
13192       __pyx_t_3 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename;
13193       {
13194         PyMem_Free(__pyx_v_tmp);
13195       }
13196       if (PY_MAJOR_VERSION >= 3) {
13197         __Pyx_XGIVEREF(__pyx_t_9);
13198         __Pyx_XGIVEREF(__pyx_t_10);
13199         __Pyx_XGIVEREF(__pyx_t_11);
13200         __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
13201       }
13202       __Pyx_XGIVEREF(__pyx_t_6);
13203       __Pyx_XGIVEREF(__pyx_t_7);
13204       __Pyx_XGIVEREF(__pyx_t_8);
13205       __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
13206       __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
13207       __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5;
13208       goto __pyx_L1_error;
13209     }
13210     __pyx_L7:;
13211   }
13212 
13213   /* "View.MemoryView":445
13214  *                                  src.ndim, dst.ndim, self.dtype_is_object)
13215  *
13216  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
13217  *         cdef int array[128]
13218  *         cdef void *tmp = NULL
13219  */
13220 
13221   /* function exit code */
13222   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13223   goto __pyx_L0;
13224   __pyx_L1_error:;
13225   __Pyx_XDECREF(__pyx_t_2);
13226   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
13227   __pyx_r = 0;
13228   __pyx_L0:;
13229   __Pyx_XGIVEREF(__pyx_r);
13230   __Pyx_RefNannyFinishContext();
13231   return __pyx_r;
13232 }
13233 
13234 /* "View.MemoryView":477
13235  *             PyMem_Free(tmp)
13236  *
13237  *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
13238  *         cdef char *itemp = self.get_item_pointer(index)
13239  *         self.assign_item_from_object(itemp, value)
13240  */
13241 
__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index,PyObject * __pyx_v_value)13242 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
13243   char *__pyx_v_itemp;
13244   PyObject *__pyx_r = NULL;
13245   __Pyx_RefNannyDeclarations
13246   char *__pyx_t_1;
13247   PyObject *__pyx_t_2 = NULL;
13248   __Pyx_RefNannySetupContext("setitem_indexed", 0);
13249 
13250   /* "View.MemoryView":478
13251  *
13252  *     cdef setitem_indexed(self, index, value):
13253  *         cdef char *itemp = self.get_item_pointer(index)             # <<<<<<<<<<<<<<
13254  *         self.assign_item_from_object(itemp, value)
13255  *
13256  */
13257   __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(2, 478, __pyx_L1_error)
13258   __pyx_v_itemp = __pyx_t_1;
13259 
13260   /* "View.MemoryView":479
13261  *     cdef setitem_indexed(self, index, value):
13262  *         cdef char *itemp = self.get_item_pointer(index)
13263  *         self.assign_item_from_object(itemp, value)             # <<<<<<<<<<<<<<
13264  *
13265  *     cdef convert_item_to_object(self, char *itemp):
13266  */
13267   __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 479, __pyx_L1_error)
13268   __Pyx_GOTREF(__pyx_t_2);
13269   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13270 
13271   /* "View.MemoryView":477
13272  *             PyMem_Free(tmp)
13273  *
13274  *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
13275  *         cdef char *itemp = self.get_item_pointer(index)
13276  *         self.assign_item_from_object(itemp, value)
13277  */
13278 
13279   /* function exit code */
13280   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13281   goto __pyx_L0;
13282   __pyx_L1_error:;
13283   __Pyx_XDECREF(__pyx_t_2);
13284   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
13285   __pyx_r = 0;
13286   __pyx_L0:;
13287   __Pyx_XGIVEREF(__pyx_r);
13288   __Pyx_RefNannyFinishContext();
13289   return __pyx_r;
13290 }
13291 
13292 /* "View.MemoryView":481
13293  *         self.assign_item_from_object(itemp, value)
13294  *
13295  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
13296  *         """Only used if instantiated manually by the user, or if Cython doesn't
13297  *         know how to convert the type"""
13298  */
13299 
__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj * __pyx_v_self,char * __pyx_v_itemp)13300 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
13301   PyObject *__pyx_v_struct = NULL;
13302   PyObject *__pyx_v_bytesitem = 0;
13303   PyObject *__pyx_v_result = NULL;
13304   PyObject *__pyx_r = NULL;
13305   __Pyx_RefNannyDeclarations
13306   PyObject *__pyx_t_1 = NULL;
13307   PyObject *__pyx_t_2 = NULL;
13308   PyObject *__pyx_t_3 = NULL;
13309   PyObject *__pyx_t_4 = NULL;
13310   PyObject *__pyx_t_5 = NULL;
13311   PyObject *__pyx_t_6 = NULL;
13312   PyObject *__pyx_t_7 = NULL;
13313   int __pyx_t_8;
13314   PyObject *__pyx_t_9 = NULL;
13315   size_t __pyx_t_10;
13316   int __pyx_t_11;
13317   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
13318 
13319   /* "View.MemoryView":484
13320  *         """Only used if instantiated manually by the user, or if Cython doesn't
13321  *         know how to convert the type"""
13322  *         import struct             # <<<<<<<<<<<<<<
13323  *         cdef bytes bytesitem
13324  *
13325  */
13326   __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 484, __pyx_L1_error)
13327   __Pyx_GOTREF(__pyx_t_1);
13328   __pyx_v_struct = __pyx_t_1;
13329   __pyx_t_1 = 0;
13330 
13331   /* "View.MemoryView":487
13332  *         cdef bytes bytesitem
13333  *
13334  *         bytesitem = itemp[:self.view.itemsize]             # <<<<<<<<<<<<<<
13335  *         try:
13336  *             result = struct.unpack(self.view.format, bytesitem)
13337  */
13338   __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 487, __pyx_L1_error)
13339   __Pyx_GOTREF(__pyx_t_1);
13340   __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
13341   __pyx_t_1 = 0;
13342 
13343   /* "View.MemoryView":488
13344  *
13345  *         bytesitem = itemp[:self.view.itemsize]
13346  *         try:             # <<<<<<<<<<<<<<
13347  *             result = struct.unpack(self.view.format, bytesitem)
13348  *         except struct.error:
13349  */
13350   {
13351     __Pyx_PyThreadState_declare
13352     __Pyx_PyThreadState_assign
13353     __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
13354     __Pyx_XGOTREF(__pyx_t_2);
13355     __Pyx_XGOTREF(__pyx_t_3);
13356     __Pyx_XGOTREF(__pyx_t_4);
13357     /*try:*/ {
13358 
13359       /* "View.MemoryView":489
13360  *         bytesitem = itemp[:self.view.itemsize]
13361  *         try:
13362  *             result = struct.unpack(self.view.format, bytesitem)             # <<<<<<<<<<<<<<
13363  *         except struct.error:
13364  *             raise ValueError("Unable to convert item to object")
13365  */
13366       __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 489, __pyx_L3_error)
13367       __Pyx_GOTREF(__pyx_t_5);
13368       __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 489, __pyx_L3_error)
13369       __Pyx_GOTREF(__pyx_t_6);
13370       __pyx_t_7 = NULL;
13371       __pyx_t_8 = 0;
13372       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
13373         __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
13374         if (likely(__pyx_t_7)) {
13375           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
13376           __Pyx_INCREF(__pyx_t_7);
13377           __Pyx_INCREF(function);
13378           __Pyx_DECREF_SET(__pyx_t_5, function);
13379           __pyx_t_8 = 1;
13380         }
13381       }
13382       #if CYTHON_FAST_PYCALL
13383       if (PyFunction_Check(__pyx_t_5)) {
13384         PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
13385         __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 489, __pyx_L3_error)
13386         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
13387         __Pyx_GOTREF(__pyx_t_1);
13388         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
13389       } else
13390       #endif
13391       #if CYTHON_FAST_PYCCALL
13392       if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
13393         PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
13394         __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 489, __pyx_L3_error)
13395         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
13396         __Pyx_GOTREF(__pyx_t_1);
13397         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
13398       } else
13399       #endif
13400       {
13401         __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 489, __pyx_L3_error)
13402         __Pyx_GOTREF(__pyx_t_9);
13403         if (__pyx_t_7) {
13404           __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
13405         }
13406         __Pyx_GIVEREF(__pyx_t_6);
13407         PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
13408         __Pyx_INCREF(__pyx_v_bytesitem);
13409         __Pyx_GIVEREF(__pyx_v_bytesitem);
13410         PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
13411         __pyx_t_6 = 0;
13412         __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 489, __pyx_L3_error)
13413         __Pyx_GOTREF(__pyx_t_1);
13414         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13415       }
13416       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13417       __pyx_v_result = __pyx_t_1;
13418       __pyx_t_1 = 0;
13419 
13420       /* "View.MemoryView":488
13421  *
13422  *         bytesitem = itemp[:self.view.itemsize]
13423  *         try:             # <<<<<<<<<<<<<<
13424  *             result = struct.unpack(self.view.format, bytesitem)
13425  *         except struct.error:
13426  */
13427     }
13428 
13429     /* "View.MemoryView":493
13430  *             raise ValueError("Unable to convert item to object")
13431  *         else:
13432  *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
13433  *                 return result[0]
13434  *             return result
13435  */
13436     /*else:*/ {
13437       __pyx_t_10 = strlen(__pyx_v_self->view.format);
13438       __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
13439       if (__pyx_t_11) {
13440 
13441         /* "View.MemoryView":494
13442  *         else:
13443  *             if len(self.view.format) == 1:
13444  *                 return result[0]             # <<<<<<<<<<<<<<
13445  *             return result
13446  *
13447  */
13448         __Pyx_XDECREF(__pyx_r);
13449         __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(2, 494, __pyx_L5_except_error)
13450         __Pyx_GOTREF(__pyx_t_1);
13451         __pyx_r = __pyx_t_1;
13452         __pyx_t_1 = 0;
13453         goto __pyx_L6_except_return;
13454 
13455         /* "View.MemoryView":493
13456  *             raise ValueError("Unable to convert item to object")
13457  *         else:
13458  *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
13459  *                 return result[0]
13460  *             return result
13461  */
13462       }
13463 
13464       /* "View.MemoryView":495
13465  *             if len(self.view.format) == 1:
13466  *                 return result[0]
13467  *             return result             # <<<<<<<<<<<<<<
13468  *
13469  *     cdef assign_item_from_object(self, char *itemp, object value):
13470  */
13471       __Pyx_XDECREF(__pyx_r);
13472       __Pyx_INCREF(__pyx_v_result);
13473       __pyx_r = __pyx_v_result;
13474       goto __pyx_L6_except_return;
13475     }
13476     __pyx_L3_error:;
13477     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
13478     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
13479     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
13480     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
13481     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
13482 
13483     /* "View.MemoryView":490
13484  *         try:
13485  *             result = struct.unpack(self.view.format, bytesitem)
13486  *         except struct.error:             # <<<<<<<<<<<<<<
13487  *             raise ValueError("Unable to convert item to object")
13488  *         else:
13489  */
13490     __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
13491     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 490, __pyx_L5_except_error)
13492     __Pyx_GOTREF(__pyx_t_6);
13493     __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
13494     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
13495     __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
13496     __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
13497     if (__pyx_t_8) {
13498       __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
13499       if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 490, __pyx_L5_except_error)
13500       __Pyx_GOTREF(__pyx_t_9);
13501       __Pyx_GOTREF(__pyx_t_5);
13502       __Pyx_GOTREF(__pyx_t_1);
13503 
13504       /* "View.MemoryView":491
13505  *             result = struct.unpack(self.view.format, bytesitem)
13506  *         except struct.error:
13507  *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
13508  *         else:
13509  *             if len(self.view.format) == 1:
13510  */
13511       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 491, __pyx_L5_except_error)
13512       __Pyx_GOTREF(__pyx_t_6);
13513       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
13514       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
13515       __PYX_ERR(2, 491, __pyx_L5_except_error)
13516     }
13517     goto __pyx_L5_except_error;
13518     __pyx_L5_except_error:;
13519 
13520     /* "View.MemoryView":488
13521  *
13522  *         bytesitem = itemp[:self.view.itemsize]
13523  *         try:             # <<<<<<<<<<<<<<
13524  *             result = struct.unpack(self.view.format, bytesitem)
13525  *         except struct.error:
13526  */
13527     __Pyx_XGIVEREF(__pyx_t_2);
13528     __Pyx_XGIVEREF(__pyx_t_3);
13529     __Pyx_XGIVEREF(__pyx_t_4);
13530     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
13531     goto __pyx_L1_error;
13532     __pyx_L6_except_return:;
13533     __Pyx_XGIVEREF(__pyx_t_2);
13534     __Pyx_XGIVEREF(__pyx_t_3);
13535     __Pyx_XGIVEREF(__pyx_t_4);
13536     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
13537     goto __pyx_L0;
13538   }
13539 
13540   /* "View.MemoryView":481
13541  *         self.assign_item_from_object(itemp, value)
13542  *
13543  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
13544  *         """Only used if instantiated manually by the user, or if Cython doesn't
13545  *         know how to convert the type"""
13546  */
13547 
13548   /* function exit code */
13549   __pyx_L1_error:;
13550   __Pyx_XDECREF(__pyx_t_1);
13551   __Pyx_XDECREF(__pyx_t_5);
13552   __Pyx_XDECREF(__pyx_t_6);
13553   __Pyx_XDECREF(__pyx_t_7);
13554   __Pyx_XDECREF(__pyx_t_9);
13555   __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
13556   __pyx_r = 0;
13557   __pyx_L0:;
13558   __Pyx_XDECREF(__pyx_v_struct);
13559   __Pyx_XDECREF(__pyx_v_bytesitem);
13560   __Pyx_XDECREF(__pyx_v_result);
13561   __Pyx_XGIVEREF(__pyx_r);
13562   __Pyx_RefNannyFinishContext();
13563   return __pyx_r;
13564 }
13565 
13566 /* "View.MemoryView":497
13567  *             return result
13568  *
13569  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
13570  *         """Only used if instantiated manually by the user, or if Cython doesn't
13571  *         know how to convert the type"""
13572  */
13573 
__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj * __pyx_v_self,char * __pyx_v_itemp,PyObject * __pyx_v_value)13574 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
13575   PyObject *__pyx_v_struct = NULL;
13576   char __pyx_v_c;
13577   PyObject *__pyx_v_bytesvalue = 0;
13578   Py_ssize_t __pyx_v_i;
13579   PyObject *__pyx_r = NULL;
13580   __Pyx_RefNannyDeclarations
13581   PyObject *__pyx_t_1 = NULL;
13582   int __pyx_t_2;
13583   int __pyx_t_3;
13584   PyObject *__pyx_t_4 = NULL;
13585   PyObject *__pyx_t_5 = NULL;
13586   PyObject *__pyx_t_6 = NULL;
13587   int __pyx_t_7;
13588   PyObject *__pyx_t_8 = NULL;
13589   Py_ssize_t __pyx_t_9;
13590   PyObject *__pyx_t_10 = NULL;
13591   char *__pyx_t_11;
13592   char *__pyx_t_12;
13593   char *__pyx_t_13;
13594   char *__pyx_t_14;
13595   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
13596 
13597   /* "View.MemoryView":500
13598  *         """Only used if instantiated manually by the user, or if Cython doesn't
13599  *         know how to convert the type"""
13600  *         import struct             # <<<<<<<<<<<<<<
13601  *         cdef char c
13602  *         cdef bytes bytesvalue
13603  */
13604   __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 500, __pyx_L1_error)
13605   __Pyx_GOTREF(__pyx_t_1);
13606   __pyx_v_struct = __pyx_t_1;
13607   __pyx_t_1 = 0;
13608 
13609   /* "View.MemoryView":505
13610  *         cdef Py_ssize_t i
13611  *
13612  *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
13613  *             bytesvalue = struct.pack(self.view.format, *value)
13614  *         else:
13615  */
13616   __pyx_t_2 = PyTuple_Check(__pyx_v_value);
13617   __pyx_t_3 = (__pyx_t_2 != 0);
13618   if (__pyx_t_3) {
13619 
13620     /* "View.MemoryView":506
13621  *
13622  *         if isinstance(value, tuple):
13623  *             bytesvalue = struct.pack(self.view.format, *value)             # <<<<<<<<<<<<<<
13624  *         else:
13625  *             bytesvalue = struct.pack(self.view.format, value)
13626  */
13627     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 506, __pyx_L1_error)
13628     __Pyx_GOTREF(__pyx_t_1);
13629     __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 506, __pyx_L1_error)
13630     __Pyx_GOTREF(__pyx_t_4);
13631     __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 506, __pyx_L1_error)
13632     __Pyx_GOTREF(__pyx_t_5);
13633     __Pyx_GIVEREF(__pyx_t_4);
13634     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
13635     __pyx_t_4 = 0;
13636     __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 506, __pyx_L1_error)
13637     __Pyx_GOTREF(__pyx_t_4);
13638     __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 506, __pyx_L1_error)
13639     __Pyx_GOTREF(__pyx_t_6);
13640     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13641     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13642     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 506, __pyx_L1_error)
13643     __Pyx_GOTREF(__pyx_t_4);
13644     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13645     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
13646     if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 506, __pyx_L1_error)
13647     __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
13648     __pyx_t_4 = 0;
13649 
13650     /* "View.MemoryView":505
13651  *         cdef Py_ssize_t i
13652  *
13653  *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
13654  *             bytesvalue = struct.pack(self.view.format, *value)
13655  *         else:
13656  */
13657     goto __pyx_L3;
13658   }
13659 
13660   /* "View.MemoryView":508
13661  *             bytesvalue = struct.pack(self.view.format, *value)
13662  *         else:
13663  *             bytesvalue = struct.pack(self.view.format, value)             # <<<<<<<<<<<<<<
13664  *
13665  *         for i, c in enumerate(bytesvalue):
13666  */
13667   /*else*/ {
13668     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 508, __pyx_L1_error)
13669     __Pyx_GOTREF(__pyx_t_6);
13670     __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 508, __pyx_L1_error)
13671     __Pyx_GOTREF(__pyx_t_1);
13672     __pyx_t_5 = NULL;
13673     __pyx_t_7 = 0;
13674     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
13675       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
13676       if (likely(__pyx_t_5)) {
13677         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
13678         __Pyx_INCREF(__pyx_t_5);
13679         __Pyx_INCREF(function);
13680         __Pyx_DECREF_SET(__pyx_t_6, function);
13681         __pyx_t_7 = 1;
13682       }
13683     }
13684     #if CYTHON_FAST_PYCALL
13685     if (PyFunction_Check(__pyx_t_6)) {
13686       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
13687       __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 508, __pyx_L1_error)
13688       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
13689       __Pyx_GOTREF(__pyx_t_4);
13690       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13691     } else
13692     #endif
13693     #if CYTHON_FAST_PYCCALL
13694     if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
13695       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
13696       __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 508, __pyx_L1_error)
13697       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
13698       __Pyx_GOTREF(__pyx_t_4);
13699       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13700     } else
13701     #endif
13702     {
13703       __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 508, __pyx_L1_error)
13704       __Pyx_GOTREF(__pyx_t_8);
13705       if (__pyx_t_5) {
13706         __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
13707       }
13708       __Pyx_GIVEREF(__pyx_t_1);
13709       PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
13710       __Pyx_INCREF(__pyx_v_value);
13711       __Pyx_GIVEREF(__pyx_v_value);
13712       PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
13713       __pyx_t_1 = 0;
13714       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 508, __pyx_L1_error)
13715       __Pyx_GOTREF(__pyx_t_4);
13716       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13717     }
13718     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
13719     if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 508, __pyx_L1_error)
13720     __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
13721     __pyx_t_4 = 0;
13722   }
13723   __pyx_L3:;
13724 
13725   /* "View.MemoryView":510
13726  *             bytesvalue = struct.pack(self.view.format, value)
13727  *
13728  *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
13729  *             itemp[i] = c
13730  *
13731  */
13732   __pyx_t_9 = 0;
13733   if (unlikely(__pyx_v_bytesvalue == Py_None)) {
13734     PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
13735     __PYX_ERR(2, 510, __pyx_L1_error)
13736   }
13737   __Pyx_INCREF(__pyx_v_bytesvalue);
13738   __pyx_t_10 = __pyx_v_bytesvalue;
13739   __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
13740   __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
13741   for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
13742     __pyx_t_11 = __pyx_t_14;
13743     __pyx_v_c = (__pyx_t_11[0]);
13744 
13745     /* "View.MemoryView":511
13746  *
13747  *         for i, c in enumerate(bytesvalue):
13748  *             itemp[i] = c             # <<<<<<<<<<<<<<
13749  *
13750  *     @cname('getbuffer')
13751  */
13752     __pyx_v_i = __pyx_t_9;
13753 
13754     /* "View.MemoryView":510
13755  *             bytesvalue = struct.pack(self.view.format, value)
13756  *
13757  *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
13758  *             itemp[i] = c
13759  *
13760  */
13761     __pyx_t_9 = (__pyx_t_9 + 1);
13762 
13763     /* "View.MemoryView":511
13764  *
13765  *         for i, c in enumerate(bytesvalue):
13766  *             itemp[i] = c             # <<<<<<<<<<<<<<
13767  *
13768  *     @cname('getbuffer')
13769  */
13770     (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
13771   }
13772   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
13773 
13774   /* "View.MemoryView":497
13775  *             return result
13776  *
13777  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
13778  *         """Only used if instantiated manually by the user, or if Cython doesn't
13779  *         know how to convert the type"""
13780  */
13781 
13782   /* function exit code */
13783   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13784   goto __pyx_L0;
13785   __pyx_L1_error:;
13786   __Pyx_XDECREF(__pyx_t_1);
13787   __Pyx_XDECREF(__pyx_t_4);
13788   __Pyx_XDECREF(__pyx_t_5);
13789   __Pyx_XDECREF(__pyx_t_6);
13790   __Pyx_XDECREF(__pyx_t_8);
13791   __Pyx_XDECREF(__pyx_t_10);
13792   __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
13793   __pyx_r = 0;
13794   __pyx_L0:;
13795   __Pyx_XDECREF(__pyx_v_struct);
13796   __Pyx_XDECREF(__pyx_v_bytesvalue);
13797   __Pyx_XGIVEREF(__pyx_r);
13798   __Pyx_RefNannyFinishContext();
13799   return __pyx_r;
13800 }
13801 
13802 /* "View.MemoryView":514
13803  *
13804  *     @cname('getbuffer')
13805  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
13806  *         if flags & PyBUF_WRITABLE and self.view.readonly:
13807  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
13808  */
13809 
13810 /* Python wrapper */
13811 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)13812 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
13813   int __pyx_r;
13814   __Pyx_RefNannyDeclarations
13815   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
13816   __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));
13817 
13818   /* function exit code */
13819   __Pyx_RefNannyFinishContext();
13820   return __pyx_r;
13821 }
13822 
__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)13823 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) {
13824   int __pyx_r;
13825   __Pyx_RefNannyDeclarations
13826   int __pyx_t_1;
13827   int __pyx_t_2;
13828   PyObject *__pyx_t_3 = NULL;
13829   Py_ssize_t *__pyx_t_4;
13830   char *__pyx_t_5;
13831   void *__pyx_t_6;
13832   int __pyx_t_7;
13833   Py_ssize_t __pyx_t_8;
13834   if (__pyx_v_info == NULL) {
13835     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
13836     return -1;
13837   }
13838   __Pyx_RefNannySetupContext("__getbuffer__", 0);
13839   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
13840   __Pyx_GIVEREF(__pyx_v_info->obj);
13841 
13842   /* "View.MemoryView":515
13843  *     @cname('getbuffer')
13844  *     def __getbuffer__(self, Py_buffer *info, int flags):
13845  *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
13846  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
13847  *
13848  */
13849   __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
13850   if (__pyx_t_2) {
13851   } else {
13852     __pyx_t_1 = __pyx_t_2;
13853     goto __pyx_L4_bool_binop_done;
13854   }
13855   __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
13856   __pyx_t_1 = __pyx_t_2;
13857   __pyx_L4_bool_binop_done:;
13858   if (unlikely(__pyx_t_1)) {
13859 
13860     /* "View.MemoryView":516
13861  *     def __getbuffer__(self, Py_buffer *info, int flags):
13862  *         if flags & PyBUF_WRITABLE and self.view.readonly:
13863  *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
13864  *
13865  *         if flags & PyBUF_ND:
13866  */
13867     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 516, __pyx_L1_error)
13868     __Pyx_GOTREF(__pyx_t_3);
13869     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
13870     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13871     __PYX_ERR(2, 516, __pyx_L1_error)
13872 
13873     /* "View.MemoryView":515
13874  *     @cname('getbuffer')
13875  *     def __getbuffer__(self, Py_buffer *info, int flags):
13876  *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
13877  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
13878  *
13879  */
13880   }
13881 
13882   /* "View.MemoryView":518
13883  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
13884  *
13885  *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
13886  *             info.shape = self.view.shape
13887  *         else:
13888  */
13889   __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
13890   if (__pyx_t_1) {
13891 
13892     /* "View.MemoryView":519
13893  *
13894  *         if flags & PyBUF_ND:
13895  *             info.shape = self.view.shape             # <<<<<<<<<<<<<<
13896  *         else:
13897  *             info.shape = NULL
13898  */
13899     __pyx_t_4 = __pyx_v_self->view.shape;
13900     __pyx_v_info->shape = __pyx_t_4;
13901 
13902     /* "View.MemoryView":518
13903  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
13904  *
13905  *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
13906  *             info.shape = self.view.shape
13907  *         else:
13908  */
13909     goto __pyx_L6;
13910   }
13911 
13912   /* "View.MemoryView":521
13913  *             info.shape = self.view.shape
13914  *         else:
13915  *             info.shape = NULL             # <<<<<<<<<<<<<<
13916  *
13917  *         if flags & PyBUF_STRIDES:
13918  */
13919   /*else*/ {
13920     __pyx_v_info->shape = NULL;
13921   }
13922   __pyx_L6:;
13923 
13924   /* "View.MemoryView":523
13925  *             info.shape = NULL
13926  *
13927  *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
13928  *             info.strides = self.view.strides
13929  *         else:
13930  */
13931   __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
13932   if (__pyx_t_1) {
13933 
13934     /* "View.MemoryView":524
13935  *
13936  *         if flags & PyBUF_STRIDES:
13937  *             info.strides = self.view.strides             # <<<<<<<<<<<<<<
13938  *         else:
13939  *             info.strides = NULL
13940  */
13941     __pyx_t_4 = __pyx_v_self->view.strides;
13942     __pyx_v_info->strides = __pyx_t_4;
13943 
13944     /* "View.MemoryView":523
13945  *             info.shape = NULL
13946  *
13947  *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
13948  *             info.strides = self.view.strides
13949  *         else:
13950  */
13951     goto __pyx_L7;
13952   }
13953 
13954   /* "View.MemoryView":526
13955  *             info.strides = self.view.strides
13956  *         else:
13957  *             info.strides = NULL             # <<<<<<<<<<<<<<
13958  *
13959  *         if flags & PyBUF_INDIRECT:
13960  */
13961   /*else*/ {
13962     __pyx_v_info->strides = NULL;
13963   }
13964   __pyx_L7:;
13965 
13966   /* "View.MemoryView":528
13967  *             info.strides = NULL
13968  *
13969  *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
13970  *             info.suboffsets = self.view.suboffsets
13971  *         else:
13972  */
13973   __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
13974   if (__pyx_t_1) {
13975 
13976     /* "View.MemoryView":529
13977  *
13978  *         if flags & PyBUF_INDIRECT:
13979  *             info.suboffsets = self.view.suboffsets             # <<<<<<<<<<<<<<
13980  *         else:
13981  *             info.suboffsets = NULL
13982  */
13983     __pyx_t_4 = __pyx_v_self->view.suboffsets;
13984     __pyx_v_info->suboffsets = __pyx_t_4;
13985 
13986     /* "View.MemoryView":528
13987  *             info.strides = NULL
13988  *
13989  *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
13990  *             info.suboffsets = self.view.suboffsets
13991  *         else:
13992  */
13993     goto __pyx_L8;
13994   }
13995 
13996   /* "View.MemoryView":531
13997  *             info.suboffsets = self.view.suboffsets
13998  *         else:
13999  *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
14000  *
14001  *         if flags & PyBUF_FORMAT:
14002  */
14003   /*else*/ {
14004     __pyx_v_info->suboffsets = NULL;
14005   }
14006   __pyx_L8:;
14007 
14008   /* "View.MemoryView":533
14009  *             info.suboffsets = NULL
14010  *
14011  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
14012  *             info.format = self.view.format
14013  *         else:
14014  */
14015   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
14016   if (__pyx_t_1) {
14017 
14018     /* "View.MemoryView":534
14019  *
14020  *         if flags & PyBUF_FORMAT:
14021  *             info.format = self.view.format             # <<<<<<<<<<<<<<
14022  *         else:
14023  *             info.format = NULL
14024  */
14025     __pyx_t_5 = __pyx_v_self->view.format;
14026     __pyx_v_info->format = __pyx_t_5;
14027 
14028     /* "View.MemoryView":533
14029  *             info.suboffsets = NULL
14030  *
14031  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
14032  *             info.format = self.view.format
14033  *         else:
14034  */
14035     goto __pyx_L9;
14036   }
14037 
14038   /* "View.MemoryView":536
14039  *             info.format = self.view.format
14040  *         else:
14041  *             info.format = NULL             # <<<<<<<<<<<<<<
14042  *
14043  *         info.buf = self.view.buf
14044  */
14045   /*else*/ {
14046     __pyx_v_info->format = NULL;
14047   }
14048   __pyx_L9:;
14049 
14050   /* "View.MemoryView":538
14051  *             info.format = NULL
14052  *
14053  *         info.buf = self.view.buf             # <<<<<<<<<<<<<<
14054  *         info.ndim = self.view.ndim
14055  *         info.itemsize = self.view.itemsize
14056  */
14057   __pyx_t_6 = __pyx_v_self->view.buf;
14058   __pyx_v_info->buf = __pyx_t_6;
14059 
14060   /* "View.MemoryView":539
14061  *
14062  *         info.buf = self.view.buf
14063  *         info.ndim = self.view.ndim             # <<<<<<<<<<<<<<
14064  *         info.itemsize = self.view.itemsize
14065  *         info.len = self.view.len
14066  */
14067   __pyx_t_7 = __pyx_v_self->view.ndim;
14068   __pyx_v_info->ndim = __pyx_t_7;
14069 
14070   /* "View.MemoryView":540
14071  *         info.buf = self.view.buf
14072  *         info.ndim = self.view.ndim
14073  *         info.itemsize = self.view.itemsize             # <<<<<<<<<<<<<<
14074  *         info.len = self.view.len
14075  *         info.readonly = self.view.readonly
14076  */
14077   __pyx_t_8 = __pyx_v_self->view.itemsize;
14078   __pyx_v_info->itemsize = __pyx_t_8;
14079 
14080   /* "View.MemoryView":541
14081  *         info.ndim = self.view.ndim
14082  *         info.itemsize = self.view.itemsize
14083  *         info.len = self.view.len             # <<<<<<<<<<<<<<
14084  *         info.readonly = self.view.readonly
14085  *         info.obj = self
14086  */
14087   __pyx_t_8 = __pyx_v_self->view.len;
14088   __pyx_v_info->len = __pyx_t_8;
14089 
14090   /* "View.MemoryView":542
14091  *         info.itemsize = self.view.itemsize
14092  *         info.len = self.view.len
14093  *         info.readonly = self.view.readonly             # <<<<<<<<<<<<<<
14094  *         info.obj = self
14095  *
14096  */
14097   __pyx_t_1 = __pyx_v_self->view.readonly;
14098   __pyx_v_info->readonly = __pyx_t_1;
14099 
14100   /* "View.MemoryView":543
14101  *         info.len = self.view.len
14102  *         info.readonly = self.view.readonly
14103  *         info.obj = self             # <<<<<<<<<<<<<<
14104  *
14105  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
14106  */
14107   __Pyx_INCREF(((PyObject *)__pyx_v_self));
14108   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
14109   __Pyx_GOTREF(__pyx_v_info->obj);
14110   __Pyx_DECREF(__pyx_v_info->obj);
14111   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
14112 
14113   /* "View.MemoryView":514
14114  *
14115  *     @cname('getbuffer')
14116  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
14117  *         if flags & PyBUF_WRITABLE and self.view.readonly:
14118  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
14119  */
14120 
14121   /* function exit code */
14122   __pyx_r = 0;
14123   goto __pyx_L0;
14124   __pyx_L1_error:;
14125   __Pyx_XDECREF(__pyx_t_3);
14126   __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14127   __pyx_r = -1;
14128   if (__pyx_v_info->obj != NULL) {
14129     __Pyx_GOTREF(__pyx_v_info->obj);
14130     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
14131   }
14132   goto __pyx_L2;
14133   __pyx_L0:;
14134   if (__pyx_v_info->obj == Py_None) {
14135     __Pyx_GOTREF(__pyx_v_info->obj);
14136     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
14137   }
14138   __pyx_L2:;
14139   __Pyx_RefNannyFinishContext();
14140   return __pyx_r;
14141 }
14142 
14143 /* "View.MemoryView":549
14144  *
14145  *     @property
14146  *     def T(self):             # <<<<<<<<<<<<<<
14147  *         cdef _memoryviewslice result = memoryview_copy(self)
14148  *         transpose_memslice(&result.from_slice)
14149  */
14150 
14151 /* Python wrapper */
14152 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)14153 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
14154   PyObject *__pyx_r = 0;
14155   __Pyx_RefNannyDeclarations
14156   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
14157   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
14158 
14159   /* function exit code */
14160   __Pyx_RefNannyFinishContext();
14161   return __pyx_r;
14162 }
14163 
__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj * __pyx_v_self)14164 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
14165   struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
14166   PyObject *__pyx_r = NULL;
14167   __Pyx_RefNannyDeclarations
14168   PyObject *__pyx_t_1 = NULL;
14169   int __pyx_t_2;
14170   __Pyx_RefNannySetupContext("__get__", 0);
14171 
14172   /* "View.MemoryView":550
14173  *     @property
14174  *     def T(self):
14175  *         cdef _memoryviewslice result = memoryview_copy(self)             # <<<<<<<<<<<<<<
14176  *         transpose_memslice(&result.from_slice)
14177  *         return result
14178  */
14179   __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 550, __pyx_L1_error)
14180   __Pyx_GOTREF(__pyx_t_1);
14181   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 550, __pyx_L1_error)
14182   __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
14183   __pyx_t_1 = 0;
14184 
14185   /* "View.MemoryView":551
14186  *     def T(self):
14187  *         cdef _memoryviewslice result = memoryview_copy(self)
14188  *         transpose_memslice(&result.from_slice)             # <<<<<<<<<<<<<<
14189  *         return result
14190  *
14191  */
14192   __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 551, __pyx_L1_error)
14193 
14194   /* "View.MemoryView":552
14195  *         cdef _memoryviewslice result = memoryview_copy(self)
14196  *         transpose_memslice(&result.from_slice)
14197  *         return result             # <<<<<<<<<<<<<<
14198  *
14199  *     @property
14200  */
14201   __Pyx_XDECREF(__pyx_r);
14202   __Pyx_INCREF(((PyObject *)__pyx_v_result));
14203   __pyx_r = ((PyObject *)__pyx_v_result);
14204   goto __pyx_L0;
14205 
14206   /* "View.MemoryView":549
14207  *
14208  *     @property
14209  *     def T(self):             # <<<<<<<<<<<<<<
14210  *         cdef _memoryviewslice result = memoryview_copy(self)
14211  *         transpose_memslice(&result.from_slice)
14212  */
14213 
14214   /* function exit code */
14215   __pyx_L1_error:;
14216   __Pyx_XDECREF(__pyx_t_1);
14217   __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14218   __pyx_r = NULL;
14219   __pyx_L0:;
14220   __Pyx_XDECREF((PyObject *)__pyx_v_result);
14221   __Pyx_XGIVEREF(__pyx_r);
14222   __Pyx_RefNannyFinishContext();
14223   return __pyx_r;
14224 }
14225 
14226 /* "View.MemoryView":555
14227  *
14228  *     @property
14229  *     def base(self):             # <<<<<<<<<<<<<<
14230  *         return self.obj
14231  *
14232  */
14233 
14234 /* Python wrapper */
14235 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)14236 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
14237   PyObject *__pyx_r = 0;
14238   __Pyx_RefNannyDeclarations
14239   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
14240   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
14241 
14242   /* function exit code */
14243   __Pyx_RefNannyFinishContext();
14244   return __pyx_r;
14245 }
14246 
__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj * __pyx_v_self)14247 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
14248   PyObject *__pyx_r = NULL;
14249   __Pyx_RefNannyDeclarations
14250   __Pyx_RefNannySetupContext("__get__", 0);
14251 
14252   /* "View.MemoryView":556
14253  *     @property
14254  *     def base(self):
14255  *         return self.obj             # <<<<<<<<<<<<<<
14256  *
14257  *     @property
14258  */
14259   __Pyx_XDECREF(__pyx_r);
14260   __Pyx_INCREF(__pyx_v_self->obj);
14261   __pyx_r = __pyx_v_self->obj;
14262   goto __pyx_L0;
14263 
14264   /* "View.MemoryView":555
14265  *
14266  *     @property
14267  *     def base(self):             # <<<<<<<<<<<<<<
14268  *         return self.obj
14269  *
14270  */
14271 
14272   /* function exit code */
14273   __pyx_L0:;
14274   __Pyx_XGIVEREF(__pyx_r);
14275   __Pyx_RefNannyFinishContext();
14276   return __pyx_r;
14277 }
14278 
14279 /* "View.MemoryView":559
14280  *
14281  *     @property
14282  *     def shape(self):             # <<<<<<<<<<<<<<
14283  *         return tuple([length for length in self.view.shape[:self.view.ndim]])
14284  *
14285  */
14286 
14287 /* Python wrapper */
14288 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)14289 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
14290   PyObject *__pyx_r = 0;
14291   __Pyx_RefNannyDeclarations
14292   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
14293   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
14294 
14295   /* function exit code */
14296   __Pyx_RefNannyFinishContext();
14297   return __pyx_r;
14298 }
14299 
__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj * __pyx_v_self)14300 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
14301   Py_ssize_t __pyx_v_length;
14302   PyObject *__pyx_r = NULL;
14303   __Pyx_RefNannyDeclarations
14304   PyObject *__pyx_t_1 = NULL;
14305   Py_ssize_t *__pyx_t_2;
14306   Py_ssize_t *__pyx_t_3;
14307   Py_ssize_t *__pyx_t_4;
14308   PyObject *__pyx_t_5 = NULL;
14309   __Pyx_RefNannySetupContext("__get__", 0);
14310 
14311   /* "View.MemoryView":560
14312  *     @property
14313  *     def shape(self):
14314  *         return tuple([length for length in self.view.shape[:self.view.ndim]])             # <<<<<<<<<<<<<<
14315  *
14316  *     @property
14317  */
14318   __Pyx_XDECREF(__pyx_r);
14319   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 560, __pyx_L1_error)
14320   __Pyx_GOTREF(__pyx_t_1);
14321   __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
14322   for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
14323     __pyx_t_2 = __pyx_t_4;
14324     __pyx_v_length = (__pyx_t_2[0]);
14325     __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 560, __pyx_L1_error)
14326     __Pyx_GOTREF(__pyx_t_5);
14327     if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 560, __pyx_L1_error)
14328     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14329   }
14330   __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 560, __pyx_L1_error)
14331   __Pyx_GOTREF(__pyx_t_5);
14332   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14333   __pyx_r = __pyx_t_5;
14334   __pyx_t_5 = 0;
14335   goto __pyx_L0;
14336 
14337   /* "View.MemoryView":559
14338  *
14339  *     @property
14340  *     def shape(self):             # <<<<<<<<<<<<<<
14341  *         return tuple([length for length in self.view.shape[:self.view.ndim]])
14342  *
14343  */
14344 
14345   /* function exit code */
14346   __pyx_L1_error:;
14347   __Pyx_XDECREF(__pyx_t_1);
14348   __Pyx_XDECREF(__pyx_t_5);
14349   __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14350   __pyx_r = NULL;
14351   __pyx_L0:;
14352   __Pyx_XGIVEREF(__pyx_r);
14353   __Pyx_RefNannyFinishContext();
14354   return __pyx_r;
14355 }
14356 
14357 /* "View.MemoryView":563
14358  *
14359  *     @property
14360  *     def strides(self):             # <<<<<<<<<<<<<<
14361  *         if self.view.strides == NULL:
14362  *
14363  */
14364 
14365 /* Python wrapper */
14366 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)14367 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
14368   PyObject *__pyx_r = 0;
14369   __Pyx_RefNannyDeclarations
14370   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
14371   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
14372 
14373   /* function exit code */
14374   __Pyx_RefNannyFinishContext();
14375   return __pyx_r;
14376 }
14377 
__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj * __pyx_v_self)14378 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
14379   Py_ssize_t __pyx_v_stride;
14380   PyObject *__pyx_r = NULL;
14381   __Pyx_RefNannyDeclarations
14382   int __pyx_t_1;
14383   PyObject *__pyx_t_2 = NULL;
14384   Py_ssize_t *__pyx_t_3;
14385   Py_ssize_t *__pyx_t_4;
14386   Py_ssize_t *__pyx_t_5;
14387   PyObject *__pyx_t_6 = NULL;
14388   __Pyx_RefNannySetupContext("__get__", 0);
14389 
14390   /* "View.MemoryView":564
14391  *     @property
14392  *     def strides(self):
14393  *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
14394  *
14395  *             raise ValueError("Buffer view does not expose strides")
14396  */
14397   __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
14398   if (unlikely(__pyx_t_1)) {
14399 
14400     /* "View.MemoryView":566
14401  *         if self.view.strides == NULL:
14402  *
14403  *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
14404  *
14405  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
14406  */
14407     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 566, __pyx_L1_error)
14408     __Pyx_GOTREF(__pyx_t_2);
14409     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
14410     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14411     __PYX_ERR(2, 566, __pyx_L1_error)
14412 
14413     /* "View.MemoryView":564
14414  *     @property
14415  *     def strides(self):
14416  *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
14417  *
14418  *             raise ValueError("Buffer view does not expose strides")
14419  */
14420   }
14421 
14422   /* "View.MemoryView":568
14423  *             raise ValueError("Buffer view does not expose strides")
14424  *
14425  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])             # <<<<<<<<<<<<<<
14426  *
14427  *     @property
14428  */
14429   __Pyx_XDECREF(__pyx_r);
14430   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 568, __pyx_L1_error)
14431   __Pyx_GOTREF(__pyx_t_2);
14432   __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
14433   for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
14434     __pyx_t_3 = __pyx_t_5;
14435     __pyx_v_stride = (__pyx_t_3[0]);
14436     __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 568, __pyx_L1_error)
14437     __Pyx_GOTREF(__pyx_t_6);
14438     if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 568, __pyx_L1_error)
14439     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14440   }
14441   __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 568, __pyx_L1_error)
14442   __Pyx_GOTREF(__pyx_t_6);
14443   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14444   __pyx_r = __pyx_t_6;
14445   __pyx_t_6 = 0;
14446   goto __pyx_L0;
14447 
14448   /* "View.MemoryView":563
14449  *
14450  *     @property
14451  *     def strides(self):             # <<<<<<<<<<<<<<
14452  *         if self.view.strides == NULL:
14453  *
14454  */
14455 
14456   /* function exit code */
14457   __pyx_L1_error:;
14458   __Pyx_XDECREF(__pyx_t_2);
14459   __Pyx_XDECREF(__pyx_t_6);
14460   __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14461   __pyx_r = NULL;
14462   __pyx_L0:;
14463   __Pyx_XGIVEREF(__pyx_r);
14464   __Pyx_RefNannyFinishContext();
14465   return __pyx_r;
14466 }
14467 
14468 /* "View.MemoryView":571
14469  *
14470  *     @property
14471  *     def suboffsets(self):             # <<<<<<<<<<<<<<
14472  *         if self.view.suboffsets == NULL:
14473  *             return (-1,) * self.view.ndim
14474  */
14475 
14476 /* Python wrapper */
14477 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)14478 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
14479   PyObject *__pyx_r = 0;
14480   __Pyx_RefNannyDeclarations
14481   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
14482   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
14483 
14484   /* function exit code */
14485   __Pyx_RefNannyFinishContext();
14486   return __pyx_r;
14487 }
14488 
__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj * __pyx_v_self)14489 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
14490   Py_ssize_t __pyx_v_suboffset;
14491   PyObject *__pyx_r = NULL;
14492   __Pyx_RefNannyDeclarations
14493   int __pyx_t_1;
14494   PyObject *__pyx_t_2 = NULL;
14495   PyObject *__pyx_t_3 = NULL;
14496   Py_ssize_t *__pyx_t_4;
14497   Py_ssize_t *__pyx_t_5;
14498   Py_ssize_t *__pyx_t_6;
14499   __Pyx_RefNannySetupContext("__get__", 0);
14500 
14501   /* "View.MemoryView":572
14502  *     @property
14503  *     def suboffsets(self):
14504  *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
14505  *             return (-1,) * self.view.ndim
14506  *
14507  */
14508   __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
14509   if (__pyx_t_1) {
14510 
14511     /* "View.MemoryView":573
14512  *     def suboffsets(self):
14513  *         if self.view.suboffsets == NULL:
14514  *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
14515  *
14516  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
14517  */
14518     __Pyx_XDECREF(__pyx_r);
14519     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 573, __pyx_L1_error)
14520     __Pyx_GOTREF(__pyx_t_2);
14521     __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__19, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 573, __pyx_L1_error)
14522     __Pyx_GOTREF(__pyx_t_3);
14523     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14524     __pyx_r = __pyx_t_3;
14525     __pyx_t_3 = 0;
14526     goto __pyx_L0;
14527 
14528     /* "View.MemoryView":572
14529  *     @property
14530  *     def suboffsets(self):
14531  *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
14532  *             return (-1,) * self.view.ndim
14533  *
14534  */
14535   }
14536 
14537   /* "View.MemoryView":575
14538  *             return (-1,) * self.view.ndim
14539  *
14540  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])             # <<<<<<<<<<<<<<
14541  *
14542  *     @property
14543  */
14544   __Pyx_XDECREF(__pyx_r);
14545   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 575, __pyx_L1_error)
14546   __Pyx_GOTREF(__pyx_t_3);
14547   __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
14548   for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
14549     __pyx_t_4 = __pyx_t_6;
14550     __pyx_v_suboffset = (__pyx_t_4[0]);
14551     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 575, __pyx_L1_error)
14552     __Pyx_GOTREF(__pyx_t_2);
14553     if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 575, __pyx_L1_error)
14554     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14555   }
14556   __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 575, __pyx_L1_error)
14557   __Pyx_GOTREF(__pyx_t_2);
14558   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14559   __pyx_r = __pyx_t_2;
14560   __pyx_t_2 = 0;
14561   goto __pyx_L0;
14562 
14563   /* "View.MemoryView":571
14564  *
14565  *     @property
14566  *     def suboffsets(self):             # <<<<<<<<<<<<<<
14567  *         if self.view.suboffsets == NULL:
14568  *             return (-1,) * self.view.ndim
14569  */
14570 
14571   /* function exit code */
14572   __pyx_L1_error:;
14573   __Pyx_XDECREF(__pyx_t_2);
14574   __Pyx_XDECREF(__pyx_t_3);
14575   __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14576   __pyx_r = NULL;
14577   __pyx_L0:;
14578   __Pyx_XGIVEREF(__pyx_r);
14579   __Pyx_RefNannyFinishContext();
14580   return __pyx_r;
14581 }
14582 
14583 /* "View.MemoryView":578
14584  *
14585  *     @property
14586  *     def ndim(self):             # <<<<<<<<<<<<<<
14587  *         return self.view.ndim
14588  *
14589  */
14590 
14591 /* Python wrapper */
14592 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)14593 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
14594   PyObject *__pyx_r = 0;
14595   __Pyx_RefNannyDeclarations
14596   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
14597   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
14598 
14599   /* function exit code */
14600   __Pyx_RefNannyFinishContext();
14601   return __pyx_r;
14602 }
14603 
__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj * __pyx_v_self)14604 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
14605   PyObject *__pyx_r = NULL;
14606   __Pyx_RefNannyDeclarations
14607   PyObject *__pyx_t_1 = NULL;
14608   __Pyx_RefNannySetupContext("__get__", 0);
14609 
14610   /* "View.MemoryView":579
14611  *     @property
14612  *     def ndim(self):
14613  *         return self.view.ndim             # <<<<<<<<<<<<<<
14614  *
14615  *     @property
14616  */
14617   __Pyx_XDECREF(__pyx_r);
14618   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 579, __pyx_L1_error)
14619   __Pyx_GOTREF(__pyx_t_1);
14620   __pyx_r = __pyx_t_1;
14621   __pyx_t_1 = 0;
14622   goto __pyx_L0;
14623 
14624   /* "View.MemoryView":578
14625  *
14626  *     @property
14627  *     def ndim(self):             # <<<<<<<<<<<<<<
14628  *         return self.view.ndim
14629  *
14630  */
14631 
14632   /* function exit code */
14633   __pyx_L1_error:;
14634   __Pyx_XDECREF(__pyx_t_1);
14635   __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14636   __pyx_r = NULL;
14637   __pyx_L0:;
14638   __Pyx_XGIVEREF(__pyx_r);
14639   __Pyx_RefNannyFinishContext();
14640   return __pyx_r;
14641 }
14642 
14643 /* "View.MemoryView":582
14644  *
14645  *     @property
14646  *     def itemsize(self):             # <<<<<<<<<<<<<<
14647  *         return self.view.itemsize
14648  *
14649  */
14650 
14651 /* Python wrapper */
14652 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)14653 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
14654   PyObject *__pyx_r = 0;
14655   __Pyx_RefNannyDeclarations
14656   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
14657   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
14658 
14659   /* function exit code */
14660   __Pyx_RefNannyFinishContext();
14661   return __pyx_r;
14662 }
14663 
__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj * __pyx_v_self)14664 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
14665   PyObject *__pyx_r = NULL;
14666   __Pyx_RefNannyDeclarations
14667   PyObject *__pyx_t_1 = NULL;
14668   __Pyx_RefNannySetupContext("__get__", 0);
14669 
14670   /* "View.MemoryView":583
14671  *     @property
14672  *     def itemsize(self):
14673  *         return self.view.itemsize             # <<<<<<<<<<<<<<
14674  *
14675  *     @property
14676  */
14677   __Pyx_XDECREF(__pyx_r);
14678   __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 583, __pyx_L1_error)
14679   __Pyx_GOTREF(__pyx_t_1);
14680   __pyx_r = __pyx_t_1;
14681   __pyx_t_1 = 0;
14682   goto __pyx_L0;
14683 
14684   /* "View.MemoryView":582
14685  *
14686  *     @property
14687  *     def itemsize(self):             # <<<<<<<<<<<<<<
14688  *         return self.view.itemsize
14689  *
14690  */
14691 
14692   /* function exit code */
14693   __pyx_L1_error:;
14694   __Pyx_XDECREF(__pyx_t_1);
14695   __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14696   __pyx_r = NULL;
14697   __pyx_L0:;
14698   __Pyx_XGIVEREF(__pyx_r);
14699   __Pyx_RefNannyFinishContext();
14700   return __pyx_r;
14701 }
14702 
14703 /* "View.MemoryView":586
14704  *
14705  *     @property
14706  *     def nbytes(self):             # <<<<<<<<<<<<<<
14707  *         return self.size * self.view.itemsize
14708  *
14709  */
14710 
14711 /* Python wrapper */
14712 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)14713 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
14714   PyObject *__pyx_r = 0;
14715   __Pyx_RefNannyDeclarations
14716   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
14717   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
14718 
14719   /* function exit code */
14720   __Pyx_RefNannyFinishContext();
14721   return __pyx_r;
14722 }
14723 
__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj * __pyx_v_self)14724 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
14725   PyObject *__pyx_r = NULL;
14726   __Pyx_RefNannyDeclarations
14727   PyObject *__pyx_t_1 = NULL;
14728   PyObject *__pyx_t_2 = NULL;
14729   PyObject *__pyx_t_3 = NULL;
14730   __Pyx_RefNannySetupContext("__get__", 0);
14731 
14732   /* "View.MemoryView":587
14733  *     @property
14734  *     def nbytes(self):
14735  *         return self.size * self.view.itemsize             # <<<<<<<<<<<<<<
14736  *
14737  *     @property
14738  */
14739   __Pyx_XDECREF(__pyx_r);
14740   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 587, __pyx_L1_error)
14741   __Pyx_GOTREF(__pyx_t_1);
14742   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 587, __pyx_L1_error)
14743   __Pyx_GOTREF(__pyx_t_2);
14744   __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 587, __pyx_L1_error)
14745   __Pyx_GOTREF(__pyx_t_3);
14746   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14747   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14748   __pyx_r = __pyx_t_3;
14749   __pyx_t_3 = 0;
14750   goto __pyx_L0;
14751 
14752   /* "View.MemoryView":586
14753  *
14754  *     @property
14755  *     def nbytes(self):             # <<<<<<<<<<<<<<
14756  *         return self.size * self.view.itemsize
14757  *
14758  */
14759 
14760   /* function exit code */
14761   __pyx_L1_error:;
14762   __Pyx_XDECREF(__pyx_t_1);
14763   __Pyx_XDECREF(__pyx_t_2);
14764   __Pyx_XDECREF(__pyx_t_3);
14765   __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14766   __pyx_r = NULL;
14767   __pyx_L0:;
14768   __Pyx_XGIVEREF(__pyx_r);
14769   __Pyx_RefNannyFinishContext();
14770   return __pyx_r;
14771 }
14772 
14773 /* "View.MemoryView":590
14774  *
14775  *     @property
14776  *     def size(self):             # <<<<<<<<<<<<<<
14777  *         if self._size is None:
14778  *             result = 1
14779  */
14780 
14781 /* Python wrapper */
14782 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)14783 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
14784   PyObject *__pyx_r = 0;
14785   __Pyx_RefNannyDeclarations
14786   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
14787   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
14788 
14789   /* function exit code */
14790   __Pyx_RefNannyFinishContext();
14791   return __pyx_r;
14792 }
14793 
__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj * __pyx_v_self)14794 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
14795   PyObject *__pyx_v_result = NULL;
14796   PyObject *__pyx_v_length = NULL;
14797   PyObject *__pyx_r = NULL;
14798   __Pyx_RefNannyDeclarations
14799   int __pyx_t_1;
14800   int __pyx_t_2;
14801   Py_ssize_t *__pyx_t_3;
14802   Py_ssize_t *__pyx_t_4;
14803   Py_ssize_t *__pyx_t_5;
14804   PyObject *__pyx_t_6 = NULL;
14805   __Pyx_RefNannySetupContext("__get__", 0);
14806 
14807   /* "View.MemoryView":591
14808  *     @property
14809  *     def size(self):
14810  *         if self._size is None:             # <<<<<<<<<<<<<<
14811  *             result = 1
14812  *
14813  */
14814   __pyx_t_1 = (__pyx_v_self->_size == Py_None);
14815   __pyx_t_2 = (__pyx_t_1 != 0);
14816   if (__pyx_t_2) {
14817 
14818     /* "View.MemoryView":592
14819  *     def size(self):
14820  *         if self._size is None:
14821  *             result = 1             # <<<<<<<<<<<<<<
14822  *
14823  *             for length in self.view.shape[:self.view.ndim]:
14824  */
14825     __Pyx_INCREF(__pyx_int_1);
14826     __pyx_v_result = __pyx_int_1;
14827 
14828     /* "View.MemoryView":594
14829  *             result = 1
14830  *
14831  *             for length in self.view.shape[:self.view.ndim]:             # <<<<<<<<<<<<<<
14832  *                 result *= length
14833  *
14834  */
14835     __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
14836     for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
14837       __pyx_t_3 = __pyx_t_5;
14838       __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 594, __pyx_L1_error)
14839       __Pyx_GOTREF(__pyx_t_6);
14840       __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
14841       __pyx_t_6 = 0;
14842 
14843       /* "View.MemoryView":595
14844  *
14845  *             for length in self.view.shape[:self.view.ndim]:
14846  *                 result *= length             # <<<<<<<<<<<<<<
14847  *
14848  *             self._size = result
14849  */
14850       __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 595, __pyx_L1_error)
14851       __Pyx_GOTREF(__pyx_t_6);
14852       __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
14853       __pyx_t_6 = 0;
14854     }
14855 
14856     /* "View.MemoryView":597
14857  *                 result *= length
14858  *
14859  *             self._size = result             # <<<<<<<<<<<<<<
14860  *
14861  *         return self._size
14862  */
14863     __Pyx_INCREF(__pyx_v_result);
14864     __Pyx_GIVEREF(__pyx_v_result);
14865     __Pyx_GOTREF(__pyx_v_self->_size);
14866     __Pyx_DECREF(__pyx_v_self->_size);
14867     __pyx_v_self->_size = __pyx_v_result;
14868 
14869     /* "View.MemoryView":591
14870  *     @property
14871  *     def size(self):
14872  *         if self._size is None:             # <<<<<<<<<<<<<<
14873  *             result = 1
14874  *
14875  */
14876   }
14877 
14878   /* "View.MemoryView":599
14879  *             self._size = result
14880  *
14881  *         return self._size             # <<<<<<<<<<<<<<
14882  *
14883  *     def __len__(self):
14884  */
14885   __Pyx_XDECREF(__pyx_r);
14886   __Pyx_INCREF(__pyx_v_self->_size);
14887   __pyx_r = __pyx_v_self->_size;
14888   goto __pyx_L0;
14889 
14890   /* "View.MemoryView":590
14891  *
14892  *     @property
14893  *     def size(self):             # <<<<<<<<<<<<<<
14894  *         if self._size is None:
14895  *             result = 1
14896  */
14897 
14898   /* function exit code */
14899   __pyx_L1_error:;
14900   __Pyx_XDECREF(__pyx_t_6);
14901   __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14902   __pyx_r = NULL;
14903   __pyx_L0:;
14904   __Pyx_XDECREF(__pyx_v_result);
14905   __Pyx_XDECREF(__pyx_v_length);
14906   __Pyx_XGIVEREF(__pyx_r);
14907   __Pyx_RefNannyFinishContext();
14908   return __pyx_r;
14909 }
14910 
14911 /* "View.MemoryView":601
14912  *         return self._size
14913  *
14914  *     def __len__(self):             # <<<<<<<<<<<<<<
14915  *         if self.view.ndim >= 1:
14916  *             return self.view.shape[0]
14917  */
14918 
14919 /* Python wrapper */
14920 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___len__(PyObject * __pyx_v_self)14921 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
14922   Py_ssize_t __pyx_r;
14923   __Pyx_RefNannyDeclarations
14924   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
14925   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));
14926 
14927   /* function exit code */
14928   __Pyx_RefNannyFinishContext();
14929   return __pyx_r;
14930 }
14931 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj * __pyx_v_self)14932 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
14933   Py_ssize_t __pyx_r;
14934   __Pyx_RefNannyDeclarations
14935   int __pyx_t_1;
14936   __Pyx_RefNannySetupContext("__len__", 0);
14937 
14938   /* "View.MemoryView":602
14939  *
14940  *     def __len__(self):
14941  *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
14942  *             return self.view.shape[0]
14943  *
14944  */
14945   __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
14946   if (__pyx_t_1) {
14947 
14948     /* "View.MemoryView":603
14949  *     def __len__(self):
14950  *         if self.view.ndim >= 1:
14951  *             return self.view.shape[0]             # <<<<<<<<<<<<<<
14952  *
14953  *         return 0
14954  */
14955     __pyx_r = (__pyx_v_self->view.shape[0]);
14956     goto __pyx_L0;
14957 
14958     /* "View.MemoryView":602
14959  *
14960  *     def __len__(self):
14961  *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
14962  *             return self.view.shape[0]
14963  *
14964  */
14965   }
14966 
14967   /* "View.MemoryView":605
14968  *             return self.view.shape[0]
14969  *
14970  *         return 0             # <<<<<<<<<<<<<<
14971  *
14972  *     def __repr__(self):
14973  */
14974   __pyx_r = 0;
14975   goto __pyx_L0;
14976 
14977   /* "View.MemoryView":601
14978  *         return self._size
14979  *
14980  *     def __len__(self):             # <<<<<<<<<<<<<<
14981  *         if self.view.ndim >= 1:
14982  *             return self.view.shape[0]
14983  */
14984 
14985   /* function exit code */
14986   __pyx_L0:;
14987   __Pyx_RefNannyFinishContext();
14988   return __pyx_r;
14989 }
14990 
14991 /* "View.MemoryView":607
14992  *         return 0
14993  *
14994  *     def __repr__(self):             # <<<<<<<<<<<<<<
14995  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
14996  *                                                id(self))
14997  */
14998 
14999 /* Python wrapper */
15000 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___repr__(PyObject * __pyx_v_self)15001 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
15002   PyObject *__pyx_r = 0;
15003   __Pyx_RefNannyDeclarations
15004   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
15005   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));
15006 
15007   /* function exit code */
15008   __Pyx_RefNannyFinishContext();
15009   return __pyx_r;
15010 }
15011 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj * __pyx_v_self)15012 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
15013   PyObject *__pyx_r = NULL;
15014   __Pyx_RefNannyDeclarations
15015   PyObject *__pyx_t_1 = NULL;
15016   PyObject *__pyx_t_2 = NULL;
15017   PyObject *__pyx_t_3 = NULL;
15018   __Pyx_RefNannySetupContext("__repr__", 0);
15019 
15020   /* "View.MemoryView":608
15021  *
15022  *     def __repr__(self):
15023  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
15024  *                                                id(self))
15025  *
15026  */
15027   __Pyx_XDECREF(__pyx_r);
15028   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 608, __pyx_L1_error)
15029   __Pyx_GOTREF(__pyx_t_1);
15030   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 608, __pyx_L1_error)
15031   __Pyx_GOTREF(__pyx_t_2);
15032   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15033   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 608, __pyx_L1_error)
15034   __Pyx_GOTREF(__pyx_t_1);
15035   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15036 
15037   /* "View.MemoryView":609
15038  *     def __repr__(self):
15039  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
15040  *                                                id(self))             # <<<<<<<<<<<<<<
15041  *
15042  *     def __str__(self):
15043  */
15044   __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 609, __pyx_L1_error)
15045   __Pyx_GOTREF(__pyx_t_2);
15046 
15047   /* "View.MemoryView":608
15048  *
15049  *     def __repr__(self):
15050  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
15051  *                                                id(self))
15052  *
15053  */
15054   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 608, __pyx_L1_error)
15055   __Pyx_GOTREF(__pyx_t_3);
15056   __Pyx_GIVEREF(__pyx_t_1);
15057   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
15058   __Pyx_GIVEREF(__pyx_t_2);
15059   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
15060   __pyx_t_1 = 0;
15061   __pyx_t_2 = 0;
15062   __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 608, __pyx_L1_error)
15063   __Pyx_GOTREF(__pyx_t_2);
15064   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15065   __pyx_r = __pyx_t_2;
15066   __pyx_t_2 = 0;
15067   goto __pyx_L0;
15068 
15069   /* "View.MemoryView":607
15070  *         return 0
15071  *
15072  *     def __repr__(self):             # <<<<<<<<<<<<<<
15073  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
15074  *                                                id(self))
15075  */
15076 
15077   /* function exit code */
15078   __pyx_L1_error:;
15079   __Pyx_XDECREF(__pyx_t_1);
15080   __Pyx_XDECREF(__pyx_t_2);
15081   __Pyx_XDECREF(__pyx_t_3);
15082   __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15083   __pyx_r = NULL;
15084   __pyx_L0:;
15085   __Pyx_XGIVEREF(__pyx_r);
15086   __Pyx_RefNannyFinishContext();
15087   return __pyx_r;
15088 }
15089 
15090 /* "View.MemoryView":611
15091  *                                                id(self))
15092  *
15093  *     def __str__(self):             # <<<<<<<<<<<<<<
15094  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
15095  *
15096  */
15097 
15098 /* Python wrapper */
15099 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___str__(PyObject * __pyx_v_self)15100 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
15101   PyObject *__pyx_r = 0;
15102   __Pyx_RefNannyDeclarations
15103   __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
15104   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));
15105 
15106   /* function exit code */
15107   __Pyx_RefNannyFinishContext();
15108   return __pyx_r;
15109 }
15110 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj * __pyx_v_self)15111 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
15112   PyObject *__pyx_r = NULL;
15113   __Pyx_RefNannyDeclarations
15114   PyObject *__pyx_t_1 = NULL;
15115   PyObject *__pyx_t_2 = NULL;
15116   __Pyx_RefNannySetupContext("__str__", 0);
15117 
15118   /* "View.MemoryView":612
15119  *
15120  *     def __str__(self):
15121  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)             # <<<<<<<<<<<<<<
15122  *
15123  *
15124  */
15125   __Pyx_XDECREF(__pyx_r);
15126   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error)
15127   __Pyx_GOTREF(__pyx_t_1);
15128   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __pyx_L1_error)
15129   __Pyx_GOTREF(__pyx_t_2);
15130   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15131   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error)
15132   __Pyx_GOTREF(__pyx_t_1);
15133   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15134   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __pyx_L1_error)
15135   __Pyx_GOTREF(__pyx_t_2);
15136   __Pyx_GIVEREF(__pyx_t_1);
15137   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
15138   __pyx_t_1 = 0;
15139   __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error)
15140   __Pyx_GOTREF(__pyx_t_1);
15141   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15142   __pyx_r = __pyx_t_1;
15143   __pyx_t_1 = 0;
15144   goto __pyx_L0;
15145 
15146   /* "View.MemoryView":611
15147  *                                                id(self))
15148  *
15149  *     def __str__(self):             # <<<<<<<<<<<<<<
15150  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
15151  *
15152  */
15153 
15154   /* function exit code */
15155   __pyx_L1_error:;
15156   __Pyx_XDECREF(__pyx_t_1);
15157   __Pyx_XDECREF(__pyx_t_2);
15158   __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15159   __pyx_r = NULL;
15160   __pyx_L0:;
15161   __Pyx_XGIVEREF(__pyx_r);
15162   __Pyx_RefNannyFinishContext();
15163   return __pyx_r;
15164 }
15165 
15166 /* "View.MemoryView":615
15167  *
15168  *
15169  *     def is_c_contig(self):             # <<<<<<<<<<<<<<
15170  *         cdef __Pyx_memviewslice *mslice
15171  *         cdef __Pyx_memviewslice tmp
15172  */
15173 
15174 /* Python wrapper */
15175 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)15176 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
15177   PyObject *__pyx_r = 0;
15178   __Pyx_RefNannyDeclarations
15179   __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
15180   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
15181 
15182   /* function exit code */
15183   __Pyx_RefNannyFinishContext();
15184   return __pyx_r;
15185 }
15186 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj * __pyx_v_self)15187 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
15188   __Pyx_memviewslice *__pyx_v_mslice;
15189   __Pyx_memviewslice __pyx_v_tmp;
15190   PyObject *__pyx_r = NULL;
15191   __Pyx_RefNannyDeclarations
15192   PyObject *__pyx_t_1 = NULL;
15193   __Pyx_RefNannySetupContext("is_c_contig", 0);
15194 
15195   /* "View.MemoryView":618
15196  *         cdef __Pyx_memviewslice *mslice
15197  *         cdef __Pyx_memviewslice tmp
15198  *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
15199  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
15200  *
15201  */
15202   __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
15203 
15204   /* "View.MemoryView":619
15205  *         cdef __Pyx_memviewslice tmp
15206  *         mslice = get_slice_from_memview(self, &tmp)
15207  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)             # <<<<<<<<<<<<<<
15208  *
15209  *     def is_f_contig(self):
15210  */
15211   __Pyx_XDECREF(__pyx_r);
15212   __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 619, __pyx_L1_error)
15213   __Pyx_GOTREF(__pyx_t_1);
15214   __pyx_r = __pyx_t_1;
15215   __pyx_t_1 = 0;
15216   goto __pyx_L0;
15217 
15218   /* "View.MemoryView":615
15219  *
15220  *
15221  *     def is_c_contig(self):             # <<<<<<<<<<<<<<
15222  *         cdef __Pyx_memviewslice *mslice
15223  *         cdef __Pyx_memviewslice tmp
15224  */
15225 
15226   /* function exit code */
15227   __pyx_L1_error:;
15228   __Pyx_XDECREF(__pyx_t_1);
15229   __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
15230   __pyx_r = NULL;
15231   __pyx_L0:;
15232   __Pyx_XGIVEREF(__pyx_r);
15233   __Pyx_RefNannyFinishContext();
15234   return __pyx_r;
15235 }
15236 
15237 /* "View.MemoryView":621
15238  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
15239  *
15240  *     def is_f_contig(self):             # <<<<<<<<<<<<<<
15241  *         cdef __Pyx_memviewslice *mslice
15242  *         cdef __Pyx_memviewslice tmp
15243  */
15244 
15245 /* Python wrapper */
15246 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)15247 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
15248   PyObject *__pyx_r = 0;
15249   __Pyx_RefNannyDeclarations
15250   __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
15251   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
15252 
15253   /* function exit code */
15254   __Pyx_RefNannyFinishContext();
15255   return __pyx_r;
15256 }
15257 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj * __pyx_v_self)15258 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
15259   __Pyx_memviewslice *__pyx_v_mslice;
15260   __Pyx_memviewslice __pyx_v_tmp;
15261   PyObject *__pyx_r = NULL;
15262   __Pyx_RefNannyDeclarations
15263   PyObject *__pyx_t_1 = NULL;
15264   __Pyx_RefNannySetupContext("is_f_contig", 0);
15265 
15266   /* "View.MemoryView":624
15267  *         cdef __Pyx_memviewslice *mslice
15268  *         cdef __Pyx_memviewslice tmp
15269  *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
15270  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
15271  *
15272  */
15273   __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
15274 
15275   /* "View.MemoryView":625
15276  *         cdef __Pyx_memviewslice tmp
15277  *         mslice = get_slice_from_memview(self, &tmp)
15278  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)             # <<<<<<<<<<<<<<
15279  *
15280  *     def copy(self):
15281  */
15282   __Pyx_XDECREF(__pyx_r);
15283   __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 625, __pyx_L1_error)
15284   __Pyx_GOTREF(__pyx_t_1);
15285   __pyx_r = __pyx_t_1;
15286   __pyx_t_1 = 0;
15287   goto __pyx_L0;
15288 
15289   /* "View.MemoryView":621
15290  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
15291  *
15292  *     def is_f_contig(self):             # <<<<<<<<<<<<<<
15293  *         cdef __Pyx_memviewslice *mslice
15294  *         cdef __Pyx_memviewslice tmp
15295  */
15296 
15297   /* function exit code */
15298   __pyx_L1_error:;
15299   __Pyx_XDECREF(__pyx_t_1);
15300   __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
15301   __pyx_r = NULL;
15302   __pyx_L0:;
15303   __Pyx_XGIVEREF(__pyx_r);
15304   __Pyx_RefNannyFinishContext();
15305   return __pyx_r;
15306 }
15307 
15308 /* "View.MemoryView":627
15309  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
15310  *
15311  *     def copy(self):             # <<<<<<<<<<<<<<
15312  *         cdef __Pyx_memviewslice mslice
15313  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
15314  */
15315 
15316 /* Python wrapper */
15317 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)15318 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
15319   PyObject *__pyx_r = 0;
15320   __Pyx_RefNannyDeclarations
15321   __Pyx_RefNannySetupContext("copy (wrapper)", 0);
15322   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));
15323 
15324   /* function exit code */
15325   __Pyx_RefNannyFinishContext();
15326   return __pyx_r;
15327 }
15328 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj * __pyx_v_self)15329 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
15330   __Pyx_memviewslice __pyx_v_mslice;
15331   int __pyx_v_flags;
15332   PyObject *__pyx_r = NULL;
15333   __Pyx_RefNannyDeclarations
15334   __Pyx_memviewslice __pyx_t_1;
15335   PyObject *__pyx_t_2 = NULL;
15336   __Pyx_RefNannySetupContext("copy", 0);
15337 
15338   /* "View.MemoryView":629
15339  *     def copy(self):
15340  *         cdef __Pyx_memviewslice mslice
15341  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS             # <<<<<<<<<<<<<<
15342  *
15343  *         slice_copy(self, &mslice)
15344  */
15345   __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
15346 
15347   /* "View.MemoryView":631
15348  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
15349  *
15350  *         slice_copy(self, &mslice)             # <<<<<<<<<<<<<<
15351  *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
15352  *                                    self.view.itemsize,
15353  */
15354   __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
15355 
15356   /* "View.MemoryView":632
15357  *
15358  *         slice_copy(self, &mslice)
15359  *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,             # <<<<<<<<<<<<<<
15360  *                                    self.view.itemsize,
15361  *                                    flags|PyBUF_C_CONTIGUOUS,
15362  */
15363   __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 632, __pyx_L1_error)
15364   __pyx_v_mslice = __pyx_t_1;
15365 
15366   /* "View.MemoryView":637
15367  *                                    self.dtype_is_object)
15368  *
15369  *         return memoryview_copy_from_slice(self, &mslice)             # <<<<<<<<<<<<<<
15370  *
15371  *     def copy_fortran(self):
15372  */
15373   __Pyx_XDECREF(__pyx_r);
15374   __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 637, __pyx_L1_error)
15375   __Pyx_GOTREF(__pyx_t_2);
15376   __pyx_r = __pyx_t_2;
15377   __pyx_t_2 = 0;
15378   goto __pyx_L0;
15379 
15380   /* "View.MemoryView":627
15381  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
15382  *
15383  *     def copy(self):             # <<<<<<<<<<<<<<
15384  *         cdef __Pyx_memviewslice mslice
15385  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
15386  */
15387 
15388   /* function exit code */
15389   __pyx_L1_error:;
15390   __Pyx_XDECREF(__pyx_t_2);
15391   __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
15392   __pyx_r = NULL;
15393   __pyx_L0:;
15394   __Pyx_XGIVEREF(__pyx_r);
15395   __Pyx_RefNannyFinishContext();
15396   return __pyx_r;
15397 }
15398 
15399 /* "View.MemoryView":639
15400  *         return memoryview_copy_from_slice(self, &mslice)
15401  *
15402  *     def copy_fortran(self):             # <<<<<<<<<<<<<<
15403  *         cdef __Pyx_memviewslice src, dst
15404  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
15405  */
15406 
15407 /* Python wrapper */
15408 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)15409 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
15410   PyObject *__pyx_r = 0;
15411   __Pyx_RefNannyDeclarations
15412   __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
15413   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));
15414 
15415   /* function exit code */
15416   __Pyx_RefNannyFinishContext();
15417   return __pyx_r;
15418 }
15419 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj * __pyx_v_self)15420 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
15421   __Pyx_memviewslice __pyx_v_src;
15422   __Pyx_memviewslice __pyx_v_dst;
15423   int __pyx_v_flags;
15424   PyObject *__pyx_r = NULL;
15425   __Pyx_RefNannyDeclarations
15426   __Pyx_memviewslice __pyx_t_1;
15427   PyObject *__pyx_t_2 = NULL;
15428   __Pyx_RefNannySetupContext("copy_fortran", 0);
15429 
15430   /* "View.MemoryView":641
15431  *     def copy_fortran(self):
15432  *         cdef __Pyx_memviewslice src, dst
15433  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS             # <<<<<<<<<<<<<<
15434  *
15435  *         slice_copy(self, &src)
15436  */
15437   __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
15438 
15439   /* "View.MemoryView":643
15440  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
15441  *
15442  *         slice_copy(self, &src)             # <<<<<<<<<<<<<<
15443  *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,
15444  *                                 self.view.itemsize,
15445  */
15446   __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
15447 
15448   /* "View.MemoryView":644
15449  *
15450  *         slice_copy(self, &src)
15451  *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,             # <<<<<<<<<<<<<<
15452  *                                 self.view.itemsize,
15453  *                                 flags|PyBUF_F_CONTIGUOUS,
15454  */
15455   __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 644, __pyx_L1_error)
15456   __pyx_v_dst = __pyx_t_1;
15457 
15458   /* "View.MemoryView":649
15459  *                                 self.dtype_is_object)
15460  *
15461  *         return memoryview_copy_from_slice(self, &dst)             # <<<<<<<<<<<<<<
15462  *
15463  *
15464  */
15465   __Pyx_XDECREF(__pyx_r);
15466   __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 649, __pyx_L1_error)
15467   __Pyx_GOTREF(__pyx_t_2);
15468   __pyx_r = __pyx_t_2;
15469   __pyx_t_2 = 0;
15470   goto __pyx_L0;
15471 
15472   /* "View.MemoryView":639
15473  *         return memoryview_copy_from_slice(self, &mslice)
15474  *
15475  *     def copy_fortran(self):             # <<<<<<<<<<<<<<
15476  *         cdef __Pyx_memviewslice src, dst
15477  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
15478  */
15479 
15480   /* function exit code */
15481   __pyx_L1_error:;
15482   __Pyx_XDECREF(__pyx_t_2);
15483   __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
15484   __pyx_r = NULL;
15485   __pyx_L0:;
15486   __Pyx_XGIVEREF(__pyx_r);
15487   __Pyx_RefNannyFinishContext();
15488   return __pyx_r;
15489 }
15490 
15491 /* "(tree fragment)":1
15492  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
15493  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15494  * def __setstate_cython__(self, __pyx_state):
15495  */
15496 
15497 /* Python wrapper */
15498 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)15499 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
15500   PyObject *__pyx_r = 0;
15501   __Pyx_RefNannyDeclarations
15502   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
15503   __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));
15504 
15505   /* function exit code */
15506   __Pyx_RefNannyFinishContext();
15507   return __pyx_r;
15508 }
15509 
__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj * __pyx_v_self)15510 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
15511   PyObject *__pyx_r = NULL;
15512   __Pyx_RefNannyDeclarations
15513   PyObject *__pyx_t_1 = NULL;
15514   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
15515 
15516   /* "(tree fragment)":2
15517  * def __reduce_cython__(self):
15518  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
15519  * def __setstate_cython__(self, __pyx_state):
15520  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15521  */
15522   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
15523   __Pyx_GOTREF(__pyx_t_1);
15524   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
15525   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15526   __PYX_ERR(2, 2, __pyx_L1_error)
15527 
15528   /* "(tree fragment)":1
15529  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
15530  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15531  * def __setstate_cython__(self, __pyx_state):
15532  */
15533 
15534   /* function exit code */
15535   __pyx_L1_error:;
15536   __Pyx_XDECREF(__pyx_t_1);
15537   __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15538   __pyx_r = NULL;
15539   __Pyx_XGIVEREF(__pyx_r);
15540   __Pyx_RefNannyFinishContext();
15541   return __pyx_r;
15542 }
15543 
15544 /* "(tree fragment)":3
15545  * def __reduce_cython__(self):
15546  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15547  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
15548  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15549  */
15550 
15551 /* Python wrapper */
15552 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)15553 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
15554   PyObject *__pyx_r = 0;
15555   __Pyx_RefNannyDeclarations
15556   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
15557   __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
15558 
15559   /* function exit code */
15560   __Pyx_RefNannyFinishContext();
15561   return __pyx_r;
15562 }
15563 
__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)15564 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) {
15565   PyObject *__pyx_r = NULL;
15566   __Pyx_RefNannyDeclarations
15567   PyObject *__pyx_t_1 = NULL;
15568   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
15569 
15570   /* "(tree fragment)":4
15571  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15572  * def __setstate_cython__(self, __pyx_state):
15573  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
15574  */
15575   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
15576   __Pyx_GOTREF(__pyx_t_1);
15577   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
15578   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15579   __PYX_ERR(2, 4, __pyx_L1_error)
15580 
15581   /* "(tree fragment)":3
15582  * def __reduce_cython__(self):
15583  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15584  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
15585  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
15586  */
15587 
15588   /* function exit code */
15589   __pyx_L1_error:;
15590   __Pyx_XDECREF(__pyx_t_1);
15591   __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15592   __pyx_r = NULL;
15593   __Pyx_XGIVEREF(__pyx_r);
15594   __Pyx_RefNannyFinishContext();
15595   return __pyx_r;
15596 }
15597 
15598 /* "View.MemoryView":653
15599  *
15600  * @cname('__pyx_memoryview_new')
15601  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
15602  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
15603  *     result.typeinfo = typeinfo
15604  */
15605 
__pyx_memoryview_new(PyObject * __pyx_v_o,int __pyx_v_flags,int __pyx_v_dtype_is_object,__Pyx_TypeInfo * __pyx_v_typeinfo)15606 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
15607   struct __pyx_memoryview_obj *__pyx_v_result = 0;
15608   PyObject *__pyx_r = NULL;
15609   __Pyx_RefNannyDeclarations
15610   PyObject *__pyx_t_1 = NULL;
15611   PyObject *__pyx_t_2 = NULL;
15612   PyObject *__pyx_t_3 = NULL;
15613   __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);
15614 
15615   /* "View.MemoryView":654
15616  * @cname('__pyx_memoryview_new')
15617  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
15618  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)             # <<<<<<<<<<<<<<
15619  *     result.typeinfo = typeinfo
15620  *     return result
15621  */
15622   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 654, __pyx_L1_error)
15623   __Pyx_GOTREF(__pyx_t_1);
15624   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 654, __pyx_L1_error)
15625   __Pyx_GOTREF(__pyx_t_2);
15626   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 654, __pyx_L1_error)
15627   __Pyx_GOTREF(__pyx_t_3);
15628   __Pyx_INCREF(__pyx_v_o);
15629   __Pyx_GIVEREF(__pyx_v_o);
15630   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
15631   __Pyx_GIVEREF(__pyx_t_1);
15632   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
15633   __Pyx_GIVEREF(__pyx_t_2);
15634   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
15635   __pyx_t_1 = 0;
15636   __pyx_t_2 = 0;
15637   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 654, __pyx_L1_error)
15638   __Pyx_GOTREF(__pyx_t_2);
15639   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15640   __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
15641   __pyx_t_2 = 0;
15642 
15643   /* "View.MemoryView":655
15644  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
15645  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
15646  *     result.typeinfo = typeinfo             # <<<<<<<<<<<<<<
15647  *     return result
15648  *
15649  */
15650   __pyx_v_result->typeinfo = __pyx_v_typeinfo;
15651 
15652   /* "View.MemoryView":656
15653  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
15654  *     result.typeinfo = typeinfo
15655  *     return result             # <<<<<<<<<<<<<<
15656  *
15657  * @cname('__pyx_memoryview_check')
15658  */
15659   __Pyx_XDECREF(__pyx_r);
15660   __Pyx_INCREF(((PyObject *)__pyx_v_result));
15661   __pyx_r = ((PyObject *)__pyx_v_result);
15662   goto __pyx_L0;
15663 
15664   /* "View.MemoryView":653
15665  *
15666  * @cname('__pyx_memoryview_new')
15667  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
15668  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
15669  *     result.typeinfo = typeinfo
15670  */
15671 
15672   /* function exit code */
15673   __pyx_L1_error:;
15674   __Pyx_XDECREF(__pyx_t_1);
15675   __Pyx_XDECREF(__pyx_t_2);
15676   __Pyx_XDECREF(__pyx_t_3);
15677   __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
15678   __pyx_r = 0;
15679   __pyx_L0:;
15680   __Pyx_XDECREF((PyObject *)__pyx_v_result);
15681   __Pyx_XGIVEREF(__pyx_r);
15682   __Pyx_RefNannyFinishContext();
15683   return __pyx_r;
15684 }
15685 
15686 /* "View.MemoryView":659
15687  *
15688  * @cname('__pyx_memoryview_check')
15689  * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
15690  *     return isinstance(o, memoryview)
15691  *
15692  */
15693 
__pyx_memoryview_check(PyObject * __pyx_v_o)15694 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
15695   int __pyx_r;
15696   __Pyx_RefNannyDeclarations
15697   int __pyx_t_1;
15698   __Pyx_RefNannySetupContext("memoryview_check", 0);
15699 
15700   /* "View.MemoryView":660
15701  * @cname('__pyx_memoryview_check')
15702  * cdef inline bint memoryview_check(object o):
15703  *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
15704  *
15705  * cdef tuple _unellipsify(object index, int ndim):
15706  */
15707   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
15708   __pyx_r = __pyx_t_1;
15709   goto __pyx_L0;
15710 
15711   /* "View.MemoryView":659
15712  *
15713  * @cname('__pyx_memoryview_check')
15714  * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
15715  *     return isinstance(o, memoryview)
15716  *
15717  */
15718 
15719   /* function exit code */
15720   __pyx_L0:;
15721   __Pyx_RefNannyFinishContext();
15722   return __pyx_r;
15723 }
15724 
15725 /* "View.MemoryView":662
15726  *     return isinstance(o, memoryview)
15727  *
15728  * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
15729  *     """
15730  *     Replace all ellipses with full slices and fill incomplete indices with
15731  */
15732 
_unellipsify(PyObject * __pyx_v_index,int __pyx_v_ndim)15733 static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
15734   PyObject *__pyx_v_tup = NULL;
15735   PyObject *__pyx_v_result = NULL;
15736   int __pyx_v_have_slices;
15737   int __pyx_v_seen_ellipsis;
15738   CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
15739   PyObject *__pyx_v_item = NULL;
15740   Py_ssize_t __pyx_v_nslices;
15741   PyObject *__pyx_r = NULL;
15742   __Pyx_RefNannyDeclarations
15743   int __pyx_t_1;
15744   int __pyx_t_2;
15745   PyObject *__pyx_t_3 = NULL;
15746   PyObject *__pyx_t_4 = NULL;
15747   Py_ssize_t __pyx_t_5;
15748   PyObject *(*__pyx_t_6)(PyObject *);
15749   PyObject *__pyx_t_7 = NULL;
15750   Py_ssize_t __pyx_t_8;
15751   int __pyx_t_9;
15752   int __pyx_t_10;
15753   PyObject *__pyx_t_11 = NULL;
15754   __Pyx_RefNannySetupContext("_unellipsify", 0);
15755 
15756   /* "View.MemoryView":667
15757  *     full slices.
15758  *     """
15759  *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
15760  *         tup = (index,)
15761  *     else:
15762  */
15763   __pyx_t_1 = PyTuple_Check(__pyx_v_index);
15764   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
15765   if (__pyx_t_2) {
15766 
15767     /* "View.MemoryView":668
15768  *     """
15769  *     if not isinstance(index, tuple):
15770  *         tup = (index,)             # <<<<<<<<<<<<<<
15771  *     else:
15772  *         tup = index
15773  */
15774     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 668, __pyx_L1_error)
15775     __Pyx_GOTREF(__pyx_t_3);
15776     __Pyx_INCREF(__pyx_v_index);
15777     __Pyx_GIVEREF(__pyx_v_index);
15778     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
15779     __pyx_v_tup = __pyx_t_3;
15780     __pyx_t_3 = 0;
15781 
15782     /* "View.MemoryView":667
15783  *     full slices.
15784  *     """
15785  *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
15786  *         tup = (index,)
15787  *     else:
15788  */
15789     goto __pyx_L3;
15790   }
15791 
15792   /* "View.MemoryView":670
15793  *         tup = (index,)
15794  *     else:
15795  *         tup = index             # <<<<<<<<<<<<<<
15796  *
15797  *     result = []
15798  */
15799   /*else*/ {
15800     __Pyx_INCREF(__pyx_v_index);
15801     __pyx_v_tup = __pyx_v_index;
15802   }
15803   __pyx_L3:;
15804 
15805   /* "View.MemoryView":672
15806  *         tup = index
15807  *
15808  *     result = []             # <<<<<<<<<<<<<<
15809  *     have_slices = False
15810  *     seen_ellipsis = False
15811  */
15812   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 672, __pyx_L1_error)
15813   __Pyx_GOTREF(__pyx_t_3);
15814   __pyx_v_result = ((PyObject*)__pyx_t_3);
15815   __pyx_t_3 = 0;
15816 
15817   /* "View.MemoryView":673
15818  *
15819  *     result = []
15820  *     have_slices = False             # <<<<<<<<<<<<<<
15821  *     seen_ellipsis = False
15822  *     for idx, item in enumerate(tup):
15823  */
15824   __pyx_v_have_slices = 0;
15825 
15826   /* "View.MemoryView":674
15827  *     result = []
15828  *     have_slices = False
15829  *     seen_ellipsis = False             # <<<<<<<<<<<<<<
15830  *     for idx, item in enumerate(tup):
15831  *         if item is Ellipsis:
15832  */
15833   __pyx_v_seen_ellipsis = 0;
15834 
15835   /* "View.MemoryView":675
15836  *     have_slices = False
15837  *     seen_ellipsis = False
15838  *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
15839  *         if item is Ellipsis:
15840  *             if not seen_ellipsis:
15841  */
15842   __Pyx_INCREF(__pyx_int_0);
15843   __pyx_t_3 = __pyx_int_0;
15844   if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
15845     __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
15846     __pyx_t_6 = NULL;
15847   } else {
15848     __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 675, __pyx_L1_error)
15849     __Pyx_GOTREF(__pyx_t_4);
15850     __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 675, __pyx_L1_error)
15851   }
15852   for (;;) {
15853     if (likely(!__pyx_t_6)) {
15854       if (likely(PyList_CheckExact(__pyx_t_4))) {
15855         if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
15856         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15857         __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 675, __pyx_L1_error)
15858         #else
15859         __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 675, __pyx_L1_error)
15860         __Pyx_GOTREF(__pyx_t_7);
15861         #endif
15862       } else {
15863         if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
15864         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15865         __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 675, __pyx_L1_error)
15866         #else
15867         __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 675, __pyx_L1_error)
15868         __Pyx_GOTREF(__pyx_t_7);
15869         #endif
15870       }
15871     } else {
15872       __pyx_t_7 = __pyx_t_6(__pyx_t_4);
15873       if (unlikely(!__pyx_t_7)) {
15874         PyObject* exc_type = PyErr_Occurred();
15875         if (exc_type) {
15876           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
15877           else __PYX_ERR(2, 675, __pyx_L1_error)
15878         }
15879         break;
15880       }
15881       __Pyx_GOTREF(__pyx_t_7);
15882     }
15883     __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
15884     __pyx_t_7 = 0;
15885     __Pyx_INCREF(__pyx_t_3);
15886     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
15887     __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 675, __pyx_L1_error)
15888     __Pyx_GOTREF(__pyx_t_7);
15889     __Pyx_DECREF(__pyx_t_3);
15890     __pyx_t_3 = __pyx_t_7;
15891     __pyx_t_7 = 0;
15892 
15893     /* "View.MemoryView":676
15894  *     seen_ellipsis = False
15895  *     for idx, item in enumerate(tup):
15896  *         if item is Ellipsis:             # <<<<<<<<<<<<<<
15897  *             if not seen_ellipsis:
15898  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
15899  */
15900     __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
15901     __pyx_t_1 = (__pyx_t_2 != 0);
15902     if (__pyx_t_1) {
15903 
15904       /* "View.MemoryView":677
15905  *     for idx, item in enumerate(tup):
15906  *         if item is Ellipsis:
15907  *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
15908  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
15909  *                 seen_ellipsis = True
15910  */
15911       __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
15912       if (__pyx_t_1) {
15913 
15914         /* "View.MemoryView":678
15915  *         if item is Ellipsis:
15916  *             if not seen_ellipsis:
15917  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
15918  *                 seen_ellipsis = True
15919  *             else:
15920  */
15921         __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 678, __pyx_L1_error)
15922         __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 678, __pyx_L1_error)
15923         __Pyx_GOTREF(__pyx_t_7);
15924         { Py_ssize_t __pyx_temp;
15925           for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
15926             __Pyx_INCREF(__pyx_slice__22);
15927             __Pyx_GIVEREF(__pyx_slice__22);
15928             PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__22);
15929           }
15930         }
15931         __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 678, __pyx_L1_error)
15932         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
15933 
15934         /* "View.MemoryView":679
15935  *             if not seen_ellipsis:
15936  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
15937  *                 seen_ellipsis = True             # <<<<<<<<<<<<<<
15938  *             else:
15939  *                 result.append(slice(None))
15940  */
15941         __pyx_v_seen_ellipsis = 1;
15942 
15943         /* "View.MemoryView":677
15944  *     for idx, item in enumerate(tup):
15945  *         if item is Ellipsis:
15946  *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
15947  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
15948  *                 seen_ellipsis = True
15949  */
15950         goto __pyx_L7;
15951       }
15952 
15953       /* "View.MemoryView":681
15954  *                 seen_ellipsis = True
15955  *             else:
15956  *                 result.append(slice(None))             # <<<<<<<<<<<<<<
15957  *             have_slices = True
15958  *         else:
15959  */
15960       /*else*/ {
15961         __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__22); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 681, __pyx_L1_error)
15962       }
15963       __pyx_L7:;
15964 
15965       /* "View.MemoryView":682
15966  *             else:
15967  *                 result.append(slice(None))
15968  *             have_slices = True             # <<<<<<<<<<<<<<
15969  *         else:
15970  *             if not isinstance(item, slice) and not PyIndex_Check(item):
15971  */
15972       __pyx_v_have_slices = 1;
15973 
15974       /* "View.MemoryView":676
15975  *     seen_ellipsis = False
15976  *     for idx, item in enumerate(tup):
15977  *         if item is Ellipsis:             # <<<<<<<<<<<<<<
15978  *             if not seen_ellipsis:
15979  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
15980  */
15981       goto __pyx_L6;
15982     }
15983 
15984     /* "View.MemoryView":684
15985  *             have_slices = True
15986  *         else:
15987  *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
15988  *                 raise TypeError("Cannot index with type '%s'" % type(item))
15989  *
15990  */
15991     /*else*/ {
15992       __pyx_t_2 = PySlice_Check(__pyx_v_item);
15993       __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
15994       if (__pyx_t_10) {
15995       } else {
15996         __pyx_t_1 = __pyx_t_10;
15997         goto __pyx_L9_bool_binop_done;
15998       }
15999       __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
16000       __pyx_t_1 = __pyx_t_10;
16001       __pyx_L9_bool_binop_done:;
16002       if (unlikely(__pyx_t_1)) {
16003 
16004         /* "View.MemoryView":685
16005  *         else:
16006  *             if not isinstance(item, slice) and not PyIndex_Check(item):
16007  *                 raise TypeError("Cannot index with type '%s'" % type(item))             # <<<<<<<<<<<<<<
16008  *
16009  *             have_slices = have_slices or isinstance(item, slice)
16010  */
16011         __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 685, __pyx_L1_error)
16012         __Pyx_GOTREF(__pyx_t_7);
16013         __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 685, __pyx_L1_error)
16014         __Pyx_GOTREF(__pyx_t_11);
16015         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
16016         __Pyx_Raise(__pyx_t_11, 0, 0, 0);
16017         __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
16018         __PYX_ERR(2, 685, __pyx_L1_error)
16019 
16020         /* "View.MemoryView":684
16021  *             have_slices = True
16022  *         else:
16023  *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
16024  *                 raise TypeError("Cannot index with type '%s'" % type(item))
16025  *
16026  */
16027       }
16028 
16029       /* "View.MemoryView":687
16030  *                 raise TypeError("Cannot index with type '%s'" % type(item))
16031  *
16032  *             have_slices = have_slices or isinstance(item, slice)             # <<<<<<<<<<<<<<
16033  *             result.append(item)
16034  *
16035  */
16036       __pyx_t_10 = (__pyx_v_have_slices != 0);
16037       if (!__pyx_t_10) {
16038       } else {
16039         __pyx_t_1 = __pyx_t_10;
16040         goto __pyx_L11_bool_binop_done;
16041       }
16042       __pyx_t_10 = PySlice_Check(__pyx_v_item);
16043       __pyx_t_2 = (__pyx_t_10 != 0);
16044       __pyx_t_1 = __pyx_t_2;
16045       __pyx_L11_bool_binop_done:;
16046       __pyx_v_have_slices = __pyx_t_1;
16047 
16048       /* "View.MemoryView":688
16049  *
16050  *             have_slices = have_slices or isinstance(item, slice)
16051  *             result.append(item)             # <<<<<<<<<<<<<<
16052  *
16053  *     nslices = ndim - len(result)
16054  */
16055       __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 688, __pyx_L1_error)
16056     }
16057     __pyx_L6:;
16058 
16059     /* "View.MemoryView":675
16060  *     have_slices = False
16061  *     seen_ellipsis = False
16062  *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
16063  *         if item is Ellipsis:
16064  *             if not seen_ellipsis:
16065  */
16066   }
16067   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16068   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16069 
16070   /* "View.MemoryView":690
16071  *             result.append(item)
16072  *
16073  *     nslices = ndim - len(result)             # <<<<<<<<<<<<<<
16074  *     if nslices:
16075  *         result.extend([slice(None)] * nslices)
16076  */
16077   __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 690, __pyx_L1_error)
16078   __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
16079 
16080   /* "View.MemoryView":691
16081  *
16082  *     nslices = ndim - len(result)
16083  *     if nslices:             # <<<<<<<<<<<<<<
16084  *         result.extend([slice(None)] * nslices)
16085  *
16086  */
16087   __pyx_t_1 = (__pyx_v_nslices != 0);
16088   if (__pyx_t_1) {
16089 
16090     /* "View.MemoryView":692
16091  *     nslices = ndim - len(result)
16092  *     if nslices:
16093  *         result.extend([slice(None)] * nslices)             # <<<<<<<<<<<<<<
16094  *
16095  *     return have_slices or nslices, tuple(result)
16096  */
16097     __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 692, __pyx_L1_error)
16098     __Pyx_GOTREF(__pyx_t_3);
16099     { Py_ssize_t __pyx_temp;
16100       for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
16101         __Pyx_INCREF(__pyx_slice__22);
16102         __Pyx_GIVEREF(__pyx_slice__22);
16103         PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__22);
16104       }
16105     }
16106     __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 692, __pyx_L1_error)
16107     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16108 
16109     /* "View.MemoryView":691
16110  *
16111  *     nslices = ndim - len(result)
16112  *     if nslices:             # <<<<<<<<<<<<<<
16113  *         result.extend([slice(None)] * nslices)
16114  *
16115  */
16116   }
16117 
16118   /* "View.MemoryView":694
16119  *         result.extend([slice(None)] * nslices)
16120  *
16121  *     return have_slices or nslices, tuple(result)             # <<<<<<<<<<<<<<
16122  *
16123  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
16124  */
16125   __Pyx_XDECREF(__pyx_r);
16126   if (!__pyx_v_have_slices) {
16127   } else {
16128     __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 694, __pyx_L1_error)
16129     __Pyx_GOTREF(__pyx_t_4);
16130     __pyx_t_3 = __pyx_t_4;
16131     __pyx_t_4 = 0;
16132     goto __pyx_L14_bool_binop_done;
16133   }
16134   __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 694, __pyx_L1_error)
16135   __Pyx_GOTREF(__pyx_t_4);
16136   __pyx_t_3 = __pyx_t_4;
16137   __pyx_t_4 = 0;
16138   __pyx_L14_bool_binop_done:;
16139   __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 694, __pyx_L1_error)
16140   __Pyx_GOTREF(__pyx_t_4);
16141   __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 694, __pyx_L1_error)
16142   __Pyx_GOTREF(__pyx_t_11);
16143   __Pyx_GIVEREF(__pyx_t_3);
16144   PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
16145   __Pyx_GIVEREF(__pyx_t_4);
16146   PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
16147   __pyx_t_3 = 0;
16148   __pyx_t_4 = 0;
16149   __pyx_r = ((PyObject*)__pyx_t_11);
16150   __pyx_t_11 = 0;
16151   goto __pyx_L0;
16152 
16153   /* "View.MemoryView":662
16154  *     return isinstance(o, memoryview)
16155  *
16156  * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
16157  *     """
16158  *     Replace all ellipses with full slices and fill incomplete indices with
16159  */
16160 
16161   /* function exit code */
16162   __pyx_L1_error:;
16163   __Pyx_XDECREF(__pyx_t_3);
16164   __Pyx_XDECREF(__pyx_t_4);
16165   __Pyx_XDECREF(__pyx_t_7);
16166   __Pyx_XDECREF(__pyx_t_11);
16167   __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
16168   __pyx_r = 0;
16169   __pyx_L0:;
16170   __Pyx_XDECREF(__pyx_v_tup);
16171   __Pyx_XDECREF(__pyx_v_result);
16172   __Pyx_XDECREF(__pyx_v_idx);
16173   __Pyx_XDECREF(__pyx_v_item);
16174   __Pyx_XGIVEREF(__pyx_r);
16175   __Pyx_RefNannyFinishContext();
16176   return __pyx_r;
16177 }
16178 
16179 /* "View.MemoryView":696
16180  *     return have_slices or nslices, tuple(result)
16181  *
16182  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
16183  *     for suboffset in suboffsets[:ndim]:
16184  *         if suboffset >= 0:
16185  */
16186 
assert_direct_dimensions(Py_ssize_t * __pyx_v_suboffsets,int __pyx_v_ndim)16187 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
16188   Py_ssize_t __pyx_v_suboffset;
16189   PyObject *__pyx_r = NULL;
16190   __Pyx_RefNannyDeclarations
16191   Py_ssize_t *__pyx_t_1;
16192   Py_ssize_t *__pyx_t_2;
16193   Py_ssize_t *__pyx_t_3;
16194   int __pyx_t_4;
16195   PyObject *__pyx_t_5 = NULL;
16196   __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);
16197 
16198   /* "View.MemoryView":697
16199  *
16200  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
16201  *     for suboffset in suboffsets[:ndim]:             # <<<<<<<<<<<<<<
16202  *         if suboffset >= 0:
16203  *             raise ValueError("Indirect dimensions not supported")
16204  */
16205   __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
16206   for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
16207     __pyx_t_1 = __pyx_t_3;
16208     __pyx_v_suboffset = (__pyx_t_1[0]);
16209 
16210     /* "View.MemoryView":698
16211  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
16212  *     for suboffset in suboffsets[:ndim]:
16213  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
16214  *             raise ValueError("Indirect dimensions not supported")
16215  *
16216  */
16217     __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
16218     if (unlikely(__pyx_t_4)) {
16219 
16220       /* "View.MemoryView":699
16221  *     for suboffset in suboffsets[:ndim]:
16222  *         if suboffset >= 0:
16223  *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
16224  *
16225  *
16226  */
16227       __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 699, __pyx_L1_error)
16228       __Pyx_GOTREF(__pyx_t_5);
16229       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
16230       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16231       __PYX_ERR(2, 699, __pyx_L1_error)
16232 
16233       /* "View.MemoryView":698
16234  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
16235  *     for suboffset in suboffsets[:ndim]:
16236  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
16237  *             raise ValueError("Indirect dimensions not supported")
16238  *
16239  */
16240     }
16241   }
16242 
16243   /* "View.MemoryView":696
16244  *     return have_slices or nslices, tuple(result)
16245  *
16246  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
16247  *     for suboffset in suboffsets[:ndim]:
16248  *         if suboffset >= 0:
16249  */
16250 
16251   /* function exit code */
16252   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16253   goto __pyx_L0;
16254   __pyx_L1_error:;
16255   __Pyx_XDECREF(__pyx_t_5);
16256   __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
16257   __pyx_r = 0;
16258   __pyx_L0:;
16259   __Pyx_XGIVEREF(__pyx_r);
16260   __Pyx_RefNannyFinishContext();
16261   return __pyx_r;
16262 }
16263 
16264 /* "View.MemoryView":706
16265  *
16266  * @cname('__pyx_memview_slice')
16267  * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
16268  *     cdef int new_ndim = 0, suboffset_dim = -1, dim
16269  *     cdef bint negative_step
16270  */
16271 
__pyx_memview_slice(struct __pyx_memoryview_obj * __pyx_v_memview,PyObject * __pyx_v_indices)16272 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
16273   int __pyx_v_new_ndim;
16274   int __pyx_v_suboffset_dim;
16275   int __pyx_v_dim;
16276   __Pyx_memviewslice __pyx_v_src;
16277   __Pyx_memviewslice __pyx_v_dst;
16278   __Pyx_memviewslice *__pyx_v_p_src;
16279   struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
16280   __Pyx_memviewslice *__pyx_v_p_dst;
16281   int *__pyx_v_p_suboffset_dim;
16282   Py_ssize_t __pyx_v_start;
16283   Py_ssize_t __pyx_v_stop;
16284   Py_ssize_t __pyx_v_step;
16285   int __pyx_v_have_start;
16286   int __pyx_v_have_stop;
16287   int __pyx_v_have_step;
16288   PyObject *__pyx_v_index = NULL;
16289   struct __pyx_memoryview_obj *__pyx_r = NULL;
16290   __Pyx_RefNannyDeclarations
16291   int __pyx_t_1;
16292   int __pyx_t_2;
16293   PyObject *__pyx_t_3 = NULL;
16294   struct __pyx_memoryview_obj *__pyx_t_4;
16295   char *__pyx_t_5;
16296   int __pyx_t_6;
16297   Py_ssize_t __pyx_t_7;
16298   PyObject *(*__pyx_t_8)(PyObject *);
16299   PyObject *__pyx_t_9 = NULL;
16300   Py_ssize_t __pyx_t_10;
16301   int __pyx_t_11;
16302   Py_ssize_t __pyx_t_12;
16303   __Pyx_RefNannySetupContext("memview_slice", 0);
16304 
16305   /* "View.MemoryView":707
16306  * @cname('__pyx_memview_slice')
16307  * cdef memoryview memview_slice(memoryview memview, object indices):
16308  *     cdef int new_ndim = 0, suboffset_dim = -1, dim             # <<<<<<<<<<<<<<
16309  *     cdef bint negative_step
16310  *     cdef __Pyx_memviewslice src, dst
16311  */
16312   __pyx_v_new_ndim = 0;
16313   __pyx_v_suboffset_dim = -1;
16314 
16315   /* "View.MemoryView":714
16316  *
16317  *
16318  *     memset(&dst, 0, sizeof(dst))             # <<<<<<<<<<<<<<
16319  *
16320  *     cdef _memoryviewslice memviewsliceobj
16321  */
16322   (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));
16323 
16324   /* "View.MemoryView":718
16325  *     cdef _memoryviewslice memviewsliceobj
16326  *
16327  *     assert memview.view.ndim > 0             # <<<<<<<<<<<<<<
16328  *
16329  *     if isinstance(memview, _memoryviewslice):
16330  */
16331   #ifndef CYTHON_WITHOUT_ASSERTIONS
16332   if (unlikely(!Py_OptimizeFlag)) {
16333     if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
16334       PyErr_SetNone(PyExc_AssertionError);
16335       __PYX_ERR(2, 718, __pyx_L1_error)
16336     }
16337   }
16338   #endif
16339 
16340   /* "View.MemoryView":720
16341  *     assert memview.view.ndim > 0
16342  *
16343  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
16344  *         memviewsliceobj = memview
16345  *         p_src = &memviewsliceobj.from_slice
16346  */
16347   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
16348   __pyx_t_2 = (__pyx_t_1 != 0);
16349   if (__pyx_t_2) {
16350 
16351     /* "View.MemoryView":721
16352  *
16353  *     if isinstance(memview, _memoryviewslice):
16354  *         memviewsliceobj = memview             # <<<<<<<<<<<<<<
16355  *         p_src = &memviewsliceobj.from_slice
16356  *     else:
16357  */
16358     if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 721, __pyx_L1_error)
16359     __pyx_t_3 = ((PyObject *)__pyx_v_memview);
16360     __Pyx_INCREF(__pyx_t_3);
16361     __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
16362     __pyx_t_3 = 0;
16363 
16364     /* "View.MemoryView":722
16365  *     if isinstance(memview, _memoryviewslice):
16366  *         memviewsliceobj = memview
16367  *         p_src = &memviewsliceobj.from_slice             # <<<<<<<<<<<<<<
16368  *     else:
16369  *         slice_copy(memview, &src)
16370  */
16371     __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
16372 
16373     /* "View.MemoryView":720
16374  *     assert memview.view.ndim > 0
16375  *
16376  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
16377  *         memviewsliceobj = memview
16378  *         p_src = &memviewsliceobj.from_slice
16379  */
16380     goto __pyx_L3;
16381   }
16382 
16383   /* "View.MemoryView":724
16384  *         p_src = &memviewsliceobj.from_slice
16385  *     else:
16386  *         slice_copy(memview, &src)             # <<<<<<<<<<<<<<
16387  *         p_src = &src
16388  *
16389  */
16390   /*else*/ {
16391     __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
16392 
16393     /* "View.MemoryView":725
16394  *     else:
16395  *         slice_copy(memview, &src)
16396  *         p_src = &src             # <<<<<<<<<<<<<<
16397  *
16398  *
16399  */
16400     __pyx_v_p_src = (&__pyx_v_src);
16401   }
16402   __pyx_L3:;
16403 
16404   /* "View.MemoryView":731
16405  *
16406  *
16407  *     dst.memview = p_src.memview             # <<<<<<<<<<<<<<
16408  *     dst.data = p_src.data
16409  *
16410  */
16411   __pyx_t_4 = __pyx_v_p_src->memview;
16412   __pyx_v_dst.memview = __pyx_t_4;
16413 
16414   /* "View.MemoryView":732
16415  *
16416  *     dst.memview = p_src.memview
16417  *     dst.data = p_src.data             # <<<<<<<<<<<<<<
16418  *
16419  *
16420  */
16421   __pyx_t_5 = __pyx_v_p_src->data;
16422   __pyx_v_dst.data = __pyx_t_5;
16423 
16424   /* "View.MemoryView":737
16425  *
16426  *
16427  *     cdef __Pyx_memviewslice *p_dst = &dst             # <<<<<<<<<<<<<<
16428  *     cdef int *p_suboffset_dim = &suboffset_dim
16429  *     cdef Py_ssize_t start, stop, step
16430  */
16431   __pyx_v_p_dst = (&__pyx_v_dst);
16432 
16433   /* "View.MemoryView":738
16434  *
16435  *     cdef __Pyx_memviewslice *p_dst = &dst
16436  *     cdef int *p_suboffset_dim = &suboffset_dim             # <<<<<<<<<<<<<<
16437  *     cdef Py_ssize_t start, stop, step
16438  *     cdef bint have_start, have_stop, have_step
16439  */
16440   __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
16441 
16442   /* "View.MemoryView":742
16443  *     cdef bint have_start, have_stop, have_step
16444  *
16445  *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
16446  *         if PyIndex_Check(index):
16447  *             slice_memviewslice(
16448  */
16449   __pyx_t_6 = 0;
16450   if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
16451     __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
16452     __pyx_t_8 = NULL;
16453   } else {
16454     __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 742, __pyx_L1_error)
16455     __Pyx_GOTREF(__pyx_t_3);
16456     __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 742, __pyx_L1_error)
16457   }
16458   for (;;) {
16459     if (likely(!__pyx_t_8)) {
16460       if (likely(PyList_CheckExact(__pyx_t_3))) {
16461         if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
16462         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
16463         __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 742, __pyx_L1_error)
16464         #else
16465         __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 742, __pyx_L1_error)
16466         __Pyx_GOTREF(__pyx_t_9);
16467         #endif
16468       } else {
16469         if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
16470         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
16471         __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 742, __pyx_L1_error)
16472         #else
16473         __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 742, __pyx_L1_error)
16474         __Pyx_GOTREF(__pyx_t_9);
16475         #endif
16476       }
16477     } else {
16478       __pyx_t_9 = __pyx_t_8(__pyx_t_3);
16479       if (unlikely(!__pyx_t_9)) {
16480         PyObject* exc_type = PyErr_Occurred();
16481         if (exc_type) {
16482           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
16483           else __PYX_ERR(2, 742, __pyx_L1_error)
16484         }
16485         break;
16486       }
16487       __Pyx_GOTREF(__pyx_t_9);
16488     }
16489     __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
16490     __pyx_t_9 = 0;
16491     __pyx_v_dim = __pyx_t_6;
16492     __pyx_t_6 = (__pyx_t_6 + 1);
16493 
16494     /* "View.MemoryView":743
16495  *
16496  *     for dim, index in enumerate(indices):
16497  *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
16498  *             slice_memviewslice(
16499  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
16500  */
16501     __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
16502     if (__pyx_t_2) {
16503 
16504       /* "View.MemoryView":747
16505  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
16506  *                 dim, new_ndim, p_suboffset_dim,
16507  *                 index, 0, 0, # start, stop, step             # <<<<<<<<<<<<<<
16508  *                 0, 0, 0, # have_{start,stop,step}
16509  *                 False)
16510  */
16511       __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 747, __pyx_L1_error)
16512 
16513       /* "View.MemoryView":744
16514  *     for dim, index in enumerate(indices):
16515  *         if PyIndex_Check(index):
16516  *             slice_memviewslice(             # <<<<<<<<<<<<<<
16517  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
16518  *                 dim, new_ndim, p_suboffset_dim,
16519  */
16520       __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 744, __pyx_L1_error)
16521 
16522       /* "View.MemoryView":743
16523  *
16524  *     for dim, index in enumerate(indices):
16525  *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
16526  *             slice_memviewslice(
16527  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
16528  */
16529       goto __pyx_L6;
16530     }
16531 
16532     /* "View.MemoryView":750
16533  *                 0, 0, 0, # have_{start,stop,step}
16534  *                 False)
16535  *         elif index is None:             # <<<<<<<<<<<<<<
16536  *             p_dst.shape[new_ndim] = 1
16537  *             p_dst.strides[new_ndim] = 0
16538  */
16539     __pyx_t_2 = (__pyx_v_index == Py_None);
16540     __pyx_t_1 = (__pyx_t_2 != 0);
16541     if (__pyx_t_1) {
16542 
16543       /* "View.MemoryView":751
16544  *                 False)
16545  *         elif index is None:
16546  *             p_dst.shape[new_ndim] = 1             # <<<<<<<<<<<<<<
16547  *             p_dst.strides[new_ndim] = 0
16548  *             p_dst.suboffsets[new_ndim] = -1
16549  */
16550       (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
16551 
16552       /* "View.MemoryView":752
16553  *         elif index is None:
16554  *             p_dst.shape[new_ndim] = 1
16555  *             p_dst.strides[new_ndim] = 0             # <<<<<<<<<<<<<<
16556  *             p_dst.suboffsets[new_ndim] = -1
16557  *             new_ndim += 1
16558  */
16559       (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
16560 
16561       /* "View.MemoryView":753
16562  *             p_dst.shape[new_ndim] = 1
16563  *             p_dst.strides[new_ndim] = 0
16564  *             p_dst.suboffsets[new_ndim] = -1             # <<<<<<<<<<<<<<
16565  *             new_ndim += 1
16566  *         else:
16567  */
16568       (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
16569 
16570       /* "View.MemoryView":754
16571  *             p_dst.strides[new_ndim] = 0
16572  *             p_dst.suboffsets[new_ndim] = -1
16573  *             new_ndim += 1             # <<<<<<<<<<<<<<
16574  *         else:
16575  *             start = index.start or 0
16576  */
16577       __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
16578 
16579       /* "View.MemoryView":750
16580  *                 0, 0, 0, # have_{start,stop,step}
16581  *                 False)
16582  *         elif index is None:             # <<<<<<<<<<<<<<
16583  *             p_dst.shape[new_ndim] = 1
16584  *             p_dst.strides[new_ndim] = 0
16585  */
16586       goto __pyx_L6;
16587     }
16588 
16589     /* "View.MemoryView":756
16590  *             new_ndim += 1
16591  *         else:
16592  *             start = index.start or 0             # <<<<<<<<<<<<<<
16593  *             stop = index.stop or 0
16594  *             step = index.step or 0
16595  */
16596     /*else*/ {
16597       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 756, __pyx_L1_error)
16598       __Pyx_GOTREF(__pyx_t_9);
16599       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 756, __pyx_L1_error)
16600       if (!__pyx_t_1) {
16601         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
16602       } else {
16603         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 756, __pyx_L1_error)
16604         __pyx_t_10 = __pyx_t_12;
16605         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
16606         goto __pyx_L7_bool_binop_done;
16607       }
16608       __pyx_t_10 = 0;
16609       __pyx_L7_bool_binop_done:;
16610       __pyx_v_start = __pyx_t_10;
16611 
16612       /* "View.MemoryView":757
16613  *         else:
16614  *             start = index.start or 0
16615  *             stop = index.stop or 0             # <<<<<<<<<<<<<<
16616  *             step = index.step or 0
16617  *
16618  */
16619       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 757, __pyx_L1_error)
16620       __Pyx_GOTREF(__pyx_t_9);
16621       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 757, __pyx_L1_error)
16622       if (!__pyx_t_1) {
16623         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
16624       } else {
16625         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 757, __pyx_L1_error)
16626         __pyx_t_10 = __pyx_t_12;
16627         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
16628         goto __pyx_L9_bool_binop_done;
16629       }
16630       __pyx_t_10 = 0;
16631       __pyx_L9_bool_binop_done:;
16632       __pyx_v_stop = __pyx_t_10;
16633 
16634       /* "View.MemoryView":758
16635  *             start = index.start or 0
16636  *             stop = index.stop or 0
16637  *             step = index.step or 0             # <<<<<<<<<<<<<<
16638  *
16639  *             have_start = index.start is not None
16640  */
16641       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 758, __pyx_L1_error)
16642       __Pyx_GOTREF(__pyx_t_9);
16643       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 758, __pyx_L1_error)
16644       if (!__pyx_t_1) {
16645         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
16646       } else {
16647         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 758, __pyx_L1_error)
16648         __pyx_t_10 = __pyx_t_12;
16649         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
16650         goto __pyx_L11_bool_binop_done;
16651       }
16652       __pyx_t_10 = 0;
16653       __pyx_L11_bool_binop_done:;
16654       __pyx_v_step = __pyx_t_10;
16655 
16656       /* "View.MemoryView":760
16657  *             step = index.step or 0
16658  *
16659  *             have_start = index.start is not None             # <<<<<<<<<<<<<<
16660  *             have_stop = index.stop is not None
16661  *             have_step = index.step is not None
16662  */
16663       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 760, __pyx_L1_error)
16664       __Pyx_GOTREF(__pyx_t_9);
16665       __pyx_t_1 = (__pyx_t_9 != Py_None);
16666       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
16667       __pyx_v_have_start = __pyx_t_1;
16668 
16669       /* "View.MemoryView":761
16670  *
16671  *             have_start = index.start is not None
16672  *             have_stop = index.stop is not None             # <<<<<<<<<<<<<<
16673  *             have_step = index.step is not None
16674  *
16675  */
16676       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 761, __pyx_L1_error)
16677       __Pyx_GOTREF(__pyx_t_9);
16678       __pyx_t_1 = (__pyx_t_9 != Py_None);
16679       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
16680       __pyx_v_have_stop = __pyx_t_1;
16681 
16682       /* "View.MemoryView":762
16683  *             have_start = index.start is not None
16684  *             have_stop = index.stop is not None
16685  *             have_step = index.step is not None             # <<<<<<<<<<<<<<
16686  *
16687  *             slice_memviewslice(
16688  */
16689       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 762, __pyx_L1_error)
16690       __Pyx_GOTREF(__pyx_t_9);
16691       __pyx_t_1 = (__pyx_t_9 != Py_None);
16692       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
16693       __pyx_v_have_step = __pyx_t_1;
16694 
16695       /* "View.MemoryView":764
16696  *             have_step = index.step is not None
16697  *
16698  *             slice_memviewslice(             # <<<<<<<<<<<<<<
16699  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
16700  *                 dim, new_ndim, p_suboffset_dim,
16701  */
16702       __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 764, __pyx_L1_error)
16703 
16704       /* "View.MemoryView":770
16705  *                 have_start, have_stop, have_step,
16706  *                 True)
16707  *             new_ndim += 1             # <<<<<<<<<<<<<<
16708  *
16709  *     if isinstance(memview, _memoryviewslice):
16710  */
16711       __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
16712     }
16713     __pyx_L6:;
16714 
16715     /* "View.MemoryView":742
16716  *     cdef bint have_start, have_stop, have_step
16717  *
16718  *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
16719  *         if PyIndex_Check(index):
16720  *             slice_memviewslice(
16721  */
16722   }
16723   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16724 
16725   /* "View.MemoryView":772
16726  *             new_ndim += 1
16727  *
16728  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
16729  *         return memoryview_fromslice(dst, new_ndim,
16730  *                                     memviewsliceobj.to_object_func,
16731  */
16732   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
16733   __pyx_t_2 = (__pyx_t_1 != 0);
16734   if (__pyx_t_2) {
16735 
16736     /* "View.MemoryView":773
16737  *
16738  *     if isinstance(memview, _memoryviewslice):
16739  *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
16740  *                                     memviewsliceobj.to_object_func,
16741  *                                     memviewsliceobj.to_dtype_func,
16742  */
16743     __Pyx_XDECREF(((PyObject *)__pyx_r));
16744 
16745     /* "View.MemoryView":774
16746  *     if isinstance(memview, _memoryviewslice):
16747  *         return memoryview_fromslice(dst, new_ndim,
16748  *                                     memviewsliceobj.to_object_func,             # <<<<<<<<<<<<<<
16749  *                                     memviewsliceobj.to_dtype_func,
16750  *                                     memview.dtype_is_object)
16751  */
16752     if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 774, __pyx_L1_error) }
16753 
16754     /* "View.MemoryView":775
16755  *         return memoryview_fromslice(dst, new_ndim,
16756  *                                     memviewsliceobj.to_object_func,
16757  *                                     memviewsliceobj.to_dtype_func,             # <<<<<<<<<<<<<<
16758  *                                     memview.dtype_is_object)
16759  *     else:
16760  */
16761     if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 775, __pyx_L1_error) }
16762 
16763     /* "View.MemoryView":773
16764  *
16765  *     if isinstance(memview, _memoryviewslice):
16766  *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
16767  *                                     memviewsliceobj.to_object_func,
16768  *                                     memviewsliceobj.to_dtype_func,
16769  */
16770     __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 773, __pyx_L1_error)
16771     __Pyx_GOTREF(__pyx_t_3);
16772     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 773, __pyx_L1_error)
16773     __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
16774     __pyx_t_3 = 0;
16775     goto __pyx_L0;
16776 
16777     /* "View.MemoryView":772
16778  *             new_ndim += 1
16779  *
16780  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
16781  *         return memoryview_fromslice(dst, new_ndim,
16782  *                                     memviewsliceobj.to_object_func,
16783  */
16784   }
16785 
16786   /* "View.MemoryView":778
16787  *                                     memview.dtype_is_object)
16788  *     else:
16789  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
16790  *                                     memview.dtype_is_object)
16791  *
16792  */
16793   /*else*/ {
16794     __Pyx_XDECREF(((PyObject *)__pyx_r));
16795 
16796     /* "View.MemoryView":779
16797  *     else:
16798  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
16799  *                                     memview.dtype_is_object)             # <<<<<<<<<<<<<<
16800  *
16801  *
16802  */
16803     __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 778, __pyx_L1_error)
16804     __Pyx_GOTREF(__pyx_t_3);
16805 
16806     /* "View.MemoryView":778
16807  *                                     memview.dtype_is_object)
16808  *     else:
16809  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
16810  *                                     memview.dtype_is_object)
16811  *
16812  */
16813     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 778, __pyx_L1_error)
16814     __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
16815     __pyx_t_3 = 0;
16816     goto __pyx_L0;
16817   }
16818 
16819   /* "View.MemoryView":706
16820  *
16821  * @cname('__pyx_memview_slice')
16822  * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
16823  *     cdef int new_ndim = 0, suboffset_dim = -1, dim
16824  *     cdef bint negative_step
16825  */
16826 
16827   /* function exit code */
16828   __pyx_L1_error:;
16829   __Pyx_XDECREF(__pyx_t_3);
16830   __Pyx_XDECREF(__pyx_t_9);
16831   __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
16832   __pyx_r = 0;
16833   __pyx_L0:;
16834   __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
16835   __Pyx_XDECREF(__pyx_v_index);
16836   __Pyx_XGIVEREF((PyObject *)__pyx_r);
16837   __Pyx_RefNannyFinishContext();
16838   return __pyx_r;
16839 }
16840 
16841 /* "View.MemoryView":803
16842  *
16843  * @cname('__pyx_memoryview_slice_memviewslice')
16844  * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
16845  *         __Pyx_memviewslice *dst,
16846  *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
16847  */
16848 
__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)16849 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) {
16850   Py_ssize_t __pyx_v_new_shape;
16851   int __pyx_v_negative_step;
16852   int __pyx_r;
16853   int __pyx_t_1;
16854   int __pyx_t_2;
16855   int __pyx_t_3;
16856 
16857   /* "View.MemoryView":823
16858  *     cdef bint negative_step
16859  *
16860  *     if not is_slice:             # <<<<<<<<<<<<<<
16861  *
16862  *         if start < 0:
16863  */
16864   __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
16865   if (__pyx_t_1) {
16866 
16867     /* "View.MemoryView":825
16868  *     if not is_slice:
16869  *
16870  *         if start < 0:             # <<<<<<<<<<<<<<
16871  *             start += shape
16872  *         if not 0 <= start < shape:
16873  */
16874     __pyx_t_1 = ((__pyx_v_start < 0) != 0);
16875     if (__pyx_t_1) {
16876 
16877       /* "View.MemoryView":826
16878  *
16879  *         if start < 0:
16880  *             start += shape             # <<<<<<<<<<<<<<
16881  *         if not 0 <= start < shape:
16882  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
16883  */
16884       __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
16885 
16886       /* "View.MemoryView":825
16887  *     if not is_slice:
16888  *
16889  *         if start < 0:             # <<<<<<<<<<<<<<
16890  *             start += shape
16891  *         if not 0 <= start < shape:
16892  */
16893     }
16894 
16895     /* "View.MemoryView":827
16896  *         if start < 0:
16897  *             start += shape
16898  *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
16899  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
16900  *     else:
16901  */
16902     __pyx_t_1 = (0 <= __pyx_v_start);
16903     if (__pyx_t_1) {
16904       __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
16905     }
16906     __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
16907     if (__pyx_t_2) {
16908 
16909       /* "View.MemoryView":828
16910  *             start += shape
16911  *         if not 0 <= start < shape:
16912  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)             # <<<<<<<<<<<<<<
16913  *     else:
16914  *
16915  */
16916       __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 828, __pyx_L1_error)
16917 
16918       /* "View.MemoryView":827
16919  *         if start < 0:
16920  *             start += shape
16921  *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
16922  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
16923  *     else:
16924  */
16925     }
16926 
16927     /* "View.MemoryView":823
16928  *     cdef bint negative_step
16929  *
16930  *     if not is_slice:             # <<<<<<<<<<<<<<
16931  *
16932  *         if start < 0:
16933  */
16934     goto __pyx_L3;
16935   }
16936 
16937   /* "View.MemoryView":831
16938  *     else:
16939  *
16940  *         negative_step = have_step != 0 and step < 0             # <<<<<<<<<<<<<<
16941  *
16942  *         if have_step and step == 0:
16943  */
16944   /*else*/ {
16945     __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
16946     if (__pyx_t_1) {
16947     } else {
16948       __pyx_t_2 = __pyx_t_1;
16949       goto __pyx_L6_bool_binop_done;
16950     }
16951     __pyx_t_1 = ((__pyx_v_step < 0) != 0);
16952     __pyx_t_2 = __pyx_t_1;
16953     __pyx_L6_bool_binop_done:;
16954     __pyx_v_negative_step = __pyx_t_2;
16955 
16956     /* "View.MemoryView":833
16957  *         negative_step = have_step != 0 and step < 0
16958  *
16959  *         if have_step and step == 0:             # <<<<<<<<<<<<<<
16960  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
16961  *
16962  */
16963     __pyx_t_1 = (__pyx_v_have_step != 0);
16964     if (__pyx_t_1) {
16965     } else {
16966       __pyx_t_2 = __pyx_t_1;
16967       goto __pyx_L9_bool_binop_done;
16968     }
16969     __pyx_t_1 = ((__pyx_v_step == 0) != 0);
16970     __pyx_t_2 = __pyx_t_1;
16971     __pyx_L9_bool_binop_done:;
16972     if (__pyx_t_2) {
16973 
16974       /* "View.MemoryView":834
16975  *
16976  *         if have_step and step == 0:
16977  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)             # <<<<<<<<<<<<<<
16978  *
16979  *
16980  */
16981       __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 834, __pyx_L1_error)
16982 
16983       /* "View.MemoryView":833
16984  *         negative_step = have_step != 0 and step < 0
16985  *
16986  *         if have_step and step == 0:             # <<<<<<<<<<<<<<
16987  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
16988  *
16989  */
16990     }
16991 
16992     /* "View.MemoryView":837
16993  *
16994  *
16995  *         if have_start:             # <<<<<<<<<<<<<<
16996  *             if start < 0:
16997  *                 start += shape
16998  */
16999     __pyx_t_2 = (__pyx_v_have_start != 0);
17000     if (__pyx_t_2) {
17001 
17002       /* "View.MemoryView":838
17003  *
17004  *         if have_start:
17005  *             if start < 0:             # <<<<<<<<<<<<<<
17006  *                 start += shape
17007  *                 if start < 0:
17008  */
17009       __pyx_t_2 = ((__pyx_v_start < 0) != 0);
17010       if (__pyx_t_2) {
17011 
17012         /* "View.MemoryView":839
17013  *         if have_start:
17014  *             if start < 0:
17015  *                 start += shape             # <<<<<<<<<<<<<<
17016  *                 if start < 0:
17017  *                     start = 0
17018  */
17019         __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
17020 
17021         /* "View.MemoryView":840
17022  *             if start < 0:
17023  *                 start += shape
17024  *                 if start < 0:             # <<<<<<<<<<<<<<
17025  *                     start = 0
17026  *             elif start >= shape:
17027  */
17028         __pyx_t_2 = ((__pyx_v_start < 0) != 0);
17029         if (__pyx_t_2) {
17030 
17031           /* "View.MemoryView":841
17032  *                 start += shape
17033  *                 if start < 0:
17034  *                     start = 0             # <<<<<<<<<<<<<<
17035  *             elif start >= shape:
17036  *                 if negative_step:
17037  */
17038           __pyx_v_start = 0;
17039 
17040           /* "View.MemoryView":840
17041  *             if start < 0:
17042  *                 start += shape
17043  *                 if start < 0:             # <<<<<<<<<<<<<<
17044  *                     start = 0
17045  *             elif start >= shape:
17046  */
17047         }
17048 
17049         /* "View.MemoryView":838
17050  *
17051  *         if have_start:
17052  *             if start < 0:             # <<<<<<<<<<<<<<
17053  *                 start += shape
17054  *                 if start < 0:
17055  */
17056         goto __pyx_L12;
17057       }
17058 
17059       /* "View.MemoryView":842
17060  *                 if start < 0:
17061  *                     start = 0
17062  *             elif start >= shape:             # <<<<<<<<<<<<<<
17063  *                 if negative_step:
17064  *                     start = shape - 1
17065  */
17066       __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
17067       if (__pyx_t_2) {
17068 
17069         /* "View.MemoryView":843
17070  *                     start = 0
17071  *             elif start >= shape:
17072  *                 if negative_step:             # <<<<<<<<<<<<<<
17073  *                     start = shape - 1
17074  *                 else:
17075  */
17076         __pyx_t_2 = (__pyx_v_negative_step != 0);
17077         if (__pyx_t_2) {
17078 
17079           /* "View.MemoryView":844
17080  *             elif start >= shape:
17081  *                 if negative_step:
17082  *                     start = shape - 1             # <<<<<<<<<<<<<<
17083  *                 else:
17084  *                     start = shape
17085  */
17086           __pyx_v_start = (__pyx_v_shape - 1);
17087 
17088           /* "View.MemoryView":843
17089  *                     start = 0
17090  *             elif start >= shape:
17091  *                 if negative_step:             # <<<<<<<<<<<<<<
17092  *                     start = shape - 1
17093  *                 else:
17094  */
17095           goto __pyx_L14;
17096         }
17097 
17098         /* "View.MemoryView":846
17099  *                     start = shape - 1
17100  *                 else:
17101  *                     start = shape             # <<<<<<<<<<<<<<
17102  *         else:
17103  *             if negative_step:
17104  */
17105         /*else*/ {
17106           __pyx_v_start = __pyx_v_shape;
17107         }
17108         __pyx_L14:;
17109 
17110         /* "View.MemoryView":842
17111  *                 if start < 0:
17112  *                     start = 0
17113  *             elif start >= shape:             # <<<<<<<<<<<<<<
17114  *                 if negative_step:
17115  *                     start = shape - 1
17116  */
17117       }
17118       __pyx_L12:;
17119 
17120       /* "View.MemoryView":837
17121  *
17122  *
17123  *         if have_start:             # <<<<<<<<<<<<<<
17124  *             if start < 0:
17125  *                 start += shape
17126  */
17127       goto __pyx_L11;
17128     }
17129 
17130     /* "View.MemoryView":848
17131  *                     start = shape
17132  *         else:
17133  *             if negative_step:             # <<<<<<<<<<<<<<
17134  *                 start = shape - 1
17135  *             else:
17136  */
17137     /*else*/ {
17138       __pyx_t_2 = (__pyx_v_negative_step != 0);
17139       if (__pyx_t_2) {
17140 
17141         /* "View.MemoryView":849
17142  *         else:
17143  *             if negative_step:
17144  *                 start = shape - 1             # <<<<<<<<<<<<<<
17145  *             else:
17146  *                 start = 0
17147  */
17148         __pyx_v_start = (__pyx_v_shape - 1);
17149 
17150         /* "View.MemoryView":848
17151  *                     start = shape
17152  *         else:
17153  *             if negative_step:             # <<<<<<<<<<<<<<
17154  *                 start = shape - 1
17155  *             else:
17156  */
17157         goto __pyx_L15;
17158       }
17159 
17160       /* "View.MemoryView":851
17161  *                 start = shape - 1
17162  *             else:
17163  *                 start = 0             # <<<<<<<<<<<<<<
17164  *
17165  *         if have_stop:
17166  */
17167       /*else*/ {
17168         __pyx_v_start = 0;
17169       }
17170       __pyx_L15:;
17171     }
17172     __pyx_L11:;
17173 
17174     /* "View.MemoryView":853
17175  *                 start = 0
17176  *
17177  *         if have_stop:             # <<<<<<<<<<<<<<
17178  *             if stop < 0:
17179  *                 stop += shape
17180  */
17181     __pyx_t_2 = (__pyx_v_have_stop != 0);
17182     if (__pyx_t_2) {
17183 
17184       /* "View.MemoryView":854
17185  *
17186  *         if have_stop:
17187  *             if stop < 0:             # <<<<<<<<<<<<<<
17188  *                 stop += shape
17189  *                 if stop < 0:
17190  */
17191       __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
17192       if (__pyx_t_2) {
17193 
17194         /* "View.MemoryView":855
17195  *         if have_stop:
17196  *             if stop < 0:
17197  *                 stop += shape             # <<<<<<<<<<<<<<
17198  *                 if stop < 0:
17199  *                     stop = 0
17200  */
17201         __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
17202 
17203         /* "View.MemoryView":856
17204  *             if stop < 0:
17205  *                 stop += shape
17206  *                 if stop < 0:             # <<<<<<<<<<<<<<
17207  *                     stop = 0
17208  *             elif stop > shape:
17209  */
17210         __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
17211         if (__pyx_t_2) {
17212 
17213           /* "View.MemoryView":857
17214  *                 stop += shape
17215  *                 if stop < 0:
17216  *                     stop = 0             # <<<<<<<<<<<<<<
17217  *             elif stop > shape:
17218  *                 stop = shape
17219  */
17220           __pyx_v_stop = 0;
17221 
17222           /* "View.MemoryView":856
17223  *             if stop < 0:
17224  *                 stop += shape
17225  *                 if stop < 0:             # <<<<<<<<<<<<<<
17226  *                     stop = 0
17227  *             elif stop > shape:
17228  */
17229         }
17230 
17231         /* "View.MemoryView":854
17232  *
17233  *         if have_stop:
17234  *             if stop < 0:             # <<<<<<<<<<<<<<
17235  *                 stop += shape
17236  *                 if stop < 0:
17237  */
17238         goto __pyx_L17;
17239       }
17240 
17241       /* "View.MemoryView":858
17242  *                 if stop < 0:
17243  *                     stop = 0
17244  *             elif stop > shape:             # <<<<<<<<<<<<<<
17245  *                 stop = shape
17246  *         else:
17247  */
17248       __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
17249       if (__pyx_t_2) {
17250 
17251         /* "View.MemoryView":859
17252  *                     stop = 0
17253  *             elif stop > shape:
17254  *                 stop = shape             # <<<<<<<<<<<<<<
17255  *         else:
17256  *             if negative_step:
17257  */
17258         __pyx_v_stop = __pyx_v_shape;
17259 
17260         /* "View.MemoryView":858
17261  *                 if stop < 0:
17262  *                     stop = 0
17263  *             elif stop > shape:             # <<<<<<<<<<<<<<
17264  *                 stop = shape
17265  *         else:
17266  */
17267       }
17268       __pyx_L17:;
17269 
17270       /* "View.MemoryView":853
17271  *                 start = 0
17272  *
17273  *         if have_stop:             # <<<<<<<<<<<<<<
17274  *             if stop < 0:
17275  *                 stop += shape
17276  */
17277       goto __pyx_L16;
17278     }
17279 
17280     /* "View.MemoryView":861
17281  *                 stop = shape
17282  *         else:
17283  *             if negative_step:             # <<<<<<<<<<<<<<
17284  *                 stop = -1
17285  *             else:
17286  */
17287     /*else*/ {
17288       __pyx_t_2 = (__pyx_v_negative_step != 0);
17289       if (__pyx_t_2) {
17290 
17291         /* "View.MemoryView":862
17292  *         else:
17293  *             if negative_step:
17294  *                 stop = -1             # <<<<<<<<<<<<<<
17295  *             else:
17296  *                 stop = shape
17297  */
17298         __pyx_v_stop = -1L;
17299 
17300         /* "View.MemoryView":861
17301  *                 stop = shape
17302  *         else:
17303  *             if negative_step:             # <<<<<<<<<<<<<<
17304  *                 stop = -1
17305  *             else:
17306  */
17307         goto __pyx_L19;
17308       }
17309 
17310       /* "View.MemoryView":864
17311  *                 stop = -1
17312  *             else:
17313  *                 stop = shape             # <<<<<<<<<<<<<<
17314  *
17315  *         if not have_step:
17316  */
17317       /*else*/ {
17318         __pyx_v_stop = __pyx_v_shape;
17319       }
17320       __pyx_L19:;
17321     }
17322     __pyx_L16:;
17323 
17324     /* "View.MemoryView":866
17325  *                 stop = shape
17326  *
17327  *         if not have_step:             # <<<<<<<<<<<<<<
17328  *             step = 1
17329  *
17330  */
17331     __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
17332     if (__pyx_t_2) {
17333 
17334       /* "View.MemoryView":867
17335  *
17336  *         if not have_step:
17337  *             step = 1             # <<<<<<<<<<<<<<
17338  *
17339  *
17340  */
17341       __pyx_v_step = 1;
17342 
17343       /* "View.MemoryView":866
17344  *                 stop = shape
17345  *
17346  *         if not have_step:             # <<<<<<<<<<<<<<
17347  *             step = 1
17348  *
17349  */
17350     }
17351 
17352     /* "View.MemoryView":871
17353  *
17354  *         with cython.cdivision(True):
17355  *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
17356  *
17357  *             if (stop - start) - step * new_shape:
17358  */
17359     __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
17360 
17361     /* "View.MemoryView":873
17362  *             new_shape = (stop - start) // step
17363  *
17364  *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
17365  *                 new_shape += 1
17366  *
17367  */
17368     __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
17369     if (__pyx_t_2) {
17370 
17371       /* "View.MemoryView":874
17372  *
17373  *             if (stop - start) - step * new_shape:
17374  *                 new_shape += 1             # <<<<<<<<<<<<<<
17375  *
17376  *         if new_shape < 0:
17377  */
17378       __pyx_v_new_shape = (__pyx_v_new_shape + 1);
17379 
17380       /* "View.MemoryView":873
17381  *             new_shape = (stop - start) // step
17382  *
17383  *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
17384  *                 new_shape += 1
17385  *
17386  */
17387     }
17388 
17389     /* "View.MemoryView":876
17390  *                 new_shape += 1
17391  *
17392  *         if new_shape < 0:             # <<<<<<<<<<<<<<
17393  *             new_shape = 0
17394  *
17395  */
17396     __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
17397     if (__pyx_t_2) {
17398 
17399       /* "View.MemoryView":877
17400  *
17401  *         if new_shape < 0:
17402  *             new_shape = 0             # <<<<<<<<<<<<<<
17403  *
17404  *
17405  */
17406       __pyx_v_new_shape = 0;
17407 
17408       /* "View.MemoryView":876
17409  *                 new_shape += 1
17410  *
17411  *         if new_shape < 0:             # <<<<<<<<<<<<<<
17412  *             new_shape = 0
17413  *
17414  */
17415     }
17416 
17417     /* "View.MemoryView":880
17418  *
17419  *
17420  *         dst.strides[new_ndim] = stride * step             # <<<<<<<<<<<<<<
17421  *         dst.shape[new_ndim] = new_shape
17422  *         dst.suboffsets[new_ndim] = suboffset
17423  */
17424     (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
17425 
17426     /* "View.MemoryView":881
17427  *
17428  *         dst.strides[new_ndim] = stride * step
17429  *         dst.shape[new_ndim] = new_shape             # <<<<<<<<<<<<<<
17430  *         dst.suboffsets[new_ndim] = suboffset
17431  *
17432  */
17433     (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
17434 
17435     /* "View.MemoryView":882
17436  *         dst.strides[new_ndim] = stride * step
17437  *         dst.shape[new_ndim] = new_shape
17438  *         dst.suboffsets[new_ndim] = suboffset             # <<<<<<<<<<<<<<
17439  *
17440  *
17441  */
17442     (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
17443   }
17444   __pyx_L3:;
17445 
17446   /* "View.MemoryView":885
17447  *
17448  *
17449  *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
17450  *         dst.data += start * stride
17451  *     else:
17452  */
17453   __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
17454   if (__pyx_t_2) {
17455 
17456     /* "View.MemoryView":886
17457  *
17458  *     if suboffset_dim[0] < 0:
17459  *         dst.data += start * stride             # <<<<<<<<<<<<<<
17460  *     else:
17461  *         dst.suboffsets[suboffset_dim[0]] += start * stride
17462  */
17463     __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
17464 
17465     /* "View.MemoryView":885
17466  *
17467  *
17468  *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
17469  *         dst.data += start * stride
17470  *     else:
17471  */
17472     goto __pyx_L23;
17473   }
17474 
17475   /* "View.MemoryView":888
17476  *         dst.data += start * stride
17477  *     else:
17478  *         dst.suboffsets[suboffset_dim[0]] += start * stride             # <<<<<<<<<<<<<<
17479  *
17480  *     if suboffset >= 0:
17481  */
17482   /*else*/ {
17483     __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
17484     (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
17485   }
17486   __pyx_L23:;
17487 
17488   /* "View.MemoryView":890
17489  *         dst.suboffsets[suboffset_dim[0]] += start * stride
17490  *
17491  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
17492  *         if not is_slice:
17493  *             if new_ndim == 0:
17494  */
17495   __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
17496   if (__pyx_t_2) {
17497 
17498     /* "View.MemoryView":891
17499  *
17500  *     if suboffset >= 0:
17501  *         if not is_slice:             # <<<<<<<<<<<<<<
17502  *             if new_ndim == 0:
17503  *                 dst.data = (<char **> dst.data)[0] + suboffset
17504  */
17505     __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
17506     if (__pyx_t_2) {
17507 
17508       /* "View.MemoryView":892
17509  *     if suboffset >= 0:
17510  *         if not is_slice:
17511  *             if new_ndim == 0:             # <<<<<<<<<<<<<<
17512  *                 dst.data = (<char **> dst.data)[0] + suboffset
17513  *             else:
17514  */
17515       __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
17516       if (__pyx_t_2) {
17517 
17518         /* "View.MemoryView":893
17519  *         if not is_slice:
17520  *             if new_ndim == 0:
17521  *                 dst.data = (<char **> dst.data)[0] + suboffset             # <<<<<<<<<<<<<<
17522  *             else:
17523  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
17524  */
17525         __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
17526 
17527         /* "View.MemoryView":892
17528  *     if suboffset >= 0:
17529  *         if not is_slice:
17530  *             if new_ndim == 0:             # <<<<<<<<<<<<<<
17531  *                 dst.data = (<char **> dst.data)[0] + suboffset
17532  *             else:
17533  */
17534         goto __pyx_L26;
17535       }
17536 
17537       /* "View.MemoryView":895
17538  *                 dst.data = (<char **> dst.data)[0] + suboffset
17539  *             else:
17540  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "             # <<<<<<<<<<<<<<
17541  *                                      "must be indexed and not sliced", dim)
17542  *         else:
17543  */
17544       /*else*/ {
17545 
17546         /* "View.MemoryView":896
17547  *             else:
17548  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
17549  *                                      "must be indexed and not sliced", dim)             # <<<<<<<<<<<<<<
17550  *         else:
17551  *             suboffset_dim[0] = new_ndim
17552  */
17553         __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 895, __pyx_L1_error)
17554       }
17555       __pyx_L26:;
17556 
17557       /* "View.MemoryView":891
17558  *
17559  *     if suboffset >= 0:
17560  *         if not is_slice:             # <<<<<<<<<<<<<<
17561  *             if new_ndim == 0:
17562  *                 dst.data = (<char **> dst.data)[0] + suboffset
17563  */
17564       goto __pyx_L25;
17565     }
17566 
17567     /* "View.MemoryView":898
17568  *                                      "must be indexed and not sliced", dim)
17569  *         else:
17570  *             suboffset_dim[0] = new_ndim             # <<<<<<<<<<<<<<
17571  *
17572  *     return 0
17573  */
17574     /*else*/ {
17575       (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
17576     }
17577     __pyx_L25:;
17578 
17579     /* "View.MemoryView":890
17580  *         dst.suboffsets[suboffset_dim[0]] += start * stride
17581  *
17582  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
17583  *         if not is_slice:
17584  *             if new_ndim == 0:
17585  */
17586   }
17587 
17588   /* "View.MemoryView":900
17589  *             suboffset_dim[0] = new_ndim
17590  *
17591  *     return 0             # <<<<<<<<<<<<<<
17592  *
17593  *
17594  */
17595   __pyx_r = 0;
17596   goto __pyx_L0;
17597 
17598   /* "View.MemoryView":803
17599  *
17600  * @cname('__pyx_memoryview_slice_memviewslice')
17601  * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
17602  *         __Pyx_memviewslice *dst,
17603  *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
17604  */
17605 
17606   /* function exit code */
17607   __pyx_L1_error:;
17608   {
17609     #ifdef WITH_THREAD
17610     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
17611     #endif
17612     __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
17613     #ifdef WITH_THREAD
17614     __Pyx_PyGILState_Release(__pyx_gilstate_save);
17615     #endif
17616   }
17617   __pyx_r = -1;
17618   __pyx_L0:;
17619   return __pyx_r;
17620 }
17621 
17622 /* "View.MemoryView":906
17623  *
17624  * @cname('__pyx_pybuffer_index')
17625  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
17626  *                           Py_ssize_t dim) except NULL:
17627  *     cdef Py_ssize_t shape, stride, suboffset = -1
17628  */
17629 
__pyx_pybuffer_index(Py_buffer * __pyx_v_view,char * __pyx_v_bufp,Py_ssize_t __pyx_v_index,Py_ssize_t __pyx_v_dim)17630 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) {
17631   Py_ssize_t __pyx_v_shape;
17632   Py_ssize_t __pyx_v_stride;
17633   Py_ssize_t __pyx_v_suboffset;
17634   Py_ssize_t __pyx_v_itemsize;
17635   char *__pyx_v_resultp;
17636   char *__pyx_r;
17637   __Pyx_RefNannyDeclarations
17638   Py_ssize_t __pyx_t_1;
17639   int __pyx_t_2;
17640   PyObject *__pyx_t_3 = NULL;
17641   PyObject *__pyx_t_4 = NULL;
17642   __Pyx_RefNannySetupContext("pybuffer_index", 0);
17643 
17644   /* "View.MemoryView":908
17645  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
17646  *                           Py_ssize_t dim) except NULL:
17647  *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
17648  *     cdef Py_ssize_t itemsize = view.itemsize
17649  *     cdef char *resultp
17650  */
17651   __pyx_v_suboffset = -1L;
17652 
17653   /* "View.MemoryView":909
17654  *                           Py_ssize_t dim) except NULL:
17655  *     cdef Py_ssize_t shape, stride, suboffset = -1
17656  *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
17657  *     cdef char *resultp
17658  *
17659  */
17660   __pyx_t_1 = __pyx_v_view->itemsize;
17661   __pyx_v_itemsize = __pyx_t_1;
17662 
17663   /* "View.MemoryView":912
17664  *     cdef char *resultp
17665  *
17666  *     if view.ndim == 0:             # <<<<<<<<<<<<<<
17667  *         shape = view.len / itemsize
17668  *         stride = itemsize
17669  */
17670   __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
17671   if (__pyx_t_2) {
17672 
17673     /* "View.MemoryView":913
17674  *
17675  *     if view.ndim == 0:
17676  *         shape = view.len / itemsize             # <<<<<<<<<<<<<<
17677  *         stride = itemsize
17678  *     else:
17679  */
17680     if (unlikely(__pyx_v_itemsize == 0)) {
17681       PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
17682       __PYX_ERR(2, 913, __pyx_L1_error)
17683     }
17684     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))) {
17685       PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
17686       __PYX_ERR(2, 913, __pyx_L1_error)
17687     }
17688     __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
17689 
17690     /* "View.MemoryView":914
17691  *     if view.ndim == 0:
17692  *         shape = view.len / itemsize
17693  *         stride = itemsize             # <<<<<<<<<<<<<<
17694  *     else:
17695  *         shape = view.shape[dim]
17696  */
17697     __pyx_v_stride = __pyx_v_itemsize;
17698 
17699     /* "View.MemoryView":912
17700  *     cdef char *resultp
17701  *
17702  *     if view.ndim == 0:             # <<<<<<<<<<<<<<
17703  *         shape = view.len / itemsize
17704  *         stride = itemsize
17705  */
17706     goto __pyx_L3;
17707   }
17708 
17709   /* "View.MemoryView":916
17710  *         stride = itemsize
17711  *     else:
17712  *         shape = view.shape[dim]             # <<<<<<<<<<<<<<
17713  *         stride = view.strides[dim]
17714  *         if view.suboffsets != NULL:
17715  */
17716   /*else*/ {
17717     __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
17718 
17719     /* "View.MemoryView":917
17720  *     else:
17721  *         shape = view.shape[dim]
17722  *         stride = view.strides[dim]             # <<<<<<<<<<<<<<
17723  *         if view.suboffsets != NULL:
17724  *             suboffset = view.suboffsets[dim]
17725  */
17726     __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
17727 
17728     /* "View.MemoryView":918
17729  *         shape = view.shape[dim]
17730  *         stride = view.strides[dim]
17731  *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
17732  *             suboffset = view.suboffsets[dim]
17733  *
17734  */
17735     __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
17736     if (__pyx_t_2) {
17737 
17738       /* "View.MemoryView":919
17739  *         stride = view.strides[dim]
17740  *         if view.suboffsets != NULL:
17741  *             suboffset = view.suboffsets[dim]             # <<<<<<<<<<<<<<
17742  *
17743  *     if index < 0:
17744  */
17745       __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
17746 
17747       /* "View.MemoryView":918
17748  *         shape = view.shape[dim]
17749  *         stride = view.strides[dim]
17750  *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
17751  *             suboffset = view.suboffsets[dim]
17752  *
17753  */
17754     }
17755   }
17756   __pyx_L3:;
17757 
17758   /* "View.MemoryView":921
17759  *             suboffset = view.suboffsets[dim]
17760  *
17761  *     if index < 0:             # <<<<<<<<<<<<<<
17762  *         index += view.shape[dim]
17763  *         if index < 0:
17764  */
17765   __pyx_t_2 = ((__pyx_v_index < 0) != 0);
17766   if (__pyx_t_2) {
17767 
17768     /* "View.MemoryView":922
17769  *
17770  *     if index < 0:
17771  *         index += view.shape[dim]             # <<<<<<<<<<<<<<
17772  *         if index < 0:
17773  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
17774  */
17775     __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
17776 
17777     /* "View.MemoryView":923
17778  *     if index < 0:
17779  *         index += view.shape[dim]
17780  *         if index < 0:             # <<<<<<<<<<<<<<
17781  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
17782  *
17783  */
17784     __pyx_t_2 = ((__pyx_v_index < 0) != 0);
17785     if (unlikely(__pyx_t_2)) {
17786 
17787       /* "View.MemoryView":924
17788  *         index += view.shape[dim]
17789  *         if index < 0:
17790  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
17791  *
17792  *     if index >= shape:
17793  */
17794       __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 924, __pyx_L1_error)
17795       __Pyx_GOTREF(__pyx_t_3);
17796       __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 924, __pyx_L1_error)
17797       __Pyx_GOTREF(__pyx_t_4);
17798       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17799       __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 924, __pyx_L1_error)
17800       __Pyx_GOTREF(__pyx_t_3);
17801       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17802       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
17803       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17804       __PYX_ERR(2, 924, __pyx_L1_error)
17805 
17806       /* "View.MemoryView":923
17807  *     if index < 0:
17808  *         index += view.shape[dim]
17809  *         if index < 0:             # <<<<<<<<<<<<<<
17810  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
17811  *
17812  */
17813     }
17814 
17815     /* "View.MemoryView":921
17816  *             suboffset = view.suboffsets[dim]
17817  *
17818  *     if index < 0:             # <<<<<<<<<<<<<<
17819  *         index += view.shape[dim]
17820  *         if index < 0:
17821  */
17822   }
17823 
17824   /* "View.MemoryView":926
17825  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
17826  *
17827  *     if index >= shape:             # <<<<<<<<<<<<<<
17828  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
17829  *
17830  */
17831   __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
17832   if (unlikely(__pyx_t_2)) {
17833 
17834     /* "View.MemoryView":927
17835  *
17836  *     if index >= shape:
17837  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
17838  *
17839  *     resultp = bufp + index * stride
17840  */
17841     __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 927, __pyx_L1_error)
17842     __Pyx_GOTREF(__pyx_t_3);
17843     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 927, __pyx_L1_error)
17844     __Pyx_GOTREF(__pyx_t_4);
17845     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17846     __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 927, __pyx_L1_error)
17847     __Pyx_GOTREF(__pyx_t_3);
17848     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17849     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
17850     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17851     __PYX_ERR(2, 927, __pyx_L1_error)
17852 
17853     /* "View.MemoryView":926
17854  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
17855  *
17856  *     if index >= shape:             # <<<<<<<<<<<<<<
17857  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
17858  *
17859  */
17860   }
17861 
17862   /* "View.MemoryView":929
17863  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
17864  *
17865  *     resultp = bufp + index * stride             # <<<<<<<<<<<<<<
17866  *     if suboffset >= 0:
17867  *         resultp = (<char **> resultp)[0] + suboffset
17868  */
17869   __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
17870 
17871   /* "View.MemoryView":930
17872  *
17873  *     resultp = bufp + index * stride
17874  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
17875  *         resultp = (<char **> resultp)[0] + suboffset
17876  *
17877  */
17878   __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
17879   if (__pyx_t_2) {
17880 
17881     /* "View.MemoryView":931
17882  *     resultp = bufp + index * stride
17883  *     if suboffset >= 0:
17884  *         resultp = (<char **> resultp)[0] + suboffset             # <<<<<<<<<<<<<<
17885  *
17886  *     return resultp
17887  */
17888     __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
17889 
17890     /* "View.MemoryView":930
17891  *
17892  *     resultp = bufp + index * stride
17893  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
17894  *         resultp = (<char **> resultp)[0] + suboffset
17895  *
17896  */
17897   }
17898 
17899   /* "View.MemoryView":933
17900  *         resultp = (<char **> resultp)[0] + suboffset
17901  *
17902  *     return resultp             # <<<<<<<<<<<<<<
17903  *
17904  *
17905  */
17906   __pyx_r = __pyx_v_resultp;
17907   goto __pyx_L0;
17908 
17909   /* "View.MemoryView":906
17910  *
17911  * @cname('__pyx_pybuffer_index')
17912  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
17913  *                           Py_ssize_t dim) except NULL:
17914  *     cdef Py_ssize_t shape, stride, suboffset = -1
17915  */
17916 
17917   /* function exit code */
17918   __pyx_L1_error:;
17919   __Pyx_XDECREF(__pyx_t_3);
17920   __Pyx_XDECREF(__pyx_t_4);
17921   __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
17922   __pyx_r = NULL;
17923   __pyx_L0:;
17924   __Pyx_RefNannyFinishContext();
17925   return __pyx_r;
17926 }
17927 
17928 /* "View.MemoryView":939
17929  *
17930  * @cname('__pyx_memslice_transpose')
17931  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
17932  *     cdef int ndim = memslice.memview.view.ndim
17933  *
17934  */
17935 
__pyx_memslice_transpose(__Pyx_memviewslice * __pyx_v_memslice)17936 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
17937   int __pyx_v_ndim;
17938   Py_ssize_t *__pyx_v_shape;
17939   Py_ssize_t *__pyx_v_strides;
17940   int __pyx_v_i;
17941   int __pyx_v_j;
17942   int __pyx_r;
17943   int __pyx_t_1;
17944   Py_ssize_t *__pyx_t_2;
17945   long __pyx_t_3;
17946   long __pyx_t_4;
17947   Py_ssize_t __pyx_t_5;
17948   Py_ssize_t __pyx_t_6;
17949   int __pyx_t_7;
17950   int __pyx_t_8;
17951   int __pyx_t_9;
17952 
17953   /* "View.MemoryView":940
17954  * @cname('__pyx_memslice_transpose')
17955  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
17956  *     cdef int ndim = memslice.memview.view.ndim             # <<<<<<<<<<<<<<
17957  *
17958  *     cdef Py_ssize_t *shape = memslice.shape
17959  */
17960   __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
17961   __pyx_v_ndim = __pyx_t_1;
17962 
17963   /* "View.MemoryView":942
17964  *     cdef int ndim = memslice.memview.view.ndim
17965  *
17966  *     cdef Py_ssize_t *shape = memslice.shape             # <<<<<<<<<<<<<<
17967  *     cdef Py_ssize_t *strides = memslice.strides
17968  *
17969  */
17970   __pyx_t_2 = __pyx_v_memslice->shape;
17971   __pyx_v_shape = __pyx_t_2;
17972 
17973   /* "View.MemoryView":943
17974  *
17975  *     cdef Py_ssize_t *shape = memslice.shape
17976  *     cdef Py_ssize_t *strides = memslice.strides             # <<<<<<<<<<<<<<
17977  *
17978  *
17979  */
17980   __pyx_t_2 = __pyx_v_memslice->strides;
17981   __pyx_v_strides = __pyx_t_2;
17982 
17983   /* "View.MemoryView":947
17984  *
17985  *     cdef int i, j
17986  *     for i in range(ndim / 2):             # <<<<<<<<<<<<<<
17987  *         j = ndim - 1 - i
17988  *         strides[i], strides[j] = strides[j], strides[i]
17989  */
17990   __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
17991   __pyx_t_4 = __pyx_t_3;
17992   for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
17993     __pyx_v_i = __pyx_t_1;
17994 
17995     /* "View.MemoryView":948
17996  *     cdef int i, j
17997  *     for i in range(ndim / 2):
17998  *         j = ndim - 1 - i             # <<<<<<<<<<<<<<
17999  *         strides[i], strides[j] = strides[j], strides[i]
18000  *         shape[i], shape[j] = shape[j], shape[i]
18001  */
18002     __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
18003 
18004     /* "View.MemoryView":949
18005  *     for i in range(ndim / 2):
18006  *         j = ndim - 1 - i
18007  *         strides[i], strides[j] = strides[j], strides[i]             # <<<<<<<<<<<<<<
18008  *         shape[i], shape[j] = shape[j], shape[i]
18009  *
18010  */
18011     __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
18012     __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
18013     (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
18014     (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
18015 
18016     /* "View.MemoryView":950
18017  *         j = ndim - 1 - i
18018  *         strides[i], strides[j] = strides[j], strides[i]
18019  *         shape[i], shape[j] = shape[j], shape[i]             # <<<<<<<<<<<<<<
18020  *
18021  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
18022  */
18023     __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
18024     __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
18025     (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
18026     (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
18027 
18028     /* "View.MemoryView":952
18029  *         shape[i], shape[j] = shape[j], shape[i]
18030  *
18031  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
18032  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
18033  *
18034  */
18035     __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
18036     if (!__pyx_t_8) {
18037     } else {
18038       __pyx_t_7 = __pyx_t_8;
18039       goto __pyx_L6_bool_binop_done;
18040     }
18041     __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
18042     __pyx_t_7 = __pyx_t_8;
18043     __pyx_L6_bool_binop_done:;
18044     if (__pyx_t_7) {
18045 
18046       /* "View.MemoryView":953
18047  *
18048  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
18049  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")             # <<<<<<<<<<<<<<
18050  *
18051  *     return 1
18052  */
18053       __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 953, __pyx_L1_error)
18054 
18055       /* "View.MemoryView":952
18056  *         shape[i], shape[j] = shape[j], shape[i]
18057  *
18058  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
18059  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
18060  *
18061  */
18062     }
18063   }
18064 
18065   /* "View.MemoryView":955
18066  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
18067  *
18068  *     return 1             # <<<<<<<<<<<<<<
18069  *
18070  *
18071  */
18072   __pyx_r = 1;
18073   goto __pyx_L0;
18074 
18075   /* "View.MemoryView":939
18076  *
18077  * @cname('__pyx_memslice_transpose')
18078  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
18079  *     cdef int ndim = memslice.memview.view.ndim
18080  *
18081  */
18082 
18083   /* function exit code */
18084   __pyx_L1_error:;
18085   {
18086     #ifdef WITH_THREAD
18087     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18088     #endif
18089     __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
18090     #ifdef WITH_THREAD
18091     __Pyx_PyGILState_Release(__pyx_gilstate_save);
18092     #endif
18093   }
18094   __pyx_r = 0;
18095   __pyx_L0:;
18096   return __pyx_r;
18097 }
18098 
18099 /* "View.MemoryView":972
18100  *     cdef int (*to_dtype_func)(char *, object) except 0
18101  *
18102  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
18103  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
18104  *
18105  */
18106 
18107 /* Python wrapper */
18108 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryviewslice___dealloc__(PyObject * __pyx_v_self)18109 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
18110   __Pyx_RefNannyDeclarations
18111   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
18112   __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
18113 
18114   /* function exit code */
18115   __Pyx_RefNannyFinishContext();
18116 }
18117 
__pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj * __pyx_v_self)18118 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
18119   __Pyx_RefNannyDeclarations
18120   __Pyx_RefNannySetupContext("__dealloc__", 0);
18121 
18122   /* "View.MemoryView":973
18123  *
18124  *     def __dealloc__(self):
18125  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)             # <<<<<<<<<<<<<<
18126  *
18127  *     cdef convert_item_to_object(self, char *itemp):
18128  */
18129   __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
18130 
18131   /* "View.MemoryView":972
18132  *     cdef int (*to_dtype_func)(char *, object) except 0
18133  *
18134  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
18135  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
18136  *
18137  */
18138 
18139   /* function exit code */
18140   __Pyx_RefNannyFinishContext();
18141 }
18142 
18143 /* "View.MemoryView":975
18144  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
18145  *
18146  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
18147  *         if self.to_object_func != NULL:
18148  *             return self.to_object_func(itemp)
18149  */
18150 
__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj * __pyx_v_self,char * __pyx_v_itemp)18151 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
18152   PyObject *__pyx_r = NULL;
18153   __Pyx_RefNannyDeclarations
18154   int __pyx_t_1;
18155   PyObject *__pyx_t_2 = NULL;
18156   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
18157 
18158   /* "View.MemoryView":976
18159  *
18160  *     cdef convert_item_to_object(self, char *itemp):
18161  *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
18162  *             return self.to_object_func(itemp)
18163  *         else:
18164  */
18165   __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
18166   if (__pyx_t_1) {
18167 
18168     /* "View.MemoryView":977
18169  *     cdef convert_item_to_object(self, char *itemp):
18170  *         if self.to_object_func != NULL:
18171  *             return self.to_object_func(itemp)             # <<<<<<<<<<<<<<
18172  *         else:
18173  *             return memoryview.convert_item_to_object(self, itemp)
18174  */
18175     __Pyx_XDECREF(__pyx_r);
18176     __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 977, __pyx_L1_error)
18177     __Pyx_GOTREF(__pyx_t_2);
18178     __pyx_r = __pyx_t_2;
18179     __pyx_t_2 = 0;
18180     goto __pyx_L0;
18181 
18182     /* "View.MemoryView":976
18183  *
18184  *     cdef convert_item_to_object(self, char *itemp):
18185  *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
18186  *             return self.to_object_func(itemp)
18187  *         else:
18188  */
18189   }
18190 
18191   /* "View.MemoryView":979
18192  *             return self.to_object_func(itemp)
18193  *         else:
18194  *             return memoryview.convert_item_to_object(self, itemp)             # <<<<<<<<<<<<<<
18195  *
18196  *     cdef assign_item_from_object(self, char *itemp, object value):
18197  */
18198   /*else*/ {
18199     __Pyx_XDECREF(__pyx_r);
18200     __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 979, __pyx_L1_error)
18201     __Pyx_GOTREF(__pyx_t_2);
18202     __pyx_r = __pyx_t_2;
18203     __pyx_t_2 = 0;
18204     goto __pyx_L0;
18205   }
18206 
18207   /* "View.MemoryView":975
18208  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
18209  *
18210  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
18211  *         if self.to_object_func != NULL:
18212  *             return self.to_object_func(itemp)
18213  */
18214 
18215   /* function exit code */
18216   __pyx_L1_error:;
18217   __Pyx_XDECREF(__pyx_t_2);
18218   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
18219   __pyx_r = 0;
18220   __pyx_L0:;
18221   __Pyx_XGIVEREF(__pyx_r);
18222   __Pyx_RefNannyFinishContext();
18223   return __pyx_r;
18224 }
18225 
18226 /* "View.MemoryView":981
18227  *             return memoryview.convert_item_to_object(self, itemp)
18228  *
18229  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
18230  *         if self.to_dtype_func != NULL:
18231  *             self.to_dtype_func(itemp, value)
18232  */
18233 
__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj * __pyx_v_self,char * __pyx_v_itemp,PyObject * __pyx_v_value)18234 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
18235   PyObject *__pyx_r = NULL;
18236   __Pyx_RefNannyDeclarations
18237   int __pyx_t_1;
18238   int __pyx_t_2;
18239   PyObject *__pyx_t_3 = NULL;
18240   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
18241 
18242   /* "View.MemoryView":982
18243  *
18244  *     cdef assign_item_from_object(self, char *itemp, object value):
18245  *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
18246  *             self.to_dtype_func(itemp, value)
18247  *         else:
18248  */
18249   __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
18250   if (__pyx_t_1) {
18251 
18252     /* "View.MemoryView":983
18253  *     cdef assign_item_from_object(self, char *itemp, object value):
18254  *         if self.to_dtype_func != NULL:
18255  *             self.to_dtype_func(itemp, value)             # <<<<<<<<<<<<<<
18256  *         else:
18257  *             memoryview.assign_item_from_object(self, itemp, value)
18258  */
18259     __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 983, __pyx_L1_error)
18260 
18261     /* "View.MemoryView":982
18262  *
18263  *     cdef assign_item_from_object(self, char *itemp, object value):
18264  *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
18265  *             self.to_dtype_func(itemp, value)
18266  *         else:
18267  */
18268     goto __pyx_L3;
18269   }
18270 
18271   /* "View.MemoryView":985
18272  *             self.to_dtype_func(itemp, value)
18273  *         else:
18274  *             memoryview.assign_item_from_object(self, itemp, value)             # <<<<<<<<<<<<<<
18275  *
18276  *     @property
18277  */
18278   /*else*/ {
18279     __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 985, __pyx_L1_error)
18280     __Pyx_GOTREF(__pyx_t_3);
18281     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18282   }
18283   __pyx_L3:;
18284 
18285   /* "View.MemoryView":981
18286  *             return memoryview.convert_item_to_object(self, itemp)
18287  *
18288  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
18289  *         if self.to_dtype_func != NULL:
18290  *             self.to_dtype_func(itemp, value)
18291  */
18292 
18293   /* function exit code */
18294   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18295   goto __pyx_L0;
18296   __pyx_L1_error:;
18297   __Pyx_XDECREF(__pyx_t_3);
18298   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
18299   __pyx_r = 0;
18300   __pyx_L0:;
18301   __Pyx_XGIVEREF(__pyx_r);
18302   __Pyx_RefNannyFinishContext();
18303   return __pyx_r;
18304 }
18305 
18306 /* "View.MemoryView":988
18307  *
18308  *     @property
18309  *     def base(self):             # <<<<<<<<<<<<<<
18310  *         return self.from_object
18311  *
18312  */
18313 
18314 /* Python wrapper */
18315 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)18316 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
18317   PyObject *__pyx_r = 0;
18318   __Pyx_RefNannyDeclarations
18319   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
18320   __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
18321 
18322   /* function exit code */
18323   __Pyx_RefNannyFinishContext();
18324   return __pyx_r;
18325 }
18326 
__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj * __pyx_v_self)18327 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
18328   PyObject *__pyx_r = NULL;
18329   __Pyx_RefNannyDeclarations
18330   __Pyx_RefNannySetupContext("__get__", 0);
18331 
18332   /* "View.MemoryView":989
18333  *     @property
18334  *     def base(self):
18335  *         return self.from_object             # <<<<<<<<<<<<<<
18336  *
18337  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
18338  */
18339   __Pyx_XDECREF(__pyx_r);
18340   __Pyx_INCREF(__pyx_v_self->from_object);
18341   __pyx_r = __pyx_v_self->from_object;
18342   goto __pyx_L0;
18343 
18344   /* "View.MemoryView":988
18345  *
18346  *     @property
18347  *     def base(self):             # <<<<<<<<<<<<<<
18348  *         return self.from_object
18349  *
18350  */
18351 
18352   /* function exit code */
18353   __pyx_L0:;
18354   __Pyx_XGIVEREF(__pyx_r);
18355   __Pyx_RefNannyFinishContext();
18356   return __pyx_r;
18357 }
18358 
18359 /* "(tree fragment)":1
18360  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
18361  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18362  * def __setstate_cython__(self, __pyx_state):
18363  */
18364 
18365 /* Python wrapper */
18366 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)18367 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
18368   PyObject *__pyx_r = 0;
18369   __Pyx_RefNannyDeclarations
18370   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
18371   __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
18372 
18373   /* function exit code */
18374   __Pyx_RefNannyFinishContext();
18375   return __pyx_r;
18376 }
18377 
__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj * __pyx_v_self)18378 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
18379   PyObject *__pyx_r = NULL;
18380   __Pyx_RefNannyDeclarations
18381   PyObject *__pyx_t_1 = NULL;
18382   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
18383 
18384   /* "(tree fragment)":2
18385  * def __reduce_cython__(self):
18386  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
18387  * def __setstate_cython__(self, __pyx_state):
18388  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18389  */
18390   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
18391   __Pyx_GOTREF(__pyx_t_1);
18392   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
18393   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18394   __PYX_ERR(2, 2, __pyx_L1_error)
18395 
18396   /* "(tree fragment)":1
18397  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
18398  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18399  * def __setstate_cython__(self, __pyx_state):
18400  */
18401 
18402   /* function exit code */
18403   __pyx_L1_error:;
18404   __Pyx_XDECREF(__pyx_t_1);
18405   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18406   __pyx_r = NULL;
18407   __Pyx_XGIVEREF(__pyx_r);
18408   __Pyx_RefNannyFinishContext();
18409   return __pyx_r;
18410 }
18411 
18412 /* "(tree fragment)":3
18413  * def __reduce_cython__(self):
18414  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18415  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
18416  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18417  */
18418 
18419 /* Python wrapper */
18420 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)18421 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
18422   PyObject *__pyx_r = 0;
18423   __Pyx_RefNannyDeclarations
18424   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
18425   __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
18426 
18427   /* function exit code */
18428   __Pyx_RefNannyFinishContext();
18429   return __pyx_r;
18430 }
18431 
__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)18432 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) {
18433   PyObject *__pyx_r = NULL;
18434   __Pyx_RefNannyDeclarations
18435   PyObject *__pyx_t_1 = NULL;
18436   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
18437 
18438   /* "(tree fragment)":4
18439  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18440  * def __setstate_cython__(self, __pyx_state):
18441  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
18442  */
18443   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
18444   __Pyx_GOTREF(__pyx_t_1);
18445   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
18446   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18447   __PYX_ERR(2, 4, __pyx_L1_error)
18448 
18449   /* "(tree fragment)":3
18450  * def __reduce_cython__(self):
18451  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18452  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
18453  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18454  */
18455 
18456   /* function exit code */
18457   __pyx_L1_error:;
18458   __Pyx_XDECREF(__pyx_t_1);
18459   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18460   __pyx_r = NULL;
18461   __Pyx_XGIVEREF(__pyx_r);
18462   __Pyx_RefNannyFinishContext();
18463   return __pyx_r;
18464 }
18465 
18466 /* "View.MemoryView":995
18467  *
18468  * @cname('__pyx_memoryview_fromslice')
18469  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
18470  *                           int ndim,
18471  *                           object (*to_object_func)(char *),
18472  */
18473 
__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)18474 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) {
18475   struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
18476   Py_ssize_t __pyx_v_suboffset;
18477   PyObject *__pyx_v_length = NULL;
18478   PyObject *__pyx_r = NULL;
18479   __Pyx_RefNannyDeclarations
18480   int __pyx_t_1;
18481   PyObject *__pyx_t_2 = NULL;
18482   PyObject *__pyx_t_3 = NULL;
18483   __Pyx_TypeInfo *__pyx_t_4;
18484   Py_buffer __pyx_t_5;
18485   Py_ssize_t *__pyx_t_6;
18486   Py_ssize_t *__pyx_t_7;
18487   Py_ssize_t *__pyx_t_8;
18488   Py_ssize_t __pyx_t_9;
18489   __Pyx_RefNannySetupContext("memoryview_fromslice", 0);
18490 
18491   /* "View.MemoryView":1003
18492  *     cdef _memoryviewslice result
18493  *
18494  *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
18495  *         return None
18496  *
18497  */
18498   __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
18499   if (__pyx_t_1) {
18500 
18501     /* "View.MemoryView":1004
18502  *
18503  *     if <PyObject *> memviewslice.memview == Py_None:
18504  *         return None             # <<<<<<<<<<<<<<
18505  *
18506  *
18507  */
18508     __Pyx_XDECREF(__pyx_r);
18509     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18510     goto __pyx_L0;
18511 
18512     /* "View.MemoryView":1003
18513  *     cdef _memoryviewslice result
18514  *
18515  *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
18516  *         return None
18517  *
18518  */
18519   }
18520 
18521   /* "View.MemoryView":1009
18522  *
18523  *
18524  *     result = _memoryviewslice(None, 0, dtype_is_object)             # <<<<<<<<<<<<<<
18525  *
18526  *     result.from_slice = memviewslice
18527  */
18528   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1009, __pyx_L1_error)
18529   __Pyx_GOTREF(__pyx_t_2);
18530   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1009, __pyx_L1_error)
18531   __Pyx_GOTREF(__pyx_t_3);
18532   __Pyx_INCREF(Py_None);
18533   __Pyx_GIVEREF(Py_None);
18534   PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
18535   __Pyx_INCREF(__pyx_int_0);
18536   __Pyx_GIVEREF(__pyx_int_0);
18537   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
18538   __Pyx_GIVEREF(__pyx_t_2);
18539   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
18540   __pyx_t_2 = 0;
18541   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1009, __pyx_L1_error)
18542   __Pyx_GOTREF(__pyx_t_2);
18543   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18544   __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
18545   __pyx_t_2 = 0;
18546 
18547   /* "View.MemoryView":1011
18548  *     result = _memoryviewslice(None, 0, dtype_is_object)
18549  *
18550  *     result.from_slice = memviewslice             # <<<<<<<<<<<<<<
18551  *     __PYX_INC_MEMVIEW(&memviewslice, 1)
18552  *
18553  */
18554   __pyx_v_result->from_slice = __pyx_v_memviewslice;
18555 
18556   /* "View.MemoryView":1012
18557  *
18558  *     result.from_slice = memviewslice
18559  *     __PYX_INC_MEMVIEW(&memviewslice, 1)             # <<<<<<<<<<<<<<
18560  *
18561  *     result.from_object = (<memoryview> memviewslice.memview).base
18562  */
18563   __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
18564 
18565   /* "View.MemoryView":1014
18566  *     __PYX_INC_MEMVIEW(&memviewslice, 1)
18567  *
18568  *     result.from_object = (<memoryview> memviewslice.memview).base             # <<<<<<<<<<<<<<
18569  *     result.typeinfo = memviewslice.memview.typeinfo
18570  *
18571  */
18572   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1014, __pyx_L1_error)
18573   __Pyx_GOTREF(__pyx_t_2);
18574   __Pyx_GIVEREF(__pyx_t_2);
18575   __Pyx_GOTREF(__pyx_v_result->from_object);
18576   __Pyx_DECREF(__pyx_v_result->from_object);
18577   __pyx_v_result->from_object = __pyx_t_2;
18578   __pyx_t_2 = 0;
18579 
18580   /* "View.MemoryView":1015
18581  *
18582  *     result.from_object = (<memoryview> memviewslice.memview).base
18583  *     result.typeinfo = memviewslice.memview.typeinfo             # <<<<<<<<<<<<<<
18584  *
18585  *     result.view = memviewslice.memview.view
18586  */
18587   __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
18588   __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
18589 
18590   /* "View.MemoryView":1017
18591  *     result.typeinfo = memviewslice.memview.typeinfo
18592  *
18593  *     result.view = memviewslice.memview.view             # <<<<<<<<<<<<<<
18594  *     result.view.buf = <void *> memviewslice.data
18595  *     result.view.ndim = ndim
18596  */
18597   __pyx_t_5 = __pyx_v_memviewslice.memview->view;
18598   __pyx_v_result->__pyx_base.view = __pyx_t_5;
18599 
18600   /* "View.MemoryView":1018
18601  *
18602  *     result.view = memviewslice.memview.view
18603  *     result.view.buf = <void *> memviewslice.data             # <<<<<<<<<<<<<<
18604  *     result.view.ndim = ndim
18605  *     (<__pyx_buffer *> &result.view).obj = Py_None
18606  */
18607   __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
18608 
18609   /* "View.MemoryView":1019
18610  *     result.view = memviewslice.memview.view
18611  *     result.view.buf = <void *> memviewslice.data
18612  *     result.view.ndim = ndim             # <<<<<<<<<<<<<<
18613  *     (<__pyx_buffer *> &result.view).obj = Py_None
18614  *     Py_INCREF(Py_None)
18615  */
18616   __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
18617 
18618   /* "View.MemoryView":1020
18619  *     result.view.buf = <void *> memviewslice.data
18620  *     result.view.ndim = ndim
18621  *     (<__pyx_buffer *> &result.view).obj = Py_None             # <<<<<<<<<<<<<<
18622  *     Py_INCREF(Py_None)
18623  *
18624  */
18625   ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
18626 
18627   /* "View.MemoryView":1021
18628  *     result.view.ndim = ndim
18629  *     (<__pyx_buffer *> &result.view).obj = Py_None
18630  *     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
18631  *
18632  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
18633  */
18634   Py_INCREF(Py_None);
18635 
18636   /* "View.MemoryView":1023
18637  *     Py_INCREF(Py_None)
18638  *
18639  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
18640  *         result.flags = PyBUF_RECORDS
18641  *     else:
18642  */
18643   __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
18644   if (__pyx_t_1) {
18645 
18646     /* "View.MemoryView":1024
18647  *
18648  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
18649  *         result.flags = PyBUF_RECORDS             # <<<<<<<<<<<<<<
18650  *     else:
18651  *         result.flags = PyBUF_RECORDS_RO
18652  */
18653     __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
18654 
18655     /* "View.MemoryView":1023
18656  *     Py_INCREF(Py_None)
18657  *
18658  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
18659  *         result.flags = PyBUF_RECORDS
18660  *     else:
18661  */
18662     goto __pyx_L4;
18663   }
18664 
18665   /* "View.MemoryView":1026
18666  *         result.flags = PyBUF_RECORDS
18667  *     else:
18668  *         result.flags = PyBUF_RECORDS_RO             # <<<<<<<<<<<<<<
18669  *
18670  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
18671  */
18672   /*else*/ {
18673     __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
18674   }
18675   __pyx_L4:;
18676 
18677   /* "View.MemoryView":1028
18678  *         result.flags = PyBUF_RECORDS_RO
18679  *
18680  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape             # <<<<<<<<<<<<<<
18681  *     result.view.strides = <Py_ssize_t *> result.from_slice.strides
18682  *
18683  */
18684   __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
18685 
18686   /* "View.MemoryView":1029
18687  *
18688  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
18689  *     result.view.strides = <Py_ssize_t *> result.from_slice.strides             # <<<<<<<<<<<<<<
18690  *
18691  *
18692  */
18693   __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
18694 
18695   /* "View.MemoryView":1032
18696  *
18697  *
18698  *     result.view.suboffsets = NULL             # <<<<<<<<<<<<<<
18699  *     for suboffset in result.from_slice.suboffsets[:ndim]:
18700  *         if suboffset >= 0:
18701  */
18702   __pyx_v_result->__pyx_base.view.suboffsets = NULL;
18703 
18704   /* "View.MemoryView":1033
18705  *
18706  *     result.view.suboffsets = NULL
18707  *     for suboffset in result.from_slice.suboffsets[:ndim]:             # <<<<<<<<<<<<<<
18708  *         if suboffset >= 0:
18709  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
18710  */
18711   __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
18712   for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
18713     __pyx_t_6 = __pyx_t_8;
18714     __pyx_v_suboffset = (__pyx_t_6[0]);
18715 
18716     /* "View.MemoryView":1034
18717  *     result.view.suboffsets = NULL
18718  *     for suboffset in result.from_slice.suboffsets[:ndim]:
18719  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
18720  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
18721  *             break
18722  */
18723     __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
18724     if (__pyx_t_1) {
18725 
18726       /* "View.MemoryView":1035
18727  *     for suboffset in result.from_slice.suboffsets[:ndim]:
18728  *         if suboffset >= 0:
18729  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets             # <<<<<<<<<<<<<<
18730  *             break
18731  *
18732  */
18733       __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
18734 
18735       /* "View.MemoryView":1036
18736  *         if suboffset >= 0:
18737  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
18738  *             break             # <<<<<<<<<<<<<<
18739  *
18740  *     result.view.len = result.view.itemsize
18741  */
18742       goto __pyx_L6_break;
18743 
18744       /* "View.MemoryView":1034
18745  *     result.view.suboffsets = NULL
18746  *     for suboffset in result.from_slice.suboffsets[:ndim]:
18747  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
18748  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
18749  *             break
18750  */
18751     }
18752   }
18753   __pyx_L6_break:;
18754 
18755   /* "View.MemoryView":1038
18756  *             break
18757  *
18758  *     result.view.len = result.view.itemsize             # <<<<<<<<<<<<<<
18759  *     for length in result.view.shape[:ndim]:
18760  *         result.view.len *= length
18761  */
18762   __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
18763   __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
18764 
18765   /* "View.MemoryView":1039
18766  *
18767  *     result.view.len = result.view.itemsize
18768  *     for length in result.view.shape[:ndim]:             # <<<<<<<<<<<<<<
18769  *         result.view.len *= length
18770  *
18771  */
18772   __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
18773   for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
18774     __pyx_t_6 = __pyx_t_8;
18775     __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1039, __pyx_L1_error)
18776     __Pyx_GOTREF(__pyx_t_2);
18777     __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
18778     __pyx_t_2 = 0;
18779 
18780     /* "View.MemoryView":1040
18781  *     result.view.len = result.view.itemsize
18782  *     for length in result.view.shape[:ndim]:
18783  *         result.view.len *= length             # <<<<<<<<<<<<<<
18784  *
18785  *     result.to_object_func = to_object_func
18786  */
18787     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1040, __pyx_L1_error)
18788     __Pyx_GOTREF(__pyx_t_2);
18789     __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1040, __pyx_L1_error)
18790     __Pyx_GOTREF(__pyx_t_3);
18791     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18792     __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1040, __pyx_L1_error)
18793     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18794     __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
18795   }
18796 
18797   /* "View.MemoryView":1042
18798  *         result.view.len *= length
18799  *
18800  *     result.to_object_func = to_object_func             # <<<<<<<<<<<<<<
18801  *     result.to_dtype_func = to_dtype_func
18802  *
18803  */
18804   __pyx_v_result->to_object_func = __pyx_v_to_object_func;
18805 
18806   /* "View.MemoryView":1043
18807  *
18808  *     result.to_object_func = to_object_func
18809  *     result.to_dtype_func = to_dtype_func             # <<<<<<<<<<<<<<
18810  *
18811  *     return result
18812  */
18813   __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
18814 
18815   /* "View.MemoryView":1045
18816  *     result.to_dtype_func = to_dtype_func
18817  *
18818  *     return result             # <<<<<<<<<<<<<<
18819  *
18820  * @cname('__pyx_memoryview_get_slice_from_memoryview')
18821  */
18822   __Pyx_XDECREF(__pyx_r);
18823   __Pyx_INCREF(((PyObject *)__pyx_v_result));
18824   __pyx_r = ((PyObject *)__pyx_v_result);
18825   goto __pyx_L0;
18826 
18827   /* "View.MemoryView":995
18828  *
18829  * @cname('__pyx_memoryview_fromslice')
18830  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
18831  *                           int ndim,
18832  *                           object (*to_object_func)(char *),
18833  */
18834 
18835   /* function exit code */
18836   __pyx_L1_error:;
18837   __Pyx_XDECREF(__pyx_t_2);
18838   __Pyx_XDECREF(__pyx_t_3);
18839   __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
18840   __pyx_r = 0;
18841   __pyx_L0:;
18842   __Pyx_XDECREF((PyObject *)__pyx_v_result);
18843   __Pyx_XDECREF(__pyx_v_length);
18844   __Pyx_XGIVEREF(__pyx_r);
18845   __Pyx_RefNannyFinishContext();
18846   return __pyx_r;
18847 }
18848 
18849 /* "View.MemoryView":1048
18850  *
18851  * @cname('__pyx_memoryview_get_slice_from_memoryview')
18852  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
18853  *                                                    __Pyx_memviewslice *mslice):
18854  *     cdef _memoryviewslice obj
18855  */
18856 
__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_mslice)18857 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
18858   struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
18859   __Pyx_memviewslice *__pyx_r;
18860   __Pyx_RefNannyDeclarations
18861   int __pyx_t_1;
18862   int __pyx_t_2;
18863   PyObject *__pyx_t_3 = NULL;
18864   __Pyx_RefNannySetupContext("get_slice_from_memview", 0);
18865 
18866   /* "View.MemoryView":1051
18867  *                                                    __Pyx_memviewslice *mslice):
18868  *     cdef _memoryviewslice obj
18869  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
18870  *         obj = memview
18871  *         return &obj.from_slice
18872  */
18873   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
18874   __pyx_t_2 = (__pyx_t_1 != 0);
18875   if (__pyx_t_2) {
18876 
18877     /* "View.MemoryView":1052
18878  *     cdef _memoryviewslice obj
18879  *     if isinstance(memview, _memoryviewslice):
18880  *         obj = memview             # <<<<<<<<<<<<<<
18881  *         return &obj.from_slice
18882  *     else:
18883  */
18884     if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1052, __pyx_L1_error)
18885     __pyx_t_3 = ((PyObject *)__pyx_v_memview);
18886     __Pyx_INCREF(__pyx_t_3);
18887     __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
18888     __pyx_t_3 = 0;
18889 
18890     /* "View.MemoryView":1053
18891  *     if isinstance(memview, _memoryviewslice):
18892  *         obj = memview
18893  *         return &obj.from_slice             # <<<<<<<<<<<<<<
18894  *     else:
18895  *         slice_copy(memview, mslice)
18896  */
18897     __pyx_r = (&__pyx_v_obj->from_slice);
18898     goto __pyx_L0;
18899 
18900     /* "View.MemoryView":1051
18901  *                                                    __Pyx_memviewslice *mslice):
18902  *     cdef _memoryviewslice obj
18903  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
18904  *         obj = memview
18905  *         return &obj.from_slice
18906  */
18907   }
18908 
18909   /* "View.MemoryView":1055
18910  *         return &obj.from_slice
18911  *     else:
18912  *         slice_copy(memview, mslice)             # <<<<<<<<<<<<<<
18913  *         return mslice
18914  *
18915  */
18916   /*else*/ {
18917     __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
18918 
18919     /* "View.MemoryView":1056
18920  *     else:
18921  *         slice_copy(memview, mslice)
18922  *         return mslice             # <<<<<<<<<<<<<<
18923  *
18924  * @cname('__pyx_memoryview_slice_copy')
18925  */
18926     __pyx_r = __pyx_v_mslice;
18927     goto __pyx_L0;
18928   }
18929 
18930   /* "View.MemoryView":1048
18931  *
18932  * @cname('__pyx_memoryview_get_slice_from_memoryview')
18933  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
18934  *                                                    __Pyx_memviewslice *mslice):
18935  *     cdef _memoryviewslice obj
18936  */
18937 
18938   /* function exit code */
18939   __pyx_L1_error:;
18940   __Pyx_XDECREF(__pyx_t_3);
18941   __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
18942   __pyx_r = 0;
18943   __pyx_L0:;
18944   __Pyx_XDECREF((PyObject *)__pyx_v_obj);
18945   __Pyx_RefNannyFinishContext();
18946   return __pyx_r;
18947 }
18948 
18949 /* "View.MemoryView":1059
18950  *
18951  * @cname('__pyx_memoryview_slice_copy')
18952  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
18953  *     cdef int dim
18954  *     cdef (Py_ssize_t*) shape, strides, suboffsets
18955  */
18956 
__pyx_memoryview_slice_copy(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_dst)18957 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
18958   int __pyx_v_dim;
18959   Py_ssize_t *__pyx_v_shape;
18960   Py_ssize_t *__pyx_v_strides;
18961   Py_ssize_t *__pyx_v_suboffsets;
18962   __Pyx_RefNannyDeclarations
18963   Py_ssize_t *__pyx_t_1;
18964   int __pyx_t_2;
18965   int __pyx_t_3;
18966   int __pyx_t_4;
18967   Py_ssize_t __pyx_t_5;
18968   __Pyx_RefNannySetupContext("slice_copy", 0);
18969 
18970   /* "View.MemoryView":1063
18971  *     cdef (Py_ssize_t*) shape, strides, suboffsets
18972  *
18973  *     shape = memview.view.shape             # <<<<<<<<<<<<<<
18974  *     strides = memview.view.strides
18975  *     suboffsets = memview.view.suboffsets
18976  */
18977   __pyx_t_1 = __pyx_v_memview->view.shape;
18978   __pyx_v_shape = __pyx_t_1;
18979 
18980   /* "View.MemoryView":1064
18981  *
18982  *     shape = memview.view.shape
18983  *     strides = memview.view.strides             # <<<<<<<<<<<<<<
18984  *     suboffsets = memview.view.suboffsets
18985  *
18986  */
18987   __pyx_t_1 = __pyx_v_memview->view.strides;
18988   __pyx_v_strides = __pyx_t_1;
18989 
18990   /* "View.MemoryView":1065
18991  *     shape = memview.view.shape
18992  *     strides = memview.view.strides
18993  *     suboffsets = memview.view.suboffsets             # <<<<<<<<<<<<<<
18994  *
18995  *     dst.memview = <__pyx_memoryview *> memview
18996  */
18997   __pyx_t_1 = __pyx_v_memview->view.suboffsets;
18998   __pyx_v_suboffsets = __pyx_t_1;
18999 
19000   /* "View.MemoryView":1067
19001  *     suboffsets = memview.view.suboffsets
19002  *
19003  *     dst.memview = <__pyx_memoryview *> memview             # <<<<<<<<<<<<<<
19004  *     dst.data = <char *> memview.view.buf
19005  *
19006  */
19007   __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);
19008 
19009   /* "View.MemoryView":1068
19010  *
19011  *     dst.memview = <__pyx_memoryview *> memview
19012  *     dst.data = <char *> memview.view.buf             # <<<<<<<<<<<<<<
19013  *
19014  *     for dim in range(memview.view.ndim):
19015  */
19016   __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);
19017 
19018   /* "View.MemoryView":1070
19019  *     dst.data = <char *> memview.view.buf
19020  *
19021  *     for dim in range(memview.view.ndim):             # <<<<<<<<<<<<<<
19022  *         dst.shape[dim] = shape[dim]
19023  *         dst.strides[dim] = strides[dim]
19024  */
19025   __pyx_t_2 = __pyx_v_memview->view.ndim;
19026   __pyx_t_3 = __pyx_t_2;
19027   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19028     __pyx_v_dim = __pyx_t_4;
19029 
19030     /* "View.MemoryView":1071
19031  *
19032  *     for dim in range(memview.view.ndim):
19033  *         dst.shape[dim] = shape[dim]             # <<<<<<<<<<<<<<
19034  *         dst.strides[dim] = strides[dim]
19035  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
19036  */
19037     (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
19038 
19039     /* "View.MemoryView":1072
19040  *     for dim in range(memview.view.ndim):
19041  *         dst.shape[dim] = shape[dim]
19042  *         dst.strides[dim] = strides[dim]             # <<<<<<<<<<<<<<
19043  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
19044  *
19045  */
19046     (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
19047 
19048     /* "View.MemoryView":1073
19049  *         dst.shape[dim] = shape[dim]
19050  *         dst.strides[dim] = strides[dim]
19051  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1             # <<<<<<<<<<<<<<
19052  *
19053  * @cname('__pyx_memoryview_copy_object')
19054  */
19055     if ((__pyx_v_suboffsets != 0)) {
19056       __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
19057     } else {
19058       __pyx_t_5 = -1L;
19059     }
19060     (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
19061   }
19062 
19063   /* "View.MemoryView":1059
19064  *
19065  * @cname('__pyx_memoryview_slice_copy')
19066  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
19067  *     cdef int dim
19068  *     cdef (Py_ssize_t*) shape, strides, suboffsets
19069  */
19070 
19071   /* function exit code */
19072   __Pyx_RefNannyFinishContext();
19073 }
19074 
19075 /* "View.MemoryView":1076
19076  *
19077  * @cname('__pyx_memoryview_copy_object')
19078  * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
19079  *     "Create a new memoryview object"
19080  *     cdef __Pyx_memviewslice memviewslice
19081  */
19082 
__pyx_memoryview_copy_object(struct __pyx_memoryview_obj * __pyx_v_memview)19083 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
19084   __Pyx_memviewslice __pyx_v_memviewslice;
19085   PyObject *__pyx_r = NULL;
19086   __Pyx_RefNannyDeclarations
19087   PyObject *__pyx_t_1 = NULL;
19088   __Pyx_RefNannySetupContext("memoryview_copy", 0);
19089 
19090   /* "View.MemoryView":1079
19091  *     "Create a new memoryview object"
19092  *     cdef __Pyx_memviewslice memviewslice
19093  *     slice_copy(memview, &memviewslice)             # <<<<<<<<<<<<<<
19094  *     return memoryview_copy_from_slice(memview, &memviewslice)
19095  *
19096  */
19097   __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
19098 
19099   /* "View.MemoryView":1080
19100  *     cdef __Pyx_memviewslice memviewslice
19101  *     slice_copy(memview, &memviewslice)
19102  *     return memoryview_copy_from_slice(memview, &memviewslice)             # <<<<<<<<<<<<<<
19103  *
19104  * @cname('__pyx_memoryview_copy_object_from_slice')
19105  */
19106   __Pyx_XDECREF(__pyx_r);
19107   __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1080, __pyx_L1_error)
19108   __Pyx_GOTREF(__pyx_t_1);
19109   __pyx_r = __pyx_t_1;
19110   __pyx_t_1 = 0;
19111   goto __pyx_L0;
19112 
19113   /* "View.MemoryView":1076
19114  *
19115  * @cname('__pyx_memoryview_copy_object')
19116  * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
19117  *     "Create a new memoryview object"
19118  *     cdef __Pyx_memviewslice memviewslice
19119  */
19120 
19121   /* function exit code */
19122   __pyx_L1_error:;
19123   __Pyx_XDECREF(__pyx_t_1);
19124   __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
19125   __pyx_r = 0;
19126   __pyx_L0:;
19127   __Pyx_XGIVEREF(__pyx_r);
19128   __Pyx_RefNannyFinishContext();
19129   return __pyx_r;
19130 }
19131 
19132 /* "View.MemoryView":1083
19133  *
19134  * @cname('__pyx_memoryview_copy_object_from_slice')
19135  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
19136  *     """
19137  *     Create a new memoryview object from a given memoryview object and slice.
19138  */
19139 
__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_memviewslice)19140 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
19141   PyObject *(*__pyx_v_to_object_func)(char *);
19142   int (*__pyx_v_to_dtype_func)(char *, PyObject *);
19143   PyObject *__pyx_r = NULL;
19144   __Pyx_RefNannyDeclarations
19145   int __pyx_t_1;
19146   int __pyx_t_2;
19147   PyObject *(*__pyx_t_3)(char *);
19148   int (*__pyx_t_4)(char *, PyObject *);
19149   PyObject *__pyx_t_5 = NULL;
19150   __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);
19151 
19152   /* "View.MemoryView":1090
19153  *     cdef int (*to_dtype_func)(char *, object) except 0
19154  *
19155  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
19156  *         to_object_func = (<_memoryviewslice> memview).to_object_func
19157  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
19158  */
19159   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
19160   __pyx_t_2 = (__pyx_t_1 != 0);
19161   if (__pyx_t_2) {
19162 
19163     /* "View.MemoryView":1091
19164  *
19165  *     if isinstance(memview, _memoryviewslice):
19166  *         to_object_func = (<_memoryviewslice> memview).to_object_func             # <<<<<<<<<<<<<<
19167  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
19168  *     else:
19169  */
19170     __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
19171     __pyx_v_to_object_func = __pyx_t_3;
19172 
19173     /* "View.MemoryView":1092
19174  *     if isinstance(memview, _memoryviewslice):
19175  *         to_object_func = (<_memoryviewslice> memview).to_object_func
19176  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func             # <<<<<<<<<<<<<<
19177  *     else:
19178  *         to_object_func = NULL
19179  */
19180     __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
19181     __pyx_v_to_dtype_func = __pyx_t_4;
19182 
19183     /* "View.MemoryView":1090
19184  *     cdef int (*to_dtype_func)(char *, object) except 0
19185  *
19186  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
19187  *         to_object_func = (<_memoryviewslice> memview).to_object_func
19188  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
19189  */
19190     goto __pyx_L3;
19191   }
19192 
19193   /* "View.MemoryView":1094
19194  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
19195  *     else:
19196  *         to_object_func = NULL             # <<<<<<<<<<<<<<
19197  *         to_dtype_func = NULL
19198  *
19199  */
19200   /*else*/ {
19201     __pyx_v_to_object_func = NULL;
19202 
19203     /* "View.MemoryView":1095
19204  *     else:
19205  *         to_object_func = NULL
19206  *         to_dtype_func = NULL             # <<<<<<<<<<<<<<
19207  *
19208  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
19209  */
19210     __pyx_v_to_dtype_func = NULL;
19211   }
19212   __pyx_L3:;
19213 
19214   /* "View.MemoryView":1097
19215  *         to_dtype_func = NULL
19216  *
19217  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,             # <<<<<<<<<<<<<<
19218  *                                 to_object_func, to_dtype_func,
19219  *                                 memview.dtype_is_object)
19220  */
19221   __Pyx_XDECREF(__pyx_r);
19222 
19223   /* "View.MemoryView":1099
19224  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
19225  *                                 to_object_func, to_dtype_func,
19226  *                                 memview.dtype_is_object)             # <<<<<<<<<<<<<<
19227  *
19228  *
19229  */
19230   __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1097, __pyx_L1_error)
19231   __Pyx_GOTREF(__pyx_t_5);
19232   __pyx_r = __pyx_t_5;
19233   __pyx_t_5 = 0;
19234   goto __pyx_L0;
19235 
19236   /* "View.MemoryView":1083
19237  *
19238  * @cname('__pyx_memoryview_copy_object_from_slice')
19239  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
19240  *     """
19241  *     Create a new memoryview object from a given memoryview object and slice.
19242  */
19243 
19244   /* function exit code */
19245   __pyx_L1_error:;
19246   __Pyx_XDECREF(__pyx_t_5);
19247   __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
19248   __pyx_r = 0;
19249   __pyx_L0:;
19250   __Pyx_XGIVEREF(__pyx_r);
19251   __Pyx_RefNannyFinishContext();
19252   return __pyx_r;
19253 }
19254 
19255 /* "View.MemoryView":1105
19256  *
19257  *
19258  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
19259  *     if arg < 0:
19260  *         return -arg
19261  */
19262 
abs_py_ssize_t(Py_ssize_t __pyx_v_arg)19263 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
19264   Py_ssize_t __pyx_r;
19265   int __pyx_t_1;
19266 
19267   /* "View.MemoryView":1106
19268  *
19269  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
19270  *     if arg < 0:             # <<<<<<<<<<<<<<
19271  *         return -arg
19272  *     else:
19273  */
19274   __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
19275   if (__pyx_t_1) {
19276 
19277     /* "View.MemoryView":1107
19278  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
19279  *     if arg < 0:
19280  *         return -arg             # <<<<<<<<<<<<<<
19281  *     else:
19282  *         return arg
19283  */
19284     __pyx_r = (-__pyx_v_arg);
19285     goto __pyx_L0;
19286 
19287     /* "View.MemoryView":1106
19288  *
19289  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
19290  *     if arg < 0:             # <<<<<<<<<<<<<<
19291  *         return -arg
19292  *     else:
19293  */
19294   }
19295 
19296   /* "View.MemoryView":1109
19297  *         return -arg
19298  *     else:
19299  *         return arg             # <<<<<<<<<<<<<<
19300  *
19301  * @cname('__pyx_get_best_slice_order')
19302  */
19303   /*else*/ {
19304     __pyx_r = __pyx_v_arg;
19305     goto __pyx_L0;
19306   }
19307 
19308   /* "View.MemoryView":1105
19309  *
19310  *
19311  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
19312  *     if arg < 0:
19313  *         return -arg
19314  */
19315 
19316   /* function exit code */
19317   __pyx_L0:;
19318   return __pyx_r;
19319 }
19320 
19321 /* "View.MemoryView":1112
19322  *
19323  * @cname('__pyx_get_best_slice_order')
19324  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
19325  *     """
19326  *     Figure out the best memory access order for a given slice.
19327  */
19328 
__pyx_get_best_slice_order(__Pyx_memviewslice * __pyx_v_mslice,int __pyx_v_ndim)19329 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
19330   int __pyx_v_i;
19331   Py_ssize_t __pyx_v_c_stride;
19332   Py_ssize_t __pyx_v_f_stride;
19333   char __pyx_r;
19334   int __pyx_t_1;
19335   int __pyx_t_2;
19336   int __pyx_t_3;
19337   int __pyx_t_4;
19338 
19339   /* "View.MemoryView":1117
19340  *     """
19341  *     cdef int i
19342  *     cdef Py_ssize_t c_stride = 0             # <<<<<<<<<<<<<<
19343  *     cdef Py_ssize_t f_stride = 0
19344  *
19345  */
19346   __pyx_v_c_stride = 0;
19347 
19348   /* "View.MemoryView":1118
19349  *     cdef int i
19350  *     cdef Py_ssize_t c_stride = 0
19351  *     cdef Py_ssize_t f_stride = 0             # <<<<<<<<<<<<<<
19352  *
19353  *     for i in range(ndim - 1, -1, -1):
19354  */
19355   __pyx_v_f_stride = 0;
19356 
19357   /* "View.MemoryView":1120
19358  *     cdef Py_ssize_t f_stride = 0
19359  *
19360  *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
19361  *         if mslice.shape[i] > 1:
19362  *             c_stride = mslice.strides[i]
19363  */
19364   for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
19365     __pyx_v_i = __pyx_t_1;
19366 
19367     /* "View.MemoryView":1121
19368  *
19369  *     for i in range(ndim - 1, -1, -1):
19370  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
19371  *             c_stride = mslice.strides[i]
19372  *             break
19373  */
19374     __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
19375     if (__pyx_t_2) {
19376 
19377       /* "View.MemoryView":1122
19378  *     for i in range(ndim - 1, -1, -1):
19379  *         if mslice.shape[i] > 1:
19380  *             c_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
19381  *             break
19382  *
19383  */
19384       __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
19385 
19386       /* "View.MemoryView":1123
19387  *         if mslice.shape[i] > 1:
19388  *             c_stride = mslice.strides[i]
19389  *             break             # <<<<<<<<<<<<<<
19390  *
19391  *     for i in range(ndim):
19392  */
19393       goto __pyx_L4_break;
19394 
19395       /* "View.MemoryView":1121
19396  *
19397  *     for i in range(ndim - 1, -1, -1):
19398  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
19399  *             c_stride = mslice.strides[i]
19400  *             break
19401  */
19402     }
19403   }
19404   __pyx_L4_break:;
19405 
19406   /* "View.MemoryView":1125
19407  *             break
19408  *
19409  *     for i in range(ndim):             # <<<<<<<<<<<<<<
19410  *         if mslice.shape[i] > 1:
19411  *             f_stride = mslice.strides[i]
19412  */
19413   __pyx_t_1 = __pyx_v_ndim;
19414   __pyx_t_3 = __pyx_t_1;
19415   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19416     __pyx_v_i = __pyx_t_4;
19417 
19418     /* "View.MemoryView":1126
19419  *
19420  *     for i in range(ndim):
19421  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
19422  *             f_stride = mslice.strides[i]
19423  *             break
19424  */
19425     __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
19426     if (__pyx_t_2) {
19427 
19428       /* "View.MemoryView":1127
19429  *     for i in range(ndim):
19430  *         if mslice.shape[i] > 1:
19431  *             f_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
19432  *             break
19433  *
19434  */
19435       __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
19436 
19437       /* "View.MemoryView":1128
19438  *         if mslice.shape[i] > 1:
19439  *             f_stride = mslice.strides[i]
19440  *             break             # <<<<<<<<<<<<<<
19441  *
19442  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
19443  */
19444       goto __pyx_L7_break;
19445 
19446       /* "View.MemoryView":1126
19447  *
19448  *     for i in range(ndim):
19449  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
19450  *             f_stride = mslice.strides[i]
19451  *             break
19452  */
19453     }
19454   }
19455   __pyx_L7_break:;
19456 
19457   /* "View.MemoryView":1130
19458  *             break
19459  *
19460  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
19461  *         return 'C'
19462  *     else:
19463  */
19464   __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
19465   if (__pyx_t_2) {
19466 
19467     /* "View.MemoryView":1131
19468  *
19469  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
19470  *         return 'C'             # <<<<<<<<<<<<<<
19471  *     else:
19472  *         return 'F'
19473  */
19474     __pyx_r = 'C';
19475     goto __pyx_L0;
19476 
19477     /* "View.MemoryView":1130
19478  *             break
19479  *
19480  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
19481  *         return 'C'
19482  *     else:
19483  */
19484   }
19485 
19486   /* "View.MemoryView":1133
19487  *         return 'C'
19488  *     else:
19489  *         return 'F'             # <<<<<<<<<<<<<<
19490  *
19491  * @cython.cdivision(True)
19492  */
19493   /*else*/ {
19494     __pyx_r = 'F';
19495     goto __pyx_L0;
19496   }
19497 
19498   /* "View.MemoryView":1112
19499  *
19500  * @cname('__pyx_get_best_slice_order')
19501  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
19502  *     """
19503  *     Figure out the best memory access order for a given slice.
19504  */
19505 
19506   /* function exit code */
19507   __pyx_L0:;
19508   return __pyx_r;
19509 }
19510 
19511 /* "View.MemoryView":1136
19512  *
19513  * @cython.cdivision(True)
19514  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
19515  *                                    char *dst_data, Py_ssize_t *dst_strides,
19516  *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
19517  */
19518 
_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)19519 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) {
19520   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
19521   CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
19522   Py_ssize_t __pyx_v_dst_extent;
19523   Py_ssize_t __pyx_v_src_stride;
19524   Py_ssize_t __pyx_v_dst_stride;
19525   int __pyx_t_1;
19526   int __pyx_t_2;
19527   int __pyx_t_3;
19528   Py_ssize_t __pyx_t_4;
19529   Py_ssize_t __pyx_t_5;
19530   Py_ssize_t __pyx_t_6;
19531 
19532   /* "View.MemoryView":1143
19533  *
19534  *     cdef Py_ssize_t i
19535  *     cdef Py_ssize_t src_extent = src_shape[0]             # <<<<<<<<<<<<<<
19536  *     cdef Py_ssize_t dst_extent = dst_shape[0]
19537  *     cdef Py_ssize_t src_stride = src_strides[0]
19538  */
19539   __pyx_v_src_extent = (__pyx_v_src_shape[0]);
19540 
19541   /* "View.MemoryView":1144
19542  *     cdef Py_ssize_t i
19543  *     cdef Py_ssize_t src_extent = src_shape[0]
19544  *     cdef Py_ssize_t dst_extent = dst_shape[0]             # <<<<<<<<<<<<<<
19545  *     cdef Py_ssize_t src_stride = src_strides[0]
19546  *     cdef Py_ssize_t dst_stride = dst_strides[0]
19547  */
19548   __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
19549 
19550   /* "View.MemoryView":1145
19551  *     cdef Py_ssize_t src_extent = src_shape[0]
19552  *     cdef Py_ssize_t dst_extent = dst_shape[0]
19553  *     cdef Py_ssize_t src_stride = src_strides[0]             # <<<<<<<<<<<<<<
19554  *     cdef Py_ssize_t dst_stride = dst_strides[0]
19555  *
19556  */
19557   __pyx_v_src_stride = (__pyx_v_src_strides[0]);
19558 
19559   /* "View.MemoryView":1146
19560  *     cdef Py_ssize_t dst_extent = dst_shape[0]
19561  *     cdef Py_ssize_t src_stride = src_strides[0]
19562  *     cdef Py_ssize_t dst_stride = dst_strides[0]             # <<<<<<<<<<<<<<
19563  *
19564  *     if ndim == 1:
19565  */
19566   __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
19567 
19568   /* "View.MemoryView":1148
19569  *     cdef Py_ssize_t dst_stride = dst_strides[0]
19570  *
19571  *     if ndim == 1:             # <<<<<<<<<<<<<<
19572  *        if (src_stride > 0 and dst_stride > 0 and
19573  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
19574  */
19575   __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
19576   if (__pyx_t_1) {
19577 
19578     /* "View.MemoryView":1149
19579  *
19580  *     if ndim == 1:
19581  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
19582  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
19583  *            memcpy(dst_data, src_data, itemsize * dst_extent)
19584  */
19585     __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
19586     if (__pyx_t_2) {
19587     } else {
19588       __pyx_t_1 = __pyx_t_2;
19589       goto __pyx_L5_bool_binop_done;
19590     }
19591     __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
19592     if (__pyx_t_2) {
19593     } else {
19594       __pyx_t_1 = __pyx_t_2;
19595       goto __pyx_L5_bool_binop_done;
19596     }
19597 
19598     /* "View.MemoryView":1150
19599  *     if ndim == 1:
19600  *        if (src_stride > 0 and dst_stride > 0 and
19601  *            <size_t> src_stride == itemsize == <size_t> dst_stride):             # <<<<<<<<<<<<<<
19602  *            memcpy(dst_data, src_data, itemsize * dst_extent)
19603  *        else:
19604  */
19605     __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
19606     if (__pyx_t_2) {
19607       __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
19608     }
19609     __pyx_t_3 = (__pyx_t_2 != 0);
19610     __pyx_t_1 = __pyx_t_3;
19611     __pyx_L5_bool_binop_done:;
19612 
19613     /* "View.MemoryView":1149
19614  *
19615  *     if ndim == 1:
19616  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
19617  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
19618  *            memcpy(dst_data, src_data, itemsize * dst_extent)
19619  */
19620     if (__pyx_t_1) {
19621 
19622       /* "View.MemoryView":1151
19623  *        if (src_stride > 0 and dst_stride > 0 and
19624  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
19625  *            memcpy(dst_data, src_data, itemsize * dst_extent)             # <<<<<<<<<<<<<<
19626  *        else:
19627  *            for i in range(dst_extent):
19628  */
19629       (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
19630 
19631       /* "View.MemoryView":1149
19632  *
19633  *     if ndim == 1:
19634  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
19635  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
19636  *            memcpy(dst_data, src_data, itemsize * dst_extent)
19637  */
19638       goto __pyx_L4;
19639     }
19640 
19641     /* "View.MemoryView":1153
19642  *            memcpy(dst_data, src_data, itemsize * dst_extent)
19643  *        else:
19644  *            for i in range(dst_extent):             # <<<<<<<<<<<<<<
19645  *                memcpy(dst_data, src_data, itemsize)
19646  *                src_data += src_stride
19647  */
19648     /*else*/ {
19649       __pyx_t_4 = __pyx_v_dst_extent;
19650       __pyx_t_5 = __pyx_t_4;
19651       for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
19652         __pyx_v_i = __pyx_t_6;
19653 
19654         /* "View.MemoryView":1154
19655  *        else:
19656  *            for i in range(dst_extent):
19657  *                memcpy(dst_data, src_data, itemsize)             # <<<<<<<<<<<<<<
19658  *                src_data += src_stride
19659  *                dst_data += dst_stride
19660  */
19661         (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
19662 
19663         /* "View.MemoryView":1155
19664  *            for i in range(dst_extent):
19665  *                memcpy(dst_data, src_data, itemsize)
19666  *                src_data += src_stride             # <<<<<<<<<<<<<<
19667  *                dst_data += dst_stride
19668  *     else:
19669  */
19670         __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
19671 
19672         /* "View.MemoryView":1156
19673  *                memcpy(dst_data, src_data, itemsize)
19674  *                src_data += src_stride
19675  *                dst_data += dst_stride             # <<<<<<<<<<<<<<
19676  *     else:
19677  *         for i in range(dst_extent):
19678  */
19679         __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
19680       }
19681     }
19682     __pyx_L4:;
19683 
19684     /* "View.MemoryView":1148
19685  *     cdef Py_ssize_t dst_stride = dst_strides[0]
19686  *
19687  *     if ndim == 1:             # <<<<<<<<<<<<<<
19688  *        if (src_stride > 0 and dst_stride > 0 and
19689  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
19690  */
19691     goto __pyx_L3;
19692   }
19693 
19694   /* "View.MemoryView":1158
19695  *                dst_data += dst_stride
19696  *     else:
19697  *         for i in range(dst_extent):             # <<<<<<<<<<<<<<
19698  *             _copy_strided_to_strided(src_data, src_strides + 1,
19699  *                                      dst_data, dst_strides + 1,
19700  */
19701   /*else*/ {
19702     __pyx_t_4 = __pyx_v_dst_extent;
19703     __pyx_t_5 = __pyx_t_4;
19704     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
19705       __pyx_v_i = __pyx_t_6;
19706 
19707       /* "View.MemoryView":1159
19708  *     else:
19709  *         for i in range(dst_extent):
19710  *             _copy_strided_to_strided(src_data, src_strides + 1,             # <<<<<<<<<<<<<<
19711  *                                      dst_data, dst_strides + 1,
19712  *                                      src_shape + 1, dst_shape + 1,
19713  */
19714       _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);
19715 
19716       /* "View.MemoryView":1163
19717  *                                      src_shape + 1, dst_shape + 1,
19718  *                                      ndim - 1, itemsize)
19719  *             src_data += src_stride             # <<<<<<<<<<<<<<
19720  *             dst_data += dst_stride
19721  *
19722  */
19723       __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
19724 
19725       /* "View.MemoryView":1164
19726  *                                      ndim - 1, itemsize)
19727  *             src_data += src_stride
19728  *             dst_data += dst_stride             # <<<<<<<<<<<<<<
19729  *
19730  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
19731  */
19732       __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
19733     }
19734   }
19735   __pyx_L3:;
19736 
19737   /* "View.MemoryView":1136
19738  *
19739  * @cython.cdivision(True)
19740  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
19741  *                                    char *dst_data, Py_ssize_t *dst_strides,
19742  *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
19743  */
19744 
19745   /* function exit code */
19746 }
19747 
19748 /* "View.MemoryView":1166
19749  *             dst_data += dst_stride
19750  *
19751  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
19752  *                                   __Pyx_memviewslice *dst,
19753  *                                   int ndim, size_t itemsize) nogil:
19754  */
19755 
copy_strided_to_strided(__Pyx_memviewslice * __pyx_v_src,__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_ndim,size_t __pyx_v_itemsize)19756 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) {
19757 
19758   /* "View.MemoryView":1169
19759  *                                   __Pyx_memviewslice *dst,
19760  *                                   int ndim, size_t itemsize) nogil:
19761  *     _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides,             # <<<<<<<<<<<<<<
19762  *                              src.shape, dst.shape, ndim, itemsize)
19763  *
19764  */
19765   _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);
19766 
19767   /* "View.MemoryView":1166
19768  *             dst_data += dst_stride
19769  *
19770  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
19771  *                                   __Pyx_memviewslice *dst,
19772  *                                   int ndim, size_t itemsize) nogil:
19773  */
19774 
19775   /* function exit code */
19776 }
19777 
19778 /* "View.MemoryView":1173
19779  *
19780  * @cname('__pyx_memoryview_slice_get_size')
19781  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
19782  *     "Return the size of the memory occupied by the slice in number of bytes"
19783  *     cdef int i
19784  */
19785 
__pyx_memoryview_slice_get_size(__Pyx_memviewslice * __pyx_v_src,int __pyx_v_ndim)19786 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
19787   int __pyx_v_i;
19788   Py_ssize_t __pyx_v_size;
19789   Py_ssize_t __pyx_r;
19790   Py_ssize_t __pyx_t_1;
19791   int __pyx_t_2;
19792   int __pyx_t_3;
19793   int __pyx_t_4;
19794 
19795   /* "View.MemoryView":1176
19796  *     "Return the size of the memory occupied by the slice in number of bytes"
19797  *     cdef int i
19798  *     cdef Py_ssize_t size = src.memview.view.itemsize             # <<<<<<<<<<<<<<
19799  *
19800  *     for i in range(ndim):
19801  */
19802   __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
19803   __pyx_v_size = __pyx_t_1;
19804 
19805   /* "View.MemoryView":1178
19806  *     cdef Py_ssize_t size = src.memview.view.itemsize
19807  *
19808  *     for i in range(ndim):             # <<<<<<<<<<<<<<
19809  *         size *= src.shape[i]
19810  *
19811  */
19812   __pyx_t_2 = __pyx_v_ndim;
19813   __pyx_t_3 = __pyx_t_2;
19814   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19815     __pyx_v_i = __pyx_t_4;
19816 
19817     /* "View.MemoryView":1179
19818  *
19819  *     for i in range(ndim):
19820  *         size *= src.shape[i]             # <<<<<<<<<<<<<<
19821  *
19822  *     return size
19823  */
19824     __pyx_v_size = (__pyx_v_size * (__pyx_v_src->shape[__pyx_v_i]));
19825   }
19826 
19827   /* "View.MemoryView":1181
19828  *         size *= src.shape[i]
19829  *
19830  *     return size             # <<<<<<<<<<<<<<
19831  *
19832  * @cname('__pyx_fill_contig_strides_array')
19833  */
19834   __pyx_r = __pyx_v_size;
19835   goto __pyx_L0;
19836 
19837   /* "View.MemoryView":1173
19838  *
19839  * @cname('__pyx_memoryview_slice_get_size')
19840  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
19841  *     "Return the size of the memory occupied by the slice in number of bytes"
19842  *     cdef int i
19843  */
19844 
19845   /* function exit code */
19846   __pyx_L0:;
19847   return __pyx_r;
19848 }
19849 
19850 /* "View.MemoryView":1184
19851  *
19852  * @cname('__pyx_fill_contig_strides_array')
19853  * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
19854  *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
19855  *                 int ndim, char order) nogil:
19856  */
19857 
__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)19858 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) {
19859   int __pyx_v_idx;
19860   Py_ssize_t __pyx_r;
19861   int __pyx_t_1;
19862   int __pyx_t_2;
19863   int __pyx_t_3;
19864   int __pyx_t_4;
19865 
19866   /* "View.MemoryView":1193
19867  *     cdef int idx
19868  *
19869  *     if order == 'F':             # <<<<<<<<<<<<<<
19870  *         for idx in range(ndim):
19871  *             strides[idx] = stride
19872  */
19873   __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
19874   if (__pyx_t_1) {
19875 
19876     /* "View.MemoryView":1194
19877  *
19878  *     if order == 'F':
19879  *         for idx in range(ndim):             # <<<<<<<<<<<<<<
19880  *             strides[idx] = stride
19881  *             stride = stride * shape[idx]
19882  */
19883     __pyx_t_2 = __pyx_v_ndim;
19884     __pyx_t_3 = __pyx_t_2;
19885     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19886       __pyx_v_idx = __pyx_t_4;
19887 
19888       /* "View.MemoryView":1195
19889  *     if order == 'F':
19890  *         for idx in range(ndim):
19891  *             strides[idx] = stride             # <<<<<<<<<<<<<<
19892  *             stride = stride * shape[idx]
19893  *     else:
19894  */
19895       (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
19896 
19897       /* "View.MemoryView":1196
19898  *         for idx in range(ndim):
19899  *             strides[idx] = stride
19900  *             stride = stride * shape[idx]             # <<<<<<<<<<<<<<
19901  *     else:
19902  *         for idx in range(ndim - 1, -1, -1):
19903  */
19904       __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
19905     }
19906 
19907     /* "View.MemoryView":1193
19908  *     cdef int idx
19909  *
19910  *     if order == 'F':             # <<<<<<<<<<<<<<
19911  *         for idx in range(ndim):
19912  *             strides[idx] = stride
19913  */
19914     goto __pyx_L3;
19915   }
19916 
19917   /* "View.MemoryView":1198
19918  *             stride = stride * shape[idx]
19919  *     else:
19920  *         for idx in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
19921  *             strides[idx] = stride
19922  *             stride = stride * shape[idx]
19923  */
19924   /*else*/ {
19925     for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
19926       __pyx_v_idx = __pyx_t_2;
19927 
19928       /* "View.MemoryView":1199
19929  *     else:
19930  *         for idx in range(ndim - 1, -1, -1):
19931  *             strides[idx] = stride             # <<<<<<<<<<<<<<
19932  *             stride = stride * shape[idx]
19933  *
19934  */
19935       (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
19936 
19937       /* "View.MemoryView":1200
19938  *         for idx in range(ndim - 1, -1, -1):
19939  *             strides[idx] = stride
19940  *             stride = stride * shape[idx]             # <<<<<<<<<<<<<<
19941  *
19942  *     return stride
19943  */
19944       __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
19945     }
19946   }
19947   __pyx_L3:;
19948 
19949   /* "View.MemoryView":1202
19950  *             stride = stride * shape[idx]
19951  *
19952  *     return stride             # <<<<<<<<<<<<<<
19953  *
19954  * @cname('__pyx_memoryview_copy_data_to_temp')
19955  */
19956   __pyx_r = __pyx_v_stride;
19957   goto __pyx_L0;
19958 
19959   /* "View.MemoryView":1184
19960  *
19961  * @cname('__pyx_fill_contig_strides_array')
19962  * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
19963  *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
19964  *                 int ndim, char order) nogil:
19965  */
19966 
19967   /* function exit code */
19968   __pyx_L0:;
19969   return __pyx_r;
19970 }
19971 
19972 /* "View.MemoryView":1205
19973  *
19974  * @cname('__pyx_memoryview_copy_data_to_temp')
19975  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
19976  *                              __Pyx_memviewslice *tmpslice,
19977  *                              char order,
19978  */
19979 
__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice * __pyx_v_src,__Pyx_memviewslice * __pyx_v_tmpslice,char __pyx_v_order,int __pyx_v_ndim)19980 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) {
19981   int __pyx_v_i;
19982   void *__pyx_v_result;
19983   size_t __pyx_v_itemsize;
19984   size_t __pyx_v_size;
19985   void *__pyx_r;
19986   Py_ssize_t __pyx_t_1;
19987   int __pyx_t_2;
19988   int __pyx_t_3;
19989   struct __pyx_memoryview_obj *__pyx_t_4;
19990   int __pyx_t_5;
19991   int __pyx_t_6;
19992 
19993   /* "View.MemoryView":1216
19994  *     cdef void *result
19995  *
19996  *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
19997  *     cdef size_t size = slice_get_size(src, ndim)
19998  *
19999  */
20000   __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
20001   __pyx_v_itemsize = __pyx_t_1;
20002 
20003   /* "View.MemoryView":1217
20004  *
20005  *     cdef size_t itemsize = src.memview.view.itemsize
20006  *     cdef size_t size = slice_get_size(src, ndim)             # <<<<<<<<<<<<<<
20007  *
20008  *     result = malloc(size)
20009  */
20010   __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
20011 
20012   /* "View.MemoryView":1219
20013  *     cdef size_t size = slice_get_size(src, ndim)
20014  *
20015  *     result = malloc(size)             # <<<<<<<<<<<<<<
20016  *     if not result:
20017  *         _err(MemoryError, NULL)
20018  */
20019   __pyx_v_result = malloc(__pyx_v_size);
20020 
20021   /* "View.MemoryView":1220
20022  *
20023  *     result = malloc(size)
20024  *     if not result:             # <<<<<<<<<<<<<<
20025  *         _err(MemoryError, NULL)
20026  *
20027  */
20028   __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
20029   if (__pyx_t_2) {
20030 
20031     /* "View.MemoryView":1221
20032  *     result = malloc(size)
20033  *     if not result:
20034  *         _err(MemoryError, NULL)             # <<<<<<<<<<<<<<
20035  *
20036  *
20037  */
20038     __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1221, __pyx_L1_error)
20039 
20040     /* "View.MemoryView":1220
20041  *
20042  *     result = malloc(size)
20043  *     if not result:             # <<<<<<<<<<<<<<
20044  *         _err(MemoryError, NULL)
20045  *
20046  */
20047   }
20048 
20049   /* "View.MemoryView":1224
20050  *
20051  *
20052  *     tmpslice.data = <char *> result             # <<<<<<<<<<<<<<
20053  *     tmpslice.memview = src.memview
20054  *     for i in range(ndim):
20055  */
20056   __pyx_v_tmpslice->data = ((char *)__pyx_v_result);
20057 
20058   /* "View.MemoryView":1225
20059  *
20060  *     tmpslice.data = <char *> result
20061  *     tmpslice.memview = src.memview             # <<<<<<<<<<<<<<
20062  *     for i in range(ndim):
20063  *         tmpslice.shape[i] = src.shape[i]
20064  */
20065   __pyx_t_4 = __pyx_v_src->memview;
20066   __pyx_v_tmpslice->memview = __pyx_t_4;
20067 
20068   /* "View.MemoryView":1226
20069  *     tmpslice.data = <char *> result
20070  *     tmpslice.memview = src.memview
20071  *     for i in range(ndim):             # <<<<<<<<<<<<<<
20072  *         tmpslice.shape[i] = src.shape[i]
20073  *         tmpslice.suboffsets[i] = -1
20074  */
20075   __pyx_t_3 = __pyx_v_ndim;
20076   __pyx_t_5 = __pyx_t_3;
20077   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
20078     __pyx_v_i = __pyx_t_6;
20079 
20080     /* "View.MemoryView":1227
20081  *     tmpslice.memview = src.memview
20082  *     for i in range(ndim):
20083  *         tmpslice.shape[i] = src.shape[i]             # <<<<<<<<<<<<<<
20084  *         tmpslice.suboffsets[i] = -1
20085  *
20086  */
20087     (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
20088 
20089     /* "View.MemoryView":1228
20090  *     for i in range(ndim):
20091  *         tmpslice.shape[i] = src.shape[i]
20092  *         tmpslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
20093  *
20094  *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
20095  */
20096     (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
20097   }
20098 
20099   /* "View.MemoryView":1230
20100  *         tmpslice.suboffsets[i] = -1
20101  *
20102  *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,             # <<<<<<<<<<<<<<
20103  *                               ndim, order)
20104  *
20105  */
20106   (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));
20107 
20108   /* "View.MemoryView":1234
20109  *
20110  *
20111  *     for i in range(ndim):             # <<<<<<<<<<<<<<
20112  *         if tmpslice.shape[i] == 1:
20113  *             tmpslice.strides[i] = 0
20114  */
20115   __pyx_t_3 = __pyx_v_ndim;
20116   __pyx_t_5 = __pyx_t_3;
20117   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
20118     __pyx_v_i = __pyx_t_6;
20119 
20120     /* "View.MemoryView":1235
20121  *
20122  *     for i in range(ndim):
20123  *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
20124  *             tmpslice.strides[i] = 0
20125  *
20126  */
20127     __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
20128     if (__pyx_t_2) {
20129 
20130       /* "View.MemoryView":1236
20131  *     for i in range(ndim):
20132  *         if tmpslice.shape[i] == 1:
20133  *             tmpslice.strides[i] = 0             # <<<<<<<<<<<<<<
20134  *
20135  *     if slice_is_contig(src[0], order, ndim):
20136  */
20137       (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
20138 
20139       /* "View.MemoryView":1235
20140  *
20141  *     for i in range(ndim):
20142  *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
20143  *             tmpslice.strides[i] = 0
20144  *
20145  */
20146     }
20147   }
20148 
20149   /* "View.MemoryView":1238
20150  *             tmpslice.strides[i] = 0
20151  *
20152  *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
20153  *         memcpy(result, src.data, size)
20154  *     else:
20155  */
20156   __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
20157   if (__pyx_t_2) {
20158 
20159     /* "View.MemoryView":1239
20160  *
20161  *     if slice_is_contig(src[0], order, ndim):
20162  *         memcpy(result, src.data, size)             # <<<<<<<<<<<<<<
20163  *     else:
20164  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
20165  */
20166     (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
20167 
20168     /* "View.MemoryView":1238
20169  *             tmpslice.strides[i] = 0
20170  *
20171  *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
20172  *         memcpy(result, src.data, size)
20173  *     else:
20174  */
20175     goto __pyx_L9;
20176   }
20177 
20178   /* "View.MemoryView":1241
20179  *         memcpy(result, src.data, size)
20180  *     else:
20181  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)             # <<<<<<<<<<<<<<
20182  *
20183  *     return result
20184  */
20185   /*else*/ {
20186     copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
20187   }
20188   __pyx_L9:;
20189 
20190   /* "View.MemoryView":1243
20191  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
20192  *
20193  *     return result             # <<<<<<<<<<<<<<
20194  *
20195  *
20196  */
20197   __pyx_r = __pyx_v_result;
20198   goto __pyx_L0;
20199 
20200   /* "View.MemoryView":1205
20201  *
20202  * @cname('__pyx_memoryview_copy_data_to_temp')
20203  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
20204  *                              __Pyx_memviewslice *tmpslice,
20205  *                              char order,
20206  */
20207 
20208   /* function exit code */
20209   __pyx_L1_error:;
20210   {
20211     #ifdef WITH_THREAD
20212     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
20213     #endif
20214     __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
20215     #ifdef WITH_THREAD
20216     __Pyx_PyGILState_Release(__pyx_gilstate_save);
20217     #endif
20218   }
20219   __pyx_r = NULL;
20220   __pyx_L0:;
20221   return __pyx_r;
20222 }
20223 
20224 /* "View.MemoryView":1248
20225  *
20226  * @cname('__pyx_memoryview_err_extents')
20227  * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
20228  *                              Py_ssize_t extent2) except -1 with gil:
20229  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
20230  */
20231 
__pyx_memoryview_err_extents(int __pyx_v_i,Py_ssize_t __pyx_v_extent1,Py_ssize_t __pyx_v_extent2)20232 static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
20233   int __pyx_r;
20234   __Pyx_RefNannyDeclarations
20235   PyObject *__pyx_t_1 = NULL;
20236   PyObject *__pyx_t_2 = NULL;
20237   PyObject *__pyx_t_3 = NULL;
20238   PyObject *__pyx_t_4 = NULL;
20239   #ifdef WITH_THREAD
20240   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
20241   #endif
20242   __Pyx_RefNannySetupContext("_err_extents", 0);
20243 
20244   /* "View.MemoryView":1251
20245  *                              Py_ssize_t extent2) except -1 with gil:
20246  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
20247  *                                                         (i, extent1, extent2))             # <<<<<<<<<<<<<<
20248  *
20249  * @cname('__pyx_memoryview_err_dim')
20250  */
20251   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1251, __pyx_L1_error)
20252   __Pyx_GOTREF(__pyx_t_1);
20253   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1251, __pyx_L1_error)
20254   __Pyx_GOTREF(__pyx_t_2);
20255   __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1251, __pyx_L1_error)
20256   __Pyx_GOTREF(__pyx_t_3);
20257   __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1251, __pyx_L1_error)
20258   __Pyx_GOTREF(__pyx_t_4);
20259   __Pyx_GIVEREF(__pyx_t_1);
20260   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
20261   __Pyx_GIVEREF(__pyx_t_2);
20262   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
20263   __Pyx_GIVEREF(__pyx_t_3);
20264   PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
20265   __pyx_t_1 = 0;
20266   __pyx_t_2 = 0;
20267   __pyx_t_3 = 0;
20268 
20269   /* "View.MemoryView":1250
20270  * cdef int _err_extents(int i, Py_ssize_t extent1,
20271  *                              Py_ssize_t extent2) except -1 with gil:
20272  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %             # <<<<<<<<<<<<<<
20273  *                                                         (i, extent1, extent2))
20274  *
20275  */
20276   __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1250, __pyx_L1_error)
20277   __Pyx_GOTREF(__pyx_t_3);
20278   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20279   __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1250, __pyx_L1_error)
20280   __Pyx_GOTREF(__pyx_t_4);
20281   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20282   __Pyx_Raise(__pyx_t_4, 0, 0, 0);
20283   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20284   __PYX_ERR(2, 1250, __pyx_L1_error)
20285 
20286   /* "View.MemoryView":1248
20287  *
20288  * @cname('__pyx_memoryview_err_extents')
20289  * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
20290  *                              Py_ssize_t extent2) except -1 with gil:
20291  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
20292  */
20293 
20294   /* function exit code */
20295   __pyx_L1_error:;
20296   __Pyx_XDECREF(__pyx_t_1);
20297   __Pyx_XDECREF(__pyx_t_2);
20298   __Pyx_XDECREF(__pyx_t_3);
20299   __Pyx_XDECREF(__pyx_t_4);
20300   __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
20301   __pyx_r = -1;
20302   __Pyx_RefNannyFinishContext();
20303   #ifdef WITH_THREAD
20304   __Pyx_PyGILState_Release(__pyx_gilstate_save);
20305   #endif
20306   return __pyx_r;
20307 }
20308 
20309 /* "View.MemoryView":1254
20310  *
20311  * @cname('__pyx_memoryview_err_dim')
20312  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
20313  *     raise error(msg.decode('ascii') % dim)
20314  *
20315  */
20316 
__pyx_memoryview_err_dim(PyObject * __pyx_v_error,char * __pyx_v_msg,int __pyx_v_dim)20317 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
20318   int __pyx_r;
20319   __Pyx_RefNannyDeclarations
20320   PyObject *__pyx_t_1 = NULL;
20321   PyObject *__pyx_t_2 = NULL;
20322   PyObject *__pyx_t_3 = NULL;
20323   PyObject *__pyx_t_4 = NULL;
20324   #ifdef WITH_THREAD
20325   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
20326   #endif
20327   __Pyx_RefNannySetupContext("_err_dim", 0);
20328   __Pyx_INCREF(__pyx_v_error);
20329 
20330   /* "View.MemoryView":1255
20331  * @cname('__pyx_memoryview_err_dim')
20332  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
20333  *     raise error(msg.decode('ascii') % dim)             # <<<<<<<<<<<<<<
20334  *
20335  * @cname('__pyx_memoryview_err')
20336  */
20337   __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1255, __pyx_L1_error)
20338   __Pyx_GOTREF(__pyx_t_2);
20339   __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1255, __pyx_L1_error)
20340   __Pyx_GOTREF(__pyx_t_3);
20341   __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1255, __pyx_L1_error)
20342   __Pyx_GOTREF(__pyx_t_4);
20343   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20344   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20345   __Pyx_INCREF(__pyx_v_error);
20346   __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
20347   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
20348     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
20349     if (likely(__pyx_t_2)) {
20350       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
20351       __Pyx_INCREF(__pyx_t_2);
20352       __Pyx_INCREF(function);
20353       __Pyx_DECREF_SET(__pyx_t_3, function);
20354     }
20355   }
20356   __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);
20357   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
20358   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20359   if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1255, __pyx_L1_error)
20360   __Pyx_GOTREF(__pyx_t_1);
20361   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20362   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
20363   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20364   __PYX_ERR(2, 1255, __pyx_L1_error)
20365 
20366   /* "View.MemoryView":1254
20367  *
20368  * @cname('__pyx_memoryview_err_dim')
20369  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
20370  *     raise error(msg.decode('ascii') % dim)
20371  *
20372  */
20373 
20374   /* function exit code */
20375   __pyx_L1_error:;
20376   __Pyx_XDECREF(__pyx_t_1);
20377   __Pyx_XDECREF(__pyx_t_2);
20378   __Pyx_XDECREF(__pyx_t_3);
20379   __Pyx_XDECREF(__pyx_t_4);
20380   __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
20381   __pyx_r = -1;
20382   __Pyx_XDECREF(__pyx_v_error);
20383   __Pyx_RefNannyFinishContext();
20384   #ifdef WITH_THREAD
20385   __Pyx_PyGILState_Release(__pyx_gilstate_save);
20386   #endif
20387   return __pyx_r;
20388 }
20389 
20390 /* "View.MemoryView":1258
20391  *
20392  * @cname('__pyx_memoryview_err')
20393  * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
20394  *     if msg != NULL:
20395  *         raise error(msg.decode('ascii'))
20396  */
20397 
__pyx_memoryview_err(PyObject * __pyx_v_error,char * __pyx_v_msg)20398 static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
20399   int __pyx_r;
20400   __Pyx_RefNannyDeclarations
20401   int __pyx_t_1;
20402   PyObject *__pyx_t_2 = NULL;
20403   PyObject *__pyx_t_3 = NULL;
20404   PyObject *__pyx_t_4 = NULL;
20405   PyObject *__pyx_t_5 = NULL;
20406   #ifdef WITH_THREAD
20407   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
20408   #endif
20409   __Pyx_RefNannySetupContext("_err", 0);
20410   __Pyx_INCREF(__pyx_v_error);
20411 
20412   /* "View.MemoryView":1259
20413  * @cname('__pyx_memoryview_err')
20414  * cdef int _err(object error, char *msg) except -1 with gil:
20415  *     if msg != NULL:             # <<<<<<<<<<<<<<
20416  *         raise error(msg.decode('ascii'))
20417  *     else:
20418  */
20419   __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
20420   if (unlikely(__pyx_t_1)) {
20421 
20422     /* "View.MemoryView":1260
20423  * cdef int _err(object error, char *msg) except -1 with gil:
20424  *     if msg != NULL:
20425  *         raise error(msg.decode('ascii'))             # <<<<<<<<<<<<<<
20426  *     else:
20427  *         raise error
20428  */
20429     __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1260, __pyx_L1_error)
20430     __Pyx_GOTREF(__pyx_t_3);
20431     __Pyx_INCREF(__pyx_v_error);
20432     __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
20433     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
20434       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
20435       if (likely(__pyx_t_5)) {
20436         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
20437         __Pyx_INCREF(__pyx_t_5);
20438         __Pyx_INCREF(function);
20439         __Pyx_DECREF_SET(__pyx_t_4, function);
20440       }
20441     }
20442     __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);
20443     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
20444     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20445     if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1260, __pyx_L1_error)
20446     __Pyx_GOTREF(__pyx_t_2);
20447     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20448     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
20449     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20450     __PYX_ERR(2, 1260, __pyx_L1_error)
20451 
20452     /* "View.MemoryView":1259
20453  * @cname('__pyx_memoryview_err')
20454  * cdef int _err(object error, char *msg) except -1 with gil:
20455  *     if msg != NULL:             # <<<<<<<<<<<<<<
20456  *         raise error(msg.decode('ascii'))
20457  *     else:
20458  */
20459   }
20460 
20461   /* "View.MemoryView":1262
20462  *         raise error(msg.decode('ascii'))
20463  *     else:
20464  *         raise error             # <<<<<<<<<<<<<<
20465  *
20466  * @cname('__pyx_memoryview_copy_contents')
20467  */
20468   /*else*/ {
20469     __Pyx_Raise(__pyx_v_error, 0, 0, 0);
20470     __PYX_ERR(2, 1262, __pyx_L1_error)
20471   }
20472 
20473   /* "View.MemoryView":1258
20474  *
20475  * @cname('__pyx_memoryview_err')
20476  * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
20477  *     if msg != NULL:
20478  *         raise error(msg.decode('ascii'))
20479  */
20480 
20481   /* function exit code */
20482   __pyx_L1_error:;
20483   __Pyx_XDECREF(__pyx_t_2);
20484   __Pyx_XDECREF(__pyx_t_3);
20485   __Pyx_XDECREF(__pyx_t_4);
20486   __Pyx_XDECREF(__pyx_t_5);
20487   __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
20488   __pyx_r = -1;
20489   __Pyx_XDECREF(__pyx_v_error);
20490   __Pyx_RefNannyFinishContext();
20491   #ifdef WITH_THREAD
20492   __Pyx_PyGILState_Release(__pyx_gilstate_save);
20493   #endif
20494   return __pyx_r;
20495 }
20496 
20497 /* "View.MemoryView":1265
20498  *
20499  * @cname('__pyx_memoryview_copy_contents')
20500  * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
20501  *                                   __Pyx_memviewslice dst,
20502  *                                   int src_ndim, int dst_ndim,
20503  */
20504 
__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)20505 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) {
20506   void *__pyx_v_tmpdata;
20507   size_t __pyx_v_itemsize;
20508   int __pyx_v_i;
20509   char __pyx_v_order;
20510   int __pyx_v_broadcasting;
20511   int __pyx_v_direct_copy;
20512   __Pyx_memviewslice __pyx_v_tmp;
20513   int __pyx_v_ndim;
20514   int __pyx_r;
20515   Py_ssize_t __pyx_t_1;
20516   int __pyx_t_2;
20517   int __pyx_t_3;
20518   int __pyx_t_4;
20519   int __pyx_t_5;
20520   int __pyx_t_6;
20521   void *__pyx_t_7;
20522   int __pyx_t_8;
20523 
20524   /* "View.MemoryView":1273
20525  *     Check for overlapping memory and verify the shapes.
20526  *     """
20527  *     cdef void *tmpdata = NULL             # <<<<<<<<<<<<<<
20528  *     cdef size_t itemsize = src.memview.view.itemsize
20529  *     cdef int i
20530  */
20531   __pyx_v_tmpdata = NULL;
20532 
20533   /* "View.MemoryView":1274
20534  *     """
20535  *     cdef void *tmpdata = NULL
20536  *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
20537  *     cdef int i
20538  *     cdef char order = get_best_order(&src, src_ndim)
20539  */
20540   __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
20541   __pyx_v_itemsize = __pyx_t_1;
20542 
20543   /* "View.MemoryView":1276
20544  *     cdef size_t itemsize = src.memview.view.itemsize
20545  *     cdef int i
20546  *     cdef char order = get_best_order(&src, src_ndim)             # <<<<<<<<<<<<<<
20547  *     cdef bint broadcasting = False
20548  *     cdef bint direct_copy = False
20549  */
20550   __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
20551 
20552   /* "View.MemoryView":1277
20553  *     cdef int i
20554  *     cdef char order = get_best_order(&src, src_ndim)
20555  *     cdef bint broadcasting = False             # <<<<<<<<<<<<<<
20556  *     cdef bint direct_copy = False
20557  *     cdef __Pyx_memviewslice tmp
20558  */
20559   __pyx_v_broadcasting = 0;
20560 
20561   /* "View.MemoryView":1278
20562  *     cdef char order = get_best_order(&src, src_ndim)
20563  *     cdef bint broadcasting = False
20564  *     cdef bint direct_copy = False             # <<<<<<<<<<<<<<
20565  *     cdef __Pyx_memviewslice tmp
20566  *
20567  */
20568   __pyx_v_direct_copy = 0;
20569 
20570   /* "View.MemoryView":1281
20571  *     cdef __Pyx_memviewslice tmp
20572  *
20573  *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
20574  *         broadcast_leading(&src, src_ndim, dst_ndim)
20575  *     elif dst_ndim < src_ndim:
20576  */
20577   __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
20578   if (__pyx_t_2) {
20579 
20580     /* "View.MemoryView":1282
20581  *
20582  *     if src_ndim < dst_ndim:
20583  *         broadcast_leading(&src, src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
20584  *     elif dst_ndim < src_ndim:
20585  *         broadcast_leading(&dst, dst_ndim, src_ndim)
20586  */
20587     __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
20588 
20589     /* "View.MemoryView":1281
20590  *     cdef __Pyx_memviewslice tmp
20591  *
20592  *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
20593  *         broadcast_leading(&src, src_ndim, dst_ndim)
20594  *     elif dst_ndim < src_ndim:
20595  */
20596     goto __pyx_L3;
20597   }
20598 
20599   /* "View.MemoryView":1283
20600  *     if src_ndim < dst_ndim:
20601  *         broadcast_leading(&src, src_ndim, dst_ndim)
20602  *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
20603  *         broadcast_leading(&dst, dst_ndim, src_ndim)
20604  *
20605  */
20606   __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
20607   if (__pyx_t_2) {
20608 
20609     /* "View.MemoryView":1284
20610  *         broadcast_leading(&src, src_ndim, dst_ndim)
20611  *     elif dst_ndim < src_ndim:
20612  *         broadcast_leading(&dst, dst_ndim, src_ndim)             # <<<<<<<<<<<<<<
20613  *
20614  *     cdef int ndim = max(src_ndim, dst_ndim)
20615  */
20616     __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
20617 
20618     /* "View.MemoryView":1283
20619  *     if src_ndim < dst_ndim:
20620  *         broadcast_leading(&src, src_ndim, dst_ndim)
20621  *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
20622  *         broadcast_leading(&dst, dst_ndim, src_ndim)
20623  *
20624  */
20625   }
20626   __pyx_L3:;
20627 
20628   /* "View.MemoryView":1286
20629  *         broadcast_leading(&dst, dst_ndim, src_ndim)
20630  *
20631  *     cdef int ndim = max(src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
20632  *
20633  *     for i in range(ndim):
20634  */
20635   __pyx_t_3 = __pyx_v_dst_ndim;
20636   __pyx_t_4 = __pyx_v_src_ndim;
20637   if (((__pyx_t_3 > __pyx_t_4) != 0)) {
20638     __pyx_t_5 = __pyx_t_3;
20639   } else {
20640     __pyx_t_5 = __pyx_t_4;
20641   }
20642   __pyx_v_ndim = __pyx_t_5;
20643 
20644   /* "View.MemoryView":1288
20645  *     cdef int ndim = max(src_ndim, dst_ndim)
20646  *
20647  *     for i in range(ndim):             # <<<<<<<<<<<<<<
20648  *         if src.shape[i] != dst.shape[i]:
20649  *             if src.shape[i] == 1:
20650  */
20651   __pyx_t_5 = __pyx_v_ndim;
20652   __pyx_t_3 = __pyx_t_5;
20653   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
20654     __pyx_v_i = __pyx_t_4;
20655 
20656     /* "View.MemoryView":1289
20657  *
20658  *     for i in range(ndim):
20659  *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
20660  *             if src.shape[i] == 1:
20661  *                 broadcasting = True
20662  */
20663     __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
20664     if (__pyx_t_2) {
20665 
20666       /* "View.MemoryView":1290
20667  *     for i in range(ndim):
20668  *         if src.shape[i] != dst.shape[i]:
20669  *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
20670  *                 broadcasting = True
20671  *                 src.strides[i] = 0
20672  */
20673       __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
20674       if (__pyx_t_2) {
20675 
20676         /* "View.MemoryView":1291
20677  *         if src.shape[i] != dst.shape[i]:
20678  *             if src.shape[i] == 1:
20679  *                 broadcasting = True             # <<<<<<<<<<<<<<
20680  *                 src.strides[i] = 0
20681  *             else:
20682  */
20683         __pyx_v_broadcasting = 1;
20684 
20685         /* "View.MemoryView":1292
20686  *             if src.shape[i] == 1:
20687  *                 broadcasting = True
20688  *                 src.strides[i] = 0             # <<<<<<<<<<<<<<
20689  *             else:
20690  *                 _err_extents(i, dst.shape[i], src.shape[i])
20691  */
20692         (__pyx_v_src.strides[__pyx_v_i]) = 0;
20693 
20694         /* "View.MemoryView":1290
20695  *     for i in range(ndim):
20696  *         if src.shape[i] != dst.shape[i]:
20697  *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
20698  *                 broadcasting = True
20699  *                 src.strides[i] = 0
20700  */
20701         goto __pyx_L7;
20702       }
20703 
20704       /* "View.MemoryView":1294
20705  *                 src.strides[i] = 0
20706  *             else:
20707  *                 _err_extents(i, dst.shape[i], src.shape[i])             # <<<<<<<<<<<<<<
20708  *
20709  *         if src.suboffsets[i] >= 0:
20710  */
20711       /*else*/ {
20712         __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1294, __pyx_L1_error)
20713       }
20714       __pyx_L7:;
20715 
20716       /* "View.MemoryView":1289
20717  *
20718  *     for i in range(ndim):
20719  *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
20720  *             if src.shape[i] == 1:
20721  *                 broadcasting = True
20722  */
20723     }
20724 
20725     /* "View.MemoryView":1296
20726  *                 _err_extents(i, dst.shape[i], src.shape[i])
20727  *
20728  *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
20729  *             _err_dim(ValueError, "Dimension %d is not direct", i)
20730  *
20731  */
20732     __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
20733     if (__pyx_t_2) {
20734 
20735       /* "View.MemoryView":1297
20736  *
20737  *         if src.suboffsets[i] >= 0:
20738  *             _err_dim(ValueError, "Dimension %d is not direct", i)             # <<<<<<<<<<<<<<
20739  *
20740  *     if slices_overlap(&src, &dst, ndim, itemsize):
20741  */
20742       __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1297, __pyx_L1_error)
20743 
20744       /* "View.MemoryView":1296
20745  *                 _err_extents(i, dst.shape[i], src.shape[i])
20746  *
20747  *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
20748  *             _err_dim(ValueError, "Dimension %d is not direct", i)
20749  *
20750  */
20751     }
20752   }
20753 
20754   /* "View.MemoryView":1299
20755  *             _err_dim(ValueError, "Dimension %d is not direct", i)
20756  *
20757  *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
20758  *
20759  *         if not slice_is_contig(src, order, ndim):
20760  */
20761   __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
20762   if (__pyx_t_2) {
20763 
20764     /* "View.MemoryView":1301
20765  *     if slices_overlap(&src, &dst, ndim, itemsize):
20766  *
20767  *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
20768  *             order = get_best_order(&dst, ndim)
20769  *
20770  */
20771     __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
20772     if (__pyx_t_2) {
20773 
20774       /* "View.MemoryView":1302
20775  *
20776  *         if not slice_is_contig(src, order, ndim):
20777  *             order = get_best_order(&dst, ndim)             # <<<<<<<<<<<<<<
20778  *
20779  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
20780  */
20781       __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
20782 
20783       /* "View.MemoryView":1301
20784  *     if slices_overlap(&src, &dst, ndim, itemsize):
20785  *
20786  *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
20787  *             order = get_best_order(&dst, ndim)
20788  *
20789  */
20790     }
20791 
20792     /* "View.MemoryView":1304
20793  *             order = get_best_order(&dst, ndim)
20794  *
20795  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)             # <<<<<<<<<<<<<<
20796  *         src = tmp
20797  *
20798  */
20799     __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1304, __pyx_L1_error)
20800     __pyx_v_tmpdata = __pyx_t_7;
20801 
20802     /* "View.MemoryView":1305
20803  *
20804  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
20805  *         src = tmp             # <<<<<<<<<<<<<<
20806  *
20807  *     if not broadcasting:
20808  */
20809     __pyx_v_src = __pyx_v_tmp;
20810 
20811     /* "View.MemoryView":1299
20812  *             _err_dim(ValueError, "Dimension %d is not direct", i)
20813  *
20814  *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
20815  *
20816  *         if not slice_is_contig(src, order, ndim):
20817  */
20818   }
20819 
20820   /* "View.MemoryView":1307
20821  *         src = tmp
20822  *
20823  *     if not broadcasting:             # <<<<<<<<<<<<<<
20824  *
20825  *
20826  */
20827   __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
20828   if (__pyx_t_2) {
20829 
20830     /* "View.MemoryView":1310
20831  *
20832  *
20833  *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
20834  *             direct_copy = slice_is_contig(dst, 'C', ndim)
20835  *         elif slice_is_contig(src, 'F', ndim):
20836  */
20837     __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
20838     if (__pyx_t_2) {
20839 
20840       /* "View.MemoryView":1311
20841  *
20842  *         if slice_is_contig(src, 'C', ndim):
20843  *             direct_copy = slice_is_contig(dst, 'C', ndim)             # <<<<<<<<<<<<<<
20844  *         elif slice_is_contig(src, 'F', ndim):
20845  *             direct_copy = slice_is_contig(dst, 'F', ndim)
20846  */
20847       __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);
20848 
20849       /* "View.MemoryView":1310
20850  *
20851  *
20852  *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
20853  *             direct_copy = slice_is_contig(dst, 'C', ndim)
20854  *         elif slice_is_contig(src, 'F', ndim):
20855  */
20856       goto __pyx_L12;
20857     }
20858 
20859     /* "View.MemoryView":1312
20860  *         if slice_is_contig(src, 'C', ndim):
20861  *             direct_copy = slice_is_contig(dst, 'C', ndim)
20862  *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
20863  *             direct_copy = slice_is_contig(dst, 'F', ndim)
20864  *
20865  */
20866     __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
20867     if (__pyx_t_2) {
20868 
20869       /* "View.MemoryView":1313
20870  *             direct_copy = slice_is_contig(dst, 'C', ndim)
20871  *         elif slice_is_contig(src, 'F', ndim):
20872  *             direct_copy = slice_is_contig(dst, 'F', ndim)             # <<<<<<<<<<<<<<
20873  *
20874  *         if direct_copy:
20875  */
20876       __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);
20877 
20878       /* "View.MemoryView":1312
20879  *         if slice_is_contig(src, 'C', ndim):
20880  *             direct_copy = slice_is_contig(dst, 'C', ndim)
20881  *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
20882  *             direct_copy = slice_is_contig(dst, 'F', ndim)
20883  *
20884  */
20885     }
20886     __pyx_L12:;
20887 
20888     /* "View.MemoryView":1315
20889  *             direct_copy = slice_is_contig(dst, 'F', ndim)
20890  *
20891  *         if direct_copy:             # <<<<<<<<<<<<<<
20892  *
20893  *             refcount_copying(&dst, dtype_is_object, ndim, False)
20894  */
20895     __pyx_t_2 = (__pyx_v_direct_copy != 0);
20896     if (__pyx_t_2) {
20897 
20898       /* "View.MemoryView":1317
20899  *         if direct_copy:
20900  *
20901  *             refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
20902  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
20903  *             refcount_copying(&dst, dtype_is_object, ndim, True)
20904  */
20905       __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
20906 
20907       /* "View.MemoryView":1318
20908  *
20909  *             refcount_copying(&dst, dtype_is_object, ndim, False)
20910  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))             # <<<<<<<<<<<<<<
20911  *             refcount_copying(&dst, dtype_is_object, ndim, True)
20912  *             free(tmpdata)
20913  */
20914       (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
20915 
20916       /* "View.MemoryView":1319
20917  *             refcount_copying(&dst, dtype_is_object, ndim, False)
20918  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
20919  *             refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
20920  *             free(tmpdata)
20921  *             return 0
20922  */
20923       __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
20924 
20925       /* "View.MemoryView":1320
20926  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
20927  *             refcount_copying(&dst, dtype_is_object, ndim, True)
20928  *             free(tmpdata)             # <<<<<<<<<<<<<<
20929  *             return 0
20930  *
20931  */
20932       free(__pyx_v_tmpdata);
20933 
20934       /* "View.MemoryView":1321
20935  *             refcount_copying(&dst, dtype_is_object, ndim, True)
20936  *             free(tmpdata)
20937  *             return 0             # <<<<<<<<<<<<<<
20938  *
20939  *     if order == 'F' == get_best_order(&dst, ndim):
20940  */
20941       __pyx_r = 0;
20942       goto __pyx_L0;
20943 
20944       /* "View.MemoryView":1315
20945  *             direct_copy = slice_is_contig(dst, 'F', ndim)
20946  *
20947  *         if direct_copy:             # <<<<<<<<<<<<<<
20948  *
20949  *             refcount_copying(&dst, dtype_is_object, ndim, False)
20950  */
20951     }
20952 
20953     /* "View.MemoryView":1307
20954  *         src = tmp
20955  *
20956  *     if not broadcasting:             # <<<<<<<<<<<<<<
20957  *
20958  *
20959  */
20960   }
20961 
20962   /* "View.MemoryView":1323
20963  *             return 0
20964  *
20965  *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
20966  *
20967  *
20968  */
20969   __pyx_t_2 = (__pyx_v_order == 'F');
20970   if (__pyx_t_2) {
20971     __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
20972   }
20973   __pyx_t_8 = (__pyx_t_2 != 0);
20974   if (__pyx_t_8) {
20975 
20976     /* "View.MemoryView":1326
20977  *
20978  *
20979  *         transpose_memslice(&src)             # <<<<<<<<<<<<<<
20980  *         transpose_memslice(&dst)
20981  *
20982  */
20983     __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1326, __pyx_L1_error)
20984 
20985     /* "View.MemoryView":1327
20986  *
20987  *         transpose_memslice(&src)
20988  *         transpose_memslice(&dst)             # <<<<<<<<<<<<<<
20989  *
20990  *     refcount_copying(&dst, dtype_is_object, ndim, False)
20991  */
20992     __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1327, __pyx_L1_error)
20993 
20994     /* "View.MemoryView":1323
20995  *             return 0
20996  *
20997  *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
20998  *
20999  *
21000  */
21001   }
21002 
21003   /* "View.MemoryView":1329
21004  *         transpose_memslice(&dst)
21005  *
21006  *     refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
21007  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
21008  *     refcount_copying(&dst, dtype_is_object, ndim, True)
21009  */
21010   __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
21011 
21012   /* "View.MemoryView":1330
21013  *
21014  *     refcount_copying(&dst, dtype_is_object, ndim, False)
21015  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)             # <<<<<<<<<<<<<<
21016  *     refcount_copying(&dst, dtype_is_object, ndim, True)
21017  *
21018  */
21019   copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
21020 
21021   /* "View.MemoryView":1331
21022  *     refcount_copying(&dst, dtype_is_object, ndim, False)
21023  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
21024  *     refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
21025  *
21026  *     free(tmpdata)
21027  */
21028   __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
21029 
21030   /* "View.MemoryView":1333
21031  *     refcount_copying(&dst, dtype_is_object, ndim, True)
21032  *
21033  *     free(tmpdata)             # <<<<<<<<<<<<<<
21034  *     return 0
21035  *
21036  */
21037   free(__pyx_v_tmpdata);
21038 
21039   /* "View.MemoryView":1334
21040  *
21041  *     free(tmpdata)
21042  *     return 0             # <<<<<<<<<<<<<<
21043  *
21044  * @cname('__pyx_memoryview_broadcast_leading')
21045  */
21046   __pyx_r = 0;
21047   goto __pyx_L0;
21048 
21049   /* "View.MemoryView":1265
21050  *
21051  * @cname('__pyx_memoryview_copy_contents')
21052  * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
21053  *                                   __Pyx_memviewslice dst,
21054  *                                   int src_ndim, int dst_ndim,
21055  */
21056 
21057   /* function exit code */
21058   __pyx_L1_error:;
21059   {
21060     #ifdef WITH_THREAD
21061     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
21062     #endif
21063     __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
21064     #ifdef WITH_THREAD
21065     __Pyx_PyGILState_Release(__pyx_gilstate_save);
21066     #endif
21067   }
21068   __pyx_r = -1;
21069   __pyx_L0:;
21070   return __pyx_r;
21071 }
21072 
21073 /* "View.MemoryView":1337
21074  *
21075  * @cname('__pyx_memoryview_broadcast_leading')
21076  * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
21077  *                             int ndim,
21078  *                             int ndim_other) nogil:
21079  */
21080 
__pyx_memoryview_broadcast_leading(__Pyx_memviewslice * __pyx_v_mslice,int __pyx_v_ndim,int __pyx_v_ndim_other)21081 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
21082   int __pyx_v_i;
21083   int __pyx_v_offset;
21084   int __pyx_t_1;
21085   int __pyx_t_2;
21086   int __pyx_t_3;
21087 
21088   /* "View.MemoryView":1341
21089  *                             int ndim_other) nogil:
21090  *     cdef int i
21091  *     cdef int offset = ndim_other - ndim             # <<<<<<<<<<<<<<
21092  *
21093  *     for i in range(ndim - 1, -1, -1):
21094  */
21095   __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
21096 
21097   /* "View.MemoryView":1343
21098  *     cdef int offset = ndim_other - ndim
21099  *
21100  *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
21101  *         mslice.shape[i + offset] = mslice.shape[i]
21102  *         mslice.strides[i + offset] = mslice.strides[i]
21103  */
21104   for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
21105     __pyx_v_i = __pyx_t_1;
21106 
21107     /* "View.MemoryView":1344
21108  *
21109  *     for i in range(ndim - 1, -1, -1):
21110  *         mslice.shape[i + offset] = mslice.shape[i]             # <<<<<<<<<<<<<<
21111  *         mslice.strides[i + offset] = mslice.strides[i]
21112  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
21113  */
21114     (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
21115 
21116     /* "View.MemoryView":1345
21117  *     for i in range(ndim - 1, -1, -1):
21118  *         mslice.shape[i + offset] = mslice.shape[i]
21119  *         mslice.strides[i + offset] = mslice.strides[i]             # <<<<<<<<<<<<<<
21120  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
21121  *
21122  */
21123     (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
21124 
21125     /* "View.MemoryView":1346
21126  *         mslice.shape[i + offset] = mslice.shape[i]
21127  *         mslice.strides[i + offset] = mslice.strides[i]
21128  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]             # <<<<<<<<<<<<<<
21129  *
21130  *     for i in range(offset):
21131  */
21132     (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
21133   }
21134 
21135   /* "View.MemoryView":1348
21136  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
21137  *
21138  *     for i in range(offset):             # <<<<<<<<<<<<<<
21139  *         mslice.shape[i] = 1
21140  *         mslice.strides[i] = mslice.strides[0]
21141  */
21142   __pyx_t_1 = __pyx_v_offset;
21143   __pyx_t_2 = __pyx_t_1;
21144   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
21145     __pyx_v_i = __pyx_t_3;
21146 
21147     /* "View.MemoryView":1349
21148  *
21149  *     for i in range(offset):
21150  *         mslice.shape[i] = 1             # <<<<<<<<<<<<<<
21151  *         mslice.strides[i] = mslice.strides[0]
21152  *         mslice.suboffsets[i] = -1
21153  */
21154     (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
21155 
21156     /* "View.MemoryView":1350
21157  *     for i in range(offset):
21158  *         mslice.shape[i] = 1
21159  *         mslice.strides[i] = mslice.strides[0]             # <<<<<<<<<<<<<<
21160  *         mslice.suboffsets[i] = -1
21161  *
21162  */
21163     (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
21164 
21165     /* "View.MemoryView":1351
21166  *         mslice.shape[i] = 1
21167  *         mslice.strides[i] = mslice.strides[0]
21168  *         mslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
21169  *
21170  *
21171  */
21172     (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
21173   }
21174 
21175   /* "View.MemoryView":1337
21176  *
21177  * @cname('__pyx_memoryview_broadcast_leading')
21178  * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
21179  *                             int ndim,
21180  *                             int ndim_other) nogil:
21181  */
21182 
21183   /* function exit code */
21184 }
21185 
21186 /* "View.MemoryView":1359
21187  *
21188  * @cname('__pyx_memoryview_refcount_copying')
21189  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
21190  *                            int ndim, bint inc) nogil:
21191  *
21192  */
21193 
__pyx_memoryview_refcount_copying(__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_dtype_is_object,int __pyx_v_ndim,int __pyx_v_inc)21194 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) {
21195   int __pyx_t_1;
21196 
21197   /* "View.MemoryView":1363
21198  *
21199  *
21200  *     if dtype_is_object:             # <<<<<<<<<<<<<<
21201  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
21202  *                                            dst.strides, ndim, inc)
21203  */
21204   __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
21205   if (__pyx_t_1) {
21206 
21207     /* "View.MemoryView":1364
21208  *
21209  *     if dtype_is_object:
21210  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,             # <<<<<<<<<<<<<<
21211  *                                            dst.strides, ndim, inc)
21212  *
21213  */
21214     __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);
21215 
21216     /* "View.MemoryView":1363
21217  *
21218  *
21219  *     if dtype_is_object:             # <<<<<<<<<<<<<<
21220  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
21221  *                                            dst.strides, ndim, inc)
21222  */
21223   }
21224 
21225   /* "View.MemoryView":1359
21226  *
21227  * @cname('__pyx_memoryview_refcount_copying')
21228  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
21229  *                            int ndim, bint inc) nogil:
21230  *
21231  */
21232 
21233   /* function exit code */
21234 }
21235 
21236 /* "View.MemoryView":1368
21237  *
21238  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
21239  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
21240  *                                              Py_ssize_t *strides, int ndim,
21241  *                                              bint inc) with gil:
21242  */
21243 
__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)21244 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) {
21245   __Pyx_RefNannyDeclarations
21246   #ifdef WITH_THREAD
21247   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
21248   #endif
21249   __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);
21250 
21251   /* "View.MemoryView":1371
21252  *                                              Py_ssize_t *strides, int ndim,
21253  *                                              bint inc) with gil:
21254  *     refcount_objects_in_slice(data, shape, strides, ndim, inc)             # <<<<<<<<<<<<<<
21255  *
21256  * @cname('__pyx_memoryview_refcount_objects_in_slice')
21257  */
21258   __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
21259 
21260   /* "View.MemoryView":1368
21261  *
21262  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
21263  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
21264  *                                              Py_ssize_t *strides, int ndim,
21265  *                                              bint inc) with gil:
21266  */
21267 
21268   /* function exit code */
21269   __Pyx_RefNannyFinishContext();
21270   #ifdef WITH_THREAD
21271   __Pyx_PyGILState_Release(__pyx_gilstate_save);
21272   #endif
21273 }
21274 
21275 /* "View.MemoryView":1374
21276  *
21277  * @cname('__pyx_memoryview_refcount_objects_in_slice')
21278  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
21279  *                                     Py_ssize_t *strides, int ndim, bint inc):
21280  *     cdef Py_ssize_t i
21281  */
21282 
__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)21283 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) {
21284   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
21285   __Pyx_RefNannyDeclarations
21286   Py_ssize_t __pyx_t_1;
21287   Py_ssize_t __pyx_t_2;
21288   Py_ssize_t __pyx_t_3;
21289   int __pyx_t_4;
21290   __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);
21291 
21292   /* "View.MemoryView":1378
21293  *     cdef Py_ssize_t i
21294  *
21295  *     for i in range(shape[0]):             # <<<<<<<<<<<<<<
21296  *         if ndim == 1:
21297  *             if inc:
21298  */
21299   __pyx_t_1 = (__pyx_v_shape[0]);
21300   __pyx_t_2 = __pyx_t_1;
21301   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
21302     __pyx_v_i = __pyx_t_3;
21303 
21304     /* "View.MemoryView":1379
21305  *
21306  *     for i in range(shape[0]):
21307  *         if ndim == 1:             # <<<<<<<<<<<<<<
21308  *             if inc:
21309  *                 Py_INCREF((<PyObject **> data)[0])
21310  */
21311     __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
21312     if (__pyx_t_4) {
21313 
21314       /* "View.MemoryView":1380
21315  *     for i in range(shape[0]):
21316  *         if ndim == 1:
21317  *             if inc:             # <<<<<<<<<<<<<<
21318  *                 Py_INCREF((<PyObject **> data)[0])
21319  *             else:
21320  */
21321       __pyx_t_4 = (__pyx_v_inc != 0);
21322       if (__pyx_t_4) {
21323 
21324         /* "View.MemoryView":1381
21325  *         if ndim == 1:
21326  *             if inc:
21327  *                 Py_INCREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
21328  *             else:
21329  *                 Py_DECREF((<PyObject **> data)[0])
21330  */
21331         Py_INCREF((((PyObject **)__pyx_v_data)[0]));
21332 
21333         /* "View.MemoryView":1380
21334  *     for i in range(shape[0]):
21335  *         if ndim == 1:
21336  *             if inc:             # <<<<<<<<<<<<<<
21337  *                 Py_INCREF((<PyObject **> data)[0])
21338  *             else:
21339  */
21340         goto __pyx_L6;
21341       }
21342 
21343       /* "View.MemoryView":1383
21344  *                 Py_INCREF((<PyObject **> data)[0])
21345  *             else:
21346  *                 Py_DECREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
21347  *         else:
21348  *             refcount_objects_in_slice(data, shape + 1, strides + 1,
21349  */
21350       /*else*/ {
21351         Py_DECREF((((PyObject **)__pyx_v_data)[0]));
21352       }
21353       __pyx_L6:;
21354 
21355       /* "View.MemoryView":1379
21356  *
21357  *     for i in range(shape[0]):
21358  *         if ndim == 1:             # <<<<<<<<<<<<<<
21359  *             if inc:
21360  *                 Py_INCREF((<PyObject **> data)[0])
21361  */
21362       goto __pyx_L5;
21363     }
21364 
21365     /* "View.MemoryView":1385
21366  *                 Py_DECREF((<PyObject **> data)[0])
21367  *         else:
21368  *             refcount_objects_in_slice(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
21369  *                                       ndim - 1, inc)
21370  *
21371  */
21372     /*else*/ {
21373 
21374       /* "View.MemoryView":1386
21375  *         else:
21376  *             refcount_objects_in_slice(data, shape + 1, strides + 1,
21377  *                                       ndim - 1, inc)             # <<<<<<<<<<<<<<
21378  *
21379  *         data += strides[0]
21380  */
21381       __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
21382     }
21383     __pyx_L5:;
21384 
21385     /* "View.MemoryView":1388
21386  *                                       ndim - 1, inc)
21387  *
21388  *         data += strides[0]             # <<<<<<<<<<<<<<
21389  *
21390  *
21391  */
21392     __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
21393   }
21394 
21395   /* "View.MemoryView":1374
21396  *
21397  * @cname('__pyx_memoryview_refcount_objects_in_slice')
21398  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
21399  *                                     Py_ssize_t *strides, int ndim, bint inc):
21400  *     cdef Py_ssize_t i
21401  */
21402 
21403   /* function exit code */
21404   __Pyx_RefNannyFinishContext();
21405 }
21406 
21407 /* "View.MemoryView":1394
21408  *
21409  * @cname('__pyx_memoryview_slice_assign_scalar')
21410  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
21411  *                               size_t itemsize, void *item,
21412  *                               bint dtype_is_object) nogil:
21413  */
21414 
__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)21415 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) {
21416 
21417   /* "View.MemoryView":1397
21418  *                               size_t itemsize, void *item,
21419  *                               bint dtype_is_object) nogil:
21420  *     refcount_copying(dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
21421  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
21422  *                          itemsize, item)
21423  */
21424   __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
21425 
21426   /* "View.MemoryView":1398
21427  *                               bint dtype_is_object) nogil:
21428  *     refcount_copying(dst, dtype_is_object, ndim, False)
21429  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,             # <<<<<<<<<<<<<<
21430  *                          itemsize, item)
21431  *     refcount_copying(dst, dtype_is_object, ndim, True)
21432  */
21433   __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);
21434 
21435   /* "View.MemoryView":1400
21436  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
21437  *                          itemsize, item)
21438  *     refcount_copying(dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
21439  *
21440  *
21441  */
21442   __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
21443 
21444   /* "View.MemoryView":1394
21445  *
21446  * @cname('__pyx_memoryview_slice_assign_scalar')
21447  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
21448  *                               size_t itemsize, void *item,
21449  *                               bint dtype_is_object) nogil:
21450  */
21451 
21452   /* function exit code */
21453 }
21454 
21455 /* "View.MemoryView":1404
21456  *
21457  * @cname('__pyx_memoryview__slice_assign_scalar')
21458  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
21459  *                               Py_ssize_t *strides, int ndim,
21460  *                               size_t itemsize, void *item) nogil:
21461  */
21462 
__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)21463 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) {
21464   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
21465   Py_ssize_t __pyx_v_stride;
21466   Py_ssize_t __pyx_v_extent;
21467   int __pyx_t_1;
21468   Py_ssize_t __pyx_t_2;
21469   Py_ssize_t __pyx_t_3;
21470   Py_ssize_t __pyx_t_4;
21471 
21472   /* "View.MemoryView":1408
21473  *                               size_t itemsize, void *item) nogil:
21474  *     cdef Py_ssize_t i
21475  *     cdef Py_ssize_t stride = strides[0]             # <<<<<<<<<<<<<<
21476  *     cdef Py_ssize_t extent = shape[0]
21477  *
21478  */
21479   __pyx_v_stride = (__pyx_v_strides[0]);
21480 
21481   /* "View.MemoryView":1409
21482  *     cdef Py_ssize_t i
21483  *     cdef Py_ssize_t stride = strides[0]
21484  *     cdef Py_ssize_t extent = shape[0]             # <<<<<<<<<<<<<<
21485  *
21486  *     if ndim == 1:
21487  */
21488   __pyx_v_extent = (__pyx_v_shape[0]);
21489 
21490   /* "View.MemoryView":1411
21491  *     cdef Py_ssize_t extent = shape[0]
21492  *
21493  *     if ndim == 1:             # <<<<<<<<<<<<<<
21494  *         for i in range(extent):
21495  *             memcpy(data, item, itemsize)
21496  */
21497   __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
21498   if (__pyx_t_1) {
21499 
21500     /* "View.MemoryView":1412
21501  *
21502  *     if ndim == 1:
21503  *         for i in range(extent):             # <<<<<<<<<<<<<<
21504  *             memcpy(data, item, itemsize)
21505  *             data += stride
21506  */
21507     __pyx_t_2 = __pyx_v_extent;
21508     __pyx_t_3 = __pyx_t_2;
21509     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
21510       __pyx_v_i = __pyx_t_4;
21511 
21512       /* "View.MemoryView":1413
21513  *     if ndim == 1:
21514  *         for i in range(extent):
21515  *             memcpy(data, item, itemsize)             # <<<<<<<<<<<<<<
21516  *             data += stride
21517  *     else:
21518  */
21519       (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
21520 
21521       /* "View.MemoryView":1414
21522  *         for i in range(extent):
21523  *             memcpy(data, item, itemsize)
21524  *             data += stride             # <<<<<<<<<<<<<<
21525  *     else:
21526  *         for i in range(extent):
21527  */
21528       __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
21529     }
21530 
21531     /* "View.MemoryView":1411
21532  *     cdef Py_ssize_t extent = shape[0]
21533  *
21534  *     if ndim == 1:             # <<<<<<<<<<<<<<
21535  *         for i in range(extent):
21536  *             memcpy(data, item, itemsize)
21537  */
21538     goto __pyx_L3;
21539   }
21540 
21541   /* "View.MemoryView":1416
21542  *             data += stride
21543  *     else:
21544  *         for i in range(extent):             # <<<<<<<<<<<<<<
21545  *             _slice_assign_scalar(data, shape + 1, strides + 1,
21546  *                                 ndim - 1, itemsize, item)
21547  */
21548   /*else*/ {
21549     __pyx_t_2 = __pyx_v_extent;
21550     __pyx_t_3 = __pyx_t_2;
21551     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
21552       __pyx_v_i = __pyx_t_4;
21553 
21554       /* "View.MemoryView":1417
21555  *     else:
21556  *         for i in range(extent):
21557  *             _slice_assign_scalar(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
21558  *                                 ndim - 1, itemsize, item)
21559  *             data += stride
21560  */
21561       __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);
21562 
21563       /* "View.MemoryView":1419
21564  *             _slice_assign_scalar(data, shape + 1, strides + 1,
21565  *                                 ndim - 1, itemsize, item)
21566  *             data += stride             # <<<<<<<<<<<<<<
21567  *
21568  *
21569  */
21570       __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
21571     }
21572   }
21573   __pyx_L3:;
21574 
21575   /* "View.MemoryView":1404
21576  *
21577  * @cname('__pyx_memoryview__slice_assign_scalar')
21578  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
21579  *                               Py_ssize_t *strides, int ndim,
21580  *                               size_t itemsize, void *item) nogil:
21581  */
21582 
21583   /* function exit code */
21584 }
21585 
21586 /* "(tree fragment)":1
21587  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
21588  *     cdef object __pyx_PickleError
21589  *     cdef object __pyx_result
21590  */
21591 
21592 /* Python wrapper */
21593 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
21594 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)21595 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
21596   PyObject *__pyx_v___pyx_type = 0;
21597   long __pyx_v___pyx_checksum;
21598   PyObject *__pyx_v___pyx_state = 0;
21599   PyObject *__pyx_r = 0;
21600   __Pyx_RefNannyDeclarations
21601   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
21602   {
21603     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
21604     PyObject* values[3] = {0,0,0};
21605     if (unlikely(__pyx_kwds)) {
21606       Py_ssize_t kw_args;
21607       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
21608       switch (pos_args) {
21609         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
21610         CYTHON_FALLTHROUGH;
21611         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
21612         CYTHON_FALLTHROUGH;
21613         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
21614         CYTHON_FALLTHROUGH;
21615         case  0: break;
21616         default: goto __pyx_L5_argtuple_error;
21617       }
21618       kw_args = PyDict_Size(__pyx_kwds);
21619       switch (pos_args) {
21620         case  0:
21621         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
21622         else goto __pyx_L5_argtuple_error;
21623         CYTHON_FALLTHROUGH;
21624         case  1:
21625         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
21626         else {
21627           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error)
21628         }
21629         CYTHON_FALLTHROUGH;
21630         case  2:
21631         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
21632         else {
21633           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error)
21634         }
21635       }
21636       if (unlikely(kw_args > 0)) {
21637         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error)
21638       }
21639     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
21640       goto __pyx_L5_argtuple_error;
21641     } else {
21642       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
21643       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
21644       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
21645     }
21646     __pyx_v___pyx_type = values[0];
21647     __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error)
21648     __pyx_v___pyx_state = values[2];
21649   }
21650   goto __pyx_L4_argument_unpacking_done;
21651   __pyx_L5_argtuple_error:;
21652   __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error)
21653   __pyx_L3_error:;
21654   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
21655   __Pyx_RefNannyFinishContext();
21656   return NULL;
21657   __pyx_L4_argument_unpacking_done:;
21658   __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
21659 
21660   /* function exit code */
21661   __Pyx_RefNannyFinishContext();
21662   return __pyx_r;
21663 }
21664 
__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)21665 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) {
21666   PyObject *__pyx_v___pyx_PickleError = 0;
21667   PyObject *__pyx_v___pyx_result = 0;
21668   PyObject *__pyx_r = NULL;
21669   __Pyx_RefNannyDeclarations
21670   int __pyx_t_1;
21671   PyObject *__pyx_t_2 = NULL;
21672   PyObject *__pyx_t_3 = NULL;
21673   PyObject *__pyx_t_4 = NULL;
21674   PyObject *__pyx_t_5 = NULL;
21675   int __pyx_t_6;
21676   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);
21677 
21678   /* "(tree fragment)":4
21679  *     cdef object __pyx_PickleError
21680  *     cdef object __pyx_result
21681  *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
21682  *         from pickle import PickleError as __pyx_PickleError
21683  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
21684  */
21685   __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
21686   if (__pyx_t_1) {
21687 
21688     /* "(tree fragment)":5
21689  *     cdef object __pyx_result
21690  *     if __pyx_checksum != 0xb068931:
21691  *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
21692  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
21693  *     __pyx_result = Enum.__new__(__pyx_type)
21694  */
21695     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
21696     __Pyx_GOTREF(__pyx_t_2);
21697     __Pyx_INCREF(__pyx_n_s_PickleError);
21698     __Pyx_GIVEREF(__pyx_n_s_PickleError);
21699     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
21700     __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
21701     __Pyx_GOTREF(__pyx_t_3);
21702     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21703     __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
21704     __Pyx_GOTREF(__pyx_t_2);
21705     __Pyx_INCREF(__pyx_t_2);
21706     __pyx_v___pyx_PickleError = __pyx_t_2;
21707     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21708     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21709 
21710     /* "(tree fragment)":6
21711  *     if __pyx_checksum != 0xb068931:
21712  *         from pickle import PickleError as __pyx_PickleError
21713  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)             # <<<<<<<<<<<<<<
21714  *     __pyx_result = Enum.__new__(__pyx_type)
21715  *     if __pyx_state is not None:
21716  */
21717     __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 6, __pyx_L1_error)
21718     __Pyx_GOTREF(__pyx_t_2);
21719     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error)
21720     __Pyx_GOTREF(__pyx_t_4);
21721     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21722     __Pyx_INCREF(__pyx_v___pyx_PickleError);
21723     __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
21724     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
21725       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
21726       if (likely(__pyx_t_5)) {
21727         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
21728         __Pyx_INCREF(__pyx_t_5);
21729         __Pyx_INCREF(function);
21730         __Pyx_DECREF_SET(__pyx_t_2, function);
21731       }
21732     }
21733     __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);
21734     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
21735     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21736     if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 6, __pyx_L1_error)
21737     __Pyx_GOTREF(__pyx_t_3);
21738     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21739     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
21740     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21741     __PYX_ERR(2, 6, __pyx_L1_error)
21742 
21743     /* "(tree fragment)":4
21744  *     cdef object __pyx_PickleError
21745  *     cdef object __pyx_result
21746  *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
21747  *         from pickle import PickleError as __pyx_PickleError
21748  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
21749  */
21750   }
21751 
21752   /* "(tree fragment)":7
21753  *         from pickle import PickleError as __pyx_PickleError
21754  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
21755  *     __pyx_result = Enum.__new__(__pyx_type)             # <<<<<<<<<<<<<<
21756  *     if __pyx_state is not None:
21757  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
21758  */
21759   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 7, __pyx_L1_error)
21760   __Pyx_GOTREF(__pyx_t_2);
21761   __pyx_t_4 = NULL;
21762   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
21763     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
21764     if (likely(__pyx_t_4)) {
21765       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
21766       __Pyx_INCREF(__pyx_t_4);
21767       __Pyx_INCREF(function);
21768       __Pyx_DECREF_SET(__pyx_t_2, function);
21769     }
21770   }
21771   __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);
21772   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
21773   if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error)
21774   __Pyx_GOTREF(__pyx_t_3);
21775   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21776   __pyx_v___pyx_result = __pyx_t_3;
21777   __pyx_t_3 = 0;
21778 
21779   /* "(tree fragment)":8
21780  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
21781  *     __pyx_result = Enum.__new__(__pyx_type)
21782  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
21783  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
21784  *     return __pyx_result
21785  */
21786   __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
21787   __pyx_t_6 = (__pyx_t_1 != 0);
21788   if (__pyx_t_6) {
21789 
21790     /* "(tree fragment)":9
21791  *     __pyx_result = Enum.__new__(__pyx_type)
21792  *     if __pyx_state is not None:
21793  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
21794  *     return __pyx_result
21795  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
21796  */
21797     if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 9, __pyx_L1_error)
21798     __pyx_t_3 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 9, __pyx_L1_error)
21799     __Pyx_GOTREF(__pyx_t_3);
21800     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21801 
21802     /* "(tree fragment)":8
21803  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
21804  *     __pyx_result = Enum.__new__(__pyx_type)
21805  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
21806  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
21807  *     return __pyx_result
21808  */
21809   }
21810 
21811   /* "(tree fragment)":10
21812  *     if __pyx_state is not None:
21813  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
21814  *     return __pyx_result             # <<<<<<<<<<<<<<
21815  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
21816  *     __pyx_result.name = __pyx_state[0]
21817  */
21818   __Pyx_XDECREF(__pyx_r);
21819   __Pyx_INCREF(__pyx_v___pyx_result);
21820   __pyx_r = __pyx_v___pyx_result;
21821   goto __pyx_L0;
21822 
21823   /* "(tree fragment)":1
21824  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
21825  *     cdef object __pyx_PickleError
21826  *     cdef object __pyx_result
21827  */
21828 
21829   /* function exit code */
21830   __pyx_L1_error:;
21831   __Pyx_XDECREF(__pyx_t_2);
21832   __Pyx_XDECREF(__pyx_t_3);
21833   __Pyx_XDECREF(__pyx_t_4);
21834   __Pyx_XDECREF(__pyx_t_5);
21835   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
21836   __pyx_r = NULL;
21837   __pyx_L0:;
21838   __Pyx_XDECREF(__pyx_v___pyx_PickleError);
21839   __Pyx_XDECREF(__pyx_v___pyx_result);
21840   __Pyx_XGIVEREF(__pyx_r);
21841   __Pyx_RefNannyFinishContext();
21842   return __pyx_r;
21843 }
21844 
21845 /* "(tree fragment)":11
21846  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
21847  *     return __pyx_result
21848  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
21849  *     __pyx_result.name = __pyx_state[0]
21850  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
21851  */
21852 
__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)21853 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
21854   PyObject *__pyx_r = NULL;
21855   __Pyx_RefNannyDeclarations
21856   PyObject *__pyx_t_1 = NULL;
21857   int __pyx_t_2;
21858   Py_ssize_t __pyx_t_3;
21859   int __pyx_t_4;
21860   int __pyx_t_5;
21861   PyObject *__pyx_t_6 = NULL;
21862   PyObject *__pyx_t_7 = NULL;
21863   PyObject *__pyx_t_8 = NULL;
21864   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);
21865 
21866   /* "(tree fragment)":12
21867  *     return __pyx_result
21868  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
21869  *     __pyx_result.name = __pyx_state[0]             # <<<<<<<<<<<<<<
21870  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
21871  *         __pyx_result.__dict__.update(__pyx_state[1])
21872  */
21873   if (unlikely(__pyx_v___pyx_state == Py_None)) {
21874     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
21875     __PYX_ERR(2, 12, __pyx_L1_error)
21876   }
21877   __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(2, 12, __pyx_L1_error)
21878   __Pyx_GOTREF(__pyx_t_1);
21879   __Pyx_GIVEREF(__pyx_t_1);
21880   __Pyx_GOTREF(__pyx_v___pyx_result->name);
21881   __Pyx_DECREF(__pyx_v___pyx_result->name);
21882   __pyx_v___pyx_result->name = __pyx_t_1;
21883   __pyx_t_1 = 0;
21884 
21885   /* "(tree fragment)":13
21886  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
21887  *     __pyx_result.name = __pyx_state[0]
21888  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
21889  *         __pyx_result.__dict__.update(__pyx_state[1])
21890  */
21891   if (unlikely(__pyx_v___pyx_state == Py_None)) {
21892     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
21893     __PYX_ERR(2, 13, __pyx_L1_error)
21894   }
21895   __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
21896   __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
21897   if (__pyx_t_4) {
21898   } else {
21899     __pyx_t_2 = __pyx_t_4;
21900     goto __pyx_L4_bool_binop_done;
21901   }
21902   __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
21903   __pyx_t_5 = (__pyx_t_4 != 0);
21904   __pyx_t_2 = __pyx_t_5;
21905   __pyx_L4_bool_binop_done:;
21906   if (__pyx_t_2) {
21907 
21908     /* "(tree fragment)":14
21909  *     __pyx_result.name = __pyx_state[0]
21910  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
21911  *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
21912  */
21913     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error)
21914     __Pyx_GOTREF(__pyx_t_6);
21915     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 14, __pyx_L1_error)
21916     __Pyx_GOTREF(__pyx_t_7);
21917     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
21918     if (unlikely(__pyx_v___pyx_state == Py_None)) {
21919       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
21920       __PYX_ERR(2, 14, __pyx_L1_error)
21921     }
21922     __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(2, 14, __pyx_L1_error)
21923     __Pyx_GOTREF(__pyx_t_6);
21924     __pyx_t_8 = NULL;
21925     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
21926       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
21927       if (likely(__pyx_t_8)) {
21928         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
21929         __Pyx_INCREF(__pyx_t_8);
21930         __Pyx_INCREF(function);
21931         __Pyx_DECREF_SET(__pyx_t_7, function);
21932       }
21933     }
21934     __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);
21935     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
21936     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
21937     if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error)
21938     __Pyx_GOTREF(__pyx_t_1);
21939     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
21940     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21941 
21942     /* "(tree fragment)":13
21943  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
21944  *     __pyx_result.name = __pyx_state[0]
21945  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
21946  *         __pyx_result.__dict__.update(__pyx_state[1])
21947  */
21948   }
21949 
21950   /* "(tree fragment)":11
21951  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
21952  *     return __pyx_result
21953  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
21954  *     __pyx_result.name = __pyx_state[0]
21955  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
21956  */
21957 
21958   /* function exit code */
21959   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21960   goto __pyx_L0;
21961   __pyx_L1_error:;
21962   __Pyx_XDECREF(__pyx_t_1);
21963   __Pyx_XDECREF(__pyx_t_6);
21964   __Pyx_XDECREF(__pyx_t_7);
21965   __Pyx_XDECREF(__pyx_t_8);
21966   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
21967   __pyx_r = 0;
21968   __pyx_L0:;
21969   __Pyx_XGIVEREF(__pyx_r);
21970   __Pyx_RefNannyFinishContext();
21971   return __pyx_r;
21972 }
21973 static struct __pyx_vtabstruct_array __pyx_vtable_array;
21974 
__pyx_tp_new_array(PyTypeObject * t,PyObject * a,PyObject * k)21975 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
21976   struct __pyx_array_obj *p;
21977   PyObject *o;
21978   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
21979     o = (*t->tp_alloc)(t, 0);
21980   } else {
21981     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
21982   }
21983   if (unlikely(!o)) return 0;
21984   p = ((struct __pyx_array_obj *)o);
21985   p->__pyx_vtab = __pyx_vtabptr_array;
21986   p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
21987   p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
21988   if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
21989   return o;
21990   bad:
21991   Py_DECREF(o); o = 0;
21992   return NULL;
21993 }
21994 
__pyx_tp_dealloc_array(PyObject * o)21995 static void __pyx_tp_dealloc_array(PyObject *o) {
21996   struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
21997   #if CYTHON_USE_TP_FINALIZE
21998   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))) {
21999     if (PyObject_CallFinalizerFromDealloc(o)) return;
22000   }
22001   #endif
22002   {
22003     PyObject *etype, *eval, *etb;
22004     PyErr_Fetch(&etype, &eval, &etb);
22005     ++Py_REFCNT(o);
22006     __pyx_array___dealloc__(o);
22007     --Py_REFCNT(o);
22008     PyErr_Restore(etype, eval, etb);
22009   }
22010   Py_CLEAR(p->mode);
22011   Py_CLEAR(p->_format);
22012   (*Py_TYPE(o)->tp_free)(o);
22013 }
__pyx_sq_item_array(PyObject * o,Py_ssize_t i)22014 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
22015   PyObject *r;
22016   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
22017   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
22018   Py_DECREF(x);
22019   return r;
22020 }
22021 
__pyx_mp_ass_subscript_array(PyObject * o,PyObject * i,PyObject * v)22022 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
22023   if (v) {
22024     return __pyx_array___setitem__(o, i, v);
22025   }
22026   else {
22027     PyErr_Format(PyExc_NotImplementedError,
22028       "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
22029     return -1;
22030   }
22031 }
22032 
__pyx_tp_getattro_array(PyObject * o,PyObject * n)22033 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
22034   PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
22035   if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
22036     PyErr_Clear();
22037     v = __pyx_array___getattr__(o, n);
22038   }
22039   return v;
22040 }
22041 
__pyx_getprop___pyx_array_memview(PyObject * o,CYTHON_UNUSED void * x)22042 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
22043   return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
22044 }
22045 
22046 static PyMethodDef __pyx_methods_array[] = {
22047   {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
22048   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
22049   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
22050   {0, 0, 0, 0}
22051 };
22052 
22053 static struct PyGetSetDef __pyx_getsets_array[] = {
22054   {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
22055   {0, 0, 0, 0, 0}
22056 };
22057 
22058 static PySequenceMethods __pyx_tp_as_sequence_array = {
22059   __pyx_array___len__, /*sq_length*/
22060   0, /*sq_concat*/
22061   0, /*sq_repeat*/
22062   __pyx_sq_item_array, /*sq_item*/
22063   0, /*sq_slice*/
22064   0, /*sq_ass_item*/
22065   0, /*sq_ass_slice*/
22066   0, /*sq_contains*/
22067   0, /*sq_inplace_concat*/
22068   0, /*sq_inplace_repeat*/
22069 };
22070 
22071 static PyMappingMethods __pyx_tp_as_mapping_array = {
22072   __pyx_array___len__, /*mp_length*/
22073   __pyx_array___getitem__, /*mp_subscript*/
22074   __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
22075 };
22076 
22077 static PyBufferProcs __pyx_tp_as_buffer_array = {
22078   #if PY_MAJOR_VERSION < 3
22079   0, /*bf_getreadbuffer*/
22080   #endif
22081   #if PY_MAJOR_VERSION < 3
22082   0, /*bf_getwritebuffer*/
22083   #endif
22084   #if PY_MAJOR_VERSION < 3
22085   0, /*bf_getsegcount*/
22086   #endif
22087   #if PY_MAJOR_VERSION < 3
22088   0, /*bf_getcharbuffer*/
22089   #endif
22090   __pyx_array_getbuffer, /*bf_getbuffer*/
22091   0, /*bf_releasebuffer*/
22092 };
22093 
22094 static PyTypeObject __pyx_type___pyx_array = {
22095   PyVarObject_HEAD_INIT(0, 0)
22096   "yt.utilities.lib.cykdtree.utils.array", /*tp_name*/
22097   sizeof(struct __pyx_array_obj), /*tp_basicsize*/
22098   0, /*tp_itemsize*/
22099   __pyx_tp_dealloc_array, /*tp_dealloc*/
22100   0, /*tp_print*/
22101   0, /*tp_getattr*/
22102   0, /*tp_setattr*/
22103   #if PY_MAJOR_VERSION < 3
22104   0, /*tp_compare*/
22105   #endif
22106   #if PY_MAJOR_VERSION >= 3
22107   0, /*tp_as_async*/
22108   #endif
22109   0, /*tp_repr*/
22110   0, /*tp_as_number*/
22111   &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
22112   &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
22113   0, /*tp_hash*/
22114   0, /*tp_call*/
22115   0, /*tp_str*/
22116   __pyx_tp_getattro_array, /*tp_getattro*/
22117   0, /*tp_setattro*/
22118   &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
22119   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
22120   0, /*tp_doc*/
22121   0, /*tp_traverse*/
22122   0, /*tp_clear*/
22123   0, /*tp_richcompare*/
22124   0, /*tp_weaklistoffset*/
22125   0, /*tp_iter*/
22126   0, /*tp_iternext*/
22127   __pyx_methods_array, /*tp_methods*/
22128   0, /*tp_members*/
22129   __pyx_getsets_array, /*tp_getset*/
22130   0, /*tp_base*/
22131   0, /*tp_dict*/
22132   0, /*tp_descr_get*/
22133   0, /*tp_descr_set*/
22134   0, /*tp_dictoffset*/
22135   0, /*tp_init*/
22136   0, /*tp_alloc*/
22137   __pyx_tp_new_array, /*tp_new*/
22138   0, /*tp_free*/
22139   0, /*tp_is_gc*/
22140   0, /*tp_bases*/
22141   0, /*tp_mro*/
22142   0, /*tp_cache*/
22143   0, /*tp_subclasses*/
22144   0, /*tp_weaklist*/
22145   0, /*tp_del*/
22146   0, /*tp_version_tag*/
22147   #if PY_VERSION_HEX >= 0x030400a1
22148   0, /*tp_finalize*/
22149   #endif
22150   #if PY_VERSION_HEX >= 0x030800b1
22151   0, /*tp_vectorcall*/
22152   #endif
22153 };
22154 
__pyx_tp_new_Enum(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)22155 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
22156   struct __pyx_MemviewEnum_obj *p;
22157   PyObject *o;
22158   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
22159     o = (*t->tp_alloc)(t, 0);
22160   } else {
22161     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
22162   }
22163   if (unlikely(!o)) return 0;
22164   p = ((struct __pyx_MemviewEnum_obj *)o);
22165   p->name = Py_None; Py_INCREF(Py_None);
22166   return o;
22167 }
22168 
__pyx_tp_dealloc_Enum(PyObject * o)22169 static void __pyx_tp_dealloc_Enum(PyObject *o) {
22170   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
22171   #if CYTHON_USE_TP_FINALIZE
22172   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
22173     if (PyObject_CallFinalizerFromDealloc(o)) return;
22174   }
22175   #endif
22176   PyObject_GC_UnTrack(o);
22177   Py_CLEAR(p->name);
22178   (*Py_TYPE(o)->tp_free)(o);
22179 }
22180 
__pyx_tp_traverse_Enum(PyObject * o,visitproc v,void * a)22181 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
22182   int e;
22183   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
22184   if (p->name) {
22185     e = (*v)(p->name, a); if (e) return e;
22186   }
22187   return 0;
22188 }
22189 
__pyx_tp_clear_Enum(PyObject * o)22190 static int __pyx_tp_clear_Enum(PyObject *o) {
22191   PyObject* tmp;
22192   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
22193   tmp = ((PyObject*)p->name);
22194   p->name = Py_None; Py_INCREF(Py_None);
22195   Py_XDECREF(tmp);
22196   return 0;
22197 }
22198 
22199 static PyMethodDef __pyx_methods_Enum[] = {
22200   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
22201   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
22202   {0, 0, 0, 0}
22203 };
22204 
22205 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
22206   PyVarObject_HEAD_INIT(0, 0)
22207   "yt.utilities.lib.cykdtree.utils.Enum", /*tp_name*/
22208   sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
22209   0, /*tp_itemsize*/
22210   __pyx_tp_dealloc_Enum, /*tp_dealloc*/
22211   0, /*tp_print*/
22212   0, /*tp_getattr*/
22213   0, /*tp_setattr*/
22214   #if PY_MAJOR_VERSION < 3
22215   0, /*tp_compare*/
22216   #endif
22217   #if PY_MAJOR_VERSION >= 3
22218   0, /*tp_as_async*/
22219   #endif
22220   __pyx_MemviewEnum___repr__, /*tp_repr*/
22221   0, /*tp_as_number*/
22222   0, /*tp_as_sequence*/
22223   0, /*tp_as_mapping*/
22224   0, /*tp_hash*/
22225   0, /*tp_call*/
22226   0, /*tp_str*/
22227   0, /*tp_getattro*/
22228   0, /*tp_setattro*/
22229   0, /*tp_as_buffer*/
22230   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
22231   0, /*tp_doc*/
22232   __pyx_tp_traverse_Enum, /*tp_traverse*/
22233   __pyx_tp_clear_Enum, /*tp_clear*/
22234   0, /*tp_richcompare*/
22235   0, /*tp_weaklistoffset*/
22236   0, /*tp_iter*/
22237   0, /*tp_iternext*/
22238   __pyx_methods_Enum, /*tp_methods*/
22239   0, /*tp_members*/
22240   0, /*tp_getset*/
22241   0, /*tp_base*/
22242   0, /*tp_dict*/
22243   0, /*tp_descr_get*/
22244   0, /*tp_descr_set*/
22245   0, /*tp_dictoffset*/
22246   __pyx_MemviewEnum___init__, /*tp_init*/
22247   0, /*tp_alloc*/
22248   __pyx_tp_new_Enum, /*tp_new*/
22249   0, /*tp_free*/
22250   0, /*tp_is_gc*/
22251   0, /*tp_bases*/
22252   0, /*tp_mro*/
22253   0, /*tp_cache*/
22254   0, /*tp_subclasses*/
22255   0, /*tp_weaklist*/
22256   0, /*tp_del*/
22257   0, /*tp_version_tag*/
22258   #if PY_VERSION_HEX >= 0x030400a1
22259   0, /*tp_finalize*/
22260   #endif
22261   #if PY_VERSION_HEX >= 0x030800b1
22262   0, /*tp_vectorcall*/
22263   #endif
22264 };
22265 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
22266 
__pyx_tp_new_memoryview(PyTypeObject * t,PyObject * a,PyObject * k)22267 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
22268   struct __pyx_memoryview_obj *p;
22269   PyObject *o;
22270   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
22271     o = (*t->tp_alloc)(t, 0);
22272   } else {
22273     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
22274   }
22275   if (unlikely(!o)) return 0;
22276   p = ((struct __pyx_memoryview_obj *)o);
22277   p->__pyx_vtab = __pyx_vtabptr_memoryview;
22278   p->obj = Py_None; Py_INCREF(Py_None);
22279   p->_size = Py_None; Py_INCREF(Py_None);
22280   p->_array_interface = Py_None; Py_INCREF(Py_None);
22281   p->view.obj = NULL;
22282   if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
22283   return o;
22284   bad:
22285   Py_DECREF(o); o = 0;
22286   return NULL;
22287 }
22288 
__pyx_tp_dealloc_memoryview(PyObject * o)22289 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
22290   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
22291   #if CYTHON_USE_TP_FINALIZE
22292   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
22293     if (PyObject_CallFinalizerFromDealloc(o)) return;
22294   }
22295   #endif
22296   PyObject_GC_UnTrack(o);
22297   {
22298     PyObject *etype, *eval, *etb;
22299     PyErr_Fetch(&etype, &eval, &etb);
22300     ++Py_REFCNT(o);
22301     __pyx_memoryview___dealloc__(o);
22302     --Py_REFCNT(o);
22303     PyErr_Restore(etype, eval, etb);
22304   }
22305   Py_CLEAR(p->obj);
22306   Py_CLEAR(p->_size);
22307   Py_CLEAR(p->_array_interface);
22308   (*Py_TYPE(o)->tp_free)(o);
22309 }
22310 
__pyx_tp_traverse_memoryview(PyObject * o,visitproc v,void * a)22311 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
22312   int e;
22313   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
22314   if (p->obj) {
22315     e = (*v)(p->obj, a); if (e) return e;
22316   }
22317   if (p->_size) {
22318     e = (*v)(p->_size, a); if (e) return e;
22319   }
22320   if (p->_array_interface) {
22321     e = (*v)(p->_array_interface, a); if (e) return e;
22322   }
22323   if (p->view.obj) {
22324     e = (*v)(p->view.obj, a); if (e) return e;
22325   }
22326   return 0;
22327 }
22328 
__pyx_tp_clear_memoryview(PyObject * o)22329 static int __pyx_tp_clear_memoryview(PyObject *o) {
22330   PyObject* tmp;
22331   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
22332   tmp = ((PyObject*)p->obj);
22333   p->obj = Py_None; Py_INCREF(Py_None);
22334   Py_XDECREF(tmp);
22335   tmp = ((PyObject*)p->_size);
22336   p->_size = Py_None; Py_INCREF(Py_None);
22337   Py_XDECREF(tmp);
22338   tmp = ((PyObject*)p->_array_interface);
22339   p->_array_interface = Py_None; Py_INCREF(Py_None);
22340   Py_XDECREF(tmp);
22341   Py_CLEAR(p->view.obj);
22342   return 0;
22343 }
__pyx_sq_item_memoryview(PyObject * o,Py_ssize_t i)22344 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
22345   PyObject *r;
22346   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
22347   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
22348   Py_DECREF(x);
22349   return r;
22350 }
22351 
__pyx_mp_ass_subscript_memoryview(PyObject * o,PyObject * i,PyObject * v)22352 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
22353   if (v) {
22354     return __pyx_memoryview___setitem__(o, i, v);
22355   }
22356   else {
22357     PyErr_Format(PyExc_NotImplementedError,
22358       "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
22359     return -1;
22360   }
22361 }
22362 
__pyx_getprop___pyx_memoryview_T(PyObject * o,CYTHON_UNUSED void * x)22363 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
22364   return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
22365 }
22366 
__pyx_getprop___pyx_memoryview_base(PyObject * o,CYTHON_UNUSED void * x)22367 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
22368   return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
22369 }
22370 
__pyx_getprop___pyx_memoryview_shape(PyObject * o,CYTHON_UNUSED void * x)22371 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
22372   return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
22373 }
22374 
__pyx_getprop___pyx_memoryview_strides(PyObject * o,CYTHON_UNUSED void * x)22375 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
22376   return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
22377 }
22378 
__pyx_getprop___pyx_memoryview_suboffsets(PyObject * o,CYTHON_UNUSED void * x)22379 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
22380   return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
22381 }
22382 
__pyx_getprop___pyx_memoryview_ndim(PyObject * o,CYTHON_UNUSED void * x)22383 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
22384   return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
22385 }
22386 
__pyx_getprop___pyx_memoryview_itemsize(PyObject * o,CYTHON_UNUSED void * x)22387 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
22388   return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
22389 }
22390 
__pyx_getprop___pyx_memoryview_nbytes(PyObject * o,CYTHON_UNUSED void * x)22391 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
22392   return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
22393 }
22394 
__pyx_getprop___pyx_memoryview_size(PyObject * o,CYTHON_UNUSED void * x)22395 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
22396   return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
22397 }
22398 
22399 static PyMethodDef __pyx_methods_memoryview[] = {
22400   {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
22401   {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
22402   {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
22403   {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
22404   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
22405   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
22406   {0, 0, 0, 0}
22407 };
22408 
22409 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
22410   {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
22411   {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
22412   {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
22413   {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
22414   {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
22415   {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
22416   {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
22417   {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
22418   {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
22419   {0, 0, 0, 0, 0}
22420 };
22421 
22422 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
22423   __pyx_memoryview___len__, /*sq_length*/
22424   0, /*sq_concat*/
22425   0, /*sq_repeat*/
22426   __pyx_sq_item_memoryview, /*sq_item*/
22427   0, /*sq_slice*/
22428   0, /*sq_ass_item*/
22429   0, /*sq_ass_slice*/
22430   0, /*sq_contains*/
22431   0, /*sq_inplace_concat*/
22432   0, /*sq_inplace_repeat*/
22433 };
22434 
22435 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
22436   __pyx_memoryview___len__, /*mp_length*/
22437   __pyx_memoryview___getitem__, /*mp_subscript*/
22438   __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
22439 };
22440 
22441 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
22442   #if PY_MAJOR_VERSION < 3
22443   0, /*bf_getreadbuffer*/
22444   #endif
22445   #if PY_MAJOR_VERSION < 3
22446   0, /*bf_getwritebuffer*/
22447   #endif
22448   #if PY_MAJOR_VERSION < 3
22449   0, /*bf_getsegcount*/
22450   #endif
22451   #if PY_MAJOR_VERSION < 3
22452   0, /*bf_getcharbuffer*/
22453   #endif
22454   __pyx_memoryview_getbuffer, /*bf_getbuffer*/
22455   0, /*bf_releasebuffer*/
22456 };
22457 
22458 static PyTypeObject __pyx_type___pyx_memoryview = {
22459   PyVarObject_HEAD_INIT(0, 0)
22460   "yt.utilities.lib.cykdtree.utils.memoryview", /*tp_name*/
22461   sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
22462   0, /*tp_itemsize*/
22463   __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
22464   0, /*tp_print*/
22465   0, /*tp_getattr*/
22466   0, /*tp_setattr*/
22467   #if PY_MAJOR_VERSION < 3
22468   0, /*tp_compare*/
22469   #endif
22470   #if PY_MAJOR_VERSION >= 3
22471   0, /*tp_as_async*/
22472   #endif
22473   __pyx_memoryview___repr__, /*tp_repr*/
22474   0, /*tp_as_number*/
22475   &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
22476   &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
22477   0, /*tp_hash*/
22478   0, /*tp_call*/
22479   __pyx_memoryview___str__, /*tp_str*/
22480   0, /*tp_getattro*/
22481   0, /*tp_setattro*/
22482   &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
22483   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
22484   0, /*tp_doc*/
22485   __pyx_tp_traverse_memoryview, /*tp_traverse*/
22486   __pyx_tp_clear_memoryview, /*tp_clear*/
22487   0, /*tp_richcompare*/
22488   0, /*tp_weaklistoffset*/
22489   0, /*tp_iter*/
22490   0, /*tp_iternext*/
22491   __pyx_methods_memoryview, /*tp_methods*/
22492   0, /*tp_members*/
22493   __pyx_getsets_memoryview, /*tp_getset*/
22494   0, /*tp_base*/
22495   0, /*tp_dict*/
22496   0, /*tp_descr_get*/
22497   0, /*tp_descr_set*/
22498   0, /*tp_dictoffset*/
22499   0, /*tp_init*/
22500   0, /*tp_alloc*/
22501   __pyx_tp_new_memoryview, /*tp_new*/
22502   0, /*tp_free*/
22503   0, /*tp_is_gc*/
22504   0, /*tp_bases*/
22505   0, /*tp_mro*/
22506   0, /*tp_cache*/
22507   0, /*tp_subclasses*/
22508   0, /*tp_weaklist*/
22509   0, /*tp_del*/
22510   0, /*tp_version_tag*/
22511   #if PY_VERSION_HEX >= 0x030400a1
22512   0, /*tp_finalize*/
22513   #endif
22514   #if PY_VERSION_HEX >= 0x030800b1
22515   0, /*tp_vectorcall*/
22516   #endif
22517 };
22518 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
22519 
__pyx_tp_new__memoryviewslice(PyTypeObject * t,PyObject * a,PyObject * k)22520 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
22521   struct __pyx_memoryviewslice_obj *p;
22522   PyObject *o = __pyx_tp_new_memoryview(t, a, k);
22523   if (unlikely(!o)) return 0;
22524   p = ((struct __pyx_memoryviewslice_obj *)o);
22525   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
22526   p->from_object = Py_None; Py_INCREF(Py_None);
22527   p->from_slice.memview = NULL;
22528   return o;
22529 }
22530 
__pyx_tp_dealloc__memoryviewslice(PyObject * o)22531 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
22532   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
22533   #if CYTHON_USE_TP_FINALIZE
22534   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
22535     if (PyObject_CallFinalizerFromDealloc(o)) return;
22536   }
22537   #endif
22538   PyObject_GC_UnTrack(o);
22539   {
22540     PyObject *etype, *eval, *etb;
22541     PyErr_Fetch(&etype, &eval, &etb);
22542     ++Py_REFCNT(o);
22543     __pyx_memoryviewslice___dealloc__(o);
22544     --Py_REFCNT(o);
22545     PyErr_Restore(etype, eval, etb);
22546   }
22547   Py_CLEAR(p->from_object);
22548   PyObject_GC_Track(o);
22549   __pyx_tp_dealloc_memoryview(o);
22550 }
22551 
__pyx_tp_traverse__memoryviewslice(PyObject * o,visitproc v,void * a)22552 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
22553   int e;
22554   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
22555   e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
22556   if (p->from_object) {
22557     e = (*v)(p->from_object, a); if (e) return e;
22558   }
22559   return 0;
22560 }
22561 
__pyx_tp_clear__memoryviewslice(PyObject * o)22562 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
22563   PyObject* tmp;
22564   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
22565   __pyx_tp_clear_memoryview(o);
22566   tmp = ((PyObject*)p->from_object);
22567   p->from_object = Py_None; Py_INCREF(Py_None);
22568   Py_XDECREF(tmp);
22569   __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
22570   return 0;
22571 }
22572 
__pyx_getprop___pyx_memoryviewslice_base(PyObject * o,CYTHON_UNUSED void * x)22573 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
22574   return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
22575 }
22576 
22577 static PyMethodDef __pyx_methods__memoryviewslice[] = {
22578   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
22579   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
22580   {0, 0, 0, 0}
22581 };
22582 
22583 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
22584   {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
22585   {0, 0, 0, 0, 0}
22586 };
22587 
22588 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
22589   PyVarObject_HEAD_INIT(0, 0)
22590   "yt.utilities.lib.cykdtree.utils._memoryviewslice", /*tp_name*/
22591   sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
22592   0, /*tp_itemsize*/
22593   __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
22594   0, /*tp_print*/
22595   0, /*tp_getattr*/
22596   0, /*tp_setattr*/
22597   #if PY_MAJOR_VERSION < 3
22598   0, /*tp_compare*/
22599   #endif
22600   #if PY_MAJOR_VERSION >= 3
22601   0, /*tp_as_async*/
22602   #endif
22603   #if CYTHON_COMPILING_IN_PYPY
22604   __pyx_memoryview___repr__, /*tp_repr*/
22605   #else
22606   0, /*tp_repr*/
22607   #endif
22608   0, /*tp_as_number*/
22609   0, /*tp_as_sequence*/
22610   0, /*tp_as_mapping*/
22611   0, /*tp_hash*/
22612   0, /*tp_call*/
22613   #if CYTHON_COMPILING_IN_PYPY
22614   __pyx_memoryview___str__, /*tp_str*/
22615   #else
22616   0, /*tp_str*/
22617   #endif
22618   0, /*tp_getattro*/
22619   0, /*tp_setattro*/
22620   0, /*tp_as_buffer*/
22621   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
22622   "Internal class for passing memoryview slices to Python", /*tp_doc*/
22623   __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
22624   __pyx_tp_clear__memoryviewslice, /*tp_clear*/
22625   0, /*tp_richcompare*/
22626   0, /*tp_weaklistoffset*/
22627   0, /*tp_iter*/
22628   0, /*tp_iternext*/
22629   __pyx_methods__memoryviewslice, /*tp_methods*/
22630   0, /*tp_members*/
22631   __pyx_getsets__memoryviewslice, /*tp_getset*/
22632   0, /*tp_base*/
22633   0, /*tp_dict*/
22634   0, /*tp_descr_get*/
22635   0, /*tp_descr_set*/
22636   0, /*tp_dictoffset*/
22637   0, /*tp_init*/
22638   0, /*tp_alloc*/
22639   __pyx_tp_new__memoryviewslice, /*tp_new*/
22640   0, /*tp_free*/
22641   0, /*tp_is_gc*/
22642   0, /*tp_bases*/
22643   0, /*tp_mro*/
22644   0, /*tp_cache*/
22645   0, /*tp_subclasses*/
22646   0, /*tp_weaklist*/
22647   0, /*tp_del*/
22648   0, /*tp_version_tag*/
22649   #if PY_VERSION_HEX >= 0x030400a1
22650   0, /*tp_finalize*/
22651   #endif
22652   #if PY_VERSION_HEX >= 0x030800b1
22653   0, /*tp_vectorcall*/
22654   #endif
22655 };
22656 
22657 static PyMethodDef __pyx_methods[] = {
22658   {0, 0, 0, 0}
22659 };
22660 
22661 #if PY_MAJOR_VERSION >= 3
22662 #if CYTHON_PEP489_MULTI_PHASE_INIT
22663 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
22664 static int __pyx_pymod_exec_utils(PyObject* module); /*proto*/
22665 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
22666   {Py_mod_create, (void*)__pyx_pymod_create},
22667   {Py_mod_exec, (void*)__pyx_pymod_exec_utils},
22668   {0, NULL}
22669 };
22670 #endif
22671 
22672 static struct PyModuleDef __pyx_moduledef = {
22673     PyModuleDef_HEAD_INIT,
22674     "utils",
22675     0, /* m_doc */
22676   #if CYTHON_PEP489_MULTI_PHASE_INIT
22677     0, /* m_size */
22678   #else
22679     -1, /* m_size */
22680   #endif
22681     __pyx_methods /* m_methods */,
22682   #if CYTHON_PEP489_MULTI_PHASE_INIT
22683     __pyx_moduledef_slots, /* m_slots */
22684   #else
22685     NULL, /* m_reload */
22686   #endif
22687     NULL, /* m_traverse */
22688     NULL, /* m_clear */
22689     NULL /* m_free */
22690 };
22691 #endif
22692 #ifndef CYTHON_SMALL_CODE
22693 #if defined(__clang__)
22694     #define CYTHON_SMALL_CODE
22695 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
22696     #define CYTHON_SMALL_CODE __attribute__((cold))
22697 #else
22698     #define CYTHON_SMALL_CODE
22699 #endif
22700 #endif
22701 
22702 static __Pyx_StringTabEntry __pyx_string_tab[] = {
22703   {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
22704   {&__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},
22705   {&__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},
22706   {&__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},
22707   {&__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},
22708   {&__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},
22709   {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
22710   {&__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},
22711   {&__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},
22712   {&__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},
22713   {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
22714   {&__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},
22715   {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
22716   {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
22717   {&__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},
22718   {&__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},
22719   {&__pyx_kp_s_Left_index_d_exceeds_size_of_pos, __pyx_k_Left_index_d_exceeds_size_of_pos, sizeof(__pyx_k_Left_index_d_exceeds_size_of_pos), 0, 0, 1, 0},
22720   {&__pyx_n_s_Lidx, __pyx_k_Lidx, sizeof(__pyx_k_Lidx), 0, 0, 1, 1},
22721   {&__pyx_n_s_Lidx0, __pyx_k_Lidx0, sizeof(__pyx_k_Lidx0), 0, 0, 1, 1},
22722   {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
22723   {&__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},
22724   {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
22725   {&__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},
22726   {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
22727   {&__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},
22728   {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
22729   {&__pyx_n_s_Ridx, __pyx_k_Ridx, sizeof(__pyx_k_Ridx), 0, 0, 1, 1},
22730   {&__pyx_n_s_Ridx0, __pyx_k_Ridx0, sizeof(__pyx_k_Ridx0), 0, 0, 1, 1},
22731   {&__pyx_kp_s_Right_index_d_exceeds_size_of_po, __pyx_k_Right_index_d_exceeds_size_of_po, sizeof(__pyx_k_Right_index_d_exceeds_size_of_po), 0, 0, 1, 0},
22732   {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
22733   {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
22734   {&__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},
22735   {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
22736   {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
22737   {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
22738   {&__pyx_n_s_arange, __pyx_k_arange, sizeof(__pyx_k_arange), 0, 0, 1, 1},
22739   {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1},
22740   {&__pyx_n_s_axis, __pyx_k_axis, sizeof(__pyx_k_axis), 0, 0, 1, 1},
22741   {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
22742   {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
22743   {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
22744   {&__pyx_n_s_c_midpoint_flag, __pyx_k_c_midpoint_flag, sizeof(__pyx_k_c_midpoint_flag), 0, 0, 1, 1},
22745   {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
22746   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
22747   {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
22748   {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
22749   {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
22750   {&__pyx_n_s_cout, __pyx_k_cout, sizeof(__pyx_k_cout), 0, 0, 1, 1},
22751   {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
22752   {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
22753   {&__pyx_n_s_dsplit, __pyx_k_dsplit, sizeof(__pyx_k_dsplit), 0, 0, 1, 1},
22754   {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
22755   {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
22756   {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
22757   {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
22758   {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
22759   {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1},
22760   {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
22761   {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
22762   {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
22763   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
22764   {&__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},
22765   {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
22766   {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
22767   {&__pyx_n_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 1},
22768   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
22769   {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
22770   {&__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},
22771   {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1},
22772   {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
22773   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
22774   {&__pyx_n_s_max, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1},
22775   {&__pyx_n_s_maxs, __pyx_k_maxs, sizeof(__pyx_k_maxs), 0, 0, 1, 1},
22776   {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
22777   {&__pyx_n_s_min, __pyx_k_min, sizeof(__pyx_k_min), 0, 0, 1, 1},
22778   {&__pyx_n_s_mins, __pyx_k_mins, sizeof(__pyx_k_mins), 0, 0, 1, 1},
22779   {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
22780   {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
22781   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
22782   {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
22783   {&__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},
22784   {&__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},
22785   {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
22786   {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
22787   {&__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},
22788   {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
22789   {&__pyx_n_s_npts, __pyx_k_npts, sizeof(__pyx_k_npts), 0, 0, 1, 1},
22790   {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
22791   {&__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},
22792   {&__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},
22793   {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
22794   {&__pyx_n_s_out, __pyx_k_out, sizeof(__pyx_k_out), 0, 0, 1, 1},
22795   {&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1},
22796   {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
22797   {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
22798   {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1},
22799   {&__pyx_n_s_ptr_idx, __pyx_k_ptr_idx, sizeof(__pyx_k_ptr_idx), 0, 0, 1, 1},
22800   {&__pyx_n_s_ptr_maxs, __pyx_k_ptr_maxs, sizeof(__pyx_k_ptr_maxs), 0, 0, 1, 1},
22801   {&__pyx_n_s_ptr_mins, __pyx_k_ptr_mins, sizeof(__pyx_k_ptr_mins), 0, 0, 1, 1},
22802   {&__pyx_n_s_ptr_pos, __pyx_k_ptr_pos, sizeof(__pyx_k_ptr_pos), 0, 0, 1, 1},
22803   {&__pyx_n_s_pval, __pyx_k_pval, sizeof(__pyx_k_pval), 0, 0, 1, 1},
22804   {&__pyx_n_s_py_argmax_pts_dim, __pyx_k_py_argmax_pts_dim, sizeof(__pyx_k_py_argmax_pts_dim), 0, 0, 1, 1},
22805   {&__pyx_n_s_py_argmin_pts_dim, __pyx_k_py_argmin_pts_dim, sizeof(__pyx_k_py_argmin_pts_dim), 0, 0, 1, 1},
22806   {&__pyx_n_s_py_insertSort, __pyx_k_py_insertSort, sizeof(__pyx_k_py_insertSort), 0, 0, 1, 1},
22807   {&__pyx_n_s_py_max_pts, __pyx_k_py_max_pts, sizeof(__pyx_k_py_max_pts), 0, 0, 1, 1},
22808   {&__pyx_n_s_py_min_pts, __pyx_k_py_min_pts, sizeof(__pyx_k_py_min_pts), 0, 0, 1, 1},
22809   {&__pyx_n_s_py_partition, __pyx_k_py_partition, sizeof(__pyx_k_py_partition), 0, 0, 1, 1},
22810   {&__pyx_n_s_py_partition_given_pivot, __pyx_k_py_partition_given_pivot, sizeof(__pyx_k_py_partition_given_pivot), 0, 0, 1, 1},
22811   {&__pyx_n_s_py_pivot, __pyx_k_py_pivot, sizeof(__pyx_k_py_pivot), 0, 0, 1, 1},
22812   {&__pyx_n_s_py_quickSort, __pyx_k_py_quickSort, sizeof(__pyx_k_py_quickSort), 0, 0, 1, 1},
22813   {&__pyx_n_s_py_select, __pyx_k_py_select, sizeof(__pyx_k_py_select), 0, 0, 1, 1},
22814   {&__pyx_n_s_py_split, __pyx_k_py_split, sizeof(__pyx_k_py_split), 0, 0, 1, 1},
22815   {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
22816   {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
22817   {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
22818   {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
22819   {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
22820   {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
22821   {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
22822   {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
22823   {&__pyx_n_s_q, __pyx_k_q, sizeof(__pyx_k_q), 0, 0, 1, 1},
22824   {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1},
22825   {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
22826   {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
22827   {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
22828   {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
22829   {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
22830   {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
22831   {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
22832   {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
22833   {&__pyx_n_s_split_val, __pyx_k_split_val, sizeof(__pyx_k_split_val), 0, 0, 1, 1},
22834   {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
22835   {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
22836   {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
22837   {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
22838   {&__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},
22839   {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
22840   {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
22841   {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
22842   {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
22843   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
22844   {&__pyx_n_s_uint64, __pyx_k_uint64, sizeof(__pyx_k_uint64), 0, 0, 1, 1},
22845   {&__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},
22846   {&__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},
22847   {&__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},
22848   {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
22849   {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
22850   {&__pyx_n_s_use_sliding_midpoint, __pyx_k_use_sliding_midpoint, sizeof(__pyx_k_use_sliding_midpoint), 0, 0, 1, 1},
22851   {&__pyx_kp_s_yt_utilities_lib_cykdtree_utils, __pyx_k_yt_utilities_lib_cykdtree_utils, sizeof(__pyx_k_yt_utilities_lib_cykdtree_utils), 0, 0, 1, 0},
22852   {&__pyx_n_s_yt_utilities_lib_cykdtree_utils_2, __pyx_k_yt_utilities_lib_cykdtree_utils_2, sizeof(__pyx_k_yt_utilities_lib_cykdtree_utils_2), 0, 0, 1, 1},
22853   {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
22854   {0, 0, 0, 0, 0, 0, 0}
22855 };
__Pyx_InitCachedBuiltins(void)22856 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
22857   __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 33, __pyx_L1_error)
22858   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 272, __pyx_L1_error)
22859   __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 856, __pyx_L1_error)
22860   __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 1038, __pyx_L1_error)
22861   __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 148, __pyx_L1_error)
22862   __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 151, __pyx_L1_error)
22863   __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error)
22864   __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 400, __pyx_L1_error)
22865   __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 609, __pyx_L1_error)
22866   __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 828, __pyx_L1_error)
22867   return 0;
22868   __pyx_L1_error:;
22869   return -1;
22870 }
22871 
__Pyx_InitCachedConstants(void)22872 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
22873   __Pyx_RefNannyDeclarations
22874   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
22875 
22876   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272
22877  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
22878  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
22879  *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
22880  *
22881  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
22882  */
22883   __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 272, __pyx_L1_error)
22884   __Pyx_GOTREF(__pyx_tuple_);
22885   __Pyx_GIVEREF(__pyx_tuple_);
22886 
22887   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276
22888  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
22889  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
22890  *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
22891  *
22892  *             info.buf = PyArray_DATA(self)
22893  */
22894   __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 276, __pyx_L1_error)
22895   __Pyx_GOTREF(__pyx_tuple__2);
22896   __Pyx_GIVEREF(__pyx_tuple__2);
22897 
22898   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":306
22899  *                 if ((descr.byteorder == c'>' and little_endian) or
22900  *                     (descr.byteorder == c'<' and not little_endian)):
22901  *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
22902  *                 if   t == NPY_BYTE:        f = "b"
22903  *                 elif t == NPY_UBYTE:       f = "B"
22904  */
22905   __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 306, __pyx_L1_error)
22906   __Pyx_GOTREF(__pyx_tuple__3);
22907   __Pyx_GIVEREF(__pyx_tuple__3);
22908 
22909   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856
22910  *
22911  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
22912  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
22913  *
22914  *         if ((child.byteorder == c'>' and little_endian) or
22915  */
22916   __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 856, __pyx_L1_error)
22917   __Pyx_GOTREF(__pyx_tuple__4);
22918   __Pyx_GIVEREF(__pyx_tuple__4);
22919 
22920   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":880
22921  *             t = child.type_num
22922  *             if end - f < 5:
22923  *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
22924  *
22925  *             # Until ticket #99 is fixed, use integers to avoid warnings
22926  */
22927   __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 880, __pyx_L1_error)
22928   __Pyx_GOTREF(__pyx_tuple__5);
22929   __Pyx_GIVEREF(__pyx_tuple__5);
22930 
22931   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1038
22932  *         _import_array()
22933  *     except Exception:
22934  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
22935  *
22936  * cdef inline int import_umath() except -1:
22937  */
22938   __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 1038, __pyx_L1_error)
22939   __Pyx_GOTREF(__pyx_tuple__6);
22940   __Pyx_GIVEREF(__pyx_tuple__6);
22941 
22942   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1044
22943  *         _import_umath()
22944  *     except Exception:
22945  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
22946  *
22947  * cdef inline int import_ufunc() except -1:
22948  */
22949   __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 1044, __pyx_L1_error)
22950   __Pyx_GOTREF(__pyx_tuple__7);
22951   __Pyx_GIVEREF(__pyx_tuple__7);
22952 
22953   /* "View.MemoryView":133
22954  *
22955  *         if not self.ndim:
22956  *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
22957  *
22958  *         if itemsize <= 0:
22959  */
22960   __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 133, __pyx_L1_error)
22961   __Pyx_GOTREF(__pyx_tuple__8);
22962   __Pyx_GIVEREF(__pyx_tuple__8);
22963 
22964   /* "View.MemoryView":136
22965  *
22966  *         if itemsize <= 0:
22967  *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
22968  *
22969  *         if not isinstance(format, bytes):
22970  */
22971   __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 136, __pyx_L1_error)
22972   __Pyx_GOTREF(__pyx_tuple__9);
22973   __Pyx_GIVEREF(__pyx_tuple__9);
22974 
22975   /* "View.MemoryView":148
22976  *
22977  *         if not self._shape:
22978  *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
22979  *
22980  *
22981  */
22982   __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 148, __pyx_L1_error)
22983   __Pyx_GOTREF(__pyx_tuple__10);
22984   __Pyx_GIVEREF(__pyx_tuple__10);
22985 
22986   /* "View.MemoryView":176
22987  *             self.data = <char *>malloc(self.len)
22988  *             if not self.data:
22989  *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
22990  *
22991  *             if self.dtype_is_object:
22992  */
22993   __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 176, __pyx_L1_error)
22994   __Pyx_GOTREF(__pyx_tuple__11);
22995   __Pyx_GIVEREF(__pyx_tuple__11);
22996 
22997   /* "View.MemoryView":192
22998  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
22999  *         if not (flags & bufmode):
23000  *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
23001  *         info.buf = self.data
23002  *         info.len = self.len
23003  */
23004   __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 192, __pyx_L1_error)
23005   __Pyx_GOTREF(__pyx_tuple__12);
23006   __Pyx_GIVEREF(__pyx_tuple__12);
23007 
23008   /* "(tree fragment)":2
23009  * def __reduce_cython__(self):
23010  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
23011  * def __setstate_cython__(self, __pyx_state):
23012  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
23013  */
23014   __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 2, __pyx_L1_error)
23015   __Pyx_GOTREF(__pyx_tuple__13);
23016   __Pyx_GIVEREF(__pyx_tuple__13);
23017 
23018   /* "(tree fragment)":4
23019  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
23020  * def __setstate_cython__(self, __pyx_state):
23021  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
23022  */
23023   __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 4, __pyx_L1_error)
23024   __Pyx_GOTREF(__pyx_tuple__14);
23025   __Pyx_GIVEREF(__pyx_tuple__14);
23026 
23027   /* "View.MemoryView":414
23028  *     def __setitem__(memoryview self, object index, object value):
23029  *         if self.view.readonly:
23030  *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
23031  *
23032  *         have_slices, index = _unellipsify(index, self.view.ndim)
23033  */
23034   __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 414, __pyx_L1_error)
23035   __Pyx_GOTREF(__pyx_tuple__15);
23036   __Pyx_GIVEREF(__pyx_tuple__15);
23037 
23038   /* "View.MemoryView":491
23039  *             result = struct.unpack(self.view.format, bytesitem)
23040  *         except struct.error:
23041  *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
23042  *         else:
23043  *             if len(self.view.format) == 1:
23044  */
23045   __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 491, __pyx_L1_error)
23046   __Pyx_GOTREF(__pyx_tuple__16);
23047   __Pyx_GIVEREF(__pyx_tuple__16);
23048 
23049   /* "View.MemoryView":516
23050  *     def __getbuffer__(self, Py_buffer *info, int flags):
23051  *         if flags & PyBUF_WRITABLE and self.view.readonly:
23052  *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
23053  *
23054  *         if flags & PyBUF_ND:
23055  */
23056   __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 516, __pyx_L1_error)
23057   __Pyx_GOTREF(__pyx_tuple__17);
23058   __Pyx_GIVEREF(__pyx_tuple__17);
23059 
23060   /* "View.MemoryView":566
23061  *         if self.view.strides == NULL:
23062  *
23063  *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
23064  *
23065  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
23066  */
23067   __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 566, __pyx_L1_error)
23068   __Pyx_GOTREF(__pyx_tuple__18);
23069   __Pyx_GIVEREF(__pyx_tuple__18);
23070 
23071   /* "View.MemoryView":573
23072  *     def suboffsets(self):
23073  *         if self.view.suboffsets == NULL:
23074  *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
23075  *
23076  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
23077  */
23078   __pyx_tuple__19 = PyTuple_New(1); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 573, __pyx_L1_error)
23079   __Pyx_GOTREF(__pyx_tuple__19);
23080   __Pyx_INCREF(__pyx_int_neg_1);
23081   __Pyx_GIVEREF(__pyx_int_neg_1);
23082   PyTuple_SET_ITEM(__pyx_tuple__19, 0, __pyx_int_neg_1);
23083   __Pyx_GIVEREF(__pyx_tuple__19);
23084 
23085   /* "(tree fragment)":2
23086  * def __reduce_cython__(self):
23087  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
23088  * def __setstate_cython__(self, __pyx_state):
23089  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
23090  */
23091   __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 2, __pyx_L1_error)
23092   __Pyx_GOTREF(__pyx_tuple__20);
23093   __Pyx_GIVEREF(__pyx_tuple__20);
23094 
23095   /* "(tree fragment)":4
23096  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
23097  * def __setstate_cython__(self, __pyx_state):
23098  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
23099  */
23100   __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 4, __pyx_L1_error)
23101   __Pyx_GOTREF(__pyx_tuple__21);
23102   __Pyx_GIVEREF(__pyx_tuple__21);
23103 
23104   /* "View.MemoryView":678
23105  *         if item is Ellipsis:
23106  *             if not seen_ellipsis:
23107  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
23108  *                 seen_ellipsis = True
23109  *             else:
23110  */
23111   __pyx_slice__22 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__22)) __PYX_ERR(2, 678, __pyx_L1_error)
23112   __Pyx_GOTREF(__pyx_slice__22);
23113   __Pyx_GIVEREF(__pyx_slice__22);
23114 
23115   /* "View.MemoryView":699
23116  *     for suboffset in suboffsets[:ndim]:
23117  *         if suboffset >= 0:
23118  *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
23119  *
23120  *
23121  */
23122   __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 699, __pyx_L1_error)
23123   __Pyx_GOTREF(__pyx_tuple__23);
23124   __Pyx_GIVEREF(__pyx_tuple__23);
23125 
23126   /* "(tree fragment)":2
23127  * def __reduce_cython__(self):
23128  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
23129  * def __setstate_cython__(self, __pyx_state):
23130  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
23131  */
23132   __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 2, __pyx_L1_error)
23133   __Pyx_GOTREF(__pyx_tuple__24);
23134   __Pyx_GIVEREF(__pyx_tuple__24);
23135 
23136   /* "(tree fragment)":4
23137  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
23138  * def __setstate_cython__(self, __pyx_state):
23139  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
23140  */
23141   __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 4, __pyx_L1_error)
23142   __Pyx_GOTREF(__pyx_tuple__25);
23143   __Pyx_GIVEREF(__pyx_tuple__25);
23144 
23145   /* "yt/utilities/lib/cykdtree/utils.pyx":18
23146  *
23147  *
23148  * def py_max_pts(np.ndarray[np.float64_t, ndim=2] pos):             # <<<<<<<<<<<<<<
23149  *     r"""Get the maximum of points along each coordinate.
23150  *
23151  */
23152   __pyx_tuple__26 = PyTuple_Pack(6, __pyx_n_s_pos, __pyx_n_s_n, __pyx_n_s_m, __pyx_n_s_cout, __pyx_n_s_i, __pyx_n_s_out); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 18, __pyx_L1_error)
23153   __Pyx_GOTREF(__pyx_tuple__26);
23154   __Pyx_GIVEREF(__pyx_tuple__26);
23155   __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_cykdtree_utils, __pyx_n_s_py_max_pts, 18, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 18, __pyx_L1_error)
23156 
23157   /* "yt/utilities/lib/cykdtree/utils.pyx":38
23158  *     return out
23159  *
23160  * def py_min_pts(np.ndarray[np.float64_t, ndim=2] pos):             # <<<<<<<<<<<<<<
23161  *     r"""Get the minimum of points along each coordinate.
23162  *
23163  */
23164   __pyx_tuple__28 = PyTuple_Pack(6, __pyx_n_s_pos, __pyx_n_s_n, __pyx_n_s_m, __pyx_n_s_cout, __pyx_n_s_i, __pyx_n_s_out); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 38, __pyx_L1_error)
23165   __Pyx_GOTREF(__pyx_tuple__28);
23166   __Pyx_GIVEREF(__pyx_tuple__28);
23167   __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_cykdtree_utils, __pyx_n_s_py_min_pts, 38, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 38, __pyx_L1_error)
23168 
23169   /* "yt/utilities/lib/cykdtree/utils.pyx":58
23170  *     return out
23171  *
23172  * def py_argmax_pts_dim(np.ndarray[np.float64_t, ndim=2] pos,             # <<<<<<<<<<<<<<
23173  *                       uint64_t[:] idx,
23174  *                       np.uint32_t d, int Lidx0, int Ridx0):
23175  */
23176   __pyx_tuple__30 = PyTuple_Pack(10, __pyx_n_s_pos, __pyx_n_s_idx, __pyx_n_s_d, __pyx_n_s_Lidx0, __pyx_n_s_Ridx0, __pyx_n_s_n, __pyx_n_s_m, __pyx_n_s_Lidx, __pyx_n_s_Ridx, __pyx_n_s_cout); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 58, __pyx_L1_error)
23177   __Pyx_GOTREF(__pyx_tuple__30);
23178   __Pyx_GIVEREF(__pyx_tuple__30);
23179   __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(5, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_cykdtree_utils, __pyx_n_s_py_argmax_pts_dim, 58, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 58, __pyx_L1_error)
23180 
23181   /* "yt/utilities/lib/cykdtree/utils.pyx":99
23182  *     return cout
23183  *
23184  * def py_argmin_pts_dim(np.ndarray[np.float64_t, ndim=2] pos,             # <<<<<<<<<<<<<<
23185  *                       uint64_t[:] idx,
23186  *                       np.uint32_t d, int Lidx0, int Ridx0):
23187  */
23188   __pyx_tuple__32 = PyTuple_Pack(10, __pyx_n_s_pos, __pyx_n_s_idx, __pyx_n_s_d, __pyx_n_s_Lidx0, __pyx_n_s_Ridx0, __pyx_n_s_n, __pyx_n_s_m, __pyx_n_s_Lidx, __pyx_n_s_Ridx, __pyx_n_s_cout); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 99, __pyx_L1_error)
23189   __Pyx_GOTREF(__pyx_tuple__32);
23190   __Pyx_GIVEREF(__pyx_tuple__32);
23191   __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(5, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_cykdtree_utils, __pyx_n_s_py_argmin_pts_dim, 99, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 99, __pyx_L1_error)
23192 
23193   /* "yt/utilities/lib/cykdtree/utils.pyx":134
23194  *     return cout
23195  *
23196  * def py_quickSort(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d):             # <<<<<<<<<<<<<<
23197  *     r"""Get the indices required to sort coordinates along one dimension.
23198  *
23199  */
23200   __pyx_tuple__34 = PyTuple_Pack(8, __pyx_n_s_pos, __pyx_n_s_d, __pyx_n_s_ndim, __pyx_n_s_l, __pyx_n_s_r, __pyx_n_s_idx, __pyx_n_s_ptr_pos, __pyx_n_s_ptr_idx); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 134, __pyx_L1_error)
23201   __Pyx_GOTREF(__pyx_tuple__34);
23202   __Pyx_GIVEREF(__pyx_tuple__34);
23203   __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_cykdtree_utils, __pyx_n_s_py_quickSort, 134, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 134, __pyx_L1_error)
23204 
23205   /* "yt/utilities/lib/cykdtree/utils.pyx":158
23206  *     return idx
23207  *
23208  * def py_insertSort(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d):             # <<<<<<<<<<<<<<
23209  *     r"""Get the indices required to sort coordinates along one dimension.
23210  *
23211  */
23212   __pyx_tuple__36 = PyTuple_Pack(8, __pyx_n_s_pos, __pyx_n_s_d, __pyx_n_s_ndim, __pyx_n_s_l, __pyx_n_s_r, __pyx_n_s_idx, __pyx_n_s_ptr_pos, __pyx_n_s_ptr_idx); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 158, __pyx_L1_error)
23213   __Pyx_GOTREF(__pyx_tuple__36);
23214   __Pyx_GIVEREF(__pyx_tuple__36);
23215   __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_cykdtree_utils, __pyx_n_s_py_insertSort, 158, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 158, __pyx_L1_error)
23216 
23217   /* "yt/utilities/lib/cykdtree/utils.pyx":182
23218  *     return idx
23219  *
23220  * def py_pivot(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d):             # <<<<<<<<<<<<<<
23221  *     r"""Get the index of the median of medians along one dimension and indices
23222  *     that partition pos according to the median of medians.
23223  */
23224   __pyx_tuple__38 = PyTuple_Pack(9, __pyx_n_s_pos, __pyx_n_s_d, __pyx_n_s_ndim, __pyx_n_s_l, __pyx_n_s_r, __pyx_n_s_idx, __pyx_n_s_ptr_pos, __pyx_n_s_ptr_idx, __pyx_n_s_q); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 182, __pyx_L1_error)
23225   __Pyx_GOTREF(__pyx_tuple__38);
23226   __Pyx_GIVEREF(__pyx_tuple__38);
23227   __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_cykdtree_utils, __pyx_n_s_py_pivot, 182, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 182, __pyx_L1_error)
23228 
23229   /* "yt/utilities/lib/cykdtree/utils.pyx":210
23230  *     return q, idx
23231  *
23232  * def py_partition(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d,             # <<<<<<<<<<<<<<
23233  *                  np.int64_t p):
23234  *     r"""Get the indices required to partition coordinates along one dimension.
23235  */
23236   __pyx_tuple__40 = PyTuple_Pack(10, __pyx_n_s_pos, __pyx_n_s_d, __pyx_n_s_p, __pyx_n_s_ndim, __pyx_n_s_l, __pyx_n_s_r, __pyx_n_s_idx, __pyx_n_s_ptr_pos, __pyx_n_s_ptr_idx, __pyx_n_s_q); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 210, __pyx_L1_error)
23237   __Pyx_GOTREF(__pyx_tuple__40);
23238   __Pyx_GIVEREF(__pyx_tuple__40);
23239   __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_cykdtree_utils, __pyx_n_s_py_partition, 210, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 210, __pyx_L1_error)
23240 
23241   /* "yt/utilities/lib/cykdtree/utils.pyx":240
23242  *     return q, idx
23243  *
23244  * def py_partition_given_pivot(np.ndarray[np.float64_t, ndim=2] pos,             # <<<<<<<<<<<<<<
23245  *                              np.uint32_t d, np.float64_t pval):
23246  *     r"""Get the indices required to partition coordinates along one dimension.
23247  */
23248   __pyx_tuple__42 = PyTuple_Pack(10, __pyx_n_s_pos, __pyx_n_s_d, __pyx_n_s_pval, __pyx_n_s_ndim, __pyx_n_s_l, __pyx_n_s_r, __pyx_n_s_idx, __pyx_n_s_ptr_pos, __pyx_n_s_ptr_idx, __pyx_n_s_q); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 240, __pyx_L1_error)
23249   __Pyx_GOTREF(__pyx_tuple__42);
23250   __Pyx_GIVEREF(__pyx_tuple__42);
23251   __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_cykdtree_utils, __pyx_n_s_py_partition_given_pivot, 240, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 240, __pyx_L1_error)
23252 
23253   /* "yt/utilities/lib/cykdtree/utils.pyx":270
23254  *     return q, idx
23255  *
23256  * def py_select(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d,             # <<<<<<<<<<<<<<
23257  *               np.int64_t t):
23258  *     r"""Get the indices required to partition coordiantes such that the first
23259  */
23260   __pyx_tuple__44 = PyTuple_Pack(10, __pyx_n_s_pos, __pyx_n_s_d, __pyx_n_s_t, __pyx_n_s_ndim, __pyx_n_s_l, __pyx_n_s_r, __pyx_n_s_idx, __pyx_n_s_ptr_pos, __pyx_n_s_ptr_idx, __pyx_n_s_q); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 270, __pyx_L1_error)
23261   __Pyx_GOTREF(__pyx_tuple__44);
23262   __Pyx_GIVEREF(__pyx_tuple__44);
23263   __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_cykdtree_utils, __pyx_n_s_py_select, 270, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 270, __pyx_L1_error)
23264 
23265   /* "yt/utilities/lib/cykdtree/utils.pyx":302
23266  *
23267  *
23268  * def py_split(np.ndarray[np.float64_t, ndim=2] pos,             # <<<<<<<<<<<<<<
23269  *              np.ndarray[np.float64_t, ndim=1] mins = None,
23270  *              np.ndarray[np.float64_t, ndim=1] maxs = None,
23271  */
23272   __pyx_tuple__46 = PyTuple_Pack(16, __pyx_n_s_pos, __pyx_n_s_mins, __pyx_n_s_maxs, __pyx_n_s_use_sliding_midpoint, __pyx_n_s_npts, __pyx_n_s_ndim, __pyx_n_s_Lidx, __pyx_n_s_idx, __pyx_n_s_ptr_pos, __pyx_n_s_ptr_idx, __pyx_n_s_ptr_mins, __pyx_n_s_ptr_maxs, __pyx_n_s_q, __pyx_n_s_split_val, __pyx_n_s_c_midpoint_flag, __pyx_n_s_dsplit); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 302, __pyx_L1_error)
23273   __Pyx_GOTREF(__pyx_tuple__46);
23274   __Pyx_GIVEREF(__pyx_tuple__46);
23275   __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(4, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_cykdtree_utils, __pyx_n_s_py_split, 302, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 302, __pyx_L1_error)
23276 
23277   /* "View.MemoryView":286
23278  *         return self.name
23279  *
23280  * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
23281  * cdef strided = Enum("<strided and direct>") # default
23282  * cdef indirect = Enum("<strided and indirect>")
23283  */
23284   __pyx_tuple__48 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(2, 286, __pyx_L1_error)
23285   __Pyx_GOTREF(__pyx_tuple__48);
23286   __Pyx_GIVEREF(__pyx_tuple__48);
23287 
23288   /* "View.MemoryView":287
23289  *
23290  * cdef generic = Enum("<strided and direct or indirect>")
23291  * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
23292  * cdef indirect = Enum("<strided and indirect>")
23293  *
23294  */
23295   __pyx_tuple__49 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(2, 287, __pyx_L1_error)
23296   __Pyx_GOTREF(__pyx_tuple__49);
23297   __Pyx_GIVEREF(__pyx_tuple__49);
23298 
23299   /* "View.MemoryView":288
23300  * cdef generic = Enum("<strided and direct or indirect>")
23301  * cdef strided = Enum("<strided and direct>") # default
23302  * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
23303  *
23304  *
23305  */
23306   __pyx_tuple__50 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(2, 288, __pyx_L1_error)
23307   __Pyx_GOTREF(__pyx_tuple__50);
23308   __Pyx_GIVEREF(__pyx_tuple__50);
23309 
23310   /* "View.MemoryView":291
23311  *
23312  *
23313  * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
23314  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
23315  *
23316  */
23317   __pyx_tuple__51 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(2, 291, __pyx_L1_error)
23318   __Pyx_GOTREF(__pyx_tuple__51);
23319   __Pyx_GIVEREF(__pyx_tuple__51);
23320 
23321   /* "View.MemoryView":292
23322  *
23323  * cdef contiguous = Enum("<contiguous and direct>")
23324  * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
23325  *
23326  *
23327  */
23328   __pyx_tuple__52 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(2, 292, __pyx_L1_error)
23329   __Pyx_GOTREF(__pyx_tuple__52);
23330   __Pyx_GIVEREF(__pyx_tuple__52);
23331 
23332   /* "(tree fragment)":1
23333  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
23334  *     cdef object __pyx_PickleError
23335  *     cdef object __pyx_result
23336  */
23337   __pyx_tuple__53 = 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__53)) __PYX_ERR(2, 1, __pyx_L1_error)
23338   __Pyx_GOTREF(__pyx_tuple__53);
23339   __Pyx_GIVEREF(__pyx_tuple__53);
23340   __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(2, 1, __pyx_L1_error)
23341   __Pyx_RefNannyFinishContext();
23342   return 0;
23343   __pyx_L1_error:;
23344   __Pyx_RefNannyFinishContext();
23345   return -1;
23346 }
23347 
__Pyx_InitGlobals(void)23348 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
23349   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
23350   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
23351   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
23352   __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
23353   __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
23354   return 0;
23355   __pyx_L1_error:;
23356   return -1;
23357 }
23358 
23359 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
23360 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
23361 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
23362 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
23363 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
23364 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
23365 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
23366 
__Pyx_modinit_global_init_code(void)23367 static int __Pyx_modinit_global_init_code(void) {
23368   __Pyx_RefNannyDeclarations
23369   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
23370   /*--- Global init code ---*/
23371   generic = Py_None; Py_INCREF(Py_None);
23372   strided = Py_None; Py_INCREF(Py_None);
23373   indirect = Py_None; Py_INCREF(Py_None);
23374   contiguous = Py_None; Py_INCREF(Py_None);
23375   indirect_contiguous = Py_None; Py_INCREF(Py_None);
23376   __Pyx_RefNannyFinishContext();
23377   return 0;
23378 }
23379 
__Pyx_modinit_variable_export_code(void)23380 static int __Pyx_modinit_variable_export_code(void) {
23381   __Pyx_RefNannyDeclarations
23382   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
23383   /*--- Variable export code ---*/
23384   __Pyx_RefNannyFinishContext();
23385   return 0;
23386 }
23387 
__Pyx_modinit_function_export_code(void)23388 static int __Pyx_modinit_function_export_code(void) {
23389   __Pyx_RefNannyDeclarations
23390   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
23391   /*--- Function export code ---*/
23392   __Pyx_RefNannyFinishContext();
23393   return 0;
23394 }
23395 
__Pyx_modinit_type_init_code(void)23396 static int __Pyx_modinit_type_init_code(void) {
23397   __Pyx_RefNannyDeclarations
23398   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
23399   /*--- Type init code ---*/
23400   __pyx_vtabptr_array = &__pyx_vtable_array;
23401   __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
23402   if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
23403   #if PY_VERSION_HEX < 0x030800B1
23404   __pyx_type___pyx_array.tp_print = 0;
23405   #endif
23406   if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
23407   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
23408   __pyx_array_type = &__pyx_type___pyx_array;
23409   if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
23410   #if PY_VERSION_HEX < 0x030800B1
23411   __pyx_type___pyx_MemviewEnum.tp_print = 0;
23412   #endif
23413   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
23414     __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
23415   }
23416   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
23417   __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
23418   __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
23419   __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
23420   __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
23421   __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
23422   __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
23423   __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
23424   __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
23425   __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
23426   if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
23427   #if PY_VERSION_HEX < 0x030800B1
23428   __pyx_type___pyx_memoryview.tp_print = 0;
23429   #endif
23430   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
23431     __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
23432   }
23433   if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
23434   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
23435   __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
23436   __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
23437   __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
23438   __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
23439   __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
23440   __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
23441   if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 961, __pyx_L1_error)
23442   #if PY_VERSION_HEX < 0x030800B1
23443   __pyx_type___pyx_memoryviewslice.tp_print = 0;
23444   #endif
23445   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
23446     __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
23447   }
23448   if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 961, __pyx_L1_error)
23449   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 961, __pyx_L1_error)
23450   __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
23451   __Pyx_RefNannyFinishContext();
23452   return 0;
23453   __pyx_L1_error:;
23454   __Pyx_RefNannyFinishContext();
23455   return -1;
23456 }
23457 
__Pyx_modinit_type_import_code(void)23458 static int __Pyx_modinit_type_import_code(void) {
23459   __Pyx_RefNannyDeclarations
23460   PyObject *__pyx_t_1 = NULL;
23461   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
23462   /*--- Type import code ---*/
23463   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
23464   __Pyx_GOTREF(__pyx_t_1);
23465   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
23466   #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
23467   sizeof(PyTypeObject),
23468   #else
23469   sizeof(PyHeapTypeObject),
23470   #endif
23471   __Pyx_ImportType_CheckSize_Warn);
23472    if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
23473   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23474   __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 206, __pyx_L1_error)
23475   __Pyx_GOTREF(__pyx_t_1);
23476   __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
23477    if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 206, __pyx_L1_error)
23478   __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn);
23479    if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 229, __pyx_L1_error)
23480   __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn);
23481    if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 233, __pyx_L1_error)
23482   __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
23483    if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 242, __pyx_L1_error)
23484   __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn);
23485    if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 918, __pyx_L1_error)
23486   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23487   __Pyx_RefNannyFinishContext();
23488   return 0;
23489   __pyx_L1_error:;
23490   __Pyx_XDECREF(__pyx_t_1);
23491   __Pyx_RefNannyFinishContext();
23492   return -1;
23493 }
23494 
__Pyx_modinit_variable_import_code(void)23495 static int __Pyx_modinit_variable_import_code(void) {
23496   __Pyx_RefNannyDeclarations
23497   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
23498   /*--- Variable import code ---*/
23499   __Pyx_RefNannyFinishContext();
23500   return 0;
23501 }
23502 
__Pyx_modinit_function_import_code(void)23503 static int __Pyx_modinit_function_import_code(void) {
23504   __Pyx_RefNannyDeclarations
23505   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
23506   /*--- Function import code ---*/
23507   __Pyx_RefNannyFinishContext();
23508   return 0;
23509 }
23510 
23511 
23512 #if PY_MAJOR_VERSION < 3
23513 #ifdef CYTHON_NO_PYINIT_EXPORT
23514 #define __Pyx_PyMODINIT_FUNC void
23515 #else
23516 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
23517 #endif
23518 #else
23519 #ifdef CYTHON_NO_PYINIT_EXPORT
23520 #define __Pyx_PyMODINIT_FUNC PyObject *
23521 #else
23522 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
23523 #endif
23524 #endif
23525 
23526 
23527 #if PY_MAJOR_VERSION < 3
23528 __Pyx_PyMODINIT_FUNC initutils(void) CYTHON_SMALL_CODE; /*proto*/
initutils(void)23529 __Pyx_PyMODINIT_FUNC initutils(void)
23530 #else
23531 __Pyx_PyMODINIT_FUNC PyInit_utils(void) CYTHON_SMALL_CODE; /*proto*/
23532 __Pyx_PyMODINIT_FUNC PyInit_utils(void)
23533 #if CYTHON_PEP489_MULTI_PHASE_INIT
23534 {
23535   return PyModuleDef_Init(&__pyx_moduledef);
23536 }
23537 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
23538     #if PY_VERSION_HEX >= 0x030700A1
23539     static PY_INT64_T main_interpreter_id = -1;
23540     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
23541     if (main_interpreter_id == -1) {
23542         main_interpreter_id = current_id;
23543         return (unlikely(current_id == -1)) ? -1 : 0;
23544     } else if (unlikely(main_interpreter_id != current_id))
23545     #else
23546     static PyInterpreterState *main_interpreter = NULL;
23547     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
23548     if (!main_interpreter) {
23549         main_interpreter = current_interpreter;
23550     } else if (unlikely(main_interpreter != current_interpreter))
23551     #endif
23552     {
23553         PyErr_SetString(
23554             PyExc_ImportError,
23555             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
23556         return -1;
23557     }
23558     return 0;
23559 }
23560 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) {
23561     PyObject *value = PyObject_GetAttrString(spec, from_name);
23562     int result = 0;
23563     if (likely(value)) {
23564         if (allow_none || value != Py_None) {
23565             result = PyDict_SetItemString(moddict, to_name, value);
23566         }
23567         Py_DECREF(value);
23568     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
23569         PyErr_Clear();
23570     } else {
23571         result = -1;
23572     }
23573     return result;
23574 }
23575 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
23576     PyObject *module = NULL, *moddict, *modname;
23577     if (__Pyx_check_single_interpreter())
23578         return NULL;
23579     if (__pyx_m)
23580         return __Pyx_NewRef(__pyx_m);
23581     modname = PyObject_GetAttrString(spec, "name");
23582     if (unlikely(!modname)) goto bad;
23583     module = PyModule_NewObject(modname);
23584     Py_DECREF(modname);
23585     if (unlikely(!module)) goto bad;
23586     moddict = PyModule_GetDict(module);
23587     if (unlikely(!moddict)) goto bad;
23588     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
23589     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
23590     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
23591     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
23592     return module;
23593 bad:
23594     Py_XDECREF(module);
23595     return NULL;
23596 }
23597 
23598 
23599 static CYTHON_SMALL_CODE int __pyx_pymod_exec_utils(PyObject *__pyx_pyinit_module)
23600 #endif
23601 #endif
23602 {
23603   PyObject *__pyx_t_1 = NULL;
23604   static PyThread_type_lock __pyx_t_2[8];
23605   __Pyx_RefNannyDeclarations
23606   #if CYTHON_PEP489_MULTI_PHASE_INIT
23607   if (__pyx_m) {
23608     if (__pyx_m == __pyx_pyinit_module) return 0;
23609     PyErr_SetString(PyExc_RuntimeError, "Module 'utils' has already been imported. Re-initialisation is not supported.");
23610     return -1;
23611   }
23612   #elif PY_MAJOR_VERSION >= 3
23613   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
23614   #endif
23615   #if CYTHON_REFNANNY
23616 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
23617 if (!__Pyx_RefNanny) {
23618   PyErr_Clear();
23619   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
23620   if (!__Pyx_RefNanny)
23621       Py_FatalError("failed to import 'refnanny' module");
23622 }
23623 #endif
23624   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_utils(void)", 0);
23625   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23626   #ifdef __Pxy_PyFrame_Initialize_Offsets
23627   __Pxy_PyFrame_Initialize_Offsets();
23628   #endif
23629   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
23630   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
23631   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
23632   #ifdef __Pyx_CyFunction_USED
23633   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23634   #endif
23635   #ifdef __Pyx_FusedFunction_USED
23636   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23637   #endif
23638   #ifdef __Pyx_Coroutine_USED
23639   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23640   #endif
23641   #ifdef __Pyx_Generator_USED
23642   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23643   #endif
23644   #ifdef __Pyx_AsyncGen_USED
23645   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23646   #endif
23647   #ifdef __Pyx_StopAsyncIteration_USED
23648   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23649   #endif
23650   /*--- Library function declarations ---*/
23651   /*--- Threads initialization code ---*/
23652   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
23653   #ifdef WITH_THREAD /* Python build with threading support? */
23654   PyEval_InitThreads();
23655   #endif
23656   #endif
23657   /*--- Module creation code ---*/
23658   #if CYTHON_PEP489_MULTI_PHASE_INIT
23659   __pyx_m = __pyx_pyinit_module;
23660   Py_INCREF(__pyx_m);
23661   #else
23662   #if PY_MAJOR_VERSION < 3
23663   __pyx_m = Py_InitModule4("utils", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
23664   #else
23665   __pyx_m = PyModule_Create(&__pyx_moduledef);
23666   #endif
23667   if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
23668   #endif
23669   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
23670   Py_INCREF(__pyx_d);
23671   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
23672   Py_INCREF(__pyx_b);
23673   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
23674   Py_INCREF(__pyx_cython_runtime);
23675   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
23676   /*--- Initialize various global constants etc. ---*/
23677   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23678   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
23679   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23680   #endif
23681   if (__pyx_module_is_main_yt__utilities__lib__cykdtree__utils) {
23682     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23683   }
23684   #if PY_MAJOR_VERSION >= 3
23685   {
23686     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
23687     if (!PyDict_GetItemString(modules, "yt.utilities.lib.cykdtree.utils")) {
23688       if (unlikely(PyDict_SetItemString(modules, "yt.utilities.lib.cykdtree.utils", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
23689     }
23690   }
23691   #endif
23692   /*--- Builtin init code ---*/
23693   if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error;
23694   /*--- Constants init code ---*/
23695   if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error;
23696   /*--- Global type/function init code ---*/
23697   (void)__Pyx_modinit_global_init_code();
23698   (void)__Pyx_modinit_variable_export_code();
23699   (void)__Pyx_modinit_function_export_code();
23700   if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
23701   if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
23702   (void)__Pyx_modinit_variable_import_code();
23703   (void)__Pyx_modinit_function_import_code();
23704   /*--- Execution code ---*/
23705   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
23706   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23707   #endif
23708 
23709   /* "yt/utilities/lib/cykdtree/utils.pyx":6
23710  * # distutils: language = c++
23711  * # distutils: extra_compile_args = CPP03_FLAG
23712  * import numpy as np             # <<<<<<<<<<<<<<
23713  *
23714  * cimport cython
23715  */
23716   __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
23717   __Pyx_GOTREF(__pyx_t_1);
23718   if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
23719   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23720 
23721   /* "yt/utilities/lib/cykdtree/utils.pyx":15
23722  * from libcpp.vector cimport vector
23723  *
23724  * import copy             # <<<<<<<<<<<<<<
23725  *
23726  *
23727  */
23728   __pyx_t_1 = __Pyx_Import(__pyx_n_s_copy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
23729   __Pyx_GOTREF(__pyx_t_1);
23730   if (PyDict_SetItem(__pyx_d, __pyx_n_s_copy, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
23731   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23732 
23733   /* "yt/utilities/lib/cykdtree/utils.pyx":18
23734  *
23735  *
23736  * def py_max_pts(np.ndarray[np.float64_t, ndim=2] pos):             # <<<<<<<<<<<<<<
23737  *     r"""Get the maximum of points along each coordinate.
23738  *
23739  */
23740   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_8cykdtree_5utils_1py_max_pts, NULL, __pyx_n_s_yt_utilities_lib_cykdtree_utils_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
23741   __Pyx_GOTREF(__pyx_t_1);
23742   if (PyDict_SetItem(__pyx_d, __pyx_n_s_py_max_pts, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
23743   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23744 
23745   /* "yt/utilities/lib/cykdtree/utils.pyx":38
23746  *     return out
23747  *
23748  * def py_min_pts(np.ndarray[np.float64_t, ndim=2] pos):             # <<<<<<<<<<<<<<
23749  *     r"""Get the minimum of points along each coordinate.
23750  *
23751  */
23752   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_8cykdtree_5utils_3py_min_pts, NULL, __pyx_n_s_yt_utilities_lib_cykdtree_utils_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
23753   __Pyx_GOTREF(__pyx_t_1);
23754   if (PyDict_SetItem(__pyx_d, __pyx_n_s_py_min_pts, __pyx_t_1) < 0) __PYX_ERR(0, 38, __pyx_L1_error)
23755   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23756 
23757   /* "yt/utilities/lib/cykdtree/utils.pyx":58
23758  *     return out
23759  *
23760  * def py_argmax_pts_dim(np.ndarray[np.float64_t, ndim=2] pos,             # <<<<<<<<<<<<<<
23761  *                       uint64_t[:] idx,
23762  *                       np.uint32_t d, int Lidx0, int Ridx0):
23763  */
23764   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_8cykdtree_5utils_5py_argmax_pts_dim, NULL, __pyx_n_s_yt_utilities_lib_cykdtree_utils_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error)
23765   __Pyx_GOTREF(__pyx_t_1);
23766   if (PyDict_SetItem(__pyx_d, __pyx_n_s_py_argmax_pts_dim, __pyx_t_1) < 0) __PYX_ERR(0, 58, __pyx_L1_error)
23767   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23768 
23769   /* "yt/utilities/lib/cykdtree/utils.pyx":99
23770  *     return cout
23771  *
23772  * def py_argmin_pts_dim(np.ndarray[np.float64_t, ndim=2] pos,             # <<<<<<<<<<<<<<
23773  *                       uint64_t[:] idx,
23774  *                       np.uint32_t d, int Lidx0, int Ridx0):
23775  */
23776   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_8cykdtree_5utils_7py_argmin_pts_dim, NULL, __pyx_n_s_yt_utilities_lib_cykdtree_utils_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
23777   __Pyx_GOTREF(__pyx_t_1);
23778   if (PyDict_SetItem(__pyx_d, __pyx_n_s_py_argmin_pts_dim, __pyx_t_1) < 0) __PYX_ERR(0, 99, __pyx_L1_error)
23779   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23780 
23781   /* "yt/utilities/lib/cykdtree/utils.pyx":134
23782  *     return cout
23783  *
23784  * def py_quickSort(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d):             # <<<<<<<<<<<<<<
23785  *     r"""Get the indices required to sort coordinates along one dimension.
23786  *
23787  */
23788   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_8cykdtree_5utils_9py_quickSort, NULL, __pyx_n_s_yt_utilities_lib_cykdtree_utils_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error)
23789   __Pyx_GOTREF(__pyx_t_1);
23790   if (PyDict_SetItem(__pyx_d, __pyx_n_s_py_quickSort, __pyx_t_1) < 0) __PYX_ERR(0, 134, __pyx_L1_error)
23791   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23792 
23793   /* "yt/utilities/lib/cykdtree/utils.pyx":158
23794  *     return idx
23795  *
23796  * def py_insertSort(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d):             # <<<<<<<<<<<<<<
23797  *     r"""Get the indices required to sort coordinates along one dimension.
23798  *
23799  */
23800   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_8cykdtree_5utils_11py_insertSort, NULL, __pyx_n_s_yt_utilities_lib_cykdtree_utils_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error)
23801   __Pyx_GOTREF(__pyx_t_1);
23802   if (PyDict_SetItem(__pyx_d, __pyx_n_s_py_insertSort, __pyx_t_1) < 0) __PYX_ERR(0, 158, __pyx_L1_error)
23803   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23804 
23805   /* "yt/utilities/lib/cykdtree/utils.pyx":182
23806  *     return idx
23807  *
23808  * def py_pivot(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d):             # <<<<<<<<<<<<<<
23809  *     r"""Get the index of the median of medians along one dimension and indices
23810  *     that partition pos according to the median of medians.
23811  */
23812   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_8cykdtree_5utils_13py_pivot, NULL, __pyx_n_s_yt_utilities_lib_cykdtree_utils_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error)
23813   __Pyx_GOTREF(__pyx_t_1);
23814   if (PyDict_SetItem(__pyx_d, __pyx_n_s_py_pivot, __pyx_t_1) < 0) __PYX_ERR(0, 182, __pyx_L1_error)
23815   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23816 
23817   /* "yt/utilities/lib/cykdtree/utils.pyx":210
23818  *     return q, idx
23819  *
23820  * def py_partition(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d,             # <<<<<<<<<<<<<<
23821  *                  np.int64_t p):
23822  *     r"""Get the indices required to partition coordinates along one dimension.
23823  */
23824   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_8cykdtree_5utils_15py_partition, NULL, __pyx_n_s_yt_utilities_lib_cykdtree_utils_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error)
23825   __Pyx_GOTREF(__pyx_t_1);
23826   if (PyDict_SetItem(__pyx_d, __pyx_n_s_py_partition, __pyx_t_1) < 0) __PYX_ERR(0, 210, __pyx_L1_error)
23827   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23828 
23829   /* "yt/utilities/lib/cykdtree/utils.pyx":240
23830  *     return q, idx
23831  *
23832  * def py_partition_given_pivot(np.ndarray[np.float64_t, ndim=2] pos,             # <<<<<<<<<<<<<<
23833  *                              np.uint32_t d, np.float64_t pval):
23834  *     r"""Get the indices required to partition coordinates along one dimension.
23835  */
23836   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_8cykdtree_5utils_17py_partition_given_pivot, NULL, __pyx_n_s_yt_utilities_lib_cykdtree_utils_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error)
23837   __Pyx_GOTREF(__pyx_t_1);
23838   if (PyDict_SetItem(__pyx_d, __pyx_n_s_py_partition_given_pivot, __pyx_t_1) < 0) __PYX_ERR(0, 240, __pyx_L1_error)
23839   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23840 
23841   /* "yt/utilities/lib/cykdtree/utils.pyx":270
23842  *     return q, idx
23843  *
23844  * def py_select(np.ndarray[np.float64_t, ndim=2] pos, np.uint32_t d,             # <<<<<<<<<<<<<<
23845  *               np.int64_t t):
23846  *     r"""Get the indices required to partition coordiantes such that the first
23847  */
23848   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_8cykdtree_5utils_19py_select, NULL, __pyx_n_s_yt_utilities_lib_cykdtree_utils_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error)
23849   __Pyx_GOTREF(__pyx_t_1);
23850   if (PyDict_SetItem(__pyx_d, __pyx_n_s_py_select, __pyx_t_1) < 0) __PYX_ERR(0, 270, __pyx_L1_error)
23851   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23852 
23853   /* "yt/utilities/lib/cykdtree/utils.pyx":302
23854  *
23855  *
23856  * def py_split(np.ndarray[np.float64_t, ndim=2] pos,             # <<<<<<<<<<<<<<
23857  *              np.ndarray[np.float64_t, ndim=1] mins = None,
23858  *              np.ndarray[np.float64_t, ndim=1] maxs = None,
23859  */
23860   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_8cykdtree_5utils_21py_split, NULL, __pyx_n_s_yt_utilities_lib_cykdtree_utils_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error)
23861   __Pyx_GOTREF(__pyx_t_1);
23862   if (PyDict_SetItem(__pyx_d, __pyx_n_s_py_split, __pyx_t_1) < 0) __PYX_ERR(0, 302, __pyx_L1_error)
23863   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23864 
23865   /* "yt/utilities/lib/cykdtree/utils.pyx":1
23866  * # distutils: libraries = STD_LIBS             # <<<<<<<<<<<<<<
23867  * # distutils: sources = yt/utilities/lib/cykdtree/c_utils.cpp
23868  * # distutils: depends = yt/utilities/lib/cykdtree/c_utils.hpp
23869  */
23870   __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
23871   __Pyx_GOTREF(__pyx_t_1);
23872   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23873   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23874 
23875   /* "View.MemoryView":209
23876  *         info.obj = self
23877  *
23878  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
23879  *
23880  *     def __dealloc__(array self):
23881  */
23882   __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 209, __pyx_L1_error)
23883   __Pyx_GOTREF(__pyx_t_1);
23884   if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 209, __pyx_L1_error)
23885   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23886   PyType_Modified(__pyx_array_type);
23887 
23888   /* "View.MemoryView":286
23889  *         return self.name
23890  *
23891  * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
23892  * cdef strided = Enum("<strided and direct>") # default
23893  * cdef indirect = Enum("<strided and indirect>")
23894  */
23895   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__48, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 286, __pyx_L1_error)
23896   __Pyx_GOTREF(__pyx_t_1);
23897   __Pyx_XGOTREF(generic);
23898   __Pyx_DECREF_SET(generic, __pyx_t_1);
23899   __Pyx_GIVEREF(__pyx_t_1);
23900   __pyx_t_1 = 0;
23901 
23902   /* "View.MemoryView":287
23903  *
23904  * cdef generic = Enum("<strided and direct or indirect>")
23905  * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
23906  * cdef indirect = Enum("<strided and indirect>")
23907  *
23908  */
23909   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 287, __pyx_L1_error)
23910   __Pyx_GOTREF(__pyx_t_1);
23911   __Pyx_XGOTREF(strided);
23912   __Pyx_DECREF_SET(strided, __pyx_t_1);
23913   __Pyx_GIVEREF(__pyx_t_1);
23914   __pyx_t_1 = 0;
23915 
23916   /* "View.MemoryView":288
23917  * cdef generic = Enum("<strided and direct or indirect>")
23918  * cdef strided = Enum("<strided and direct>") # default
23919  * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
23920  *
23921  *
23922  */
23923   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__50, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 288, __pyx_L1_error)
23924   __Pyx_GOTREF(__pyx_t_1);
23925   __Pyx_XGOTREF(indirect);
23926   __Pyx_DECREF_SET(indirect, __pyx_t_1);
23927   __Pyx_GIVEREF(__pyx_t_1);
23928   __pyx_t_1 = 0;
23929 
23930   /* "View.MemoryView":291
23931  *
23932  *
23933  * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
23934  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
23935  *
23936  */
23937   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__51, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 291, __pyx_L1_error)
23938   __Pyx_GOTREF(__pyx_t_1);
23939   __Pyx_XGOTREF(contiguous);
23940   __Pyx_DECREF_SET(contiguous, __pyx_t_1);
23941   __Pyx_GIVEREF(__pyx_t_1);
23942   __pyx_t_1 = 0;
23943 
23944   /* "View.MemoryView":292
23945  *
23946  * cdef contiguous = Enum("<contiguous and direct>")
23947  * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
23948  *
23949  *
23950  */
23951   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__52, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 292, __pyx_L1_error)
23952   __Pyx_GOTREF(__pyx_t_1);
23953   __Pyx_XGOTREF(indirect_contiguous);
23954   __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
23955   __Pyx_GIVEREF(__pyx_t_1);
23956   __pyx_t_1 = 0;
23957 
23958   /* "View.MemoryView":316
23959  *
23960  * DEF THREAD_LOCKS_PREALLOCATED = 8
23961  * cdef int __pyx_memoryview_thread_locks_used = 0             # <<<<<<<<<<<<<<
23962  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
23963  *     PyThread_allocate_lock(),
23964  */
23965   __pyx_memoryview_thread_locks_used = 0;
23966 
23967   /* "View.MemoryView":317
23968  * DEF THREAD_LOCKS_PREALLOCATED = 8
23969  * cdef int __pyx_memoryview_thread_locks_used = 0
23970  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [             # <<<<<<<<<<<<<<
23971  *     PyThread_allocate_lock(),
23972  *     PyThread_allocate_lock(),
23973  */
23974   __pyx_t_2[0] = PyThread_allocate_lock();
23975   __pyx_t_2[1] = PyThread_allocate_lock();
23976   __pyx_t_2[2] = PyThread_allocate_lock();
23977   __pyx_t_2[3] = PyThread_allocate_lock();
23978   __pyx_t_2[4] = PyThread_allocate_lock();
23979   __pyx_t_2[5] = PyThread_allocate_lock();
23980   __pyx_t_2[6] = PyThread_allocate_lock();
23981   __pyx_t_2[7] = PyThread_allocate_lock();
23982   memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_2, sizeof(__pyx_memoryview_thread_locks[0]) * (8));
23983 
23984   /* "View.MemoryView":545
23985  *         info.obj = self
23986  *
23987  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
23988  *
23989  *
23990  */
23991   __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 545, __pyx_L1_error)
23992   __Pyx_GOTREF(__pyx_t_1);
23993   if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 545, __pyx_L1_error)
23994   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23995   PyType_Modified(__pyx_memoryview_type);
23996 
23997   /* "View.MemoryView":991
23998  *         return self.from_object
23999  *
24000  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
24001  *
24002  *
24003  */
24004   __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 991, __pyx_L1_error)
24005   __Pyx_GOTREF(__pyx_t_1);
24006   if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 991, __pyx_L1_error)
24007   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24008   PyType_Modified(__pyx_memoryviewslice_type);
24009 
24010   /* "(tree fragment)":1
24011  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
24012  *     cdef object __pyx_PickleError
24013  *     cdef object __pyx_result
24014  */
24015   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1, __pyx_L1_error)
24016   __Pyx_GOTREF(__pyx_t_1);
24017   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
24018   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24019 
24020   /* "(tree fragment)":11
24021  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
24022  *     return __pyx_result
24023  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
24024  *     __pyx_result.name = __pyx_state[0]
24025  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
24026  */
24027 
24028   /*--- Wrapped vars code ---*/
24029 
24030   goto __pyx_L0;
24031   __pyx_L1_error:;
24032   __Pyx_XDECREF(__pyx_t_1);
24033   if (__pyx_m) {
24034     if (__pyx_d) {
24035       __Pyx_AddTraceback("init yt.utilities.lib.cykdtree.utils", __pyx_clineno, __pyx_lineno, __pyx_filename);
24036     }
24037     Py_CLEAR(__pyx_m);
24038   } else if (!PyErr_Occurred()) {
24039     PyErr_SetString(PyExc_ImportError, "init yt.utilities.lib.cykdtree.utils");
24040   }
24041   __pyx_L0:;
24042   __Pyx_RefNannyFinishContext();
24043   #if CYTHON_PEP489_MULTI_PHASE_INIT
24044   return (__pyx_m != NULL) ? 0 : -1;
24045   #elif PY_MAJOR_VERSION >= 3
24046   return __pyx_m;
24047   #else
24048   return;
24049   #endif
24050 }
24051 
24052 /* --- Runtime support code --- */
24053 /* Refnanny */
24054 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)24055 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
24056     PyObject *m = NULL, *p = NULL;
24057     void *r = NULL;
24058     m = PyImport_ImportModule(modname);
24059     if (!m) goto end;
24060     p = PyObject_GetAttrString(m, "RefNannyAPI");
24061     if (!p) goto end;
24062     r = PyLong_AsVoidPtr(p);
24063 end:
24064     Py_XDECREF(p);
24065     Py_XDECREF(m);
24066     return (__Pyx_RefNannyAPIStruct *)r;
24067 }
24068 #endif
24069 
24070 /* PyObjectGetAttrStr */
24071 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)24072 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
24073     PyTypeObject* tp = Py_TYPE(obj);
24074     if (likely(tp->tp_getattro))
24075         return tp->tp_getattro(obj, attr_name);
24076 #if PY_MAJOR_VERSION < 3
24077     if (likely(tp->tp_getattr))
24078         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
24079 #endif
24080     return PyObject_GetAttr(obj, attr_name);
24081 }
24082 #endif
24083 
24084 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)24085 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
24086     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
24087     if (unlikely(!result)) {
24088         PyErr_Format(PyExc_NameError,
24089 #if PY_MAJOR_VERSION >= 3
24090             "name '%U' is not defined", name);
24091 #else
24092             "name '%.200s' is not defined", PyString_AS_STRING(name));
24093 #endif
24094     }
24095     return result;
24096 }
24097 
24098 /* ArgTypeTest */
__Pyx__ArgTypeTest(PyObject * obj,PyTypeObject * type,const char * name,int exact)24099 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
24100 {
24101     if (unlikely(!type)) {
24102         PyErr_SetString(PyExc_SystemError, "Missing type object");
24103         return 0;
24104     }
24105     else if (exact) {
24106         #if PY_MAJOR_VERSION == 2
24107         if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
24108         #endif
24109     }
24110     else {
24111         if (likely(__Pyx_TypeCheck(obj, type))) return 1;
24112     }
24113     PyErr_Format(PyExc_TypeError,
24114         "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
24115         name, type->tp_name, Py_TYPE(obj)->tp_name);
24116     return 0;
24117 }
24118 
24119 /* IsLittleEndian */
__Pyx_Is_Little_Endian(void)24120 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
24121 {
24122   union {
24123     uint32_t u32;
24124     uint8_t u8[4];
24125   } S;
24126   S.u32 = 0x01020304;
24127   return S.u8[0] == 4;
24128 }
24129 
24130 /* BufferFormatCheck */
__Pyx_BufFmt_Init(__Pyx_BufFmt_Context * ctx,__Pyx_BufFmt_StackElem * stack,__Pyx_TypeInfo * type)24131 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
24132                               __Pyx_BufFmt_StackElem* stack,
24133                               __Pyx_TypeInfo* type) {
24134   stack[0].field = &ctx->root;
24135   stack[0].parent_offset = 0;
24136   ctx->root.type = type;
24137   ctx->root.name = "buffer dtype";
24138   ctx->root.offset = 0;
24139   ctx->head = stack;
24140   ctx->head->field = &ctx->root;
24141   ctx->fmt_offset = 0;
24142   ctx->head->parent_offset = 0;
24143   ctx->new_packmode = '@';
24144   ctx->enc_packmode = '@';
24145   ctx->new_count = 1;
24146   ctx->enc_count = 0;
24147   ctx->enc_type = 0;
24148   ctx->is_complex = 0;
24149   ctx->is_valid_array = 0;
24150   ctx->struct_alignment = 0;
24151   while (type->typegroup == 'S') {
24152     ++ctx->head;
24153     ctx->head->field = type->fields;
24154     ctx->head->parent_offset = 0;
24155     type = type->fields->type;
24156   }
24157 }
__Pyx_BufFmt_ParseNumber(const char ** ts)24158 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
24159     int count;
24160     const char* t = *ts;
24161     if (*t < '0' || *t > '9') {
24162       return -1;
24163     } else {
24164         count = *t++ - '0';
24165         while (*t >= '0' && *t <= '9') {
24166             count *= 10;
24167             count += *t++ - '0';
24168         }
24169     }
24170     *ts = t;
24171     return count;
24172 }
__Pyx_BufFmt_ExpectNumber(const char ** ts)24173 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
24174     int number = __Pyx_BufFmt_ParseNumber(ts);
24175     if (number == -1)
24176         PyErr_Format(PyExc_ValueError,\
24177                      "Does not understand character buffer dtype format string ('%c')", **ts);
24178     return number;
24179 }
__Pyx_BufFmt_RaiseUnexpectedChar(char ch)24180 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
24181   PyErr_Format(PyExc_ValueError,
24182                "Unexpected format string character: '%c'", ch);
24183 }
__Pyx_BufFmt_DescribeTypeChar(char ch,int is_complex)24184 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
24185   switch (ch) {
24186     case 'c': return "'char'";
24187     case 'b': return "'signed char'";
24188     case 'B': return "'unsigned char'";
24189     case 'h': return "'short'";
24190     case 'H': return "'unsigned short'";
24191     case 'i': return "'int'";
24192     case 'I': return "'unsigned int'";
24193     case 'l': return "'long'";
24194     case 'L': return "'unsigned long'";
24195     case 'q': return "'long long'";
24196     case 'Q': return "'unsigned long long'";
24197     case 'f': return (is_complex ? "'complex float'" : "'float'");
24198     case 'd': return (is_complex ? "'complex double'" : "'double'");
24199     case 'g': return (is_complex ? "'complex long double'" : "'long double'");
24200     case 'T': return "a struct";
24201     case 'O': return "Python object";
24202     case 'P': return "a pointer";
24203     case 's': case 'p': return "a string";
24204     case 0: return "end";
24205     default: return "unparseable format string";
24206   }
24207 }
__Pyx_BufFmt_TypeCharToStandardSize(char ch,int is_complex)24208 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
24209   switch (ch) {
24210     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
24211     case 'h': case 'H': return 2;
24212     case 'i': case 'I': case 'l': case 'L': return 4;
24213     case 'q': case 'Q': return 8;
24214     case 'f': return (is_complex ? 8 : 4);
24215     case 'd': return (is_complex ? 16 : 8);
24216     case 'g': {
24217       PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
24218       return 0;
24219     }
24220     case 'O': case 'P': return sizeof(void*);
24221     default:
24222       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24223       return 0;
24224     }
24225 }
__Pyx_BufFmt_TypeCharToNativeSize(char ch,int is_complex)24226 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
24227   switch (ch) {
24228     case 'c': case 'b': case 'B': case 's': case 'p': return 1;
24229     case 'h': case 'H': return sizeof(short);
24230     case 'i': case 'I': return sizeof(int);
24231     case 'l': case 'L': return sizeof(long);
24232     #ifdef HAVE_LONG_LONG
24233     case 'q': case 'Q': return sizeof(PY_LONG_LONG);
24234     #endif
24235     case 'f': return sizeof(float) * (is_complex ? 2 : 1);
24236     case 'd': return sizeof(double) * (is_complex ? 2 : 1);
24237     case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
24238     case 'O': case 'P': return sizeof(void*);
24239     default: {
24240       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24241       return 0;
24242     }
24243   }
24244 }
24245 typedef struct { char c; short x; } __Pyx_st_short;
24246 typedef struct { char c; int x; } __Pyx_st_int;
24247 typedef struct { char c; long x; } __Pyx_st_long;
24248 typedef struct { char c; float x; } __Pyx_st_float;
24249 typedef struct { char c; double x; } __Pyx_st_double;
24250 typedef struct { char c; long double x; } __Pyx_st_longdouble;
24251 typedef struct { char c; void *x; } __Pyx_st_void_p;
24252 #ifdef HAVE_LONG_LONG
24253 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
24254 #endif
__Pyx_BufFmt_TypeCharToAlignment(char ch,CYTHON_UNUSED int is_complex)24255 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
24256   switch (ch) {
24257     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
24258     case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
24259     case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
24260     case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
24261 #ifdef HAVE_LONG_LONG
24262     case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
24263 #endif
24264     case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
24265     case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
24266     case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
24267     case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
24268     default:
24269       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24270       return 0;
24271     }
24272 }
24273 /* These are for computing the padding at the end of the struct to align
24274    on the first member of the struct. This will probably the same as above,
24275    but we don't have any guarantees.
24276  */
24277 typedef struct { short x; char c; } __Pyx_pad_short;
24278 typedef struct { int x; char c; } __Pyx_pad_int;
24279 typedef struct { long x; char c; } __Pyx_pad_long;
24280 typedef struct { float x; char c; } __Pyx_pad_float;
24281 typedef struct { double x; char c; } __Pyx_pad_double;
24282 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
24283 typedef struct { void *x; char c; } __Pyx_pad_void_p;
24284 #ifdef HAVE_LONG_LONG
24285 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
24286 #endif
__Pyx_BufFmt_TypeCharToPadding(char ch,CYTHON_UNUSED int is_complex)24287 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
24288   switch (ch) {
24289     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
24290     case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
24291     case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
24292     case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
24293 #ifdef HAVE_LONG_LONG
24294     case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
24295 #endif
24296     case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
24297     case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
24298     case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
24299     case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
24300     default:
24301       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24302       return 0;
24303     }
24304 }
__Pyx_BufFmt_TypeCharToGroup(char ch,int is_complex)24305 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
24306   switch (ch) {
24307     case 'c':
24308         return 'H';
24309     case 'b': case 'h': case 'i':
24310     case 'l': case 'q': case 's': case 'p':
24311         return 'I';
24312     case 'B': case 'H': case 'I': case 'L': case 'Q':
24313         return 'U';
24314     case 'f': case 'd': case 'g':
24315         return (is_complex ? 'C' : 'R');
24316     case 'O':
24317         return 'O';
24318     case 'P':
24319         return 'P';
24320     default: {
24321       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24322       return 0;
24323     }
24324   }
24325 }
__Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context * ctx)24326 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
24327   if (ctx->head == NULL || ctx->head->field == &ctx->root) {
24328     const char* expected;
24329     const char* quote;
24330     if (ctx->head == NULL) {
24331       expected = "end";
24332       quote = "";
24333     } else {
24334       expected = ctx->head->field->type->name;
24335       quote = "'";
24336     }
24337     PyErr_Format(PyExc_ValueError,
24338                  "Buffer dtype mismatch, expected %s%s%s but got %s",
24339                  quote, expected, quote,
24340                  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
24341   } else {
24342     __Pyx_StructField* field = ctx->head->field;
24343     __Pyx_StructField* parent = (ctx->head - 1)->field;
24344     PyErr_Format(PyExc_ValueError,
24345                  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
24346                  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
24347                  parent->type->name, field->name);
24348   }
24349 }
__Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context * ctx)24350 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
24351   char group;
24352   size_t size, offset, arraysize = 1;
24353   if (ctx->enc_type == 0) return 0;
24354   if (ctx->head->field->type->arraysize[0]) {
24355     int i, ndim = 0;
24356     if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
24357         ctx->is_valid_array = ctx->head->field->type->ndim == 1;
24358         ndim = 1;
24359         if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
24360             PyErr_Format(PyExc_ValueError,
24361                          "Expected a dimension of size %zu, got %zu",
24362                          ctx->head->field->type->arraysize[0], ctx->enc_count);
24363             return -1;
24364         }
24365     }
24366     if (!ctx->is_valid_array) {
24367       PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
24368                    ctx->head->field->type->ndim, ndim);
24369       return -1;
24370     }
24371     for (i = 0; i < ctx->head->field->type->ndim; i++) {
24372       arraysize *= ctx->head->field->type->arraysize[i];
24373     }
24374     ctx->is_valid_array = 0;
24375     ctx->enc_count = 1;
24376   }
24377   group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
24378   do {
24379     __Pyx_StructField* field = ctx->head->field;
24380     __Pyx_TypeInfo* type = field->type;
24381     if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
24382       size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
24383     } else {
24384       size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
24385     }
24386     if (ctx->enc_packmode == '@') {
24387       size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
24388       size_t align_mod_offset;
24389       if (align_at == 0) return -1;
24390       align_mod_offset = ctx->fmt_offset % align_at;
24391       if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
24392       if (ctx->struct_alignment == 0)
24393           ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
24394                                                                  ctx->is_complex);
24395     }
24396     if (type->size != size || type->typegroup != group) {
24397       if (type->typegroup == 'C' && type->fields != NULL) {
24398         size_t parent_offset = ctx->head->parent_offset + field->offset;
24399         ++ctx->head;
24400         ctx->head->field = type->fields;
24401         ctx->head->parent_offset = parent_offset;
24402         continue;
24403       }
24404       if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
24405       } else {
24406           __Pyx_BufFmt_RaiseExpected(ctx);
24407           return -1;
24408       }
24409     }
24410     offset = ctx->head->parent_offset + field->offset;
24411     if (ctx->fmt_offset != offset) {
24412       PyErr_Format(PyExc_ValueError,
24413                    "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
24414                    (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
24415       return -1;
24416     }
24417     ctx->fmt_offset += size;
24418     if (arraysize)
24419       ctx->fmt_offset += (arraysize - 1) * size;
24420     --ctx->enc_count;
24421     while (1) {
24422       if (field == &ctx->root) {
24423         ctx->head = NULL;
24424         if (ctx->enc_count != 0) {
24425           __Pyx_BufFmt_RaiseExpected(ctx);
24426           return -1;
24427         }
24428         break;
24429       }
24430       ctx->head->field = ++field;
24431       if (field->type == NULL) {
24432         --ctx->head;
24433         field = ctx->head->field;
24434         continue;
24435       } else if (field->type->typegroup == 'S') {
24436         size_t parent_offset = ctx->head->parent_offset + field->offset;
24437         if (field->type->fields->type == NULL) continue;
24438         field = field->type->fields;
24439         ++ctx->head;
24440         ctx->head->field = field;
24441         ctx->head->parent_offset = parent_offset;
24442         break;
24443       } else {
24444         break;
24445       }
24446     }
24447   } while (ctx->enc_count);
24448   ctx->enc_type = 0;
24449   ctx->is_complex = 0;
24450   return 0;
24451 }
24452 static PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context * ctx,const char ** tsp)24453 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
24454 {
24455     const char *ts = *tsp;
24456     int i = 0, number;
24457     int ndim = ctx->head->field->type->ndim;
24458 ;
24459     ++ts;
24460     if (ctx->new_count != 1) {
24461         PyErr_SetString(PyExc_ValueError,
24462                         "Cannot handle repeated arrays in format string");
24463         return NULL;
24464     }
24465     if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24466     while (*ts && *ts != ')') {
24467         switch (*ts) {
24468             case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
24469             default:  break;
24470         }
24471         number = __Pyx_BufFmt_ExpectNumber(&ts);
24472         if (number == -1) return NULL;
24473         if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
24474             return PyErr_Format(PyExc_ValueError,
24475                         "Expected a dimension of size %zu, got %d",
24476                         ctx->head->field->type->arraysize[i], number);
24477         if (*ts != ',' && *ts != ')')
24478             return PyErr_Format(PyExc_ValueError,
24479                                 "Expected a comma in format string, got '%c'", *ts);
24480         if (*ts == ',') ts++;
24481         i++;
24482     }
24483     if (i != ndim)
24484         return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
24485                             ctx->head->field->type->ndim, i);
24486     if (!*ts) {
24487         PyErr_SetString(PyExc_ValueError,
24488                         "Unexpected end of format string, expected ')'");
24489         return NULL;
24490     }
24491     ctx->is_valid_array = 1;
24492     ctx->new_count = 1;
24493     *tsp = ++ts;
24494     return Py_None;
24495 }
__Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context * ctx,const char * ts)24496 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
24497   int got_Z = 0;
24498   while (1) {
24499     switch(*ts) {
24500       case 0:
24501         if (ctx->enc_type != 0 && ctx->head == NULL) {
24502           __Pyx_BufFmt_RaiseExpected(ctx);
24503           return NULL;
24504         }
24505         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24506         if (ctx->head != NULL) {
24507           __Pyx_BufFmt_RaiseExpected(ctx);
24508           return NULL;
24509         }
24510         return ts;
24511       case ' ':
24512       case '\r':
24513       case '\n':
24514         ++ts;
24515         break;
24516       case '<':
24517         if (!__Pyx_Is_Little_Endian()) {
24518           PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
24519           return NULL;
24520         }
24521         ctx->new_packmode = '=';
24522         ++ts;
24523         break;
24524       case '>':
24525       case '!':
24526         if (__Pyx_Is_Little_Endian()) {
24527           PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
24528           return NULL;
24529         }
24530         ctx->new_packmode = '=';
24531         ++ts;
24532         break;
24533       case '=':
24534       case '@':
24535       case '^':
24536         ctx->new_packmode = *ts++;
24537         break;
24538       case 'T':
24539         {
24540           const char* ts_after_sub;
24541           size_t i, struct_count = ctx->new_count;
24542           size_t struct_alignment = ctx->struct_alignment;
24543           ctx->new_count = 1;
24544           ++ts;
24545           if (*ts != '{') {
24546             PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
24547             return NULL;
24548           }
24549           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24550           ctx->enc_type = 0;
24551           ctx->enc_count = 0;
24552           ctx->struct_alignment = 0;
24553           ++ts;
24554           ts_after_sub = ts;
24555           for (i = 0; i != struct_count; ++i) {
24556             ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
24557             if (!ts_after_sub) return NULL;
24558           }
24559           ts = ts_after_sub;
24560           if (struct_alignment) ctx->struct_alignment = struct_alignment;
24561         }
24562         break;
24563       case '}':
24564         {
24565           size_t alignment = ctx->struct_alignment;
24566           ++ts;
24567           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24568           ctx->enc_type = 0;
24569           if (alignment && ctx->fmt_offset % alignment) {
24570             ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
24571           }
24572         }
24573         return ts;
24574       case 'x':
24575         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24576         ctx->fmt_offset += ctx->new_count;
24577         ctx->new_count = 1;
24578         ctx->enc_count = 0;
24579         ctx->enc_type = 0;
24580         ctx->enc_packmode = ctx->new_packmode;
24581         ++ts;
24582         break;
24583       case 'Z':
24584         got_Z = 1;
24585         ++ts;
24586         if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
24587           __Pyx_BufFmt_RaiseUnexpectedChar('Z');
24588           return NULL;
24589         }
24590         CYTHON_FALLTHROUGH;
24591       case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
24592       case 'l': case 'L': case 'q': case 'Q':
24593       case 'f': case 'd': case 'g':
24594       case 'O': case 'p':
24595         if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
24596             ctx->enc_packmode == ctx->new_packmode) {
24597           ctx->enc_count += ctx->new_count;
24598           ctx->new_count = 1;
24599           got_Z = 0;
24600           ++ts;
24601           break;
24602         }
24603         CYTHON_FALLTHROUGH;
24604       case 's':
24605         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24606         ctx->enc_count = ctx->new_count;
24607         ctx->enc_packmode = ctx->new_packmode;
24608         ctx->enc_type = *ts;
24609         ctx->is_complex = got_Z;
24610         ++ts;
24611         ctx->new_count = 1;
24612         got_Z = 0;
24613         break;
24614       case ':':
24615         ++ts;
24616         while(*ts != ':') ++ts;
24617         ++ts;
24618         break;
24619       case '(':
24620         if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
24621         break;
24622       default:
24623         {
24624           int number = __Pyx_BufFmt_ExpectNumber(&ts);
24625           if (number == -1) return NULL;
24626           ctx->new_count = (size_t)number;
24627         }
24628     }
24629   }
24630 }
24631 
24632 /* BufferGetAndValidate */
__Pyx_SafeReleaseBuffer(Py_buffer * info)24633   static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
24634   if (unlikely(info->buf == NULL)) return;
24635   if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
24636   __Pyx_ReleaseBuffer(info);
24637 }
__Pyx_ZeroBuffer(Py_buffer * buf)24638 static void __Pyx_ZeroBuffer(Py_buffer* buf) {
24639   buf->buf = NULL;
24640   buf->obj = NULL;
24641   buf->strides = __Pyx_zeros;
24642   buf->shape = __Pyx_zeros;
24643   buf->suboffsets = __Pyx_minusones;
24644 }
__Pyx__GetBufferAndValidate(Py_buffer * buf,PyObject * obj,__Pyx_TypeInfo * dtype,int flags,int nd,int cast,__Pyx_BufFmt_StackElem * stack)24645 static int __Pyx__GetBufferAndValidate(
24646         Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
24647         int nd, int cast, __Pyx_BufFmt_StackElem* stack)
24648 {
24649   buf->buf = NULL;
24650   if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
24651     __Pyx_ZeroBuffer(buf);
24652     return -1;
24653   }
24654   if (unlikely(buf->ndim != nd)) {
24655     PyErr_Format(PyExc_ValueError,
24656                  "Buffer has wrong number of dimensions (expected %d, got %d)",
24657                  nd, buf->ndim);
24658     goto fail;
24659   }
24660   if (!cast) {
24661     __Pyx_BufFmt_Context ctx;
24662     __Pyx_BufFmt_Init(&ctx, stack, dtype);
24663     if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
24664   }
24665   if (unlikely((size_t)buf->itemsize != dtype->size)) {
24666     PyErr_Format(PyExc_ValueError,
24667       "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
24668       buf->itemsize, (buf->itemsize > 1) ? "s" : "",
24669       dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
24670     goto fail;
24671   }
24672   if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
24673   return 0;
24674 fail:;
24675   __Pyx_SafeReleaseBuffer(buf);
24676   return -1;
24677 }
24678 
24679 /* BufferIndexError */
__Pyx_RaiseBufferIndexError(int axis)24680   static void __Pyx_RaiseBufferIndexError(int axis) {
24681   PyErr_Format(PyExc_IndexError,
24682      "Out of bounds on buffer access (axis %d)", axis);
24683 }
24684 
24685 /* PyDictVersioning */
24686   #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)24687 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
24688     PyObject *dict = Py_TYPE(obj)->tp_dict;
24689     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
24690 }
__Pyx_get_object_dict_version(PyObject * obj)24691 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
24692     PyObject **dictptr = NULL;
24693     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
24694     if (offset) {
24695 #if CYTHON_COMPILING_IN_CPYTHON
24696         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
24697 #else
24698         dictptr = _PyObject_GetDictPtr(obj);
24699 #endif
24700     }
24701     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
24702 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)24703 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
24704     PyObject *dict = Py_TYPE(obj)->tp_dict;
24705     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
24706         return 0;
24707     return obj_dict_version == __Pyx_get_object_dict_version(obj);
24708 }
24709 #endif
24710 
24711 /* GetModuleGlobalName */
24712   #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)24713 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
24714 #else
24715 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
24716 #endif
24717 {
24718     PyObject *result;
24719 #if !CYTHON_AVOID_BORROWED_REFS
24720 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
24721     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
24722     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
24723     if (likely(result)) {
24724         return __Pyx_NewRef(result);
24725     } else if (unlikely(PyErr_Occurred())) {
24726         return NULL;
24727     }
24728 #else
24729     result = PyDict_GetItem(__pyx_d, name);
24730     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
24731     if (likely(result)) {
24732         return __Pyx_NewRef(result);
24733     }
24734 #endif
24735 #else
24736     result = PyObject_GetItem(__pyx_d, name);
24737     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
24738     if (likely(result)) {
24739         return __Pyx_NewRef(result);
24740     }
24741     PyErr_Clear();
24742 #endif
24743     return __Pyx_GetBuiltinName(name);
24744 }
24745 
24746 /* PyFunctionFastCall */
24747   #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)24748 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
24749                                                PyObject *globals) {
24750     PyFrameObject *f;
24751     PyThreadState *tstate = __Pyx_PyThreadState_Current;
24752     PyObject **fastlocals;
24753     Py_ssize_t i;
24754     PyObject *result;
24755     assert(globals != NULL);
24756     /* XXX Perhaps we should create a specialized
24757        PyFrame_New() that doesn't take locals, but does
24758        take builtins without sanity checking them.
24759        */
24760     assert(tstate != NULL);
24761     f = PyFrame_New(tstate, co, globals, NULL);
24762     if (f == NULL) {
24763         return NULL;
24764     }
24765     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
24766     for (i = 0; i < na; i++) {
24767         Py_INCREF(*args);
24768         fastlocals[i] = *args++;
24769     }
24770     result = PyEval_EvalFrameEx(f,0);
24771     ++tstate->recursion_depth;
24772     Py_DECREF(f);
24773     --tstate->recursion_depth;
24774     return result;
24775 }
24776 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)24777 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
24778     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
24779     PyObject *globals = PyFunction_GET_GLOBALS(func);
24780     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
24781     PyObject *closure;
24782 #if PY_MAJOR_VERSION >= 3
24783     PyObject *kwdefs;
24784 #endif
24785     PyObject *kwtuple, **k;
24786     PyObject **d;
24787     Py_ssize_t nd;
24788     Py_ssize_t nk;
24789     PyObject *result;
24790     assert(kwargs == NULL || PyDict_Check(kwargs));
24791     nk = kwargs ? PyDict_Size(kwargs) : 0;
24792     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
24793         return NULL;
24794     }
24795     if (
24796 #if PY_MAJOR_VERSION >= 3
24797             co->co_kwonlyargcount == 0 &&
24798 #endif
24799             likely(kwargs == NULL || nk == 0) &&
24800             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
24801         if (argdefs == NULL && co->co_argcount == nargs) {
24802             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
24803             goto done;
24804         }
24805         else if (nargs == 0 && argdefs != NULL
24806                  && co->co_argcount == Py_SIZE(argdefs)) {
24807             /* function called with no arguments, but all parameters have
24808                a default value: use default values as arguments .*/
24809             args = &PyTuple_GET_ITEM(argdefs, 0);
24810             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
24811             goto done;
24812         }
24813     }
24814     if (kwargs != NULL) {
24815         Py_ssize_t pos, i;
24816         kwtuple = PyTuple_New(2 * nk);
24817         if (kwtuple == NULL) {
24818             result = NULL;
24819             goto done;
24820         }
24821         k = &PyTuple_GET_ITEM(kwtuple, 0);
24822         pos = i = 0;
24823         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
24824             Py_INCREF(k[i]);
24825             Py_INCREF(k[i+1]);
24826             i += 2;
24827         }
24828         nk = i / 2;
24829     }
24830     else {
24831         kwtuple = NULL;
24832         k = NULL;
24833     }
24834     closure = PyFunction_GET_CLOSURE(func);
24835 #if PY_MAJOR_VERSION >= 3
24836     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
24837 #endif
24838     if (argdefs != NULL) {
24839         d = &PyTuple_GET_ITEM(argdefs, 0);
24840         nd = Py_SIZE(argdefs);
24841     }
24842     else {
24843         d = NULL;
24844         nd = 0;
24845     }
24846 #if PY_MAJOR_VERSION >= 3
24847     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
24848                                args, (int)nargs,
24849                                k, (int)nk,
24850                                d, (int)nd, kwdefs, closure);
24851 #else
24852     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
24853                                args, (int)nargs,
24854                                k, (int)nk,
24855                                d, (int)nd, closure);
24856 #endif
24857     Py_XDECREF(kwtuple);
24858 done:
24859     Py_LeaveRecursiveCall();
24860     return result;
24861 }
24862 #endif
24863 #endif
24864 
24865 /* PyCFunctionFastCall */
24866   #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)24867 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
24868     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
24869     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
24870     PyObject *self = PyCFunction_GET_SELF(func);
24871     int flags = PyCFunction_GET_FLAGS(func);
24872     assert(PyCFunction_Check(func));
24873     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
24874     assert(nargs >= 0);
24875     assert(nargs == 0 || args != NULL);
24876     /* _PyCFunction_FastCallDict() must not be called with an exception set,
24877        because it may clear it (directly or indirectly) and so the
24878        caller loses its exception */
24879     assert(!PyErr_Occurred());
24880     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
24881         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
24882     } else {
24883         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
24884     }
24885 }
24886 #endif
24887 
24888 /* PyObjectCall */
24889   #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)24890 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
24891     PyObject *result;
24892     ternaryfunc call = func->ob_type->tp_call;
24893     if (unlikely(!call))
24894         return PyObject_Call(func, arg, kw);
24895     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
24896         return NULL;
24897     result = (*call)(func, arg, kw);
24898     Py_LeaveRecursiveCall();
24899     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
24900         PyErr_SetString(
24901             PyExc_SystemError,
24902             "NULL result without error in PyObject_Call");
24903     }
24904     return result;
24905 }
24906 #endif
24907 
24908 /* ExtTypeTest */
__Pyx_TypeTest(PyObject * obj,PyTypeObject * type)24909   static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
24910     if (unlikely(!type)) {
24911         PyErr_SetString(PyExc_SystemError, "Missing type object");
24912         return 0;
24913     }
24914     if (likely(__Pyx_TypeCheck(obj, type)))
24915         return 1;
24916     PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
24917                  Py_TYPE(obj)->tp_name, type->tp_name);
24918     return 0;
24919 }
24920 
24921 /* PyErrFetchRestore */
24922   #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)24923 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
24924     PyObject *tmp_type, *tmp_value, *tmp_tb;
24925     tmp_type = tstate->curexc_type;
24926     tmp_value = tstate->curexc_value;
24927     tmp_tb = tstate->curexc_traceback;
24928     tstate->curexc_type = type;
24929     tstate->curexc_value = value;
24930     tstate->curexc_traceback = tb;
24931     Py_XDECREF(tmp_type);
24932     Py_XDECREF(tmp_value);
24933     Py_XDECREF(tmp_tb);
24934 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)24935 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
24936     *type = tstate->curexc_type;
24937     *value = tstate->curexc_value;
24938     *tb = tstate->curexc_traceback;
24939     tstate->curexc_type = 0;
24940     tstate->curexc_value = 0;
24941     tstate->curexc_traceback = 0;
24942 }
24943 #endif
24944 
24945 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)24946   static void __Pyx_RaiseArgtupleInvalid(
24947     const char* func_name,
24948     int exact,
24949     Py_ssize_t num_min,
24950     Py_ssize_t num_max,
24951     Py_ssize_t num_found)
24952 {
24953     Py_ssize_t num_expected;
24954     const char *more_or_less;
24955     if (num_found < num_min) {
24956         num_expected = num_min;
24957         more_or_less = "at least";
24958     } else {
24959         num_expected = num_max;
24960         more_or_less = "at most";
24961     }
24962     if (exact) {
24963         more_or_less = "exactly";
24964     }
24965     PyErr_Format(PyExc_TypeError,
24966                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
24967                  func_name, more_or_less, num_expected,
24968                  (num_expected == 1) ? "" : "s", num_found);
24969 }
24970 
24971 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)24972   static void __Pyx_RaiseDoubleKeywordsError(
24973     const char* func_name,
24974     PyObject* kw_name)
24975 {
24976     PyErr_Format(PyExc_TypeError,
24977         #if PY_MAJOR_VERSION >= 3
24978         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
24979         #else
24980         "%s() got multiple values for keyword argument '%s'", func_name,
24981         PyString_AsString(kw_name));
24982         #endif
24983 }
24984 
24985 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)24986   static int __Pyx_ParseOptionalKeywords(
24987     PyObject *kwds,
24988     PyObject **argnames[],
24989     PyObject *kwds2,
24990     PyObject *values[],
24991     Py_ssize_t num_pos_args,
24992     const char* function_name)
24993 {
24994     PyObject *key = 0, *value = 0;
24995     Py_ssize_t pos = 0;
24996     PyObject*** name;
24997     PyObject*** first_kw_arg = argnames + num_pos_args;
24998     while (PyDict_Next(kwds, &pos, &key, &value)) {
24999         name = first_kw_arg;
25000         while (*name && (**name != key)) name++;
25001         if (*name) {
25002             values[name-argnames] = value;
25003             continue;
25004         }
25005         name = first_kw_arg;
25006         #if PY_MAJOR_VERSION < 3
25007         if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
25008             while (*name) {
25009                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
25010                         && _PyString_Eq(**name, key)) {
25011                     values[name-argnames] = value;
25012                     break;
25013                 }
25014                 name++;
25015             }
25016             if (*name) continue;
25017             else {
25018                 PyObject*** argname = argnames;
25019                 while (argname != first_kw_arg) {
25020                     if ((**argname == key) || (
25021                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
25022                              && _PyString_Eq(**argname, key))) {
25023                         goto arg_passed_twice;
25024                     }
25025                     argname++;
25026                 }
25027             }
25028         } else
25029         #endif
25030         if (likely(PyUnicode_Check(key))) {
25031             while (*name) {
25032                 int cmp = (**name == key) ? 0 :
25033                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
25034                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
25035                 #endif
25036                     PyUnicode_Compare(**name, key);
25037                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
25038                 if (cmp == 0) {
25039                     values[name-argnames] = value;
25040                     break;
25041                 }
25042                 name++;
25043             }
25044             if (*name) continue;
25045             else {
25046                 PyObject*** argname = argnames;
25047                 while (argname != first_kw_arg) {
25048                     int cmp = (**argname == key) ? 0 :
25049                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
25050                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
25051                     #endif
25052                         PyUnicode_Compare(**argname, key);
25053                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
25054                     if (cmp == 0) goto arg_passed_twice;
25055                     argname++;
25056                 }
25057             }
25058         } else
25059             goto invalid_keyword_type;
25060         if (kwds2) {
25061             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
25062         } else {
25063             goto invalid_keyword;
25064         }
25065     }
25066     return 0;
25067 arg_passed_twice:
25068     __Pyx_RaiseDoubleKeywordsError(function_name, key);
25069     goto bad;
25070 invalid_keyword_type:
25071     PyErr_Format(PyExc_TypeError,
25072         "%.200s() keywords must be strings", function_name);
25073     goto bad;
25074 invalid_keyword:
25075     PyErr_Format(PyExc_TypeError,
25076     #if PY_MAJOR_VERSION < 3
25077         "%.200s() got an unexpected keyword argument '%.200s'",
25078         function_name, PyString_AsString(key));
25079     #else
25080         "%s() got an unexpected keyword argument '%U'",
25081         function_name, key);
25082     #endif
25083 bad:
25084     return -1;
25085 }
25086 
25087 /* PyObjectCallMethO */
25088   #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)25089 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
25090     PyObject *self, *result;
25091     PyCFunction cfunc;
25092     cfunc = PyCFunction_GET_FUNCTION(func);
25093     self = PyCFunction_GET_SELF(func);
25094     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
25095         return NULL;
25096     result = cfunc(self, arg);
25097     Py_LeaveRecursiveCall();
25098     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
25099         PyErr_SetString(
25100             PyExc_SystemError,
25101             "NULL result without error in PyObject_Call");
25102     }
25103     return result;
25104 }
25105 #endif
25106 
25107 /* PyObjectCallOneArg */
25108   #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)25109 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
25110     PyObject *result;
25111     PyObject *args = PyTuple_New(1);
25112     if (unlikely(!args)) return NULL;
25113     Py_INCREF(arg);
25114     PyTuple_SET_ITEM(args, 0, arg);
25115     result = __Pyx_PyObject_Call(func, args, NULL);
25116     Py_DECREF(args);
25117     return result;
25118 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)25119 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
25120 #if CYTHON_FAST_PYCALL
25121     if (PyFunction_Check(func)) {
25122         return __Pyx_PyFunction_FastCall(func, &arg, 1);
25123     }
25124 #endif
25125     if (likely(PyCFunction_Check(func))) {
25126         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
25127             return __Pyx_PyObject_CallMethO(func, arg);
25128 #if CYTHON_FAST_PYCCALL
25129         } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
25130             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
25131 #endif
25132         }
25133     }
25134     return __Pyx__PyObject_CallOneArg(func, arg);
25135 }
25136 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)25137 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
25138     PyObject *result;
25139     PyObject *args = PyTuple_Pack(1, arg);
25140     if (unlikely(!args)) return NULL;
25141     result = __Pyx_PyObject_Call(func, args, NULL);
25142     Py_DECREF(args);
25143     return result;
25144 }
25145 #endif
25146 
25147 /* RaiseException */
25148   #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)25149 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
25150                         CYTHON_UNUSED PyObject *cause) {
25151     __Pyx_PyThreadState_declare
25152     Py_XINCREF(type);
25153     if (!value || value == Py_None)
25154         value = NULL;
25155     else
25156         Py_INCREF(value);
25157     if (!tb || tb == Py_None)
25158         tb = NULL;
25159     else {
25160         Py_INCREF(tb);
25161         if (!PyTraceBack_Check(tb)) {
25162             PyErr_SetString(PyExc_TypeError,
25163                 "raise: arg 3 must be a traceback or None");
25164             goto raise_error;
25165         }
25166     }
25167     if (PyType_Check(type)) {
25168 #if CYTHON_COMPILING_IN_PYPY
25169         if (!value) {
25170             Py_INCREF(Py_None);
25171             value = Py_None;
25172         }
25173 #endif
25174         PyErr_NormalizeException(&type, &value, &tb);
25175     } else {
25176         if (value) {
25177             PyErr_SetString(PyExc_TypeError,
25178                 "instance exception may not have a separate value");
25179             goto raise_error;
25180         }
25181         value = type;
25182         type = (PyObject*) Py_TYPE(type);
25183         Py_INCREF(type);
25184         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
25185             PyErr_SetString(PyExc_TypeError,
25186                 "raise: exception class must be a subclass of BaseException");
25187             goto raise_error;
25188         }
25189     }
25190     __Pyx_PyThreadState_assign
25191     __Pyx_ErrRestore(type, value, tb);
25192     return;
25193 raise_error:
25194     Py_XDECREF(value);
25195     Py_XDECREF(type);
25196     Py_XDECREF(tb);
25197     return;
25198 }
25199 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)25200 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
25201     PyObject* owned_instance = NULL;
25202     if (tb == Py_None) {
25203         tb = 0;
25204     } else if (tb && !PyTraceBack_Check(tb)) {
25205         PyErr_SetString(PyExc_TypeError,
25206             "raise: arg 3 must be a traceback or None");
25207         goto bad;
25208     }
25209     if (value == Py_None)
25210         value = 0;
25211     if (PyExceptionInstance_Check(type)) {
25212         if (value) {
25213             PyErr_SetString(PyExc_TypeError,
25214                 "instance exception may not have a separate value");
25215             goto bad;
25216         }
25217         value = type;
25218         type = (PyObject*) Py_TYPE(value);
25219     } else if (PyExceptionClass_Check(type)) {
25220         PyObject *instance_class = NULL;
25221         if (value && PyExceptionInstance_Check(value)) {
25222             instance_class = (PyObject*) Py_TYPE(value);
25223             if (instance_class != type) {
25224                 int is_subclass = PyObject_IsSubclass(instance_class, type);
25225                 if (!is_subclass) {
25226                     instance_class = NULL;
25227                 } else if (unlikely(is_subclass == -1)) {
25228                     goto bad;
25229                 } else {
25230                     type = instance_class;
25231                 }
25232             }
25233         }
25234         if (!instance_class) {
25235             PyObject *args;
25236             if (!value)
25237                 args = PyTuple_New(0);
25238             else if (PyTuple_Check(value)) {
25239                 Py_INCREF(value);
25240                 args = value;
25241             } else
25242                 args = PyTuple_Pack(1, value);
25243             if (!args)
25244                 goto bad;
25245             owned_instance = PyObject_Call(type, args, NULL);
25246             Py_DECREF(args);
25247             if (!owned_instance)
25248                 goto bad;
25249             value = owned_instance;
25250             if (!PyExceptionInstance_Check(value)) {
25251                 PyErr_Format(PyExc_TypeError,
25252                              "calling %R should have returned an instance of "
25253                              "BaseException, not %R",
25254                              type, Py_TYPE(value));
25255                 goto bad;
25256             }
25257         }
25258     } else {
25259         PyErr_SetString(PyExc_TypeError,
25260             "raise: exception class must be a subclass of BaseException");
25261         goto bad;
25262     }
25263     if (cause) {
25264         PyObject *fixed_cause;
25265         if (cause == Py_None) {
25266             fixed_cause = NULL;
25267         } else if (PyExceptionClass_Check(cause)) {
25268             fixed_cause = PyObject_CallObject(cause, NULL);
25269             if (fixed_cause == NULL)
25270                 goto bad;
25271         } else if (PyExceptionInstance_Check(cause)) {
25272             fixed_cause = cause;
25273             Py_INCREF(fixed_cause);
25274         } else {
25275             PyErr_SetString(PyExc_TypeError,
25276                             "exception causes must derive from "
25277                             "BaseException");
25278             goto bad;
25279         }
25280         PyException_SetCause(value, fixed_cause);
25281     }
25282     PyErr_SetObject(type, value);
25283     if (tb) {
25284 #if CYTHON_COMPILING_IN_PYPY
25285         PyObject *tmp_type, *tmp_value, *tmp_tb;
25286         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
25287         Py_INCREF(tb);
25288         PyErr_Restore(tmp_type, tmp_value, tb);
25289         Py_XDECREF(tmp_tb);
25290 #else
25291         PyThreadState *tstate = __Pyx_PyThreadState_Current;
25292         PyObject* tmp_tb = tstate->curexc_traceback;
25293         if (tb != tmp_tb) {
25294             Py_INCREF(tb);
25295             tstate->curexc_traceback = tb;
25296             Py_XDECREF(tmp_tb);
25297         }
25298 #endif
25299     }
25300 bad:
25301     Py_XDECREF(owned_instance);
25302     return;
25303 }
25304 #endif
25305 
25306 /* MemviewSliceInit */
25307   static int
__Pyx_init_memviewslice(struct __pyx_memoryview_obj * memview,int ndim,__Pyx_memviewslice * memviewslice,int memview_is_new_reference)25308 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
25309                         int ndim,
25310                         __Pyx_memviewslice *memviewslice,
25311                         int memview_is_new_reference)
25312 {
25313     __Pyx_RefNannyDeclarations
25314     int i, retval=-1;
25315     Py_buffer *buf = &memview->view;
25316     __Pyx_RefNannySetupContext("init_memviewslice", 0);
25317     if (memviewslice->memview || memviewslice->data) {
25318         PyErr_SetString(PyExc_ValueError,
25319             "memviewslice is already initialized!");
25320         goto fail;
25321     }
25322     if (buf->strides) {
25323         for (i = 0; i < ndim; i++) {
25324             memviewslice->strides[i] = buf->strides[i];
25325         }
25326     } else {
25327         Py_ssize_t stride = buf->itemsize;
25328         for (i = ndim - 1; i >= 0; i--) {
25329             memviewslice->strides[i] = stride;
25330             stride *= buf->shape[i];
25331         }
25332     }
25333     for (i = 0; i < ndim; i++) {
25334         memviewslice->shape[i]   = buf->shape[i];
25335         if (buf->suboffsets) {
25336             memviewslice->suboffsets[i] = buf->suboffsets[i];
25337         } else {
25338             memviewslice->suboffsets[i] = -1;
25339         }
25340     }
25341     memviewslice->memview = memview;
25342     memviewslice->data = (char *)buf->buf;
25343     if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
25344         Py_INCREF(memview);
25345     }
25346     retval = 0;
25347     goto no_fail;
25348 fail:
25349     memviewslice->memview = 0;
25350     memviewslice->data = 0;
25351     retval = -1;
25352 no_fail:
25353     __Pyx_RefNannyFinishContext();
25354     return retval;
25355 }
25356 #ifndef Py_NO_RETURN
25357 #define Py_NO_RETURN
25358 #endif
__pyx_fatalerror(const char * fmt,...)25359 static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
25360     va_list vargs;
25361     char msg[200];
25362 #ifdef HAVE_STDARG_PROTOTYPES
25363     va_start(vargs, fmt);
25364 #else
25365     va_start(vargs);
25366 #endif
25367     vsnprintf(msg, 200, fmt, vargs);
25368     va_end(vargs);
25369     Py_FatalError(msg);
25370 }
25371 static CYTHON_INLINE int
__pyx_add_acquisition_count_locked(__pyx_atomic_int * acquisition_count,PyThread_type_lock lock)25372 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
25373                                    PyThread_type_lock lock)
25374 {
25375     int result;
25376     PyThread_acquire_lock(lock, 1);
25377     result = (*acquisition_count)++;
25378     PyThread_release_lock(lock);
25379     return result;
25380 }
25381 static CYTHON_INLINE int
__pyx_sub_acquisition_count_locked(__pyx_atomic_int * acquisition_count,PyThread_type_lock lock)25382 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
25383                                    PyThread_type_lock lock)
25384 {
25385     int result;
25386     PyThread_acquire_lock(lock, 1);
25387     result = (*acquisition_count)--;
25388     PyThread_release_lock(lock);
25389     return result;
25390 }
25391 static CYTHON_INLINE void
__Pyx_INC_MEMVIEW(__Pyx_memviewslice * memslice,int have_gil,int lineno)25392 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
25393 {
25394     int first_time;
25395     struct __pyx_memoryview_obj *memview = memslice->memview;
25396     if (!memview || (PyObject *) memview == Py_None)
25397         return;
25398     if (__pyx_get_slice_count(memview) < 0)
25399         __pyx_fatalerror("Acquisition count is %d (line %d)",
25400                          __pyx_get_slice_count(memview), lineno);
25401     first_time = __pyx_add_acquisition_count(memview) == 0;
25402     if (first_time) {
25403         if (have_gil) {
25404             Py_INCREF((PyObject *) memview);
25405         } else {
25406             PyGILState_STATE _gilstate = PyGILState_Ensure();
25407             Py_INCREF((PyObject *) memview);
25408             PyGILState_Release(_gilstate);
25409         }
25410     }
25411 }
__Pyx_XDEC_MEMVIEW(__Pyx_memviewslice * memslice,int have_gil,int lineno)25412 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
25413                                              int have_gil, int lineno) {
25414     int last_time;
25415     struct __pyx_memoryview_obj *memview = memslice->memview;
25416     if (!memview ) {
25417         return;
25418     } else if ((PyObject *) memview == Py_None) {
25419         memslice->memview = NULL;
25420         return;
25421     }
25422     if (__pyx_get_slice_count(memview) <= 0)
25423         __pyx_fatalerror("Acquisition count is %d (line %d)",
25424                          __pyx_get_slice_count(memview), lineno);
25425     last_time = __pyx_sub_acquisition_count(memview) == 1;
25426     memslice->data = NULL;
25427     if (last_time) {
25428         if (have_gil) {
25429             Py_CLEAR(memslice->memview);
25430         } else {
25431             PyGILState_STATE _gilstate = PyGILState_Ensure();
25432             Py_CLEAR(memslice->memview);
25433             PyGILState_Release(_gilstate);
25434         }
25435     } else {
25436         memslice->memview = NULL;
25437     }
25438 }
25439 
25440 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)25441   static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
25442     PyObject *args, *result = NULL;
25443     #if CYTHON_FAST_PYCALL
25444     if (PyFunction_Check(function)) {
25445         PyObject *args[2] = {arg1, arg2};
25446         return __Pyx_PyFunction_FastCall(function, args, 2);
25447     }
25448     #endif
25449     #if CYTHON_FAST_PYCCALL
25450     if (__Pyx_PyFastCFunction_Check(function)) {
25451         PyObject *args[2] = {arg1, arg2};
25452         return __Pyx_PyCFunction_FastCall(function, args, 2);
25453     }
25454     #endif
25455     args = PyTuple_New(2);
25456     if (unlikely(!args)) goto done;
25457     Py_INCREF(arg1);
25458     PyTuple_SET_ITEM(args, 0, arg1);
25459     Py_INCREF(arg2);
25460     PyTuple_SET_ITEM(args, 1, arg2);
25461     Py_INCREF(function);
25462     result = __Pyx_PyObject_Call(function, args, NULL);
25463     Py_DECREF(args);
25464     Py_DECREF(function);
25465 done:
25466     return result;
25467 }
25468 
25469 /* BufferFallbackError */
__Pyx_RaiseBufferFallbackError(void)25470   static void __Pyx_RaiseBufferFallbackError(void) {
25471   PyErr_SetString(PyExc_ValueError,
25472      "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
25473 }
25474 
25475 /* DictGetItem */
25476   #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
__Pyx_PyDict_GetItem(PyObject * d,PyObject * key)25477 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
25478     PyObject *value;
25479     value = PyDict_GetItemWithError(d, key);
25480     if (unlikely(!value)) {
25481         if (!PyErr_Occurred()) {
25482             if (unlikely(PyTuple_Check(key))) {
25483                 PyObject* args = PyTuple_Pack(1, key);
25484                 if (likely(args)) {
25485                     PyErr_SetObject(PyExc_KeyError, args);
25486                     Py_DECREF(args);
25487                 }
25488             } else {
25489                 PyErr_SetObject(PyExc_KeyError, key);
25490             }
25491         }
25492         return NULL;
25493     }
25494     Py_INCREF(value);
25495     return value;
25496 }
25497 #endif
25498 
25499 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)25500   static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
25501     PyErr_Format(PyExc_ValueError,
25502                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
25503 }
25504 
25505 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)25506   static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
25507     PyErr_Format(PyExc_ValueError,
25508                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
25509                  index, (index == 1) ? "" : "s");
25510 }
25511 
25512 /* RaiseNoneIterError */
__Pyx_RaiseNoneNotIterableError(void)25513   static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
25514     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
25515 }
25516 
25517 /* GetTopmostException */
25518   #if CYTHON_USE_EXC_INFO_STACK
25519 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)25520 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
25521 {
25522     _PyErr_StackItem *exc_info = tstate->exc_info;
25523     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
25524            exc_info->previous_item != NULL)
25525     {
25526         exc_info = exc_info->previous_item;
25527     }
25528     return exc_info;
25529 }
25530 #endif
25531 
25532 /* SaveResetException */
25533   #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)25534 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
25535     #if CYTHON_USE_EXC_INFO_STACK
25536     _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
25537     *type = exc_info->exc_type;
25538     *value = exc_info->exc_value;
25539     *tb = exc_info->exc_traceback;
25540     #else
25541     *type = tstate->exc_type;
25542     *value = tstate->exc_value;
25543     *tb = tstate->exc_traceback;
25544     #endif
25545     Py_XINCREF(*type);
25546     Py_XINCREF(*value);
25547     Py_XINCREF(*tb);
25548 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)25549 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
25550     PyObject *tmp_type, *tmp_value, *tmp_tb;
25551     #if CYTHON_USE_EXC_INFO_STACK
25552     _PyErr_StackItem *exc_info = tstate->exc_info;
25553     tmp_type = exc_info->exc_type;
25554     tmp_value = exc_info->exc_value;
25555     tmp_tb = exc_info->exc_traceback;
25556     exc_info->exc_type = type;
25557     exc_info->exc_value = value;
25558     exc_info->exc_traceback = tb;
25559     #else
25560     tmp_type = tstate->exc_type;
25561     tmp_value = tstate->exc_value;
25562     tmp_tb = tstate->exc_traceback;
25563     tstate->exc_type = type;
25564     tstate->exc_value = value;
25565     tstate->exc_traceback = tb;
25566     #endif
25567     Py_XDECREF(tmp_type);
25568     Py_XDECREF(tmp_value);
25569     Py_XDECREF(tmp_tb);
25570 }
25571 #endif
25572 
25573 /* PyErrExceptionMatches */
25574   #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)25575 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
25576     Py_ssize_t i, n;
25577     n = PyTuple_GET_SIZE(tuple);
25578 #if PY_MAJOR_VERSION >= 3
25579     for (i=0; i<n; i++) {
25580         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
25581     }
25582 #endif
25583     for (i=0; i<n; i++) {
25584         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
25585     }
25586     return 0;
25587 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)25588 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
25589     PyObject *exc_type = tstate->curexc_type;
25590     if (exc_type == err) return 1;
25591     if (unlikely(!exc_type)) return 0;
25592     if (unlikely(PyTuple_Check(err)))
25593         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
25594     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
25595 }
25596 #endif
25597 
25598 /* GetException */
25599   #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)25600 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
25601 #else
25602 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
25603 #endif
25604 {
25605     PyObject *local_type, *local_value, *local_tb;
25606 #if CYTHON_FAST_THREAD_STATE
25607     PyObject *tmp_type, *tmp_value, *tmp_tb;
25608     local_type = tstate->curexc_type;
25609     local_value = tstate->curexc_value;
25610     local_tb = tstate->curexc_traceback;
25611     tstate->curexc_type = 0;
25612     tstate->curexc_value = 0;
25613     tstate->curexc_traceback = 0;
25614 #else
25615     PyErr_Fetch(&local_type, &local_value, &local_tb);
25616 #endif
25617     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
25618 #if CYTHON_FAST_THREAD_STATE
25619     if (unlikely(tstate->curexc_type))
25620 #else
25621     if (unlikely(PyErr_Occurred()))
25622 #endif
25623         goto bad;
25624     #if PY_MAJOR_VERSION >= 3
25625     if (local_tb) {
25626         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
25627             goto bad;
25628     }
25629     #endif
25630     Py_XINCREF(local_tb);
25631     Py_XINCREF(local_type);
25632     Py_XINCREF(local_value);
25633     *type = local_type;
25634     *value = local_value;
25635     *tb = local_tb;
25636 #if CYTHON_FAST_THREAD_STATE
25637     #if CYTHON_USE_EXC_INFO_STACK
25638     {
25639         _PyErr_StackItem *exc_info = tstate->exc_info;
25640         tmp_type = exc_info->exc_type;
25641         tmp_value = exc_info->exc_value;
25642         tmp_tb = exc_info->exc_traceback;
25643         exc_info->exc_type = local_type;
25644         exc_info->exc_value = local_value;
25645         exc_info->exc_traceback = local_tb;
25646     }
25647     #else
25648     tmp_type = tstate->exc_type;
25649     tmp_value = tstate->exc_value;
25650     tmp_tb = tstate->exc_traceback;
25651     tstate->exc_type = local_type;
25652     tstate->exc_value = local_value;
25653     tstate->exc_traceback = local_tb;
25654     #endif
25655     Py_XDECREF(tmp_type);
25656     Py_XDECREF(tmp_value);
25657     Py_XDECREF(tmp_tb);
25658 #else
25659     PyErr_SetExcInfo(local_type, local_value, local_tb);
25660 #endif
25661     return 0;
25662 bad:
25663     *type = 0;
25664     *value = 0;
25665     *tb = 0;
25666     Py_XDECREF(local_type);
25667     Py_XDECREF(local_value);
25668     Py_XDECREF(local_tb);
25669     return -1;
25670 }
25671 
25672 /* BytesEquals */
__Pyx_PyBytes_Equals(PyObject * s1,PyObject * s2,int equals)25673   static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
25674 #if CYTHON_COMPILING_IN_PYPY
25675     return PyObject_RichCompareBool(s1, s2, equals);
25676 #else
25677     if (s1 == s2) {
25678         return (equals == Py_EQ);
25679     } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
25680         const char *ps1, *ps2;
25681         Py_ssize_t length = PyBytes_GET_SIZE(s1);
25682         if (length != PyBytes_GET_SIZE(s2))
25683             return (equals == Py_NE);
25684         ps1 = PyBytes_AS_STRING(s1);
25685         ps2 = PyBytes_AS_STRING(s2);
25686         if (ps1[0] != ps2[0]) {
25687             return (equals == Py_NE);
25688         } else if (length == 1) {
25689             return (equals == Py_EQ);
25690         } else {
25691             int result;
25692 #if CYTHON_USE_UNICODE_INTERNALS
25693             Py_hash_t hash1, hash2;
25694             hash1 = ((PyBytesObject*)s1)->ob_shash;
25695             hash2 = ((PyBytesObject*)s2)->ob_shash;
25696             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
25697                 return (equals == Py_NE);
25698             }
25699 #endif
25700             result = memcmp(ps1, ps2, (size_t)length);
25701             return (equals == Py_EQ) ? (result == 0) : (result != 0);
25702         }
25703     } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
25704         return (equals == Py_NE);
25705     } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
25706         return (equals == Py_NE);
25707     } else {
25708         int result;
25709         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
25710         if (!py_result)
25711             return -1;
25712         result = __Pyx_PyObject_IsTrue(py_result);
25713         Py_DECREF(py_result);
25714         return result;
25715     }
25716 #endif
25717 }
25718 
25719 /* UnicodeEquals */
__Pyx_PyUnicode_Equals(PyObject * s1,PyObject * s2,int equals)25720   static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
25721 #if CYTHON_COMPILING_IN_PYPY
25722     return PyObject_RichCompareBool(s1, s2, equals);
25723 #else
25724 #if PY_MAJOR_VERSION < 3
25725     PyObject* owned_ref = NULL;
25726 #endif
25727     int s1_is_unicode, s2_is_unicode;
25728     if (s1 == s2) {
25729         goto return_eq;
25730     }
25731     s1_is_unicode = PyUnicode_CheckExact(s1);
25732     s2_is_unicode = PyUnicode_CheckExact(s2);
25733 #if PY_MAJOR_VERSION < 3
25734     if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
25735         owned_ref = PyUnicode_FromObject(s2);
25736         if (unlikely(!owned_ref))
25737             return -1;
25738         s2 = owned_ref;
25739         s2_is_unicode = 1;
25740     } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
25741         owned_ref = PyUnicode_FromObject(s1);
25742         if (unlikely(!owned_ref))
25743             return -1;
25744         s1 = owned_ref;
25745         s1_is_unicode = 1;
25746     } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
25747         return __Pyx_PyBytes_Equals(s1, s2, equals);
25748     }
25749 #endif
25750     if (s1_is_unicode & s2_is_unicode) {
25751         Py_ssize_t length;
25752         int kind;
25753         void *data1, *data2;
25754         if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
25755             return -1;
25756         length = __Pyx_PyUnicode_GET_LENGTH(s1);
25757         if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
25758             goto return_ne;
25759         }
25760 #if CYTHON_USE_UNICODE_INTERNALS
25761         {
25762             Py_hash_t hash1, hash2;
25763         #if CYTHON_PEP393_ENABLED
25764             hash1 = ((PyASCIIObject*)s1)->hash;
25765             hash2 = ((PyASCIIObject*)s2)->hash;
25766         #else
25767             hash1 = ((PyUnicodeObject*)s1)->hash;
25768             hash2 = ((PyUnicodeObject*)s2)->hash;
25769         #endif
25770             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
25771                 goto return_ne;
25772             }
25773         }
25774 #endif
25775         kind = __Pyx_PyUnicode_KIND(s1);
25776         if (kind != __Pyx_PyUnicode_KIND(s2)) {
25777             goto return_ne;
25778         }
25779         data1 = __Pyx_PyUnicode_DATA(s1);
25780         data2 = __Pyx_PyUnicode_DATA(s2);
25781         if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
25782             goto return_ne;
25783         } else if (length == 1) {
25784             goto return_eq;
25785         } else {
25786             int result = memcmp(data1, data2, (size_t)(length * kind));
25787             #if PY_MAJOR_VERSION < 3
25788             Py_XDECREF(owned_ref);
25789             #endif
25790             return (equals == Py_EQ) ? (result == 0) : (result != 0);
25791         }
25792     } else if ((s1 == Py_None) & s2_is_unicode) {
25793         goto return_ne;
25794     } else if ((s2 == Py_None) & s1_is_unicode) {
25795         goto return_ne;
25796     } else {
25797         int result;
25798         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
25799         #if PY_MAJOR_VERSION < 3
25800         Py_XDECREF(owned_ref);
25801         #endif
25802         if (!py_result)
25803             return -1;
25804         result = __Pyx_PyObject_IsTrue(py_result);
25805         Py_DECREF(py_result);
25806         return result;
25807     }
25808 return_eq:
25809     #if PY_MAJOR_VERSION < 3
25810     Py_XDECREF(owned_ref);
25811     #endif
25812     return (equals == Py_EQ);
25813 return_ne:
25814     #if PY_MAJOR_VERSION < 3
25815     Py_XDECREF(owned_ref);
25816     #endif
25817     return (equals == Py_NE);
25818 #endif
25819 }
25820 
25821 /* None */
__Pyx_div_Py_ssize_t(Py_ssize_t a,Py_ssize_t b)25822   static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
25823     Py_ssize_t q = a / b;
25824     Py_ssize_t r = a - q*b;
25825     q -= ((r != 0) & ((r ^ b) < 0));
25826     return q;
25827 }
25828 
25829 /* GetAttr */
__Pyx_GetAttr(PyObject * o,PyObject * n)25830   static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
25831 #if CYTHON_USE_TYPE_SLOTS
25832 #if PY_MAJOR_VERSION >= 3
25833     if (likely(PyUnicode_Check(n)))
25834 #else
25835     if (likely(PyString_Check(n)))
25836 #endif
25837         return __Pyx_PyObject_GetAttrStr(o, n);
25838 #endif
25839     return PyObject_GetAttr(o, n);
25840 }
25841 
25842 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)25843   static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
25844     PyObject *r;
25845     if (!j) return NULL;
25846     r = PyObject_GetItem(o, j);
25847     Py_DECREF(j);
25848     return r;
25849 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)25850 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
25851                                                               CYTHON_NCP_UNUSED int wraparound,
25852                                                               CYTHON_NCP_UNUSED int boundscheck) {
25853 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
25854     Py_ssize_t wrapped_i = i;
25855     if (wraparound & unlikely(i < 0)) {
25856         wrapped_i += PyList_GET_SIZE(o);
25857     }
25858     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
25859         PyObject *r = PyList_GET_ITEM(o, wrapped_i);
25860         Py_INCREF(r);
25861         return r;
25862     }
25863     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
25864 #else
25865     return PySequence_GetItem(o, i);
25866 #endif
25867 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)25868 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
25869                                                               CYTHON_NCP_UNUSED int wraparound,
25870                                                               CYTHON_NCP_UNUSED int boundscheck) {
25871 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
25872     Py_ssize_t wrapped_i = i;
25873     if (wraparound & unlikely(i < 0)) {
25874         wrapped_i += PyTuple_GET_SIZE(o);
25875     }
25876     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
25877         PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
25878         Py_INCREF(r);
25879         return r;
25880     }
25881     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
25882 #else
25883     return PySequence_GetItem(o, i);
25884 #endif
25885 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)25886 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
25887                                                      CYTHON_NCP_UNUSED int wraparound,
25888                                                      CYTHON_NCP_UNUSED int boundscheck) {
25889 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
25890     if (is_list || PyList_CheckExact(o)) {
25891         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
25892         if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
25893             PyObject *r = PyList_GET_ITEM(o, n);
25894             Py_INCREF(r);
25895             return r;
25896         }
25897     }
25898     else if (PyTuple_CheckExact(o)) {
25899         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
25900         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
25901             PyObject *r = PyTuple_GET_ITEM(o, n);
25902             Py_INCREF(r);
25903             return r;
25904         }
25905     } else {
25906         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
25907         if (likely(m && m->sq_item)) {
25908             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
25909                 Py_ssize_t l = m->sq_length(o);
25910                 if (likely(l >= 0)) {
25911                     i += l;
25912                 } else {
25913                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
25914                         return NULL;
25915                     PyErr_Clear();
25916                 }
25917             }
25918             return m->sq_item(o, i);
25919         }
25920     }
25921 #else
25922     if (is_list || PySequence_Check(o)) {
25923         return PySequence_GetItem(o, i);
25924     }
25925 #endif
25926     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
25927 }
25928 
25929 /* ObjectGetItem */
25930   #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetIndex(PyObject * obj,PyObject * index)25931 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
25932     PyObject *runerr;
25933     Py_ssize_t key_value;
25934     PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
25935     if (unlikely(!(m && m->sq_item))) {
25936         PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
25937         return NULL;
25938     }
25939     key_value = __Pyx_PyIndex_AsSsize_t(index);
25940     if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
25941         return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
25942     }
25943     if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
25944         PyErr_Clear();
25945         PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
25946     }
25947     return NULL;
25948 }
__Pyx_PyObject_GetItem(PyObject * obj,PyObject * key)25949 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
25950     PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
25951     if (likely(m && m->mp_subscript)) {
25952         return m->mp_subscript(obj, key);
25953     }
25954     return __Pyx_PyObject_GetIndex(obj, key);
25955 }
25956 #endif
25957 
25958 /* 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))25959   static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
25960          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
25961          const char* encoding, const char* errors,
25962          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
25963     Py_ssize_t length;
25964     if (unlikely((start < 0) | (stop < 0))) {
25965         size_t slen = strlen(cstring);
25966         if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
25967             PyErr_SetString(PyExc_OverflowError,
25968                             "c-string too long to convert to Python");
25969             return NULL;
25970         }
25971         length = (Py_ssize_t) slen;
25972         if (start < 0) {
25973             start += length;
25974             if (start < 0)
25975                 start = 0;
25976         }
25977         if (stop < 0)
25978             stop += length;
25979     }
25980     length = stop - start;
25981     if (unlikely(length <= 0))
25982         return PyUnicode_FromUnicode(NULL, 0);
25983     cstring += start;
25984     if (decode_func) {
25985         return decode_func(cstring, length, errors);
25986     } else {
25987         return PyUnicode_Decode(cstring, length, encoding, errors);
25988     }
25989 }
25990 
25991 /* GetAttr3 */
__Pyx_GetAttr3Default(PyObject * d)25992   static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
25993     __Pyx_PyThreadState_declare
25994     __Pyx_PyThreadState_assign
25995     if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
25996         return NULL;
25997     __Pyx_PyErr_Clear();
25998     Py_INCREF(d);
25999     return d;
26000 }
__Pyx_GetAttr3(PyObject * o,PyObject * n,PyObject * d)26001 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
26002     PyObject *r = __Pyx_GetAttr(o, n);
26003     return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
26004 }
26005 
26006 /* SwapException */
26007   #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSwap(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)26008 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
26009     PyObject *tmp_type, *tmp_value, *tmp_tb;
26010     #if CYTHON_USE_EXC_INFO_STACK
26011     _PyErr_StackItem *exc_info = tstate->exc_info;
26012     tmp_type = exc_info->exc_type;
26013     tmp_value = exc_info->exc_value;
26014     tmp_tb = exc_info->exc_traceback;
26015     exc_info->exc_type = *type;
26016     exc_info->exc_value = *value;
26017     exc_info->exc_traceback = *tb;
26018     #else
26019     tmp_type = tstate->exc_type;
26020     tmp_value = tstate->exc_value;
26021     tmp_tb = tstate->exc_traceback;
26022     tstate->exc_type = *type;
26023     tstate->exc_value = *value;
26024     tstate->exc_traceback = *tb;
26025     #endif
26026     *type = tmp_type;
26027     *value = tmp_value;
26028     *tb = tmp_tb;
26029 }
26030 #else
__Pyx_ExceptionSwap(PyObject ** type,PyObject ** value,PyObject ** tb)26031 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
26032     PyObject *tmp_type, *tmp_value, *tmp_tb;
26033     PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
26034     PyErr_SetExcInfo(*type, *value, *tb);
26035     *type = tmp_type;
26036     *value = tmp_value;
26037     *tb = tmp_tb;
26038 }
26039 #endif
26040 
26041 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)26042   static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
26043     PyObject *empty_list = 0;
26044     PyObject *module = 0;
26045     PyObject *global_dict = 0;
26046     PyObject *empty_dict = 0;
26047     PyObject *list;
26048     #if PY_MAJOR_VERSION < 3
26049     PyObject *py_import;
26050     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
26051     if (!py_import)
26052         goto bad;
26053     #endif
26054     if (from_list)
26055         list = from_list;
26056     else {
26057         empty_list = PyList_New(0);
26058         if (!empty_list)
26059             goto bad;
26060         list = empty_list;
26061     }
26062     global_dict = PyModule_GetDict(__pyx_m);
26063     if (!global_dict)
26064         goto bad;
26065     empty_dict = PyDict_New();
26066     if (!empty_dict)
26067         goto bad;
26068     {
26069         #if PY_MAJOR_VERSION >= 3
26070         if (level == -1) {
26071             if (strchr(__Pyx_MODULE_NAME, '.')) {
26072                 module = PyImport_ImportModuleLevelObject(
26073                     name, global_dict, empty_dict, list, 1);
26074                 if (!module) {
26075                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
26076                         goto bad;
26077                     PyErr_Clear();
26078                 }
26079             }
26080             level = 0;
26081         }
26082         #endif
26083         if (!module) {
26084             #if PY_MAJOR_VERSION < 3
26085             PyObject *py_level = PyInt_FromLong(level);
26086             if (!py_level)
26087                 goto bad;
26088             module = PyObject_CallFunctionObjArgs(py_import,
26089                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
26090             Py_DECREF(py_level);
26091             #else
26092             module = PyImport_ImportModuleLevelObject(
26093                 name, global_dict, empty_dict, list, level);
26094             #endif
26095         }
26096     }
26097 bad:
26098     #if PY_MAJOR_VERSION < 3
26099     Py_XDECREF(py_import);
26100     #endif
26101     Py_XDECREF(empty_list);
26102     Py_XDECREF(empty_dict);
26103     return module;
26104 }
26105 
26106 /* FastTypeChecks */
26107   #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)26108 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
26109     while (a) {
26110         a = a->tp_base;
26111         if (a == b)
26112             return 1;
26113     }
26114     return b == &PyBaseObject_Type;
26115 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)26116 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
26117     PyObject *mro;
26118     if (a == b) return 1;
26119     mro = a->tp_mro;
26120     if (likely(mro)) {
26121         Py_ssize_t i, n;
26122         n = PyTuple_GET_SIZE(mro);
26123         for (i = 0; i < n; i++) {
26124             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
26125                 return 1;
26126         }
26127         return 0;
26128     }
26129     return __Pyx_InBases(a, b);
26130 }
26131 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)26132 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
26133     PyObject *exception, *value, *tb;
26134     int res;
26135     __Pyx_PyThreadState_declare
26136     __Pyx_PyThreadState_assign
26137     __Pyx_ErrFetch(&exception, &value, &tb);
26138     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
26139     if (unlikely(res == -1)) {
26140         PyErr_WriteUnraisable(err);
26141         res = 0;
26142     }
26143     if (!res) {
26144         res = PyObject_IsSubclass(err, exc_type2);
26145         if (unlikely(res == -1)) {
26146             PyErr_WriteUnraisable(err);
26147             res = 0;
26148         }
26149     }
26150     __Pyx_ErrRestore(exception, value, tb);
26151     return res;
26152 }
26153 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)26154 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
26155     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
26156     if (!res) {
26157         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
26158     }
26159     return res;
26160 }
26161 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)26162 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
26163     Py_ssize_t i, n;
26164     assert(PyExceptionClass_Check(exc_type));
26165     n = PyTuple_GET_SIZE(tuple);
26166 #if PY_MAJOR_VERSION >= 3
26167     for (i=0; i<n; i++) {
26168         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
26169     }
26170 #endif
26171     for (i=0; i<n; i++) {
26172         PyObject *t = PyTuple_GET_ITEM(tuple, i);
26173         #if PY_MAJOR_VERSION < 3
26174         if (likely(exc_type == t)) return 1;
26175         #endif
26176         if (likely(PyExceptionClass_Check(t))) {
26177             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
26178         } else {
26179         }
26180     }
26181     return 0;
26182 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)26183 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
26184     if (likely(err == exc_type)) return 1;
26185     if (likely(PyExceptionClass_Check(err))) {
26186         if (likely(PyExceptionClass_Check(exc_type))) {
26187             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
26188         } else if (likely(PyTuple_Check(exc_type))) {
26189             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
26190         } else {
26191         }
26192     }
26193     return PyErr_GivenExceptionMatches(err, exc_type);
26194 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)26195 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
26196     assert(PyExceptionClass_Check(exc_type1));
26197     assert(PyExceptionClass_Check(exc_type2));
26198     if (likely(err == exc_type1 || err == exc_type2)) return 1;
26199     if (likely(PyExceptionClass_Check(err))) {
26200         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
26201     }
26202     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
26203 }
26204 #endif
26205 
26206 /* PyIntBinop */
26207   #if !CYTHON_COMPILING_IN_PYPY
__Pyx_PyInt_AddObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,int inplace,int zerodivision_check)26208 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
26209     (void)inplace;
26210     (void)zerodivision_check;
26211     #if PY_MAJOR_VERSION < 3
26212     if (likely(PyInt_CheckExact(op1))) {
26213         const long b = intval;
26214         long x;
26215         long a = PyInt_AS_LONG(op1);
26216             x = (long)((unsigned long)a + b);
26217             if (likely((x^a) >= 0 || (x^b) >= 0))
26218                 return PyInt_FromLong(x);
26219             return PyLong_Type.tp_as_number->nb_add(op1, op2);
26220     }
26221     #endif
26222     #if CYTHON_USE_PYLONG_INTERNALS
26223     if (likely(PyLong_CheckExact(op1))) {
26224         const long b = intval;
26225         long a, x;
26226 #ifdef HAVE_LONG_LONG
26227         const PY_LONG_LONG llb = intval;
26228         PY_LONG_LONG lla, llx;
26229 #endif
26230         const digit* digits = ((PyLongObject*)op1)->ob_digit;
26231         const Py_ssize_t size = Py_SIZE(op1);
26232         if (likely(__Pyx_sst_abs(size) <= 1)) {
26233             a = likely(size) ? digits[0] : 0;
26234             if (size == -1) a = -a;
26235         } else {
26236             switch (size) {
26237                 case -2:
26238                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
26239                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
26240                         break;
26241 #ifdef HAVE_LONG_LONG
26242                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
26243                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
26244                         goto long_long;
26245 #endif
26246                     }
26247                     CYTHON_FALLTHROUGH;
26248                 case 2:
26249                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
26250                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
26251                         break;
26252 #ifdef HAVE_LONG_LONG
26253                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
26254                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
26255                         goto long_long;
26256 #endif
26257                     }
26258                     CYTHON_FALLTHROUGH;
26259                 case -3:
26260                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
26261                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
26262                         break;
26263 #ifdef HAVE_LONG_LONG
26264                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
26265                         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]));
26266                         goto long_long;
26267 #endif
26268                     }
26269                     CYTHON_FALLTHROUGH;
26270                 case 3:
26271                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
26272                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
26273                         break;
26274 #ifdef HAVE_LONG_LONG
26275                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
26276                         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]));
26277                         goto long_long;
26278 #endif
26279                     }
26280                     CYTHON_FALLTHROUGH;
26281                 case -4:
26282                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
26283                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
26284                         break;
26285 #ifdef HAVE_LONG_LONG
26286                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
26287                         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]));
26288                         goto long_long;
26289 #endif
26290                     }
26291                     CYTHON_FALLTHROUGH;
26292                 case 4:
26293                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
26294                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
26295                         break;
26296 #ifdef HAVE_LONG_LONG
26297                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
26298                         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]));
26299                         goto long_long;
26300 #endif
26301                     }
26302                     CYTHON_FALLTHROUGH;
26303                 default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
26304             }
26305         }
26306                 x = a + b;
26307             return PyLong_FromLong(x);
26308 #ifdef HAVE_LONG_LONG
26309         long_long:
26310                 llx = lla + llb;
26311             return PyLong_FromLongLong(llx);
26312 #endif
26313 
26314 
26315     }
26316     #endif
26317     if (PyFloat_CheckExact(op1)) {
26318         const long b = intval;
26319         double a = PyFloat_AS_DOUBLE(op1);
26320             double result;
26321             PyFPE_START_PROTECT("add", return NULL)
26322             result = ((double)a) + (double)b;
26323             PyFPE_END_PROTECT(result)
26324             return PyFloat_FromDouble(result);
26325     }
26326     return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
26327 }
26328 #endif
26329 
26330 /* None */
__Pyx_RaiseUnboundLocalError(const char * varname)26331   static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
26332     PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
26333 }
26334 
26335 /* None */
__Pyx_div_long(long a,long b)26336   static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
26337     long q = a / b;
26338     long r = a - q*b;
26339     q -= ((r != 0) & ((r ^ b) < 0));
26340     return q;
26341 }
26342 
26343 /* 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)26344   static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
26345                                   CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
26346                                   int full_traceback, CYTHON_UNUSED int nogil) {
26347     PyObject *old_exc, *old_val, *old_tb;
26348     PyObject *ctx;
26349     __Pyx_PyThreadState_declare
26350 #ifdef WITH_THREAD
26351     PyGILState_STATE state;
26352     if (nogil)
26353         state = PyGILState_Ensure();
26354 #ifdef _MSC_VER
26355     else state = (PyGILState_STATE)-1;
26356 #endif
26357 #endif
26358     __Pyx_PyThreadState_assign
26359     __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
26360     if (full_traceback) {
26361         Py_XINCREF(old_exc);
26362         Py_XINCREF(old_val);
26363         Py_XINCREF(old_tb);
26364         __Pyx_ErrRestore(old_exc, old_val, old_tb);
26365         PyErr_PrintEx(1);
26366     }
26367     #if PY_MAJOR_VERSION < 3
26368     ctx = PyString_FromString(name);
26369     #else
26370     ctx = PyUnicode_FromString(name);
26371     #endif
26372     __Pyx_ErrRestore(old_exc, old_val, old_tb);
26373     if (!ctx) {
26374         PyErr_WriteUnraisable(Py_None);
26375     } else {
26376         PyErr_WriteUnraisable(ctx);
26377         Py_DECREF(ctx);
26378     }
26379 #ifdef WITH_THREAD
26380     if (nogil)
26381         PyGILState_Release(state);
26382 #endif
26383 }
26384 
26385 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)26386   static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
26387     PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
26388     if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
26389         PyErr_Format(PyExc_ImportError,
26390         #if PY_MAJOR_VERSION < 3
26391             "cannot import name %.230s", PyString_AS_STRING(name));
26392         #else
26393             "cannot import name %S", name);
26394         #endif
26395     }
26396     return value;
26397 }
26398 
26399 /* HasAttr */
__Pyx_HasAttr(PyObject * o,PyObject * n)26400   static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
26401     PyObject *r;
26402     if (unlikely(!__Pyx_PyBaseString_Check(n))) {
26403         PyErr_SetString(PyExc_TypeError,
26404                         "hasattr(): attribute name must be string");
26405         return -1;
26406     }
26407     r = __Pyx_GetAttr(o, n);
26408     if (unlikely(!r)) {
26409         PyErr_Clear();
26410         return 0;
26411     } else {
26412         Py_DECREF(r);
26413         return 1;
26414     }
26415 }
26416 
26417 /* PyObject_GenericGetAttrNoDict */
26418   #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)26419 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
26420     PyErr_Format(PyExc_AttributeError,
26421 #if PY_MAJOR_VERSION >= 3
26422                  "'%.50s' object has no attribute '%U'",
26423                  tp->tp_name, attr_name);
26424 #else
26425                  "'%.50s' object has no attribute '%.400s'",
26426                  tp->tp_name, PyString_AS_STRING(attr_name));
26427 #endif
26428     return NULL;
26429 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)26430 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
26431     PyObject *descr;
26432     PyTypeObject *tp = Py_TYPE(obj);
26433     if (unlikely(!PyString_Check(attr_name))) {
26434         return PyObject_GenericGetAttr(obj, attr_name);
26435     }
26436     assert(!tp->tp_dictoffset);
26437     descr = _PyType_Lookup(tp, attr_name);
26438     if (unlikely(!descr)) {
26439         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
26440     }
26441     Py_INCREF(descr);
26442     #if PY_MAJOR_VERSION < 3
26443     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
26444     #endif
26445     {
26446         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
26447         if (unlikely(f)) {
26448             PyObject *res = f(descr, obj, (PyObject *)tp);
26449             Py_DECREF(descr);
26450             return res;
26451         }
26452     }
26453     return descr;
26454 }
26455 #endif
26456 
26457 /* PyObject_GenericGetAttr */
26458   #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)26459 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
26460     if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
26461         return PyObject_GenericGetAttr(obj, attr_name);
26462     }
26463     return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
26464 }
26465 #endif
26466 
26467 /* SetVTable */
__Pyx_SetVtable(PyObject * dict,void * vtable)26468   static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
26469 #if PY_VERSION_HEX >= 0x02070000
26470     PyObject *ob = PyCapsule_New(vtable, 0, 0);
26471 #else
26472     PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
26473 #endif
26474     if (!ob)
26475         goto bad;
26476     if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
26477         goto bad;
26478     Py_DECREF(ob);
26479     return 0;
26480 bad:
26481     Py_XDECREF(ob);
26482     return -1;
26483 }
26484 
26485 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)26486   static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
26487   int ret;
26488   PyObject *name_attr;
26489   name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
26490   if (likely(name_attr)) {
26491       ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
26492   } else {
26493       ret = -1;
26494   }
26495   if (unlikely(ret < 0)) {
26496       PyErr_Clear();
26497       ret = 0;
26498   }
26499   Py_XDECREF(name_attr);
26500   return ret;
26501 }
__Pyx_setup_reduce(PyObject * type_obj)26502 static int __Pyx_setup_reduce(PyObject* type_obj) {
26503     int ret = 0;
26504     PyObject *object_reduce = NULL;
26505     PyObject *object_reduce_ex = NULL;
26506     PyObject *reduce = NULL;
26507     PyObject *reduce_ex = NULL;
26508     PyObject *reduce_cython = NULL;
26509     PyObject *setstate = NULL;
26510     PyObject *setstate_cython = NULL;
26511 #if CYTHON_USE_PYTYPE_LOOKUP
26512     if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD;
26513 #else
26514     if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD;
26515 #endif
26516 #if CYTHON_USE_PYTYPE_LOOKUP
26517     object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
26518 #else
26519     object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
26520 #endif
26521     reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto BAD;
26522     if (reduce_ex == object_reduce_ex) {
26523 #if CYTHON_USE_PYTYPE_LOOKUP
26524         object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
26525 #else
26526         object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
26527 #endif
26528         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto BAD;
26529         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
26530             reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD;
26531             ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD;
26532             ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD;
26533             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
26534             if (!setstate) PyErr_Clear();
26535             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
26536                 setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD;
26537                 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD;
26538                 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD;
26539             }
26540             PyType_Modified((PyTypeObject*)type_obj);
26541         }
26542     }
26543     goto GOOD;
26544 BAD:
26545     if (!PyErr_Occurred())
26546         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
26547     ret = -1;
26548 GOOD:
26549 #if !CYTHON_USE_PYTYPE_LOOKUP
26550     Py_XDECREF(object_reduce);
26551     Py_XDECREF(object_reduce_ex);
26552 #endif
26553     Py_XDECREF(reduce);
26554     Py_XDECREF(reduce_ex);
26555     Py_XDECREF(reduce_cython);
26556     Py_XDECREF(setstate);
26557     Py_XDECREF(setstate_cython);
26558     return ret;
26559 }
26560 
26561 /* TypeImport */
26562   #ifndef __PYX_HAVE_RT_ImportType
26563 #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)26564 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
26565     size_t size, enum __Pyx_ImportType_CheckSize check_size)
26566 {
26567     PyObject *result = 0;
26568     char warning[200];
26569     Py_ssize_t basicsize;
26570 #ifdef Py_LIMITED_API
26571     PyObject *py_basicsize;
26572 #endif
26573     result = PyObject_GetAttrString(module, class_name);
26574     if (!result)
26575         goto bad;
26576     if (!PyType_Check(result)) {
26577         PyErr_Format(PyExc_TypeError,
26578             "%.200s.%.200s is not a type object",
26579             module_name, class_name);
26580         goto bad;
26581     }
26582 #ifndef Py_LIMITED_API
26583     basicsize = ((PyTypeObject *)result)->tp_basicsize;
26584 #else
26585     py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
26586     if (!py_basicsize)
26587         goto bad;
26588     basicsize = PyLong_AsSsize_t(py_basicsize);
26589     Py_DECREF(py_basicsize);
26590     py_basicsize = 0;
26591     if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
26592         goto bad;
26593 #endif
26594     if ((size_t)basicsize < size) {
26595         PyErr_Format(PyExc_ValueError,
26596             "%.200s.%.200s size changed, may indicate binary incompatibility. "
26597             "Expected %zd from C header, got %zd from PyObject",
26598             module_name, class_name, size, basicsize);
26599         goto bad;
26600     }
26601     if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
26602         PyErr_Format(PyExc_ValueError,
26603             "%.200s.%.200s size changed, may indicate binary incompatibility. "
26604             "Expected %zd from C header, got %zd from PyObject",
26605             module_name, class_name, size, basicsize);
26606         goto bad;
26607     }
26608     else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
26609         PyOS_snprintf(warning, sizeof(warning),
26610             "%s.%s size changed, may indicate binary incompatibility. "
26611             "Expected %zd from C header, got %zd from PyObject",
26612             module_name, class_name, size, basicsize);
26613         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
26614     }
26615     return (PyTypeObject *)result;
26616 bad:
26617     Py_XDECREF(result);
26618     return NULL;
26619 }
26620 #endif
26621 
26622 /* CLineInTraceback */
26623   #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(PyThreadState * tstate,int c_line)26624 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
26625     PyObject *use_cline;
26626     PyObject *ptype, *pvalue, *ptraceback;
26627 #if CYTHON_COMPILING_IN_CPYTHON
26628     PyObject **cython_runtime_dict;
26629 #endif
26630     if (unlikely(!__pyx_cython_runtime)) {
26631         return c_line;
26632     }
26633     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
26634 #if CYTHON_COMPILING_IN_CPYTHON
26635     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
26636     if (likely(cython_runtime_dict)) {
26637         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
26638             use_cline, *cython_runtime_dict,
26639             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
26640     } else
26641 #endif
26642     {
26643       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
26644       if (use_cline_obj) {
26645         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
26646         Py_DECREF(use_cline_obj);
26647       } else {
26648         PyErr_Clear();
26649         use_cline = NULL;
26650       }
26651     }
26652     if (!use_cline) {
26653         c_line = 0;
26654         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
26655     }
26656     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
26657         c_line = 0;
26658     }
26659     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
26660     return c_line;
26661 }
26662 #endif
26663 
26664 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)26665   static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
26666     int start = 0, mid = 0, end = count - 1;
26667     if (end >= 0 && code_line > entries[end].code_line) {
26668         return count;
26669     }
26670     while (start < end) {
26671         mid = start + (end - start) / 2;
26672         if (code_line < entries[mid].code_line) {
26673             end = mid;
26674         } else if (code_line > entries[mid].code_line) {
26675              start = mid + 1;
26676         } else {
26677             return mid;
26678         }
26679     }
26680     if (code_line <= entries[mid].code_line) {
26681         return mid;
26682     } else {
26683         return mid + 1;
26684     }
26685 }
__pyx_find_code_object(int code_line)26686 static PyCodeObject *__pyx_find_code_object(int code_line) {
26687     PyCodeObject* code_object;
26688     int pos;
26689     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
26690         return NULL;
26691     }
26692     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
26693     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
26694         return NULL;
26695     }
26696     code_object = __pyx_code_cache.entries[pos].code_object;
26697     Py_INCREF(code_object);
26698     return code_object;
26699 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)26700 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
26701     int pos, i;
26702     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
26703     if (unlikely(!code_line)) {
26704         return;
26705     }
26706     if (unlikely(!entries)) {
26707         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
26708         if (likely(entries)) {
26709             __pyx_code_cache.entries = entries;
26710             __pyx_code_cache.max_count = 64;
26711             __pyx_code_cache.count = 1;
26712             entries[0].code_line = code_line;
26713             entries[0].code_object = code_object;
26714             Py_INCREF(code_object);
26715         }
26716         return;
26717     }
26718     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
26719     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
26720         PyCodeObject* tmp = entries[pos].code_object;
26721         entries[pos].code_object = code_object;
26722         Py_DECREF(tmp);
26723         return;
26724     }
26725     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
26726         int new_max = __pyx_code_cache.max_count + 64;
26727         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
26728             __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
26729         if (unlikely(!entries)) {
26730             return;
26731         }
26732         __pyx_code_cache.entries = entries;
26733         __pyx_code_cache.max_count = new_max;
26734     }
26735     for (i=__pyx_code_cache.count; i>pos; i--) {
26736         entries[i] = entries[i-1];
26737     }
26738     entries[pos].code_line = code_line;
26739     entries[pos].code_object = code_object;
26740     __pyx_code_cache.count++;
26741     Py_INCREF(code_object);
26742 }
26743 
26744 /* AddTraceback */
26745   #include "compile.h"
26746 #include "frameobject.h"
26747 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)26748 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
26749             const char *funcname, int c_line,
26750             int py_line, const char *filename) {
26751     PyCodeObject *py_code = 0;
26752     PyObject *py_srcfile = 0;
26753     PyObject *py_funcname = 0;
26754     #if PY_MAJOR_VERSION < 3
26755     py_srcfile = PyString_FromString(filename);
26756     #else
26757     py_srcfile = PyUnicode_FromString(filename);
26758     #endif
26759     if (!py_srcfile) goto bad;
26760     if (c_line) {
26761         #if PY_MAJOR_VERSION < 3
26762         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
26763         #else
26764         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
26765         #endif
26766     }
26767     else {
26768         #if PY_MAJOR_VERSION < 3
26769         py_funcname = PyString_FromString(funcname);
26770         #else
26771         py_funcname = PyUnicode_FromString(funcname);
26772         #endif
26773     }
26774     if (!py_funcname) goto bad;
26775     py_code = __Pyx_PyCode_New(
26776         0,
26777         0,
26778         0,
26779         0,
26780         0,
26781         __pyx_empty_bytes, /*PyObject *code,*/
26782         __pyx_empty_tuple, /*PyObject *consts,*/
26783         __pyx_empty_tuple, /*PyObject *names,*/
26784         __pyx_empty_tuple, /*PyObject *varnames,*/
26785         __pyx_empty_tuple, /*PyObject *freevars,*/
26786         __pyx_empty_tuple, /*PyObject *cellvars,*/
26787         py_srcfile,   /*PyObject *filename,*/
26788         py_funcname,  /*PyObject *name,*/
26789         py_line,
26790         __pyx_empty_bytes  /*PyObject *lnotab*/
26791     );
26792     Py_DECREF(py_srcfile);
26793     Py_DECREF(py_funcname);
26794     return py_code;
26795 bad:
26796     Py_XDECREF(py_srcfile);
26797     Py_XDECREF(py_funcname);
26798     return NULL;
26799 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)26800 static void __Pyx_AddTraceback(const char *funcname, int c_line,
26801                                int py_line, const char *filename) {
26802     PyCodeObject *py_code = 0;
26803     PyFrameObject *py_frame = 0;
26804     PyThreadState *tstate = __Pyx_PyThreadState_Current;
26805     if (c_line) {
26806         c_line = __Pyx_CLineForTraceback(tstate, c_line);
26807     }
26808     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
26809     if (!py_code) {
26810         py_code = __Pyx_CreateCodeObjectForTraceback(
26811             funcname, c_line, py_line, filename);
26812         if (!py_code) goto bad;
26813         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
26814     }
26815     py_frame = PyFrame_New(
26816         tstate,            /*PyThreadState *tstate,*/
26817         py_code,           /*PyCodeObject *code,*/
26818         __pyx_d,    /*PyObject *globals,*/
26819         0                  /*PyObject *locals*/
26820     );
26821     if (!py_frame) goto bad;
26822     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
26823     PyTraceBack_Here(py_frame);
26824 bad:
26825     Py_XDECREF(py_code);
26826     Py_XDECREF(py_frame);
26827 }
26828 
26829 #if PY_MAJOR_VERSION < 3
__Pyx_GetBuffer(PyObject * obj,Py_buffer * view,int flags)26830 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
26831     if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
26832         if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
26833         if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
26834         if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
26835     PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
26836     return -1;
26837 }
__Pyx_ReleaseBuffer(Py_buffer * view)26838 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
26839     PyObject *obj = view->obj;
26840     if (!obj) return;
26841     if (PyObject_CheckBuffer(obj)) {
26842         PyBuffer_Release(view);
26843         return;
26844     }
26845     if ((0)) {}
26846         else if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view);
26847     view->obj = NULL;
26848     Py_DECREF(obj);
26849 }
26850 #endif
26851 
26852 
26853   /* MemviewSliceIsContig */
26854   static int
__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs,char order,int ndim)26855 __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
26856 {
26857     int i, index, step, start;
26858     Py_ssize_t itemsize = mvs.memview->view.itemsize;
26859     if (order == 'F') {
26860         step = 1;
26861         start = 0;
26862     } else {
26863         step = -1;
26864         start = ndim - 1;
26865     }
26866     for (i = 0; i < ndim; i++) {
26867         index = start + step * i;
26868         if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
26869             return 0;
26870         itemsize *= mvs.shape[index];
26871     }
26872     return 1;
26873 }
26874 
26875 /* OverlappingSlices */
26876   static void
__pyx_get_array_memory_extents(__Pyx_memviewslice * slice,void ** out_start,void ** out_end,int ndim,size_t itemsize)26877 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
26878                                void **out_start, void **out_end,
26879                                int ndim, size_t itemsize)
26880 {
26881     char *start, *end;
26882     int i;
26883     start = end = slice->data;
26884     for (i = 0; i < ndim; i++) {
26885         Py_ssize_t stride = slice->strides[i];
26886         Py_ssize_t extent = slice->shape[i];
26887         if (extent == 0) {
26888             *out_start = *out_end = start;
26889             return;
26890         } else {
26891             if (stride > 0)
26892                 end += stride * (extent - 1);
26893             else
26894                 start += stride * (extent - 1);
26895         }
26896     }
26897     *out_start = start;
26898     *out_end = end + itemsize;
26899 }
26900 static int
__pyx_slices_overlap(__Pyx_memviewslice * slice1,__Pyx_memviewslice * slice2,int ndim,size_t itemsize)26901 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
26902                      __Pyx_memviewslice *slice2,
26903                      int ndim, size_t itemsize)
26904 {
26905     void *start1, *end1, *start2, *end2;
26906     __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
26907     __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
26908     return (start1 < end2) && (start2 < end1);
26909 }
26910 
26911 /* Capsule */
26912   static CYTHON_INLINE PyObject *
__pyx_capsule_create(void * p,CYTHON_UNUSED const char * sig)26913 __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
26914 {
26915     PyObject *cobj;
26916 #if PY_VERSION_HEX >= 0x02070000
26917     cobj = PyCapsule_New(p, sig, NULL);
26918 #else
26919     cobj = PyCObject_FromVoidPtr(p, NULL);
26920 #endif
26921     return cobj;
26922 }
26923 
26924 /* TypeInfoCompare */
26925   static int
__pyx_typeinfo_cmp(__Pyx_TypeInfo * a,__Pyx_TypeInfo * b)26926 __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
26927 {
26928     int i;
26929     if (!a || !b)
26930         return 0;
26931     if (a == b)
26932         return 1;
26933     if (a->size != b->size || a->typegroup != b->typegroup ||
26934             a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
26935         if (a->typegroup == 'H' || b->typegroup == 'H') {
26936             return a->size == b->size;
26937         } else {
26938             return 0;
26939         }
26940     }
26941     if (a->ndim) {
26942         for (i = 0; i < a->ndim; i++)
26943             if (a->arraysize[i] != b->arraysize[i])
26944                 return 0;
26945     }
26946     if (a->typegroup == 'S') {
26947         if (a->flags != b->flags)
26948             return 0;
26949         if (a->fields || b->fields) {
26950             if (!(a->fields && b->fields))
26951                 return 0;
26952             for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
26953                 __Pyx_StructField *field_a = a->fields + i;
26954                 __Pyx_StructField *field_b = b->fields + i;
26955                 if (field_a->offset != field_b->offset ||
26956                     !__pyx_typeinfo_cmp(field_a->type, field_b->type))
26957                     return 0;
26958             }
26959             return !a->fields[i].type && !b->fields[i].type;
26960         }
26961     }
26962     return 1;
26963 }
26964 
26965 /* MemviewSliceValidateAndInit */
26966   static int
__pyx_check_strides(Py_buffer * buf,int dim,int ndim,int spec)26967 __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
26968 {
26969     if (buf->shape[dim] <= 1)
26970         return 1;
26971     if (buf->strides) {
26972         if (spec & __Pyx_MEMVIEW_CONTIG) {
26973             if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
26974                 if (buf->strides[dim] != sizeof(void *)) {
26975                     PyErr_Format(PyExc_ValueError,
26976                                  "Buffer is not indirectly contiguous "
26977                                  "in dimension %d.", dim);
26978                     goto fail;
26979                 }
26980             } else if (buf->strides[dim] != buf->itemsize) {
26981                 PyErr_SetString(PyExc_ValueError,
26982                                 "Buffer and memoryview are not contiguous "
26983                                 "in the same dimension.");
26984                 goto fail;
26985             }
26986         }
26987         if (spec & __Pyx_MEMVIEW_FOLLOW) {
26988             Py_ssize_t stride = buf->strides[dim];
26989             if (stride < 0)
26990                 stride = -stride;
26991             if (stride < buf->itemsize) {
26992                 PyErr_SetString(PyExc_ValueError,
26993                                 "Buffer and memoryview are not contiguous "
26994                                 "in the same dimension.");
26995                 goto fail;
26996             }
26997         }
26998     } else {
26999         if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) {
27000             PyErr_Format(PyExc_ValueError,
27001                          "C-contiguous buffer is not contiguous in "
27002                          "dimension %d", dim);
27003             goto fail;
27004         } else if (spec & (__Pyx_MEMVIEW_PTR)) {
27005             PyErr_Format(PyExc_ValueError,
27006                          "C-contiguous buffer is not indirect in "
27007                          "dimension %d", dim);
27008             goto fail;
27009         } else if (buf->suboffsets) {
27010             PyErr_SetString(PyExc_ValueError,
27011                             "Buffer exposes suboffsets but no strides");
27012             goto fail;
27013         }
27014     }
27015     return 1;
27016 fail:
27017     return 0;
27018 }
27019 static int
__pyx_check_suboffsets(Py_buffer * buf,int dim,CYTHON_UNUSED int ndim,int spec)27020 __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
27021 {
27022     if (spec & __Pyx_MEMVIEW_DIRECT) {
27023         if (buf->suboffsets && buf->suboffsets[dim] >= 0) {
27024             PyErr_Format(PyExc_ValueError,
27025                          "Buffer not compatible with direct access "
27026                          "in dimension %d.", dim);
27027             goto fail;
27028         }
27029     }
27030     if (spec & __Pyx_MEMVIEW_PTR) {
27031         if (!buf->suboffsets || (buf->suboffsets[dim] < 0)) {
27032             PyErr_Format(PyExc_ValueError,
27033                          "Buffer is not indirectly accessible "
27034                          "in dimension %d.", dim);
27035             goto fail;
27036         }
27037     }
27038     return 1;
27039 fail:
27040     return 0;
27041 }
27042 static int
__pyx_verify_contig(Py_buffer * buf,int ndim,int c_or_f_flag)27043 __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
27044 {
27045     int i;
27046     if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
27047         Py_ssize_t stride = 1;
27048         for (i = 0; i < ndim; i++) {
27049             if (stride * buf->itemsize != buf->strides[i] &&
27050                     buf->shape[i] > 1)
27051             {
27052                 PyErr_SetString(PyExc_ValueError,
27053                     "Buffer not fortran contiguous.");
27054                 goto fail;
27055             }
27056             stride = stride * buf->shape[i];
27057         }
27058     } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
27059         Py_ssize_t stride = 1;
27060         for (i = ndim - 1; i >- 1; i--) {
27061             if (stride * buf->itemsize != buf->strides[i] &&
27062                     buf->shape[i] > 1) {
27063                 PyErr_SetString(PyExc_ValueError,
27064                     "Buffer not C contiguous.");
27065                 goto fail;
27066             }
27067             stride = stride * buf->shape[i];
27068         }
27069     }
27070     return 1;
27071 fail:
27072     return 0;
27073 }
__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)27074 static int __Pyx_ValidateAndInit_memviewslice(
27075                 int *axes_specs,
27076                 int c_or_f_flag,
27077                 int buf_flags,
27078                 int ndim,
27079                 __Pyx_TypeInfo *dtype,
27080                 __Pyx_BufFmt_StackElem stack[],
27081                 __Pyx_memviewslice *memviewslice,
27082                 PyObject *original_obj)
27083 {
27084     struct __pyx_memoryview_obj *memview, *new_memview;
27085     __Pyx_RefNannyDeclarations
27086     Py_buffer *buf;
27087     int i, spec = 0, retval = -1;
27088     __Pyx_BufFmt_Context ctx;
27089     int from_memoryview = __pyx_memoryview_check(original_obj);
27090     __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
27091     if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
27092                                                             original_obj)->typeinfo)) {
27093         memview = (struct __pyx_memoryview_obj *) original_obj;
27094         new_memview = NULL;
27095     } else {
27096         memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
27097                                             original_obj, buf_flags, 0, dtype);
27098         new_memview = memview;
27099         if (unlikely(!memview))
27100             goto fail;
27101     }
27102     buf = &memview->view;
27103     if (buf->ndim != ndim) {
27104         PyErr_Format(PyExc_ValueError,
27105                 "Buffer has wrong number of dimensions (expected %d, got %d)",
27106                 ndim, buf->ndim);
27107         goto fail;
27108     }
27109     if (new_memview) {
27110         __Pyx_BufFmt_Init(&ctx, stack, dtype);
27111         if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
27112     }
27113     if ((unsigned) buf->itemsize != dtype->size) {
27114         PyErr_Format(PyExc_ValueError,
27115                      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
27116                      "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
27117                      buf->itemsize,
27118                      (buf->itemsize > 1) ? "s" : "",
27119                      dtype->name,
27120                      dtype->size,
27121                      (dtype->size > 1) ? "s" : "");
27122         goto fail;
27123     }
27124     for (i = 0; i < ndim; i++) {
27125         spec = axes_specs[i];
27126         if (!__pyx_check_strides(buf, i, ndim, spec))
27127             goto fail;
27128         if (!__pyx_check_suboffsets(buf, i, ndim, spec))
27129             goto fail;
27130     }
27131     if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))
27132         goto fail;
27133     if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
27134                                          new_memview != NULL) == -1)) {
27135         goto fail;
27136     }
27137     retval = 0;
27138     goto no_fail;
27139 fail:
27140     Py_XDECREF(new_memview);
27141     retval = -1;
27142 no_fail:
27143     __Pyx_RefNannyFinishContext();
27144     return retval;
27145 }
27146 
27147 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_ds_nn_uint64_t(PyObject * obj,int writable_flag)27148   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn_uint64_t(PyObject *obj, int writable_flag) {
27149     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
27150     __Pyx_BufFmt_StackElem stack[1];
27151     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
27152     int retcode;
27153     if (obj == Py_None) {
27154         result.memview = (struct __pyx_memoryview_obj *) Py_None;
27155         return result;
27156     }
27157     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
27158                                                  PyBUF_RECORDS_RO | writable_flag, 1,
27159                                                  &__Pyx_TypeInfo_nn_uint64_t, stack,
27160                                                  &result, obj);
27161     if (unlikely(retcode == -1))
27162         goto __pyx_fail;
27163     return result;
27164 __pyx_fail:
27165     result.memview = NULL;
27166     result.data = NULL;
27167     return result;
27168 }
27169 
27170 /* CIntFromPyVerify */
27171   #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
27172     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
27173 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
27174     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
27175 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
27176     {\
27177         func_type value = func_value;\
27178         if (sizeof(target_type) < sizeof(func_type)) {\
27179             if (unlikely(value != (func_type) (target_type) value)) {\
27180                 func_type zero = 0;\
27181                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
27182                     return (target_type) -1;\
27183                 if (is_unsigned && unlikely(value < zero))\
27184                     goto raise_neg_overflow;\
27185                 else\
27186                     goto raise_overflow;\
27187             }\
27188         }\
27189         return (target_type) value;\
27190     }
27191 
27192 /* CIntToPy */
__Pyx_PyInt_From_uint32_t(uint32_t value)27193   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value) {
27194     const uint32_t neg_one = (uint32_t) ((uint32_t) 0 - (uint32_t) 1), const_zero = (uint32_t) 0;
27195     const int is_unsigned = neg_one > const_zero;
27196     if (is_unsigned) {
27197         if (sizeof(uint32_t) < sizeof(long)) {
27198             return PyInt_FromLong((long) value);
27199         } else if (sizeof(uint32_t) <= sizeof(unsigned long)) {
27200             return PyLong_FromUnsignedLong((unsigned long) value);
27201 #ifdef HAVE_LONG_LONG
27202         } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) {
27203             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
27204 #endif
27205         }
27206     } else {
27207         if (sizeof(uint32_t) <= sizeof(long)) {
27208             return PyInt_FromLong((long) value);
27209 #ifdef HAVE_LONG_LONG
27210         } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) {
27211             return PyLong_FromLongLong((PY_LONG_LONG) value);
27212 #endif
27213         }
27214     }
27215     {
27216         int one = 1; int little = (int)*(unsigned char *)&one;
27217         unsigned char *bytes = (unsigned char *)&value;
27218         return _PyLong_FromByteArray(bytes, sizeof(uint32_t),
27219                                      little, !is_unsigned);
27220     }
27221 }
27222 
27223 /* CIntToPy */
__Pyx_PyInt_From_int(int value)27224   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
27225     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
27226     const int is_unsigned = neg_one > const_zero;
27227     if (is_unsigned) {
27228         if (sizeof(int) < sizeof(long)) {
27229             return PyInt_FromLong((long) value);
27230         } else if (sizeof(int) <= sizeof(unsigned long)) {
27231             return PyLong_FromUnsignedLong((unsigned long) value);
27232 #ifdef HAVE_LONG_LONG
27233         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
27234             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
27235 #endif
27236         }
27237     } else {
27238         if (sizeof(int) <= sizeof(long)) {
27239             return PyInt_FromLong((long) value);
27240 #ifdef HAVE_LONG_LONG
27241         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
27242             return PyLong_FromLongLong((PY_LONG_LONG) value);
27243 #endif
27244         }
27245     }
27246     {
27247         int one = 1; int little = (int)*(unsigned char *)&one;
27248         unsigned char *bytes = (unsigned char *)&value;
27249         return _PyLong_FromByteArray(bytes, sizeof(int),
27250                                      little, !is_unsigned);
27251     }
27252 }
27253 
27254 /* CIntToPy */
__Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value)27255   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
27256     const Py_intptr_t neg_one = (Py_intptr_t) ((Py_intptr_t) 0 - (Py_intptr_t) 1), const_zero = (Py_intptr_t) 0;
27257     const int is_unsigned = neg_one > const_zero;
27258     if (is_unsigned) {
27259         if (sizeof(Py_intptr_t) < sizeof(long)) {
27260             return PyInt_FromLong((long) value);
27261         } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
27262             return PyLong_FromUnsignedLong((unsigned long) value);
27263 #ifdef HAVE_LONG_LONG
27264         } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
27265             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
27266 #endif
27267         }
27268     } else {
27269         if (sizeof(Py_intptr_t) <= sizeof(long)) {
27270             return PyInt_FromLong((long) value);
27271 #ifdef HAVE_LONG_LONG
27272         } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
27273             return PyLong_FromLongLong((PY_LONG_LONG) value);
27274 #endif
27275         }
27276     }
27277     {
27278         int one = 1; int little = (int)*(unsigned char *)&one;
27279         unsigned char *bytes = (unsigned char *)&value;
27280         return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
27281                                      little, !is_unsigned);
27282     }
27283 }
27284 
27285 /* CIntToPy */
__Pyx_PyInt_From_npy_uint64(npy_uint64 value)27286   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_uint64(npy_uint64 value) {
27287     const npy_uint64 neg_one = (npy_uint64) ((npy_uint64) 0 - (npy_uint64) 1), const_zero = (npy_uint64) 0;
27288     const int is_unsigned = neg_one > const_zero;
27289     if (is_unsigned) {
27290         if (sizeof(npy_uint64) < sizeof(long)) {
27291             return PyInt_FromLong((long) value);
27292         } else if (sizeof(npy_uint64) <= sizeof(unsigned long)) {
27293             return PyLong_FromUnsignedLong((unsigned long) value);
27294 #ifdef HAVE_LONG_LONG
27295         } else if (sizeof(npy_uint64) <= sizeof(unsigned PY_LONG_LONG)) {
27296             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
27297 #endif
27298         }
27299     } else {
27300         if (sizeof(npy_uint64) <= sizeof(long)) {
27301             return PyInt_FromLong((long) value);
27302 #ifdef HAVE_LONG_LONG
27303         } else if (sizeof(npy_uint64) <= sizeof(PY_LONG_LONG)) {
27304             return PyLong_FromLongLong((PY_LONG_LONG) value);
27305 #endif
27306         }
27307     }
27308     {
27309         int one = 1; int little = (int)*(unsigned char *)&one;
27310         unsigned char *bytes = (unsigned char *)&value;
27311         return _PyLong_FromByteArray(bytes, sizeof(npy_uint64),
27312                                      little, !is_unsigned);
27313     }
27314 }
27315 
27316 /* CIntToPy */
__Pyx_PyInt_From_uint64_t(uint64_t value)27317   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value) {
27318     const uint64_t neg_one = (uint64_t) ((uint64_t) 0 - (uint64_t) 1), const_zero = (uint64_t) 0;
27319     const int is_unsigned = neg_one > const_zero;
27320     if (is_unsigned) {
27321         if (sizeof(uint64_t) < sizeof(long)) {
27322             return PyInt_FromLong((long) value);
27323         } else if (sizeof(uint64_t) <= sizeof(unsigned long)) {
27324             return PyLong_FromUnsignedLong((unsigned long) value);
27325 #ifdef HAVE_LONG_LONG
27326         } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) {
27327             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
27328 #endif
27329         }
27330     } else {
27331         if (sizeof(uint64_t) <= sizeof(long)) {
27332             return PyInt_FromLong((long) value);
27333 #ifdef HAVE_LONG_LONG
27334         } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) {
27335             return PyLong_FromLongLong((PY_LONG_LONG) value);
27336 #endif
27337         }
27338     }
27339     {
27340         int one = 1; int little = (int)*(unsigned char *)&one;
27341         unsigned char *bytes = (unsigned char *)&value;
27342         return _PyLong_FromByteArray(bytes, sizeof(uint64_t),
27343                                      little, !is_unsigned);
27344     }
27345 }
27346 
27347 /* MemviewDtypeToObject */
__pyx_memview_get_nn_uint64_t(const char * itemp)27348   static CYTHON_INLINE PyObject *__pyx_memview_get_nn_uint64_t(const char *itemp) {
27349     return (PyObject *) __Pyx_PyInt_From_uint64_t(*(uint64_t *) itemp);
27350 }
__pyx_memview_set_nn_uint64_t(const char * itemp,PyObject * obj)27351 static CYTHON_INLINE int __pyx_memview_set_nn_uint64_t(const char *itemp, PyObject *obj) {
27352     uint64_t value = __Pyx_PyInt_As_uint64_t(obj);
27353     if ((value == ((uint64_t)-1)) && PyErr_Occurred())
27354         return 0;
27355     *(uint64_t *) itemp = value;
27356     return 1;
27357 }
27358 
27359 /* CIntToPy */
__Pyx_PyInt_From_int64_t(int64_t value)27360   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int64_t(int64_t value) {
27361     const int64_t neg_one = (int64_t) ((int64_t) 0 - (int64_t) 1), const_zero = (int64_t) 0;
27362     const int is_unsigned = neg_one > const_zero;
27363     if (is_unsigned) {
27364         if (sizeof(int64_t) < sizeof(long)) {
27365             return PyInt_FromLong((long) value);
27366         } else if (sizeof(int64_t) <= sizeof(unsigned long)) {
27367             return PyLong_FromUnsignedLong((unsigned long) value);
27368 #ifdef HAVE_LONG_LONG
27369         } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) {
27370             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
27371 #endif
27372         }
27373     } else {
27374         if (sizeof(int64_t) <= sizeof(long)) {
27375             return PyInt_FromLong((long) value);
27376 #ifdef HAVE_LONG_LONG
27377         } else if (sizeof(int64_t) <= sizeof(PY_LONG_LONG)) {
27378             return PyLong_FromLongLong((PY_LONG_LONG) value);
27379 #endif
27380         }
27381     }
27382     {
27383         int one = 1; int little = (int)*(unsigned char *)&one;
27384         unsigned char *bytes = (unsigned char *)&value;
27385         return _PyLong_FromByteArray(bytes, sizeof(int64_t),
27386                                      little, !is_unsigned);
27387     }
27388 }
27389 
27390 /* Declarations */
27391   #if CYTHON_CCOMPLEX
27392   #ifdef __cplusplus
__pyx_t_float_complex_from_parts(float x,float y)27393     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
27394       return ::std::complex< float >(x, y);
27395     }
27396   #else
__pyx_t_float_complex_from_parts(float x,float y)27397     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
27398       return x + y*(__pyx_t_float_complex)_Complex_I;
27399     }
27400   #endif
27401 #else
__pyx_t_float_complex_from_parts(float x,float y)27402     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
27403       __pyx_t_float_complex z;
27404       z.real = x;
27405       z.imag = y;
27406       return z;
27407     }
27408 #endif
27409 
27410 /* Arithmetic */
27411   #if CYTHON_CCOMPLEX
27412 #else
__Pyx_c_eq_float(__pyx_t_float_complex a,__pyx_t_float_complex b)27413     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27414        return (a.real == b.real) && (a.imag == b.imag);
27415     }
__Pyx_c_sum_float(__pyx_t_float_complex a,__pyx_t_float_complex b)27416     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27417         __pyx_t_float_complex z;
27418         z.real = a.real + b.real;
27419         z.imag = a.imag + b.imag;
27420         return z;
27421     }
__Pyx_c_diff_float(__pyx_t_float_complex a,__pyx_t_float_complex b)27422     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27423         __pyx_t_float_complex z;
27424         z.real = a.real - b.real;
27425         z.imag = a.imag - b.imag;
27426         return z;
27427     }
__Pyx_c_prod_float(__pyx_t_float_complex a,__pyx_t_float_complex b)27428     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27429         __pyx_t_float_complex z;
27430         z.real = a.real * b.real - a.imag * b.imag;
27431         z.imag = a.real * b.imag + a.imag * b.real;
27432         return z;
27433     }
27434     #if 1
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)27435     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27436         if (b.imag == 0) {
27437             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
27438         } else if (fabsf(b.real) >= fabsf(b.imag)) {
27439             if (b.real == 0 && b.imag == 0) {
27440                 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
27441             } else {
27442                 float r = b.imag / b.real;
27443                 float s = (float)(1.0) / (b.real + b.imag * r);
27444                 return __pyx_t_float_complex_from_parts(
27445                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
27446             }
27447         } else {
27448             float r = b.real / b.imag;
27449             float s = (float)(1.0) / (b.imag + b.real * r);
27450             return __pyx_t_float_complex_from_parts(
27451                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
27452         }
27453     }
27454     #else
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)27455     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27456         if (b.imag == 0) {
27457             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
27458         } else {
27459             float denom = b.real * b.real + b.imag * b.imag;
27460             return __pyx_t_float_complex_from_parts(
27461                 (a.real * b.real + a.imag * b.imag) / denom,
27462                 (a.imag * b.real - a.real * b.imag) / denom);
27463         }
27464     }
27465     #endif
__Pyx_c_neg_float(__pyx_t_float_complex a)27466     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
27467         __pyx_t_float_complex z;
27468         z.real = -a.real;
27469         z.imag = -a.imag;
27470         return z;
27471     }
__Pyx_c_is_zero_float(__pyx_t_float_complex a)27472     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
27473        return (a.real == 0) && (a.imag == 0);
27474     }
__Pyx_c_conj_float(__pyx_t_float_complex a)27475     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
27476         __pyx_t_float_complex z;
27477         z.real =  a.real;
27478         z.imag = -a.imag;
27479         return z;
27480     }
27481     #if 1
__Pyx_c_abs_float(__pyx_t_float_complex z)27482         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
27483           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
27484             return sqrtf(z.real*z.real + z.imag*z.imag);
27485           #else
27486             return hypotf(z.real, z.imag);
27487           #endif
27488         }
__Pyx_c_pow_float(__pyx_t_float_complex a,__pyx_t_float_complex b)27489         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27490             __pyx_t_float_complex z;
27491             float r, lnr, theta, z_r, z_theta;
27492             if (b.imag == 0 && b.real == (int)b.real) {
27493                 if (b.real < 0) {
27494                     float denom = a.real * a.real + a.imag * a.imag;
27495                     a.real = a.real / denom;
27496                     a.imag = -a.imag / denom;
27497                     b.real = -b.real;
27498                 }
27499                 switch ((int)b.real) {
27500                     case 0:
27501                         z.real = 1;
27502                         z.imag = 0;
27503                         return z;
27504                     case 1:
27505                         return a;
27506                     case 2:
27507                         z = __Pyx_c_prod_float(a, a);
27508                         return __Pyx_c_prod_float(a, a);
27509                     case 3:
27510                         z = __Pyx_c_prod_float(a, a);
27511                         return __Pyx_c_prod_float(z, a);
27512                     case 4:
27513                         z = __Pyx_c_prod_float(a, a);
27514                         return __Pyx_c_prod_float(z, z);
27515                 }
27516             }
27517             if (a.imag == 0) {
27518                 if (a.real == 0) {
27519                     return a;
27520                 } else if (b.imag == 0) {
27521                     z.real = powf(a.real, b.real);
27522                     z.imag = 0;
27523                     return z;
27524                 } else if (a.real > 0) {
27525                     r = a.real;
27526                     theta = 0;
27527                 } else {
27528                     r = -a.real;
27529                     theta = atan2f(0.0, -1.0);
27530                 }
27531             } else {
27532                 r = __Pyx_c_abs_float(a);
27533                 theta = atan2f(a.imag, a.real);
27534             }
27535             lnr = logf(r);
27536             z_r = expf(lnr * b.real - theta * b.imag);
27537             z_theta = theta * b.real + lnr * b.imag;
27538             z.real = z_r * cosf(z_theta);
27539             z.imag = z_r * sinf(z_theta);
27540             return z;
27541         }
27542     #endif
27543 #endif
27544 
27545 /* Declarations */
27546   #if CYTHON_CCOMPLEX
27547   #ifdef __cplusplus
__pyx_t_double_complex_from_parts(double x,double y)27548     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
27549       return ::std::complex< double >(x, y);
27550     }
27551   #else
__pyx_t_double_complex_from_parts(double x,double y)27552     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
27553       return x + y*(__pyx_t_double_complex)_Complex_I;
27554     }
27555   #endif
27556 #else
__pyx_t_double_complex_from_parts(double x,double y)27557     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
27558       __pyx_t_double_complex z;
27559       z.real = x;
27560       z.imag = y;
27561       return z;
27562     }
27563 #endif
27564 
27565 /* Arithmetic */
27566   #if CYTHON_CCOMPLEX
27567 #else
__Pyx_c_eq_double(__pyx_t_double_complex a,__pyx_t_double_complex b)27568     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27569        return (a.real == b.real) && (a.imag == b.imag);
27570     }
__Pyx_c_sum_double(__pyx_t_double_complex a,__pyx_t_double_complex b)27571     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27572         __pyx_t_double_complex z;
27573         z.real = a.real + b.real;
27574         z.imag = a.imag + b.imag;
27575         return z;
27576     }
__Pyx_c_diff_double(__pyx_t_double_complex a,__pyx_t_double_complex b)27577     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27578         __pyx_t_double_complex z;
27579         z.real = a.real - b.real;
27580         z.imag = a.imag - b.imag;
27581         return z;
27582     }
__Pyx_c_prod_double(__pyx_t_double_complex a,__pyx_t_double_complex b)27583     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27584         __pyx_t_double_complex z;
27585         z.real = a.real * b.real - a.imag * b.imag;
27586         z.imag = a.real * b.imag + a.imag * b.real;
27587         return z;
27588     }
27589     #if 1
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)27590     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27591         if (b.imag == 0) {
27592             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
27593         } else if (fabs(b.real) >= fabs(b.imag)) {
27594             if (b.real == 0 && b.imag == 0) {
27595                 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
27596             } else {
27597                 double r = b.imag / b.real;
27598                 double s = (double)(1.0) / (b.real + b.imag * r);
27599                 return __pyx_t_double_complex_from_parts(
27600                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
27601             }
27602         } else {
27603             double r = b.real / b.imag;
27604             double s = (double)(1.0) / (b.imag + b.real * r);
27605             return __pyx_t_double_complex_from_parts(
27606                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
27607         }
27608     }
27609     #else
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)27610     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27611         if (b.imag == 0) {
27612             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
27613         } else {
27614             double denom = b.real * b.real + b.imag * b.imag;
27615             return __pyx_t_double_complex_from_parts(
27616                 (a.real * b.real + a.imag * b.imag) / denom,
27617                 (a.imag * b.real - a.real * b.imag) / denom);
27618         }
27619     }
27620     #endif
__Pyx_c_neg_double(__pyx_t_double_complex a)27621     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
27622         __pyx_t_double_complex z;
27623         z.real = -a.real;
27624         z.imag = -a.imag;
27625         return z;
27626     }
__Pyx_c_is_zero_double(__pyx_t_double_complex a)27627     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
27628        return (a.real == 0) && (a.imag == 0);
27629     }
__Pyx_c_conj_double(__pyx_t_double_complex a)27630     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
27631         __pyx_t_double_complex z;
27632         z.real =  a.real;
27633         z.imag = -a.imag;
27634         return z;
27635     }
27636     #if 1
__Pyx_c_abs_double(__pyx_t_double_complex z)27637         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
27638           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
27639             return sqrt(z.real*z.real + z.imag*z.imag);
27640           #else
27641             return hypot(z.real, z.imag);
27642           #endif
27643         }
__Pyx_c_pow_double(__pyx_t_double_complex a,__pyx_t_double_complex b)27644         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27645             __pyx_t_double_complex z;
27646             double r, lnr, theta, z_r, z_theta;
27647             if (b.imag == 0 && b.real == (int)b.real) {
27648                 if (b.real < 0) {
27649                     double denom = a.real * a.real + a.imag * a.imag;
27650                     a.real = a.real / denom;
27651                     a.imag = -a.imag / denom;
27652                     b.real = -b.real;
27653                 }
27654                 switch ((int)b.real) {
27655                     case 0:
27656                         z.real = 1;
27657                         z.imag = 0;
27658                         return z;
27659                     case 1:
27660                         return a;
27661                     case 2:
27662                         z = __Pyx_c_prod_double(a, a);
27663                         return __Pyx_c_prod_double(a, a);
27664                     case 3:
27665                         z = __Pyx_c_prod_double(a, a);
27666                         return __Pyx_c_prod_double(z, a);
27667                     case 4:
27668                         z = __Pyx_c_prod_double(a, a);
27669                         return __Pyx_c_prod_double(z, z);
27670                 }
27671             }
27672             if (a.imag == 0) {
27673                 if (a.real == 0) {
27674                     return a;
27675                 } else if (b.imag == 0) {
27676                     z.real = pow(a.real, b.real);
27677                     z.imag = 0;
27678                     return z;
27679                 } else if (a.real > 0) {
27680                     r = a.real;
27681                     theta = 0;
27682                 } else {
27683                     r = -a.real;
27684                     theta = atan2(0.0, -1.0);
27685                 }
27686             } else {
27687                 r = __Pyx_c_abs_double(a);
27688                 theta = atan2(a.imag, a.real);
27689             }
27690             lnr = log(r);
27691             z_r = exp(lnr * b.real - theta * b.imag);
27692             z_theta = theta * b.real + lnr * b.imag;
27693             z.real = z_r * cos(z_theta);
27694             z.imag = z_r * sin(z_theta);
27695             return z;
27696         }
27697     #endif
27698 #endif
27699 
27700 /* CIntToPy */
__Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value)27701   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
27702     const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0;
27703     const int is_unsigned = neg_one > const_zero;
27704     if (is_unsigned) {
27705         if (sizeof(enum NPY_TYPES) < sizeof(long)) {
27706             return PyInt_FromLong((long) value);
27707         } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
27708             return PyLong_FromUnsignedLong((unsigned long) value);
27709 #ifdef HAVE_LONG_LONG
27710         } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
27711             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
27712 #endif
27713         }
27714     } else {
27715         if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
27716             return PyInt_FromLong((long) value);
27717 #ifdef HAVE_LONG_LONG
27718         } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
27719             return PyLong_FromLongLong((PY_LONG_LONG) value);
27720 #endif
27721         }
27722     }
27723     {
27724         int one = 1; int little = (int)*(unsigned char *)&one;
27725         unsigned char *bytes = (unsigned char *)&value;
27726         return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
27727                                      little, !is_unsigned);
27728     }
27729 }
27730 
27731 /* MemviewSliceCopyTemplate */
27732   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)27733 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
27734                                  const char *mode, int ndim,
27735                                  size_t sizeof_dtype, int contig_flag,
27736                                  int dtype_is_object)
27737 {
27738     __Pyx_RefNannyDeclarations
27739     int i;
27740     __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
27741     struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
27742     Py_buffer *buf = &from_memview->view;
27743     PyObject *shape_tuple = NULL;
27744     PyObject *temp_int = NULL;
27745     struct __pyx_array_obj *array_obj = NULL;
27746     struct __pyx_memoryview_obj *memview_obj = NULL;
27747     __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
27748     for (i = 0; i < ndim; i++) {
27749         if (from_mvs->suboffsets[i] >= 0) {
27750             PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
27751                                            "indirect dimensions (axis %d)", i);
27752             goto fail;
27753         }
27754     }
27755     shape_tuple = PyTuple_New(ndim);
27756     if (unlikely(!shape_tuple)) {
27757         goto fail;
27758     }
27759     __Pyx_GOTREF(shape_tuple);
27760     for(i = 0; i < ndim; i++) {
27761         temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
27762         if(unlikely(!temp_int)) {
27763             goto fail;
27764         } else {
27765             PyTuple_SET_ITEM(shape_tuple, i, temp_int);
27766             temp_int = NULL;
27767         }
27768     }
27769     array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
27770     if (unlikely(!array_obj)) {
27771         goto fail;
27772     }
27773     __Pyx_GOTREF(array_obj);
27774     memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
27775                                     (PyObject *) array_obj, contig_flag,
27776                                     dtype_is_object,
27777                                     from_mvs->memview->typeinfo);
27778     if (unlikely(!memview_obj))
27779         goto fail;
27780     if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
27781         goto fail;
27782     if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
27783                                                 dtype_is_object) < 0))
27784         goto fail;
27785     goto no_fail;
27786 fail:
27787     __Pyx_XDECREF(new_mvs.memview);
27788     new_mvs.memview = NULL;
27789     new_mvs.data = NULL;
27790 no_fail:
27791     __Pyx_XDECREF(shape_tuple);
27792     __Pyx_XDECREF(temp_int);
27793     __Pyx_XDECREF(array_obj);
27794     __Pyx_RefNannyFinishContext();
27795     return new_mvs;
27796 }
27797 
27798 /* CIntFromPy */
__Pyx_PyInt_As_npy_uint32(PyObject * x)27799   static CYTHON_INLINE npy_uint32 __Pyx_PyInt_As_npy_uint32(PyObject *x) {
27800     const npy_uint32 neg_one = (npy_uint32) ((npy_uint32) 0 - (npy_uint32) 1), const_zero = (npy_uint32) 0;
27801     const int is_unsigned = neg_one > const_zero;
27802 #if PY_MAJOR_VERSION < 3
27803     if (likely(PyInt_Check(x))) {
27804         if (sizeof(npy_uint32) < sizeof(long)) {
27805             __PYX_VERIFY_RETURN_INT(npy_uint32, long, PyInt_AS_LONG(x))
27806         } else {
27807             long val = PyInt_AS_LONG(x);
27808             if (is_unsigned && unlikely(val < 0)) {
27809                 goto raise_neg_overflow;
27810             }
27811             return (npy_uint32) val;
27812         }
27813     } else
27814 #endif
27815     if (likely(PyLong_Check(x))) {
27816         if (is_unsigned) {
27817 #if CYTHON_USE_PYLONG_INTERNALS
27818             const digit* digits = ((PyLongObject*)x)->ob_digit;
27819             switch (Py_SIZE(x)) {
27820                 case  0: return (npy_uint32) 0;
27821                 case  1: __PYX_VERIFY_RETURN_INT(npy_uint32, digit, digits[0])
27822                 case 2:
27823                     if (8 * sizeof(npy_uint32) > 1 * PyLong_SHIFT) {
27824                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27825                             __PYX_VERIFY_RETURN_INT(npy_uint32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27826                         } else if (8 * sizeof(npy_uint32) >= 2 * PyLong_SHIFT) {
27827                             return (npy_uint32) (((((npy_uint32)digits[1]) << PyLong_SHIFT) | (npy_uint32)digits[0]));
27828                         }
27829                     }
27830                     break;
27831                 case 3:
27832                     if (8 * sizeof(npy_uint32) > 2 * PyLong_SHIFT) {
27833                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27834                             __PYX_VERIFY_RETURN_INT(npy_uint32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27835                         } else if (8 * sizeof(npy_uint32) >= 3 * PyLong_SHIFT) {
27836                             return (npy_uint32) (((((((npy_uint32)digits[2]) << PyLong_SHIFT) | (npy_uint32)digits[1]) << PyLong_SHIFT) | (npy_uint32)digits[0]));
27837                         }
27838                     }
27839                     break;
27840                 case 4:
27841                     if (8 * sizeof(npy_uint32) > 3 * PyLong_SHIFT) {
27842                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27843                             __PYX_VERIFY_RETURN_INT(npy_uint32, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27844                         } else if (8 * sizeof(npy_uint32) >= 4 * PyLong_SHIFT) {
27845                             return (npy_uint32) (((((((((npy_uint32)digits[3]) << PyLong_SHIFT) | (npy_uint32)digits[2]) << PyLong_SHIFT) | (npy_uint32)digits[1]) << PyLong_SHIFT) | (npy_uint32)digits[0]));
27846                         }
27847                     }
27848                     break;
27849             }
27850 #endif
27851 #if CYTHON_COMPILING_IN_CPYTHON
27852             if (unlikely(Py_SIZE(x) < 0)) {
27853                 goto raise_neg_overflow;
27854             }
27855 #else
27856             {
27857                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27858                 if (unlikely(result < 0))
27859                     return (npy_uint32) -1;
27860                 if (unlikely(result == 1))
27861                     goto raise_neg_overflow;
27862             }
27863 #endif
27864             if (sizeof(npy_uint32) <= sizeof(unsigned long)) {
27865                 __PYX_VERIFY_RETURN_INT_EXC(npy_uint32, unsigned long, PyLong_AsUnsignedLong(x))
27866 #ifdef HAVE_LONG_LONG
27867             } else if (sizeof(npy_uint32) <= sizeof(unsigned PY_LONG_LONG)) {
27868                 __PYX_VERIFY_RETURN_INT_EXC(npy_uint32, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27869 #endif
27870             }
27871         } else {
27872 #if CYTHON_USE_PYLONG_INTERNALS
27873             const digit* digits = ((PyLongObject*)x)->ob_digit;
27874             switch (Py_SIZE(x)) {
27875                 case  0: return (npy_uint32) 0;
27876                 case -1: __PYX_VERIFY_RETURN_INT(npy_uint32, sdigit, (sdigit) (-(sdigit)digits[0]))
27877                 case  1: __PYX_VERIFY_RETURN_INT(npy_uint32,  digit, +digits[0])
27878                 case -2:
27879                     if (8 * sizeof(npy_uint32) - 1 > 1 * PyLong_SHIFT) {
27880                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27881                             __PYX_VERIFY_RETURN_INT(npy_uint32, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27882                         } else if (8 * sizeof(npy_uint32) - 1 > 2 * PyLong_SHIFT) {
27883                             return (npy_uint32) (((npy_uint32)-1)*(((((npy_uint32)digits[1]) << PyLong_SHIFT) | (npy_uint32)digits[0])));
27884                         }
27885                     }
27886                     break;
27887                 case 2:
27888                     if (8 * sizeof(npy_uint32) > 1 * PyLong_SHIFT) {
27889                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27890                             __PYX_VERIFY_RETURN_INT(npy_uint32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27891                         } else if (8 * sizeof(npy_uint32) - 1 > 2 * PyLong_SHIFT) {
27892                             return (npy_uint32) ((((((npy_uint32)digits[1]) << PyLong_SHIFT) | (npy_uint32)digits[0])));
27893                         }
27894                     }
27895                     break;
27896                 case -3:
27897                     if (8 * sizeof(npy_uint32) - 1 > 2 * PyLong_SHIFT) {
27898                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27899                             __PYX_VERIFY_RETURN_INT(npy_uint32, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27900                         } else if (8 * sizeof(npy_uint32) - 1 > 3 * PyLong_SHIFT) {
27901                             return (npy_uint32) (((npy_uint32)-1)*(((((((npy_uint32)digits[2]) << PyLong_SHIFT) | (npy_uint32)digits[1]) << PyLong_SHIFT) | (npy_uint32)digits[0])));
27902                         }
27903                     }
27904                     break;
27905                 case 3:
27906                     if (8 * sizeof(npy_uint32) > 2 * PyLong_SHIFT) {
27907                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27908                             __PYX_VERIFY_RETURN_INT(npy_uint32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27909                         } else if (8 * sizeof(npy_uint32) - 1 > 3 * PyLong_SHIFT) {
27910                             return (npy_uint32) ((((((((npy_uint32)digits[2]) << PyLong_SHIFT) | (npy_uint32)digits[1]) << PyLong_SHIFT) | (npy_uint32)digits[0])));
27911                         }
27912                     }
27913                     break;
27914                 case -4:
27915                     if (8 * sizeof(npy_uint32) - 1 > 3 * PyLong_SHIFT) {
27916                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27917                             __PYX_VERIFY_RETURN_INT(npy_uint32, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27918                         } else if (8 * sizeof(npy_uint32) - 1 > 4 * PyLong_SHIFT) {
27919                             return (npy_uint32) (((npy_uint32)-1)*(((((((((npy_uint32)digits[3]) << PyLong_SHIFT) | (npy_uint32)digits[2]) << PyLong_SHIFT) | (npy_uint32)digits[1]) << PyLong_SHIFT) | (npy_uint32)digits[0])));
27920                         }
27921                     }
27922                     break;
27923                 case 4:
27924                     if (8 * sizeof(npy_uint32) > 3 * PyLong_SHIFT) {
27925                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27926                             __PYX_VERIFY_RETURN_INT(npy_uint32, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27927                         } else if (8 * sizeof(npy_uint32) - 1 > 4 * PyLong_SHIFT) {
27928                             return (npy_uint32) ((((((((((npy_uint32)digits[3]) << PyLong_SHIFT) | (npy_uint32)digits[2]) << PyLong_SHIFT) | (npy_uint32)digits[1]) << PyLong_SHIFT) | (npy_uint32)digits[0])));
27929                         }
27930                     }
27931                     break;
27932             }
27933 #endif
27934             if (sizeof(npy_uint32) <= sizeof(long)) {
27935                 __PYX_VERIFY_RETURN_INT_EXC(npy_uint32, long, PyLong_AsLong(x))
27936 #ifdef HAVE_LONG_LONG
27937             } else if (sizeof(npy_uint32) <= sizeof(PY_LONG_LONG)) {
27938                 __PYX_VERIFY_RETURN_INT_EXC(npy_uint32, PY_LONG_LONG, PyLong_AsLongLong(x))
27939 #endif
27940             }
27941         }
27942         {
27943 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27944             PyErr_SetString(PyExc_RuntimeError,
27945                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27946 #else
27947             npy_uint32 val;
27948             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
27949  #if PY_MAJOR_VERSION < 3
27950             if (likely(v) && !PyLong_Check(v)) {
27951                 PyObject *tmp = v;
27952                 v = PyNumber_Long(tmp);
27953                 Py_DECREF(tmp);
27954             }
27955  #endif
27956             if (likely(v)) {
27957                 int one = 1; int is_little = (int)*(unsigned char *)&one;
27958                 unsigned char *bytes = (unsigned char *)&val;
27959                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
27960                                               bytes, sizeof(val),
27961                                               is_little, !is_unsigned);
27962                 Py_DECREF(v);
27963                 if (likely(!ret))
27964                     return val;
27965             }
27966 #endif
27967             return (npy_uint32) -1;
27968         }
27969     } else {
27970         npy_uint32 val;
27971         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27972         if (!tmp) return (npy_uint32) -1;
27973         val = __Pyx_PyInt_As_npy_uint32(tmp);
27974         Py_DECREF(tmp);
27975         return val;
27976     }
27977 raise_overflow:
27978     PyErr_SetString(PyExc_OverflowError,
27979         "value too large to convert to npy_uint32");
27980     return (npy_uint32) -1;
27981 raise_neg_overflow:
27982     PyErr_SetString(PyExc_OverflowError,
27983         "can't convert negative value to npy_uint32");
27984     return (npy_uint32) -1;
27985 }
27986 
27987 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)27988   static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
27989     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
27990     const int is_unsigned = neg_one > const_zero;
27991 #if PY_MAJOR_VERSION < 3
27992     if (likely(PyInt_Check(x))) {
27993         if (sizeof(int) < sizeof(long)) {
27994             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
27995         } else {
27996             long val = PyInt_AS_LONG(x);
27997             if (is_unsigned && unlikely(val < 0)) {
27998                 goto raise_neg_overflow;
27999             }
28000             return (int) val;
28001         }
28002     } else
28003 #endif
28004     if (likely(PyLong_Check(x))) {
28005         if (is_unsigned) {
28006 #if CYTHON_USE_PYLONG_INTERNALS
28007             const digit* digits = ((PyLongObject*)x)->ob_digit;
28008             switch (Py_SIZE(x)) {
28009                 case  0: return (int) 0;
28010                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
28011                 case 2:
28012                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
28013                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
28014                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28015                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
28016                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
28017                         }
28018                     }
28019                     break;
28020                 case 3:
28021                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
28022                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
28023                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28024                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
28025                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
28026                         }
28027                     }
28028                     break;
28029                 case 4:
28030                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
28031                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
28032                             __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])))
28033                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
28034                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
28035                         }
28036                     }
28037                     break;
28038             }
28039 #endif
28040 #if CYTHON_COMPILING_IN_CPYTHON
28041             if (unlikely(Py_SIZE(x) < 0)) {
28042                 goto raise_neg_overflow;
28043             }
28044 #else
28045             {
28046                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
28047                 if (unlikely(result < 0))
28048                     return (int) -1;
28049                 if (unlikely(result == 1))
28050                     goto raise_neg_overflow;
28051             }
28052 #endif
28053             if (sizeof(int) <= sizeof(unsigned long)) {
28054                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
28055 #ifdef HAVE_LONG_LONG
28056             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
28057                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
28058 #endif
28059             }
28060         } else {
28061 #if CYTHON_USE_PYLONG_INTERNALS
28062             const digit* digits = ((PyLongObject*)x)->ob_digit;
28063             switch (Py_SIZE(x)) {
28064                 case  0: return (int) 0;
28065                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
28066                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
28067                 case -2:
28068                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
28069                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
28070                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28071                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
28072                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
28073                         }
28074                     }
28075                     break;
28076                 case 2:
28077                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
28078                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
28079                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28080                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
28081                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
28082                         }
28083                     }
28084                     break;
28085                 case -3:
28086                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
28087                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
28088                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28089                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
28090                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
28091                         }
28092                     }
28093                     break;
28094                 case 3:
28095                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
28096                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
28097                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28098                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
28099                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
28100                         }
28101                     }
28102                     break;
28103                 case -4:
28104                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
28105                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
28106                             __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])))
28107                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
28108                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
28109                         }
28110                     }
28111                     break;
28112                 case 4:
28113                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
28114                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
28115                             __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])))
28116                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
28117                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
28118                         }
28119                     }
28120                     break;
28121             }
28122 #endif
28123             if (sizeof(int) <= sizeof(long)) {
28124                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
28125 #ifdef HAVE_LONG_LONG
28126             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
28127                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
28128 #endif
28129             }
28130         }
28131         {
28132 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
28133             PyErr_SetString(PyExc_RuntimeError,
28134                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
28135 #else
28136             int val;
28137             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
28138  #if PY_MAJOR_VERSION < 3
28139             if (likely(v) && !PyLong_Check(v)) {
28140                 PyObject *tmp = v;
28141                 v = PyNumber_Long(tmp);
28142                 Py_DECREF(tmp);
28143             }
28144  #endif
28145             if (likely(v)) {
28146                 int one = 1; int is_little = (int)*(unsigned char *)&one;
28147                 unsigned char *bytes = (unsigned char *)&val;
28148                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
28149                                               bytes, sizeof(val),
28150                                               is_little, !is_unsigned);
28151                 Py_DECREF(v);
28152                 if (likely(!ret))
28153                     return val;
28154             }
28155 #endif
28156             return (int) -1;
28157         }
28158     } else {
28159         int val;
28160         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
28161         if (!tmp) return (int) -1;
28162         val = __Pyx_PyInt_As_int(tmp);
28163         Py_DECREF(tmp);
28164         return val;
28165     }
28166 raise_overflow:
28167     PyErr_SetString(PyExc_OverflowError,
28168         "value too large to convert to int");
28169     return (int) -1;
28170 raise_neg_overflow:
28171     PyErr_SetString(PyExc_OverflowError,
28172         "can't convert negative value to int");
28173     return (int) -1;
28174 }
28175 
28176 /* CIntFromPy */
__Pyx_PyInt_As_npy_int64(PyObject * x)28177   static CYTHON_INLINE npy_int64 __Pyx_PyInt_As_npy_int64(PyObject *x) {
28178     const npy_int64 neg_one = (npy_int64) ((npy_int64) 0 - (npy_int64) 1), const_zero = (npy_int64) 0;
28179     const int is_unsigned = neg_one > const_zero;
28180 #if PY_MAJOR_VERSION < 3
28181     if (likely(PyInt_Check(x))) {
28182         if (sizeof(npy_int64) < sizeof(long)) {
28183             __PYX_VERIFY_RETURN_INT(npy_int64, long, PyInt_AS_LONG(x))
28184         } else {
28185             long val = PyInt_AS_LONG(x);
28186             if (is_unsigned && unlikely(val < 0)) {
28187                 goto raise_neg_overflow;
28188             }
28189             return (npy_int64) val;
28190         }
28191     } else
28192 #endif
28193     if (likely(PyLong_Check(x))) {
28194         if (is_unsigned) {
28195 #if CYTHON_USE_PYLONG_INTERNALS
28196             const digit* digits = ((PyLongObject*)x)->ob_digit;
28197             switch (Py_SIZE(x)) {
28198                 case  0: return (npy_int64) 0;
28199                 case  1: __PYX_VERIFY_RETURN_INT(npy_int64, digit, digits[0])
28200                 case 2:
28201                     if (8 * sizeof(npy_int64) > 1 * PyLong_SHIFT) {
28202                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
28203                             __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28204                         } else if (8 * sizeof(npy_int64) >= 2 * PyLong_SHIFT) {
28205                             return (npy_int64) (((((npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0]));
28206                         }
28207                     }
28208                     break;
28209                 case 3:
28210                     if (8 * sizeof(npy_int64) > 2 * PyLong_SHIFT) {
28211                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
28212                             __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28213                         } else if (8 * sizeof(npy_int64) >= 3 * PyLong_SHIFT) {
28214                             return (npy_int64) (((((((npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0]));
28215                         }
28216                     }
28217                     break;
28218                 case 4:
28219                     if (8 * sizeof(npy_int64) > 3 * PyLong_SHIFT) {
28220                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
28221                             __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28222                         } else if (8 * sizeof(npy_int64) >= 4 * PyLong_SHIFT) {
28223                             return (npy_int64) (((((((((npy_int64)digits[3]) << PyLong_SHIFT) | (npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0]));
28224                         }
28225                     }
28226                     break;
28227             }
28228 #endif
28229 #if CYTHON_COMPILING_IN_CPYTHON
28230             if (unlikely(Py_SIZE(x) < 0)) {
28231                 goto raise_neg_overflow;
28232             }
28233 #else
28234             {
28235                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
28236                 if (unlikely(result < 0))
28237                     return (npy_int64) -1;
28238                 if (unlikely(result == 1))
28239                     goto raise_neg_overflow;
28240             }
28241 #endif
28242             if (sizeof(npy_int64) <= sizeof(unsigned long)) {
28243                 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, unsigned long, PyLong_AsUnsignedLong(x))
28244 #ifdef HAVE_LONG_LONG
28245             } else if (sizeof(npy_int64) <= sizeof(unsigned PY_LONG_LONG)) {
28246                 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
28247 #endif
28248             }
28249         } else {
28250 #if CYTHON_USE_PYLONG_INTERNALS
28251             const digit* digits = ((PyLongObject*)x)->ob_digit;
28252             switch (Py_SIZE(x)) {
28253                 case  0: return (npy_int64) 0;
28254                 case -1: __PYX_VERIFY_RETURN_INT(npy_int64, sdigit, (sdigit) (-(sdigit)digits[0]))
28255                 case  1: __PYX_VERIFY_RETURN_INT(npy_int64,  digit, +digits[0])
28256                 case -2:
28257                     if (8 * sizeof(npy_int64) - 1 > 1 * PyLong_SHIFT) {
28258                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
28259                             __PYX_VERIFY_RETURN_INT(npy_int64, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28260                         } else if (8 * sizeof(npy_int64) - 1 > 2 * PyLong_SHIFT) {
28261                             return (npy_int64) (((npy_int64)-1)*(((((npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
28262                         }
28263                     }
28264                     break;
28265                 case 2:
28266                     if (8 * sizeof(npy_int64) > 1 * PyLong_SHIFT) {
28267                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
28268                             __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28269                         } else if (8 * sizeof(npy_int64) - 1 > 2 * PyLong_SHIFT) {
28270                             return (npy_int64) ((((((npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
28271                         }
28272                     }
28273                     break;
28274                 case -3:
28275                     if (8 * sizeof(npy_int64) - 1 > 2 * PyLong_SHIFT) {
28276                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
28277                             __PYX_VERIFY_RETURN_INT(npy_int64, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28278                         } else if (8 * sizeof(npy_int64) - 1 > 3 * PyLong_SHIFT) {
28279                             return (npy_int64) (((npy_int64)-1)*(((((((npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
28280                         }
28281                     }
28282                     break;
28283                 case 3:
28284                     if (8 * sizeof(npy_int64) > 2 * PyLong_SHIFT) {
28285                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
28286                             __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28287                         } else if (8 * sizeof(npy_int64) - 1 > 3 * PyLong_SHIFT) {
28288                             return (npy_int64) ((((((((npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
28289                         }
28290                     }
28291                     break;
28292                 case -4:
28293                     if (8 * sizeof(npy_int64) - 1 > 3 * PyLong_SHIFT) {
28294                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
28295                             __PYX_VERIFY_RETURN_INT(npy_int64, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28296                         } else if (8 * sizeof(npy_int64) - 1 > 4 * PyLong_SHIFT) {
28297                             return (npy_int64) (((npy_int64)-1)*(((((((((npy_int64)digits[3]) << PyLong_SHIFT) | (npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
28298                         }
28299                     }
28300                     break;
28301                 case 4:
28302                     if (8 * sizeof(npy_int64) > 3 * PyLong_SHIFT) {
28303                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
28304                             __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28305                         } else if (8 * sizeof(npy_int64) - 1 > 4 * PyLong_SHIFT) {
28306                             return (npy_int64) ((((((((((npy_int64)digits[3]) << PyLong_SHIFT) | (npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
28307                         }
28308                     }
28309                     break;
28310             }
28311 #endif
28312             if (sizeof(npy_int64) <= sizeof(long)) {
28313                 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, long, PyLong_AsLong(x))
28314 #ifdef HAVE_LONG_LONG
28315             } else if (sizeof(npy_int64) <= sizeof(PY_LONG_LONG)) {
28316                 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, PY_LONG_LONG, PyLong_AsLongLong(x))
28317 #endif
28318             }
28319         }
28320         {
28321 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
28322             PyErr_SetString(PyExc_RuntimeError,
28323                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
28324 #else
28325             npy_int64 val;
28326             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
28327  #if PY_MAJOR_VERSION < 3
28328             if (likely(v) && !PyLong_Check(v)) {
28329                 PyObject *tmp = v;
28330                 v = PyNumber_Long(tmp);
28331                 Py_DECREF(tmp);
28332             }
28333  #endif
28334             if (likely(v)) {
28335                 int one = 1; int is_little = (int)*(unsigned char *)&one;
28336                 unsigned char *bytes = (unsigned char *)&val;
28337                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
28338                                               bytes, sizeof(val),
28339                                               is_little, !is_unsigned);
28340                 Py_DECREF(v);
28341                 if (likely(!ret))
28342                     return val;
28343             }
28344 #endif
28345             return (npy_int64) -1;
28346         }
28347     } else {
28348         npy_int64 val;
28349         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
28350         if (!tmp) return (npy_int64) -1;
28351         val = __Pyx_PyInt_As_npy_int64(tmp);
28352         Py_DECREF(tmp);
28353         return val;
28354     }
28355 raise_overflow:
28356     PyErr_SetString(PyExc_OverflowError,
28357         "value too large to convert to npy_int64");
28358     return (npy_int64) -1;
28359 raise_neg_overflow:
28360     PyErr_SetString(PyExc_OverflowError,
28361         "can't convert negative value to npy_int64");
28362     return (npy_int64) -1;
28363 }
28364 
28365 /* CIntFromPy */
__Pyx_PyInt_As_uint32_t(PyObject * x)28366   static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) {
28367     const uint32_t neg_one = (uint32_t) ((uint32_t) 0 - (uint32_t) 1), const_zero = (uint32_t) 0;
28368     const int is_unsigned = neg_one > const_zero;
28369 #if PY_MAJOR_VERSION < 3
28370     if (likely(PyInt_Check(x))) {
28371         if (sizeof(uint32_t) < sizeof(long)) {
28372             __PYX_VERIFY_RETURN_INT(uint32_t, long, PyInt_AS_LONG(x))
28373         } else {
28374             long val = PyInt_AS_LONG(x);
28375             if (is_unsigned && unlikely(val < 0)) {
28376                 goto raise_neg_overflow;
28377             }
28378             return (uint32_t) val;
28379         }
28380     } else
28381 #endif
28382     if (likely(PyLong_Check(x))) {
28383         if (is_unsigned) {
28384 #if CYTHON_USE_PYLONG_INTERNALS
28385             const digit* digits = ((PyLongObject*)x)->ob_digit;
28386             switch (Py_SIZE(x)) {
28387                 case  0: return (uint32_t) 0;
28388                 case  1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, digits[0])
28389                 case 2:
28390                     if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) {
28391                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
28392                             __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28393                         } else if (8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT) {
28394                             return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]));
28395                         }
28396                     }
28397                     break;
28398                 case 3:
28399                     if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) {
28400                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
28401                             __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28402                         } else if (8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT) {
28403                             return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]));
28404                         }
28405                     }
28406                     break;
28407                 case 4:
28408                     if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) {
28409                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
28410                             __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28411                         } else if (8 * sizeof(uint32_t) >= 4 * PyLong_SHIFT) {
28412                             return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]));
28413                         }
28414                     }
28415                     break;
28416             }
28417 #endif
28418 #if CYTHON_COMPILING_IN_CPYTHON
28419             if (unlikely(Py_SIZE(x) < 0)) {
28420                 goto raise_neg_overflow;
28421             }
28422 #else
28423             {
28424                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
28425                 if (unlikely(result < 0))
28426                     return (uint32_t) -1;
28427                 if (unlikely(result == 1))
28428                     goto raise_neg_overflow;
28429             }
28430 #endif
28431             if (sizeof(uint32_t) <= sizeof(unsigned long)) {
28432                 __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned long, PyLong_AsUnsignedLong(x))
28433 #ifdef HAVE_LONG_LONG
28434             } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) {
28435                 __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
28436 #endif
28437             }
28438         } else {
28439 #if CYTHON_USE_PYLONG_INTERNALS
28440             const digit* digits = ((PyLongObject*)x)->ob_digit;
28441             switch (Py_SIZE(x)) {
28442                 case  0: return (uint32_t) 0;
28443                 case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, (sdigit) (-(sdigit)digits[0]))
28444                 case  1: __PYX_VERIFY_RETURN_INT(uint32_t,  digit, +digits[0])
28445                 case -2:
28446                     if (8 * sizeof(uint32_t) - 1 > 1 * PyLong_SHIFT) {
28447                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
28448                             __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28449                         } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) {
28450                             return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
28451                         }
28452                     }
28453                     break;
28454                 case 2:
28455                     if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) {
28456                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
28457                             __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28458                         } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) {
28459                             return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
28460                         }
28461                     }
28462                     break;
28463                 case -3:
28464                     if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) {
28465                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
28466                             __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28467                         } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) {
28468                             return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
28469                         }
28470                     }
28471                     break;
28472                 case 3:
28473                     if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) {
28474                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
28475                             __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28476                         } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) {
28477                             return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
28478                         }
28479                     }
28480                     break;
28481                 case -4:
28482                     if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) {
28483                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
28484                             __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28485                         } else if (8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT) {
28486                             return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
28487                         }
28488                     }
28489                     break;
28490                 case 4:
28491                     if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) {
28492                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
28493                             __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28494                         } else if (8 * sizeof(uint32_t) - 1 > 4 * PyLong_SHIFT) {
28495                             return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
28496                         }
28497                     }
28498                     break;
28499             }
28500 #endif
28501             if (sizeof(uint32_t) <= sizeof(long)) {
28502                 __PYX_VERIFY_RETURN_INT_EXC(uint32_t, long, PyLong_AsLong(x))
28503 #ifdef HAVE_LONG_LONG
28504             } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) {
28505                 __PYX_VERIFY_RETURN_INT_EXC(uint32_t, PY_LONG_LONG, PyLong_AsLongLong(x))
28506 #endif
28507             }
28508         }
28509         {
28510 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
28511             PyErr_SetString(PyExc_RuntimeError,
28512                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
28513 #else
28514             uint32_t val;
28515             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
28516  #if PY_MAJOR_VERSION < 3
28517             if (likely(v) && !PyLong_Check(v)) {
28518                 PyObject *tmp = v;
28519                 v = PyNumber_Long(tmp);
28520                 Py_DECREF(tmp);
28521             }
28522  #endif
28523             if (likely(v)) {
28524                 int one = 1; int is_little = (int)*(unsigned char *)&one;
28525                 unsigned char *bytes = (unsigned char *)&val;
28526                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
28527                                               bytes, sizeof(val),
28528                                               is_little, !is_unsigned);
28529                 Py_DECREF(v);
28530                 if (likely(!ret))
28531                     return val;
28532             }
28533 #endif
28534             return (uint32_t) -1;
28535         }
28536     } else {
28537         uint32_t val;
28538         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
28539         if (!tmp) return (uint32_t) -1;
28540         val = __Pyx_PyInt_As_uint32_t(tmp);
28541         Py_DECREF(tmp);
28542         return val;
28543     }
28544 raise_overflow:
28545     PyErr_SetString(PyExc_OverflowError,
28546         "value too large to convert to uint32_t");
28547     return (uint32_t) -1;
28548 raise_neg_overflow:
28549     PyErr_SetString(PyExc_OverflowError,
28550         "can't convert negative value to uint32_t");
28551     return (uint32_t) -1;
28552 }
28553 
28554 /* CIntFromPy */
__Pyx_PyInt_As_uint64_t(PyObject * x)28555   static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *x) {
28556     const uint64_t neg_one = (uint64_t) ((uint64_t) 0 - (uint64_t) 1), const_zero = (uint64_t) 0;
28557     const int is_unsigned = neg_one > const_zero;
28558 #if PY_MAJOR_VERSION < 3
28559     if (likely(PyInt_Check(x))) {
28560         if (sizeof(uint64_t) < sizeof(long)) {
28561             __PYX_VERIFY_RETURN_INT(uint64_t, long, PyInt_AS_LONG(x))
28562         } else {
28563             long val = PyInt_AS_LONG(x);
28564             if (is_unsigned && unlikely(val < 0)) {
28565                 goto raise_neg_overflow;
28566             }
28567             return (uint64_t) val;
28568         }
28569     } else
28570 #endif
28571     if (likely(PyLong_Check(x))) {
28572         if (is_unsigned) {
28573 #if CYTHON_USE_PYLONG_INTERNALS
28574             const digit* digits = ((PyLongObject*)x)->ob_digit;
28575             switch (Py_SIZE(x)) {
28576                 case  0: return (uint64_t) 0;
28577                 case  1: __PYX_VERIFY_RETURN_INT(uint64_t, digit, digits[0])
28578                 case 2:
28579                     if (8 * sizeof(uint64_t) > 1 * PyLong_SHIFT) {
28580                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
28581                             __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28582                         } else if (8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT) {
28583                             return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
28584                         }
28585                     }
28586                     break;
28587                 case 3:
28588                     if (8 * sizeof(uint64_t) > 2 * PyLong_SHIFT) {
28589                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
28590                             __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28591                         } else if (8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT) {
28592                             return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
28593                         }
28594                     }
28595                     break;
28596                 case 4:
28597                     if (8 * sizeof(uint64_t) > 3 * PyLong_SHIFT) {
28598                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
28599                             __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28600                         } else if (8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT) {
28601                             return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
28602                         }
28603                     }
28604                     break;
28605             }
28606 #endif
28607 #if CYTHON_COMPILING_IN_CPYTHON
28608             if (unlikely(Py_SIZE(x) < 0)) {
28609                 goto raise_neg_overflow;
28610             }
28611 #else
28612             {
28613                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
28614                 if (unlikely(result < 0))
28615                     return (uint64_t) -1;
28616                 if (unlikely(result == 1))
28617                     goto raise_neg_overflow;
28618             }
28619 #endif
28620             if (sizeof(uint64_t) <= sizeof(unsigned long)) {
28621                 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x))
28622 #ifdef HAVE_LONG_LONG
28623             } else if (sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG)) {
28624                 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
28625 #endif
28626             }
28627         } else {
28628 #if CYTHON_USE_PYLONG_INTERNALS
28629             const digit* digits = ((PyLongObject*)x)->ob_digit;
28630             switch (Py_SIZE(x)) {
28631                 case  0: return (uint64_t) 0;
28632                 case -1: __PYX_VERIFY_RETURN_INT(uint64_t, sdigit, (sdigit) (-(sdigit)digits[0]))
28633                 case  1: __PYX_VERIFY_RETURN_INT(uint64_t,  digit, +digits[0])
28634                 case -2:
28635                     if (8 * sizeof(uint64_t) - 1 > 1 * PyLong_SHIFT) {
28636                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
28637                             __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28638                         } else if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
28639                             return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
28640                         }
28641                     }
28642                     break;
28643                 case 2:
28644                     if (8 * sizeof(uint64_t) > 1 * PyLong_SHIFT) {
28645                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
28646                             __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28647                         } else if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
28648                             return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
28649                         }
28650                     }
28651                     break;
28652                 case -3:
28653                     if (8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT) {
28654                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
28655                             __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28656                         } else if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
28657                             return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
28658                         }
28659                     }
28660                     break;
28661                 case 3:
28662                     if (8 * sizeof(uint64_t) > 2 * PyLong_SHIFT) {
28663                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
28664                             __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28665                         } else if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
28666                             return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
28667                         }
28668                     }
28669                     break;
28670                 case -4:
28671                     if (8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT) {
28672                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
28673                             __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28674                         } else if (8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT) {
28675                             return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
28676                         }
28677                     }
28678                     break;
28679                 case 4:
28680                     if (8 * sizeof(uint64_t) > 3 * PyLong_SHIFT) {
28681                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
28682                             __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28683                         } else if (8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT) {
28684                             return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
28685                         }
28686                     }
28687                     break;
28688             }
28689 #endif
28690             if (sizeof(uint64_t) <= sizeof(long)) {
28691                 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x))
28692 #ifdef HAVE_LONG_LONG
28693             } else if (sizeof(uint64_t) <= sizeof(PY_LONG_LONG)) {
28694                 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x))
28695 #endif
28696             }
28697         }
28698         {
28699 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
28700             PyErr_SetString(PyExc_RuntimeError,
28701                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
28702 #else
28703             uint64_t val;
28704             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
28705  #if PY_MAJOR_VERSION < 3
28706             if (likely(v) && !PyLong_Check(v)) {
28707                 PyObject *tmp = v;
28708                 v = PyNumber_Long(tmp);
28709                 Py_DECREF(tmp);
28710             }
28711  #endif
28712             if (likely(v)) {
28713                 int one = 1; int is_little = (int)*(unsigned char *)&one;
28714                 unsigned char *bytes = (unsigned char *)&val;
28715                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
28716                                               bytes, sizeof(val),
28717                                               is_little, !is_unsigned);
28718                 Py_DECREF(v);
28719                 if (likely(!ret))
28720                     return val;
28721             }
28722 #endif
28723             return (uint64_t) -1;
28724         }
28725     } else {
28726         uint64_t val;
28727         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
28728         if (!tmp) return (uint64_t) -1;
28729         val = __Pyx_PyInt_As_uint64_t(tmp);
28730         Py_DECREF(tmp);
28731         return val;
28732     }
28733 raise_overflow:
28734     PyErr_SetString(PyExc_OverflowError,
28735         "value too large to convert to uint64_t");
28736     return (uint64_t) -1;
28737 raise_neg_overflow:
28738     PyErr_SetString(PyExc_OverflowError,
28739         "can't convert negative value to uint64_t");
28740     return (uint64_t) -1;
28741 }
28742 
28743 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)28744   static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
28745     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
28746     const int is_unsigned = neg_one > const_zero;
28747 #if PY_MAJOR_VERSION < 3
28748     if (likely(PyInt_Check(x))) {
28749         if (sizeof(long) < sizeof(long)) {
28750             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
28751         } else {
28752             long val = PyInt_AS_LONG(x);
28753             if (is_unsigned && unlikely(val < 0)) {
28754                 goto raise_neg_overflow;
28755             }
28756             return (long) val;
28757         }
28758     } else
28759 #endif
28760     if (likely(PyLong_Check(x))) {
28761         if (is_unsigned) {
28762 #if CYTHON_USE_PYLONG_INTERNALS
28763             const digit* digits = ((PyLongObject*)x)->ob_digit;
28764             switch (Py_SIZE(x)) {
28765                 case  0: return (long) 0;
28766                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
28767                 case 2:
28768                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
28769                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
28770                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28771                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
28772                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
28773                         }
28774                     }
28775                     break;
28776                 case 3:
28777                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
28778                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
28779                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28780                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
28781                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
28782                         }
28783                     }
28784                     break;
28785                 case 4:
28786                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
28787                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
28788                             __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])))
28789                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
28790                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
28791                         }
28792                     }
28793                     break;
28794             }
28795 #endif
28796 #if CYTHON_COMPILING_IN_CPYTHON
28797             if (unlikely(Py_SIZE(x) < 0)) {
28798                 goto raise_neg_overflow;
28799             }
28800 #else
28801             {
28802                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
28803                 if (unlikely(result < 0))
28804                     return (long) -1;
28805                 if (unlikely(result == 1))
28806                     goto raise_neg_overflow;
28807             }
28808 #endif
28809             if (sizeof(long) <= sizeof(unsigned long)) {
28810                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
28811 #ifdef HAVE_LONG_LONG
28812             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
28813                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
28814 #endif
28815             }
28816         } else {
28817 #if CYTHON_USE_PYLONG_INTERNALS
28818             const digit* digits = ((PyLongObject*)x)->ob_digit;
28819             switch (Py_SIZE(x)) {
28820                 case  0: return (long) 0;
28821                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
28822                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
28823                 case -2:
28824                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
28825                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
28826                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28827                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
28828                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28829                         }
28830                     }
28831                     break;
28832                 case 2:
28833                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
28834                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
28835                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28836                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
28837                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28838                         }
28839                     }
28840                     break;
28841                 case -3:
28842                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
28843                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
28844                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28845                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
28846                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28847                         }
28848                     }
28849                     break;
28850                 case 3:
28851                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
28852                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
28853                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28854                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
28855                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28856                         }
28857                     }
28858                     break;
28859                 case -4:
28860                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
28861                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
28862                             __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])))
28863                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
28864                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28865                         }
28866                     }
28867                     break;
28868                 case 4:
28869                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
28870                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
28871                             __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])))
28872                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
28873                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28874                         }
28875                     }
28876                     break;
28877             }
28878 #endif
28879             if (sizeof(long) <= sizeof(long)) {
28880                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
28881 #ifdef HAVE_LONG_LONG
28882             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
28883                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
28884 #endif
28885             }
28886         }
28887         {
28888 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
28889             PyErr_SetString(PyExc_RuntimeError,
28890                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
28891 #else
28892             long val;
28893             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
28894  #if PY_MAJOR_VERSION < 3
28895             if (likely(v) && !PyLong_Check(v)) {
28896                 PyObject *tmp = v;
28897                 v = PyNumber_Long(tmp);
28898                 Py_DECREF(tmp);
28899             }
28900  #endif
28901             if (likely(v)) {
28902                 int one = 1; int is_little = (int)*(unsigned char *)&one;
28903                 unsigned char *bytes = (unsigned char *)&val;
28904                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
28905                                               bytes, sizeof(val),
28906                                               is_little, !is_unsigned);
28907                 Py_DECREF(v);
28908                 if (likely(!ret))
28909                     return val;
28910             }
28911 #endif
28912             return (long) -1;
28913         }
28914     } else {
28915         long val;
28916         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
28917         if (!tmp) return (long) -1;
28918         val = __Pyx_PyInt_As_long(tmp);
28919         Py_DECREF(tmp);
28920         return val;
28921     }
28922 raise_overflow:
28923     PyErr_SetString(PyExc_OverflowError,
28924         "value too large to convert to long");
28925     return (long) -1;
28926 raise_neg_overflow:
28927     PyErr_SetString(PyExc_OverflowError,
28928         "can't convert negative value to long");
28929     return (long) -1;
28930 }
28931 
28932 /* CIntToPy */
__Pyx_PyInt_From_long(long value)28933   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
28934     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
28935     const int is_unsigned = neg_one > const_zero;
28936     if (is_unsigned) {
28937         if (sizeof(long) < sizeof(long)) {
28938             return PyInt_FromLong((long) value);
28939         } else if (sizeof(long) <= sizeof(unsigned long)) {
28940             return PyLong_FromUnsignedLong((unsigned long) value);
28941 #ifdef HAVE_LONG_LONG
28942         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
28943             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
28944 #endif
28945         }
28946     } else {
28947         if (sizeof(long) <= sizeof(long)) {
28948             return PyInt_FromLong((long) value);
28949 #ifdef HAVE_LONG_LONG
28950         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
28951             return PyLong_FromLongLong((PY_LONG_LONG) value);
28952 #endif
28953         }
28954     }
28955     {
28956         int one = 1; int little = (int)*(unsigned char *)&one;
28957         unsigned char *bytes = (unsigned char *)&value;
28958         return _PyLong_FromByteArray(bytes, sizeof(long),
28959                                      little, !is_unsigned);
28960     }
28961 }
28962 
28963 /* CIntFromPy */
__Pyx_PyInt_As_char(PyObject * x)28964   static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
28965     const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0;
28966     const int is_unsigned = neg_one > const_zero;
28967 #if PY_MAJOR_VERSION < 3
28968     if (likely(PyInt_Check(x))) {
28969         if (sizeof(char) < sizeof(long)) {
28970             __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
28971         } else {
28972             long val = PyInt_AS_LONG(x);
28973             if (is_unsigned && unlikely(val < 0)) {
28974                 goto raise_neg_overflow;
28975             }
28976             return (char) val;
28977         }
28978     } else
28979 #endif
28980     if (likely(PyLong_Check(x))) {
28981         if (is_unsigned) {
28982 #if CYTHON_USE_PYLONG_INTERNALS
28983             const digit* digits = ((PyLongObject*)x)->ob_digit;
28984             switch (Py_SIZE(x)) {
28985                 case  0: return (char) 0;
28986                 case  1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
28987                 case 2:
28988                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
28989                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
28990                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28991                         } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
28992                             return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
28993                         }
28994                     }
28995                     break;
28996                 case 3:
28997                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
28998                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
28999                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
29000                         } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
29001                             return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
29002                         }
29003                     }
29004                     break;
29005                 case 4:
29006                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
29007                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
29008                             __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])))
29009                         } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
29010                             return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
29011                         }
29012                     }
29013                     break;
29014             }
29015 #endif
29016 #if CYTHON_COMPILING_IN_CPYTHON
29017             if (unlikely(Py_SIZE(x) < 0)) {
29018                 goto raise_neg_overflow;
29019             }
29020 #else
29021             {
29022                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
29023                 if (unlikely(result < 0))
29024                     return (char) -1;
29025                 if (unlikely(result == 1))
29026                     goto raise_neg_overflow;
29027             }
29028 #endif
29029             if (sizeof(char) <= sizeof(unsigned long)) {
29030                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
29031 #ifdef HAVE_LONG_LONG
29032             } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
29033                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
29034 #endif
29035             }
29036         } else {
29037 #if CYTHON_USE_PYLONG_INTERNALS
29038             const digit* digits = ((PyLongObject*)x)->ob_digit;
29039             switch (Py_SIZE(x)) {
29040                 case  0: return (char) 0;
29041                 case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
29042                 case  1: __PYX_VERIFY_RETURN_INT(char,  digit, +digits[0])
29043                 case -2:
29044                     if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
29045                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
29046                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
29047                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
29048                             return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
29049                         }
29050                     }
29051                     break;
29052                 case 2:
29053                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
29054                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
29055                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
29056                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
29057                             return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
29058                         }
29059                     }
29060                     break;
29061                 case -3:
29062                     if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
29063                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
29064                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
29065                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
29066                             return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
29067                         }
29068                     }
29069                     break;
29070                 case 3:
29071                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
29072                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
29073                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
29074                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
29075                             return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
29076                         }
29077                     }
29078                     break;
29079                 case -4:
29080                     if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
29081                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
29082                             __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])))
29083                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
29084                             return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
29085                         }
29086                     }
29087                     break;
29088                 case 4:
29089                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
29090                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
29091                             __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])))
29092                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
29093                             return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
29094                         }
29095                     }
29096                     break;
29097             }
29098 #endif
29099             if (sizeof(char) <= sizeof(long)) {
29100                 __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
29101 #ifdef HAVE_LONG_LONG
29102             } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
29103                 __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
29104 #endif
29105             }
29106         }
29107         {
29108 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
29109             PyErr_SetString(PyExc_RuntimeError,
29110                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
29111 #else
29112             char val;
29113             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
29114  #if PY_MAJOR_VERSION < 3
29115             if (likely(v) && !PyLong_Check(v)) {
29116                 PyObject *tmp = v;
29117                 v = PyNumber_Long(tmp);
29118                 Py_DECREF(tmp);
29119             }
29120  #endif
29121             if (likely(v)) {
29122                 int one = 1; int is_little = (int)*(unsigned char *)&one;
29123                 unsigned char *bytes = (unsigned char *)&val;
29124                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
29125                                               bytes, sizeof(val),
29126                                               is_little, !is_unsigned);
29127                 Py_DECREF(v);
29128                 if (likely(!ret))
29129                     return val;
29130             }
29131 #endif
29132             return (char) -1;
29133         }
29134     } else {
29135         char val;
29136         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
29137         if (!tmp) return (char) -1;
29138         val = __Pyx_PyInt_As_char(tmp);
29139         Py_DECREF(tmp);
29140         return val;
29141     }
29142 raise_overflow:
29143     PyErr_SetString(PyExc_OverflowError,
29144         "value too large to convert to char");
29145     return (char) -1;
29146 raise_neg_overflow:
29147     PyErr_SetString(PyExc_OverflowError,
29148         "can't convert negative value to char");
29149     return (char) -1;
29150 }
29151 
29152 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)29153   static int __Pyx_check_binary_version(void) {
29154     char ctversion[4], rtversion[4];
29155     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
29156     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
29157     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
29158         char message[200];
29159         PyOS_snprintf(message, sizeof(message),
29160                       "compiletime version %s of module '%.100s' "
29161                       "does not match runtime version %s",
29162                       ctversion, __Pyx_MODULE_NAME, rtversion);
29163         return PyErr_WarnEx(NULL, message, 1);
29164     }
29165     return 0;
29166 }
29167 
29168 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)29169   static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
29170     while (t->p) {
29171         #if PY_MAJOR_VERSION < 3
29172         if (t->is_unicode) {
29173             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
29174         } else if (t->intern) {
29175             *t->p = PyString_InternFromString(t->s);
29176         } else {
29177             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
29178         }
29179         #else
29180         if (t->is_unicode | t->is_str) {
29181             if (t->intern) {
29182                 *t->p = PyUnicode_InternFromString(t->s);
29183             } else if (t->encoding) {
29184                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
29185             } else {
29186                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
29187             }
29188         } else {
29189             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
29190         }
29191         #endif
29192         if (!*t->p)
29193             return -1;
29194         if (PyObject_Hash(*t->p) == -1)
29195             return -1;
29196         ++t;
29197     }
29198     return 0;
29199 }
29200 
__Pyx_PyUnicode_FromString(const char * c_str)29201 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
29202     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
29203 }
__Pyx_PyObject_AsString(PyObject * o)29204 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
29205     Py_ssize_t ignore;
29206     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
29207 }
29208 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
29209 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)29210 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
29211     char* defenc_c;
29212     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
29213     if (!defenc) return NULL;
29214     defenc_c = PyBytes_AS_STRING(defenc);
29215 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
29216     {
29217         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
29218         char* c;
29219         for (c = defenc_c; c < end; c++) {
29220             if ((unsigned char) (*c) >= 128) {
29221                 PyUnicode_AsASCIIString(o);
29222                 return NULL;
29223             }
29224         }
29225     }
29226 #endif
29227     *length = PyBytes_GET_SIZE(defenc);
29228     return defenc_c;
29229 }
29230 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)29231 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
29232     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
29233 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
29234     if (likely(PyUnicode_IS_ASCII(o))) {
29235         *length = PyUnicode_GET_LENGTH(o);
29236         return PyUnicode_AsUTF8(o);
29237     } else {
29238         PyUnicode_AsASCIIString(o);
29239         return NULL;
29240     }
29241 #else
29242     return PyUnicode_AsUTF8AndSize(o, length);
29243 #endif
29244 }
29245 #endif
29246 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)29247 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
29248 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
29249     if (
29250 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
29251             __Pyx_sys_getdefaultencoding_not_ascii &&
29252 #endif
29253             PyUnicode_Check(o)) {
29254         return __Pyx_PyUnicode_AsStringAndSize(o, length);
29255     } else
29256 #endif
29257 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
29258     if (PyByteArray_Check(o)) {
29259         *length = PyByteArray_GET_SIZE(o);
29260         return PyByteArray_AS_STRING(o);
29261     } else
29262 #endif
29263     {
29264         char* result;
29265         int r = PyBytes_AsStringAndSize(o, &result, length);
29266         if (unlikely(r < 0)) {
29267             return NULL;
29268         } else {
29269             return result;
29270         }
29271     }
29272 }
__Pyx_PyObject_IsTrue(PyObject * x)29273 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
29274    int is_true = x == Py_True;
29275    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
29276    else return PyObject_IsTrue(x);
29277 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)29278 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
29279     int retval;
29280     if (unlikely(!x)) return -1;
29281     retval = __Pyx_PyObject_IsTrue(x);
29282     Py_DECREF(x);
29283     return retval;
29284 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)29285 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
29286 #if PY_MAJOR_VERSION >= 3
29287     if (PyLong_Check(result)) {
29288         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
29289                 "__int__ returned non-int (type %.200s).  "
29290                 "The ability to return an instance of a strict subclass of int "
29291                 "is deprecated, and may be removed in a future version of Python.",
29292                 Py_TYPE(result)->tp_name)) {
29293             Py_DECREF(result);
29294             return NULL;
29295         }
29296         return result;
29297     }
29298 #endif
29299     PyErr_Format(PyExc_TypeError,
29300                  "__%.4s__ returned non-%.4s (type %.200s)",
29301                  type_name, type_name, Py_TYPE(result)->tp_name);
29302     Py_DECREF(result);
29303     return NULL;
29304 }
__Pyx_PyNumber_IntOrLong(PyObject * x)29305 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
29306 #if CYTHON_USE_TYPE_SLOTS
29307   PyNumberMethods *m;
29308 #endif
29309   const char *name = NULL;
29310   PyObject *res = NULL;
29311 #if PY_MAJOR_VERSION < 3
29312   if (likely(PyInt_Check(x) || PyLong_Check(x)))
29313 #else
29314   if (likely(PyLong_Check(x)))
29315 #endif
29316     return __Pyx_NewRef(x);
29317 #if CYTHON_USE_TYPE_SLOTS
29318   m = Py_TYPE(x)->tp_as_number;
29319   #if PY_MAJOR_VERSION < 3
29320   if (m && m->nb_int) {
29321     name = "int";
29322     res = m->nb_int(x);
29323   }
29324   else if (m && m->nb_long) {
29325     name = "long";
29326     res = m->nb_long(x);
29327   }
29328   #else
29329   if (likely(m && m->nb_int)) {
29330     name = "int";
29331     res = m->nb_int(x);
29332   }
29333   #endif
29334 #else
29335   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
29336     res = PyNumber_Int(x);
29337   }
29338 #endif
29339   if (likely(res)) {
29340 #if PY_MAJOR_VERSION < 3
29341     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
29342 #else
29343     if (unlikely(!PyLong_CheckExact(res))) {
29344 #endif
29345         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
29346     }
29347   }
29348   else if (!PyErr_Occurred()) {
29349     PyErr_SetString(PyExc_TypeError,
29350                     "an integer is required");
29351   }
29352   return res;
29353 }
29354 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
29355   Py_ssize_t ival;
29356   PyObject *x;
29357 #if PY_MAJOR_VERSION < 3
29358   if (likely(PyInt_CheckExact(b))) {
29359     if (sizeof(Py_ssize_t) >= sizeof(long))
29360         return PyInt_AS_LONG(b);
29361     else
29362         return PyInt_AsSsize_t(b);
29363   }
29364 #endif
29365   if (likely(PyLong_CheckExact(b))) {
29366     #if CYTHON_USE_PYLONG_INTERNALS
29367     const digit* digits = ((PyLongObject*)b)->ob_digit;
29368     const Py_ssize_t size = Py_SIZE(b);
29369     if (likely(__Pyx_sst_abs(size) <= 1)) {
29370         ival = likely(size) ? digits[0] : 0;
29371         if (size == -1) ival = -ival;
29372         return ival;
29373     } else {
29374       switch (size) {
29375          case 2:
29376            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
29377              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
29378            }
29379            break;
29380          case -2:
29381            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
29382              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
29383            }
29384            break;
29385          case 3:
29386            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
29387              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
29388            }
29389            break;
29390          case -3:
29391            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
29392              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
29393            }
29394            break;
29395          case 4:
29396            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
29397              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]));
29398            }
29399            break;
29400          case -4:
29401            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
29402              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]));
29403            }
29404            break;
29405       }
29406     }
29407     #endif
29408     return PyLong_AsSsize_t(b);
29409   }
29410   x = PyNumber_Index(b);
29411   if (!x) return -1;
29412   ival = PyInt_AsSsize_t(x);
29413   Py_DECREF(x);
29414   return ival;
29415 }
29416 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
29417   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
29418 }
29419 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
29420     return PyInt_FromSize_t(ival);
29421 }
29422 
29423 
29424 #endif /* Py_PYTHON_H */
29425