1 /* Generated by Cython 0.29.12 */
2 
3 /* BEGIN: Cython Metadata
4 {
5     "distutils": {
6         "depends": [],
7         "libraries": [
8             "m"
9         ],
10         "name": "yt.utilities.lib.amr_kdtools",
11         "sources": [
12             "yt/utilities/lib/amr_kdtools.pyx"
13         ]
14     },
15     "module_name": "yt.utilities.lib.amr_kdtools"
16 }
17 END: Cython Metadata */
18 
19 #define PY_SSIZE_T_CLEAN
20 #include "Python.h"
21 #ifndef Py_PYTHON_H
22     #error Python headers needed to compile C extensions, please install development version of Python.
23 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
24     #error Cython requires Python 2.6+ or Python 3.3+.
25 #else
26 #define CYTHON_ABI "0_29_12"
27 #define CYTHON_HEX_VERSION 0x001D0CF0
28 #define CYTHON_FUTURE_DIVISION 0
29 #include <stddef.h>
30 #ifndef offsetof
31   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
32 #endif
33 #if !defined(WIN32) && !defined(MS_WINDOWS)
34   #ifndef __stdcall
35     #define __stdcall
36   #endif
37   #ifndef __cdecl
38     #define __cdecl
39   #endif
40   #ifndef __fastcall
41     #define __fastcall
42   #endif
43 #endif
44 #ifndef DL_IMPORT
45   #define DL_IMPORT(t) t
46 #endif
47 #ifndef DL_EXPORT
48   #define DL_EXPORT(t) t
49 #endif
50 #define __PYX_COMMA ,
51 #ifndef HAVE_LONG_LONG
52   #if PY_VERSION_HEX >= 0x02070000
53     #define HAVE_LONG_LONG
54   #endif
55 #endif
56 #ifndef PY_LONG_LONG
57   #define PY_LONG_LONG LONG_LONG
58 #endif
59 #ifndef Py_HUGE_VAL
60   #define Py_HUGE_VAL HUGE_VAL
61 #endif
62 #ifdef PYPY_VERSION
63   #define CYTHON_COMPILING_IN_PYPY 1
64   #define CYTHON_COMPILING_IN_PYSTON 0
65   #define CYTHON_COMPILING_IN_CPYTHON 0
66   #undef CYTHON_USE_TYPE_SLOTS
67   #define CYTHON_USE_TYPE_SLOTS 0
68   #undef CYTHON_USE_PYTYPE_LOOKUP
69   #define CYTHON_USE_PYTYPE_LOOKUP 0
70   #if PY_VERSION_HEX < 0x03050000
71     #undef CYTHON_USE_ASYNC_SLOTS
72     #define CYTHON_USE_ASYNC_SLOTS 0
73   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
74     #define CYTHON_USE_ASYNC_SLOTS 1
75   #endif
76   #undef CYTHON_USE_PYLIST_INTERNALS
77   #define CYTHON_USE_PYLIST_INTERNALS 0
78   #undef CYTHON_USE_UNICODE_INTERNALS
79   #define CYTHON_USE_UNICODE_INTERNALS 0
80   #undef CYTHON_USE_UNICODE_WRITER
81   #define CYTHON_USE_UNICODE_WRITER 0
82   #undef CYTHON_USE_PYLONG_INTERNALS
83   #define CYTHON_USE_PYLONG_INTERNALS 0
84   #undef CYTHON_AVOID_BORROWED_REFS
85   #define CYTHON_AVOID_BORROWED_REFS 1
86   #undef CYTHON_ASSUME_SAFE_MACROS
87   #define CYTHON_ASSUME_SAFE_MACROS 0
88   #undef CYTHON_UNPACK_METHODS
captured_command_loop(void * data)89   #define CYTHON_UNPACK_METHODS 0
90   #undef CYTHON_FAST_THREAD_STATE
91   #define CYTHON_FAST_THREAD_STATE 0
92   #undef CYTHON_FAST_PYCALL
93   #define CYTHON_FAST_PYCALL 0
94   #undef CYTHON_PEP489_MULTI_PHASE_INIT
95   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
96   #undef CYTHON_USE_TP_FINALIZE
97   #define CYTHON_USE_TP_FINALIZE 0
98   #undef CYTHON_USE_DICT_VERSIONS
99   #define CYTHON_USE_DICT_VERSIONS 0
100   #undef CYTHON_USE_EXC_INFO_STACK
101   #define CYTHON_USE_EXC_INFO_STACK 0
102 #elif defined(PYSTON_VERSION)
103   #define CYTHON_COMPILING_IN_PYPY 0
104   #define CYTHON_COMPILING_IN_PYSTON 1
105   #define CYTHON_COMPILING_IN_CPYTHON 0
106   #ifndef CYTHON_USE_TYPE_SLOTS
107     #define CYTHON_USE_TYPE_SLOTS 1
108   #endif
109   #undef CYTHON_USE_PYTYPE_LOOKUP
110   #define CYTHON_USE_PYTYPE_LOOKUP 0
111   #undef CYTHON_USE_ASYNC_SLOTS
112   #define CYTHON_USE_ASYNC_SLOTS 0
113   #undef CYTHON_USE_PYLIST_INTERNALS
114   #define CYTHON_USE_PYLIST_INTERNALS 0
115   #ifndef CYTHON_USE_UNICODE_INTERNALS
116     #define CYTHON_USE_UNICODE_INTERNALS 1
117   #endif
118   #undef CYTHON_USE_UNICODE_WRITER
119   #define CYTHON_USE_UNICODE_WRITER 0
120   #undef CYTHON_USE_PYLONG_INTERNALS
121   #define CYTHON_USE_PYLONG_INTERNALS 0
122   #ifndef CYTHON_AVOID_BORROWED_REFS
123     #define CYTHON_AVOID_BORROWED_REFS 0
124   #endif
125   #ifndef CYTHON_ASSUME_SAFE_MACROS
126     #define CYTHON_ASSUME_SAFE_MACROS 1
127   #endif
128   #ifndef CYTHON_UNPACK_METHODS
129     #define CYTHON_UNPACK_METHODS 1
130   #endif
131   #undef CYTHON_FAST_THREAD_STATE
132   #define CYTHON_FAST_THREAD_STATE 0
133   #undef CYTHON_FAST_PYCALL
134   #define CYTHON_FAST_PYCALL 0
135   #undef CYTHON_PEP489_MULTI_PHASE_INIT
136   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
137   #undef CYTHON_USE_TP_FINALIZE
138   #define CYTHON_USE_TP_FINALIZE 0
139   #undef CYTHON_USE_DICT_VERSIONS
140   #define CYTHON_USE_DICT_VERSIONS 0
141   #undef CYTHON_USE_EXC_INFO_STACK
142   #define CYTHON_USE_EXC_INFO_STACK 0
143 #else
144   #define CYTHON_COMPILING_IN_PYPY 0
145   #define CYTHON_COMPILING_IN_PYSTON 0
146   #define CYTHON_COMPILING_IN_CPYTHON 1
147   #ifndef CYTHON_USE_TYPE_SLOTS
148     #define CYTHON_USE_TYPE_SLOTS 1
149   #endif
150   #if PY_VERSION_HEX < 0x02070000
151     #undef CYTHON_USE_PYTYPE_LOOKUP
152     #define CYTHON_USE_PYTYPE_LOOKUP 0
153   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
154     #define CYTHON_USE_PYTYPE_LOOKUP 1
155   #endif
156   #if PY_MAJOR_VERSION < 3
157     #undef CYTHON_USE_ASYNC_SLOTS
158     #define CYTHON_USE_ASYNC_SLOTS 0
159   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
160     #define CYTHON_USE_ASYNC_SLOTS 1
161   #endif
162   #if PY_VERSION_HEX < 0x02070000
163     #undef CYTHON_USE_PYLONG_INTERNALS
164     #define CYTHON_USE_PYLONG_INTERNALS 0
165   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
166     #define CYTHON_USE_PYLONG_INTERNALS 1
167   #endif
168   #ifndef CYTHON_USE_PYLIST_INTERNALS
169     #define CYTHON_USE_PYLIST_INTERNALS 1
170   #endif
171   #ifndef CYTHON_USE_UNICODE_INTERNALS
172     #define CYTHON_USE_UNICODE_INTERNALS 1
173   #endif
174   #if PY_VERSION_HEX < 0x030300F0
175     #undef CYTHON_USE_UNICODE_WRITER
176     #define CYTHON_USE_UNICODE_WRITER 0
177   #elif !defined(CYTHON_USE_UNICODE_WRITER)
178     #define CYTHON_USE_UNICODE_WRITER 1
179   #endif
180   #ifndef CYTHON_AVOID_BORROWED_REFS
181     #define CYTHON_AVOID_BORROWED_REFS 0
182   #endif
183   #ifndef CYTHON_ASSUME_SAFE_MACROS
184     #define CYTHON_ASSUME_SAFE_MACROS 1
185   #endif
186   #ifndef CYTHON_UNPACK_METHODS
187     #define CYTHON_UNPACK_METHODS 1
188   #endif
189   #ifndef CYTHON_FAST_THREAD_STATE
190     #define CYTHON_FAST_THREAD_STATE 1
191   #endif
192   #ifndef CYTHON_FAST_PYCALL
193     #define CYTHON_FAST_PYCALL 1
194   #endif
195   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
196     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
197   #endif
198   #ifndef CYTHON_USE_TP_FINALIZE
199     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
200   #endif
201   #ifndef CYTHON_USE_DICT_VERSIONS
202     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
203   #endif
204   #ifndef CYTHON_USE_EXC_INFO_STACK
205     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
206   #endif
207 #endif
208 #if !defined(CYTHON_FAST_PYCCALL)
209 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
210 #endif
211 #if CYTHON_USE_PYLONG_INTERNALS
212   #include "longintrepr.h"
213   #undef SHIFT
214   #undef BASE
215   #undef MASK
216   #ifdef SIZEOF_VOID_P
217     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
218   #endif
219 #endif
220 #ifndef __has_attribute
221   #define __has_attribute(x) 0
222 #endif
223 #ifndef __has_cpp_attribute
224   #define __has_cpp_attribute(x) 0
225 #endif
226 #ifndef CYTHON_RESTRICT
227   #if defined(__GNUC__)
228     #define CYTHON_RESTRICT __restrict__
229   #elif defined(_MSC_VER) && _MSC_VER >= 1400
230     #define CYTHON_RESTRICT __restrict
231   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
232     #define CYTHON_RESTRICT restrict
233   #else
234     #define CYTHON_RESTRICT
235   #endif
236 #endif
237 #ifndef CYTHON_UNUSED
238 # if defined(__GNUC__)
239 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
240 #     define CYTHON_UNUSED __attribute__ ((__unused__))
241 #   else
242 #     define CYTHON_UNUSED
243 #   endif
244 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
245 #   define CYTHON_UNUSED __attribute__ ((__unused__))
246 # else
247 #   define CYTHON_UNUSED
248 # endif
249 #endif
250 #ifndef CYTHON_MAYBE_UNUSED_VAR
251 #  if defined(__cplusplus)
252      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
253 #  else
254 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
255 #  endif
256 #endif
257 #ifndef CYTHON_NCP_UNUSED
258 # if CYTHON_COMPILING_IN_CPYTHON
259 #  define CYTHON_NCP_UNUSED
260 # else
261 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
262 # endif
263 #endif
264 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
265 #ifdef _MSC_VER
266     #ifndef _MSC_STDINT_H_
267         #if _MSC_VER < 1300
268            typedef unsigned char     uint8_t;
269            typedef unsigned int      uint32_t;
270         #else
271            typedef unsigned __int8   uint8_t;
272            typedef unsigned __int32  uint32_t;
273         #endif
274     #endif
275 #else
276    #include <stdint.h>
277 #endif
278 #ifndef CYTHON_FALLTHROUGH
279   #if defined(__cplusplus) && __cplusplus >= 201103L
280     #if __has_cpp_attribute(fallthrough)
281       #define CYTHON_FALLTHROUGH [[fallthrough]]
282     #elif __has_cpp_attribute(clang::fallthrough)
283       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
284     #elif __has_cpp_attribute(gnu::fallthrough)
285       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
286     #endif
287   #endif
288   #ifndef CYTHON_FALLTHROUGH
289     #if __has_attribute(fallthrough)
290       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
291     #else
292       #define CYTHON_FALLTHROUGH
293     #endif
294   #endif
295   #if defined(__clang__ ) && defined(__apple_build_version__)
296     #if __apple_build_version__ < 7000000
297       #undef  CYTHON_FALLTHROUGH
298       #define CYTHON_FALLTHROUGH
299     #endif
300   #endif
301 #endif
302 
303 #ifndef CYTHON_INLINE
304   #if defined(__clang__)
305     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
306   #elif defined(__GNUC__)
307     #define CYTHON_INLINE __inline__
308   #elif defined(_MSC_VER)
309     #define CYTHON_INLINE __inline
310   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
311     #define CYTHON_INLINE inline
312   #else
313     #define CYTHON_INLINE
314   #endif
315 #endif
316 
317 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
318   #define Py_OptimizeFlag 0
319 #endif
320 #define __PYX_BUILD_PY_SSIZE_T "n"
321 #define CYTHON_FORMAT_SSIZE_T "z"
322 #if PY_MAJOR_VERSION < 3
323   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
324   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
325           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
326   #define __Pyx_DefaultClassType PyClass_Type
327 #else
328   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
329 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
330   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
331           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
332 #else
333   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
334           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
335 #endif
336   #define __Pyx_DefaultClassType PyType_Type
337 #endif
338 #ifndef Py_TPFLAGS_CHECKTYPES
339   #define Py_TPFLAGS_CHECKTYPES 0
340 #endif
341 #ifndef Py_TPFLAGS_HAVE_INDEX
342   #define Py_TPFLAGS_HAVE_INDEX 0
343 #endif
344 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
345   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
346 #endif
347 #ifndef Py_TPFLAGS_HAVE_FINALIZE
348   #define Py_TPFLAGS_HAVE_FINALIZE 0
349 #endif
350 #ifndef METH_STACKLESS
351   #define METH_STACKLESS 0
352 #endif
353 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
354   #ifndef METH_FASTCALL
355      #define METH_FASTCALL 0x80
356   #endif
357   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
358   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
359                                                           Py_ssize_t nargs, PyObject *kwnames);
360 #else
361   #define __Pyx_PyCFunctionFast _PyCFunctionFast
362   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
363 #endif
364 #if CYTHON_FAST_PYCCALL
365 #define __Pyx_PyFastCFunction_Check(func)\
366     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
367 #else
368 #define __Pyx_PyFastCFunction_Check(func) 0
369 #endif
370 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
371   #define PyObject_Malloc(s)   PyMem_Malloc(s)
372   #define PyObject_Free(p)     PyMem_Free(p)
373   #define PyObject_Realloc(p)  PyMem_Realloc(p)
374 #endif
375 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
376   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
377   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
378   #define PyMem_RawFree(p)             PyMem_Free(p)
379 #endif
380 #if CYTHON_COMPILING_IN_PYSTON
381   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
382   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
383 #else
384   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
385   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
386 #endif
387 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
388   #define __Pyx_PyThreadState_Current PyThreadState_GET()
389 #elif PY_VERSION_HEX >= 0x03060000
390   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
391 #elif PY_VERSION_HEX >= 0x03000000
392   #define __Pyx_PyThreadState_Current PyThreadState_GET()
393 #else
394   #define __Pyx_PyThreadState_Current _PyThreadState_Current
395 #endif
396 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
397 #include "pythread.h"
398 #define Py_tss_NEEDS_INIT 0
399 typedef int Py_tss_t;
400 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
401   *key = PyThread_create_key();
402   return 0;
403 }
404 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
405   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
406   *key = Py_tss_NEEDS_INIT;
407   return key;
408 }
409 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
410   PyObject_Free(key);
411 }
412 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
413   return *key != Py_tss_NEEDS_INIT;
414 }
415 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
416   PyThread_delete_key(*key);
417   *key = Py_tss_NEEDS_INIT;
418 }
419 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
420   return PyThread_set_key_value(*key, value);
421 }
422 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
423   return PyThread_get_key_value(*key);
424 }
425 #endif
426 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
427 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
428 #else
429 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
430 #endif
431 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
432   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
433   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
434 #else
435   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
436   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
437 #endif
438 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
439 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
440 #else
441 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
442 #endif
443 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
444   #define CYTHON_PEP393_ENABLED 1
445   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
446                                               0 : _PyUnicode_Ready((PyObject *)(op)))
447   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
448   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
449   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
450   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
451   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
452   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
453   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
454   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
455 #else
456   #define CYTHON_PEP393_ENABLED 0
457   #define PyUnicode_1BYTE_KIND  1
458   #define PyUnicode_2BYTE_KIND  2
459   #define PyUnicode_4BYTE_KIND  4
460   #define __Pyx_PyUnicode_READY(op)       (0)
461   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
462   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
463   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
464   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
465   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
466   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
467   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
468   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
469 #endif
470 #if CYTHON_COMPILING_IN_PYPY
471   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
472   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
473 #else
474   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
475   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
476       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
477 #endif
478 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
479   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
480 #endif
481 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
482   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
483 #endif
484 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
485   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
486 #endif
487 #define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
488 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
489 #if PY_MAJOR_VERSION >= 3
490   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
491 #else
492   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
493 #endif
494 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
495   #define PyObject_ASCII(o)            PyObject_Repr(o)
496 #endif
497 #if PY_MAJOR_VERSION >= 3
498   #define PyBaseString_Type            PyUnicode_Type
499   #define PyStringObject               PyUnicodeObject
500   #define PyString_Type                PyUnicode_Type
501   #define PyString_Check               PyUnicode_Check
502   #define PyString_CheckExact          PyUnicode_CheckExact
503   #define PyObject_Unicode             PyObject_Str
504 #endif
505 #if PY_MAJOR_VERSION >= 3
506   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
507   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
508 #else
509   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
510   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
511 #endif
512 #ifndef PySet_CheckExact
513   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
514 #endif
515 #if CYTHON_ASSUME_SAFE_MACROS
516   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
517 #else
518   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
519 #endif
520 #if PY_MAJOR_VERSION >= 3
521   #define PyIntObject                  PyLongObject
522   #define PyInt_Type                   PyLong_Type
523   #define PyInt_Check(op)              PyLong_Check(op)
524   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
525   #define PyInt_FromString             PyLong_FromString
526   #define PyInt_FromUnicode            PyLong_FromUnicode
527   #define PyInt_FromLong               PyLong_FromLong
528   #define PyInt_FromSize_t             PyLong_FromSize_t
529   #define PyInt_FromSsize_t            PyLong_FromSsize_t
530   #define PyInt_AsLong                 PyLong_AsLong
531   #define PyInt_AS_LONG                PyLong_AS_LONG
532   #define PyInt_AsSsize_t              PyLong_AsSsize_t
533   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
534   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
535   #define PyNumber_Int                 PyNumber_Long
536 #endif
537 #if PY_MAJOR_VERSION >= 3
538   #define PyBoolObject                 PyLongObject
539 #endif
540 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
541   #ifndef PyUnicode_InternFromString
542     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
543   #endif
544 #endif
545 #if PY_VERSION_HEX < 0x030200A4
546   typedef long Py_hash_t;
547   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
548   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
549 #else
550   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
551   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
552 #endif
553 #if PY_MAJOR_VERSION >= 3
554   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
555 #else
556   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
557 #endif
558 #if CYTHON_USE_ASYNC_SLOTS
559   #if PY_VERSION_HEX >= 0x030500B1
560     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
561     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
562   #else
563     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
564   #endif
565 #else
566   #define __Pyx_PyType_AsAsync(obj) NULL
567 #endif
568 #ifndef __Pyx_PyAsyncMethodsStruct
569     typedef struct {
570         unaryfunc am_await;
571         unaryfunc am_aiter;
572         unaryfunc am_anext;
573     } __Pyx_PyAsyncMethodsStruct;
574 #endif
575 
576 #if defined(WIN32) || defined(MS_WINDOWS)
577   #define _USE_MATH_DEFINES
578 #endif
579 #include <math.h>
580 #ifdef NAN
581 #define __PYX_NAN() ((float) NAN)
582 #else
583 static CYTHON_INLINE float __PYX_NAN() {
584   float value;
585   memset(&value, 0xFF, sizeof(value));
586   return value;
587 }
588 #endif
589 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
590 #define __Pyx_truncl trunc
591 #else
592 #define __Pyx_truncl truncl
593 #endif
594 
595 
596 #define __PYX_ERR(f_index, lineno, Ln_error) \
597 { \
598   __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
599 }
600 
601 #ifndef __PYX_EXTERN_C
602   #ifdef __cplusplus
603     #define __PYX_EXTERN_C extern "C"
604   #else
605     #define __PYX_EXTERN_C extern
606   #endif
607 #endif
608 
609 #define __PYX_HAVE__yt__utilities__lib__amr_kdtools
610 #define __PYX_HAVE_API__yt__utilities__lib__amr_kdtools
611 /* Early includes */
612 #include <string.h>
613 #include <stdio.h>
614 #include "numpy/arrayobject.h"
615 #include "numpy/ufuncobject.h"
616 #include <stdlib.h>
617 #include "pythread.h"
618 #include "pystate.h"
619 #ifdef _OPENMP
620 #include <omp.h>
621 #endif /* _OPENMP */
622 
623 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
624 #define CYTHON_WITHOUT_ASSERTIONS
625 #endif
626 
627 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
628                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
629 
630 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
631 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
632 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
633 #define __PYX_DEFAULT_STRING_ENCODING ""
634 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
635 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
636 #define __Pyx_uchar_cast(c) ((unsigned char)c)
637 #define __Pyx_long_cast(x) ((long)x)
638 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
639     (sizeof(type) < sizeof(Py_ssize_t))  ||\
640     (sizeof(type) > sizeof(Py_ssize_t) &&\
641           likely(v < (type)PY_SSIZE_T_MAX ||\
642                  v == (type)PY_SSIZE_T_MAX)  &&\
643           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
644                                 v == (type)PY_SSIZE_T_MIN)))  ||\
645     (sizeof(type) == sizeof(Py_ssize_t) &&\
646           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
647                                v == (type)PY_SSIZE_T_MAX)))  )
648 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
649     return (size_t) i < (size_t) limit;
650 }
651 #if defined (__cplusplus) && __cplusplus >= 201103L
652     #include <cstdlib>
653     #define __Pyx_sst_abs(value) std::abs(value)
654 #elif SIZEOF_INT >= SIZEOF_SIZE_T
655     #define __Pyx_sst_abs(value) abs(value)
656 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
657     #define __Pyx_sst_abs(value) labs(value)
658 #elif defined (_MSC_VER)
659     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
660 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
661     #define __Pyx_sst_abs(value) llabs(value)
662 #elif defined (__GNUC__)
663     #define __Pyx_sst_abs(value) __builtin_llabs(value)
664 #else
665     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
666 #endif
667 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
668 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
669 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
670 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
671 #define __Pyx_PyBytes_FromString        PyBytes_FromString
672 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
673 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
674 #if PY_MAJOR_VERSION < 3
675     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
676     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
677 #else
678     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
679     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
680 #endif
681 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
682 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
683 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
684 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
685 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
686 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
687 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
688 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
689 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
690 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
691 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
692 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
693 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
694 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
695 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
696 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
697 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
698     const Py_UNICODE *u_end = u;
699     while (*u_end++) ;
700     return (size_t)(u_end - u - 1);
701 }
702 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
703 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
704 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
705 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
706 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
707 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
708 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
709 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
710 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
711 #define __Pyx_PySequence_Tuple(obj)\
712     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
713 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
714 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
715 #if CYTHON_ASSUME_SAFE_MACROS
716 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
717 #else
718 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
719 #endif
720 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
721 #if PY_MAJOR_VERSION >= 3
722 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
723 #else
724 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
725 #endif
726 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
727 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
728 static int __Pyx_sys_getdefaultencoding_not_ascii;
729 static int __Pyx_init_sys_getdefaultencoding_params(void) {
730     PyObject* sys;
731     PyObject* default_encoding = NULL;
732     PyObject* ascii_chars_u = NULL;
733     PyObject* ascii_chars_b = NULL;
734     const char* default_encoding_c;
735     sys = PyImport_ImportModule("sys");
736     if (!sys) goto bad;
737     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
738     Py_DECREF(sys);
739     if (!default_encoding) goto bad;
740     default_encoding_c = PyBytes_AsString(default_encoding);
741     if (!default_encoding_c) goto bad;
742     if (strcmp(default_encoding_c, "ascii") == 0) {
743         __Pyx_sys_getdefaultencoding_not_ascii = 0;
744     } else {
745         char ascii_chars[128];
746         int c;
747         for (c = 0; c < 128; c++) {
748             ascii_chars[c] = c;
749         }
750         __Pyx_sys_getdefaultencoding_not_ascii = 1;
751         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
752         if (!ascii_chars_u) goto bad;
753         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
754         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
755             PyErr_Format(
756                 PyExc_ValueError,
757                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
758                 default_encoding_c);
759             goto bad;
760         }
761         Py_DECREF(ascii_chars_u);
762         Py_DECREF(ascii_chars_b);
763     }
764     Py_DECREF(default_encoding);
765     return 0;
766 bad:
767     Py_XDECREF(default_encoding);
768     Py_XDECREF(ascii_chars_u);
769     Py_XDECREF(ascii_chars_b);
770     return -1;
771 }
772 #endif
773 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
774 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
775 #else
776 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
777 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
778 static char* __PYX_DEFAULT_STRING_ENCODING;
779 static int __Pyx_init_sys_getdefaultencoding_params(void) {
780     PyObject* sys;
781     PyObject* default_encoding = NULL;
782     char* default_encoding_c;
783     sys = PyImport_ImportModule("sys");
784     if (!sys) goto bad;
785     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
786     Py_DECREF(sys);
787     if (!default_encoding) goto bad;
788     default_encoding_c = PyBytes_AsString(default_encoding);
789     if (!default_encoding_c) goto bad;
790     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
791     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
792     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
793     Py_DECREF(default_encoding);
794     return 0;
795 bad:
796     Py_XDECREF(default_encoding);
797     return -1;
798 }
799 #endif
800 #endif
801 
802 
803 /* Test for GCC > 2.95 */
804 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
805   #define likely(x)   __builtin_expect(!!(x), 1)
806   #define unlikely(x) __builtin_expect(!!(x), 0)
807 #else /* !__GNUC__ or GCC < 2.95 */
808   #define likely(x)   (x)
809   #define unlikely(x) (x)
gdb_main(struct captured_main_args * args)810 #endif /* __GNUC__ */
811 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
812 
813 static PyObject *__pyx_m = NULL;
814 static PyObject *__pyx_d;
815 static PyObject *__pyx_b;
816 static PyObject *__pyx_cython_runtime = NULL;
817 static PyObject *__pyx_empty_tuple;
818 static PyObject *__pyx_empty_bytes;
819 static PyObject *__pyx_empty_unicode;
820 static int __pyx_lineno;
821 static int __pyx_clineno = 0;
822 static const char * __pyx_cfilenm= __FILE__;
823 static const char *__pyx_filename;
824 
print_gdb_help(struct ui_file * stream)825 /* Header.proto */
826 #if !defined(CYTHON_CCOMPLEX)
827   #if defined(__cplusplus)
828     #define CYTHON_CCOMPLEX 1
829   #elif defined(_Complex_I)
830     #define CYTHON_CCOMPLEX 1
831   #else
832     #define CYTHON_CCOMPLEX 0
833   #endif
834 #endif
835 #if CYTHON_CCOMPLEX
836   #ifdef __cplusplus
837     #include <complex>
838   #else
839     #include <complex.h>
840   #endif
841 #endif
842 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
843   #undef _Complex_I
844   #define _Complex_I 1.0fj
845 #endif
846 
847 
848 static const char *__pyx_f[] = {
849   "yt/utilities/lib/amr_kdtools.pyx",
850   "stringsource",
851   "yt/utilities/lib/amr_kdtools.pxd",
852   "__init__.pxd",
853   "type.pxd",
854 };
855 /* MemviewSliceStruct.proto */
856 struct __pyx_memoryview_obj;
857 typedef struct {
858   struct __pyx_memoryview_obj *memview;
859   char *data;
860   Py_ssize_t shape[8];
861   Py_ssize_t strides[8];
862   Py_ssize_t suboffsets[8];
863 } __Pyx_memviewslice;
864 #define __Pyx_MemoryView_Len(m)  (m.shape[0])
865 
866 /* Atomics.proto */
867 #include <pythread.h>
868 #ifndef CYTHON_ATOMICS
869     #define CYTHON_ATOMICS 1
870 #endif
871 #define __pyx_atomic_int_type int
872 #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
873                     (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
874                     !defined(__i386__)
875     #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
876     #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
877     #ifdef __PYX_DEBUG_ATOMICS
878         #warning "Using GNU atomics"
879     #endif
880 #elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
881     #include <Windows.h>
882     #undef __pyx_atomic_int_type
883     #define __pyx_atomic_int_type LONG
884     #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
885     #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
886     #ifdef __PYX_DEBUG_ATOMICS
887         #pragma message ("Using MSVC atomics")
888     #endif
889 #elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
890     #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
891     #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
892     #ifdef __PYX_DEBUG_ATOMICS
893         #warning "Using Intel atomics"
894     #endif
895 #else
896     #undef CYTHON_ATOMICS
897     #define CYTHON_ATOMICS 0
898     #ifdef __PYX_DEBUG_ATOMICS
899         #warning "Not using atomics"
900     #endif
901 #endif
902 typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
903 #if CYTHON_ATOMICS
904     #define __pyx_add_acquisition_count(memview)\
905              __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
906     #define __pyx_sub_acquisition_count(memview)\
907             __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
908 #else
909     #define __pyx_add_acquisition_count(memview)\
910             __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
911     #define __pyx_sub_acquisition_count(memview)\
912             __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
913 #endif
914 
915 /* BufferFormatStructs.proto */
916 #define IS_UNSIGNED(type) (((type) -1) > 0)
917 struct __Pyx_StructField_;
918 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
919 typedef struct {
920   const char* name;
921   struct __Pyx_StructField_* fields;
922   size_t size;
923   size_t arraysize[8];
924   int ndim;
925   char typegroup;
926   char is_unsigned;
927   int flags;
928 } __Pyx_TypeInfo;
929 typedef struct __Pyx_StructField_ {
930   __Pyx_TypeInfo* type;
931   const char* name;
932   size_t offset;
933 } __Pyx_StructField;
934 typedef struct {
935   __Pyx_StructField* field;
936   size_t parent_offset;
937 } __Pyx_BufFmt_StackElem;
938 typedef struct {
939   __Pyx_StructField root;
940   __Pyx_BufFmt_StackElem* head;
941   size_t fmt_offset;
942   size_t new_count, enc_count;
943   size_t struct_alignment;
944   int is_complex;
945   char enc_type;
946   char new_packmode;
947   char enc_packmode;
948   char is_valid_array;
949 } __Pyx_BufFmt_Context;
950 
951 /* ForceInitThreads.proto */
952 #ifndef __PYX_FORCE_INIT_THREADS
953   #define __PYX_FORCE_INIT_THREADS 0
954 #endif
955 
956 /* NoFastGil.proto */
957 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
958 #define __Pyx_PyGILState_Release PyGILState_Release
959 #define __Pyx_FastGIL_Remember()
960 #define __Pyx_FastGIL_Forget()
961 #define __Pyx_FastGilFuncInit()
962 
963 
964 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":776
965  * # in Cython to enable them only on the right systems.
966  *
967  * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
968  * ctypedef npy_int16      int16_t
969  * ctypedef npy_int32      int32_t
970  */
971 typedef npy_int8 __pyx_t_5numpy_int8_t;
972 
973 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":777
974  *
975  * ctypedef npy_int8       int8_t
976  * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
977  * ctypedef npy_int32      int32_t
978  * ctypedef npy_int64      int64_t
979  */
980 typedef npy_int16 __pyx_t_5numpy_int16_t;
981 
982 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":778
983  * ctypedef npy_int8       int8_t
984  * ctypedef npy_int16      int16_t
985  * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
986  * ctypedef npy_int64      int64_t
987  * #ctypedef npy_int96      int96_t
988  */
989 typedef npy_int32 __pyx_t_5numpy_int32_t;
990 
991 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":779
992  * ctypedef npy_int16      int16_t
993  * ctypedef npy_int32      int32_t
994  * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
995  * #ctypedef npy_int96      int96_t
996  * #ctypedef npy_int128     int128_t
997  */
998 typedef npy_int64 __pyx_t_5numpy_int64_t;
999 
1000 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":783
1001  * #ctypedef npy_int128     int128_t
1002  *
1003  * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
1004  * ctypedef npy_uint16     uint16_t
1005  * ctypedef npy_uint32     uint32_t
1006  */
1007 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1008 
1009 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":784
1010  *
1011  * ctypedef npy_uint8      uint8_t
1012  * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
1013  * ctypedef npy_uint32     uint32_t
1014  * ctypedef npy_uint64     uint64_t
1015  */
1016 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1017 
1018 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":785
1019  * ctypedef npy_uint8      uint8_t
1020  * ctypedef npy_uint16     uint16_t
1021  * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
1022  * ctypedef npy_uint64     uint64_t
1023  * #ctypedef npy_uint96     uint96_t
1024  */
1025 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1026 
1027 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":786
1028  * ctypedef npy_uint16     uint16_t
1029  * ctypedef npy_uint32     uint32_t
1030  * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
1031  * #ctypedef npy_uint96     uint96_t
1032  * #ctypedef npy_uint128    uint128_t
1033  */
1034 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1035 
1036 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":790
1037  * #ctypedef npy_uint128    uint128_t
1038  *
1039  * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
1040  * ctypedef npy_float64    float64_t
1041  * #ctypedef npy_float80    float80_t
1042  */
1043 typedef npy_float32 __pyx_t_5numpy_float32_t;
1044 
1045 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":791
1046  *
1047  * ctypedef npy_float32    float32_t
1048  * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
1049  * #ctypedef npy_float80    float80_t
1050  * #ctypedef npy_float128   float128_t
1051  */
1052 typedef npy_float64 __pyx_t_5numpy_float64_t;
1053 
1054 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":800
1055  * # The int types are mapped a bit surprising --
1056  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1057  * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
1058  * ctypedef npy_longlong   long_t
1059  * ctypedef npy_longlong   longlong_t
1060  */
1061 typedef npy_long __pyx_t_5numpy_int_t;
1062 
1063 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":801
1064  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1065  * ctypedef npy_long       int_t
1066  * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
1067  * ctypedef npy_longlong   longlong_t
1068  *
1069  */
1070 typedef npy_longlong __pyx_t_5numpy_long_t;
1071 
1072 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":802
1073  * ctypedef npy_long       int_t
1074  * ctypedef npy_longlong   long_t
1075  * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
1076  *
1077  * ctypedef npy_ulong      uint_t
1078  */
1079 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1080 
1081 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":804
1082  * ctypedef npy_longlong   longlong_t
1083  *
1084  * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
1085  * ctypedef npy_ulonglong  ulong_t
1086  * ctypedef npy_ulonglong  ulonglong_t
1087  */
1088 typedef npy_ulong __pyx_t_5numpy_uint_t;
1089 
1090 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":805
1091  *
1092  * ctypedef npy_ulong      uint_t
1093  * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
1094  * ctypedef npy_ulonglong  ulonglong_t
1095  *
1096  */
1097 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1098 
1099 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":806
1100  * ctypedef npy_ulong      uint_t
1101  * ctypedef npy_ulonglong  ulong_t
1102  * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
1103  *
1104  * ctypedef npy_intp       intp_t
1105  */
1106 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1107 
1108 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":808
1109  * ctypedef npy_ulonglong  ulonglong_t
1110  *
1111  * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
1112  * ctypedef npy_uintp      uintp_t
1113  *
1114  */
1115 typedef npy_intp __pyx_t_5numpy_intp_t;
1116 
1117 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":809
1118  *
1119  * ctypedef npy_intp       intp_t
1120  * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
1121  *
1122  * ctypedef npy_double     float_t
1123  */
1124 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1125 
1126 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":811
1127  * ctypedef npy_uintp      uintp_t
1128  *
1129  * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
1130  * ctypedef npy_double     double_t
1131  * ctypedef npy_longdouble longdouble_t
1132  */
1133 typedef npy_double __pyx_t_5numpy_float_t;
1134 
1135 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":812
1136  *
1137  * ctypedef npy_double     float_t
1138  * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
1139  * ctypedef npy_longdouble longdouble_t
1140  *
1141  */
1142 typedef npy_double __pyx_t_5numpy_double_t;
1143 
1144 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":813
1145  * ctypedef npy_double     float_t
1146  * ctypedef npy_double     double_t
1147  * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
1148  *
1149  * ctypedef npy_cfloat      cfloat_t
1150  */
1151 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1152 /* Declarations.proto */
1153 #if CYTHON_CCOMPLEX
1154   #ifdef __cplusplus
1155     typedef ::std::complex< float > __pyx_t_float_complex;
1156   #else
1157     typedef float _Complex __pyx_t_float_complex;
1158   #endif
1159 #else
1160     typedef struct { float real, imag; } __pyx_t_float_complex;
1161 #endif
1162 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1163 
1164 /* Declarations.proto */
1165 #if CYTHON_CCOMPLEX
1166   #ifdef __cplusplus
1167     typedef ::std::complex< double > __pyx_t_double_complex;
1168   #else
1169     typedef double _Complex __pyx_t_double_complex;
1170   #endif
1171 #else
1172     typedef struct { double real, imag; } __pyx_t_double_complex;
1173 #endif
1174 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1175 
1176 
1177 /*--- Type declarations ---*/
1178 struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node;
1179 struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse;
1180 struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse;
1181 struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch;
1182 struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse;
1183 struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse;
1184 struct __pyx_array_obj;
1185 struct __pyx_MemviewEnum_obj;
1186 struct __pyx_memoryview_obj;
1187 struct __pyx_memoryviewslice_obj;
1188 
1189 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":815
1190  * ctypedef npy_longdouble longdouble_t
1191  *
1192  * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
1193  * ctypedef npy_cdouble     cdouble_t
1194  * ctypedef npy_clongdouble clongdouble_t
1195  */
1196 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1197 
1198 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":816
1199  *
1200  * ctypedef npy_cfloat      cfloat_t
1201  * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
1202  * ctypedef npy_clongdouble clongdouble_t
1203  *
1204  */
1205 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1206 
1207 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":817
1208  * ctypedef npy_cfloat      cfloat_t
1209  * ctypedef npy_cdouble     cdouble_t
1210  * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
1211  *
1212  * ctypedef npy_cdouble     complex_t
1213  */
1214 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1215 
1216 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":819
1217  * ctypedef npy_clongdouble clongdouble_t
1218  *
1219  * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
1220  *
1221  * cdef inline object PyArray_MultiIterNew1(a):
1222  */
1223 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1224 struct __pyx_t_2yt_9utilities_3lib_11amr_kdtools_Split;
1225 
1226 /* "yt/utilities/lib/amr_kdtools.pxd":12
1227  *
1228  *
1229  * cdef struct Split:             # <<<<<<<<<<<<<<
1230  *     int dim
1231  *     np.float64_t pos
1232  */
1233 struct __pyx_t_2yt_9utilities_3lib_11amr_kdtools_Split {
1234   int dim;
1235   __pyx_t_5numpy_float64_t pos;
1236 };
1237 
1238 /* "yt/utilities/lib/amr_kdtools.pxd":16
1239  *     np.float64_t pos
1240  *
1241  * cdef class Node:             # <<<<<<<<<<<<<<
1242  *     cdef public Node left
1243  *     cdef public Node right
1244  */
1245 struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node {
1246   PyObject_HEAD
1247   struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_vtab;
1248   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *left;
1249   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *right;
1250   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *parent;
1251   int grid;
1252   int dirty;
1253   __pyx_t_5numpy_int64_t node_id;
1254   __pyx_t_5numpy_int64_t node_ind;
1255   __pyx_t_5numpy_float64_t left_edge[3];
1256   __pyx_t_5numpy_float64_t right_edge[3];
1257   PyObject *data;
1258   struct __pyx_t_2yt_9utilities_3lib_11amr_kdtools_Split *split;
1259   int level;
1260 };
1261 
1262 
1263 /* "yt/utilities/lib/amr_kdtools.pyx":104
1264  *             node.dirty = state
1265  *
1266  *     def kd_traverse(self, viewpoint=None):             # <<<<<<<<<<<<<<
1267  *         cdef Node node
1268  *         if viewpoint is None:
1269  */
1270 struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse {
1271   PyObject_HEAD
1272   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_node;
1273   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self;
1274   PyObject *__pyx_v_viewpoint;
1275   PyObject *__pyx_t_0;
1276   Py_ssize_t __pyx_t_1;
1277   PyObject *(*__pyx_t_2)(PyObject *);
1278 };
1279 
1280 
1281 /* "yt/utilities/lib/amr_kdtools.pyx":567
1282  *         return 0
1283  *
1284  *     def depth_traverse(self, max_node=None):             # <<<<<<<<<<<<<<
1285  *         '''
1286  *         Yields a depth-first traversal of the kd tree always going to
1287  */
1288 struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse {
1289   PyObject_HEAD
1290   PyObject *__pyx_v_current;
1291   PyObject *__pyx_v_max_node;
1292   PyObject *__pyx_v_previous;
1293   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self;
1294 };
1295 
1296 
1297 /* "yt/utilities/lib/amr_kdtools.pyx":584
1298  *                 previous = current.right
1299  *
1300  *     def depth_first_touch(self, max_node=None):             # <<<<<<<<<<<<<<
1301  *         '''
1302  *         Yields a depth-first traversal of the kd tree always going to
1303  */
1304 struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch {
1305   PyObject_HEAD
1306   PyObject *__pyx_v_current;
1307   PyObject *__pyx_v_max_node;
1308   PyObject *__pyx_v_previous;
1309   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self;
1310 };
1311 
1312 
1313 /* "yt/utilities/lib/amr_kdtools.pyx":602
1314  *                 previous = current.right
1315  *
1316  *     def breadth_traverse(self):             # <<<<<<<<<<<<<<
1317  *         '''
1318  *         Yields a breadth-first traversal of the kd tree always going to
1319  */
1320 struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse {
1321   PyObject_HEAD
1322   PyObject *__pyx_v_current;
1323   PyObject *__pyx_v_previous;
1324   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self;
1325 };
1326 
1327 
1328 /* "yt/utilities/lib/amr_kdtools.pyx":614
1329  *
1330  *
1331  *     def viewpoint_traverse(self, viewpoint):             # <<<<<<<<<<<<<<
1332  *         '''
1333  *         Yields a viewpoint dependent traversal of the kd-tree.  Starts
1334  */
1335 struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse {
1336   PyObject_HEAD
1337   PyObject *__pyx_v_current;
1338   PyObject *__pyx_v_previous;
1339   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self;
1340   PyObject *__pyx_v_viewpoint;
1341 };
1342 
1343 
1344 /* "View.MemoryView":105
1345  *
1346  * @cname("__pyx_array")
1347  * cdef class array:             # <<<<<<<<<<<<<<
1348  *
1349  *     cdef:
1350  */
1351 struct __pyx_array_obj {
1352   PyObject_HEAD
1353   struct __pyx_vtabstruct_array *__pyx_vtab;
1354   char *data;
1355   Py_ssize_t len;
1356   char *format;
1357   int ndim;
1358   Py_ssize_t *_shape;
1359   Py_ssize_t *_strides;
1360   Py_ssize_t itemsize;
1361   PyObject *mode;
1362   PyObject *_format;
1363   void (*callback_free_data)(void *);
1364   int free_data;
1365   int dtype_is_object;
1366 };
1367 
1368 
1369 /* "View.MemoryView":279
1370  *
1371  * @cname('__pyx_MemviewEnum')
1372  * cdef class Enum(object):             # <<<<<<<<<<<<<<
1373  *     cdef object name
1374  *     def __init__(self, name):
1375  */
1376 struct __pyx_MemviewEnum_obj {
1377   PyObject_HEAD
1378   PyObject *name;
1379 };
1380 
1381 
1382 /* "View.MemoryView":330
1383  *
1384  * @cname('__pyx_memoryview')
1385  * cdef class memoryview(object):             # <<<<<<<<<<<<<<
1386  *
1387  *     cdef object obj
1388  */
1389 struct __pyx_memoryview_obj {
1390   PyObject_HEAD
1391   struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1392   PyObject *obj;
1393   PyObject *_size;
1394   PyObject *_array_interface;
1395   PyThread_type_lock lock;
1396   __pyx_atomic_int acquisition_count[2];
1397   __pyx_atomic_int *acquisition_count_aligned_p;
1398   Py_buffer view;
1399   int flags;
1400   int dtype_is_object;
1401   __Pyx_TypeInfo *typeinfo;
1402 };
1403 
1404 
1405 /* "View.MemoryView":961
1406  *
1407  * @cname('__pyx_memoryviewslice')
1408  * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
1409  *     "Internal class for passing memoryview slices to Python"
1410  *
1411  */
1412 struct __pyx_memoryviewslice_obj {
1413   struct __pyx_memoryview_obj __pyx_base;
1414   __Pyx_memviewslice from_slice;
1415   PyObject *from_object;
1416   PyObject *(*to_object_func)(char *);
1417   int (*to_dtype_func)(char *, PyObject *);
1418 };
1419 
1420 
1421 
1422 /* "View.MemoryView":105
1423  *
1424  * @cname("__pyx_array")
1425  * cdef class array:             # <<<<<<<<<<<<<<
1426  *
1427  *     cdef:
1428  */
1429 
1430 struct __pyx_vtabstruct_array {
1431   PyObject *(*get_memview)(struct __pyx_array_obj *);
1432 };
1433 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1434 
1435 
1436 /* "yt/utilities/lib/amr_kdtools.pyx":23
1437  * @cython.wraparound(False)
1438  * @cython.cdivision(True)
1439  * cdef class Node:             # <<<<<<<<<<<<<<
1440  *
1441  *     def __cinit__(self,
1442  */
1443 
1444 struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node {
1445   int (*point_in_node)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, __Pyx_memviewslice);
1446   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *(*_find_node)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, __Pyx_memviewslice);
1447   int (*_kd_is_leaf)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *);
1448   PyObject *(*add_grid)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, __Pyx_memviewslice, __Pyx_memviewslice, int, int, int);
1449   PyObject *(*insert_grid)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, __Pyx_memviewslice, __Pyx_memviewslice, int, int, int);
1450   PyObject *(*add_grids)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, int, int __pyx_skip_dispatch);
1451   int (*should_i_split)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, int, int);
1452   void (*insert_grids)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, int);
1453   PyObject *(*split_grid)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, __Pyx_memviewslice, __Pyx_memviewslice, int, int, int);
1454   int (*split_grids)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, int);
1455   PyObject *(*geo_split)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, __Pyx_memviewslice, __Pyx_memviewslice, int, int, int);
1456   void (*divide)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, struct __pyx_t_2yt_9utilities_3lib_11amr_kdtools_Split *);
1457 };
1458 static struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_vtabptr_2yt_9utilities_3lib_11amr_kdtools_Node;
1459 
1460 
1461 /* "View.MemoryView":330
1462  *
1463  * @cname('__pyx_memoryview')
1464  * cdef class memoryview(object):             # <<<<<<<<<<<<<<
1465  *
1466  *     cdef object obj
1467  */
1468 
1469 struct __pyx_vtabstruct_memoryview {
1470   char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
1471   PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
1472   PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1473   PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
1474   PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1475   PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
1476   PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
1477 };
1478 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1479 
1480 
1481 /* "View.MemoryView":961
1482  *
1483  * @cname('__pyx_memoryviewslice')
1484  * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
1485  *     "Internal class for passing memoryview slices to Python"
1486  *
1487  */
1488 
1489 struct __pyx_vtabstruct__memoryviewslice {
1490   struct __pyx_vtabstruct_memoryview __pyx_base;
1491 };
1492 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1493 
1494 /* --- Runtime support code (head) --- */
1495 /* Refnanny.proto */
1496 #ifndef CYTHON_REFNANNY
1497   #define CYTHON_REFNANNY 0
1498 #endif
1499 #if CYTHON_REFNANNY
1500   typedef struct {
1501     void (*INCREF)(void*, PyObject*, int);
1502     void (*DECREF)(void*, PyObject*, int);
1503     void (*GOTREF)(void*, PyObject*, int);
1504     void (*GIVEREF)(void*, PyObject*, int);
1505     void* (*SetupContext)(const char*, int, const char*);
1506     void (*FinishContext)(void**);
1507   } __Pyx_RefNannyAPIStruct;
1508   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1509   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1510   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1511 #ifdef WITH_THREAD
1512   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1513           if (acquire_gil) {\
1514               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1515               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1516               PyGILState_Release(__pyx_gilstate_save);\
1517           } else {\
1518               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1519           }
1520 #else
1521   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1522           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1523 #endif
1524   #define __Pyx_RefNannyFinishContext()\
1525           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1526   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1527   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1528   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1529   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1530   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1531   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1532   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1533   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1534 #else
1535   #define __Pyx_RefNannyDeclarations
1536   #define __Pyx_RefNannySetupContext(name, acquire_gil)
1537   #define __Pyx_RefNannyFinishContext()
1538   #define __Pyx_INCREF(r) Py_INCREF(r)
1539   #define __Pyx_DECREF(r) Py_DECREF(r)
1540   #define __Pyx_GOTREF(r)
1541   #define __Pyx_GIVEREF(r)
1542   #define __Pyx_XINCREF(r) Py_XINCREF(r)
1543   #define __Pyx_XDECREF(r) Py_XDECREF(r)
1544   #define __Pyx_XGOTREF(r)
1545   #define __Pyx_XGIVEREF(r)
1546 #endif
1547 #define __Pyx_XDECREF_SET(r, v) do {\
1548         PyObject *tmp = (PyObject *) r;\
1549         r = v; __Pyx_XDECREF(tmp);\
1550     } while (0)
1551 #define __Pyx_DECREF_SET(r, v) do {\
1552         PyObject *tmp = (PyObject *) r;\
1553         r = v; __Pyx_DECREF(tmp);\
1554     } while (0)
1555 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1556 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1557 
1558 /* PyObjectGetAttrStr.proto */
1559 #if CYTHON_USE_TYPE_SLOTS
1560 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1561 #else
1562 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1563 #endif
1564 
1565 /* GetBuiltinName.proto */
1566 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1567 
1568 /* RaiseArgTupleInvalid.proto */
1569 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1570     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1571 
1572 /* RaiseDoubleKeywords.proto */
1573 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1574 
1575 /* ParseKeywords.proto */
1576 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1577     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1578     const char* function_name);
1579 
1580 /* ArgTypeTest.proto */
1581 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1582     ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1583         __Pyx__ArgTypeTest(obj, type, name, exact))
1584 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1585 
1586 /* MemviewSliceInit.proto */
1587 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
1588 #define __Pyx_MEMVIEW_DIRECT   1
1589 #define __Pyx_MEMVIEW_PTR      2
1590 #define __Pyx_MEMVIEW_FULL     4
1591 #define __Pyx_MEMVIEW_CONTIG   8
1592 #define __Pyx_MEMVIEW_STRIDED  16
1593 #define __Pyx_MEMVIEW_FOLLOW   32
1594 #define __Pyx_IS_C_CONTIG 1
1595 #define __Pyx_IS_F_CONTIG 2
1596 static int __Pyx_init_memviewslice(
1597                 struct __pyx_memoryview_obj *memview,
1598                 int ndim,
1599                 __Pyx_memviewslice *memviewslice,
1600                 int memview_is_new_reference);
1601 static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
1602     __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1603 static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
1604     __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1605 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
1606 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
1607 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
1608 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
1609 static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
1610 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
1611 
1612 /* PyDictVersioning.proto */
1613 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1614 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1615 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1616 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1617     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1618     (cache_var) = (value);
1619 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1620     static PY_UINT64_T __pyx_dict_version = 0;\
1621     static PyObject *__pyx_dict_cached_value = NULL;\
1622     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1623         (VAR) = __pyx_dict_cached_value;\
1624     } else {\
1625         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1626         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1627     }\
1628 }
1629 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1630 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1631 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1632 #else
1633 #define __PYX_GET_DICT_VERSION(dict)  (0)
1634 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1635 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1636 #endif
1637 
1638 /* GetModuleGlobalName.proto */
1639 #if CYTHON_USE_DICT_VERSIONS
1640 #define __Pyx_GetModuleGlobalName(var, name)  {\
1641     static PY_UINT64_T __pyx_dict_version = 0;\
1642     static PyObject *__pyx_dict_cached_value = NULL;\
1643     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1644         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1645         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1646 }
1647 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1648     PY_UINT64_T __pyx_dict_version;\
1649     PyObject *__pyx_dict_cached_value;\
1650     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1651 }
1652 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1653 #else
1654 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1655 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1656 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1657 #endif
1658 
1659 /* PyObjectCall.proto */
1660 #if CYTHON_COMPILING_IN_CPYTHON
1661 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1662 #else
1663 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1664 #endif
1665 
1666 /* SetItemInt.proto */
1667 #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1668     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1669     __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
1670     (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
1671                __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
1672 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
1673 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
1674                                                int is_list, int wraparound, int boundscheck);
1675 
1676 /* PyFunctionFastCall.proto */
1677 #if CYTHON_FAST_PYCALL
1678 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1679     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1680 #if 1 || PY_VERSION_HEX < 0x030600B1
1681 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1682 #else
1683 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1684 #endif
1685 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1686     (sizeof(char [1 - 2*!(cond)]) - 1)
1687 #ifndef Py_MEMBER_SIZE
1688 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1689 #endif
1690   static size_t __pyx_pyframe_localsplus_offset = 0;
1691   #include "frameobject.h"
1692   #define __Pxy_PyFrame_Initialize_Offsets()\
1693     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1694      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1695   #define __Pyx_PyFrame_GetLocalsplus(frame)\
1696     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1697 #endif
1698 
1699 /* PyObjectCallMethO.proto */
1700 #if CYTHON_COMPILING_IN_CPYTHON
1701 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1702 #endif
1703 
1704 /* PyObjectCallNoArg.proto */
1705 #if CYTHON_COMPILING_IN_CPYTHON
1706 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1707 #else
1708 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1709 #endif
1710 
1711 /* PyCFunctionFastCall.proto */
1712 #if CYTHON_FAST_PYCCALL
1713 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1714 #else
1715 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1716 #endif
1717 
1718 /* PyObjectCallOneArg.proto */
1719 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1720 
1721 /* ExtTypeTest.proto */
1722 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1723 
1724 /* PyObjectCall2Args.proto */
1725 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1726 
1727 /* None.proto */
1728 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
1729 
1730 /* GetItemInt.proto */
1731 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1732     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1733     __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1734     (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1735                __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1736 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1737     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1738     __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1739     (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1740 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1741                                                               int wraparound, int boundscheck);
1742 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1743     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1744     __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1745     (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1746 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1747                                                               int wraparound, int boundscheck);
1748 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1749 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1750                                                      int is_list, int wraparound, int boundscheck);
1751 
1752 /* PyThreadStateGet.proto */
1753 #if CYTHON_FAST_THREAD_STATE
1754 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
1755 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
1756 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
1757 #else
1758 #define __Pyx_PyThreadState_declare
1759 #define __Pyx_PyThreadState_assign
1760 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
1761 #endif
1762 
1763 /* PyErrFetchRestore.proto */
1764 #if CYTHON_FAST_THREAD_STATE
1765 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1766 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1767 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1768 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1769 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1770 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1771 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1772 #if CYTHON_COMPILING_IN_CPYTHON
1773 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1774 #else
1775 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1776 #endif
1777 #else
1778 #define __Pyx_PyErr_Clear() PyErr_Clear()
1779 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1780 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
1781 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
1782 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
1783 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
1784 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
1785 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
1786 #endif
1787 
1788 /* WriteUnraisableException.proto */
1789 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1790                                   int lineno, const char *filename,
1791                                   int full_traceback, int nogil);
1792 
1793 /* RaiseTooManyValuesToUnpack.proto */
1794 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1795 
1796 /* RaiseNeedMoreValuesToUnpack.proto */
1797 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1798 
1799 /* IterFinish.proto */
1800 static CYTHON_INLINE int __Pyx_IterFinish(void);
1801 
1802 /* UnpackItemEndCheck.proto */
1803 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1804 
1805 /* PyIntCompare.proto */
1806 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
1807 
1808 /* PyIntBinop.proto */
1809 #if !CYTHON_COMPILING_IN_PYPY
1810 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1811 #else
1812 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1813     (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1814 #endif
1815 
1816 /* RaiseException.proto */
1817 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1818 
1819 /* IsLittleEndian.proto */
1820 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
1821 
1822 /* BufferFormatCheck.proto */
1823 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
1824 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
1825                               __Pyx_BufFmt_StackElem* stack,
1826                               __Pyx_TypeInfo* type);
1827 
1828 /* BufferGetAndValidate.proto */
1829 #define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
1830     ((obj == Py_None || obj == NULL) ?\
1831     (__Pyx_ZeroBuffer(buf), 0) :\
1832     __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
1833 static int  __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
1834     __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
1835 static void __Pyx_ZeroBuffer(Py_buffer* buf);
1836 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
1837 static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
1838 static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
1839 
1840 #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
1841 /* DictGetItem.proto */
1842 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1843 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1844 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1845     (likely(PyDict_CheckExact(obj)) ?\
1846      __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1847 #else
1848 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1849 #define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
1850 #endif
1851 
1852 /* RaiseNoneIterError.proto */
1853 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1854 
1855 /* GetTopmostException.proto */
1856 #if CYTHON_USE_EXC_INFO_STACK
1857 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1858 #endif
1859 
1860 /* SaveResetException.proto */
1861 #if CYTHON_FAST_THREAD_STATE
1862 #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1863 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1864 #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1865 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1866 #else
1867 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1868 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1869 #endif
1870 
1871 /* PyErrExceptionMatches.proto */
1872 #if CYTHON_FAST_THREAD_STATE
1873 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1874 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1875 #else
1876 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1877 #endif
1878 
1879 /* GetException.proto */
1880 #if CYTHON_FAST_THREAD_STATE
1881 #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
1882 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1883 #else
1884 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1885 #endif
1886 
1887 /* IncludeStringH.proto */
1888 #include <string.h>
1889 
1890 /* BytesEquals.proto */
1891 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1892 
1893 /* UnicodeEquals.proto */
1894 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1895 
1896 /* StrEquals.proto */
1897 #if PY_MAJOR_VERSION >= 3
1898 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1899 #else
1900 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1901 #endif
1902 
1903 /* None.proto */
1904 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
1905 
1906 /* UnaryNegOverflows.proto */
1907 #define UNARY_NEG_WOULD_OVERFLOW(x)\
1908         (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1909 
1910 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1911 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
1912 /* GetAttr.proto */
1913 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1914 
1915 /* ObjectGetItem.proto */
1916 #if CYTHON_USE_TYPE_SLOTS
1917 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1918 #else
1919 #define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
1920 #endif
1921 
1922 /* decode_c_string_utf16.proto */
1923 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
1924     int byteorder = 0;
1925     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1926 }
1927 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
1928     int byteorder = -1;
1929     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1930 }
1931 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
1932     int byteorder = 1;
1933     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1934 }
1935 
1936 /* decode_c_string.proto */
1937 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
1938          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
1939          const char* encoding, const char* errors,
1940          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
1941 
1942 /* GetAttr3.proto */
1943 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1944 
1945 /* SwapException.proto */
1946 #if CYTHON_FAST_THREAD_STATE
1947 #define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1948 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1949 #else
1950 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1951 #endif
1952 
1953 /* Import.proto */
1954 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1955 
1956 /* FastTypeChecks.proto */
1957 #if CYTHON_COMPILING_IN_CPYTHON
1958 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1959 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1960 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1961 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1962 #else
1963 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1964 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1965 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1966 #endif
1967 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1968 
1969 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1970 /* ListCompAppend.proto */
1971 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1972 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1973     PyListObject* L = (PyListObject*) list;
1974     Py_ssize_t len = Py_SIZE(list);
1975     if (likely(L->allocated > len)) {
1976         Py_INCREF(x);
1977         PyList_SET_ITEM(list, len, x);
1978         Py_SIZE(list) = len+1;
1979         return 0;
1980     }
1981     return PyList_Append(list, x);
1982 }
1983 #else
1984 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1985 #endif
1986 
1987 /* ListExtend.proto */
1988 static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
1989 #if CYTHON_COMPILING_IN_CPYTHON
1990     PyObject* none = _PyList_Extend((PyListObject*)L, v);
1991     if (unlikely(!none))
1992         return -1;
1993     Py_DECREF(none);
1994     return 0;
1995 #else
1996     return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
1997 #endif
1998 }
1999 
2000 /* ListAppend.proto */
2001 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
2002 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
2003     PyListObject* L = (PyListObject*) list;
2004     Py_ssize_t len = Py_SIZE(list);
2005     if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
2006         Py_INCREF(x);
2007         PyList_SET_ITEM(list, len, x);
2008         Py_SIZE(list) = len+1;
2009         return 0;
2010     }
2011     return PyList_Append(list, x);
2012 }
2013 #else
2014 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
2015 #endif
2016 
2017 /* None.proto */
2018 static CYTHON_INLINE long __Pyx_div_long(long, long);
2019 
2020 /* ImportFrom.proto */
2021 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
2022 
2023 /* HasAttr.proto */
2024 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
2025 
2026 /* StringJoin.proto */
2027 #if PY_MAJOR_VERSION < 3
2028 #define __Pyx_PyString_Join __Pyx_PyBytes_Join
2029 #define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
2030 #else
2031 #define __Pyx_PyString_Join PyUnicode_Join
2032 #define __Pyx_PyBaseString_Join PyUnicode_Join
2033 #endif
2034 #if CYTHON_COMPILING_IN_CPYTHON
2035     #if PY_MAJOR_VERSION < 3
2036     #define __Pyx_PyBytes_Join _PyString_Join
2037     #else
2038     #define __Pyx_PyBytes_Join _PyBytes_Join
2039     #endif
2040 #else
2041 static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);
2042 #endif
2043 
2044 /* PyObject_Unicode.proto */
2045 #if PY_MAJOR_VERSION >= 3
2046 #define __Pyx_PyObject_Unicode(obj)\
2047     (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj))
2048 #else
2049 #define __Pyx_PyObject_Unicode(obj)\
2050     (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Unicode(obj))
2051 #endif
2052 
2053 /* PyObject_GenericGetAttrNoDict.proto */
2054 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2055 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
2056 #else
2057 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
2058 #endif
2059 
2060 /* PyObject_GenericGetAttr.proto */
2061 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2062 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
2063 #else
2064 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
2065 #endif
2066 
2067 /* SetVTable.proto */
2068 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
2069 
2070 /* SetupReduce.proto */
2071 static int __Pyx_setup_reduce(PyObject* type_obj);
2072 
2073 /* TypeImport.proto */
2074 #ifndef __PYX_HAVE_RT_ImportType_proto
2075 #define __PYX_HAVE_RT_ImportType_proto
2076 enum __Pyx_ImportType_CheckSize {
2077    __Pyx_ImportType_CheckSize_Error = 0,
2078    __Pyx_ImportType_CheckSize_Warn = 1,
2079    __Pyx_ImportType_CheckSize_Ignore = 2
2080 };
2081 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
2082 #endif
2083 
2084 /* CLineInTraceback.proto */
2085 #ifdef CYTHON_CLINE_IN_TRACEBACK
2086 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
2087 #else
2088 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
2089 #endif
2090 
2091 /* CodeObjectCache.proto */
2092 typedef struct {
2093     PyCodeObject* code_object;
2094     int code_line;
2095 } __Pyx_CodeObjectCacheEntry;
2096 struct __Pyx_CodeObjectCache {
2097     int count;
2098     int max_count;
2099     __Pyx_CodeObjectCacheEntry* entries;
2100 };
2101 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
2102 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
2103 static PyCodeObject *__pyx_find_code_object(int code_line);
2104 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
2105 
2106 /* AddTraceback.proto */
2107 static void __Pyx_AddTraceback(const char *funcname, int c_line,
2108                                int py_line, const char *filename);
2109 
2110 #if PY_MAJOR_VERSION < 3
2111     static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
2112     static void __Pyx_ReleaseBuffer(Py_buffer *view);
2113 #else
2114     #define __Pyx_GetBuffer PyObject_GetBuffer
2115     #define __Pyx_ReleaseBuffer PyBuffer_Release
2116 #endif
2117 
2118 
2119 /* BufferStructDeclare.proto */
2120 typedef struct {
2121   Py_ssize_t shape, strides, suboffsets;
2122 } __Pyx_Buf_DimInfo;
2123 typedef struct {
2124   size_t refcount;
2125   Py_buffer pybuffer;
2126 } __Pyx_Buffer;
2127 typedef struct {
2128   __Pyx_Buffer *rcbuffer;
2129   char *data;
2130   __Pyx_Buf_DimInfo diminfo[8];
2131 } __Pyx_LocalBuf_ND;
2132 
2133 /* MemviewSliceIsContig.proto */
2134 static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);
2135 
2136 /* OverlappingSlices.proto */
2137 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
2138                                 __Pyx_memviewslice *slice2,
2139                                 int ndim, size_t itemsize);
2140 
2141 /* Capsule.proto */
2142 static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
2143 
2144 /* TypeInfoCompare.proto */
2145 static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
2146 
2147 /* MemviewSliceValidateAndInit.proto */
2148 static int __Pyx_ValidateAndInit_memviewslice(
2149                 int *axes_specs,
2150                 int c_or_f_flag,
2151                 int buf_flags,
2152                 int ndim,
2153                 __Pyx_TypeInfo *dtype,
2154                 __Pyx_BufFmt_StackElem stack[],
2155                 __Pyx_memviewslice *memviewslice,
2156                 PyObject *original_obj);
2157 
2158 /* ObjectToMemviewSlice.proto */
2159 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(PyObject *, int writable_flag);
2160 
2161 /* ObjectToMemviewSlice.proto */
2162 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(PyObject *, int writable_flag);
2163 
2164 /* ObjectToMemviewSlice.proto */
2165 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int64_t(PyObject *, int writable_flag);
2166 
2167 /* CIntToPy.proto */
2168 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int64(npy_int64 value);
2169 
2170 /* Print.proto */
2171 static int __Pyx_Print(PyObject*, PyObject *, int);
2172 #if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3
2173 static PyObject* __pyx_print = 0;
2174 static PyObject* __pyx_print_kwargs = 0;
2175 #endif
2176 
2177 /* CIntToPy.proto */
2178 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
2179 
2180 /* CIntToPy.proto */
2181 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
2182 
2183 /* MemviewDtypeToObject.proto */
2184 static CYTHON_INLINE PyObject *__pyx_memview_get_nn___pyx_t_5numpy_float64_t(const char *itemp);
2185 static CYTHON_INLINE int __pyx_memview_set_nn___pyx_t_5numpy_float64_t(const char *itemp, PyObject *obj);
2186 
2187 /* MemviewDtypeToObject.proto */
2188 static CYTHON_INLINE PyObject *__pyx_memview_get_nn___pyx_t_5numpy_int64_t(const char *itemp);
2189 static CYTHON_INLINE int __pyx_memview_set_nn___pyx_t_5numpy_int64_t(const char *itemp, PyObject *obj);
2190 
2191 /* CIntToPy.proto */
2192 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ptrdiff_t(ptrdiff_t value);
2193 
2194 /* RealImag.proto */
2195 #if CYTHON_CCOMPLEX
2196   #ifdef __cplusplus
2197     #define __Pyx_CREAL(z) ((z).real())
2198     #define __Pyx_CIMAG(z) ((z).imag())
2199   #else
2200     #define __Pyx_CREAL(z) (__real__(z))
2201     #define __Pyx_CIMAG(z) (__imag__(z))
2202   #endif
2203 #else
2204     #define __Pyx_CREAL(z) ((z).real)
2205     #define __Pyx_CIMAG(z) ((z).imag)
2206 #endif
2207 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
2208         && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
2209     #define __Pyx_SET_CREAL(z,x) ((z).real(x))
2210     #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
2211 #else
2212     #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
2213     #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
2214 #endif
2215 
2216 /* Arithmetic.proto */
2217 #if CYTHON_CCOMPLEX
2218     #define __Pyx_c_eq_float(a, b)   ((a)==(b))
2219     #define __Pyx_c_sum_float(a, b)  ((a)+(b))
2220     #define __Pyx_c_diff_float(a, b) ((a)-(b))
2221     #define __Pyx_c_prod_float(a, b) ((a)*(b))
2222     #define __Pyx_c_quot_float(a, b) ((a)/(b))
2223     #define __Pyx_c_neg_float(a)     (-(a))
2224   #ifdef __cplusplus
2225     #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
2226     #define __Pyx_c_conj_float(z)    (::std::conj(z))
2227     #if 1
2228         #define __Pyx_c_abs_float(z)     (::std::abs(z))
2229         #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
2230     #endif
2231   #else
2232     #define __Pyx_c_is_zero_float(z) ((z)==0)
2233     #define __Pyx_c_conj_float(z)    (conjf(z))
2234     #if 1
2235         #define __Pyx_c_abs_float(z)     (cabsf(z))
2236         #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
2237     #endif
2238  #endif
2239 #else
2240     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
2241     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
2242     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
2243     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
2244     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
2245     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
2246     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
2247     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
2248     #if 1
2249         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
2250         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
2251     #endif
2252 #endif
2253 
2254 /* Arithmetic.proto */
2255 #if CYTHON_CCOMPLEX
2256     #define __Pyx_c_eq_double(a, b)   ((a)==(b))
2257     #define __Pyx_c_sum_double(a, b)  ((a)+(b))
2258     #define __Pyx_c_diff_double(a, b) ((a)-(b))
2259     #define __Pyx_c_prod_double(a, b) ((a)*(b))
2260     #define __Pyx_c_quot_double(a, b) ((a)/(b))
2261     #define __Pyx_c_neg_double(a)     (-(a))
2262   #ifdef __cplusplus
2263     #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
2264     #define __Pyx_c_conj_double(z)    (::std::conj(z))
2265     #if 1
2266         #define __Pyx_c_abs_double(z)     (::std::abs(z))
2267         #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
2268     #endif
2269   #else
2270     #define __Pyx_c_is_zero_double(z) ((z)==0)
2271     #define __Pyx_c_conj_double(z)    (conj(z))
2272     #if 1
2273         #define __Pyx_c_abs_double(z)     (cabs(z))
2274         #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
2275     #endif
2276  #endif
2277 #else
2278     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
2279     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
2280     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
2281     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
2282     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
2283     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
2284     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
2285     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
2286     #if 1
2287         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
2288         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
2289     #endif
2290 #endif
2291 
2292 /* CIntToPy.proto */
2293 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
2294 
2295 /* MemviewSliceCopyTemplate.proto */
2296 static __Pyx_memviewslice
2297 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
2298                                  const char *mode, int ndim,
2299                                  size_t sizeof_dtype, int contig_flag,
2300                                  int dtype_is_object);
2301 
2302 /* CIntFromPy.proto */
2303 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
2304 
2305 /* CIntFromPy.proto */
2306 static CYTHON_INLINE npy_int64 __Pyx_PyInt_As_npy_int64(PyObject *);
2307 
2308 /* TypeInfoToFormat.proto */
2309 struct __pyx_typeinfo_string {
2310     char string[3];
2311 };
2312 static struct __pyx_typeinfo_string __Pyx_TypeInfoToFormat(__Pyx_TypeInfo *type);
2313 
2314 /* CIntFromPy.proto */
2315 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
2316 
2317 /* PrintOne.proto */
2318 static int __Pyx_PrintOne(PyObject* stream, PyObject *o);
2319 
2320 /* CIntFromPy.proto */
2321 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
2322 
2323 /* FetchCommonType.proto */
2324 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
2325 
2326 /* PyObjectGetMethod.proto */
2327 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
2328 
2329 /* PyObjectCallMethod1.proto */
2330 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
2331 
2332 /* CoroutineBase.proto */
2333 typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *);
2334 #if CYTHON_USE_EXC_INFO_STACK
2335 #define __Pyx_ExcInfoStruct  _PyErr_StackItem
2336 #else
2337 typedef struct {
2338     PyObject *exc_type;
2339     PyObject *exc_value;
2340     PyObject *exc_traceback;
2341 } __Pyx_ExcInfoStruct;
2342 #endif
2343 typedef struct {
2344     PyObject_HEAD
2345     __pyx_coroutine_body_t body;
2346     PyObject *closure;
2347     __Pyx_ExcInfoStruct gi_exc_state;
2348     PyObject *gi_weakreflist;
2349     PyObject *classobj;
2350     PyObject *yieldfrom;
2351     PyObject *gi_name;
2352     PyObject *gi_qualname;
2353     PyObject *gi_modulename;
2354     PyObject *gi_code;
2355     int resume_label;
2356     char is_running;
2357 } __pyx_CoroutineObject;
2358 static __pyx_CoroutineObject *__Pyx__Coroutine_New(
2359     PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
2360     PyObject *name, PyObject *qualname, PyObject *module_name);
2361 static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
2362             __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
2363             PyObject *name, PyObject *qualname, PyObject *module_name);
2364 static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
2365 static int __Pyx_Coroutine_clear(PyObject *self);
2366 static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
2367 static PyObject *__Pyx_Coroutine_Close(PyObject *self);
2368 static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
2369 #if CYTHON_USE_EXC_INFO_STACK
2370 #define __Pyx_Coroutine_SwapException(self)
2371 #define __Pyx_Coroutine_ResetAndClearException(self)  __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
2372 #else
2373 #define __Pyx_Coroutine_SwapException(self) {\
2374     __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
2375     __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
2376     }
2377 #define __Pyx_Coroutine_ResetAndClearException(self) {\
2378     __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
2379     (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
2380     }
2381 #endif
2382 #if CYTHON_FAST_THREAD_STATE
2383 #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
2384     __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
2385 #else
2386 #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
2387     __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
2388 #endif
2389 static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
2390 static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);
2391 
2392 /* PatchModuleWithCoroutine.proto */
2393 static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);
2394 
2395 /* PatchGeneratorABC.proto */
2396 static int __Pyx_patch_abc(void);
2397 
2398 /* Generator.proto */
2399 #define __Pyx_Generator_USED
2400 static PyTypeObject *__pyx_GeneratorType = 0;
2401 #define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
2402 #define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
2403     __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
2404 static PyObject *__Pyx_Generator_Next(PyObject *self);
2405 static int __pyx_Generator_init(void);
2406 
2407 /* ObjectToMemviewSlice.proto */
2408 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_uint8_t(PyObject *, int writable_flag);
2409 
2410 /* ObjectToMemviewSlice.proto */
2411 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_nn___pyx_t_5numpy_float64_t(PyObject *, int writable_flag);
2412 
2413 /* CheckBinaryVersion.proto */
2414 static int __Pyx_check_binary_version(void);
2415 
2416 /* InitStrings.proto */
2417 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2418 
2419 static PyObject *__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_add_grid(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, __Pyx_memviewslice __pyx_v_gle, __Pyx_memviewslice __pyx_v_gre, int __pyx_v_gid, int __pyx_v_rank, int __pyx_v_size); /* proto*/
2420 static PyObject *__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_insert_grid(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, __Pyx_memviewslice __pyx_v_gle, __Pyx_memviewslice __pyx_v_gre, int __pyx_v_grid_id, int __pyx_v_rank, int __pyx_v_size); /* proto*/
2421 static PyObject *__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_add_grids(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, int __pyx_v_ngrids, __Pyx_memviewslice __pyx_v_gles, __Pyx_memviewslice __pyx_v_gres, __Pyx_memviewslice __pyx_v_gids, int __pyx_v_rank, int __pyx_v_size, int __pyx_skip_dispatch); /* proto*/
2422 static int __pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_should_i_split(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, CYTHON_UNUSED int __pyx_v_rank, int __pyx_v_size); /* proto*/
2423 static void __pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_insert_grids(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, int __pyx_v_ngrids, __Pyx_memviewslice __pyx_v_gles, __Pyx_memviewslice __pyx_v_gres, __Pyx_memviewslice __pyx_v_gids, int __pyx_v_rank, int __pyx_v_size); /* proto*/
2424 static PyObject *__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_split_grid(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, __Pyx_memviewslice __pyx_v_gle, __Pyx_memviewslice __pyx_v_gre, int __pyx_v_gid, int __pyx_v_rank, int __pyx_v_size); /* proto*/
2425 static int __pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_split_grids(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, int __pyx_v_ngrids, __Pyx_memviewslice __pyx_v_gles, __Pyx_memviewslice __pyx_v_gres, __Pyx_memviewslice __pyx_v_gids, int __pyx_v_rank, int __pyx_v_size); /* proto*/
2426 static PyObject *__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_geo_split(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, __Pyx_memviewslice __pyx_v_gle, __Pyx_memviewslice __pyx_v_gre, int __pyx_v_grid_id, int __pyx_v_rank, int __pyx_v_size); /* proto*/
2427 static void __pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_divide(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_11amr_kdtools_Split *__pyx_v_split); /* proto*/
2428 static int __pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node__kd_is_leaf(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto*/
2429 static int __pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_point_in_node(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, __Pyx_memviewslice __pyx_v_point); /* proto*/
2430 static struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node__find_node(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, __Pyx_memviewslice __pyx_v_point); /* proto*/
2431 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
2432 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
2433 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
2434 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
2435 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*/
2436 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
2437 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2438 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2439 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2440 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2441 
2442 /* Module declarations from 'cpython.buffer' */
2443 
2444 /* Module declarations from 'libc.string' */
2445 
2446 /* Module declarations from 'libc.stdio' */
2447 
2448 /* Module declarations from '__builtin__' */
2449 
2450 /* Module declarations from 'cpython.type' */
2451 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2452 
2453 /* Module declarations from 'cpython' */
2454 
2455 /* Module declarations from 'cpython.object' */
2456 
2457 /* Module declarations from 'cpython.ref' */
2458 
2459 /* Module declarations from 'cpython.mem' */
2460 
2461 /* Module declarations from 'numpy' */
2462 
2463 /* Module declarations from 'numpy' */
2464 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
2465 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
2466 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
2467 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
2468 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
2469 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
2470 
2471 /* Module declarations from 'cython.view' */
2472 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
2473 
2474 /* Module declarations from 'cython' */
2475 
2476 /* Module declarations from 'libc.stdlib' */
2477 
2478 /* Module declarations from 'yt.utilities.lib.amr_kdtools' */
2479 static PyTypeObject *__pyx_ptype_2yt_9utilities_3lib_11amr_kdtools_Node = 0;
2480 static PyTypeObject *__pyx_ptype_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse = 0;
2481 static PyTypeObject *__pyx_ptype_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse = 0;
2482 static PyTypeObject *__pyx_ptype_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch = 0;
2483 static PyTypeObject *__pyx_ptype_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse = 0;
2484 static PyTypeObject *__pyx_ptype_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse = 0;
2485 static PyTypeObject *__pyx_array_type = 0;
2486 static PyTypeObject *__pyx_MemviewEnum_type = 0;
2487 static PyTypeObject *__pyx_memoryview_type = 0;
2488 static PyTypeObject *__pyx_memoryviewslice_type = 0;
2489 static PyObject *generic = 0;
2490 static PyObject *strided = 0;
2491 static PyObject *indirect = 0;
2492 static PyObject *contiguous = 0;
2493 static PyObject *indirect_contiguous = 0;
2494 static int __pyx_memoryview_thread_locks_used;
2495 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2496 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_11amr_kdtools__lchild_id(__pyx_t_5numpy_int64_t); /*proto*/
2497 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_11amr_kdtools__rchild_id(__pyx_t_5numpy_int64_t); /*proto*/
2498 static int __pyx_f_2yt_9utilities_3lib_11amr_kdtools_should_i_build(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, int, int); /*proto*/
2499 static PyObject *__pyx_f_2yt_9utilities_3lib_11amr_kdtools_kdtree_get_choices(int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
2500 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
2501 static void *__pyx_align_pointer(void *, size_t); /*proto*/
2502 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
2503 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
2504 static PyObject *_unellipsify(PyObject *, int); /*proto*/
2505 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
2506 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
2507 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*/
2508 static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
2509 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
2510 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
2511 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2512 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2513 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
2514 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2515 static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
2516 static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
2517 static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
2518 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
2519 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
2520 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
2521 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
2522 static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
2523 static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
2524 static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
2525 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
2526 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
2527 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
2528 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2529 static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2530 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
2531 static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
2532 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
2533 static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo *); /*proto*/
2534 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 };
2535 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t = { "int64_t", NULL, sizeof(__pyx_t_5numpy_int64_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int64_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int64_t), 0 };
2536 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t = { "uint8_t", NULL, sizeof(__pyx_t_5numpy_uint8_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_uint8_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_uint8_t), 0 };
2537 #define __Pyx_MODULE_NAME "yt.utilities.lib.amr_kdtools"
2538 extern int __pyx_module_is_main_yt__utilities__lib__amr_kdtools;
2539 int __pyx_module_is_main_yt__utilities__lib__amr_kdtools = 0;
2540 
2541 /* Implementation of 'yt.utilities.lib.amr_kdtools' */
2542 static PyObject *__pyx_builtin_range;
2543 static PyObject *__pyx_builtin_TypeError;
2544 static PyObject *__pyx_builtin_ValueError;
2545 static PyObject *__pyx_builtin_RuntimeError;
2546 static PyObject *__pyx_builtin_ImportError;
2547 static PyObject *__pyx_builtin_MemoryError;
2548 static PyObject *__pyx_builtin_enumerate;
2549 static PyObject *__pyx_builtin_Ellipsis;
2550 static PyObject *__pyx_builtin_id;
2551 static PyObject *__pyx_builtin_IndexError;
2552 static const char __pyx_k_B[] = "B";
2553 static const char __pyx_k_O[] = "O";
2554 static const char __pyx_k_T[] = "T{";
2555   static const char __pyx_k_c[] = "c";
2556   static const char __pyx_k_d[] = "d";
2557   static const char __pyx_k_q[] = "q";
2558   static const char __pyx_k_s[] = "(%s)";
2559   static const char __pyx_k_id[] = "id";
2560   static const char __pyx_k_np[] = "np";
2561   static const char __pyx_k__32[] = "^";
2562   static const char __pyx_k__33[] = "";
2563   static const char __pyx_k__34[] = ":";
2564 static const char __pyx_k__35[] = "}";
2565 static const char __pyx_k__36[] = ",";
2566 static const char __pyx_k_dim[] = "dim";
2567 static const char __pyx_k_end[] = "end";
2568 static const char __pyx_k_gid[] = "gid";
2569 static const char __pyx_k_gle[] = "gle";
2570 static const char __pyx_k_gre[] = "gre";
2571 static const char __pyx_k_inf[] = "inf";
2572 static const char __pyx_k_nan[] = "nan";
2573 static const char __pyx_k_new[] = "__new__";
2574 static const char __pyx_k_obj[] = "obj";
2575 static const char __pyx_k_pos[] = "pos";
2576 static const char __pyx_k_Node[] = "Node";
2577 static const char __pyx_k_args[] = "args";
2578 static const char __pyx_k_base[] = "base";
2579 static const char __pyx_k_dict[] = "__dict__";
2580 static const char __pyx_k_file[] = "file";
2581 static const char __pyx_k_gids[] = "gids";
2582 static const char __pyx_k_gles[] = "gles";
2583 static const char __pyx_k_gres[] = "gres";
2584 static const char __pyx_k_grid[] = "grid";
2585 static const char __pyx_k_join[] = "join";
2586 static const char __pyx_k_left[] = "left";
2587 static const char __pyx_k_main[] = "__main__";
2588 static const char __pyx_k_mode[] = "mode";
2589 static const char __pyx_k_name[] = "name";
2590 static const char __pyx_k_ndim[] = "ndim";
2591 static const char __pyx_k_pack[] = "pack";
2592 static const char __pyx_k_prod[] = "prod";
2593 static const char __pyx_k_rank[] = "rank";
2594 static const char __pyx_k_send[] = "send";
2595 static const char __pyx_k_size[] = "size";
2596 static const char __pyx_k_sort[] = "sort";
2597 static const char __pyx_k_step[] = "step";
2598 static const char __pyx_k_stop[] = "stop";
2599 static const char __pyx_k_test[] = "__test__";
2600 static const char __pyx_k_ASCII[] = "ASCII";
2601 static const char __pyx_k_class[] = "__class__";
2602 static const char __pyx_k_close[] = "close";
2603 static const char __pyx_k_dtype[] = "dtype";
2604 static const char __pyx_k_empty[] = "empty";
2605 static const char __pyx_k_error[] = "error";
2606 static const char __pyx_k_flags[] = "flags";
2607 static const char __pyx_k_numpy[] = "numpy";
2608 static const char __pyx_k_print[] = "print";
2609 static const char __pyx_k_range[] = "range";
2610 static const char __pyx_k_right[] = "right";
2611 static const char __pyx_k_shape[] = "shape";
2612 static const char __pyx_k_start[] = "start";
2613 static const char __pyx_k_throw[] = "throw";
2614 static const char __pyx_k_Node_i[] = "Node %i";
2615 static const char __pyx_k_encode[] = "encode";
2616 static const char __pyx_k_format[] = "format";
2617 static const char __pyx_k_grid_i[] = "\t grid: %i";
2618 static const char __pyx_k_import[] = "__import__";
2619 static const char __pyx_k_name_2[] = "__name__";
2620 static const char __pyx_k_ngrids[] = "ngrids";
2621 static const char __pyx_k_parent[] = "parent";
2622 static const char __pyx_k_pickle[] = "pickle";
2623 static const char __pyx_k_reduce[] = "__reduce__";
2624 static const char __pyx_k_struct[] = "struct";
2625 static const char __pyx_k_unpack[] = "unpack";
2626 static const char __pyx_k_update[] = "update";
2627 static const char __pyx_k_current[] = "current";
2628 static const char __pyx_k_float64[] = "float64";
2629 static const char __pyx_k_fortran[] = "fortran";
2630 static const char __pyx_k_memview[] = "memview";
2631 static const char __pyx_k_node_id[] = "node_id";
2632 static const char __pyx_k_Ellipsis[] = "Ellipsis";
2633 static const char __pyx_k_getstate[] = "__getstate__";
2634 static const char __pyx_k_itemsize[] = "itemsize";
2635 static const char __pyx_k_le_e_e_e[] = "\t le: %e %e %e";
2636 static const char __pyx_k_max_node[] = "max_node";
2637 static const char __pyx_k_previous[] = "previous";
2638 static const char __pyx_k_pyx_type[] = "__pyx_type";
2639 static const char __pyx_k_re_e_e_e[] = "\t re: %e %e %e";
2640 static const char __pyx_k_setstate[] = "__setstate__";
2641 static const char __pyx_k_TypeError[] = "TypeError";
2642 static const char __pyx_k_add_grids[] = "add_grids";
2643 static const char __pyx_k_enumerate[] = "enumerate";
2644 static const char __pyx_k_left_edge[] = "left_edge";
2645 static const char __pyx_k_pyx_state[] = "__pyx_state";
2646 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
2647 static const char __pyx_k_viewpoint[] = "viewpoint";
2648 static const char __pyx_k_IndexError[] = "IndexError";
2649 static const char __pyx_k_ValueError[] = "ValueError";
2650 static const char __pyx_k_pyx_result[] = "__pyx_result";
2651 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
2652 static const char __pyx_k_right_edge[] = "right_edge";
2653 static const char __pyx_k_step_depth[] = "step_depth";
2654 static const char __pyx_k_ImportError[] = "ImportError";
2655 static const char __pyx_k_MemoryError[] = "MemoryError";
2656 static const char __pyx_k_PickleError[] = "PickleError";
2657 static const char __pyx_k_kd_traverse[] = "kd_traverse";
2658 static const char __pyx_k_RuntimeError[] = "RuntimeError";
2659 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
2660 static const char __pyx_k_stringsource[] = "stringsource";
2661 static const char __pyx_k_kd_node_check[] = "kd_node_check";
2662 static const char __pyx_k_kd_sum_volume[] = "kd_sum_volume";
2663 static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
2664 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
2665 static const char __pyx_k_depth_traverse[] = "depth_traverse";
2666 static const char __pyx_k_step_viewpoint[] = "step_viewpoint";
2667 static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
2668 static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
2669 static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
2670 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
2671 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
2672 static const char __pyx_k_Node_kd_traverse[] = "Node.kd_traverse";
2673 static const char __pyx_k_breadth_traverse[] = "breadth_traverse";
2674 static const char __pyx_k_depth_first_touch[] = "depth_first_touch";
2675 static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
2676 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2677 static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
2678 static const char __pyx_k_viewpoint_traverse[] = "viewpoint_traverse";
2679 static const char __pyx_k_Node_depth_traverse[] = "Node.depth_traverse";
2680 static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
2681 static const char __pyx_k_Failed_to_split_grids[] = "Failed to split grids.";
2682 static const char __pyx_k_Node_breadth_traverse[] = "Node.breadth_traverse";
2683 static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
2684 static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
2685 static const char __pyx_k_Node_depth_first_touch[] = "Node.depth_first_touch";
2686 static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
2687 static const char __pyx_k_Node_viewpoint_traverse[] = "Node.viewpoint_traverse";
2688 static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
2689 static const char __pyx_k_AMR_kD_Tree_Cython_Tools[] = "\nAMR kD-Tree Cython Tools\n\n\n\n";
2690 static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
2691 static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
2692 static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
2693 static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
2694 static const char __pyx_k_yt_utilities_lib_amr_kdtools[] = "yt.utilities.lib.amr_kdtools";
2695 static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
2696 static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
2697 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
2698 static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
2699 static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
2700 static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
2701 static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
2702 static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
2703 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
2704 static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
2705 static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))";
2706 static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
2707 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
2708 static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
2709 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
2710 static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
2711 static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
2712 static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
2713 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
2714 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
2715 static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
2716 static const char __pyx_k_yt_utilities_lib_amr_kdtools_pyx[] = "yt/utilities/lib/amr_kdtools.pyx";
2717 static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
2718 static PyObject *__pyx_n_s_ASCII;
2719 static PyObject *__pyx_n_s_B;
2720 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
2721 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
2722 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
2723 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
2724 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
2725 static PyObject *__pyx_n_s_Ellipsis;
2726 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
2727 static PyObject *__pyx_kp_s_Failed_to_split_grids;
2728 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
2729 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
2730 static PyObject *__pyx_n_s_ImportError;
2731 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
2732 static PyObject *__pyx_n_s_IndexError;
2733 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
2734 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
2735 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
2736 static PyObject *__pyx_n_s_MemoryError;
2737 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
2738 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
2739 static PyObject *__pyx_n_s_Node;
2740 static PyObject *__pyx_n_s_Node_breadth_traverse;
2741 static PyObject *__pyx_n_s_Node_depth_first_touch;
2742 static PyObject *__pyx_n_s_Node_depth_traverse;
2743 static PyObject *__pyx_kp_s_Node_i;
2744 static PyObject *__pyx_n_s_Node_kd_traverse;
2745 static PyObject *__pyx_n_s_Node_viewpoint_traverse;
2746 static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
2747 static PyObject *__pyx_n_b_O;
2748 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
2749 static PyObject *__pyx_n_s_PickleError;
2750 static PyObject *__pyx_n_s_RuntimeError;
2751 static PyObject *__pyx_kp_b_T;
2752 static PyObject *__pyx_n_s_TypeError;
2753 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
2754 static PyObject *__pyx_n_s_ValueError;
2755 static PyObject *__pyx_n_s_View_MemoryView;
2756 static PyObject *__pyx_kp_b__32;
2757 static PyObject *__pyx_kp_b__33;
2758 static PyObject *__pyx_kp_b__34;
2759 static PyObject *__pyx_kp_b__35;
2760 static PyObject *__pyx_kp_u__36;
2761 static PyObject *__pyx_n_s_add_grids;
2762 static PyObject *__pyx_n_s_allocate_buffer;
2763 static PyObject *__pyx_n_s_args;
2764 static PyObject *__pyx_n_s_base;
2765 static PyObject *__pyx_n_s_breadth_traverse;
2766 static PyObject *__pyx_n_s_c;
2767 static PyObject *__pyx_n_u_c;
2768 static PyObject *__pyx_n_s_class;
2769 static PyObject *__pyx_n_s_cline_in_traceback;
2770 static PyObject *__pyx_n_s_close;
2771 static PyObject *__pyx_kp_s_contiguous_and_direct;
2772 static PyObject *__pyx_kp_s_contiguous_and_indirect;
2773 static PyObject *__pyx_n_s_current;
2774 static PyObject *__pyx_n_s_d;
2775 static PyObject *__pyx_n_s_depth_first_touch;
2776 static PyObject *__pyx_n_s_depth_traverse;
2777 static PyObject *__pyx_n_s_dict;
2778 static PyObject *__pyx_n_s_dim;
2779 static PyObject *__pyx_n_s_dtype;
2780 static PyObject *__pyx_n_s_dtype_is_object;
2781 static PyObject *__pyx_n_s_empty;
2782 static PyObject *__pyx_n_s_encode;
2783 static PyObject *__pyx_n_s_end;
2784 static PyObject *__pyx_n_s_enumerate;
2785 static PyObject *__pyx_n_s_error;
2786 static PyObject *__pyx_n_s_file;
2787 static PyObject *__pyx_n_s_flags;
2788 static PyObject *__pyx_n_s_float64;
2789 static PyObject *__pyx_n_s_format;
2790 static PyObject *__pyx_n_s_fortran;
2791 static PyObject *__pyx_n_u_fortran;
2792 static PyObject *__pyx_n_s_getstate;
2793 static PyObject *__pyx_n_s_gid;
2794 static PyObject *__pyx_n_s_gids;
2795 static PyObject *__pyx_n_s_gle;
2796 static PyObject *__pyx_n_s_gles;
2797 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
2798 static PyObject *__pyx_n_s_gre;
2799 static PyObject *__pyx_n_s_gres;
2800 static PyObject *__pyx_n_s_grid;
2801 static PyObject *__pyx_kp_s_grid_i;
2802 static PyObject *__pyx_n_s_id;
2803 static PyObject *__pyx_n_s_import;
2804 static PyObject *__pyx_n_s_inf;
2805 static PyObject *__pyx_n_s_itemsize;
2806 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
2807 static PyObject *__pyx_n_s_join;
2808 static PyObject *__pyx_n_s_kd_node_check;
2809 static PyObject *__pyx_n_s_kd_sum_volume;
2810 static PyObject *__pyx_n_s_kd_traverse;
2811 static PyObject *__pyx_kp_s_le_e_e_e;
2812 static PyObject *__pyx_n_s_left;
2813 static PyObject *__pyx_n_s_left_edge;
2814 static PyObject *__pyx_n_s_main;
2815 static PyObject *__pyx_n_s_max_node;
2816 static PyObject *__pyx_n_s_memview;
2817 static PyObject *__pyx_n_s_mode;
2818 static PyObject *__pyx_n_s_name;
2819 static PyObject *__pyx_n_s_name_2;
2820 static PyObject *__pyx_n_s_nan;
2821 static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
2822 static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
2823 static PyObject *__pyx_n_s_ndim;
2824 static PyObject *__pyx_n_s_new;
2825 static PyObject *__pyx_n_s_ngrids;
2826 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2827 static PyObject *__pyx_n_s_node_id;
2828 static PyObject *__pyx_n_s_np;
2829 static PyObject *__pyx_n_s_numpy;
2830 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
2831 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
2832 static PyObject *__pyx_n_s_obj;
2833 static PyObject *__pyx_n_s_pack;
2834 static PyObject *__pyx_n_s_parent;
2835 static PyObject *__pyx_n_s_pickle;
2836 static PyObject *__pyx_n_s_pos;
2837 static PyObject *__pyx_n_s_previous;
2838 static PyObject *__pyx_n_s_print;
2839 static PyObject *__pyx_n_s_prod;
2840 static PyObject *__pyx_n_s_pyx_PickleError;
2841 static PyObject *__pyx_n_s_pyx_checksum;
2842 static PyObject *__pyx_n_s_pyx_getbuffer;
2843 static PyObject *__pyx_n_s_pyx_result;
2844 static PyObject *__pyx_n_s_pyx_state;
2845 static PyObject *__pyx_n_s_pyx_type;
2846 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
2847 static PyObject *__pyx_n_s_pyx_vtable;
2848 static PyObject *__pyx_n_s_q;
2849 static PyObject *__pyx_n_s_range;
2850 static PyObject *__pyx_n_s_rank;
2851 static PyObject *__pyx_kp_s_re_e_e_e;
2852 static PyObject *__pyx_n_s_reduce;
2853 static PyObject *__pyx_n_s_reduce_cython;
2854 static PyObject *__pyx_n_s_reduce_ex;
2855 static PyObject *__pyx_n_s_right;
2856 static PyObject *__pyx_n_s_right_edge;
2857 static PyObject *__pyx_kp_u_s;
2858 static PyObject *__pyx_n_s_send;
2859 static PyObject *__pyx_n_s_setstate;
2860 static PyObject *__pyx_n_s_setstate_cython;
2861 static PyObject *__pyx_n_s_shape;
2862 static PyObject *__pyx_n_s_size;
2863 static PyObject *__pyx_n_s_sort;
2864 static PyObject *__pyx_n_s_start;
2865 static PyObject *__pyx_n_s_step;
2866 static PyObject *__pyx_n_s_step_depth;
2867 static PyObject *__pyx_n_s_step_viewpoint;
2868 static PyObject *__pyx_n_s_stop;
2869 static PyObject *__pyx_kp_s_strided_and_direct;
2870 static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
2871 static PyObject *__pyx_kp_s_strided_and_indirect;
2872 static PyObject *__pyx_kp_s_stringsource;
2873 static PyObject *__pyx_n_s_struct;
2874 static PyObject *__pyx_n_s_test;
2875 static PyObject *__pyx_n_s_throw;
2876 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
2877 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
2878 static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
2879 static PyObject *__pyx_n_s_unpack;
2880 static PyObject *__pyx_n_s_update;
2881 static PyObject *__pyx_n_s_viewpoint;
2882 static PyObject *__pyx_n_s_viewpoint_traverse;
2883 static PyObject *__pyx_n_s_yt_utilities_lib_amr_kdtools;
2884 static PyObject *__pyx_kp_s_yt_utilities_lib_amr_kdtools_pyx;
2885 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node___cinit__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_parent, struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_left, struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_right, __Pyx_memviewslice __pyx_v_left_edge, __Pyx_memviewslice __pyx_v_right_edge, int __pyx_v_grid, __pyx_t_5numpy_int64_t __pyx_v_node_id); /* proto */
2886 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_2print_me(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2887 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4get_split_dim(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2888 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_6get_split_pos(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2889 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_8set_left_edge(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, __Pyx_memviewslice __pyx_v_left_edge); /* proto */
2890 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_10set_right_edge(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, __Pyx_memviewslice __pyx_v_right_edge); /* proto */
2891 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_12create_split(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_dim, PyObject *__pyx_v_pos); /* proto */
2892 static void __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_14__dealloc__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2893 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_16get_left_edge(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2894 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_18get_right_edge(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2895 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_20set_dirty(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, int __pyx_v_state); /* proto */
2896 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_22kd_traverse(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_viewpoint); /* proto */
2897 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_25add_pygrid(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, __Pyx_memviewslice __pyx_v_gle, __Pyx_memviewslice __pyx_v_gre, int __pyx_v_gid, int __pyx_v_rank, int __pyx_v_size); /* proto */
2898 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_27add_grids(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, int __pyx_v_ngrids, __Pyx_memviewslice __pyx_v_gles, __Pyx_memviewslice __pyx_v_gres, __Pyx_memviewslice __pyx_v_gids, int __pyx_v_rank, int __pyx_v_size); /* proto */
2899 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_29kd_sum_volume(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2900 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_31kd_node_check(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2901 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_33kd_is_leaf(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2902 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_35depth_traverse(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_max_node); /* proto */
2903 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_38depth_first_touch(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_max_node); /* proto */
2904 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_41breadth_traverse(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2905 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_44viewpoint_traverse(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_viewpoint); /* proto */
2906 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_47find_node(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, __Pyx_memviewslice __pyx_v_point); /* proto */
2907 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4left___get__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2908 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4left_2__set__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2909 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4left_4__del__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2910 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_5right___get__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2911 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_5right_2__set__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2912 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_5right_4__del__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2913 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_6parent___get__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2914 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_6parent_2__set__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2915 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_6parent_4__del__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2916 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4grid___get__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2917 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4grid_2__set__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2918 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_5dirty___get__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2919 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_5dirty_2__set__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2920 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_7node_id___get__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2921 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_7node_id_2__set__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2922 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_8node_ind___get__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2923 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_8node_ind_2__set__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2924 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4data___get__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2925 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4data_2__set__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2926 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4data_4__del__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2927 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_49__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self); /* proto */
2928 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_51__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2929 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_step_depth(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_current, struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_previous); /* proto */
2930 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_2step_viewpoint(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_current, struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_previous, PyObject *__pyx_v_viewpoint); /* proto */
2931 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
2932 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
2933 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 */
2934 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 */
2935 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2936 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2937 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2938 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
2939 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
2940 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 */
2941 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
2942 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 */
2943 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
2944 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2945 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2946 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
2947 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 */
2948 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2949 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
2950 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 */
2951 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 */
2952 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2953 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2954 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2955 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2956 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2957 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2958 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2959 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2960 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2961 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2962 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2963 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2964 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2965 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2966 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2967 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2968 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2969 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 */
2970 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2971 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2972 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2973 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 */
2974 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 */
2975 static PyObject *__pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools_Node(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2976 static PyObject *__pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2977 static PyObject *__pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2978 static PyObject *__pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2979 static PyObject *__pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2980 static PyObject *__pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2981 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2982 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2983 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2984 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2985 static PyObject *__pyx_float_0_0;
2986 static PyObject *__pyx_int_0;
2987 static PyObject *__pyx_int_1;
2988 static PyObject *__pyx_int_2;
2989 static PyObject *__pyx_int_3;
2990 static PyObject *__pyx_int_184977713;
2991 static PyObject *__pyx_int_neg_1;
2992 static PyObject *__pyx_tuple_;
2993 static PyObject *__pyx_tuple__2;
2994 static PyObject *__pyx_tuple__3;
2995 static PyObject *__pyx_tuple__4;
2996 static PyObject *__pyx_tuple__5;
2997 static PyObject *__pyx_tuple__6;
2998 static PyObject *__pyx_tuple__7;
2999 static PyObject *__pyx_tuple__8;
3000 static PyObject *__pyx_tuple__9;
3001 static PyObject *__pyx_slice__28;
3002 static PyObject *__pyx_tuple__10;
3003 static PyObject *__pyx_tuple__11;
3004 static PyObject *__pyx_tuple__12;
3005 static PyObject *__pyx_tuple__13;
3006 static PyObject *__pyx_tuple__14;
3007 static PyObject *__pyx_tuple__15;
3008 static PyObject *__pyx_tuple__16;
3009 static PyObject *__pyx_tuple__17;
3010 static PyObject *__pyx_tuple__18;
3011 static PyObject *__pyx_tuple__19;
3012 static PyObject *__pyx_tuple__20;
3013 static PyObject *__pyx_tuple__21;
3014 static PyObject *__pyx_tuple__22;
3015 static PyObject *__pyx_tuple__23;
3016 static PyObject *__pyx_tuple__24;
3017 static PyObject *__pyx_tuple__25;
3018 static PyObject *__pyx_tuple__26;
3019 static PyObject *__pyx_tuple__27;
3020 static PyObject *__pyx_tuple__29;
3021 static PyObject *__pyx_tuple__30;
3022 static PyObject *__pyx_tuple__31;
3023 static PyObject *__pyx_tuple__37;
3024 static PyObject *__pyx_tuple__39;
3025 static PyObject *__pyx_tuple__41;
3026 static PyObject *__pyx_tuple__42;
3027 static PyObject *__pyx_tuple__43;
3028 static PyObject *__pyx_tuple__44;
3029 static PyObject *__pyx_tuple__45;
3030 static PyObject *__pyx_tuple__46;
3031 static PyObject *__pyx_codeobj__38;
3032 static PyObject *__pyx_codeobj__40;
3033 static PyObject *__pyx_codeobj__47;
3034 /* Late includes */
3035 
3036 /* "yt/utilities/lib/amr_kdtools.pyx":25
3037  * cdef class Node:
3038  *
3039  *     def __cinit__(self,             # <<<<<<<<<<<<<<
3040  *                   Node parent,
3041  *                   Node left,
3042  */
3043 
3044 /* Python wrapper */
3045 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3046 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3047   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_parent = 0;
3048   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_left = 0;
3049   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_right = 0;
3050   __Pyx_memviewslice __pyx_v_left_edge = { 0, 0, { 0 }, { 0 }, { 0 } };
3051   __Pyx_memviewslice __pyx_v_right_edge = { 0, 0, { 0 }, { 0 }, { 0 } };
3052   int __pyx_v_grid;
3053   __pyx_t_5numpy_int64_t __pyx_v_node_id;
3054   int __pyx_r;
3055   __Pyx_RefNannyDeclarations
3056   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
3057   {
3058     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_parent,&__pyx_n_s_left,&__pyx_n_s_right,&__pyx_n_s_left_edge,&__pyx_n_s_right_edge,&__pyx_n_s_grid,&__pyx_n_s_node_id,0};
3059     PyObject* values[7] = {0,0,0,0,0,0,0};
3060     if (unlikely(__pyx_kwds)) {
3061       Py_ssize_t kw_args;
3062       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3063       switch (pos_args) {
3064         case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3065         CYTHON_FALLTHROUGH;
3066         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3067         CYTHON_FALLTHROUGH;
3068         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3069         CYTHON_FALLTHROUGH;
3070         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3071         CYTHON_FALLTHROUGH;
3072         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3073         CYTHON_FALLTHROUGH;
3074         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3075         CYTHON_FALLTHROUGH;
3076         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3077         CYTHON_FALLTHROUGH;
3078         case  0: break;
3079         default: goto __pyx_L5_argtuple_error;
3080       }
3081       kw_args = PyDict_Size(__pyx_kwds);
3082       switch (pos_args) {
3083         case  0:
3084         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parent)) != 0)) kw_args--;
3085         else goto __pyx_L5_argtuple_error;
3086         CYTHON_FALLTHROUGH;
3087         case  1:
3088         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_left)) != 0)) kw_args--;
3089         else {
3090           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, 1); __PYX_ERR(0, 25, __pyx_L3_error)
3091         }
3092         CYTHON_FALLTHROUGH;
3093         case  2:
3094         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_right)) != 0)) kw_args--;
3095         else {
3096           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, 2); __PYX_ERR(0, 25, __pyx_L3_error)
3097         }
3098         CYTHON_FALLTHROUGH;
3099         case  3:
3100         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_left_edge)) != 0)) kw_args--;
3101         else {
3102           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, 3); __PYX_ERR(0, 25, __pyx_L3_error)
3103         }
3104         CYTHON_FALLTHROUGH;
3105         case  4:
3106         if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_right_edge)) != 0)) kw_args--;
3107         else {
3108           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, 4); __PYX_ERR(0, 25, __pyx_L3_error)
3109         }
3110         CYTHON_FALLTHROUGH;
3111         case  5:
3112         if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_grid)) != 0)) kw_args--;
3113         else {
3114           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, 5); __PYX_ERR(0, 25, __pyx_L3_error)
3115         }
3116         CYTHON_FALLTHROUGH;
3117         case  6:
3118         if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_node_id)) != 0)) kw_args--;
3119         else {
3120           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, 6); __PYX_ERR(0, 25, __pyx_L3_error)
3121         }
3122       }
3123       if (unlikely(kw_args > 0)) {
3124         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 25, __pyx_L3_error)
3125       }
3126     } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
3127       goto __pyx_L5_argtuple_error;
3128     } else {
3129       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3130       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3131       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3132       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3133       values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3134       values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3135       values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3136     }
3137     __pyx_v_parent = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)values[0]);
3138     __pyx_v_left = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)values[1]);
3139     __pyx_v_right = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)values[2]);
3140     __pyx_v_left_edge = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_left_edge.memview)) __PYX_ERR(0, 29, __pyx_L3_error)
3141     __pyx_v_right_edge = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_right_edge.memview)) __PYX_ERR(0, 30, __pyx_L3_error)
3142     __pyx_v_grid = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_grid == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 31, __pyx_L3_error)
3143     __pyx_v_node_id = __Pyx_PyInt_As_npy_int64(values[6]); if (unlikely((__pyx_v_node_id == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 32, __pyx_L3_error)
3144   }
3145   goto __pyx_L4_argument_unpacking_done;
3146   __pyx_L5_argtuple_error:;
3147   __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 25, __pyx_L3_error)
3148   __pyx_L3_error:;
3149   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3150   __Pyx_RefNannyFinishContext();
3151   return -1;
3152   __pyx_L4_argument_unpacking_done:;
3153   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_2yt_9utilities_3lib_11amr_kdtools_Node, 1, "parent", 0))) __PYX_ERR(0, 26, __pyx_L1_error)
3154   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left), __pyx_ptype_2yt_9utilities_3lib_11amr_kdtools_Node, 1, "left", 0))) __PYX_ERR(0, 27, __pyx_L1_error)
3155   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_right), __pyx_ptype_2yt_9utilities_3lib_11amr_kdtools_Node, 1, "right", 0))) __PYX_ERR(0, 28, __pyx_L1_error)
3156   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node___cinit__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self), __pyx_v_parent, __pyx_v_left, __pyx_v_right, __pyx_v_left_edge, __pyx_v_right_edge, __pyx_v_grid, __pyx_v_node_id);
3157 
3158   /* function exit code */
3159   goto __pyx_L0;
3160   __pyx_L1_error:;
3161   __pyx_r = -1;
3162   __pyx_L0:;
3163   __Pyx_RefNannyFinishContext();
3164   return __pyx_r;
3165 }
3166 
3167 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node___cinit__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_parent, struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_left, struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_right, __Pyx_memviewslice __pyx_v_left_edge, __Pyx_memviewslice __pyx_v_right_edge, int __pyx_v_grid, __pyx_t_5numpy_int64_t __pyx_v_node_id) {
3168   int __pyx_v_i;
3169   int __pyx_r;
3170   __Pyx_RefNannyDeclarations
3171   int __pyx_t_1;
3172   Py_ssize_t __pyx_t_2;
3173   Py_ssize_t __pyx_t_3;
3174   __Pyx_RefNannySetupContext("__cinit__", 0);
3175 
3176   /* "yt/utilities/lib/amr_kdtools.pyx":33
3177  *                   int grid,
3178  *                   np.int64_t node_id):
3179  *         self.dirty = False             # <<<<<<<<<<<<<<
3180  *         self.left = left
3181  *         self.right = right
3182  */
3183   __pyx_v_self->dirty = 0;
3184 
3185   /* "yt/utilities/lib/amr_kdtools.pyx":34
3186  *                   np.int64_t node_id):
3187  *         self.dirty = False
3188  *         self.left = left             # <<<<<<<<<<<<<<
3189  *         self.right = right
3190  *         self.parent = parent
3191  */
3192   __Pyx_INCREF(((PyObject *)__pyx_v_left));
3193   __Pyx_GIVEREF(((PyObject *)__pyx_v_left));
3194   __Pyx_GOTREF(__pyx_v_self->left);
3195   __Pyx_DECREF(((PyObject *)__pyx_v_self->left));
3196   __pyx_v_self->left = __pyx_v_left;
3197 
3198   /* "yt/utilities/lib/amr_kdtools.pyx":35
3199  *         self.dirty = False
3200  *         self.left = left
3201  *         self.right = right             # <<<<<<<<<<<<<<
3202  *         self.parent = parent
3203  *         cdef int i
3204  */
3205   __Pyx_INCREF(((PyObject *)__pyx_v_right));
3206   __Pyx_GIVEREF(((PyObject *)__pyx_v_right));
3207   __Pyx_GOTREF(__pyx_v_self->right);
3208   __Pyx_DECREF(((PyObject *)__pyx_v_self->right));
3209   __pyx_v_self->right = __pyx_v_right;
3210 
3211   /* "yt/utilities/lib/amr_kdtools.pyx":36
3212  *         self.left = left
3213  *         self.right = right
3214  *         self.parent = parent             # <<<<<<<<<<<<<<
3215  *         cdef int i
3216  *         for i in range(3):
3217  */
3218   __Pyx_INCREF(((PyObject *)__pyx_v_parent));
3219   __Pyx_GIVEREF(((PyObject *)__pyx_v_parent));
3220   __Pyx_GOTREF(__pyx_v_self->parent);
3221   __Pyx_DECREF(((PyObject *)__pyx_v_self->parent));
3222   __pyx_v_self->parent = __pyx_v_parent;
3223 
3224   /* "yt/utilities/lib/amr_kdtools.pyx":38
3225  *         self.parent = parent
3226  *         cdef int i
3227  *         for i in range(3):             # <<<<<<<<<<<<<<
3228  *             self.left_edge[i] = left_edge[i]
3229  *             self.right_edge[i] = right_edge[i]
3230  */
3231   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
3232     __pyx_v_i = __pyx_t_1;
3233 
3234     /* "yt/utilities/lib/amr_kdtools.pyx":39
3235  *         cdef int i
3236  *         for i in range(3):
3237  *             self.left_edge[i] = left_edge[i]             # <<<<<<<<<<<<<<
3238  *             self.right_edge[i] = right_edge[i]
3239  *         self.grid = grid
3240  */
3241     __pyx_t_2 = __pyx_v_i;
3242     (__pyx_v_self->left_edge[__pyx_v_i]) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_left_edge.data + __pyx_t_2 * __pyx_v_left_edge.strides[0]) )));
3243 
3244     /* "yt/utilities/lib/amr_kdtools.pyx":40
3245  *         for i in range(3):
3246  *             self.left_edge[i] = left_edge[i]
3247  *             self.right_edge[i] = right_edge[i]             # <<<<<<<<<<<<<<
3248  *         self.grid = grid
3249  *         self.node_id = node_id
3250  */
3251     __pyx_t_3 = __pyx_v_i;
3252     (__pyx_v_self->right_edge[__pyx_v_i]) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_right_edge.data + __pyx_t_3 * __pyx_v_right_edge.strides[0]) )));
3253   }
3254 
3255   /* "yt/utilities/lib/amr_kdtools.pyx":41
3256  *             self.left_edge[i] = left_edge[i]
3257  *             self.right_edge[i] = right_edge[i]
3258  *         self.grid = grid             # <<<<<<<<<<<<<<
3259  *         self.node_id = node_id
3260  *         self.split == NULL
3261  */
3262   __pyx_v_self->grid = __pyx_v_grid;
3263 
3264   /* "yt/utilities/lib/amr_kdtools.pyx":42
3265  *             self.right_edge[i] = right_edge[i]
3266  *         self.grid = grid
3267  *         self.node_id = node_id             # <<<<<<<<<<<<<<
3268  *         self.split == NULL
3269  *
3270  */
3271   __pyx_v_self->node_id = __pyx_v_node_id;
3272 
3273   /* "yt/utilities/lib/amr_kdtools.pyx":43
3274  *         self.grid = grid
3275  *         self.node_id = node_id
3276  *         self.split == NULL             # <<<<<<<<<<<<<<
3277  *
3278  *
3279  */
3280   (void)((__pyx_v_self->split == NULL));
3281 
3282   /* "yt/utilities/lib/amr_kdtools.pyx":25
3283  * cdef class Node:
3284  *
3285  *     def __cinit__(self,             # <<<<<<<<<<<<<<
3286  *                   Node parent,
3287  *                   Node left,
3288  */
3289 
3290   /* function exit code */
3291   __pyx_r = 0;
3292   __PYX_XDEC_MEMVIEW(&__pyx_v_left_edge, 1);
3293   __PYX_XDEC_MEMVIEW(&__pyx_v_right_edge, 1);
3294   __Pyx_RefNannyFinishContext();
3295   return __pyx_r;
3296 }
3297 
3298 /* "yt/utilities/lib/amr_kdtools.pyx":46
3299  *
3300  *
3301  *     def print_me(self):             # <<<<<<<<<<<<<<
3302  *         print('Node %i' % self.node_id)
3303  *         print('\t le: %e %e %e' % (self.left_edge[0], self.left_edge[1],
3304  */
3305 
3306 /* Python wrapper */
3307 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_3print_me(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
3308 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_3print_me(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3309   PyObject *__pyx_r = 0;
3310   __Pyx_RefNannyDeclarations
3311   __Pyx_RefNannySetupContext("print_me (wrapper)", 0);
3312   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_2print_me(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
3313 
3314   /* function exit code */
3315   __Pyx_RefNannyFinishContext();
3316   return __pyx_r;
3317 }
3318 
3319 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_2print_me(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
3320   PyObject *__pyx_r = NULL;
3321   __Pyx_RefNannyDeclarations
3322   PyObject *__pyx_t_1 = NULL;
3323   PyObject *__pyx_t_2 = NULL;
3324   PyObject *__pyx_t_3 = NULL;
3325   PyObject *__pyx_t_4 = NULL;
3326   __Pyx_RefNannySetupContext("print_me", 0);
3327 
3328   /* "yt/utilities/lib/amr_kdtools.pyx":47
3329  *
3330  *     def print_me(self):
3331  *         print('Node %i' % self.node_id)             # <<<<<<<<<<<<<<
3332  *         print('\t le: %e %e %e' % (self.left_edge[0], self.left_edge[1],
3333  *                                    self.left_edge[2]))
3334  */
3335   __pyx_t_1 = __Pyx_PyInt_From_npy_int64(__pyx_v_self->node_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
3336   __Pyx_GOTREF(__pyx_t_1);
3337   __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Node_i, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error)
3338   __Pyx_GOTREF(__pyx_t_2);
3339   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3340   if (__Pyx_PrintOne(0, __pyx_t_2) < 0) __PYX_ERR(0, 47, __pyx_L1_error)
3341   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3342 
3343   /* "yt/utilities/lib/amr_kdtools.pyx":48
3344  *     def print_me(self):
3345  *         print('Node %i' % self.node_id)
3346  *         print('\t le: %e %e %e' % (self.left_edge[0], self.left_edge[1],             # <<<<<<<<<<<<<<
3347  *                                    self.left_edge[2]))
3348  *         print('\t re: %e %e %e' % (self.right_edge[0], self.right_edge[1],
3349  */
3350   __pyx_t_2 = PyFloat_FromDouble((__pyx_v_self->left_edge[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error)
3351   __Pyx_GOTREF(__pyx_t_2);
3352   __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->left_edge[1])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error)
3353   __Pyx_GOTREF(__pyx_t_1);
3354 
3355   /* "yt/utilities/lib/amr_kdtools.pyx":49
3356  *         print('Node %i' % self.node_id)
3357  *         print('\t le: %e %e %e' % (self.left_edge[0], self.left_edge[1],
3358  *                                    self.left_edge[2]))             # <<<<<<<<<<<<<<
3359  *         print('\t re: %e %e %e' % (self.right_edge[0], self.right_edge[1],
3360  *                                    self.right_edge[2]))
3361  */
3362   __pyx_t_3 = PyFloat_FromDouble((__pyx_v_self->left_edge[2])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error)
3363   __Pyx_GOTREF(__pyx_t_3);
3364 
3365   /* "yt/utilities/lib/amr_kdtools.pyx":48
3366  *     def print_me(self):
3367  *         print('Node %i' % self.node_id)
3368  *         print('\t le: %e %e %e' % (self.left_edge[0], self.left_edge[1],             # <<<<<<<<<<<<<<
3369  *                                    self.left_edge[2]))
3370  *         print('\t re: %e %e %e' % (self.right_edge[0], self.right_edge[1],
3371  */
3372   __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 48, __pyx_L1_error)
3373   __Pyx_GOTREF(__pyx_t_4);
3374   __Pyx_GIVEREF(__pyx_t_2);
3375   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
3376   __Pyx_GIVEREF(__pyx_t_1);
3377   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
3378   __Pyx_GIVEREF(__pyx_t_3);
3379   PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
3380   __pyx_t_2 = 0;
3381   __pyx_t_1 = 0;
3382   __pyx_t_3 = 0;
3383   __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_le_e_e_e, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error)
3384   __Pyx_GOTREF(__pyx_t_3);
3385   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3386   if (__Pyx_PrintOne(0, __pyx_t_3) < 0) __PYX_ERR(0, 48, __pyx_L1_error)
3387   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3388 
3389   /* "yt/utilities/lib/amr_kdtools.pyx":50
3390  *         print('\t le: %e %e %e' % (self.left_edge[0], self.left_edge[1],
3391  *                                    self.left_edge[2]))
3392  *         print('\t re: %e %e %e' % (self.right_edge[0], self.right_edge[1],             # <<<<<<<<<<<<<<
3393  *                                    self.right_edge[2]))
3394  *         print('\t grid: %i' % self.grid)
3395  */
3396   __pyx_t_3 = PyFloat_FromDouble((__pyx_v_self->right_edge[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error)
3397   __Pyx_GOTREF(__pyx_t_3);
3398   __pyx_t_4 = PyFloat_FromDouble((__pyx_v_self->right_edge[1])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error)
3399   __Pyx_GOTREF(__pyx_t_4);
3400 
3401   /* "yt/utilities/lib/amr_kdtools.pyx":51
3402  *                                    self.left_edge[2]))
3403  *         print('\t re: %e %e %e' % (self.right_edge[0], self.right_edge[1],
3404  *                                    self.right_edge[2]))             # <<<<<<<<<<<<<<
3405  *         print('\t grid: %i' % self.grid)
3406  *
3407  */
3408   __pyx_t_1 = PyFloat_FromDouble((__pyx_v_self->right_edge[2])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error)
3409   __Pyx_GOTREF(__pyx_t_1);
3410 
3411   /* "yt/utilities/lib/amr_kdtools.pyx":50
3412  *         print('\t le: %e %e %e' % (self.left_edge[0], self.left_edge[1],
3413  *                                    self.left_edge[2]))
3414  *         print('\t re: %e %e %e' % (self.right_edge[0], self.right_edge[1],             # <<<<<<<<<<<<<<
3415  *                                    self.right_edge[2]))
3416  *         print('\t grid: %i' % self.grid)
3417  */
3418   __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error)
3419   __Pyx_GOTREF(__pyx_t_2);
3420   __Pyx_GIVEREF(__pyx_t_3);
3421   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
3422   __Pyx_GIVEREF(__pyx_t_4);
3423   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
3424   __Pyx_GIVEREF(__pyx_t_1);
3425   PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1);
3426   __pyx_t_3 = 0;
3427   __pyx_t_4 = 0;
3428   __pyx_t_1 = 0;
3429   __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_re_e_e_e, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error)
3430   __Pyx_GOTREF(__pyx_t_1);
3431   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3432   if (__Pyx_PrintOne(0, __pyx_t_1) < 0) __PYX_ERR(0, 50, __pyx_L1_error)
3433   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3434 
3435   /* "yt/utilities/lib/amr_kdtools.pyx":52
3436  *         print('\t re: %e %e %e' % (self.right_edge[0], self.right_edge[1],
3437  *                                    self.right_edge[2]))
3438  *         print('\t grid: %i' % self.grid)             # <<<<<<<<<<<<<<
3439  *
3440  *     def get_split_dim(self):
3441  */
3442   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->grid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error)
3443   __Pyx_GOTREF(__pyx_t_1);
3444   __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_grid_i, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error)
3445   __Pyx_GOTREF(__pyx_t_2);
3446   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3447   if (__Pyx_PrintOne(0, __pyx_t_2) < 0) __PYX_ERR(0, 52, __pyx_L1_error)
3448   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3449 
3450   /* "yt/utilities/lib/amr_kdtools.pyx":46
3451  *
3452  *
3453  *     def print_me(self):             # <<<<<<<<<<<<<<
3454  *         print('Node %i' % self.node_id)
3455  *         print('\t le: %e %e %e' % (self.left_edge[0], self.left_edge[1],
3456  */
3457 
3458   /* function exit code */
3459   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3460   goto __pyx_L0;
3461   __pyx_L1_error:;
3462   __Pyx_XDECREF(__pyx_t_1);
3463   __Pyx_XDECREF(__pyx_t_2);
3464   __Pyx_XDECREF(__pyx_t_3);
3465   __Pyx_XDECREF(__pyx_t_4);
3466   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.print_me", __pyx_clineno, __pyx_lineno, __pyx_filename);
3467   __pyx_r = NULL;
3468   __pyx_L0:;
3469   __Pyx_XGIVEREF(__pyx_r);
3470   __Pyx_RefNannyFinishContext();
3471   return __pyx_r;
3472 }
3473 
3474 /* "yt/utilities/lib/amr_kdtools.pyx":54
3475  *         print('\t grid: %i' % self.grid)
3476  *
3477  *     def get_split_dim(self):             # <<<<<<<<<<<<<<
3478  *         if self.split != NULL:
3479  *             return self.split.dim
3480  */
3481 
3482 /* Python wrapper */
3483 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_5get_split_dim(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
3484 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_5get_split_dim(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3485   PyObject *__pyx_r = 0;
3486   __Pyx_RefNannyDeclarations
3487   __Pyx_RefNannySetupContext("get_split_dim (wrapper)", 0);
3488   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4get_split_dim(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
3489 
3490   /* function exit code */
3491   __Pyx_RefNannyFinishContext();
3492   return __pyx_r;
3493 }
3494 
3495 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4get_split_dim(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
3496   PyObject *__pyx_r = NULL;
3497   __Pyx_RefNannyDeclarations
3498   int __pyx_t_1;
3499   PyObject *__pyx_t_2 = NULL;
3500   __Pyx_RefNannySetupContext("get_split_dim", 0);
3501 
3502   /* "yt/utilities/lib/amr_kdtools.pyx":55
3503  *
3504  *     def get_split_dim(self):
3505  *         if self.split != NULL:             # <<<<<<<<<<<<<<
3506  *             return self.split.dim
3507  *         else:
3508  */
3509   __pyx_t_1 = ((__pyx_v_self->split != NULL) != 0);
3510   if (__pyx_t_1) {
3511 
3512     /* "yt/utilities/lib/amr_kdtools.pyx":56
3513  *     def get_split_dim(self):
3514  *         if self.split != NULL:
3515  *             return self.split.dim             # <<<<<<<<<<<<<<
3516  *         else:
3517  *             return -1
3518  */
3519     __Pyx_XDECREF(__pyx_r);
3520     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->split->dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error)
3521     __Pyx_GOTREF(__pyx_t_2);
3522     __pyx_r = __pyx_t_2;
3523     __pyx_t_2 = 0;
3524     goto __pyx_L0;
3525 
3526     /* "yt/utilities/lib/amr_kdtools.pyx":55
3527  *
3528  *     def get_split_dim(self):
3529  *         if self.split != NULL:             # <<<<<<<<<<<<<<
3530  *             return self.split.dim
3531  *         else:
3532  */
3533   }
3534 
3535   /* "yt/utilities/lib/amr_kdtools.pyx":58
3536  *             return self.split.dim
3537  *         else:
3538  *             return -1             # <<<<<<<<<<<<<<
3539  *
3540  *     def get_split_pos(self):
3541  */
3542   /*else*/ {
3543     __Pyx_XDECREF(__pyx_r);
3544     __Pyx_INCREF(__pyx_int_neg_1);
3545     __pyx_r = __pyx_int_neg_1;
3546     goto __pyx_L0;
3547   }
3548 
3549   /* "yt/utilities/lib/amr_kdtools.pyx":54
3550  *         print('\t grid: %i' % self.grid)
3551  *
3552  *     def get_split_dim(self):             # <<<<<<<<<<<<<<
3553  *         if self.split != NULL:
3554  *             return self.split.dim
3555  */
3556 
3557   /* function exit code */
3558   __pyx_L1_error:;
3559   __Pyx_XDECREF(__pyx_t_2);
3560   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.get_split_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
3561   __pyx_r = NULL;
3562   __pyx_L0:;
3563   __Pyx_XGIVEREF(__pyx_r);
3564   __Pyx_RefNannyFinishContext();
3565   return __pyx_r;
3566 }
3567 
3568 /* "yt/utilities/lib/amr_kdtools.pyx":60
3569  *             return -1
3570  *
3571  *     def get_split_pos(self):             # <<<<<<<<<<<<<<
3572  *         if self.split != NULL:
3573  *             return self.split.pos
3574  */
3575 
3576 /* Python wrapper */
3577 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_7get_split_pos(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
3578 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_7get_split_pos(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3579   PyObject *__pyx_r = 0;
3580   __Pyx_RefNannyDeclarations
3581   __Pyx_RefNannySetupContext("get_split_pos (wrapper)", 0);
3582   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_6get_split_pos(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
3583 
3584   /* function exit code */
3585   __Pyx_RefNannyFinishContext();
3586   return __pyx_r;
3587 }
3588 
3589 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_6get_split_pos(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
3590   PyObject *__pyx_r = NULL;
3591   __Pyx_RefNannyDeclarations
3592   int __pyx_t_1;
3593   PyObject *__pyx_t_2 = NULL;
3594   PyObject *__pyx_t_3 = NULL;
3595   __Pyx_RefNannySetupContext("get_split_pos", 0);
3596 
3597   /* "yt/utilities/lib/amr_kdtools.pyx":61
3598  *
3599  *     def get_split_pos(self):
3600  *         if self.split != NULL:             # <<<<<<<<<<<<<<
3601  *             return self.split.pos
3602  *         else:
3603  */
3604   __pyx_t_1 = ((__pyx_v_self->split != NULL) != 0);
3605   if (__pyx_t_1) {
3606 
3607     /* "yt/utilities/lib/amr_kdtools.pyx":62
3608  *     def get_split_pos(self):
3609  *         if self.split != NULL:
3610  *             return self.split.pos             # <<<<<<<<<<<<<<
3611  *         else:
3612  *             return np.nan
3613  */
3614     __Pyx_XDECREF(__pyx_r);
3615     __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->split->pos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error)
3616     __Pyx_GOTREF(__pyx_t_2);
3617     __pyx_r = __pyx_t_2;
3618     __pyx_t_2 = 0;
3619     goto __pyx_L0;
3620 
3621     /* "yt/utilities/lib/amr_kdtools.pyx":61
3622  *
3623  *     def get_split_pos(self):
3624  *         if self.split != NULL:             # <<<<<<<<<<<<<<
3625  *             return self.split.pos
3626  *         else:
3627  */
3628   }
3629 
3630   /* "yt/utilities/lib/amr_kdtools.pyx":64
3631  *             return self.split.pos
3632  *         else:
3633  *             return np.nan             # <<<<<<<<<<<<<<
3634  *
3635  *     def set_left_edge(self, np.float64_t[:] left_edge):
3636  */
3637   /*else*/ {
3638     __Pyx_XDECREF(__pyx_r);
3639     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error)
3640     __Pyx_GOTREF(__pyx_t_2);
3641     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_nan); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __pyx_L1_error)
3642     __Pyx_GOTREF(__pyx_t_3);
3643     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3644     __pyx_r = __pyx_t_3;
3645     __pyx_t_3 = 0;
3646     goto __pyx_L0;
3647   }
3648 
3649   /* "yt/utilities/lib/amr_kdtools.pyx":60
3650  *             return -1
3651  *
3652  *     def get_split_pos(self):             # <<<<<<<<<<<<<<
3653  *         if self.split != NULL:
3654  *             return self.split.pos
3655  */
3656 
3657   /* function exit code */
3658   __pyx_L1_error:;
3659   __Pyx_XDECREF(__pyx_t_2);
3660   __Pyx_XDECREF(__pyx_t_3);
3661   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.get_split_pos", __pyx_clineno, __pyx_lineno, __pyx_filename);
3662   __pyx_r = NULL;
3663   __pyx_L0:;
3664   __Pyx_XGIVEREF(__pyx_r);
3665   __Pyx_RefNannyFinishContext();
3666   return __pyx_r;
3667 }
3668 
3669 /* "yt/utilities/lib/amr_kdtools.pyx":66
3670  *             return np.nan
3671  *
3672  *     def set_left_edge(self, np.float64_t[:] left_edge):             # <<<<<<<<<<<<<<
3673  *         cdef int i
3674  *         for i in range(3):
3675  */
3676 
3677 /* Python wrapper */
3678 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_9set_left_edge(PyObject *__pyx_v_self, PyObject *__pyx_arg_left_edge); /*proto*/
3679 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_9set_left_edge(PyObject *__pyx_v_self, PyObject *__pyx_arg_left_edge) {
3680   __Pyx_memviewslice __pyx_v_left_edge = { 0, 0, { 0 }, { 0 }, { 0 } };
3681   PyObject *__pyx_r = 0;
3682   __Pyx_RefNannyDeclarations
3683   __Pyx_RefNannySetupContext("set_left_edge (wrapper)", 0);
3684   assert(__pyx_arg_left_edge); {
3685     __pyx_v_left_edge = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_arg_left_edge, PyBUF_WRITABLE); if (unlikely(!__pyx_v_left_edge.memview)) __PYX_ERR(0, 66, __pyx_L3_error)
3686   }
3687   goto __pyx_L4_argument_unpacking_done;
3688   __pyx_L3_error:;
3689   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.set_left_edge", __pyx_clineno, __pyx_lineno, __pyx_filename);
3690   __Pyx_RefNannyFinishContext();
3691   return NULL;
3692   __pyx_L4_argument_unpacking_done:;
3693   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_8set_left_edge(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self), __pyx_v_left_edge);
3694 
3695   /* function exit code */
3696   __Pyx_RefNannyFinishContext();
3697   return __pyx_r;
3698 }
3699 
3700 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_8set_left_edge(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, __Pyx_memviewslice __pyx_v_left_edge) {
3701   int __pyx_v_i;
3702   PyObject *__pyx_r = NULL;
3703   __Pyx_RefNannyDeclarations
3704   int __pyx_t_1;
3705   Py_ssize_t __pyx_t_2;
3706   __Pyx_RefNannySetupContext("set_left_edge", 0);
3707 
3708   /* "yt/utilities/lib/amr_kdtools.pyx":68
3709  *     def set_left_edge(self, np.float64_t[:] left_edge):
3710  *         cdef int i
3711  *         for i in range(3):             # <<<<<<<<<<<<<<
3712  *             self.left_edge[i] = left_edge[i]
3713  *
3714  */
3715   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
3716     __pyx_v_i = __pyx_t_1;
3717 
3718     /* "yt/utilities/lib/amr_kdtools.pyx":69
3719  *         cdef int i
3720  *         for i in range(3):
3721  *             self.left_edge[i] = left_edge[i]             # <<<<<<<<<<<<<<
3722  *
3723  *     def set_right_edge(self, np.float64_t[:] right_edge):
3724  */
3725     __pyx_t_2 = __pyx_v_i;
3726     (__pyx_v_self->left_edge[__pyx_v_i]) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_left_edge.data + __pyx_t_2 * __pyx_v_left_edge.strides[0]) )));
3727   }
3728 
3729   /* "yt/utilities/lib/amr_kdtools.pyx":66
3730  *             return np.nan
3731  *
3732  *     def set_left_edge(self, np.float64_t[:] left_edge):             # <<<<<<<<<<<<<<
3733  *         cdef int i
3734  *         for i in range(3):
3735  */
3736 
3737   /* function exit code */
3738   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3739   __PYX_XDEC_MEMVIEW(&__pyx_v_left_edge, 1);
3740   __Pyx_XGIVEREF(__pyx_r);
3741   __Pyx_RefNannyFinishContext();
3742   return __pyx_r;
3743 }
3744 
3745 /* "yt/utilities/lib/amr_kdtools.pyx":71
3746  *             self.left_edge[i] = left_edge[i]
3747  *
3748  *     def set_right_edge(self, np.float64_t[:] right_edge):             # <<<<<<<<<<<<<<
3749  *         cdef int i
3750  *         for i in range(3):
3751  */
3752 
3753 /* Python wrapper */
3754 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_11set_right_edge(PyObject *__pyx_v_self, PyObject *__pyx_arg_right_edge); /*proto*/
3755 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_11set_right_edge(PyObject *__pyx_v_self, PyObject *__pyx_arg_right_edge) {
3756   __Pyx_memviewslice __pyx_v_right_edge = { 0, 0, { 0 }, { 0 }, { 0 } };
3757   PyObject *__pyx_r = 0;
3758   __Pyx_RefNannyDeclarations
3759   __Pyx_RefNannySetupContext("set_right_edge (wrapper)", 0);
3760   assert(__pyx_arg_right_edge); {
3761     __pyx_v_right_edge = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_arg_right_edge, PyBUF_WRITABLE); if (unlikely(!__pyx_v_right_edge.memview)) __PYX_ERR(0, 71, __pyx_L3_error)
3762   }
3763   goto __pyx_L4_argument_unpacking_done;
3764   __pyx_L3_error:;
3765   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.set_right_edge", __pyx_clineno, __pyx_lineno, __pyx_filename);
3766   __Pyx_RefNannyFinishContext();
3767   return NULL;
3768   __pyx_L4_argument_unpacking_done:;
3769   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_10set_right_edge(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self), __pyx_v_right_edge);
3770 
3771   /* function exit code */
3772   __Pyx_RefNannyFinishContext();
3773   return __pyx_r;
3774 }
3775 
3776 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_10set_right_edge(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, __Pyx_memviewslice __pyx_v_right_edge) {
3777   int __pyx_v_i;
3778   PyObject *__pyx_r = NULL;
3779   __Pyx_RefNannyDeclarations
3780   int __pyx_t_1;
3781   Py_ssize_t __pyx_t_2;
3782   __Pyx_RefNannySetupContext("set_right_edge", 0);
3783 
3784   /* "yt/utilities/lib/amr_kdtools.pyx":73
3785  *     def set_right_edge(self, np.float64_t[:] right_edge):
3786  *         cdef int i
3787  *         for i in range(3):             # <<<<<<<<<<<<<<
3788  *             self.right_edge[i] = right_edge[i]
3789  *
3790  */
3791   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
3792     __pyx_v_i = __pyx_t_1;
3793 
3794     /* "yt/utilities/lib/amr_kdtools.pyx":74
3795  *         cdef int i
3796  *         for i in range(3):
3797  *             self.right_edge[i] = right_edge[i]             # <<<<<<<<<<<<<<
3798  *
3799  *     def create_split(self, dim, pos):
3800  */
3801     __pyx_t_2 = __pyx_v_i;
3802     (__pyx_v_self->right_edge[__pyx_v_i]) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_right_edge.data + __pyx_t_2 * __pyx_v_right_edge.strides[0]) )));
3803   }
3804 
3805   /* "yt/utilities/lib/amr_kdtools.pyx":71
3806  *             self.left_edge[i] = left_edge[i]
3807  *
3808  *     def set_right_edge(self, np.float64_t[:] right_edge):             # <<<<<<<<<<<<<<
3809  *         cdef int i
3810  *         for i in range(3):
3811  */
3812 
3813   /* function exit code */
3814   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3815   __PYX_XDEC_MEMVIEW(&__pyx_v_right_edge, 1);
3816   __Pyx_XGIVEREF(__pyx_r);
3817   __Pyx_RefNannyFinishContext();
3818   return __pyx_r;
3819 }
3820 
3821 /* "yt/utilities/lib/amr_kdtools.pyx":76
3822  *             self.right_edge[i] = right_edge[i]
3823  *
3824  *     def create_split(self, dim, pos):             # <<<<<<<<<<<<<<
3825  *         split = <Split *> malloc(sizeof(Split))
3826  *         split.dim = dim
3827  */
3828 
3829 /* Python wrapper */
3830 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_13create_split(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3831 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_13create_split(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3832   PyObject *__pyx_v_dim = 0;
3833   PyObject *__pyx_v_pos = 0;
3834   PyObject *__pyx_r = 0;
3835   __Pyx_RefNannyDeclarations
3836   __Pyx_RefNannySetupContext("create_split (wrapper)", 0);
3837   {
3838     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dim,&__pyx_n_s_pos,0};
3839     PyObject* values[2] = {0,0};
3840     if (unlikely(__pyx_kwds)) {
3841       Py_ssize_t kw_args;
3842       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3843       switch (pos_args) {
3844         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3845         CYTHON_FALLTHROUGH;
3846         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3847         CYTHON_FALLTHROUGH;
3848         case  0: break;
3849         default: goto __pyx_L5_argtuple_error;
3850       }
3851       kw_args = PyDict_Size(__pyx_kwds);
3852       switch (pos_args) {
3853         case  0:
3854         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dim)) != 0)) kw_args--;
3855         else goto __pyx_L5_argtuple_error;
3856         CYTHON_FALLTHROUGH;
3857         case  1:
3858         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
3859         else {
3860           __Pyx_RaiseArgtupleInvalid("create_split", 1, 2, 2, 1); __PYX_ERR(0, 76, __pyx_L3_error)
3861         }
3862       }
3863       if (unlikely(kw_args > 0)) {
3864         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create_split") < 0)) __PYX_ERR(0, 76, __pyx_L3_error)
3865       }
3866     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3867       goto __pyx_L5_argtuple_error;
3868     } else {
3869       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3870       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3871     }
3872     __pyx_v_dim = values[0];
3873     __pyx_v_pos = values[1];
3874   }
3875   goto __pyx_L4_argument_unpacking_done;
3876   __pyx_L5_argtuple_error:;
3877   __Pyx_RaiseArgtupleInvalid("create_split", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 76, __pyx_L3_error)
3878   __pyx_L3_error:;
3879   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.create_split", __pyx_clineno, __pyx_lineno, __pyx_filename);
3880   __Pyx_RefNannyFinishContext();
3881   return NULL;
3882   __pyx_L4_argument_unpacking_done:;
3883   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_12create_split(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self), __pyx_v_dim, __pyx_v_pos);
3884 
3885   /* function exit code */
3886   __Pyx_RefNannyFinishContext();
3887   return __pyx_r;
3888 }
3889 
3890 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_12create_split(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_dim, PyObject *__pyx_v_pos) {
3891   struct __pyx_t_2yt_9utilities_3lib_11amr_kdtools_Split *__pyx_v_split;
3892   PyObject *__pyx_r = NULL;
3893   __Pyx_RefNannyDeclarations
3894   int __pyx_t_1;
3895   __pyx_t_5numpy_float64_t __pyx_t_2;
3896   __Pyx_RefNannySetupContext("create_split", 0);
3897 
3898   /* "yt/utilities/lib/amr_kdtools.pyx":77
3899  *
3900  *     def create_split(self, dim, pos):
3901  *         split = <Split *> malloc(sizeof(Split))             # <<<<<<<<<<<<<<
3902  *         split.dim = dim
3903  *         split.pos = pos
3904  */
3905   __pyx_v_split = ((struct __pyx_t_2yt_9utilities_3lib_11amr_kdtools_Split *)malloc((sizeof(struct __pyx_t_2yt_9utilities_3lib_11amr_kdtools_Split))));
3906 
3907   /* "yt/utilities/lib/amr_kdtools.pyx":78
3908  *     def create_split(self, dim, pos):
3909  *         split = <Split *> malloc(sizeof(Split))
3910  *         split.dim = dim             # <<<<<<<<<<<<<<
3911  *         split.pos = pos
3912  *         self.split = split
3913  */
3914   __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_dim); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L1_error)
3915   __pyx_v_split->dim = __pyx_t_1;
3916 
3917   /* "yt/utilities/lib/amr_kdtools.pyx":79
3918  *         split = <Split *> malloc(sizeof(Split))
3919  *         split.dim = dim
3920  *         split.pos = pos             # <<<<<<<<<<<<<<
3921  *         self.split = split
3922  *
3923  */
3924   __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_pos); if (unlikely((__pyx_t_2 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 79, __pyx_L1_error)
3925   __pyx_v_split->pos = __pyx_t_2;
3926 
3927   /* "yt/utilities/lib/amr_kdtools.pyx":80
3928  *         split.dim = dim
3929  *         split.pos = pos
3930  *         self.split = split             # <<<<<<<<<<<<<<
3931  *
3932  *     def __dealloc__(self):
3933  */
3934   __pyx_v_self->split = __pyx_v_split;
3935 
3936   /* "yt/utilities/lib/amr_kdtools.pyx":76
3937  *             self.right_edge[i] = right_edge[i]
3938  *
3939  *     def create_split(self, dim, pos):             # <<<<<<<<<<<<<<
3940  *         split = <Split *> malloc(sizeof(Split))
3941  *         split.dim = dim
3942  */
3943 
3944   /* function exit code */
3945   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3946   goto __pyx_L0;
3947   __pyx_L1_error:;
3948   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.create_split", __pyx_clineno, __pyx_lineno, __pyx_filename);
3949   __pyx_r = NULL;
3950   __pyx_L0:;
3951   __Pyx_XGIVEREF(__pyx_r);
3952   __Pyx_RefNannyFinishContext();
3953   return __pyx_r;
3954 }
3955 
3956 /* "yt/utilities/lib/amr_kdtools.pyx":82
3957  *         self.split = split
3958  *
3959  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
3960  *         if self.split != NULL: free(self.split)
3961  *
3962  */
3963 
3964 /* Python wrapper */
3965 static void __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_15__dealloc__(PyObject *__pyx_v_self); /*proto*/
3966 static void __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_15__dealloc__(PyObject *__pyx_v_self) {
3967   __Pyx_RefNannyDeclarations
3968   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
3969   __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_14__dealloc__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
3970 
3971   /* function exit code */
3972   __Pyx_RefNannyFinishContext();
3973 }
3974 
3975 static void __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_14__dealloc__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
3976   __Pyx_RefNannyDeclarations
3977   int __pyx_t_1;
3978   __Pyx_RefNannySetupContext("__dealloc__", 0);
3979 
3980   /* "yt/utilities/lib/amr_kdtools.pyx":83
3981  *
3982  *     def __dealloc__(self):
3983  *         if self.split != NULL: free(self.split)             # <<<<<<<<<<<<<<
3984  *
3985  *     # Begin input of converted methods
3986  */
3987   __pyx_t_1 = ((__pyx_v_self->split != NULL) != 0);
3988   if (__pyx_t_1) {
3989     free(__pyx_v_self->split);
3990   }
3991 
3992   /* "yt/utilities/lib/amr_kdtools.pyx":82
3993  *         self.split = split
3994  *
3995  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
3996  *         if self.split != NULL: free(self.split)
3997  *
3998  */
3999 
4000   /* function exit code */
4001   __Pyx_RefNannyFinishContext();
4002 }
4003 
4004 /* "yt/utilities/lib/amr_kdtools.pyx":87
4005  *     # Begin input of converted methods
4006  *
4007  *     def get_left_edge(self):             # <<<<<<<<<<<<<<
4008  *         le = np.empty(3, dtype='float64')
4009  *         for i in range(3):
4010  */
4011 
4012 /* Python wrapper */
4013 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_17get_left_edge(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
4014 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_17get_left_edge(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4015   PyObject *__pyx_r = 0;
4016   __Pyx_RefNannyDeclarations
4017   __Pyx_RefNannySetupContext("get_left_edge (wrapper)", 0);
4018   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_16get_left_edge(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
4019 
4020   /* function exit code */
4021   __Pyx_RefNannyFinishContext();
4022   return __pyx_r;
4023 }
4024 
4025 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_16get_left_edge(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
4026   PyObject *__pyx_v_le = NULL;
4027   long __pyx_v_i;
4028   PyObject *__pyx_r = NULL;
4029   __Pyx_RefNannyDeclarations
4030   PyObject *__pyx_t_1 = NULL;
4031   PyObject *__pyx_t_2 = NULL;
4032   PyObject *__pyx_t_3 = NULL;
4033   long __pyx_t_4;
4034   __Pyx_RefNannySetupContext("get_left_edge", 0);
4035 
4036   /* "yt/utilities/lib/amr_kdtools.pyx":88
4037  *
4038  *     def get_left_edge(self):
4039  *         le = np.empty(3, dtype='float64')             # <<<<<<<<<<<<<<
4040  *         for i in range(3):
4041  *             le[i] = self.left_edge[i]
4042  */
4043   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)
4044   __Pyx_GOTREF(__pyx_t_1);
4045   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error)
4046   __Pyx_GOTREF(__pyx_t_2);
4047   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4048   __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)
4049   __Pyx_GOTREF(__pyx_t_1);
4050   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 88, __pyx_L1_error)
4051   __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple_, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error)
4052   __Pyx_GOTREF(__pyx_t_3);
4053   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4054   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4055   __pyx_v_le = __pyx_t_3;
4056   __pyx_t_3 = 0;
4057 
4058   /* "yt/utilities/lib/amr_kdtools.pyx":89
4059  *     def get_left_edge(self):
4060  *         le = np.empty(3, dtype='float64')
4061  *         for i in range(3):             # <<<<<<<<<<<<<<
4062  *             le[i] = self.left_edge[i]
4063  *         return le
4064  */
4065   for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) {
4066     __pyx_v_i = __pyx_t_4;
4067 
4068     /* "yt/utilities/lib/amr_kdtools.pyx":90
4069  *         le = np.empty(3, dtype='float64')
4070  *         for i in range(3):
4071  *             le[i] = self.left_edge[i]             # <<<<<<<<<<<<<<
4072  *         return le
4073  *
4074  */
4075     __pyx_t_3 = PyFloat_FromDouble((__pyx_v_self->left_edge[__pyx_v_i])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error)
4076     __Pyx_GOTREF(__pyx_t_3);
4077     if (unlikely(__Pyx_SetItemInt(__pyx_v_le, __pyx_v_i, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 0, 0, 0) < 0)) __PYX_ERR(0, 90, __pyx_L1_error)
4078     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4079   }
4080 
4081   /* "yt/utilities/lib/amr_kdtools.pyx":91
4082  *         for i in range(3):
4083  *             le[i] = self.left_edge[i]
4084  *         return le             # <<<<<<<<<<<<<<
4085  *
4086  *     def get_right_edge(self):
4087  */
4088   __Pyx_XDECREF(__pyx_r);
4089   __Pyx_INCREF(__pyx_v_le);
4090   __pyx_r = __pyx_v_le;
4091   goto __pyx_L0;
4092 
4093   /* "yt/utilities/lib/amr_kdtools.pyx":87
4094  *     # Begin input of converted methods
4095  *
4096  *     def get_left_edge(self):             # <<<<<<<<<<<<<<
4097  *         le = np.empty(3, dtype='float64')
4098  *         for i in range(3):
4099  */
4100 
4101   /* function exit code */
4102   __pyx_L1_error:;
4103   __Pyx_XDECREF(__pyx_t_1);
4104   __Pyx_XDECREF(__pyx_t_2);
4105   __Pyx_XDECREF(__pyx_t_3);
4106   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.get_left_edge", __pyx_clineno, __pyx_lineno, __pyx_filename);
4107   __pyx_r = NULL;
4108   __pyx_L0:;
4109   __Pyx_XDECREF(__pyx_v_le);
4110   __Pyx_XGIVEREF(__pyx_r);
4111   __Pyx_RefNannyFinishContext();
4112   return __pyx_r;
4113 }
4114 
4115 /* "yt/utilities/lib/amr_kdtools.pyx":93
4116  *         return le
4117  *
4118  *     def get_right_edge(self):             # <<<<<<<<<<<<<<
4119  *         re = np.empty(3, dtype='float64')
4120  *         for i in range(3):
4121  */
4122 
4123 /* Python wrapper */
4124 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_19get_right_edge(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
4125 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_19get_right_edge(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4126   PyObject *__pyx_r = 0;
4127   __Pyx_RefNannyDeclarations
4128   __Pyx_RefNannySetupContext("get_right_edge (wrapper)", 0);
4129   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_18get_right_edge(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
4130 
4131   /* function exit code */
4132   __Pyx_RefNannyFinishContext();
4133   return __pyx_r;
4134 }
4135 
4136 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_18get_right_edge(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
4137   PyObject *__pyx_v_re = NULL;
4138   long __pyx_v_i;
4139   PyObject *__pyx_r = NULL;
4140   __Pyx_RefNannyDeclarations
4141   PyObject *__pyx_t_1 = NULL;
4142   PyObject *__pyx_t_2 = NULL;
4143   PyObject *__pyx_t_3 = NULL;
4144   long __pyx_t_4;
4145   __Pyx_RefNannySetupContext("get_right_edge", 0);
4146 
4147   /* "yt/utilities/lib/amr_kdtools.pyx":94
4148  *
4149  *     def get_right_edge(self):
4150  *         re = np.empty(3, dtype='float64')             # <<<<<<<<<<<<<<
4151  *         for i in range(3):
4152  *             re[i] = self.right_edge[i]
4153  */
4154   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error)
4155   __Pyx_GOTREF(__pyx_t_1);
4156   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error)
4157   __Pyx_GOTREF(__pyx_t_2);
4158   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4159   __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error)
4160   __Pyx_GOTREF(__pyx_t_1);
4161   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 94, __pyx_L1_error)
4162   __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple_, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error)
4163   __Pyx_GOTREF(__pyx_t_3);
4164   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4165   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4166   __pyx_v_re = __pyx_t_3;
4167   __pyx_t_3 = 0;
4168 
4169   /* "yt/utilities/lib/amr_kdtools.pyx":95
4170  *     def get_right_edge(self):
4171  *         re = np.empty(3, dtype='float64')
4172  *         for i in range(3):             # <<<<<<<<<<<<<<
4173  *             re[i] = self.right_edge[i]
4174  *         return re
4175  */
4176   for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) {
4177     __pyx_v_i = __pyx_t_4;
4178 
4179     /* "yt/utilities/lib/amr_kdtools.pyx":96
4180  *         re = np.empty(3, dtype='float64')
4181  *         for i in range(3):
4182  *             re[i] = self.right_edge[i]             # <<<<<<<<<<<<<<
4183  *         return re
4184  *
4185  */
4186     __pyx_t_3 = PyFloat_FromDouble((__pyx_v_self->right_edge[__pyx_v_i])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error)
4187     __Pyx_GOTREF(__pyx_t_3);
4188     if (unlikely(__Pyx_SetItemInt(__pyx_v_re, __pyx_v_i, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 0, 0, 0) < 0)) __PYX_ERR(0, 96, __pyx_L1_error)
4189     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4190   }
4191 
4192   /* "yt/utilities/lib/amr_kdtools.pyx":97
4193  *         for i in range(3):
4194  *             re[i] = self.right_edge[i]
4195  *         return re             # <<<<<<<<<<<<<<
4196  *
4197  *     def set_dirty(self, bint state):
4198  */
4199   __Pyx_XDECREF(__pyx_r);
4200   __Pyx_INCREF(__pyx_v_re);
4201   __pyx_r = __pyx_v_re;
4202   goto __pyx_L0;
4203 
4204   /* "yt/utilities/lib/amr_kdtools.pyx":93
4205  *         return le
4206  *
4207  *     def get_right_edge(self):             # <<<<<<<<<<<<<<
4208  *         re = np.empty(3, dtype='float64')
4209  *         for i in range(3):
4210  */
4211 
4212   /* function exit code */
4213   __pyx_L1_error:;
4214   __Pyx_XDECREF(__pyx_t_1);
4215   __Pyx_XDECREF(__pyx_t_2);
4216   __Pyx_XDECREF(__pyx_t_3);
4217   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.get_right_edge", __pyx_clineno, __pyx_lineno, __pyx_filename);
4218   __pyx_r = NULL;
4219   __pyx_L0:;
4220   __Pyx_XDECREF(__pyx_v_re);
4221   __Pyx_XGIVEREF(__pyx_r);
4222   __Pyx_RefNannyFinishContext();
4223   return __pyx_r;
4224 }
4225 
4226 /* "yt/utilities/lib/amr_kdtools.pyx":99
4227  *         return re
4228  *
4229  *     def set_dirty(self, bint state):             # <<<<<<<<<<<<<<
4230  *         cdef Node node
4231  *         for node in self.depth_traverse():
4232  */
4233 
4234 /* Python wrapper */
4235 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_21set_dirty(PyObject *__pyx_v_self, PyObject *__pyx_arg_state); /*proto*/
4236 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_21set_dirty(PyObject *__pyx_v_self, PyObject *__pyx_arg_state) {
4237   int __pyx_v_state;
4238   PyObject *__pyx_r = 0;
4239   __Pyx_RefNannyDeclarations
4240   __Pyx_RefNannySetupContext("set_dirty (wrapper)", 0);
4241   assert(__pyx_arg_state); {
4242     __pyx_v_state = __Pyx_PyObject_IsTrue(__pyx_arg_state); if (unlikely((__pyx_v_state == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 99, __pyx_L3_error)
4243   }
4244   goto __pyx_L4_argument_unpacking_done;
4245   __pyx_L3_error:;
4246   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.set_dirty", __pyx_clineno, __pyx_lineno, __pyx_filename);
4247   __Pyx_RefNannyFinishContext();
4248   return NULL;
4249   __pyx_L4_argument_unpacking_done:;
4250   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_20set_dirty(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self), ((int)__pyx_v_state));
4251 
4252   /* function exit code */
4253   __Pyx_RefNannyFinishContext();
4254   return __pyx_r;
4255 }
4256 
4257 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_20set_dirty(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, int __pyx_v_state) {
4258   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_node = 0;
4259   PyObject *__pyx_r = NULL;
4260   __Pyx_RefNannyDeclarations
4261   PyObject *__pyx_t_1 = NULL;
4262   PyObject *__pyx_t_2 = NULL;
4263   PyObject *__pyx_t_3 = NULL;
4264   Py_ssize_t __pyx_t_4;
4265   PyObject *(*__pyx_t_5)(PyObject *);
4266   __Pyx_RefNannySetupContext("set_dirty", 0);
4267 
4268   /* "yt/utilities/lib/amr_kdtools.pyx":101
4269  *     def set_dirty(self, bint state):
4270  *         cdef Node node
4271  *         for node in self.depth_traverse():             # <<<<<<<<<<<<<<
4272  *             node.dirty = state
4273  *
4274  */
4275   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_depth_traverse); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error)
4276   __Pyx_GOTREF(__pyx_t_2);
4277   __pyx_t_3 = NULL;
4278   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
4279     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
4280     if (likely(__pyx_t_3)) {
4281       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4282       __Pyx_INCREF(__pyx_t_3);
4283       __Pyx_INCREF(function);
4284       __Pyx_DECREF_SET(__pyx_t_2, function);
4285     }
4286   }
4287   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
4288   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4289   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error)
4290   __Pyx_GOTREF(__pyx_t_1);
4291   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4292   if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
4293     __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
4294     __pyx_t_5 = NULL;
4295   } else {
4296     __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error)
4297     __Pyx_GOTREF(__pyx_t_2);
4298     __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 101, __pyx_L1_error)
4299   }
4300   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4301   for (;;) {
4302     if (likely(!__pyx_t_5)) {
4303       if (likely(PyList_CheckExact(__pyx_t_2))) {
4304         if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
4305         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4306         __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 101, __pyx_L1_error)
4307         #else
4308         __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error)
4309         __Pyx_GOTREF(__pyx_t_1);
4310         #endif
4311       } else {
4312         if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
4313         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4314         __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 101, __pyx_L1_error)
4315         #else
4316         __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error)
4317         __Pyx_GOTREF(__pyx_t_1);
4318         #endif
4319       }
4320     } else {
4321       __pyx_t_1 = __pyx_t_5(__pyx_t_2);
4322       if (unlikely(!__pyx_t_1)) {
4323         PyObject* exc_type = PyErr_Occurred();
4324         if (exc_type) {
4325           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4326           else __PYX_ERR(0, 101, __pyx_L1_error)
4327         }
4328         break;
4329       }
4330       __Pyx_GOTREF(__pyx_t_1);
4331     }
4332     if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_2yt_9utilities_3lib_11amr_kdtools_Node))))) __PYX_ERR(0, 101, __pyx_L1_error)
4333     __Pyx_XDECREF_SET(__pyx_v_node, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_1));
4334     __pyx_t_1 = 0;
4335 
4336     /* "yt/utilities/lib/amr_kdtools.pyx":102
4337  *         cdef Node node
4338  *         for node in self.depth_traverse():
4339  *             node.dirty = state             # <<<<<<<<<<<<<<
4340  *
4341  *     def kd_traverse(self, viewpoint=None):
4342  */
4343     __pyx_v_node->dirty = __pyx_v_state;
4344 
4345     /* "yt/utilities/lib/amr_kdtools.pyx":101
4346  *     def set_dirty(self, bint state):
4347  *         cdef Node node
4348  *         for node in self.depth_traverse():             # <<<<<<<<<<<<<<
4349  *             node.dirty = state
4350  *
4351  */
4352   }
4353   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4354 
4355   /* "yt/utilities/lib/amr_kdtools.pyx":99
4356  *         return re
4357  *
4358  *     def set_dirty(self, bint state):             # <<<<<<<<<<<<<<
4359  *         cdef Node node
4360  *         for node in self.depth_traverse():
4361  */
4362 
4363   /* function exit code */
4364   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4365   goto __pyx_L0;
4366   __pyx_L1_error:;
4367   __Pyx_XDECREF(__pyx_t_1);
4368   __Pyx_XDECREF(__pyx_t_2);
4369   __Pyx_XDECREF(__pyx_t_3);
4370   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.set_dirty", __pyx_clineno, __pyx_lineno, __pyx_filename);
4371   __pyx_r = NULL;
4372   __pyx_L0:;
4373   __Pyx_XDECREF((PyObject *)__pyx_v_node);
4374   __Pyx_XGIVEREF(__pyx_r);
4375   __Pyx_RefNannyFinishContext();
4376   return __pyx_r;
4377 }
4378 static PyObject *__pyx_gb_2yt_9utilities_3lib_11amr_kdtools_4Node_24generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
4379 
4380 /* "yt/utilities/lib/amr_kdtools.pyx":104
4381  *             node.dirty = state
4382  *
4383  *     def kd_traverse(self, viewpoint=None):             # <<<<<<<<<<<<<<
4384  *         cdef Node node
4385  *         if viewpoint is None:
4386  */
4387 
4388 /* Python wrapper */
4389 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_23kd_traverse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4390 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_23kd_traverse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4391   PyObject *__pyx_v_viewpoint = 0;
4392   PyObject *__pyx_r = 0;
4393   __Pyx_RefNannyDeclarations
4394   __Pyx_RefNannySetupContext("kd_traverse (wrapper)", 0);
4395   {
4396     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_viewpoint,0};
4397     PyObject* values[1] = {0};
4398     values[0] = ((PyObject *)Py_None);
4399     if (unlikely(__pyx_kwds)) {
4400       Py_ssize_t kw_args;
4401       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4402       switch (pos_args) {
4403         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4404         CYTHON_FALLTHROUGH;
4405         case  0: break;
4406         default: goto __pyx_L5_argtuple_error;
4407       }
4408       kw_args = PyDict_Size(__pyx_kwds);
4409       switch (pos_args) {
4410         case  0:
4411         if (kw_args > 0) {
4412           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_viewpoint);
4413           if (value) { values[0] = value; kw_args--; }
4414         }
4415       }
4416       if (unlikely(kw_args > 0)) {
4417         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "kd_traverse") < 0)) __PYX_ERR(0, 104, __pyx_L3_error)
4418       }
4419     } else {
4420       switch (PyTuple_GET_SIZE(__pyx_args)) {
4421         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4422         CYTHON_FALLTHROUGH;
4423         case  0: break;
4424         default: goto __pyx_L5_argtuple_error;
4425       }
4426     }
4427     __pyx_v_viewpoint = values[0];
4428   }
4429   goto __pyx_L4_argument_unpacking_done;
4430   __pyx_L5_argtuple_error:;
4431   __Pyx_RaiseArgtupleInvalid("kd_traverse", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 104, __pyx_L3_error)
4432   __pyx_L3_error:;
4433   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.kd_traverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
4434   __Pyx_RefNannyFinishContext();
4435   return NULL;
4436   __pyx_L4_argument_unpacking_done:;
4437   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_22kd_traverse(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self), __pyx_v_viewpoint);
4438 
4439   /* function exit code */
4440   __Pyx_RefNannyFinishContext();
4441   return __pyx_r;
4442 }
4443 
4444 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_22kd_traverse(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_viewpoint) {
4445   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse *__pyx_cur_scope;
4446   PyObject *__pyx_r = NULL;
4447   __Pyx_RefNannyDeclarations
4448   __Pyx_RefNannySetupContext("kd_traverse", 0);
4449   __pyx_cur_scope = (struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse *)__pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse(__pyx_ptype_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse, __pyx_empty_tuple, NULL);
4450   if (unlikely(!__pyx_cur_scope)) {
4451     __pyx_cur_scope = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse *)Py_None);
4452     __Pyx_INCREF(Py_None);
4453     __PYX_ERR(0, 104, __pyx_L1_error)
4454   } else {
4455     __Pyx_GOTREF(__pyx_cur_scope);
4456   }
4457   __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
4458   __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
4459   __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
4460   __pyx_cur_scope->__pyx_v_viewpoint = __pyx_v_viewpoint;
4461   __Pyx_INCREF(__pyx_cur_scope->__pyx_v_viewpoint);
4462   __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_viewpoint);
4463   {
4464     __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_2yt_9utilities_3lib_11amr_kdtools_4Node_24generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_kd_traverse, __pyx_n_s_Node_kd_traverse, __pyx_n_s_yt_utilities_lib_amr_kdtools); if (unlikely(!gen)) __PYX_ERR(0, 104, __pyx_L1_error)
4465     __Pyx_DECREF(__pyx_cur_scope);
4466     __Pyx_RefNannyFinishContext();
4467     return (PyObject *) gen;
4468   }
4469 
4470   /* function exit code */
4471   __pyx_L1_error:;
4472   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.kd_traverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
4473   __pyx_r = NULL;
4474   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
4475   __Pyx_XGIVEREF(__pyx_r);
4476   __Pyx_RefNannyFinishContext();
4477   return __pyx_r;
4478 }
4479 
4480 static PyObject *__pyx_gb_2yt_9utilities_3lib_11amr_kdtools_4Node_24generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
4481 {
4482   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse *__pyx_cur_scope = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse *)__pyx_generator->closure);
4483   PyObject *__pyx_r = NULL;
4484   int __pyx_t_1;
4485   int __pyx_t_2;
4486   PyObject *__pyx_t_3 = NULL;
4487   PyObject *__pyx_t_4 = NULL;
4488   PyObject *__pyx_t_5 = NULL;
4489   Py_ssize_t __pyx_t_6;
4490   PyObject *(*__pyx_t_7)(PyObject *);
4491   __Pyx_RefNannyDeclarations
4492   __Pyx_RefNannySetupContext("kd_traverse", 0);
4493   switch (__pyx_generator->resume_label) {
4494     case 0: goto __pyx_L3_first_run;
4495     case 1: goto __pyx_L10_resume_from_yield;
4496     case 2: goto __pyx_L16_resume_from_yield;
4497     default: /* CPython raises the right error here */
4498     __Pyx_RefNannyFinishContext();
4499     return NULL;
4500   }
4501   __pyx_L3_first_run:;
4502   if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 104, __pyx_L1_error)
4503 
4504   /* "yt/utilities/lib/amr_kdtools.pyx":106
4505  *     def kd_traverse(self, viewpoint=None):
4506  *         cdef Node node
4507  *         if viewpoint is None:             # <<<<<<<<<<<<<<
4508  *             for node in self.depth_traverse():
4509  *                 if node._kd_is_leaf() == 1 and node.grid != -1:
4510  */
4511   __pyx_t_1 = (__pyx_cur_scope->__pyx_v_viewpoint == Py_None);
4512   __pyx_t_2 = (__pyx_t_1 != 0);
4513   if (__pyx_t_2) {
4514 
4515     /* "yt/utilities/lib/amr_kdtools.pyx":107
4516  *         cdef Node node
4517  *         if viewpoint is None:
4518  *             for node in self.depth_traverse():             # <<<<<<<<<<<<<<
4519  *                 if node._kd_is_leaf() == 1 and node.grid != -1:
4520  *                     yield node
4521  */
4522     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_depth_traverse); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 107, __pyx_L1_error)
4523     __Pyx_GOTREF(__pyx_t_4);
4524     __pyx_t_5 = NULL;
4525     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
4526       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
4527       if (likely(__pyx_t_5)) {
4528         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4529         __Pyx_INCREF(__pyx_t_5);
4530         __Pyx_INCREF(function);
4531         __Pyx_DECREF_SET(__pyx_t_4, function);
4532       }
4533     }
4534     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
4535     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4536     if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __pyx_L1_error)
4537     __Pyx_GOTREF(__pyx_t_3);
4538     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4539     if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
4540       __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
4541       __pyx_t_7 = NULL;
4542     } else {
4543       __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 107, __pyx_L1_error)
4544       __Pyx_GOTREF(__pyx_t_4);
4545       __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 107, __pyx_L1_error)
4546     }
4547     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4548     for (;;) {
4549       if (likely(!__pyx_t_7)) {
4550         if (likely(PyList_CheckExact(__pyx_t_4))) {
4551           if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
4552           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4553           __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 107, __pyx_L1_error)
4554           #else
4555           __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __pyx_L1_error)
4556           __Pyx_GOTREF(__pyx_t_3);
4557           #endif
4558         } else {
4559           if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
4560           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4561           __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 107, __pyx_L1_error)
4562           #else
4563           __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __pyx_L1_error)
4564           __Pyx_GOTREF(__pyx_t_3);
4565           #endif
4566         }
4567       } else {
4568         __pyx_t_3 = __pyx_t_7(__pyx_t_4);
4569         if (unlikely(!__pyx_t_3)) {
4570           PyObject* exc_type = PyErr_Occurred();
4571           if (exc_type) {
4572             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4573             else __PYX_ERR(0, 107, __pyx_L1_error)
4574           }
4575           break;
4576         }
4577         __Pyx_GOTREF(__pyx_t_3);
4578       }
4579       if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_2yt_9utilities_3lib_11amr_kdtools_Node))))) __PYX_ERR(0, 107, __pyx_L1_error)
4580       __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_node));
4581       __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_node, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_3));
4582       __Pyx_GIVEREF(__pyx_t_3);
4583       __pyx_t_3 = 0;
4584 
4585       /* "yt/utilities/lib/amr_kdtools.pyx":108
4586  *         if viewpoint is None:
4587  *             for node in self.depth_traverse():
4588  *                 if node._kd_is_leaf() == 1 and node.grid != -1:             # <<<<<<<<<<<<<<
4589  *                     yield node
4590  *         else:
4591  */
4592       __pyx_t_1 = ((((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_cur_scope->__pyx_v_node->__pyx_vtab)->_kd_is_leaf(__pyx_cur_scope->__pyx_v_node) == 1) != 0);
4593       if (__pyx_t_1) {
4594       } else {
4595         __pyx_t_2 = __pyx_t_1;
4596         goto __pyx_L8_bool_binop_done;
4597       }
4598       __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_node->grid != -1L) != 0);
4599       __pyx_t_2 = __pyx_t_1;
4600       __pyx_L8_bool_binop_done:;
4601       if (__pyx_t_2) {
4602 
4603         /* "yt/utilities/lib/amr_kdtools.pyx":109
4604  *             for node in self.depth_traverse():
4605  *                 if node._kd_is_leaf() == 1 and node.grid != -1:
4606  *                     yield node             # <<<<<<<<<<<<<<
4607  *         else:
4608  *             for node in self.viewpoint_traverse(viewpoint):
4609  */
4610         __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_node));
4611         __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_node);
4612         __Pyx_XGIVEREF(__pyx_t_4);
4613         __pyx_cur_scope->__pyx_t_0 = __pyx_t_4;
4614         __pyx_cur_scope->__pyx_t_1 = __pyx_t_6;
4615         __pyx_cur_scope->__pyx_t_2 = __pyx_t_7;
4616         __Pyx_XGIVEREF(__pyx_r);
4617         __Pyx_RefNannyFinishContext();
4618         __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
4619         /* return from generator, yielding value */
4620         __pyx_generator->resume_label = 1;
4621         return __pyx_r;
4622         __pyx_L10_resume_from_yield:;
4623         __pyx_t_4 = __pyx_cur_scope->__pyx_t_0;
4624         __pyx_cur_scope->__pyx_t_0 = 0;
4625         __Pyx_XGOTREF(__pyx_t_4);
4626         __pyx_t_6 = __pyx_cur_scope->__pyx_t_1;
4627         __pyx_t_7 = __pyx_cur_scope->__pyx_t_2;
4628         if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 109, __pyx_L1_error)
4629 
4630         /* "yt/utilities/lib/amr_kdtools.pyx":108
4631  *         if viewpoint is None:
4632  *             for node in self.depth_traverse():
4633  *                 if node._kd_is_leaf() == 1 and node.grid != -1:             # <<<<<<<<<<<<<<
4634  *                     yield node
4635  *         else:
4636  */
4637       }
4638 
4639       /* "yt/utilities/lib/amr_kdtools.pyx":107
4640  *         cdef Node node
4641  *         if viewpoint is None:
4642  *             for node in self.depth_traverse():             # <<<<<<<<<<<<<<
4643  *                 if node._kd_is_leaf() == 1 and node.grid != -1:
4644  *                     yield node
4645  */
4646     }
4647     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4648 
4649     /* "yt/utilities/lib/amr_kdtools.pyx":106
4650  *     def kd_traverse(self, viewpoint=None):
4651  *         cdef Node node
4652  *         if viewpoint is None:             # <<<<<<<<<<<<<<
4653  *             for node in self.depth_traverse():
4654  *                 if node._kd_is_leaf() == 1 and node.grid != -1:
4655  */
4656     goto __pyx_L4;
4657   }
4658 
4659   /* "yt/utilities/lib/amr_kdtools.pyx":111
4660  *                     yield node
4661  *         else:
4662  *             for node in self.viewpoint_traverse(viewpoint):             # <<<<<<<<<<<<<<
4663  *                 if node._kd_is_leaf() == 1 and node.grid != -1:
4664  *                     yield node
4665  */
4666   /*else*/ {
4667     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_viewpoint_traverse); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error)
4668     __Pyx_GOTREF(__pyx_t_3);
4669     __pyx_t_5 = NULL;
4670     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
4671       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
4672       if (likely(__pyx_t_5)) {
4673         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
4674         __Pyx_INCREF(__pyx_t_5);
4675         __Pyx_INCREF(function);
4676         __Pyx_DECREF_SET(__pyx_t_3, function);
4677       }
4678     }
4679     __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_cur_scope->__pyx_v_viewpoint) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_cur_scope->__pyx_v_viewpoint);
4680     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4681     if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L1_error)
4682     __Pyx_GOTREF(__pyx_t_4);
4683     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4684     if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
4685       __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0;
4686       __pyx_t_7 = NULL;
4687     } else {
4688       __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error)
4689       __Pyx_GOTREF(__pyx_t_3);
4690       __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 111, __pyx_L1_error)
4691     }
4692     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4693     for (;;) {
4694       if (likely(!__pyx_t_7)) {
4695         if (likely(PyList_CheckExact(__pyx_t_3))) {
4696           if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break;
4697           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4698           __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 111, __pyx_L1_error)
4699           #else
4700           __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L1_error)
4701           __Pyx_GOTREF(__pyx_t_4);
4702           #endif
4703         } else {
4704           if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
4705           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4706           __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 111, __pyx_L1_error)
4707           #else
4708           __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L1_error)
4709           __Pyx_GOTREF(__pyx_t_4);
4710           #endif
4711         }
4712       } else {
4713         __pyx_t_4 = __pyx_t_7(__pyx_t_3);
4714         if (unlikely(!__pyx_t_4)) {
4715           PyObject* exc_type = PyErr_Occurred();
4716           if (exc_type) {
4717             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4718             else __PYX_ERR(0, 111, __pyx_L1_error)
4719           }
4720           break;
4721         }
4722         __Pyx_GOTREF(__pyx_t_4);
4723       }
4724       if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_2yt_9utilities_3lib_11amr_kdtools_Node))))) __PYX_ERR(0, 111, __pyx_L1_error)
4725       __Pyx_XGOTREF(((PyObject *)__pyx_cur_scope->__pyx_v_node));
4726       __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_node, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_4));
4727       __Pyx_GIVEREF(__pyx_t_4);
4728       __pyx_t_4 = 0;
4729 
4730       /* "yt/utilities/lib/amr_kdtools.pyx":112
4731  *         else:
4732  *             for node in self.viewpoint_traverse(viewpoint):
4733  *                 if node._kd_is_leaf() == 1 and node.grid != -1:             # <<<<<<<<<<<<<<
4734  *                     yield node
4735  *
4736  */
4737       __pyx_t_1 = ((((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_cur_scope->__pyx_v_node->__pyx_vtab)->_kd_is_leaf(__pyx_cur_scope->__pyx_v_node) == 1) != 0);
4738       if (__pyx_t_1) {
4739       } else {
4740         __pyx_t_2 = __pyx_t_1;
4741         goto __pyx_L14_bool_binop_done;
4742       }
4743       __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_node->grid != -1L) != 0);
4744       __pyx_t_2 = __pyx_t_1;
4745       __pyx_L14_bool_binop_done:;
4746       if (__pyx_t_2) {
4747 
4748         /* "yt/utilities/lib/amr_kdtools.pyx":113
4749  *             for node in self.viewpoint_traverse(viewpoint):
4750  *                 if node._kd_is_leaf() == 1 and node.grid != -1:
4751  *                     yield node             # <<<<<<<<<<<<<<
4752  *
4753  *     def add_pygrid(self,
4754  */
4755         __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_node));
4756         __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_node);
4757         __Pyx_XGIVEREF(__pyx_t_3);
4758         __pyx_cur_scope->__pyx_t_0 = __pyx_t_3;
4759         __pyx_cur_scope->__pyx_t_1 = __pyx_t_6;
4760         __pyx_cur_scope->__pyx_t_2 = __pyx_t_7;
4761         __Pyx_XGIVEREF(__pyx_r);
4762         __Pyx_RefNannyFinishContext();
4763         __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
4764         /* return from generator, yielding value */
4765         __pyx_generator->resume_label = 2;
4766         return __pyx_r;
4767         __pyx_L16_resume_from_yield:;
4768         __pyx_t_3 = __pyx_cur_scope->__pyx_t_0;
4769         __pyx_cur_scope->__pyx_t_0 = 0;
4770         __Pyx_XGOTREF(__pyx_t_3);
4771         __pyx_t_6 = __pyx_cur_scope->__pyx_t_1;
4772         __pyx_t_7 = __pyx_cur_scope->__pyx_t_2;
4773         if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 113, __pyx_L1_error)
4774 
4775         /* "yt/utilities/lib/amr_kdtools.pyx":112
4776  *         else:
4777  *             for node in self.viewpoint_traverse(viewpoint):
4778  *                 if node._kd_is_leaf() == 1 and node.grid != -1:             # <<<<<<<<<<<<<<
4779  *                     yield node
4780  *
4781  */
4782       }
4783 
4784       /* "yt/utilities/lib/amr_kdtools.pyx":111
4785  *                     yield node
4786  *         else:
4787  *             for node in self.viewpoint_traverse(viewpoint):             # <<<<<<<<<<<<<<
4788  *                 if node._kd_is_leaf() == 1 and node.grid != -1:
4789  *                     yield node
4790  */
4791     }
4792     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4793   }
4794   __pyx_L4:;
4795   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
4796 
4797   /* "yt/utilities/lib/amr_kdtools.pyx":104
4798  *             node.dirty = state
4799  *
4800  *     def kd_traverse(self, viewpoint=None):             # <<<<<<<<<<<<<<
4801  *         cdef Node node
4802  *         if viewpoint is None:
4803  */
4804 
4805   /* function exit code */
4806   PyErr_SetNone(PyExc_StopIteration);
4807   goto __pyx_L0;
4808   __pyx_L1_error:;
4809   __Pyx_XDECREF(__pyx_t_3);
4810   __Pyx_XDECREF(__pyx_t_4);
4811   __Pyx_XDECREF(__pyx_t_5);
4812   __Pyx_AddTraceback("kd_traverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
4813   __pyx_L0:;
4814   __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
4815   #if !CYTHON_USE_EXC_INFO_STACK
4816   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
4817   #endif
4818   __pyx_generator->resume_label = -1;
4819   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
4820   __Pyx_RefNannyFinishContext();
4821   return __pyx_r;
4822 }
4823 
4824 /* "yt/utilities/lib/amr_kdtools.pyx":115
4825  *                     yield node
4826  *
4827  *     def add_pygrid(self,             # <<<<<<<<<<<<<<
4828  *                        np.float64_t[:] gle,
4829  *                        np.float64_t[:] gre,
4830  */
4831 
4832 /* Python wrapper */
4833 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_26add_pygrid(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4834 static char __pyx_doc_2yt_9utilities_3lib_11amr_kdtools_4Node_25add_pygrid[] = "\n        The entire purpose of this function is to move everything from ndarrays\n        to internal C pointers.\n        ";
4835 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_26add_pygrid(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4836   __Pyx_memviewslice __pyx_v_gle = { 0, 0, { 0 }, { 0 }, { 0 } };
4837   __Pyx_memviewslice __pyx_v_gre = { 0, 0, { 0 }, { 0 }, { 0 } };
4838   int __pyx_v_gid;
4839   int __pyx_v_rank;
4840   int __pyx_v_size;
4841   PyObject *__pyx_r = 0;
4842   __Pyx_RefNannyDeclarations
4843   __Pyx_RefNannySetupContext("add_pygrid (wrapper)", 0);
4844   {
4845     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gle,&__pyx_n_s_gre,&__pyx_n_s_gid,&__pyx_n_s_rank,&__pyx_n_s_size,0};
4846     PyObject* values[5] = {0,0,0,0,0};
4847     if (unlikely(__pyx_kwds)) {
4848       Py_ssize_t kw_args;
4849       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4850       switch (pos_args) {
4851         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4852         CYTHON_FALLTHROUGH;
4853         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4854         CYTHON_FALLTHROUGH;
4855         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4856         CYTHON_FALLTHROUGH;
4857         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4858         CYTHON_FALLTHROUGH;
4859         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4860         CYTHON_FALLTHROUGH;
4861         case  0: break;
4862         default: goto __pyx_L5_argtuple_error;
4863       }
4864       kw_args = PyDict_Size(__pyx_kwds);
4865       switch (pos_args) {
4866         case  0:
4867         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gle)) != 0)) kw_args--;
4868         else goto __pyx_L5_argtuple_error;
4869         CYTHON_FALLTHROUGH;
4870         case  1:
4871         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gre)) != 0)) kw_args--;
4872         else {
4873           __Pyx_RaiseArgtupleInvalid("add_pygrid", 1, 5, 5, 1); __PYX_ERR(0, 115, __pyx_L3_error)
4874         }
4875         CYTHON_FALLTHROUGH;
4876         case  2:
4877         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gid)) != 0)) kw_args--;
4878         else {
4879           __Pyx_RaiseArgtupleInvalid("add_pygrid", 1, 5, 5, 2); __PYX_ERR(0, 115, __pyx_L3_error)
4880         }
4881         CYTHON_FALLTHROUGH;
4882         case  3:
4883         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rank)) != 0)) kw_args--;
4884         else {
4885           __Pyx_RaiseArgtupleInvalid("add_pygrid", 1, 5, 5, 3); __PYX_ERR(0, 115, __pyx_L3_error)
4886         }
4887         CYTHON_FALLTHROUGH;
4888         case  4:
4889         if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--;
4890         else {
4891           __Pyx_RaiseArgtupleInvalid("add_pygrid", 1, 5, 5, 4); __PYX_ERR(0, 115, __pyx_L3_error)
4892         }
4893       }
4894       if (unlikely(kw_args > 0)) {
4895         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_pygrid") < 0)) __PYX_ERR(0, 115, __pyx_L3_error)
4896       }
4897     } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
4898       goto __pyx_L5_argtuple_error;
4899     } else {
4900       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4901       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4902       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4903       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4904       values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4905     }
4906     __pyx_v_gle = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_gle.memview)) __PYX_ERR(0, 116, __pyx_L3_error)
4907     __pyx_v_gre = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_gre.memview)) __PYX_ERR(0, 117, __pyx_L3_error)
4908     __pyx_v_gid = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_gid == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L3_error)
4909     __pyx_v_rank = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_rank == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L3_error)
4910     __pyx_v_size = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L3_error)
4911   }
4912   goto __pyx_L4_argument_unpacking_done;
4913   __pyx_L5_argtuple_error:;
4914   __Pyx_RaiseArgtupleInvalid("add_pygrid", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 115, __pyx_L3_error)
4915   __pyx_L3_error:;
4916   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.add_pygrid", __pyx_clineno, __pyx_lineno, __pyx_filename);
4917   __Pyx_RefNannyFinishContext();
4918   return NULL;
4919   __pyx_L4_argument_unpacking_done:;
4920   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_25add_pygrid(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self), __pyx_v_gle, __pyx_v_gre, __pyx_v_gid, __pyx_v_rank, __pyx_v_size);
4921 
4922   /* function exit code */
4923   __Pyx_RefNannyFinishContext();
4924   return __pyx_r;
4925 }
4926 
4927 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_25add_pygrid(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, __Pyx_memviewslice __pyx_v_gle, __Pyx_memviewslice __pyx_v_gre, int __pyx_v_gid, int __pyx_v_rank, int __pyx_v_size) {
4928   __Pyx_memviewslice __pyx_v_pgles = { 0, 0, { 0 }, { 0 }, { 0 } };
4929   __Pyx_memviewslice __pyx_v_pgres = { 0, 0, { 0 }, { 0 }, { 0 } };
4930   int __pyx_v_j;
4931   PyObject *__pyx_r = NULL;
4932   __Pyx_RefNannyDeclarations
4933   PyObject *__pyx_t_1 = NULL;
4934   PyObject *__pyx_t_2 = NULL;
4935   __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
4936   int __pyx_t_4;
4937   Py_ssize_t __pyx_t_5;
4938   Py_ssize_t __pyx_t_6;
4939   Py_ssize_t __pyx_t_7;
4940   Py_ssize_t __pyx_t_8;
4941   __Pyx_RefNannySetupContext("add_pygrid", 0);
4942 
4943   /* "yt/utilities/lib/amr_kdtools.pyx":126
4944  *         to internal C pointers.
4945  *         """
4946  *         cdef np.float64_t[:] pgles = cvarray(format="d", shape=(3,), itemsize=sizeof(np.float64_t))             # <<<<<<<<<<<<<<
4947  *         cdef np.float64_t[:] pgres = cvarray(format="d", shape=(3,), itemsize=sizeof(np.float64_t))
4948  *         cdef int j
4949  */
4950   __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error)
4951   __Pyx_GOTREF(__pyx_t_1);
4952   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 126, __pyx_L1_error)
4953   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_shape, __pyx_tuple_) < 0) __PYX_ERR(0, 126, __pyx_L1_error)
4954   __pyx_t_2 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_float64_t))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L1_error)
4955   __Pyx_GOTREF(__pyx_t_2);
4956   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_itemsize, __pyx_t_2) < 0) __PYX_ERR(0, 126, __pyx_L1_error)
4957   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4958   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L1_error)
4959   __Pyx_GOTREF(__pyx_t_2);
4960   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4961   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 126, __pyx_L1_error)
4962   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4963   __pyx_v_pgles = __pyx_t_3;
4964   __pyx_t_3.memview = NULL;
4965   __pyx_t_3.data = NULL;
4966 
4967   /* "yt/utilities/lib/amr_kdtools.pyx":127
4968  *         """
4969  *         cdef np.float64_t[:] pgles = cvarray(format="d", shape=(3,), itemsize=sizeof(np.float64_t))
4970  *         cdef np.float64_t[:] pgres = cvarray(format="d", shape=(3,), itemsize=sizeof(np.float64_t))             # <<<<<<<<<<<<<<
4971  *         cdef int j
4972  *         for j in range(3):
4973  */
4974   __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __pyx_L1_error)
4975   __Pyx_GOTREF(__pyx_t_2);
4976   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 127, __pyx_L1_error)
4977   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_shape, __pyx_tuple_) < 0) __PYX_ERR(0, 127, __pyx_L1_error)
4978   __pyx_t_1 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_float64_t))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error)
4979   __Pyx_GOTREF(__pyx_t_1);
4980   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_itemsize, __pyx_t_1) < 0) __PYX_ERR(0, 127, __pyx_L1_error)
4981   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4982   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error)
4983   __Pyx_GOTREF(__pyx_t_1);
4984   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4985   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 127, __pyx_L1_error)
4986   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4987   __pyx_v_pgres = __pyx_t_3;
4988   __pyx_t_3.memview = NULL;
4989   __pyx_t_3.data = NULL;
4990 
4991   /* "yt/utilities/lib/amr_kdtools.pyx":129
4992  *         cdef np.float64_t[:] pgres = cvarray(format="d", shape=(3,), itemsize=sizeof(np.float64_t))
4993  *         cdef int j
4994  *         for j in range(3):             # <<<<<<<<<<<<<<
4995  *             pgles[j] = gle[j]
4996  *             pgres[j] = gre[j]
4997  */
4998   for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) {
4999     __pyx_v_j = __pyx_t_4;
5000 
5001     /* "yt/utilities/lib/amr_kdtools.pyx":130
5002  *         cdef int j
5003  *         for j in range(3):
5004  *             pgles[j] = gle[j]             # <<<<<<<<<<<<<<
5005  *             pgres[j] = gre[j]
5006  *
5007  */
5008     __pyx_t_5 = __pyx_v_j;
5009     __pyx_t_6 = __pyx_v_j;
5010     *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_pgles.data + __pyx_t_6 * __pyx_v_pgles.strides[0]) )) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_gle.data + __pyx_t_5 * __pyx_v_gle.strides[0]) )));
5011 
5012     /* "yt/utilities/lib/amr_kdtools.pyx":131
5013  *         for j in range(3):
5014  *             pgles[j] = gle[j]
5015  *             pgres[j] = gre[j]             # <<<<<<<<<<<<<<
5016  *
5017  *         self.add_grid(pgles, pgres, gid, rank, size)
5018  */
5019     __pyx_t_7 = __pyx_v_j;
5020     __pyx_t_8 = __pyx_v_j;
5021     *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_pgres.data + __pyx_t_8 * __pyx_v_pgres.strides[0]) )) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_gre.data + __pyx_t_7 * __pyx_v_gre.strides[0]) )));
5022   }
5023 
5024   /* "yt/utilities/lib/amr_kdtools.pyx":133
5025  *             pgres[j] = gre[j]
5026  *
5027  *         self.add_grid(pgles, pgres, gid, rank, size)             # <<<<<<<<<<<<<<
5028  *
5029  *     @cython.boundscheck(False)
5030  */
5031   __pyx_t_1 = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->__pyx_vtab)->add_grid(__pyx_v_self, __pyx_v_pgles, __pyx_v_pgres, __pyx_v_gid, __pyx_v_rank, __pyx_v_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error)
5032   __Pyx_GOTREF(__pyx_t_1);
5033   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5034 
5035   /* "yt/utilities/lib/amr_kdtools.pyx":115
5036  *                     yield node
5037  *
5038  *     def add_pygrid(self,             # <<<<<<<<<<<<<<
5039  *                        np.float64_t[:] gle,
5040  *                        np.float64_t[:] gre,
5041  */
5042 
5043   /* function exit code */
5044   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5045   goto __pyx_L0;
5046   __pyx_L1_error:;
5047   __Pyx_XDECREF(__pyx_t_1);
5048   __Pyx_XDECREF(__pyx_t_2);
5049   __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
5050   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.add_pygrid", __pyx_clineno, __pyx_lineno, __pyx_filename);
5051   __pyx_r = NULL;
5052   __pyx_L0:;
5053   __PYX_XDEC_MEMVIEW(&__pyx_v_pgles, 1);
5054   __PYX_XDEC_MEMVIEW(&__pyx_v_pgres, 1);
5055   __PYX_XDEC_MEMVIEW(&__pyx_v_gle, 1);
5056   __PYX_XDEC_MEMVIEW(&__pyx_v_gre, 1);
5057   __Pyx_XGIVEREF(__pyx_r);
5058   __Pyx_RefNannyFinishContext();
5059   return __pyx_r;
5060 }
5061 
5062 /* "yt/utilities/lib/amr_kdtools.pyx":138
5063  *     @cython.wraparound(False)
5064  *     @cython.cdivision(True)
5065  *     cdef add_grid(self,             # <<<<<<<<<<<<<<
5066  *                        np.float64_t[:] gle,
5067  *                        np.float64_t[:] gre,
5068  */
5069 
5070 static PyObject *__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_add_grid(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, __Pyx_memviewslice __pyx_v_gle, __Pyx_memviewslice __pyx_v_gre, int __pyx_v_gid, int __pyx_v_rank, int __pyx_v_size) {
5071   PyObject *__pyx_v_less_id = NULL;
5072   PyObject *__pyx_v_greater_id = NULL;
5073   PyObject *__pyx_r = NULL;
5074   __Pyx_RefNannyDeclarations
5075   int __pyx_t_1;
5076   PyObject *__pyx_t_2 = NULL;
5077   Py_ssize_t __pyx_t_3;
5078   Py_ssize_t __pyx_t_4;
5079   __Pyx_RefNannySetupContext("add_grid", 0);
5080 
5081   /* "yt/utilities/lib/amr_kdtools.pyx":145
5082  *                        int size):
5083  *
5084  *         if not should_i_build(self, rank, size):             # <<<<<<<<<<<<<<
5085  *             return
5086  *
5087  */
5088   __pyx_t_1 = ((!(__pyx_f_2yt_9utilities_3lib_11amr_kdtools_should_i_build(__pyx_v_self, __pyx_v_rank, __pyx_v_size) != 0)) != 0);
5089   if (__pyx_t_1) {
5090 
5091     /* "yt/utilities/lib/amr_kdtools.pyx":146
5092  *
5093  *         if not should_i_build(self, rank, size):
5094  *             return             # <<<<<<<<<<<<<<
5095  *
5096  *         if self._kd_is_leaf() == 1:
5097  */
5098     __Pyx_XDECREF(__pyx_r);
5099     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5100     goto __pyx_L0;
5101 
5102     /* "yt/utilities/lib/amr_kdtools.pyx":145
5103  *                        int size):
5104  *
5105  *         if not should_i_build(self, rank, size):             # <<<<<<<<<<<<<<
5106  *             return
5107  *
5108  */
5109   }
5110 
5111   /* "yt/utilities/lib/amr_kdtools.pyx":148
5112  *             return
5113  *
5114  *         if self._kd_is_leaf() == 1:             # <<<<<<<<<<<<<<
5115  *             self.insert_grid(gle, gre, gid, rank, size)
5116  *         else:
5117  */
5118   __pyx_t_1 = ((((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->__pyx_vtab)->_kd_is_leaf(__pyx_v_self) == 1) != 0);
5119   if (__pyx_t_1) {
5120 
5121     /* "yt/utilities/lib/amr_kdtools.pyx":149
5122  *
5123  *         if self._kd_is_leaf() == 1:
5124  *             self.insert_grid(gle, gre, gid, rank, size)             # <<<<<<<<<<<<<<
5125  *         else:
5126  *             less_id = gle[self.split.dim] < self.split.pos
5127  */
5128     __pyx_t_2 = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->__pyx_vtab)->insert_grid(__pyx_v_self, __pyx_v_gle, __pyx_v_gre, __pyx_v_gid, __pyx_v_rank, __pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error)
5129     __Pyx_GOTREF(__pyx_t_2);
5130     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5131 
5132     /* "yt/utilities/lib/amr_kdtools.pyx":148
5133  *             return
5134  *
5135  *         if self._kd_is_leaf() == 1:             # <<<<<<<<<<<<<<
5136  *             self.insert_grid(gle, gre, gid, rank, size)
5137  *         else:
5138  */
5139     goto __pyx_L4;
5140   }
5141 
5142   /* "yt/utilities/lib/amr_kdtools.pyx":151
5143  *             self.insert_grid(gle, gre, gid, rank, size)
5144  *         else:
5145  *             less_id = gle[self.split.dim] < self.split.pos             # <<<<<<<<<<<<<<
5146  *             if less_id:
5147  *                 self.left.add_grid(gle, gre,
5148  */
5149   /*else*/ {
5150     __pyx_t_3 = __pyx_v_self->split->dim;
5151     __pyx_t_2 = __Pyx_PyBool_FromLong(((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_gle.data + __pyx_t_3 * __pyx_v_gle.strides[0]) ))) < __pyx_v_self->split->pos)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error)
5152     __Pyx_GOTREF(__pyx_t_2);
5153     __pyx_v_less_id = __pyx_t_2;
5154     __pyx_t_2 = 0;
5155 
5156     /* "yt/utilities/lib/amr_kdtools.pyx":152
5157  *         else:
5158  *             less_id = gle[self.split.dim] < self.split.pos
5159  *             if less_id:             # <<<<<<<<<<<<<<
5160  *                 self.left.add_grid(gle, gre,
5161  *                          gid, rank, size)
5162  */
5163     __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_less_id); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 152, __pyx_L1_error)
5164     if (__pyx_t_1) {
5165 
5166       /* "yt/utilities/lib/amr_kdtools.pyx":153
5167  *             less_id = gle[self.split.dim] < self.split.pos
5168  *             if less_id:
5169  *                 self.left.add_grid(gle, gre,             # <<<<<<<<<<<<<<
5170  *                          gid, rank, size)
5171  *
5172  */
5173       __pyx_t_2 = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->left->__pyx_vtab)->add_grid(__pyx_v_self->left, __pyx_v_gle, __pyx_v_gre, __pyx_v_gid, __pyx_v_rank, __pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
5174       __Pyx_GOTREF(__pyx_t_2);
5175       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5176 
5177       /* "yt/utilities/lib/amr_kdtools.pyx":152
5178  *         else:
5179  *             less_id = gle[self.split.dim] < self.split.pos
5180  *             if less_id:             # <<<<<<<<<<<<<<
5181  *                 self.left.add_grid(gle, gre,
5182  *                          gid, rank, size)
5183  */
5184     }
5185 
5186     /* "yt/utilities/lib/amr_kdtools.pyx":156
5187  *                          gid, rank, size)
5188  *
5189  *             greater_id = gre[self.split.dim] > self.split.pos             # <<<<<<<<<<<<<<
5190  *             if greater_id:
5191  *                 self.right.add_grid(gle, gre,
5192  */
5193     __pyx_t_4 = __pyx_v_self->split->dim;
5194     __pyx_t_2 = __Pyx_PyBool_FromLong(((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_gre.data + __pyx_t_4 * __pyx_v_gre.strides[0]) ))) > __pyx_v_self->split->pos)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error)
5195     __Pyx_GOTREF(__pyx_t_2);
5196     __pyx_v_greater_id = __pyx_t_2;
5197     __pyx_t_2 = 0;
5198 
5199     /* "yt/utilities/lib/amr_kdtools.pyx":157
5200  *
5201  *             greater_id = gre[self.split.dim] > self.split.pos
5202  *             if greater_id:             # <<<<<<<<<<<<<<
5203  *                 self.right.add_grid(gle, gre,
5204  *                          gid, rank, size)
5205  */
5206     __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_greater_id); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 157, __pyx_L1_error)
5207     if (__pyx_t_1) {
5208 
5209       /* "yt/utilities/lib/amr_kdtools.pyx":158
5210  *             greater_id = gre[self.split.dim] > self.split.pos
5211  *             if greater_id:
5212  *                 self.right.add_grid(gle, gre,             # <<<<<<<<<<<<<<
5213  *                          gid, rank, size)
5214  *         return
5215  */
5216       __pyx_t_2 = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->right->__pyx_vtab)->add_grid(__pyx_v_self->right, __pyx_v_gle, __pyx_v_gre, __pyx_v_gid, __pyx_v_rank, __pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error)
5217       __Pyx_GOTREF(__pyx_t_2);
5218       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5219 
5220       /* "yt/utilities/lib/amr_kdtools.pyx":157
5221  *
5222  *             greater_id = gre[self.split.dim] > self.split.pos
5223  *             if greater_id:             # <<<<<<<<<<<<<<
5224  *                 self.right.add_grid(gle, gre,
5225  *                          gid, rank, size)
5226  */
5227     }
5228   }
5229   __pyx_L4:;
5230 
5231   /* "yt/utilities/lib/amr_kdtools.pyx":160
5232  *                 self.right.add_grid(gle, gre,
5233  *                          gid, rank, size)
5234  *         return             # <<<<<<<<<<<<<<
5235  *
5236  *
5237  */
5238   __Pyx_XDECREF(__pyx_r);
5239   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5240   goto __pyx_L0;
5241 
5242   /* "yt/utilities/lib/amr_kdtools.pyx":138
5243  *     @cython.wraparound(False)
5244  *     @cython.cdivision(True)
5245  *     cdef add_grid(self,             # <<<<<<<<<<<<<<
5246  *                        np.float64_t[:] gle,
5247  *                        np.float64_t[:] gre,
5248  */
5249 
5250   /* function exit code */
5251   __pyx_L1_error:;
5252   __Pyx_XDECREF(__pyx_t_2);
5253   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.add_grid", __pyx_clineno, __pyx_lineno, __pyx_filename);
5254   __pyx_r = 0;
5255   __pyx_L0:;
5256   __Pyx_XDECREF(__pyx_v_less_id);
5257   __Pyx_XDECREF(__pyx_v_greater_id);
5258   __Pyx_XGIVEREF(__pyx_r);
5259   __Pyx_RefNannyFinishContext();
5260   return __pyx_r;
5261 }
5262 
5263 /* "yt/utilities/lib/amr_kdtools.pyx":167
5264  *     @cython.wraparound(False)
5265  *     @cython.cdivision(True)
5266  *     cdef insert_grid(self,             # <<<<<<<<<<<<<<
5267  *                     np.float64_t[:] gle,
5268  *                     np.float64_t[:] gre,
5269  */
5270 
5271 static PyObject *__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_insert_grid(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, __Pyx_memviewslice __pyx_v_gle, __Pyx_memviewslice __pyx_v_gre, int __pyx_v_grid_id, int __pyx_v_rank, int __pyx_v_size) {
5272   int __pyx_v_contained;
5273   long __pyx_v_i;
5274   int __pyx_v_check;
5275   PyObject *__pyx_r = NULL;
5276   __Pyx_RefNannyDeclarations
5277   int __pyx_t_1;
5278   PyObject *__pyx_t_2 = NULL;
5279   long __pyx_t_3;
5280   Py_ssize_t __pyx_t_4;
5281   int __pyx_t_5;
5282   Py_ssize_t __pyx_t_6;
5283   int __pyx_t_7;
5284   __Pyx_RefNannySetupContext("insert_grid", 0);
5285 
5286   /* "yt/utilities/lib/amr_kdtools.pyx":173
5287  *                     int rank,
5288  *                     int size):
5289  *         if not should_i_build(self, rank, size):             # <<<<<<<<<<<<<<
5290  *             return
5291  *
5292  */
5293   __pyx_t_1 = ((!(__pyx_f_2yt_9utilities_3lib_11amr_kdtools_should_i_build(__pyx_v_self, __pyx_v_rank, __pyx_v_size) != 0)) != 0);
5294   if (__pyx_t_1) {
5295 
5296     /* "yt/utilities/lib/amr_kdtools.pyx":174
5297  *                     int size):
5298  *         if not should_i_build(self, rank, size):
5299  *             return             # <<<<<<<<<<<<<<
5300  *
5301  *         # If we should continue to split based on parallelism, do so!
5302  */
5303     __Pyx_XDECREF(__pyx_r);
5304     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5305     goto __pyx_L0;
5306 
5307     /* "yt/utilities/lib/amr_kdtools.pyx":173
5308  *                     int rank,
5309  *                     int size):
5310  *         if not should_i_build(self, rank, size):             # <<<<<<<<<<<<<<
5311  *             return
5312  *
5313  */
5314   }
5315 
5316   /* "yt/utilities/lib/amr_kdtools.pyx":177
5317  *
5318  *         # If we should continue to split based on parallelism, do so!
5319  *         if self.should_i_split(rank, size):             # <<<<<<<<<<<<<<
5320  *             self.geo_split(gle, gre, grid_id, rank, size)
5321  *             return
5322  */
5323   __pyx_t_1 = (((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->__pyx_vtab)->should_i_split(__pyx_v_self, __pyx_v_rank, __pyx_v_size) != 0);
5324   if (__pyx_t_1) {
5325 
5326     /* "yt/utilities/lib/amr_kdtools.pyx":178
5327  *         # If we should continue to split based on parallelism, do so!
5328  *         if self.should_i_split(rank, size):
5329  *             self.geo_split(gle, gre, grid_id, rank, size)             # <<<<<<<<<<<<<<
5330  *             return
5331  *
5332  */
5333     __pyx_t_2 = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->__pyx_vtab)->geo_split(__pyx_v_self, __pyx_v_gle, __pyx_v_gre, __pyx_v_grid_id, __pyx_v_rank, __pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error)
5334     __Pyx_GOTREF(__pyx_t_2);
5335     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5336 
5337     /* "yt/utilities/lib/amr_kdtools.pyx":179
5338  *         if self.should_i_split(rank, size):
5339  *             self.geo_split(gle, gre, grid_id, rank, size)
5340  *             return             # <<<<<<<<<<<<<<
5341  *
5342  *         cdef int contained = 1
5343  */
5344     __Pyx_XDECREF(__pyx_r);
5345     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5346     goto __pyx_L0;
5347 
5348     /* "yt/utilities/lib/amr_kdtools.pyx":177
5349  *
5350  *         # If we should continue to split based on parallelism, do so!
5351  *         if self.should_i_split(rank, size):             # <<<<<<<<<<<<<<
5352  *             self.geo_split(gle, gre, grid_id, rank, size)
5353  *             return
5354  */
5355   }
5356 
5357   /* "yt/utilities/lib/amr_kdtools.pyx":181
5358  *             return
5359  *
5360  *         cdef int contained = 1             # <<<<<<<<<<<<<<
5361  *         for i in range(3):
5362  *             if gle[i] > self.left_edge[i] or\
5363  */
5364   __pyx_v_contained = 1;
5365 
5366   /* "yt/utilities/lib/amr_kdtools.pyx":182
5367  *
5368  *         cdef int contained = 1
5369  *         for i in range(3):             # <<<<<<<<<<<<<<
5370  *             if gle[i] > self.left_edge[i] or\
5371  *                gre[i] < self.right_edge[i]:
5372  */
5373   for (__pyx_t_3 = 0; __pyx_t_3 < 3; __pyx_t_3+=1) {
5374     __pyx_v_i = __pyx_t_3;
5375 
5376     /* "yt/utilities/lib/amr_kdtools.pyx":183
5377  *         cdef int contained = 1
5378  *         for i in range(3):
5379  *             if gle[i] > self.left_edge[i] or\             # <<<<<<<<<<<<<<
5380  *                gre[i] < self.right_edge[i]:
5381  *                 contained *= 0
5382  */
5383     __pyx_t_4 = __pyx_v_i;
5384     __pyx_t_5 = (((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_gle.data + __pyx_t_4 * __pyx_v_gle.strides[0]) ))) > (__pyx_v_self->left_edge[__pyx_v_i])) != 0);
5385     if (!__pyx_t_5) {
5386     } else {
5387       __pyx_t_1 = __pyx_t_5;
5388       goto __pyx_L8_bool_binop_done;
5389     }
5390 
5391     /* "yt/utilities/lib/amr_kdtools.pyx":184
5392  *         for i in range(3):
5393  *             if gle[i] > self.left_edge[i] or\
5394  *                gre[i] < self.right_edge[i]:             # <<<<<<<<<<<<<<
5395  *                 contained *= 0
5396  *
5397  */
5398     __pyx_t_6 = __pyx_v_i;
5399     __pyx_t_5 = (((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_gre.data + __pyx_t_6 * __pyx_v_gre.strides[0]) ))) < (__pyx_v_self->right_edge[__pyx_v_i])) != 0);
5400     __pyx_t_1 = __pyx_t_5;
5401     __pyx_L8_bool_binop_done:;
5402 
5403     /* "yt/utilities/lib/amr_kdtools.pyx":183
5404  *         cdef int contained = 1
5405  *         for i in range(3):
5406  *             if gle[i] > self.left_edge[i] or\             # <<<<<<<<<<<<<<
5407  *                gre[i] < self.right_edge[i]:
5408  *                 contained *= 0
5409  */
5410     if (__pyx_t_1) {
5411 
5412       /* "yt/utilities/lib/amr_kdtools.pyx":185
5413  *             if gle[i] > self.left_edge[i] or\
5414  *                gre[i] < self.right_edge[i]:
5415  *                 contained *= 0             # <<<<<<<<<<<<<<
5416  *
5417  *         if contained == 1:
5418  */
5419       __pyx_v_contained = (__pyx_v_contained * 0);
5420 
5421       /* "yt/utilities/lib/amr_kdtools.pyx":183
5422  *         cdef int contained = 1
5423  *         for i in range(3):
5424  *             if gle[i] > self.left_edge[i] or\             # <<<<<<<<<<<<<<
5425  *                gre[i] < self.right_edge[i]:
5426  *                 contained *= 0
5427  */
5428     }
5429   }
5430 
5431   /* "yt/utilities/lib/amr_kdtools.pyx":187
5432  *                 contained *= 0
5433  *
5434  *         if contained == 1:             # <<<<<<<<<<<<<<
5435  *             self.grid = grid_id
5436  *             assert(self.grid != -1)
5437  */
5438   __pyx_t_1 = ((__pyx_v_contained == 1) != 0);
5439   if (__pyx_t_1) {
5440 
5441     /* "yt/utilities/lib/amr_kdtools.pyx":188
5442  *
5443  *         if contained == 1:
5444  *             self.grid = grid_id             # <<<<<<<<<<<<<<
5445  *             assert(self.grid != -1)
5446  *             return
5447  */
5448     __pyx_v_self->grid = __pyx_v_grid_id;
5449 
5450     /* "yt/utilities/lib/amr_kdtools.pyx":189
5451  *         if contained == 1:
5452  *             self.grid = grid_id
5453  *             assert(self.grid != -1)             # <<<<<<<<<<<<<<
5454  *             return
5455  *
5456  */
5457     #ifndef CYTHON_WITHOUT_ASSERTIONS
5458     if (unlikely(!Py_OptimizeFlag)) {
5459       if (unlikely(!((__pyx_v_self->grid != -1L) != 0))) {
5460         PyErr_SetNone(PyExc_AssertionError);
5461         __PYX_ERR(0, 189, __pyx_L1_error)
5462       }
5463     }
5464     #endif
5465 
5466     /* "yt/utilities/lib/amr_kdtools.pyx":190
5467  *             self.grid = grid_id
5468  *             assert(self.grid != -1)
5469  *             return             # <<<<<<<<<<<<<<
5470  *
5471  *         # Split the grid
5472  */
5473     __Pyx_XDECREF(__pyx_r);
5474     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5475     goto __pyx_L0;
5476 
5477     /* "yt/utilities/lib/amr_kdtools.pyx":187
5478  *                 contained *= 0
5479  *
5480  *         if contained == 1:             # <<<<<<<<<<<<<<
5481  *             self.grid = grid_id
5482  *             assert(self.grid != -1)
5483  */
5484   }
5485 
5486   /* "yt/utilities/lib/amr_kdtools.pyx":193
5487  *
5488  *         # Split the grid
5489  *         cdef int check = self.split_grid(gle, gre, grid_id, rank, size)             # <<<<<<<<<<<<<<
5490  *         # If check is -1, then we have found a place where there are no choices.
5491  *         # Exit out and set the node to None.
5492  */
5493   __pyx_t_2 = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->__pyx_vtab)->split_grid(__pyx_v_self, __pyx_v_gle, __pyx_v_gre, __pyx_v_grid_id, __pyx_v_rank, __pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error)
5494   __Pyx_GOTREF(__pyx_t_2);
5495   __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 193, __pyx_L1_error)
5496   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5497   __pyx_v_check = __pyx_t_7;
5498 
5499   /* "yt/utilities/lib/amr_kdtools.pyx":196
5500  *         # If check is -1, then we have found a place where there are no choices.
5501  *         # Exit out and set the node to None.
5502  *         if check == -1:             # <<<<<<<<<<<<<<
5503  *             self.grid = -1
5504  *         return
5505  */
5506   __pyx_t_1 = ((__pyx_v_check == -1L) != 0);
5507   if (__pyx_t_1) {
5508 
5509     /* "yt/utilities/lib/amr_kdtools.pyx":197
5510  *         # Exit out and set the node to None.
5511  *         if check == -1:
5512  *             self.grid = -1             # <<<<<<<<<<<<<<
5513  *         return
5514  *
5515  */
5516     __pyx_v_self->grid = -1;
5517 
5518     /* "yt/utilities/lib/amr_kdtools.pyx":196
5519  *         # If check is -1, then we have found a place where there are no choices.
5520  *         # Exit out and set the node to None.
5521  *         if check == -1:             # <<<<<<<<<<<<<<
5522  *             self.grid = -1
5523  *         return
5524  */
5525   }
5526 
5527   /* "yt/utilities/lib/amr_kdtools.pyx":198
5528  *         if check == -1:
5529  *             self.grid = -1
5530  *         return             # <<<<<<<<<<<<<<
5531  *
5532  *     @cython.boundscheck(False)
5533  */
5534   __Pyx_XDECREF(__pyx_r);
5535   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5536   goto __pyx_L0;
5537 
5538   /* "yt/utilities/lib/amr_kdtools.pyx":167
5539  *     @cython.wraparound(False)
5540  *     @cython.cdivision(True)
5541  *     cdef insert_grid(self,             # <<<<<<<<<<<<<<
5542  *                     np.float64_t[:] gle,
5543  *                     np.float64_t[:] gre,
5544  */
5545 
5546   /* function exit code */
5547   __pyx_L1_error:;
5548   __Pyx_XDECREF(__pyx_t_2);
5549   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.insert_grid", __pyx_clineno, __pyx_lineno, __pyx_filename);
5550   __pyx_r = 0;
5551   __pyx_L0:;
5552   __Pyx_XGIVEREF(__pyx_r);
5553   __Pyx_RefNannyFinishContext();
5554   return __pyx_r;
5555 }
5556 
5557 /* "yt/utilities/lib/amr_kdtools.pyx":203
5558  *     @cython.wraparound(False)
5559  *     @cython.cdivision(True)
5560  *     cpdef add_grids(self,             # <<<<<<<<<<<<<<
5561  *                         int ngrids,
5562  *                         np.float64_t[:,:] gles,
5563  */
5564 
5565 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_28add_grids(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5566 static PyObject *__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_add_grids(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, int __pyx_v_ngrids, __Pyx_memviewslice __pyx_v_gles, __Pyx_memviewslice __pyx_v_gres, __Pyx_memviewslice __pyx_v_gids, int __pyx_v_rank, int __pyx_v_size, int __pyx_skip_dispatch) {
5567   int __pyx_v_i;
5568   int __pyx_v_j;
5569   int __pyx_v_nless;
5570   int __pyx_v_ngreater;
5571   int __pyx_v_index;
5572   __Pyx_memviewslice __pyx_v_less_gles = { 0, 0, { 0 }, { 0 }, { 0 } };
5573   __Pyx_memviewslice __pyx_v_less_gres = { 0, 0, { 0 }, { 0 }, { 0 } };
5574   __Pyx_memviewslice __pyx_v_greater_gles = { 0, 0, { 0 }, { 0 }, { 0 } };
5575   __Pyx_memviewslice __pyx_v_greater_gres = { 0, 0, { 0 }, { 0 }, { 0 } };
5576   __Pyx_memviewslice __pyx_v_l_ids = { 0, 0, { 0 }, { 0 }, { 0 } };
5577   __Pyx_memviewslice __pyx_v_g_ids = { 0, 0, { 0 }, { 0 }, { 0 } };
5578   PyObject *__pyx_v_less_ids = NULL;
5579   PyObject *__pyx_v_greater_ids = NULL;
5580   PyObject *__pyx_r = NULL;
5581   __Pyx_RefNannyDeclarations
5582   PyObject *__pyx_t_1 = NULL;
5583   PyObject *__pyx_t_2 = NULL;
5584   PyObject *__pyx_t_3 = NULL;
5585   PyObject *__pyx_t_4 = NULL;
5586   PyObject *__pyx_t_5 = NULL;
5587   PyObject *__pyx_t_6 = NULL;
5588   PyObject *__pyx_t_7 = NULL;
5589   PyObject *__pyx_t_8 = NULL;
5590   PyObject *__pyx_t_9 = NULL;
5591   PyObject *__pyx_t_10 = NULL;
5592   int __pyx_t_11;
5593   PyObject *__pyx_t_12 = NULL;
5594   int __pyx_t_13;
5595   int __pyx_t_14;
5596   int __pyx_t_15;
5597   Py_ssize_t __pyx_t_16;
5598   Py_ssize_t __pyx_t_17;
5599   Py_ssize_t __pyx_t_18;
5600   Py_ssize_t __pyx_t_19;
5601   __Pyx_memviewslice __pyx_t_20 = { 0, 0, { 0 }, { 0 }, { 0 } };
5602   __Pyx_memviewslice __pyx_t_21 = { 0, 0, { 0 }, { 0 }, { 0 } };
5603   int __pyx_t_22;
5604   Py_ssize_t __pyx_t_23;
5605   Py_ssize_t __pyx_t_24;
5606   Py_ssize_t __pyx_t_25;
5607   Py_ssize_t __pyx_t_26;
5608   Py_ssize_t __pyx_t_27;
5609   Py_ssize_t __pyx_t_28;
5610   Py_ssize_t __pyx_t_29;
5611   Py_ssize_t __pyx_t_30;
5612   Py_ssize_t __pyx_t_31;
5613   Py_ssize_t __pyx_t_32;
5614   Py_ssize_t __pyx_t_33;
5615   Py_ssize_t __pyx_t_34;
5616   Py_ssize_t __pyx_t_35;
5617   Py_ssize_t __pyx_t_36;
5618   Py_ssize_t __pyx_t_37;
5619   Py_ssize_t __pyx_t_38;
5620   Py_ssize_t __pyx_t_39;
5621   Py_ssize_t __pyx_t_40;
5622   Py_ssize_t __pyx_t_41;
5623   Py_ssize_t __pyx_t_42;
5624   __Pyx_RefNannySetupContext("add_grids", 0);
5625   /* Check if called by wrapper */
5626   if (unlikely(__pyx_skip_dispatch)) ;
5627   /* Check if overridden in Python */
5628   else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
5629     #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
5630     static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
5631     if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
5632       PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
5633       #endif
5634       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add_grids); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error)
5635       __Pyx_GOTREF(__pyx_t_1);
5636       if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_28add_grids)) {
5637         __Pyx_XDECREF(__pyx_r);
5638         __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_ngrids); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L1_error)
5639         __Pyx_GOTREF(__pyx_t_3);
5640         if (unlikely(!__pyx_v_gles.memview)) { __Pyx_RaiseUnboundLocalError("gles"); __PYX_ERR(0, 203, __pyx_L1_error) }
5641         __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_gles, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float64_t, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 203, __pyx_L1_error)
5642         __Pyx_GOTREF(__pyx_t_4);
5643         if (unlikely(!__pyx_v_gres.memview)) { __Pyx_RaiseUnboundLocalError("gres"); __PYX_ERR(0, 203, __pyx_L1_error) }
5644         __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_gres, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float64_t, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 203, __pyx_L1_error)
5645         __Pyx_GOTREF(__pyx_t_5);
5646         if (unlikely(!__pyx_v_gids.memview)) { __Pyx_RaiseUnboundLocalError("gids"); __PYX_ERR(0, 203, __pyx_L1_error) }
5647         __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_gids, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_int64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_int64_t, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 203, __pyx_L1_error)
5648         __Pyx_GOTREF(__pyx_t_6);
5649         __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_rank); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 203, __pyx_L1_error)
5650         __Pyx_GOTREF(__pyx_t_7);
5651         __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_size); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 203, __pyx_L1_error)
5652         __Pyx_GOTREF(__pyx_t_8);
5653         __Pyx_INCREF(__pyx_t_1);
5654         __pyx_t_9 = __pyx_t_1; __pyx_t_10 = NULL;
5655         __pyx_t_11 = 0;
5656         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
5657           __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
5658           if (likely(__pyx_t_10)) {
5659             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
5660             __Pyx_INCREF(__pyx_t_10);
5661             __Pyx_INCREF(function);
5662             __Pyx_DECREF_SET(__pyx_t_9, function);
5663             __pyx_t_11 = 1;
5664           }
5665         }
5666         #if CYTHON_FAST_PYCALL
5667         if (PyFunction_Check(__pyx_t_9)) {
5668           PyObject *__pyx_temp[7] = {__pyx_t_10, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8};
5669           __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 6+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error)
5670           __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
5671           __Pyx_GOTREF(__pyx_t_2);
5672           __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5673           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5674           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5675           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5676           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5677           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5678         } else
5679         #endif
5680         #if CYTHON_FAST_PYCCALL
5681         if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
5682           PyObject *__pyx_temp[7] = {__pyx_t_10, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8};
5683           __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_11, 6+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error)
5684           __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
5685           __Pyx_GOTREF(__pyx_t_2);
5686           __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5687           __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5688           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5689           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5690           __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5691           __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5692         } else
5693         #endif
5694         {
5695           __pyx_t_12 = PyTuple_New(6+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 203, __pyx_L1_error)
5696           __Pyx_GOTREF(__pyx_t_12);
5697           if (__pyx_t_10) {
5698             __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL;
5699           }
5700           __Pyx_GIVEREF(__pyx_t_3);
5701           PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_3);
5702           __Pyx_GIVEREF(__pyx_t_4);
5703           PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_4);
5704           __Pyx_GIVEREF(__pyx_t_5);
5705           PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_11, __pyx_t_5);
5706           __Pyx_GIVEREF(__pyx_t_6);
5707           PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_11, __pyx_t_6);
5708           __Pyx_GIVEREF(__pyx_t_7);
5709           PyTuple_SET_ITEM(__pyx_t_12, 4+__pyx_t_11, __pyx_t_7);
5710           __Pyx_GIVEREF(__pyx_t_8);
5711           PyTuple_SET_ITEM(__pyx_t_12, 5+__pyx_t_11, __pyx_t_8);
5712           __pyx_t_3 = 0;
5713           __pyx_t_4 = 0;
5714           __pyx_t_5 = 0;
5715           __pyx_t_6 = 0;
5716           __pyx_t_7 = 0;
5717           __pyx_t_8 = 0;
5718           __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error)
5719           __Pyx_GOTREF(__pyx_t_2);
5720           __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5721         }
5722         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5723         __pyx_r = __pyx_t_2;
5724         __pyx_t_2 = 0;
5725         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5726         goto __pyx_L0;
5727       }
5728       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
5729       __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
5730       __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
5731       if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
5732         __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
5733       }
5734       #endif
5735       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5736       #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
5737     }
5738     #endif
5739   }
5740 
5741   /* "yt/utilities/lib/amr_kdtools.pyx":213
5742  *         cdef np.float64_t[:,:] less_gles, less_gres, greater_gles, greater_gres
5743  *         cdef np.int64_t[:] l_ids, g_ids
5744  *         if not should_i_build(self, rank, size):             # <<<<<<<<<<<<<<
5745  *             return
5746  *
5747  */
5748   __pyx_t_13 = ((!(__pyx_f_2yt_9utilities_3lib_11amr_kdtools_should_i_build(__pyx_v_self, __pyx_v_rank, __pyx_v_size) != 0)) != 0);
5749   if (__pyx_t_13) {
5750 
5751     /* "yt/utilities/lib/amr_kdtools.pyx":214
5752  *         cdef np.int64_t[:] l_ids, g_ids
5753  *         if not should_i_build(self, rank, size):
5754  *             return             # <<<<<<<<<<<<<<
5755  *
5756  *         if self._kd_is_leaf() == 1:
5757  */
5758     __Pyx_XDECREF(__pyx_r);
5759     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5760     goto __pyx_L0;
5761 
5762     /* "yt/utilities/lib/amr_kdtools.pyx":213
5763  *         cdef np.float64_t[:,:] less_gles, less_gres, greater_gles, greater_gres
5764  *         cdef np.int64_t[:] l_ids, g_ids
5765  *         if not should_i_build(self, rank, size):             # <<<<<<<<<<<<<<
5766  *             return
5767  *
5768  */
5769   }
5770 
5771   /* "yt/utilities/lib/amr_kdtools.pyx":216
5772  *             return
5773  *
5774  *         if self._kd_is_leaf() == 1:             # <<<<<<<<<<<<<<
5775  *             self.insert_grids(ngrids, gles, gres, gids, rank, size)
5776  *             return
5777  */
5778   __pyx_t_13 = ((((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->__pyx_vtab)->_kd_is_leaf(__pyx_v_self) == 1) != 0);
5779   if (__pyx_t_13) {
5780 
5781     /* "yt/utilities/lib/amr_kdtools.pyx":217
5782  *
5783  *         if self._kd_is_leaf() == 1:
5784  *             self.insert_grids(ngrids, gles, gres, gids, rank, size)             # <<<<<<<<<<<<<<
5785  *             return
5786  *
5787  */
5788     ((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->__pyx_vtab)->insert_grids(__pyx_v_self, __pyx_v_ngrids, __pyx_v_gles, __pyx_v_gres, __pyx_v_gids, __pyx_v_rank, __pyx_v_size);
5789 
5790     /* "yt/utilities/lib/amr_kdtools.pyx":218
5791  *         if self._kd_is_leaf() == 1:
5792  *             self.insert_grids(ngrids, gles, gres, gids, rank, size)
5793  *             return             # <<<<<<<<<<<<<<
5794  *
5795  *         less_ids = cvarray(format="q", shape=(ngrids,), itemsize=sizeof(np.int64_t))
5796  */
5797     __Pyx_XDECREF(__pyx_r);
5798     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5799     goto __pyx_L0;
5800 
5801     /* "yt/utilities/lib/amr_kdtools.pyx":216
5802  *             return
5803  *
5804  *         if self._kd_is_leaf() == 1:             # <<<<<<<<<<<<<<
5805  *             self.insert_grids(ngrids, gles, gres, gids, rank, size)
5806  *             return
5807  */
5808   }
5809 
5810   /* "yt/utilities/lib/amr_kdtools.pyx":220
5811  *             return
5812  *
5813  *         less_ids = cvarray(format="q", shape=(ngrids,), itemsize=sizeof(np.int64_t))             # <<<<<<<<<<<<<<
5814  *         greater_ids = cvarray(format="q", shape=(ngrids,), itemsize=sizeof(np.int64_t))
5815  *
5816  */
5817   __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error)
5818   __Pyx_GOTREF(__pyx_t_1);
5819   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_format, __pyx_n_s_q) < 0) __PYX_ERR(0, 220, __pyx_L1_error)
5820   __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ngrids); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error)
5821   __Pyx_GOTREF(__pyx_t_2);
5822   __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 220, __pyx_L1_error)
5823   __Pyx_GOTREF(__pyx_t_9);
5824   __Pyx_GIVEREF(__pyx_t_2);
5825   PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
5826   __pyx_t_2 = 0;
5827   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_shape, __pyx_t_9) < 0) __PYX_ERR(0, 220, __pyx_L1_error)
5828   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5829   __pyx_t_9 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_int64_t))); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 220, __pyx_L1_error)
5830   __Pyx_GOTREF(__pyx_t_9);
5831   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_itemsize, __pyx_t_9) < 0) __PYX_ERR(0, 220, __pyx_L1_error)
5832   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5833   __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 220, __pyx_L1_error)
5834   __Pyx_GOTREF(__pyx_t_9);
5835   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5836   __pyx_v_less_ids = __pyx_t_9;
5837   __pyx_t_9 = 0;
5838 
5839   /* "yt/utilities/lib/amr_kdtools.pyx":221
5840  *
5841  *         less_ids = cvarray(format="q", shape=(ngrids,), itemsize=sizeof(np.int64_t))
5842  *         greater_ids = cvarray(format="q", shape=(ngrids,), itemsize=sizeof(np.int64_t))             # <<<<<<<<<<<<<<
5843  *
5844  *         nless = 0
5845  */
5846   __pyx_t_9 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 221, __pyx_L1_error)
5847   __Pyx_GOTREF(__pyx_t_9);
5848   if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_format, __pyx_n_s_q) < 0) __PYX_ERR(0, 221, __pyx_L1_error)
5849   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_ngrids); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error)
5850   __Pyx_GOTREF(__pyx_t_1);
5851   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error)
5852   __Pyx_GOTREF(__pyx_t_2);
5853   __Pyx_GIVEREF(__pyx_t_1);
5854   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
5855   __pyx_t_1 = 0;
5856   if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_shape, __pyx_t_2) < 0) __PYX_ERR(0, 221, __pyx_L1_error)
5857   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5858   __pyx_t_2 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_int64_t))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error)
5859   __Pyx_GOTREF(__pyx_t_2);
5860   if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_itemsize, __pyx_t_2) < 0) __PYX_ERR(0, 221, __pyx_L1_error)
5861   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5862   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error)
5863   __Pyx_GOTREF(__pyx_t_2);
5864   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5865   __pyx_v_greater_ids = __pyx_t_2;
5866   __pyx_t_2 = 0;
5867 
5868   /* "yt/utilities/lib/amr_kdtools.pyx":223
5869  *         greater_ids = cvarray(format="q", shape=(ngrids,), itemsize=sizeof(np.int64_t))
5870  *
5871  *         nless = 0             # <<<<<<<<<<<<<<
5872  *         ngreater = 0
5873  *         for i in range(ngrids):
5874  */
5875   __pyx_v_nless = 0;
5876 
5877   /* "yt/utilities/lib/amr_kdtools.pyx":224
5878  *
5879  *         nless = 0
5880  *         ngreater = 0             # <<<<<<<<<<<<<<
5881  *         for i in range(ngrids):
5882  *             if gles[i, self.split.dim] < self.split.pos:
5883  */
5884   __pyx_v_ngreater = 0;
5885 
5886   /* "yt/utilities/lib/amr_kdtools.pyx":225
5887  *         nless = 0
5888  *         ngreater = 0
5889  *         for i in range(ngrids):             # <<<<<<<<<<<<<<
5890  *             if gles[i, self.split.dim] < self.split.pos:
5891  *                 less_ids[nless] = i
5892  */
5893   __pyx_t_11 = __pyx_v_ngrids;
5894   __pyx_t_14 = __pyx_t_11;
5895   for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
5896     __pyx_v_i = __pyx_t_15;
5897 
5898     /* "yt/utilities/lib/amr_kdtools.pyx":226
5899  *         ngreater = 0
5900  *         for i in range(ngrids):
5901  *             if gles[i, self.split.dim] < self.split.pos:             # <<<<<<<<<<<<<<
5902  *                 less_ids[nless] = i
5903  *                 nless += 1
5904  */
5905     __pyx_t_16 = __pyx_v_i;
5906     __pyx_t_17 = __pyx_v_self->split->dim;
5907     __pyx_t_13 = (((*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_gles.data + __pyx_t_16 * __pyx_v_gles.strides[0]) ) + __pyx_t_17 * __pyx_v_gles.strides[1]) ))) < __pyx_v_self->split->pos) != 0);
5908     if (__pyx_t_13) {
5909 
5910       /* "yt/utilities/lib/amr_kdtools.pyx":227
5911  *         for i in range(ngrids):
5912  *             if gles[i, self.split.dim] < self.split.pos:
5913  *                 less_ids[nless] = i             # <<<<<<<<<<<<<<
5914  *                 nless += 1
5915  *
5916  */
5917       __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __pyx_L1_error)
5918       __Pyx_GOTREF(__pyx_t_2);
5919       if (unlikely(__Pyx_SetItemInt(__pyx_v_less_ids, __pyx_v_nless, __pyx_t_2, int, 1, __Pyx_PyInt_From_int, 0, 0, 0) < 0)) __PYX_ERR(0, 227, __pyx_L1_error)
5920       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5921 
5922       /* "yt/utilities/lib/amr_kdtools.pyx":228
5923  *             if gles[i, self.split.dim] < self.split.pos:
5924  *                 less_ids[nless] = i
5925  *                 nless += 1             # <<<<<<<<<<<<<<
5926  *
5927  *             if gres[i, self.split.dim] > self.split.pos:
5928  */
5929       __pyx_v_nless = (__pyx_v_nless + 1);
5930 
5931       /* "yt/utilities/lib/amr_kdtools.pyx":226
5932  *         ngreater = 0
5933  *         for i in range(ngrids):
5934  *             if gles[i, self.split.dim] < self.split.pos:             # <<<<<<<<<<<<<<
5935  *                 less_ids[nless] = i
5936  *                 nless += 1
5937  */
5938     }
5939 
5940     /* "yt/utilities/lib/amr_kdtools.pyx":230
5941  *                 nless += 1
5942  *
5943  *             if gres[i, self.split.dim] > self.split.pos:             # <<<<<<<<<<<<<<
5944  *                 greater_ids[ngreater] = i
5945  *                 ngreater += 1
5946  */
5947     __pyx_t_18 = __pyx_v_i;
5948     __pyx_t_19 = __pyx_v_self->split->dim;
5949     __pyx_t_13 = (((*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_gres.data + __pyx_t_18 * __pyx_v_gres.strides[0]) ) + __pyx_t_19 * __pyx_v_gres.strides[1]) ))) > __pyx_v_self->split->pos) != 0);
5950     if (__pyx_t_13) {
5951 
5952       /* "yt/utilities/lib/amr_kdtools.pyx":231
5953  *
5954  *             if gres[i, self.split.dim] > self.split.pos:
5955  *                 greater_ids[ngreater] = i             # <<<<<<<<<<<<<<
5956  *                 ngreater += 1
5957  *
5958  */
5959       __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 231, __pyx_L1_error)
5960       __Pyx_GOTREF(__pyx_t_2);
5961       if (unlikely(__Pyx_SetItemInt(__pyx_v_greater_ids, __pyx_v_ngreater, __pyx_t_2, int, 1, __Pyx_PyInt_From_int, 0, 0, 0) < 0)) __PYX_ERR(0, 231, __pyx_L1_error)
5962       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5963 
5964       /* "yt/utilities/lib/amr_kdtools.pyx":232
5965  *             if gres[i, self.split.dim] > self.split.pos:
5966  *                 greater_ids[ngreater] = i
5967  *                 ngreater += 1             # <<<<<<<<<<<<<<
5968  *
5969  *         #print('nless: %i' % nless)
5970  */
5971       __pyx_v_ngreater = (__pyx_v_ngreater + 1);
5972 
5973       /* "yt/utilities/lib/amr_kdtools.pyx":230
5974  *                 nless += 1
5975  *
5976  *             if gres[i, self.split.dim] > self.split.pos:             # <<<<<<<<<<<<<<
5977  *                 greater_ids[ngreater] = i
5978  *                 ngreater += 1
5979  */
5980     }
5981   }
5982 
5983   /* "yt/utilities/lib/amr_kdtools.pyx":237
5984  *         #print('ngreater: %i' % ngreater)
5985  *
5986  *         if nless > 0:             # <<<<<<<<<<<<<<
5987  *             less_gles = cvarray(format="d", shape=(nless,3), itemsize=sizeof(np.float64_t))
5988  *             less_gres = cvarray(format="d", shape=(nless,3), itemsize=sizeof(np.float64_t))
5989  */
5990   __pyx_t_13 = ((__pyx_v_nless > 0) != 0);
5991   if (__pyx_t_13) {
5992 
5993     /* "yt/utilities/lib/amr_kdtools.pyx":238
5994  *
5995  *         if nless > 0:
5996  *             less_gles = cvarray(format="d", shape=(nless,3), itemsize=sizeof(np.float64_t))             # <<<<<<<<<<<<<<
5997  *             less_gres = cvarray(format="d", shape=(nless,3), itemsize=sizeof(np.float64_t))
5998  *             l_ids = cvarray(format="q", shape=(nless,), itemsize=sizeof(np.int64_t))
5999  */
6000     __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __pyx_L1_error)
6001     __Pyx_GOTREF(__pyx_t_2);
6002     if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 238, __pyx_L1_error)
6003     __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_nless); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 238, __pyx_L1_error)
6004     __Pyx_GOTREF(__pyx_t_9);
6005     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error)
6006     __Pyx_GOTREF(__pyx_t_1);
6007     __Pyx_GIVEREF(__pyx_t_9);
6008     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
6009     __Pyx_INCREF(__pyx_int_3);
6010     __Pyx_GIVEREF(__pyx_int_3);
6011     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_3);
6012     __pyx_t_9 = 0;
6013     if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_shape, __pyx_t_1) < 0) __PYX_ERR(0, 238, __pyx_L1_error)
6014     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6015     __pyx_t_1 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_float64_t))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error)
6016     __Pyx_GOTREF(__pyx_t_1);
6017     if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_itemsize, __pyx_t_1) < 0) __PYX_ERR(0, 238, __pyx_L1_error)
6018     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6019     __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error)
6020     __Pyx_GOTREF(__pyx_t_1);
6021     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6022     __pyx_t_20 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_20.memview)) __PYX_ERR(0, 238, __pyx_L1_error)
6023     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6024     __pyx_v_less_gles = __pyx_t_20;
6025     __pyx_t_20.memview = NULL;
6026     __pyx_t_20.data = NULL;
6027 
6028     /* "yt/utilities/lib/amr_kdtools.pyx":239
6029  *         if nless > 0:
6030  *             less_gles = cvarray(format="d", shape=(nless,3), itemsize=sizeof(np.float64_t))
6031  *             less_gres = cvarray(format="d", shape=(nless,3), itemsize=sizeof(np.float64_t))             # <<<<<<<<<<<<<<
6032  *             l_ids = cvarray(format="q", shape=(nless,), itemsize=sizeof(np.int64_t))
6033  *
6034  */
6035     __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error)
6036     __Pyx_GOTREF(__pyx_t_1);
6037     if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 239, __pyx_L1_error)
6038     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nless); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error)
6039     __Pyx_GOTREF(__pyx_t_2);
6040     __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 239, __pyx_L1_error)
6041     __Pyx_GOTREF(__pyx_t_9);
6042     __Pyx_GIVEREF(__pyx_t_2);
6043     PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
6044     __Pyx_INCREF(__pyx_int_3);
6045     __Pyx_GIVEREF(__pyx_int_3);
6046     PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_int_3);
6047     __pyx_t_2 = 0;
6048     if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_shape, __pyx_t_9) < 0) __PYX_ERR(0, 239, __pyx_L1_error)
6049     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6050     __pyx_t_9 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_float64_t))); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 239, __pyx_L1_error)
6051     __Pyx_GOTREF(__pyx_t_9);
6052     if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_itemsize, __pyx_t_9) < 0) __PYX_ERR(0, 239, __pyx_L1_error)
6053     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6054     __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 239, __pyx_L1_error)
6055     __Pyx_GOTREF(__pyx_t_9);
6056     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6057     __pyx_t_20 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(__pyx_t_9, PyBUF_WRITABLE); if (unlikely(!__pyx_t_20.memview)) __PYX_ERR(0, 239, __pyx_L1_error)
6058     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6059     __pyx_v_less_gres = __pyx_t_20;
6060     __pyx_t_20.memview = NULL;
6061     __pyx_t_20.data = NULL;
6062 
6063     /* "yt/utilities/lib/amr_kdtools.pyx":240
6064  *             less_gles = cvarray(format="d", shape=(nless,3), itemsize=sizeof(np.float64_t))
6065  *             less_gres = cvarray(format="d", shape=(nless,3), itemsize=sizeof(np.float64_t))
6066  *             l_ids = cvarray(format="q", shape=(nless,), itemsize=sizeof(np.int64_t))             # <<<<<<<<<<<<<<
6067  *
6068  *             for i in range(nless):
6069  */
6070     __pyx_t_9 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 240, __pyx_L1_error)
6071     __Pyx_GOTREF(__pyx_t_9);
6072     if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_format, __pyx_n_s_q) < 0) __PYX_ERR(0, 240, __pyx_L1_error)
6073     __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nless); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error)
6074     __Pyx_GOTREF(__pyx_t_1);
6075     __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error)
6076     __Pyx_GOTREF(__pyx_t_2);
6077     __Pyx_GIVEREF(__pyx_t_1);
6078     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
6079     __pyx_t_1 = 0;
6080     if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_shape, __pyx_t_2) < 0) __PYX_ERR(0, 240, __pyx_L1_error)
6081     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6082     __pyx_t_2 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_int64_t))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error)
6083     __Pyx_GOTREF(__pyx_t_2);
6084     if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_itemsize, __pyx_t_2) < 0) __PYX_ERR(0, 240, __pyx_L1_error)
6085     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6086     __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error)
6087     __Pyx_GOTREF(__pyx_t_2);
6088     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6089     __pyx_t_21 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int64_t(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_21.memview)) __PYX_ERR(0, 240, __pyx_L1_error)
6090     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6091     __pyx_v_l_ids = __pyx_t_21;
6092     __pyx_t_21.memview = NULL;
6093     __pyx_t_21.data = NULL;
6094 
6095     /* "yt/utilities/lib/amr_kdtools.pyx":242
6096  *             l_ids = cvarray(format="q", shape=(nless,), itemsize=sizeof(np.int64_t))
6097  *
6098  *             for i in range(nless):             # <<<<<<<<<<<<<<
6099  *                 index = less_ids[i]
6100  *                 l_ids[i] = gids[index]
6101  */
6102     __pyx_t_11 = __pyx_v_nless;
6103     __pyx_t_14 = __pyx_t_11;
6104     for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
6105       __pyx_v_i = __pyx_t_15;
6106 
6107       /* "yt/utilities/lib/amr_kdtools.pyx":243
6108  *
6109  *             for i in range(nless):
6110  *                 index = less_ids[i]             # <<<<<<<<<<<<<<
6111  *                 l_ids[i] = gids[index]
6112  *                 for j in range(3):
6113  */
6114       __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_less_ids, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 243, __pyx_L1_error)
6115       __Pyx_GOTREF(__pyx_t_2);
6116       __pyx_t_22 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_22 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 243, __pyx_L1_error)
6117       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6118       __pyx_v_index = __pyx_t_22;
6119 
6120       /* "yt/utilities/lib/amr_kdtools.pyx":244
6121  *             for i in range(nless):
6122  *                 index = less_ids[i]
6123  *                 l_ids[i] = gids[index]             # <<<<<<<<<<<<<<
6124  *                 for j in range(3):
6125  *                     less_gles[i,j] = gles[index,j]
6126  */
6127       __pyx_t_23 = __pyx_v_index;
6128       __pyx_t_24 = __pyx_v_i;
6129       *((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ (__pyx_v_l_ids.data + __pyx_t_24 * __pyx_v_l_ids.strides[0]) )) = (*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ (__pyx_v_gids.data + __pyx_t_23 * __pyx_v_gids.strides[0]) )));
6130 
6131       /* "yt/utilities/lib/amr_kdtools.pyx":245
6132  *                 index = less_ids[i]
6133  *                 l_ids[i] = gids[index]
6134  *                 for j in range(3):             # <<<<<<<<<<<<<<
6135  *                     less_gles[i,j] = gles[index,j]
6136  *                     less_gres[i,j] = gres[index,j]
6137  */
6138       for (__pyx_t_22 = 0; __pyx_t_22 < 3; __pyx_t_22+=1) {
6139         __pyx_v_j = __pyx_t_22;
6140 
6141         /* "yt/utilities/lib/amr_kdtools.pyx":246
6142  *                 l_ids[i] = gids[index]
6143  *                 for j in range(3):
6144  *                     less_gles[i,j] = gles[index,j]             # <<<<<<<<<<<<<<
6145  *                     less_gres[i,j] = gres[index,j]
6146  *
6147  */
6148         __pyx_t_25 = __pyx_v_index;
6149         __pyx_t_26 = __pyx_v_j;
6150         __pyx_t_27 = __pyx_v_i;
6151         __pyx_t_28 = __pyx_v_j;
6152         *((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_less_gles.data + __pyx_t_27 * __pyx_v_less_gles.strides[0]) ) + __pyx_t_28 * __pyx_v_less_gles.strides[1]) )) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_gles.data + __pyx_t_25 * __pyx_v_gles.strides[0]) ) + __pyx_t_26 * __pyx_v_gles.strides[1]) )));
6153 
6154         /* "yt/utilities/lib/amr_kdtools.pyx":247
6155  *                 for j in range(3):
6156  *                     less_gles[i,j] = gles[index,j]
6157  *                     less_gres[i,j] = gres[index,j]             # <<<<<<<<<<<<<<
6158  *
6159  *             self.left.add_grids(nless, less_gles, less_gres,
6160  */
6161         __pyx_t_29 = __pyx_v_index;
6162         __pyx_t_30 = __pyx_v_j;
6163         __pyx_t_31 = __pyx_v_i;
6164         __pyx_t_32 = __pyx_v_j;
6165         *((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_less_gres.data + __pyx_t_31 * __pyx_v_less_gres.strides[0]) ) + __pyx_t_32 * __pyx_v_less_gres.strides[1]) )) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_gres.data + __pyx_t_29 * __pyx_v_gres.strides[0]) ) + __pyx_t_30 * __pyx_v_gres.strides[1]) )));
6166       }
6167     }
6168 
6169     /* "yt/utilities/lib/amr_kdtools.pyx":249
6170  *                     less_gres[i,j] = gres[index,j]
6171  *
6172  *             self.left.add_grids(nless, less_gles, less_gres,             # <<<<<<<<<<<<<<
6173  *                       l_ids, rank, size)
6174  *
6175  */
6176     __pyx_t_2 = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->left->__pyx_vtab)->add_grids(__pyx_v_self->left, __pyx_v_nless, __pyx_v_less_gles, __pyx_v_less_gres, __pyx_v_l_ids, __pyx_v_rank, __pyx_v_size, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 249, __pyx_L1_error)
6177     __Pyx_GOTREF(__pyx_t_2);
6178     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6179 
6180     /* "yt/utilities/lib/amr_kdtools.pyx":237
6181  *         #print('ngreater: %i' % ngreater)
6182  *
6183  *         if nless > 0:             # <<<<<<<<<<<<<<
6184  *             less_gles = cvarray(format="d", shape=(nless,3), itemsize=sizeof(np.float64_t))
6185  *             less_gres = cvarray(format="d", shape=(nless,3), itemsize=sizeof(np.float64_t))
6186  */
6187   }
6188 
6189   /* "yt/utilities/lib/amr_kdtools.pyx":252
6190  *                       l_ids, rank, size)
6191  *
6192  *         if ngreater > 0:             # <<<<<<<<<<<<<<
6193  *             greater_gles = cvarray(format="d", shape=(ngreater,3), itemsize=sizeof(np.float64_t))
6194  *             greater_gres = cvarray(format="d", shape=(ngreater,3), itemsize=sizeof(np.float64_t))
6195  */
6196   __pyx_t_13 = ((__pyx_v_ngreater > 0) != 0);
6197   if (__pyx_t_13) {
6198 
6199     /* "yt/utilities/lib/amr_kdtools.pyx":253
6200  *
6201  *         if ngreater > 0:
6202  *             greater_gles = cvarray(format="d", shape=(ngreater,3), itemsize=sizeof(np.float64_t))             # <<<<<<<<<<<<<<
6203  *             greater_gres = cvarray(format="d", shape=(ngreater,3), itemsize=sizeof(np.float64_t))
6204  *             g_ids = cvarray(format="q", shape=(ngreater,), itemsize=sizeof(np.int64_t))
6205  */
6206     __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 253, __pyx_L1_error)
6207     __Pyx_GOTREF(__pyx_t_2);
6208     if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 253, __pyx_L1_error)
6209     __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_ngreater); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 253, __pyx_L1_error)
6210     __Pyx_GOTREF(__pyx_t_9);
6211     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error)
6212     __Pyx_GOTREF(__pyx_t_1);
6213     __Pyx_GIVEREF(__pyx_t_9);
6214     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9);
6215     __Pyx_INCREF(__pyx_int_3);
6216     __Pyx_GIVEREF(__pyx_int_3);
6217     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_3);
6218     __pyx_t_9 = 0;
6219     if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_shape, __pyx_t_1) < 0) __PYX_ERR(0, 253, __pyx_L1_error)
6220     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6221     __pyx_t_1 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_float64_t))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error)
6222     __Pyx_GOTREF(__pyx_t_1);
6223     if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_itemsize, __pyx_t_1) < 0) __PYX_ERR(0, 253, __pyx_L1_error)
6224     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6225     __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error)
6226     __Pyx_GOTREF(__pyx_t_1);
6227     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6228     __pyx_t_20 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_20.memview)) __PYX_ERR(0, 253, __pyx_L1_error)
6229     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6230     __pyx_v_greater_gles = __pyx_t_20;
6231     __pyx_t_20.memview = NULL;
6232     __pyx_t_20.data = NULL;
6233 
6234     /* "yt/utilities/lib/amr_kdtools.pyx":254
6235  *         if ngreater > 0:
6236  *             greater_gles = cvarray(format="d", shape=(ngreater,3), itemsize=sizeof(np.float64_t))
6237  *             greater_gres = cvarray(format="d", shape=(ngreater,3), itemsize=sizeof(np.float64_t))             # <<<<<<<<<<<<<<
6238  *             g_ids = cvarray(format="q", shape=(ngreater,), itemsize=sizeof(np.int64_t))
6239  *
6240  */
6241     __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error)
6242     __Pyx_GOTREF(__pyx_t_1);
6243     if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 254, __pyx_L1_error)
6244     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ngreater); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 254, __pyx_L1_error)
6245     __Pyx_GOTREF(__pyx_t_2);
6246     __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 254, __pyx_L1_error)
6247     __Pyx_GOTREF(__pyx_t_9);
6248     __Pyx_GIVEREF(__pyx_t_2);
6249     PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
6250     __Pyx_INCREF(__pyx_int_3);
6251     __Pyx_GIVEREF(__pyx_int_3);
6252     PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_int_3);
6253     __pyx_t_2 = 0;
6254     if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_shape, __pyx_t_9) < 0) __PYX_ERR(0, 254, __pyx_L1_error)
6255     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6256     __pyx_t_9 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_float64_t))); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 254, __pyx_L1_error)
6257     __Pyx_GOTREF(__pyx_t_9);
6258     if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_itemsize, __pyx_t_9) < 0) __PYX_ERR(0, 254, __pyx_L1_error)
6259     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6260     __pyx_t_9 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 254, __pyx_L1_error)
6261     __Pyx_GOTREF(__pyx_t_9);
6262     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6263     __pyx_t_20 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(__pyx_t_9, PyBUF_WRITABLE); if (unlikely(!__pyx_t_20.memview)) __PYX_ERR(0, 254, __pyx_L1_error)
6264     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6265     __pyx_v_greater_gres = __pyx_t_20;
6266     __pyx_t_20.memview = NULL;
6267     __pyx_t_20.data = NULL;
6268 
6269     /* "yt/utilities/lib/amr_kdtools.pyx":255
6270  *             greater_gles = cvarray(format="d", shape=(ngreater,3), itemsize=sizeof(np.float64_t))
6271  *             greater_gres = cvarray(format="d", shape=(ngreater,3), itemsize=sizeof(np.float64_t))
6272  *             g_ids = cvarray(format="q", shape=(ngreater,), itemsize=sizeof(np.int64_t))             # <<<<<<<<<<<<<<
6273  *
6274  *             for i in range(ngreater):
6275  */
6276     __pyx_t_9 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 255, __pyx_L1_error)
6277     __Pyx_GOTREF(__pyx_t_9);
6278     if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_format, __pyx_n_s_q) < 0) __PYX_ERR(0, 255, __pyx_L1_error)
6279     __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_ngreater); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error)
6280     __Pyx_GOTREF(__pyx_t_1);
6281     __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error)
6282     __Pyx_GOTREF(__pyx_t_2);
6283     __Pyx_GIVEREF(__pyx_t_1);
6284     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
6285     __pyx_t_1 = 0;
6286     if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_shape, __pyx_t_2) < 0) __PYX_ERR(0, 255, __pyx_L1_error)
6287     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6288     __pyx_t_2 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_int64_t))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error)
6289     __Pyx_GOTREF(__pyx_t_2);
6290     if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_itemsize, __pyx_t_2) < 0) __PYX_ERR(0, 255, __pyx_L1_error)
6291     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6292     __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error)
6293     __Pyx_GOTREF(__pyx_t_2);
6294     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6295     __pyx_t_21 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int64_t(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_21.memview)) __PYX_ERR(0, 255, __pyx_L1_error)
6296     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6297     __pyx_v_g_ids = __pyx_t_21;
6298     __pyx_t_21.memview = NULL;
6299     __pyx_t_21.data = NULL;
6300 
6301     /* "yt/utilities/lib/amr_kdtools.pyx":257
6302  *             g_ids = cvarray(format="q", shape=(ngreater,), itemsize=sizeof(np.int64_t))
6303  *
6304  *             for i in range(ngreater):             # <<<<<<<<<<<<<<
6305  *                 index = greater_ids[i]
6306  *                 g_ids[i] = gids[index]
6307  */
6308     __pyx_t_11 = __pyx_v_ngreater;
6309     __pyx_t_14 = __pyx_t_11;
6310     for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
6311       __pyx_v_i = __pyx_t_15;
6312 
6313       /* "yt/utilities/lib/amr_kdtools.pyx":258
6314  *
6315  *             for i in range(ngreater):
6316  *                 index = greater_ids[i]             # <<<<<<<<<<<<<<
6317  *                 g_ids[i] = gids[index]
6318  *                 for j in range(3):
6319  */
6320       __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_greater_ids, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L1_error)
6321       __Pyx_GOTREF(__pyx_t_2);
6322       __pyx_t_22 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_22 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 258, __pyx_L1_error)
6323       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6324       __pyx_v_index = __pyx_t_22;
6325 
6326       /* "yt/utilities/lib/amr_kdtools.pyx":259
6327  *             for i in range(ngreater):
6328  *                 index = greater_ids[i]
6329  *                 g_ids[i] = gids[index]             # <<<<<<<<<<<<<<
6330  *                 for j in range(3):
6331  *                     greater_gles[i,j] = gles[index,j]
6332  */
6333       __pyx_t_33 = __pyx_v_index;
6334       __pyx_t_34 = __pyx_v_i;
6335       *((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ (__pyx_v_g_ids.data + __pyx_t_34 * __pyx_v_g_ids.strides[0]) )) = (*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ (__pyx_v_gids.data + __pyx_t_33 * __pyx_v_gids.strides[0]) )));
6336 
6337       /* "yt/utilities/lib/amr_kdtools.pyx":260
6338  *                 index = greater_ids[i]
6339  *                 g_ids[i] = gids[index]
6340  *                 for j in range(3):             # <<<<<<<<<<<<<<
6341  *                     greater_gles[i,j] = gles[index,j]
6342  *                     greater_gres[i,j] = gres[index,j]
6343  */
6344       for (__pyx_t_22 = 0; __pyx_t_22 < 3; __pyx_t_22+=1) {
6345         __pyx_v_j = __pyx_t_22;
6346 
6347         /* "yt/utilities/lib/amr_kdtools.pyx":261
6348  *                 g_ids[i] = gids[index]
6349  *                 for j in range(3):
6350  *                     greater_gles[i,j] = gles[index,j]             # <<<<<<<<<<<<<<
6351  *                     greater_gres[i,j] = gres[index,j]
6352  *
6353  */
6354         __pyx_t_35 = __pyx_v_index;
6355         __pyx_t_36 = __pyx_v_j;
6356         __pyx_t_37 = __pyx_v_i;
6357         __pyx_t_38 = __pyx_v_j;
6358         *((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_greater_gles.data + __pyx_t_37 * __pyx_v_greater_gles.strides[0]) ) + __pyx_t_38 * __pyx_v_greater_gles.strides[1]) )) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_gles.data + __pyx_t_35 * __pyx_v_gles.strides[0]) ) + __pyx_t_36 * __pyx_v_gles.strides[1]) )));
6359 
6360         /* "yt/utilities/lib/amr_kdtools.pyx":262
6361  *                 for j in range(3):
6362  *                     greater_gles[i,j] = gles[index,j]
6363  *                     greater_gres[i,j] = gres[index,j]             # <<<<<<<<<<<<<<
6364  *
6365  *             self.right.add_grids(ngreater, greater_gles, greater_gres,
6366  */
6367         __pyx_t_39 = __pyx_v_index;
6368         __pyx_t_40 = __pyx_v_j;
6369         __pyx_t_41 = __pyx_v_i;
6370         __pyx_t_42 = __pyx_v_j;
6371         *((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_greater_gres.data + __pyx_t_41 * __pyx_v_greater_gres.strides[0]) ) + __pyx_t_42 * __pyx_v_greater_gres.strides[1]) )) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_gres.data + __pyx_t_39 * __pyx_v_gres.strides[0]) ) + __pyx_t_40 * __pyx_v_gres.strides[1]) )));
6372       }
6373     }
6374 
6375     /* "yt/utilities/lib/amr_kdtools.pyx":264
6376  *                     greater_gres[i,j] = gres[index,j]
6377  *
6378  *             self.right.add_grids(ngreater, greater_gles, greater_gres,             # <<<<<<<<<<<<<<
6379  *                       g_ids, rank, size)
6380  *
6381  */
6382     __pyx_t_2 = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->right->__pyx_vtab)->add_grids(__pyx_v_self->right, __pyx_v_ngreater, __pyx_v_greater_gles, __pyx_v_greater_gres, __pyx_v_g_ids, __pyx_v_rank, __pyx_v_size, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 264, __pyx_L1_error)
6383     __Pyx_GOTREF(__pyx_t_2);
6384     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6385 
6386     /* "yt/utilities/lib/amr_kdtools.pyx":252
6387  *                       l_ids, rank, size)
6388  *
6389  *         if ngreater > 0:             # <<<<<<<<<<<<<<
6390  *             greater_gles = cvarray(format="d", shape=(ngreater,3), itemsize=sizeof(np.float64_t))
6391  *             greater_gres = cvarray(format="d", shape=(ngreater,3), itemsize=sizeof(np.float64_t))
6392  */
6393   }
6394 
6395   /* "yt/utilities/lib/amr_kdtools.pyx":267
6396  *                       g_ids, rank, size)
6397  *
6398  *         return             # <<<<<<<<<<<<<<
6399  *
6400  *     @cython.boundscheck(False)
6401  */
6402   __Pyx_XDECREF(__pyx_r);
6403   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6404   goto __pyx_L0;
6405 
6406   /* "yt/utilities/lib/amr_kdtools.pyx":203
6407  *     @cython.wraparound(False)
6408  *     @cython.cdivision(True)
6409  *     cpdef add_grids(self,             # <<<<<<<<<<<<<<
6410  *                         int ngrids,
6411  *                         np.float64_t[:,:] gles,
6412  */
6413 
6414   /* function exit code */
6415   __pyx_L1_error:;
6416   __Pyx_XDECREF(__pyx_t_1);
6417   __Pyx_XDECREF(__pyx_t_2);
6418   __Pyx_XDECREF(__pyx_t_3);
6419   __Pyx_XDECREF(__pyx_t_4);
6420   __Pyx_XDECREF(__pyx_t_5);
6421   __Pyx_XDECREF(__pyx_t_6);
6422   __Pyx_XDECREF(__pyx_t_7);
6423   __Pyx_XDECREF(__pyx_t_8);
6424   __Pyx_XDECREF(__pyx_t_9);
6425   __Pyx_XDECREF(__pyx_t_10);
6426   __Pyx_XDECREF(__pyx_t_12);
6427   __PYX_XDEC_MEMVIEW(&__pyx_t_20, 1);
6428   __PYX_XDEC_MEMVIEW(&__pyx_t_21, 1);
6429   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.add_grids", __pyx_clineno, __pyx_lineno, __pyx_filename);
6430   __pyx_r = 0;
6431   __pyx_L0:;
6432   __PYX_XDEC_MEMVIEW(&__pyx_v_less_gles, 1);
6433   __PYX_XDEC_MEMVIEW(&__pyx_v_less_gres, 1);
6434   __PYX_XDEC_MEMVIEW(&__pyx_v_greater_gles, 1);
6435   __PYX_XDEC_MEMVIEW(&__pyx_v_greater_gres, 1);
6436   __PYX_XDEC_MEMVIEW(&__pyx_v_l_ids, 1);
6437   __PYX_XDEC_MEMVIEW(&__pyx_v_g_ids, 1);
6438   __Pyx_XDECREF(__pyx_v_less_ids);
6439   __Pyx_XDECREF(__pyx_v_greater_ids);
6440   __Pyx_XGIVEREF(__pyx_r);
6441   __Pyx_RefNannyFinishContext();
6442   return __pyx_r;
6443 }
6444 
6445 /* Python wrapper */
6446 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_28add_grids(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6447 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_28add_grids(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6448   int __pyx_v_ngrids;
6449   __Pyx_memviewslice __pyx_v_gles = { 0, 0, { 0 }, { 0 }, { 0 } };
6450   __Pyx_memviewslice __pyx_v_gres = { 0, 0, { 0 }, { 0 }, { 0 } };
6451   __Pyx_memviewslice __pyx_v_gids = { 0, 0, { 0 }, { 0 }, { 0 } };
6452   int __pyx_v_rank;
6453   int __pyx_v_size;
6454   PyObject *__pyx_r = 0;
6455   __Pyx_RefNannyDeclarations
6456   __Pyx_RefNannySetupContext("add_grids (wrapper)", 0);
6457   {
6458     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ngrids,&__pyx_n_s_gles,&__pyx_n_s_gres,&__pyx_n_s_gids,&__pyx_n_s_rank,&__pyx_n_s_size,0};
6459     PyObject* values[6] = {0,0,0,0,0,0};
6460     if (unlikely(__pyx_kwds)) {
6461       Py_ssize_t kw_args;
6462       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6463       switch (pos_args) {
6464         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6465         CYTHON_FALLTHROUGH;
6466         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6467         CYTHON_FALLTHROUGH;
6468         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6469         CYTHON_FALLTHROUGH;
6470         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6471         CYTHON_FALLTHROUGH;
6472         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6473         CYTHON_FALLTHROUGH;
6474         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6475         CYTHON_FALLTHROUGH;
6476         case  0: break;
6477         default: goto __pyx_L5_argtuple_error;
6478       }
6479       kw_args = PyDict_Size(__pyx_kwds);
6480       switch (pos_args) {
6481         case  0:
6482         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ngrids)) != 0)) kw_args--;
6483         else goto __pyx_L5_argtuple_error;
6484         CYTHON_FALLTHROUGH;
6485         case  1:
6486         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gles)) != 0)) kw_args--;
6487         else {
6488           __Pyx_RaiseArgtupleInvalid("add_grids", 1, 6, 6, 1); __PYX_ERR(0, 203, __pyx_L3_error)
6489         }
6490         CYTHON_FALLTHROUGH;
6491         case  2:
6492         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gres)) != 0)) kw_args--;
6493         else {
6494           __Pyx_RaiseArgtupleInvalid("add_grids", 1, 6, 6, 2); __PYX_ERR(0, 203, __pyx_L3_error)
6495         }
6496         CYTHON_FALLTHROUGH;
6497         case  3:
6498         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gids)) != 0)) kw_args--;
6499         else {
6500           __Pyx_RaiseArgtupleInvalid("add_grids", 1, 6, 6, 3); __PYX_ERR(0, 203, __pyx_L3_error)
6501         }
6502         CYTHON_FALLTHROUGH;
6503         case  4:
6504         if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rank)) != 0)) kw_args--;
6505         else {
6506           __Pyx_RaiseArgtupleInvalid("add_grids", 1, 6, 6, 4); __PYX_ERR(0, 203, __pyx_L3_error)
6507         }
6508         CYTHON_FALLTHROUGH;
6509         case  5:
6510         if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--;
6511         else {
6512           __Pyx_RaiseArgtupleInvalid("add_grids", 1, 6, 6, 5); __PYX_ERR(0, 203, __pyx_L3_error)
6513         }
6514       }
6515       if (unlikely(kw_args > 0)) {
6516         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_grids") < 0)) __PYX_ERR(0, 203, __pyx_L3_error)
6517       }
6518     } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
6519       goto __pyx_L5_argtuple_error;
6520     } else {
6521       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6522       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6523       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6524       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6525       values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6526       values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6527     }
6528     __pyx_v_ngrids = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_ngrids == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 204, __pyx_L3_error)
6529     __pyx_v_gles = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_gles.memview)) __PYX_ERR(0, 205, __pyx_L3_error)
6530     __pyx_v_gres = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_gres.memview)) __PYX_ERR(0, 206, __pyx_L3_error)
6531     __pyx_v_gids = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int64_t(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_gids.memview)) __PYX_ERR(0, 207, __pyx_L3_error)
6532     __pyx_v_rank = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_rank == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 208, __pyx_L3_error)
6533     __pyx_v_size = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L3_error)
6534   }
6535   goto __pyx_L4_argument_unpacking_done;
6536   __pyx_L5_argtuple_error:;
6537   __Pyx_RaiseArgtupleInvalid("add_grids", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 203, __pyx_L3_error)
6538   __pyx_L3_error:;
6539   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.add_grids", __pyx_clineno, __pyx_lineno, __pyx_filename);
6540   __Pyx_RefNannyFinishContext();
6541   return NULL;
6542   __pyx_L4_argument_unpacking_done:;
6543   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_27add_grids(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self), __pyx_v_ngrids, __pyx_v_gles, __pyx_v_gres, __pyx_v_gids, __pyx_v_rank, __pyx_v_size);
6544 
6545   /* function exit code */
6546   __Pyx_RefNannyFinishContext();
6547   return __pyx_r;
6548 }
6549 
6550 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_27add_grids(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, int __pyx_v_ngrids, __Pyx_memviewslice __pyx_v_gles, __Pyx_memviewslice __pyx_v_gres, __Pyx_memviewslice __pyx_v_gids, int __pyx_v_rank, int __pyx_v_size) {
6551   PyObject *__pyx_r = NULL;
6552   __Pyx_RefNannyDeclarations
6553   PyObject *__pyx_t_1 = NULL;
6554   __Pyx_RefNannySetupContext("add_grids", 0);
6555   __Pyx_XDECREF(__pyx_r);
6556   if (unlikely(!__pyx_v_gles.memview)) { __Pyx_RaiseUnboundLocalError("gles"); __PYX_ERR(0, 203, __pyx_L1_error) }
6557   if (unlikely(!__pyx_v_gres.memview)) { __Pyx_RaiseUnboundLocalError("gres"); __PYX_ERR(0, 203, __pyx_L1_error) }
6558   if (unlikely(!__pyx_v_gids.memview)) { __Pyx_RaiseUnboundLocalError("gids"); __PYX_ERR(0, 203, __pyx_L1_error) }
6559   __pyx_t_1 = __pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_add_grids(__pyx_v_self, __pyx_v_ngrids, __pyx_v_gles, __pyx_v_gres, __pyx_v_gids, __pyx_v_rank, __pyx_v_size, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error)
6560   __Pyx_GOTREF(__pyx_t_1);
6561   __pyx_r = __pyx_t_1;
6562   __pyx_t_1 = 0;
6563   goto __pyx_L0;
6564 
6565   /* function exit code */
6566   __pyx_L1_error:;
6567   __Pyx_XDECREF(__pyx_t_1);
6568   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.add_grids", __pyx_clineno, __pyx_lineno, __pyx_filename);
6569   __pyx_r = NULL;
6570   __pyx_L0:;
6571   __PYX_XDEC_MEMVIEW(&__pyx_v_gles, 1);
6572   __PYX_XDEC_MEMVIEW(&__pyx_v_gres, 1);
6573   __PYX_XDEC_MEMVIEW(&__pyx_v_gids, 1);
6574   __Pyx_XGIVEREF(__pyx_r);
6575   __Pyx_RefNannyFinishContext();
6576   return __pyx_r;
6577 }
6578 
6579 /* "yt/utilities/lib/amr_kdtools.pyx":272
6580  *     @cython.wraparound(False)
6581  *     @cython.cdivision(True)
6582  *     cdef int should_i_split(self, int rank, int size):             # <<<<<<<<<<<<<<
6583  *         if self.node_id < size and self.node_id > 0:
6584  *             return 1
6585  */
6586 
6587 static int __pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_should_i_split(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, CYTHON_UNUSED int __pyx_v_rank, int __pyx_v_size) {
6588   int __pyx_r;
6589   __Pyx_RefNannyDeclarations
6590   int __pyx_t_1;
6591   int __pyx_t_2;
6592   __Pyx_RefNannySetupContext("should_i_split", 0);
6593 
6594   /* "yt/utilities/lib/amr_kdtools.pyx":273
6595  *     @cython.cdivision(True)
6596  *     cdef int should_i_split(self, int rank, int size):
6597  *         if self.node_id < size and self.node_id > 0:             # <<<<<<<<<<<<<<
6598  *             return 1
6599  *         return 0
6600  */
6601   __pyx_t_2 = ((__pyx_v_self->node_id < __pyx_v_size) != 0);
6602   if (__pyx_t_2) {
6603   } else {
6604     __pyx_t_1 = __pyx_t_2;
6605     goto __pyx_L4_bool_binop_done;
6606   }
6607   __pyx_t_2 = ((__pyx_v_self->node_id > 0) != 0);
6608   __pyx_t_1 = __pyx_t_2;
6609   __pyx_L4_bool_binop_done:;
6610   if (__pyx_t_1) {
6611 
6612     /* "yt/utilities/lib/amr_kdtools.pyx":274
6613  *     cdef int should_i_split(self, int rank, int size):
6614  *         if self.node_id < size and self.node_id > 0:
6615  *             return 1             # <<<<<<<<<<<<<<
6616  *         return 0
6617  *
6618  */
6619     __pyx_r = 1;
6620     goto __pyx_L0;
6621 
6622     /* "yt/utilities/lib/amr_kdtools.pyx":273
6623  *     @cython.cdivision(True)
6624  *     cdef int should_i_split(self, int rank, int size):
6625  *         if self.node_id < size and self.node_id > 0:             # <<<<<<<<<<<<<<
6626  *             return 1
6627  *         return 0
6628  */
6629   }
6630 
6631   /* "yt/utilities/lib/amr_kdtools.pyx":275
6632  *         if self.node_id < size and self.node_id > 0:
6633  *             return 1
6634  *         return 0             # <<<<<<<<<<<<<<
6635  *
6636  *     @cython.boundscheck(False)
6637  */
6638   __pyx_r = 0;
6639   goto __pyx_L0;
6640 
6641   /* "yt/utilities/lib/amr_kdtools.pyx":272
6642  *     @cython.wraparound(False)
6643  *     @cython.cdivision(True)
6644  *     cdef int should_i_split(self, int rank, int size):             # <<<<<<<<<<<<<<
6645  *         if self.node_id < size and self.node_id > 0:
6646  *             return 1
6647  */
6648 
6649   /* function exit code */
6650   __pyx_L0:;
6651   __Pyx_RefNannyFinishContext();
6652   return __pyx_r;
6653 }
6654 
6655 /* "yt/utilities/lib/amr_kdtools.pyx":280
6656  *     @cython.wraparound(False)
6657  *     @cython.cdivision(True)
6658  *     cdef void insert_grids(self,             # <<<<<<<<<<<<<<
6659  *                            int ngrids,
6660  *                            np.float64_t[:,:] gles,
6661  */
6662 
6663 static void __pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_insert_grids(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, int __pyx_v_ngrids, __Pyx_memviewslice __pyx_v_gles, __Pyx_memviewslice __pyx_v_gres, __Pyx_memviewslice __pyx_v_gids, int __pyx_v_rank, int __pyx_v_size) {
6664   int __pyx_v_contained;
6665   int __pyx_v_check;
6666   long __pyx_v_i;
6667   __Pyx_RefNannyDeclarations
6668   int __pyx_t_1;
6669   int __pyx_t_2;
6670   __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
6671   __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
6672   Py_ssize_t __pyx_t_5;
6673   PyObject *__pyx_t_6 = NULL;
6674   long __pyx_t_7;
6675   Py_ssize_t __pyx_t_8;
6676   Py_ssize_t __pyx_t_9;
6677   Py_ssize_t __pyx_t_10;
6678   Py_ssize_t __pyx_t_11;
6679   Py_ssize_t __pyx_t_12;
6680   __Pyx_RefNannySetupContext("insert_grids", 0);
6681 
6682   /* "yt/utilities/lib/amr_kdtools.pyx":288
6683  *                            int size):
6684  *
6685  *         if not should_i_build(self, rank, size) or ngrids == 0:             # <<<<<<<<<<<<<<
6686  *             return
6687  *         cdef int contained = 1
6688  */
6689   __pyx_t_2 = ((!(__pyx_f_2yt_9utilities_3lib_11amr_kdtools_should_i_build(__pyx_v_self, __pyx_v_rank, __pyx_v_size) != 0)) != 0);
6690   if (!__pyx_t_2) {
6691   } else {
6692     __pyx_t_1 = __pyx_t_2;
6693     goto __pyx_L4_bool_binop_done;
6694   }
6695   __pyx_t_2 = ((__pyx_v_ngrids == 0) != 0);
6696   __pyx_t_1 = __pyx_t_2;
6697   __pyx_L4_bool_binop_done:;
6698   if (__pyx_t_1) {
6699 
6700     /* "yt/utilities/lib/amr_kdtools.pyx":289
6701  *
6702  *         if not should_i_build(self, rank, size) or ngrids == 0:
6703  *             return             # <<<<<<<<<<<<<<
6704  *         cdef int contained = 1
6705  *         cdef int check
6706  */
6707     goto __pyx_L0;
6708 
6709     /* "yt/utilities/lib/amr_kdtools.pyx":288
6710  *                            int size):
6711  *
6712  *         if not should_i_build(self, rank, size) or ngrids == 0:             # <<<<<<<<<<<<<<
6713  *             return
6714  *         cdef int contained = 1
6715  */
6716   }
6717 
6718   /* "yt/utilities/lib/amr_kdtools.pyx":290
6719  *         if not should_i_build(self, rank, size) or ngrids == 0:
6720  *             return
6721  *         cdef int contained = 1             # <<<<<<<<<<<<<<
6722  *         cdef int check
6723  *
6724  */
6725   __pyx_v_contained = 1;
6726 
6727   /* "yt/utilities/lib/amr_kdtools.pyx":293
6728  *         cdef int check
6729  *
6730  *         if ngrids == 1:             # <<<<<<<<<<<<<<
6731  *             # If we should continue to split based on parallelism, do so!
6732  *             if self.should_i_split(rank, size):
6733  */
6734   __pyx_t_1 = ((__pyx_v_ngrids == 1) != 0);
6735   if (__pyx_t_1) {
6736 
6737     /* "yt/utilities/lib/amr_kdtools.pyx":295
6738  *         if ngrids == 1:
6739  *             # If we should continue to split based on parallelism, do so!
6740  *             if self.should_i_split(rank, size):             # <<<<<<<<<<<<<<
6741  *                 self.geo_split(gles[0,:], gres[0,:], gids[0], rank, size)
6742  *                 return
6743  */
6744     __pyx_t_1 = (((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->__pyx_vtab)->should_i_split(__pyx_v_self, __pyx_v_rank, __pyx_v_size) != 0);
6745     if (__pyx_t_1) {
6746 
6747       /* "yt/utilities/lib/amr_kdtools.pyx":296
6748  *             # If we should continue to split based on parallelism, do so!
6749  *             if self.should_i_split(rank, size):
6750  *                 self.geo_split(gles[0,:], gres[0,:], gids[0], rank, size)             # <<<<<<<<<<<<<<
6751  *                 return
6752  *
6753  */
6754       __pyx_t_3.data = __pyx_v_gles.data;
6755       __pyx_t_3.memview = __pyx_v_gles.memview;
6756       __PYX_INC_MEMVIEW(&__pyx_t_3, 0);
6757       {
6758     Py_ssize_t __pyx_tmp_idx = 0;
6759     Py_ssize_t __pyx_tmp_stride = __pyx_v_gles.strides[0];
6760         if ((0)) __PYX_ERR(0, 296, __pyx_L1_error)
6761         __pyx_t_3.data += __pyx_tmp_idx * __pyx_tmp_stride;
6762 }
6763 
6764 __pyx_t_3.shape[0] = __pyx_v_gles.shape[1];
6765 __pyx_t_3.strides[0] = __pyx_v_gles.strides[1];
6766     __pyx_t_3.suboffsets[0] = -1;
6767 
6768 __pyx_t_4.data = __pyx_v_gres.data;
6769       __pyx_t_4.memview = __pyx_v_gres.memview;
6770       __PYX_INC_MEMVIEW(&__pyx_t_4, 0);
6771       {
6772     Py_ssize_t __pyx_tmp_idx = 0;
6773     Py_ssize_t __pyx_tmp_stride = __pyx_v_gres.strides[0];
6774         if ((0)) __PYX_ERR(0, 296, __pyx_L1_error)
6775         __pyx_t_4.data += __pyx_tmp_idx * __pyx_tmp_stride;
6776 }
6777 
6778 __pyx_t_4.shape[0] = __pyx_v_gres.shape[1];
6779 __pyx_t_4.strides[0] = __pyx_v_gres.strides[1];
6780     __pyx_t_4.suboffsets[0] = -1;
6781 
6782 __pyx_t_5 = 0;
6783       __pyx_t_6 = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->__pyx_vtab)->geo_split(__pyx_v_self, __pyx_t_3, __pyx_t_4, (*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ (__pyx_v_gids.data + __pyx_t_5 * __pyx_v_gids.strides[0]) ))), __pyx_v_rank, __pyx_v_size); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 296, __pyx_L1_error)
6784       __Pyx_GOTREF(__pyx_t_6);
6785       __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
6786       __pyx_t_3.memview = NULL;
6787       __pyx_t_3.data = NULL;
6788       __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
6789       __pyx_t_4.memview = NULL;
6790       __pyx_t_4.data = NULL;
6791       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6792 
6793       /* "yt/utilities/lib/amr_kdtools.pyx":297
6794  *             if self.should_i_split(rank, size):
6795  *                 self.geo_split(gles[0,:], gres[0,:], gids[0], rank, size)
6796  *                 return             # <<<<<<<<<<<<<<
6797  *
6798  *             for i in range(3):
6799  */
6800       goto __pyx_L0;
6801 
6802       /* "yt/utilities/lib/amr_kdtools.pyx":295
6803  *         if ngrids == 1:
6804  *             # If we should continue to split based on parallelism, do so!
6805  *             if self.should_i_split(rank, size):             # <<<<<<<<<<<<<<
6806  *                 self.geo_split(gles[0,:], gres[0,:], gids[0], rank, size)
6807  *                 return
6808  */
6809     }
6810 
6811     /* "yt/utilities/lib/amr_kdtools.pyx":299
6812  *                 return
6813  *
6814  *             for i in range(3):             # <<<<<<<<<<<<<<
6815  *                 contained *= gles[0,i] <= self.left_edge[i]
6816  *                 contained *= gres[0,i] >= self.right_edge[i]
6817  */
6818     for (__pyx_t_7 = 0; __pyx_t_7 < 3; __pyx_t_7+=1) {
6819       __pyx_v_i = __pyx_t_7;
6820 
6821       /* "yt/utilities/lib/amr_kdtools.pyx":300
6822  *
6823  *             for i in range(3):
6824  *                 contained *= gles[0,i] <= self.left_edge[i]             # <<<<<<<<<<<<<<
6825  *                 contained *= gres[0,i] >= self.right_edge[i]
6826  *
6827  */
6828       __pyx_t_8 = 0;
6829       __pyx_t_9 = __pyx_v_i;
6830       __pyx_v_contained = (__pyx_v_contained * ((*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_gles.data + __pyx_t_8 * __pyx_v_gles.strides[0]) ) + __pyx_t_9 * __pyx_v_gles.strides[1]) ))) <= (__pyx_v_self->left_edge[__pyx_v_i])));
6831 
6832       /* "yt/utilities/lib/amr_kdtools.pyx":301
6833  *             for i in range(3):
6834  *                 contained *= gles[0,i] <= self.left_edge[i]
6835  *                 contained *= gres[0,i] >= self.right_edge[i]             # <<<<<<<<<<<<<<
6836  *
6837  *             if contained == 1:
6838  */
6839       __pyx_t_10 = 0;
6840       __pyx_t_11 = __pyx_v_i;
6841       __pyx_v_contained = (__pyx_v_contained * ((*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_gres.data + __pyx_t_10 * __pyx_v_gres.strides[0]) ) + __pyx_t_11 * __pyx_v_gres.strides[1]) ))) >= (__pyx_v_self->right_edge[__pyx_v_i])));
6842     }
6843 
6844     /* "yt/utilities/lib/amr_kdtools.pyx":303
6845  *                 contained *= gres[0,i] >= self.right_edge[i]
6846  *
6847  *             if contained == 1:             # <<<<<<<<<<<<<<
6848  *                 # print('Node fully contained, setting to grid: %i' % gids[0])
6849  *                 self.grid = gids[0]
6850  */
6851     __pyx_t_1 = ((__pyx_v_contained == 1) != 0);
6852     if (__pyx_t_1) {
6853 
6854       /* "yt/utilities/lib/amr_kdtools.pyx":305
6855  *             if contained == 1:
6856  *                 # print('Node fully contained, setting to grid: %i' % gids[0])
6857  *                 self.grid = gids[0]             # <<<<<<<<<<<<<<
6858  *                 assert(self.grid != -1)
6859  *                 return
6860  */
6861       __pyx_t_12 = 0;
6862       __pyx_v_self->grid = (*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ (__pyx_v_gids.data + __pyx_t_12 * __pyx_v_gids.strides[0]) )));
6863 
6864       /* "yt/utilities/lib/amr_kdtools.pyx":306
6865  *                 # print('Node fully contained, setting to grid: %i' % gids[0])
6866  *                 self.grid = gids[0]
6867  *                 assert(self.grid != -1)             # <<<<<<<<<<<<<<
6868  *                 return
6869  *
6870  */
6871       #ifndef CYTHON_WITHOUT_ASSERTIONS
6872       if (unlikely(!Py_OptimizeFlag)) {
6873         if (unlikely(!((__pyx_v_self->grid != -1L) != 0))) {
6874           PyErr_SetNone(PyExc_AssertionError);
6875           __PYX_ERR(0, 306, __pyx_L1_error)
6876         }
6877       }
6878       #endif
6879 
6880       /* "yt/utilities/lib/amr_kdtools.pyx":307
6881  *                 self.grid = gids[0]
6882  *                 assert(self.grid != -1)
6883  *                 return             # <<<<<<<<<<<<<<
6884  *
6885  *         # Split the grids
6886  */
6887       goto __pyx_L0;
6888 
6889       /* "yt/utilities/lib/amr_kdtools.pyx":303
6890  *                 contained *= gres[0,i] >= self.right_edge[i]
6891  *
6892  *             if contained == 1:             # <<<<<<<<<<<<<<
6893  *                 # print('Node fully contained, setting to grid: %i' % gids[0])
6894  *                 self.grid = gids[0]
6895  */
6896     }
6897 
6898     /* "yt/utilities/lib/amr_kdtools.pyx":293
6899  *         cdef int check
6900  *
6901  *         if ngrids == 1:             # <<<<<<<<<<<<<<
6902  *             # If we should continue to split based on parallelism, do so!
6903  *             if self.should_i_split(rank, size):
6904  */
6905   }
6906 
6907   /* "yt/utilities/lib/amr_kdtools.pyx":310
6908  *
6909  *         # Split the grids
6910  *         check = self.split_grids(ngrids, gles, gres, gids, rank, size)             # <<<<<<<<<<<<<<
6911  *         # If check is -1, then we have found a place where there are no choices.
6912  *         # Exit out and set the node to None.
6913  */
6914   __pyx_v_check = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->__pyx_vtab)->split_grids(__pyx_v_self, __pyx_v_ngrids, __pyx_v_gles, __pyx_v_gres, __pyx_v_gids, __pyx_v_rank, __pyx_v_size);
6915 
6916   /* "yt/utilities/lib/amr_kdtools.pyx":313
6917  *         # If check is -1, then we have found a place where there are no choices.
6918  *         # Exit out and set the node to None.
6919  *         if check == -1:             # <<<<<<<<<<<<<<
6920  *             self.grid = -1
6921  *         return
6922  */
6923   __pyx_t_1 = ((__pyx_v_check == -1L) != 0);
6924   if (__pyx_t_1) {
6925 
6926     /* "yt/utilities/lib/amr_kdtools.pyx":314
6927  *         # Exit out and set the node to None.
6928  *         if check == -1:
6929  *             self.grid = -1             # <<<<<<<<<<<<<<
6930  *         return
6931  *
6932  */
6933     __pyx_v_self->grid = -1;
6934 
6935     /* "yt/utilities/lib/amr_kdtools.pyx":313
6936  *         # If check is -1, then we have found a place where there are no choices.
6937  *         # Exit out and set the node to None.
6938  *         if check == -1:             # <<<<<<<<<<<<<<
6939  *             self.grid = -1
6940  *         return
6941  */
6942   }
6943 
6944   /* "yt/utilities/lib/amr_kdtools.pyx":315
6945  *         if check == -1:
6946  *             self.grid = -1
6947  *         return             # <<<<<<<<<<<<<<
6948  *
6949  *     @cython.boundscheck(False)
6950  */
6951   goto __pyx_L0;
6952 
6953   /* "yt/utilities/lib/amr_kdtools.pyx":280
6954  *     @cython.wraparound(False)
6955  *     @cython.cdivision(True)
6956  *     cdef void insert_grids(self,             # <<<<<<<<<<<<<<
6957  *                            int ngrids,
6958  *                            np.float64_t[:,:] gles,
6959  */
6960 
6961   /* function exit code */
6962   __pyx_L1_error:;
6963   __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
6964   __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
6965   __Pyx_XDECREF(__pyx_t_6);
6966   __Pyx_WriteUnraisable("yt.utilities.lib.amr_kdtools.Node.insert_grids", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
6967   __pyx_L0:;
6968   __Pyx_RefNannyFinishContext();
6969 }
6970 
6971 /* "yt/utilities/lib/amr_kdtools.pyx":320
6972  *     @cython.wraparound(False)
6973  *     @cython.cdivision(True)
6974  *     cdef split_grid(self,             # <<<<<<<<<<<<<<
6975  *                    np.float64_t[:] gle,
6976  *                    np.float64_t[:] gre,
6977  */
6978 
6979 static PyObject *__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_split_grid(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, __Pyx_memviewslice __pyx_v_gle, __Pyx_memviewslice __pyx_v_gre, int __pyx_v_gid, int __pyx_v_rank, int __pyx_v_size) {
6980   int __pyx_v_j;
6981   __Pyx_memviewslice __pyx_v_less_ids = { 0, 0, { 0 }, { 0 }, { 0 } };
6982   __Pyx_memviewslice __pyx_v_greater_ids = { 0, 0, { 0 }, { 0 }, { 0 } };
6983   PyObject *__pyx_v_data = NULL;
6984   PyObject *__pyx_v_best_dim = NULL;
6985   PyObject *__pyx_v_split_pos = NULL;
6986   PyObject *__pyx_v_nless = NULL;
6987   PyObject *__pyx_v_ngreater = NULL;
6988   struct __pyx_t_2yt_9utilities_3lib_11amr_kdtools_Split *__pyx_v_split;
6989   PyObject *__pyx_r = NULL;
6990   __Pyx_RefNannyDeclarations
6991   PyObject *__pyx_t_1 = NULL;
6992   PyObject *__pyx_t_2 = NULL;
6993   int __pyx_t_3;
6994   Py_ssize_t __pyx_t_4;
6995   PyObject *__pyx_t_5 = NULL;
6996   Py_ssize_t __pyx_t_6;
6997   __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
6998   __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
6999   __pyx_t_5numpy_float64_t *__pyx_t_9;
7000   struct __pyx_array_obj *__pyx_t_10 = NULL;
7001   __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
7002   __Pyx_memviewslice __pyx_t_12 = { 0, 0, { 0 }, { 0 }, { 0 } };
7003   PyObject *__pyx_t_13 = NULL;
7004   PyObject *__pyx_t_14 = NULL;
7005   PyObject *__pyx_t_15 = NULL;
7006   PyObject *(*__pyx_t_16)(PyObject *);
7007   int __pyx_t_17;
7008   __pyx_t_5numpy_float64_t __pyx_t_18;
7009   __Pyx_RefNannySetupContext("split_grid", 0);
7010 
7011   /* "yt/utilities/lib/amr_kdtools.pyx":329
7012  *         cdef int j
7013  *         cdef np.uint8_t[:] less_ids, greater_ids
7014  *         data = cvarray(format="d", shape=(1,2,3), itemsize=sizeof(np.float64_t))             # <<<<<<<<<<<<<<
7015  *         for j in range(3):
7016  *             data[0,0,j] = gle[j]
7017  */
7018   __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error)
7019   __Pyx_GOTREF(__pyx_t_1);
7020   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 329, __pyx_L1_error)
7021   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_shape, __pyx_tuple__2) < 0) __PYX_ERR(0, 329, __pyx_L1_error)
7022   __pyx_t_2 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_float64_t))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __pyx_L1_error)
7023   __Pyx_GOTREF(__pyx_t_2);
7024   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_itemsize, __pyx_t_2) < 0) __PYX_ERR(0, 329, __pyx_L1_error)
7025   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7026   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 329, __pyx_L1_error)
7027   __Pyx_GOTREF(__pyx_t_2);
7028   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7029   __pyx_v_data = __pyx_t_2;
7030   __pyx_t_2 = 0;
7031 
7032   /* "yt/utilities/lib/amr_kdtools.pyx":330
7033  *         cdef np.uint8_t[:] less_ids, greater_ids
7034  *         data = cvarray(format="d", shape=(1,2,3), itemsize=sizeof(np.float64_t))
7035  *         for j in range(3):             # <<<<<<<<<<<<<<
7036  *             data[0,0,j] = gle[j]
7037  *             data[0,1,j] = gre[j]
7038  */
7039   for (__pyx_t_3 = 0; __pyx_t_3 < 3; __pyx_t_3+=1) {
7040     __pyx_v_j = __pyx_t_3;
7041 
7042     /* "yt/utilities/lib/amr_kdtools.pyx":331
7043  *         data = cvarray(format="d", shape=(1,2,3), itemsize=sizeof(np.float64_t))
7044  *         for j in range(3):
7045  *             data[0,0,j] = gle[j]             # <<<<<<<<<<<<<<
7046  *             data[0,1,j] = gre[j]
7047  *
7048  */
7049     __pyx_t_4 = __pyx_v_j;
7050     __pyx_t_2 = PyFloat_FromDouble((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_gle.data + __pyx_t_4 * __pyx_v_gle.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 331, __pyx_L1_error)
7051     __Pyx_GOTREF(__pyx_t_2);
7052     __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error)
7053     __Pyx_GOTREF(__pyx_t_1);
7054     __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 331, __pyx_L1_error)
7055     __Pyx_GOTREF(__pyx_t_5);
7056     __Pyx_INCREF(__pyx_int_0);
7057     __Pyx_GIVEREF(__pyx_int_0);
7058     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_0);
7059     __Pyx_INCREF(__pyx_int_0);
7060     __Pyx_GIVEREF(__pyx_int_0);
7061     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_0);
7062     __Pyx_GIVEREF(__pyx_t_1);
7063     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_1);
7064     __pyx_t_1 = 0;
7065     if (unlikely(PyObject_SetItem(__pyx_v_data, __pyx_t_5, __pyx_t_2) < 0)) __PYX_ERR(0, 331, __pyx_L1_error)
7066     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7067     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7068 
7069     /* "yt/utilities/lib/amr_kdtools.pyx":332
7070  *         for j in range(3):
7071  *             data[0,0,j] = gle[j]
7072  *             data[0,1,j] = gre[j]             # <<<<<<<<<<<<<<
7073  *
7074  *         less_ids = cvarray(format="B", shape=(1,), itemsize=sizeof(np.uint8_t))
7075  */
7076     __pyx_t_6 = __pyx_v_j;
7077     __pyx_t_2 = PyFloat_FromDouble((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_gre.data + __pyx_t_6 * __pyx_v_gre.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 332, __pyx_L1_error)
7078     __Pyx_GOTREF(__pyx_t_2);
7079     __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 332, __pyx_L1_error)
7080     __Pyx_GOTREF(__pyx_t_5);
7081     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 332, __pyx_L1_error)
7082     __Pyx_GOTREF(__pyx_t_1);
7083     __Pyx_INCREF(__pyx_int_0);
7084     __Pyx_GIVEREF(__pyx_int_0);
7085     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
7086     __Pyx_INCREF(__pyx_int_1);
7087     __Pyx_GIVEREF(__pyx_int_1);
7088     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_1);
7089     __Pyx_GIVEREF(__pyx_t_5);
7090     PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_5);
7091     __pyx_t_5 = 0;
7092     if (unlikely(PyObject_SetItem(__pyx_v_data, __pyx_t_1, __pyx_t_2) < 0)) __PYX_ERR(0, 332, __pyx_L1_error)
7093     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7094     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7095   }
7096 
7097   /* "yt/utilities/lib/amr_kdtools.pyx":334
7098  *             data[0,1,j] = gre[j]
7099  *
7100  *         less_ids = cvarray(format="B", shape=(1,), itemsize=sizeof(np.uint8_t))             # <<<<<<<<<<<<<<
7101  *         greater_ids = cvarray(format="B", shape=(1,), itemsize=sizeof(np.uint8_t))
7102  *
7103  */
7104   __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 334, __pyx_L1_error)
7105   __Pyx_GOTREF(__pyx_t_2);
7106   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_format, __pyx_n_s_B) < 0) __PYX_ERR(0, 334, __pyx_L1_error)
7107   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_shape, __pyx_tuple__3) < 0) __PYX_ERR(0, 334, __pyx_L1_error)
7108   __pyx_t_1 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_uint8_t))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 334, __pyx_L1_error)
7109   __Pyx_GOTREF(__pyx_t_1);
7110   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_itemsize, __pyx_t_1) < 0) __PYX_ERR(0, 334, __pyx_L1_error)
7111   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7112   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 334, __pyx_L1_error)
7113   __Pyx_GOTREF(__pyx_t_1);
7114   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7115   __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_uint8_t(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 334, __pyx_L1_error)
7116   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7117   __pyx_v_less_ids = __pyx_t_7;
7118   __pyx_t_7.memview = NULL;
7119   __pyx_t_7.data = NULL;
7120 
7121   /* "yt/utilities/lib/amr_kdtools.pyx":335
7122  *
7123  *         less_ids = cvarray(format="B", shape=(1,), itemsize=sizeof(np.uint8_t))
7124  *         greater_ids = cvarray(format="B", shape=(1,), itemsize=sizeof(np.uint8_t))             # <<<<<<<<<<<<<<
7125  *
7126  *         best_dim, split_pos, nless, ngreater = \
7127  */
7128   __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 335, __pyx_L1_error)
7129   __Pyx_GOTREF(__pyx_t_1);
7130   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_format, __pyx_n_s_B) < 0) __PYX_ERR(0, 335, __pyx_L1_error)
7131   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_shape, __pyx_tuple__3) < 0) __PYX_ERR(0, 335, __pyx_L1_error)
7132   __pyx_t_2 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_uint8_t))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 335, __pyx_L1_error)
7133   __Pyx_GOTREF(__pyx_t_2);
7134   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_itemsize, __pyx_t_2) < 0) __PYX_ERR(0, 335, __pyx_L1_error)
7135   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7136   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 335, __pyx_L1_error)
7137   __Pyx_GOTREF(__pyx_t_2);
7138   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7139   __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_uint8_t(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 335, __pyx_L1_error)
7140   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7141   __pyx_v_greater_ids = __pyx_t_7;
7142   __pyx_t_7.memview = NULL;
7143   __pyx_t_7.data = NULL;
7144 
7145   /* "yt/utilities/lib/amr_kdtools.pyx":338
7146  *
7147  *         best_dim, split_pos, nless, ngreater = \
7148  *             kdtree_get_choices(1, data, self.left_edge, self.right_edge,             # <<<<<<<<<<<<<<
7149  *                               less_ids, greater_ids)
7150  *
7151  */
7152   __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_nn___pyx_t_5numpy_float64_t(__pyx_v_data, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 338, __pyx_L1_error)
7153   __pyx_t_9 = __pyx_v_self->left_edge;
7154   if (!__pyx_t_9) {
7155     PyErr_SetString(PyExc_ValueError,"Cannot create cython.array from NULL pointer");
7156     __PYX_ERR(0, 338, __pyx_L1_error)
7157   }
7158   __pyx_t_1 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t);
7159   __pyx_t_2 = Py_BuildValue((char*) "("  __PYX_BUILD_PY_SSIZE_T  ")", ((Py_ssize_t)3));
7160   if (unlikely(!__pyx_t_1 || !__pyx_t_2 || !PyBytes_AsString(__pyx_t_1))) __PYX_ERR(0, 338, __pyx_L1_error)
7161   __Pyx_GOTREF(__pyx_t_1);
7162   __Pyx_GOTREF(__pyx_t_2);
7163   __pyx_t_10 = __pyx_array_new(__pyx_t_2, sizeof(__pyx_t_5numpy_float64_t), PyBytes_AS_STRING(__pyx_t_1), (char *) "fortran", (char *) __pyx_t_9);
7164   if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 338, __pyx_L1_error)
7165   __Pyx_GOTREF(__pyx_t_10);
7166   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7167   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7168   __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(((PyObject *)__pyx_t_10), PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 338, __pyx_L1_error)
7169   __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
7170   __pyx_t_9 = __pyx_v_self->right_edge;
7171   if (!__pyx_t_9) {
7172     PyErr_SetString(PyExc_ValueError,"Cannot create cython.array from NULL pointer");
7173     __PYX_ERR(0, 338, __pyx_L1_error)
7174   }
7175   __pyx_t_2 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t);
7176   __pyx_t_1 = Py_BuildValue((char*) "("  __PYX_BUILD_PY_SSIZE_T  ")", ((Py_ssize_t)3));
7177   if (unlikely(!__pyx_t_2 || !__pyx_t_1 || !PyBytes_AsString(__pyx_t_2))) __PYX_ERR(0, 338, __pyx_L1_error)
7178   __Pyx_GOTREF(__pyx_t_2);
7179   __Pyx_GOTREF(__pyx_t_1);
7180   __pyx_t_10 = __pyx_array_new(__pyx_t_1, sizeof(__pyx_t_5numpy_float64_t), PyBytes_AS_STRING(__pyx_t_2), (char *) "fortran", (char *) __pyx_t_9);
7181   if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 338, __pyx_L1_error)
7182   __Pyx_GOTREF(__pyx_t_10);
7183   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7184   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7185   __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(((PyObject *)__pyx_t_10), PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 338, __pyx_L1_error)
7186   __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
7187 
7188   /* "yt/utilities/lib/amr_kdtools.pyx":339
7189  *         best_dim, split_pos, nless, ngreater = \
7190  *             kdtree_get_choices(1, data, self.left_edge, self.right_edge,
7191  *                               less_ids, greater_ids)             # <<<<<<<<<<<<<<
7192  *
7193  *         # If best_dim is -1, then we have found a place where there are no choices.
7194  */
7195   __pyx_t_2 = __pyx_f_2yt_9utilities_3lib_11amr_kdtools_kdtree_get_choices(1, __pyx_t_8, __pyx_t_11, __pyx_t_12, __pyx_v_less_ids, __pyx_v_greater_ids); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 338, __pyx_L1_error)
7196   __Pyx_GOTREF(__pyx_t_2);
7197   __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
7198   __pyx_t_8.memview = NULL;
7199   __pyx_t_8.data = NULL;
7200   __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
7201   __pyx_t_11.memview = NULL;
7202   __pyx_t_11.data = NULL;
7203   __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
7204   __pyx_t_12.memview = NULL;
7205   __pyx_t_12.data = NULL;
7206   if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
7207     PyObject* sequence = __pyx_t_2;
7208     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7209     if (unlikely(size != 4)) {
7210       if (size > 4) __Pyx_RaiseTooManyValuesError(4);
7211       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7212       __PYX_ERR(0, 337, __pyx_L1_error)
7213     }
7214     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7215     if (likely(PyTuple_CheckExact(sequence))) {
7216       __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
7217       __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
7218       __pyx_t_13 = PyTuple_GET_ITEM(sequence, 2);
7219       __pyx_t_14 = PyTuple_GET_ITEM(sequence, 3);
7220     } else {
7221       __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
7222       __pyx_t_5 = PyList_GET_ITEM(sequence, 1);
7223       __pyx_t_13 = PyList_GET_ITEM(sequence, 2);
7224       __pyx_t_14 = PyList_GET_ITEM(sequence, 3);
7225     }
7226     __Pyx_INCREF(__pyx_t_1);
7227     __Pyx_INCREF(__pyx_t_5);
7228     __Pyx_INCREF(__pyx_t_13);
7229     __Pyx_INCREF(__pyx_t_14);
7230     #else
7231     {
7232       Py_ssize_t i;
7233       PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_5,&__pyx_t_13,&__pyx_t_14};
7234       for (i=0; i < 4; i++) {
7235         PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 337, __pyx_L1_error)
7236         __Pyx_GOTREF(item);
7237         *(temps[i]) = item;
7238       }
7239     }
7240     #endif
7241     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7242   } else {
7243     Py_ssize_t index = -1;
7244     PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_5,&__pyx_t_13,&__pyx_t_14};
7245     __pyx_t_15 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 337, __pyx_L1_error)
7246     __Pyx_GOTREF(__pyx_t_15);
7247     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7248     __pyx_t_16 = Py_TYPE(__pyx_t_15)->tp_iternext;
7249     for (index=0; index < 4; index++) {
7250       PyObject* item = __pyx_t_16(__pyx_t_15); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
7251       __Pyx_GOTREF(item);
7252       *(temps[index]) = item;
7253     }
7254     if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_15), 4) < 0) __PYX_ERR(0, 337, __pyx_L1_error)
7255     __pyx_t_16 = NULL;
7256     __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7257     goto __pyx_L6_unpacking_done;
7258     __pyx_L5_unpacking_failed:;
7259     __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7260     __pyx_t_16 = NULL;
7261     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7262     __PYX_ERR(0, 337, __pyx_L1_error)
7263     __pyx_L6_unpacking_done:;
7264   }
7265 
7266   /* "yt/utilities/lib/amr_kdtools.pyx":337
7267  *         greater_ids = cvarray(format="B", shape=(1,), itemsize=sizeof(np.uint8_t))
7268  *
7269  *         best_dim, split_pos, nless, ngreater = \             # <<<<<<<<<<<<<<
7270  *             kdtree_get_choices(1, data, self.left_edge, self.right_edge,
7271  *                               less_ids, greater_ids)
7272  */
7273   __pyx_v_best_dim = __pyx_t_1;
7274   __pyx_t_1 = 0;
7275   __pyx_v_split_pos = __pyx_t_5;
7276   __pyx_t_5 = 0;
7277   __pyx_v_nless = __pyx_t_13;
7278   __pyx_t_13 = 0;
7279   __pyx_v_ngreater = __pyx_t_14;
7280   __pyx_t_14 = 0;
7281 
7282   /* "yt/utilities/lib/amr_kdtools.pyx":343
7283  *         # If best_dim is -1, then we have found a place where there are no choices.
7284  *         # Exit out and set the node to None.
7285  *         if best_dim == -1:             # <<<<<<<<<<<<<<
7286  *             return -1
7287  *
7288  */
7289   __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_v_best_dim, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error)
7290   __Pyx_GOTREF(__pyx_t_2);
7291   __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 343, __pyx_L1_error)
7292   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7293   if (__pyx_t_17) {
7294 
7295     /* "yt/utilities/lib/amr_kdtools.pyx":344
7296  *         # Exit out and set the node to None.
7297  *         if best_dim == -1:
7298  *             return -1             # <<<<<<<<<<<<<<
7299  *
7300  *
7301  */
7302     __Pyx_XDECREF(__pyx_r);
7303     __Pyx_INCREF(__pyx_int_neg_1);
7304     __pyx_r = __pyx_int_neg_1;
7305     goto __pyx_L0;
7306 
7307     /* "yt/utilities/lib/amr_kdtools.pyx":343
7308  *         # If best_dim is -1, then we have found a place where there are no choices.
7309  *         # Exit out and set the node to None.
7310  *         if best_dim == -1:             # <<<<<<<<<<<<<<
7311  *             return -1
7312  *
7313  */
7314   }
7315 
7316   /* "yt/utilities/lib/amr_kdtools.pyx":347
7317  *
7318  *
7319  *         split = <Split *> malloc(sizeof(Split))             # <<<<<<<<<<<<<<
7320  *         split.dim = best_dim
7321  *         split.pos = split_pos
7322  */
7323   __pyx_v_split = ((struct __pyx_t_2yt_9utilities_3lib_11amr_kdtools_Split *)malloc((sizeof(struct __pyx_t_2yt_9utilities_3lib_11amr_kdtools_Split))));
7324 
7325   /* "yt/utilities/lib/amr_kdtools.pyx":348
7326  *
7327  *         split = <Split *> malloc(sizeof(Split))
7328  *         split.dim = best_dim             # <<<<<<<<<<<<<<
7329  *         split.pos = split_pos
7330  *
7331  */
7332   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_best_dim); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 348, __pyx_L1_error)
7333   __pyx_v_split->dim = __pyx_t_3;
7334 
7335   /* "yt/utilities/lib/amr_kdtools.pyx":349
7336  *         split = <Split *> malloc(sizeof(Split))
7337  *         split.dim = best_dim
7338  *         split.pos = split_pos             # <<<<<<<<<<<<<<
7339  *
7340  *         # Create a Split
7341  */
7342   __pyx_t_18 = __pyx_PyFloat_AsDouble(__pyx_v_split_pos); if (unlikely((__pyx_t_18 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 349, __pyx_L1_error)
7343   __pyx_v_split->pos = __pyx_t_18;
7344 
7345   /* "yt/utilities/lib/amr_kdtools.pyx":352
7346  *
7347  *         # Create a Split
7348  *         self.divide(split)             # <<<<<<<<<<<<<<
7349  *
7350  *         # Populate Left Node
7351  */
7352   ((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->__pyx_vtab)->divide(__pyx_v_self, __pyx_v_split);
7353 
7354   /* "yt/utilities/lib/amr_kdtools.pyx":356
7355  *         # Populate Left Node
7356  *         #print('Inserting left node', self.left_edge, self.right_edge)
7357  *         if nless == 1:             # <<<<<<<<<<<<<<
7358  *             self.left.insert_grid(gle, gre,
7359  *                          gid, rank, size)
7360  */
7361   __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_v_nless, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error)
7362   __Pyx_GOTREF(__pyx_t_2);
7363   __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 356, __pyx_L1_error)
7364   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7365   if (__pyx_t_17) {
7366 
7367     /* "yt/utilities/lib/amr_kdtools.pyx":357
7368  *         #print('Inserting left node', self.left_edge, self.right_edge)
7369  *         if nless == 1:
7370  *             self.left.insert_grid(gle, gre,             # <<<<<<<<<<<<<<
7371  *                          gid, rank, size)
7372  *
7373  */
7374     __pyx_t_2 = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->left->__pyx_vtab)->insert_grid(__pyx_v_self->left, __pyx_v_gle, __pyx_v_gre, __pyx_v_gid, __pyx_v_rank, __pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 357, __pyx_L1_error)
7375     __Pyx_GOTREF(__pyx_t_2);
7376     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7377 
7378     /* "yt/utilities/lib/amr_kdtools.pyx":356
7379  *         # Populate Left Node
7380  *         #print('Inserting left node', self.left_edge, self.right_edge)
7381  *         if nless == 1:             # <<<<<<<<<<<<<<
7382  *             self.left.insert_grid(gle, gre,
7383  *                          gid, rank, size)
7384  */
7385   }
7386 
7387   /* "yt/utilities/lib/amr_kdtools.pyx":362
7388  *         # Populate Right Node
7389  *         #print('Inserting right node', self.left_edge, self.right_edge)
7390  *         if ngreater == 1:             # <<<<<<<<<<<<<<
7391  *             self.right.insert_grid(gle, gre,
7392  *                          gid, rank, size)
7393  */
7394   __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_v_ngreater, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 362, __pyx_L1_error)
7395   __Pyx_GOTREF(__pyx_t_2);
7396   __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_17 < 0)) __PYX_ERR(0, 362, __pyx_L1_error)
7397   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7398   if (__pyx_t_17) {
7399 
7400     /* "yt/utilities/lib/amr_kdtools.pyx":363
7401  *         #print('Inserting right node', self.left_edge, self.right_edge)
7402  *         if ngreater == 1:
7403  *             self.right.insert_grid(gle, gre,             # <<<<<<<<<<<<<<
7404  *                          gid, rank, size)
7405  *
7406  */
7407     __pyx_t_2 = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->right->__pyx_vtab)->insert_grid(__pyx_v_self->right, __pyx_v_gle, __pyx_v_gre, __pyx_v_gid, __pyx_v_rank, __pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 363, __pyx_L1_error)
7408     __Pyx_GOTREF(__pyx_t_2);
7409     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7410 
7411     /* "yt/utilities/lib/amr_kdtools.pyx":362
7412  *         # Populate Right Node
7413  *         #print('Inserting right node', self.left_edge, self.right_edge)
7414  *         if ngreater == 1:             # <<<<<<<<<<<<<<
7415  *             self.right.insert_grid(gle, gre,
7416  *                          gid, rank, size)
7417  */
7418   }
7419 
7420   /* "yt/utilities/lib/amr_kdtools.pyx":366
7421  *                          gid, rank, size)
7422  *
7423  *         return 0             # <<<<<<<<<<<<<<
7424  *
7425  *     #@cython.boundscheck(False)
7426  */
7427   __Pyx_XDECREF(__pyx_r);
7428   __Pyx_INCREF(__pyx_int_0);
7429   __pyx_r = __pyx_int_0;
7430   goto __pyx_L0;
7431 
7432   /* "yt/utilities/lib/amr_kdtools.pyx":320
7433  *     @cython.wraparound(False)
7434  *     @cython.cdivision(True)
7435  *     cdef split_grid(self,             # <<<<<<<<<<<<<<
7436  *                    np.float64_t[:] gle,
7437  *                    np.float64_t[:] gre,
7438  */
7439 
7440   /* function exit code */
7441   __pyx_L1_error:;
7442   __Pyx_XDECREF(__pyx_t_1);
7443   __Pyx_XDECREF(__pyx_t_2);
7444   __Pyx_XDECREF(__pyx_t_5);
7445   __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
7446   __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
7447   __Pyx_XDECREF(((PyObject *)__pyx_t_10));
7448   __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
7449   __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
7450   __Pyx_XDECREF(__pyx_t_13);
7451   __Pyx_XDECREF(__pyx_t_14);
7452   __Pyx_XDECREF(__pyx_t_15);
7453   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.split_grid", __pyx_clineno, __pyx_lineno, __pyx_filename);
7454   __pyx_r = 0;
7455   __pyx_L0:;
7456   __PYX_XDEC_MEMVIEW(&__pyx_v_less_ids, 1);
7457   __PYX_XDEC_MEMVIEW(&__pyx_v_greater_ids, 1);
7458   __Pyx_XDECREF(__pyx_v_data);
7459   __Pyx_XDECREF(__pyx_v_best_dim);
7460   __Pyx_XDECREF(__pyx_v_split_pos);
7461   __Pyx_XDECREF(__pyx_v_nless);
7462   __Pyx_XDECREF(__pyx_v_ngreater);
7463   __Pyx_XGIVEREF(__pyx_r);
7464   __Pyx_RefNannyFinishContext();
7465   return __pyx_r;
7466 }
7467 
7468 /* "yt/utilities/lib/amr_kdtools.pyx":371
7469  *     #@cython.wraparound(False)
7470  *     #@cython.cdivision(True)
7471  *     cdef int split_grids(self,             # <<<<<<<<<<<<<<
7472  *                            int ngrids,
7473  *                            np.float64_t[:,:] gles,
7474  */
7475 
7476 static int __pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_split_grids(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, int __pyx_v_ngrids, __Pyx_memviewslice __pyx_v_gles, __Pyx_memviewslice __pyx_v_gres, __Pyx_memviewslice __pyx_v_gids, int __pyx_v_rank, int __pyx_v_size) {
7477   int __pyx_v_i;
7478   int __pyx_v_j;
7479   int __pyx_v_index;
7480   __Pyx_memviewslice __pyx_v_less_gles = { 0, 0, { 0 }, { 0 }, { 0 } };
7481   __Pyx_memviewslice __pyx_v_less_gres = { 0, 0, { 0 }, { 0 }, { 0 } };
7482   __Pyx_memviewslice __pyx_v_greater_gles = { 0, 0, { 0 }, { 0 }, { 0 } };
7483   __Pyx_memviewslice __pyx_v_greater_gres = { 0, 0, { 0 }, { 0 }, { 0 } };
7484   __Pyx_memviewslice __pyx_v_l_ids = { 0, 0, { 0 }, { 0 }, { 0 } };
7485   __Pyx_memviewslice __pyx_v_g_ids = { 0, 0, { 0 }, { 0 }, { 0 } };
7486   PyObject *__pyx_v_data = NULL;
7487   PyObject *__pyx_v_less_ids = NULL;
7488   PyObject *__pyx_v_greater_ids = NULL;
7489   PyObject *__pyx_v_best_dim = NULL;
7490   PyObject *__pyx_v_split_pos = NULL;
7491   PyObject *__pyx_v_nless = NULL;
7492   PyObject *__pyx_v_ngreater = NULL;
7493   struct __pyx_t_2yt_9utilities_3lib_11amr_kdtools_Split *__pyx_v_split;
7494   PyObject *__pyx_v_less_index = NULL;
7495   PyObject *__pyx_v_greater_index = NULL;
7496   int __pyx_r;
7497   __Pyx_RefNannyDeclarations
7498   int __pyx_t_1;
7499   PyObject *__pyx_t_2 = NULL;
7500   PyObject *__pyx_t_3 = NULL;
7501   PyObject *__pyx_t_4 = NULL;
7502   int __pyx_t_5;
7503   int __pyx_t_6;
7504   int __pyx_t_7;
7505   int __pyx_t_8;
7506   Py_ssize_t __pyx_t_9;
7507   Py_ssize_t __pyx_t_10;
7508   PyObject *__pyx_t_11 = NULL;
7509   Py_ssize_t __pyx_t_12;
7510   Py_ssize_t __pyx_t_13;
7511   __Pyx_memviewslice __pyx_t_14 = { 0, 0, { 0 }, { 0 }, { 0 } };
7512   __pyx_t_5numpy_float64_t *__pyx_t_15;
7513   struct __pyx_array_obj *__pyx_t_16 = NULL;
7514   __Pyx_memviewslice __pyx_t_17 = { 0, 0, { 0 }, { 0 }, { 0 } };
7515   __Pyx_memviewslice __pyx_t_18 = { 0, 0, { 0 }, { 0 }, { 0 } };
7516   __Pyx_memviewslice __pyx_t_19 = { 0, 0, { 0 }, { 0 }, { 0 } };
7517   __Pyx_memviewslice __pyx_t_20 = { 0, 0, { 0 }, { 0 }, { 0 } };
7518   PyObject *__pyx_t_21 = NULL;
7519   PyObject *__pyx_t_22 = NULL;
7520   PyObject *(*__pyx_t_23)(PyObject *);
7521   __pyx_t_5numpy_float64_t __pyx_t_24;
7522   __Pyx_memviewslice __pyx_t_25 = { 0, 0, { 0 }, { 0 }, { 0 } };
7523   __Pyx_memviewslice __pyx_t_26 = { 0, 0, { 0 }, { 0 }, { 0 } };
7524   long __pyx_t_27;
7525   long __pyx_t_28;
7526   Py_ssize_t __pyx_t_29;
7527   Py_ssize_t __pyx_t_30;
7528   Py_ssize_t __pyx_t_31;
7529   Py_ssize_t __pyx_t_32;
7530   Py_ssize_t __pyx_t_33;
7531   Py_ssize_t __pyx_t_34;
7532   Py_ssize_t __pyx_t_35;
7533   Py_ssize_t __pyx_t_36;
7534   Py_ssize_t __pyx_t_37;
7535   Py_ssize_t __pyx_t_38;
7536   Py_ssize_t __pyx_t_39;
7537   Py_ssize_t __pyx_t_40;
7538   Py_ssize_t __pyx_t_41;
7539   Py_ssize_t __pyx_t_42;
7540   Py_ssize_t __pyx_t_43;
7541   Py_ssize_t __pyx_t_44;
7542   Py_ssize_t __pyx_t_45;
7543   Py_ssize_t __pyx_t_46;
7544   Py_ssize_t __pyx_t_47;
7545   Py_ssize_t __pyx_t_48;
7546   __Pyx_RefNannySetupContext("split_grids", 0);
7547 
7548   /* "yt/utilities/lib/amr_kdtools.pyx":382
7549  *         cdef np.float64_t[:,:] less_gles, less_gres, greater_gles, greater_gres
7550  *         cdef np.int64_t[:] l_ids, g_ids
7551  *         if ngrids == 0: return 0             # <<<<<<<<<<<<<<
7552  *
7553  *         data = cvarray(format="d", shape=(ngrids,2,3), itemsize=sizeof(np.float64_t))
7554  */
7555   __pyx_t_1 = ((__pyx_v_ngrids == 0) != 0);
7556   if (__pyx_t_1) {
7557     __pyx_r = 0;
7558     goto __pyx_L0;
7559   }
7560 
7561   /* "yt/utilities/lib/amr_kdtools.pyx":384
7562  *         if ngrids == 0: return 0
7563  *
7564  *         data = cvarray(format="d", shape=(ngrids,2,3), itemsize=sizeof(np.float64_t))             # <<<<<<<<<<<<<<
7565  *
7566  *         for i in range(ngrids):
7567  */
7568   __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 384, __pyx_L1_error)
7569   __Pyx_GOTREF(__pyx_t_2);
7570   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 384, __pyx_L1_error)
7571   __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_ngrids); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error)
7572   __Pyx_GOTREF(__pyx_t_3);
7573   __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 384, __pyx_L1_error)
7574   __Pyx_GOTREF(__pyx_t_4);
7575   __Pyx_GIVEREF(__pyx_t_3);
7576   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
7577   __Pyx_INCREF(__pyx_int_2);
7578   __Pyx_GIVEREF(__pyx_int_2);
7579   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_2);
7580   __Pyx_INCREF(__pyx_int_3);
7581   __Pyx_GIVEREF(__pyx_int_3);
7582   PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_3);
7583   __pyx_t_3 = 0;
7584   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_shape, __pyx_t_4) < 0) __PYX_ERR(0, 384, __pyx_L1_error)
7585   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7586   __pyx_t_4 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_float64_t))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 384, __pyx_L1_error)
7587   __Pyx_GOTREF(__pyx_t_4);
7588   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_itemsize, __pyx_t_4) < 0) __PYX_ERR(0, 384, __pyx_L1_error)
7589   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7590   __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 384, __pyx_L1_error)
7591   __Pyx_GOTREF(__pyx_t_4);
7592   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7593   __pyx_v_data = __pyx_t_4;
7594   __pyx_t_4 = 0;
7595 
7596   /* "yt/utilities/lib/amr_kdtools.pyx":386
7597  *         data = cvarray(format="d", shape=(ngrids,2,3), itemsize=sizeof(np.float64_t))
7598  *
7599  *         for i in range(ngrids):             # <<<<<<<<<<<<<<
7600  *             for j in range(3):
7601  *                 data[i,0,j] = gles[i,j]
7602  */
7603   __pyx_t_5 = __pyx_v_ngrids;
7604   __pyx_t_6 = __pyx_t_5;
7605   for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
7606     __pyx_v_i = __pyx_t_7;
7607 
7608     /* "yt/utilities/lib/amr_kdtools.pyx":387
7609  *
7610  *         for i in range(ngrids):
7611  *             for j in range(3):             # <<<<<<<<<<<<<<
7612  *                 data[i,0,j] = gles[i,j]
7613  *                 data[i,1,j] = gres[i,j]
7614  */
7615     for (__pyx_t_8 = 0; __pyx_t_8 < 3; __pyx_t_8+=1) {
7616       __pyx_v_j = __pyx_t_8;
7617 
7618       /* "yt/utilities/lib/amr_kdtools.pyx":388
7619  *         for i in range(ngrids):
7620  *             for j in range(3):
7621  *                 data[i,0,j] = gles[i,j]             # <<<<<<<<<<<<<<
7622  *                 data[i,1,j] = gres[i,j]
7623  *
7624  */
7625       __pyx_t_9 = __pyx_v_i;
7626       __pyx_t_10 = __pyx_v_j;
7627       __pyx_t_4 = PyFloat_FromDouble((*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_gles.data + __pyx_t_9 * __pyx_v_gles.strides[0]) ) + __pyx_t_10 * __pyx_v_gles.strides[1]) )))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 388, __pyx_L1_error)
7628       __Pyx_GOTREF(__pyx_t_4);
7629       __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 388, __pyx_L1_error)
7630       __Pyx_GOTREF(__pyx_t_2);
7631       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error)
7632       __Pyx_GOTREF(__pyx_t_3);
7633       __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 388, __pyx_L1_error)
7634       __Pyx_GOTREF(__pyx_t_11);
7635       __Pyx_GIVEREF(__pyx_t_2);
7636       PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_2);
7637       __Pyx_INCREF(__pyx_int_0);
7638       __Pyx_GIVEREF(__pyx_int_0);
7639       PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_int_0);
7640       __Pyx_GIVEREF(__pyx_t_3);
7641       PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_3);
7642       __pyx_t_2 = 0;
7643       __pyx_t_3 = 0;
7644       if (unlikely(PyObject_SetItem(__pyx_v_data, __pyx_t_11, __pyx_t_4) < 0)) __PYX_ERR(0, 388, __pyx_L1_error)
7645       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
7646       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7647 
7648       /* "yt/utilities/lib/amr_kdtools.pyx":389
7649  *             for j in range(3):
7650  *                 data[i,0,j] = gles[i,j]
7651  *                 data[i,1,j] = gres[i,j]             # <<<<<<<<<<<<<<
7652  *
7653  *         less_ids = cvarray(format="B", shape=(ngrids,), itemsize=sizeof(np.uint8_t))
7654  */
7655       __pyx_t_12 = __pyx_v_i;
7656       __pyx_t_13 = __pyx_v_j;
7657       __pyx_t_4 = PyFloat_FromDouble((*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_gres.data + __pyx_t_12 * __pyx_v_gres.strides[0]) ) + __pyx_t_13 * __pyx_v_gres.strides[1]) )))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 389, __pyx_L1_error)
7658       __Pyx_GOTREF(__pyx_t_4);
7659       __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 389, __pyx_L1_error)
7660       __Pyx_GOTREF(__pyx_t_11);
7661       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 389, __pyx_L1_error)
7662       __Pyx_GOTREF(__pyx_t_3);
7663       __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 389, __pyx_L1_error)
7664       __Pyx_GOTREF(__pyx_t_2);
7665       __Pyx_GIVEREF(__pyx_t_11);
7666       PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_11);
7667       __Pyx_INCREF(__pyx_int_1);
7668       __Pyx_GIVEREF(__pyx_int_1);
7669       PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_1);
7670       __Pyx_GIVEREF(__pyx_t_3);
7671       PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_3);
7672       __pyx_t_11 = 0;
7673       __pyx_t_3 = 0;
7674       if (unlikely(PyObject_SetItem(__pyx_v_data, __pyx_t_2, __pyx_t_4) < 0)) __PYX_ERR(0, 389, __pyx_L1_error)
7675       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7676       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7677     }
7678   }
7679 
7680   /* "yt/utilities/lib/amr_kdtools.pyx":391
7681  *                 data[i,1,j] = gres[i,j]
7682  *
7683  *         less_ids = cvarray(format="B", shape=(ngrids,), itemsize=sizeof(np.uint8_t))             # <<<<<<<<<<<<<<
7684  *         greater_ids = cvarray(format="B", shape=(ngrids,), itemsize=sizeof(np.uint8_t))
7685  *
7686  */
7687   __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 391, __pyx_L1_error)
7688   __Pyx_GOTREF(__pyx_t_4);
7689   if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_format, __pyx_n_s_B) < 0) __PYX_ERR(0, 391, __pyx_L1_error)
7690   __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ngrids); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 391, __pyx_L1_error)
7691   __Pyx_GOTREF(__pyx_t_2);
7692   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 391, __pyx_L1_error)
7693   __Pyx_GOTREF(__pyx_t_3);
7694   __Pyx_GIVEREF(__pyx_t_2);
7695   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
7696   __pyx_t_2 = 0;
7697   if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_shape, __pyx_t_3) < 0) __PYX_ERR(0, 391, __pyx_L1_error)
7698   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7699   __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_uint8_t))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 391, __pyx_L1_error)
7700   __Pyx_GOTREF(__pyx_t_3);
7701   if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_itemsize, __pyx_t_3) < 0) __PYX_ERR(0, 391, __pyx_L1_error)
7702   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7703   __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 391, __pyx_L1_error)
7704   __Pyx_GOTREF(__pyx_t_3);
7705   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7706   __pyx_v_less_ids = __pyx_t_3;
7707   __pyx_t_3 = 0;
7708 
7709   /* "yt/utilities/lib/amr_kdtools.pyx":392
7710  *
7711  *         less_ids = cvarray(format="B", shape=(ngrids,), itemsize=sizeof(np.uint8_t))
7712  *         greater_ids = cvarray(format="B", shape=(ngrids,), itemsize=sizeof(np.uint8_t))             # <<<<<<<<<<<<<<
7713  *
7714  *         best_dim, split_pos, nless, ngreater = \
7715  */
7716   __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 392, __pyx_L1_error)
7717   __Pyx_GOTREF(__pyx_t_3);
7718   if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_format, __pyx_n_s_B) < 0) __PYX_ERR(0, 392, __pyx_L1_error)
7719   __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_ngrids); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 392, __pyx_L1_error)
7720   __Pyx_GOTREF(__pyx_t_4);
7721   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 392, __pyx_L1_error)
7722   __Pyx_GOTREF(__pyx_t_2);
7723   __Pyx_GIVEREF(__pyx_t_4);
7724   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
7725   __pyx_t_4 = 0;
7726   if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_shape, __pyx_t_2) < 0) __PYX_ERR(0, 392, __pyx_L1_error)
7727   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7728   __pyx_t_2 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_uint8_t))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 392, __pyx_L1_error)
7729   __Pyx_GOTREF(__pyx_t_2);
7730   if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_itemsize, __pyx_t_2) < 0) __PYX_ERR(0, 392, __pyx_L1_error)
7731   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7732   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 392, __pyx_L1_error)
7733   __Pyx_GOTREF(__pyx_t_2);
7734   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7735   __pyx_v_greater_ids = __pyx_t_2;
7736   __pyx_t_2 = 0;
7737 
7738   /* "yt/utilities/lib/amr_kdtools.pyx":395
7739  *
7740  *         best_dim, split_pos, nless, ngreater = \
7741  *             kdtree_get_choices(ngrids, data, self.left_edge, self.right_edge,             # <<<<<<<<<<<<<<
7742  *                               less_ids, greater_ids)
7743  *
7744  */
7745   __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_nn___pyx_t_5numpy_float64_t(__pyx_v_data, PyBUF_WRITABLE); if (unlikely(!__pyx_t_14.memview)) __PYX_ERR(0, 395, __pyx_L1_error)
7746   __pyx_t_15 = __pyx_v_self->left_edge;
7747   if (!__pyx_t_15) {
7748     PyErr_SetString(PyExc_ValueError,"Cannot create cython.array from NULL pointer");
7749     __PYX_ERR(0, 395, __pyx_L1_error)
7750   }
7751   __pyx_t_3 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t);
7752   __pyx_t_2 = Py_BuildValue((char*) "("  __PYX_BUILD_PY_SSIZE_T  ")", ((Py_ssize_t)3));
7753   if (unlikely(!__pyx_t_3 || !__pyx_t_2 || !PyBytes_AsString(__pyx_t_3))) __PYX_ERR(0, 395, __pyx_L1_error)
7754   __Pyx_GOTREF(__pyx_t_3);
7755   __Pyx_GOTREF(__pyx_t_2);
7756   __pyx_t_16 = __pyx_array_new(__pyx_t_2, sizeof(__pyx_t_5numpy_float64_t), PyBytes_AS_STRING(__pyx_t_3), (char *) "fortran", (char *) __pyx_t_15);
7757   if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 395, __pyx_L1_error)
7758   __Pyx_GOTREF(__pyx_t_16);
7759   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7760   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7761   __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(((PyObject *)__pyx_t_16), PyBUF_WRITABLE); if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(0, 395, __pyx_L1_error)
7762   __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0;
7763   __pyx_t_15 = __pyx_v_self->right_edge;
7764   if (!__pyx_t_15) {
7765     PyErr_SetString(PyExc_ValueError,"Cannot create cython.array from NULL pointer");
7766     __PYX_ERR(0, 395, __pyx_L1_error)
7767   }
7768   __pyx_t_2 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t);
7769   __pyx_t_3 = Py_BuildValue((char*) "("  __PYX_BUILD_PY_SSIZE_T  ")", ((Py_ssize_t)3));
7770   if (unlikely(!__pyx_t_2 || !__pyx_t_3 || !PyBytes_AsString(__pyx_t_2))) __PYX_ERR(0, 395, __pyx_L1_error)
7771   __Pyx_GOTREF(__pyx_t_2);
7772   __Pyx_GOTREF(__pyx_t_3);
7773   __pyx_t_16 = __pyx_array_new(__pyx_t_3, sizeof(__pyx_t_5numpy_float64_t), PyBytes_AS_STRING(__pyx_t_2), (char *) "fortran", (char *) __pyx_t_15);
7774   if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 395, __pyx_L1_error)
7775   __Pyx_GOTREF(__pyx_t_16);
7776   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7777   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7778   __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(((PyObject *)__pyx_t_16), PyBUF_WRITABLE); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 395, __pyx_L1_error)
7779   __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0;
7780 
7781   /* "yt/utilities/lib/amr_kdtools.pyx":396
7782  *         best_dim, split_pos, nless, ngreater = \
7783  *             kdtree_get_choices(ngrids, data, self.left_edge, self.right_edge,
7784  *                               less_ids, greater_ids)             # <<<<<<<<<<<<<<
7785  *
7786  *
7787  */
7788   __pyx_t_19 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_uint8_t(__pyx_v_less_ids, PyBUF_WRITABLE); if (unlikely(!__pyx_t_19.memview)) __PYX_ERR(0, 396, __pyx_L1_error)
7789   __pyx_t_20 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_uint8_t(__pyx_v_greater_ids, PyBUF_WRITABLE); if (unlikely(!__pyx_t_20.memview)) __PYX_ERR(0, 396, __pyx_L1_error)
7790 
7791   /* "yt/utilities/lib/amr_kdtools.pyx":395
7792  *
7793  *         best_dim, split_pos, nless, ngreater = \
7794  *             kdtree_get_choices(ngrids, data, self.left_edge, self.right_edge,             # <<<<<<<<<<<<<<
7795  *                               less_ids, greater_ids)
7796  *
7797  */
7798   __pyx_t_2 = __pyx_f_2yt_9utilities_3lib_11amr_kdtools_kdtree_get_choices(__pyx_v_ngrids, __pyx_t_14, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 395, __pyx_L1_error)
7799   __Pyx_GOTREF(__pyx_t_2);
7800   __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
7801   __pyx_t_14.memview = NULL;
7802   __pyx_t_14.data = NULL;
7803   __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
7804   __pyx_t_17.memview = NULL;
7805   __pyx_t_17.data = NULL;
7806   __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
7807   __pyx_t_18.memview = NULL;
7808   __pyx_t_18.data = NULL;
7809   __PYX_XDEC_MEMVIEW(&__pyx_t_19, 1);
7810   __pyx_t_19.memview = NULL;
7811   __pyx_t_19.data = NULL;
7812   __PYX_XDEC_MEMVIEW(&__pyx_t_20, 1);
7813   __pyx_t_20.memview = NULL;
7814   __pyx_t_20.data = NULL;
7815   if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
7816     PyObject* sequence = __pyx_t_2;
7817     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7818     if (unlikely(size != 4)) {
7819       if (size > 4) __Pyx_RaiseTooManyValuesError(4);
7820       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7821       __PYX_ERR(0, 394, __pyx_L1_error)
7822     }
7823     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7824     if (likely(PyTuple_CheckExact(sequence))) {
7825       __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
7826       __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
7827       __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2);
7828       __pyx_t_21 = PyTuple_GET_ITEM(sequence, 3);
7829     } else {
7830       __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
7831       __pyx_t_4 = PyList_GET_ITEM(sequence, 1);
7832       __pyx_t_11 = PyList_GET_ITEM(sequence, 2);
7833       __pyx_t_21 = PyList_GET_ITEM(sequence, 3);
7834     }
7835     __Pyx_INCREF(__pyx_t_3);
7836     __Pyx_INCREF(__pyx_t_4);
7837     __Pyx_INCREF(__pyx_t_11);
7838     __Pyx_INCREF(__pyx_t_21);
7839     #else
7840     {
7841       Py_ssize_t i;
7842       PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_4,&__pyx_t_11,&__pyx_t_21};
7843       for (i=0; i < 4; i++) {
7844         PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 394, __pyx_L1_error)
7845         __Pyx_GOTREF(item);
7846         *(temps[i]) = item;
7847       }
7848     }
7849     #endif
7850     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7851   } else {
7852     Py_ssize_t index = -1;
7853     PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_4,&__pyx_t_11,&__pyx_t_21};
7854     __pyx_t_22 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 394, __pyx_L1_error)
7855     __Pyx_GOTREF(__pyx_t_22);
7856     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7857     __pyx_t_23 = Py_TYPE(__pyx_t_22)->tp_iternext;
7858     for (index=0; index < 4; index++) {
7859       PyObject* item = __pyx_t_23(__pyx_t_22); if (unlikely(!item)) goto __pyx_L8_unpacking_failed;
7860       __Pyx_GOTREF(item);
7861       *(temps[index]) = item;
7862     }
7863     if (__Pyx_IternextUnpackEndCheck(__pyx_t_23(__pyx_t_22), 4) < 0) __PYX_ERR(0, 394, __pyx_L1_error)
7864     __pyx_t_23 = NULL;
7865     __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7866     goto __pyx_L9_unpacking_done;
7867     __pyx_L8_unpacking_failed:;
7868     __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7869     __pyx_t_23 = NULL;
7870     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7871     __PYX_ERR(0, 394, __pyx_L1_error)
7872     __pyx_L9_unpacking_done:;
7873   }
7874 
7875   /* "yt/utilities/lib/amr_kdtools.pyx":394
7876  *         greater_ids = cvarray(format="B", shape=(ngrids,), itemsize=sizeof(np.uint8_t))
7877  *
7878  *         best_dim, split_pos, nless, ngreater = \             # <<<<<<<<<<<<<<
7879  *             kdtree_get_choices(ngrids, data, self.left_edge, self.right_edge,
7880  *                               less_ids, greater_ids)
7881  */
7882   __pyx_v_best_dim = __pyx_t_3;
7883   __pyx_t_3 = 0;
7884   __pyx_v_split_pos = __pyx_t_4;
7885   __pyx_t_4 = 0;
7886   __pyx_v_nless = __pyx_t_11;
7887   __pyx_t_11 = 0;
7888   __pyx_v_ngreater = __pyx_t_21;
7889   __pyx_t_21 = 0;
7890 
7891   /* "yt/utilities/lib/amr_kdtools.pyx":401
7892  *         # If best_dim is -1, then we have found a place where there are no choices.
7893  *         # Exit out and set the node to None.
7894  *         if best_dim == -1:             # <<<<<<<<<<<<<<
7895  *             print('Failed to split grids.')
7896  *             return -1
7897  */
7898   __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_v_best_dim, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 401, __pyx_L1_error)
7899   __Pyx_GOTREF(__pyx_t_2);
7900   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 401, __pyx_L1_error)
7901   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7902   if (__pyx_t_1) {
7903 
7904     /* "yt/utilities/lib/amr_kdtools.pyx":402
7905  *         # Exit out and set the node to None.
7906  *         if best_dim == -1:
7907  *             print('Failed to split grids.')             # <<<<<<<<<<<<<<
7908  *             return -1
7909  *
7910  */
7911     if (__Pyx_PrintOne(0, __pyx_kp_s_Failed_to_split_grids) < 0) __PYX_ERR(0, 402, __pyx_L1_error)
7912 
7913     /* "yt/utilities/lib/amr_kdtools.pyx":403
7914  *         if best_dim == -1:
7915  *             print('Failed to split grids.')
7916  *             return -1             # <<<<<<<<<<<<<<
7917  *
7918  *         split = <Split *> malloc(sizeof(Split))
7919  */
7920     __pyx_r = -1;
7921     goto __pyx_L0;
7922 
7923     /* "yt/utilities/lib/amr_kdtools.pyx":401
7924  *         # If best_dim is -1, then we have found a place where there are no choices.
7925  *         # Exit out and set the node to None.
7926  *         if best_dim == -1:             # <<<<<<<<<<<<<<
7927  *             print('Failed to split grids.')
7928  *             return -1
7929  */
7930   }
7931 
7932   /* "yt/utilities/lib/amr_kdtools.pyx":405
7933  *             return -1
7934  *
7935  *         split = <Split *> malloc(sizeof(Split))             # <<<<<<<<<<<<<<
7936  *         split.dim = best_dim
7937  *         split.pos = split_pos
7938  */
7939   __pyx_v_split = ((struct __pyx_t_2yt_9utilities_3lib_11amr_kdtools_Split *)malloc((sizeof(struct __pyx_t_2yt_9utilities_3lib_11amr_kdtools_Split))));
7940 
7941   /* "yt/utilities/lib/amr_kdtools.pyx":406
7942  *
7943  *         split = <Split *> malloc(sizeof(Split))
7944  *         split.dim = best_dim             # <<<<<<<<<<<<<<
7945  *         split.pos = split_pos
7946  *
7947  */
7948   __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_best_dim); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 406, __pyx_L1_error)
7949   __pyx_v_split->dim = __pyx_t_5;
7950 
7951   /* "yt/utilities/lib/amr_kdtools.pyx":407
7952  *         split = <Split *> malloc(sizeof(Split))
7953  *         split.dim = best_dim
7954  *         split.pos = split_pos             # <<<<<<<<<<<<<<
7955  *
7956  *         # Create a Split
7957  */
7958   __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_v_split_pos); if (unlikely((__pyx_t_24 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 407, __pyx_L1_error)
7959   __pyx_v_split->pos = __pyx_t_24;
7960 
7961   /* "yt/utilities/lib/amr_kdtools.pyx":410
7962  *
7963  *         # Create a Split
7964  *         self.divide(split)             # <<<<<<<<<<<<<<
7965  *
7966  *         less_index = cvarray(format="q", shape=(ngrids,), itemsize=sizeof(np.int64_t))
7967  */
7968   ((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->__pyx_vtab)->divide(__pyx_v_self, __pyx_v_split);
7969 
7970   /* "yt/utilities/lib/amr_kdtools.pyx":412
7971  *         self.divide(split)
7972  *
7973  *         less_index = cvarray(format="q", shape=(ngrids,), itemsize=sizeof(np.int64_t))             # <<<<<<<<<<<<<<
7974  *         greater_index = cvarray(format="q", shape=(ngrids,), itemsize=sizeof(np.int64_t))
7975  *
7976  */
7977   __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 412, __pyx_L1_error)
7978   __Pyx_GOTREF(__pyx_t_2);
7979   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_format, __pyx_n_s_q) < 0) __PYX_ERR(0, 412, __pyx_L1_error)
7980   __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_ngrids); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 412, __pyx_L1_error)
7981   __Pyx_GOTREF(__pyx_t_21);
7982   __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 412, __pyx_L1_error)
7983   __Pyx_GOTREF(__pyx_t_11);
7984   __Pyx_GIVEREF(__pyx_t_21);
7985   PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_21);
7986   __pyx_t_21 = 0;
7987   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_shape, __pyx_t_11) < 0) __PYX_ERR(0, 412, __pyx_L1_error)
7988   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
7989   __pyx_t_11 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_int64_t))); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 412, __pyx_L1_error)
7990   __Pyx_GOTREF(__pyx_t_11);
7991   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_itemsize, __pyx_t_11) < 0) __PYX_ERR(0, 412, __pyx_L1_error)
7992   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
7993   __pyx_t_11 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 412, __pyx_L1_error)
7994   __Pyx_GOTREF(__pyx_t_11);
7995   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7996   __pyx_v_less_index = __pyx_t_11;
7997   __pyx_t_11 = 0;
7998 
7999   /* "yt/utilities/lib/amr_kdtools.pyx":413
8000  *
8001  *         less_index = cvarray(format="q", shape=(ngrids,), itemsize=sizeof(np.int64_t))
8002  *         greater_index = cvarray(format="q", shape=(ngrids,), itemsize=sizeof(np.int64_t))             # <<<<<<<<<<<<<<
8003  *
8004  *         nless = 0
8005  */
8006   __pyx_t_11 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 413, __pyx_L1_error)
8007   __Pyx_GOTREF(__pyx_t_11);
8008   if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_format, __pyx_n_s_q) < 0) __PYX_ERR(0, 413, __pyx_L1_error)
8009   __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ngrids); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error)
8010   __Pyx_GOTREF(__pyx_t_2);
8011   __pyx_t_21 = PyTuple_New(1); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 413, __pyx_L1_error)
8012   __Pyx_GOTREF(__pyx_t_21);
8013   __Pyx_GIVEREF(__pyx_t_2);
8014   PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_2);
8015   __pyx_t_2 = 0;
8016   if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_shape, __pyx_t_21) < 0) __PYX_ERR(0, 413, __pyx_L1_error)
8017   __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8018   __pyx_t_21 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_int64_t))); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 413, __pyx_L1_error)
8019   __Pyx_GOTREF(__pyx_t_21);
8020   if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_itemsize, __pyx_t_21) < 0) __PYX_ERR(0, 413, __pyx_L1_error)
8021   __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8022   __pyx_t_21 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_11); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 413, __pyx_L1_error)
8023   __Pyx_GOTREF(__pyx_t_21);
8024   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
8025   __pyx_v_greater_index = __pyx_t_21;
8026   __pyx_t_21 = 0;
8027 
8028   /* "yt/utilities/lib/amr_kdtools.pyx":415
8029  *         greater_index = cvarray(format="q", shape=(ngrids,), itemsize=sizeof(np.int64_t))
8030  *
8031  *         nless = 0             # <<<<<<<<<<<<<<
8032  *         ngreater = 0
8033  *         for i in range(ngrids):
8034  */
8035   __Pyx_INCREF(__pyx_int_0);
8036   __Pyx_DECREF_SET(__pyx_v_nless, __pyx_int_0);
8037 
8038   /* "yt/utilities/lib/amr_kdtools.pyx":416
8039  *
8040  *         nless = 0
8041  *         ngreater = 0             # <<<<<<<<<<<<<<
8042  *         for i in range(ngrids):
8043  *             if less_ids[i] == 1:
8044  */
8045   __Pyx_INCREF(__pyx_int_0);
8046   __Pyx_DECREF_SET(__pyx_v_ngreater, __pyx_int_0);
8047 
8048   /* "yt/utilities/lib/amr_kdtools.pyx":417
8049  *         nless = 0
8050  *         ngreater = 0
8051  *         for i in range(ngrids):             # <<<<<<<<<<<<<<
8052  *             if less_ids[i] == 1:
8053  *                 less_index[nless] = i
8054  */
8055   __pyx_t_5 = __pyx_v_ngrids;
8056   __pyx_t_6 = __pyx_t_5;
8057   for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
8058     __pyx_v_i = __pyx_t_7;
8059 
8060     /* "yt/utilities/lib/amr_kdtools.pyx":418
8061  *         ngreater = 0
8062  *         for i in range(ngrids):
8063  *             if less_ids[i] == 1:             # <<<<<<<<<<<<<<
8064  *                 less_index[nless] = i
8065  *                 nless += 1
8066  */
8067     __pyx_t_21 = __Pyx_GetItemInt(__pyx_v_less_ids, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 418, __pyx_L1_error)
8068     __Pyx_GOTREF(__pyx_t_21);
8069     __pyx_t_11 = __Pyx_PyInt_EqObjC(__pyx_t_21, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 418, __pyx_L1_error)
8070     __Pyx_GOTREF(__pyx_t_11);
8071     __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8072     __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 418, __pyx_L1_error)
8073     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
8074     if (__pyx_t_1) {
8075 
8076       /* "yt/utilities/lib/amr_kdtools.pyx":419
8077  *         for i in range(ngrids):
8078  *             if less_ids[i] == 1:
8079  *                 less_index[nless] = i             # <<<<<<<<<<<<<<
8080  *                 nless += 1
8081  *
8082  */
8083       __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 419, __pyx_L1_error)
8084       __Pyx_GOTREF(__pyx_t_11);
8085       if (unlikely(PyObject_SetItem(__pyx_v_less_index, __pyx_v_nless, __pyx_t_11) < 0)) __PYX_ERR(0, 419, __pyx_L1_error)
8086       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
8087 
8088       /* "yt/utilities/lib/amr_kdtools.pyx":420
8089  *             if less_ids[i] == 1:
8090  *                 less_index[nless] = i
8091  *                 nless += 1             # <<<<<<<<<<<<<<
8092  *
8093  *             if greater_ids[i] == 1:
8094  */
8095       __pyx_t_11 = __Pyx_PyInt_AddObjC(__pyx_v_nless, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 420, __pyx_L1_error)
8096       __Pyx_GOTREF(__pyx_t_11);
8097       __Pyx_DECREF_SET(__pyx_v_nless, __pyx_t_11);
8098       __pyx_t_11 = 0;
8099 
8100       /* "yt/utilities/lib/amr_kdtools.pyx":418
8101  *         ngreater = 0
8102  *         for i in range(ngrids):
8103  *             if less_ids[i] == 1:             # <<<<<<<<<<<<<<
8104  *                 less_index[nless] = i
8105  *                 nless += 1
8106  */
8107     }
8108 
8109     /* "yt/utilities/lib/amr_kdtools.pyx":422
8110  *                 nless += 1
8111  *
8112  *             if greater_ids[i] == 1:             # <<<<<<<<<<<<<<
8113  *                 greater_index[ngreater] = i
8114  *                 ngreater += 1
8115  */
8116     __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_greater_ids, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 422, __pyx_L1_error)
8117     __Pyx_GOTREF(__pyx_t_11);
8118     __pyx_t_21 = __Pyx_PyInt_EqObjC(__pyx_t_11, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 422, __pyx_L1_error)
8119     __Pyx_GOTREF(__pyx_t_21);
8120     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
8121     __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_21); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 422, __pyx_L1_error)
8122     __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8123     if (__pyx_t_1) {
8124 
8125       /* "yt/utilities/lib/amr_kdtools.pyx":423
8126  *
8127  *             if greater_ids[i] == 1:
8128  *                 greater_index[ngreater] = i             # <<<<<<<<<<<<<<
8129  *                 ngreater += 1
8130  *
8131  */
8132       __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 423, __pyx_L1_error)
8133       __Pyx_GOTREF(__pyx_t_21);
8134       if (unlikely(PyObject_SetItem(__pyx_v_greater_index, __pyx_v_ngreater, __pyx_t_21) < 0)) __PYX_ERR(0, 423, __pyx_L1_error)
8135       __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8136 
8137       /* "yt/utilities/lib/amr_kdtools.pyx":424
8138  *             if greater_ids[i] == 1:
8139  *                 greater_index[ngreater] = i
8140  *                 ngreater += 1             # <<<<<<<<<<<<<<
8141  *
8142  *         if nless > 0:
8143  */
8144       __pyx_t_21 = __Pyx_PyInt_AddObjC(__pyx_v_ngreater, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 424, __pyx_L1_error)
8145       __Pyx_GOTREF(__pyx_t_21);
8146       __Pyx_DECREF_SET(__pyx_v_ngreater, __pyx_t_21);
8147       __pyx_t_21 = 0;
8148 
8149       /* "yt/utilities/lib/amr_kdtools.pyx":422
8150  *                 nless += 1
8151  *
8152  *             if greater_ids[i] == 1:             # <<<<<<<<<<<<<<
8153  *                 greater_index[ngreater] = i
8154  *                 ngreater += 1
8155  */
8156     }
8157   }
8158 
8159   /* "yt/utilities/lib/amr_kdtools.pyx":426
8160  *                 ngreater += 1
8161  *
8162  *         if nless > 0:             # <<<<<<<<<<<<<<
8163  *             less_gles = cvarray(format="d", shape=(nless,3), itemsize=sizeof(np.float64_t))
8164  *             less_gres = cvarray(format="d", shape=(nless,3), itemsize=sizeof(np.float64_t))
8165  */
8166   __pyx_t_21 = PyObject_RichCompare(__pyx_v_nless, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_21); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 426, __pyx_L1_error)
8167   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_21); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 426, __pyx_L1_error)
8168   __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8169   if (__pyx_t_1) {
8170 
8171     /* "yt/utilities/lib/amr_kdtools.pyx":427
8172  *
8173  *         if nless > 0:
8174  *             less_gles = cvarray(format="d", shape=(nless,3), itemsize=sizeof(np.float64_t))             # <<<<<<<<<<<<<<
8175  *             less_gres = cvarray(format="d", shape=(nless,3), itemsize=sizeof(np.float64_t))
8176  *             l_ids = cvarray(format="q", shape=(nless,), itemsize=sizeof(np.int64_t))
8177  */
8178     __pyx_t_21 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 427, __pyx_L1_error)
8179     __Pyx_GOTREF(__pyx_t_21);
8180     if (PyDict_SetItem(__pyx_t_21, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 427, __pyx_L1_error)
8181     __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 427, __pyx_L1_error)
8182     __Pyx_GOTREF(__pyx_t_11);
8183     __Pyx_INCREF(__pyx_v_nless);
8184     __Pyx_GIVEREF(__pyx_v_nless);
8185     PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_nless);
8186     __Pyx_INCREF(__pyx_int_3);
8187     __Pyx_GIVEREF(__pyx_int_3);
8188     PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_int_3);
8189     if (PyDict_SetItem(__pyx_t_21, __pyx_n_s_shape, __pyx_t_11) < 0) __PYX_ERR(0, 427, __pyx_L1_error)
8190     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
8191     __pyx_t_11 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_float64_t))); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 427, __pyx_L1_error)
8192     __Pyx_GOTREF(__pyx_t_11);
8193     if (PyDict_SetItem(__pyx_t_21, __pyx_n_s_itemsize, __pyx_t_11) < 0) __PYX_ERR(0, 427, __pyx_L1_error)
8194     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
8195     __pyx_t_11 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_21); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 427, __pyx_L1_error)
8196     __Pyx_GOTREF(__pyx_t_11);
8197     __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8198     __pyx_t_25 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(__pyx_t_11, PyBUF_WRITABLE); if (unlikely(!__pyx_t_25.memview)) __PYX_ERR(0, 427, __pyx_L1_error)
8199     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
8200     __pyx_v_less_gles = __pyx_t_25;
8201     __pyx_t_25.memview = NULL;
8202     __pyx_t_25.data = NULL;
8203 
8204     /* "yt/utilities/lib/amr_kdtools.pyx":428
8205  *         if nless > 0:
8206  *             less_gles = cvarray(format="d", shape=(nless,3), itemsize=sizeof(np.float64_t))
8207  *             less_gres = cvarray(format="d", shape=(nless,3), itemsize=sizeof(np.float64_t))             # <<<<<<<<<<<<<<
8208  *             l_ids = cvarray(format="q", shape=(nless,), itemsize=sizeof(np.int64_t))
8209  *
8210  */
8211     __pyx_t_11 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 428, __pyx_L1_error)
8212     __Pyx_GOTREF(__pyx_t_11);
8213     if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 428, __pyx_L1_error)
8214     __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 428, __pyx_L1_error)
8215     __Pyx_GOTREF(__pyx_t_21);
8216     __Pyx_INCREF(__pyx_v_nless);
8217     __Pyx_GIVEREF(__pyx_v_nless);
8218     PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_v_nless);
8219     __Pyx_INCREF(__pyx_int_3);
8220     __Pyx_GIVEREF(__pyx_int_3);
8221     PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_int_3);
8222     if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_shape, __pyx_t_21) < 0) __PYX_ERR(0, 428, __pyx_L1_error)
8223     __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8224     __pyx_t_21 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_float64_t))); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 428, __pyx_L1_error)
8225     __Pyx_GOTREF(__pyx_t_21);
8226     if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_itemsize, __pyx_t_21) < 0) __PYX_ERR(0, 428, __pyx_L1_error)
8227     __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8228     __pyx_t_21 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_11); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 428, __pyx_L1_error)
8229     __Pyx_GOTREF(__pyx_t_21);
8230     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
8231     __pyx_t_25 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(__pyx_t_21, PyBUF_WRITABLE); if (unlikely(!__pyx_t_25.memview)) __PYX_ERR(0, 428, __pyx_L1_error)
8232     __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8233     __pyx_v_less_gres = __pyx_t_25;
8234     __pyx_t_25.memview = NULL;
8235     __pyx_t_25.data = NULL;
8236 
8237     /* "yt/utilities/lib/amr_kdtools.pyx":429
8238  *             less_gles = cvarray(format="d", shape=(nless,3), itemsize=sizeof(np.float64_t))
8239  *             less_gres = cvarray(format="d", shape=(nless,3), itemsize=sizeof(np.float64_t))
8240  *             l_ids = cvarray(format="q", shape=(nless,), itemsize=sizeof(np.int64_t))             # <<<<<<<<<<<<<<
8241  *
8242  *             for i in range(nless):
8243  */
8244     __pyx_t_21 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 429, __pyx_L1_error)
8245     __Pyx_GOTREF(__pyx_t_21);
8246     if (PyDict_SetItem(__pyx_t_21, __pyx_n_s_format, __pyx_n_s_q) < 0) __PYX_ERR(0, 429, __pyx_L1_error)
8247     __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 429, __pyx_L1_error)
8248     __Pyx_GOTREF(__pyx_t_11);
8249     __Pyx_INCREF(__pyx_v_nless);
8250     __Pyx_GIVEREF(__pyx_v_nless);
8251     PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_nless);
8252     if (PyDict_SetItem(__pyx_t_21, __pyx_n_s_shape, __pyx_t_11) < 0) __PYX_ERR(0, 429, __pyx_L1_error)
8253     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
8254     __pyx_t_11 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_int64_t))); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 429, __pyx_L1_error)
8255     __Pyx_GOTREF(__pyx_t_11);
8256     if (PyDict_SetItem(__pyx_t_21, __pyx_n_s_itemsize, __pyx_t_11) < 0) __PYX_ERR(0, 429, __pyx_L1_error)
8257     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
8258     __pyx_t_11 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_21); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 429, __pyx_L1_error)
8259     __Pyx_GOTREF(__pyx_t_11);
8260     __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8261     __pyx_t_26 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int64_t(__pyx_t_11, PyBUF_WRITABLE); if (unlikely(!__pyx_t_26.memview)) __PYX_ERR(0, 429, __pyx_L1_error)
8262     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
8263     __pyx_v_l_ids = __pyx_t_26;
8264     __pyx_t_26.memview = NULL;
8265     __pyx_t_26.data = NULL;
8266 
8267     /* "yt/utilities/lib/amr_kdtools.pyx":431
8268  *             l_ids = cvarray(format="q", shape=(nless,), itemsize=sizeof(np.int64_t))
8269  *
8270  *             for i in range(nless):             # <<<<<<<<<<<<<<
8271  *                 index = less_index[i]
8272  *                 l_ids[i] = gids[index]
8273  */
8274     __pyx_t_27 = __Pyx_PyInt_As_long(__pyx_v_nless); if (unlikely((__pyx_t_27 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 431, __pyx_L1_error)
8275     __pyx_t_28 = __pyx_t_27;
8276     for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_28; __pyx_t_5+=1) {
8277       __pyx_v_i = __pyx_t_5;
8278 
8279       /* "yt/utilities/lib/amr_kdtools.pyx":432
8280  *
8281  *             for i in range(nless):
8282  *                 index = less_index[i]             # <<<<<<<<<<<<<<
8283  *                 l_ids[i] = gids[index]
8284  *                 for j in range(3):
8285  */
8286       __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_less_index, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 432, __pyx_L1_error)
8287       __Pyx_GOTREF(__pyx_t_11);
8288       __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_11); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 432, __pyx_L1_error)
8289       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
8290       __pyx_v_index = __pyx_t_6;
8291 
8292       /* "yt/utilities/lib/amr_kdtools.pyx":433
8293  *             for i in range(nless):
8294  *                 index = less_index[i]
8295  *                 l_ids[i] = gids[index]             # <<<<<<<<<<<<<<
8296  *                 for j in range(3):
8297  *                     less_gles[i,j] = gles[index,j]
8298  */
8299       __pyx_t_29 = __pyx_v_index;
8300       __pyx_t_30 = __pyx_v_i;
8301       *((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ (__pyx_v_l_ids.data + __pyx_t_30 * __pyx_v_l_ids.strides[0]) )) = (*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ (__pyx_v_gids.data + __pyx_t_29 * __pyx_v_gids.strides[0]) )));
8302 
8303       /* "yt/utilities/lib/amr_kdtools.pyx":434
8304  *                 index = less_index[i]
8305  *                 l_ids[i] = gids[index]
8306  *                 for j in range(3):             # <<<<<<<<<<<<<<
8307  *                     less_gles[i,j] = gles[index,j]
8308  *                     less_gres[i,j] = gres[index,j]
8309  */
8310       for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) {
8311         __pyx_v_j = __pyx_t_6;
8312 
8313         /* "yt/utilities/lib/amr_kdtools.pyx":435
8314  *                 l_ids[i] = gids[index]
8315  *                 for j in range(3):
8316  *                     less_gles[i,j] = gles[index,j]             # <<<<<<<<<<<<<<
8317  *                     less_gres[i,j] = gres[index,j]
8318  *
8319  */
8320         __pyx_t_31 = __pyx_v_index;
8321         __pyx_t_32 = __pyx_v_j;
8322         __pyx_t_33 = __pyx_v_i;
8323         __pyx_t_34 = __pyx_v_j;
8324         *((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_less_gles.data + __pyx_t_33 * __pyx_v_less_gles.strides[0]) ) + __pyx_t_34 * __pyx_v_less_gles.strides[1]) )) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_gles.data + __pyx_t_31 * __pyx_v_gles.strides[0]) ) + __pyx_t_32 * __pyx_v_gles.strides[1]) )));
8325 
8326         /* "yt/utilities/lib/amr_kdtools.pyx":436
8327  *                 for j in range(3):
8328  *                     less_gles[i,j] = gles[index,j]
8329  *                     less_gres[i,j] = gres[index,j]             # <<<<<<<<<<<<<<
8330  *
8331  *             # Populate Left Node
8332  */
8333         __pyx_t_35 = __pyx_v_index;
8334         __pyx_t_36 = __pyx_v_j;
8335         __pyx_t_37 = __pyx_v_i;
8336         __pyx_t_38 = __pyx_v_j;
8337         *((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_less_gres.data + __pyx_t_37 * __pyx_v_less_gres.strides[0]) ) + __pyx_t_38 * __pyx_v_less_gres.strides[1]) )) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_gres.data + __pyx_t_35 * __pyx_v_gres.strides[0]) ) + __pyx_t_36 * __pyx_v_gres.strides[1]) )));
8338       }
8339     }
8340 
8341     /* "yt/utilities/lib/amr_kdtools.pyx":440
8342  *             # Populate Left Node
8343  *             #print('Inserting left node', self.left_edge, self.right_edge)
8344  *             self.left.insert_grids(nless, less_gles, less_gres,             # <<<<<<<<<<<<<<
8345  *                          l_ids, rank, size)
8346  *
8347  */
8348     __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_nless); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 440, __pyx_L1_error)
8349 
8350     /* "yt/utilities/lib/amr_kdtools.pyx":441
8351  *             #print('Inserting left node', self.left_edge, self.right_edge)
8352  *             self.left.insert_grids(nless, less_gles, less_gres,
8353  *                          l_ids, rank, size)             # <<<<<<<<<<<<<<
8354  *
8355  *         if ngreater > 0:
8356  */
8357     ((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->left->__pyx_vtab)->insert_grids(__pyx_v_self->left, __pyx_t_5, __pyx_v_less_gles, __pyx_v_less_gres, __pyx_v_l_ids, __pyx_v_rank, __pyx_v_size);
8358 
8359     /* "yt/utilities/lib/amr_kdtools.pyx":426
8360  *                 ngreater += 1
8361  *
8362  *         if nless > 0:             # <<<<<<<<<<<<<<
8363  *             less_gles = cvarray(format="d", shape=(nless,3), itemsize=sizeof(np.float64_t))
8364  *             less_gres = cvarray(format="d", shape=(nless,3), itemsize=sizeof(np.float64_t))
8365  */
8366   }
8367 
8368   /* "yt/utilities/lib/amr_kdtools.pyx":443
8369  *                          l_ids, rank, size)
8370  *
8371  *         if ngreater > 0:             # <<<<<<<<<<<<<<
8372  *             greater_gles = cvarray(format="d", shape=(ngreater,3), itemsize=sizeof(np.float64_t))
8373  *             greater_gres = cvarray(format="d", shape=(ngreater,3), itemsize=sizeof(np.float64_t))
8374  */
8375   __pyx_t_11 = PyObject_RichCompare(__pyx_v_ngreater, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 443, __pyx_L1_error)
8376   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 443, __pyx_L1_error)
8377   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
8378   if (__pyx_t_1) {
8379 
8380     /* "yt/utilities/lib/amr_kdtools.pyx":444
8381  *
8382  *         if ngreater > 0:
8383  *             greater_gles = cvarray(format="d", shape=(ngreater,3), itemsize=sizeof(np.float64_t))             # <<<<<<<<<<<<<<
8384  *             greater_gres = cvarray(format="d", shape=(ngreater,3), itemsize=sizeof(np.float64_t))
8385  *             g_ids = cvarray(format="q", shape=(ngreater,), itemsize=sizeof(np.int64_t))
8386  */
8387     __pyx_t_11 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 444, __pyx_L1_error)
8388     __Pyx_GOTREF(__pyx_t_11);
8389     if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 444, __pyx_L1_error)
8390     __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 444, __pyx_L1_error)
8391     __Pyx_GOTREF(__pyx_t_21);
8392     __Pyx_INCREF(__pyx_v_ngreater);
8393     __Pyx_GIVEREF(__pyx_v_ngreater);
8394     PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_v_ngreater);
8395     __Pyx_INCREF(__pyx_int_3);
8396     __Pyx_GIVEREF(__pyx_int_3);
8397     PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_int_3);
8398     if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_shape, __pyx_t_21) < 0) __PYX_ERR(0, 444, __pyx_L1_error)
8399     __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8400     __pyx_t_21 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_float64_t))); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 444, __pyx_L1_error)
8401     __Pyx_GOTREF(__pyx_t_21);
8402     if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_itemsize, __pyx_t_21) < 0) __PYX_ERR(0, 444, __pyx_L1_error)
8403     __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8404     __pyx_t_21 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_11); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 444, __pyx_L1_error)
8405     __Pyx_GOTREF(__pyx_t_21);
8406     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
8407     __pyx_t_25 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(__pyx_t_21, PyBUF_WRITABLE); if (unlikely(!__pyx_t_25.memview)) __PYX_ERR(0, 444, __pyx_L1_error)
8408     __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8409     __pyx_v_greater_gles = __pyx_t_25;
8410     __pyx_t_25.memview = NULL;
8411     __pyx_t_25.data = NULL;
8412 
8413     /* "yt/utilities/lib/amr_kdtools.pyx":445
8414  *         if ngreater > 0:
8415  *             greater_gles = cvarray(format="d", shape=(ngreater,3), itemsize=sizeof(np.float64_t))
8416  *             greater_gres = cvarray(format="d", shape=(ngreater,3), itemsize=sizeof(np.float64_t))             # <<<<<<<<<<<<<<
8417  *             g_ids = cvarray(format="q", shape=(ngreater,), itemsize=sizeof(np.int64_t))
8418  *
8419  */
8420     __pyx_t_21 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 445, __pyx_L1_error)
8421     __Pyx_GOTREF(__pyx_t_21);
8422     if (PyDict_SetItem(__pyx_t_21, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 445, __pyx_L1_error)
8423     __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 445, __pyx_L1_error)
8424     __Pyx_GOTREF(__pyx_t_11);
8425     __Pyx_INCREF(__pyx_v_ngreater);
8426     __Pyx_GIVEREF(__pyx_v_ngreater);
8427     PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_ngreater);
8428     __Pyx_INCREF(__pyx_int_3);
8429     __Pyx_GIVEREF(__pyx_int_3);
8430     PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_int_3);
8431     if (PyDict_SetItem(__pyx_t_21, __pyx_n_s_shape, __pyx_t_11) < 0) __PYX_ERR(0, 445, __pyx_L1_error)
8432     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
8433     __pyx_t_11 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_float64_t))); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 445, __pyx_L1_error)
8434     __Pyx_GOTREF(__pyx_t_11);
8435     if (PyDict_SetItem(__pyx_t_21, __pyx_n_s_itemsize, __pyx_t_11) < 0) __PYX_ERR(0, 445, __pyx_L1_error)
8436     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
8437     __pyx_t_11 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_21); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 445, __pyx_L1_error)
8438     __Pyx_GOTREF(__pyx_t_11);
8439     __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8440     __pyx_t_25 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(__pyx_t_11, PyBUF_WRITABLE); if (unlikely(!__pyx_t_25.memview)) __PYX_ERR(0, 445, __pyx_L1_error)
8441     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
8442     __pyx_v_greater_gres = __pyx_t_25;
8443     __pyx_t_25.memview = NULL;
8444     __pyx_t_25.data = NULL;
8445 
8446     /* "yt/utilities/lib/amr_kdtools.pyx":446
8447  *             greater_gles = cvarray(format="d", shape=(ngreater,3), itemsize=sizeof(np.float64_t))
8448  *             greater_gres = cvarray(format="d", shape=(ngreater,3), itemsize=sizeof(np.float64_t))
8449  *             g_ids = cvarray(format="q", shape=(ngreater,), itemsize=sizeof(np.int64_t))             # <<<<<<<<<<<<<<
8450  *
8451  *             for i in range(ngreater):
8452  */
8453     __pyx_t_11 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 446, __pyx_L1_error)
8454     __Pyx_GOTREF(__pyx_t_11);
8455     if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_format, __pyx_n_s_q) < 0) __PYX_ERR(0, 446, __pyx_L1_error)
8456     __pyx_t_21 = PyTuple_New(1); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 446, __pyx_L1_error)
8457     __Pyx_GOTREF(__pyx_t_21);
8458     __Pyx_INCREF(__pyx_v_ngreater);
8459     __Pyx_GIVEREF(__pyx_v_ngreater);
8460     PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_v_ngreater);
8461     if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_shape, __pyx_t_21) < 0) __PYX_ERR(0, 446, __pyx_L1_error)
8462     __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8463     __pyx_t_21 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_int64_t))); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 446, __pyx_L1_error)
8464     __Pyx_GOTREF(__pyx_t_21);
8465     if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_itemsize, __pyx_t_21) < 0) __PYX_ERR(0, 446, __pyx_L1_error)
8466     __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8467     __pyx_t_21 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_11); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 446, __pyx_L1_error)
8468     __Pyx_GOTREF(__pyx_t_21);
8469     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
8470     __pyx_t_26 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int64_t(__pyx_t_21, PyBUF_WRITABLE); if (unlikely(!__pyx_t_26.memview)) __PYX_ERR(0, 446, __pyx_L1_error)
8471     __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8472     __pyx_v_g_ids = __pyx_t_26;
8473     __pyx_t_26.memview = NULL;
8474     __pyx_t_26.data = NULL;
8475 
8476     /* "yt/utilities/lib/amr_kdtools.pyx":448
8477  *             g_ids = cvarray(format="q", shape=(ngreater,), itemsize=sizeof(np.int64_t))
8478  *
8479  *             for i in range(ngreater):             # <<<<<<<<<<<<<<
8480  *                 index = greater_index[i]
8481  *                 g_ids[i] = gids[index]
8482  */
8483     __pyx_t_27 = __Pyx_PyInt_As_long(__pyx_v_ngreater); if (unlikely((__pyx_t_27 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 448, __pyx_L1_error)
8484     __pyx_t_28 = __pyx_t_27;
8485     for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_28; __pyx_t_5+=1) {
8486       __pyx_v_i = __pyx_t_5;
8487 
8488       /* "yt/utilities/lib/amr_kdtools.pyx":449
8489  *
8490  *             for i in range(ngreater):
8491  *                 index = greater_index[i]             # <<<<<<<<<<<<<<
8492  *                 g_ids[i] = gids[index]
8493  *                 for j in range(3):
8494  */
8495       __pyx_t_21 = __Pyx_GetItemInt(__pyx_v_greater_index, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 449, __pyx_L1_error)
8496       __Pyx_GOTREF(__pyx_t_21);
8497       __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_21); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 449, __pyx_L1_error)
8498       __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8499       __pyx_v_index = __pyx_t_6;
8500 
8501       /* "yt/utilities/lib/amr_kdtools.pyx":450
8502  *             for i in range(ngreater):
8503  *                 index = greater_index[i]
8504  *                 g_ids[i] = gids[index]             # <<<<<<<<<<<<<<
8505  *                 for j in range(3):
8506  *                     greater_gles[i,j] = gles[index,j]
8507  */
8508       __pyx_t_39 = __pyx_v_index;
8509       __pyx_t_40 = __pyx_v_i;
8510       *((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ (__pyx_v_g_ids.data + __pyx_t_40 * __pyx_v_g_ids.strides[0]) )) = (*((__pyx_t_5numpy_int64_t *) ( /* dim=0 */ (__pyx_v_gids.data + __pyx_t_39 * __pyx_v_gids.strides[0]) )));
8511 
8512       /* "yt/utilities/lib/amr_kdtools.pyx":451
8513  *                 index = greater_index[i]
8514  *                 g_ids[i] = gids[index]
8515  *                 for j in range(3):             # <<<<<<<<<<<<<<
8516  *                     greater_gles[i,j] = gles[index,j]
8517  *                     greater_gres[i,j] = gres[index,j]
8518  */
8519       for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) {
8520         __pyx_v_j = __pyx_t_6;
8521 
8522         /* "yt/utilities/lib/amr_kdtools.pyx":452
8523  *                 g_ids[i] = gids[index]
8524  *                 for j in range(3):
8525  *                     greater_gles[i,j] = gles[index,j]             # <<<<<<<<<<<<<<
8526  *                     greater_gres[i,j] = gres[index,j]
8527  *
8528  */
8529         __pyx_t_41 = __pyx_v_index;
8530         __pyx_t_42 = __pyx_v_j;
8531         __pyx_t_43 = __pyx_v_i;
8532         __pyx_t_44 = __pyx_v_j;
8533         *((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_greater_gles.data + __pyx_t_43 * __pyx_v_greater_gles.strides[0]) ) + __pyx_t_44 * __pyx_v_greater_gles.strides[1]) )) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_gles.data + __pyx_t_41 * __pyx_v_gles.strides[0]) ) + __pyx_t_42 * __pyx_v_gles.strides[1]) )));
8534 
8535         /* "yt/utilities/lib/amr_kdtools.pyx":453
8536  *                 for j in range(3):
8537  *                     greater_gles[i,j] = gles[index,j]
8538  *                     greater_gres[i,j] = gres[index,j]             # <<<<<<<<<<<<<<
8539  *
8540  *             # Populate Right Node
8541  */
8542         __pyx_t_45 = __pyx_v_index;
8543         __pyx_t_46 = __pyx_v_j;
8544         __pyx_t_47 = __pyx_v_i;
8545         __pyx_t_48 = __pyx_v_j;
8546         *((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_greater_gres.data + __pyx_t_47 * __pyx_v_greater_gres.strides[0]) ) + __pyx_t_48 * __pyx_v_greater_gres.strides[1]) )) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_gres.data + __pyx_t_45 * __pyx_v_gres.strides[0]) ) + __pyx_t_46 * __pyx_v_gres.strides[1]) )));
8547       }
8548     }
8549 
8550     /* "yt/utilities/lib/amr_kdtools.pyx":457
8551  *             # Populate Right Node
8552  *             #print('Inserting right node', self.left_edge, self.right_edge)
8553  *             self.right.insert_grids(ngreater, greater_gles, greater_gres,             # <<<<<<<<<<<<<<
8554  *                          g_ids, rank, size)
8555  *
8556  */
8557     __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_ngreater); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 457, __pyx_L1_error)
8558 
8559     /* "yt/utilities/lib/amr_kdtools.pyx":458
8560  *             #print('Inserting right node', self.left_edge, self.right_edge)
8561  *             self.right.insert_grids(ngreater, greater_gles, greater_gres,
8562  *                          g_ids, rank, size)             # <<<<<<<<<<<<<<
8563  *
8564  *         return 0
8565  */
8566     ((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->right->__pyx_vtab)->insert_grids(__pyx_v_self->right, __pyx_t_5, __pyx_v_greater_gles, __pyx_v_greater_gres, __pyx_v_g_ids, __pyx_v_rank, __pyx_v_size);
8567 
8568     /* "yt/utilities/lib/amr_kdtools.pyx":443
8569  *                          l_ids, rank, size)
8570  *
8571  *         if ngreater > 0:             # <<<<<<<<<<<<<<
8572  *             greater_gles = cvarray(format="d", shape=(ngreater,3), itemsize=sizeof(np.float64_t))
8573  *             greater_gres = cvarray(format="d", shape=(ngreater,3), itemsize=sizeof(np.float64_t))
8574  */
8575   }
8576 
8577   /* "yt/utilities/lib/amr_kdtools.pyx":460
8578  *                          g_ids, rank, size)
8579  *
8580  *         return 0             # <<<<<<<<<<<<<<
8581  *
8582  *     cdef geo_split(self,
8583  */
8584   __pyx_r = 0;
8585   goto __pyx_L0;
8586 
8587   /* "yt/utilities/lib/amr_kdtools.pyx":371
8588  *     #@cython.wraparound(False)
8589  *     #@cython.cdivision(True)
8590  *     cdef int split_grids(self,             # <<<<<<<<<<<<<<
8591  *                            int ngrids,
8592  *                            np.float64_t[:,:] gles,
8593  */
8594 
8595   /* function exit code */
8596   __pyx_L1_error:;
8597   __Pyx_XDECREF(__pyx_t_2);
8598   __Pyx_XDECREF(__pyx_t_3);
8599   __Pyx_XDECREF(__pyx_t_4);
8600   __Pyx_XDECREF(__pyx_t_11);
8601   __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
8602   __Pyx_XDECREF(((PyObject *)__pyx_t_16));
8603   __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
8604   __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
8605   __PYX_XDEC_MEMVIEW(&__pyx_t_19, 1);
8606   __PYX_XDEC_MEMVIEW(&__pyx_t_20, 1);
8607   __Pyx_XDECREF(__pyx_t_21);
8608   __Pyx_XDECREF(__pyx_t_22);
8609   __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
8610   __PYX_XDEC_MEMVIEW(&__pyx_t_26, 1);
8611   __Pyx_WriteUnraisable("yt.utilities.lib.amr_kdtools.Node.split_grids", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
8612   __pyx_r = 0;
8613   __pyx_L0:;
8614   __PYX_XDEC_MEMVIEW(&__pyx_v_less_gles, 1);
8615   __PYX_XDEC_MEMVIEW(&__pyx_v_less_gres, 1);
8616   __PYX_XDEC_MEMVIEW(&__pyx_v_greater_gles, 1);
8617   __PYX_XDEC_MEMVIEW(&__pyx_v_greater_gres, 1);
8618   __PYX_XDEC_MEMVIEW(&__pyx_v_l_ids, 1);
8619   __PYX_XDEC_MEMVIEW(&__pyx_v_g_ids, 1);
8620   __Pyx_XDECREF(__pyx_v_data);
8621   __Pyx_XDECREF(__pyx_v_less_ids);
8622   __Pyx_XDECREF(__pyx_v_greater_ids);
8623   __Pyx_XDECREF(__pyx_v_best_dim);
8624   __Pyx_XDECREF(__pyx_v_split_pos);
8625   __Pyx_XDECREF(__pyx_v_nless);
8626   __Pyx_XDECREF(__pyx_v_ngreater);
8627   __Pyx_XDECREF(__pyx_v_less_index);
8628   __Pyx_XDECREF(__pyx_v_greater_index);
8629   __Pyx_RefNannyFinishContext();
8630   return __pyx_r;
8631 }
8632 
8633 /* "yt/utilities/lib/amr_kdtools.pyx":462
8634  *         return 0
8635  *
8636  *     cdef geo_split(self,             # <<<<<<<<<<<<<<
8637  *                    np.float64_t[:] gle,
8638  *                    np.float64_t[:] gre,
8639  */
8640 
8641 static PyObject *__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_geo_split(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, __Pyx_memviewslice __pyx_v_gle, __Pyx_memviewslice __pyx_v_gre, int __pyx_v_grid_id, int __pyx_v_rank, int __pyx_v_size) {
8642   int __pyx_v_big_dim;
8643   int __pyx_v_i;
8644   __pyx_t_5numpy_float64_t __pyx_v_v;
8645   __pyx_t_5numpy_float64_t __pyx_v_my_max;
8646   PyObject *__pyx_v_new_pos = NULL;
8647   PyObject *__pyx_v_lnew_gle = NULL;
8648   PyObject *__pyx_v_lnew_gre = NULL;
8649   PyObject *__pyx_v_rnew_gle = NULL;
8650   PyObject *__pyx_v_rnew_gre = NULL;
8651   long __pyx_v_j;
8652   struct __pyx_t_2yt_9utilities_3lib_11amr_kdtools_Split *__pyx_v_split;
8653   PyObject *__pyx_r = NULL;
8654   __Pyx_RefNannyDeclarations
8655   int __pyx_t_1;
8656   Py_ssize_t __pyx_t_2;
8657   Py_ssize_t __pyx_t_3;
8658   int __pyx_t_4;
8659   Py_ssize_t __pyx_t_5;
8660   Py_ssize_t __pyx_t_6;
8661   PyObject *__pyx_t_7 = NULL;
8662   PyObject *__pyx_t_8 = NULL;
8663   long __pyx_t_9;
8664   Py_ssize_t __pyx_t_10;
8665   Py_ssize_t __pyx_t_11;
8666   Py_ssize_t __pyx_t_12;
8667   Py_ssize_t __pyx_t_13;
8668   __pyx_t_5numpy_float64_t __pyx_t_14;
8669   __Pyx_memviewslice __pyx_t_15 = { 0, 0, { 0 }, { 0 }, { 0 } };
8670   __Pyx_memviewslice __pyx_t_16 = { 0, 0, { 0 }, { 0 }, { 0 } };
8671   __Pyx_RefNannySetupContext("geo_split", 0);
8672 
8673   /* "yt/utilities/lib/amr_kdtools.pyx":468
8674  *                    int rank,
8675  *                    int size):
8676  *         cdef int big_dim = 0             # <<<<<<<<<<<<<<
8677  *         cdef int i
8678  *         cdef np.float64_t v, my_max = 0.0
8679  */
8680   __pyx_v_big_dim = 0;
8681 
8682   /* "yt/utilities/lib/amr_kdtools.pyx":470
8683  *         cdef int big_dim = 0
8684  *         cdef int i
8685  *         cdef np.float64_t v, my_max = 0.0             # <<<<<<<<<<<<<<
8686  *
8687  *         for i in range(3):
8688  */
8689   __pyx_v_my_max = 0.0;
8690 
8691   /* "yt/utilities/lib/amr_kdtools.pyx":472
8692  *         cdef np.float64_t v, my_max = 0.0
8693  *
8694  *         for i in range(3):             # <<<<<<<<<<<<<<
8695  *             v = gre[i] - gle[i]
8696  *             if v > my_max:
8697  */
8698   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
8699     __pyx_v_i = __pyx_t_1;
8700 
8701     /* "yt/utilities/lib/amr_kdtools.pyx":473
8702  *
8703  *         for i in range(3):
8704  *             v = gre[i] - gle[i]             # <<<<<<<<<<<<<<
8705  *             if v > my_max:
8706  *                 my_max = v
8707  */
8708     __pyx_t_2 = __pyx_v_i;
8709     __pyx_t_3 = __pyx_v_i;
8710     __pyx_v_v = ((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_gre.data + __pyx_t_2 * __pyx_v_gre.strides[0]) ))) - (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_gle.data + __pyx_t_3 * __pyx_v_gle.strides[0]) ))));
8711 
8712     /* "yt/utilities/lib/amr_kdtools.pyx":474
8713  *         for i in range(3):
8714  *             v = gre[i] - gle[i]
8715  *             if v > my_max:             # <<<<<<<<<<<<<<
8716  *                 my_max = v
8717  *                 big_dim = i
8718  */
8719     __pyx_t_4 = ((__pyx_v_v > __pyx_v_my_max) != 0);
8720     if (__pyx_t_4) {
8721 
8722       /* "yt/utilities/lib/amr_kdtools.pyx":475
8723  *             v = gre[i] - gle[i]
8724  *             if v > my_max:
8725  *                 my_max = v             # <<<<<<<<<<<<<<
8726  *                 big_dim = i
8727  *
8728  */
8729       __pyx_v_my_max = __pyx_v_v;
8730 
8731       /* "yt/utilities/lib/amr_kdtools.pyx":476
8732  *             if v > my_max:
8733  *                 my_max = v
8734  *                 big_dim = i             # <<<<<<<<<<<<<<
8735  *
8736  *         new_pos = (gre[big_dim] + gle[big_dim])/2.
8737  */
8738       __pyx_v_big_dim = __pyx_v_i;
8739 
8740       /* "yt/utilities/lib/amr_kdtools.pyx":474
8741  *         for i in range(3):
8742  *             v = gre[i] - gle[i]
8743  *             if v > my_max:             # <<<<<<<<<<<<<<
8744  *                 my_max = v
8745  *                 big_dim = i
8746  */
8747     }
8748   }
8749 
8750   /* "yt/utilities/lib/amr_kdtools.pyx":478
8751  *                 big_dim = i
8752  *
8753  *         new_pos = (gre[big_dim] + gle[big_dim])/2.             # <<<<<<<<<<<<<<
8754  *
8755  *         lnew_gle = cvarray(format="d", shape=(3,), itemsize=sizeof(np.float64_t))
8756  */
8757   __pyx_t_5 = __pyx_v_big_dim;
8758   __pyx_t_6 = __pyx_v_big_dim;
8759   __pyx_t_7 = PyFloat_FromDouble((((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_gre.data + __pyx_t_5 * __pyx_v_gre.strides[0]) ))) + (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_gle.data + __pyx_t_6 * __pyx_v_gle.strides[0]) )))) / 2.)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 478, __pyx_L1_error)
8760   __Pyx_GOTREF(__pyx_t_7);
8761   __pyx_v_new_pos = __pyx_t_7;
8762   __pyx_t_7 = 0;
8763 
8764   /* "yt/utilities/lib/amr_kdtools.pyx":480
8765  *         new_pos = (gre[big_dim] + gle[big_dim])/2.
8766  *
8767  *         lnew_gle = cvarray(format="d", shape=(3,), itemsize=sizeof(np.float64_t))             # <<<<<<<<<<<<<<
8768  *         lnew_gre = cvarray(format="d", shape=(3,), itemsize=sizeof(np.float64_t))
8769  *         rnew_gle = cvarray(format="d", shape=(3,), itemsize=sizeof(np.float64_t))
8770  */
8771   __pyx_t_7 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 480, __pyx_L1_error)
8772   __Pyx_GOTREF(__pyx_t_7);
8773   if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 480, __pyx_L1_error)
8774   if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_shape, __pyx_tuple_) < 0) __PYX_ERR(0, 480, __pyx_L1_error)
8775   __pyx_t_8 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_float64_t))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 480, __pyx_L1_error)
8776   __Pyx_GOTREF(__pyx_t_8);
8777   if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_itemsize, __pyx_t_8) < 0) __PYX_ERR(0, 480, __pyx_L1_error)
8778   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8779   __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 480, __pyx_L1_error)
8780   __Pyx_GOTREF(__pyx_t_8);
8781   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8782   __pyx_v_lnew_gle = __pyx_t_8;
8783   __pyx_t_8 = 0;
8784 
8785   /* "yt/utilities/lib/amr_kdtools.pyx":481
8786  *
8787  *         lnew_gle = cvarray(format="d", shape=(3,), itemsize=sizeof(np.float64_t))
8788  *         lnew_gre = cvarray(format="d", shape=(3,), itemsize=sizeof(np.float64_t))             # <<<<<<<<<<<<<<
8789  *         rnew_gle = cvarray(format="d", shape=(3,), itemsize=sizeof(np.float64_t))
8790  *         rnew_gre = cvarray(format="d", shape=(3,), itemsize=sizeof(np.float64_t))
8791  */
8792   __pyx_t_8 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 481, __pyx_L1_error)
8793   __Pyx_GOTREF(__pyx_t_8);
8794   if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 481, __pyx_L1_error)
8795   if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_shape, __pyx_tuple_) < 0) __PYX_ERR(0, 481, __pyx_L1_error)
8796   __pyx_t_7 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_float64_t))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 481, __pyx_L1_error)
8797   __Pyx_GOTREF(__pyx_t_7);
8798   if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_itemsize, __pyx_t_7) < 0) __PYX_ERR(0, 481, __pyx_L1_error)
8799   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8800   __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 481, __pyx_L1_error)
8801   __Pyx_GOTREF(__pyx_t_7);
8802   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8803   __pyx_v_lnew_gre = __pyx_t_7;
8804   __pyx_t_7 = 0;
8805 
8806   /* "yt/utilities/lib/amr_kdtools.pyx":482
8807  *         lnew_gle = cvarray(format="d", shape=(3,), itemsize=sizeof(np.float64_t))
8808  *         lnew_gre = cvarray(format="d", shape=(3,), itemsize=sizeof(np.float64_t))
8809  *         rnew_gle = cvarray(format="d", shape=(3,), itemsize=sizeof(np.float64_t))             # <<<<<<<<<<<<<<
8810  *         rnew_gre = cvarray(format="d", shape=(3,), itemsize=sizeof(np.float64_t))
8811  *
8812  */
8813   __pyx_t_7 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 482, __pyx_L1_error)
8814   __Pyx_GOTREF(__pyx_t_7);
8815   if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 482, __pyx_L1_error)
8816   if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_shape, __pyx_tuple_) < 0) __PYX_ERR(0, 482, __pyx_L1_error)
8817   __pyx_t_8 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_float64_t))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 482, __pyx_L1_error)
8818   __Pyx_GOTREF(__pyx_t_8);
8819   if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_itemsize, __pyx_t_8) < 0) __PYX_ERR(0, 482, __pyx_L1_error)
8820   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8821   __pyx_t_8 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 482, __pyx_L1_error)
8822   __Pyx_GOTREF(__pyx_t_8);
8823   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8824   __pyx_v_rnew_gle = __pyx_t_8;
8825   __pyx_t_8 = 0;
8826 
8827   /* "yt/utilities/lib/amr_kdtools.pyx":483
8828  *         lnew_gre = cvarray(format="d", shape=(3,), itemsize=sizeof(np.float64_t))
8829  *         rnew_gle = cvarray(format="d", shape=(3,), itemsize=sizeof(np.float64_t))
8830  *         rnew_gre = cvarray(format="d", shape=(3,), itemsize=sizeof(np.float64_t))             # <<<<<<<<<<<<<<
8831  *
8832  *         for j in range(3):
8833  */
8834   __pyx_t_8 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 483, __pyx_L1_error)
8835   __Pyx_GOTREF(__pyx_t_8);
8836   if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 483, __pyx_L1_error)
8837   if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_shape, __pyx_tuple_) < 0) __PYX_ERR(0, 483, __pyx_L1_error)
8838   __pyx_t_7 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_float64_t))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 483, __pyx_L1_error)
8839   __Pyx_GOTREF(__pyx_t_7);
8840   if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_itemsize, __pyx_t_7) < 0) __PYX_ERR(0, 483, __pyx_L1_error)
8841   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8842   __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 483, __pyx_L1_error)
8843   __Pyx_GOTREF(__pyx_t_7);
8844   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8845   __pyx_v_rnew_gre = __pyx_t_7;
8846   __pyx_t_7 = 0;
8847 
8848   /* "yt/utilities/lib/amr_kdtools.pyx":485
8849  *         rnew_gre = cvarray(format="d", shape=(3,), itemsize=sizeof(np.float64_t))
8850  *
8851  *         for j in range(3):             # <<<<<<<<<<<<<<
8852  *             lnew_gle[j] = gle[j]
8853  *             lnew_gre[j] = gre[j]
8854  */
8855   for (__pyx_t_9 = 0; __pyx_t_9 < 3; __pyx_t_9+=1) {
8856     __pyx_v_j = __pyx_t_9;
8857 
8858     /* "yt/utilities/lib/amr_kdtools.pyx":486
8859  *
8860  *         for j in range(3):
8861  *             lnew_gle[j] = gle[j]             # <<<<<<<<<<<<<<
8862  *             lnew_gre[j] = gre[j]
8863  *             rnew_gle[j] = gle[j]
8864  */
8865     __pyx_t_10 = __pyx_v_j;
8866     __pyx_t_7 = PyFloat_FromDouble((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_gle.data + __pyx_t_10 * __pyx_v_gle.strides[0]) )))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 486, __pyx_L1_error)
8867     __Pyx_GOTREF(__pyx_t_7);
8868     if (unlikely(__Pyx_SetItemInt(__pyx_v_lnew_gle, __pyx_v_j, __pyx_t_7, long, 1, __Pyx_PyInt_From_long, 0, 0, 0) < 0)) __PYX_ERR(0, 486, __pyx_L1_error)
8869     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8870 
8871     /* "yt/utilities/lib/amr_kdtools.pyx":487
8872  *         for j in range(3):
8873  *             lnew_gle[j] = gle[j]
8874  *             lnew_gre[j] = gre[j]             # <<<<<<<<<<<<<<
8875  *             rnew_gle[j] = gle[j]
8876  *             rnew_gre[j] = gre[j]
8877  */
8878     __pyx_t_11 = __pyx_v_j;
8879     __pyx_t_7 = PyFloat_FromDouble((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_gre.data + __pyx_t_11 * __pyx_v_gre.strides[0]) )))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 487, __pyx_L1_error)
8880     __Pyx_GOTREF(__pyx_t_7);
8881     if (unlikely(__Pyx_SetItemInt(__pyx_v_lnew_gre, __pyx_v_j, __pyx_t_7, long, 1, __Pyx_PyInt_From_long, 0, 0, 0) < 0)) __PYX_ERR(0, 487, __pyx_L1_error)
8882     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8883 
8884     /* "yt/utilities/lib/amr_kdtools.pyx":488
8885  *             lnew_gle[j] = gle[j]
8886  *             lnew_gre[j] = gre[j]
8887  *             rnew_gle[j] = gle[j]             # <<<<<<<<<<<<<<
8888  *             rnew_gre[j] = gre[j]
8889  *
8890  */
8891     __pyx_t_12 = __pyx_v_j;
8892     __pyx_t_7 = PyFloat_FromDouble((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_gle.data + __pyx_t_12 * __pyx_v_gle.strides[0]) )))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 488, __pyx_L1_error)
8893     __Pyx_GOTREF(__pyx_t_7);
8894     if (unlikely(__Pyx_SetItemInt(__pyx_v_rnew_gle, __pyx_v_j, __pyx_t_7, long, 1, __Pyx_PyInt_From_long, 0, 0, 0) < 0)) __PYX_ERR(0, 488, __pyx_L1_error)
8895     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8896 
8897     /* "yt/utilities/lib/amr_kdtools.pyx":489
8898  *             lnew_gre[j] = gre[j]
8899  *             rnew_gle[j] = gle[j]
8900  *             rnew_gre[j] = gre[j]             # <<<<<<<<<<<<<<
8901  *
8902  *         split = <Split *> malloc(sizeof(Split))
8903  */
8904     __pyx_t_13 = __pyx_v_j;
8905     __pyx_t_7 = PyFloat_FromDouble((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_gre.data + __pyx_t_13 * __pyx_v_gre.strides[0]) )))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 489, __pyx_L1_error)
8906     __Pyx_GOTREF(__pyx_t_7);
8907     if (unlikely(__Pyx_SetItemInt(__pyx_v_rnew_gre, __pyx_v_j, __pyx_t_7, long, 1, __Pyx_PyInt_From_long, 0, 0, 0) < 0)) __PYX_ERR(0, 489, __pyx_L1_error)
8908     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8909   }
8910 
8911   /* "yt/utilities/lib/amr_kdtools.pyx":491
8912  *             rnew_gre[j] = gre[j]
8913  *
8914  *         split = <Split *> malloc(sizeof(Split))             # <<<<<<<<<<<<<<
8915  *         split.dim = big_dim
8916  *         split.pos = new_pos
8917  */
8918   __pyx_v_split = ((struct __pyx_t_2yt_9utilities_3lib_11amr_kdtools_Split *)malloc((sizeof(struct __pyx_t_2yt_9utilities_3lib_11amr_kdtools_Split))));
8919 
8920   /* "yt/utilities/lib/amr_kdtools.pyx":492
8921  *
8922  *         split = <Split *> malloc(sizeof(Split))
8923  *         split.dim = big_dim             # <<<<<<<<<<<<<<
8924  *         split.pos = new_pos
8925  *
8926  */
8927   __pyx_v_split->dim = __pyx_v_big_dim;
8928 
8929   /* "yt/utilities/lib/amr_kdtools.pyx":493
8930  *         split = <Split *> malloc(sizeof(Split))
8931  *         split.dim = big_dim
8932  *         split.pos = new_pos             # <<<<<<<<<<<<<<
8933  *
8934  *         # Create a Split
8935  */
8936   __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_v_new_pos); if (unlikely((__pyx_t_14 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 493, __pyx_L1_error)
8937   __pyx_v_split->pos = __pyx_t_14;
8938 
8939   /* "yt/utilities/lib/amr_kdtools.pyx":496
8940  *
8941  *         # Create a Split
8942  *         self.divide(split)             # <<<<<<<<<<<<<<
8943  *
8944  *         #lnew_gre[big_dim] = new_pos
8945  */
8946   ((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->__pyx_vtab)->divide(__pyx_v_self, __pyx_v_split);
8947 
8948   /* "yt/utilities/lib/amr_kdtools.pyx":501
8949  *         # Populate Left Node
8950  *         #print('Inserting left node', self.left_edge, self.right_edge)
8951  *         self.left.insert_grid(lnew_gle, lnew_gre,             # <<<<<<<<<<<<<<
8952  *                 grid_id, rank, size)
8953  *
8954  */
8955   __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_v_lnew_gle, PyBUF_WRITABLE); if (unlikely(!__pyx_t_15.memview)) __PYX_ERR(0, 501, __pyx_L1_error)
8956   __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_v_lnew_gre, PyBUF_WRITABLE); if (unlikely(!__pyx_t_16.memview)) __PYX_ERR(0, 501, __pyx_L1_error)
8957 
8958   /* "yt/utilities/lib/amr_kdtools.pyx":502
8959  *         #print('Inserting left node', self.left_edge, self.right_edge)
8960  *         self.left.insert_grid(lnew_gle, lnew_gre,
8961  *                 grid_id, rank, size)             # <<<<<<<<<<<<<<
8962  *
8963  *         #rnew_gle[big_dim] = new_pos
8964  */
8965   __pyx_t_7 = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->left->__pyx_vtab)->insert_grid(__pyx_v_self->left, __pyx_t_15, __pyx_t_16, __pyx_v_grid_id, __pyx_v_rank, __pyx_v_size); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 501, __pyx_L1_error)
8966   __Pyx_GOTREF(__pyx_t_7);
8967   __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
8968   __pyx_t_15.memview = NULL;
8969   __pyx_t_15.data = NULL;
8970   __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
8971   __pyx_t_16.memview = NULL;
8972   __pyx_t_16.data = NULL;
8973   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
8974 
8975   /* "yt/utilities/lib/amr_kdtools.pyx":507
8976  *         # Populate Right Node
8977  *         #print('Inserting right node', self.left_edge, self.right_edge)
8978  *         self.right.insert_grid(rnew_gle, rnew_gre,             # <<<<<<<<<<<<<<
8979  *                 grid_id, rank, size)
8980  *         return
8981  */
8982   __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_v_rnew_gle, PyBUF_WRITABLE); if (unlikely(!__pyx_t_16.memview)) __PYX_ERR(0, 507, __pyx_L1_error)
8983   __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_v_rnew_gre, PyBUF_WRITABLE); if (unlikely(!__pyx_t_15.memview)) __PYX_ERR(0, 507, __pyx_L1_error)
8984 
8985   /* "yt/utilities/lib/amr_kdtools.pyx":508
8986  *         #print('Inserting right node', self.left_edge, self.right_edge)
8987  *         self.right.insert_grid(rnew_gle, rnew_gre,
8988  *                 grid_id, rank, size)             # <<<<<<<<<<<<<<
8989  *         return
8990  *
8991  */
8992   __pyx_t_7 = ((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->right->__pyx_vtab)->insert_grid(__pyx_v_self->right, __pyx_t_16, __pyx_t_15, __pyx_v_grid_id, __pyx_v_rank, __pyx_v_size); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 507, __pyx_L1_error)
8993   __Pyx_GOTREF(__pyx_t_7);
8994   __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
8995   __pyx_t_16.memview = NULL;
8996   __pyx_t_16.data = NULL;
8997   __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
8998   __pyx_t_15.memview = NULL;
8999   __pyx_t_15.data = NULL;
9000   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9001 
9002   /* "yt/utilities/lib/amr_kdtools.pyx":509
9003  *         self.right.insert_grid(rnew_gle, rnew_gre,
9004  *                 grid_id, rank, size)
9005  *         return             # <<<<<<<<<<<<<<
9006  *
9007  *     cdef void divide(self, Split * split):
9008  */
9009   __Pyx_XDECREF(__pyx_r);
9010   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9011   goto __pyx_L0;
9012 
9013   /* "yt/utilities/lib/amr_kdtools.pyx":462
9014  *         return 0
9015  *
9016  *     cdef geo_split(self,             # <<<<<<<<<<<<<<
9017  *                    np.float64_t[:] gle,
9018  *                    np.float64_t[:] gre,
9019  */
9020 
9021   /* function exit code */
9022   __pyx_L1_error:;
9023   __Pyx_XDECREF(__pyx_t_7);
9024   __Pyx_XDECREF(__pyx_t_8);
9025   __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
9026   __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
9027   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.geo_split", __pyx_clineno, __pyx_lineno, __pyx_filename);
9028   __pyx_r = 0;
9029   __pyx_L0:;
9030   __Pyx_XDECREF(__pyx_v_new_pos);
9031   __Pyx_XDECREF(__pyx_v_lnew_gle);
9032   __Pyx_XDECREF(__pyx_v_lnew_gre);
9033   __Pyx_XDECREF(__pyx_v_rnew_gle);
9034   __Pyx_XDECREF(__pyx_v_rnew_gre);
9035   __Pyx_XGIVEREF(__pyx_r);
9036   __Pyx_RefNannyFinishContext();
9037   return __pyx_r;
9038 }
9039 
9040 /* "yt/utilities/lib/amr_kdtools.pyx":511
9041  *         return
9042  *
9043  *     cdef void divide(self, Split * split):             # <<<<<<<<<<<<<<
9044  *         # Create a Split
9045  *         self.split = split
9046  */
9047 
9048 static void __pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_divide(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, struct __pyx_t_2yt_9utilities_3lib_11amr_kdtools_Split *__pyx_v_split) {
9049   __Pyx_memviewslice __pyx_v_le = { 0, 0, { 0 }, { 0 }, { 0 } };
9050   __Pyx_memviewslice __pyx_v_re = { 0, 0, { 0 }, { 0 }, { 0 } };
9051   int __pyx_v_i;
9052   __Pyx_RefNannyDeclarations
9053   PyObject *__pyx_t_1 = NULL;
9054   PyObject *__pyx_t_2 = NULL;
9055   PyObject *__pyx_t_3 = NULL;
9056   __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
9057   int __pyx_t_5;
9058   Py_ssize_t __pyx_t_6;
9059   Py_ssize_t __pyx_t_7;
9060   __pyx_t_5numpy_float64_t __pyx_t_8;
9061   Py_ssize_t __pyx_t_9;
9062   PyObject *__pyx_t_10 = NULL;
9063   PyObject *__pyx_t_11 = NULL;
9064   Py_ssize_t __pyx_t_12;
9065   Py_ssize_t __pyx_t_13;
9066   __Pyx_RefNannySetupContext("divide", 0);
9067 
9068   /* "yt/utilities/lib/amr_kdtools.pyx":513
9069  *     cdef void divide(self, Split * split):
9070  *         # Create a Split
9071  *         self.split = split             # <<<<<<<<<<<<<<
9072  *
9073  *         cdef np.float64_t[:] le = np.empty(3, dtype='float64')
9074  */
9075   __pyx_v_self->split = __pyx_v_split;
9076 
9077   /* "yt/utilities/lib/amr_kdtools.pyx":515
9078  *         self.split = split
9079  *
9080  *         cdef np.float64_t[:] le = np.empty(3, dtype='float64')             # <<<<<<<<<<<<<<
9081  *         cdef np.float64_t[:] re = np.empty(3, dtype='float64')
9082  *
9083  */
9084   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error)
9085   __Pyx_GOTREF(__pyx_t_1);
9086   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error)
9087   __Pyx_GOTREF(__pyx_t_2);
9088   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9089   __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error)
9090   __Pyx_GOTREF(__pyx_t_1);
9091   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 515, __pyx_L1_error)
9092   __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple_, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 515, __pyx_L1_error)
9093   __Pyx_GOTREF(__pyx_t_3);
9094   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9095   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9096   __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 515, __pyx_L1_error)
9097   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9098   __pyx_v_le = __pyx_t_4;
9099   __pyx_t_4.memview = NULL;
9100   __pyx_t_4.data = NULL;
9101 
9102   /* "yt/utilities/lib/amr_kdtools.pyx":516
9103  *
9104  *         cdef np.float64_t[:] le = np.empty(3, dtype='float64')
9105  *         cdef np.float64_t[:] re = np.empty(3, dtype='float64')             # <<<<<<<<<<<<<<
9106  *
9107  *         cdef int i
9108  */
9109   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 516, __pyx_L1_error)
9110   __Pyx_GOTREF(__pyx_t_3);
9111   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error)
9112   __Pyx_GOTREF(__pyx_t_1);
9113   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9114   __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 516, __pyx_L1_error)
9115   __Pyx_GOTREF(__pyx_t_3);
9116   if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 516, __pyx_L1_error)
9117   __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple_, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 516, __pyx_L1_error)
9118   __Pyx_GOTREF(__pyx_t_2);
9119   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9120   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9121   __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 516, __pyx_L1_error)
9122   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9123   __pyx_v_re = __pyx_t_4;
9124   __pyx_t_4.memview = NULL;
9125   __pyx_t_4.data = NULL;
9126 
9127   /* "yt/utilities/lib/amr_kdtools.pyx":519
9128  *
9129  *         cdef int i
9130  *         for i in range(3):             # <<<<<<<<<<<<<<
9131  *             le[i] = self.left_edge[i]
9132  *             re[i] = self.right_edge[i]
9133  */
9134   for (__pyx_t_5 = 0; __pyx_t_5 < 3; __pyx_t_5+=1) {
9135     __pyx_v_i = __pyx_t_5;
9136 
9137     /* "yt/utilities/lib/amr_kdtools.pyx":520
9138  *         cdef int i
9139  *         for i in range(3):
9140  *             le[i] = self.left_edge[i]             # <<<<<<<<<<<<<<
9141  *             re[i] = self.right_edge[i]
9142  *         re[split.dim] = split.pos
9143  */
9144     __pyx_t_6 = __pyx_v_i;
9145     *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_le.data + __pyx_t_6 * __pyx_v_le.strides[0]) )) = (__pyx_v_self->left_edge[__pyx_v_i]);
9146 
9147     /* "yt/utilities/lib/amr_kdtools.pyx":521
9148  *         for i in range(3):
9149  *             le[i] = self.left_edge[i]
9150  *             re[i] = self.right_edge[i]             # <<<<<<<<<<<<<<
9151  *         re[split.dim] = split.pos
9152  *
9153  */
9154     __pyx_t_7 = __pyx_v_i;
9155     *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_re.data + __pyx_t_7 * __pyx_v_re.strides[0]) )) = (__pyx_v_self->right_edge[__pyx_v_i]);
9156   }
9157 
9158   /* "yt/utilities/lib/amr_kdtools.pyx":522
9159  *             le[i] = self.left_edge[i]
9160  *             re[i] = self.right_edge[i]
9161  *         re[split.dim] = split.pos             # <<<<<<<<<<<<<<
9162  *
9163  *         self.left = Node(self, None, None,
9164  */
9165   __pyx_t_8 = __pyx_v_split->pos;
9166   __pyx_t_9 = __pyx_v_split->dim;
9167   *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_re.data + __pyx_t_9 * __pyx_v_re.strides[0]) )) = __pyx_t_8;
9168 
9169   /* "yt/utilities/lib/amr_kdtools.pyx":525
9170  *
9171  *         self.left = Node(self, None, None,
9172  *                          le, re, self.grid,             # <<<<<<<<<<<<<<
9173  *                          _lchild_id(self.node_id))
9174  *
9175  */
9176   __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_le, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float64_t, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 525, __pyx_L1_error)
9177   __Pyx_GOTREF(__pyx_t_2);
9178   __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_re, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float64_t, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 525, __pyx_L1_error)
9179   __Pyx_GOTREF(__pyx_t_3);
9180   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->grid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L1_error)
9181   __Pyx_GOTREF(__pyx_t_1);
9182 
9183   /* "yt/utilities/lib/amr_kdtools.pyx":526
9184  *         self.left = Node(self, None, None,
9185  *                          le, re, self.grid,
9186  *                          _lchild_id(self.node_id))             # <<<<<<<<<<<<<<
9187  *
9188  *         re[split.dim] = self.right_edge[split.dim]
9189  */
9190   __pyx_t_10 = __Pyx_PyInt_From_npy_int64(__pyx_f_2yt_9utilities_3lib_11amr_kdtools__lchild_id(__pyx_v_self->node_id)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 526, __pyx_L1_error)
9191   __Pyx_GOTREF(__pyx_t_10);
9192 
9193   /* "yt/utilities/lib/amr_kdtools.pyx":524
9194  *         re[split.dim] = split.pos
9195  *
9196  *         self.left = Node(self, None, None,             # <<<<<<<<<<<<<<
9197  *                          le, re, self.grid,
9198  *                          _lchild_id(self.node_id))
9199  */
9200   __pyx_t_11 = PyTuple_New(7); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 524, __pyx_L1_error)
9201   __Pyx_GOTREF(__pyx_t_11);
9202   __Pyx_INCREF(((PyObject *)__pyx_v_self));
9203   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
9204   PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_v_self));
9205   __Pyx_INCREF(Py_None);
9206   __Pyx_GIVEREF(Py_None);
9207   PyTuple_SET_ITEM(__pyx_t_11, 1, Py_None);
9208   __Pyx_INCREF(Py_None);
9209   __Pyx_GIVEREF(Py_None);
9210   PyTuple_SET_ITEM(__pyx_t_11, 2, Py_None);
9211   __Pyx_GIVEREF(__pyx_t_2);
9212   PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_2);
9213   __Pyx_GIVEREF(__pyx_t_3);
9214   PyTuple_SET_ITEM(__pyx_t_11, 4, __pyx_t_3);
9215   __Pyx_GIVEREF(__pyx_t_1);
9216   PyTuple_SET_ITEM(__pyx_t_11, 5, __pyx_t_1);
9217   __Pyx_GIVEREF(__pyx_t_10);
9218   PyTuple_SET_ITEM(__pyx_t_11, 6, __pyx_t_10);
9219   __pyx_t_2 = 0;
9220   __pyx_t_3 = 0;
9221   __pyx_t_1 = 0;
9222   __pyx_t_10 = 0;
9223   __pyx_t_10 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_2yt_9utilities_3lib_11amr_kdtools_Node), __pyx_t_11, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 524, __pyx_L1_error)
9224   __Pyx_GOTREF(__pyx_t_10);
9225   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
9226   __Pyx_GIVEREF(__pyx_t_10);
9227   __Pyx_GOTREF(__pyx_v_self->left);
9228   __Pyx_DECREF(((PyObject *)__pyx_v_self->left));
9229   __pyx_v_self->left = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_10);
9230   __pyx_t_10 = 0;
9231 
9232   /* "yt/utilities/lib/amr_kdtools.pyx":528
9233  *                          _lchild_id(self.node_id))
9234  *
9235  *         re[split.dim] = self.right_edge[split.dim]             # <<<<<<<<<<<<<<
9236  *         le[split.dim] = split.pos
9237  *         self.right = Node(self, None, None,
9238  */
9239   __pyx_t_12 = __pyx_v_split->dim;
9240   *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_re.data + __pyx_t_12 * __pyx_v_re.strides[0]) )) = (__pyx_v_self->right_edge[__pyx_v_split->dim]);
9241 
9242   /* "yt/utilities/lib/amr_kdtools.pyx":529
9243  *
9244  *         re[split.dim] = self.right_edge[split.dim]
9245  *         le[split.dim] = split.pos             # <<<<<<<<<<<<<<
9246  *         self.right = Node(self, None, None,
9247  *                           le, re, self.grid,
9248  */
9249   __pyx_t_8 = __pyx_v_split->pos;
9250   __pyx_t_13 = __pyx_v_split->dim;
9251   *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_le.data + __pyx_t_13 * __pyx_v_le.strides[0]) )) = __pyx_t_8;
9252 
9253   /* "yt/utilities/lib/amr_kdtools.pyx":531
9254  *         le[split.dim] = split.pos
9255  *         self.right = Node(self, None, None,
9256  *                           le, re, self.grid,             # <<<<<<<<<<<<<<
9257  *                           _rchild_id(self.node_id))
9258  *
9259  */
9260   __pyx_t_10 = __pyx_memoryview_fromslice(__pyx_v_le, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float64_t, 0);; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 531, __pyx_L1_error)
9261   __Pyx_GOTREF(__pyx_t_10);
9262   __pyx_t_11 = __pyx_memoryview_fromslice(__pyx_v_re, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_5numpy_float64_t, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_5numpy_float64_t, 0);; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 531, __pyx_L1_error)
9263   __Pyx_GOTREF(__pyx_t_11);
9264   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->grid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 531, __pyx_L1_error)
9265   __Pyx_GOTREF(__pyx_t_1);
9266 
9267   /* "yt/utilities/lib/amr_kdtools.pyx":532
9268  *         self.right = Node(self, None, None,
9269  *                           le, re, self.grid,
9270  *                           _rchild_id(self.node_id))             # <<<<<<<<<<<<<<
9271  *
9272  *         return
9273  */
9274   __pyx_t_3 = __Pyx_PyInt_From_npy_int64(__pyx_f_2yt_9utilities_3lib_11amr_kdtools__rchild_id(__pyx_v_self->node_id)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 532, __pyx_L1_error)
9275   __Pyx_GOTREF(__pyx_t_3);
9276 
9277   /* "yt/utilities/lib/amr_kdtools.pyx":530
9278  *         re[split.dim] = self.right_edge[split.dim]
9279  *         le[split.dim] = split.pos
9280  *         self.right = Node(self, None, None,             # <<<<<<<<<<<<<<
9281  *                           le, re, self.grid,
9282  *                           _rchild_id(self.node_id))
9283  */
9284   __pyx_t_2 = PyTuple_New(7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 530, __pyx_L1_error)
9285   __Pyx_GOTREF(__pyx_t_2);
9286   __Pyx_INCREF(((PyObject *)__pyx_v_self));
9287   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
9288   PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
9289   __Pyx_INCREF(Py_None);
9290   __Pyx_GIVEREF(Py_None);
9291   PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
9292   __Pyx_INCREF(Py_None);
9293   __Pyx_GIVEREF(Py_None);
9294   PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None);
9295   __Pyx_GIVEREF(__pyx_t_10);
9296   PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_10);
9297   __Pyx_GIVEREF(__pyx_t_11);
9298   PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_t_11);
9299   __Pyx_GIVEREF(__pyx_t_1);
9300   PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_t_1);
9301   __Pyx_GIVEREF(__pyx_t_3);
9302   PyTuple_SET_ITEM(__pyx_t_2, 6, __pyx_t_3);
9303   __pyx_t_10 = 0;
9304   __pyx_t_11 = 0;
9305   __pyx_t_1 = 0;
9306   __pyx_t_3 = 0;
9307   __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_2yt_9utilities_3lib_11amr_kdtools_Node), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 530, __pyx_L1_error)
9308   __Pyx_GOTREF(__pyx_t_3);
9309   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9310   __Pyx_GIVEREF(__pyx_t_3);
9311   __Pyx_GOTREF(__pyx_v_self->right);
9312   __Pyx_DECREF(((PyObject *)__pyx_v_self->right));
9313   __pyx_v_self->right = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_3);
9314   __pyx_t_3 = 0;
9315 
9316   /* "yt/utilities/lib/amr_kdtools.pyx":534
9317  *                           _rchild_id(self.node_id))
9318  *
9319  *         return             # <<<<<<<<<<<<<<
9320  *     #
9321  *     def kd_sum_volume(self):
9322  */
9323   goto __pyx_L0;
9324 
9325   /* "yt/utilities/lib/amr_kdtools.pyx":511
9326  *         return
9327  *
9328  *     cdef void divide(self, Split * split):             # <<<<<<<<<<<<<<
9329  *         # Create a Split
9330  *         self.split = split
9331  */
9332 
9333   /* function exit code */
9334   __pyx_L1_error:;
9335   __Pyx_XDECREF(__pyx_t_1);
9336   __Pyx_XDECREF(__pyx_t_2);
9337   __Pyx_XDECREF(__pyx_t_3);
9338   __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
9339   __Pyx_XDECREF(__pyx_t_10);
9340   __Pyx_XDECREF(__pyx_t_11);
9341   __Pyx_WriteUnraisable("yt.utilities.lib.amr_kdtools.Node.divide", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
9342   __pyx_L0:;
9343   __PYX_XDEC_MEMVIEW(&__pyx_v_le, 1);
9344   __PYX_XDEC_MEMVIEW(&__pyx_v_re, 1);
9345   __Pyx_RefNannyFinishContext();
9346 }
9347 
9348 /* "yt/utilities/lib/amr_kdtools.pyx":536
9349  *         return
9350  *     #
9351  *     def kd_sum_volume(self):             # <<<<<<<<<<<<<<
9352  *         cdef np.float64_t vol = 1.0
9353  *         if (self.left is None) and (self.right is None):
9354  */
9355 
9356 /* Python wrapper */
9357 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_30kd_sum_volume(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
9358 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_30kd_sum_volume(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9359   PyObject *__pyx_r = 0;
9360   __Pyx_RefNannyDeclarations
9361   __Pyx_RefNannySetupContext("kd_sum_volume (wrapper)", 0);
9362   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_29kd_sum_volume(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
9363 
9364   /* function exit code */
9365   __Pyx_RefNannyFinishContext();
9366   return __pyx_r;
9367 }
9368 
9369 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_29kd_sum_volume(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
9370   __pyx_t_5numpy_float64_t __pyx_v_vol;
9371   long __pyx_v_i;
9372   PyObject *__pyx_r = NULL;
9373   __Pyx_RefNannyDeclarations
9374   int __pyx_t_1;
9375   int __pyx_t_2;
9376   int __pyx_t_3;
9377   long __pyx_t_4;
9378   PyObject *__pyx_t_5 = NULL;
9379   PyObject *__pyx_t_6 = NULL;
9380   PyObject *__pyx_t_7 = NULL;
9381   PyObject *__pyx_t_8 = NULL;
9382   __Pyx_RefNannySetupContext("kd_sum_volume", 0);
9383 
9384   /* "yt/utilities/lib/amr_kdtools.pyx":537
9385  *     #
9386  *     def kd_sum_volume(self):
9387  *         cdef np.float64_t vol = 1.0             # <<<<<<<<<<<<<<
9388  *         if (self.left is None) and (self.right is None):
9389  *             if self.grid == -1:
9390  */
9391   __pyx_v_vol = 1.0;
9392 
9393   /* "yt/utilities/lib/amr_kdtools.pyx":538
9394  *     def kd_sum_volume(self):
9395  *         cdef np.float64_t vol = 1.0
9396  *         if (self.left is None) and (self.right is None):             # <<<<<<<<<<<<<<
9397  *             if self.grid == -1:
9398  *                 return 0.0
9399  */
9400   __pyx_t_2 = (((PyObject *)__pyx_v_self->left) == Py_None);
9401   __pyx_t_3 = (__pyx_t_2 != 0);
9402   if (__pyx_t_3) {
9403   } else {
9404     __pyx_t_1 = __pyx_t_3;
9405     goto __pyx_L4_bool_binop_done;
9406   }
9407   __pyx_t_3 = (((PyObject *)__pyx_v_self->right) == Py_None);
9408   __pyx_t_2 = (__pyx_t_3 != 0);
9409   __pyx_t_1 = __pyx_t_2;
9410   __pyx_L4_bool_binop_done:;
9411   if (__pyx_t_1) {
9412 
9413     /* "yt/utilities/lib/amr_kdtools.pyx":539
9414  *         cdef np.float64_t vol = 1.0
9415  *         if (self.left is None) and (self.right is None):
9416  *             if self.grid == -1:             # <<<<<<<<<<<<<<
9417  *                 return 0.0
9418  *             for i in range(3):
9419  */
9420     __pyx_t_1 = ((__pyx_v_self->grid == -1L) != 0);
9421     if (__pyx_t_1) {
9422 
9423       /* "yt/utilities/lib/amr_kdtools.pyx":540
9424  *         if (self.left is None) and (self.right is None):
9425  *             if self.grid == -1:
9426  *                 return 0.0             # <<<<<<<<<<<<<<
9427  *             for i in range(3):
9428  *                 vol *= self.right_edge[i] - self.left_edge[i]
9429  */
9430       __Pyx_XDECREF(__pyx_r);
9431       __Pyx_INCREF(__pyx_float_0_0);
9432       __pyx_r = __pyx_float_0_0;
9433       goto __pyx_L0;
9434 
9435       /* "yt/utilities/lib/amr_kdtools.pyx":539
9436  *         cdef np.float64_t vol = 1.0
9437  *         if (self.left is None) and (self.right is None):
9438  *             if self.grid == -1:             # <<<<<<<<<<<<<<
9439  *                 return 0.0
9440  *             for i in range(3):
9441  */
9442     }
9443 
9444     /* "yt/utilities/lib/amr_kdtools.pyx":541
9445  *             if self.grid == -1:
9446  *                 return 0.0
9447  *             for i in range(3):             # <<<<<<<<<<<<<<
9448  *                 vol *= self.right_edge[i] - self.left_edge[i]
9449  *             return vol
9450  */
9451     for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) {
9452       __pyx_v_i = __pyx_t_4;
9453 
9454       /* "yt/utilities/lib/amr_kdtools.pyx":542
9455  *                 return 0.0
9456  *             for i in range(3):
9457  *                 vol *= self.right_edge[i] - self.left_edge[i]             # <<<<<<<<<<<<<<
9458  *             return vol
9459  *         else:
9460  */
9461       __pyx_v_vol = (__pyx_v_vol * ((__pyx_v_self->right_edge[__pyx_v_i]) - (__pyx_v_self->left_edge[__pyx_v_i])));
9462     }
9463 
9464     /* "yt/utilities/lib/amr_kdtools.pyx":543
9465  *             for i in range(3):
9466  *                 vol *= self.right_edge[i] - self.left_edge[i]
9467  *             return vol             # <<<<<<<<<<<<<<
9468  *         else:
9469  *             return self.left.kd_sum_volume() + self.right.kd_sum_volume()
9470  */
9471     __Pyx_XDECREF(__pyx_r);
9472     __pyx_t_5 = PyFloat_FromDouble(__pyx_v_vol); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 543, __pyx_L1_error)
9473     __Pyx_GOTREF(__pyx_t_5);
9474     __pyx_r = __pyx_t_5;
9475     __pyx_t_5 = 0;
9476     goto __pyx_L0;
9477 
9478     /* "yt/utilities/lib/amr_kdtools.pyx":538
9479  *     def kd_sum_volume(self):
9480  *         cdef np.float64_t vol = 1.0
9481  *         if (self.left is None) and (self.right is None):             # <<<<<<<<<<<<<<
9482  *             if self.grid == -1:
9483  *                 return 0.0
9484  */
9485   }
9486 
9487   /* "yt/utilities/lib/amr_kdtools.pyx":545
9488  *             return vol
9489  *         else:
9490  *             return self.left.kd_sum_volume() + self.right.kd_sum_volume()             # <<<<<<<<<<<<<<
9491  *
9492  *     def kd_node_check(self):
9493  */
9494   /*else*/ {
9495     __Pyx_XDECREF(__pyx_r);
9496     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->left), __pyx_n_s_kd_sum_volume); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 545, __pyx_L1_error)
9497     __Pyx_GOTREF(__pyx_t_6);
9498     __pyx_t_7 = NULL;
9499     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
9500       __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
9501       if (likely(__pyx_t_7)) {
9502         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
9503         __Pyx_INCREF(__pyx_t_7);
9504         __Pyx_INCREF(function);
9505         __Pyx_DECREF_SET(__pyx_t_6, function);
9506       }
9507     }
9508     __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
9509     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9510     if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 545, __pyx_L1_error)
9511     __Pyx_GOTREF(__pyx_t_5);
9512     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9513     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->right), __pyx_n_s_kd_sum_volume); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 545, __pyx_L1_error)
9514     __Pyx_GOTREF(__pyx_t_7);
9515     __pyx_t_8 = NULL;
9516     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
9517       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
9518       if (likely(__pyx_t_8)) {
9519         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
9520         __Pyx_INCREF(__pyx_t_8);
9521         __Pyx_INCREF(function);
9522         __Pyx_DECREF_SET(__pyx_t_7, function);
9523       }
9524     }
9525     __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
9526     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
9527     if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 545, __pyx_L1_error)
9528     __Pyx_GOTREF(__pyx_t_6);
9529     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9530     __pyx_t_7 = PyNumber_Add(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 545, __pyx_L1_error)
9531     __Pyx_GOTREF(__pyx_t_7);
9532     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9533     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9534     __pyx_r = __pyx_t_7;
9535     __pyx_t_7 = 0;
9536     goto __pyx_L0;
9537   }
9538 
9539   /* "yt/utilities/lib/amr_kdtools.pyx":536
9540  *         return
9541  *     #
9542  *     def kd_sum_volume(self):             # <<<<<<<<<<<<<<
9543  *         cdef np.float64_t vol = 1.0
9544  *         if (self.left is None) and (self.right is None):
9545  */
9546 
9547   /* function exit code */
9548   __pyx_L1_error:;
9549   __Pyx_XDECREF(__pyx_t_5);
9550   __Pyx_XDECREF(__pyx_t_6);
9551   __Pyx_XDECREF(__pyx_t_7);
9552   __Pyx_XDECREF(__pyx_t_8);
9553   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.kd_sum_volume", __pyx_clineno, __pyx_lineno, __pyx_filename);
9554   __pyx_r = NULL;
9555   __pyx_L0:;
9556   __Pyx_XGIVEREF(__pyx_r);
9557   __Pyx_RefNannyFinishContext();
9558   return __pyx_r;
9559 }
9560 
9561 /* "yt/utilities/lib/amr_kdtools.pyx":547
9562  *             return self.left.kd_sum_volume() + self.right.kd_sum_volume()
9563  *
9564  *     def kd_node_check(self):             # <<<<<<<<<<<<<<
9565  *         assert (self.left is None) == (self.right is None)
9566  *         if (self.left is None) and (self.right is None):
9567  */
9568 
9569 /* Python wrapper */
9570 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_32kd_node_check(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
9571 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_32kd_node_check(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9572   PyObject *__pyx_r = 0;
9573   __Pyx_RefNannyDeclarations
9574   __Pyx_RefNannySetupContext("kd_node_check (wrapper)", 0);
9575   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_31kd_node_check(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
9576 
9577   /* function exit code */
9578   __Pyx_RefNannyFinishContext();
9579   return __pyx_r;
9580 }
9581 
9582 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_31kd_node_check(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
9583   PyObject *__pyx_r = NULL;
9584   __Pyx_RefNannyDeclarations
9585   int __pyx_t_1;
9586   int __pyx_t_2;
9587   int __pyx_t_3;
9588   PyObject *__pyx_t_4 = NULL;
9589   PyObject *__pyx_t_5 = NULL;
9590   PyObject *__pyx_t_6 = NULL;
9591   PyObject *__pyx_t_7 = NULL;
9592   __Pyx_RefNannySetupContext("kd_node_check", 0);
9593 
9594   /* "yt/utilities/lib/amr_kdtools.pyx":548
9595  *
9596  *     def kd_node_check(self):
9597  *         assert (self.left is None) == (self.right is None)             # <<<<<<<<<<<<<<
9598  *         if (self.left is None) and (self.right is None):
9599  *             if self.grid != -1:
9600  */
9601   #ifndef CYTHON_WITHOUT_ASSERTIONS
9602   if (unlikely(!Py_OptimizeFlag)) {
9603     __pyx_t_1 = (((PyObject *)__pyx_v_self->left) == Py_None);
9604     __pyx_t_2 = (((PyObject *)__pyx_v_self->right) == Py_None);
9605     if (unlikely(!((__pyx_t_1 == __pyx_t_2) != 0))) {
9606       PyErr_SetNone(PyExc_AssertionError);
9607       __PYX_ERR(0, 548, __pyx_L1_error)
9608     }
9609   }
9610   #endif
9611 
9612   /* "yt/utilities/lib/amr_kdtools.pyx":549
9613  *     def kd_node_check(self):
9614  *         assert (self.left is None) == (self.right is None)
9615  *         if (self.left is None) and (self.right is None):             # <<<<<<<<<<<<<<
9616  *             if self.grid != -1:
9617  *                 return np.prod(self.right_edge - self.left_edge)
9618  */
9619   __pyx_t_1 = (((PyObject *)__pyx_v_self->left) == Py_None);
9620   __pyx_t_3 = (__pyx_t_1 != 0);
9621   if (__pyx_t_3) {
9622   } else {
9623     __pyx_t_2 = __pyx_t_3;
9624     goto __pyx_L4_bool_binop_done;
9625   }
9626   __pyx_t_3 = (((PyObject *)__pyx_v_self->right) == Py_None);
9627   __pyx_t_1 = (__pyx_t_3 != 0);
9628   __pyx_t_2 = __pyx_t_1;
9629   __pyx_L4_bool_binop_done:;
9630   if (__pyx_t_2) {
9631 
9632     /* "yt/utilities/lib/amr_kdtools.pyx":550
9633  *         assert (self.left is None) == (self.right is None)
9634  *         if (self.left is None) and (self.right is None):
9635  *             if self.grid != -1:             # <<<<<<<<<<<<<<
9636  *                 return np.prod(self.right_edge - self.left_edge)
9637  *             else: return 0.0
9638  */
9639     __pyx_t_2 = ((__pyx_v_self->grid != -1L) != 0);
9640     if (__pyx_t_2) {
9641 
9642       /* "yt/utilities/lib/amr_kdtools.pyx":551
9643  *         if (self.left is None) and (self.right is None):
9644  *             if self.grid != -1:
9645  *                 return np.prod(self.right_edge - self.left_edge)             # <<<<<<<<<<<<<<
9646  *             else: return 0.0
9647  *         else:
9648  */
9649       __Pyx_XDECREF(__pyx_r);
9650       __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 551, __pyx_L1_error)
9651       __Pyx_GOTREF(__pyx_t_5);
9652       __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_prod); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 551, __pyx_L1_error)
9653       __Pyx_GOTREF(__pyx_t_6);
9654       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9655       __pyx_t_5 = __Pyx_PyInt_From_ptrdiff_t((__pyx_v_self->right_edge - __pyx_v_self->left_edge)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 551, __pyx_L1_error)
9656       __Pyx_GOTREF(__pyx_t_5);
9657       __pyx_t_7 = NULL;
9658       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
9659         __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
9660         if (likely(__pyx_t_7)) {
9661           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
9662           __Pyx_INCREF(__pyx_t_7);
9663           __Pyx_INCREF(function);
9664           __Pyx_DECREF_SET(__pyx_t_6, function);
9665         }
9666       }
9667       __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5);
9668       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9669       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9670       if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 551, __pyx_L1_error)
9671       __Pyx_GOTREF(__pyx_t_4);
9672       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9673       __pyx_r = __pyx_t_4;
9674       __pyx_t_4 = 0;
9675       goto __pyx_L0;
9676 
9677       /* "yt/utilities/lib/amr_kdtools.pyx":550
9678  *         assert (self.left is None) == (self.right is None)
9679  *         if (self.left is None) and (self.right is None):
9680  *             if self.grid != -1:             # <<<<<<<<<<<<<<
9681  *                 return np.prod(self.right_edge - self.left_edge)
9682  *             else: return 0.0
9683  */
9684     }
9685 
9686     /* "yt/utilities/lib/amr_kdtools.pyx":552
9687  *             if self.grid != -1:
9688  *                 return np.prod(self.right_edge - self.left_edge)
9689  *             else: return 0.0             # <<<<<<<<<<<<<<
9690  *         else:
9691  *             return self.left.kd_node_check()+self.right.kd_node_check()
9692  */
9693     /*else*/ {
9694       __Pyx_XDECREF(__pyx_r);
9695       __Pyx_INCREF(__pyx_float_0_0);
9696       __pyx_r = __pyx_float_0_0;
9697       goto __pyx_L0;
9698     }
9699 
9700     /* "yt/utilities/lib/amr_kdtools.pyx":549
9701  *     def kd_node_check(self):
9702  *         assert (self.left is None) == (self.right is None)
9703  *         if (self.left is None) and (self.right is None):             # <<<<<<<<<<<<<<
9704  *             if self.grid != -1:
9705  *                 return np.prod(self.right_edge - self.left_edge)
9706  */
9707   }
9708 
9709   /* "yt/utilities/lib/amr_kdtools.pyx":554
9710  *             else: return 0.0
9711  *         else:
9712  *             return self.left.kd_node_check()+self.right.kd_node_check()             # <<<<<<<<<<<<<<
9713  *
9714  *     def kd_is_leaf(self):
9715  */
9716   /*else*/ {
9717     __Pyx_XDECREF(__pyx_r);
9718     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->left), __pyx_n_s_kd_node_check); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 554, __pyx_L1_error)
9719     __Pyx_GOTREF(__pyx_t_6);
9720     __pyx_t_5 = NULL;
9721     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
9722       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
9723       if (likely(__pyx_t_5)) {
9724         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
9725         __Pyx_INCREF(__pyx_t_5);
9726         __Pyx_INCREF(function);
9727         __Pyx_DECREF_SET(__pyx_t_6, function);
9728       }
9729     }
9730     __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
9731     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9732     if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 554, __pyx_L1_error)
9733     __Pyx_GOTREF(__pyx_t_4);
9734     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9735     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->right), __pyx_n_s_kd_node_check); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 554, __pyx_L1_error)
9736     __Pyx_GOTREF(__pyx_t_5);
9737     __pyx_t_7 = NULL;
9738     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
9739       __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
9740       if (likely(__pyx_t_7)) {
9741         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
9742         __Pyx_INCREF(__pyx_t_7);
9743         __Pyx_INCREF(function);
9744         __Pyx_DECREF_SET(__pyx_t_5, function);
9745       }
9746     }
9747     __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
9748     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
9749     if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 554, __pyx_L1_error)
9750     __Pyx_GOTREF(__pyx_t_6);
9751     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9752     __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 554, __pyx_L1_error)
9753     __Pyx_GOTREF(__pyx_t_5);
9754     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9755     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9756     __pyx_r = __pyx_t_5;
9757     __pyx_t_5 = 0;
9758     goto __pyx_L0;
9759   }
9760 
9761   /* "yt/utilities/lib/amr_kdtools.pyx":547
9762  *             return self.left.kd_sum_volume() + self.right.kd_sum_volume()
9763  *
9764  *     def kd_node_check(self):             # <<<<<<<<<<<<<<
9765  *         assert (self.left is None) == (self.right is None)
9766  *         if (self.left is None) and (self.right is None):
9767  */
9768 
9769   /* function exit code */
9770   __pyx_L1_error:;
9771   __Pyx_XDECREF(__pyx_t_4);
9772   __Pyx_XDECREF(__pyx_t_5);
9773   __Pyx_XDECREF(__pyx_t_6);
9774   __Pyx_XDECREF(__pyx_t_7);
9775   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.kd_node_check", __pyx_clineno, __pyx_lineno, __pyx_filename);
9776   __pyx_r = NULL;
9777   __pyx_L0:;
9778   __Pyx_XGIVEREF(__pyx_r);
9779   __Pyx_RefNannyFinishContext();
9780   return __pyx_r;
9781 }
9782 
9783 /* "yt/utilities/lib/amr_kdtools.pyx":556
9784  *             return self.left.kd_node_check()+self.right.kd_node_check()
9785  *
9786  *     def kd_is_leaf(self):             # <<<<<<<<<<<<<<
9787  *         cdef int has_l_child = self.left == None
9788  *         cdef int has_r_child = self.right == None
9789  */
9790 
9791 /* Python wrapper */
9792 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_34kd_is_leaf(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
9793 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_34kd_is_leaf(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9794   PyObject *__pyx_r = 0;
9795   __Pyx_RefNannyDeclarations
9796   __Pyx_RefNannySetupContext("kd_is_leaf (wrapper)", 0);
9797   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_33kd_is_leaf(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
9798 
9799   /* function exit code */
9800   __Pyx_RefNannyFinishContext();
9801   return __pyx_r;
9802 }
9803 
9804 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_33kd_is_leaf(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
9805   int __pyx_v_has_l_child;
9806   int __pyx_v_has_r_child;
9807   PyObject *__pyx_r = NULL;
9808   __Pyx_RefNannyDeclarations
9809   PyObject *__pyx_t_1 = NULL;
9810   int __pyx_t_2;
9811   __Pyx_RefNannySetupContext("kd_is_leaf", 0);
9812 
9813   /* "yt/utilities/lib/amr_kdtools.pyx":557
9814  *
9815  *     def kd_is_leaf(self):
9816  *         cdef int has_l_child = self.left == None             # <<<<<<<<<<<<<<
9817  *         cdef int has_r_child = self.right == None
9818  *         assert has_l_child == has_r_child
9819  */
9820   __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_self->left), Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error)
9821   __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 557, __pyx_L1_error)
9822   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9823   __pyx_v_has_l_child = __pyx_t_2;
9824 
9825   /* "yt/utilities/lib/amr_kdtools.pyx":558
9826  *     def kd_is_leaf(self):
9827  *         cdef int has_l_child = self.left == None
9828  *         cdef int has_r_child = self.right == None             # <<<<<<<<<<<<<<
9829  *         assert has_l_child == has_r_child
9830  *         return has_l_child
9831  */
9832   __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_self->right), Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 558, __pyx_L1_error)
9833   __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 558, __pyx_L1_error)
9834   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9835   __pyx_v_has_r_child = __pyx_t_2;
9836 
9837   /* "yt/utilities/lib/amr_kdtools.pyx":559
9838  *         cdef int has_l_child = self.left == None
9839  *         cdef int has_r_child = self.right == None
9840  *         assert has_l_child == has_r_child             # <<<<<<<<<<<<<<
9841  *         return has_l_child
9842  *
9843  */
9844   #ifndef CYTHON_WITHOUT_ASSERTIONS
9845   if (unlikely(!Py_OptimizeFlag)) {
9846     if (unlikely(!((__pyx_v_has_l_child == __pyx_v_has_r_child) != 0))) {
9847       PyErr_SetNone(PyExc_AssertionError);
9848       __PYX_ERR(0, 559, __pyx_L1_error)
9849     }
9850   }
9851   #endif
9852 
9853   /* "yt/utilities/lib/amr_kdtools.pyx":560
9854  *         cdef int has_r_child = self.right == None
9855  *         assert has_l_child == has_r_child
9856  *         return has_l_child             # <<<<<<<<<<<<<<
9857  *
9858  *     cdef int _kd_is_leaf(self):
9859  */
9860   __Pyx_XDECREF(__pyx_r);
9861   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_has_l_child); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 560, __pyx_L1_error)
9862   __Pyx_GOTREF(__pyx_t_1);
9863   __pyx_r = __pyx_t_1;
9864   __pyx_t_1 = 0;
9865   goto __pyx_L0;
9866 
9867   /* "yt/utilities/lib/amr_kdtools.pyx":556
9868  *             return self.left.kd_node_check()+self.right.kd_node_check()
9869  *
9870  *     def kd_is_leaf(self):             # <<<<<<<<<<<<<<
9871  *         cdef int has_l_child = self.left == None
9872  *         cdef int has_r_child = self.right == None
9873  */
9874 
9875   /* function exit code */
9876   __pyx_L1_error:;
9877   __Pyx_XDECREF(__pyx_t_1);
9878   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.kd_is_leaf", __pyx_clineno, __pyx_lineno, __pyx_filename);
9879   __pyx_r = NULL;
9880   __pyx_L0:;
9881   __Pyx_XGIVEREF(__pyx_r);
9882   __Pyx_RefNannyFinishContext();
9883   return __pyx_r;
9884 }
9885 
9886 /* "yt/utilities/lib/amr_kdtools.pyx":562
9887  *         return has_l_child
9888  *
9889  *     cdef int _kd_is_leaf(self):             # <<<<<<<<<<<<<<
9890  *         if self.left is None or self.right is None:
9891  *             return 1
9892  */
9893 
9894 static int __pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node__kd_is_leaf(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
9895   int __pyx_r;
9896   __Pyx_RefNannyDeclarations
9897   int __pyx_t_1;
9898   int __pyx_t_2;
9899   int __pyx_t_3;
9900   __Pyx_RefNannySetupContext("_kd_is_leaf", 0);
9901 
9902   /* "yt/utilities/lib/amr_kdtools.pyx":563
9903  *
9904  *     cdef int _kd_is_leaf(self):
9905  *         if self.left is None or self.right is None:             # <<<<<<<<<<<<<<
9906  *             return 1
9907  *         return 0
9908  */
9909   __pyx_t_2 = (((PyObject *)__pyx_v_self->left) == Py_None);
9910   __pyx_t_3 = (__pyx_t_2 != 0);
9911   if (!__pyx_t_3) {
9912   } else {
9913     __pyx_t_1 = __pyx_t_3;
9914     goto __pyx_L4_bool_binop_done;
9915   }
9916   __pyx_t_3 = (((PyObject *)__pyx_v_self->right) == Py_None);
9917   __pyx_t_2 = (__pyx_t_3 != 0);
9918   __pyx_t_1 = __pyx_t_2;
9919   __pyx_L4_bool_binop_done:;
9920   if (__pyx_t_1) {
9921 
9922     /* "yt/utilities/lib/amr_kdtools.pyx":564
9923  *     cdef int _kd_is_leaf(self):
9924  *         if self.left is None or self.right is None:
9925  *             return 1             # <<<<<<<<<<<<<<
9926  *         return 0
9927  *
9928  */
9929     __pyx_r = 1;
9930     goto __pyx_L0;
9931 
9932     /* "yt/utilities/lib/amr_kdtools.pyx":563
9933  *
9934  *     cdef int _kd_is_leaf(self):
9935  *         if self.left is None or self.right is None:             # <<<<<<<<<<<<<<
9936  *             return 1
9937  *         return 0
9938  */
9939   }
9940 
9941   /* "yt/utilities/lib/amr_kdtools.pyx":565
9942  *         if self.left is None or self.right is None:
9943  *             return 1
9944  *         return 0             # <<<<<<<<<<<<<<
9945  *
9946  *     def depth_traverse(self, max_node=None):
9947  */
9948   __pyx_r = 0;
9949   goto __pyx_L0;
9950 
9951   /* "yt/utilities/lib/amr_kdtools.pyx":562
9952  *         return has_l_child
9953  *
9954  *     cdef int _kd_is_leaf(self):             # <<<<<<<<<<<<<<
9955  *         if self.left is None or self.right is None:
9956  *             return 1
9957  */
9958 
9959   /* function exit code */
9960   __pyx_L0:;
9961   __Pyx_RefNannyFinishContext();
9962   return __pyx_r;
9963 }
9964 static PyObject *__pyx_gb_2yt_9utilities_3lib_11amr_kdtools_4Node_37generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
9965 
9966 /* "yt/utilities/lib/amr_kdtools.pyx":567
9967  *         return 0
9968  *
9969  *     def depth_traverse(self, max_node=None):             # <<<<<<<<<<<<<<
9970  *         '''
9971  *         Yields a depth-first traversal of the kd tree always going to
9972  */
9973 
9974 /* Python wrapper */
9975 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_36depth_traverse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
9976 static char __pyx_doc_2yt_9utilities_3lib_11amr_kdtools_4Node_35depth_traverse[] = "\n        Yields a depth-first traversal of the kd tree always going to\n        the left child before the right.\n        ";
9977 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_36depth_traverse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9978   PyObject *__pyx_v_max_node = 0;
9979   PyObject *__pyx_r = 0;
9980   __Pyx_RefNannyDeclarations
9981   __Pyx_RefNannySetupContext("depth_traverse (wrapper)", 0);
9982   {
9983     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_max_node,0};
9984     PyObject* values[1] = {0};
9985     values[0] = ((PyObject *)Py_None);
9986     if (unlikely(__pyx_kwds)) {
9987       Py_ssize_t kw_args;
9988       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9989       switch (pos_args) {
9990         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9991         CYTHON_FALLTHROUGH;
9992         case  0: break;
9993         default: goto __pyx_L5_argtuple_error;
9994       }
9995       kw_args = PyDict_Size(__pyx_kwds);
9996       switch (pos_args) {
9997         case  0:
9998         if (kw_args > 0) {
9999           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_node);
10000           if (value) { values[0] = value; kw_args--; }
10001         }
10002       }
10003       if (unlikely(kw_args > 0)) {
10004         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "depth_traverse") < 0)) __PYX_ERR(0, 567, __pyx_L3_error)
10005       }
10006     } else {
10007       switch (PyTuple_GET_SIZE(__pyx_args)) {
10008         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10009         CYTHON_FALLTHROUGH;
10010         case  0: break;
10011         default: goto __pyx_L5_argtuple_error;
10012       }
10013     }
10014     __pyx_v_max_node = values[0];
10015   }
10016   goto __pyx_L4_argument_unpacking_done;
10017   __pyx_L5_argtuple_error:;
10018   __Pyx_RaiseArgtupleInvalid("depth_traverse", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 567, __pyx_L3_error)
10019   __pyx_L3_error:;
10020   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.depth_traverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
10021   __Pyx_RefNannyFinishContext();
10022   return NULL;
10023   __pyx_L4_argument_unpacking_done:;
10024   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_35depth_traverse(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self), __pyx_v_max_node);
10025 
10026   /* function exit code */
10027   __Pyx_RefNannyFinishContext();
10028   return __pyx_r;
10029 }
10030 
10031 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_35depth_traverse(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_max_node) {
10032   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse *__pyx_cur_scope;
10033   PyObject *__pyx_r = NULL;
10034   __Pyx_RefNannyDeclarations
10035   __Pyx_RefNannySetupContext("depth_traverse", 0);
10036   __pyx_cur_scope = (struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse *)__pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse(__pyx_ptype_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse, __pyx_empty_tuple, NULL);
10037   if (unlikely(!__pyx_cur_scope)) {
10038     __pyx_cur_scope = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse *)Py_None);
10039     __Pyx_INCREF(Py_None);
10040     __PYX_ERR(0, 567, __pyx_L1_error)
10041   } else {
10042     __Pyx_GOTREF(__pyx_cur_scope);
10043   }
10044   __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
10045   __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
10046   __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
10047   __pyx_cur_scope->__pyx_v_max_node = __pyx_v_max_node;
10048   __Pyx_INCREF(__pyx_cur_scope->__pyx_v_max_node);
10049   __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_max_node);
10050   {
10051     __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_2yt_9utilities_3lib_11amr_kdtools_4Node_37generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_depth_traverse, __pyx_n_s_Node_depth_traverse, __pyx_n_s_yt_utilities_lib_amr_kdtools); if (unlikely(!gen)) __PYX_ERR(0, 567, __pyx_L1_error)
10052     __Pyx_DECREF(__pyx_cur_scope);
10053     __Pyx_RefNannyFinishContext();
10054     return (PyObject *) gen;
10055   }
10056 
10057   /* function exit code */
10058   __pyx_L1_error:;
10059   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.depth_traverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
10060   __pyx_r = NULL;
10061   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
10062   __Pyx_XGIVEREF(__pyx_r);
10063   __Pyx_RefNannyFinishContext();
10064   return __pyx_r;
10065 }
10066 
10067 static PyObject *__pyx_gb_2yt_9utilities_3lib_11amr_kdtools_4Node_37generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
10068 {
10069   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse *__pyx_cur_scope = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse *)__pyx_generator->closure);
10070   PyObject *__pyx_r = NULL;
10071   int __pyx_t_1;
10072   int __pyx_t_2;
10073   PyObject *__pyx_t_3 = NULL;
10074   PyObject *__pyx_t_4 = NULL;
10075   PyObject *__pyx_t_5 = NULL;
10076   int __pyx_t_6;
10077   PyObject *__pyx_t_7 = NULL;
10078   PyObject *(*__pyx_t_8)(PyObject *);
10079   __Pyx_RefNannyDeclarations
10080   __Pyx_RefNannySetupContext("depth_traverse", 0);
10081   switch (__pyx_generator->resume_label) {
10082     case 0: goto __pyx_L3_first_run;
10083     case 1: goto __pyx_L7_resume_from_yield;
10084     default: /* CPython raises the right error here */
10085     __Pyx_RefNannyFinishContext();
10086     return NULL;
10087   }
10088   __pyx_L3_first_run:;
10089   if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 567, __pyx_L1_error)
10090 
10091   /* "yt/utilities/lib/amr_kdtools.pyx":572
10092  *         the left child before the right.
10093  *         '''
10094  *         current = self             # <<<<<<<<<<<<<<
10095  *         previous = None
10096  *         if max_node is None:
10097  */
10098   __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self));
10099   __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self));
10100   __pyx_cur_scope->__pyx_v_current = ((PyObject *)__pyx_cur_scope->__pyx_v_self);
10101 
10102   /* "yt/utilities/lib/amr_kdtools.pyx":573
10103  *         '''
10104  *         current = self
10105  *         previous = None             # <<<<<<<<<<<<<<
10106  *         if max_node is None:
10107  *             max_node = np.inf
10108  */
10109   __Pyx_INCREF(Py_None);
10110   __Pyx_GIVEREF(Py_None);
10111   __pyx_cur_scope->__pyx_v_previous = Py_None;
10112 
10113   /* "yt/utilities/lib/amr_kdtools.pyx":574
10114  *         current = self
10115  *         previous = None
10116  *         if max_node is None:             # <<<<<<<<<<<<<<
10117  *             max_node = np.inf
10118  *         while current is not None:
10119  */
10120   __pyx_t_1 = (__pyx_cur_scope->__pyx_v_max_node == Py_None);
10121   __pyx_t_2 = (__pyx_t_1 != 0);
10122   if (__pyx_t_2) {
10123 
10124     /* "yt/utilities/lib/amr_kdtools.pyx":575
10125  *         previous = None
10126  *         if max_node is None:
10127  *             max_node = np.inf             # <<<<<<<<<<<<<<
10128  *         while current is not None:
10129  *             yield current
10130  */
10131     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 575, __pyx_L1_error)
10132     __Pyx_GOTREF(__pyx_t_3);
10133     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_inf); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 575, __pyx_L1_error)
10134     __Pyx_GOTREF(__pyx_t_4);
10135     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10136     __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_max_node);
10137     __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_max_node, __pyx_t_4);
10138     __Pyx_GIVEREF(__pyx_t_4);
10139     __pyx_t_4 = 0;
10140 
10141     /* "yt/utilities/lib/amr_kdtools.pyx":574
10142  *         current = self
10143  *         previous = None
10144  *         if max_node is None:             # <<<<<<<<<<<<<<
10145  *             max_node = np.inf
10146  *         while current is not None:
10147  */
10148   }
10149 
10150   /* "yt/utilities/lib/amr_kdtools.pyx":576
10151  *         if max_node is None:
10152  *             max_node = np.inf
10153  *         while current is not None:             # <<<<<<<<<<<<<<
10154  *             yield current
10155  *             current, previous = step_depth(current, previous)
10156  */
10157   while (1) {
10158     __pyx_t_2 = (__pyx_cur_scope->__pyx_v_current != Py_None);
10159     __pyx_t_1 = (__pyx_t_2 != 0);
10160     if (!__pyx_t_1) break;
10161 
10162     /* "yt/utilities/lib/amr_kdtools.pyx":577
10163  *             max_node = np.inf
10164  *         while current is not None:
10165  *             yield current             # <<<<<<<<<<<<<<
10166  *             current, previous = step_depth(current, previous)
10167  *             if current is None: break
10168  */
10169     __Pyx_INCREF(__pyx_cur_scope->__pyx_v_current);
10170     __pyx_r = __pyx_cur_scope->__pyx_v_current;
10171     __Pyx_XGIVEREF(__pyx_r);
10172     __Pyx_RefNannyFinishContext();
10173     __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
10174     /* return from generator, yielding value */
10175     __pyx_generator->resume_label = 1;
10176     return __pyx_r;
10177     __pyx_L7_resume_from_yield:;
10178     if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 577, __pyx_L1_error)
10179 
10180     /* "yt/utilities/lib/amr_kdtools.pyx":578
10181  *         while current is not None:
10182  *             yield current
10183  *             current, previous = step_depth(current, previous)             # <<<<<<<<<<<<<<
10184  *             if current is None: break
10185  *             if current.node_id >= max_node:
10186  */
10187     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_step_depth); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 578, __pyx_L1_error)
10188     __Pyx_GOTREF(__pyx_t_3);
10189     __pyx_t_5 = NULL;
10190     __pyx_t_6 = 0;
10191     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
10192       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
10193       if (likely(__pyx_t_5)) {
10194         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
10195         __Pyx_INCREF(__pyx_t_5);
10196         __Pyx_INCREF(function);
10197         __Pyx_DECREF_SET(__pyx_t_3, function);
10198         __pyx_t_6 = 1;
10199       }
10200     }
10201     #if CYTHON_FAST_PYCALL
10202     if (PyFunction_Check(__pyx_t_3)) {
10203       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_current, __pyx_cur_scope->__pyx_v_previous};
10204       __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 578, __pyx_L1_error)
10205       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10206       __Pyx_GOTREF(__pyx_t_4);
10207     } else
10208     #endif
10209     #if CYTHON_FAST_PYCCALL
10210     if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
10211       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_current, __pyx_cur_scope->__pyx_v_previous};
10212       __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 578, __pyx_L1_error)
10213       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10214       __Pyx_GOTREF(__pyx_t_4);
10215     } else
10216     #endif
10217     {
10218       __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 578, __pyx_L1_error)
10219       __Pyx_GOTREF(__pyx_t_7);
10220       if (__pyx_t_5) {
10221         __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
10222       }
10223       __Pyx_INCREF(__pyx_cur_scope->__pyx_v_current);
10224       __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_current);
10225       PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_current);
10226       __Pyx_INCREF(__pyx_cur_scope->__pyx_v_previous);
10227       __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_previous);
10228       PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_cur_scope->__pyx_v_previous);
10229       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 578, __pyx_L1_error)
10230       __Pyx_GOTREF(__pyx_t_4);
10231       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10232     }
10233     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10234     if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
10235       PyObject* sequence = __pyx_t_4;
10236       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
10237       if (unlikely(size != 2)) {
10238         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
10239         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
10240         __PYX_ERR(0, 578, __pyx_L1_error)
10241       }
10242       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10243       if (likely(PyTuple_CheckExact(sequence))) {
10244         __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
10245         __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
10246       } else {
10247         __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
10248         __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
10249       }
10250       __Pyx_INCREF(__pyx_t_3);
10251       __Pyx_INCREF(__pyx_t_7);
10252       #else
10253       __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 578, __pyx_L1_error)
10254       __Pyx_GOTREF(__pyx_t_3);
10255       __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 578, __pyx_L1_error)
10256       __Pyx_GOTREF(__pyx_t_7);
10257       #endif
10258       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10259     } else {
10260       Py_ssize_t index = -1;
10261       __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 578, __pyx_L1_error)
10262       __Pyx_GOTREF(__pyx_t_5);
10263       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10264       __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext;
10265       index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L8_unpacking_failed;
10266       __Pyx_GOTREF(__pyx_t_3);
10267       index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_7)) goto __pyx_L8_unpacking_failed;
10268       __Pyx_GOTREF(__pyx_t_7);
10269       if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_5), 2) < 0) __PYX_ERR(0, 578, __pyx_L1_error)
10270       __pyx_t_8 = NULL;
10271       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10272       goto __pyx_L9_unpacking_done;
10273       __pyx_L8_unpacking_failed:;
10274       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10275       __pyx_t_8 = NULL;
10276       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
10277       __PYX_ERR(0, 578, __pyx_L1_error)
10278       __pyx_L9_unpacking_done:;
10279     }
10280     __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_current);
10281     __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_current, __pyx_t_3);
10282     __Pyx_GIVEREF(__pyx_t_3);
10283     __pyx_t_3 = 0;
10284     __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_previous);
10285     __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_previous, __pyx_t_7);
10286     __Pyx_GIVEREF(__pyx_t_7);
10287     __pyx_t_7 = 0;
10288 
10289     /* "yt/utilities/lib/amr_kdtools.pyx":579
10290  *             yield current
10291  *             current, previous = step_depth(current, previous)
10292  *             if current is None: break             # <<<<<<<<<<<<<<
10293  *             if current.node_id >= max_node:
10294  *                 current = current.parent
10295  */
10296     __pyx_t_1 = (__pyx_cur_scope->__pyx_v_current == Py_None);
10297     __pyx_t_2 = (__pyx_t_1 != 0);
10298     if (__pyx_t_2) {
10299       goto __pyx_L6_break;
10300     }
10301 
10302     /* "yt/utilities/lib/amr_kdtools.pyx":580
10303  *             current, previous = step_depth(current, previous)
10304  *             if current is None: break
10305  *             if current.node_id >= max_node:             # <<<<<<<<<<<<<<
10306  *                 current = current.parent
10307  *                 previous = current.right
10308  */
10309     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_current, __pyx_n_s_node_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 580, __pyx_L1_error)
10310     __Pyx_GOTREF(__pyx_t_4);
10311     __pyx_t_7 = PyObject_RichCompare(__pyx_t_4, __pyx_cur_scope->__pyx_v_max_node, Py_GE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 580, __pyx_L1_error)
10312     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10313     __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 580, __pyx_L1_error)
10314     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10315     if (__pyx_t_2) {
10316 
10317       /* "yt/utilities/lib/amr_kdtools.pyx":581
10318  *             if current is None: break
10319  *             if current.node_id >= max_node:
10320  *                 current = current.parent             # <<<<<<<<<<<<<<
10321  *                 previous = current.right
10322  *
10323  */
10324       __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_current, __pyx_n_s_parent); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 581, __pyx_L1_error)
10325       __Pyx_GOTREF(__pyx_t_7);
10326       __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_current);
10327       __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_current, __pyx_t_7);
10328       __Pyx_GIVEREF(__pyx_t_7);
10329       __pyx_t_7 = 0;
10330 
10331       /* "yt/utilities/lib/amr_kdtools.pyx":582
10332  *             if current.node_id >= max_node:
10333  *                 current = current.parent
10334  *                 previous = current.right             # <<<<<<<<<<<<<<
10335  *
10336  *     def depth_first_touch(self, max_node=None):
10337  */
10338       __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_current, __pyx_n_s_right); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 582, __pyx_L1_error)
10339       __Pyx_GOTREF(__pyx_t_7);
10340       __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_previous);
10341       __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_previous, __pyx_t_7);
10342       __Pyx_GIVEREF(__pyx_t_7);
10343       __pyx_t_7 = 0;
10344 
10345       /* "yt/utilities/lib/amr_kdtools.pyx":580
10346  *             current, previous = step_depth(current, previous)
10347  *             if current is None: break
10348  *             if current.node_id >= max_node:             # <<<<<<<<<<<<<<
10349  *                 current = current.parent
10350  *                 previous = current.right
10351  */
10352     }
10353   }
10354   __pyx_L6_break:;
10355   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
10356 
10357   /* "yt/utilities/lib/amr_kdtools.pyx":567
10358  *         return 0
10359  *
10360  *     def depth_traverse(self, max_node=None):             # <<<<<<<<<<<<<<
10361  *         '''
10362  *         Yields a depth-first traversal of the kd tree always going to
10363  */
10364 
10365   /* function exit code */
10366   PyErr_SetNone(PyExc_StopIteration);
10367   goto __pyx_L0;
10368   __pyx_L1_error:;
10369   __Pyx_XDECREF(__pyx_t_3);
10370   __Pyx_XDECREF(__pyx_t_4);
10371   __Pyx_XDECREF(__pyx_t_5);
10372   __Pyx_XDECREF(__pyx_t_7);
10373   __Pyx_AddTraceback("depth_traverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
10374   __pyx_L0:;
10375   __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
10376   #if !CYTHON_USE_EXC_INFO_STACK
10377   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
10378   #endif
10379   __pyx_generator->resume_label = -1;
10380   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
10381   __Pyx_RefNannyFinishContext();
10382   return __pyx_r;
10383 }
10384 static PyObject *__pyx_gb_2yt_9utilities_3lib_11amr_kdtools_4Node_40generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
10385 
10386 /* "yt/utilities/lib/amr_kdtools.pyx":584
10387  *                 previous = current.right
10388  *
10389  *     def depth_first_touch(self, max_node=None):             # <<<<<<<<<<<<<<
10390  *         '''
10391  *         Yields a depth-first traversal of the kd tree always going to
10392  */
10393 
10394 /* Python wrapper */
10395 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_39depth_first_touch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
10396 static char __pyx_doc_2yt_9utilities_3lib_11amr_kdtools_4Node_38depth_first_touch[] = "\n        Yields a depth-first traversal of the kd tree always going to\n        the left child before the right.\n        ";
10397 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_39depth_first_touch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10398   PyObject *__pyx_v_max_node = 0;
10399   PyObject *__pyx_r = 0;
10400   __Pyx_RefNannyDeclarations
10401   __Pyx_RefNannySetupContext("depth_first_touch (wrapper)", 0);
10402   {
10403     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_max_node,0};
10404     PyObject* values[1] = {0};
10405     values[0] = ((PyObject *)Py_None);
10406     if (unlikely(__pyx_kwds)) {
10407       Py_ssize_t kw_args;
10408       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
10409       switch (pos_args) {
10410         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10411         CYTHON_FALLTHROUGH;
10412         case  0: break;
10413         default: goto __pyx_L5_argtuple_error;
10414       }
10415       kw_args = PyDict_Size(__pyx_kwds);
10416       switch (pos_args) {
10417         case  0:
10418         if (kw_args > 0) {
10419           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_node);
10420           if (value) { values[0] = value; kw_args--; }
10421         }
10422       }
10423       if (unlikely(kw_args > 0)) {
10424         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "depth_first_touch") < 0)) __PYX_ERR(0, 584, __pyx_L3_error)
10425       }
10426     } else {
10427       switch (PyTuple_GET_SIZE(__pyx_args)) {
10428         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10429         CYTHON_FALLTHROUGH;
10430         case  0: break;
10431         default: goto __pyx_L5_argtuple_error;
10432       }
10433     }
10434     __pyx_v_max_node = values[0];
10435   }
10436   goto __pyx_L4_argument_unpacking_done;
10437   __pyx_L5_argtuple_error:;
10438   __Pyx_RaiseArgtupleInvalid("depth_first_touch", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 584, __pyx_L3_error)
10439   __pyx_L3_error:;
10440   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.depth_first_touch", __pyx_clineno, __pyx_lineno, __pyx_filename);
10441   __Pyx_RefNannyFinishContext();
10442   return NULL;
10443   __pyx_L4_argument_unpacking_done:;
10444   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_38depth_first_touch(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self), __pyx_v_max_node);
10445 
10446   /* function exit code */
10447   __Pyx_RefNannyFinishContext();
10448   return __pyx_r;
10449 }
10450 
10451 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_38depth_first_touch(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_max_node) {
10452   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch *__pyx_cur_scope;
10453   PyObject *__pyx_r = NULL;
10454   __Pyx_RefNannyDeclarations
10455   __Pyx_RefNannySetupContext("depth_first_touch", 0);
10456   __pyx_cur_scope = (struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch *)__pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch(__pyx_ptype_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch, __pyx_empty_tuple, NULL);
10457   if (unlikely(!__pyx_cur_scope)) {
10458     __pyx_cur_scope = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch *)Py_None);
10459     __Pyx_INCREF(Py_None);
10460     __PYX_ERR(0, 584, __pyx_L1_error)
10461   } else {
10462     __Pyx_GOTREF(__pyx_cur_scope);
10463   }
10464   __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
10465   __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
10466   __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
10467   __pyx_cur_scope->__pyx_v_max_node = __pyx_v_max_node;
10468   __Pyx_INCREF(__pyx_cur_scope->__pyx_v_max_node);
10469   __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_max_node);
10470   {
10471     __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_2yt_9utilities_3lib_11amr_kdtools_4Node_40generator2, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_depth_first_touch, __pyx_n_s_Node_depth_first_touch, __pyx_n_s_yt_utilities_lib_amr_kdtools); if (unlikely(!gen)) __PYX_ERR(0, 584, __pyx_L1_error)
10472     __Pyx_DECREF(__pyx_cur_scope);
10473     __Pyx_RefNannyFinishContext();
10474     return (PyObject *) gen;
10475   }
10476 
10477   /* function exit code */
10478   __pyx_L1_error:;
10479   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.depth_first_touch", __pyx_clineno, __pyx_lineno, __pyx_filename);
10480   __pyx_r = NULL;
10481   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
10482   __Pyx_XGIVEREF(__pyx_r);
10483   __Pyx_RefNannyFinishContext();
10484   return __pyx_r;
10485 }
10486 
10487 static PyObject *__pyx_gb_2yt_9utilities_3lib_11amr_kdtools_4Node_40generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
10488 {
10489   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch *__pyx_cur_scope = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch *)__pyx_generator->closure);
10490   PyObject *__pyx_r = NULL;
10491   int __pyx_t_1;
10492   int __pyx_t_2;
10493   PyObject *__pyx_t_3 = NULL;
10494   PyObject *__pyx_t_4 = NULL;
10495   int __pyx_t_5;
10496   PyObject *__pyx_t_6 = NULL;
10497   int __pyx_t_7;
10498   PyObject *__pyx_t_8 = NULL;
10499   PyObject *(*__pyx_t_9)(PyObject *);
10500   __Pyx_RefNannyDeclarations
10501   __Pyx_RefNannySetupContext("depth_first_touch", 0);
10502   switch (__pyx_generator->resume_label) {
10503     case 0: goto __pyx_L3_first_run;
10504     case 1: goto __pyx_L10_resume_from_yield;
10505     default: /* CPython raises the right error here */
10506     __Pyx_RefNannyFinishContext();
10507     return NULL;
10508   }
10509   __pyx_L3_first_run:;
10510   if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 584, __pyx_L1_error)
10511 
10512   /* "yt/utilities/lib/amr_kdtools.pyx":589
10513  *         the left child before the right.
10514  *         '''
10515  *         current = self             # <<<<<<<<<<<<<<
10516  *         previous = None
10517  *         if max_node is None:
10518  */
10519   __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self));
10520   __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self));
10521   __pyx_cur_scope->__pyx_v_current = ((PyObject *)__pyx_cur_scope->__pyx_v_self);
10522 
10523   /* "yt/utilities/lib/amr_kdtools.pyx":590
10524  *         '''
10525  *         current = self
10526  *         previous = None             # <<<<<<<<<<<<<<
10527  *         if max_node is None:
10528  *             max_node = np.inf
10529  */
10530   __Pyx_INCREF(Py_None);
10531   __Pyx_GIVEREF(Py_None);
10532   __pyx_cur_scope->__pyx_v_previous = Py_None;
10533 
10534   /* "yt/utilities/lib/amr_kdtools.pyx":591
10535  *         current = self
10536  *         previous = None
10537  *         if max_node is None:             # <<<<<<<<<<<<<<
10538  *             max_node = np.inf
10539  *         while current is not None:
10540  */
10541   __pyx_t_1 = (__pyx_cur_scope->__pyx_v_max_node == Py_None);
10542   __pyx_t_2 = (__pyx_t_1 != 0);
10543   if (__pyx_t_2) {
10544 
10545     /* "yt/utilities/lib/amr_kdtools.pyx":592
10546  *         previous = None
10547  *         if max_node is None:
10548  *             max_node = np.inf             # <<<<<<<<<<<<<<
10549  *         while current is not None:
10550  *             if previous is None or previous.parent != current:
10551  */
10552     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 592, __pyx_L1_error)
10553     __Pyx_GOTREF(__pyx_t_3);
10554     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_inf); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 592, __pyx_L1_error)
10555     __Pyx_GOTREF(__pyx_t_4);
10556     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10557     __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_max_node);
10558     __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_max_node, __pyx_t_4);
10559     __Pyx_GIVEREF(__pyx_t_4);
10560     __pyx_t_4 = 0;
10561 
10562     /* "yt/utilities/lib/amr_kdtools.pyx":591
10563  *         current = self
10564  *         previous = None
10565  *         if max_node is None:             # <<<<<<<<<<<<<<
10566  *             max_node = np.inf
10567  *         while current is not None:
10568  */
10569   }
10570 
10571   /* "yt/utilities/lib/amr_kdtools.pyx":593
10572  *         if max_node is None:
10573  *             max_node = np.inf
10574  *         while current is not None:             # <<<<<<<<<<<<<<
10575  *             if previous is None or previous.parent != current:
10576  *                 yield current
10577  */
10578   while (1) {
10579     __pyx_t_2 = (__pyx_cur_scope->__pyx_v_current != Py_None);
10580     __pyx_t_1 = (__pyx_t_2 != 0);
10581     if (!__pyx_t_1) break;
10582 
10583     /* "yt/utilities/lib/amr_kdtools.pyx":594
10584  *             max_node = np.inf
10585  *         while current is not None:
10586  *             if previous is None or previous.parent != current:             # <<<<<<<<<<<<<<
10587  *                 yield current
10588  *             current, previous = step_depth(current, previous)
10589  */
10590     __pyx_t_2 = (__pyx_cur_scope->__pyx_v_previous == Py_None);
10591     __pyx_t_5 = (__pyx_t_2 != 0);
10592     if (!__pyx_t_5) {
10593     } else {
10594       __pyx_t_1 = __pyx_t_5;
10595       goto __pyx_L8_bool_binop_done;
10596     }
10597     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_previous, __pyx_n_s_parent); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 594, __pyx_L1_error)
10598     __Pyx_GOTREF(__pyx_t_4);
10599     __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_cur_scope->__pyx_v_current, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 594, __pyx_L1_error)
10600     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10601     __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 594, __pyx_L1_error)
10602     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10603     __pyx_t_1 = __pyx_t_5;
10604     __pyx_L8_bool_binop_done:;
10605     if (__pyx_t_1) {
10606 
10607       /* "yt/utilities/lib/amr_kdtools.pyx":595
10608  *         while current is not None:
10609  *             if previous is None or previous.parent != current:
10610  *                 yield current             # <<<<<<<<<<<<<<
10611  *             current, previous = step_depth(current, previous)
10612  *             if current is None: break
10613  */
10614       __Pyx_INCREF(__pyx_cur_scope->__pyx_v_current);
10615       __pyx_r = __pyx_cur_scope->__pyx_v_current;
10616       __Pyx_XGIVEREF(__pyx_r);
10617       __Pyx_RefNannyFinishContext();
10618       __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
10619       /* return from generator, yielding value */
10620       __pyx_generator->resume_label = 1;
10621       return __pyx_r;
10622       __pyx_L10_resume_from_yield:;
10623       if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 595, __pyx_L1_error)
10624 
10625       /* "yt/utilities/lib/amr_kdtools.pyx":594
10626  *             max_node = np.inf
10627  *         while current is not None:
10628  *             if previous is None or previous.parent != current:             # <<<<<<<<<<<<<<
10629  *                 yield current
10630  *             current, previous = step_depth(current, previous)
10631  */
10632     }
10633 
10634     /* "yt/utilities/lib/amr_kdtools.pyx":596
10635  *             if previous is None or previous.parent != current:
10636  *                 yield current
10637  *             current, previous = step_depth(current, previous)             # <<<<<<<<<<<<<<
10638  *             if current is None: break
10639  *             if current.node_id >= max_node:
10640  */
10641     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_step_depth); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 596, __pyx_L1_error)
10642     __Pyx_GOTREF(__pyx_t_4);
10643     __pyx_t_6 = NULL;
10644     __pyx_t_7 = 0;
10645     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
10646       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
10647       if (likely(__pyx_t_6)) {
10648         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
10649         __Pyx_INCREF(__pyx_t_6);
10650         __Pyx_INCREF(function);
10651         __Pyx_DECREF_SET(__pyx_t_4, function);
10652         __pyx_t_7 = 1;
10653       }
10654     }
10655     #if CYTHON_FAST_PYCALL
10656     if (PyFunction_Check(__pyx_t_4)) {
10657       PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_cur_scope->__pyx_v_current, __pyx_cur_scope->__pyx_v_previous};
10658       __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 596, __pyx_L1_error)
10659       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
10660       __Pyx_GOTREF(__pyx_t_3);
10661     } else
10662     #endif
10663     #if CYTHON_FAST_PYCCALL
10664     if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
10665       PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_cur_scope->__pyx_v_current, __pyx_cur_scope->__pyx_v_previous};
10666       __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 596, __pyx_L1_error)
10667       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
10668       __Pyx_GOTREF(__pyx_t_3);
10669     } else
10670     #endif
10671     {
10672       __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 596, __pyx_L1_error)
10673       __Pyx_GOTREF(__pyx_t_8);
10674       if (__pyx_t_6) {
10675         __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
10676       }
10677       __Pyx_INCREF(__pyx_cur_scope->__pyx_v_current);
10678       __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_current);
10679       PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_cur_scope->__pyx_v_current);
10680       __Pyx_INCREF(__pyx_cur_scope->__pyx_v_previous);
10681       __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_previous);
10682       PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_cur_scope->__pyx_v_previous);
10683       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 596, __pyx_L1_error)
10684       __Pyx_GOTREF(__pyx_t_3);
10685       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10686     }
10687     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10688     if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
10689       PyObject* sequence = __pyx_t_3;
10690       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
10691       if (unlikely(size != 2)) {
10692         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
10693         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
10694         __PYX_ERR(0, 596, __pyx_L1_error)
10695       }
10696       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10697       if (likely(PyTuple_CheckExact(sequence))) {
10698         __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
10699         __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
10700       } else {
10701         __pyx_t_4 = PyList_GET_ITEM(sequence, 0);
10702         __pyx_t_8 = PyList_GET_ITEM(sequence, 1);
10703       }
10704       __Pyx_INCREF(__pyx_t_4);
10705       __Pyx_INCREF(__pyx_t_8);
10706       #else
10707       __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 596, __pyx_L1_error)
10708       __Pyx_GOTREF(__pyx_t_4);
10709       __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 596, __pyx_L1_error)
10710       __Pyx_GOTREF(__pyx_t_8);
10711       #endif
10712       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10713     } else {
10714       Py_ssize_t index = -1;
10715       __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 596, __pyx_L1_error)
10716       __Pyx_GOTREF(__pyx_t_6);
10717       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10718       __pyx_t_9 = Py_TYPE(__pyx_t_6)->tp_iternext;
10719       index = 0; __pyx_t_4 = __pyx_t_9(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L11_unpacking_failed;
10720       __Pyx_GOTREF(__pyx_t_4);
10721       index = 1; __pyx_t_8 = __pyx_t_9(__pyx_t_6); if (unlikely(!__pyx_t_8)) goto __pyx_L11_unpacking_failed;
10722       __Pyx_GOTREF(__pyx_t_8);
10723       if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_6), 2) < 0) __PYX_ERR(0, 596, __pyx_L1_error)
10724       __pyx_t_9 = NULL;
10725       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10726       goto __pyx_L12_unpacking_done;
10727       __pyx_L11_unpacking_failed:;
10728       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10729       __pyx_t_9 = NULL;
10730       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
10731       __PYX_ERR(0, 596, __pyx_L1_error)
10732       __pyx_L12_unpacking_done:;
10733     }
10734     __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_current);
10735     __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_current, __pyx_t_4);
10736     __Pyx_GIVEREF(__pyx_t_4);
10737     __pyx_t_4 = 0;
10738     __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_previous);
10739     __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_previous, __pyx_t_8);
10740     __Pyx_GIVEREF(__pyx_t_8);
10741     __pyx_t_8 = 0;
10742 
10743     /* "yt/utilities/lib/amr_kdtools.pyx":597
10744  *                 yield current
10745  *             current, previous = step_depth(current, previous)
10746  *             if current is None: break             # <<<<<<<<<<<<<<
10747  *             if current.node_id >= max_node:
10748  *                 current = current.parent
10749  */
10750     __pyx_t_1 = (__pyx_cur_scope->__pyx_v_current == Py_None);
10751     __pyx_t_5 = (__pyx_t_1 != 0);
10752     if (__pyx_t_5) {
10753       goto __pyx_L6_break;
10754     }
10755 
10756     /* "yt/utilities/lib/amr_kdtools.pyx":598
10757  *             current, previous = step_depth(current, previous)
10758  *             if current is None: break
10759  *             if current.node_id >= max_node:             # <<<<<<<<<<<<<<
10760  *                 current = current.parent
10761  *                 previous = current.right
10762  */
10763     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_current, __pyx_n_s_node_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 598, __pyx_L1_error)
10764     __Pyx_GOTREF(__pyx_t_3);
10765     __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, __pyx_cur_scope->__pyx_v_max_node, Py_GE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 598, __pyx_L1_error)
10766     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10767     __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 598, __pyx_L1_error)
10768     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10769     if (__pyx_t_5) {
10770 
10771       /* "yt/utilities/lib/amr_kdtools.pyx":599
10772  *             if current is None: break
10773  *             if current.node_id >= max_node:
10774  *                 current = current.parent             # <<<<<<<<<<<<<<
10775  *                 previous = current.right
10776  *
10777  */
10778       __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_current, __pyx_n_s_parent); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 599, __pyx_L1_error)
10779       __Pyx_GOTREF(__pyx_t_8);
10780       __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_current);
10781       __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_current, __pyx_t_8);
10782       __Pyx_GIVEREF(__pyx_t_8);
10783       __pyx_t_8 = 0;
10784 
10785       /* "yt/utilities/lib/amr_kdtools.pyx":600
10786  *             if current.node_id >= max_node:
10787  *                 current = current.parent
10788  *                 previous = current.right             # <<<<<<<<<<<<<<
10789  *
10790  *     def breadth_traverse(self):
10791  */
10792       __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_current, __pyx_n_s_right); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 600, __pyx_L1_error)
10793       __Pyx_GOTREF(__pyx_t_8);
10794       __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_previous);
10795       __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_previous, __pyx_t_8);
10796       __Pyx_GIVEREF(__pyx_t_8);
10797       __pyx_t_8 = 0;
10798 
10799       /* "yt/utilities/lib/amr_kdtools.pyx":598
10800  *             current, previous = step_depth(current, previous)
10801  *             if current is None: break
10802  *             if current.node_id >= max_node:             # <<<<<<<<<<<<<<
10803  *                 current = current.parent
10804  *                 previous = current.right
10805  */
10806     }
10807   }
10808   __pyx_L6_break:;
10809   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
10810 
10811   /* "yt/utilities/lib/amr_kdtools.pyx":584
10812  *                 previous = current.right
10813  *
10814  *     def depth_first_touch(self, max_node=None):             # <<<<<<<<<<<<<<
10815  *         '''
10816  *         Yields a depth-first traversal of the kd tree always going to
10817  */
10818 
10819   /* function exit code */
10820   PyErr_SetNone(PyExc_StopIteration);
10821   goto __pyx_L0;
10822   __pyx_L1_error:;
10823   __Pyx_XDECREF(__pyx_t_3);
10824   __Pyx_XDECREF(__pyx_t_4);
10825   __Pyx_XDECREF(__pyx_t_6);
10826   __Pyx_XDECREF(__pyx_t_8);
10827   __Pyx_AddTraceback("depth_first_touch", __pyx_clineno, __pyx_lineno, __pyx_filename);
10828   __pyx_L0:;
10829   __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
10830   #if !CYTHON_USE_EXC_INFO_STACK
10831   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
10832   #endif
10833   __pyx_generator->resume_label = -1;
10834   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
10835   __Pyx_RefNannyFinishContext();
10836   return __pyx_r;
10837 }
10838 static PyObject *__pyx_gb_2yt_9utilities_3lib_11amr_kdtools_4Node_43generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
10839 
10840 /* "yt/utilities/lib/amr_kdtools.pyx":602
10841  *                 previous = current.right
10842  *
10843  *     def breadth_traverse(self):             # <<<<<<<<<<<<<<
10844  *         '''
10845  *         Yields a breadth-first traversal of the kd tree always going to
10846  */
10847 
10848 /* Python wrapper */
10849 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_42breadth_traverse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
10850 static char __pyx_doc_2yt_9utilities_3lib_11amr_kdtools_4Node_41breadth_traverse[] = "\n        Yields a breadth-first traversal of the kd tree always going to\n        the left child before the right.\n        ";
10851 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_42breadth_traverse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
10852   PyObject *__pyx_r = 0;
10853   __Pyx_RefNannyDeclarations
10854   __Pyx_RefNannySetupContext("breadth_traverse (wrapper)", 0);
10855   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_41breadth_traverse(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
10856 
10857   /* function exit code */
10858   __Pyx_RefNannyFinishContext();
10859   return __pyx_r;
10860 }
10861 
10862 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_41breadth_traverse(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
10863   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse *__pyx_cur_scope;
10864   PyObject *__pyx_r = NULL;
10865   __Pyx_RefNannyDeclarations
10866   __Pyx_RefNannySetupContext("breadth_traverse", 0);
10867   __pyx_cur_scope = (struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse *)__pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse(__pyx_ptype_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse, __pyx_empty_tuple, NULL);
10868   if (unlikely(!__pyx_cur_scope)) {
10869     __pyx_cur_scope = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse *)Py_None);
10870     __Pyx_INCREF(Py_None);
10871     __PYX_ERR(0, 602, __pyx_L1_error)
10872   } else {
10873     __Pyx_GOTREF(__pyx_cur_scope);
10874   }
10875   __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
10876   __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
10877   __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
10878   {
10879     __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_2yt_9utilities_3lib_11amr_kdtools_4Node_43generator3, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_breadth_traverse, __pyx_n_s_Node_breadth_traverse, __pyx_n_s_yt_utilities_lib_amr_kdtools); if (unlikely(!gen)) __PYX_ERR(0, 602, __pyx_L1_error)
10880     __Pyx_DECREF(__pyx_cur_scope);
10881     __Pyx_RefNannyFinishContext();
10882     return (PyObject *) gen;
10883   }
10884 
10885   /* function exit code */
10886   __pyx_L1_error:;
10887   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.breadth_traverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
10888   __pyx_r = NULL;
10889   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
10890   __Pyx_XGIVEREF(__pyx_r);
10891   __Pyx_RefNannyFinishContext();
10892   return __pyx_r;
10893 }
10894 
10895 static PyObject *__pyx_gb_2yt_9utilities_3lib_11amr_kdtools_4Node_43generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
10896 {
10897   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse *__pyx_cur_scope = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse *)__pyx_generator->closure);
10898   PyObject *__pyx_r = NULL;
10899   int __pyx_t_1;
10900   int __pyx_t_2;
10901   PyObject *__pyx_t_3 = NULL;
10902   PyObject *__pyx_t_4 = NULL;
10903   PyObject *__pyx_t_5 = NULL;
10904   int __pyx_t_6;
10905   PyObject *__pyx_t_7 = NULL;
10906   PyObject *(*__pyx_t_8)(PyObject *);
10907   __Pyx_RefNannyDeclarations
10908   __Pyx_RefNannySetupContext("breadth_traverse", 0);
10909   switch (__pyx_generator->resume_label) {
10910     case 0: goto __pyx_L3_first_run;
10911     case 1: goto __pyx_L6_resume_from_yield;
10912     default: /* CPython raises the right error here */
10913     __Pyx_RefNannyFinishContext();
10914     return NULL;
10915   }
10916   __pyx_L3_first_run:;
10917   if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 602, __pyx_L1_error)
10918 
10919   /* "yt/utilities/lib/amr_kdtools.pyx":607
10920  *         the left child before the right.
10921  *         '''
10922  *         current = self             # <<<<<<<<<<<<<<
10923  *         previous = None
10924  *         while current is not None:
10925  */
10926   __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self));
10927   __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self));
10928   __pyx_cur_scope->__pyx_v_current = ((PyObject *)__pyx_cur_scope->__pyx_v_self);
10929 
10930   /* "yt/utilities/lib/amr_kdtools.pyx":608
10931  *         '''
10932  *         current = self
10933  *         previous = None             # <<<<<<<<<<<<<<
10934  *         while current is not None:
10935  *             yield current
10936  */
10937   __Pyx_INCREF(Py_None);
10938   __Pyx_GIVEREF(Py_None);
10939   __pyx_cur_scope->__pyx_v_previous = Py_None;
10940 
10941   /* "yt/utilities/lib/amr_kdtools.pyx":609
10942  *         current = self
10943  *         previous = None
10944  *         while current is not None:             # <<<<<<<<<<<<<<
10945  *             yield current
10946  *             current, previous = step_depth(current, previous)
10947  */
10948   while (1) {
10949     __pyx_t_1 = (__pyx_cur_scope->__pyx_v_current != Py_None);
10950     __pyx_t_2 = (__pyx_t_1 != 0);
10951     if (!__pyx_t_2) break;
10952 
10953     /* "yt/utilities/lib/amr_kdtools.pyx":610
10954  *         previous = None
10955  *         while current is not None:
10956  *             yield current             # <<<<<<<<<<<<<<
10957  *             current, previous = step_depth(current, previous)
10958  *
10959  */
10960     __Pyx_INCREF(__pyx_cur_scope->__pyx_v_current);
10961     __pyx_r = __pyx_cur_scope->__pyx_v_current;
10962     __Pyx_XGIVEREF(__pyx_r);
10963     __Pyx_RefNannyFinishContext();
10964     __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
10965     /* return from generator, yielding value */
10966     __pyx_generator->resume_label = 1;
10967     return __pyx_r;
10968     __pyx_L6_resume_from_yield:;
10969     if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 610, __pyx_L1_error)
10970 
10971     /* "yt/utilities/lib/amr_kdtools.pyx":611
10972  *         while current is not None:
10973  *             yield current
10974  *             current, previous = step_depth(current, previous)             # <<<<<<<<<<<<<<
10975  *
10976  *
10977  */
10978     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_step_depth); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 611, __pyx_L1_error)
10979     __Pyx_GOTREF(__pyx_t_4);
10980     __pyx_t_5 = NULL;
10981     __pyx_t_6 = 0;
10982     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
10983       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
10984       if (likely(__pyx_t_5)) {
10985         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
10986         __Pyx_INCREF(__pyx_t_5);
10987         __Pyx_INCREF(function);
10988         __Pyx_DECREF_SET(__pyx_t_4, function);
10989         __pyx_t_6 = 1;
10990       }
10991     }
10992     #if CYTHON_FAST_PYCALL
10993     if (PyFunction_Check(__pyx_t_4)) {
10994       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_current, __pyx_cur_scope->__pyx_v_previous};
10995       __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 611, __pyx_L1_error)
10996       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10997       __Pyx_GOTREF(__pyx_t_3);
10998     } else
10999     #endif
11000     #if CYTHON_FAST_PYCCALL
11001     if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
11002       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_current, __pyx_cur_scope->__pyx_v_previous};
11003       __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 611, __pyx_L1_error)
11004       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11005       __Pyx_GOTREF(__pyx_t_3);
11006     } else
11007     #endif
11008     {
11009       __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 611, __pyx_L1_error)
11010       __Pyx_GOTREF(__pyx_t_7);
11011       if (__pyx_t_5) {
11012         __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
11013       }
11014       __Pyx_INCREF(__pyx_cur_scope->__pyx_v_current);
11015       __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_current);
11016       PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_current);
11017       __Pyx_INCREF(__pyx_cur_scope->__pyx_v_previous);
11018       __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_previous);
11019       PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_cur_scope->__pyx_v_previous);
11020       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 611, __pyx_L1_error)
11021       __Pyx_GOTREF(__pyx_t_3);
11022       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11023     }
11024     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11025     if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
11026       PyObject* sequence = __pyx_t_3;
11027       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
11028       if (unlikely(size != 2)) {
11029         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
11030         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
11031         __PYX_ERR(0, 611, __pyx_L1_error)
11032       }
11033       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11034       if (likely(PyTuple_CheckExact(sequence))) {
11035         __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
11036         __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
11037       } else {
11038         __pyx_t_4 = PyList_GET_ITEM(sequence, 0);
11039         __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
11040       }
11041       __Pyx_INCREF(__pyx_t_4);
11042       __Pyx_INCREF(__pyx_t_7);
11043       #else
11044       __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 611, __pyx_L1_error)
11045       __Pyx_GOTREF(__pyx_t_4);
11046       __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 611, __pyx_L1_error)
11047       __Pyx_GOTREF(__pyx_t_7);
11048       #endif
11049       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11050     } else {
11051       Py_ssize_t index = -1;
11052       __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 611, __pyx_L1_error)
11053       __Pyx_GOTREF(__pyx_t_5);
11054       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11055       __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext;
11056       index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed;
11057       __Pyx_GOTREF(__pyx_t_4);
11058       index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed;
11059       __Pyx_GOTREF(__pyx_t_7);
11060       if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_5), 2) < 0) __PYX_ERR(0, 611, __pyx_L1_error)
11061       __pyx_t_8 = NULL;
11062       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11063       goto __pyx_L8_unpacking_done;
11064       __pyx_L7_unpacking_failed:;
11065       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11066       __pyx_t_8 = NULL;
11067       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
11068       __PYX_ERR(0, 611, __pyx_L1_error)
11069       __pyx_L8_unpacking_done:;
11070     }
11071     __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_current);
11072     __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_current, __pyx_t_4);
11073     __Pyx_GIVEREF(__pyx_t_4);
11074     __pyx_t_4 = 0;
11075     __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_previous);
11076     __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_previous, __pyx_t_7);
11077     __Pyx_GIVEREF(__pyx_t_7);
11078     __pyx_t_7 = 0;
11079   }
11080   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
11081 
11082   /* "yt/utilities/lib/amr_kdtools.pyx":602
11083  *                 previous = current.right
11084  *
11085  *     def breadth_traverse(self):             # <<<<<<<<<<<<<<
11086  *         '''
11087  *         Yields a breadth-first traversal of the kd tree always going to
11088  */
11089 
11090   /* function exit code */
11091   PyErr_SetNone(PyExc_StopIteration);
11092   goto __pyx_L0;
11093   __pyx_L1_error:;
11094   __Pyx_XDECREF(__pyx_t_3);
11095   __Pyx_XDECREF(__pyx_t_4);
11096   __Pyx_XDECREF(__pyx_t_5);
11097   __Pyx_XDECREF(__pyx_t_7);
11098   __Pyx_AddTraceback("breadth_traverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
11099   __pyx_L0:;
11100   __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
11101   #if !CYTHON_USE_EXC_INFO_STACK
11102   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
11103   #endif
11104   __pyx_generator->resume_label = -1;
11105   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
11106   __Pyx_RefNannyFinishContext();
11107   return __pyx_r;
11108 }
11109 static PyObject *__pyx_gb_2yt_9utilities_3lib_11amr_kdtools_4Node_46generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
11110 
11111 /* "yt/utilities/lib/amr_kdtools.pyx":614
11112  *
11113  *
11114  *     def viewpoint_traverse(self, viewpoint):             # <<<<<<<<<<<<<<
11115  *         '''
11116  *         Yields a viewpoint dependent traversal of the kd-tree.  Starts
11117  */
11118 
11119 /* Python wrapper */
11120 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_45viewpoint_traverse(PyObject *__pyx_v_self, PyObject *__pyx_v_viewpoint); /*proto*/
11121 static char __pyx_doc_2yt_9utilities_3lib_11amr_kdtools_4Node_44viewpoint_traverse[] = "\n        Yields a viewpoint dependent traversal of the kd-tree.  Starts\n        with nodes furthest away from viewpoint.\n        ";
11122 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_45viewpoint_traverse(PyObject *__pyx_v_self, PyObject *__pyx_v_viewpoint) {
11123   PyObject *__pyx_r = 0;
11124   __Pyx_RefNannyDeclarations
11125   __Pyx_RefNannySetupContext("viewpoint_traverse (wrapper)", 0);
11126   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_44viewpoint_traverse(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self), ((PyObject *)__pyx_v_viewpoint));
11127 
11128   /* function exit code */
11129   __Pyx_RefNannyFinishContext();
11130   return __pyx_r;
11131 }
11132 
11133 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_44viewpoint_traverse(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_viewpoint) {
11134   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse *__pyx_cur_scope;
11135   PyObject *__pyx_r = NULL;
11136   __Pyx_RefNannyDeclarations
11137   __Pyx_RefNannySetupContext("viewpoint_traverse", 0);
11138   __pyx_cur_scope = (struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse *)__pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse(__pyx_ptype_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse, __pyx_empty_tuple, NULL);
11139   if (unlikely(!__pyx_cur_scope)) {
11140     __pyx_cur_scope = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse *)Py_None);
11141     __Pyx_INCREF(Py_None);
11142     __PYX_ERR(0, 614, __pyx_L1_error)
11143   } else {
11144     __Pyx_GOTREF(__pyx_cur_scope);
11145   }
11146   __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
11147   __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
11148   __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
11149   __pyx_cur_scope->__pyx_v_viewpoint = __pyx_v_viewpoint;
11150   __Pyx_INCREF(__pyx_cur_scope->__pyx_v_viewpoint);
11151   __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_viewpoint);
11152   {
11153     __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_2yt_9utilities_3lib_11amr_kdtools_4Node_46generator4, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_viewpoint_traverse, __pyx_n_s_Node_viewpoint_traverse, __pyx_n_s_yt_utilities_lib_amr_kdtools); if (unlikely(!gen)) __PYX_ERR(0, 614, __pyx_L1_error)
11154     __Pyx_DECREF(__pyx_cur_scope);
11155     __Pyx_RefNannyFinishContext();
11156     return (PyObject *) gen;
11157   }
11158 
11159   /* function exit code */
11160   __pyx_L1_error:;
11161   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.viewpoint_traverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
11162   __pyx_r = NULL;
11163   __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
11164   __Pyx_XGIVEREF(__pyx_r);
11165   __Pyx_RefNannyFinishContext();
11166   return __pyx_r;
11167 }
11168 
11169 static PyObject *__pyx_gb_2yt_9utilities_3lib_11amr_kdtools_4Node_46generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
11170 {
11171   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse *__pyx_cur_scope = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse *)__pyx_generator->closure);
11172   PyObject *__pyx_r = NULL;
11173   int __pyx_t_1;
11174   int __pyx_t_2;
11175   PyObject *__pyx_t_3 = NULL;
11176   PyObject *__pyx_t_4 = NULL;
11177   PyObject *__pyx_t_5 = NULL;
11178   int __pyx_t_6;
11179   PyObject *__pyx_t_7 = NULL;
11180   PyObject *(*__pyx_t_8)(PyObject *);
11181   __Pyx_RefNannyDeclarations
11182   __Pyx_RefNannySetupContext("viewpoint_traverse", 0);
11183   switch (__pyx_generator->resume_label) {
11184     case 0: goto __pyx_L3_first_run;
11185     case 1: goto __pyx_L6_resume_from_yield;
11186     default: /* CPython raises the right error here */
11187     __Pyx_RefNannyFinishContext();
11188     return NULL;
11189   }
11190   __pyx_L3_first_run:;
11191   if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 614, __pyx_L1_error)
11192 
11193   /* "yt/utilities/lib/amr_kdtools.pyx":620
11194  *         '''
11195  *
11196  *         current = self             # <<<<<<<<<<<<<<
11197  *         previous = None
11198  *         while current is not None:
11199  */
11200   __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self));
11201   __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self));
11202   __pyx_cur_scope->__pyx_v_current = ((PyObject *)__pyx_cur_scope->__pyx_v_self);
11203 
11204   /* "yt/utilities/lib/amr_kdtools.pyx":621
11205  *
11206  *         current = self
11207  *         previous = None             # <<<<<<<<<<<<<<
11208  *         while current is not None:
11209  *             yield current
11210  */
11211   __Pyx_INCREF(Py_None);
11212   __Pyx_GIVEREF(Py_None);
11213   __pyx_cur_scope->__pyx_v_previous = Py_None;
11214 
11215   /* "yt/utilities/lib/amr_kdtools.pyx":622
11216  *         current = self
11217  *         previous = None
11218  *         while current is not None:             # <<<<<<<<<<<<<<
11219  *             yield current
11220  *             current, previous = step_viewpoint(current, previous, viewpoint)
11221  */
11222   while (1) {
11223     __pyx_t_1 = (__pyx_cur_scope->__pyx_v_current != Py_None);
11224     __pyx_t_2 = (__pyx_t_1 != 0);
11225     if (!__pyx_t_2) break;
11226 
11227     /* "yt/utilities/lib/amr_kdtools.pyx":623
11228  *         previous = None
11229  *         while current is not None:
11230  *             yield current             # <<<<<<<<<<<<<<
11231  *             current, previous = step_viewpoint(current, previous, viewpoint)
11232  *
11233  */
11234     __Pyx_INCREF(__pyx_cur_scope->__pyx_v_current);
11235     __pyx_r = __pyx_cur_scope->__pyx_v_current;
11236     __Pyx_XGIVEREF(__pyx_r);
11237     __Pyx_RefNannyFinishContext();
11238     __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
11239     /* return from generator, yielding value */
11240     __pyx_generator->resume_label = 1;
11241     return __pyx_r;
11242     __pyx_L6_resume_from_yield:;
11243     if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 623, __pyx_L1_error)
11244 
11245     /* "yt/utilities/lib/amr_kdtools.pyx":624
11246  *         while current is not None:
11247  *             yield current
11248  *             current, previous = step_viewpoint(current, previous, viewpoint)             # <<<<<<<<<<<<<<
11249  *
11250  *     cdef int point_in_node(self,
11251  */
11252     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_step_viewpoint); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 624, __pyx_L1_error)
11253     __Pyx_GOTREF(__pyx_t_4);
11254     __pyx_t_5 = NULL;
11255     __pyx_t_6 = 0;
11256     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
11257       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
11258       if (likely(__pyx_t_5)) {
11259         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
11260         __Pyx_INCREF(__pyx_t_5);
11261         __Pyx_INCREF(function);
11262         __Pyx_DECREF_SET(__pyx_t_4, function);
11263         __pyx_t_6 = 1;
11264       }
11265     }
11266     #if CYTHON_FAST_PYCALL
11267     if (PyFunction_Check(__pyx_t_4)) {
11268       PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_current, __pyx_cur_scope->__pyx_v_previous, __pyx_cur_scope->__pyx_v_viewpoint};
11269       __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error)
11270       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11271       __Pyx_GOTREF(__pyx_t_3);
11272     } else
11273     #endif
11274     #if CYTHON_FAST_PYCCALL
11275     if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
11276       PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_current, __pyx_cur_scope->__pyx_v_previous, __pyx_cur_scope->__pyx_v_viewpoint};
11277       __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error)
11278       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11279       __Pyx_GOTREF(__pyx_t_3);
11280     } else
11281     #endif
11282     {
11283       __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 624, __pyx_L1_error)
11284       __Pyx_GOTREF(__pyx_t_7);
11285       if (__pyx_t_5) {
11286         __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
11287       }
11288       __Pyx_INCREF(__pyx_cur_scope->__pyx_v_current);
11289       __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_current);
11290       PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_cur_scope->__pyx_v_current);
11291       __Pyx_INCREF(__pyx_cur_scope->__pyx_v_previous);
11292       __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_previous);
11293       PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_cur_scope->__pyx_v_previous);
11294       __Pyx_INCREF(__pyx_cur_scope->__pyx_v_viewpoint);
11295       __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_viewpoint);
11296       PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_cur_scope->__pyx_v_viewpoint);
11297       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error)
11298       __Pyx_GOTREF(__pyx_t_3);
11299       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11300     }
11301     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11302     if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
11303       PyObject* sequence = __pyx_t_3;
11304       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
11305       if (unlikely(size != 2)) {
11306         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
11307         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
11308         __PYX_ERR(0, 624, __pyx_L1_error)
11309       }
11310       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11311       if (likely(PyTuple_CheckExact(sequence))) {
11312         __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
11313         __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
11314       } else {
11315         __pyx_t_4 = PyList_GET_ITEM(sequence, 0);
11316         __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
11317       }
11318       __Pyx_INCREF(__pyx_t_4);
11319       __Pyx_INCREF(__pyx_t_7);
11320       #else
11321       __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 624, __pyx_L1_error)
11322       __Pyx_GOTREF(__pyx_t_4);
11323       __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 624, __pyx_L1_error)
11324       __Pyx_GOTREF(__pyx_t_7);
11325       #endif
11326       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11327     } else {
11328       Py_ssize_t index = -1;
11329       __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 624, __pyx_L1_error)
11330       __Pyx_GOTREF(__pyx_t_5);
11331       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11332       __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext;
11333       index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed;
11334       __Pyx_GOTREF(__pyx_t_4);
11335       index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed;
11336       __Pyx_GOTREF(__pyx_t_7);
11337       if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_5), 2) < 0) __PYX_ERR(0, 624, __pyx_L1_error)
11338       __pyx_t_8 = NULL;
11339       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11340       goto __pyx_L8_unpacking_done;
11341       __pyx_L7_unpacking_failed:;
11342       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11343       __pyx_t_8 = NULL;
11344       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
11345       __PYX_ERR(0, 624, __pyx_L1_error)
11346       __pyx_L8_unpacking_done:;
11347     }
11348     __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_current);
11349     __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_current, __pyx_t_4);
11350     __Pyx_GIVEREF(__pyx_t_4);
11351     __pyx_t_4 = 0;
11352     __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_previous);
11353     __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_previous, __pyx_t_7);
11354     __Pyx_GIVEREF(__pyx_t_7);
11355     __pyx_t_7 = 0;
11356   }
11357   CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
11358 
11359   /* "yt/utilities/lib/amr_kdtools.pyx":614
11360  *
11361  *
11362  *     def viewpoint_traverse(self, viewpoint):             # <<<<<<<<<<<<<<
11363  *         '''
11364  *         Yields a viewpoint dependent traversal of the kd-tree.  Starts
11365  */
11366 
11367   /* function exit code */
11368   PyErr_SetNone(PyExc_StopIteration);
11369   goto __pyx_L0;
11370   __pyx_L1_error:;
11371   __Pyx_XDECREF(__pyx_t_3);
11372   __Pyx_XDECREF(__pyx_t_4);
11373   __Pyx_XDECREF(__pyx_t_5);
11374   __Pyx_XDECREF(__pyx_t_7);
11375   __Pyx_AddTraceback("viewpoint_traverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
11376   __pyx_L0:;
11377   __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
11378   #if !CYTHON_USE_EXC_INFO_STACK
11379   __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
11380   #endif
11381   __pyx_generator->resume_label = -1;
11382   __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
11383   __Pyx_RefNannyFinishContext();
11384   return __pyx_r;
11385 }
11386 
11387 /* "yt/utilities/lib/amr_kdtools.pyx":626
11388  *             current, previous = step_viewpoint(current, previous, viewpoint)
11389  *
11390  *     cdef int point_in_node(self,             # <<<<<<<<<<<<<<
11391  *                            np.float64_t[:] point):
11392  *         cdef int i
11393  */
11394 
11395 static int __pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_point_in_node(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, __Pyx_memviewslice __pyx_v_point) {
11396   int __pyx_v_i;
11397   int __pyx_v_inside;
11398   int __pyx_r;
11399   __Pyx_RefNannyDeclarations
11400   int __pyx_t_1;
11401   Py_ssize_t __pyx_t_2;
11402   Py_ssize_t __pyx_t_3;
11403   __Pyx_RefNannySetupContext("point_in_node", 0);
11404 
11405   /* "yt/utilities/lib/amr_kdtools.pyx":629
11406  *                            np.float64_t[:] point):
11407  *         cdef int i
11408  *         cdef int inside = 1             # <<<<<<<<<<<<<<
11409  *         for i in range(3):
11410  *             inside *= self.left_edge[i] <= point[i]
11411  */
11412   __pyx_v_inside = 1;
11413 
11414   /* "yt/utilities/lib/amr_kdtools.pyx":630
11415  *         cdef int i
11416  *         cdef int inside = 1
11417  *         for i in range(3):             # <<<<<<<<<<<<<<
11418  *             inside *= self.left_edge[i] <= point[i]
11419  *             inside *= self.right_edge[i] > point[i]
11420  */
11421   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
11422     __pyx_v_i = __pyx_t_1;
11423 
11424     /* "yt/utilities/lib/amr_kdtools.pyx":631
11425  *         cdef int inside = 1
11426  *         for i in range(3):
11427  *             inside *= self.left_edge[i] <= point[i]             # <<<<<<<<<<<<<<
11428  *             inside *= self.right_edge[i] > point[i]
11429  *         return inside
11430  */
11431     __pyx_t_2 = __pyx_v_i;
11432     __pyx_v_inside = (__pyx_v_inside * ((__pyx_v_self->left_edge[__pyx_v_i]) <= (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_point.data + __pyx_t_2 * __pyx_v_point.strides[0]) )))));
11433 
11434     /* "yt/utilities/lib/amr_kdtools.pyx":632
11435  *         for i in range(3):
11436  *             inside *= self.left_edge[i] <= point[i]
11437  *             inside *= self.right_edge[i] > point[i]             # <<<<<<<<<<<<<<
11438  *         return inside
11439  *
11440  */
11441     __pyx_t_3 = __pyx_v_i;
11442     __pyx_v_inside = (__pyx_v_inside * ((__pyx_v_self->right_edge[__pyx_v_i]) > (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_point.data + __pyx_t_3 * __pyx_v_point.strides[0]) )))));
11443   }
11444 
11445   /* "yt/utilities/lib/amr_kdtools.pyx":633
11446  *             inside *= self.left_edge[i] <= point[i]
11447  *             inside *= self.right_edge[i] > point[i]
11448  *         return inside             # <<<<<<<<<<<<<<
11449  *
11450  *     cdef Node _find_node(self, np.float64_t[:] point):
11451  */
11452   __pyx_r = __pyx_v_inside;
11453   goto __pyx_L0;
11454 
11455   /* "yt/utilities/lib/amr_kdtools.pyx":626
11456  *             current, previous = step_viewpoint(current, previous, viewpoint)
11457  *
11458  *     cdef int point_in_node(self,             # <<<<<<<<<<<<<<
11459  *                            np.float64_t[:] point):
11460  *         cdef int i
11461  */
11462 
11463   /* function exit code */
11464   __pyx_L0:;
11465   __Pyx_RefNannyFinishContext();
11466   return __pyx_r;
11467 }
11468 
11469 /* "yt/utilities/lib/amr_kdtools.pyx":635
11470  *         return inside
11471  *
11472  *     cdef Node _find_node(self, np.float64_t[:] point):             # <<<<<<<<<<<<<<
11473  *         while self._kd_is_leaf() == 0:
11474  *             if point[self.split.dim] < self.split.pos:
11475  */
11476 
11477 static struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node__find_node(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, __Pyx_memviewslice __pyx_v_point) {
11478   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_r = NULL;
11479   __Pyx_RefNannyDeclarations
11480   int __pyx_t_1;
11481   Py_ssize_t __pyx_t_2;
11482   PyObject *__pyx_t_3 = NULL;
11483   __Pyx_RefNannySetupContext("_find_node", 0);
11484   __Pyx_INCREF((PyObject *)__pyx_v_self);
11485 
11486   /* "yt/utilities/lib/amr_kdtools.pyx":636
11487  *
11488  *     cdef Node _find_node(self, np.float64_t[:] point):
11489  *         while self._kd_is_leaf() == 0:             # <<<<<<<<<<<<<<
11490  *             if point[self.split.dim] < self.split.pos:
11491  *                 self = self.left
11492  */
11493   while (1) {
11494     __pyx_t_1 = ((((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->__pyx_vtab)->_kd_is_leaf(__pyx_v_self) == 0) != 0);
11495     if (!__pyx_t_1) break;
11496 
11497     /* "yt/utilities/lib/amr_kdtools.pyx":637
11498  *     cdef Node _find_node(self, np.float64_t[:] point):
11499  *         while self._kd_is_leaf() == 0:
11500  *             if point[self.split.dim] < self.split.pos:             # <<<<<<<<<<<<<<
11501  *                 self = self.left
11502  *             else:
11503  */
11504     __pyx_t_2 = __pyx_v_self->split->dim;
11505     __pyx_t_1 = (((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_point.data + __pyx_t_2 * __pyx_v_point.strides[0]) ))) < __pyx_v_self->split->pos) != 0);
11506     if (__pyx_t_1) {
11507 
11508       /* "yt/utilities/lib/amr_kdtools.pyx":638
11509  *         while self._kd_is_leaf() == 0:
11510  *             if point[self.split.dim] < self.split.pos:
11511  *                 self = self.left             # <<<<<<<<<<<<<<
11512  *             else:
11513  *                 self = self.right
11514  */
11515       __pyx_t_3 = ((PyObject *)__pyx_v_self->left);
11516       __Pyx_INCREF(__pyx_t_3);
11517       __Pyx_DECREF_SET(__pyx_v_self, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_3));
11518       __pyx_t_3 = 0;
11519 
11520       /* "yt/utilities/lib/amr_kdtools.pyx":637
11521  *     cdef Node _find_node(self, np.float64_t[:] point):
11522  *         while self._kd_is_leaf() == 0:
11523  *             if point[self.split.dim] < self.split.pos:             # <<<<<<<<<<<<<<
11524  *                 self = self.left
11525  *             else:
11526  */
11527       goto __pyx_L5;
11528     }
11529 
11530     /* "yt/utilities/lib/amr_kdtools.pyx":640
11531  *                 self = self.left
11532  *             else:
11533  *                 self = self.right             # <<<<<<<<<<<<<<
11534  *         return self
11535  *
11536  */
11537     /*else*/ {
11538       __pyx_t_3 = ((PyObject *)__pyx_v_self->right);
11539       __Pyx_INCREF(__pyx_t_3);
11540       __Pyx_DECREF_SET(__pyx_v_self, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_3));
11541       __pyx_t_3 = 0;
11542     }
11543     __pyx_L5:;
11544   }
11545 
11546   /* "yt/utilities/lib/amr_kdtools.pyx":641
11547  *             else:
11548  *                 self = self.right
11549  *         return self             # <<<<<<<<<<<<<<
11550  *
11551  *     def find_node(self,
11552  */
11553   __Pyx_XDECREF(((PyObject *)__pyx_r));
11554   __Pyx_INCREF(((PyObject *)__pyx_v_self));
11555   __pyx_r = __pyx_v_self;
11556   goto __pyx_L0;
11557 
11558   /* "yt/utilities/lib/amr_kdtools.pyx":635
11559  *         return inside
11560  *
11561  *     cdef Node _find_node(self, np.float64_t[:] point):             # <<<<<<<<<<<<<<
11562  *         while self._kd_is_leaf() == 0:
11563  *             if point[self.split.dim] < self.split.pos:
11564  */
11565 
11566   /* function exit code */
11567   __pyx_L0:;
11568   __Pyx_XDECREF((PyObject *)__pyx_v_self);
11569   __Pyx_XGIVEREF((PyObject *)__pyx_r);
11570   __Pyx_RefNannyFinishContext();
11571   return __pyx_r;
11572 }
11573 
11574 /* "yt/utilities/lib/amr_kdtools.pyx":643
11575  *         return self
11576  *
11577  *     def find_node(self,             # <<<<<<<<<<<<<<
11578  *                   np.float64_t[:] point):
11579  *         """
11580  */
11581 
11582 /* Python wrapper */
11583 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_48find_node(PyObject *__pyx_v_self, PyObject *__pyx_arg_point); /*proto*/
11584 static char __pyx_doc_2yt_9utilities_3lib_11amr_kdtools_4Node_47find_node[] = "\n        Find the AMRKDTree node enclosing a position\n        ";
11585 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_48find_node(PyObject *__pyx_v_self, PyObject *__pyx_arg_point) {
11586   __Pyx_memviewslice __pyx_v_point = { 0, 0, { 0 }, { 0 }, { 0 } };
11587   PyObject *__pyx_r = 0;
11588   __Pyx_RefNannyDeclarations
11589   __Pyx_RefNannySetupContext("find_node (wrapper)", 0);
11590   assert(__pyx_arg_point); {
11591     __pyx_v_point = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_arg_point, PyBUF_WRITABLE); if (unlikely(!__pyx_v_point.memview)) __PYX_ERR(0, 644, __pyx_L3_error)
11592   }
11593   goto __pyx_L4_argument_unpacking_done;
11594   __pyx_L3_error:;
11595   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.find_node", __pyx_clineno, __pyx_lineno, __pyx_filename);
11596   __Pyx_RefNannyFinishContext();
11597   return NULL;
11598   __pyx_L4_argument_unpacking_done:;
11599   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_47find_node(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self), __pyx_v_point);
11600 
11601   /* function exit code */
11602   __Pyx_RefNannyFinishContext();
11603   return __pyx_r;
11604 }
11605 
11606 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_47find_node(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, __Pyx_memviewslice __pyx_v_point) {
11607   PyObject *__pyx_r = NULL;
11608   __Pyx_RefNannyDeclarations
11609   PyObject *__pyx_t_1 = NULL;
11610   __Pyx_RefNannySetupContext("find_node", 0);
11611 
11612   /* "yt/utilities/lib/amr_kdtools.pyx":648
11613  *         Find the AMRKDTree node enclosing a position
11614  *         """
11615  *         assert(self.point_in_node(point))             # <<<<<<<<<<<<<<
11616  *         return self._find_node(point)
11617  *
11618  */
11619   #ifndef CYTHON_WITHOUT_ASSERTIONS
11620   if (unlikely(!Py_OptimizeFlag)) {
11621     if (unlikely(!(((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->__pyx_vtab)->point_in_node(__pyx_v_self, __pyx_v_point) != 0))) {
11622       PyErr_SetNone(PyExc_AssertionError);
11623       __PYX_ERR(0, 648, __pyx_L1_error)
11624     }
11625   }
11626   #endif
11627 
11628   /* "yt/utilities/lib/amr_kdtools.pyx":649
11629  *         """
11630  *         assert(self.point_in_node(point))
11631  *         return self._find_node(point)             # <<<<<<<<<<<<<<
11632  *
11633  * @cython.boundscheck(False)
11634  */
11635   __Pyx_XDECREF(__pyx_r);
11636   __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self->__pyx_vtab)->_find_node(__pyx_v_self, __pyx_v_point)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 649, __pyx_L1_error)
11637   __Pyx_GOTREF(__pyx_t_1);
11638   __pyx_r = __pyx_t_1;
11639   __pyx_t_1 = 0;
11640   goto __pyx_L0;
11641 
11642   /* "yt/utilities/lib/amr_kdtools.pyx":643
11643  *         return self
11644  *
11645  *     def find_node(self,             # <<<<<<<<<<<<<<
11646  *                   np.float64_t[:] point):
11647  *         """
11648  */
11649 
11650   /* function exit code */
11651   __pyx_L1_error:;
11652   __Pyx_XDECREF(__pyx_t_1);
11653   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.find_node", __pyx_clineno, __pyx_lineno, __pyx_filename);
11654   __pyx_r = NULL;
11655   __pyx_L0:;
11656   __PYX_XDEC_MEMVIEW(&__pyx_v_point, 1);
11657   __Pyx_XGIVEREF(__pyx_r);
11658   __Pyx_RefNannyFinishContext();
11659   return __pyx_r;
11660 }
11661 
11662 /* "yt/utilities/lib/amr_kdtools.pxd":17
11663  *
11664  * cdef class Node:
11665  *     cdef public Node left             # <<<<<<<<<<<<<<
11666  *     cdef public Node right
11667  *     cdef public Node parent
11668  */
11669 
11670 /* Python wrapper */
11671 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4left_1__get__(PyObject *__pyx_v_self); /*proto*/
11672 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4left_1__get__(PyObject *__pyx_v_self) {
11673   PyObject *__pyx_r = 0;
11674   __Pyx_RefNannyDeclarations
11675   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11676   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4left___get__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
11677 
11678   /* function exit code */
11679   __Pyx_RefNannyFinishContext();
11680   return __pyx_r;
11681 }
11682 
11683 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4left___get__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
11684   PyObject *__pyx_r = NULL;
11685   __Pyx_RefNannyDeclarations
11686   __Pyx_RefNannySetupContext("__get__", 0);
11687   __Pyx_XDECREF(__pyx_r);
11688   __Pyx_INCREF(((PyObject *)__pyx_v_self->left));
11689   __pyx_r = ((PyObject *)__pyx_v_self->left);
11690   goto __pyx_L0;
11691 
11692   /* function exit code */
11693   __pyx_L0:;
11694   __Pyx_XGIVEREF(__pyx_r);
11695   __Pyx_RefNannyFinishContext();
11696   return __pyx_r;
11697 }
11698 
11699 /* Python wrapper */
11700 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4left_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
11701 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4left_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
11702   int __pyx_r;
11703   __Pyx_RefNannyDeclarations
11704   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
11705   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4left_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self), ((PyObject *)__pyx_v_value));
11706 
11707   /* function exit code */
11708   __Pyx_RefNannyFinishContext();
11709   return __pyx_r;
11710 }
11711 
11712 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4left_2__set__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_value) {
11713   int __pyx_r;
11714   __Pyx_RefNannyDeclarations
11715   PyObject *__pyx_t_1 = NULL;
11716   __Pyx_RefNannySetupContext("__set__", 0);
11717   if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_2yt_9utilities_3lib_11amr_kdtools_Node))))) __PYX_ERR(2, 17, __pyx_L1_error)
11718   __pyx_t_1 = __pyx_v_value;
11719   __Pyx_INCREF(__pyx_t_1);
11720   __Pyx_GIVEREF(__pyx_t_1);
11721   __Pyx_GOTREF(__pyx_v_self->left);
11722   __Pyx_DECREF(((PyObject *)__pyx_v_self->left));
11723   __pyx_v_self->left = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_1);
11724   __pyx_t_1 = 0;
11725 
11726   /* function exit code */
11727   __pyx_r = 0;
11728   goto __pyx_L0;
11729   __pyx_L1_error:;
11730   __Pyx_XDECREF(__pyx_t_1);
11731   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.left.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11732   __pyx_r = -1;
11733   __pyx_L0:;
11734   __Pyx_RefNannyFinishContext();
11735   return __pyx_r;
11736 }
11737 
11738 /* Python wrapper */
11739 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4left_5__del__(PyObject *__pyx_v_self); /*proto*/
11740 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4left_5__del__(PyObject *__pyx_v_self) {
11741   int __pyx_r;
11742   __Pyx_RefNannyDeclarations
11743   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
11744   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4left_4__del__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
11745 
11746   /* function exit code */
11747   __Pyx_RefNannyFinishContext();
11748   return __pyx_r;
11749 }
11750 
11751 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4left_4__del__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
11752   int __pyx_r;
11753   __Pyx_RefNannyDeclarations
11754   __Pyx_RefNannySetupContext("__del__", 0);
11755   __Pyx_INCREF(Py_None);
11756   __Pyx_GIVEREF(Py_None);
11757   __Pyx_GOTREF(__pyx_v_self->left);
11758   __Pyx_DECREF(((PyObject *)__pyx_v_self->left));
11759   __pyx_v_self->left = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)Py_None);
11760 
11761   /* function exit code */
11762   __pyx_r = 0;
11763   __Pyx_RefNannyFinishContext();
11764   return __pyx_r;
11765 }
11766 
11767 /* "yt/utilities/lib/amr_kdtools.pxd":18
11768  * cdef class Node:
11769  *     cdef public Node left
11770  *     cdef public Node right             # <<<<<<<<<<<<<<
11771  *     cdef public Node parent
11772  *     cdef public int grid
11773  */
11774 
11775 /* Python wrapper */
11776 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_5right_1__get__(PyObject *__pyx_v_self); /*proto*/
11777 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_5right_1__get__(PyObject *__pyx_v_self) {
11778   PyObject *__pyx_r = 0;
11779   __Pyx_RefNannyDeclarations
11780   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11781   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_5right___get__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
11782 
11783   /* function exit code */
11784   __Pyx_RefNannyFinishContext();
11785   return __pyx_r;
11786 }
11787 
11788 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_5right___get__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
11789   PyObject *__pyx_r = NULL;
11790   __Pyx_RefNannyDeclarations
11791   __Pyx_RefNannySetupContext("__get__", 0);
11792   __Pyx_XDECREF(__pyx_r);
11793   __Pyx_INCREF(((PyObject *)__pyx_v_self->right));
11794   __pyx_r = ((PyObject *)__pyx_v_self->right);
11795   goto __pyx_L0;
11796 
11797   /* function exit code */
11798   __pyx_L0:;
11799   __Pyx_XGIVEREF(__pyx_r);
11800   __Pyx_RefNannyFinishContext();
11801   return __pyx_r;
11802 }
11803 
11804 /* Python wrapper */
11805 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_5right_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
11806 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_5right_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
11807   int __pyx_r;
11808   __Pyx_RefNannyDeclarations
11809   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
11810   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_5right_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self), ((PyObject *)__pyx_v_value));
11811 
11812   /* function exit code */
11813   __Pyx_RefNannyFinishContext();
11814   return __pyx_r;
11815 }
11816 
11817 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_5right_2__set__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_value) {
11818   int __pyx_r;
11819   __Pyx_RefNannyDeclarations
11820   PyObject *__pyx_t_1 = NULL;
11821   __Pyx_RefNannySetupContext("__set__", 0);
11822   if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_2yt_9utilities_3lib_11amr_kdtools_Node))))) __PYX_ERR(2, 18, __pyx_L1_error)
11823   __pyx_t_1 = __pyx_v_value;
11824   __Pyx_INCREF(__pyx_t_1);
11825   __Pyx_GIVEREF(__pyx_t_1);
11826   __Pyx_GOTREF(__pyx_v_self->right);
11827   __Pyx_DECREF(((PyObject *)__pyx_v_self->right));
11828   __pyx_v_self->right = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_1);
11829   __pyx_t_1 = 0;
11830 
11831   /* function exit code */
11832   __pyx_r = 0;
11833   goto __pyx_L0;
11834   __pyx_L1_error:;
11835   __Pyx_XDECREF(__pyx_t_1);
11836   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.right.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11837   __pyx_r = -1;
11838   __pyx_L0:;
11839   __Pyx_RefNannyFinishContext();
11840   return __pyx_r;
11841 }
11842 
11843 /* Python wrapper */
11844 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_5right_5__del__(PyObject *__pyx_v_self); /*proto*/
11845 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_5right_5__del__(PyObject *__pyx_v_self) {
11846   int __pyx_r;
11847   __Pyx_RefNannyDeclarations
11848   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
11849   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_5right_4__del__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
11850 
11851   /* function exit code */
11852   __Pyx_RefNannyFinishContext();
11853   return __pyx_r;
11854 }
11855 
11856 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_5right_4__del__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
11857   int __pyx_r;
11858   __Pyx_RefNannyDeclarations
11859   __Pyx_RefNannySetupContext("__del__", 0);
11860   __Pyx_INCREF(Py_None);
11861   __Pyx_GIVEREF(Py_None);
11862   __Pyx_GOTREF(__pyx_v_self->right);
11863   __Pyx_DECREF(((PyObject *)__pyx_v_self->right));
11864   __pyx_v_self->right = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)Py_None);
11865 
11866   /* function exit code */
11867   __pyx_r = 0;
11868   __Pyx_RefNannyFinishContext();
11869   return __pyx_r;
11870 }
11871 
11872 /* "yt/utilities/lib/amr_kdtools.pxd":19
11873  *     cdef public Node left
11874  *     cdef public Node right
11875  *     cdef public Node parent             # <<<<<<<<<<<<<<
11876  *     cdef public int grid
11877  *     cdef public bint dirty
11878  */
11879 
11880 /* Python wrapper */
11881 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_6parent_1__get__(PyObject *__pyx_v_self); /*proto*/
11882 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_6parent_1__get__(PyObject *__pyx_v_self) {
11883   PyObject *__pyx_r = 0;
11884   __Pyx_RefNannyDeclarations
11885   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11886   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_6parent___get__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
11887 
11888   /* function exit code */
11889   __Pyx_RefNannyFinishContext();
11890   return __pyx_r;
11891 }
11892 
11893 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_6parent___get__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
11894   PyObject *__pyx_r = NULL;
11895   __Pyx_RefNannyDeclarations
11896   __Pyx_RefNannySetupContext("__get__", 0);
11897   __Pyx_XDECREF(__pyx_r);
11898   __Pyx_INCREF(((PyObject *)__pyx_v_self->parent));
11899   __pyx_r = ((PyObject *)__pyx_v_self->parent);
11900   goto __pyx_L0;
11901 
11902   /* function exit code */
11903   __pyx_L0:;
11904   __Pyx_XGIVEREF(__pyx_r);
11905   __Pyx_RefNannyFinishContext();
11906   return __pyx_r;
11907 }
11908 
11909 /* Python wrapper */
11910 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_6parent_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
11911 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_6parent_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
11912   int __pyx_r;
11913   __Pyx_RefNannyDeclarations
11914   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
11915   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_6parent_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self), ((PyObject *)__pyx_v_value));
11916 
11917   /* function exit code */
11918   __Pyx_RefNannyFinishContext();
11919   return __pyx_r;
11920 }
11921 
11922 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_6parent_2__set__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_value) {
11923   int __pyx_r;
11924   __Pyx_RefNannyDeclarations
11925   PyObject *__pyx_t_1 = NULL;
11926   __Pyx_RefNannySetupContext("__set__", 0);
11927   if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_2yt_9utilities_3lib_11amr_kdtools_Node))))) __PYX_ERR(2, 19, __pyx_L1_error)
11928   __pyx_t_1 = __pyx_v_value;
11929   __Pyx_INCREF(__pyx_t_1);
11930   __Pyx_GIVEREF(__pyx_t_1);
11931   __Pyx_GOTREF(__pyx_v_self->parent);
11932   __Pyx_DECREF(((PyObject *)__pyx_v_self->parent));
11933   __pyx_v_self->parent = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_1);
11934   __pyx_t_1 = 0;
11935 
11936   /* function exit code */
11937   __pyx_r = 0;
11938   goto __pyx_L0;
11939   __pyx_L1_error:;
11940   __Pyx_XDECREF(__pyx_t_1);
11941   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.parent.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11942   __pyx_r = -1;
11943   __pyx_L0:;
11944   __Pyx_RefNannyFinishContext();
11945   return __pyx_r;
11946 }
11947 
11948 /* Python wrapper */
11949 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_6parent_5__del__(PyObject *__pyx_v_self); /*proto*/
11950 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_6parent_5__del__(PyObject *__pyx_v_self) {
11951   int __pyx_r;
11952   __Pyx_RefNannyDeclarations
11953   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
11954   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_6parent_4__del__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
11955 
11956   /* function exit code */
11957   __Pyx_RefNannyFinishContext();
11958   return __pyx_r;
11959 }
11960 
11961 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_6parent_4__del__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
11962   int __pyx_r;
11963   __Pyx_RefNannyDeclarations
11964   __Pyx_RefNannySetupContext("__del__", 0);
11965   __Pyx_INCREF(Py_None);
11966   __Pyx_GIVEREF(Py_None);
11967   __Pyx_GOTREF(__pyx_v_self->parent);
11968   __Pyx_DECREF(((PyObject *)__pyx_v_self->parent));
11969   __pyx_v_self->parent = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)Py_None);
11970 
11971   /* function exit code */
11972   __pyx_r = 0;
11973   __Pyx_RefNannyFinishContext();
11974   return __pyx_r;
11975 }
11976 
11977 /* "yt/utilities/lib/amr_kdtools.pxd":20
11978  *     cdef public Node right
11979  *     cdef public Node parent
11980  *     cdef public int grid             # <<<<<<<<<<<<<<
11981  *     cdef public bint dirty
11982  *     cdef public np.int64_t node_id
11983  */
11984 
11985 /* Python wrapper */
11986 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4grid_1__get__(PyObject *__pyx_v_self); /*proto*/
11987 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4grid_1__get__(PyObject *__pyx_v_self) {
11988   PyObject *__pyx_r = 0;
11989   __Pyx_RefNannyDeclarations
11990   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11991   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4grid___get__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
11992 
11993   /* function exit code */
11994   __Pyx_RefNannyFinishContext();
11995   return __pyx_r;
11996 }
11997 
11998 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4grid___get__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
11999   PyObject *__pyx_r = NULL;
12000   __Pyx_RefNannyDeclarations
12001   PyObject *__pyx_t_1 = NULL;
12002   __Pyx_RefNannySetupContext("__get__", 0);
12003   __Pyx_XDECREF(__pyx_r);
12004   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->grid); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 20, __pyx_L1_error)
12005   __Pyx_GOTREF(__pyx_t_1);
12006   __pyx_r = __pyx_t_1;
12007   __pyx_t_1 = 0;
12008   goto __pyx_L0;
12009 
12010   /* function exit code */
12011   __pyx_L1_error:;
12012   __Pyx_XDECREF(__pyx_t_1);
12013   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.grid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12014   __pyx_r = NULL;
12015   __pyx_L0:;
12016   __Pyx_XGIVEREF(__pyx_r);
12017   __Pyx_RefNannyFinishContext();
12018   return __pyx_r;
12019 }
12020 
12021 /* Python wrapper */
12022 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4grid_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
12023 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4grid_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
12024   int __pyx_r;
12025   __Pyx_RefNannyDeclarations
12026   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
12027   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4grid_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self), ((PyObject *)__pyx_v_value));
12028 
12029   /* function exit code */
12030   __Pyx_RefNannyFinishContext();
12031   return __pyx_r;
12032 }
12033 
12034 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4grid_2__set__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_value) {
12035   int __pyx_r;
12036   __Pyx_RefNannyDeclarations
12037   int __pyx_t_1;
12038   __Pyx_RefNannySetupContext("__set__", 0);
12039   __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 20, __pyx_L1_error)
12040   __pyx_v_self->grid = __pyx_t_1;
12041 
12042   /* function exit code */
12043   __pyx_r = 0;
12044   goto __pyx_L0;
12045   __pyx_L1_error:;
12046   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.grid.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12047   __pyx_r = -1;
12048   __pyx_L0:;
12049   __Pyx_RefNannyFinishContext();
12050   return __pyx_r;
12051 }
12052 
12053 /* "yt/utilities/lib/amr_kdtools.pxd":21
12054  *     cdef public Node parent
12055  *     cdef public int grid
12056  *     cdef public bint dirty             # <<<<<<<<<<<<<<
12057  *     cdef public np.int64_t node_id
12058  *     cdef public np.int64_t node_ind
12059  */
12060 
12061 /* Python wrapper */
12062 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_5dirty_1__get__(PyObject *__pyx_v_self); /*proto*/
12063 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_5dirty_1__get__(PyObject *__pyx_v_self) {
12064   PyObject *__pyx_r = 0;
12065   __Pyx_RefNannyDeclarations
12066   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12067   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_5dirty___get__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
12068 
12069   /* function exit code */
12070   __Pyx_RefNannyFinishContext();
12071   return __pyx_r;
12072 }
12073 
12074 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_5dirty___get__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
12075   PyObject *__pyx_r = NULL;
12076   __Pyx_RefNannyDeclarations
12077   PyObject *__pyx_t_1 = NULL;
12078   __Pyx_RefNannySetupContext("__get__", 0);
12079   __Pyx_XDECREF(__pyx_r);
12080   __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->dirty); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 21, __pyx_L1_error)
12081   __Pyx_GOTREF(__pyx_t_1);
12082   __pyx_r = __pyx_t_1;
12083   __pyx_t_1 = 0;
12084   goto __pyx_L0;
12085 
12086   /* function exit code */
12087   __pyx_L1_error:;
12088   __Pyx_XDECREF(__pyx_t_1);
12089   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.dirty.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12090   __pyx_r = NULL;
12091   __pyx_L0:;
12092   __Pyx_XGIVEREF(__pyx_r);
12093   __Pyx_RefNannyFinishContext();
12094   return __pyx_r;
12095 }
12096 
12097 /* Python wrapper */
12098 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_5dirty_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
12099 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_5dirty_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
12100   int __pyx_r;
12101   __Pyx_RefNannyDeclarations
12102   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
12103   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_5dirty_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self), ((PyObject *)__pyx_v_value));
12104 
12105   /* function exit code */
12106   __Pyx_RefNannyFinishContext();
12107   return __pyx_r;
12108 }
12109 
12110 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_5dirty_2__set__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_value) {
12111   int __pyx_r;
12112   __Pyx_RefNannyDeclarations
12113   int __pyx_t_1;
12114   __Pyx_RefNannySetupContext("__set__", 0);
12115   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 21, __pyx_L1_error)
12116   __pyx_v_self->dirty = __pyx_t_1;
12117 
12118   /* function exit code */
12119   __pyx_r = 0;
12120   goto __pyx_L0;
12121   __pyx_L1_error:;
12122   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.dirty.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12123   __pyx_r = -1;
12124   __pyx_L0:;
12125   __Pyx_RefNannyFinishContext();
12126   return __pyx_r;
12127 }
12128 
12129 /* "yt/utilities/lib/amr_kdtools.pxd":22
12130  *     cdef public int grid
12131  *     cdef public bint dirty
12132  *     cdef public np.int64_t node_id             # <<<<<<<<<<<<<<
12133  *     cdef public np.int64_t node_ind
12134  *     cdef np.float64_t left_edge[3]
12135  */
12136 
12137 /* Python wrapper */
12138 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_7node_id_1__get__(PyObject *__pyx_v_self); /*proto*/
12139 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_7node_id_1__get__(PyObject *__pyx_v_self) {
12140   PyObject *__pyx_r = 0;
12141   __Pyx_RefNannyDeclarations
12142   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12143   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_7node_id___get__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
12144 
12145   /* function exit code */
12146   __Pyx_RefNannyFinishContext();
12147   return __pyx_r;
12148 }
12149 
12150 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_7node_id___get__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
12151   PyObject *__pyx_r = NULL;
12152   __Pyx_RefNannyDeclarations
12153   PyObject *__pyx_t_1 = NULL;
12154   __Pyx_RefNannySetupContext("__get__", 0);
12155   __Pyx_XDECREF(__pyx_r);
12156   __pyx_t_1 = __Pyx_PyInt_From_npy_int64(__pyx_v_self->node_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 22, __pyx_L1_error)
12157   __Pyx_GOTREF(__pyx_t_1);
12158   __pyx_r = __pyx_t_1;
12159   __pyx_t_1 = 0;
12160   goto __pyx_L0;
12161 
12162   /* function exit code */
12163   __pyx_L1_error:;
12164   __Pyx_XDECREF(__pyx_t_1);
12165   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.node_id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12166   __pyx_r = NULL;
12167   __pyx_L0:;
12168   __Pyx_XGIVEREF(__pyx_r);
12169   __Pyx_RefNannyFinishContext();
12170   return __pyx_r;
12171 }
12172 
12173 /* Python wrapper */
12174 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_7node_id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
12175 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_7node_id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
12176   int __pyx_r;
12177   __Pyx_RefNannyDeclarations
12178   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
12179   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_7node_id_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self), ((PyObject *)__pyx_v_value));
12180 
12181   /* function exit code */
12182   __Pyx_RefNannyFinishContext();
12183   return __pyx_r;
12184 }
12185 
12186 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_7node_id_2__set__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_value) {
12187   int __pyx_r;
12188   __Pyx_RefNannyDeclarations
12189   __pyx_t_5numpy_int64_t __pyx_t_1;
12190   __Pyx_RefNannySetupContext("__set__", 0);
12191   __pyx_t_1 = __Pyx_PyInt_As_npy_int64(__pyx_v_value); if (unlikely((__pyx_t_1 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(2, 22, __pyx_L1_error)
12192   __pyx_v_self->node_id = __pyx_t_1;
12193 
12194   /* function exit code */
12195   __pyx_r = 0;
12196   goto __pyx_L0;
12197   __pyx_L1_error:;
12198   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.node_id.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12199   __pyx_r = -1;
12200   __pyx_L0:;
12201   __Pyx_RefNannyFinishContext();
12202   return __pyx_r;
12203 }
12204 
12205 /* "yt/utilities/lib/amr_kdtools.pxd":23
12206  *     cdef public bint dirty
12207  *     cdef public np.int64_t node_id
12208  *     cdef public np.int64_t node_ind             # <<<<<<<<<<<<<<
12209  *     cdef np.float64_t left_edge[3]
12210  *     cdef np.float64_t right_edge[3]
12211  */
12212 
12213 /* Python wrapper */
12214 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_8node_ind_1__get__(PyObject *__pyx_v_self); /*proto*/
12215 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_8node_ind_1__get__(PyObject *__pyx_v_self) {
12216   PyObject *__pyx_r = 0;
12217   __Pyx_RefNannyDeclarations
12218   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12219   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_8node_ind___get__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
12220 
12221   /* function exit code */
12222   __Pyx_RefNannyFinishContext();
12223   return __pyx_r;
12224 }
12225 
12226 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_8node_ind___get__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
12227   PyObject *__pyx_r = NULL;
12228   __Pyx_RefNannyDeclarations
12229   PyObject *__pyx_t_1 = NULL;
12230   __Pyx_RefNannySetupContext("__get__", 0);
12231   __Pyx_XDECREF(__pyx_r);
12232   __pyx_t_1 = __Pyx_PyInt_From_npy_int64(__pyx_v_self->node_ind); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 23, __pyx_L1_error)
12233   __Pyx_GOTREF(__pyx_t_1);
12234   __pyx_r = __pyx_t_1;
12235   __pyx_t_1 = 0;
12236   goto __pyx_L0;
12237 
12238   /* function exit code */
12239   __pyx_L1_error:;
12240   __Pyx_XDECREF(__pyx_t_1);
12241   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.node_ind.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12242   __pyx_r = NULL;
12243   __pyx_L0:;
12244   __Pyx_XGIVEREF(__pyx_r);
12245   __Pyx_RefNannyFinishContext();
12246   return __pyx_r;
12247 }
12248 
12249 /* Python wrapper */
12250 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_8node_ind_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
12251 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_8node_ind_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
12252   int __pyx_r;
12253   __Pyx_RefNannyDeclarations
12254   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
12255   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_8node_ind_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self), ((PyObject *)__pyx_v_value));
12256 
12257   /* function exit code */
12258   __Pyx_RefNannyFinishContext();
12259   return __pyx_r;
12260 }
12261 
12262 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_8node_ind_2__set__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_value) {
12263   int __pyx_r;
12264   __Pyx_RefNannyDeclarations
12265   __pyx_t_5numpy_int64_t __pyx_t_1;
12266   __Pyx_RefNannySetupContext("__set__", 0);
12267   __pyx_t_1 = __Pyx_PyInt_As_npy_int64(__pyx_v_value); if (unlikely((__pyx_t_1 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(2, 23, __pyx_L1_error)
12268   __pyx_v_self->node_ind = __pyx_t_1;
12269 
12270   /* function exit code */
12271   __pyx_r = 0;
12272   goto __pyx_L0;
12273   __pyx_L1_error:;
12274   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.node_ind.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12275   __pyx_r = -1;
12276   __pyx_L0:;
12277   __Pyx_RefNannyFinishContext();
12278   return __pyx_r;
12279 }
12280 
12281 /* "yt/utilities/lib/amr_kdtools.pxd":26
12282  *     cdef np.float64_t left_edge[3]
12283  *     cdef np.float64_t right_edge[3]
12284  *     cdef public data             # <<<<<<<<<<<<<<
12285  *     cdef Split * split
12286  *     cdef int level
12287  */
12288 
12289 /* Python wrapper */
12290 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4data_1__get__(PyObject *__pyx_v_self); /*proto*/
12291 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4data_1__get__(PyObject *__pyx_v_self) {
12292   PyObject *__pyx_r = 0;
12293   __Pyx_RefNannyDeclarations
12294   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12295   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4data___get__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
12296 
12297   /* function exit code */
12298   __Pyx_RefNannyFinishContext();
12299   return __pyx_r;
12300 }
12301 
12302 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4data___get__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
12303   PyObject *__pyx_r = NULL;
12304   __Pyx_RefNannyDeclarations
12305   __Pyx_RefNannySetupContext("__get__", 0);
12306   __Pyx_XDECREF(__pyx_r);
12307   __Pyx_INCREF(__pyx_v_self->data);
12308   __pyx_r = __pyx_v_self->data;
12309   goto __pyx_L0;
12310 
12311   /* function exit code */
12312   __pyx_L0:;
12313   __Pyx_XGIVEREF(__pyx_r);
12314   __Pyx_RefNannyFinishContext();
12315   return __pyx_r;
12316 }
12317 
12318 /* Python wrapper */
12319 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4data_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
12320 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4data_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
12321   int __pyx_r;
12322   __Pyx_RefNannyDeclarations
12323   __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
12324   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4data_2__set__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self), ((PyObject *)__pyx_v_value));
12325 
12326   /* function exit code */
12327   __Pyx_RefNannyFinishContext();
12328   return __pyx_r;
12329 }
12330 
12331 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4data_2__set__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, PyObject *__pyx_v_value) {
12332   int __pyx_r;
12333   __Pyx_RefNannyDeclarations
12334   __Pyx_RefNannySetupContext("__set__", 0);
12335   __Pyx_INCREF(__pyx_v_value);
12336   __Pyx_GIVEREF(__pyx_v_value);
12337   __Pyx_GOTREF(__pyx_v_self->data);
12338   __Pyx_DECREF(__pyx_v_self->data);
12339   __pyx_v_self->data = __pyx_v_value;
12340 
12341   /* function exit code */
12342   __pyx_r = 0;
12343   __Pyx_RefNannyFinishContext();
12344   return __pyx_r;
12345 }
12346 
12347 /* Python wrapper */
12348 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4data_5__del__(PyObject *__pyx_v_self); /*proto*/
12349 static int __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4data_5__del__(PyObject *__pyx_v_self) {
12350   int __pyx_r;
12351   __Pyx_RefNannyDeclarations
12352   __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
12353   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4data_4__del__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
12354 
12355   /* function exit code */
12356   __Pyx_RefNannyFinishContext();
12357   return __pyx_r;
12358 }
12359 
12360 static int __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_4data_4__del__(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
12361   int __pyx_r;
12362   __Pyx_RefNannyDeclarations
12363   __Pyx_RefNannySetupContext("__del__", 0);
12364   __Pyx_INCREF(Py_None);
12365   __Pyx_GIVEREF(Py_None);
12366   __Pyx_GOTREF(__pyx_v_self->data);
12367   __Pyx_DECREF(__pyx_v_self->data);
12368   __pyx_v_self->data = Py_None;
12369 
12370   /* function exit code */
12371   __pyx_r = 0;
12372   __Pyx_RefNannyFinishContext();
12373   return __pyx_r;
12374 }
12375 
12376 /* "(tree fragment)":1
12377  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
12378  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
12379  * def __setstate_cython__(self, __pyx_state):
12380  */
12381 
12382 /* Python wrapper */
12383 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_50__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
12384 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_50__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12385   PyObject *__pyx_r = 0;
12386   __Pyx_RefNannyDeclarations
12387   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
12388   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_49__reduce_cython__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self));
12389 
12390   /* function exit code */
12391   __Pyx_RefNannyFinishContext();
12392   return __pyx_r;
12393 }
12394 
12395 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_49__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self) {
12396   PyObject *__pyx_r = NULL;
12397   __Pyx_RefNannyDeclarations
12398   PyObject *__pyx_t_1 = NULL;
12399   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
12400 
12401   /* "(tree fragment)":2
12402  * def __reduce_cython__(self):
12403  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
12404  * def __setstate_cython__(self, __pyx_state):
12405  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
12406  */
12407   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
12408   __Pyx_GOTREF(__pyx_t_1);
12409   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
12410   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12411   __PYX_ERR(1, 2, __pyx_L1_error)
12412 
12413   /* "(tree fragment)":1
12414  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
12415  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
12416  * def __setstate_cython__(self, __pyx_state):
12417  */
12418 
12419   /* function exit code */
12420   __pyx_L1_error:;
12421   __Pyx_XDECREF(__pyx_t_1);
12422   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12423   __pyx_r = NULL;
12424   __Pyx_XGIVEREF(__pyx_r);
12425   __Pyx_RefNannyFinishContext();
12426   return __pyx_r;
12427 }
12428 
12429 /* "(tree fragment)":3
12430  * def __reduce_cython__(self):
12431  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
12432  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
12433  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
12434  */
12435 
12436 /* Python wrapper */
12437 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_52__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
12438 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_52__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
12439   PyObject *__pyx_r = 0;
12440   __Pyx_RefNannyDeclarations
12441   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
12442   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_51__setstate_cython__(((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
12443 
12444   /* function exit code */
12445   __Pyx_RefNannyFinishContext();
12446   return __pyx_r;
12447 }
12448 
12449 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_4Node_51__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
12450   PyObject *__pyx_r = NULL;
12451   __Pyx_RefNannyDeclarations
12452   PyObject *__pyx_t_1 = NULL;
12453   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
12454 
12455   /* "(tree fragment)":4
12456  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
12457  * def __setstate_cython__(self, __pyx_state):
12458  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
12459  */
12460   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
12461   __Pyx_GOTREF(__pyx_t_1);
12462   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
12463   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12464   __PYX_ERR(1, 4, __pyx_L1_error)
12465 
12466   /* "(tree fragment)":3
12467  * def __reduce_cython__(self):
12468  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
12469  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
12470  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
12471  */
12472 
12473   /* function exit code */
12474   __pyx_L1_error:;
12475   __Pyx_XDECREF(__pyx_t_1);
12476   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.Node.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12477   __pyx_r = NULL;
12478   __Pyx_XGIVEREF(__pyx_r);
12479   __Pyx_RefNannyFinishContext();
12480   return __pyx_r;
12481 }
12482 
12483 /* "yt/utilities/lib/amr_kdtools.pyx":654
12484  * @cython.wraparound(False)
12485  * @cython.cdivision(True)
12486  * cdef inline np.int64_t _lchild_id(np.int64_t node_id):             # <<<<<<<<<<<<<<
12487  *     return (node_id<<1)
12488  *
12489  */
12490 
12491 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_11amr_kdtools__lchild_id(__pyx_t_5numpy_int64_t __pyx_v_node_id) {
12492   __pyx_t_5numpy_int64_t __pyx_r;
12493   __Pyx_RefNannyDeclarations
12494   __Pyx_RefNannySetupContext("_lchild_id", 0);
12495 
12496   /* "yt/utilities/lib/amr_kdtools.pyx":655
12497  * @cython.cdivision(True)
12498  * cdef inline np.int64_t _lchild_id(np.int64_t node_id):
12499  *     return (node_id<<1)             # <<<<<<<<<<<<<<
12500  *
12501  * @cython.boundscheck(False)
12502  */
12503   __pyx_r = (__pyx_v_node_id << 1);
12504   goto __pyx_L0;
12505 
12506   /* "yt/utilities/lib/amr_kdtools.pyx":654
12507  * @cython.wraparound(False)
12508  * @cython.cdivision(True)
12509  * cdef inline np.int64_t _lchild_id(np.int64_t node_id):             # <<<<<<<<<<<<<<
12510  *     return (node_id<<1)
12511  *
12512  */
12513 
12514   /* function exit code */
12515   __pyx_L0:;
12516   __Pyx_RefNannyFinishContext();
12517   return __pyx_r;
12518 }
12519 
12520 /* "yt/utilities/lib/amr_kdtools.pyx":660
12521  * @cython.wraparound(False)
12522  * @cython.cdivision(True)
12523  * cdef inline np.int64_t _rchild_id(np.int64_t node_id):             # <<<<<<<<<<<<<<
12524  *     return (node_id<<1) + 1
12525  *
12526  */
12527 
12528 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_11amr_kdtools__rchild_id(__pyx_t_5numpy_int64_t __pyx_v_node_id) {
12529   __pyx_t_5numpy_int64_t __pyx_r;
12530   __Pyx_RefNannyDeclarations
12531   __Pyx_RefNannySetupContext("_rchild_id", 0);
12532 
12533   /* "yt/utilities/lib/amr_kdtools.pyx":661
12534  * @cython.cdivision(True)
12535  * cdef inline np.int64_t _rchild_id(np.int64_t node_id):
12536  *     return (node_id<<1) + 1             # <<<<<<<<<<<<<<
12537  *
12538  * @cython.boundscheck(False)
12539  */
12540   __pyx_r = ((__pyx_v_node_id << 1) + 1);
12541   goto __pyx_L0;
12542 
12543   /* "yt/utilities/lib/amr_kdtools.pyx":660
12544  * @cython.wraparound(False)
12545  * @cython.cdivision(True)
12546  * cdef inline np.int64_t _rchild_id(np.int64_t node_id):             # <<<<<<<<<<<<<<
12547  *     return (node_id<<1) + 1
12548  *
12549  */
12550 
12551   /* function exit code */
12552   __pyx_L0:;
12553   __Pyx_RefNannyFinishContext();
12554   return __pyx_r;
12555 }
12556 
12557 /* "yt/utilities/lib/amr_kdtools.pyx":666
12558  * @cython.wraparound(False)
12559  * @cython.cdivision(True)
12560  * cdef inline np.int64_t _parent_id(np.int64_t node_id):             # <<<<<<<<<<<<<<
12561  *     return (node_id-1) >> 1
12562  *
12563  */
12564 
12565 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_11amr_kdtools__parent_id(__pyx_t_5numpy_int64_t __pyx_v_node_id) {
12566   __pyx_t_5numpy_int64_t __pyx_r;
12567   __Pyx_RefNannyDeclarations
12568   __Pyx_RefNannySetupContext("_parent_id", 0);
12569 
12570   /* "yt/utilities/lib/amr_kdtools.pyx":667
12571  * @cython.cdivision(True)
12572  * cdef inline np.int64_t _parent_id(np.int64_t node_id):
12573  *     return (node_id-1) >> 1             # <<<<<<<<<<<<<<
12574  *
12575  * @cython.boundscheck(False)
12576  */
12577   __pyx_r = ((__pyx_v_node_id - 1) >> 1);
12578   goto __pyx_L0;
12579 
12580   /* "yt/utilities/lib/amr_kdtools.pyx":666
12581  * @cython.wraparound(False)
12582  * @cython.cdivision(True)
12583  * cdef inline np.int64_t _parent_id(np.int64_t node_id):             # <<<<<<<<<<<<<<
12584  *     return (node_id-1) >> 1
12585  *
12586  */
12587 
12588   /* function exit code */
12589   __pyx_L0:;
12590   __Pyx_RefNannyFinishContext();
12591   return __pyx_r;
12592 }
12593 
12594 /* "yt/utilities/lib/amr_kdtools.pyx":672
12595  * @cython.wraparound(False)
12596  * @cython.cdivision(True)
12597  * cdef int should_i_build(Node node, int rank, int size):             # <<<<<<<<<<<<<<
12598  *     if (node.node_id < size) or (node.node_id >= 2*size):
12599  *         return 1
12600  */
12601 
12602 static int __pyx_f_2yt_9utilities_3lib_11amr_kdtools_should_i_build(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_node, int __pyx_v_rank, int __pyx_v_size) {
12603   int __pyx_r;
12604   __Pyx_RefNannyDeclarations
12605   int __pyx_t_1;
12606   int __pyx_t_2;
12607   __Pyx_RefNannySetupContext("should_i_build", 0);
12608 
12609   /* "yt/utilities/lib/amr_kdtools.pyx":673
12610  * @cython.cdivision(True)
12611  * cdef int should_i_build(Node node, int rank, int size):
12612  *     if (node.node_id < size) or (node.node_id >= 2*size):             # <<<<<<<<<<<<<<
12613  *         return 1
12614  *     elif node.node_id - size == rank:
12615  */
12616   __pyx_t_2 = ((__pyx_v_node->node_id < __pyx_v_size) != 0);
12617   if (!__pyx_t_2) {
12618   } else {
12619     __pyx_t_1 = __pyx_t_2;
12620     goto __pyx_L4_bool_binop_done;
12621   }
12622   __pyx_t_2 = ((__pyx_v_node->node_id >= (2 * __pyx_v_size)) != 0);
12623   __pyx_t_1 = __pyx_t_2;
12624   __pyx_L4_bool_binop_done:;
12625   if (__pyx_t_1) {
12626 
12627     /* "yt/utilities/lib/amr_kdtools.pyx":674
12628  * cdef int should_i_build(Node node, int rank, int size):
12629  *     if (node.node_id < size) or (node.node_id >= 2*size):
12630  *         return 1             # <<<<<<<<<<<<<<
12631  *     elif node.node_id - size == rank:
12632  *         return 1
12633  */
12634     __pyx_r = 1;
12635     goto __pyx_L0;
12636 
12637     /* "yt/utilities/lib/amr_kdtools.pyx":673
12638  * @cython.cdivision(True)
12639  * cdef int should_i_build(Node node, int rank, int size):
12640  *     if (node.node_id < size) or (node.node_id >= 2*size):             # <<<<<<<<<<<<<<
12641  *         return 1
12642  *     elif node.node_id - size == rank:
12643  */
12644   }
12645 
12646   /* "yt/utilities/lib/amr_kdtools.pyx":675
12647  *     if (node.node_id < size) or (node.node_id >= 2*size):
12648  *         return 1
12649  *     elif node.node_id - size == rank:             # <<<<<<<<<<<<<<
12650  *         return 1
12651  *     else:
12652  */
12653   __pyx_t_1 = (((__pyx_v_node->node_id - __pyx_v_size) == __pyx_v_rank) != 0);
12654   if (__pyx_t_1) {
12655 
12656     /* "yt/utilities/lib/amr_kdtools.pyx":676
12657  *         return 1
12658  *     elif node.node_id - size == rank:
12659  *         return 1             # <<<<<<<<<<<<<<
12660  *     else:
12661  *         return 0
12662  */
12663     __pyx_r = 1;
12664     goto __pyx_L0;
12665 
12666     /* "yt/utilities/lib/amr_kdtools.pyx":675
12667  *     if (node.node_id < size) or (node.node_id >= 2*size):
12668  *         return 1
12669  *     elif node.node_id - size == rank:             # <<<<<<<<<<<<<<
12670  *         return 1
12671  *     else:
12672  */
12673   }
12674 
12675   /* "yt/utilities/lib/amr_kdtools.pyx":678
12676  *         return 1
12677  *     else:
12678  *         return 0             # <<<<<<<<<<<<<<
12679  *
12680  * def step_depth(Node current, Node previous):
12681  */
12682   /*else*/ {
12683     __pyx_r = 0;
12684     goto __pyx_L0;
12685   }
12686 
12687   /* "yt/utilities/lib/amr_kdtools.pyx":672
12688  * @cython.wraparound(False)
12689  * @cython.cdivision(True)
12690  * cdef int should_i_build(Node node, int rank, int size):             # <<<<<<<<<<<<<<
12691  *     if (node.node_id < size) or (node.node_id >= 2*size):
12692  *         return 1
12693  */
12694 
12695   /* function exit code */
12696   __pyx_L0:;
12697   __Pyx_RefNannyFinishContext();
12698   return __pyx_r;
12699 }
12700 
12701 /* "yt/utilities/lib/amr_kdtools.pyx":680
12702  *         return 0
12703  *
12704  * def step_depth(Node current, Node previous):             # <<<<<<<<<<<<<<
12705  *     '''
12706  *     Takes a single step in the depth-first traversal
12707  */
12708 
12709 /* Python wrapper */
12710 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_1step_depth(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
12711 static char __pyx_doc_2yt_9utilities_3lib_11amr_kdtools_step_depth[] = "\n    Takes a single step in the depth-first traversal\n    ";
12712 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_11amr_kdtools_1step_depth = {"step_depth", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_1step_depth, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2yt_9utilities_3lib_11amr_kdtools_step_depth};
12713 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_1step_depth(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
12714   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_current = 0;
12715   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_previous = 0;
12716   PyObject *__pyx_r = 0;
12717   __Pyx_RefNannyDeclarations
12718   __Pyx_RefNannySetupContext("step_depth (wrapper)", 0);
12719   {
12720     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_current,&__pyx_n_s_previous,0};
12721     PyObject* values[2] = {0,0};
12722     if (unlikely(__pyx_kwds)) {
12723       Py_ssize_t kw_args;
12724       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
12725       switch (pos_args) {
12726         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12727         CYTHON_FALLTHROUGH;
12728         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12729         CYTHON_FALLTHROUGH;
12730         case  0: break;
12731         default: goto __pyx_L5_argtuple_error;
12732       }
12733       kw_args = PyDict_Size(__pyx_kwds);
12734       switch (pos_args) {
12735         case  0:
12736         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_current)) != 0)) kw_args--;
12737         else goto __pyx_L5_argtuple_error;
12738         CYTHON_FALLTHROUGH;
12739         case  1:
12740         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_previous)) != 0)) kw_args--;
12741         else {
12742           __Pyx_RaiseArgtupleInvalid("step_depth", 1, 2, 2, 1); __PYX_ERR(0, 680, __pyx_L3_error)
12743         }
12744       }
12745       if (unlikely(kw_args > 0)) {
12746         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "step_depth") < 0)) __PYX_ERR(0, 680, __pyx_L3_error)
12747       }
12748     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
12749       goto __pyx_L5_argtuple_error;
12750     } else {
12751       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12752       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12753     }
12754     __pyx_v_current = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)values[0]);
12755     __pyx_v_previous = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)values[1]);
12756   }
12757   goto __pyx_L4_argument_unpacking_done;
12758   __pyx_L5_argtuple_error:;
12759   __Pyx_RaiseArgtupleInvalid("step_depth", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 680, __pyx_L3_error)
12760   __pyx_L3_error:;
12761   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.step_depth", __pyx_clineno, __pyx_lineno, __pyx_filename);
12762   __Pyx_RefNannyFinishContext();
12763   return NULL;
12764   __pyx_L4_argument_unpacking_done:;
12765   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_current), __pyx_ptype_2yt_9utilities_3lib_11amr_kdtools_Node, 1, "current", 0))) __PYX_ERR(0, 680, __pyx_L1_error)
12766   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_previous), __pyx_ptype_2yt_9utilities_3lib_11amr_kdtools_Node, 1, "previous", 0))) __PYX_ERR(0, 680, __pyx_L1_error)
12767   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_step_depth(__pyx_self, __pyx_v_current, __pyx_v_previous);
12768 
12769   /* function exit code */
12770   goto __pyx_L0;
12771   __pyx_L1_error:;
12772   __pyx_r = NULL;
12773   __pyx_L0:;
12774   __Pyx_RefNannyFinishContext();
12775   return __pyx_r;
12776 }
12777 
12778 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_step_depth(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_current, struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_previous) {
12779   PyObject *__pyx_r = NULL;
12780   __Pyx_RefNannyDeclarations
12781   int __pyx_t_1;
12782   PyObject *__pyx_t_2 = NULL;
12783   int __pyx_t_3;
12784   __Pyx_RefNannySetupContext("step_depth", 0);
12785   __Pyx_INCREF((PyObject *)__pyx_v_current);
12786   __Pyx_INCREF((PyObject *)__pyx_v_previous);
12787 
12788   /* "yt/utilities/lib/amr_kdtools.pyx":684
12789  *     Takes a single step in the depth-first traversal
12790  *     '''
12791  *     if current._kd_is_leaf() == 1: # At a leaf, move back up             # <<<<<<<<<<<<<<
12792  *         previous = current
12793  *         current = current.parent
12794  */
12795   __pyx_t_1 = ((((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_current->__pyx_vtab)->_kd_is_leaf(__pyx_v_current) == 1) != 0);
12796   if (__pyx_t_1) {
12797 
12798     /* "yt/utilities/lib/amr_kdtools.pyx":685
12799  *     '''
12800  *     if current._kd_is_leaf() == 1: # At a leaf, move back up
12801  *         previous = current             # <<<<<<<<<<<<<<
12802  *         current = current.parent
12803  *
12804  */
12805     __Pyx_INCREF(((PyObject *)__pyx_v_current));
12806     __Pyx_DECREF_SET(__pyx_v_previous, __pyx_v_current);
12807 
12808     /* "yt/utilities/lib/amr_kdtools.pyx":686
12809  *     if current._kd_is_leaf() == 1: # At a leaf, move back up
12810  *         previous = current
12811  *         current = current.parent             # <<<<<<<<<<<<<<
12812  *
12813  *     elif current.parent is previous: # Moving down, go left first
12814  */
12815     __pyx_t_2 = ((PyObject *)__pyx_v_current->parent);
12816     __Pyx_INCREF(__pyx_t_2);
12817     __Pyx_DECREF_SET(__pyx_v_current, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_2));
12818     __pyx_t_2 = 0;
12819 
12820     /* "yt/utilities/lib/amr_kdtools.pyx":684
12821  *     Takes a single step in the depth-first traversal
12822  *     '''
12823  *     if current._kd_is_leaf() == 1: # At a leaf, move back up             # <<<<<<<<<<<<<<
12824  *         previous = current
12825  *         current = current.parent
12826  */
12827     goto __pyx_L3;
12828   }
12829 
12830   /* "yt/utilities/lib/amr_kdtools.pyx":688
12831  *         current = current.parent
12832  *
12833  *     elif current.parent is previous: # Moving down, go left first             # <<<<<<<<<<<<<<
12834  *         previous = current
12835  *         if current.left is not None:
12836  */
12837   __pyx_t_1 = (__pyx_v_current->parent == __pyx_v_previous);
12838   __pyx_t_3 = (__pyx_t_1 != 0);
12839   if (__pyx_t_3) {
12840 
12841     /* "yt/utilities/lib/amr_kdtools.pyx":689
12842  *
12843  *     elif current.parent is previous: # Moving down, go left first
12844  *         previous = current             # <<<<<<<<<<<<<<
12845  *         if current.left is not None:
12846  *             current = current.left
12847  */
12848     __Pyx_INCREF(((PyObject *)__pyx_v_current));
12849     __Pyx_DECREF_SET(__pyx_v_previous, __pyx_v_current);
12850 
12851     /* "yt/utilities/lib/amr_kdtools.pyx":690
12852  *     elif current.parent is previous: # Moving down, go left first
12853  *         previous = current
12854  *         if current.left is not None:             # <<<<<<<<<<<<<<
12855  *             current = current.left
12856  *         elif current.right is not None:
12857  */
12858     __pyx_t_3 = (((PyObject *)__pyx_v_current->left) != Py_None);
12859     __pyx_t_1 = (__pyx_t_3 != 0);
12860     if (__pyx_t_1) {
12861 
12862       /* "yt/utilities/lib/amr_kdtools.pyx":691
12863  *         previous = current
12864  *         if current.left is not None:
12865  *             current = current.left             # <<<<<<<<<<<<<<
12866  *         elif current.right is not None:
12867  *             current = current.right
12868  */
12869       __pyx_t_2 = ((PyObject *)__pyx_v_current->left);
12870       __Pyx_INCREF(__pyx_t_2);
12871       __Pyx_DECREF_SET(__pyx_v_current, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_2));
12872       __pyx_t_2 = 0;
12873 
12874       /* "yt/utilities/lib/amr_kdtools.pyx":690
12875  *     elif current.parent is previous: # Moving down, go left first
12876  *         previous = current
12877  *         if current.left is not None:             # <<<<<<<<<<<<<<
12878  *             current = current.left
12879  *         elif current.right is not None:
12880  */
12881       goto __pyx_L4;
12882     }
12883 
12884     /* "yt/utilities/lib/amr_kdtools.pyx":692
12885  *         if current.left is not None:
12886  *             current = current.left
12887  *         elif current.right is not None:             # <<<<<<<<<<<<<<
12888  *             current = current.right
12889  *         else:
12890  */
12891     __pyx_t_1 = (((PyObject *)__pyx_v_current->right) != Py_None);
12892     __pyx_t_3 = (__pyx_t_1 != 0);
12893     if (__pyx_t_3) {
12894 
12895       /* "yt/utilities/lib/amr_kdtools.pyx":693
12896  *             current = current.left
12897  *         elif current.right is not None:
12898  *             current = current.right             # <<<<<<<<<<<<<<
12899  *         else:
12900  *             current = current.parent
12901  */
12902       __pyx_t_2 = ((PyObject *)__pyx_v_current->right);
12903       __Pyx_INCREF(__pyx_t_2);
12904       __Pyx_DECREF_SET(__pyx_v_current, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_2));
12905       __pyx_t_2 = 0;
12906 
12907       /* "yt/utilities/lib/amr_kdtools.pyx":692
12908  *         if current.left is not None:
12909  *             current = current.left
12910  *         elif current.right is not None:             # <<<<<<<<<<<<<<
12911  *             current = current.right
12912  *         else:
12913  */
12914       goto __pyx_L4;
12915     }
12916 
12917     /* "yt/utilities/lib/amr_kdtools.pyx":695
12918  *             current = current.right
12919  *         else:
12920  *             current = current.parent             # <<<<<<<<<<<<<<
12921  *
12922  *     elif current.left is previous: # Moving up from left, go right
12923  */
12924     /*else*/ {
12925       __pyx_t_2 = ((PyObject *)__pyx_v_current->parent);
12926       __Pyx_INCREF(__pyx_t_2);
12927       __Pyx_DECREF_SET(__pyx_v_current, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_2));
12928       __pyx_t_2 = 0;
12929     }
12930     __pyx_L4:;
12931 
12932     /* "yt/utilities/lib/amr_kdtools.pyx":688
12933  *         current = current.parent
12934  *
12935  *     elif current.parent is previous: # Moving down, go left first             # <<<<<<<<<<<<<<
12936  *         previous = current
12937  *         if current.left is not None:
12938  */
12939     goto __pyx_L3;
12940   }
12941 
12942   /* "yt/utilities/lib/amr_kdtools.pyx":697
12943  *             current = current.parent
12944  *
12945  *     elif current.left is previous: # Moving up from left, go right             # <<<<<<<<<<<<<<
12946  *         previous = current
12947  *         if current.right is not None:
12948  */
12949   __pyx_t_3 = (__pyx_v_current->left == __pyx_v_previous);
12950   __pyx_t_1 = (__pyx_t_3 != 0);
12951   if (__pyx_t_1) {
12952 
12953     /* "yt/utilities/lib/amr_kdtools.pyx":698
12954  *
12955  *     elif current.left is previous: # Moving up from left, go right
12956  *         previous = current             # <<<<<<<<<<<<<<
12957  *         if current.right is not None:
12958  *             current = current.right
12959  */
12960     __Pyx_INCREF(((PyObject *)__pyx_v_current));
12961     __Pyx_DECREF_SET(__pyx_v_previous, __pyx_v_current);
12962 
12963     /* "yt/utilities/lib/amr_kdtools.pyx":699
12964  *     elif current.left is previous: # Moving up from left, go right
12965  *         previous = current
12966  *         if current.right is not None:             # <<<<<<<<<<<<<<
12967  *             current = current.right
12968  *         else:
12969  */
12970     __pyx_t_1 = (((PyObject *)__pyx_v_current->right) != Py_None);
12971     __pyx_t_3 = (__pyx_t_1 != 0);
12972     if (__pyx_t_3) {
12973 
12974       /* "yt/utilities/lib/amr_kdtools.pyx":700
12975  *         previous = current
12976  *         if current.right is not None:
12977  *             current = current.right             # <<<<<<<<<<<<<<
12978  *         else:
12979  *             current = current.parent
12980  */
12981       __pyx_t_2 = ((PyObject *)__pyx_v_current->right);
12982       __Pyx_INCREF(__pyx_t_2);
12983       __Pyx_DECREF_SET(__pyx_v_current, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_2));
12984       __pyx_t_2 = 0;
12985 
12986       /* "yt/utilities/lib/amr_kdtools.pyx":699
12987  *     elif current.left is previous: # Moving up from left, go right
12988  *         previous = current
12989  *         if current.right is not None:             # <<<<<<<<<<<<<<
12990  *             current = current.right
12991  *         else:
12992  */
12993       goto __pyx_L5;
12994     }
12995 
12996     /* "yt/utilities/lib/amr_kdtools.pyx":702
12997  *             current = current.right
12998  *         else:
12999  *             current = current.parent             # <<<<<<<<<<<<<<
13000  *
13001  *     elif current.right is previous: # Moving up from right child, move up
13002  */
13003     /*else*/ {
13004       __pyx_t_2 = ((PyObject *)__pyx_v_current->parent);
13005       __Pyx_INCREF(__pyx_t_2);
13006       __Pyx_DECREF_SET(__pyx_v_current, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_2));
13007       __pyx_t_2 = 0;
13008     }
13009     __pyx_L5:;
13010 
13011     /* "yt/utilities/lib/amr_kdtools.pyx":697
13012  *             current = current.parent
13013  *
13014  *     elif current.left is previous: # Moving up from left, go right             # <<<<<<<<<<<<<<
13015  *         previous = current
13016  *         if current.right is not None:
13017  */
13018     goto __pyx_L3;
13019   }
13020 
13021   /* "yt/utilities/lib/amr_kdtools.pyx":704
13022  *             current = current.parent
13023  *
13024  *     elif current.right is previous: # Moving up from right child, move up             # <<<<<<<<<<<<<<
13025  *         previous = current
13026  *         current = current.parent
13027  */
13028   __pyx_t_3 = (__pyx_v_current->right == __pyx_v_previous);
13029   __pyx_t_1 = (__pyx_t_3 != 0);
13030   if (__pyx_t_1) {
13031 
13032     /* "yt/utilities/lib/amr_kdtools.pyx":705
13033  *
13034  *     elif current.right is previous: # Moving up from right child, move up
13035  *         previous = current             # <<<<<<<<<<<<<<
13036  *         current = current.parent
13037  *
13038  */
13039     __Pyx_INCREF(((PyObject *)__pyx_v_current));
13040     __Pyx_DECREF_SET(__pyx_v_previous, __pyx_v_current);
13041 
13042     /* "yt/utilities/lib/amr_kdtools.pyx":706
13043  *     elif current.right is previous: # Moving up from right child, move up
13044  *         previous = current
13045  *         current = current.parent             # <<<<<<<<<<<<<<
13046  *
13047  *     return current, previous
13048  */
13049     __pyx_t_2 = ((PyObject *)__pyx_v_current->parent);
13050     __Pyx_INCREF(__pyx_t_2);
13051     __Pyx_DECREF_SET(__pyx_v_current, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_2));
13052     __pyx_t_2 = 0;
13053 
13054     /* "yt/utilities/lib/amr_kdtools.pyx":704
13055  *             current = current.parent
13056  *
13057  *     elif current.right is previous: # Moving up from right child, move up             # <<<<<<<<<<<<<<
13058  *         previous = current
13059  *         current = current.parent
13060  */
13061   }
13062   __pyx_L3:;
13063 
13064   /* "yt/utilities/lib/amr_kdtools.pyx":708
13065  *         current = current.parent
13066  *
13067  *     return current, previous             # <<<<<<<<<<<<<<
13068  *
13069  * def step_viewpoint(Node current,
13070  */
13071   __Pyx_XDECREF(__pyx_r);
13072   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 708, __pyx_L1_error)
13073   __Pyx_GOTREF(__pyx_t_2);
13074   __Pyx_INCREF(((PyObject *)__pyx_v_current));
13075   __Pyx_GIVEREF(((PyObject *)__pyx_v_current));
13076   PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_current));
13077   __Pyx_INCREF(((PyObject *)__pyx_v_previous));
13078   __Pyx_GIVEREF(((PyObject *)__pyx_v_previous));
13079   PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_previous));
13080   __pyx_r = __pyx_t_2;
13081   __pyx_t_2 = 0;
13082   goto __pyx_L0;
13083 
13084   /* "yt/utilities/lib/amr_kdtools.pyx":680
13085  *         return 0
13086  *
13087  * def step_depth(Node current, Node previous):             # <<<<<<<<<<<<<<
13088  *     '''
13089  *     Takes a single step in the depth-first traversal
13090  */
13091 
13092   /* function exit code */
13093   __pyx_L1_error:;
13094   __Pyx_XDECREF(__pyx_t_2);
13095   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.step_depth", __pyx_clineno, __pyx_lineno, __pyx_filename);
13096   __pyx_r = NULL;
13097   __pyx_L0:;
13098   __Pyx_XDECREF((PyObject *)__pyx_v_current);
13099   __Pyx_XDECREF((PyObject *)__pyx_v_previous);
13100   __Pyx_XGIVEREF(__pyx_r);
13101   __Pyx_RefNannyFinishContext();
13102   return __pyx_r;
13103 }
13104 
13105 /* "yt/utilities/lib/amr_kdtools.pyx":710
13106  *     return current, previous
13107  *
13108  * def step_viewpoint(Node current,             # <<<<<<<<<<<<<<
13109  *                    Node previous,
13110  *                    viewpoint):
13111  */
13112 
13113 /* Python wrapper */
13114 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_3step_viewpoint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
13115 static char __pyx_doc_2yt_9utilities_3lib_11amr_kdtools_2step_viewpoint[] = "\n    Takes a single step in the viewpoint based traversal.  Always\n    goes to the node furthest away from viewpoint first.\n    ";
13116 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_11amr_kdtools_3step_viewpoint = {"step_viewpoint", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_3step_viewpoint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2yt_9utilities_3lib_11amr_kdtools_2step_viewpoint};
13117 static PyObject *__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_3step_viewpoint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
13118   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_current = 0;
13119   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_previous = 0;
13120   PyObject *__pyx_v_viewpoint = 0;
13121   PyObject *__pyx_r = 0;
13122   __Pyx_RefNannyDeclarations
13123   __Pyx_RefNannySetupContext("step_viewpoint (wrapper)", 0);
13124   {
13125     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_current,&__pyx_n_s_previous,&__pyx_n_s_viewpoint,0};
13126     PyObject* values[3] = {0,0,0};
13127     if (unlikely(__pyx_kwds)) {
13128       Py_ssize_t kw_args;
13129       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
13130       switch (pos_args) {
13131         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13132         CYTHON_FALLTHROUGH;
13133         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13134         CYTHON_FALLTHROUGH;
13135         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13136         CYTHON_FALLTHROUGH;
13137         case  0: break;
13138         default: goto __pyx_L5_argtuple_error;
13139       }
13140       kw_args = PyDict_Size(__pyx_kwds);
13141       switch (pos_args) {
13142         case  0:
13143         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_current)) != 0)) kw_args--;
13144         else goto __pyx_L5_argtuple_error;
13145         CYTHON_FALLTHROUGH;
13146         case  1:
13147         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_previous)) != 0)) kw_args--;
13148         else {
13149           __Pyx_RaiseArgtupleInvalid("step_viewpoint", 1, 3, 3, 1); __PYX_ERR(0, 710, __pyx_L3_error)
13150         }
13151         CYTHON_FALLTHROUGH;
13152         case  2:
13153         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_viewpoint)) != 0)) kw_args--;
13154         else {
13155           __Pyx_RaiseArgtupleInvalid("step_viewpoint", 1, 3, 3, 2); __PYX_ERR(0, 710, __pyx_L3_error)
13156         }
13157       }
13158       if (unlikely(kw_args > 0)) {
13159         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "step_viewpoint") < 0)) __PYX_ERR(0, 710, __pyx_L3_error)
13160       }
13161     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
13162       goto __pyx_L5_argtuple_error;
13163     } else {
13164       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13165       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13166       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13167     }
13168     __pyx_v_current = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)values[0]);
13169     __pyx_v_previous = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)values[1]);
13170     __pyx_v_viewpoint = values[2];
13171   }
13172   goto __pyx_L4_argument_unpacking_done;
13173   __pyx_L5_argtuple_error:;
13174   __Pyx_RaiseArgtupleInvalid("step_viewpoint", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 710, __pyx_L3_error)
13175   __pyx_L3_error:;
13176   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.step_viewpoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
13177   __Pyx_RefNannyFinishContext();
13178   return NULL;
13179   __pyx_L4_argument_unpacking_done:;
13180   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_current), __pyx_ptype_2yt_9utilities_3lib_11amr_kdtools_Node, 1, "current", 0))) __PYX_ERR(0, 710, __pyx_L1_error)
13181   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_previous), __pyx_ptype_2yt_9utilities_3lib_11amr_kdtools_Node, 1, "previous", 0))) __PYX_ERR(0, 711, __pyx_L1_error)
13182   __pyx_r = __pyx_pf_2yt_9utilities_3lib_11amr_kdtools_2step_viewpoint(__pyx_self, __pyx_v_current, __pyx_v_previous, __pyx_v_viewpoint);
13183 
13184   /* function exit code */
13185   goto __pyx_L0;
13186   __pyx_L1_error:;
13187   __pyx_r = NULL;
13188   __pyx_L0:;
13189   __Pyx_RefNannyFinishContext();
13190   return __pyx_r;
13191 }
13192 
13193 static PyObject *__pyx_pf_2yt_9utilities_3lib_11amr_kdtools_2step_viewpoint(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_current, struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *__pyx_v_previous, PyObject *__pyx_v_viewpoint) {
13194   PyObject *__pyx_r = NULL;
13195   __Pyx_RefNannyDeclarations
13196   int __pyx_t_1;
13197   PyObject *__pyx_t_2 = NULL;
13198   int __pyx_t_3;
13199   PyObject *__pyx_t_4 = NULL;
13200   PyObject *__pyx_t_5 = NULL;
13201   __Pyx_RefNannySetupContext("step_viewpoint", 0);
13202   __Pyx_INCREF((PyObject *)__pyx_v_current);
13203   __Pyx_INCREF((PyObject *)__pyx_v_previous);
13204 
13205   /* "yt/utilities/lib/amr_kdtools.pyx":717
13206  *     goes to the node furthest away from viewpoint first.
13207  *     '''
13208  *     if current._kd_is_leaf() == 1: # At a leaf, move back up             # <<<<<<<<<<<<<<
13209  *         previous = current
13210  *         current = current.parent
13211  */
13212   __pyx_t_1 = ((((struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_v_current->__pyx_vtab)->_kd_is_leaf(__pyx_v_current) == 1) != 0);
13213   if (__pyx_t_1) {
13214 
13215     /* "yt/utilities/lib/amr_kdtools.pyx":718
13216  *     '''
13217  *     if current._kd_is_leaf() == 1: # At a leaf, move back up
13218  *         previous = current             # <<<<<<<<<<<<<<
13219  *         current = current.parent
13220  *     elif current.split.dim is None: # This is a dead node
13221  */
13222     __Pyx_INCREF(((PyObject *)__pyx_v_current));
13223     __Pyx_DECREF_SET(__pyx_v_previous, __pyx_v_current);
13224 
13225     /* "yt/utilities/lib/amr_kdtools.pyx":719
13226  *     if current._kd_is_leaf() == 1: # At a leaf, move back up
13227  *         previous = current
13228  *         current = current.parent             # <<<<<<<<<<<<<<
13229  *     elif current.split.dim is None: # This is a dead node
13230  *         previous = current
13231  */
13232     __pyx_t_2 = ((PyObject *)__pyx_v_current->parent);
13233     __Pyx_INCREF(__pyx_t_2);
13234     __Pyx_DECREF_SET(__pyx_v_current, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_2));
13235     __pyx_t_2 = 0;
13236 
13237     /* "yt/utilities/lib/amr_kdtools.pyx":717
13238  *     goes to the node furthest away from viewpoint first.
13239  *     '''
13240  *     if current._kd_is_leaf() == 1: # At a leaf, move back up             # <<<<<<<<<<<<<<
13241  *         previous = current
13242  *         current = current.parent
13243  */
13244     goto __pyx_L3;
13245   }
13246 
13247   /* "yt/utilities/lib/amr_kdtools.pyx":720
13248  *         previous = current
13249  *         current = current.parent
13250  *     elif current.split.dim is None: # This is a dead node             # <<<<<<<<<<<<<<
13251  *         previous = current
13252  *         current = current.parent
13253  */
13254   __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_current->split->dim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 720, __pyx_L1_error)
13255   __Pyx_GOTREF(__pyx_t_2);
13256   __pyx_t_1 = (__pyx_t_2 == Py_None);
13257   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13258   __pyx_t_3 = (__pyx_t_1 != 0);
13259   if (__pyx_t_3) {
13260 
13261     /* "yt/utilities/lib/amr_kdtools.pyx":721
13262  *         current = current.parent
13263  *     elif current.split.dim is None: # This is a dead node
13264  *         previous = current             # <<<<<<<<<<<<<<
13265  *         current = current.parent
13266  *
13267  */
13268     __Pyx_INCREF(((PyObject *)__pyx_v_current));
13269     __Pyx_DECREF_SET(__pyx_v_previous, __pyx_v_current);
13270 
13271     /* "yt/utilities/lib/amr_kdtools.pyx":722
13272  *     elif current.split.dim is None: # This is a dead node
13273  *         previous = current
13274  *         current = current.parent             # <<<<<<<<<<<<<<
13275  *
13276  *     elif current.parent is previous: # Moving down
13277  */
13278     __pyx_t_2 = ((PyObject *)__pyx_v_current->parent);
13279     __Pyx_INCREF(__pyx_t_2);
13280     __Pyx_DECREF_SET(__pyx_v_current, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_2));
13281     __pyx_t_2 = 0;
13282 
13283     /* "yt/utilities/lib/amr_kdtools.pyx":720
13284  *         previous = current
13285  *         current = current.parent
13286  *     elif current.split.dim is None: # This is a dead node             # <<<<<<<<<<<<<<
13287  *         previous = current
13288  *         current = current.parent
13289  */
13290     goto __pyx_L3;
13291   }
13292 
13293   /* "yt/utilities/lib/amr_kdtools.pyx":724
13294  *         current = current.parent
13295  *
13296  *     elif current.parent is previous: # Moving down             # <<<<<<<<<<<<<<
13297  *         previous = current
13298  *         if viewpoint[current.split.dim] <= current.split.pos:
13299  */
13300   __pyx_t_3 = (__pyx_v_current->parent == __pyx_v_previous);
13301   __pyx_t_1 = (__pyx_t_3 != 0);
13302   if (__pyx_t_1) {
13303 
13304     /* "yt/utilities/lib/amr_kdtools.pyx":725
13305  *
13306  *     elif current.parent is previous: # Moving down
13307  *         previous = current             # <<<<<<<<<<<<<<
13308  *         if viewpoint[current.split.dim] <= current.split.pos:
13309  *             if current.right is not None:
13310  */
13311     __Pyx_INCREF(((PyObject *)__pyx_v_current));
13312     __Pyx_DECREF_SET(__pyx_v_previous, __pyx_v_current);
13313 
13314     /* "yt/utilities/lib/amr_kdtools.pyx":726
13315  *     elif current.parent is previous: # Moving down
13316  *         previous = current
13317  *         if viewpoint[current.split.dim] <= current.split.pos:             # <<<<<<<<<<<<<<
13318  *             if current.right is not None:
13319  *                 current = current.right
13320  */
13321     __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_viewpoint, __pyx_v_current->split->dim, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 726, __pyx_L1_error)
13322     __Pyx_GOTREF(__pyx_t_2);
13323     __pyx_t_4 = PyFloat_FromDouble(__pyx_v_current->split->pos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 726, __pyx_L1_error)
13324     __Pyx_GOTREF(__pyx_t_4);
13325     __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 726, __pyx_L1_error)
13326     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13327     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13328     __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 726, __pyx_L1_error)
13329     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13330     if (__pyx_t_1) {
13331 
13332       /* "yt/utilities/lib/amr_kdtools.pyx":727
13333  *         previous = current
13334  *         if viewpoint[current.split.dim] <= current.split.pos:
13335  *             if current.right is not None:             # <<<<<<<<<<<<<<
13336  *                 current = current.right
13337  *             else:
13338  */
13339       __pyx_t_1 = (((PyObject *)__pyx_v_current->right) != Py_None);
13340       __pyx_t_3 = (__pyx_t_1 != 0);
13341       if (__pyx_t_3) {
13342 
13343         /* "yt/utilities/lib/amr_kdtools.pyx":728
13344  *         if viewpoint[current.split.dim] <= current.split.pos:
13345  *             if current.right is not None:
13346  *                 current = current.right             # <<<<<<<<<<<<<<
13347  *             else:
13348  *                 previous = current.right
13349  */
13350         __pyx_t_5 = ((PyObject *)__pyx_v_current->right);
13351         __Pyx_INCREF(__pyx_t_5);
13352         __Pyx_DECREF_SET(__pyx_v_current, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_5));
13353         __pyx_t_5 = 0;
13354 
13355         /* "yt/utilities/lib/amr_kdtools.pyx":727
13356  *         previous = current
13357  *         if viewpoint[current.split.dim] <= current.split.pos:
13358  *             if current.right is not None:             # <<<<<<<<<<<<<<
13359  *                 current = current.right
13360  *             else:
13361  */
13362         goto __pyx_L5;
13363       }
13364 
13365       /* "yt/utilities/lib/amr_kdtools.pyx":730
13366  *                 current = current.right
13367  *             else:
13368  *                 previous = current.right             # <<<<<<<<<<<<<<
13369  *         else:
13370  *             if current.left is not None:
13371  */
13372       /*else*/ {
13373         __pyx_t_5 = ((PyObject *)__pyx_v_current->right);
13374         __Pyx_INCREF(__pyx_t_5);
13375         __Pyx_DECREF_SET(__pyx_v_previous, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_5));
13376         __pyx_t_5 = 0;
13377       }
13378       __pyx_L5:;
13379 
13380       /* "yt/utilities/lib/amr_kdtools.pyx":726
13381  *     elif current.parent is previous: # Moving down
13382  *         previous = current
13383  *         if viewpoint[current.split.dim] <= current.split.pos:             # <<<<<<<<<<<<<<
13384  *             if current.right is not None:
13385  *                 current = current.right
13386  */
13387       goto __pyx_L4;
13388     }
13389 
13390     /* "yt/utilities/lib/amr_kdtools.pyx":732
13391  *                 previous = current.right
13392  *         else:
13393  *             if current.left is not None:             # <<<<<<<<<<<<<<
13394  *                 current = current.left
13395  *             else:
13396  */
13397     /*else*/ {
13398       __pyx_t_3 = (((PyObject *)__pyx_v_current->left) != Py_None);
13399       __pyx_t_1 = (__pyx_t_3 != 0);
13400       if (__pyx_t_1) {
13401 
13402         /* "yt/utilities/lib/amr_kdtools.pyx":733
13403  *         else:
13404  *             if current.left is not None:
13405  *                 current = current.left             # <<<<<<<<<<<<<<
13406  *             else:
13407  *                 previous = current.left
13408  */
13409         __pyx_t_5 = ((PyObject *)__pyx_v_current->left);
13410         __Pyx_INCREF(__pyx_t_5);
13411         __Pyx_DECREF_SET(__pyx_v_current, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_5));
13412         __pyx_t_5 = 0;
13413 
13414         /* "yt/utilities/lib/amr_kdtools.pyx":732
13415  *                 previous = current.right
13416  *         else:
13417  *             if current.left is not None:             # <<<<<<<<<<<<<<
13418  *                 current = current.left
13419  *             else:
13420  */
13421         goto __pyx_L6;
13422       }
13423 
13424       /* "yt/utilities/lib/amr_kdtools.pyx":735
13425  *                 current = current.left
13426  *             else:
13427  *                 previous = current.left             # <<<<<<<<<<<<<<
13428  *
13429  *     elif current.right is previous: # Moving up from right
13430  */
13431       /*else*/ {
13432         __pyx_t_5 = ((PyObject *)__pyx_v_current->left);
13433         __Pyx_INCREF(__pyx_t_5);
13434         __Pyx_DECREF_SET(__pyx_v_previous, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_5));
13435         __pyx_t_5 = 0;
13436       }
13437       __pyx_L6:;
13438     }
13439     __pyx_L4:;
13440 
13441     /* "yt/utilities/lib/amr_kdtools.pyx":724
13442  *         current = current.parent
13443  *
13444  *     elif current.parent is previous: # Moving down             # <<<<<<<<<<<<<<
13445  *         previous = current
13446  *         if viewpoint[current.split.dim] <= current.split.pos:
13447  */
13448     goto __pyx_L3;
13449   }
13450 
13451   /* "yt/utilities/lib/amr_kdtools.pyx":737
13452  *                 previous = current.left
13453  *
13454  *     elif current.right is previous: # Moving up from right             # <<<<<<<<<<<<<<
13455  *         previous = current
13456  *         if viewpoint[current.split.dim] <= current.split.pos:
13457  */
13458   __pyx_t_1 = (__pyx_v_current->right == __pyx_v_previous);
13459   __pyx_t_3 = (__pyx_t_1 != 0);
13460   if (__pyx_t_3) {
13461 
13462     /* "yt/utilities/lib/amr_kdtools.pyx":738
13463  *
13464  *     elif current.right is previous: # Moving up from right
13465  *         previous = current             # <<<<<<<<<<<<<<
13466  *         if viewpoint[current.split.dim] <= current.split.pos:
13467  *             if current.left is not None:
13468  */
13469     __Pyx_INCREF(((PyObject *)__pyx_v_current));
13470     __Pyx_DECREF_SET(__pyx_v_previous, __pyx_v_current);
13471 
13472     /* "yt/utilities/lib/amr_kdtools.pyx":739
13473  *     elif current.right is previous: # Moving up from right
13474  *         previous = current
13475  *         if viewpoint[current.split.dim] <= current.split.pos:             # <<<<<<<<<<<<<<
13476  *             if current.left is not None:
13477  *                 current = current.left
13478  */
13479     __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_viewpoint, __pyx_v_current->split->dim, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 739, __pyx_L1_error)
13480     __Pyx_GOTREF(__pyx_t_5);
13481     __pyx_t_4 = PyFloat_FromDouble(__pyx_v_current->split->pos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 739, __pyx_L1_error)
13482     __Pyx_GOTREF(__pyx_t_4);
13483     __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 739, __pyx_L1_error)
13484     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13485     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13486     __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 739, __pyx_L1_error)
13487     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13488     if (__pyx_t_3) {
13489 
13490       /* "yt/utilities/lib/amr_kdtools.pyx":740
13491  *         previous = current
13492  *         if viewpoint[current.split.dim] <= current.split.pos:
13493  *             if current.left is not None:             # <<<<<<<<<<<<<<
13494  *                 current = current.left
13495  *             else:
13496  */
13497       __pyx_t_3 = (((PyObject *)__pyx_v_current->left) != Py_None);
13498       __pyx_t_1 = (__pyx_t_3 != 0);
13499       if (__pyx_t_1) {
13500 
13501         /* "yt/utilities/lib/amr_kdtools.pyx":741
13502  *         if viewpoint[current.split.dim] <= current.split.pos:
13503  *             if current.left is not None:
13504  *                 current = current.left             # <<<<<<<<<<<<<<
13505  *             else:
13506  *                 current = current.parent
13507  */
13508         __pyx_t_2 = ((PyObject *)__pyx_v_current->left);
13509         __Pyx_INCREF(__pyx_t_2);
13510         __Pyx_DECREF_SET(__pyx_v_current, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_2));
13511         __pyx_t_2 = 0;
13512 
13513         /* "yt/utilities/lib/amr_kdtools.pyx":740
13514  *         previous = current
13515  *         if viewpoint[current.split.dim] <= current.split.pos:
13516  *             if current.left is not None:             # <<<<<<<<<<<<<<
13517  *                 current = current.left
13518  *             else:
13519  */
13520         goto __pyx_L8;
13521       }
13522 
13523       /* "yt/utilities/lib/amr_kdtools.pyx":743
13524  *                 current = current.left
13525  *             else:
13526  *                 current = current.parent             # <<<<<<<<<<<<<<
13527  *         else:
13528  *             current = current.parent
13529  */
13530       /*else*/ {
13531         __pyx_t_2 = ((PyObject *)__pyx_v_current->parent);
13532         __Pyx_INCREF(__pyx_t_2);
13533         __Pyx_DECREF_SET(__pyx_v_current, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_2));
13534         __pyx_t_2 = 0;
13535       }
13536       __pyx_L8:;
13537 
13538       /* "yt/utilities/lib/amr_kdtools.pyx":739
13539  *     elif current.right is previous: # Moving up from right
13540  *         previous = current
13541  *         if viewpoint[current.split.dim] <= current.split.pos:             # <<<<<<<<<<<<<<
13542  *             if current.left is not None:
13543  *                 current = current.left
13544  */
13545       goto __pyx_L7;
13546     }
13547 
13548     /* "yt/utilities/lib/amr_kdtools.pyx":745
13549  *                 current = current.parent
13550  *         else:
13551  *             current = current.parent             # <<<<<<<<<<<<<<
13552  *
13553  *     elif current.left is previous: # Moving up from left child
13554  */
13555     /*else*/ {
13556       __pyx_t_2 = ((PyObject *)__pyx_v_current->parent);
13557       __Pyx_INCREF(__pyx_t_2);
13558       __Pyx_DECREF_SET(__pyx_v_current, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_2));
13559       __pyx_t_2 = 0;
13560     }
13561     __pyx_L7:;
13562 
13563     /* "yt/utilities/lib/amr_kdtools.pyx":737
13564  *                 previous = current.left
13565  *
13566  *     elif current.right is previous: # Moving up from right             # <<<<<<<<<<<<<<
13567  *         previous = current
13568  *         if viewpoint[current.split.dim] <= current.split.pos:
13569  */
13570     goto __pyx_L3;
13571   }
13572 
13573   /* "yt/utilities/lib/amr_kdtools.pyx":747
13574  *             current = current.parent
13575  *
13576  *     elif current.left is previous: # Moving up from left child             # <<<<<<<<<<<<<<
13577  *         previous = current
13578  *         if viewpoint[current.split.dim] > current.split.pos:
13579  */
13580   __pyx_t_1 = (__pyx_v_current->left == __pyx_v_previous);
13581   __pyx_t_3 = (__pyx_t_1 != 0);
13582   if (__pyx_t_3) {
13583 
13584     /* "yt/utilities/lib/amr_kdtools.pyx":748
13585  *
13586  *     elif current.left is previous: # Moving up from left child
13587  *         previous = current             # <<<<<<<<<<<<<<
13588  *         if viewpoint[current.split.dim] > current.split.pos:
13589  *             if current.right is not None:
13590  */
13591     __Pyx_INCREF(((PyObject *)__pyx_v_current));
13592     __Pyx_DECREF_SET(__pyx_v_previous, __pyx_v_current);
13593 
13594     /* "yt/utilities/lib/amr_kdtools.pyx":749
13595  *     elif current.left is previous: # Moving up from left child
13596  *         previous = current
13597  *         if viewpoint[current.split.dim] > current.split.pos:             # <<<<<<<<<<<<<<
13598  *             if current.right is not None:
13599  *                 current = current.right
13600  */
13601     __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_viewpoint, __pyx_v_current->split->dim, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 749, __pyx_L1_error)
13602     __Pyx_GOTREF(__pyx_t_2);
13603     __pyx_t_4 = PyFloat_FromDouble(__pyx_v_current->split->pos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 749, __pyx_L1_error)
13604     __Pyx_GOTREF(__pyx_t_4);
13605     __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 749, __pyx_L1_error)
13606     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13607     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13608     __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 749, __pyx_L1_error)
13609     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13610     if (__pyx_t_3) {
13611 
13612       /* "yt/utilities/lib/amr_kdtools.pyx":750
13613  *         previous = current
13614  *         if viewpoint[current.split.dim] > current.split.pos:
13615  *             if current.right is not None:             # <<<<<<<<<<<<<<
13616  *                 current = current.right
13617  *             else:
13618  */
13619       __pyx_t_3 = (((PyObject *)__pyx_v_current->right) != Py_None);
13620       __pyx_t_1 = (__pyx_t_3 != 0);
13621       if (__pyx_t_1) {
13622 
13623         /* "yt/utilities/lib/amr_kdtools.pyx":751
13624  *         if viewpoint[current.split.dim] > current.split.pos:
13625  *             if current.right is not None:
13626  *                 current = current.right             # <<<<<<<<<<<<<<
13627  *             else:
13628  *                 current = current.parent
13629  */
13630         __pyx_t_5 = ((PyObject *)__pyx_v_current->right);
13631         __Pyx_INCREF(__pyx_t_5);
13632         __Pyx_DECREF_SET(__pyx_v_current, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_5));
13633         __pyx_t_5 = 0;
13634 
13635         /* "yt/utilities/lib/amr_kdtools.pyx":750
13636  *         previous = current
13637  *         if viewpoint[current.split.dim] > current.split.pos:
13638  *             if current.right is not None:             # <<<<<<<<<<<<<<
13639  *                 current = current.right
13640  *             else:
13641  */
13642         goto __pyx_L10;
13643       }
13644 
13645       /* "yt/utilities/lib/amr_kdtools.pyx":753
13646  *                 current = current.right
13647  *             else:
13648  *                 current = current.parent             # <<<<<<<<<<<<<<
13649  *         else:
13650  *             current = current.parent
13651  */
13652       /*else*/ {
13653         __pyx_t_5 = ((PyObject *)__pyx_v_current->parent);
13654         __Pyx_INCREF(__pyx_t_5);
13655         __Pyx_DECREF_SET(__pyx_v_current, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_5));
13656         __pyx_t_5 = 0;
13657       }
13658       __pyx_L10:;
13659 
13660       /* "yt/utilities/lib/amr_kdtools.pyx":749
13661  *     elif current.left is previous: # Moving up from left child
13662  *         previous = current
13663  *         if viewpoint[current.split.dim] > current.split.pos:             # <<<<<<<<<<<<<<
13664  *             if current.right is not None:
13665  *                 current = current.right
13666  */
13667       goto __pyx_L9;
13668     }
13669 
13670     /* "yt/utilities/lib/amr_kdtools.pyx":755
13671  *                 current = current.parent
13672  *         else:
13673  *             current = current.parent             # <<<<<<<<<<<<<<
13674  *
13675  *     return current, previous
13676  */
13677     /*else*/ {
13678       __pyx_t_5 = ((PyObject *)__pyx_v_current->parent);
13679       __Pyx_INCREF(__pyx_t_5);
13680       __Pyx_DECREF_SET(__pyx_v_current, ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)__pyx_t_5));
13681       __pyx_t_5 = 0;
13682     }
13683     __pyx_L9:;
13684 
13685     /* "yt/utilities/lib/amr_kdtools.pyx":747
13686  *             current = current.parent
13687  *
13688  *     elif current.left is previous: # Moving up from left child             # <<<<<<<<<<<<<<
13689  *         previous = current
13690  *         if viewpoint[current.split.dim] > current.split.pos:
13691  */
13692   }
13693   __pyx_L3:;
13694 
13695   /* "yt/utilities/lib/amr_kdtools.pyx":757
13696  *             current = current.parent
13697  *
13698  *     return current, previous             # <<<<<<<<<<<<<<
13699  *
13700  * @cython.boundscheck(False)
13701  */
13702   __Pyx_XDECREF(__pyx_r);
13703   __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 757, __pyx_L1_error)
13704   __Pyx_GOTREF(__pyx_t_5);
13705   __Pyx_INCREF(((PyObject *)__pyx_v_current));
13706   __Pyx_GIVEREF(((PyObject *)__pyx_v_current));
13707   PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_current));
13708   __Pyx_INCREF(((PyObject *)__pyx_v_previous));
13709   __Pyx_GIVEREF(((PyObject *)__pyx_v_previous));
13710   PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_previous));
13711   __pyx_r = __pyx_t_5;
13712   __pyx_t_5 = 0;
13713   goto __pyx_L0;
13714 
13715   /* "yt/utilities/lib/amr_kdtools.pyx":710
13716  *     return current, previous
13717  *
13718  * def step_viewpoint(Node current,             # <<<<<<<<<<<<<<
13719  *                    Node previous,
13720  *                    viewpoint):
13721  */
13722 
13723   /* function exit code */
13724   __pyx_L1_error:;
13725   __Pyx_XDECREF(__pyx_t_2);
13726   __Pyx_XDECREF(__pyx_t_4);
13727   __Pyx_XDECREF(__pyx_t_5);
13728   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.step_viewpoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
13729   __pyx_r = NULL;
13730   __pyx_L0:;
13731   __Pyx_XDECREF((PyObject *)__pyx_v_current);
13732   __Pyx_XDECREF((PyObject *)__pyx_v_previous);
13733   __Pyx_XGIVEREF(__pyx_r);
13734   __Pyx_RefNannyFinishContext();
13735   return __pyx_r;
13736 }
13737 
13738 /* "yt/utilities/lib/amr_kdtools.pyx":762
13739  * @cython.wraparound(False)
13740  * @cython.cdivision(True)
13741  * cdef kdtree_get_choices(int n_grids,             # <<<<<<<<<<<<<<
13742  *                         np.float64_t[:,:,:] data,
13743  *                         np.float64_t[:] l_corner,
13744  */
13745 
13746 static PyObject *__pyx_f_2yt_9utilities_3lib_11amr_kdtools_kdtree_get_choices(int __pyx_v_n_grids, __Pyx_memviewslice __pyx_v_data, __Pyx_memviewslice __pyx_v_l_corner, __Pyx_memviewslice __pyx_v_r_corner, __Pyx_memviewslice __pyx_v_less_ids, __Pyx_memviewslice __pyx_v_greater_ids) {
13747   int __pyx_v_i;
13748   int __pyx_v_j;
13749   int __pyx_v_k;
13750   int __pyx_v_dim;
13751   int __pyx_v_n_unique;
13752   int __pyx_v_best_dim;
13753   int __pyx_v_my_split;
13754   __pyx_t_5numpy_float64_t __pyx_v_split;
13755   __Pyx_memviewslice __pyx_v_uniquedims = { 0, 0, { 0 }, { 0 }, { 0 } };
13756   __Pyx_memviewslice __pyx_v_uniques = { 0, 0, { 0 }, { 0 }, { 0 } };
13757   long __pyx_v_my_max;
13758   long __pyx_v_skipit;
13759   PyArrayObject *__pyx_v_tarr = 0;
13760   int __pyx_v_nless;
13761   int __pyx_v_ngreater;
13762   __Pyx_LocalBuf_ND __pyx_pybuffernd_tarr;
13763   __Pyx_Buffer __pyx_pybuffer_tarr;
13764   PyObject *__pyx_r = NULL;
13765   __Pyx_RefNannyDeclarations
13766   PyObject *__pyx_t_1 = NULL;
13767   PyObject *__pyx_t_2 = NULL;
13768   PyObject *__pyx_t_3 = NULL;
13769   __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
13770   int __pyx_t_5;
13771   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
13772   int __pyx_t_7;
13773   int __pyx_t_8;
13774   int __pyx_t_9;
13775   int __pyx_t_10;
13776   int __pyx_t_11;
13777   Py_ssize_t __pyx_t_12;
13778   Py_ssize_t __pyx_t_13;
13779   Py_ssize_t __pyx_t_14;
13780   Py_ssize_t __pyx_t_15;
13781   int __pyx_t_16;
13782   Py_ssize_t __pyx_t_17;
13783   Py_ssize_t __pyx_t_18;
13784   Py_ssize_t __pyx_t_19;
13785   Py_ssize_t __pyx_t_20;
13786   int __pyx_t_21;
13787   int __pyx_t_22;
13788   int __pyx_t_23;
13789   Py_ssize_t __pyx_t_24;
13790   Py_ssize_t __pyx_t_25;
13791   Py_ssize_t __pyx_t_26;
13792   Py_ssize_t __pyx_t_27;
13793   Py_ssize_t __pyx_t_28;
13794   Py_ssize_t __pyx_t_29;
13795   Py_ssize_t __pyx_t_30;
13796   Py_ssize_t __pyx_t_31;
13797   PyObject *__pyx_t_32 = NULL;
13798   PyArrayObject *__pyx_t_33 = NULL;
13799   long __pyx_t_34;
13800   long __pyx_t_35;
13801   Py_ssize_t __pyx_t_36;
13802   Py_ssize_t __pyx_t_37;
13803   Py_ssize_t __pyx_t_38;
13804   Py_ssize_t __pyx_t_39;
13805   Py_ssize_t __pyx_t_40;
13806   Py_ssize_t __pyx_t_41;
13807   Py_ssize_t __pyx_t_42;
13808   Py_ssize_t __pyx_t_43;
13809   Py_ssize_t __pyx_t_44;
13810   Py_ssize_t __pyx_t_45;
13811   Py_ssize_t __pyx_t_46;
13812   Py_ssize_t __pyx_t_47;
13813   Py_ssize_t __pyx_t_48;
13814   Py_ssize_t __pyx_t_49;
13815   PyObject *__pyx_t_50 = NULL;
13816   __Pyx_RefNannySetupContext("kdtree_get_choices", 0);
13817   __pyx_pybuffer_tarr.pybuffer.buf = NULL;
13818   __pyx_pybuffer_tarr.refcount = 0;
13819   __pyx_pybuffernd_tarr.data = NULL;
13820   __pyx_pybuffernd_tarr.rcbuffer = &__pyx_pybuffer_tarr;
13821 
13822   /* "yt/utilities/lib/amr_kdtools.pyx":773
13823  *     cdef np.float64_t[:,:] uniquedims
13824  *     cdef np.float64_t[:] uniques
13825  *     uniquedims = cvarray(format="d", shape=(3, 2*n_grids), itemsize=sizeof(np.float64_t))             # <<<<<<<<<<<<<<
13826  *     my_max = 0
13827  *     my_split = 0
13828  */
13829   __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 773, __pyx_L1_error)
13830   __Pyx_GOTREF(__pyx_t_1);
13831   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 773, __pyx_L1_error)
13832   __pyx_t_2 = __Pyx_PyInt_From_long((2 * __pyx_v_n_grids)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 773, __pyx_L1_error)
13833   __Pyx_GOTREF(__pyx_t_2);
13834   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 773, __pyx_L1_error)
13835   __Pyx_GOTREF(__pyx_t_3);
13836   __Pyx_INCREF(__pyx_int_3);
13837   __Pyx_GIVEREF(__pyx_int_3);
13838   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_3);
13839   __Pyx_GIVEREF(__pyx_t_2);
13840   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
13841   __pyx_t_2 = 0;
13842   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_shape, __pyx_t_3) < 0) __PYX_ERR(0, 773, __pyx_L1_error)
13843   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13844   __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(__pyx_t_5numpy_float64_t))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 773, __pyx_L1_error)
13845   __Pyx_GOTREF(__pyx_t_3);
13846   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_itemsize, __pyx_t_3) < 0) __PYX_ERR(0, 773, __pyx_L1_error)
13847   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13848   __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 773, __pyx_L1_error)
13849   __Pyx_GOTREF(__pyx_t_3);
13850   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13851   __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 773, __pyx_L1_error)
13852   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13853   __pyx_v_uniquedims = __pyx_t_4;
13854   __pyx_t_4.memview = NULL;
13855   __pyx_t_4.data = NULL;
13856 
13857   /* "yt/utilities/lib/amr_kdtools.pyx":774
13858  *     cdef np.float64_t[:] uniques
13859  *     uniquedims = cvarray(format="d", shape=(3, 2*n_grids), itemsize=sizeof(np.float64_t))
13860  *     my_max = 0             # <<<<<<<<<<<<<<
13861  *     my_split = 0
13862  *     best_dim = -1
13863  */
13864   __pyx_v_my_max = 0;
13865 
13866   /* "yt/utilities/lib/amr_kdtools.pyx":775
13867  *     uniquedims = cvarray(format="d", shape=(3, 2*n_grids), itemsize=sizeof(np.float64_t))
13868  *     my_max = 0
13869  *     my_split = 0             # <<<<<<<<<<<<<<
13870  *     best_dim = -1
13871  *     for dim in range(3):
13872  */
13873   __pyx_v_my_split = 0;
13874 
13875   /* "yt/utilities/lib/amr_kdtools.pyx":776
13876  *     my_max = 0
13877  *     my_split = 0
13878  *     best_dim = -1             # <<<<<<<<<<<<<<
13879  *     for dim in range(3):
13880  *         n_unique = 0
13881  */
13882   __pyx_v_best_dim = -1;
13883 
13884   /* "yt/utilities/lib/amr_kdtools.pyx":777
13885  *     my_split = 0
13886  *     best_dim = -1
13887  *     for dim in range(3):             # <<<<<<<<<<<<<<
13888  *         n_unique = 0
13889  *         uniques = uniquedims[dim]
13890  */
13891   for (__pyx_t_5 = 0; __pyx_t_5 < 3; __pyx_t_5+=1) {
13892     __pyx_v_dim = __pyx_t_5;
13893 
13894     /* "yt/utilities/lib/amr_kdtools.pyx":778
13895  *     best_dim = -1
13896  *     for dim in range(3):
13897  *         n_unique = 0             # <<<<<<<<<<<<<<
13898  *         uniques = uniquedims[dim]
13899  *         for i in range(n_grids):
13900  */
13901     __pyx_v_n_unique = 0;
13902 
13903     /* "yt/utilities/lib/amr_kdtools.pyx":779
13904  *     for dim in range(3):
13905  *         n_unique = 0
13906  *         uniques = uniquedims[dim]             # <<<<<<<<<<<<<<
13907  *         for i in range(n_grids):
13908  *             # Check for disqualification
13909  */
13910     __pyx_t_6.data = __pyx_v_uniquedims.data;
13911     __pyx_t_6.memview = __pyx_v_uniquedims.memview;
13912     __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
13913     {
13914     Py_ssize_t __pyx_tmp_idx = __pyx_v_dim;
13915     Py_ssize_t __pyx_tmp_stride = __pyx_v_uniquedims.strides[0];
13916         if ((0)) __PYX_ERR(0, 779, __pyx_L1_error)
13917         __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride;
13918 }
13919 
13920 __pyx_t_6.shape[0] = __pyx_v_uniquedims.shape[1];
13921 __pyx_t_6.strides[0] = __pyx_v_uniquedims.strides[1];
13922     __pyx_t_6.suboffsets[0] = -1;
13923 
13924 __PYX_XDEC_MEMVIEW(&__pyx_v_uniques, 1);
13925     __pyx_v_uniques = __pyx_t_6;
13926     __pyx_t_6.memview = NULL;
13927     __pyx_t_6.data = NULL;
13928 
13929     /* "yt/utilities/lib/amr_kdtools.pyx":780
13930  *         n_unique = 0
13931  *         uniques = uniquedims[dim]
13932  *         for i in range(n_grids):             # <<<<<<<<<<<<<<
13933  *             # Check for disqualification
13934  *             for j in range(2):
13935  */
13936     __pyx_t_7 = __pyx_v_n_grids;
13937     __pyx_t_8 = __pyx_t_7;
13938     for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
13939       __pyx_v_i = __pyx_t_9;
13940 
13941       /* "yt/utilities/lib/amr_kdtools.pyx":782
13942  *         for i in range(n_grids):
13943  *             # Check for disqualification
13944  *             for j in range(2):             # <<<<<<<<<<<<<<
13945  *                 # print("Checking against", i,j,dim,data[i,j,dim])
13946  *                 if not (l_corner[dim] < data[i][j][dim] and
13947  */
13948       for (__pyx_t_10 = 0; __pyx_t_10 < 2; __pyx_t_10+=1) {
13949         __pyx_v_j = __pyx_t_10;
13950 
13951         /* "yt/utilities/lib/amr_kdtools.pyx":784
13952  *             for j in range(2):
13953  *                 # print("Checking against", i,j,dim,data[i,j,dim])
13954  *                 if not (l_corner[dim] < data[i][j][dim] and             # <<<<<<<<<<<<<<
13955  *                         data[i][j][dim] < r_corner[dim]):
13956  *                     # print("Skipping ", data[i,j,dim], l_corner[dim], r_corner[dim])
13957  */
13958         __pyx_t_12 = __pyx_v_dim;
13959         __pyx_t_13 = __pyx_v_i;
13960         __pyx_t_14 = __pyx_v_j;
13961         __pyx_t_15 = __pyx_v_dim;
13962         __pyx_t_16 = (((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_l_corner.data + __pyx_t_12 * __pyx_v_l_corner.strides[0]) ))) < (*((__pyx_t_5numpy_float64_t *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_data.data + __pyx_t_13 * __pyx_v_data.strides[0]) ) + __pyx_t_14 * __pyx_v_data.strides[1]) ) + __pyx_t_15 * __pyx_v_data.strides[2]) )))) != 0);
13963         if (__pyx_t_16) {
13964         } else {
13965           __pyx_t_11 = __pyx_t_16;
13966           goto __pyx_L10_bool_binop_done;
13967         }
13968 
13969         /* "yt/utilities/lib/amr_kdtools.pyx":785
13970  *                 # print("Checking against", i,j,dim,data[i,j,dim])
13971  *                 if not (l_corner[dim] < data[i][j][dim] and
13972  *                         data[i][j][dim] < r_corner[dim]):             # <<<<<<<<<<<<<<
13973  *                     # print("Skipping ", data[i,j,dim], l_corner[dim], r_corner[dim])
13974  *                     continue
13975  */
13976         __pyx_t_17 = __pyx_v_i;
13977         __pyx_t_18 = __pyx_v_j;
13978         __pyx_t_19 = __pyx_v_dim;
13979         __pyx_t_20 = __pyx_v_dim;
13980         __pyx_t_16 = (((*((__pyx_t_5numpy_float64_t *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_data.data + __pyx_t_17 * __pyx_v_data.strides[0]) ) + __pyx_t_18 * __pyx_v_data.strides[1]) ) + __pyx_t_19 * __pyx_v_data.strides[2]) ))) < (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_r_corner.data + __pyx_t_20 * __pyx_v_r_corner.strides[0]) )))) != 0);
13981         __pyx_t_11 = __pyx_t_16;
13982         __pyx_L10_bool_binop_done:;
13983 
13984         /* "yt/utilities/lib/amr_kdtools.pyx":784
13985  *             for j in range(2):
13986  *                 # print("Checking against", i,j,dim,data[i,j,dim])
13987  *                 if not (l_corner[dim] < data[i][j][dim] and             # <<<<<<<<<<<<<<
13988  *                         data[i][j][dim] < r_corner[dim]):
13989  *                     # print("Skipping ", data[i,j,dim], l_corner[dim], r_corner[dim])
13990  */
13991         __pyx_t_16 = ((!__pyx_t_11) != 0);
13992         if (__pyx_t_16) {
13993 
13994           /* "yt/utilities/lib/amr_kdtools.pyx":787
13995  *                         data[i][j][dim] < r_corner[dim]):
13996  *                     # print("Skipping ", data[i,j,dim], l_corner[dim], r_corner[dim])
13997  *                     continue             # <<<<<<<<<<<<<<
13998  *                 skipit = 0
13999  *                 # Add our left ...
14000  */
14001           goto __pyx_L7_continue;
14002 
14003           /* "yt/utilities/lib/amr_kdtools.pyx":784
14004  *             for j in range(2):
14005  *                 # print("Checking against", i,j,dim,data[i,j,dim])
14006  *                 if not (l_corner[dim] < data[i][j][dim] and             # <<<<<<<<<<<<<<
14007  *                         data[i][j][dim] < r_corner[dim]):
14008  *                     # print("Skipping ", data[i,j,dim], l_corner[dim], r_corner[dim])
14009  */
14010         }
14011 
14012         /* "yt/utilities/lib/amr_kdtools.pyx":788
14013  *                     # print("Skipping ", data[i,j,dim], l_corner[dim], r_corner[dim])
14014  *                     continue
14015  *                 skipit = 0             # <<<<<<<<<<<<<<
14016  *                 # Add our left ...
14017  *                 for k in range(n_unique):
14018  */
14019         __pyx_v_skipit = 0;
14020 
14021         /* "yt/utilities/lib/amr_kdtools.pyx":790
14022  *                 skipit = 0
14023  *                 # Add our left ...
14024  *                 for k in range(n_unique):             # <<<<<<<<<<<<<<
14025  *                     if uniques[k] == data[i][j][dim]:
14026  *                         skipit = 1
14027  */
14028         __pyx_t_21 = __pyx_v_n_unique;
14029         __pyx_t_22 = __pyx_t_21;
14030         for (__pyx_t_23 = 0; __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
14031           __pyx_v_k = __pyx_t_23;
14032 
14033           /* "yt/utilities/lib/amr_kdtools.pyx":791
14034  *                 # Add our left ...
14035  *                 for k in range(n_unique):
14036  *                     if uniques[k] == data[i][j][dim]:             # <<<<<<<<<<<<<<
14037  *                         skipit = 1
14038  *                         # print("Identified", uniques[k], data[i,j,dim], n_unique)
14039  */
14040           __pyx_t_24 = __pyx_v_k;
14041           __pyx_t_25 = __pyx_v_i;
14042           __pyx_t_26 = __pyx_v_j;
14043           __pyx_t_27 = __pyx_v_dim;
14044           __pyx_t_16 = (((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_uniques.data + __pyx_t_24 * __pyx_v_uniques.strides[0]) ))) == (*((__pyx_t_5numpy_float64_t *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_data.data + __pyx_t_25 * __pyx_v_data.strides[0]) ) + __pyx_t_26 * __pyx_v_data.strides[1]) ) + __pyx_t_27 * __pyx_v_data.strides[2]) )))) != 0);
14045           if (__pyx_t_16) {
14046 
14047             /* "yt/utilities/lib/amr_kdtools.pyx":792
14048  *                 for k in range(n_unique):
14049  *                     if uniques[k] == data[i][j][dim]:
14050  *                         skipit = 1             # <<<<<<<<<<<<<<
14051  *                         # print("Identified", uniques[k], data[i,j,dim], n_unique)
14052  *                         break
14053  */
14054             __pyx_v_skipit = 1;
14055 
14056             /* "yt/utilities/lib/amr_kdtools.pyx":794
14057  *                         skipit = 1
14058  *                         # print("Identified", uniques[k], data[i,j,dim], n_unique)
14059  *                         break             # <<<<<<<<<<<<<<
14060  *                 if skipit == 0:
14061  *                     uniques[n_unique] = data[i][j][dim]
14062  */
14063             goto __pyx_L13_break;
14064 
14065             /* "yt/utilities/lib/amr_kdtools.pyx":791
14066  *                 # Add our left ...
14067  *                 for k in range(n_unique):
14068  *                     if uniques[k] == data[i][j][dim]:             # <<<<<<<<<<<<<<
14069  *                         skipit = 1
14070  *                         # print("Identified", uniques[k], data[i,j,dim], n_unique)
14071  */
14072           }
14073         }
14074         __pyx_L13_break:;
14075 
14076         /* "yt/utilities/lib/amr_kdtools.pyx":795
14077  *                         # print("Identified", uniques[k], data[i,j,dim], n_unique)
14078  *                         break
14079  *                 if skipit == 0:             # <<<<<<<<<<<<<<
14080  *                     uniques[n_unique] = data[i][j][dim]
14081  *                     n_unique += 1
14082  */
14083         __pyx_t_16 = ((__pyx_v_skipit == 0) != 0);
14084         if (__pyx_t_16) {
14085 
14086           /* "yt/utilities/lib/amr_kdtools.pyx":796
14087  *                         break
14088  *                 if skipit == 0:
14089  *                     uniques[n_unique] = data[i][j][dim]             # <<<<<<<<<<<<<<
14090  *                     n_unique += 1
14091  *         if n_unique > my_max:
14092  */
14093           __pyx_t_28 = __pyx_v_i;
14094           __pyx_t_29 = __pyx_v_j;
14095           __pyx_t_30 = __pyx_v_dim;
14096           __pyx_t_31 = __pyx_v_n_unique;
14097           *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_uniques.data + __pyx_t_31 * __pyx_v_uniques.strides[0]) )) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_data.data + __pyx_t_28 * __pyx_v_data.strides[0]) ) + __pyx_t_29 * __pyx_v_data.strides[1]) ) + __pyx_t_30 * __pyx_v_data.strides[2]) )));
14098 
14099           /* "yt/utilities/lib/amr_kdtools.pyx":797
14100  *                 if skipit == 0:
14101  *                     uniques[n_unique] = data[i][j][dim]
14102  *                     n_unique += 1             # <<<<<<<<<<<<<<
14103  *         if n_unique > my_max:
14104  *             best_dim = dim
14105  */
14106           __pyx_v_n_unique = (__pyx_v_n_unique + 1);
14107 
14108           /* "yt/utilities/lib/amr_kdtools.pyx":795
14109  *                         # print("Identified", uniques[k], data[i,j,dim], n_unique)
14110  *                         break
14111  *                 if skipit == 0:             # <<<<<<<<<<<<<<
14112  *                     uniques[n_unique] = data[i][j][dim]
14113  *                     n_unique += 1
14114  */
14115         }
14116         __pyx_L7_continue:;
14117       }
14118     }
14119 
14120     /* "yt/utilities/lib/amr_kdtools.pyx":798
14121  *                     uniques[n_unique] = data[i][j][dim]
14122  *                     n_unique += 1
14123  *         if n_unique > my_max:             # <<<<<<<<<<<<<<
14124  *             best_dim = dim
14125  *             my_max = n_unique
14126  */
14127     __pyx_t_16 = ((__pyx_v_n_unique > __pyx_v_my_max) != 0);
14128     if (__pyx_t_16) {
14129 
14130       /* "yt/utilities/lib/amr_kdtools.pyx":799
14131  *                     n_unique += 1
14132  *         if n_unique > my_max:
14133  *             best_dim = dim             # <<<<<<<<<<<<<<
14134  *             my_max = n_unique
14135  *             my_split = (n_unique-1)/2
14136  */
14137       __pyx_v_best_dim = __pyx_v_dim;
14138 
14139       /* "yt/utilities/lib/amr_kdtools.pyx":800
14140  *         if n_unique > my_max:
14141  *             best_dim = dim
14142  *             my_max = n_unique             # <<<<<<<<<<<<<<
14143  *             my_split = (n_unique-1)/2
14144  *     if best_dim == -1:
14145  */
14146       __pyx_v_my_max = __pyx_v_n_unique;
14147 
14148       /* "yt/utilities/lib/amr_kdtools.pyx":801
14149  *             best_dim = dim
14150  *             my_max = n_unique
14151  *             my_split = (n_unique-1)/2             # <<<<<<<<<<<<<<
14152  *     if best_dim == -1:
14153  *         return -1, 0, 0, 0
14154  */
14155       __pyx_v_my_split = ((__pyx_v_n_unique - 1) / 2);
14156 
14157       /* "yt/utilities/lib/amr_kdtools.pyx":798
14158  *                     uniques[n_unique] = data[i][j][dim]
14159  *                     n_unique += 1
14160  *         if n_unique > my_max:             # <<<<<<<<<<<<<<
14161  *             best_dim = dim
14162  *             my_max = n_unique
14163  */
14164     }
14165   }
14166 
14167   /* "yt/utilities/lib/amr_kdtools.pyx":802
14168  *             my_max = n_unique
14169  *             my_split = (n_unique-1)/2
14170  *     if best_dim == -1:             # <<<<<<<<<<<<<<
14171  *         return -1, 0, 0, 0
14172  *     # I recognize how lame this is.
14173  */
14174   __pyx_t_16 = ((__pyx_v_best_dim == -1L) != 0);
14175   if (__pyx_t_16) {
14176 
14177     /* "yt/utilities/lib/amr_kdtools.pyx":803
14178  *             my_split = (n_unique-1)/2
14179  *     if best_dim == -1:
14180  *         return -1, 0, 0, 0             # <<<<<<<<<<<<<<
14181  *     # I recognize how lame this is.
14182  *     cdef np.ndarray[np.float64_t, ndim=1] tarr = np.empty(my_max, dtype='float64')
14183  */
14184     __Pyx_XDECREF(__pyx_r);
14185     __Pyx_INCREF(__pyx_tuple__6);
14186     __pyx_r = __pyx_tuple__6;
14187     goto __pyx_L0;
14188 
14189     /* "yt/utilities/lib/amr_kdtools.pyx":802
14190  *             my_max = n_unique
14191  *             my_split = (n_unique-1)/2
14192  *     if best_dim == -1:             # <<<<<<<<<<<<<<
14193  *         return -1, 0, 0, 0
14194  *     # I recognize how lame this is.
14195  */
14196   }
14197 
14198   /* "yt/utilities/lib/amr_kdtools.pyx":805
14199  *         return -1, 0, 0, 0
14200  *     # I recognize how lame this is.
14201  *     cdef np.ndarray[np.float64_t, ndim=1] tarr = np.empty(my_max, dtype='float64')             # <<<<<<<<<<<<<<
14202  *     for i in range(my_max):
14203  *         # print("Setting tarr: ", i, uniquedims[best_dim][i])
14204  */
14205   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 805, __pyx_L1_error)
14206   __Pyx_GOTREF(__pyx_t_3);
14207   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 805, __pyx_L1_error)
14208   __Pyx_GOTREF(__pyx_t_1);
14209   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14210   __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_my_max); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 805, __pyx_L1_error)
14211   __Pyx_GOTREF(__pyx_t_3);
14212   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 805, __pyx_L1_error)
14213   __Pyx_GOTREF(__pyx_t_2);
14214   __Pyx_GIVEREF(__pyx_t_3);
14215   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
14216   __pyx_t_3 = 0;
14217   __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 805, __pyx_L1_error)
14218   __Pyx_GOTREF(__pyx_t_3);
14219   if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(0, 805, __pyx_L1_error)
14220   __pyx_t_32 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_32)) __PYX_ERR(0, 805, __pyx_L1_error)
14221   __Pyx_GOTREF(__pyx_t_32);
14222   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14223   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14224   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14225   if (!(likely(((__pyx_t_32) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_32, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 805, __pyx_L1_error)
14226   __pyx_t_33 = ((PyArrayObject *)__pyx_t_32);
14227   {
14228     __Pyx_BufFmt_StackElem __pyx_stack[1];
14229     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_tarr.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
14230       __pyx_v_tarr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_tarr.rcbuffer->pybuffer.buf = NULL;
14231       __PYX_ERR(0, 805, __pyx_L1_error)
14232     } else {__pyx_pybuffernd_tarr.diminfo[0].strides = __pyx_pybuffernd_tarr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_tarr.diminfo[0].shape = __pyx_pybuffernd_tarr.rcbuffer->pybuffer.shape[0];
14233     }
14234   }
14235   __pyx_t_33 = 0;
14236   __pyx_v_tarr = ((PyArrayObject *)__pyx_t_32);
14237   __pyx_t_32 = 0;
14238 
14239   /* "yt/utilities/lib/amr_kdtools.pyx":806
14240  *     # I recognize how lame this is.
14241  *     cdef np.ndarray[np.float64_t, ndim=1] tarr = np.empty(my_max, dtype='float64')
14242  *     for i in range(my_max):             # <<<<<<<<<<<<<<
14243  *         # print("Setting tarr: ", i, uniquedims[best_dim][i])
14244  *         tarr[i] = uniquedims[best_dim][i]
14245  */
14246   __pyx_t_34 = __pyx_v_my_max;
14247   __pyx_t_35 = __pyx_t_34;
14248   for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_35; __pyx_t_5+=1) {
14249     __pyx_v_i = __pyx_t_5;
14250 
14251     /* "yt/utilities/lib/amr_kdtools.pyx":808
14252  *     for i in range(my_max):
14253  *         # print("Setting tarr: ", i, uniquedims[best_dim][i])
14254  *         tarr[i] = uniquedims[best_dim][i]             # <<<<<<<<<<<<<<
14255  *     tarr.sort()
14256  *     split = tarr[my_split]
14257  */
14258     __pyx_t_36 = __pyx_v_best_dim;
14259     __pyx_t_37 = __pyx_v_i;
14260     __pyx_t_38 = __pyx_v_i;
14261     *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_tarr.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_tarr.diminfo[0].strides) = (*((__pyx_t_5numpy_float64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_uniquedims.data + __pyx_t_36 * __pyx_v_uniquedims.strides[0]) ) + __pyx_t_37 * __pyx_v_uniquedims.strides[1]) )));
14262   }
14263 
14264   /* "yt/utilities/lib/amr_kdtools.pyx":809
14265  *         # print("Setting tarr: ", i, uniquedims[best_dim][i])
14266  *         tarr[i] = uniquedims[best_dim][i]
14267  *     tarr.sort()             # <<<<<<<<<<<<<<
14268  *     split = tarr[my_split]
14269  *     cdef int nless=0, ngreater=0
14270  */
14271   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_tarr), __pyx_n_s_sort); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 809, __pyx_L1_error)
14272   __Pyx_GOTREF(__pyx_t_3);
14273   __pyx_t_2 = NULL;
14274   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
14275     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
14276     if (likely(__pyx_t_2)) {
14277       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
14278       __Pyx_INCREF(__pyx_t_2);
14279       __Pyx_INCREF(function);
14280       __Pyx_DECREF_SET(__pyx_t_3, function);
14281     }
14282   }
14283   __pyx_t_32 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
14284   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
14285   if (unlikely(!__pyx_t_32)) __PYX_ERR(0, 809, __pyx_L1_error)
14286   __Pyx_GOTREF(__pyx_t_32);
14287   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14288   __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
14289 
14290   /* "yt/utilities/lib/amr_kdtools.pyx":810
14291  *         tarr[i] = uniquedims[best_dim][i]
14292  *     tarr.sort()
14293  *     split = tarr[my_split]             # <<<<<<<<<<<<<<
14294  *     cdef int nless=0, ngreater=0
14295  *     for i in range(n_grids):
14296  */
14297   __pyx_t_39 = __pyx_v_my_split;
14298   __pyx_v_split = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_tarr.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_tarr.diminfo[0].strides));
14299 
14300   /* "yt/utilities/lib/amr_kdtools.pyx":811
14301  *     tarr.sort()
14302  *     split = tarr[my_split]
14303  *     cdef int nless=0, ngreater=0             # <<<<<<<<<<<<<<
14304  *     for i in range(n_grids):
14305  *         if data[i][0][best_dim] < split:
14306  */
14307   __pyx_v_nless = 0;
14308   __pyx_v_ngreater = 0;
14309 
14310   /* "yt/utilities/lib/amr_kdtools.pyx":812
14311  *     split = tarr[my_split]
14312  *     cdef int nless=0, ngreater=0
14313  *     for i in range(n_grids):             # <<<<<<<<<<<<<<
14314  *         if data[i][0][best_dim] < split:
14315  *             less_ids[i] = 1
14316  */
14317   __pyx_t_5 = __pyx_v_n_grids;
14318   __pyx_t_7 = __pyx_t_5;
14319   for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
14320     __pyx_v_i = __pyx_t_8;
14321 
14322     /* "yt/utilities/lib/amr_kdtools.pyx":813
14323  *     cdef int nless=0, ngreater=0
14324  *     for i in range(n_grids):
14325  *         if data[i][0][best_dim] < split:             # <<<<<<<<<<<<<<
14326  *             less_ids[i] = 1
14327  *             nless += 1
14328  */
14329     __pyx_t_40 = __pyx_v_i;
14330     __pyx_t_41 = 0;
14331     __pyx_t_42 = __pyx_v_best_dim;
14332     __pyx_t_16 = (((*((__pyx_t_5numpy_float64_t *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_data.data + __pyx_t_40 * __pyx_v_data.strides[0]) ) + __pyx_t_41 * __pyx_v_data.strides[1]) ) + __pyx_t_42 * __pyx_v_data.strides[2]) ))) < __pyx_v_split) != 0);
14333     if (__pyx_t_16) {
14334 
14335       /* "yt/utilities/lib/amr_kdtools.pyx":814
14336  *     for i in range(n_grids):
14337  *         if data[i][0][best_dim] < split:
14338  *             less_ids[i] = 1             # <<<<<<<<<<<<<<
14339  *             nless += 1
14340  *         else:
14341  */
14342       __pyx_t_43 = __pyx_v_i;
14343       *((__pyx_t_5numpy_uint8_t *) ( /* dim=0 */ (__pyx_v_less_ids.data + __pyx_t_43 * __pyx_v_less_ids.strides[0]) )) = 1;
14344 
14345       /* "yt/utilities/lib/amr_kdtools.pyx":815
14346  *         if data[i][0][best_dim] < split:
14347  *             less_ids[i] = 1
14348  *             nless += 1             # <<<<<<<<<<<<<<
14349  *         else:
14350  *             less_ids[i] = 0
14351  */
14352       __pyx_v_nless = (__pyx_v_nless + 1);
14353 
14354       /* "yt/utilities/lib/amr_kdtools.pyx":813
14355  *     cdef int nless=0, ngreater=0
14356  *     for i in range(n_grids):
14357  *         if data[i][0][best_dim] < split:             # <<<<<<<<<<<<<<
14358  *             less_ids[i] = 1
14359  *             nless += 1
14360  */
14361       goto __pyx_L22;
14362     }
14363 
14364     /* "yt/utilities/lib/amr_kdtools.pyx":817
14365  *             nless += 1
14366  *         else:
14367  *             less_ids[i] = 0             # <<<<<<<<<<<<<<
14368  *         if data[i][1][best_dim] > split:
14369  *             greater_ids[i] = 1
14370  */
14371     /*else*/ {
14372       __pyx_t_44 = __pyx_v_i;
14373       *((__pyx_t_5numpy_uint8_t *) ( /* dim=0 */ (__pyx_v_less_ids.data + __pyx_t_44 * __pyx_v_less_ids.strides[0]) )) = 0;
14374     }
14375     __pyx_L22:;
14376 
14377     /* "yt/utilities/lib/amr_kdtools.pyx":818
14378  *         else:
14379  *             less_ids[i] = 0
14380  *         if data[i][1][best_dim] > split:             # <<<<<<<<<<<<<<
14381  *             greater_ids[i] = 1
14382  *             ngreater += 1
14383  */
14384     __pyx_t_45 = __pyx_v_i;
14385     __pyx_t_46 = 1;
14386     __pyx_t_47 = __pyx_v_best_dim;
14387     __pyx_t_16 = (((*((__pyx_t_5numpy_float64_t *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_data.data + __pyx_t_45 * __pyx_v_data.strides[0]) ) + __pyx_t_46 * __pyx_v_data.strides[1]) ) + __pyx_t_47 * __pyx_v_data.strides[2]) ))) > __pyx_v_split) != 0);
14388     if (__pyx_t_16) {
14389 
14390       /* "yt/utilities/lib/amr_kdtools.pyx":819
14391  *             less_ids[i] = 0
14392  *         if data[i][1][best_dim] > split:
14393  *             greater_ids[i] = 1             # <<<<<<<<<<<<<<
14394  *             ngreater += 1
14395  *         else:
14396  */
14397       __pyx_t_48 = __pyx_v_i;
14398       *((__pyx_t_5numpy_uint8_t *) ( /* dim=0 */ (__pyx_v_greater_ids.data + __pyx_t_48 * __pyx_v_greater_ids.strides[0]) )) = 1;
14399 
14400       /* "yt/utilities/lib/amr_kdtools.pyx":820
14401  *         if data[i][1][best_dim] > split:
14402  *             greater_ids[i] = 1
14403  *             ngreater += 1             # <<<<<<<<<<<<<<
14404  *         else:
14405  *             greater_ids[i] = 0
14406  */
14407       __pyx_v_ngreater = (__pyx_v_ngreater + 1);
14408 
14409       /* "yt/utilities/lib/amr_kdtools.pyx":818
14410  *         else:
14411  *             less_ids[i] = 0
14412  *         if data[i][1][best_dim] > split:             # <<<<<<<<<<<<<<
14413  *             greater_ids[i] = 1
14414  *             ngreater += 1
14415  */
14416       goto __pyx_L23;
14417     }
14418 
14419     /* "yt/utilities/lib/amr_kdtools.pyx":822
14420  *             ngreater += 1
14421  *         else:
14422  *             greater_ids[i] = 0             # <<<<<<<<<<<<<<
14423  *
14424  *     # Return out unique values
14425  */
14426     /*else*/ {
14427       __pyx_t_49 = __pyx_v_i;
14428       *((__pyx_t_5numpy_uint8_t *) ( /* dim=0 */ (__pyx_v_greater_ids.data + __pyx_t_49 * __pyx_v_greater_ids.strides[0]) )) = 0;
14429     }
14430     __pyx_L23:;
14431   }
14432 
14433   /* "yt/utilities/lib/amr_kdtools.pyx":825
14434  *
14435  *     # Return out unique values
14436  *     return best_dim, split, nless, ngreater             # <<<<<<<<<<<<<<
14437  */
14438   __Pyx_XDECREF(__pyx_r);
14439   __pyx_t_32 = __Pyx_PyInt_From_int(__pyx_v_best_dim); if (unlikely(!__pyx_t_32)) __PYX_ERR(0, 825, __pyx_L1_error)
14440   __Pyx_GOTREF(__pyx_t_32);
14441   __pyx_t_3 = PyFloat_FromDouble(__pyx_v_split); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 825, __pyx_L1_error)
14442   __Pyx_GOTREF(__pyx_t_3);
14443   __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nless); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 825, __pyx_L1_error)
14444   __Pyx_GOTREF(__pyx_t_2);
14445   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_ngreater); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 825, __pyx_L1_error)
14446   __Pyx_GOTREF(__pyx_t_1);
14447   __pyx_t_50 = PyTuple_New(4); if (unlikely(!__pyx_t_50)) __PYX_ERR(0, 825, __pyx_L1_error)
14448   __Pyx_GOTREF(__pyx_t_50);
14449   __Pyx_GIVEREF(__pyx_t_32);
14450   PyTuple_SET_ITEM(__pyx_t_50, 0, __pyx_t_32);
14451   __Pyx_GIVEREF(__pyx_t_3);
14452   PyTuple_SET_ITEM(__pyx_t_50, 1, __pyx_t_3);
14453   __Pyx_GIVEREF(__pyx_t_2);
14454   PyTuple_SET_ITEM(__pyx_t_50, 2, __pyx_t_2);
14455   __Pyx_GIVEREF(__pyx_t_1);
14456   PyTuple_SET_ITEM(__pyx_t_50, 3, __pyx_t_1);
14457   __pyx_t_32 = 0;
14458   __pyx_t_3 = 0;
14459   __pyx_t_2 = 0;
14460   __pyx_t_1 = 0;
14461   __pyx_r = __pyx_t_50;
14462   __pyx_t_50 = 0;
14463   goto __pyx_L0;
14464 
14465   /* "yt/utilities/lib/amr_kdtools.pyx":762
14466  * @cython.wraparound(False)
14467  * @cython.cdivision(True)
14468  * cdef kdtree_get_choices(int n_grids,             # <<<<<<<<<<<<<<
14469  *                         np.float64_t[:,:,:] data,
14470  *                         np.float64_t[:] l_corner,
14471  */
14472 
14473   /* function exit code */
14474   __pyx_L1_error:;
14475   __Pyx_XDECREF(__pyx_t_1);
14476   __Pyx_XDECREF(__pyx_t_2);
14477   __Pyx_XDECREF(__pyx_t_3);
14478   __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
14479   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
14480   __Pyx_XDECREF(__pyx_t_32);
14481   __Pyx_XDECREF(__pyx_t_50);
14482   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
14483     __Pyx_PyThreadState_declare
14484     __Pyx_PyThreadState_assign
14485     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
14486     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tarr.rcbuffer->pybuffer);
14487   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
14488   __Pyx_AddTraceback("yt.utilities.lib.amr_kdtools.kdtree_get_choices", __pyx_clineno, __pyx_lineno, __pyx_filename);
14489   __pyx_r = 0;
14490   goto __pyx_L2;
14491   __pyx_L0:;
14492   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_tarr.rcbuffer->pybuffer);
14493   __pyx_L2:;
14494   __PYX_XDEC_MEMVIEW(&__pyx_v_uniquedims, 1);
14495   __PYX_XDEC_MEMVIEW(&__pyx_v_uniques, 1);
14496   __Pyx_XDECREF((PyObject *)__pyx_v_tarr);
14497   __Pyx_XGIVEREF(__pyx_r);
14498   __Pyx_RefNannyFinishContext();
14499   return __pyx_r;
14500 }
14501 
14502 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":258
14503  *         # experimental exception made for __getbuffer__ and __releasebuffer__
14504  *         # -- the details of this may change.
14505  *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
14506  *             # This implementation of getbuffer is geared towards Cython
14507  *             # requirements, and does not yet fulfill the PEP.
14508  */
14509 
14510 /* Python wrapper */
14511 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
14512 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
14513   int __pyx_r;
14514   __Pyx_RefNannyDeclarations
14515   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
14516   __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
14517 
14518   /* function exit code */
14519   __Pyx_RefNannyFinishContext();
14520   return __pyx_r;
14521 }
14522 
14523 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
14524   int __pyx_v_i;
14525   int __pyx_v_ndim;
14526   int __pyx_v_endian_detector;
14527   int __pyx_v_little_endian;
14528   int __pyx_v_t;
14529   char *__pyx_v_f;
14530   PyArray_Descr *__pyx_v_descr = 0;
14531   int __pyx_v_offset;
14532   int __pyx_r;
14533   __Pyx_RefNannyDeclarations
14534   int __pyx_t_1;
14535   int __pyx_t_2;
14536   PyObject *__pyx_t_3 = NULL;
14537   int __pyx_t_4;
14538   int __pyx_t_5;
14539   int __pyx_t_6;
14540   PyArray_Descr *__pyx_t_7;
14541   PyObject *__pyx_t_8 = NULL;
14542   char *__pyx_t_9;
14543   if (__pyx_v_info == NULL) {
14544     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
14545     return -1;
14546   }
14547   __Pyx_RefNannySetupContext("__getbuffer__", 0);
14548   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
14549   __Pyx_GIVEREF(__pyx_v_info->obj);
14550 
14551   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":265
14552  *
14553  *             cdef int i, ndim
14554  *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
14555  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
14556  *
14557  */
14558   __pyx_v_endian_detector = 1;
14559 
14560   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":266
14561  *             cdef int i, ndim
14562  *             cdef int endian_detector = 1
14563  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
14564  *
14565  *             ndim = PyArray_NDIM(self)
14566  */
14567   __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
14568 
14569   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":268
14570  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
14571  *
14572  *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
14573  *
14574  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
14575  */
14576   __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
14577 
14578   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
14579  *             ndim = PyArray_NDIM(self)
14580  *
14581  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
14582  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
14583  *                 raise ValueError(u"ndarray is not C contiguous")
14584  */
14585   __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
14586   if (__pyx_t_2) {
14587   } else {
14588     __pyx_t_1 = __pyx_t_2;
14589     goto __pyx_L4_bool_binop_done;
14590   }
14591 
14592   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":271
14593  *
14594  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
14595  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
14596  *                 raise ValueError(u"ndarray is not C contiguous")
14597  *
14598  */
14599   __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0);
14600   __pyx_t_1 = __pyx_t_2;
14601   __pyx_L4_bool_binop_done:;
14602 
14603   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
14604  *             ndim = PyArray_NDIM(self)
14605  *
14606  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
14607  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
14608  *                 raise ValueError(u"ndarray is not C contiguous")
14609  */
14610   if (unlikely(__pyx_t_1)) {
14611 
14612     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272
14613  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
14614  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
14615  *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
14616  *
14617  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
14618  */
14619     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 272, __pyx_L1_error)
14620     __Pyx_GOTREF(__pyx_t_3);
14621     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
14622     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14623     __PYX_ERR(3, 272, __pyx_L1_error)
14624 
14625     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
14626  *             ndim = PyArray_NDIM(self)
14627  *
14628  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
14629  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
14630  *                 raise ValueError(u"ndarray is not C contiguous")
14631  */
14632   }
14633 
14634   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
14635  *                 raise ValueError(u"ndarray is not C contiguous")
14636  *
14637  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
14638  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
14639  *                 raise ValueError(u"ndarray is not Fortran contiguous")
14640  */
14641   __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
14642   if (__pyx_t_2) {
14643   } else {
14644     __pyx_t_1 = __pyx_t_2;
14645     goto __pyx_L7_bool_binop_done;
14646   }
14647 
14648   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":275
14649  *
14650  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
14651  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
14652  *                 raise ValueError(u"ndarray is not Fortran contiguous")
14653  *
14654  */
14655   __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0);
14656   __pyx_t_1 = __pyx_t_2;
14657   __pyx_L7_bool_binop_done:;
14658 
14659   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
14660  *                 raise ValueError(u"ndarray is not C contiguous")
14661  *
14662  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
14663  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
14664  *                 raise ValueError(u"ndarray is not Fortran contiguous")
14665  */
14666   if (unlikely(__pyx_t_1)) {
14667 
14668     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276
14669  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
14670  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
14671  *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
14672  *
14673  *             info.buf = PyArray_DATA(self)
14674  */
14675     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 276, __pyx_L1_error)
14676     __Pyx_GOTREF(__pyx_t_3);
14677     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
14678     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14679     __PYX_ERR(3, 276, __pyx_L1_error)
14680 
14681     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
14682  *                 raise ValueError(u"ndarray is not C contiguous")
14683  *
14684  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
14685  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
14686  *                 raise ValueError(u"ndarray is not Fortran contiguous")
14687  */
14688   }
14689 
14690   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":278
14691  *                 raise ValueError(u"ndarray is not Fortran contiguous")
14692  *
14693  *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
14694  *             info.ndim = ndim
14695  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
14696  */
14697   __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
14698 
14699   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":279
14700  *
14701  *             info.buf = PyArray_DATA(self)
14702  *             info.ndim = ndim             # <<<<<<<<<<<<<<
14703  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
14704  *                 # Allocate new buffer for strides and shape info.
14705  */
14706   __pyx_v_info->ndim = __pyx_v_ndim;
14707 
14708   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280
14709  *             info.buf = PyArray_DATA(self)
14710  *             info.ndim = ndim
14711  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
14712  *                 # Allocate new buffer for strides and shape info.
14713  *                 # This is allocated as one block, strides first.
14714  */
14715   __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
14716   if (__pyx_t_1) {
14717 
14718     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":283
14719  *                 # Allocate new buffer for strides and shape info.
14720  *                 # This is allocated as one block, strides first.
14721  *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)             # <<<<<<<<<<<<<<
14722  *                 info.shape = info.strides + ndim
14723  *                 for i in range(ndim):
14724  */
14725     __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim))));
14726 
14727     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":284
14728  *                 # This is allocated as one block, strides first.
14729  *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
14730  *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
14731  *                 for i in range(ndim):
14732  *                     info.strides[i] = PyArray_STRIDES(self)[i]
14733  */
14734     __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
14735 
14736     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":285
14737  *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
14738  *                 info.shape = info.strides + ndim
14739  *                 for i in range(ndim):             # <<<<<<<<<<<<<<
14740  *                     info.strides[i] = PyArray_STRIDES(self)[i]
14741  *                     info.shape[i] = PyArray_DIMS(self)[i]
14742  */
14743     __pyx_t_4 = __pyx_v_ndim;
14744     __pyx_t_5 = __pyx_t_4;
14745     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
14746       __pyx_v_i = __pyx_t_6;
14747 
14748       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":286
14749  *                 info.shape = info.strides + ndim
14750  *                 for i in range(ndim):
14751  *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
14752  *                     info.shape[i] = PyArray_DIMS(self)[i]
14753  *             else:
14754  */
14755       (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
14756 
14757       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":287
14758  *                 for i in range(ndim):
14759  *                     info.strides[i] = PyArray_STRIDES(self)[i]
14760  *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
14761  *             else:
14762  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
14763  */
14764       (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
14765     }
14766 
14767     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280
14768  *             info.buf = PyArray_DATA(self)
14769  *             info.ndim = ndim
14770  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
14771  *                 # Allocate new buffer for strides and shape info.
14772  *                 # This is allocated as one block, strides first.
14773  */
14774     goto __pyx_L9;
14775   }
14776 
14777   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":289
14778  *                     info.shape[i] = PyArray_DIMS(self)[i]
14779  *             else:
14780  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
14781  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
14782  *             info.suboffsets = NULL
14783  */
14784   /*else*/ {
14785     __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
14786 
14787     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":290
14788  *             else:
14789  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
14790  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)             # <<<<<<<<<<<<<<
14791  *             info.suboffsets = NULL
14792  *             info.itemsize = PyArray_ITEMSIZE(self)
14793  */
14794     __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
14795   }
14796   __pyx_L9:;
14797 
14798   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":291
14799  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
14800  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
14801  *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
14802  *             info.itemsize = PyArray_ITEMSIZE(self)
14803  *             info.readonly = not PyArray_ISWRITEABLE(self)
14804  */
14805   __pyx_v_info->suboffsets = NULL;
14806 
14807   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":292
14808  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
14809  *             info.suboffsets = NULL
14810  *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
14811  *             info.readonly = not PyArray_ISWRITEABLE(self)
14812  *
14813  */
14814   __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
14815 
14816   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":293
14817  *             info.suboffsets = NULL
14818  *             info.itemsize = PyArray_ITEMSIZE(self)
14819  *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
14820  *
14821  *             cdef int t
14822  */
14823   __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
14824 
14825   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":296
14826  *
14827  *             cdef int t
14828  *             cdef char* f = NULL             # <<<<<<<<<<<<<<
14829  *             cdef dtype descr = <dtype>PyArray_DESCR(self)
14830  *             cdef int offset
14831  */
14832   __pyx_v_f = NULL;
14833 
14834   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":297
14835  *             cdef int t
14836  *             cdef char* f = NULL
14837  *             cdef dtype descr = <dtype>PyArray_DESCR(self)             # <<<<<<<<<<<<<<
14838  *             cdef int offset
14839  *
14840  */
14841   __pyx_t_7 = PyArray_DESCR(__pyx_v_self);
14842   __pyx_t_3 = ((PyObject *)__pyx_t_7);
14843   __Pyx_INCREF(__pyx_t_3);
14844   __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
14845   __pyx_t_3 = 0;
14846 
14847   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":300
14848  *             cdef int offset
14849  *
14850  *             info.obj = self             # <<<<<<<<<<<<<<
14851  *
14852  *             if not PyDataType_HASFIELDS(descr):
14853  */
14854   __Pyx_INCREF(((PyObject *)__pyx_v_self));
14855   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
14856   __Pyx_GOTREF(__pyx_v_info->obj);
14857   __Pyx_DECREF(__pyx_v_info->obj);
14858   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
14859 
14860   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302
14861  *             info.obj = self
14862  *
14863  *             if not PyDataType_HASFIELDS(descr):             # <<<<<<<<<<<<<<
14864  *                 t = descr.type_num
14865  *                 if ((descr.byteorder == c'>' and little_endian) or
14866  */
14867   __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0);
14868   if (__pyx_t_1) {
14869 
14870     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":303
14871  *
14872  *             if not PyDataType_HASFIELDS(descr):
14873  *                 t = descr.type_num             # <<<<<<<<<<<<<<
14874  *                 if ((descr.byteorder == c'>' and little_endian) or
14875  *                     (descr.byteorder == c'<' and not little_endian)):
14876  */
14877     __pyx_t_4 = __pyx_v_descr->type_num;
14878     __pyx_v_t = __pyx_t_4;
14879 
14880     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
14881  *             if not PyDataType_HASFIELDS(descr):
14882  *                 t = descr.type_num
14883  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
14884  *                     (descr.byteorder == c'<' and not little_endian)):
14885  *                     raise ValueError(u"Non-native byte order not supported")
14886  */
14887     __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
14888     if (!__pyx_t_2) {
14889       goto __pyx_L15_next_or;
14890     } else {
14891     }
14892     __pyx_t_2 = (__pyx_v_little_endian != 0);
14893     if (!__pyx_t_2) {
14894     } else {
14895       __pyx_t_1 = __pyx_t_2;
14896       goto __pyx_L14_bool_binop_done;
14897     }
14898     __pyx_L15_next_or:;
14899 
14900     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":305
14901  *                 t = descr.type_num
14902  *                 if ((descr.byteorder == c'>' and little_endian) or
14903  *                     (descr.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
14904  *                     raise ValueError(u"Non-native byte order not supported")
14905  *                 if   t == NPY_BYTE:        f = "b"
14906  */
14907     __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
14908     if (__pyx_t_2) {
14909     } else {
14910       __pyx_t_1 = __pyx_t_2;
14911       goto __pyx_L14_bool_binop_done;
14912     }
14913     __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
14914     __pyx_t_1 = __pyx_t_2;
14915     __pyx_L14_bool_binop_done:;
14916 
14917     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
14918  *             if not PyDataType_HASFIELDS(descr):
14919  *                 t = descr.type_num
14920  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
14921  *                     (descr.byteorder == c'<' and not little_endian)):
14922  *                     raise ValueError(u"Non-native byte order not supported")
14923  */
14924     if (unlikely(__pyx_t_1)) {
14925 
14926       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":306
14927  *                 if ((descr.byteorder == c'>' and little_endian) or
14928  *                     (descr.byteorder == c'<' and not little_endian)):
14929  *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
14930  *                 if   t == NPY_BYTE:        f = "b"
14931  *                 elif t == NPY_UBYTE:       f = "B"
14932  */
14933       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 306, __pyx_L1_error)
14934       __Pyx_GOTREF(__pyx_t_3);
14935       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
14936       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14937       __PYX_ERR(3, 306, __pyx_L1_error)
14938 
14939       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
14940  *             if not PyDataType_HASFIELDS(descr):
14941  *                 t = descr.type_num
14942  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
14943  *                     (descr.byteorder == c'<' and not little_endian)):
14944  *                     raise ValueError(u"Non-native byte order not supported")
14945  */
14946     }
14947 
14948     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":307
14949  *                     (descr.byteorder == c'<' and not little_endian)):
14950  *                     raise ValueError(u"Non-native byte order not supported")
14951  *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
14952  *                 elif t == NPY_UBYTE:       f = "B"
14953  *                 elif t == NPY_SHORT:       f = "h"
14954  */
14955     switch (__pyx_v_t) {
14956       case NPY_BYTE:
14957       __pyx_v_f = ((char *)"b");
14958       break;
14959       case NPY_UBYTE:
14960 
14961       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":308
14962  *                     raise ValueError(u"Non-native byte order not supported")
14963  *                 if   t == NPY_BYTE:        f = "b"
14964  *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
14965  *                 elif t == NPY_SHORT:       f = "h"
14966  *                 elif t == NPY_USHORT:      f = "H"
14967  */
14968       __pyx_v_f = ((char *)"B");
14969       break;
14970       case NPY_SHORT:
14971 
14972       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":309
14973  *                 if   t == NPY_BYTE:        f = "b"
14974  *                 elif t == NPY_UBYTE:       f = "B"
14975  *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
14976  *                 elif t == NPY_USHORT:      f = "H"
14977  *                 elif t == NPY_INT:         f = "i"
14978  */
14979       __pyx_v_f = ((char *)"h");
14980       break;
14981       case NPY_USHORT:
14982 
14983       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":310
14984  *                 elif t == NPY_UBYTE:       f = "B"
14985  *                 elif t == NPY_SHORT:       f = "h"
14986  *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
14987  *                 elif t == NPY_INT:         f = "i"
14988  *                 elif t == NPY_UINT:        f = "I"
14989  */
14990       __pyx_v_f = ((char *)"H");
14991       break;
14992       case NPY_INT:
14993 
14994       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":311
14995  *                 elif t == NPY_SHORT:       f = "h"
14996  *                 elif t == NPY_USHORT:      f = "H"
14997  *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
14998  *                 elif t == NPY_UINT:        f = "I"
14999  *                 elif t == NPY_LONG:        f = "l"
15000  */
15001       __pyx_v_f = ((char *)"i");
15002       break;
15003       case NPY_UINT:
15004 
15005       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":312
15006  *                 elif t == NPY_USHORT:      f = "H"
15007  *                 elif t == NPY_INT:         f = "i"
15008  *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
15009  *                 elif t == NPY_LONG:        f = "l"
15010  *                 elif t == NPY_ULONG:       f = "L"
15011  */
15012       __pyx_v_f = ((char *)"I");
15013       break;
15014       case NPY_LONG:
15015 
15016       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":313
15017  *                 elif t == NPY_INT:         f = "i"
15018  *                 elif t == NPY_UINT:        f = "I"
15019  *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
15020  *                 elif t == NPY_ULONG:       f = "L"
15021  *                 elif t == NPY_LONGLONG:    f = "q"
15022  */
15023       __pyx_v_f = ((char *)"l");
15024       break;
15025       case NPY_ULONG:
15026 
15027       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":314
15028  *                 elif t == NPY_UINT:        f = "I"
15029  *                 elif t == NPY_LONG:        f = "l"
15030  *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
15031  *                 elif t == NPY_LONGLONG:    f = "q"
15032  *                 elif t == NPY_ULONGLONG:   f = "Q"
15033  */
15034       __pyx_v_f = ((char *)"L");
15035       break;
15036       case NPY_LONGLONG:
15037 
15038       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":315
15039  *                 elif t == NPY_LONG:        f = "l"
15040  *                 elif t == NPY_ULONG:       f = "L"
15041  *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
15042  *                 elif t == NPY_ULONGLONG:   f = "Q"
15043  *                 elif t == NPY_FLOAT:       f = "f"
15044  */
15045       __pyx_v_f = ((char *)"q");
15046       break;
15047       case NPY_ULONGLONG:
15048 
15049       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":316
15050  *                 elif t == NPY_ULONG:       f = "L"
15051  *                 elif t == NPY_LONGLONG:    f = "q"
15052  *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
15053  *                 elif t == NPY_FLOAT:       f = "f"
15054  *                 elif t == NPY_DOUBLE:      f = "d"
15055  */
15056       __pyx_v_f = ((char *)"Q");
15057       break;
15058       case NPY_FLOAT:
15059 
15060       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":317
15061  *                 elif t == NPY_LONGLONG:    f = "q"
15062  *                 elif t == NPY_ULONGLONG:   f = "Q"
15063  *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
15064  *                 elif t == NPY_DOUBLE:      f = "d"
15065  *                 elif t == NPY_LONGDOUBLE:  f = "g"
15066  */
15067       __pyx_v_f = ((char *)"f");
15068       break;
15069       case NPY_DOUBLE:
15070 
15071       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":318
15072  *                 elif t == NPY_ULONGLONG:   f = "Q"
15073  *                 elif t == NPY_FLOAT:       f = "f"
15074  *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
15075  *                 elif t == NPY_LONGDOUBLE:  f = "g"
15076  *                 elif t == NPY_CFLOAT:      f = "Zf"
15077  */
15078       __pyx_v_f = ((char *)"d");
15079       break;
15080       case NPY_LONGDOUBLE:
15081 
15082       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":319
15083  *                 elif t == NPY_FLOAT:       f = "f"
15084  *                 elif t == NPY_DOUBLE:      f = "d"
15085  *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
15086  *                 elif t == NPY_CFLOAT:      f = "Zf"
15087  *                 elif t == NPY_CDOUBLE:     f = "Zd"
15088  */
15089       __pyx_v_f = ((char *)"g");
15090       break;
15091       case NPY_CFLOAT:
15092 
15093       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":320
15094  *                 elif t == NPY_DOUBLE:      f = "d"
15095  *                 elif t == NPY_LONGDOUBLE:  f = "g"
15096  *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
15097  *                 elif t == NPY_CDOUBLE:     f = "Zd"
15098  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
15099  */
15100       __pyx_v_f = ((char *)"Zf");
15101       break;
15102       case NPY_CDOUBLE:
15103 
15104       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":321
15105  *                 elif t == NPY_LONGDOUBLE:  f = "g"
15106  *                 elif t == NPY_CFLOAT:      f = "Zf"
15107  *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
15108  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
15109  *                 elif t == NPY_OBJECT:      f = "O"
15110  */
15111       __pyx_v_f = ((char *)"Zd");
15112       break;
15113       case NPY_CLONGDOUBLE:
15114 
15115       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":322
15116  *                 elif t == NPY_CFLOAT:      f = "Zf"
15117  *                 elif t == NPY_CDOUBLE:     f = "Zd"
15118  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
15119  *                 elif t == NPY_OBJECT:      f = "O"
15120  *                 else:
15121  */
15122       __pyx_v_f = ((char *)"Zg");
15123       break;
15124       case NPY_OBJECT:
15125 
15126       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":323
15127  *                 elif t == NPY_CDOUBLE:     f = "Zd"
15128  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
15129  *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
15130  *                 else:
15131  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
15132  */
15133       __pyx_v_f = ((char *)"O");
15134       break;
15135       default:
15136 
15137       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":325
15138  *                 elif t == NPY_OBJECT:      f = "O"
15139  *                 else:
15140  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
15141  *                 info.format = f
15142  *                 return
15143  */
15144       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 325, __pyx_L1_error)
15145       __Pyx_GOTREF(__pyx_t_3);
15146       __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 325, __pyx_L1_error)
15147       __Pyx_GOTREF(__pyx_t_8);
15148       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15149       __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 325, __pyx_L1_error)
15150       __Pyx_GOTREF(__pyx_t_3);
15151       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
15152       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15153       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15154       __PYX_ERR(3, 325, __pyx_L1_error)
15155       break;
15156     }
15157 
15158     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":326
15159  *                 else:
15160  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
15161  *                 info.format = f             # <<<<<<<<<<<<<<
15162  *                 return
15163  *             else:
15164  */
15165     __pyx_v_info->format = __pyx_v_f;
15166 
15167     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":327
15168  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
15169  *                 info.format = f
15170  *                 return             # <<<<<<<<<<<<<<
15171  *             else:
15172  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
15173  */
15174     __pyx_r = 0;
15175     goto __pyx_L0;
15176 
15177     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302
15178  *             info.obj = self
15179  *
15180  *             if not PyDataType_HASFIELDS(descr):             # <<<<<<<<<<<<<<
15181  *                 t = descr.type_num
15182  *                 if ((descr.byteorder == c'>' and little_endian) or
15183  */
15184   }
15185 
15186   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":329
15187  *                 return
15188  *             else:
15189  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
15190  *                 info.format[0] = c'^' # Native data types, manual alignment
15191  *                 offset = 0
15192  */
15193   /*else*/ {
15194     __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF));
15195 
15196     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":330
15197  *             else:
15198  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
15199  *                 info.format[0] = c'^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
15200  *                 offset = 0
15201  *                 f = _util_dtypestring(descr, info.format + 1,
15202  */
15203     (__pyx_v_info->format[0]) = '^';
15204 
15205     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":331
15206  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
15207  *                 info.format[0] = c'^' # Native data types, manual alignment
15208  *                 offset = 0             # <<<<<<<<<<<<<<
15209  *                 f = _util_dtypestring(descr, info.format + 1,
15210  *                                       info.format + _buffer_format_string_len,
15211  */
15212     __pyx_v_offset = 0;
15213 
15214     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":332
15215  *                 info.format[0] = c'^' # Native data types, manual alignment
15216  *                 offset = 0
15217  *                 f = _util_dtypestring(descr, info.format + 1,             # <<<<<<<<<<<<<<
15218  *                                       info.format + _buffer_format_string_len,
15219  *                                       &offset)
15220  */
15221     __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(3, 332, __pyx_L1_error)
15222     __pyx_v_f = __pyx_t_9;
15223 
15224     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":335
15225  *                                       info.format + _buffer_format_string_len,
15226  *                                       &offset)
15227  *                 f[0] = c'\0' # Terminate format string             # <<<<<<<<<<<<<<
15228  *
15229  *         def __releasebuffer__(ndarray self, Py_buffer* info):
15230  */
15231     (__pyx_v_f[0]) = '\x00';
15232   }
15233 
15234   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":258
15235  *         # experimental exception made for __getbuffer__ and __releasebuffer__
15236  *         # -- the details of this may change.
15237  *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
15238  *             # This implementation of getbuffer is geared towards Cython
15239  *             # requirements, and does not yet fulfill the PEP.
15240  */
15241 
15242   /* function exit code */
15243   __pyx_r = 0;
15244   goto __pyx_L0;
15245   __pyx_L1_error:;
15246   __Pyx_XDECREF(__pyx_t_3);
15247   __Pyx_XDECREF(__pyx_t_8);
15248   __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15249   __pyx_r = -1;
15250   if (__pyx_v_info->obj != NULL) {
15251     __Pyx_GOTREF(__pyx_v_info->obj);
15252     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
15253   }
15254   goto __pyx_L2;
15255   __pyx_L0:;
15256   if (__pyx_v_info->obj == Py_None) {
15257     __Pyx_GOTREF(__pyx_v_info->obj);
15258     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
15259   }
15260   __pyx_L2:;
15261   __Pyx_XDECREF((PyObject *)__pyx_v_descr);
15262   __Pyx_RefNannyFinishContext();
15263   return __pyx_r;
15264 }
15265 
15266 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":337
15267  *                 f[0] = c'\0' # Terminate format string
15268  *
15269  *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
15270  *             if PyArray_HASFIELDS(self):
15271  *                 PyObject_Free(info.format)
15272  */
15273 
15274 /* Python wrapper */
15275 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
15276 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
15277   __Pyx_RefNannyDeclarations
15278   __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
15279   __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
15280 
15281   /* function exit code */
15282   __Pyx_RefNannyFinishContext();
15283 }
15284 
15285 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
15286   __Pyx_RefNannyDeclarations
15287   int __pyx_t_1;
15288   __Pyx_RefNannySetupContext("__releasebuffer__", 0);
15289 
15290   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":338
15291  *
15292  *         def __releasebuffer__(ndarray self, Py_buffer* info):
15293  *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
15294  *                 PyObject_Free(info.format)
15295  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
15296  */
15297   __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
15298   if (__pyx_t_1) {
15299 
15300     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":339
15301  *         def __releasebuffer__(ndarray self, Py_buffer* info):
15302  *             if PyArray_HASFIELDS(self):
15303  *                 PyObject_Free(info.format)             # <<<<<<<<<<<<<<
15304  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
15305  *                 PyObject_Free(info.strides)
15306  */
15307     PyObject_Free(__pyx_v_info->format);
15308 
15309     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":338
15310  *
15311  *         def __releasebuffer__(ndarray self, Py_buffer* info):
15312  *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
15313  *                 PyObject_Free(info.format)
15314  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
15315  */
15316   }
15317 
15318   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":340
15319  *             if PyArray_HASFIELDS(self):
15320  *                 PyObject_Free(info.format)
15321  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
15322  *                 PyObject_Free(info.strides)
15323  *                 # info.shape was stored after info.strides in the same block
15324  */
15325   __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
15326   if (__pyx_t_1) {
15327 
15328     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":341
15329  *                 PyObject_Free(info.format)
15330  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
15331  *                 PyObject_Free(info.strides)             # <<<<<<<<<<<<<<
15332  *                 # info.shape was stored after info.strides in the same block
15333  *
15334  */
15335     PyObject_Free(__pyx_v_info->strides);
15336 
15337     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":340
15338  *             if PyArray_HASFIELDS(self):
15339  *                 PyObject_Free(info.format)
15340  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
15341  *                 PyObject_Free(info.strides)
15342  *                 # info.shape was stored after info.strides in the same block
15343  */
15344   }
15345 
15346   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":337
15347  *                 f[0] = c'\0' # Terminate format string
15348  *
15349  *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
15350  *             if PyArray_HASFIELDS(self):
15351  *                 PyObject_Free(info.format)
15352  */
15353 
15354   /* function exit code */
15355   __Pyx_RefNannyFinishContext();
15356 }
15357 
15358 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":821
15359  * ctypedef npy_cdouble     complex_t
15360  *
15361  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
15362  *     return PyArray_MultiIterNew(1, <void*>a)
15363  *
15364  */
15365 
15366 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
15367   PyObject *__pyx_r = NULL;
15368   __Pyx_RefNannyDeclarations
15369   PyObject *__pyx_t_1 = NULL;
15370   __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
15371 
15372   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":822
15373  *
15374  * cdef inline object PyArray_MultiIterNew1(a):
15375  *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
15376  *
15377  * cdef inline object PyArray_MultiIterNew2(a, b):
15378  */
15379   __Pyx_XDECREF(__pyx_r);
15380   __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 822, __pyx_L1_error)
15381   __Pyx_GOTREF(__pyx_t_1);
15382   __pyx_r = __pyx_t_1;
15383   __pyx_t_1 = 0;
15384   goto __pyx_L0;
15385 
15386   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":821
15387  * ctypedef npy_cdouble     complex_t
15388  *
15389  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
15390  *     return PyArray_MultiIterNew(1, <void*>a)
15391  *
15392  */
15393 
15394   /* function exit code */
15395   __pyx_L1_error:;
15396   __Pyx_XDECREF(__pyx_t_1);
15397   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
15398   __pyx_r = 0;
15399   __pyx_L0:;
15400   __Pyx_XGIVEREF(__pyx_r);
15401   __Pyx_RefNannyFinishContext();
15402   return __pyx_r;
15403 }
15404 
15405 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":824
15406  *     return PyArray_MultiIterNew(1, <void*>a)
15407  *
15408  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
15409  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
15410  *
15411  */
15412 
15413 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
15414   PyObject *__pyx_r = NULL;
15415   __Pyx_RefNannyDeclarations
15416   PyObject *__pyx_t_1 = NULL;
15417   __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
15418 
15419   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":825
15420  *
15421  * cdef inline object PyArray_MultiIterNew2(a, b):
15422  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
15423  *
15424  * cdef inline object PyArray_MultiIterNew3(a, b, c):
15425  */
15426   __Pyx_XDECREF(__pyx_r);
15427   __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 825, __pyx_L1_error)
15428   __Pyx_GOTREF(__pyx_t_1);
15429   __pyx_r = __pyx_t_1;
15430   __pyx_t_1 = 0;
15431   goto __pyx_L0;
15432 
15433   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":824
15434  *     return PyArray_MultiIterNew(1, <void*>a)
15435  *
15436  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
15437  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
15438  *
15439  */
15440 
15441   /* function exit code */
15442   __pyx_L1_error:;
15443   __Pyx_XDECREF(__pyx_t_1);
15444   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
15445   __pyx_r = 0;
15446   __pyx_L0:;
15447   __Pyx_XGIVEREF(__pyx_r);
15448   __Pyx_RefNannyFinishContext();
15449   return __pyx_r;
15450 }
15451 
15452 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827
15453  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
15454  *
15455  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
15456  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
15457  *
15458  */
15459 
15460 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
15461   PyObject *__pyx_r = NULL;
15462   __Pyx_RefNannyDeclarations
15463   PyObject *__pyx_t_1 = NULL;
15464   __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
15465 
15466   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":828
15467  *
15468  * cdef inline object PyArray_MultiIterNew3(a, b, c):
15469  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
15470  *
15471  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
15472  */
15473   __Pyx_XDECREF(__pyx_r);
15474   __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(3, 828, __pyx_L1_error)
15475   __Pyx_GOTREF(__pyx_t_1);
15476   __pyx_r = __pyx_t_1;
15477   __pyx_t_1 = 0;
15478   goto __pyx_L0;
15479 
15480   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827
15481  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
15482  *
15483  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
15484  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
15485  *
15486  */
15487 
15488   /* function exit code */
15489   __pyx_L1_error:;
15490   __Pyx_XDECREF(__pyx_t_1);
15491   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
15492   __pyx_r = 0;
15493   __pyx_L0:;
15494   __Pyx_XGIVEREF(__pyx_r);
15495   __Pyx_RefNannyFinishContext();
15496   return __pyx_r;
15497 }
15498 
15499 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":830
15500  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
15501  *
15502  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
15503  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
15504  *
15505  */
15506 
15507 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) {
15508   PyObject *__pyx_r = NULL;
15509   __Pyx_RefNannyDeclarations
15510   PyObject *__pyx_t_1 = NULL;
15511   __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
15512 
15513   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":831
15514  *
15515  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
15516  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
15517  *
15518  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
15519  */
15520   __Pyx_XDECREF(__pyx_r);
15521   __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(3, 831, __pyx_L1_error)
15522   __Pyx_GOTREF(__pyx_t_1);
15523   __pyx_r = __pyx_t_1;
15524   __pyx_t_1 = 0;
15525   goto __pyx_L0;
15526 
15527   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":830
15528  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
15529  *
15530  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
15531  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
15532  *
15533  */
15534 
15535   /* function exit code */
15536   __pyx_L1_error:;
15537   __Pyx_XDECREF(__pyx_t_1);
15538   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
15539   __pyx_r = 0;
15540   __pyx_L0:;
15541   __Pyx_XGIVEREF(__pyx_r);
15542   __Pyx_RefNannyFinishContext();
15543   return __pyx_r;
15544 }
15545 
15546 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":833
15547  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
15548  *
15549  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
15550  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
15551  *
15552  */
15553 
15554 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) {
15555   PyObject *__pyx_r = NULL;
15556   __Pyx_RefNannyDeclarations
15557   PyObject *__pyx_t_1 = NULL;
15558   __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
15559 
15560   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":834
15561  *
15562  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
15563  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
15564  *
15565  * cdef inline tuple PyDataType_SHAPE(dtype d):
15566  */
15567   __Pyx_XDECREF(__pyx_r);
15568   __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(3, 834, __pyx_L1_error)
15569   __Pyx_GOTREF(__pyx_t_1);
15570   __pyx_r = __pyx_t_1;
15571   __pyx_t_1 = 0;
15572   goto __pyx_L0;
15573 
15574   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":833
15575  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
15576  *
15577  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
15578  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
15579  *
15580  */
15581 
15582   /* function exit code */
15583   __pyx_L1_error:;
15584   __Pyx_XDECREF(__pyx_t_1);
15585   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
15586   __pyx_r = 0;
15587   __pyx_L0:;
15588   __Pyx_XGIVEREF(__pyx_r);
15589   __Pyx_RefNannyFinishContext();
15590   return __pyx_r;
15591 }
15592 
15593 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":836
15594  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
15595  *
15596  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
15597  *     if PyDataType_HASSUBARRAY(d):
15598  *         return <tuple>d.subarray.shape
15599  */
15600 
15601 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
15602   PyObject *__pyx_r = NULL;
15603   __Pyx_RefNannyDeclarations
15604   int __pyx_t_1;
15605   __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
15606 
15607   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837
15608  *
15609  * cdef inline tuple PyDataType_SHAPE(dtype d):
15610  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
15611  *         return <tuple>d.subarray.shape
15612  *     else:
15613  */
15614   __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
15615   if (__pyx_t_1) {
15616 
15617     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":838
15618  * cdef inline tuple PyDataType_SHAPE(dtype d):
15619  *     if PyDataType_HASSUBARRAY(d):
15620  *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
15621  *     else:
15622  *         return ()
15623  */
15624     __Pyx_XDECREF(__pyx_r);
15625     __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
15626     __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
15627     goto __pyx_L0;
15628 
15629     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837
15630  *
15631  * cdef inline tuple PyDataType_SHAPE(dtype d):
15632  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
15633  *         return <tuple>d.subarray.shape
15634  *     else:
15635  */
15636   }
15637 
15638   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":840
15639  *         return <tuple>d.subarray.shape
15640  *     else:
15641  *         return ()             # <<<<<<<<<<<<<<
15642  *
15643  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
15644  */
15645   /*else*/ {
15646     __Pyx_XDECREF(__pyx_r);
15647     __Pyx_INCREF(__pyx_empty_tuple);
15648     __pyx_r = __pyx_empty_tuple;
15649     goto __pyx_L0;
15650   }
15651 
15652   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":836
15653  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
15654  *
15655  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
15656  *     if PyDataType_HASSUBARRAY(d):
15657  *         return <tuple>d.subarray.shape
15658  */
15659 
15660   /* function exit code */
15661   __pyx_L0:;
15662   __Pyx_XGIVEREF(__pyx_r);
15663   __Pyx_RefNannyFinishContext();
15664   return __pyx_r;
15665 }
15666 
15667 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842
15668  *         return ()
15669  *
15670  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
15671  *     # Recursive utility function used in __getbuffer__ to get format
15672  *     # string. The new location in the format string is returned.
15673  */
15674 
15675 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) {
15676   PyArray_Descr *__pyx_v_child = 0;
15677   int __pyx_v_endian_detector;
15678   int __pyx_v_little_endian;
15679   PyObject *__pyx_v_fields = 0;
15680   PyObject *__pyx_v_childname = NULL;
15681   PyObject *__pyx_v_new_offset = NULL;
15682   PyObject *__pyx_v_t = NULL;
15683   char *__pyx_r;
15684   __Pyx_RefNannyDeclarations
15685   PyObject *__pyx_t_1 = NULL;
15686   Py_ssize_t __pyx_t_2;
15687   PyObject *__pyx_t_3 = NULL;
15688   PyObject *__pyx_t_4 = NULL;
15689   int __pyx_t_5;
15690   int __pyx_t_6;
15691   int __pyx_t_7;
15692   long __pyx_t_8;
15693   char *__pyx_t_9;
15694   __Pyx_RefNannySetupContext("_util_dtypestring", 0);
15695 
15696   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":847
15697  *
15698  *     cdef dtype child
15699  *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
15700  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
15701  *     cdef tuple fields
15702  */
15703   __pyx_v_endian_detector = 1;
15704 
15705   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":848
15706  *     cdef dtype child
15707  *     cdef int endian_detector = 1
15708  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
15709  *     cdef tuple fields
15710  *
15711  */
15712   __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
15713 
15714   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851
15715  *     cdef tuple fields
15716  *
15717  *     for childname in descr.names:             # <<<<<<<<<<<<<<
15718  *         fields = descr.fields[childname]
15719  *         child, new_offset = fields
15720  */
15721   if (unlikely(__pyx_v_descr->names == Py_None)) {
15722     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
15723     __PYX_ERR(3, 851, __pyx_L1_error)
15724   }
15725   __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
15726   for (;;) {
15727     if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
15728     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15729     __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(3, 851, __pyx_L1_error)
15730     #else
15731     __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 851, __pyx_L1_error)
15732     __Pyx_GOTREF(__pyx_t_3);
15733     #endif
15734     __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
15735     __pyx_t_3 = 0;
15736 
15737     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":852
15738  *
15739  *     for childname in descr.names:
15740  *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
15741  *         child, new_offset = fields
15742  *
15743  */
15744     if (unlikely(__pyx_v_descr->fields == Py_None)) {
15745       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
15746       __PYX_ERR(3, 852, __pyx_L1_error)
15747     }
15748     __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 852, __pyx_L1_error)
15749     __Pyx_GOTREF(__pyx_t_3);
15750     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(3, 852, __pyx_L1_error)
15751     __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
15752     __pyx_t_3 = 0;
15753 
15754     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":853
15755  *     for childname in descr.names:
15756  *         fields = descr.fields[childname]
15757  *         child, new_offset = fields             # <<<<<<<<<<<<<<
15758  *
15759  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
15760  */
15761     if (likely(__pyx_v_fields != Py_None)) {
15762       PyObject* sequence = __pyx_v_fields;
15763       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
15764       if (unlikely(size != 2)) {
15765         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
15766         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
15767         __PYX_ERR(3, 853, __pyx_L1_error)
15768       }
15769       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15770       __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
15771       __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
15772       __Pyx_INCREF(__pyx_t_3);
15773       __Pyx_INCREF(__pyx_t_4);
15774       #else
15775       __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 853, __pyx_L1_error)
15776       __Pyx_GOTREF(__pyx_t_3);
15777       __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 853, __pyx_L1_error)
15778       __Pyx_GOTREF(__pyx_t_4);
15779       #endif
15780     } else {
15781       __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(3, 853, __pyx_L1_error)
15782     }
15783     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(3, 853, __pyx_L1_error)
15784     __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
15785     __pyx_t_3 = 0;
15786     __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
15787     __pyx_t_4 = 0;
15788 
15789     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855
15790  *         child, new_offset = fields
15791  *
15792  *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
15793  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
15794  *
15795  */
15796     __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 855, __pyx_L1_error)
15797     __Pyx_GOTREF(__pyx_t_4);
15798     __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 855, __pyx_L1_error)
15799     __Pyx_GOTREF(__pyx_t_3);
15800     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15801     __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 855, __pyx_L1_error)
15802     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15803     __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
15804     if (unlikely(__pyx_t_6)) {
15805 
15806       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856
15807  *
15808  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
15809  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
15810  *
15811  *         if ((child.byteorder == c'>' and little_endian) or
15812  */
15813       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 856, __pyx_L1_error)
15814       __Pyx_GOTREF(__pyx_t_3);
15815       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15816       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15817       __PYX_ERR(3, 856, __pyx_L1_error)
15818 
15819       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855
15820  *         child, new_offset = fields
15821  *
15822  *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
15823  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
15824  *
15825  */
15826     }
15827 
15828     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
15829  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
15830  *
15831  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
15832  *             (child.byteorder == c'<' and not little_endian)):
15833  *             raise ValueError(u"Non-native byte order not supported")
15834  */
15835     __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
15836     if (!__pyx_t_7) {
15837       goto __pyx_L8_next_or;
15838     } else {
15839     }
15840     __pyx_t_7 = (__pyx_v_little_endian != 0);
15841     if (!__pyx_t_7) {
15842     } else {
15843       __pyx_t_6 = __pyx_t_7;
15844       goto __pyx_L7_bool_binop_done;
15845     }
15846     __pyx_L8_next_or:;
15847 
15848     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":859
15849  *
15850  *         if ((child.byteorder == c'>' and little_endian) or
15851  *             (child.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
15852  *             raise ValueError(u"Non-native byte order not supported")
15853  *             # One could encode it in the format string and have Cython
15854  */
15855     __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
15856     if (__pyx_t_7) {
15857     } else {
15858       __pyx_t_6 = __pyx_t_7;
15859       goto __pyx_L7_bool_binop_done;
15860     }
15861     __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
15862     __pyx_t_6 = __pyx_t_7;
15863     __pyx_L7_bool_binop_done:;
15864 
15865     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
15866  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
15867  *
15868  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
15869  *             (child.byteorder == c'<' and not little_endian)):
15870  *             raise ValueError(u"Non-native byte order not supported")
15871  */
15872     if (unlikely(__pyx_t_6)) {
15873 
15874       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":860
15875  *         if ((child.byteorder == c'>' and little_endian) or
15876  *             (child.byteorder == c'<' and not little_endian)):
15877  *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
15878  *             # One could encode it in the format string and have Cython
15879  *             # complain instead, BUT: < and > in format strings also imply
15880  */
15881       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 860, __pyx_L1_error)
15882       __Pyx_GOTREF(__pyx_t_3);
15883       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15884       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15885       __PYX_ERR(3, 860, __pyx_L1_error)
15886 
15887       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
15888  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
15889  *
15890  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
15891  *             (child.byteorder == c'<' and not little_endian)):
15892  *             raise ValueError(u"Non-native byte order not supported")
15893  */
15894     }
15895 
15896     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":870
15897  *
15898  *         # Output padding bytes
15899  *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
15900  *             f[0] = 120 # "x"; pad byte
15901  *             f += 1
15902  */
15903     while (1) {
15904       __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 870, __pyx_L1_error)
15905       __Pyx_GOTREF(__pyx_t_3);
15906       __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(3, 870, __pyx_L1_error)
15907       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15908       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(3, 870, __pyx_L1_error)
15909       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15910       if (!__pyx_t_6) break;
15911 
15912       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":871
15913  *         # Output padding bytes
15914  *         while offset[0] < new_offset:
15915  *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
15916  *             f += 1
15917  *             offset[0] += 1
15918  */
15919       (__pyx_v_f[0]) = 0x78;
15920 
15921       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":872
15922  *         while offset[0] < new_offset:
15923  *             f[0] = 120 # "x"; pad byte
15924  *             f += 1             # <<<<<<<<<<<<<<
15925  *             offset[0] += 1
15926  *
15927  */
15928       __pyx_v_f = (__pyx_v_f + 1);
15929 
15930       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":873
15931  *             f[0] = 120 # "x"; pad byte
15932  *             f += 1
15933  *             offset[0] += 1             # <<<<<<<<<<<<<<
15934  *
15935  *         offset[0] += child.itemsize
15936  */
15937       __pyx_t_8 = 0;
15938       (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
15939     }
15940 
15941     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":875
15942  *             offset[0] += 1
15943  *
15944  *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
15945  *
15946  *         if not PyDataType_HASFIELDS(child):
15947  */
15948     __pyx_t_8 = 0;
15949     (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
15950 
15951     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":877
15952  *         offset[0] += child.itemsize
15953  *
15954  *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
15955  *             t = child.type_num
15956  *             if end - f < 5:
15957  */
15958     __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
15959     if (__pyx_t_6) {
15960 
15961       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":878
15962  *
15963  *         if not PyDataType_HASFIELDS(child):
15964  *             t = child.type_num             # <<<<<<<<<<<<<<
15965  *             if end - f < 5:
15966  *                 raise RuntimeError(u"Format string allocated too short.")
15967  */
15968       __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 878, __pyx_L1_error)
15969       __Pyx_GOTREF(__pyx_t_4);
15970       __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
15971       __pyx_t_4 = 0;
15972 
15973       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":879
15974  *         if not PyDataType_HASFIELDS(child):
15975  *             t = child.type_num
15976  *             if end - f < 5:             # <<<<<<<<<<<<<<
15977  *                 raise RuntimeError(u"Format string allocated too short.")
15978  *
15979  */
15980       __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
15981       if (unlikely(__pyx_t_6)) {
15982 
15983         /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":880
15984  *             t = child.type_num
15985  *             if end - f < 5:
15986  *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
15987  *
15988  *             # Until ticket #99 is fixed, use integers to avoid warnings
15989  */
15990         __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 880, __pyx_L1_error)
15991         __Pyx_GOTREF(__pyx_t_4);
15992         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
15993         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15994         __PYX_ERR(3, 880, __pyx_L1_error)
15995 
15996         /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":879
15997  *         if not PyDataType_HASFIELDS(child):
15998  *             t = child.type_num
15999  *             if end - f < 5:             # <<<<<<<<<<<<<<
16000  *                 raise RuntimeError(u"Format string allocated too short.")
16001  *
16002  */
16003       }
16004 
16005       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":883
16006  *
16007  *             # Until ticket #99 is fixed, use integers to avoid warnings
16008  *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
16009  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
16010  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
16011  */
16012       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 883, __pyx_L1_error)
16013       __Pyx_GOTREF(__pyx_t_4);
16014       __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(3, 883, __pyx_L1_error)
16015       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16016       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(3, 883, __pyx_L1_error)
16017       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16018       if (__pyx_t_6) {
16019         (__pyx_v_f[0]) = 98;
16020         goto __pyx_L15;
16021       }
16022 
16023       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":884
16024  *             # Until ticket #99 is fixed, use integers to avoid warnings
16025  *             if   t == NPY_BYTE:        f[0] =  98 #"b"
16026  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
16027  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
16028  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
16029  */
16030       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 884, __pyx_L1_error)
16031       __Pyx_GOTREF(__pyx_t_3);
16032       __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(3, 884, __pyx_L1_error)
16033       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16034       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(3, 884, __pyx_L1_error)
16035       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16036       if (__pyx_t_6) {
16037         (__pyx_v_f[0]) = 66;
16038         goto __pyx_L15;
16039       }
16040 
16041       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":885
16042  *             if   t == NPY_BYTE:        f[0] =  98 #"b"
16043  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
16044  *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
16045  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
16046  *             elif t == NPY_INT:         f[0] = 105 #"i"
16047  */
16048       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 885, __pyx_L1_error)
16049       __Pyx_GOTREF(__pyx_t_4);
16050       __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(3, 885, __pyx_L1_error)
16051       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16052       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(3, 885, __pyx_L1_error)
16053       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16054       if (__pyx_t_6) {
16055         (__pyx_v_f[0]) = 0x68;
16056         goto __pyx_L15;
16057       }
16058 
16059       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":886
16060  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
16061  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
16062  *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
16063  *             elif t == NPY_INT:         f[0] = 105 #"i"
16064  *             elif t == NPY_UINT:        f[0] =  73 #"I"
16065  */
16066       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 886, __pyx_L1_error)
16067       __Pyx_GOTREF(__pyx_t_3);
16068       __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(3, 886, __pyx_L1_error)
16069       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16070       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(3, 886, __pyx_L1_error)
16071       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16072       if (__pyx_t_6) {
16073         (__pyx_v_f[0]) = 72;
16074         goto __pyx_L15;
16075       }
16076 
16077       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":887
16078  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
16079  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
16080  *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
16081  *             elif t == NPY_UINT:        f[0] =  73 #"I"
16082  *             elif t == NPY_LONG:        f[0] = 108 #"l"
16083  */
16084       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 887, __pyx_L1_error)
16085       __Pyx_GOTREF(__pyx_t_4);
16086       __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(3, 887, __pyx_L1_error)
16087       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16088       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(3, 887, __pyx_L1_error)
16089       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16090       if (__pyx_t_6) {
16091         (__pyx_v_f[0]) = 0x69;
16092         goto __pyx_L15;
16093       }
16094 
16095       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":888
16096  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
16097  *             elif t == NPY_INT:         f[0] = 105 #"i"
16098  *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
16099  *             elif t == NPY_LONG:        f[0] = 108 #"l"
16100  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
16101  */
16102       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 888, __pyx_L1_error)
16103       __Pyx_GOTREF(__pyx_t_3);
16104       __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(3, 888, __pyx_L1_error)
16105       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16106       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(3, 888, __pyx_L1_error)
16107       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16108       if (__pyx_t_6) {
16109         (__pyx_v_f[0]) = 73;
16110         goto __pyx_L15;
16111       }
16112 
16113       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":889
16114  *             elif t == NPY_INT:         f[0] = 105 #"i"
16115  *             elif t == NPY_UINT:        f[0] =  73 #"I"
16116  *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
16117  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
16118  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
16119  */
16120       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 889, __pyx_L1_error)
16121       __Pyx_GOTREF(__pyx_t_4);
16122       __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(3, 889, __pyx_L1_error)
16123       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16124       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(3, 889, __pyx_L1_error)
16125       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16126       if (__pyx_t_6) {
16127         (__pyx_v_f[0]) = 0x6C;
16128         goto __pyx_L15;
16129       }
16130 
16131       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":890
16132  *             elif t == NPY_UINT:        f[0] =  73 #"I"
16133  *             elif t == NPY_LONG:        f[0] = 108 #"l"
16134  *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
16135  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
16136  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
16137  */
16138       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 890, __pyx_L1_error)
16139       __Pyx_GOTREF(__pyx_t_3);
16140       __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(3, 890, __pyx_L1_error)
16141       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16142       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(3, 890, __pyx_L1_error)
16143       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16144       if (__pyx_t_6) {
16145         (__pyx_v_f[0]) = 76;
16146         goto __pyx_L15;
16147       }
16148 
16149       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":891
16150  *             elif t == NPY_LONG:        f[0] = 108 #"l"
16151  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
16152  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
16153  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
16154  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
16155  */
16156       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 891, __pyx_L1_error)
16157       __Pyx_GOTREF(__pyx_t_4);
16158       __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(3, 891, __pyx_L1_error)
16159       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16160       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(3, 891, __pyx_L1_error)
16161       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16162       if (__pyx_t_6) {
16163         (__pyx_v_f[0]) = 0x71;
16164         goto __pyx_L15;
16165       }
16166 
16167       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":892
16168  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
16169  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
16170  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
16171  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
16172  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
16173  */
16174       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 892, __pyx_L1_error)
16175       __Pyx_GOTREF(__pyx_t_3);
16176       __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(3, 892, __pyx_L1_error)
16177       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16178       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(3, 892, __pyx_L1_error)
16179       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16180       if (__pyx_t_6) {
16181         (__pyx_v_f[0]) = 81;
16182         goto __pyx_L15;
16183       }
16184 
16185       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":893
16186  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
16187  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
16188  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
16189  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
16190  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
16191  */
16192       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 893, __pyx_L1_error)
16193       __Pyx_GOTREF(__pyx_t_4);
16194       __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(3, 893, __pyx_L1_error)
16195       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16196       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(3, 893, __pyx_L1_error)
16197       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16198       if (__pyx_t_6) {
16199         (__pyx_v_f[0]) = 0x66;
16200         goto __pyx_L15;
16201       }
16202 
16203       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":894
16204  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
16205  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
16206  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
16207  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
16208  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
16209  */
16210       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 894, __pyx_L1_error)
16211       __Pyx_GOTREF(__pyx_t_3);
16212       __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(3, 894, __pyx_L1_error)
16213       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16214       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(3, 894, __pyx_L1_error)
16215       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16216       if (__pyx_t_6) {
16217         (__pyx_v_f[0]) = 0x64;
16218         goto __pyx_L15;
16219       }
16220 
16221       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":895
16222  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
16223  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
16224  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
16225  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
16226  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
16227  */
16228       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 895, __pyx_L1_error)
16229       __Pyx_GOTREF(__pyx_t_4);
16230       __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(3, 895, __pyx_L1_error)
16231       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16232       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(3, 895, __pyx_L1_error)
16233       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16234       if (__pyx_t_6) {
16235         (__pyx_v_f[0]) = 0x67;
16236         goto __pyx_L15;
16237       }
16238 
16239       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":896
16240  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
16241  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
16242  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
16243  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
16244  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
16245  */
16246       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 896, __pyx_L1_error)
16247       __Pyx_GOTREF(__pyx_t_3);
16248       __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(3, 896, __pyx_L1_error)
16249       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16250       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(3, 896, __pyx_L1_error)
16251       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16252       if (__pyx_t_6) {
16253         (__pyx_v_f[0]) = 90;
16254         (__pyx_v_f[1]) = 0x66;
16255         __pyx_v_f = (__pyx_v_f + 1);
16256         goto __pyx_L15;
16257       }
16258 
16259       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":897
16260  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
16261  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
16262  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
16263  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
16264  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
16265  */
16266       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 897, __pyx_L1_error)
16267       __Pyx_GOTREF(__pyx_t_4);
16268       __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(3, 897, __pyx_L1_error)
16269       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16270       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(3, 897, __pyx_L1_error)
16271       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16272       if (__pyx_t_6) {
16273         (__pyx_v_f[0]) = 90;
16274         (__pyx_v_f[1]) = 0x64;
16275         __pyx_v_f = (__pyx_v_f + 1);
16276         goto __pyx_L15;
16277       }
16278 
16279       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":898
16280  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
16281  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
16282  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
16283  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
16284  *             else:
16285  */
16286       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 898, __pyx_L1_error)
16287       __Pyx_GOTREF(__pyx_t_3);
16288       __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(3, 898, __pyx_L1_error)
16289       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16290       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(3, 898, __pyx_L1_error)
16291       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16292       if (__pyx_t_6) {
16293         (__pyx_v_f[0]) = 90;
16294         (__pyx_v_f[1]) = 0x67;
16295         __pyx_v_f = (__pyx_v_f + 1);
16296         goto __pyx_L15;
16297       }
16298 
16299       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":899
16300  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
16301  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
16302  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
16303  *             else:
16304  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
16305  */
16306       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 899, __pyx_L1_error)
16307       __Pyx_GOTREF(__pyx_t_4);
16308       __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(3, 899, __pyx_L1_error)
16309       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16310       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(3, 899, __pyx_L1_error)
16311       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16312       if (likely(__pyx_t_6)) {
16313         (__pyx_v_f[0]) = 79;
16314         goto __pyx_L15;
16315       }
16316 
16317       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":901
16318  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
16319  *             else:
16320  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
16321  *             f += 1
16322  *         else:
16323  */
16324       /*else*/ {
16325         __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(3, 901, __pyx_L1_error)
16326         __Pyx_GOTREF(__pyx_t_3);
16327         __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 901, __pyx_L1_error)
16328         __Pyx_GOTREF(__pyx_t_4);
16329         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16330         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
16331         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16332         __PYX_ERR(3, 901, __pyx_L1_error)
16333       }
16334       __pyx_L15:;
16335 
16336       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":902
16337  *             else:
16338  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
16339  *             f += 1             # <<<<<<<<<<<<<<
16340  *         else:
16341  *             # Cython ignores struct boundary information ("T{...}"),
16342  */
16343       __pyx_v_f = (__pyx_v_f + 1);
16344 
16345       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":877
16346  *         offset[0] += child.itemsize
16347  *
16348  *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
16349  *             t = child.type_num
16350  *             if end - f < 5:
16351  */
16352       goto __pyx_L13;
16353     }
16354 
16355     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":906
16356  *             # Cython ignores struct boundary information ("T{...}"),
16357  *             # so don't output it
16358  *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
16359  *     return f
16360  *
16361  */
16362     /*else*/ {
16363       __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(3, 906, __pyx_L1_error)
16364       __pyx_v_f = __pyx_t_9;
16365     }
16366     __pyx_L13:;
16367 
16368     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851
16369  *     cdef tuple fields
16370  *
16371  *     for childname in descr.names:             # <<<<<<<<<<<<<<
16372  *         fields = descr.fields[childname]
16373  *         child, new_offset = fields
16374  */
16375   }
16376   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16377 
16378   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":907
16379  *             # so don't output it
16380  *             f = _util_dtypestring(child, f, end, offset)
16381  *     return f             # <<<<<<<<<<<<<<
16382  *
16383  *
16384  */
16385   __pyx_r = __pyx_v_f;
16386   goto __pyx_L0;
16387 
16388   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842
16389  *         return ()
16390  *
16391  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
16392  *     # Recursive utility function used in __getbuffer__ to get format
16393  *     # string. The new location in the format string is returned.
16394  */
16395 
16396   /* function exit code */
16397   __pyx_L1_error:;
16398   __Pyx_XDECREF(__pyx_t_1);
16399   __Pyx_XDECREF(__pyx_t_3);
16400   __Pyx_XDECREF(__pyx_t_4);
16401   __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
16402   __pyx_r = NULL;
16403   __pyx_L0:;
16404   __Pyx_XDECREF((PyObject *)__pyx_v_child);
16405   __Pyx_XDECREF(__pyx_v_fields);
16406   __Pyx_XDECREF(__pyx_v_childname);
16407   __Pyx_XDECREF(__pyx_v_new_offset);
16408   __Pyx_XDECREF(__pyx_v_t);
16409   __Pyx_RefNannyFinishContext();
16410   return __pyx_r;
16411 }
16412 
16413 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022
16414  *     int _import_umath() except -1
16415  *
16416  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
16417  *     Py_INCREF(base) # important to do this before stealing the reference below!
16418  *     PyArray_SetBaseObject(arr, base)
16419  */
16420 
16421 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
16422   __Pyx_RefNannyDeclarations
16423   __Pyx_RefNannySetupContext("set_array_base", 0);
16424 
16425   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1023
16426  *
16427  * cdef inline void set_array_base(ndarray arr, object base):
16428  *     Py_INCREF(base) # important to do this before stealing the reference below!             # <<<<<<<<<<<<<<
16429  *     PyArray_SetBaseObject(arr, base)
16430  *
16431  */
16432   Py_INCREF(__pyx_v_base);
16433 
16434   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1024
16435  * cdef inline void set_array_base(ndarray arr, object base):
16436  *     Py_INCREF(base) # important to do this before stealing the reference below!
16437  *     PyArray_SetBaseObject(arr, base)             # <<<<<<<<<<<<<<
16438  *
16439  * cdef inline object get_array_base(ndarray arr):
16440  */
16441   (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
16442 
16443   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022
16444  *     int _import_umath() except -1
16445  *
16446  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
16447  *     Py_INCREF(base) # important to do this before stealing the reference below!
16448  *     PyArray_SetBaseObject(arr, base)
16449  */
16450 
16451   /* function exit code */
16452   __Pyx_RefNannyFinishContext();
16453 }
16454 
16455 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1026
16456  *     PyArray_SetBaseObject(arr, base)
16457  *
16458  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
16459  *     base = PyArray_BASE(arr)
16460  *     if base is NULL:
16461  */
16462 
16463 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
16464   PyObject *__pyx_v_base;
16465   PyObject *__pyx_r = NULL;
16466   __Pyx_RefNannyDeclarations
16467   int __pyx_t_1;
16468   __Pyx_RefNannySetupContext("get_array_base", 0);
16469 
16470   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1027
16471  *
16472  * cdef inline object get_array_base(ndarray arr):
16473  *     base = PyArray_BASE(arr)             # <<<<<<<<<<<<<<
16474  *     if base is NULL:
16475  *         return None
16476  */
16477   __pyx_v_base = PyArray_BASE(__pyx_v_arr);
16478 
16479   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1028
16480  * cdef inline object get_array_base(ndarray arr):
16481  *     base = PyArray_BASE(arr)
16482  *     if base is NULL:             # <<<<<<<<<<<<<<
16483  *         return None
16484  *     return <object>base
16485  */
16486   __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
16487   if (__pyx_t_1) {
16488 
16489     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1029
16490  *     base = PyArray_BASE(arr)
16491  *     if base is NULL:
16492  *         return None             # <<<<<<<<<<<<<<
16493  *     return <object>base
16494  *
16495  */
16496     __Pyx_XDECREF(__pyx_r);
16497     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16498     goto __pyx_L0;
16499 
16500     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1028
16501  * cdef inline object get_array_base(ndarray arr):
16502  *     base = PyArray_BASE(arr)
16503  *     if base is NULL:             # <<<<<<<<<<<<<<
16504  *         return None
16505  *     return <object>base
16506  */
16507   }
16508 
16509   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1030
16510  *     if base is NULL:
16511  *         return None
16512  *     return <object>base             # <<<<<<<<<<<<<<
16513  *
16514  * # Versions of the import_* functions which are more suitable for
16515  */
16516   __Pyx_XDECREF(__pyx_r);
16517   __Pyx_INCREF(((PyObject *)__pyx_v_base));
16518   __pyx_r = ((PyObject *)__pyx_v_base);
16519   goto __pyx_L0;
16520 
16521   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1026
16522  *     PyArray_SetBaseObject(arr, base)
16523  *
16524  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
16525  *     base = PyArray_BASE(arr)
16526  *     if base is NULL:
16527  */
16528 
16529   /* function exit code */
16530   __pyx_L0:;
16531   __Pyx_XGIVEREF(__pyx_r);
16532   __Pyx_RefNannyFinishContext();
16533   return __pyx_r;
16534 }
16535 
16536 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1034
16537  * # Versions of the import_* functions which are more suitable for
16538  * # Cython code.
16539  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
16540  *     try:
16541  *         _import_array()
16542  */
16543 
16544 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
16545   int __pyx_r;
16546   __Pyx_RefNannyDeclarations
16547   PyObject *__pyx_t_1 = NULL;
16548   PyObject *__pyx_t_2 = NULL;
16549   PyObject *__pyx_t_3 = NULL;
16550   int __pyx_t_4;
16551   PyObject *__pyx_t_5 = NULL;
16552   PyObject *__pyx_t_6 = NULL;
16553   PyObject *__pyx_t_7 = NULL;
16554   PyObject *__pyx_t_8 = NULL;
16555   __Pyx_RefNannySetupContext("import_array", 0);
16556 
16557   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
16558  * # Cython code.
16559  * cdef inline int import_array() except -1:
16560  *     try:             # <<<<<<<<<<<<<<
16561  *         _import_array()
16562  *     except Exception:
16563  */
16564   {
16565     __Pyx_PyThreadState_declare
16566     __Pyx_PyThreadState_assign
16567     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
16568     __Pyx_XGOTREF(__pyx_t_1);
16569     __Pyx_XGOTREF(__pyx_t_2);
16570     __Pyx_XGOTREF(__pyx_t_3);
16571     /*try:*/ {
16572 
16573       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1036
16574  * cdef inline int import_array() except -1:
16575  *     try:
16576  *         _import_array()             # <<<<<<<<<<<<<<
16577  *     except Exception:
16578  *         raise ImportError("numpy.core.multiarray failed to import")
16579  */
16580       __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(3, 1036, __pyx_L3_error)
16581 
16582       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
16583  * # Cython code.
16584  * cdef inline int import_array() except -1:
16585  *     try:             # <<<<<<<<<<<<<<
16586  *         _import_array()
16587  *     except Exception:
16588  */
16589     }
16590     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
16591     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
16592     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
16593     goto __pyx_L8_try_end;
16594     __pyx_L3_error:;
16595 
16596     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1037
16597  *     try:
16598  *         _import_array()
16599  *     except Exception:             # <<<<<<<<<<<<<<
16600  *         raise ImportError("numpy.core.multiarray failed to import")
16601  *
16602  */
16603     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
16604     if (__pyx_t_4) {
16605       __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
16606       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(3, 1037, __pyx_L5_except_error)
16607       __Pyx_GOTREF(__pyx_t_5);
16608       __Pyx_GOTREF(__pyx_t_6);
16609       __Pyx_GOTREF(__pyx_t_7);
16610 
16611       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1038
16612  *         _import_array()
16613  *     except Exception:
16614  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
16615  *
16616  * cdef inline int import_umath() except -1:
16617  */
16618       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 1038, __pyx_L5_except_error)
16619       __Pyx_GOTREF(__pyx_t_8);
16620       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
16621       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
16622       __PYX_ERR(3, 1038, __pyx_L5_except_error)
16623     }
16624     goto __pyx_L5_except_error;
16625     __pyx_L5_except_error:;
16626 
16627     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
16628  * # Cython code.
16629  * cdef inline int import_array() except -1:
16630  *     try:             # <<<<<<<<<<<<<<
16631  *         _import_array()
16632  *     except Exception:
16633  */
16634     __Pyx_XGIVEREF(__pyx_t_1);
16635     __Pyx_XGIVEREF(__pyx_t_2);
16636     __Pyx_XGIVEREF(__pyx_t_3);
16637     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
16638     goto __pyx_L1_error;
16639     __pyx_L8_try_end:;
16640   }
16641 
16642   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1034
16643  * # Versions of the import_* functions which are more suitable for
16644  * # Cython code.
16645  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
16646  *     try:
16647  *         _import_array()
16648  */
16649 
16650   /* function exit code */
16651   __pyx_r = 0;
16652   goto __pyx_L0;
16653   __pyx_L1_error:;
16654   __Pyx_XDECREF(__pyx_t_5);
16655   __Pyx_XDECREF(__pyx_t_6);
16656   __Pyx_XDECREF(__pyx_t_7);
16657   __Pyx_XDECREF(__pyx_t_8);
16658   __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
16659   __pyx_r = -1;
16660   __pyx_L0:;
16661   __Pyx_RefNannyFinishContext();
16662   return __pyx_r;
16663 }
16664 
16665 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1040
16666  *         raise ImportError("numpy.core.multiarray failed to import")
16667  *
16668  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
16669  *     try:
16670  *         _import_umath()
16671  */
16672 
16673 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
16674   int __pyx_r;
16675   __Pyx_RefNannyDeclarations
16676   PyObject *__pyx_t_1 = NULL;
16677   PyObject *__pyx_t_2 = NULL;
16678   PyObject *__pyx_t_3 = NULL;
16679   int __pyx_t_4;
16680   PyObject *__pyx_t_5 = NULL;
16681   PyObject *__pyx_t_6 = NULL;
16682   PyObject *__pyx_t_7 = NULL;
16683   PyObject *__pyx_t_8 = NULL;
16684   __Pyx_RefNannySetupContext("import_umath", 0);
16685 
16686   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
16687  *
16688  * cdef inline int import_umath() except -1:
16689  *     try:             # <<<<<<<<<<<<<<
16690  *         _import_umath()
16691  *     except Exception:
16692  */
16693   {
16694     __Pyx_PyThreadState_declare
16695     __Pyx_PyThreadState_assign
16696     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
16697     __Pyx_XGOTREF(__pyx_t_1);
16698     __Pyx_XGOTREF(__pyx_t_2);
16699     __Pyx_XGOTREF(__pyx_t_3);
16700     /*try:*/ {
16701 
16702       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1042
16703  * cdef inline int import_umath() except -1:
16704  *     try:
16705  *         _import_umath()             # <<<<<<<<<<<<<<
16706  *     except Exception:
16707  *         raise ImportError("numpy.core.umath failed to import")
16708  */
16709       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(3, 1042, __pyx_L3_error)
16710 
16711       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
16712  *
16713  * cdef inline int import_umath() except -1:
16714  *     try:             # <<<<<<<<<<<<<<
16715  *         _import_umath()
16716  *     except Exception:
16717  */
16718     }
16719     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
16720     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
16721     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
16722     goto __pyx_L8_try_end;
16723     __pyx_L3_error:;
16724 
16725     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1043
16726  *     try:
16727  *         _import_umath()
16728  *     except Exception:             # <<<<<<<<<<<<<<
16729  *         raise ImportError("numpy.core.umath failed to import")
16730  *
16731  */
16732     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
16733     if (__pyx_t_4) {
16734       __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
16735       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(3, 1043, __pyx_L5_except_error)
16736       __Pyx_GOTREF(__pyx_t_5);
16737       __Pyx_GOTREF(__pyx_t_6);
16738       __Pyx_GOTREF(__pyx_t_7);
16739 
16740       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1044
16741  *         _import_umath()
16742  *     except Exception:
16743  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
16744  *
16745  * cdef inline int import_ufunc() except -1:
16746  */
16747       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 1044, __pyx_L5_except_error)
16748       __Pyx_GOTREF(__pyx_t_8);
16749       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
16750       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
16751       __PYX_ERR(3, 1044, __pyx_L5_except_error)
16752     }
16753     goto __pyx_L5_except_error;
16754     __pyx_L5_except_error:;
16755 
16756     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
16757  *
16758  * cdef inline int import_umath() except -1:
16759  *     try:             # <<<<<<<<<<<<<<
16760  *         _import_umath()
16761  *     except Exception:
16762  */
16763     __Pyx_XGIVEREF(__pyx_t_1);
16764     __Pyx_XGIVEREF(__pyx_t_2);
16765     __Pyx_XGIVEREF(__pyx_t_3);
16766     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
16767     goto __pyx_L1_error;
16768     __pyx_L8_try_end:;
16769   }
16770 
16771   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1040
16772  *         raise ImportError("numpy.core.multiarray failed to import")
16773  *
16774  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
16775  *     try:
16776  *         _import_umath()
16777  */
16778 
16779   /* function exit code */
16780   __pyx_r = 0;
16781   goto __pyx_L0;
16782   __pyx_L1_error:;
16783   __Pyx_XDECREF(__pyx_t_5);
16784   __Pyx_XDECREF(__pyx_t_6);
16785   __Pyx_XDECREF(__pyx_t_7);
16786   __Pyx_XDECREF(__pyx_t_8);
16787   __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
16788   __pyx_r = -1;
16789   __pyx_L0:;
16790   __Pyx_RefNannyFinishContext();
16791   return __pyx_r;
16792 }
16793 
16794 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046
16795  *         raise ImportError("numpy.core.umath failed to import")
16796  *
16797  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
16798  *     try:
16799  *         _import_umath()
16800  */
16801 
16802 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
16803   int __pyx_r;
16804   __Pyx_RefNannyDeclarations
16805   PyObject *__pyx_t_1 = NULL;
16806   PyObject *__pyx_t_2 = NULL;
16807   PyObject *__pyx_t_3 = NULL;
16808   int __pyx_t_4;
16809   PyObject *__pyx_t_5 = NULL;
16810   PyObject *__pyx_t_6 = NULL;
16811   PyObject *__pyx_t_7 = NULL;
16812   PyObject *__pyx_t_8 = NULL;
16813   __Pyx_RefNannySetupContext("import_ufunc", 0);
16814 
16815   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
16816  *
16817  * cdef inline int import_ufunc() except -1:
16818  *     try:             # <<<<<<<<<<<<<<
16819  *         _import_umath()
16820  *     except Exception:
16821  */
16822   {
16823     __Pyx_PyThreadState_declare
16824     __Pyx_PyThreadState_assign
16825     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
16826     __Pyx_XGOTREF(__pyx_t_1);
16827     __Pyx_XGOTREF(__pyx_t_2);
16828     __Pyx_XGOTREF(__pyx_t_3);
16829     /*try:*/ {
16830 
16831       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1048
16832  * cdef inline int import_ufunc() except -1:
16833  *     try:
16834  *         _import_umath()             # <<<<<<<<<<<<<<
16835  *     except Exception:
16836  *         raise ImportError("numpy.core.umath failed to import")
16837  */
16838       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(3, 1048, __pyx_L3_error)
16839 
16840       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
16841  *
16842  * cdef inline int import_ufunc() except -1:
16843  *     try:             # <<<<<<<<<<<<<<
16844  *         _import_umath()
16845  *     except Exception:
16846  */
16847     }
16848     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
16849     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
16850     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
16851     goto __pyx_L8_try_end;
16852     __pyx_L3_error:;
16853 
16854     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1049
16855  *     try:
16856  *         _import_umath()
16857  *     except Exception:             # <<<<<<<<<<<<<<
16858  *         raise ImportError("numpy.core.umath failed to import")
16859  */
16860     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
16861     if (__pyx_t_4) {
16862       __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
16863       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(3, 1049, __pyx_L5_except_error)
16864       __Pyx_GOTREF(__pyx_t_5);
16865       __Pyx_GOTREF(__pyx_t_6);
16866       __Pyx_GOTREF(__pyx_t_7);
16867 
16868       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1050
16869  *         _import_umath()
16870  *     except Exception:
16871  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
16872  */
16873       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 1050, __pyx_L5_except_error)
16874       __Pyx_GOTREF(__pyx_t_8);
16875       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
16876       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
16877       __PYX_ERR(3, 1050, __pyx_L5_except_error)
16878     }
16879     goto __pyx_L5_except_error;
16880     __pyx_L5_except_error:;
16881 
16882     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
16883  *
16884  * cdef inline int import_ufunc() except -1:
16885  *     try:             # <<<<<<<<<<<<<<
16886  *         _import_umath()
16887  *     except Exception:
16888  */
16889     __Pyx_XGIVEREF(__pyx_t_1);
16890     __Pyx_XGIVEREF(__pyx_t_2);
16891     __Pyx_XGIVEREF(__pyx_t_3);
16892     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
16893     goto __pyx_L1_error;
16894     __pyx_L8_try_end:;
16895   }
16896 
16897   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046
16898  *         raise ImportError("numpy.core.umath failed to import")
16899  *
16900  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
16901  *     try:
16902  *         _import_umath()
16903  */
16904 
16905   /* function exit code */
16906   __pyx_r = 0;
16907   goto __pyx_L0;
16908   __pyx_L1_error:;
16909   __Pyx_XDECREF(__pyx_t_5);
16910   __Pyx_XDECREF(__pyx_t_6);
16911   __Pyx_XDECREF(__pyx_t_7);
16912   __Pyx_XDECREF(__pyx_t_8);
16913   __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
16914   __pyx_r = -1;
16915   __pyx_L0:;
16916   __Pyx_RefNannyFinishContext();
16917   return __pyx_r;
16918 }
16919 
16920 /* "View.MemoryView":122
16921  *         cdef bint dtype_is_object
16922  *
16923  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
16924  *                   mode="c", bint allocate_buffer=True):
16925  *
16926  */
16927 
16928 /* Python wrapper */
16929 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
16930 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16931   PyObject *__pyx_v_shape = 0;
16932   Py_ssize_t __pyx_v_itemsize;
16933   PyObject *__pyx_v_format = 0;
16934   PyObject *__pyx_v_mode = 0;
16935   int __pyx_v_allocate_buffer;
16936   int __pyx_r;
16937   __Pyx_RefNannyDeclarations
16938   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
16939   {
16940     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};
16941     PyObject* values[5] = {0,0,0,0,0};
16942     values[3] = ((PyObject *)__pyx_n_s_c);
16943     if (unlikely(__pyx_kwds)) {
16944       Py_ssize_t kw_args;
16945       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
16946       switch (pos_args) {
16947         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16948         CYTHON_FALLTHROUGH;
16949         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16950         CYTHON_FALLTHROUGH;
16951         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16952         CYTHON_FALLTHROUGH;
16953         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16954         CYTHON_FALLTHROUGH;
16955         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16956         CYTHON_FALLTHROUGH;
16957         case  0: break;
16958         default: goto __pyx_L5_argtuple_error;
16959       }
16960       kw_args = PyDict_Size(__pyx_kwds);
16961       switch (pos_args) {
16962         case  0:
16963         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
16964         else goto __pyx_L5_argtuple_error;
16965         CYTHON_FALLTHROUGH;
16966         case  1:
16967         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
16968         else {
16969           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(1, 122, __pyx_L3_error)
16970         }
16971         CYTHON_FALLTHROUGH;
16972         case  2:
16973         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
16974         else {
16975           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(1, 122, __pyx_L3_error)
16976         }
16977         CYTHON_FALLTHROUGH;
16978         case  3:
16979         if (kw_args > 0) {
16980           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
16981           if (value) { values[3] = value; kw_args--; }
16982         }
16983         CYTHON_FALLTHROUGH;
16984         case  4:
16985         if (kw_args > 0) {
16986           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
16987           if (value) { values[4] = value; kw_args--; }
16988         }
16989       }
16990       if (unlikely(kw_args > 0)) {
16991         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 122, __pyx_L3_error)
16992       }
16993     } else {
16994       switch (PyTuple_GET_SIZE(__pyx_args)) {
16995         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16996         CYTHON_FALLTHROUGH;
16997         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16998         CYTHON_FALLTHROUGH;
16999         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17000         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17001         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17002         break;
17003         default: goto __pyx_L5_argtuple_error;
17004       }
17005     }
17006     __pyx_v_shape = ((PyObject*)values[0]);
17007     __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 122, __pyx_L3_error)
17008     __pyx_v_format = values[2];
17009     __pyx_v_mode = values[3];
17010     if (values[4]) {
17011       __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 123, __pyx_L3_error)
17012     } else {
17013 
17014       /* "View.MemoryView":123
17015  *
17016  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
17017  *                   mode="c", bint allocate_buffer=True):             # <<<<<<<<<<<<<<
17018  *
17019  *         cdef int idx
17020  */
17021       __pyx_v_allocate_buffer = ((int)1);
17022     }
17023   }
17024   goto __pyx_L4_argument_unpacking_done;
17025   __pyx_L5_argtuple_error:;
17026   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 122, __pyx_L3_error)
17027   __pyx_L3_error:;
17028   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
17029   __Pyx_RefNannyFinishContext();
17030   return -1;
17031   __pyx_L4_argument_unpacking_done:;
17032   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 122, __pyx_L1_error)
17033   if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
17034     PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 122, __pyx_L1_error)
17035   }
17036   __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);
17037 
17038   /* "View.MemoryView":122
17039  *         cdef bint dtype_is_object
17040  *
17041  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
17042  *                   mode="c", bint allocate_buffer=True):
17043  *
17044  */
17045 
17046   /* function exit code */
17047   goto __pyx_L0;
17048   __pyx_L1_error:;
17049   __pyx_r = -1;
17050   __pyx_L0:;
17051   __Pyx_RefNannyFinishContext();
17052   return __pyx_r;
17053 }
17054 
17055 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) {
17056   int __pyx_v_idx;
17057   Py_ssize_t __pyx_v_i;
17058   Py_ssize_t __pyx_v_dim;
17059   PyObject **__pyx_v_p;
17060   char __pyx_v_order;
17061   int __pyx_r;
17062   __Pyx_RefNannyDeclarations
17063   Py_ssize_t __pyx_t_1;
17064   int __pyx_t_2;
17065   PyObject *__pyx_t_3 = NULL;
17066   int __pyx_t_4;
17067   PyObject *__pyx_t_5 = NULL;
17068   PyObject *__pyx_t_6 = NULL;
17069   char *__pyx_t_7;
17070   int __pyx_t_8;
17071   Py_ssize_t __pyx_t_9;
17072   PyObject *__pyx_t_10 = NULL;
17073   Py_ssize_t __pyx_t_11;
17074   __Pyx_RefNannySetupContext("__cinit__", 0);
17075   __Pyx_INCREF(__pyx_v_format);
17076 
17077   /* "View.MemoryView":129
17078  *         cdef PyObject **p
17079  *
17080  *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
17081  *         self.itemsize = itemsize
17082  *
17083  */
17084   if (unlikely(__pyx_v_shape == Py_None)) {
17085     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
17086     __PYX_ERR(1, 129, __pyx_L1_error)
17087   }
17088   __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 129, __pyx_L1_error)
17089   __pyx_v_self->ndim = ((int)__pyx_t_1);
17090 
17091   /* "View.MemoryView":130
17092  *
17093  *         self.ndim = <int> len(shape)
17094  *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
17095  *
17096  *         if not self.ndim:
17097  */
17098   __pyx_v_self->itemsize = __pyx_v_itemsize;
17099 
17100   /* "View.MemoryView":132
17101  *         self.itemsize = itemsize
17102  *
17103  *         if not self.ndim:             # <<<<<<<<<<<<<<
17104  *             raise ValueError("Empty shape tuple for cython.array")
17105  *
17106  */
17107   __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
17108   if (unlikely(__pyx_t_2)) {
17109 
17110     /* "View.MemoryView":133
17111  *
17112  *         if not self.ndim:
17113  *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
17114  *
17115  *         if itemsize <= 0:
17116  */
17117     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 133, __pyx_L1_error)
17118     __Pyx_GOTREF(__pyx_t_3);
17119     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
17120     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17121     __PYX_ERR(1, 133, __pyx_L1_error)
17122 
17123     /* "View.MemoryView":132
17124  *         self.itemsize = itemsize
17125  *
17126  *         if not self.ndim:             # <<<<<<<<<<<<<<
17127  *             raise ValueError("Empty shape tuple for cython.array")
17128  *
17129  */
17130   }
17131 
17132   /* "View.MemoryView":135
17133  *             raise ValueError("Empty shape tuple for cython.array")
17134  *
17135  *         if itemsize <= 0:             # <<<<<<<<<<<<<<
17136  *             raise ValueError("itemsize <= 0 for cython.array")
17137  *
17138  */
17139   __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
17140   if (unlikely(__pyx_t_2)) {
17141 
17142     /* "View.MemoryView":136
17143  *
17144  *         if itemsize <= 0:
17145  *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
17146  *
17147  *         if not isinstance(format, bytes):
17148  */
17149     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 136, __pyx_L1_error)
17150     __Pyx_GOTREF(__pyx_t_3);
17151     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
17152     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17153     __PYX_ERR(1, 136, __pyx_L1_error)
17154 
17155     /* "View.MemoryView":135
17156  *             raise ValueError("Empty shape tuple for cython.array")
17157  *
17158  *         if itemsize <= 0:             # <<<<<<<<<<<<<<
17159  *             raise ValueError("itemsize <= 0 for cython.array")
17160  *
17161  */
17162   }
17163 
17164   /* "View.MemoryView":138
17165  *             raise ValueError("itemsize <= 0 for cython.array")
17166  *
17167  *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
17168  *             format = format.encode('ASCII')
17169  *         self._format = format  # keep a reference to the byte string
17170  */
17171   __pyx_t_2 = PyBytes_Check(__pyx_v_format);
17172   __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
17173   if (__pyx_t_4) {
17174 
17175     /* "View.MemoryView":139
17176  *
17177  *         if not isinstance(format, bytes):
17178  *             format = format.encode('ASCII')             # <<<<<<<<<<<<<<
17179  *         self._format = format  # keep a reference to the byte string
17180  *         self.format = self._format
17181  */
17182     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 139, __pyx_L1_error)
17183     __Pyx_GOTREF(__pyx_t_5);
17184     __pyx_t_6 = NULL;
17185     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
17186       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
17187       if (likely(__pyx_t_6)) {
17188         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
17189         __Pyx_INCREF(__pyx_t_6);
17190         __Pyx_INCREF(function);
17191         __Pyx_DECREF_SET(__pyx_t_5, function);
17192       }
17193     }
17194     __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);
17195     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
17196     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 139, __pyx_L1_error)
17197     __Pyx_GOTREF(__pyx_t_3);
17198     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
17199     __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
17200     __pyx_t_3 = 0;
17201 
17202     /* "View.MemoryView":138
17203  *             raise ValueError("itemsize <= 0 for cython.array")
17204  *
17205  *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
17206  *             format = format.encode('ASCII')
17207  *         self._format = format  # keep a reference to the byte string
17208  */
17209   }
17210 
17211   /* "View.MemoryView":140
17212  *         if not isinstance(format, bytes):
17213  *             format = format.encode('ASCII')
17214  *         self._format = format  # keep a reference to the byte string             # <<<<<<<<<<<<<<
17215  *         self.format = self._format
17216  *
17217  */
17218   if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(1, 140, __pyx_L1_error)
17219   __pyx_t_3 = __pyx_v_format;
17220   __Pyx_INCREF(__pyx_t_3);
17221   __Pyx_GIVEREF(__pyx_t_3);
17222   __Pyx_GOTREF(__pyx_v_self->_format);
17223   __Pyx_DECREF(__pyx_v_self->_format);
17224   __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
17225   __pyx_t_3 = 0;
17226 
17227   /* "View.MemoryView":141
17228  *             format = format.encode('ASCII')
17229  *         self._format = format  # keep a reference to the byte string
17230  *         self.format = self._format             # <<<<<<<<<<<<<<
17231  *
17232  *
17233  */
17234   if (unlikely(__pyx_v_self->_format == Py_None)) {
17235     PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
17236     __PYX_ERR(1, 141, __pyx_L1_error)
17237   }
17238   __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 141, __pyx_L1_error)
17239   __pyx_v_self->format = __pyx_t_7;
17240 
17241   /* "View.MemoryView":144
17242  *
17243  *
17244  *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)             # <<<<<<<<<<<<<<
17245  *         self._strides = self._shape + self.ndim
17246  *
17247  */
17248   __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
17249 
17250   /* "View.MemoryView":145
17251  *
17252  *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
17253  *         self._strides = self._shape + self.ndim             # <<<<<<<<<<<<<<
17254  *
17255  *         if not self._shape:
17256  */
17257   __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
17258 
17259   /* "View.MemoryView":147
17260  *         self._strides = self._shape + self.ndim
17261  *
17262  *         if not self._shape:             # <<<<<<<<<<<<<<
17263  *             raise MemoryError("unable to allocate shape and strides.")
17264  *
17265  */
17266   __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
17267   if (unlikely(__pyx_t_4)) {
17268 
17269     /* "View.MemoryView":148
17270  *
17271  *         if not self._shape:
17272  *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
17273  *
17274  *
17275  */
17276     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 148, __pyx_L1_error)
17277     __Pyx_GOTREF(__pyx_t_3);
17278     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
17279     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17280     __PYX_ERR(1, 148, __pyx_L1_error)
17281 
17282     /* "View.MemoryView":147
17283  *         self._strides = self._shape + self.ndim
17284  *
17285  *         if not self._shape:             # <<<<<<<<<<<<<<
17286  *             raise MemoryError("unable to allocate shape and strides.")
17287  *
17288  */
17289   }
17290 
17291   /* "View.MemoryView":151
17292  *
17293  *
17294  *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
17295  *             if dim <= 0:
17296  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
17297  */
17298   __pyx_t_8 = 0;
17299   __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
17300   for (;;) {
17301     if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
17302     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
17303     __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(1, 151, __pyx_L1_error)
17304     #else
17305     __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 151, __pyx_L1_error)
17306     __Pyx_GOTREF(__pyx_t_5);
17307     #endif
17308     __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 151, __pyx_L1_error)
17309     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
17310     __pyx_v_dim = __pyx_t_9;
17311     __pyx_v_idx = __pyx_t_8;
17312     __pyx_t_8 = (__pyx_t_8 + 1);
17313 
17314     /* "View.MemoryView":152
17315  *
17316  *         for idx, dim in enumerate(shape):
17317  *             if dim <= 0:             # <<<<<<<<<<<<<<
17318  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
17319  *             self._shape[idx] = dim
17320  */
17321     __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
17322     if (unlikely(__pyx_t_4)) {
17323 
17324       /* "View.MemoryView":153
17325  *         for idx, dim in enumerate(shape):
17326  *             if dim <= 0:
17327  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))             # <<<<<<<<<<<<<<
17328  *             self._shape[idx] = dim
17329  *
17330  */
17331       __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 153, __pyx_L1_error)
17332       __Pyx_GOTREF(__pyx_t_5);
17333       __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 153, __pyx_L1_error)
17334       __Pyx_GOTREF(__pyx_t_6);
17335       __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 153, __pyx_L1_error)
17336       __Pyx_GOTREF(__pyx_t_10);
17337       __Pyx_GIVEREF(__pyx_t_5);
17338       PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
17339       __Pyx_GIVEREF(__pyx_t_6);
17340       PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
17341       __pyx_t_5 = 0;
17342       __pyx_t_6 = 0;
17343       __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 153, __pyx_L1_error)
17344       __Pyx_GOTREF(__pyx_t_6);
17345       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
17346       __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 153, __pyx_L1_error)
17347       __Pyx_GOTREF(__pyx_t_10);
17348       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
17349       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
17350       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
17351       __PYX_ERR(1, 153, __pyx_L1_error)
17352 
17353       /* "View.MemoryView":152
17354  *
17355  *         for idx, dim in enumerate(shape):
17356  *             if dim <= 0:             # <<<<<<<<<<<<<<
17357  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
17358  *             self._shape[idx] = dim
17359  */
17360     }
17361 
17362     /* "View.MemoryView":154
17363  *             if dim <= 0:
17364  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
17365  *             self._shape[idx] = dim             # <<<<<<<<<<<<<<
17366  *
17367  *         cdef char order
17368  */
17369     (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
17370 
17371     /* "View.MemoryView":151
17372  *
17373  *
17374  *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
17375  *             if dim <= 0:
17376  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
17377  */
17378   }
17379   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17380 
17381   /* "View.MemoryView":157
17382  *
17383  *         cdef char order
17384  *         if mode == 'fortran':             # <<<<<<<<<<<<<<
17385  *             order = b'F'
17386  *             self.mode = u'fortran'
17387  */
17388   __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 157, __pyx_L1_error)
17389   if (__pyx_t_4) {
17390 
17391     /* "View.MemoryView":158
17392  *         cdef char order
17393  *         if mode == 'fortran':
17394  *             order = b'F'             # <<<<<<<<<<<<<<
17395  *             self.mode = u'fortran'
17396  *         elif mode == 'c':
17397  */
17398     __pyx_v_order = 'F';
17399 
17400     /* "View.MemoryView":159
17401  *         if mode == 'fortran':
17402  *             order = b'F'
17403  *             self.mode = u'fortran'             # <<<<<<<<<<<<<<
17404  *         elif mode == 'c':
17405  *             order = b'C'
17406  */
17407     __Pyx_INCREF(__pyx_n_u_fortran);
17408     __Pyx_GIVEREF(__pyx_n_u_fortran);
17409     __Pyx_GOTREF(__pyx_v_self->mode);
17410     __Pyx_DECREF(__pyx_v_self->mode);
17411     __pyx_v_self->mode = __pyx_n_u_fortran;
17412 
17413     /* "View.MemoryView":157
17414  *
17415  *         cdef char order
17416  *         if mode == 'fortran':             # <<<<<<<<<<<<<<
17417  *             order = b'F'
17418  *             self.mode = u'fortran'
17419  */
17420     goto __pyx_L10;
17421   }
17422 
17423   /* "View.MemoryView":160
17424  *             order = b'F'
17425  *             self.mode = u'fortran'
17426  *         elif mode == 'c':             # <<<<<<<<<<<<<<
17427  *             order = b'C'
17428  *             self.mode = u'c'
17429  */
17430   __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 160, __pyx_L1_error)
17431   if (likely(__pyx_t_4)) {
17432 
17433     /* "View.MemoryView":161
17434  *             self.mode = u'fortran'
17435  *         elif mode == 'c':
17436  *             order = b'C'             # <<<<<<<<<<<<<<
17437  *             self.mode = u'c'
17438  *         else:
17439  */
17440     __pyx_v_order = 'C';
17441 
17442     /* "View.MemoryView":162
17443  *         elif mode == 'c':
17444  *             order = b'C'
17445  *             self.mode = u'c'             # <<<<<<<<<<<<<<
17446  *         else:
17447  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
17448  */
17449     __Pyx_INCREF(__pyx_n_u_c);
17450     __Pyx_GIVEREF(__pyx_n_u_c);
17451     __Pyx_GOTREF(__pyx_v_self->mode);
17452     __Pyx_DECREF(__pyx_v_self->mode);
17453     __pyx_v_self->mode = __pyx_n_u_c;
17454 
17455     /* "View.MemoryView":160
17456  *             order = b'F'
17457  *             self.mode = u'fortran'
17458  *         elif mode == 'c':             # <<<<<<<<<<<<<<
17459  *             order = b'C'
17460  *             self.mode = u'c'
17461  */
17462     goto __pyx_L10;
17463   }
17464 
17465   /* "View.MemoryView":164
17466  *             self.mode = u'c'
17467  *         else:
17468  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)             # <<<<<<<<<<<<<<
17469  *
17470  *         self.len = fill_contig_strides_array(self._shape, self._strides,
17471  */
17472   /*else*/ {
17473     __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 164, __pyx_L1_error)
17474     __Pyx_GOTREF(__pyx_t_3);
17475     __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 164, __pyx_L1_error)
17476     __Pyx_GOTREF(__pyx_t_10);
17477     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17478     __Pyx_Raise(__pyx_t_10, 0, 0, 0);
17479     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
17480     __PYX_ERR(1, 164, __pyx_L1_error)
17481   }
17482   __pyx_L10:;
17483 
17484   /* "View.MemoryView":166
17485  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
17486  *
17487  *         self.len = fill_contig_strides_array(self._shape, self._strides,             # <<<<<<<<<<<<<<
17488  *                                              itemsize, self.ndim, order)
17489  *
17490  */
17491   __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);
17492 
17493   /* "View.MemoryView":169
17494  *                                              itemsize, self.ndim, order)
17495  *
17496  *         self.free_data = allocate_buffer             # <<<<<<<<<<<<<<
17497  *         self.dtype_is_object = format == b'O'
17498  *         if allocate_buffer:
17499  */
17500   __pyx_v_self->free_data = __pyx_v_allocate_buffer;
17501 
17502   /* "View.MemoryView":170
17503  *
17504  *         self.free_data = allocate_buffer
17505  *         self.dtype_is_object = format == b'O'             # <<<<<<<<<<<<<<
17506  *         if allocate_buffer:
17507  *
17508  */
17509   __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 170, __pyx_L1_error)
17510   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 170, __pyx_L1_error)
17511   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
17512   __pyx_v_self->dtype_is_object = __pyx_t_4;
17513 
17514   /* "View.MemoryView":171
17515  *         self.free_data = allocate_buffer
17516  *         self.dtype_is_object = format == b'O'
17517  *         if allocate_buffer:             # <<<<<<<<<<<<<<
17518  *
17519  *
17520  */
17521   __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
17522   if (__pyx_t_4) {
17523 
17524     /* "View.MemoryView":174
17525  *
17526  *
17527  *             self.data = <char *>malloc(self.len)             # <<<<<<<<<<<<<<
17528  *             if not self.data:
17529  *                 raise MemoryError("unable to allocate array data.")
17530  */
17531     __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
17532 
17533     /* "View.MemoryView":175
17534  *
17535  *             self.data = <char *>malloc(self.len)
17536  *             if not self.data:             # <<<<<<<<<<<<<<
17537  *                 raise MemoryError("unable to allocate array data.")
17538  *
17539  */
17540     __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
17541     if (unlikely(__pyx_t_4)) {
17542 
17543       /* "View.MemoryView":176
17544  *             self.data = <char *>malloc(self.len)
17545  *             if not self.data:
17546  *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
17547  *
17548  *             if self.dtype_is_object:
17549  */
17550       __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 176, __pyx_L1_error)
17551       __Pyx_GOTREF(__pyx_t_10);
17552       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
17553       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
17554       __PYX_ERR(1, 176, __pyx_L1_error)
17555 
17556       /* "View.MemoryView":175
17557  *
17558  *             self.data = <char *>malloc(self.len)
17559  *             if not self.data:             # <<<<<<<<<<<<<<
17560  *                 raise MemoryError("unable to allocate array data.")
17561  *
17562  */
17563     }
17564 
17565     /* "View.MemoryView":178
17566  *                 raise MemoryError("unable to allocate array data.")
17567  *
17568  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
17569  *                 p = <PyObject **> self.data
17570  *                 for i in range(self.len / itemsize):
17571  */
17572     __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
17573     if (__pyx_t_4) {
17574 
17575       /* "View.MemoryView":179
17576  *
17577  *             if self.dtype_is_object:
17578  *                 p = <PyObject **> self.data             # <<<<<<<<<<<<<<
17579  *                 for i in range(self.len / itemsize):
17580  *                     p[i] = Py_None
17581  */
17582       __pyx_v_p = ((PyObject **)__pyx_v_self->data);
17583 
17584       /* "View.MemoryView":180
17585  *             if self.dtype_is_object:
17586  *                 p = <PyObject **> self.data
17587  *                 for i in range(self.len / itemsize):             # <<<<<<<<<<<<<<
17588  *                     p[i] = Py_None
17589  *                     Py_INCREF(Py_None)
17590  */
17591       if (unlikely(__pyx_v_itemsize == 0)) {
17592         PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
17593         __PYX_ERR(1, 180, __pyx_L1_error)
17594       }
17595       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))) {
17596         PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
17597         __PYX_ERR(1, 180, __pyx_L1_error)
17598       }
17599       __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
17600       __pyx_t_9 = __pyx_t_1;
17601       for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
17602         __pyx_v_i = __pyx_t_11;
17603 
17604         /* "View.MemoryView":181
17605  *                 p = <PyObject **> self.data
17606  *                 for i in range(self.len / itemsize):
17607  *                     p[i] = Py_None             # <<<<<<<<<<<<<<
17608  *                     Py_INCREF(Py_None)
17609  *
17610  */
17611         (__pyx_v_p[__pyx_v_i]) = Py_None;
17612 
17613         /* "View.MemoryView":182
17614  *                 for i in range(self.len / itemsize):
17615  *                     p[i] = Py_None
17616  *                     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
17617  *
17618  *     @cname('getbuffer')
17619  */
17620         Py_INCREF(Py_None);
17621       }
17622 
17623       /* "View.MemoryView":178
17624  *                 raise MemoryError("unable to allocate array data.")
17625  *
17626  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
17627  *                 p = <PyObject **> self.data
17628  *                 for i in range(self.len / itemsize):
17629  */
17630     }
17631 
17632     /* "View.MemoryView":171
17633  *         self.free_data = allocate_buffer
17634  *         self.dtype_is_object = format == b'O'
17635  *         if allocate_buffer:             # <<<<<<<<<<<<<<
17636  *
17637  *
17638  */
17639   }
17640 
17641   /* "View.MemoryView":122
17642  *         cdef bint dtype_is_object
17643  *
17644  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
17645  *                   mode="c", bint allocate_buffer=True):
17646  *
17647  */
17648 
17649   /* function exit code */
17650   __pyx_r = 0;
17651   goto __pyx_L0;
17652   __pyx_L1_error:;
17653   __Pyx_XDECREF(__pyx_t_3);
17654   __Pyx_XDECREF(__pyx_t_5);
17655   __Pyx_XDECREF(__pyx_t_6);
17656   __Pyx_XDECREF(__pyx_t_10);
17657   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
17658   __pyx_r = -1;
17659   __pyx_L0:;
17660   __Pyx_XDECREF(__pyx_v_format);
17661   __Pyx_RefNannyFinishContext();
17662   return __pyx_r;
17663 }
17664 
17665 /* "View.MemoryView":185
17666  *
17667  *     @cname('getbuffer')
17668  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
17669  *         cdef int bufmode = -1
17670  *         if self.mode == u"c":
17671  */
17672 
17673 /* Python wrapper */
17674 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
17675 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
17676   int __pyx_r;
17677   __Pyx_RefNannyDeclarations
17678   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
17679   __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));
17680 
17681   /* function exit code */
17682   __Pyx_RefNannyFinishContext();
17683   return __pyx_r;
17684 }
17685 
17686 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) {
17687   int __pyx_v_bufmode;
17688   int __pyx_r;
17689   __Pyx_RefNannyDeclarations
17690   int __pyx_t_1;
17691   int __pyx_t_2;
17692   PyObject *__pyx_t_3 = NULL;
17693   char *__pyx_t_4;
17694   Py_ssize_t __pyx_t_5;
17695   int __pyx_t_6;
17696   Py_ssize_t *__pyx_t_7;
17697   if (__pyx_v_info == NULL) {
17698     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
17699     return -1;
17700   }
17701   __Pyx_RefNannySetupContext("__getbuffer__", 0);
17702   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
17703   __Pyx_GIVEREF(__pyx_v_info->obj);
17704 
17705   /* "View.MemoryView":186
17706  *     @cname('getbuffer')
17707  *     def __getbuffer__(self, Py_buffer *info, int flags):
17708  *         cdef int bufmode = -1             # <<<<<<<<<<<<<<
17709  *         if self.mode == u"c":
17710  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
17711  */
17712   __pyx_v_bufmode = -1;
17713 
17714   /* "View.MemoryView":187
17715  *     def __getbuffer__(self, Py_buffer *info, int flags):
17716  *         cdef int bufmode = -1
17717  *         if self.mode == u"c":             # <<<<<<<<<<<<<<
17718  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
17719  *         elif self.mode == u"fortran":
17720  */
17721   __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 187, __pyx_L1_error)
17722   __pyx_t_2 = (__pyx_t_1 != 0);
17723   if (__pyx_t_2) {
17724 
17725     /* "View.MemoryView":188
17726  *         cdef int bufmode = -1
17727  *         if self.mode == u"c":
17728  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
17729  *         elif self.mode == u"fortran":
17730  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
17731  */
17732     __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
17733 
17734     /* "View.MemoryView":187
17735  *     def __getbuffer__(self, Py_buffer *info, int flags):
17736  *         cdef int bufmode = -1
17737  *         if self.mode == u"c":             # <<<<<<<<<<<<<<
17738  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
17739  *         elif self.mode == u"fortran":
17740  */
17741     goto __pyx_L3;
17742   }
17743 
17744   /* "View.MemoryView":189
17745  *         if self.mode == u"c":
17746  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
17747  *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
17748  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
17749  *         if not (flags & bufmode):
17750  */
17751   __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 189, __pyx_L1_error)
17752   __pyx_t_1 = (__pyx_t_2 != 0);
17753   if (__pyx_t_1) {
17754 
17755     /* "View.MemoryView":190
17756  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
17757  *         elif self.mode == u"fortran":
17758  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
17759  *         if not (flags & bufmode):
17760  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
17761  */
17762     __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
17763 
17764     /* "View.MemoryView":189
17765  *         if self.mode == u"c":
17766  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
17767  *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
17768  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
17769  *         if not (flags & bufmode):
17770  */
17771   }
17772   __pyx_L3:;
17773 
17774   /* "View.MemoryView":191
17775  *         elif self.mode == u"fortran":
17776  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
17777  *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
17778  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
17779  *         info.buf = self.data
17780  */
17781   __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
17782   if (unlikely(__pyx_t_1)) {
17783 
17784     /* "View.MemoryView":192
17785  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
17786  *         if not (flags & bufmode):
17787  *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
17788  *         info.buf = self.data
17789  *         info.len = self.len
17790  */
17791     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 192, __pyx_L1_error)
17792     __Pyx_GOTREF(__pyx_t_3);
17793     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
17794     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17795     __PYX_ERR(1, 192, __pyx_L1_error)
17796 
17797     /* "View.MemoryView":191
17798  *         elif self.mode == u"fortran":
17799  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
17800  *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
17801  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
17802  *         info.buf = self.data
17803  */
17804   }
17805 
17806   /* "View.MemoryView":193
17807  *         if not (flags & bufmode):
17808  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
17809  *         info.buf = self.data             # <<<<<<<<<<<<<<
17810  *         info.len = self.len
17811  *         info.ndim = self.ndim
17812  */
17813   __pyx_t_4 = __pyx_v_self->data;
17814   __pyx_v_info->buf = __pyx_t_4;
17815 
17816   /* "View.MemoryView":194
17817  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
17818  *         info.buf = self.data
17819  *         info.len = self.len             # <<<<<<<<<<<<<<
17820  *         info.ndim = self.ndim
17821  *         info.shape = self._shape
17822  */
17823   __pyx_t_5 = __pyx_v_self->len;
17824   __pyx_v_info->len = __pyx_t_5;
17825 
17826   /* "View.MemoryView":195
17827  *         info.buf = self.data
17828  *         info.len = self.len
17829  *         info.ndim = self.ndim             # <<<<<<<<<<<<<<
17830  *         info.shape = self._shape
17831  *         info.strides = self._strides
17832  */
17833   __pyx_t_6 = __pyx_v_self->ndim;
17834   __pyx_v_info->ndim = __pyx_t_6;
17835 
17836   /* "View.MemoryView":196
17837  *         info.len = self.len
17838  *         info.ndim = self.ndim
17839  *         info.shape = self._shape             # <<<<<<<<<<<<<<
17840  *         info.strides = self._strides
17841  *         info.suboffsets = NULL
17842  */
17843   __pyx_t_7 = __pyx_v_self->_shape;
17844   __pyx_v_info->shape = __pyx_t_7;
17845 
17846   /* "View.MemoryView":197
17847  *         info.ndim = self.ndim
17848  *         info.shape = self._shape
17849  *         info.strides = self._strides             # <<<<<<<<<<<<<<
17850  *         info.suboffsets = NULL
17851  *         info.itemsize = self.itemsize
17852  */
17853   __pyx_t_7 = __pyx_v_self->_strides;
17854   __pyx_v_info->strides = __pyx_t_7;
17855 
17856   /* "View.MemoryView":198
17857  *         info.shape = self._shape
17858  *         info.strides = self._strides
17859  *         info.suboffsets = NULL             # <<<<<<<<<<<<<<
17860  *         info.itemsize = self.itemsize
17861  *         info.readonly = 0
17862  */
17863   __pyx_v_info->suboffsets = NULL;
17864 
17865   /* "View.MemoryView":199
17866  *         info.strides = self._strides
17867  *         info.suboffsets = NULL
17868  *         info.itemsize = self.itemsize             # <<<<<<<<<<<<<<
17869  *         info.readonly = 0
17870  *
17871  */
17872   __pyx_t_5 = __pyx_v_self->itemsize;
17873   __pyx_v_info->itemsize = __pyx_t_5;
17874 
17875   /* "View.MemoryView":200
17876  *         info.suboffsets = NULL
17877  *         info.itemsize = self.itemsize
17878  *         info.readonly = 0             # <<<<<<<<<<<<<<
17879  *
17880  *         if flags & PyBUF_FORMAT:
17881  */
17882   __pyx_v_info->readonly = 0;
17883 
17884   /* "View.MemoryView":202
17885  *         info.readonly = 0
17886  *
17887  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
17888  *             info.format = self.format
17889  *         else:
17890  */
17891   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
17892   if (__pyx_t_1) {
17893 
17894     /* "View.MemoryView":203
17895  *
17896  *         if flags & PyBUF_FORMAT:
17897  *             info.format = self.format             # <<<<<<<<<<<<<<
17898  *         else:
17899  *             info.format = NULL
17900  */
17901     __pyx_t_4 = __pyx_v_self->format;
17902     __pyx_v_info->format = __pyx_t_4;
17903 
17904     /* "View.MemoryView":202
17905  *         info.readonly = 0
17906  *
17907  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
17908  *             info.format = self.format
17909  *         else:
17910  */
17911     goto __pyx_L5;
17912   }
17913 
17914   /* "View.MemoryView":205
17915  *             info.format = self.format
17916  *         else:
17917  *             info.format = NULL             # <<<<<<<<<<<<<<
17918  *
17919  *         info.obj = self
17920  */
17921   /*else*/ {
17922     __pyx_v_info->format = NULL;
17923   }
17924   __pyx_L5:;
17925 
17926   /* "View.MemoryView":207
17927  *             info.format = NULL
17928  *
17929  *         info.obj = self             # <<<<<<<<<<<<<<
17930  *
17931  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
17932  */
17933   __Pyx_INCREF(((PyObject *)__pyx_v_self));
17934   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
17935   __Pyx_GOTREF(__pyx_v_info->obj);
17936   __Pyx_DECREF(__pyx_v_info->obj);
17937   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
17938 
17939   /* "View.MemoryView":185
17940  *
17941  *     @cname('getbuffer')
17942  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
17943  *         cdef int bufmode = -1
17944  *         if self.mode == u"c":
17945  */
17946 
17947   /* function exit code */
17948   __pyx_r = 0;
17949   goto __pyx_L0;
17950   __pyx_L1_error:;
17951   __Pyx_XDECREF(__pyx_t_3);
17952   __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
17953   __pyx_r = -1;
17954   if (__pyx_v_info->obj != NULL) {
17955     __Pyx_GOTREF(__pyx_v_info->obj);
17956     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
17957   }
17958   goto __pyx_L2;
17959   __pyx_L0:;
17960   if (__pyx_v_info->obj == Py_None) {
17961     __Pyx_GOTREF(__pyx_v_info->obj);
17962     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
17963   }
17964   __pyx_L2:;
17965   __Pyx_RefNannyFinishContext();
17966   return __pyx_r;
17967 }
17968 
17969 /* "View.MemoryView":211
17970  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
17971  *
17972  *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
17973  *         if self.callback_free_data != NULL:
17974  *             self.callback_free_data(self.data)
17975  */
17976 
17977 /* Python wrapper */
17978 static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
17979 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
17980   __Pyx_RefNannyDeclarations
17981   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
17982   __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));
17983 
17984   /* function exit code */
17985   __Pyx_RefNannyFinishContext();
17986 }
17987 
17988 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
17989   __Pyx_RefNannyDeclarations
17990   int __pyx_t_1;
17991   __Pyx_RefNannySetupContext("__dealloc__", 0);
17992 
17993   /* "View.MemoryView":212
17994  *
17995  *     def __dealloc__(array self):
17996  *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
17997  *             self.callback_free_data(self.data)
17998  *         elif self.free_data:
17999  */
18000   __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
18001   if (__pyx_t_1) {
18002 
18003     /* "View.MemoryView":213
18004  *     def __dealloc__(array self):
18005  *         if self.callback_free_data != NULL:
18006  *             self.callback_free_data(self.data)             # <<<<<<<<<<<<<<
18007  *         elif self.free_data:
18008  *             if self.dtype_is_object:
18009  */
18010     __pyx_v_self->callback_free_data(__pyx_v_self->data);
18011 
18012     /* "View.MemoryView":212
18013  *
18014  *     def __dealloc__(array self):
18015  *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
18016  *             self.callback_free_data(self.data)
18017  *         elif self.free_data:
18018  */
18019     goto __pyx_L3;
18020   }
18021 
18022   /* "View.MemoryView":214
18023  *         if self.callback_free_data != NULL:
18024  *             self.callback_free_data(self.data)
18025  *         elif self.free_data:             # <<<<<<<<<<<<<<
18026  *             if self.dtype_is_object:
18027  *                 refcount_objects_in_slice(self.data, self._shape,
18028  */
18029   __pyx_t_1 = (__pyx_v_self->free_data != 0);
18030   if (__pyx_t_1) {
18031 
18032     /* "View.MemoryView":215
18033  *             self.callback_free_data(self.data)
18034  *         elif self.free_data:
18035  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
18036  *                 refcount_objects_in_slice(self.data, self._shape,
18037  *                                           self._strides, self.ndim, False)
18038  */
18039     __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
18040     if (__pyx_t_1) {
18041 
18042       /* "View.MemoryView":216
18043  *         elif self.free_data:
18044  *             if self.dtype_is_object:
18045  *                 refcount_objects_in_slice(self.data, self._shape,             # <<<<<<<<<<<<<<
18046  *                                           self._strides, self.ndim, False)
18047  *             free(self.data)
18048  */
18049       __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
18050 
18051       /* "View.MemoryView":215
18052  *             self.callback_free_data(self.data)
18053  *         elif self.free_data:
18054  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
18055  *                 refcount_objects_in_slice(self.data, self._shape,
18056  *                                           self._strides, self.ndim, False)
18057  */
18058     }
18059 
18060     /* "View.MemoryView":218
18061  *                 refcount_objects_in_slice(self.data, self._shape,
18062  *                                           self._strides, self.ndim, False)
18063  *             free(self.data)             # <<<<<<<<<<<<<<
18064  *         PyObject_Free(self._shape)
18065  *
18066  */
18067     free(__pyx_v_self->data);
18068 
18069     /* "View.MemoryView":214
18070  *         if self.callback_free_data != NULL:
18071  *             self.callback_free_data(self.data)
18072  *         elif self.free_data:             # <<<<<<<<<<<<<<
18073  *             if self.dtype_is_object:
18074  *                 refcount_objects_in_slice(self.data, self._shape,
18075  */
18076   }
18077   __pyx_L3:;
18078 
18079   /* "View.MemoryView":219
18080  *                                           self._strides, self.ndim, False)
18081  *             free(self.data)
18082  *         PyObject_Free(self._shape)             # <<<<<<<<<<<<<<
18083  *
18084  *     @property
18085  */
18086   PyObject_Free(__pyx_v_self->_shape);
18087 
18088   /* "View.MemoryView":211
18089  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
18090  *
18091  *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
18092  *         if self.callback_free_data != NULL:
18093  *             self.callback_free_data(self.data)
18094  */
18095 
18096   /* function exit code */
18097   __Pyx_RefNannyFinishContext();
18098 }
18099 
18100 /* "View.MemoryView":222
18101  *
18102  *     @property
18103  *     def memview(self):             # <<<<<<<<<<<<<<
18104  *         return self.get_memview()
18105  *
18106  */
18107 
18108 /* Python wrapper */
18109 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
18110 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
18111   PyObject *__pyx_r = 0;
18112   __Pyx_RefNannyDeclarations
18113   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
18114   __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));
18115 
18116   /* function exit code */
18117   __Pyx_RefNannyFinishContext();
18118   return __pyx_r;
18119 }
18120 
18121 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
18122   PyObject *__pyx_r = NULL;
18123   __Pyx_RefNannyDeclarations
18124   PyObject *__pyx_t_1 = NULL;
18125   __Pyx_RefNannySetupContext("__get__", 0);
18126 
18127   /* "View.MemoryView":223
18128  *     @property
18129  *     def memview(self):
18130  *         return self.get_memview()             # <<<<<<<<<<<<<<
18131  *
18132  *     @cname('get_memview')
18133  */
18134   __Pyx_XDECREF(__pyx_r);
18135   __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 223, __pyx_L1_error)
18136   __Pyx_GOTREF(__pyx_t_1);
18137   __pyx_r = __pyx_t_1;
18138   __pyx_t_1 = 0;
18139   goto __pyx_L0;
18140 
18141   /* "View.MemoryView":222
18142  *
18143  *     @property
18144  *     def memview(self):             # <<<<<<<<<<<<<<
18145  *         return self.get_memview()
18146  *
18147  */
18148 
18149   /* function exit code */
18150   __pyx_L1_error:;
18151   __Pyx_XDECREF(__pyx_t_1);
18152   __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18153   __pyx_r = NULL;
18154   __pyx_L0:;
18155   __Pyx_XGIVEREF(__pyx_r);
18156   __Pyx_RefNannyFinishContext();
18157   return __pyx_r;
18158 }
18159 
18160 /* "View.MemoryView":226
18161  *
18162  *     @cname('get_memview')
18163  *     cdef get_memview(self):             # <<<<<<<<<<<<<<
18164  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
18165  *         return  memoryview(self, flags, self.dtype_is_object)
18166  */
18167 
18168 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
18169   int __pyx_v_flags;
18170   PyObject *__pyx_r = NULL;
18171   __Pyx_RefNannyDeclarations
18172   PyObject *__pyx_t_1 = NULL;
18173   PyObject *__pyx_t_2 = NULL;
18174   PyObject *__pyx_t_3 = NULL;
18175   __Pyx_RefNannySetupContext("get_memview", 0);
18176 
18177   /* "View.MemoryView":227
18178  *     @cname('get_memview')
18179  *     cdef get_memview(self):
18180  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE             # <<<<<<<<<<<<<<
18181  *         return  memoryview(self, flags, self.dtype_is_object)
18182  *
18183  */
18184   __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
18185 
18186   /* "View.MemoryView":228
18187  *     cdef get_memview(self):
18188  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
18189  *         return  memoryview(self, flags, self.dtype_is_object)             # <<<<<<<<<<<<<<
18190  *
18191  *     def __len__(self):
18192  */
18193   __Pyx_XDECREF(__pyx_r);
18194   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 228, __pyx_L1_error)
18195   __Pyx_GOTREF(__pyx_t_1);
18196   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error)
18197   __Pyx_GOTREF(__pyx_t_2);
18198   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 228, __pyx_L1_error)
18199   __Pyx_GOTREF(__pyx_t_3);
18200   __Pyx_INCREF(((PyObject *)__pyx_v_self));
18201   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
18202   PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
18203   __Pyx_GIVEREF(__pyx_t_1);
18204   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
18205   __Pyx_GIVEREF(__pyx_t_2);
18206   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
18207   __pyx_t_1 = 0;
18208   __pyx_t_2 = 0;
18209   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error)
18210   __Pyx_GOTREF(__pyx_t_2);
18211   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18212   __pyx_r = __pyx_t_2;
18213   __pyx_t_2 = 0;
18214   goto __pyx_L0;
18215 
18216   /* "View.MemoryView":226
18217  *
18218  *     @cname('get_memview')
18219  *     cdef get_memview(self):             # <<<<<<<<<<<<<<
18220  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
18221  *         return  memoryview(self, flags, self.dtype_is_object)
18222  */
18223 
18224   /* function exit code */
18225   __pyx_L1_error:;
18226   __Pyx_XDECREF(__pyx_t_1);
18227   __Pyx_XDECREF(__pyx_t_2);
18228   __Pyx_XDECREF(__pyx_t_3);
18229   __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
18230   __pyx_r = 0;
18231   __pyx_L0:;
18232   __Pyx_XGIVEREF(__pyx_r);
18233   __Pyx_RefNannyFinishContext();
18234   return __pyx_r;
18235 }
18236 
18237 /* "View.MemoryView":230
18238  *         return  memoryview(self, flags, self.dtype_is_object)
18239  *
18240  *     def __len__(self):             # <<<<<<<<<<<<<<
18241  *         return self._shape[0]
18242  *
18243  */
18244 
18245 /* Python wrapper */
18246 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
18247 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
18248   Py_ssize_t __pyx_r;
18249   __Pyx_RefNannyDeclarations
18250   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
18251   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));
18252 
18253   /* function exit code */
18254   __Pyx_RefNannyFinishContext();
18255   return __pyx_r;
18256 }
18257 
18258 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
18259   Py_ssize_t __pyx_r;
18260   __Pyx_RefNannyDeclarations
18261   __Pyx_RefNannySetupContext("__len__", 0);
18262 
18263   /* "View.MemoryView":231
18264  *
18265  *     def __len__(self):
18266  *         return self._shape[0]             # <<<<<<<<<<<<<<
18267  *
18268  *     def __getattr__(self, attr):
18269  */
18270   __pyx_r = (__pyx_v_self->_shape[0]);
18271   goto __pyx_L0;
18272 
18273   /* "View.MemoryView":230
18274  *         return  memoryview(self, flags, self.dtype_is_object)
18275  *
18276  *     def __len__(self):             # <<<<<<<<<<<<<<
18277  *         return self._shape[0]
18278  *
18279  */
18280 
18281   /* function exit code */
18282   __pyx_L0:;
18283   __Pyx_RefNannyFinishContext();
18284   return __pyx_r;
18285 }
18286 
18287 /* "View.MemoryView":233
18288  *         return self._shape[0]
18289  *
18290  *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
18291  *         return getattr(self.memview, attr)
18292  *
18293  */
18294 
18295 /* Python wrapper */
18296 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
18297 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
18298   PyObject *__pyx_r = 0;
18299   __Pyx_RefNannyDeclarations
18300   __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
18301   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
18302 
18303   /* function exit code */
18304   __Pyx_RefNannyFinishContext();
18305   return __pyx_r;
18306 }
18307 
18308 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
18309   PyObject *__pyx_r = NULL;
18310   __Pyx_RefNannyDeclarations
18311   PyObject *__pyx_t_1 = NULL;
18312   PyObject *__pyx_t_2 = NULL;
18313   __Pyx_RefNannySetupContext("__getattr__", 0);
18314 
18315   /* "View.MemoryView":234
18316  *
18317  *     def __getattr__(self, attr):
18318  *         return getattr(self.memview, attr)             # <<<<<<<<<<<<<<
18319  *
18320  *     def __getitem__(self, item):
18321  */
18322   __Pyx_XDECREF(__pyx_r);
18323   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 234, __pyx_L1_error)
18324   __Pyx_GOTREF(__pyx_t_1);
18325   __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 234, __pyx_L1_error)
18326   __Pyx_GOTREF(__pyx_t_2);
18327   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18328   __pyx_r = __pyx_t_2;
18329   __pyx_t_2 = 0;
18330   goto __pyx_L0;
18331 
18332   /* "View.MemoryView":233
18333  *         return self._shape[0]
18334  *
18335  *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
18336  *         return getattr(self.memview, attr)
18337  *
18338  */
18339 
18340   /* function exit code */
18341   __pyx_L1_error:;
18342   __Pyx_XDECREF(__pyx_t_1);
18343   __Pyx_XDECREF(__pyx_t_2);
18344   __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18345   __pyx_r = NULL;
18346   __pyx_L0:;
18347   __Pyx_XGIVEREF(__pyx_r);
18348   __Pyx_RefNannyFinishContext();
18349   return __pyx_r;
18350 }
18351 
18352 /* "View.MemoryView":236
18353  *         return getattr(self.memview, attr)
18354  *
18355  *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
18356  *         return self.memview[item]
18357  *
18358  */
18359 
18360 /* Python wrapper */
18361 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
18362 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
18363   PyObject *__pyx_r = 0;
18364   __Pyx_RefNannyDeclarations
18365   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
18366   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
18367 
18368   /* function exit code */
18369   __Pyx_RefNannyFinishContext();
18370   return __pyx_r;
18371 }
18372 
18373 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
18374   PyObject *__pyx_r = NULL;
18375   __Pyx_RefNannyDeclarations
18376   PyObject *__pyx_t_1 = NULL;
18377   PyObject *__pyx_t_2 = NULL;
18378   __Pyx_RefNannySetupContext("__getitem__", 0);
18379 
18380   /* "View.MemoryView":237
18381  *
18382  *     def __getitem__(self, item):
18383  *         return self.memview[item]             # <<<<<<<<<<<<<<
18384  *
18385  *     def __setitem__(self, item, value):
18386  */
18387   __Pyx_XDECREF(__pyx_r);
18388   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 237, __pyx_L1_error)
18389   __Pyx_GOTREF(__pyx_t_1);
18390   __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 237, __pyx_L1_error)
18391   __Pyx_GOTREF(__pyx_t_2);
18392   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18393   __pyx_r = __pyx_t_2;
18394   __pyx_t_2 = 0;
18395   goto __pyx_L0;
18396 
18397   /* "View.MemoryView":236
18398  *         return getattr(self.memview, attr)
18399  *
18400  *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
18401  *         return self.memview[item]
18402  *
18403  */
18404 
18405   /* function exit code */
18406   __pyx_L1_error:;
18407   __Pyx_XDECREF(__pyx_t_1);
18408   __Pyx_XDECREF(__pyx_t_2);
18409   __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18410   __pyx_r = NULL;
18411   __pyx_L0:;
18412   __Pyx_XGIVEREF(__pyx_r);
18413   __Pyx_RefNannyFinishContext();
18414   return __pyx_r;
18415 }
18416 
18417 /* "View.MemoryView":239
18418  *         return self.memview[item]
18419  *
18420  *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
18421  *         self.memview[item] = value
18422  *
18423  */
18424 
18425 /* Python wrapper */
18426 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
18427 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
18428   int __pyx_r;
18429   __Pyx_RefNannyDeclarations
18430   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
18431   __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));
18432 
18433   /* function exit code */
18434   __Pyx_RefNannyFinishContext();
18435   return __pyx_r;
18436 }
18437 
18438 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) {
18439   int __pyx_r;
18440   __Pyx_RefNannyDeclarations
18441   PyObject *__pyx_t_1 = NULL;
18442   __Pyx_RefNannySetupContext("__setitem__", 0);
18443 
18444   /* "View.MemoryView":240
18445  *
18446  *     def __setitem__(self, item, value):
18447  *         self.memview[item] = value             # <<<<<<<<<<<<<<
18448  *
18449  *
18450  */
18451   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 240, __pyx_L1_error)
18452   __Pyx_GOTREF(__pyx_t_1);
18453   if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(1, 240, __pyx_L1_error)
18454   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18455 
18456   /* "View.MemoryView":239
18457  *         return self.memview[item]
18458  *
18459  *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
18460  *         self.memview[item] = value
18461  *
18462  */
18463 
18464   /* function exit code */
18465   __pyx_r = 0;
18466   goto __pyx_L0;
18467   __pyx_L1_error:;
18468   __Pyx_XDECREF(__pyx_t_1);
18469   __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18470   __pyx_r = -1;
18471   __pyx_L0:;
18472   __Pyx_RefNannyFinishContext();
18473   return __pyx_r;
18474 }
18475 
18476 /* "(tree fragment)":1
18477  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
18478  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18479  * def __setstate_cython__(self, __pyx_state):
18480  */
18481 
18482 /* Python wrapper */
18483 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
18484 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
18485   PyObject *__pyx_r = 0;
18486   __Pyx_RefNannyDeclarations
18487   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
18488   __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));
18489 
18490   /* function exit code */
18491   __Pyx_RefNannyFinishContext();
18492   return __pyx_r;
18493 }
18494 
18495 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
18496   PyObject *__pyx_r = NULL;
18497   __Pyx_RefNannyDeclarations
18498   PyObject *__pyx_t_1 = NULL;
18499   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
18500 
18501   /* "(tree fragment)":2
18502  * def __reduce_cython__(self):
18503  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
18504  * def __setstate_cython__(self, __pyx_state):
18505  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18506  */
18507   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
18508   __Pyx_GOTREF(__pyx_t_1);
18509   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
18510   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18511   __PYX_ERR(1, 2, __pyx_L1_error)
18512 
18513   /* "(tree fragment)":1
18514  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
18515  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18516  * def __setstate_cython__(self, __pyx_state):
18517  */
18518 
18519   /* function exit code */
18520   __pyx_L1_error:;
18521   __Pyx_XDECREF(__pyx_t_1);
18522   __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18523   __pyx_r = NULL;
18524   __Pyx_XGIVEREF(__pyx_r);
18525   __Pyx_RefNannyFinishContext();
18526   return __pyx_r;
18527 }
18528 
18529 /* "(tree fragment)":3
18530  * def __reduce_cython__(self):
18531  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18532  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
18533  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18534  */
18535 
18536 /* Python wrapper */
18537 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
18538 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
18539   PyObject *__pyx_r = 0;
18540   __Pyx_RefNannyDeclarations
18541   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
18542   __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
18543 
18544   /* function exit code */
18545   __Pyx_RefNannyFinishContext();
18546   return __pyx_r;
18547 }
18548 
18549 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) {
18550   PyObject *__pyx_r = NULL;
18551   __Pyx_RefNannyDeclarations
18552   PyObject *__pyx_t_1 = NULL;
18553   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
18554 
18555   /* "(tree fragment)":4
18556  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18557  * def __setstate_cython__(self, __pyx_state):
18558  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
18559  */
18560   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
18561   __Pyx_GOTREF(__pyx_t_1);
18562   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
18563   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18564   __PYX_ERR(1, 4, __pyx_L1_error)
18565 
18566   /* "(tree fragment)":3
18567  * def __reduce_cython__(self):
18568  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18569  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
18570  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
18571  */
18572 
18573   /* function exit code */
18574   __pyx_L1_error:;
18575   __Pyx_XDECREF(__pyx_t_1);
18576   __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18577   __pyx_r = NULL;
18578   __Pyx_XGIVEREF(__pyx_r);
18579   __Pyx_RefNannyFinishContext();
18580   return __pyx_r;
18581 }
18582 
18583 /* "View.MemoryView":244
18584  *
18585  * @cname("__pyx_array_new")
18586  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
18587  *                           char *mode, char *buf):
18588  *     cdef array result
18589  */
18590 
18591 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) {
18592   struct __pyx_array_obj *__pyx_v_result = 0;
18593   struct __pyx_array_obj *__pyx_r = NULL;
18594   __Pyx_RefNannyDeclarations
18595   int __pyx_t_1;
18596   PyObject *__pyx_t_2 = NULL;
18597   PyObject *__pyx_t_3 = NULL;
18598   PyObject *__pyx_t_4 = NULL;
18599   PyObject *__pyx_t_5 = NULL;
18600   __Pyx_RefNannySetupContext("array_cwrapper", 0);
18601 
18602   /* "View.MemoryView":248
18603  *     cdef array result
18604  *
18605  *     if buf == NULL:             # <<<<<<<<<<<<<<
18606  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
18607  *     else:
18608  */
18609   __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
18610   if (__pyx_t_1) {
18611 
18612     /* "View.MemoryView":249
18613  *
18614  *     if buf == NULL:
18615  *         result = array(shape, itemsize, format, mode.decode('ASCII'))             # <<<<<<<<<<<<<<
18616  *     else:
18617  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
18618  */
18619     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 249, __pyx_L1_error)
18620     __Pyx_GOTREF(__pyx_t_2);
18621     __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 249, __pyx_L1_error)
18622     __Pyx_GOTREF(__pyx_t_3);
18623     __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 249, __pyx_L1_error)
18624     __Pyx_GOTREF(__pyx_t_4);
18625     __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 249, __pyx_L1_error)
18626     __Pyx_GOTREF(__pyx_t_5);
18627     __Pyx_INCREF(__pyx_v_shape);
18628     __Pyx_GIVEREF(__pyx_v_shape);
18629     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
18630     __Pyx_GIVEREF(__pyx_t_2);
18631     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
18632     __Pyx_GIVEREF(__pyx_t_3);
18633     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
18634     __Pyx_GIVEREF(__pyx_t_4);
18635     PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
18636     __pyx_t_2 = 0;
18637     __pyx_t_3 = 0;
18638     __pyx_t_4 = 0;
18639     __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 249, __pyx_L1_error)
18640     __Pyx_GOTREF(__pyx_t_4);
18641     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
18642     __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
18643     __pyx_t_4 = 0;
18644 
18645     /* "View.MemoryView":248
18646  *     cdef array result
18647  *
18648  *     if buf == NULL:             # <<<<<<<<<<<<<<
18649  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
18650  *     else:
18651  */
18652     goto __pyx_L3;
18653   }
18654 
18655   /* "View.MemoryView":251
18656  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
18657  *     else:
18658  *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
18659  *                        allocate_buffer=False)
18660  *         result.data = buf
18661  */
18662   /*else*/ {
18663     __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 251, __pyx_L1_error)
18664     __Pyx_GOTREF(__pyx_t_4);
18665     __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error)
18666     __Pyx_GOTREF(__pyx_t_5);
18667     __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 251, __pyx_L1_error)
18668     __Pyx_GOTREF(__pyx_t_3);
18669     __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 251, __pyx_L1_error)
18670     __Pyx_GOTREF(__pyx_t_2);
18671     __Pyx_INCREF(__pyx_v_shape);
18672     __Pyx_GIVEREF(__pyx_v_shape);
18673     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
18674     __Pyx_GIVEREF(__pyx_t_4);
18675     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
18676     __Pyx_GIVEREF(__pyx_t_5);
18677     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
18678     __Pyx_GIVEREF(__pyx_t_3);
18679     PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
18680     __pyx_t_4 = 0;
18681     __pyx_t_5 = 0;
18682     __pyx_t_3 = 0;
18683 
18684     /* "View.MemoryView":252
18685  *     else:
18686  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
18687  *                        allocate_buffer=False)             # <<<<<<<<<<<<<<
18688  *         result.data = buf
18689  *
18690  */
18691     __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 252, __pyx_L1_error)
18692     __Pyx_GOTREF(__pyx_t_3);
18693     if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(1, 252, __pyx_L1_error)
18694 
18695     /* "View.MemoryView":251
18696  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
18697  *     else:
18698  *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
18699  *                        allocate_buffer=False)
18700  *         result.data = buf
18701  */
18702     __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error)
18703     __Pyx_GOTREF(__pyx_t_5);
18704     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18705     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18706     __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
18707     __pyx_t_5 = 0;
18708 
18709     /* "View.MemoryView":253
18710  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
18711  *                        allocate_buffer=False)
18712  *         result.data = buf             # <<<<<<<<<<<<<<
18713  *
18714  *     return result
18715  */
18716     __pyx_v_result->data = __pyx_v_buf;
18717   }
18718   __pyx_L3:;
18719 
18720   /* "View.MemoryView":255
18721  *         result.data = buf
18722  *
18723  *     return result             # <<<<<<<<<<<<<<
18724  *
18725  *
18726  */
18727   __Pyx_XDECREF(((PyObject *)__pyx_r));
18728   __Pyx_INCREF(((PyObject *)__pyx_v_result));
18729   __pyx_r = __pyx_v_result;
18730   goto __pyx_L0;
18731 
18732   /* "View.MemoryView":244
18733  *
18734  * @cname("__pyx_array_new")
18735  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
18736  *                           char *mode, char *buf):
18737  *     cdef array result
18738  */
18739 
18740   /* function exit code */
18741   __pyx_L1_error:;
18742   __Pyx_XDECREF(__pyx_t_2);
18743   __Pyx_XDECREF(__pyx_t_3);
18744   __Pyx_XDECREF(__pyx_t_4);
18745   __Pyx_XDECREF(__pyx_t_5);
18746   __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
18747   __pyx_r = 0;
18748   __pyx_L0:;
18749   __Pyx_XDECREF((PyObject *)__pyx_v_result);
18750   __Pyx_XGIVEREF((PyObject *)__pyx_r);
18751   __Pyx_RefNannyFinishContext();
18752   return __pyx_r;
18753 }
18754 
18755 /* "View.MemoryView":281
18756  * cdef class Enum(object):
18757  *     cdef object name
18758  *     def __init__(self, name):             # <<<<<<<<<<<<<<
18759  *         self.name = name
18760  *     def __repr__(self):
18761  */
18762 
18763 /* Python wrapper */
18764 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
18765 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
18766   PyObject *__pyx_v_name = 0;
18767   int __pyx_r;
18768   __Pyx_RefNannyDeclarations
18769   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
18770   {
18771     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
18772     PyObject* values[1] = {0};
18773     if (unlikely(__pyx_kwds)) {
18774       Py_ssize_t kw_args;
18775       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
18776       switch (pos_args) {
18777         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
18778         CYTHON_FALLTHROUGH;
18779         case  0: break;
18780         default: goto __pyx_L5_argtuple_error;
18781       }
18782       kw_args = PyDict_Size(__pyx_kwds);
18783       switch (pos_args) {
18784         case  0:
18785         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
18786         else goto __pyx_L5_argtuple_error;
18787       }
18788       if (unlikely(kw_args > 0)) {
18789         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 281, __pyx_L3_error)
18790       }
18791     } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
18792       goto __pyx_L5_argtuple_error;
18793     } else {
18794       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
18795     }
18796     __pyx_v_name = values[0];
18797   }
18798   goto __pyx_L4_argument_unpacking_done;
18799   __pyx_L5_argtuple_error:;
18800   __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 281, __pyx_L3_error)
18801   __pyx_L3_error:;
18802   __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18803   __Pyx_RefNannyFinishContext();
18804   return -1;
18805   __pyx_L4_argument_unpacking_done:;
18806   __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
18807 
18808   /* function exit code */
18809   __Pyx_RefNannyFinishContext();
18810   return __pyx_r;
18811 }
18812 
18813 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
18814   int __pyx_r;
18815   __Pyx_RefNannyDeclarations
18816   __Pyx_RefNannySetupContext("__init__", 0);
18817 
18818   /* "View.MemoryView":282
18819  *     cdef object name
18820  *     def __init__(self, name):
18821  *         self.name = name             # <<<<<<<<<<<<<<
18822  *     def __repr__(self):
18823  *         return self.name
18824  */
18825   __Pyx_INCREF(__pyx_v_name);
18826   __Pyx_GIVEREF(__pyx_v_name);
18827   __Pyx_GOTREF(__pyx_v_self->name);
18828   __Pyx_DECREF(__pyx_v_self->name);
18829   __pyx_v_self->name = __pyx_v_name;
18830 
18831   /* "View.MemoryView":281
18832  * cdef class Enum(object):
18833  *     cdef object name
18834  *     def __init__(self, name):             # <<<<<<<<<<<<<<
18835  *         self.name = name
18836  *     def __repr__(self):
18837  */
18838 
18839   /* function exit code */
18840   __pyx_r = 0;
18841   __Pyx_RefNannyFinishContext();
18842   return __pyx_r;
18843 }
18844 
18845 /* "View.MemoryView":283
18846  *     def __init__(self, name):
18847  *         self.name = name
18848  *     def __repr__(self):             # <<<<<<<<<<<<<<
18849  *         return self.name
18850  *
18851  */
18852 
18853 /* Python wrapper */
18854 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
18855 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
18856   PyObject *__pyx_r = 0;
18857   __Pyx_RefNannyDeclarations
18858   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
18859   __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
18860 
18861   /* function exit code */
18862   __Pyx_RefNannyFinishContext();
18863   return __pyx_r;
18864 }
18865 
18866 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
18867   PyObject *__pyx_r = NULL;
18868   __Pyx_RefNannyDeclarations
18869   __Pyx_RefNannySetupContext("__repr__", 0);
18870 
18871   /* "View.MemoryView":284
18872  *         self.name = name
18873  *     def __repr__(self):
18874  *         return self.name             # <<<<<<<<<<<<<<
18875  *
18876  * cdef generic = Enum("<strided and direct or indirect>")
18877  */
18878   __Pyx_XDECREF(__pyx_r);
18879   __Pyx_INCREF(__pyx_v_self->name);
18880   __pyx_r = __pyx_v_self->name;
18881   goto __pyx_L0;
18882 
18883   /* "View.MemoryView":283
18884  *     def __init__(self, name):
18885  *         self.name = name
18886  *     def __repr__(self):             # <<<<<<<<<<<<<<
18887  *         return self.name
18888  *
18889  */
18890 
18891   /* function exit code */
18892   __pyx_L0:;
18893   __Pyx_XGIVEREF(__pyx_r);
18894   __Pyx_RefNannyFinishContext();
18895   return __pyx_r;
18896 }
18897 
18898 /* "(tree fragment)":1
18899  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
18900  *     cdef tuple state
18901  *     cdef object _dict
18902  */
18903 
18904 /* Python wrapper */
18905 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
18906 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
18907   PyObject *__pyx_r = 0;
18908   __Pyx_RefNannyDeclarations
18909   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
18910   __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
18911 
18912   /* function exit code */
18913   __Pyx_RefNannyFinishContext();
18914   return __pyx_r;
18915 }
18916 
18917 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
18918   PyObject *__pyx_v_state = 0;
18919   PyObject *__pyx_v__dict = 0;
18920   int __pyx_v_use_setstate;
18921   PyObject *__pyx_r = NULL;
18922   __Pyx_RefNannyDeclarations
18923   PyObject *__pyx_t_1 = NULL;
18924   int __pyx_t_2;
18925   int __pyx_t_3;
18926   PyObject *__pyx_t_4 = NULL;
18927   PyObject *__pyx_t_5 = NULL;
18928   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
18929 
18930   /* "(tree fragment)":5
18931  *     cdef object _dict
18932  *     cdef bint use_setstate
18933  *     state = (self.name,)             # <<<<<<<<<<<<<<
18934  *     _dict = getattr(self, '__dict__', None)
18935  *     if _dict is not None:
18936  */
18937   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
18938   __Pyx_GOTREF(__pyx_t_1);
18939   __Pyx_INCREF(__pyx_v_self->name);
18940   __Pyx_GIVEREF(__pyx_v_self->name);
18941   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
18942   __pyx_v_state = ((PyObject*)__pyx_t_1);
18943   __pyx_t_1 = 0;
18944 
18945   /* "(tree fragment)":6
18946  *     cdef bint use_setstate
18947  *     state = (self.name,)
18948  *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
18949  *     if _dict is not None:
18950  *         state += (_dict,)
18951  */
18952   __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
18953   __Pyx_GOTREF(__pyx_t_1);
18954   __pyx_v__dict = __pyx_t_1;
18955   __pyx_t_1 = 0;
18956 
18957   /* "(tree fragment)":7
18958  *     state = (self.name,)
18959  *     _dict = getattr(self, '__dict__', None)
18960  *     if _dict is not None:             # <<<<<<<<<<<<<<
18961  *         state += (_dict,)
18962  *         use_setstate = True
18963  */
18964   __pyx_t_2 = (__pyx_v__dict != Py_None);
18965   __pyx_t_3 = (__pyx_t_2 != 0);
18966   if (__pyx_t_3) {
18967 
18968     /* "(tree fragment)":8
18969  *     _dict = getattr(self, '__dict__', None)
18970  *     if _dict is not None:
18971  *         state += (_dict,)             # <<<<<<<<<<<<<<
18972  *         use_setstate = True
18973  *     else:
18974  */
18975     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
18976     __Pyx_GOTREF(__pyx_t_1);
18977     __Pyx_INCREF(__pyx_v__dict);
18978     __Pyx_GIVEREF(__pyx_v__dict);
18979     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
18980     __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
18981     __Pyx_GOTREF(__pyx_t_4);
18982     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18983     __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
18984     __pyx_t_4 = 0;
18985 
18986     /* "(tree fragment)":9
18987  *     if _dict is not None:
18988  *         state += (_dict,)
18989  *         use_setstate = True             # <<<<<<<<<<<<<<
18990  *     else:
18991  *         use_setstate = self.name is not None
18992  */
18993     __pyx_v_use_setstate = 1;
18994 
18995     /* "(tree fragment)":7
18996  *     state = (self.name,)
18997  *     _dict = getattr(self, '__dict__', None)
18998  *     if _dict is not None:             # <<<<<<<<<<<<<<
18999  *         state += (_dict,)
19000  *         use_setstate = True
19001  */
19002     goto __pyx_L3;
19003   }
19004 
19005   /* "(tree fragment)":11
19006  *         use_setstate = True
19007  *     else:
19008  *         use_setstate = self.name is not None             # <<<<<<<<<<<<<<
19009  *     if use_setstate:
19010  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
19011  */
19012   /*else*/ {
19013     __pyx_t_3 = (__pyx_v_self->name != Py_None);
19014     __pyx_v_use_setstate = __pyx_t_3;
19015   }
19016   __pyx_L3:;
19017 
19018   /* "(tree fragment)":12
19019  *     else:
19020  *         use_setstate = self.name is not None
19021  *     if use_setstate:             # <<<<<<<<<<<<<<
19022  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
19023  *     else:
19024  */
19025   __pyx_t_3 = (__pyx_v_use_setstate != 0);
19026   if (__pyx_t_3) {
19027 
19028     /* "(tree fragment)":13
19029  *         use_setstate = self.name is not None
19030  *     if use_setstate:
19031  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state             # <<<<<<<<<<<<<<
19032  *     else:
19033  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
19034  */
19035     __Pyx_XDECREF(__pyx_r);
19036     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
19037     __Pyx_GOTREF(__pyx_t_4);
19038     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
19039     __Pyx_GOTREF(__pyx_t_1);
19040     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
19041     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
19042     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
19043     __Pyx_INCREF(__pyx_int_184977713);
19044     __Pyx_GIVEREF(__pyx_int_184977713);
19045     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
19046     __Pyx_INCREF(Py_None);
19047     __Pyx_GIVEREF(Py_None);
19048     PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
19049     __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
19050     __Pyx_GOTREF(__pyx_t_5);
19051     __Pyx_GIVEREF(__pyx_t_4);
19052     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
19053     __Pyx_GIVEREF(__pyx_t_1);
19054     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
19055     __Pyx_INCREF(__pyx_v_state);
19056     __Pyx_GIVEREF(__pyx_v_state);
19057     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
19058     __pyx_t_4 = 0;
19059     __pyx_t_1 = 0;
19060     __pyx_r = __pyx_t_5;
19061     __pyx_t_5 = 0;
19062     goto __pyx_L0;
19063 
19064     /* "(tree fragment)":12
19065  *     else:
19066  *         use_setstate = self.name is not None
19067  *     if use_setstate:             # <<<<<<<<<<<<<<
19068  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
19069  *     else:
19070  */
19071   }
19072 
19073   /* "(tree fragment)":15
19074  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
19075  *     else:
19076  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)             # <<<<<<<<<<<<<<
19077  * def __setstate_cython__(self, __pyx_state):
19078  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
19079  */
19080   /*else*/ {
19081     __Pyx_XDECREF(__pyx_r);
19082     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
19083     __Pyx_GOTREF(__pyx_t_5);
19084     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
19085     __Pyx_GOTREF(__pyx_t_1);
19086     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
19087     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
19088     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
19089     __Pyx_INCREF(__pyx_int_184977713);
19090     __Pyx_GIVEREF(__pyx_int_184977713);
19091     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
19092     __Pyx_INCREF(__pyx_v_state);
19093     __Pyx_GIVEREF(__pyx_v_state);
19094     PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
19095     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
19096     __Pyx_GOTREF(__pyx_t_4);
19097     __Pyx_GIVEREF(__pyx_t_5);
19098     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
19099     __Pyx_GIVEREF(__pyx_t_1);
19100     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
19101     __pyx_t_5 = 0;
19102     __pyx_t_1 = 0;
19103     __pyx_r = __pyx_t_4;
19104     __pyx_t_4 = 0;
19105     goto __pyx_L0;
19106   }
19107 
19108   /* "(tree fragment)":1
19109  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
19110  *     cdef tuple state
19111  *     cdef object _dict
19112  */
19113 
19114   /* function exit code */
19115   __pyx_L1_error:;
19116   __Pyx_XDECREF(__pyx_t_1);
19117   __Pyx_XDECREF(__pyx_t_4);
19118   __Pyx_XDECREF(__pyx_t_5);
19119   __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
19120   __pyx_r = NULL;
19121   __pyx_L0:;
19122   __Pyx_XDECREF(__pyx_v_state);
19123   __Pyx_XDECREF(__pyx_v__dict);
19124   __Pyx_XGIVEREF(__pyx_r);
19125   __Pyx_RefNannyFinishContext();
19126   return __pyx_r;
19127 }
19128 
19129 /* "(tree fragment)":16
19130  *     else:
19131  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
19132  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
19133  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
19134  */
19135 
19136 /* Python wrapper */
19137 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
19138 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
19139   PyObject *__pyx_r = 0;
19140   __Pyx_RefNannyDeclarations
19141   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
19142   __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
19143 
19144   /* function exit code */
19145   __Pyx_RefNannyFinishContext();
19146   return __pyx_r;
19147 }
19148 
19149 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
19150   PyObject *__pyx_r = NULL;
19151   __Pyx_RefNannyDeclarations
19152   PyObject *__pyx_t_1 = NULL;
19153   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
19154 
19155   /* "(tree fragment)":17
19156  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
19157  * def __setstate_cython__(self, __pyx_state):
19158  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
19159  */
19160   if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
19161   __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
19162   __Pyx_GOTREF(__pyx_t_1);
19163   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19164 
19165   /* "(tree fragment)":16
19166  *     else:
19167  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
19168  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
19169  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
19170  */
19171 
19172   /* function exit code */
19173   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19174   goto __pyx_L0;
19175   __pyx_L1_error:;
19176   __Pyx_XDECREF(__pyx_t_1);
19177   __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
19178   __pyx_r = NULL;
19179   __pyx_L0:;
19180   __Pyx_XGIVEREF(__pyx_r);
19181   __Pyx_RefNannyFinishContext();
19182   return __pyx_r;
19183 }
19184 
19185 /* "View.MemoryView":298
19186  *
19187  * @cname('__pyx_align_pointer')
19188  * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
19189  *     "Align pointer memory on a given boundary"
19190  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
19191  */
19192 
19193 static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
19194   Py_intptr_t __pyx_v_aligned_p;
19195   size_t __pyx_v_offset;
19196   void *__pyx_r;
19197   int __pyx_t_1;
19198 
19199   /* "View.MemoryView":300
19200  * cdef void *align_pointer(void *memory, size_t alignment) nogil:
19201  *     "Align pointer memory on a given boundary"
19202  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory             # <<<<<<<<<<<<<<
19203  *     cdef size_t offset
19204  *
19205  */
19206   __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
19207 
19208   /* "View.MemoryView":304
19209  *
19210  *     with cython.cdivision(True):
19211  *         offset = aligned_p % alignment             # <<<<<<<<<<<<<<
19212  *
19213  *     if offset > 0:
19214  */
19215   __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
19216 
19217   /* "View.MemoryView":306
19218  *         offset = aligned_p % alignment
19219  *
19220  *     if offset > 0:             # <<<<<<<<<<<<<<
19221  *         aligned_p += alignment - offset
19222  *
19223  */
19224   __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
19225   if (__pyx_t_1) {
19226 
19227     /* "View.MemoryView":307
19228  *
19229  *     if offset > 0:
19230  *         aligned_p += alignment - offset             # <<<<<<<<<<<<<<
19231  *
19232  *     return <void *> aligned_p
19233  */
19234     __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
19235 
19236     /* "View.MemoryView":306
19237  *         offset = aligned_p % alignment
19238  *
19239  *     if offset > 0:             # <<<<<<<<<<<<<<
19240  *         aligned_p += alignment - offset
19241  *
19242  */
19243   }
19244 
19245   /* "View.MemoryView":309
19246  *         aligned_p += alignment - offset
19247  *
19248  *     return <void *> aligned_p             # <<<<<<<<<<<<<<
19249  *
19250  *
19251  */
19252   __pyx_r = ((void *)__pyx_v_aligned_p);
19253   goto __pyx_L0;
19254 
19255   /* "View.MemoryView":298
19256  *
19257  * @cname('__pyx_align_pointer')
19258  * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
19259  *     "Align pointer memory on a given boundary"
19260  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
19261  */
19262 
19263   /* function exit code */
19264   __pyx_L0:;
19265   return __pyx_r;
19266 }
19267 
19268 /* "View.MemoryView":345
19269  *     cdef __Pyx_TypeInfo *typeinfo
19270  *
19271  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
19272  *         self.obj = obj
19273  *         self.flags = flags
19274  */
19275 
19276 /* Python wrapper */
19277 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
19278 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
19279   PyObject *__pyx_v_obj = 0;
19280   int __pyx_v_flags;
19281   int __pyx_v_dtype_is_object;
19282   int __pyx_r;
19283   __Pyx_RefNannyDeclarations
19284   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
19285   {
19286     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
19287     PyObject* values[3] = {0,0,0};
19288     if (unlikely(__pyx_kwds)) {
19289       Py_ssize_t kw_args;
19290       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19291       switch (pos_args) {
19292         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19293         CYTHON_FALLTHROUGH;
19294         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19295         CYTHON_FALLTHROUGH;
19296         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19297         CYTHON_FALLTHROUGH;
19298         case  0: break;
19299         default: goto __pyx_L5_argtuple_error;
19300       }
19301       kw_args = PyDict_Size(__pyx_kwds);
19302       switch (pos_args) {
19303         case  0:
19304         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
19305         else goto __pyx_L5_argtuple_error;
19306         CYTHON_FALLTHROUGH;
19307         case  1:
19308         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
19309         else {
19310           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(1, 345, __pyx_L3_error)
19311         }
19312         CYTHON_FALLTHROUGH;
19313         case  2:
19314         if (kw_args > 0) {
19315           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
19316           if (value) { values[2] = value; kw_args--; }
19317         }
19318       }
19319       if (unlikely(kw_args > 0)) {
19320         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 345, __pyx_L3_error)
19321       }
19322     } else {
19323       switch (PyTuple_GET_SIZE(__pyx_args)) {
19324         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19325         CYTHON_FALLTHROUGH;
19326         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19327         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19328         break;
19329         default: goto __pyx_L5_argtuple_error;
19330       }
19331     }
19332     __pyx_v_obj = values[0];
19333     __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 345, __pyx_L3_error)
19334     if (values[2]) {
19335       __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 345, __pyx_L3_error)
19336     } else {
19337       __pyx_v_dtype_is_object = ((int)0);
19338     }
19339   }
19340   goto __pyx_L4_argument_unpacking_done;
19341   __pyx_L5_argtuple_error:;
19342   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 345, __pyx_L3_error)
19343   __pyx_L3_error:;
19344   __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
19345   __Pyx_RefNannyFinishContext();
19346   return -1;
19347   __pyx_L4_argument_unpacking_done:;
19348   __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);
19349 
19350   /* function exit code */
19351   __Pyx_RefNannyFinishContext();
19352   return __pyx_r;
19353 }
19354 
19355 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) {
19356   int __pyx_r;
19357   __Pyx_RefNannyDeclarations
19358   int __pyx_t_1;
19359   int __pyx_t_2;
19360   int __pyx_t_3;
19361   int __pyx_t_4;
19362   __Pyx_RefNannySetupContext("__cinit__", 0);
19363 
19364   /* "View.MemoryView":346
19365  *
19366  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
19367  *         self.obj = obj             # <<<<<<<<<<<<<<
19368  *         self.flags = flags
19369  *         if type(self) is memoryview or obj is not None:
19370  */
19371   __Pyx_INCREF(__pyx_v_obj);
19372   __Pyx_GIVEREF(__pyx_v_obj);
19373   __Pyx_GOTREF(__pyx_v_self->obj);
19374   __Pyx_DECREF(__pyx_v_self->obj);
19375   __pyx_v_self->obj = __pyx_v_obj;
19376 
19377   /* "View.MemoryView":347
19378  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
19379  *         self.obj = obj
19380  *         self.flags = flags             # <<<<<<<<<<<<<<
19381  *         if type(self) is memoryview or obj is not None:
19382  *             __Pyx_GetBuffer(obj, &self.view, flags)
19383  */
19384   __pyx_v_self->flags = __pyx_v_flags;
19385 
19386   /* "View.MemoryView":348
19387  *         self.obj = obj
19388  *         self.flags = flags
19389  *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
19390  *             __Pyx_GetBuffer(obj, &self.view, flags)
19391  *             if <PyObject *> self.view.obj == NULL:
19392  */
19393   __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
19394   __pyx_t_3 = (__pyx_t_2 != 0);
19395   if (!__pyx_t_3) {
19396   } else {
19397     __pyx_t_1 = __pyx_t_3;
19398     goto __pyx_L4_bool_binop_done;
19399   }
19400   __pyx_t_3 = (__pyx_v_obj != Py_None);
19401   __pyx_t_2 = (__pyx_t_3 != 0);
19402   __pyx_t_1 = __pyx_t_2;
19403   __pyx_L4_bool_binop_done:;
19404   if (__pyx_t_1) {
19405 
19406     /* "View.MemoryView":349
19407  *         self.flags = flags
19408  *         if type(self) is memoryview or obj is not None:
19409  *             __Pyx_GetBuffer(obj, &self.view, flags)             # <<<<<<<<<<<<<<
19410  *             if <PyObject *> self.view.obj == NULL:
19411  *                 (<__pyx_buffer *> &self.view).obj = Py_None
19412  */
19413     __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 349, __pyx_L1_error)
19414 
19415     /* "View.MemoryView":350
19416  *         if type(self) is memoryview or obj is not None:
19417  *             __Pyx_GetBuffer(obj, &self.view, flags)
19418  *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
19419  *                 (<__pyx_buffer *> &self.view).obj = Py_None
19420  *                 Py_INCREF(Py_None)
19421  */
19422     __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
19423     if (__pyx_t_1) {
19424 
19425       /* "View.MemoryView":351
19426  *             __Pyx_GetBuffer(obj, &self.view, flags)
19427  *             if <PyObject *> self.view.obj == NULL:
19428  *                 (<__pyx_buffer *> &self.view).obj = Py_None             # <<<<<<<<<<<<<<
19429  *                 Py_INCREF(Py_None)
19430  *
19431  */
19432       ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
19433 
19434       /* "View.MemoryView":352
19435  *             if <PyObject *> self.view.obj == NULL:
19436  *                 (<__pyx_buffer *> &self.view).obj = Py_None
19437  *                 Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
19438  *
19439  *         global __pyx_memoryview_thread_locks_used
19440  */
19441       Py_INCREF(Py_None);
19442 
19443       /* "View.MemoryView":350
19444  *         if type(self) is memoryview or obj is not None:
19445  *             __Pyx_GetBuffer(obj, &self.view, flags)
19446  *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
19447  *                 (<__pyx_buffer *> &self.view).obj = Py_None
19448  *                 Py_INCREF(Py_None)
19449  */
19450     }
19451 
19452     /* "View.MemoryView":348
19453  *         self.obj = obj
19454  *         self.flags = flags
19455  *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
19456  *             __Pyx_GetBuffer(obj, &self.view, flags)
19457  *             if <PyObject *> self.view.obj == NULL:
19458  */
19459   }
19460 
19461   /* "View.MemoryView":355
19462  *
19463  *         global __pyx_memoryview_thread_locks_used
19464  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
19465  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
19466  *             __pyx_memoryview_thread_locks_used += 1
19467  */
19468   __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
19469   if (__pyx_t_1) {
19470 
19471     /* "View.MemoryView":356
19472  *         global __pyx_memoryview_thread_locks_used
19473  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
19474  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]             # <<<<<<<<<<<<<<
19475  *             __pyx_memoryview_thread_locks_used += 1
19476  *         if self.lock is NULL:
19477  */
19478     __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
19479 
19480     /* "View.MemoryView":357
19481  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
19482  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
19483  *             __pyx_memoryview_thread_locks_used += 1             # <<<<<<<<<<<<<<
19484  *         if self.lock is NULL:
19485  *             self.lock = PyThread_allocate_lock()
19486  */
19487     __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
19488 
19489     /* "View.MemoryView":355
19490  *
19491  *         global __pyx_memoryview_thread_locks_used
19492  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
19493  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
19494  *             __pyx_memoryview_thread_locks_used += 1
19495  */
19496   }
19497 
19498   /* "View.MemoryView":358
19499  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
19500  *             __pyx_memoryview_thread_locks_used += 1
19501  *         if self.lock is NULL:             # <<<<<<<<<<<<<<
19502  *             self.lock = PyThread_allocate_lock()
19503  *             if self.lock is NULL:
19504  */
19505   __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
19506   if (__pyx_t_1) {
19507 
19508     /* "View.MemoryView":359
19509  *             __pyx_memoryview_thread_locks_used += 1
19510  *         if self.lock is NULL:
19511  *             self.lock = PyThread_allocate_lock()             # <<<<<<<<<<<<<<
19512  *             if self.lock is NULL:
19513  *                 raise MemoryError
19514  */
19515     __pyx_v_self->lock = PyThread_allocate_lock();
19516 
19517     /* "View.MemoryView":360
19518  *         if self.lock is NULL:
19519  *             self.lock = PyThread_allocate_lock()
19520  *             if self.lock is NULL:             # <<<<<<<<<<<<<<
19521  *                 raise MemoryError
19522  *
19523  */
19524     __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
19525     if (unlikely(__pyx_t_1)) {
19526 
19527       /* "View.MemoryView":361
19528  *             self.lock = PyThread_allocate_lock()
19529  *             if self.lock is NULL:
19530  *                 raise MemoryError             # <<<<<<<<<<<<<<
19531  *
19532  *         if flags & PyBUF_FORMAT:
19533  */
19534       PyErr_NoMemory(); __PYX_ERR(1, 361, __pyx_L1_error)
19535 
19536       /* "View.MemoryView":360
19537  *         if self.lock is NULL:
19538  *             self.lock = PyThread_allocate_lock()
19539  *             if self.lock is NULL:             # <<<<<<<<<<<<<<
19540  *                 raise MemoryError
19541  *
19542  */
19543     }
19544 
19545     /* "View.MemoryView":358
19546  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
19547  *             __pyx_memoryview_thread_locks_used += 1
19548  *         if self.lock is NULL:             # <<<<<<<<<<<<<<
19549  *             self.lock = PyThread_allocate_lock()
19550  *             if self.lock is NULL:
19551  */
19552   }
19553 
19554   /* "View.MemoryView":363
19555  *                 raise MemoryError
19556  *
19557  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
19558  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
19559  *         else:
19560  */
19561   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
19562   if (__pyx_t_1) {
19563 
19564     /* "View.MemoryView":364
19565  *
19566  *         if flags & PyBUF_FORMAT:
19567  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')             # <<<<<<<<<<<<<<
19568  *         else:
19569  *             self.dtype_is_object = dtype_is_object
19570  */
19571     __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
19572     if (__pyx_t_2) {
19573     } else {
19574       __pyx_t_1 = __pyx_t_2;
19575       goto __pyx_L11_bool_binop_done;
19576     }
19577     __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
19578     __pyx_t_1 = __pyx_t_2;
19579     __pyx_L11_bool_binop_done:;
19580     __pyx_v_self->dtype_is_object = __pyx_t_1;
19581 
19582     /* "View.MemoryView":363
19583  *                 raise MemoryError
19584  *
19585  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
19586  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
19587  *         else:
19588  */
19589     goto __pyx_L10;
19590   }
19591 
19592   /* "View.MemoryView":366
19593  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
19594  *         else:
19595  *             self.dtype_is_object = dtype_is_object             # <<<<<<<<<<<<<<
19596  *
19597  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
19598  */
19599   /*else*/ {
19600     __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
19601   }
19602   __pyx_L10:;
19603 
19604   /* "View.MemoryView":368
19605  *             self.dtype_is_object = dtype_is_object
19606  *
19607  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(             # <<<<<<<<<<<<<<
19608  *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
19609  *         self.typeinfo = NULL
19610  */
19611   __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));
19612 
19613   /* "View.MemoryView":370
19614  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
19615  *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
19616  *         self.typeinfo = NULL             # <<<<<<<<<<<<<<
19617  *
19618  *     def __dealloc__(memoryview self):
19619  */
19620   __pyx_v_self->typeinfo = NULL;
19621 
19622   /* "View.MemoryView":345
19623  *     cdef __Pyx_TypeInfo *typeinfo
19624  *
19625  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
19626  *         self.obj = obj
19627  *         self.flags = flags
19628  */
19629 
19630   /* function exit code */
19631   __pyx_r = 0;
19632   goto __pyx_L0;
19633   __pyx_L1_error:;
19634   __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
19635   __pyx_r = -1;
19636   __pyx_L0:;
19637   __Pyx_RefNannyFinishContext();
19638   return __pyx_r;
19639 }
19640 
19641 /* "View.MemoryView":372
19642  *         self.typeinfo = NULL
19643  *
19644  *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
19645  *         if self.obj is not None:
19646  *             __Pyx_ReleaseBuffer(&self.view)
19647  */
19648 
19649 /* Python wrapper */
19650 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
19651 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
19652   __Pyx_RefNannyDeclarations
19653   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
19654   __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));
19655 
19656   /* function exit code */
19657   __Pyx_RefNannyFinishContext();
19658 }
19659 
19660 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
19661   int __pyx_v_i;
19662   __Pyx_RefNannyDeclarations
19663   int __pyx_t_1;
19664   int __pyx_t_2;
19665   int __pyx_t_3;
19666   int __pyx_t_4;
19667   int __pyx_t_5;
19668   PyThread_type_lock __pyx_t_6;
19669   PyThread_type_lock __pyx_t_7;
19670   __Pyx_RefNannySetupContext("__dealloc__", 0);
19671 
19672   /* "View.MemoryView":373
19673  *
19674  *     def __dealloc__(memoryview self):
19675  *         if self.obj is not None:             # <<<<<<<<<<<<<<
19676  *             __Pyx_ReleaseBuffer(&self.view)
19677  *
19678  */
19679   __pyx_t_1 = (__pyx_v_self->obj != Py_None);
19680   __pyx_t_2 = (__pyx_t_1 != 0);
19681   if (__pyx_t_2) {
19682 
19683     /* "View.MemoryView":374
19684  *     def __dealloc__(memoryview self):
19685  *         if self.obj is not None:
19686  *             __Pyx_ReleaseBuffer(&self.view)             # <<<<<<<<<<<<<<
19687  *
19688  *         cdef int i
19689  */
19690     __Pyx_ReleaseBuffer((&__pyx_v_self->view));
19691 
19692     /* "View.MemoryView":373
19693  *
19694  *     def __dealloc__(memoryview self):
19695  *         if self.obj is not None:             # <<<<<<<<<<<<<<
19696  *             __Pyx_ReleaseBuffer(&self.view)
19697  *
19698  */
19699   }
19700 
19701   /* "View.MemoryView":378
19702  *         cdef int i
19703  *         global __pyx_memoryview_thread_locks_used
19704  *         if self.lock != NULL:             # <<<<<<<<<<<<<<
19705  *             for i in range(__pyx_memoryview_thread_locks_used):
19706  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
19707  */
19708   __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
19709   if (__pyx_t_2) {
19710 
19711     /* "View.MemoryView":379
19712  *         global __pyx_memoryview_thread_locks_used
19713  *         if self.lock != NULL:
19714  *             for i in range(__pyx_memoryview_thread_locks_used):             # <<<<<<<<<<<<<<
19715  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
19716  *                     __pyx_memoryview_thread_locks_used -= 1
19717  */
19718     __pyx_t_3 = __pyx_memoryview_thread_locks_used;
19719     __pyx_t_4 = __pyx_t_3;
19720     for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
19721       __pyx_v_i = __pyx_t_5;
19722 
19723       /* "View.MemoryView":380
19724  *         if self.lock != NULL:
19725  *             for i in range(__pyx_memoryview_thread_locks_used):
19726  *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
19727  *                     __pyx_memoryview_thread_locks_used -= 1
19728  *                     if i != __pyx_memoryview_thread_locks_used:
19729  */
19730       __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
19731       if (__pyx_t_2) {
19732 
19733         /* "View.MemoryView":381
19734  *             for i in range(__pyx_memoryview_thread_locks_used):
19735  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
19736  *                     __pyx_memoryview_thread_locks_used -= 1             # <<<<<<<<<<<<<<
19737  *                     if i != __pyx_memoryview_thread_locks_used:
19738  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
19739  */
19740         __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
19741 
19742         /* "View.MemoryView":382
19743  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
19744  *                     __pyx_memoryview_thread_locks_used -= 1
19745  *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
19746  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
19747  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
19748  */
19749         __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
19750         if (__pyx_t_2) {
19751 
19752           /* "View.MemoryView":384
19753  *                     if i != __pyx_memoryview_thread_locks_used:
19754  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
19755  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])             # <<<<<<<<<<<<<<
19756  *                     break
19757  *             else:
19758  */
19759           __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
19760           __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
19761 
19762           /* "View.MemoryView":383
19763  *                     __pyx_memoryview_thread_locks_used -= 1
19764  *                     if i != __pyx_memoryview_thread_locks_used:
19765  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (             # <<<<<<<<<<<<<<
19766  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
19767  *                     break
19768  */
19769           (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
19770           (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
19771 
19772           /* "View.MemoryView":382
19773  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
19774  *                     __pyx_memoryview_thread_locks_used -= 1
19775  *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
19776  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
19777  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
19778  */
19779         }
19780 
19781         /* "View.MemoryView":385
19782  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
19783  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
19784  *                     break             # <<<<<<<<<<<<<<
19785  *             else:
19786  *                 PyThread_free_lock(self.lock)
19787  */
19788         goto __pyx_L6_break;
19789 
19790         /* "View.MemoryView":380
19791  *         if self.lock != NULL:
19792  *             for i in range(__pyx_memoryview_thread_locks_used):
19793  *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
19794  *                     __pyx_memoryview_thread_locks_used -= 1
19795  *                     if i != __pyx_memoryview_thread_locks_used:
19796  */
19797       }
19798     }
19799     /*else*/ {
19800 
19801       /* "View.MemoryView":387
19802  *                     break
19803  *             else:
19804  *                 PyThread_free_lock(self.lock)             # <<<<<<<<<<<<<<
19805  *
19806  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
19807  */
19808       PyThread_free_lock(__pyx_v_self->lock);
19809     }
19810     __pyx_L6_break:;
19811 
19812     /* "View.MemoryView":378
19813  *         cdef int i
19814  *         global __pyx_memoryview_thread_locks_used
19815  *         if self.lock != NULL:             # <<<<<<<<<<<<<<
19816  *             for i in range(__pyx_memoryview_thread_locks_used):
19817  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
19818  */
19819   }
19820 
19821   /* "View.MemoryView":372
19822  *         self.typeinfo = NULL
19823  *
19824  *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
19825  *         if self.obj is not None:
19826  *             __Pyx_ReleaseBuffer(&self.view)
19827  */
19828 
19829   /* function exit code */
19830   __Pyx_RefNannyFinishContext();
19831 }
19832 
19833 /* "View.MemoryView":389
19834  *                 PyThread_free_lock(self.lock)
19835  *
19836  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
19837  *         cdef Py_ssize_t dim
19838  *         cdef char *itemp = <char *> self.view.buf
19839  */
19840 
19841 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
19842   Py_ssize_t __pyx_v_dim;
19843   char *__pyx_v_itemp;
19844   PyObject *__pyx_v_idx = NULL;
19845   char *__pyx_r;
19846   __Pyx_RefNannyDeclarations
19847   Py_ssize_t __pyx_t_1;
19848   PyObject *__pyx_t_2 = NULL;
19849   Py_ssize_t __pyx_t_3;
19850   PyObject *(*__pyx_t_4)(PyObject *);
19851   PyObject *__pyx_t_5 = NULL;
19852   Py_ssize_t __pyx_t_6;
19853   char *__pyx_t_7;
19854   __Pyx_RefNannySetupContext("get_item_pointer", 0);
19855 
19856   /* "View.MemoryView":391
19857  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
19858  *         cdef Py_ssize_t dim
19859  *         cdef char *itemp = <char *> self.view.buf             # <<<<<<<<<<<<<<
19860  *
19861  *         for dim, idx in enumerate(index):
19862  */
19863   __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
19864 
19865   /* "View.MemoryView":393
19866  *         cdef char *itemp = <char *> self.view.buf
19867  *
19868  *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
19869  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
19870  *
19871  */
19872   __pyx_t_1 = 0;
19873   if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
19874     __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
19875     __pyx_t_4 = NULL;
19876   } else {
19877     __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 393, __pyx_L1_error)
19878     __Pyx_GOTREF(__pyx_t_2);
19879     __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 393, __pyx_L1_error)
19880   }
19881   for (;;) {
19882     if (likely(!__pyx_t_4)) {
19883       if (likely(PyList_CheckExact(__pyx_t_2))) {
19884         if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
19885         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
19886         __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(1, 393, __pyx_L1_error)
19887         #else
19888         __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 393, __pyx_L1_error)
19889         __Pyx_GOTREF(__pyx_t_5);
19890         #endif
19891       } else {
19892         if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
19893         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
19894         __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(1, 393, __pyx_L1_error)
19895         #else
19896         __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 393, __pyx_L1_error)
19897         __Pyx_GOTREF(__pyx_t_5);
19898         #endif
19899       }
19900     } else {
19901       __pyx_t_5 = __pyx_t_4(__pyx_t_2);
19902       if (unlikely(!__pyx_t_5)) {
19903         PyObject* exc_type = PyErr_Occurred();
19904         if (exc_type) {
19905           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
19906           else __PYX_ERR(1, 393, __pyx_L1_error)
19907         }
19908         break;
19909       }
19910       __Pyx_GOTREF(__pyx_t_5);
19911     }
19912     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
19913     __pyx_t_5 = 0;
19914     __pyx_v_dim = __pyx_t_1;
19915     __pyx_t_1 = (__pyx_t_1 + 1);
19916 
19917     /* "View.MemoryView":394
19918  *
19919  *         for dim, idx in enumerate(index):
19920  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)             # <<<<<<<<<<<<<<
19921  *
19922  *         return itemp
19923  */
19924     __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 394, __pyx_L1_error)
19925     __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(1, 394, __pyx_L1_error)
19926     __pyx_v_itemp = __pyx_t_7;
19927 
19928     /* "View.MemoryView":393
19929  *         cdef char *itemp = <char *> self.view.buf
19930  *
19931  *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
19932  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
19933  *
19934  */
19935   }
19936   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19937 
19938   /* "View.MemoryView":396
19939  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
19940  *
19941  *         return itemp             # <<<<<<<<<<<<<<
19942  *
19943  *
19944  */
19945   __pyx_r = __pyx_v_itemp;
19946   goto __pyx_L0;
19947 
19948   /* "View.MemoryView":389
19949  *                 PyThread_free_lock(self.lock)
19950  *
19951  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
19952  *         cdef Py_ssize_t dim
19953  *         cdef char *itemp = <char *> self.view.buf
19954  */
19955 
19956   /* function exit code */
19957   __pyx_L1_error:;
19958   __Pyx_XDECREF(__pyx_t_2);
19959   __Pyx_XDECREF(__pyx_t_5);
19960   __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
19961   __pyx_r = NULL;
19962   __pyx_L0:;
19963   __Pyx_XDECREF(__pyx_v_idx);
19964   __Pyx_RefNannyFinishContext();
19965   return __pyx_r;
19966 }
19967 
19968 /* "View.MemoryView":399
19969  *
19970  *
19971  *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
19972  *         if index is Ellipsis:
19973  *             return self
19974  */
19975 
19976 /* Python wrapper */
19977 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
19978 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
19979   PyObject *__pyx_r = 0;
19980   __Pyx_RefNannyDeclarations
19981   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
19982   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
19983 
19984   /* function exit code */
19985   __Pyx_RefNannyFinishContext();
19986   return __pyx_r;
19987 }
19988 
19989 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
19990   PyObject *__pyx_v_have_slices = NULL;
19991   PyObject *__pyx_v_indices = NULL;
19992   char *__pyx_v_itemp;
19993   PyObject *__pyx_r = NULL;
19994   __Pyx_RefNannyDeclarations
19995   int __pyx_t_1;
19996   int __pyx_t_2;
19997   PyObject *__pyx_t_3 = NULL;
19998   PyObject *__pyx_t_4 = NULL;
19999   PyObject *__pyx_t_5 = NULL;
20000   char *__pyx_t_6;
20001   __Pyx_RefNannySetupContext("__getitem__", 0);
20002 
20003   /* "View.MemoryView":400
20004  *
20005  *     def __getitem__(memoryview self, object index):
20006  *         if index is Ellipsis:             # <<<<<<<<<<<<<<
20007  *             return self
20008  *
20009  */
20010   __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
20011   __pyx_t_2 = (__pyx_t_1 != 0);
20012   if (__pyx_t_2) {
20013 
20014     /* "View.MemoryView":401
20015  *     def __getitem__(memoryview self, object index):
20016  *         if index is Ellipsis:
20017  *             return self             # <<<<<<<<<<<<<<
20018  *
20019  *         have_slices, indices = _unellipsify(index, self.view.ndim)
20020  */
20021     __Pyx_XDECREF(__pyx_r);
20022     __Pyx_INCREF(((PyObject *)__pyx_v_self));
20023     __pyx_r = ((PyObject *)__pyx_v_self);
20024     goto __pyx_L0;
20025 
20026     /* "View.MemoryView":400
20027  *
20028  *     def __getitem__(memoryview self, object index):
20029  *         if index is Ellipsis:             # <<<<<<<<<<<<<<
20030  *             return self
20031  *
20032  */
20033   }
20034 
20035   /* "View.MemoryView":403
20036  *             return self
20037  *
20038  *         have_slices, indices = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
20039  *
20040  *         cdef char *itemp
20041  */
20042   __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 403, __pyx_L1_error)
20043   __Pyx_GOTREF(__pyx_t_3);
20044   if (likely(__pyx_t_3 != Py_None)) {
20045     PyObject* sequence = __pyx_t_3;
20046     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
20047     if (unlikely(size != 2)) {
20048       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
20049       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
20050       __PYX_ERR(1, 403, __pyx_L1_error)
20051     }
20052     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
20053     __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
20054     __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
20055     __Pyx_INCREF(__pyx_t_4);
20056     __Pyx_INCREF(__pyx_t_5);
20057     #else
20058     __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 403, __pyx_L1_error)
20059     __Pyx_GOTREF(__pyx_t_4);
20060     __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 403, __pyx_L1_error)
20061     __Pyx_GOTREF(__pyx_t_5);
20062     #endif
20063     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20064   } else {
20065     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 403, __pyx_L1_error)
20066   }
20067   __pyx_v_have_slices = __pyx_t_4;
20068   __pyx_t_4 = 0;
20069   __pyx_v_indices = __pyx_t_5;
20070   __pyx_t_5 = 0;
20071 
20072   /* "View.MemoryView":406
20073  *
20074  *         cdef char *itemp
20075  *         if have_slices:             # <<<<<<<<<<<<<<
20076  *             return memview_slice(self, indices)
20077  *         else:
20078  */
20079   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 406, __pyx_L1_error)
20080   if (__pyx_t_2) {
20081 
20082     /* "View.MemoryView":407
20083  *         cdef char *itemp
20084  *         if have_slices:
20085  *             return memview_slice(self, indices)             # <<<<<<<<<<<<<<
20086  *         else:
20087  *             itemp = self.get_item_pointer(indices)
20088  */
20089     __Pyx_XDECREF(__pyx_r);
20090     __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 407, __pyx_L1_error)
20091     __Pyx_GOTREF(__pyx_t_3);
20092     __pyx_r = __pyx_t_3;
20093     __pyx_t_3 = 0;
20094     goto __pyx_L0;
20095 
20096     /* "View.MemoryView":406
20097  *
20098  *         cdef char *itemp
20099  *         if have_slices:             # <<<<<<<<<<<<<<
20100  *             return memview_slice(self, indices)
20101  *         else:
20102  */
20103   }
20104 
20105   /* "View.MemoryView":409
20106  *             return memview_slice(self, indices)
20107  *         else:
20108  *             itemp = self.get_item_pointer(indices)             # <<<<<<<<<<<<<<
20109  *             return self.convert_item_to_object(itemp)
20110  *
20111  */
20112   /*else*/ {
20113     __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(1, 409, __pyx_L1_error)
20114     __pyx_v_itemp = __pyx_t_6;
20115 
20116     /* "View.MemoryView":410
20117  *         else:
20118  *             itemp = self.get_item_pointer(indices)
20119  *             return self.convert_item_to_object(itemp)             # <<<<<<<<<<<<<<
20120  *
20121  *     def __setitem__(memoryview self, object index, object value):
20122  */
20123     __Pyx_XDECREF(__pyx_r);
20124     __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 410, __pyx_L1_error)
20125     __Pyx_GOTREF(__pyx_t_3);
20126     __pyx_r = __pyx_t_3;
20127     __pyx_t_3 = 0;
20128     goto __pyx_L0;
20129   }
20130 
20131   /* "View.MemoryView":399
20132  *
20133  *
20134  *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
20135  *         if index is Ellipsis:
20136  *             return self
20137  */
20138 
20139   /* function exit code */
20140   __pyx_L1_error:;
20141   __Pyx_XDECREF(__pyx_t_3);
20142   __Pyx_XDECREF(__pyx_t_4);
20143   __Pyx_XDECREF(__pyx_t_5);
20144   __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
20145   __pyx_r = NULL;
20146   __pyx_L0:;
20147   __Pyx_XDECREF(__pyx_v_have_slices);
20148   __Pyx_XDECREF(__pyx_v_indices);
20149   __Pyx_XGIVEREF(__pyx_r);
20150   __Pyx_RefNannyFinishContext();
20151   return __pyx_r;
20152 }
20153 
20154 /* "View.MemoryView":412
20155  *             return self.convert_item_to_object(itemp)
20156  *
20157  *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
20158  *         if self.view.readonly:
20159  *             raise TypeError("Cannot assign to read-only memoryview")
20160  */
20161 
20162 /* Python wrapper */
20163 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
20164 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
20165   int __pyx_r;
20166   __Pyx_RefNannyDeclarations
20167   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
20168   __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));
20169 
20170   /* function exit code */
20171   __Pyx_RefNannyFinishContext();
20172   return __pyx_r;
20173 }
20174 
20175 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) {
20176   PyObject *__pyx_v_have_slices = NULL;
20177   PyObject *__pyx_v_obj = NULL;
20178   int __pyx_r;
20179   __Pyx_RefNannyDeclarations
20180   int __pyx_t_1;
20181   PyObject *__pyx_t_2 = NULL;
20182   PyObject *__pyx_t_3 = NULL;
20183   PyObject *__pyx_t_4 = NULL;
20184   __Pyx_RefNannySetupContext("__setitem__", 0);
20185   __Pyx_INCREF(__pyx_v_index);
20186 
20187   /* "View.MemoryView":413
20188  *
20189  *     def __setitem__(memoryview self, object index, object value):
20190  *         if self.view.readonly:             # <<<<<<<<<<<<<<
20191  *             raise TypeError("Cannot assign to read-only memoryview")
20192  *
20193  */
20194   __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
20195   if (unlikely(__pyx_t_1)) {
20196 
20197     /* "View.MemoryView":414
20198  *     def __setitem__(memoryview self, object index, object value):
20199  *         if self.view.readonly:
20200  *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
20201  *
20202  *         have_slices, index = _unellipsify(index, self.view.ndim)
20203  */
20204     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 414, __pyx_L1_error)
20205     __Pyx_GOTREF(__pyx_t_2);
20206     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
20207     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20208     __PYX_ERR(1, 414, __pyx_L1_error)
20209 
20210     /* "View.MemoryView":413
20211  *
20212  *     def __setitem__(memoryview self, object index, object value):
20213  *         if self.view.readonly:             # <<<<<<<<<<<<<<
20214  *             raise TypeError("Cannot assign to read-only memoryview")
20215  *
20216  */
20217   }
20218 
20219   /* "View.MemoryView":416
20220  *             raise TypeError("Cannot assign to read-only memoryview")
20221  *
20222  *         have_slices, index = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
20223  *
20224  *         if have_slices:
20225  */
20226   __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 416, __pyx_L1_error)
20227   __Pyx_GOTREF(__pyx_t_2);
20228   if (likely(__pyx_t_2 != Py_None)) {
20229     PyObject* sequence = __pyx_t_2;
20230     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
20231     if (unlikely(size != 2)) {
20232       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
20233       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
20234       __PYX_ERR(1, 416, __pyx_L1_error)
20235     }
20236     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
20237     __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
20238     __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
20239     __Pyx_INCREF(__pyx_t_3);
20240     __Pyx_INCREF(__pyx_t_4);
20241     #else
20242     __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 416, __pyx_L1_error)
20243     __Pyx_GOTREF(__pyx_t_3);
20244     __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 416, __pyx_L1_error)
20245     __Pyx_GOTREF(__pyx_t_4);
20246     #endif
20247     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20248   } else {
20249     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 416, __pyx_L1_error)
20250   }
20251   __pyx_v_have_slices = __pyx_t_3;
20252   __pyx_t_3 = 0;
20253   __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
20254   __pyx_t_4 = 0;
20255 
20256   /* "View.MemoryView":418
20257  *         have_slices, index = _unellipsify(index, self.view.ndim)
20258  *
20259  *         if have_slices:             # <<<<<<<<<<<<<<
20260  *             obj = self.is_slice(value)
20261  *             if obj:
20262  */
20263   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 418, __pyx_L1_error)
20264   if (__pyx_t_1) {
20265 
20266     /* "View.MemoryView":419
20267  *
20268  *         if have_slices:
20269  *             obj = self.is_slice(value)             # <<<<<<<<<<<<<<
20270  *             if obj:
20271  *                 self.setitem_slice_assignment(self[index], obj)
20272  */
20273     __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 419, __pyx_L1_error)
20274     __Pyx_GOTREF(__pyx_t_2);
20275     __pyx_v_obj = __pyx_t_2;
20276     __pyx_t_2 = 0;
20277 
20278     /* "View.MemoryView":420
20279  *         if have_slices:
20280  *             obj = self.is_slice(value)
20281  *             if obj:             # <<<<<<<<<<<<<<
20282  *                 self.setitem_slice_assignment(self[index], obj)
20283  *             else:
20284  */
20285     __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 420, __pyx_L1_error)
20286     if (__pyx_t_1) {
20287 
20288       /* "View.MemoryView":421
20289  *             obj = self.is_slice(value)
20290  *             if obj:
20291  *                 self.setitem_slice_assignment(self[index], obj)             # <<<<<<<<<<<<<<
20292  *             else:
20293  *                 self.setitem_slice_assign_scalar(self[index], value)
20294  */
20295       __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 421, __pyx_L1_error)
20296       __Pyx_GOTREF(__pyx_t_2);
20297       __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 421, __pyx_L1_error)
20298       __Pyx_GOTREF(__pyx_t_4);
20299       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20300       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20301 
20302       /* "View.MemoryView":420
20303  *         if have_slices:
20304  *             obj = self.is_slice(value)
20305  *             if obj:             # <<<<<<<<<<<<<<
20306  *                 self.setitem_slice_assignment(self[index], obj)
20307  *             else:
20308  */
20309       goto __pyx_L5;
20310     }
20311 
20312     /* "View.MemoryView":423
20313  *                 self.setitem_slice_assignment(self[index], obj)
20314  *             else:
20315  *                 self.setitem_slice_assign_scalar(self[index], value)             # <<<<<<<<<<<<<<
20316  *         else:
20317  *             self.setitem_indexed(index, value)
20318  */
20319     /*else*/ {
20320       __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 423, __pyx_L1_error)
20321       __Pyx_GOTREF(__pyx_t_4);
20322       if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(1, 423, __pyx_L1_error)
20323       __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 423, __pyx_L1_error)
20324       __Pyx_GOTREF(__pyx_t_2);
20325       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20326       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20327     }
20328     __pyx_L5:;
20329 
20330     /* "View.MemoryView":418
20331  *         have_slices, index = _unellipsify(index, self.view.ndim)
20332  *
20333  *         if have_slices:             # <<<<<<<<<<<<<<
20334  *             obj = self.is_slice(value)
20335  *             if obj:
20336  */
20337     goto __pyx_L4;
20338   }
20339 
20340   /* "View.MemoryView":425
20341  *                 self.setitem_slice_assign_scalar(self[index], value)
20342  *         else:
20343  *             self.setitem_indexed(index, value)             # <<<<<<<<<<<<<<
20344  *
20345  *     cdef is_slice(self, obj):
20346  */
20347   /*else*/ {
20348     __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error)
20349     __Pyx_GOTREF(__pyx_t_2);
20350     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20351   }
20352   __pyx_L4:;
20353 
20354   /* "View.MemoryView":412
20355  *             return self.convert_item_to_object(itemp)
20356  *
20357  *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
20358  *         if self.view.readonly:
20359  *             raise TypeError("Cannot assign to read-only memoryview")
20360  */
20361 
20362   /* function exit code */
20363   __pyx_r = 0;
20364   goto __pyx_L0;
20365   __pyx_L1_error:;
20366   __Pyx_XDECREF(__pyx_t_2);
20367   __Pyx_XDECREF(__pyx_t_3);
20368   __Pyx_XDECREF(__pyx_t_4);
20369   __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
20370   __pyx_r = -1;
20371   __pyx_L0:;
20372   __Pyx_XDECREF(__pyx_v_have_slices);
20373   __Pyx_XDECREF(__pyx_v_obj);
20374   __Pyx_XDECREF(__pyx_v_index);
20375   __Pyx_RefNannyFinishContext();
20376   return __pyx_r;
20377 }
20378 
20379 /* "View.MemoryView":427
20380  *             self.setitem_indexed(index, value)
20381  *
20382  *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
20383  *         if not isinstance(obj, memoryview):
20384  *             try:
20385  */
20386 
20387 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
20388   PyObject *__pyx_r = NULL;
20389   __Pyx_RefNannyDeclarations
20390   int __pyx_t_1;
20391   int __pyx_t_2;
20392   PyObject *__pyx_t_3 = NULL;
20393   PyObject *__pyx_t_4 = NULL;
20394   PyObject *__pyx_t_5 = NULL;
20395   PyObject *__pyx_t_6 = NULL;
20396   PyObject *__pyx_t_7 = NULL;
20397   PyObject *__pyx_t_8 = NULL;
20398   int __pyx_t_9;
20399   __Pyx_RefNannySetupContext("is_slice", 0);
20400   __Pyx_INCREF(__pyx_v_obj);
20401 
20402   /* "View.MemoryView":428
20403  *
20404  *     cdef is_slice(self, obj):
20405  *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
20406  *             try:
20407  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
20408  */
20409   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
20410   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
20411   if (__pyx_t_2) {
20412 
20413     /* "View.MemoryView":429
20414  *     cdef is_slice(self, obj):
20415  *         if not isinstance(obj, memoryview):
20416  *             try:             # <<<<<<<<<<<<<<
20417  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
20418  *                                  self.dtype_is_object)
20419  */
20420     {
20421       __Pyx_PyThreadState_declare
20422       __Pyx_PyThreadState_assign
20423       __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
20424       __Pyx_XGOTREF(__pyx_t_3);
20425       __Pyx_XGOTREF(__pyx_t_4);
20426       __Pyx_XGOTREF(__pyx_t_5);
20427       /*try:*/ {
20428 
20429         /* "View.MemoryView":430
20430  *         if not isinstance(obj, memoryview):
20431  *             try:
20432  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
20433  *                                  self.dtype_is_object)
20434  *             except TypeError:
20435  */
20436         __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 430, __pyx_L4_error)
20437         __Pyx_GOTREF(__pyx_t_6);
20438 
20439         /* "View.MemoryView":431
20440  *             try:
20441  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
20442  *                                  self.dtype_is_object)             # <<<<<<<<<<<<<<
20443  *             except TypeError:
20444  *                 return None
20445  */
20446         __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 431, __pyx_L4_error)
20447         __Pyx_GOTREF(__pyx_t_7);
20448 
20449         /* "View.MemoryView":430
20450  *         if not isinstance(obj, memoryview):
20451  *             try:
20452  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
20453  *                                  self.dtype_is_object)
20454  *             except TypeError:
20455  */
20456         __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 430, __pyx_L4_error)
20457         __Pyx_GOTREF(__pyx_t_8);
20458         __Pyx_INCREF(__pyx_v_obj);
20459         __Pyx_GIVEREF(__pyx_v_obj);
20460         PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
20461         __Pyx_GIVEREF(__pyx_t_6);
20462         PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
20463         __Pyx_GIVEREF(__pyx_t_7);
20464         PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
20465         __pyx_t_6 = 0;
20466         __pyx_t_7 = 0;
20467         __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 430, __pyx_L4_error)
20468         __Pyx_GOTREF(__pyx_t_7);
20469         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
20470         __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
20471         __pyx_t_7 = 0;
20472 
20473         /* "View.MemoryView":429
20474  *     cdef is_slice(self, obj):
20475  *         if not isinstance(obj, memoryview):
20476  *             try:             # <<<<<<<<<<<<<<
20477  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
20478  *                                  self.dtype_is_object)
20479  */
20480       }
20481       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
20482       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
20483       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
20484       goto __pyx_L9_try_end;
20485       __pyx_L4_error:;
20486       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
20487       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
20488       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
20489 
20490       /* "View.MemoryView":432
20491  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
20492  *                                  self.dtype_is_object)
20493  *             except TypeError:             # <<<<<<<<<<<<<<
20494  *                 return None
20495  *
20496  */
20497       __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
20498       if (__pyx_t_9) {
20499         __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
20500         if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(1, 432, __pyx_L6_except_error)
20501         __Pyx_GOTREF(__pyx_t_7);
20502         __Pyx_GOTREF(__pyx_t_8);
20503         __Pyx_GOTREF(__pyx_t_6);
20504 
20505         /* "View.MemoryView":433
20506  *                                  self.dtype_is_object)
20507  *             except TypeError:
20508  *                 return None             # <<<<<<<<<<<<<<
20509  *
20510  *         return obj
20511  */
20512         __Pyx_XDECREF(__pyx_r);
20513         __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20514         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20515         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20516         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
20517         goto __pyx_L7_except_return;
20518       }
20519       goto __pyx_L6_except_error;
20520       __pyx_L6_except_error:;
20521 
20522       /* "View.MemoryView":429
20523  *     cdef is_slice(self, obj):
20524  *         if not isinstance(obj, memoryview):
20525  *             try:             # <<<<<<<<<<<<<<
20526  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
20527  *                                  self.dtype_is_object)
20528  */
20529       __Pyx_XGIVEREF(__pyx_t_3);
20530       __Pyx_XGIVEREF(__pyx_t_4);
20531       __Pyx_XGIVEREF(__pyx_t_5);
20532       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
20533       goto __pyx_L1_error;
20534       __pyx_L7_except_return:;
20535       __Pyx_XGIVEREF(__pyx_t_3);
20536       __Pyx_XGIVEREF(__pyx_t_4);
20537       __Pyx_XGIVEREF(__pyx_t_5);
20538       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
20539       goto __pyx_L0;
20540       __pyx_L9_try_end:;
20541     }
20542 
20543     /* "View.MemoryView":428
20544  *
20545  *     cdef is_slice(self, obj):
20546  *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
20547  *             try:
20548  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
20549  */
20550   }
20551 
20552   /* "View.MemoryView":435
20553  *                 return None
20554  *
20555  *         return obj             # <<<<<<<<<<<<<<
20556  *
20557  *     cdef setitem_slice_assignment(self, dst, src):
20558  */
20559   __Pyx_XDECREF(__pyx_r);
20560   __Pyx_INCREF(__pyx_v_obj);
20561   __pyx_r = __pyx_v_obj;
20562   goto __pyx_L0;
20563 
20564   /* "View.MemoryView":427
20565  *             self.setitem_indexed(index, value)
20566  *
20567  *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
20568  *         if not isinstance(obj, memoryview):
20569  *             try:
20570  */
20571 
20572   /* function exit code */
20573   __pyx_L1_error:;
20574   __Pyx_XDECREF(__pyx_t_6);
20575   __Pyx_XDECREF(__pyx_t_7);
20576   __Pyx_XDECREF(__pyx_t_8);
20577   __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
20578   __pyx_r = 0;
20579   __pyx_L0:;
20580   __Pyx_XDECREF(__pyx_v_obj);
20581   __Pyx_XGIVEREF(__pyx_r);
20582   __Pyx_RefNannyFinishContext();
20583   return __pyx_r;
20584 }
20585 
20586 /* "View.MemoryView":437
20587  *         return obj
20588  *
20589  *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
20590  *         cdef __Pyx_memviewslice dst_slice
20591  *         cdef __Pyx_memviewslice src_slice
20592  */
20593 
20594 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
20595   __Pyx_memviewslice __pyx_v_dst_slice;
20596   __Pyx_memviewslice __pyx_v_src_slice;
20597   PyObject *__pyx_r = NULL;
20598   __Pyx_RefNannyDeclarations
20599   PyObject *__pyx_t_1 = NULL;
20600   int __pyx_t_2;
20601   int __pyx_t_3;
20602   int __pyx_t_4;
20603   __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
20604 
20605   /* "View.MemoryView":441
20606  *         cdef __Pyx_memviewslice src_slice
20607  *
20608  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
20609  *                                  get_slice_from_memview(dst, &dst_slice)[0],
20610  *                                  src.ndim, dst.ndim, self.dtype_is_object)
20611  */
20612   if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(1, 441, __pyx_L1_error)
20613 
20614   /* "View.MemoryView":442
20615  *
20616  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
20617  *                                  get_slice_from_memview(dst, &dst_slice)[0],             # <<<<<<<<<<<<<<
20618  *                                  src.ndim, dst.ndim, self.dtype_is_object)
20619  *
20620  */
20621   if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(1, 442, __pyx_L1_error)
20622 
20623   /* "View.MemoryView":443
20624  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
20625  *                                  get_slice_from_memview(dst, &dst_slice)[0],
20626  *                                  src.ndim, dst.ndim, self.dtype_is_object)             # <<<<<<<<<<<<<<
20627  *
20628  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
20629  */
20630   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 443, __pyx_L1_error)
20631   __Pyx_GOTREF(__pyx_t_1);
20632   __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 443, __pyx_L1_error)
20633   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20634   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 443, __pyx_L1_error)
20635   __Pyx_GOTREF(__pyx_t_1);
20636   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 443, __pyx_L1_error)
20637   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20638 
20639   /* "View.MemoryView":441
20640  *         cdef __Pyx_memviewslice src_slice
20641  *
20642  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
20643  *                                  get_slice_from_memview(dst, &dst_slice)[0],
20644  *                                  src.ndim, dst.ndim, self.dtype_is_object)
20645  */
20646   __pyx_t_4 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice))[0]), __pyx_t_2, __pyx_t_3, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 441, __pyx_L1_error)
20647 
20648   /* "View.MemoryView":437
20649  *         return obj
20650  *
20651  *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
20652  *         cdef __Pyx_memviewslice dst_slice
20653  *         cdef __Pyx_memviewslice src_slice
20654  */
20655 
20656   /* function exit code */
20657   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20658   goto __pyx_L0;
20659   __pyx_L1_error:;
20660   __Pyx_XDECREF(__pyx_t_1);
20661   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
20662   __pyx_r = 0;
20663   __pyx_L0:;
20664   __Pyx_XGIVEREF(__pyx_r);
20665   __Pyx_RefNannyFinishContext();
20666   return __pyx_r;
20667 }
20668 
20669 /* "View.MemoryView":445
20670  *                                  src.ndim, dst.ndim, self.dtype_is_object)
20671  *
20672  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
20673  *         cdef int array[128]
20674  *         cdef void *tmp = NULL
20675  */
20676 
20677 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) {
20678   int __pyx_v_array[0x80];
20679   void *__pyx_v_tmp;
20680   void *__pyx_v_item;
20681   __Pyx_memviewslice *__pyx_v_dst_slice;
20682   __Pyx_memviewslice __pyx_v_tmp_slice;
20683   PyObject *__pyx_r = NULL;
20684   __Pyx_RefNannyDeclarations
20685   int __pyx_t_1;
20686   PyObject *__pyx_t_2 = NULL;
20687   int __pyx_t_3;
20688   int __pyx_t_4;
20689   char const *__pyx_t_5;
20690   PyObject *__pyx_t_6 = NULL;
20691   PyObject *__pyx_t_7 = NULL;
20692   PyObject *__pyx_t_8 = NULL;
20693   PyObject *__pyx_t_9 = NULL;
20694   PyObject *__pyx_t_10 = NULL;
20695   PyObject *__pyx_t_11 = NULL;
20696   __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);
20697 
20698   /* "View.MemoryView":447
20699  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
20700  *         cdef int array[128]
20701  *         cdef void *tmp = NULL             # <<<<<<<<<<<<<<
20702  *         cdef void *item
20703  *
20704  */
20705   __pyx_v_tmp = NULL;
20706 
20707   /* "View.MemoryView":452
20708  *         cdef __Pyx_memviewslice *dst_slice
20709  *         cdef __Pyx_memviewslice tmp_slice
20710  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)             # <<<<<<<<<<<<<<
20711  *
20712  *         if <size_t>self.view.itemsize > sizeof(array):
20713  */
20714   __pyx_v_dst_slice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice));
20715 
20716   /* "View.MemoryView":454
20717  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
20718  *
20719  *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
20720  *             tmp = PyMem_Malloc(self.view.itemsize)
20721  *             if tmp == NULL:
20722  */
20723   __pyx_t_1 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
20724   if (__pyx_t_1) {
20725 
20726     /* "View.MemoryView":455
20727  *
20728  *         if <size_t>self.view.itemsize > sizeof(array):
20729  *             tmp = PyMem_Malloc(self.view.itemsize)             # <<<<<<<<<<<<<<
20730  *             if tmp == NULL:
20731  *                 raise MemoryError
20732  */
20733     __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
20734 
20735     /* "View.MemoryView":456
20736  *         if <size_t>self.view.itemsize > sizeof(array):
20737  *             tmp = PyMem_Malloc(self.view.itemsize)
20738  *             if tmp == NULL:             # <<<<<<<<<<<<<<
20739  *                 raise MemoryError
20740  *             item = tmp
20741  */
20742     __pyx_t_1 = ((__pyx_v_tmp == NULL) != 0);
20743     if (unlikely(__pyx_t_1)) {
20744 
20745       /* "View.MemoryView":457
20746  *             tmp = PyMem_Malloc(self.view.itemsize)
20747  *             if tmp == NULL:
20748  *                 raise MemoryError             # <<<<<<<<<<<<<<
20749  *             item = tmp
20750  *         else:
20751  */
20752       PyErr_NoMemory(); __PYX_ERR(1, 457, __pyx_L1_error)
20753 
20754       /* "View.MemoryView":456
20755  *         if <size_t>self.view.itemsize > sizeof(array):
20756  *             tmp = PyMem_Malloc(self.view.itemsize)
20757  *             if tmp == NULL:             # <<<<<<<<<<<<<<
20758  *                 raise MemoryError
20759  *             item = tmp
20760  */
20761     }
20762 
20763     /* "View.MemoryView":458
20764  *             if tmp == NULL:
20765  *                 raise MemoryError
20766  *             item = tmp             # <<<<<<<<<<<<<<
20767  *         else:
20768  *             item = <void *> array
20769  */
20770     __pyx_v_item = __pyx_v_tmp;
20771 
20772     /* "View.MemoryView":454
20773  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
20774  *
20775  *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
20776  *             tmp = PyMem_Malloc(self.view.itemsize)
20777  *             if tmp == NULL:
20778  */
20779     goto __pyx_L3;
20780   }
20781 
20782   /* "View.MemoryView":460
20783  *             item = tmp
20784  *         else:
20785  *             item = <void *> array             # <<<<<<<<<<<<<<
20786  *
20787  *         try:
20788  */
20789   /*else*/ {
20790     __pyx_v_item = ((void *)__pyx_v_array);
20791   }
20792   __pyx_L3:;
20793 
20794   /* "View.MemoryView":462
20795  *             item = <void *> array
20796  *
20797  *         try:             # <<<<<<<<<<<<<<
20798  *             if self.dtype_is_object:
20799  *                 (<PyObject **> item)[0] = <PyObject *> value
20800  */
20801   /*try:*/ {
20802 
20803     /* "View.MemoryView":463
20804  *
20805  *         try:
20806  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
20807  *                 (<PyObject **> item)[0] = <PyObject *> value
20808  *             else:
20809  */
20810     __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
20811     if (__pyx_t_1) {
20812 
20813       /* "View.MemoryView":464
20814  *         try:
20815  *             if self.dtype_is_object:
20816  *                 (<PyObject **> item)[0] = <PyObject *> value             # <<<<<<<<<<<<<<
20817  *             else:
20818  *                 self.assign_item_from_object(<char *> item, value)
20819  */
20820       (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
20821 
20822       /* "View.MemoryView":463
20823  *
20824  *         try:
20825  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
20826  *                 (<PyObject **> item)[0] = <PyObject *> value
20827  *             else:
20828  */
20829       goto __pyx_L8;
20830     }
20831 
20832     /* "View.MemoryView":466
20833  *                 (<PyObject **> item)[0] = <PyObject *> value
20834  *             else:
20835  *                 self.assign_item_from_object(<char *> item, value)             # <<<<<<<<<<<<<<
20836  *
20837  *
20838  */
20839     /*else*/ {
20840       __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 466, __pyx_L6_error)
20841       __Pyx_GOTREF(__pyx_t_2);
20842       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20843     }
20844     __pyx_L8:;
20845 
20846     /* "View.MemoryView":470
20847  *
20848  *
20849  *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
20850  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
20851  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
20852  */
20853     __pyx_t_1 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
20854     if (__pyx_t_1) {
20855 
20856       /* "View.MemoryView":471
20857  *
20858  *             if self.view.suboffsets != NULL:
20859  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)             # <<<<<<<<<<<<<<
20860  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
20861  *                                 item, self.dtype_is_object)
20862  */
20863       __pyx_t_2 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 471, __pyx_L6_error)
20864       __Pyx_GOTREF(__pyx_t_2);
20865       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20866 
20867       /* "View.MemoryView":470
20868  *
20869  *
20870  *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
20871  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
20872  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
20873  */
20874     }
20875 
20876     /* "View.MemoryView":472
20877  *             if self.view.suboffsets != NULL:
20878  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
20879  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,             # <<<<<<<<<<<<<<
20880  *                                 item, self.dtype_is_object)
20881  *         finally:
20882  */
20883     __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);
20884   }
20885 
20886   /* "View.MemoryView":475
20887  *                                 item, self.dtype_is_object)
20888  *         finally:
20889  *             PyMem_Free(tmp)             # <<<<<<<<<<<<<<
20890  *
20891  *     cdef setitem_indexed(self, index, value):
20892  */
20893   /*finally:*/ {
20894     /*normal exit:*/{
20895       PyMem_Free(__pyx_v_tmp);
20896       goto __pyx_L7;
20897     }
20898     __pyx_L6_error:;
20899     /*exception exit:*/{
20900       __Pyx_PyThreadState_declare
20901       __Pyx_PyThreadState_assign
20902       __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
20903       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
20904       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
20905       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);
20906       __Pyx_XGOTREF(__pyx_t_6);
20907       __Pyx_XGOTREF(__pyx_t_7);
20908       __Pyx_XGOTREF(__pyx_t_8);
20909       __Pyx_XGOTREF(__pyx_t_9);
20910       __Pyx_XGOTREF(__pyx_t_10);
20911       __Pyx_XGOTREF(__pyx_t_11);
20912       __pyx_t_3 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename;
20913       {
20914         PyMem_Free(__pyx_v_tmp);
20915       }
20916       if (PY_MAJOR_VERSION >= 3) {
20917         __Pyx_XGIVEREF(__pyx_t_9);
20918         __Pyx_XGIVEREF(__pyx_t_10);
20919         __Pyx_XGIVEREF(__pyx_t_11);
20920         __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
20921       }
20922       __Pyx_XGIVEREF(__pyx_t_6);
20923       __Pyx_XGIVEREF(__pyx_t_7);
20924       __Pyx_XGIVEREF(__pyx_t_8);
20925       __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
20926       __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
20927       __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5;
20928       goto __pyx_L1_error;
20929     }
20930     __pyx_L7:;
20931   }
20932 
20933   /* "View.MemoryView":445
20934  *                                  src.ndim, dst.ndim, self.dtype_is_object)
20935  *
20936  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
20937  *         cdef int array[128]
20938  *         cdef void *tmp = NULL
20939  */
20940 
20941   /* function exit code */
20942   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20943   goto __pyx_L0;
20944   __pyx_L1_error:;
20945   __Pyx_XDECREF(__pyx_t_2);
20946   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
20947   __pyx_r = 0;
20948   __pyx_L0:;
20949   __Pyx_XGIVEREF(__pyx_r);
20950   __Pyx_RefNannyFinishContext();
20951   return __pyx_r;
20952 }
20953 
20954 /* "View.MemoryView":477
20955  *             PyMem_Free(tmp)
20956  *
20957  *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
20958  *         cdef char *itemp = self.get_item_pointer(index)
20959  *         self.assign_item_from_object(itemp, value)
20960  */
20961 
20962 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
20963   char *__pyx_v_itemp;
20964   PyObject *__pyx_r = NULL;
20965   __Pyx_RefNannyDeclarations
20966   char *__pyx_t_1;
20967   PyObject *__pyx_t_2 = NULL;
20968   __Pyx_RefNannySetupContext("setitem_indexed", 0);
20969 
20970   /* "View.MemoryView":478
20971  *
20972  *     cdef setitem_indexed(self, index, value):
20973  *         cdef char *itemp = self.get_item_pointer(index)             # <<<<<<<<<<<<<<
20974  *         self.assign_item_from_object(itemp, value)
20975  *
20976  */
20977   __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(1, 478, __pyx_L1_error)
20978   __pyx_v_itemp = __pyx_t_1;
20979 
20980   /* "View.MemoryView":479
20981  *     cdef setitem_indexed(self, index, value):
20982  *         cdef char *itemp = self.get_item_pointer(index)
20983  *         self.assign_item_from_object(itemp, value)             # <<<<<<<<<<<<<<
20984  *
20985  *     cdef convert_item_to_object(self, char *itemp):
20986  */
20987   __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 479, __pyx_L1_error)
20988   __Pyx_GOTREF(__pyx_t_2);
20989   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20990 
20991   /* "View.MemoryView":477
20992  *             PyMem_Free(tmp)
20993  *
20994  *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
20995  *         cdef char *itemp = self.get_item_pointer(index)
20996  *         self.assign_item_from_object(itemp, value)
20997  */
20998 
20999   /* function exit code */
21000   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21001   goto __pyx_L0;
21002   __pyx_L1_error:;
21003   __Pyx_XDECREF(__pyx_t_2);
21004   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
21005   __pyx_r = 0;
21006   __pyx_L0:;
21007   __Pyx_XGIVEREF(__pyx_r);
21008   __Pyx_RefNannyFinishContext();
21009   return __pyx_r;
21010 }
21011 
21012 /* "View.MemoryView":481
21013  *         self.assign_item_from_object(itemp, value)
21014  *
21015  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
21016  *         """Only used if instantiated manually by the user, or if Cython doesn't
21017  *         know how to convert the type"""
21018  */
21019 
21020 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
21021   PyObject *__pyx_v_struct = NULL;
21022   PyObject *__pyx_v_bytesitem = 0;
21023   PyObject *__pyx_v_result = NULL;
21024   PyObject *__pyx_r = NULL;
21025   __Pyx_RefNannyDeclarations
21026   PyObject *__pyx_t_1 = NULL;
21027   PyObject *__pyx_t_2 = NULL;
21028   PyObject *__pyx_t_3 = NULL;
21029   PyObject *__pyx_t_4 = NULL;
21030   PyObject *__pyx_t_5 = NULL;
21031   PyObject *__pyx_t_6 = NULL;
21032   PyObject *__pyx_t_7 = NULL;
21033   int __pyx_t_8;
21034   PyObject *__pyx_t_9 = NULL;
21035   size_t __pyx_t_10;
21036   int __pyx_t_11;
21037   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
21038 
21039   /* "View.MemoryView":484
21040  *         """Only used if instantiated manually by the user, or if Cython doesn't
21041  *         know how to convert the type"""
21042  *         import struct             # <<<<<<<<<<<<<<
21043  *         cdef bytes bytesitem
21044  *
21045  */
21046   __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 484, __pyx_L1_error)
21047   __Pyx_GOTREF(__pyx_t_1);
21048   __pyx_v_struct = __pyx_t_1;
21049   __pyx_t_1 = 0;
21050 
21051   /* "View.MemoryView":487
21052  *         cdef bytes bytesitem
21053  *
21054  *         bytesitem = itemp[:self.view.itemsize]             # <<<<<<<<<<<<<<
21055  *         try:
21056  *             result = struct.unpack(self.view.format, bytesitem)
21057  */
21058   __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 487, __pyx_L1_error)
21059   __Pyx_GOTREF(__pyx_t_1);
21060   __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
21061   __pyx_t_1 = 0;
21062 
21063   /* "View.MemoryView":488
21064  *
21065  *         bytesitem = itemp[:self.view.itemsize]
21066  *         try:             # <<<<<<<<<<<<<<
21067  *             result = struct.unpack(self.view.format, bytesitem)
21068  *         except struct.error:
21069  */
21070   {
21071     __Pyx_PyThreadState_declare
21072     __Pyx_PyThreadState_assign
21073     __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
21074     __Pyx_XGOTREF(__pyx_t_2);
21075     __Pyx_XGOTREF(__pyx_t_3);
21076     __Pyx_XGOTREF(__pyx_t_4);
21077     /*try:*/ {
21078 
21079       /* "View.MemoryView":489
21080  *         bytesitem = itemp[:self.view.itemsize]
21081  *         try:
21082  *             result = struct.unpack(self.view.format, bytesitem)             # <<<<<<<<<<<<<<
21083  *         except struct.error:
21084  *             raise ValueError("Unable to convert item to object")
21085  */
21086       __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 489, __pyx_L3_error)
21087       __Pyx_GOTREF(__pyx_t_5);
21088       __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 489, __pyx_L3_error)
21089       __Pyx_GOTREF(__pyx_t_6);
21090       __pyx_t_7 = NULL;
21091       __pyx_t_8 = 0;
21092       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
21093         __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
21094         if (likely(__pyx_t_7)) {
21095           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
21096           __Pyx_INCREF(__pyx_t_7);
21097           __Pyx_INCREF(function);
21098           __Pyx_DECREF_SET(__pyx_t_5, function);
21099           __pyx_t_8 = 1;
21100         }
21101       }
21102       #if CYTHON_FAST_PYCALL
21103       if (PyFunction_Check(__pyx_t_5)) {
21104         PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
21105         __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 489, __pyx_L3_error)
21106         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
21107         __Pyx_GOTREF(__pyx_t_1);
21108         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
21109       } else
21110       #endif
21111       #if CYTHON_FAST_PYCCALL
21112       if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
21113         PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
21114         __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 489, __pyx_L3_error)
21115         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
21116         __Pyx_GOTREF(__pyx_t_1);
21117         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
21118       } else
21119       #endif
21120       {
21121         __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 489, __pyx_L3_error)
21122         __Pyx_GOTREF(__pyx_t_9);
21123         if (__pyx_t_7) {
21124           __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
21125         }
21126         __Pyx_GIVEREF(__pyx_t_6);
21127         PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
21128         __Pyx_INCREF(__pyx_v_bytesitem);
21129         __Pyx_GIVEREF(__pyx_v_bytesitem);
21130         PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
21131         __pyx_t_6 = 0;
21132         __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 489, __pyx_L3_error)
21133         __Pyx_GOTREF(__pyx_t_1);
21134         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
21135       }
21136       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
21137       __pyx_v_result = __pyx_t_1;
21138       __pyx_t_1 = 0;
21139 
21140       /* "View.MemoryView":488
21141  *
21142  *         bytesitem = itemp[:self.view.itemsize]
21143  *         try:             # <<<<<<<<<<<<<<
21144  *             result = struct.unpack(self.view.format, bytesitem)
21145  *         except struct.error:
21146  */
21147     }
21148 
21149     /* "View.MemoryView":493
21150  *             raise ValueError("Unable to convert item to object")
21151  *         else:
21152  *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
21153  *                 return result[0]
21154  *             return result
21155  */
21156     /*else:*/ {
21157       __pyx_t_10 = strlen(__pyx_v_self->view.format);
21158       __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
21159       if (__pyx_t_11) {
21160 
21161         /* "View.MemoryView":494
21162  *         else:
21163  *             if len(self.view.format) == 1:
21164  *                 return result[0]             # <<<<<<<<<<<<<<
21165  *             return result
21166  *
21167  */
21168         __Pyx_XDECREF(__pyx_r);
21169         __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 494, __pyx_L5_except_error)
21170         __Pyx_GOTREF(__pyx_t_1);
21171         __pyx_r = __pyx_t_1;
21172         __pyx_t_1 = 0;
21173         goto __pyx_L6_except_return;
21174 
21175         /* "View.MemoryView":493
21176  *             raise ValueError("Unable to convert item to object")
21177  *         else:
21178  *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
21179  *                 return result[0]
21180  *             return result
21181  */
21182       }
21183 
21184       /* "View.MemoryView":495
21185  *             if len(self.view.format) == 1:
21186  *                 return result[0]
21187  *             return result             # <<<<<<<<<<<<<<
21188  *
21189  *     cdef assign_item_from_object(self, char *itemp, object value):
21190  */
21191       __Pyx_XDECREF(__pyx_r);
21192       __Pyx_INCREF(__pyx_v_result);
21193       __pyx_r = __pyx_v_result;
21194       goto __pyx_L6_except_return;
21195     }
21196     __pyx_L3_error:;
21197     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
21198     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
21199     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
21200     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
21201     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
21202 
21203     /* "View.MemoryView":490
21204  *         try:
21205  *             result = struct.unpack(self.view.format, bytesitem)
21206  *         except struct.error:             # <<<<<<<<<<<<<<
21207  *             raise ValueError("Unable to convert item to object")
21208  *         else:
21209  */
21210     __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
21211     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 490, __pyx_L5_except_error)
21212     __Pyx_GOTREF(__pyx_t_6);
21213     __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
21214     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
21215     __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
21216     __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
21217     if (__pyx_t_8) {
21218       __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
21219       if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(1, 490, __pyx_L5_except_error)
21220       __Pyx_GOTREF(__pyx_t_9);
21221       __Pyx_GOTREF(__pyx_t_5);
21222       __Pyx_GOTREF(__pyx_t_1);
21223 
21224       /* "View.MemoryView":491
21225  *             result = struct.unpack(self.view.format, bytesitem)
21226  *         except struct.error:
21227  *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
21228  *         else:
21229  *             if len(self.view.format) == 1:
21230  */
21231       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 491, __pyx_L5_except_error)
21232       __Pyx_GOTREF(__pyx_t_6);
21233       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
21234       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
21235       __PYX_ERR(1, 491, __pyx_L5_except_error)
21236     }
21237     goto __pyx_L5_except_error;
21238     __pyx_L5_except_error:;
21239 
21240     /* "View.MemoryView":488
21241  *
21242  *         bytesitem = itemp[:self.view.itemsize]
21243  *         try:             # <<<<<<<<<<<<<<
21244  *             result = struct.unpack(self.view.format, bytesitem)
21245  *         except struct.error:
21246  */
21247     __Pyx_XGIVEREF(__pyx_t_2);
21248     __Pyx_XGIVEREF(__pyx_t_3);
21249     __Pyx_XGIVEREF(__pyx_t_4);
21250     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
21251     goto __pyx_L1_error;
21252     __pyx_L6_except_return:;
21253     __Pyx_XGIVEREF(__pyx_t_2);
21254     __Pyx_XGIVEREF(__pyx_t_3);
21255     __Pyx_XGIVEREF(__pyx_t_4);
21256     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
21257     goto __pyx_L0;
21258   }
21259 
21260   /* "View.MemoryView":481
21261  *         self.assign_item_from_object(itemp, value)
21262  *
21263  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
21264  *         """Only used if instantiated manually by the user, or if Cython doesn't
21265  *         know how to convert the type"""
21266  */
21267 
21268   /* function exit code */
21269   __pyx_L1_error:;
21270   __Pyx_XDECREF(__pyx_t_1);
21271   __Pyx_XDECREF(__pyx_t_5);
21272   __Pyx_XDECREF(__pyx_t_6);
21273   __Pyx_XDECREF(__pyx_t_7);
21274   __Pyx_XDECREF(__pyx_t_9);
21275   __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
21276   __pyx_r = 0;
21277   __pyx_L0:;
21278   __Pyx_XDECREF(__pyx_v_struct);
21279   __Pyx_XDECREF(__pyx_v_bytesitem);
21280   __Pyx_XDECREF(__pyx_v_result);
21281   __Pyx_XGIVEREF(__pyx_r);
21282   __Pyx_RefNannyFinishContext();
21283   return __pyx_r;
21284 }
21285 
21286 /* "View.MemoryView":497
21287  *             return result
21288  *
21289  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
21290  *         """Only used if instantiated manually by the user, or if Cython doesn't
21291  *         know how to convert the type"""
21292  */
21293 
21294 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
21295   PyObject *__pyx_v_struct = NULL;
21296   char __pyx_v_c;
21297   PyObject *__pyx_v_bytesvalue = 0;
21298   Py_ssize_t __pyx_v_i;
21299   PyObject *__pyx_r = NULL;
21300   __Pyx_RefNannyDeclarations
21301   PyObject *__pyx_t_1 = NULL;
21302   int __pyx_t_2;
21303   int __pyx_t_3;
21304   PyObject *__pyx_t_4 = NULL;
21305   PyObject *__pyx_t_5 = NULL;
21306   PyObject *__pyx_t_6 = NULL;
21307   int __pyx_t_7;
21308   PyObject *__pyx_t_8 = NULL;
21309   Py_ssize_t __pyx_t_9;
21310   PyObject *__pyx_t_10 = NULL;
21311   char *__pyx_t_11;
21312   char *__pyx_t_12;
21313   char *__pyx_t_13;
21314   char *__pyx_t_14;
21315   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
21316 
21317   /* "View.MemoryView":500
21318  *         """Only used if instantiated manually by the user, or if Cython doesn't
21319  *         know how to convert the type"""
21320  *         import struct             # <<<<<<<<<<<<<<
21321  *         cdef char c
21322  *         cdef bytes bytesvalue
21323  */
21324   __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 500, __pyx_L1_error)
21325   __Pyx_GOTREF(__pyx_t_1);
21326   __pyx_v_struct = __pyx_t_1;
21327   __pyx_t_1 = 0;
21328 
21329   /* "View.MemoryView":505
21330  *         cdef Py_ssize_t i
21331  *
21332  *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
21333  *             bytesvalue = struct.pack(self.view.format, *value)
21334  *         else:
21335  */
21336   __pyx_t_2 = PyTuple_Check(__pyx_v_value);
21337   __pyx_t_3 = (__pyx_t_2 != 0);
21338   if (__pyx_t_3) {
21339 
21340     /* "View.MemoryView":506
21341  *
21342  *         if isinstance(value, tuple):
21343  *             bytesvalue = struct.pack(self.view.format, *value)             # <<<<<<<<<<<<<<
21344  *         else:
21345  *             bytesvalue = struct.pack(self.view.format, value)
21346  */
21347     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 506, __pyx_L1_error)
21348     __Pyx_GOTREF(__pyx_t_1);
21349     __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 506, __pyx_L1_error)
21350     __Pyx_GOTREF(__pyx_t_4);
21351     __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 506, __pyx_L1_error)
21352     __Pyx_GOTREF(__pyx_t_5);
21353     __Pyx_GIVEREF(__pyx_t_4);
21354     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
21355     __pyx_t_4 = 0;
21356     __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 506, __pyx_L1_error)
21357     __Pyx_GOTREF(__pyx_t_4);
21358     __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 506, __pyx_L1_error)
21359     __Pyx_GOTREF(__pyx_t_6);
21360     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
21361     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21362     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 506, __pyx_L1_error)
21363     __Pyx_GOTREF(__pyx_t_4);
21364     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21365     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
21366     if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(1, 506, __pyx_L1_error)
21367     __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
21368     __pyx_t_4 = 0;
21369 
21370     /* "View.MemoryView":505
21371  *         cdef Py_ssize_t i
21372  *
21373  *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
21374  *             bytesvalue = struct.pack(self.view.format, *value)
21375  *         else:
21376  */
21377     goto __pyx_L3;
21378   }
21379 
21380   /* "View.MemoryView":508
21381  *             bytesvalue = struct.pack(self.view.format, *value)
21382  *         else:
21383  *             bytesvalue = struct.pack(self.view.format, value)             # <<<<<<<<<<<<<<
21384  *
21385  *         for i, c in enumerate(bytesvalue):
21386  */
21387   /*else*/ {
21388     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 508, __pyx_L1_error)
21389     __Pyx_GOTREF(__pyx_t_6);
21390     __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 508, __pyx_L1_error)
21391     __Pyx_GOTREF(__pyx_t_1);
21392     __pyx_t_5 = NULL;
21393     __pyx_t_7 = 0;
21394     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
21395       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
21396       if (likely(__pyx_t_5)) {
21397         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
21398         __Pyx_INCREF(__pyx_t_5);
21399         __Pyx_INCREF(function);
21400         __Pyx_DECREF_SET(__pyx_t_6, function);
21401         __pyx_t_7 = 1;
21402       }
21403     }
21404     #if CYTHON_FAST_PYCALL
21405     if (PyFunction_Check(__pyx_t_6)) {
21406       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
21407       __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 508, __pyx_L1_error)
21408       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
21409       __Pyx_GOTREF(__pyx_t_4);
21410       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21411     } else
21412     #endif
21413     #if CYTHON_FAST_PYCCALL
21414     if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
21415       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
21416       __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 508, __pyx_L1_error)
21417       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
21418       __Pyx_GOTREF(__pyx_t_4);
21419       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21420     } else
21421     #endif
21422     {
21423       __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 508, __pyx_L1_error)
21424       __Pyx_GOTREF(__pyx_t_8);
21425       if (__pyx_t_5) {
21426         __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
21427       }
21428       __Pyx_GIVEREF(__pyx_t_1);
21429       PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
21430       __Pyx_INCREF(__pyx_v_value);
21431       __Pyx_GIVEREF(__pyx_v_value);
21432       PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
21433       __pyx_t_1 = 0;
21434       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 508, __pyx_L1_error)
21435       __Pyx_GOTREF(__pyx_t_4);
21436       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
21437     }
21438     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
21439     if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(1, 508, __pyx_L1_error)
21440     __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
21441     __pyx_t_4 = 0;
21442   }
21443   __pyx_L3:;
21444 
21445   /* "View.MemoryView":510
21446  *             bytesvalue = struct.pack(self.view.format, value)
21447  *
21448  *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
21449  *             itemp[i] = c
21450  *
21451  */
21452   __pyx_t_9 = 0;
21453   if (unlikely(__pyx_v_bytesvalue == Py_None)) {
21454     PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
21455     __PYX_ERR(1, 510, __pyx_L1_error)
21456   }
21457   __Pyx_INCREF(__pyx_v_bytesvalue);
21458   __pyx_t_10 = __pyx_v_bytesvalue;
21459   __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
21460   __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
21461   for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
21462     __pyx_t_11 = __pyx_t_14;
21463     __pyx_v_c = (__pyx_t_11[0]);
21464 
21465     /* "View.MemoryView":511
21466  *
21467  *         for i, c in enumerate(bytesvalue):
21468  *             itemp[i] = c             # <<<<<<<<<<<<<<
21469  *
21470  *     @cname('getbuffer')
21471  */
21472     __pyx_v_i = __pyx_t_9;
21473 
21474     /* "View.MemoryView":510
21475  *             bytesvalue = struct.pack(self.view.format, value)
21476  *
21477  *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
21478  *             itemp[i] = c
21479  *
21480  */
21481     __pyx_t_9 = (__pyx_t_9 + 1);
21482 
21483     /* "View.MemoryView":511
21484  *
21485  *         for i, c in enumerate(bytesvalue):
21486  *             itemp[i] = c             # <<<<<<<<<<<<<<
21487  *
21488  *     @cname('getbuffer')
21489  */
21490     (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
21491   }
21492   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
21493 
21494   /* "View.MemoryView":497
21495  *             return result
21496  *
21497  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
21498  *         """Only used if instantiated manually by the user, or if Cython doesn't
21499  *         know how to convert the type"""
21500  */
21501 
21502   /* function exit code */
21503   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21504   goto __pyx_L0;
21505   __pyx_L1_error:;
21506   __Pyx_XDECREF(__pyx_t_1);
21507   __Pyx_XDECREF(__pyx_t_4);
21508   __Pyx_XDECREF(__pyx_t_5);
21509   __Pyx_XDECREF(__pyx_t_6);
21510   __Pyx_XDECREF(__pyx_t_8);
21511   __Pyx_XDECREF(__pyx_t_10);
21512   __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
21513   __pyx_r = 0;
21514   __pyx_L0:;
21515   __Pyx_XDECREF(__pyx_v_struct);
21516   __Pyx_XDECREF(__pyx_v_bytesvalue);
21517   __Pyx_XGIVEREF(__pyx_r);
21518   __Pyx_RefNannyFinishContext();
21519   return __pyx_r;
21520 }
21521 
21522 /* "View.MemoryView":514
21523  *
21524  *     @cname('getbuffer')
21525  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
21526  *         if flags & PyBUF_WRITABLE and self.view.readonly:
21527  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
21528  */
21529 
21530 /* Python wrapper */
21531 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
21532 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
21533   int __pyx_r;
21534   __Pyx_RefNannyDeclarations
21535   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
21536   __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));
21537 
21538   /* function exit code */
21539   __Pyx_RefNannyFinishContext();
21540   return __pyx_r;
21541 }
21542 
21543 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) {
21544   int __pyx_r;
21545   __Pyx_RefNannyDeclarations
21546   int __pyx_t_1;
21547   int __pyx_t_2;
21548   PyObject *__pyx_t_3 = NULL;
21549   Py_ssize_t *__pyx_t_4;
21550   char *__pyx_t_5;
21551   void *__pyx_t_6;
21552   int __pyx_t_7;
21553   Py_ssize_t __pyx_t_8;
21554   if (__pyx_v_info == NULL) {
21555     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
21556     return -1;
21557   }
21558   __Pyx_RefNannySetupContext("__getbuffer__", 0);
21559   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
21560   __Pyx_GIVEREF(__pyx_v_info->obj);
21561 
21562   /* "View.MemoryView":515
21563  *     @cname('getbuffer')
21564  *     def __getbuffer__(self, Py_buffer *info, int flags):
21565  *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
21566  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
21567  *
21568  */
21569   __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
21570   if (__pyx_t_2) {
21571   } else {
21572     __pyx_t_1 = __pyx_t_2;
21573     goto __pyx_L4_bool_binop_done;
21574   }
21575   __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
21576   __pyx_t_1 = __pyx_t_2;
21577   __pyx_L4_bool_binop_done:;
21578   if (unlikely(__pyx_t_1)) {
21579 
21580     /* "View.MemoryView":516
21581  *     def __getbuffer__(self, Py_buffer *info, int flags):
21582  *         if flags & PyBUF_WRITABLE and self.view.readonly:
21583  *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
21584  *
21585  *         if flags & PyBUF_ND:
21586  */
21587     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 516, __pyx_L1_error)
21588     __Pyx_GOTREF(__pyx_t_3);
21589     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
21590     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21591     __PYX_ERR(1, 516, __pyx_L1_error)
21592 
21593     /* "View.MemoryView":515
21594  *     @cname('getbuffer')
21595  *     def __getbuffer__(self, Py_buffer *info, int flags):
21596  *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
21597  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
21598  *
21599  */
21600   }
21601 
21602   /* "View.MemoryView":518
21603  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
21604  *
21605  *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
21606  *             info.shape = self.view.shape
21607  *         else:
21608  */
21609   __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
21610   if (__pyx_t_1) {
21611 
21612     /* "View.MemoryView":519
21613  *
21614  *         if flags & PyBUF_ND:
21615  *             info.shape = self.view.shape             # <<<<<<<<<<<<<<
21616  *         else:
21617  *             info.shape = NULL
21618  */
21619     __pyx_t_4 = __pyx_v_self->view.shape;
21620     __pyx_v_info->shape = __pyx_t_4;
21621 
21622     /* "View.MemoryView":518
21623  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
21624  *
21625  *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
21626  *             info.shape = self.view.shape
21627  *         else:
21628  */
21629     goto __pyx_L6;
21630   }
21631 
21632   /* "View.MemoryView":521
21633  *             info.shape = self.view.shape
21634  *         else:
21635  *             info.shape = NULL             # <<<<<<<<<<<<<<
21636  *
21637  *         if flags & PyBUF_STRIDES:
21638  */
21639   /*else*/ {
21640     __pyx_v_info->shape = NULL;
21641   }
21642   __pyx_L6:;
21643 
21644   /* "View.MemoryView":523
21645  *             info.shape = NULL
21646  *
21647  *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
21648  *             info.strides = self.view.strides
21649  *         else:
21650  */
21651   __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
21652   if (__pyx_t_1) {
21653 
21654     /* "View.MemoryView":524
21655  *
21656  *         if flags & PyBUF_STRIDES:
21657  *             info.strides = self.view.strides             # <<<<<<<<<<<<<<
21658  *         else:
21659  *             info.strides = NULL
21660  */
21661     __pyx_t_4 = __pyx_v_self->view.strides;
21662     __pyx_v_info->strides = __pyx_t_4;
21663 
21664     /* "View.MemoryView":523
21665  *             info.shape = NULL
21666  *
21667  *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
21668  *             info.strides = self.view.strides
21669  *         else:
21670  */
21671     goto __pyx_L7;
21672   }
21673 
21674   /* "View.MemoryView":526
21675  *             info.strides = self.view.strides
21676  *         else:
21677  *             info.strides = NULL             # <<<<<<<<<<<<<<
21678  *
21679  *         if flags & PyBUF_INDIRECT:
21680  */
21681   /*else*/ {
21682     __pyx_v_info->strides = NULL;
21683   }
21684   __pyx_L7:;
21685 
21686   /* "View.MemoryView":528
21687  *             info.strides = NULL
21688  *
21689  *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
21690  *             info.suboffsets = self.view.suboffsets
21691  *         else:
21692  */
21693   __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
21694   if (__pyx_t_1) {
21695 
21696     /* "View.MemoryView":529
21697  *
21698  *         if flags & PyBUF_INDIRECT:
21699  *             info.suboffsets = self.view.suboffsets             # <<<<<<<<<<<<<<
21700  *         else:
21701  *             info.suboffsets = NULL
21702  */
21703     __pyx_t_4 = __pyx_v_self->view.suboffsets;
21704     __pyx_v_info->suboffsets = __pyx_t_4;
21705 
21706     /* "View.MemoryView":528
21707  *             info.strides = NULL
21708  *
21709  *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
21710  *             info.suboffsets = self.view.suboffsets
21711  *         else:
21712  */
21713     goto __pyx_L8;
21714   }
21715 
21716   /* "View.MemoryView":531
21717  *             info.suboffsets = self.view.suboffsets
21718  *         else:
21719  *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
21720  *
21721  *         if flags & PyBUF_FORMAT:
21722  */
21723   /*else*/ {
21724     __pyx_v_info->suboffsets = NULL;
21725   }
21726   __pyx_L8:;
21727 
21728   /* "View.MemoryView":533
21729  *             info.suboffsets = NULL
21730  *
21731  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
21732  *             info.format = self.view.format
21733  *         else:
21734  */
21735   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
21736   if (__pyx_t_1) {
21737 
21738     /* "View.MemoryView":534
21739  *
21740  *         if flags & PyBUF_FORMAT:
21741  *             info.format = self.view.format             # <<<<<<<<<<<<<<
21742  *         else:
21743  *             info.format = NULL
21744  */
21745     __pyx_t_5 = __pyx_v_self->view.format;
21746     __pyx_v_info->format = __pyx_t_5;
21747 
21748     /* "View.MemoryView":533
21749  *             info.suboffsets = NULL
21750  *
21751  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
21752  *             info.format = self.view.format
21753  *         else:
21754  */
21755     goto __pyx_L9;
21756   }
21757 
21758   /* "View.MemoryView":536
21759  *             info.format = self.view.format
21760  *         else:
21761  *             info.format = NULL             # <<<<<<<<<<<<<<
21762  *
21763  *         info.buf = self.view.buf
21764  */
21765   /*else*/ {
21766     __pyx_v_info->format = NULL;
21767   }
21768   __pyx_L9:;
21769 
21770   /* "View.MemoryView":538
21771  *             info.format = NULL
21772  *
21773  *         info.buf = self.view.buf             # <<<<<<<<<<<<<<
21774  *         info.ndim = self.view.ndim
21775  *         info.itemsize = self.view.itemsize
21776  */
21777   __pyx_t_6 = __pyx_v_self->view.buf;
21778   __pyx_v_info->buf = __pyx_t_6;
21779 
21780   /* "View.MemoryView":539
21781  *
21782  *         info.buf = self.view.buf
21783  *         info.ndim = self.view.ndim             # <<<<<<<<<<<<<<
21784  *         info.itemsize = self.view.itemsize
21785  *         info.len = self.view.len
21786  */
21787   __pyx_t_7 = __pyx_v_self->view.ndim;
21788   __pyx_v_info->ndim = __pyx_t_7;
21789 
21790   /* "View.MemoryView":540
21791  *         info.buf = self.view.buf
21792  *         info.ndim = self.view.ndim
21793  *         info.itemsize = self.view.itemsize             # <<<<<<<<<<<<<<
21794  *         info.len = self.view.len
21795  *         info.readonly = self.view.readonly
21796  */
21797   __pyx_t_8 = __pyx_v_self->view.itemsize;
21798   __pyx_v_info->itemsize = __pyx_t_8;
21799 
21800   /* "View.MemoryView":541
21801  *         info.ndim = self.view.ndim
21802  *         info.itemsize = self.view.itemsize
21803  *         info.len = self.view.len             # <<<<<<<<<<<<<<
21804  *         info.readonly = self.view.readonly
21805  *         info.obj = self
21806  */
21807   __pyx_t_8 = __pyx_v_self->view.len;
21808   __pyx_v_info->len = __pyx_t_8;
21809 
21810   /* "View.MemoryView":542
21811  *         info.itemsize = self.view.itemsize
21812  *         info.len = self.view.len
21813  *         info.readonly = self.view.readonly             # <<<<<<<<<<<<<<
21814  *         info.obj = self
21815  *
21816  */
21817   __pyx_t_1 = __pyx_v_self->view.readonly;
21818   __pyx_v_info->readonly = __pyx_t_1;
21819 
21820   /* "View.MemoryView":543
21821  *         info.len = self.view.len
21822  *         info.readonly = self.view.readonly
21823  *         info.obj = self             # <<<<<<<<<<<<<<
21824  *
21825  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
21826  */
21827   __Pyx_INCREF(((PyObject *)__pyx_v_self));
21828   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
21829   __Pyx_GOTREF(__pyx_v_info->obj);
21830   __Pyx_DECREF(__pyx_v_info->obj);
21831   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
21832 
21833   /* "View.MemoryView":514
21834  *
21835  *     @cname('getbuffer')
21836  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
21837  *         if flags & PyBUF_WRITABLE and self.view.readonly:
21838  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
21839  */
21840 
21841   /* function exit code */
21842   __pyx_r = 0;
21843   goto __pyx_L0;
21844   __pyx_L1_error:;
21845   __Pyx_XDECREF(__pyx_t_3);
21846   __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
21847   __pyx_r = -1;
21848   if (__pyx_v_info->obj != NULL) {
21849     __Pyx_GOTREF(__pyx_v_info->obj);
21850     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
21851   }
21852   goto __pyx_L2;
21853   __pyx_L0:;
21854   if (__pyx_v_info->obj == Py_None) {
21855     __Pyx_GOTREF(__pyx_v_info->obj);
21856     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
21857   }
21858   __pyx_L2:;
21859   __Pyx_RefNannyFinishContext();
21860   return __pyx_r;
21861 }
21862 
21863 /* "View.MemoryView":549
21864  *
21865  *     @property
21866  *     def T(self):             # <<<<<<<<<<<<<<
21867  *         cdef _memoryviewslice result = memoryview_copy(self)
21868  *         transpose_memslice(&result.from_slice)
21869  */
21870 
21871 /* Python wrapper */
21872 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
21873 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
21874   PyObject *__pyx_r = 0;
21875   __Pyx_RefNannyDeclarations
21876   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
21877   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
21878 
21879   /* function exit code */
21880   __Pyx_RefNannyFinishContext();
21881   return __pyx_r;
21882 }
21883 
21884 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
21885   struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
21886   PyObject *__pyx_r = NULL;
21887   __Pyx_RefNannyDeclarations
21888   PyObject *__pyx_t_1 = NULL;
21889   int __pyx_t_2;
21890   __Pyx_RefNannySetupContext("__get__", 0);
21891 
21892   /* "View.MemoryView":550
21893  *     @property
21894  *     def T(self):
21895  *         cdef _memoryviewslice result = memoryview_copy(self)             # <<<<<<<<<<<<<<
21896  *         transpose_memslice(&result.from_slice)
21897  *         return result
21898  */
21899   __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 550, __pyx_L1_error)
21900   __Pyx_GOTREF(__pyx_t_1);
21901   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(1, 550, __pyx_L1_error)
21902   __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
21903   __pyx_t_1 = 0;
21904 
21905   /* "View.MemoryView":551
21906  *     def T(self):
21907  *         cdef _memoryviewslice result = memoryview_copy(self)
21908  *         transpose_memslice(&result.from_slice)             # <<<<<<<<<<<<<<
21909  *         return result
21910  *
21911  */
21912   __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 551, __pyx_L1_error)
21913 
21914   /* "View.MemoryView":552
21915  *         cdef _memoryviewslice result = memoryview_copy(self)
21916  *         transpose_memslice(&result.from_slice)
21917  *         return result             # <<<<<<<<<<<<<<
21918  *
21919  *     @property
21920  */
21921   __Pyx_XDECREF(__pyx_r);
21922   __Pyx_INCREF(((PyObject *)__pyx_v_result));
21923   __pyx_r = ((PyObject *)__pyx_v_result);
21924   goto __pyx_L0;
21925 
21926   /* "View.MemoryView":549
21927  *
21928  *     @property
21929  *     def T(self):             # <<<<<<<<<<<<<<
21930  *         cdef _memoryviewslice result = memoryview_copy(self)
21931  *         transpose_memslice(&result.from_slice)
21932  */
21933 
21934   /* function exit code */
21935   __pyx_L1_error:;
21936   __Pyx_XDECREF(__pyx_t_1);
21937   __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
21938   __pyx_r = NULL;
21939   __pyx_L0:;
21940   __Pyx_XDECREF((PyObject *)__pyx_v_result);
21941   __Pyx_XGIVEREF(__pyx_r);
21942   __Pyx_RefNannyFinishContext();
21943   return __pyx_r;
21944 }
21945 
21946 /* "View.MemoryView":555
21947  *
21948  *     @property
21949  *     def base(self):             # <<<<<<<<<<<<<<
21950  *         return self.obj
21951  *
21952  */
21953 
21954 /* Python wrapper */
21955 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
21956 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
21957   PyObject *__pyx_r = 0;
21958   __Pyx_RefNannyDeclarations
21959   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
21960   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
21961 
21962   /* function exit code */
21963   __Pyx_RefNannyFinishContext();
21964   return __pyx_r;
21965 }
21966 
21967 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
21968   PyObject *__pyx_r = NULL;
21969   __Pyx_RefNannyDeclarations
21970   __Pyx_RefNannySetupContext("__get__", 0);
21971 
21972   /* "View.MemoryView":556
21973  *     @property
21974  *     def base(self):
21975  *         return self.obj             # <<<<<<<<<<<<<<
21976  *
21977  *     @property
21978  */
21979   __Pyx_XDECREF(__pyx_r);
21980   __Pyx_INCREF(__pyx_v_self->obj);
21981   __pyx_r = __pyx_v_self->obj;
21982   goto __pyx_L0;
21983 
21984   /* "View.MemoryView":555
21985  *
21986  *     @property
21987  *     def base(self):             # <<<<<<<<<<<<<<
21988  *         return self.obj
21989  *
21990  */
21991 
21992   /* function exit code */
21993   __pyx_L0:;
21994   __Pyx_XGIVEREF(__pyx_r);
21995   __Pyx_RefNannyFinishContext();
21996   return __pyx_r;
21997 }
21998 
21999 /* "View.MemoryView":559
22000  *
22001  *     @property
22002  *     def shape(self):             # <<<<<<<<<<<<<<
22003  *         return tuple([length for length in self.view.shape[:self.view.ndim]])
22004  *
22005  */
22006 
22007 /* Python wrapper */
22008 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
22009 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
22010   PyObject *__pyx_r = 0;
22011   __Pyx_RefNannyDeclarations
22012   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22013   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
22014 
22015   /* function exit code */
22016   __Pyx_RefNannyFinishContext();
22017   return __pyx_r;
22018 }
22019 
22020 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
22021   Py_ssize_t __pyx_v_length;
22022   PyObject *__pyx_r = NULL;
22023   __Pyx_RefNannyDeclarations
22024   PyObject *__pyx_t_1 = NULL;
22025   Py_ssize_t *__pyx_t_2;
22026   Py_ssize_t *__pyx_t_3;
22027   Py_ssize_t *__pyx_t_4;
22028   PyObject *__pyx_t_5 = NULL;
22029   __Pyx_RefNannySetupContext("__get__", 0);
22030 
22031   /* "View.MemoryView":560
22032  *     @property
22033  *     def shape(self):
22034  *         return tuple([length for length in self.view.shape[:self.view.ndim]])             # <<<<<<<<<<<<<<
22035  *
22036  *     @property
22037  */
22038   __Pyx_XDECREF(__pyx_r);
22039   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 560, __pyx_L1_error)
22040   __Pyx_GOTREF(__pyx_t_1);
22041   __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
22042   for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
22043     __pyx_t_2 = __pyx_t_4;
22044     __pyx_v_length = (__pyx_t_2[0]);
22045     __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 560, __pyx_L1_error)
22046     __Pyx_GOTREF(__pyx_t_5);
22047     if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 560, __pyx_L1_error)
22048     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
22049   }
22050   __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 560, __pyx_L1_error)
22051   __Pyx_GOTREF(__pyx_t_5);
22052   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22053   __pyx_r = __pyx_t_5;
22054   __pyx_t_5 = 0;
22055   goto __pyx_L0;
22056 
22057   /* "View.MemoryView":559
22058  *
22059  *     @property
22060  *     def shape(self):             # <<<<<<<<<<<<<<
22061  *         return tuple([length for length in self.view.shape[:self.view.ndim]])
22062  *
22063  */
22064 
22065   /* function exit code */
22066   __pyx_L1_error:;
22067   __Pyx_XDECREF(__pyx_t_1);
22068   __Pyx_XDECREF(__pyx_t_5);
22069   __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
22070   __pyx_r = NULL;
22071   __pyx_L0:;
22072   __Pyx_XGIVEREF(__pyx_r);
22073   __Pyx_RefNannyFinishContext();
22074   return __pyx_r;
22075 }
22076 
22077 /* "View.MemoryView":563
22078  *
22079  *     @property
22080  *     def strides(self):             # <<<<<<<<<<<<<<
22081  *         if self.view.strides == NULL:
22082  *
22083  */
22084 
22085 /* Python wrapper */
22086 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
22087 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
22088   PyObject *__pyx_r = 0;
22089   __Pyx_RefNannyDeclarations
22090   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22091   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
22092 
22093   /* function exit code */
22094   __Pyx_RefNannyFinishContext();
22095   return __pyx_r;
22096 }
22097 
22098 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
22099   Py_ssize_t __pyx_v_stride;
22100   PyObject *__pyx_r = NULL;
22101   __Pyx_RefNannyDeclarations
22102   int __pyx_t_1;
22103   PyObject *__pyx_t_2 = NULL;
22104   Py_ssize_t *__pyx_t_3;
22105   Py_ssize_t *__pyx_t_4;
22106   Py_ssize_t *__pyx_t_5;
22107   PyObject *__pyx_t_6 = NULL;
22108   __Pyx_RefNannySetupContext("__get__", 0);
22109 
22110   /* "View.MemoryView":564
22111  *     @property
22112  *     def strides(self):
22113  *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
22114  *
22115  *             raise ValueError("Buffer view does not expose strides")
22116  */
22117   __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
22118   if (unlikely(__pyx_t_1)) {
22119 
22120     /* "View.MemoryView":566
22121  *         if self.view.strides == NULL:
22122  *
22123  *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
22124  *
22125  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
22126  */
22127     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 566, __pyx_L1_error)
22128     __Pyx_GOTREF(__pyx_t_2);
22129     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
22130     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22131     __PYX_ERR(1, 566, __pyx_L1_error)
22132 
22133     /* "View.MemoryView":564
22134  *     @property
22135  *     def strides(self):
22136  *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
22137  *
22138  *             raise ValueError("Buffer view does not expose strides")
22139  */
22140   }
22141 
22142   /* "View.MemoryView":568
22143  *             raise ValueError("Buffer view does not expose strides")
22144  *
22145  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])             # <<<<<<<<<<<<<<
22146  *
22147  *     @property
22148  */
22149   __Pyx_XDECREF(__pyx_r);
22150   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 568, __pyx_L1_error)
22151   __Pyx_GOTREF(__pyx_t_2);
22152   __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
22153   for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
22154     __pyx_t_3 = __pyx_t_5;
22155     __pyx_v_stride = (__pyx_t_3[0]);
22156     __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 568, __pyx_L1_error)
22157     __Pyx_GOTREF(__pyx_t_6);
22158     if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 568, __pyx_L1_error)
22159     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22160   }
22161   __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 568, __pyx_L1_error)
22162   __Pyx_GOTREF(__pyx_t_6);
22163   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22164   __pyx_r = __pyx_t_6;
22165   __pyx_t_6 = 0;
22166   goto __pyx_L0;
22167 
22168   /* "View.MemoryView":563
22169  *
22170  *     @property
22171  *     def strides(self):             # <<<<<<<<<<<<<<
22172  *         if self.view.strides == NULL:
22173  *
22174  */
22175 
22176   /* function exit code */
22177   __pyx_L1_error:;
22178   __Pyx_XDECREF(__pyx_t_2);
22179   __Pyx_XDECREF(__pyx_t_6);
22180   __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
22181   __pyx_r = NULL;
22182   __pyx_L0:;
22183   __Pyx_XGIVEREF(__pyx_r);
22184   __Pyx_RefNannyFinishContext();
22185   return __pyx_r;
22186 }
22187 
22188 /* "View.MemoryView":571
22189  *
22190  *     @property
22191  *     def suboffsets(self):             # <<<<<<<<<<<<<<
22192  *         if self.view.suboffsets == NULL:
22193  *             return (-1,) * self.view.ndim
22194  */
22195 
22196 /* Python wrapper */
22197 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
22198 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
22199   PyObject *__pyx_r = 0;
22200   __Pyx_RefNannyDeclarations
22201   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22202   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
22203 
22204   /* function exit code */
22205   __Pyx_RefNannyFinishContext();
22206   return __pyx_r;
22207 }
22208 
22209 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
22210   Py_ssize_t __pyx_v_suboffset;
22211   PyObject *__pyx_r = NULL;
22212   __Pyx_RefNannyDeclarations
22213   int __pyx_t_1;
22214   PyObject *__pyx_t_2 = NULL;
22215   PyObject *__pyx_t_3 = NULL;
22216   Py_ssize_t *__pyx_t_4;
22217   Py_ssize_t *__pyx_t_5;
22218   Py_ssize_t *__pyx_t_6;
22219   __Pyx_RefNannySetupContext("__get__", 0);
22220 
22221   /* "View.MemoryView":572
22222  *     @property
22223  *     def suboffsets(self):
22224  *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
22225  *             return (-1,) * self.view.ndim
22226  *
22227  */
22228   __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
22229   if (__pyx_t_1) {
22230 
22231     /* "View.MemoryView":573
22232  *     def suboffsets(self):
22233  *         if self.view.suboffsets == NULL:
22234  *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
22235  *
22236  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
22237  */
22238     __Pyx_XDECREF(__pyx_r);
22239     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 573, __pyx_L1_error)
22240     __Pyx_GOTREF(__pyx_t_2);
22241     __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__25, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 573, __pyx_L1_error)
22242     __Pyx_GOTREF(__pyx_t_3);
22243     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22244     __pyx_r = __pyx_t_3;
22245     __pyx_t_3 = 0;
22246     goto __pyx_L0;
22247 
22248     /* "View.MemoryView":572
22249  *     @property
22250  *     def suboffsets(self):
22251  *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
22252  *             return (-1,) * self.view.ndim
22253  *
22254  */
22255   }
22256 
22257   /* "View.MemoryView":575
22258  *             return (-1,) * self.view.ndim
22259  *
22260  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])             # <<<<<<<<<<<<<<
22261  *
22262  *     @property
22263  */
22264   __Pyx_XDECREF(__pyx_r);
22265   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 575, __pyx_L1_error)
22266   __Pyx_GOTREF(__pyx_t_3);
22267   __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
22268   for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
22269     __pyx_t_4 = __pyx_t_6;
22270     __pyx_v_suboffset = (__pyx_t_4[0]);
22271     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 575, __pyx_L1_error)
22272     __Pyx_GOTREF(__pyx_t_2);
22273     if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(1, 575, __pyx_L1_error)
22274     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22275   }
22276   __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 575, __pyx_L1_error)
22277   __Pyx_GOTREF(__pyx_t_2);
22278   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22279   __pyx_r = __pyx_t_2;
22280   __pyx_t_2 = 0;
22281   goto __pyx_L0;
22282 
22283   /* "View.MemoryView":571
22284  *
22285  *     @property
22286  *     def suboffsets(self):             # <<<<<<<<<<<<<<
22287  *         if self.view.suboffsets == NULL:
22288  *             return (-1,) * self.view.ndim
22289  */
22290 
22291   /* function exit code */
22292   __pyx_L1_error:;
22293   __Pyx_XDECREF(__pyx_t_2);
22294   __Pyx_XDECREF(__pyx_t_3);
22295   __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
22296   __pyx_r = NULL;
22297   __pyx_L0:;
22298   __Pyx_XGIVEREF(__pyx_r);
22299   __Pyx_RefNannyFinishContext();
22300   return __pyx_r;
22301 }
22302 
22303 /* "View.MemoryView":578
22304  *
22305  *     @property
22306  *     def ndim(self):             # <<<<<<<<<<<<<<
22307  *         return self.view.ndim
22308  *
22309  */
22310 
22311 /* Python wrapper */
22312 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
22313 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
22314   PyObject *__pyx_r = 0;
22315   __Pyx_RefNannyDeclarations
22316   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22317   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
22318 
22319   /* function exit code */
22320   __Pyx_RefNannyFinishContext();
22321   return __pyx_r;
22322 }
22323 
22324 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
22325   PyObject *__pyx_r = NULL;
22326   __Pyx_RefNannyDeclarations
22327   PyObject *__pyx_t_1 = NULL;
22328   __Pyx_RefNannySetupContext("__get__", 0);
22329 
22330   /* "View.MemoryView":579
22331  *     @property
22332  *     def ndim(self):
22333  *         return self.view.ndim             # <<<<<<<<<<<<<<
22334  *
22335  *     @property
22336  */
22337   __Pyx_XDECREF(__pyx_r);
22338   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 579, __pyx_L1_error)
22339   __Pyx_GOTREF(__pyx_t_1);
22340   __pyx_r = __pyx_t_1;
22341   __pyx_t_1 = 0;
22342   goto __pyx_L0;
22343 
22344   /* "View.MemoryView":578
22345  *
22346  *     @property
22347  *     def ndim(self):             # <<<<<<<<<<<<<<
22348  *         return self.view.ndim
22349  *
22350  */
22351 
22352   /* function exit code */
22353   __pyx_L1_error:;
22354   __Pyx_XDECREF(__pyx_t_1);
22355   __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
22356   __pyx_r = NULL;
22357   __pyx_L0:;
22358   __Pyx_XGIVEREF(__pyx_r);
22359   __Pyx_RefNannyFinishContext();
22360   return __pyx_r;
22361 }
22362 
22363 /* "View.MemoryView":582
22364  *
22365  *     @property
22366  *     def itemsize(self):             # <<<<<<<<<<<<<<
22367  *         return self.view.itemsize
22368  *
22369  */
22370 
22371 /* Python wrapper */
22372 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
22373 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
22374   PyObject *__pyx_r = 0;
22375   __Pyx_RefNannyDeclarations
22376   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22377   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
22378 
22379   /* function exit code */
22380   __Pyx_RefNannyFinishContext();
22381   return __pyx_r;
22382 }
22383 
22384 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
22385   PyObject *__pyx_r = NULL;
22386   __Pyx_RefNannyDeclarations
22387   PyObject *__pyx_t_1 = NULL;
22388   __Pyx_RefNannySetupContext("__get__", 0);
22389 
22390   /* "View.MemoryView":583
22391  *     @property
22392  *     def itemsize(self):
22393  *         return self.view.itemsize             # <<<<<<<<<<<<<<
22394  *
22395  *     @property
22396  */
22397   __Pyx_XDECREF(__pyx_r);
22398   __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 583, __pyx_L1_error)
22399   __Pyx_GOTREF(__pyx_t_1);
22400   __pyx_r = __pyx_t_1;
22401   __pyx_t_1 = 0;
22402   goto __pyx_L0;
22403 
22404   /* "View.MemoryView":582
22405  *
22406  *     @property
22407  *     def itemsize(self):             # <<<<<<<<<<<<<<
22408  *         return self.view.itemsize
22409  *
22410  */
22411 
22412   /* function exit code */
22413   __pyx_L1_error:;
22414   __Pyx_XDECREF(__pyx_t_1);
22415   __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
22416   __pyx_r = NULL;
22417   __pyx_L0:;
22418   __Pyx_XGIVEREF(__pyx_r);
22419   __Pyx_RefNannyFinishContext();
22420   return __pyx_r;
22421 }
22422 
22423 /* "View.MemoryView":586
22424  *
22425  *     @property
22426  *     def nbytes(self):             # <<<<<<<<<<<<<<
22427  *         return self.size * self.view.itemsize
22428  *
22429  */
22430 
22431 /* Python wrapper */
22432 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
22433 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
22434   PyObject *__pyx_r = 0;
22435   __Pyx_RefNannyDeclarations
22436   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22437   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
22438 
22439   /* function exit code */
22440   __Pyx_RefNannyFinishContext();
22441   return __pyx_r;
22442 }
22443 
22444 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
22445   PyObject *__pyx_r = NULL;
22446   __Pyx_RefNannyDeclarations
22447   PyObject *__pyx_t_1 = NULL;
22448   PyObject *__pyx_t_2 = NULL;
22449   PyObject *__pyx_t_3 = NULL;
22450   __Pyx_RefNannySetupContext("__get__", 0);
22451 
22452   /* "View.MemoryView":587
22453  *     @property
22454  *     def nbytes(self):
22455  *         return self.size * self.view.itemsize             # <<<<<<<<<<<<<<
22456  *
22457  *     @property
22458  */
22459   __Pyx_XDECREF(__pyx_r);
22460   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 587, __pyx_L1_error)
22461   __Pyx_GOTREF(__pyx_t_1);
22462   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 587, __pyx_L1_error)
22463   __Pyx_GOTREF(__pyx_t_2);
22464   __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 587, __pyx_L1_error)
22465   __Pyx_GOTREF(__pyx_t_3);
22466   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22467   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22468   __pyx_r = __pyx_t_3;
22469   __pyx_t_3 = 0;
22470   goto __pyx_L0;
22471 
22472   /* "View.MemoryView":586
22473  *
22474  *     @property
22475  *     def nbytes(self):             # <<<<<<<<<<<<<<
22476  *         return self.size * self.view.itemsize
22477  *
22478  */
22479 
22480   /* function exit code */
22481   __pyx_L1_error:;
22482   __Pyx_XDECREF(__pyx_t_1);
22483   __Pyx_XDECREF(__pyx_t_2);
22484   __Pyx_XDECREF(__pyx_t_3);
22485   __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
22486   __pyx_r = NULL;
22487   __pyx_L0:;
22488   __Pyx_XGIVEREF(__pyx_r);
22489   __Pyx_RefNannyFinishContext();
22490   return __pyx_r;
22491 }
22492 
22493 /* "View.MemoryView":590
22494  *
22495  *     @property
22496  *     def size(self):             # <<<<<<<<<<<<<<
22497  *         if self._size is None:
22498  *             result = 1
22499  */
22500 
22501 /* Python wrapper */
22502 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
22503 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
22504   PyObject *__pyx_r = 0;
22505   __Pyx_RefNannyDeclarations
22506   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
22507   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
22508 
22509   /* function exit code */
22510   __Pyx_RefNannyFinishContext();
22511   return __pyx_r;
22512 }
22513 
22514 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
22515   PyObject *__pyx_v_result = NULL;
22516   PyObject *__pyx_v_length = NULL;
22517   PyObject *__pyx_r = NULL;
22518   __Pyx_RefNannyDeclarations
22519   int __pyx_t_1;
22520   int __pyx_t_2;
22521   Py_ssize_t *__pyx_t_3;
22522   Py_ssize_t *__pyx_t_4;
22523   Py_ssize_t *__pyx_t_5;
22524   PyObject *__pyx_t_6 = NULL;
22525   __Pyx_RefNannySetupContext("__get__", 0);
22526 
22527   /* "View.MemoryView":591
22528  *     @property
22529  *     def size(self):
22530  *         if self._size is None:             # <<<<<<<<<<<<<<
22531  *             result = 1
22532  *
22533  */
22534   __pyx_t_1 = (__pyx_v_self->_size == Py_None);
22535   __pyx_t_2 = (__pyx_t_1 != 0);
22536   if (__pyx_t_2) {
22537 
22538     /* "View.MemoryView":592
22539  *     def size(self):
22540  *         if self._size is None:
22541  *             result = 1             # <<<<<<<<<<<<<<
22542  *
22543  *             for length in self.view.shape[:self.view.ndim]:
22544  */
22545     __Pyx_INCREF(__pyx_int_1);
22546     __pyx_v_result = __pyx_int_1;
22547 
22548     /* "View.MemoryView":594
22549  *             result = 1
22550  *
22551  *             for length in self.view.shape[:self.view.ndim]:             # <<<<<<<<<<<<<<
22552  *                 result *= length
22553  *
22554  */
22555     __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
22556     for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
22557       __pyx_t_3 = __pyx_t_5;
22558       __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 594, __pyx_L1_error)
22559       __Pyx_GOTREF(__pyx_t_6);
22560       __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
22561       __pyx_t_6 = 0;
22562 
22563       /* "View.MemoryView":595
22564  *
22565  *             for length in self.view.shape[:self.view.ndim]:
22566  *                 result *= length             # <<<<<<<<<<<<<<
22567  *
22568  *             self._size = result
22569  */
22570       __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 595, __pyx_L1_error)
22571       __Pyx_GOTREF(__pyx_t_6);
22572       __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
22573       __pyx_t_6 = 0;
22574     }
22575 
22576     /* "View.MemoryView":597
22577  *                 result *= length
22578  *
22579  *             self._size = result             # <<<<<<<<<<<<<<
22580  *
22581  *         return self._size
22582  */
22583     __Pyx_INCREF(__pyx_v_result);
22584     __Pyx_GIVEREF(__pyx_v_result);
22585     __Pyx_GOTREF(__pyx_v_self->_size);
22586     __Pyx_DECREF(__pyx_v_self->_size);
22587     __pyx_v_self->_size = __pyx_v_result;
22588 
22589     /* "View.MemoryView":591
22590  *     @property
22591  *     def size(self):
22592  *         if self._size is None:             # <<<<<<<<<<<<<<
22593  *             result = 1
22594  *
22595  */
22596   }
22597 
22598   /* "View.MemoryView":599
22599  *             self._size = result
22600  *
22601  *         return self._size             # <<<<<<<<<<<<<<
22602  *
22603  *     def __len__(self):
22604  */
22605   __Pyx_XDECREF(__pyx_r);
22606   __Pyx_INCREF(__pyx_v_self->_size);
22607   __pyx_r = __pyx_v_self->_size;
22608   goto __pyx_L0;
22609 
22610   /* "View.MemoryView":590
22611  *
22612  *     @property
22613  *     def size(self):             # <<<<<<<<<<<<<<
22614  *         if self._size is None:
22615  *             result = 1
22616  */
22617 
22618   /* function exit code */
22619   __pyx_L1_error:;
22620   __Pyx_XDECREF(__pyx_t_6);
22621   __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
22622   __pyx_r = NULL;
22623   __pyx_L0:;
22624   __Pyx_XDECREF(__pyx_v_result);
22625   __Pyx_XDECREF(__pyx_v_length);
22626   __Pyx_XGIVEREF(__pyx_r);
22627   __Pyx_RefNannyFinishContext();
22628   return __pyx_r;
22629 }
22630 
22631 /* "View.MemoryView":601
22632  *         return self._size
22633  *
22634  *     def __len__(self):             # <<<<<<<<<<<<<<
22635  *         if self.view.ndim >= 1:
22636  *             return self.view.shape[0]
22637  */
22638 
22639 /* Python wrapper */
22640 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
22641 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
22642   Py_ssize_t __pyx_r;
22643   __Pyx_RefNannyDeclarations
22644   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
22645   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));
22646 
22647   /* function exit code */
22648   __Pyx_RefNannyFinishContext();
22649   return __pyx_r;
22650 }
22651 
22652 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
22653   Py_ssize_t __pyx_r;
22654   __Pyx_RefNannyDeclarations
22655   int __pyx_t_1;
22656   __Pyx_RefNannySetupContext("__len__", 0);
22657 
22658   /* "View.MemoryView":602
22659  *
22660  *     def __len__(self):
22661  *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
22662  *             return self.view.shape[0]
22663  *
22664  */
22665   __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
22666   if (__pyx_t_1) {
22667 
22668     /* "View.MemoryView":603
22669  *     def __len__(self):
22670  *         if self.view.ndim >= 1:
22671  *             return self.view.shape[0]             # <<<<<<<<<<<<<<
22672  *
22673  *         return 0
22674  */
22675     __pyx_r = (__pyx_v_self->view.shape[0]);
22676     goto __pyx_L0;
22677 
22678     /* "View.MemoryView":602
22679  *
22680  *     def __len__(self):
22681  *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
22682  *             return self.view.shape[0]
22683  *
22684  */
22685   }
22686 
22687   /* "View.MemoryView":605
22688  *             return self.view.shape[0]
22689  *
22690  *         return 0             # <<<<<<<<<<<<<<
22691  *
22692  *     def __repr__(self):
22693  */
22694   __pyx_r = 0;
22695   goto __pyx_L0;
22696 
22697   /* "View.MemoryView":601
22698  *         return self._size
22699  *
22700  *     def __len__(self):             # <<<<<<<<<<<<<<
22701  *         if self.view.ndim >= 1:
22702  *             return self.view.shape[0]
22703  */
22704 
22705   /* function exit code */
22706   __pyx_L0:;
22707   __Pyx_RefNannyFinishContext();
22708   return __pyx_r;
22709 }
22710 
22711 /* "View.MemoryView":607
22712  *         return 0
22713  *
22714  *     def __repr__(self):             # <<<<<<<<<<<<<<
22715  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
22716  *                                                id(self))
22717  */
22718 
22719 /* Python wrapper */
22720 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
22721 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
22722   PyObject *__pyx_r = 0;
22723   __Pyx_RefNannyDeclarations
22724   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
22725   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));
22726 
22727   /* function exit code */
22728   __Pyx_RefNannyFinishContext();
22729   return __pyx_r;
22730 }
22731 
22732 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
22733   PyObject *__pyx_r = NULL;
22734   __Pyx_RefNannyDeclarations
22735   PyObject *__pyx_t_1 = NULL;
22736   PyObject *__pyx_t_2 = NULL;
22737   PyObject *__pyx_t_3 = NULL;
22738   __Pyx_RefNannySetupContext("__repr__", 0);
22739 
22740   /* "View.MemoryView":608
22741  *
22742  *     def __repr__(self):
22743  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
22744  *                                                id(self))
22745  *
22746  */
22747   __Pyx_XDECREF(__pyx_r);
22748   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 608, __pyx_L1_error)
22749   __Pyx_GOTREF(__pyx_t_1);
22750   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 608, __pyx_L1_error)
22751   __Pyx_GOTREF(__pyx_t_2);
22752   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22753   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 608, __pyx_L1_error)
22754   __Pyx_GOTREF(__pyx_t_1);
22755   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22756 
22757   /* "View.MemoryView":609
22758  *     def __repr__(self):
22759  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
22760  *                                                id(self))             # <<<<<<<<<<<<<<
22761  *
22762  *     def __str__(self):
22763  */
22764   __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 609, __pyx_L1_error)
22765   __Pyx_GOTREF(__pyx_t_2);
22766 
22767   /* "View.MemoryView":608
22768  *
22769  *     def __repr__(self):
22770  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
22771  *                                                id(self))
22772  *
22773  */
22774   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 608, __pyx_L1_error)
22775   __Pyx_GOTREF(__pyx_t_3);
22776   __Pyx_GIVEREF(__pyx_t_1);
22777   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
22778   __Pyx_GIVEREF(__pyx_t_2);
22779   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
22780   __pyx_t_1 = 0;
22781   __pyx_t_2 = 0;
22782   __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 608, __pyx_L1_error)
22783   __Pyx_GOTREF(__pyx_t_2);
22784   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22785   __pyx_r = __pyx_t_2;
22786   __pyx_t_2 = 0;
22787   goto __pyx_L0;
22788 
22789   /* "View.MemoryView":607
22790  *         return 0
22791  *
22792  *     def __repr__(self):             # <<<<<<<<<<<<<<
22793  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
22794  *                                                id(self))
22795  */
22796 
22797   /* function exit code */
22798   __pyx_L1_error:;
22799   __Pyx_XDECREF(__pyx_t_1);
22800   __Pyx_XDECREF(__pyx_t_2);
22801   __Pyx_XDECREF(__pyx_t_3);
22802   __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
22803   __pyx_r = NULL;
22804   __pyx_L0:;
22805   __Pyx_XGIVEREF(__pyx_r);
22806   __Pyx_RefNannyFinishContext();
22807   return __pyx_r;
22808 }
22809 
22810 /* "View.MemoryView":611
22811  *                                                id(self))
22812  *
22813  *     def __str__(self):             # <<<<<<<<<<<<<<
22814  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
22815  *
22816  */
22817 
22818 /* Python wrapper */
22819 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
22820 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
22821   PyObject *__pyx_r = 0;
22822   __Pyx_RefNannyDeclarations
22823   __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
22824   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));
22825 
22826   /* function exit code */
22827   __Pyx_RefNannyFinishContext();
22828   return __pyx_r;
22829 }
22830 
22831 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
22832   PyObject *__pyx_r = NULL;
22833   __Pyx_RefNannyDeclarations
22834   PyObject *__pyx_t_1 = NULL;
22835   PyObject *__pyx_t_2 = NULL;
22836   __Pyx_RefNannySetupContext("__str__", 0);
22837 
22838   /* "View.MemoryView":612
22839  *
22840  *     def __str__(self):
22841  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)             # <<<<<<<<<<<<<<
22842  *
22843  *
22844  */
22845   __Pyx_XDECREF(__pyx_r);
22846   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
22847   __Pyx_GOTREF(__pyx_t_1);
22848   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
22849   __Pyx_GOTREF(__pyx_t_2);
22850   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22851   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
22852   __Pyx_GOTREF(__pyx_t_1);
22853   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22854   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
22855   __Pyx_GOTREF(__pyx_t_2);
22856   __Pyx_GIVEREF(__pyx_t_1);
22857   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
22858   __pyx_t_1 = 0;
22859   __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
22860   __Pyx_GOTREF(__pyx_t_1);
22861   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22862   __pyx_r = __pyx_t_1;
22863   __pyx_t_1 = 0;
22864   goto __pyx_L0;
22865 
22866   /* "View.MemoryView":611
22867  *                                                id(self))
22868  *
22869  *     def __str__(self):             # <<<<<<<<<<<<<<
22870  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
22871  *
22872  */
22873 
22874   /* function exit code */
22875   __pyx_L1_error:;
22876   __Pyx_XDECREF(__pyx_t_1);
22877   __Pyx_XDECREF(__pyx_t_2);
22878   __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
22879   __pyx_r = NULL;
22880   __pyx_L0:;
22881   __Pyx_XGIVEREF(__pyx_r);
22882   __Pyx_RefNannyFinishContext();
22883   return __pyx_r;
22884 }
22885 
22886 /* "View.MemoryView":615
22887  *
22888  *
22889  *     def is_c_contig(self):             # <<<<<<<<<<<<<<
22890  *         cdef __Pyx_memviewslice *mslice
22891  *         cdef __Pyx_memviewslice tmp
22892  */
22893 
22894 /* Python wrapper */
22895 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
22896 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
22897   PyObject *__pyx_r = 0;
22898   __Pyx_RefNannyDeclarations
22899   __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
22900   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
22901 
22902   /* function exit code */
22903   __Pyx_RefNannyFinishContext();
22904   return __pyx_r;
22905 }
22906 
22907 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
22908   __Pyx_memviewslice *__pyx_v_mslice;
22909   __Pyx_memviewslice __pyx_v_tmp;
22910   PyObject *__pyx_r = NULL;
22911   __Pyx_RefNannyDeclarations
22912   PyObject *__pyx_t_1 = NULL;
22913   __Pyx_RefNannySetupContext("is_c_contig", 0);
22914 
22915   /* "View.MemoryView":618
22916  *         cdef __Pyx_memviewslice *mslice
22917  *         cdef __Pyx_memviewslice tmp
22918  *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
22919  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
22920  *
22921  */
22922   __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
22923 
22924   /* "View.MemoryView":619
22925  *         cdef __Pyx_memviewslice tmp
22926  *         mslice = get_slice_from_memview(self, &tmp)
22927  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)             # <<<<<<<<<<<<<<
22928  *
22929  *     def is_f_contig(self):
22930  */
22931   __Pyx_XDECREF(__pyx_r);
22932   __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 619, __pyx_L1_error)
22933   __Pyx_GOTREF(__pyx_t_1);
22934   __pyx_r = __pyx_t_1;
22935   __pyx_t_1 = 0;
22936   goto __pyx_L0;
22937 
22938   /* "View.MemoryView":615
22939  *
22940  *
22941  *     def is_c_contig(self):             # <<<<<<<<<<<<<<
22942  *         cdef __Pyx_memviewslice *mslice
22943  *         cdef __Pyx_memviewslice tmp
22944  */
22945 
22946   /* function exit code */
22947   __pyx_L1_error:;
22948   __Pyx_XDECREF(__pyx_t_1);
22949   __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
22950   __pyx_r = NULL;
22951   __pyx_L0:;
22952   __Pyx_XGIVEREF(__pyx_r);
22953   __Pyx_RefNannyFinishContext();
22954   return __pyx_r;
22955 }
22956 
22957 /* "View.MemoryView":621
22958  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
22959  *
22960  *     def is_f_contig(self):             # <<<<<<<<<<<<<<
22961  *         cdef __Pyx_memviewslice *mslice
22962  *         cdef __Pyx_memviewslice tmp
22963  */
22964 
22965 /* Python wrapper */
22966 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
22967 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
22968   PyObject *__pyx_r = 0;
22969   __Pyx_RefNannyDeclarations
22970   __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
22971   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
22972 
22973   /* function exit code */
22974   __Pyx_RefNannyFinishContext();
22975   return __pyx_r;
22976 }
22977 
22978 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
22979   __Pyx_memviewslice *__pyx_v_mslice;
22980   __Pyx_memviewslice __pyx_v_tmp;
22981   PyObject *__pyx_r = NULL;
22982   __Pyx_RefNannyDeclarations
22983   PyObject *__pyx_t_1 = NULL;
22984   __Pyx_RefNannySetupContext("is_f_contig", 0);
22985 
22986   /* "View.MemoryView":624
22987  *         cdef __Pyx_memviewslice *mslice
22988  *         cdef __Pyx_memviewslice tmp
22989  *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
22990  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
22991  *
22992  */
22993   __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
22994 
22995   /* "View.MemoryView":625
22996  *         cdef __Pyx_memviewslice tmp
22997  *         mslice = get_slice_from_memview(self, &tmp)
22998  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)             # <<<<<<<<<<<<<<
22999  *
23000  *     def copy(self):
23001  */
23002   __Pyx_XDECREF(__pyx_r);
23003   __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 625, __pyx_L1_error)
23004   __Pyx_GOTREF(__pyx_t_1);
23005   __pyx_r = __pyx_t_1;
23006   __pyx_t_1 = 0;
23007   goto __pyx_L0;
23008 
23009   /* "View.MemoryView":621
23010  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
23011  *
23012  *     def is_f_contig(self):             # <<<<<<<<<<<<<<
23013  *         cdef __Pyx_memviewslice *mslice
23014  *         cdef __Pyx_memviewslice tmp
23015  */
23016 
23017   /* function exit code */
23018   __pyx_L1_error:;
23019   __Pyx_XDECREF(__pyx_t_1);
23020   __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
23021   __pyx_r = NULL;
23022   __pyx_L0:;
23023   __Pyx_XGIVEREF(__pyx_r);
23024   __Pyx_RefNannyFinishContext();
23025   return __pyx_r;
23026 }
23027 
23028 /* "View.MemoryView":627
23029  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
23030  *
23031  *     def copy(self):             # <<<<<<<<<<<<<<
23032  *         cdef __Pyx_memviewslice mslice
23033  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
23034  */
23035 
23036 /* Python wrapper */
23037 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
23038 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
23039   PyObject *__pyx_r = 0;
23040   __Pyx_RefNannyDeclarations
23041   __Pyx_RefNannySetupContext("copy (wrapper)", 0);
23042   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));
23043 
23044   /* function exit code */
23045   __Pyx_RefNannyFinishContext();
23046   return __pyx_r;
23047 }
23048 
23049 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
23050   __Pyx_memviewslice __pyx_v_mslice;
23051   int __pyx_v_flags;
23052   PyObject *__pyx_r = NULL;
23053   __Pyx_RefNannyDeclarations
23054   __Pyx_memviewslice __pyx_t_1;
23055   PyObject *__pyx_t_2 = NULL;
23056   __Pyx_RefNannySetupContext("copy", 0);
23057 
23058   /* "View.MemoryView":629
23059  *     def copy(self):
23060  *         cdef __Pyx_memviewslice mslice
23061  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS             # <<<<<<<<<<<<<<
23062  *
23063  *         slice_copy(self, &mslice)
23064  */
23065   __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
23066 
23067   /* "View.MemoryView":631
23068  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
23069  *
23070  *         slice_copy(self, &mslice)             # <<<<<<<<<<<<<<
23071  *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
23072  *                                    self.view.itemsize,
23073  */
23074   __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
23075 
23076   /* "View.MemoryView":632
23077  *
23078  *         slice_copy(self, &mslice)
23079  *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,             # <<<<<<<<<<<<<<
23080  *                                    self.view.itemsize,
23081  *                                    flags|PyBUF_C_CONTIGUOUS,
23082  */
23083   __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 632, __pyx_L1_error)
23084   __pyx_v_mslice = __pyx_t_1;
23085 
23086   /* "View.MemoryView":637
23087  *                                    self.dtype_is_object)
23088  *
23089  *         return memoryview_copy_from_slice(self, &mslice)             # <<<<<<<<<<<<<<
23090  *
23091  *     def copy_fortran(self):
23092  */
23093   __Pyx_XDECREF(__pyx_r);
23094   __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 637, __pyx_L1_error)
23095   __Pyx_GOTREF(__pyx_t_2);
23096   __pyx_r = __pyx_t_2;
23097   __pyx_t_2 = 0;
23098   goto __pyx_L0;
23099 
23100   /* "View.MemoryView":627
23101  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
23102  *
23103  *     def copy(self):             # <<<<<<<<<<<<<<
23104  *         cdef __Pyx_memviewslice mslice
23105  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
23106  */
23107 
23108   /* function exit code */
23109   __pyx_L1_error:;
23110   __Pyx_XDECREF(__pyx_t_2);
23111   __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
23112   __pyx_r = NULL;
23113   __pyx_L0:;
23114   __Pyx_XGIVEREF(__pyx_r);
23115   __Pyx_RefNannyFinishContext();
23116   return __pyx_r;
23117 }
23118 
23119 /* "View.MemoryView":639
23120  *         return memoryview_copy_from_slice(self, &mslice)
23121  *
23122  *     def copy_fortran(self):             # <<<<<<<<<<<<<<
23123  *         cdef __Pyx_memviewslice src, dst
23124  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
23125  */
23126 
23127 /* Python wrapper */
23128 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
23129 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
23130   PyObject *__pyx_r = 0;
23131   __Pyx_RefNannyDeclarations
23132   __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
23133   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));
23134 
23135   /* function exit code */
23136   __Pyx_RefNannyFinishContext();
23137   return __pyx_r;
23138 }
23139 
23140 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
23141   __Pyx_memviewslice __pyx_v_src;
23142   __Pyx_memviewslice __pyx_v_dst;
23143   int __pyx_v_flags;
23144   PyObject *__pyx_r = NULL;
23145   __Pyx_RefNannyDeclarations
23146   __Pyx_memviewslice __pyx_t_1;
23147   PyObject *__pyx_t_2 = NULL;
23148   __Pyx_RefNannySetupContext("copy_fortran", 0);
23149 
23150   /* "View.MemoryView":641
23151  *     def copy_fortran(self):
23152  *         cdef __Pyx_memviewslice src, dst
23153  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS             # <<<<<<<<<<<<<<
23154  *
23155  *         slice_copy(self, &src)
23156  */
23157   __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
23158 
23159   /* "View.MemoryView":643
23160  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
23161  *
23162  *         slice_copy(self, &src)             # <<<<<<<<<<<<<<
23163  *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,
23164  *                                 self.view.itemsize,
23165  */
23166   __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
23167 
23168   /* "View.MemoryView":644
23169  *
23170  *         slice_copy(self, &src)
23171  *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,             # <<<<<<<<<<<<<<
23172  *                                 self.view.itemsize,
23173  *                                 flags|PyBUF_F_CONTIGUOUS,
23174  */
23175   __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 644, __pyx_L1_error)
23176   __pyx_v_dst = __pyx_t_1;
23177 
23178   /* "View.MemoryView":649
23179  *                                 self.dtype_is_object)
23180  *
23181  *         return memoryview_copy_from_slice(self, &dst)             # <<<<<<<<<<<<<<
23182  *
23183  *
23184  */
23185   __Pyx_XDECREF(__pyx_r);
23186   __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 649, __pyx_L1_error)
23187   __Pyx_GOTREF(__pyx_t_2);
23188   __pyx_r = __pyx_t_2;
23189   __pyx_t_2 = 0;
23190   goto __pyx_L0;
23191 
23192   /* "View.MemoryView":639
23193  *         return memoryview_copy_from_slice(self, &mslice)
23194  *
23195  *     def copy_fortran(self):             # <<<<<<<<<<<<<<
23196  *         cdef __Pyx_memviewslice src, dst
23197  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
23198  */
23199 
23200   /* function exit code */
23201   __pyx_L1_error:;
23202   __Pyx_XDECREF(__pyx_t_2);
23203   __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
23204   __pyx_r = NULL;
23205   __pyx_L0:;
23206   __Pyx_XGIVEREF(__pyx_r);
23207   __Pyx_RefNannyFinishContext();
23208   return __pyx_r;
23209 }
23210 
23211 /* "(tree fragment)":1
23212  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
23213  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
23214  * def __setstate_cython__(self, __pyx_state):
23215  */
23216 
23217 /* Python wrapper */
23218 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
23219 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
23220   PyObject *__pyx_r = 0;
23221   __Pyx_RefNannyDeclarations
23222   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
23223   __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));
23224 
23225   /* function exit code */
23226   __Pyx_RefNannyFinishContext();
23227   return __pyx_r;
23228 }
23229 
23230 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
23231   PyObject *__pyx_r = NULL;
23232   __Pyx_RefNannyDeclarations
23233   PyObject *__pyx_t_1 = NULL;
23234   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
23235 
23236   /* "(tree fragment)":2
23237  * def __reduce_cython__(self):
23238  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
23239  * def __setstate_cython__(self, __pyx_state):
23240  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
23241  */
23242   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
23243   __Pyx_GOTREF(__pyx_t_1);
23244   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
23245   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23246   __PYX_ERR(1, 2, __pyx_L1_error)
23247 
23248   /* "(tree fragment)":1
23249  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
23250  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
23251  * def __setstate_cython__(self, __pyx_state):
23252  */
23253 
23254   /* function exit code */
23255   __pyx_L1_error:;
23256   __Pyx_XDECREF(__pyx_t_1);
23257   __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
23258   __pyx_r = NULL;
23259   __Pyx_XGIVEREF(__pyx_r);
23260   __Pyx_RefNannyFinishContext();
23261   return __pyx_r;
23262 }
23263 
23264 /* "(tree fragment)":3
23265  * def __reduce_cython__(self):
23266  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
23267  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
23268  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
23269  */
23270 
23271 /* Python wrapper */
23272 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
23273 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
23274   PyObject *__pyx_r = 0;
23275   __Pyx_RefNannyDeclarations
23276   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
23277   __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
23278 
23279   /* function exit code */
23280   __Pyx_RefNannyFinishContext();
23281   return __pyx_r;
23282 }
23283 
23284 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) {
23285   PyObject *__pyx_r = NULL;
23286   __Pyx_RefNannyDeclarations
23287   PyObject *__pyx_t_1 = NULL;
23288   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
23289 
23290   /* "(tree fragment)":4
23291  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
23292  * def __setstate_cython__(self, __pyx_state):
23293  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
23294  */
23295   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
23296   __Pyx_GOTREF(__pyx_t_1);
23297   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
23298   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23299   __PYX_ERR(1, 4, __pyx_L1_error)
23300 
23301   /* "(tree fragment)":3
23302  * def __reduce_cython__(self):
23303  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
23304  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
23305  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
23306  */
23307 
23308   /* function exit code */
23309   __pyx_L1_error:;
23310   __Pyx_XDECREF(__pyx_t_1);
23311   __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
23312   __pyx_r = NULL;
23313   __Pyx_XGIVEREF(__pyx_r);
23314   __Pyx_RefNannyFinishContext();
23315   return __pyx_r;
23316 }
23317 
23318 /* "View.MemoryView":653
23319  *
23320  * @cname('__pyx_memoryview_new')
23321  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
23322  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
23323  *     result.typeinfo = typeinfo
23324  */
23325 
23326 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
23327   struct __pyx_memoryview_obj *__pyx_v_result = 0;
23328   PyObject *__pyx_r = NULL;
23329   __Pyx_RefNannyDeclarations
23330   PyObject *__pyx_t_1 = NULL;
23331   PyObject *__pyx_t_2 = NULL;
23332   PyObject *__pyx_t_3 = NULL;
23333   __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);
23334 
23335   /* "View.MemoryView":654
23336  * @cname('__pyx_memoryview_new')
23337  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
23338  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)             # <<<<<<<<<<<<<<
23339  *     result.typeinfo = typeinfo
23340  *     return result
23341  */
23342   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 654, __pyx_L1_error)
23343   __Pyx_GOTREF(__pyx_t_1);
23344   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 654, __pyx_L1_error)
23345   __Pyx_GOTREF(__pyx_t_2);
23346   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 654, __pyx_L1_error)
23347   __Pyx_GOTREF(__pyx_t_3);
23348   __Pyx_INCREF(__pyx_v_o);
23349   __Pyx_GIVEREF(__pyx_v_o);
23350   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
23351   __Pyx_GIVEREF(__pyx_t_1);
23352   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
23353   __Pyx_GIVEREF(__pyx_t_2);
23354   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
23355   __pyx_t_1 = 0;
23356   __pyx_t_2 = 0;
23357   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 654, __pyx_L1_error)
23358   __Pyx_GOTREF(__pyx_t_2);
23359   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23360   __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
23361   __pyx_t_2 = 0;
23362 
23363   /* "View.MemoryView":655
23364  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
23365  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
23366  *     result.typeinfo = typeinfo             # <<<<<<<<<<<<<<
23367  *     return result
23368  *
23369  */
23370   __pyx_v_result->typeinfo = __pyx_v_typeinfo;
23371 
23372   /* "View.MemoryView":656
23373  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
23374  *     result.typeinfo = typeinfo
23375  *     return result             # <<<<<<<<<<<<<<
23376  *
23377  * @cname('__pyx_memoryview_check')
23378  */
23379   __Pyx_XDECREF(__pyx_r);
23380   __Pyx_INCREF(((PyObject *)__pyx_v_result));
23381   __pyx_r = ((PyObject *)__pyx_v_result);
23382   goto __pyx_L0;
23383 
23384   /* "View.MemoryView":653
23385  *
23386  * @cname('__pyx_memoryview_new')
23387  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
23388  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
23389  *     result.typeinfo = typeinfo
23390  */
23391 
23392   /* function exit code */
23393   __pyx_L1_error:;
23394   __Pyx_XDECREF(__pyx_t_1);
23395   __Pyx_XDECREF(__pyx_t_2);
23396   __Pyx_XDECREF(__pyx_t_3);
23397   __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
23398   __pyx_r = 0;
23399   __pyx_L0:;
23400   __Pyx_XDECREF((PyObject *)__pyx_v_result);
23401   __Pyx_XGIVEREF(__pyx_r);
23402   __Pyx_RefNannyFinishContext();
23403   return __pyx_r;
23404 }
23405 
23406 /* "View.MemoryView":659
23407  *
23408  * @cname('__pyx_memoryview_check')
23409  * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
23410  *     return isinstance(o, memoryview)
23411  *
23412  */
23413 
23414 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
23415   int __pyx_r;
23416   __Pyx_RefNannyDeclarations
23417   int __pyx_t_1;
23418   __Pyx_RefNannySetupContext("memoryview_check", 0);
23419 
23420   /* "View.MemoryView":660
23421  * @cname('__pyx_memoryview_check')
23422  * cdef inline bint memoryview_check(object o):
23423  *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
23424  *
23425  * cdef tuple _unellipsify(object index, int ndim):
23426  */
23427   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
23428   __pyx_r = __pyx_t_1;
23429   goto __pyx_L0;
23430 
23431   /* "View.MemoryView":659
23432  *
23433  * @cname('__pyx_memoryview_check')
23434  * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
23435  *     return isinstance(o, memoryview)
23436  *
23437  */
23438 
23439   /* function exit code */
23440   __pyx_L0:;
23441   __Pyx_RefNannyFinishContext();
23442   return __pyx_r;
23443 }
23444 
23445 /* "View.MemoryView":662
23446  *     return isinstance(o, memoryview)
23447  *
23448  * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
23449  *     """
23450  *     Replace all ellipses with full slices and fill incomplete indices with
23451  */
23452 
23453 static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
23454   PyObject *__pyx_v_tup = NULL;
23455   PyObject *__pyx_v_result = NULL;
23456   int __pyx_v_have_slices;
23457   int __pyx_v_seen_ellipsis;
23458   CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
23459   PyObject *__pyx_v_item = NULL;
23460   Py_ssize_t __pyx_v_nslices;
23461   PyObject *__pyx_r = NULL;
23462   __Pyx_RefNannyDeclarations
23463   int __pyx_t_1;
23464   int __pyx_t_2;
23465   PyObject *__pyx_t_3 = NULL;
23466   PyObject *__pyx_t_4 = NULL;
23467   Py_ssize_t __pyx_t_5;
23468   PyObject *(*__pyx_t_6)(PyObject *);
23469   PyObject *__pyx_t_7 = NULL;
23470   Py_ssize_t __pyx_t_8;
23471   int __pyx_t_9;
23472   int __pyx_t_10;
23473   PyObject *__pyx_t_11 = NULL;
23474   __Pyx_RefNannySetupContext("_unellipsify", 0);
23475 
23476   /* "View.MemoryView":667
23477  *     full slices.
23478  *     """
23479  *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
23480  *         tup = (index,)
23481  *     else:
23482  */
23483   __pyx_t_1 = PyTuple_Check(__pyx_v_index);
23484   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
23485   if (__pyx_t_2) {
23486 
23487     /* "View.MemoryView":668
23488  *     """
23489  *     if not isinstance(index, tuple):
23490  *         tup = (index,)             # <<<<<<<<<<<<<<
23491  *     else:
23492  *         tup = index
23493  */
23494     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 668, __pyx_L1_error)
23495     __Pyx_GOTREF(__pyx_t_3);
23496     __Pyx_INCREF(__pyx_v_index);
23497     __Pyx_GIVEREF(__pyx_v_index);
23498     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
23499     __pyx_v_tup = __pyx_t_3;
23500     __pyx_t_3 = 0;
23501 
23502     /* "View.MemoryView":667
23503  *     full slices.
23504  *     """
23505  *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
23506  *         tup = (index,)
23507  *     else:
23508  */
23509     goto __pyx_L3;
23510   }
23511 
23512   /* "View.MemoryView":670
23513  *         tup = (index,)
23514  *     else:
23515  *         tup = index             # <<<<<<<<<<<<<<
23516  *
23517  *     result = []
23518  */
23519   /*else*/ {
23520     __Pyx_INCREF(__pyx_v_index);
23521     __pyx_v_tup = __pyx_v_index;
23522   }
23523   __pyx_L3:;
23524 
23525   /* "View.MemoryView":672
23526  *         tup = index
23527  *
23528  *     result = []             # <<<<<<<<<<<<<<
23529  *     have_slices = False
23530  *     seen_ellipsis = False
23531  */
23532   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 672, __pyx_L1_error)
23533   __Pyx_GOTREF(__pyx_t_3);
23534   __pyx_v_result = ((PyObject*)__pyx_t_3);
23535   __pyx_t_3 = 0;
23536 
23537   /* "View.MemoryView":673
23538  *
23539  *     result = []
23540  *     have_slices = False             # <<<<<<<<<<<<<<
23541  *     seen_ellipsis = False
23542  *     for idx, item in enumerate(tup):
23543  */
23544   __pyx_v_have_slices = 0;
23545 
23546   /* "View.MemoryView":674
23547  *     result = []
23548  *     have_slices = False
23549  *     seen_ellipsis = False             # <<<<<<<<<<<<<<
23550  *     for idx, item in enumerate(tup):
23551  *         if item is Ellipsis:
23552  */
23553   __pyx_v_seen_ellipsis = 0;
23554 
23555   /* "View.MemoryView":675
23556  *     have_slices = False
23557  *     seen_ellipsis = False
23558  *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
23559  *         if item is Ellipsis:
23560  *             if not seen_ellipsis:
23561  */
23562   __Pyx_INCREF(__pyx_int_0);
23563   __pyx_t_3 = __pyx_int_0;
23564   if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
23565     __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
23566     __pyx_t_6 = NULL;
23567   } else {
23568     __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 675, __pyx_L1_error)
23569     __Pyx_GOTREF(__pyx_t_4);
23570     __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 675, __pyx_L1_error)
23571   }
23572   for (;;) {
23573     if (likely(!__pyx_t_6)) {
23574       if (likely(PyList_CheckExact(__pyx_t_4))) {
23575         if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
23576         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
23577         __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(1, 675, __pyx_L1_error)
23578         #else
23579         __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 675, __pyx_L1_error)
23580         __Pyx_GOTREF(__pyx_t_7);
23581         #endif
23582       } else {
23583         if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
23584         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
23585         __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(1, 675, __pyx_L1_error)
23586         #else
23587         __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 675, __pyx_L1_error)
23588         __Pyx_GOTREF(__pyx_t_7);
23589         #endif
23590       }
23591     } else {
23592       __pyx_t_7 = __pyx_t_6(__pyx_t_4);
23593       if (unlikely(!__pyx_t_7)) {
23594         PyObject* exc_type = PyErr_Occurred();
23595         if (exc_type) {
23596           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
23597           else __PYX_ERR(1, 675, __pyx_L1_error)
23598         }
23599         break;
23600       }
23601       __Pyx_GOTREF(__pyx_t_7);
23602     }
23603     __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
23604     __pyx_t_7 = 0;
23605     __Pyx_INCREF(__pyx_t_3);
23606     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
23607     __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 675, __pyx_L1_error)
23608     __Pyx_GOTREF(__pyx_t_7);
23609     __Pyx_DECREF(__pyx_t_3);
23610     __pyx_t_3 = __pyx_t_7;
23611     __pyx_t_7 = 0;
23612 
23613     /* "View.MemoryView":676
23614  *     seen_ellipsis = False
23615  *     for idx, item in enumerate(tup):
23616  *         if item is Ellipsis:             # <<<<<<<<<<<<<<
23617  *             if not seen_ellipsis:
23618  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
23619  */
23620     __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
23621     __pyx_t_1 = (__pyx_t_2 != 0);
23622     if (__pyx_t_1) {
23623 
23624       /* "View.MemoryView":677
23625  *     for idx, item in enumerate(tup):
23626  *         if item is Ellipsis:
23627  *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
23628  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
23629  *                 seen_ellipsis = True
23630  */
23631       __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
23632       if (__pyx_t_1) {
23633 
23634         /* "View.MemoryView":678
23635  *         if item is Ellipsis:
23636  *             if not seen_ellipsis:
23637  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
23638  *                 seen_ellipsis = True
23639  *             else:
23640  */
23641         __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 678, __pyx_L1_error)
23642         __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 678, __pyx_L1_error)
23643         __Pyx_GOTREF(__pyx_t_7);
23644         { Py_ssize_t __pyx_temp;
23645           for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
23646             __Pyx_INCREF(__pyx_slice__28);
23647             __Pyx_GIVEREF(__pyx_slice__28);
23648             PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__28);
23649           }
23650         }
23651         __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 678, __pyx_L1_error)
23652         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
23653 
23654         /* "View.MemoryView":679
23655  *             if not seen_ellipsis:
23656  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
23657  *                 seen_ellipsis = True             # <<<<<<<<<<<<<<
23658  *             else:
23659  *                 result.append(slice(None))
23660  */
23661         __pyx_v_seen_ellipsis = 1;
23662 
23663         /* "View.MemoryView":677
23664  *     for idx, item in enumerate(tup):
23665  *         if item is Ellipsis:
23666  *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
23667  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
23668  *                 seen_ellipsis = True
23669  */
23670         goto __pyx_L7;
23671       }
23672 
23673       /* "View.MemoryView":681
23674  *                 seen_ellipsis = True
23675  *             else:
23676  *                 result.append(slice(None))             # <<<<<<<<<<<<<<
23677  *             have_slices = True
23678  *         else:
23679  */
23680       /*else*/ {
23681         __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__28); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 681, __pyx_L1_error)
23682       }
23683       __pyx_L7:;
23684 
23685       /* "View.MemoryView":682
23686  *             else:
23687  *                 result.append(slice(None))
23688  *             have_slices = True             # <<<<<<<<<<<<<<
23689  *         else:
23690  *             if not isinstance(item, slice) and not PyIndex_Check(item):
23691  */
23692       __pyx_v_have_slices = 1;
23693 
23694       /* "View.MemoryView":676
23695  *     seen_ellipsis = False
23696  *     for idx, item in enumerate(tup):
23697  *         if item is Ellipsis:             # <<<<<<<<<<<<<<
23698  *             if not seen_ellipsis:
23699  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
23700  */
23701       goto __pyx_L6;
23702     }
23703 
23704     /* "View.MemoryView":684
23705  *             have_slices = True
23706  *         else:
23707  *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
23708  *                 raise TypeError("Cannot index with type '%s'" % type(item))
23709  *
23710  */
23711     /*else*/ {
23712       __pyx_t_2 = PySlice_Check(__pyx_v_item);
23713       __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
23714       if (__pyx_t_10) {
23715       } else {
23716         __pyx_t_1 = __pyx_t_10;
23717         goto __pyx_L9_bool_binop_done;
23718       }
23719       __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
23720       __pyx_t_1 = __pyx_t_10;
23721       __pyx_L9_bool_binop_done:;
23722       if (unlikely(__pyx_t_1)) {
23723 
23724         /* "View.MemoryView":685
23725  *         else:
23726  *             if not isinstance(item, slice) and not PyIndex_Check(item):
23727  *                 raise TypeError("Cannot index with type '%s'" % type(item))             # <<<<<<<<<<<<<<
23728  *
23729  *             have_slices = have_slices or isinstance(item, slice)
23730  */
23731         __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 685, __pyx_L1_error)
23732         __Pyx_GOTREF(__pyx_t_7);
23733         __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 685, __pyx_L1_error)
23734         __Pyx_GOTREF(__pyx_t_11);
23735         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
23736         __Pyx_Raise(__pyx_t_11, 0, 0, 0);
23737         __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
23738         __PYX_ERR(1, 685, __pyx_L1_error)
23739 
23740         /* "View.MemoryView":684
23741  *             have_slices = True
23742  *         else:
23743  *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
23744  *                 raise TypeError("Cannot index with type '%s'" % type(item))
23745  *
23746  */
23747       }
23748 
23749       /* "View.MemoryView":687
23750  *                 raise TypeError("Cannot index with type '%s'" % type(item))
23751  *
23752  *             have_slices = have_slices or isinstance(item, slice)             # <<<<<<<<<<<<<<
23753  *             result.append(item)
23754  *
23755  */
23756       __pyx_t_10 = (__pyx_v_have_slices != 0);
23757       if (!__pyx_t_10) {
23758       } else {
23759         __pyx_t_1 = __pyx_t_10;
23760         goto __pyx_L11_bool_binop_done;
23761       }
23762       __pyx_t_10 = PySlice_Check(__pyx_v_item);
23763       __pyx_t_2 = (__pyx_t_10 != 0);
23764       __pyx_t_1 = __pyx_t_2;
23765       __pyx_L11_bool_binop_done:;
23766       __pyx_v_have_slices = __pyx_t_1;
23767 
23768       /* "View.MemoryView":688
23769  *
23770  *             have_slices = have_slices or isinstance(item, slice)
23771  *             result.append(item)             # <<<<<<<<<<<<<<
23772  *
23773  *     nslices = ndim - len(result)
23774  */
23775       __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 688, __pyx_L1_error)
23776     }
23777     __pyx_L6:;
23778 
23779     /* "View.MemoryView":675
23780  *     have_slices = False
23781  *     seen_ellipsis = False
23782  *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
23783  *         if item is Ellipsis:
23784  *             if not seen_ellipsis:
23785  */
23786   }
23787   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23788   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23789 
23790   /* "View.MemoryView":690
23791  *             result.append(item)
23792  *
23793  *     nslices = ndim - len(result)             # <<<<<<<<<<<<<<
23794  *     if nslices:
23795  *         result.extend([slice(None)] * nslices)
23796  */
23797   __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 690, __pyx_L1_error)
23798   __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
23799 
23800   /* "View.MemoryView":691
23801  *
23802  *     nslices = ndim - len(result)
23803  *     if nslices:             # <<<<<<<<<<<<<<
23804  *         result.extend([slice(None)] * nslices)
23805  *
23806  */
23807   __pyx_t_1 = (__pyx_v_nslices != 0);
23808   if (__pyx_t_1) {
23809 
23810     /* "View.MemoryView":692
23811  *     nslices = ndim - len(result)
23812  *     if nslices:
23813  *         result.extend([slice(None)] * nslices)             # <<<<<<<<<<<<<<
23814  *
23815  *     return have_slices or nslices, tuple(result)
23816  */
23817     __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 692, __pyx_L1_error)
23818     __Pyx_GOTREF(__pyx_t_3);
23819     { Py_ssize_t __pyx_temp;
23820       for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
23821         __Pyx_INCREF(__pyx_slice__28);
23822         __Pyx_GIVEREF(__pyx_slice__28);
23823         PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__28);
23824       }
23825     }
23826     __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 692, __pyx_L1_error)
23827     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23828 
23829     /* "View.MemoryView":691
23830  *
23831  *     nslices = ndim - len(result)
23832  *     if nslices:             # <<<<<<<<<<<<<<
23833  *         result.extend([slice(None)] * nslices)
23834  *
23835  */
23836   }
23837 
23838   /* "View.MemoryView":694
23839  *         result.extend([slice(None)] * nslices)
23840  *
23841  *     return have_slices or nslices, tuple(result)             # <<<<<<<<<<<<<<
23842  *
23843  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
23844  */
23845   __Pyx_XDECREF(__pyx_r);
23846   if (!__pyx_v_have_slices) {
23847   } else {
23848     __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 694, __pyx_L1_error)
23849     __Pyx_GOTREF(__pyx_t_4);
23850     __pyx_t_3 = __pyx_t_4;
23851     __pyx_t_4 = 0;
23852     goto __pyx_L14_bool_binop_done;
23853   }
23854   __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 694, __pyx_L1_error)
23855   __Pyx_GOTREF(__pyx_t_4);
23856   __pyx_t_3 = __pyx_t_4;
23857   __pyx_t_4 = 0;
23858   __pyx_L14_bool_binop_done:;
23859   __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 694, __pyx_L1_error)
23860   __Pyx_GOTREF(__pyx_t_4);
23861   __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 694, __pyx_L1_error)
23862   __Pyx_GOTREF(__pyx_t_11);
23863   __Pyx_GIVEREF(__pyx_t_3);
23864   PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
23865   __Pyx_GIVEREF(__pyx_t_4);
23866   PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
23867   __pyx_t_3 = 0;
23868   __pyx_t_4 = 0;
23869   __pyx_r = ((PyObject*)__pyx_t_11);
23870   __pyx_t_11 = 0;
23871   goto __pyx_L0;
23872 
23873   /* "View.MemoryView":662
23874  *     return isinstance(o, memoryview)
23875  *
23876  * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
23877  *     """
23878  *     Replace all ellipses with full slices and fill incomplete indices with
23879  */
23880 
23881   /* function exit code */
23882   __pyx_L1_error:;
23883   __Pyx_XDECREF(__pyx_t_3);
23884   __Pyx_XDECREF(__pyx_t_4);
23885   __Pyx_XDECREF(__pyx_t_7);
23886   __Pyx_XDECREF(__pyx_t_11);
23887   __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
23888   __pyx_r = 0;
23889   __pyx_L0:;
23890   __Pyx_XDECREF(__pyx_v_tup);
23891   __Pyx_XDECREF(__pyx_v_result);
23892   __Pyx_XDECREF(__pyx_v_idx);
23893   __Pyx_XDECREF(__pyx_v_item);
23894   __Pyx_XGIVEREF(__pyx_r);
23895   __Pyx_RefNannyFinishContext();
23896   return __pyx_r;
23897 }
23898 
23899 /* "View.MemoryView":696
23900  *     return have_slices or nslices, tuple(result)
23901  *
23902  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
23903  *     for suboffset in suboffsets[:ndim]:
23904  *         if suboffset >= 0:
23905  */
23906 
23907 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
23908   Py_ssize_t __pyx_v_suboffset;
23909   PyObject *__pyx_r = NULL;
23910   __Pyx_RefNannyDeclarations
23911   Py_ssize_t *__pyx_t_1;
23912   Py_ssize_t *__pyx_t_2;
23913   Py_ssize_t *__pyx_t_3;
23914   int __pyx_t_4;
23915   PyObject *__pyx_t_5 = NULL;
23916   __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);
23917 
23918   /* "View.MemoryView":697
23919  *
23920  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
23921  *     for suboffset in suboffsets[:ndim]:             # <<<<<<<<<<<<<<
23922  *         if suboffset >= 0:
23923  *             raise ValueError("Indirect dimensions not supported")
23924  */
23925   __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
23926   for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
23927     __pyx_t_1 = __pyx_t_3;
23928     __pyx_v_suboffset = (__pyx_t_1[0]);
23929 
23930     /* "View.MemoryView":698
23931  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
23932  *     for suboffset in suboffsets[:ndim]:
23933  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
23934  *             raise ValueError("Indirect dimensions not supported")
23935  *
23936  */
23937     __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
23938     if (unlikely(__pyx_t_4)) {
23939 
23940       /* "View.MemoryView":699
23941  *     for suboffset in suboffsets[:ndim]:
23942  *         if suboffset >= 0:
23943  *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
23944  *
23945  *
23946  */
23947       __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 699, __pyx_L1_error)
23948       __Pyx_GOTREF(__pyx_t_5);
23949       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
23950       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
23951       __PYX_ERR(1, 699, __pyx_L1_error)
23952 
23953       /* "View.MemoryView":698
23954  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
23955  *     for suboffset in suboffsets[:ndim]:
23956  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
23957  *             raise ValueError("Indirect dimensions not supported")
23958  *
23959  */
23960     }
23961   }
23962 
23963   /* "View.MemoryView":696
23964  *     return have_slices or nslices, tuple(result)
23965  *
23966  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
23967  *     for suboffset in suboffsets[:ndim]:
23968  *         if suboffset >= 0:
23969  */
23970 
23971   /* function exit code */
23972   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
23973   goto __pyx_L0;
23974   __pyx_L1_error:;
23975   __Pyx_XDECREF(__pyx_t_5);
23976   __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
23977   __pyx_r = 0;
23978   __pyx_L0:;
23979   __Pyx_XGIVEREF(__pyx_r);
23980   __Pyx_RefNannyFinishContext();
23981   return __pyx_r;
23982 }
23983 
23984 /* "View.MemoryView":706
23985  *
23986  * @cname('__pyx_memview_slice')
23987  * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
23988  *     cdef int new_ndim = 0, suboffset_dim = -1, dim
23989  *     cdef bint negative_step
23990  */
23991 
23992 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
23993   int __pyx_v_new_ndim;
23994   int __pyx_v_suboffset_dim;
23995   int __pyx_v_dim;
23996   __Pyx_memviewslice __pyx_v_src;
23997   __Pyx_memviewslice __pyx_v_dst;
23998   __Pyx_memviewslice *__pyx_v_p_src;
23999   struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
24000   __Pyx_memviewslice *__pyx_v_p_dst;
24001   int *__pyx_v_p_suboffset_dim;
24002   Py_ssize_t __pyx_v_start;
24003   Py_ssize_t __pyx_v_stop;
24004   Py_ssize_t __pyx_v_step;
24005   int __pyx_v_have_start;
24006   int __pyx_v_have_stop;
24007   int __pyx_v_have_step;
24008   PyObject *__pyx_v_index = NULL;
24009   struct __pyx_memoryview_obj *__pyx_r = NULL;
24010   __Pyx_RefNannyDeclarations
24011   int __pyx_t_1;
24012   int __pyx_t_2;
24013   PyObject *__pyx_t_3 = NULL;
24014   struct __pyx_memoryview_obj *__pyx_t_4;
24015   char *__pyx_t_5;
24016   int __pyx_t_6;
24017   Py_ssize_t __pyx_t_7;
24018   PyObject *(*__pyx_t_8)(PyObject *);
24019   PyObject *__pyx_t_9 = NULL;
24020   Py_ssize_t __pyx_t_10;
24021   int __pyx_t_11;
24022   Py_ssize_t __pyx_t_12;
24023   __Pyx_RefNannySetupContext("memview_slice", 0);
24024 
24025   /* "View.MemoryView":707
24026  * @cname('__pyx_memview_slice')
24027  * cdef memoryview memview_slice(memoryview memview, object indices):
24028  *     cdef int new_ndim = 0, suboffset_dim = -1, dim             # <<<<<<<<<<<<<<
24029  *     cdef bint negative_step
24030  *     cdef __Pyx_memviewslice src, dst
24031  */
24032   __pyx_v_new_ndim = 0;
24033   __pyx_v_suboffset_dim = -1;
24034 
24035   /* "View.MemoryView":714
24036  *
24037  *
24038  *     memset(&dst, 0, sizeof(dst))             # <<<<<<<<<<<<<<
24039  *
24040  *     cdef _memoryviewslice memviewsliceobj
24041  */
24042   (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));
24043 
24044   /* "View.MemoryView":718
24045  *     cdef _memoryviewslice memviewsliceobj
24046  *
24047  *     assert memview.view.ndim > 0             # <<<<<<<<<<<<<<
24048  *
24049  *     if isinstance(memview, _memoryviewslice):
24050  */
24051   #ifndef CYTHON_WITHOUT_ASSERTIONS
24052   if (unlikely(!Py_OptimizeFlag)) {
24053     if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
24054       PyErr_SetNone(PyExc_AssertionError);
24055       __PYX_ERR(1, 718, __pyx_L1_error)
24056     }
24057   }
24058   #endif
24059 
24060   /* "View.MemoryView":720
24061  *     assert memview.view.ndim > 0
24062  *
24063  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
24064  *         memviewsliceobj = memview
24065  *         p_src = &memviewsliceobj.from_slice
24066  */
24067   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
24068   __pyx_t_2 = (__pyx_t_1 != 0);
24069   if (__pyx_t_2) {
24070 
24071     /* "View.MemoryView":721
24072  *
24073  *     if isinstance(memview, _memoryviewslice):
24074  *         memviewsliceobj = memview             # <<<<<<<<<<<<<<
24075  *         p_src = &memviewsliceobj.from_slice
24076  *     else:
24077  */
24078     if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 721, __pyx_L1_error)
24079     __pyx_t_3 = ((PyObject *)__pyx_v_memview);
24080     __Pyx_INCREF(__pyx_t_3);
24081     __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
24082     __pyx_t_3 = 0;
24083 
24084     /* "View.MemoryView":722
24085  *     if isinstance(memview, _memoryviewslice):
24086  *         memviewsliceobj = memview
24087  *         p_src = &memviewsliceobj.from_slice             # <<<<<<<<<<<<<<
24088  *     else:
24089  *         slice_copy(memview, &src)
24090  */
24091     __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
24092 
24093     /* "View.MemoryView":720
24094  *     assert memview.view.ndim > 0
24095  *
24096  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
24097  *         memviewsliceobj = memview
24098  *         p_src = &memviewsliceobj.from_slice
24099  */
24100     goto __pyx_L3;
24101   }
24102 
24103   /* "View.MemoryView":724
24104  *         p_src = &memviewsliceobj.from_slice
24105  *     else:
24106  *         slice_copy(memview, &src)             # <<<<<<<<<<<<<<
24107  *         p_src = &src
24108  *
24109  */
24110   /*else*/ {
24111     __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
24112 
24113     /* "View.MemoryView":725
24114  *     else:
24115  *         slice_copy(memview, &src)
24116  *         p_src = &src             # <<<<<<<<<<<<<<
24117  *
24118  *
24119  */
24120     __pyx_v_p_src = (&__pyx_v_src);
24121   }
24122   __pyx_L3:;
24123 
24124   /* "View.MemoryView":731
24125  *
24126  *
24127  *     dst.memview = p_src.memview             # <<<<<<<<<<<<<<
24128  *     dst.data = p_src.data
24129  *
24130  */
24131   __pyx_t_4 = __pyx_v_p_src->memview;
24132   __pyx_v_dst.memview = __pyx_t_4;
24133 
24134   /* "View.MemoryView":732
24135  *
24136  *     dst.memview = p_src.memview
24137  *     dst.data = p_src.data             # <<<<<<<<<<<<<<
24138  *
24139  *
24140  */
24141   __pyx_t_5 = __pyx_v_p_src->data;
24142   __pyx_v_dst.data = __pyx_t_5;
24143 
24144   /* "View.MemoryView":737
24145  *
24146  *
24147  *     cdef __Pyx_memviewslice *p_dst = &dst             # <<<<<<<<<<<<<<
24148  *     cdef int *p_suboffset_dim = &suboffset_dim
24149  *     cdef Py_ssize_t start, stop, step
24150  */
24151   __pyx_v_p_dst = (&__pyx_v_dst);
24152 
24153   /* "View.MemoryView":738
24154  *
24155  *     cdef __Pyx_memviewslice *p_dst = &dst
24156  *     cdef int *p_suboffset_dim = &suboffset_dim             # <<<<<<<<<<<<<<
24157  *     cdef Py_ssize_t start, stop, step
24158  *     cdef bint have_start, have_stop, have_step
24159  */
24160   __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
24161 
24162   /* "View.MemoryView":742
24163  *     cdef bint have_start, have_stop, have_step
24164  *
24165  *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
24166  *         if PyIndex_Check(index):
24167  *             slice_memviewslice(
24168  */
24169   __pyx_t_6 = 0;
24170   if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
24171     __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
24172     __pyx_t_8 = NULL;
24173   } else {
24174     __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 742, __pyx_L1_error)
24175     __Pyx_GOTREF(__pyx_t_3);
24176     __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 742, __pyx_L1_error)
24177   }
24178   for (;;) {
24179     if (likely(!__pyx_t_8)) {
24180       if (likely(PyList_CheckExact(__pyx_t_3))) {
24181         if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
24182         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
24183         __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(1, 742, __pyx_L1_error)
24184         #else
24185         __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 742, __pyx_L1_error)
24186         __Pyx_GOTREF(__pyx_t_9);
24187         #endif
24188       } else {
24189         if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
24190         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
24191         __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(1, 742, __pyx_L1_error)
24192         #else
24193         __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 742, __pyx_L1_error)
24194         __Pyx_GOTREF(__pyx_t_9);
24195         #endif
24196       }
24197     } else {
24198       __pyx_t_9 = __pyx_t_8(__pyx_t_3);
24199       if (unlikely(!__pyx_t_9)) {
24200         PyObject* exc_type = PyErr_Occurred();
24201         if (exc_type) {
24202           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
24203           else __PYX_ERR(1, 742, __pyx_L1_error)
24204         }
24205         break;
24206       }
24207       __Pyx_GOTREF(__pyx_t_9);
24208     }
24209     __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
24210     __pyx_t_9 = 0;
24211     __pyx_v_dim = __pyx_t_6;
24212     __pyx_t_6 = (__pyx_t_6 + 1);
24213 
24214     /* "View.MemoryView":743
24215  *
24216  *     for dim, index in enumerate(indices):
24217  *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
24218  *             slice_memviewslice(
24219  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
24220  */
24221     __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
24222     if (__pyx_t_2) {
24223 
24224       /* "View.MemoryView":747
24225  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
24226  *                 dim, new_ndim, p_suboffset_dim,
24227  *                 index, 0, 0, # start, stop, step             # <<<<<<<<<<<<<<
24228  *                 0, 0, 0, # have_{start,stop,step}
24229  *                 False)
24230  */
24231       __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 747, __pyx_L1_error)
24232 
24233       /* "View.MemoryView":744
24234  *     for dim, index in enumerate(indices):
24235  *         if PyIndex_Check(index):
24236  *             slice_memviewslice(             # <<<<<<<<<<<<<<
24237  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
24238  *                 dim, new_ndim, p_suboffset_dim,
24239  */
24240       __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(1, 744, __pyx_L1_error)
24241 
24242       /* "View.MemoryView":743
24243  *
24244  *     for dim, index in enumerate(indices):
24245  *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
24246  *             slice_memviewslice(
24247  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
24248  */
24249       goto __pyx_L6;
24250     }
24251 
24252     /* "View.MemoryView":750
24253  *                 0, 0, 0, # have_{start,stop,step}
24254  *                 False)
24255  *         elif index is None:             # <<<<<<<<<<<<<<
24256  *             p_dst.shape[new_ndim] = 1
24257  *             p_dst.strides[new_ndim] = 0
24258  */
24259     __pyx_t_2 = (__pyx_v_index == Py_None);
24260     __pyx_t_1 = (__pyx_t_2 != 0);
24261     if (__pyx_t_1) {
24262 
24263       /* "View.MemoryView":751
24264  *                 False)
24265  *         elif index is None:
24266  *             p_dst.shape[new_ndim] = 1             # <<<<<<<<<<<<<<
24267  *             p_dst.strides[new_ndim] = 0
24268  *             p_dst.suboffsets[new_ndim] = -1
24269  */
24270       (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
24271 
24272       /* "View.MemoryView":752
24273  *         elif index is None:
24274  *             p_dst.shape[new_ndim] = 1
24275  *             p_dst.strides[new_ndim] = 0             # <<<<<<<<<<<<<<
24276  *             p_dst.suboffsets[new_ndim] = -1
24277  *             new_ndim += 1
24278  */
24279       (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
24280 
24281       /* "View.MemoryView":753
24282  *             p_dst.shape[new_ndim] = 1
24283  *             p_dst.strides[new_ndim] = 0
24284  *             p_dst.suboffsets[new_ndim] = -1             # <<<<<<<<<<<<<<
24285  *             new_ndim += 1
24286  *         else:
24287  */
24288       (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
24289 
24290       /* "View.MemoryView":754
24291  *             p_dst.strides[new_ndim] = 0
24292  *             p_dst.suboffsets[new_ndim] = -1
24293  *             new_ndim += 1             # <<<<<<<<<<<<<<
24294  *         else:
24295  *             start = index.start or 0
24296  */
24297       __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
24298 
24299       /* "View.MemoryView":750
24300  *                 0, 0, 0, # have_{start,stop,step}
24301  *                 False)
24302  *         elif index is None:             # <<<<<<<<<<<<<<
24303  *             p_dst.shape[new_ndim] = 1
24304  *             p_dst.strides[new_ndim] = 0
24305  */
24306       goto __pyx_L6;
24307     }
24308 
24309     /* "View.MemoryView":756
24310  *             new_ndim += 1
24311  *         else:
24312  *             start = index.start or 0             # <<<<<<<<<<<<<<
24313  *             stop = index.stop or 0
24314  *             step = index.step or 0
24315  */
24316     /*else*/ {
24317       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 756, __pyx_L1_error)
24318       __Pyx_GOTREF(__pyx_t_9);
24319       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 756, __pyx_L1_error)
24320       if (!__pyx_t_1) {
24321         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
24322       } else {
24323         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 756, __pyx_L1_error)
24324         __pyx_t_10 = __pyx_t_12;
24325         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
24326         goto __pyx_L7_bool_binop_done;
24327       }
24328       __pyx_t_10 = 0;
24329       __pyx_L7_bool_binop_done:;
24330       __pyx_v_start = __pyx_t_10;
24331 
24332       /* "View.MemoryView":757
24333  *         else:
24334  *             start = index.start or 0
24335  *             stop = index.stop or 0             # <<<<<<<<<<<<<<
24336  *             step = index.step or 0
24337  *
24338  */
24339       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 757, __pyx_L1_error)
24340       __Pyx_GOTREF(__pyx_t_9);
24341       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 757, __pyx_L1_error)
24342       if (!__pyx_t_1) {
24343         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
24344       } else {
24345         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 757, __pyx_L1_error)
24346         __pyx_t_10 = __pyx_t_12;
24347         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
24348         goto __pyx_L9_bool_binop_done;
24349       }
24350       __pyx_t_10 = 0;
24351       __pyx_L9_bool_binop_done:;
24352       __pyx_v_stop = __pyx_t_10;
24353 
24354       /* "View.MemoryView":758
24355  *             start = index.start or 0
24356  *             stop = index.stop or 0
24357  *             step = index.step or 0             # <<<<<<<<<<<<<<
24358  *
24359  *             have_start = index.start is not None
24360  */
24361       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 758, __pyx_L1_error)
24362       __Pyx_GOTREF(__pyx_t_9);
24363       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 758, __pyx_L1_error)
24364       if (!__pyx_t_1) {
24365         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
24366       } else {
24367         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 758, __pyx_L1_error)
24368         __pyx_t_10 = __pyx_t_12;
24369         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
24370         goto __pyx_L11_bool_binop_done;
24371       }
24372       __pyx_t_10 = 0;
24373       __pyx_L11_bool_binop_done:;
24374       __pyx_v_step = __pyx_t_10;
24375 
24376       /* "View.MemoryView":760
24377  *             step = index.step or 0
24378  *
24379  *             have_start = index.start is not None             # <<<<<<<<<<<<<<
24380  *             have_stop = index.stop is not None
24381  *             have_step = index.step is not None
24382  */
24383       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 760, __pyx_L1_error)
24384       __Pyx_GOTREF(__pyx_t_9);
24385       __pyx_t_1 = (__pyx_t_9 != Py_None);
24386       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
24387       __pyx_v_have_start = __pyx_t_1;
24388 
24389       /* "View.MemoryView":761
24390  *
24391  *             have_start = index.start is not None
24392  *             have_stop = index.stop is not None             # <<<<<<<<<<<<<<
24393  *             have_step = index.step is not None
24394  *
24395  */
24396       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 761, __pyx_L1_error)
24397       __Pyx_GOTREF(__pyx_t_9);
24398       __pyx_t_1 = (__pyx_t_9 != Py_None);
24399       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
24400       __pyx_v_have_stop = __pyx_t_1;
24401 
24402       /* "View.MemoryView":762
24403  *             have_start = index.start is not None
24404  *             have_stop = index.stop is not None
24405  *             have_step = index.step is not None             # <<<<<<<<<<<<<<
24406  *
24407  *             slice_memviewslice(
24408  */
24409       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 762, __pyx_L1_error)
24410       __Pyx_GOTREF(__pyx_t_9);
24411       __pyx_t_1 = (__pyx_t_9 != Py_None);
24412       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
24413       __pyx_v_have_step = __pyx_t_1;
24414 
24415       /* "View.MemoryView":764
24416  *             have_step = index.step is not None
24417  *
24418  *             slice_memviewslice(             # <<<<<<<<<<<<<<
24419  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
24420  *                 dim, new_ndim, p_suboffset_dim,
24421  */
24422       __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(1, 764, __pyx_L1_error)
24423 
24424       /* "View.MemoryView":770
24425  *                 have_start, have_stop, have_step,
24426  *                 True)
24427  *             new_ndim += 1             # <<<<<<<<<<<<<<
24428  *
24429  *     if isinstance(memview, _memoryviewslice):
24430  */
24431       __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
24432     }
24433     __pyx_L6:;
24434 
24435     /* "View.MemoryView":742
24436  *     cdef bint have_start, have_stop, have_step
24437  *
24438  *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
24439  *         if PyIndex_Check(index):
24440  *             slice_memviewslice(
24441  */
24442   }
24443   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
24444 
24445   /* "View.MemoryView":772
24446  *             new_ndim += 1
24447  *
24448  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
24449  *         return memoryview_fromslice(dst, new_ndim,
24450  *                                     memviewsliceobj.to_object_func,
24451  */
24452   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
24453   __pyx_t_2 = (__pyx_t_1 != 0);
24454   if (__pyx_t_2) {
24455 
24456     /* "View.MemoryView":773
24457  *
24458  *     if isinstance(memview, _memoryviewslice):
24459  *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
24460  *                                     memviewsliceobj.to_object_func,
24461  *                                     memviewsliceobj.to_dtype_func,
24462  */
24463     __Pyx_XDECREF(((PyObject *)__pyx_r));
24464 
24465     /* "View.MemoryView":774
24466  *     if isinstance(memview, _memoryviewslice):
24467  *         return memoryview_fromslice(dst, new_ndim,
24468  *                                     memviewsliceobj.to_object_func,             # <<<<<<<<<<<<<<
24469  *                                     memviewsliceobj.to_dtype_func,
24470  *                                     memview.dtype_is_object)
24471  */
24472     if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 774, __pyx_L1_error) }
24473 
24474     /* "View.MemoryView":775
24475  *         return memoryview_fromslice(dst, new_ndim,
24476  *                                     memviewsliceobj.to_object_func,
24477  *                                     memviewsliceobj.to_dtype_func,             # <<<<<<<<<<<<<<
24478  *                                     memview.dtype_is_object)
24479  *     else:
24480  */
24481     if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 775, __pyx_L1_error) }
24482 
24483     /* "View.MemoryView":773
24484  *
24485  *     if isinstance(memview, _memoryviewslice):
24486  *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
24487  *                                     memviewsliceobj.to_object_func,
24488  *                                     memviewsliceobj.to_dtype_func,
24489  */
24490     __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 773, __pyx_L1_error)
24491     __Pyx_GOTREF(__pyx_t_3);
24492     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 773, __pyx_L1_error)
24493     __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
24494     __pyx_t_3 = 0;
24495     goto __pyx_L0;
24496 
24497     /* "View.MemoryView":772
24498  *             new_ndim += 1
24499  *
24500  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
24501  *         return memoryview_fromslice(dst, new_ndim,
24502  *                                     memviewsliceobj.to_object_func,
24503  */
24504   }
24505 
24506   /* "View.MemoryView":778
24507  *                                     memview.dtype_is_object)
24508  *     else:
24509  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
24510  *                                     memview.dtype_is_object)
24511  *
24512  */
24513   /*else*/ {
24514     __Pyx_XDECREF(((PyObject *)__pyx_r));
24515 
24516     /* "View.MemoryView":779
24517  *     else:
24518  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
24519  *                                     memview.dtype_is_object)             # <<<<<<<<<<<<<<
24520  *
24521  *
24522  */
24523     __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 778, __pyx_L1_error)
24524     __Pyx_GOTREF(__pyx_t_3);
24525 
24526     /* "View.MemoryView":778
24527  *                                     memview.dtype_is_object)
24528  *     else:
24529  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
24530  *                                     memview.dtype_is_object)
24531  *
24532  */
24533     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 778, __pyx_L1_error)
24534     __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
24535     __pyx_t_3 = 0;
24536     goto __pyx_L0;
24537   }
24538 
24539   /* "View.MemoryView":706
24540  *
24541  * @cname('__pyx_memview_slice')
24542  * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
24543  *     cdef int new_ndim = 0, suboffset_dim = -1, dim
24544  *     cdef bint negative_step
24545  */
24546 
24547   /* function exit code */
24548   __pyx_L1_error:;
24549   __Pyx_XDECREF(__pyx_t_3);
24550   __Pyx_XDECREF(__pyx_t_9);
24551   __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
24552   __pyx_r = 0;
24553   __pyx_L0:;
24554   __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
24555   __Pyx_XDECREF(__pyx_v_index);
24556   __Pyx_XGIVEREF((PyObject *)__pyx_r);
24557   __Pyx_RefNannyFinishContext();
24558   return __pyx_r;
24559 }
24560 
24561 /* "View.MemoryView":803
24562  *
24563  * @cname('__pyx_memoryview_slice_memviewslice')
24564  * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
24565  *         __Pyx_memviewslice *dst,
24566  *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
24567  */
24568 
24569 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) {
24570   Py_ssize_t __pyx_v_new_shape;
24571   int __pyx_v_negative_step;
24572   int __pyx_r;
24573   int __pyx_t_1;
24574   int __pyx_t_2;
24575   int __pyx_t_3;
24576 
24577   /* "View.MemoryView":823
24578  *     cdef bint negative_step
24579  *
24580  *     if not is_slice:             # <<<<<<<<<<<<<<
24581  *
24582  *         if start < 0:
24583  */
24584   __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
24585   if (__pyx_t_1) {
24586 
24587     /* "View.MemoryView":825
24588  *     if not is_slice:
24589  *
24590  *         if start < 0:             # <<<<<<<<<<<<<<
24591  *             start += shape
24592  *         if not 0 <= start < shape:
24593  */
24594     __pyx_t_1 = ((__pyx_v_start < 0) != 0);
24595     if (__pyx_t_1) {
24596 
24597       /* "View.MemoryView":826
24598  *
24599  *         if start < 0:
24600  *             start += shape             # <<<<<<<<<<<<<<
24601  *         if not 0 <= start < shape:
24602  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
24603  */
24604       __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
24605 
24606       /* "View.MemoryView":825
24607  *     if not is_slice:
24608  *
24609  *         if start < 0:             # <<<<<<<<<<<<<<
24610  *             start += shape
24611  *         if not 0 <= start < shape:
24612  */
24613     }
24614 
24615     /* "View.MemoryView":827
24616  *         if start < 0:
24617  *             start += shape
24618  *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
24619  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
24620  *     else:
24621  */
24622     __pyx_t_1 = (0 <= __pyx_v_start);
24623     if (__pyx_t_1) {
24624       __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
24625     }
24626     __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
24627     if (__pyx_t_2) {
24628 
24629       /* "View.MemoryView":828
24630  *             start += shape
24631  *         if not 0 <= start < shape:
24632  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)             # <<<<<<<<<<<<<<
24633  *     else:
24634  *
24635  */
24636       __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 828, __pyx_L1_error)
24637 
24638       /* "View.MemoryView":827
24639  *         if start < 0:
24640  *             start += shape
24641  *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
24642  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
24643  *     else:
24644  */
24645     }
24646 
24647     /* "View.MemoryView":823
24648  *     cdef bint negative_step
24649  *
24650  *     if not is_slice:             # <<<<<<<<<<<<<<
24651  *
24652  *         if start < 0:
24653  */
24654     goto __pyx_L3;
24655   }
24656 
24657   /* "View.MemoryView":831
24658  *     else:
24659  *
24660  *         negative_step = have_step != 0 and step < 0             # <<<<<<<<<<<<<<
24661  *
24662  *         if have_step and step == 0:
24663  */
24664   /*else*/ {
24665     __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
24666     if (__pyx_t_1) {
24667     } else {
24668       __pyx_t_2 = __pyx_t_1;
24669       goto __pyx_L6_bool_binop_done;
24670     }
24671     __pyx_t_1 = ((__pyx_v_step < 0) != 0);
24672     __pyx_t_2 = __pyx_t_1;
24673     __pyx_L6_bool_binop_done:;
24674     __pyx_v_negative_step = __pyx_t_2;
24675 
24676     /* "View.MemoryView":833
24677  *         negative_step = have_step != 0 and step < 0
24678  *
24679  *         if have_step and step == 0:             # <<<<<<<<<<<<<<
24680  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
24681  *
24682  */
24683     __pyx_t_1 = (__pyx_v_have_step != 0);
24684     if (__pyx_t_1) {
24685     } else {
24686       __pyx_t_2 = __pyx_t_1;
24687       goto __pyx_L9_bool_binop_done;
24688     }
24689     __pyx_t_1 = ((__pyx_v_step == 0) != 0);
24690     __pyx_t_2 = __pyx_t_1;
24691     __pyx_L9_bool_binop_done:;
24692     if (__pyx_t_2) {
24693 
24694       /* "View.MemoryView":834
24695  *
24696  *         if have_step and step == 0:
24697  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)             # <<<<<<<<<<<<<<
24698  *
24699  *
24700  */
24701       __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 834, __pyx_L1_error)
24702 
24703       /* "View.MemoryView":833
24704  *         negative_step = have_step != 0 and step < 0
24705  *
24706  *         if have_step and step == 0:             # <<<<<<<<<<<<<<
24707  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
24708  *
24709  */
24710     }
24711 
24712     /* "View.MemoryView":837
24713  *
24714  *
24715  *         if have_start:             # <<<<<<<<<<<<<<
24716  *             if start < 0:
24717  *                 start += shape
24718  */
24719     __pyx_t_2 = (__pyx_v_have_start != 0);
24720     if (__pyx_t_2) {
24721 
24722       /* "View.MemoryView":838
24723  *
24724  *         if have_start:
24725  *             if start < 0:             # <<<<<<<<<<<<<<
24726  *                 start += shape
24727  *                 if start < 0:
24728  */
24729       __pyx_t_2 = ((__pyx_v_start < 0) != 0);
24730       if (__pyx_t_2) {
24731 
24732         /* "View.MemoryView":839
24733  *         if have_start:
24734  *             if start < 0:
24735  *                 start += shape             # <<<<<<<<<<<<<<
24736  *                 if start < 0:
24737  *                     start = 0
24738  */
24739         __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
24740 
24741         /* "View.MemoryView":840
24742  *             if start < 0:
24743  *                 start += shape
24744  *                 if start < 0:             # <<<<<<<<<<<<<<
24745  *                     start = 0
24746  *             elif start >= shape:
24747  */
24748         __pyx_t_2 = ((__pyx_v_start < 0) != 0);
24749         if (__pyx_t_2) {
24750 
24751           /* "View.MemoryView":841
24752  *                 start += shape
24753  *                 if start < 0:
24754  *                     start = 0             # <<<<<<<<<<<<<<
24755  *             elif start >= shape:
24756  *                 if negative_step:
24757  */
24758           __pyx_v_start = 0;
24759 
24760           /* "View.MemoryView":840
24761  *             if start < 0:
24762  *                 start += shape
24763  *                 if start < 0:             # <<<<<<<<<<<<<<
24764  *                     start = 0
24765  *             elif start >= shape:
24766  */
24767         }
24768 
24769         /* "View.MemoryView":838
24770  *
24771  *         if have_start:
24772  *             if start < 0:             # <<<<<<<<<<<<<<
24773  *                 start += shape
24774  *                 if start < 0:
24775  */
24776         goto __pyx_L12;
24777       }
24778 
24779       /* "View.MemoryView":842
24780  *                 if start < 0:
24781  *                     start = 0
24782  *             elif start >= shape:             # <<<<<<<<<<<<<<
24783  *                 if negative_step:
24784  *                     start = shape - 1
24785  */
24786       __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
24787       if (__pyx_t_2) {
24788 
24789         /* "View.MemoryView":843
24790  *                     start = 0
24791  *             elif start >= shape:
24792  *                 if negative_step:             # <<<<<<<<<<<<<<
24793  *                     start = shape - 1
24794  *                 else:
24795  */
24796         __pyx_t_2 = (__pyx_v_negative_step != 0);
24797         if (__pyx_t_2) {
24798 
24799           /* "View.MemoryView":844
24800  *             elif start >= shape:
24801  *                 if negative_step:
24802  *                     start = shape - 1             # <<<<<<<<<<<<<<
24803  *                 else:
24804  *                     start = shape
24805  */
24806           __pyx_v_start = (__pyx_v_shape - 1);
24807 
24808           /* "View.MemoryView":843
24809  *                     start = 0
24810  *             elif start >= shape:
24811  *                 if negative_step:             # <<<<<<<<<<<<<<
24812  *                     start = shape - 1
24813  *                 else:
24814  */
24815           goto __pyx_L14;
24816         }
24817 
24818         /* "View.MemoryView":846
24819  *                     start = shape - 1
24820  *                 else:
24821  *                     start = shape             # <<<<<<<<<<<<<<
24822  *         else:
24823  *             if negative_step:
24824  */
24825         /*else*/ {
24826           __pyx_v_start = __pyx_v_shape;
24827         }
24828         __pyx_L14:;
24829 
24830         /* "View.MemoryView":842
24831  *                 if start < 0:
24832  *                     start = 0
24833  *             elif start >= shape:             # <<<<<<<<<<<<<<
24834  *                 if negative_step:
24835  *                     start = shape - 1
24836  */
24837       }
24838       __pyx_L12:;
24839 
24840       /* "View.MemoryView":837
24841  *
24842  *
24843  *         if have_start:             # <<<<<<<<<<<<<<
24844  *             if start < 0:
24845  *                 start += shape
24846  */
24847       goto __pyx_L11;
24848     }
24849 
24850     /* "View.MemoryView":848
24851  *                     start = shape
24852  *         else:
24853  *             if negative_step:             # <<<<<<<<<<<<<<
24854  *                 start = shape - 1
24855  *             else:
24856  */
24857     /*else*/ {
24858       __pyx_t_2 = (__pyx_v_negative_step != 0);
24859       if (__pyx_t_2) {
24860 
24861         /* "View.MemoryView":849
24862  *         else:
24863  *             if negative_step:
24864  *                 start = shape - 1             # <<<<<<<<<<<<<<
24865  *             else:
24866  *                 start = 0
24867  */
24868         __pyx_v_start = (__pyx_v_shape - 1);
24869 
24870         /* "View.MemoryView":848
24871  *                     start = shape
24872  *         else:
24873  *             if negative_step:             # <<<<<<<<<<<<<<
24874  *                 start = shape - 1
24875  *             else:
24876  */
24877         goto __pyx_L15;
24878       }
24879 
24880       /* "View.MemoryView":851
24881  *                 start = shape - 1
24882  *             else:
24883  *                 start = 0             # <<<<<<<<<<<<<<
24884  *
24885  *         if have_stop:
24886  */
24887       /*else*/ {
24888         __pyx_v_start = 0;
24889       }
24890       __pyx_L15:;
24891     }
24892     __pyx_L11:;
24893 
24894     /* "View.MemoryView":853
24895  *                 start = 0
24896  *
24897  *         if have_stop:             # <<<<<<<<<<<<<<
24898  *             if stop < 0:
24899  *                 stop += shape
24900  */
24901     __pyx_t_2 = (__pyx_v_have_stop != 0);
24902     if (__pyx_t_2) {
24903 
24904       /* "View.MemoryView":854
24905  *
24906  *         if have_stop:
24907  *             if stop < 0:             # <<<<<<<<<<<<<<
24908  *                 stop += shape
24909  *                 if stop < 0:
24910  */
24911       __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
24912       if (__pyx_t_2) {
24913 
24914         /* "View.MemoryView":855
24915  *         if have_stop:
24916  *             if stop < 0:
24917  *                 stop += shape             # <<<<<<<<<<<<<<
24918  *                 if stop < 0:
24919  *                     stop = 0
24920  */
24921         __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
24922 
24923         /* "View.MemoryView":856
24924  *             if stop < 0:
24925  *                 stop += shape
24926  *                 if stop < 0:             # <<<<<<<<<<<<<<
24927  *                     stop = 0
24928  *             elif stop > shape:
24929  */
24930         __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
24931         if (__pyx_t_2) {
24932 
24933           /* "View.MemoryView":857
24934  *                 stop += shape
24935  *                 if stop < 0:
24936  *                     stop = 0             # <<<<<<<<<<<<<<
24937  *             elif stop > shape:
24938  *                 stop = shape
24939  */
24940           __pyx_v_stop = 0;
24941 
24942           /* "View.MemoryView":856
24943  *             if stop < 0:
24944  *                 stop += shape
24945  *                 if stop < 0:             # <<<<<<<<<<<<<<
24946  *                     stop = 0
24947  *             elif stop > shape:
24948  */
24949         }
24950 
24951         /* "View.MemoryView":854
24952  *
24953  *         if have_stop:
24954  *             if stop < 0:             # <<<<<<<<<<<<<<
24955  *                 stop += shape
24956  *                 if stop < 0:
24957  */
24958         goto __pyx_L17;
24959       }
24960 
24961       /* "View.MemoryView":858
24962  *                 if stop < 0:
24963  *                     stop = 0
24964  *             elif stop > shape:             # <<<<<<<<<<<<<<
24965  *                 stop = shape
24966  *         else:
24967  */
24968       __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
24969       if (__pyx_t_2) {
24970 
24971         /* "View.MemoryView":859
24972  *                     stop = 0
24973  *             elif stop > shape:
24974  *                 stop = shape             # <<<<<<<<<<<<<<
24975  *         else:
24976  *             if negative_step:
24977  */
24978         __pyx_v_stop = __pyx_v_shape;
24979 
24980         /* "View.MemoryView":858
24981  *                 if stop < 0:
24982  *                     stop = 0
24983  *             elif stop > shape:             # <<<<<<<<<<<<<<
24984  *                 stop = shape
24985  *         else:
24986  */
24987       }
24988       __pyx_L17:;
24989 
24990       /* "View.MemoryView":853
24991  *                 start = 0
24992  *
24993  *         if have_stop:             # <<<<<<<<<<<<<<
24994  *             if stop < 0:
24995  *                 stop += shape
24996  */
24997       goto __pyx_L16;
24998     }
24999 
25000     /* "View.MemoryView":861
25001  *                 stop = shape
25002  *         else:
25003  *             if negative_step:             # <<<<<<<<<<<<<<
25004  *                 stop = -1
25005  *             else:
25006  */
25007     /*else*/ {
25008       __pyx_t_2 = (__pyx_v_negative_step != 0);
25009       if (__pyx_t_2) {
25010 
25011         /* "View.MemoryView":862
25012  *         else:
25013  *             if negative_step:
25014  *                 stop = -1             # <<<<<<<<<<<<<<
25015  *             else:
25016  *                 stop = shape
25017  */
25018         __pyx_v_stop = -1L;
25019 
25020         /* "View.MemoryView":861
25021  *                 stop = shape
25022  *         else:
25023  *             if negative_step:             # <<<<<<<<<<<<<<
25024  *                 stop = -1
25025  *             else:
25026  */
25027         goto __pyx_L19;
25028       }
25029 
25030       /* "View.MemoryView":864
25031  *                 stop = -1
25032  *             else:
25033  *                 stop = shape             # <<<<<<<<<<<<<<
25034  *
25035  *         if not have_step:
25036  */
25037       /*else*/ {
25038         __pyx_v_stop = __pyx_v_shape;
25039       }
25040       __pyx_L19:;
25041     }
25042     __pyx_L16:;
25043 
25044     /* "View.MemoryView":866
25045  *                 stop = shape
25046  *
25047  *         if not have_step:             # <<<<<<<<<<<<<<
25048  *             step = 1
25049  *
25050  */
25051     __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
25052     if (__pyx_t_2) {
25053 
25054       /* "View.MemoryView":867
25055  *
25056  *         if not have_step:
25057  *             step = 1             # <<<<<<<<<<<<<<
25058  *
25059  *
25060  */
25061       __pyx_v_step = 1;
25062 
25063       /* "View.MemoryView":866
25064  *                 stop = shape
25065  *
25066  *         if not have_step:             # <<<<<<<<<<<<<<
25067  *             step = 1
25068  *
25069  */
25070     }
25071 
25072     /* "View.MemoryView":871
25073  *
25074  *         with cython.cdivision(True):
25075  *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
25076  *
25077  *             if (stop - start) - step * new_shape:
25078  */
25079     __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
25080 
25081     /* "View.MemoryView":873
25082  *             new_shape = (stop - start) // step
25083  *
25084  *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
25085  *                 new_shape += 1
25086  *
25087  */
25088     __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
25089     if (__pyx_t_2) {
25090 
25091       /* "View.MemoryView":874
25092  *
25093  *             if (stop - start) - step * new_shape:
25094  *                 new_shape += 1             # <<<<<<<<<<<<<<
25095  *
25096  *         if new_shape < 0:
25097  */
25098       __pyx_v_new_shape = (__pyx_v_new_shape + 1);
25099 
25100       /* "View.MemoryView":873
25101  *             new_shape = (stop - start) // step
25102  *
25103  *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
25104  *                 new_shape += 1
25105  *
25106  */
25107     }
25108 
25109     /* "View.MemoryView":876
25110  *                 new_shape += 1
25111  *
25112  *         if new_shape < 0:             # <<<<<<<<<<<<<<
25113  *             new_shape = 0
25114  *
25115  */
25116     __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
25117     if (__pyx_t_2) {
25118 
25119       /* "View.MemoryView":877
25120  *
25121  *         if new_shape < 0:
25122  *             new_shape = 0             # <<<<<<<<<<<<<<
25123  *
25124  *
25125  */
25126       __pyx_v_new_shape = 0;
25127 
25128       /* "View.MemoryView":876
25129  *                 new_shape += 1
25130  *
25131  *         if new_shape < 0:             # <<<<<<<<<<<<<<
25132  *             new_shape = 0
25133  *
25134  */
25135     }
25136 
25137     /* "View.MemoryView":880
25138  *
25139  *
25140  *         dst.strides[new_ndim] = stride * step             # <<<<<<<<<<<<<<
25141  *         dst.shape[new_ndim] = new_shape
25142  *         dst.suboffsets[new_ndim] = suboffset
25143  */
25144     (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
25145 
25146     /* "View.MemoryView":881
25147  *
25148  *         dst.strides[new_ndim] = stride * step
25149  *         dst.shape[new_ndim] = new_shape             # <<<<<<<<<<<<<<
25150  *         dst.suboffsets[new_ndim] = suboffset
25151  *
25152  */
25153     (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
25154 
25155     /* "View.MemoryView":882
25156  *         dst.strides[new_ndim] = stride * step
25157  *         dst.shape[new_ndim] = new_shape
25158  *         dst.suboffsets[new_ndim] = suboffset             # <<<<<<<<<<<<<<
25159  *
25160  *
25161  */
25162     (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
25163   }
25164   __pyx_L3:;
25165 
25166   /* "View.MemoryView":885
25167  *
25168  *
25169  *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
25170  *         dst.data += start * stride
25171  *     else:
25172  */
25173   __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
25174   if (__pyx_t_2) {
25175 
25176     /* "View.MemoryView":886
25177  *
25178  *     if suboffset_dim[0] < 0:
25179  *         dst.data += start * stride             # <<<<<<<<<<<<<<
25180  *     else:
25181  *         dst.suboffsets[suboffset_dim[0]] += start * stride
25182  */
25183     __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
25184 
25185     /* "View.MemoryView":885
25186  *
25187  *
25188  *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
25189  *         dst.data += start * stride
25190  *     else:
25191  */
25192     goto __pyx_L23;
25193   }
25194 
25195   /* "View.MemoryView":888
25196  *         dst.data += start * stride
25197  *     else:
25198  *         dst.suboffsets[suboffset_dim[0]] += start * stride             # <<<<<<<<<<<<<<
25199  *
25200  *     if suboffset >= 0:
25201  */
25202   /*else*/ {
25203     __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
25204     (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
25205   }
25206   __pyx_L23:;
25207 
25208   /* "View.MemoryView":890
25209  *         dst.suboffsets[suboffset_dim[0]] += start * stride
25210  *
25211  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
25212  *         if not is_slice:
25213  *             if new_ndim == 0:
25214  */
25215   __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
25216   if (__pyx_t_2) {
25217 
25218     /* "View.MemoryView":891
25219  *
25220  *     if suboffset >= 0:
25221  *         if not is_slice:             # <<<<<<<<<<<<<<
25222  *             if new_ndim == 0:
25223  *                 dst.data = (<char **> dst.data)[0] + suboffset
25224  */
25225     __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
25226     if (__pyx_t_2) {
25227 
25228       /* "View.MemoryView":892
25229  *     if suboffset >= 0:
25230  *         if not is_slice:
25231  *             if new_ndim == 0:             # <<<<<<<<<<<<<<
25232  *                 dst.data = (<char **> dst.data)[0] + suboffset
25233  *             else:
25234  */
25235       __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
25236       if (__pyx_t_2) {
25237 
25238         /* "View.MemoryView":893
25239  *         if not is_slice:
25240  *             if new_ndim == 0:
25241  *                 dst.data = (<char **> dst.data)[0] + suboffset             # <<<<<<<<<<<<<<
25242  *             else:
25243  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
25244  */
25245         __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
25246 
25247         /* "View.MemoryView":892
25248  *     if suboffset >= 0:
25249  *         if not is_slice:
25250  *             if new_ndim == 0:             # <<<<<<<<<<<<<<
25251  *                 dst.data = (<char **> dst.data)[0] + suboffset
25252  *             else:
25253  */
25254         goto __pyx_L26;
25255       }
25256 
25257       /* "View.MemoryView":895
25258  *                 dst.data = (<char **> dst.data)[0] + suboffset
25259  *             else:
25260  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "             # <<<<<<<<<<<<<<
25261  *                                      "must be indexed and not sliced", dim)
25262  *         else:
25263  */
25264       /*else*/ {
25265 
25266         /* "View.MemoryView":896
25267  *             else:
25268  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
25269  *                                      "must be indexed and not sliced", dim)             # <<<<<<<<<<<<<<
25270  *         else:
25271  *             suboffset_dim[0] = new_ndim
25272  */
25273         __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 895, __pyx_L1_error)
25274       }
25275       __pyx_L26:;
25276 
25277       /* "View.MemoryView":891
25278  *
25279  *     if suboffset >= 0:
25280  *         if not is_slice:             # <<<<<<<<<<<<<<
25281  *             if new_ndim == 0:
25282  *                 dst.data = (<char **> dst.data)[0] + suboffset
25283  */
25284       goto __pyx_L25;
25285     }
25286 
25287     /* "View.MemoryView":898
25288  *                                      "must be indexed and not sliced", dim)
25289  *         else:
25290  *             suboffset_dim[0] = new_ndim             # <<<<<<<<<<<<<<
25291  *
25292  *     return 0
25293  */
25294     /*else*/ {
25295       (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
25296     }
25297     __pyx_L25:;
25298 
25299     /* "View.MemoryView":890
25300  *         dst.suboffsets[suboffset_dim[0]] += start * stride
25301  *
25302  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
25303  *         if not is_slice:
25304  *             if new_ndim == 0:
25305  */
25306   }
25307 
25308   /* "View.MemoryView":900
25309  *             suboffset_dim[0] = new_ndim
25310  *
25311  *     return 0             # <<<<<<<<<<<<<<
25312  *
25313  *
25314  */
25315   __pyx_r = 0;
25316   goto __pyx_L0;
25317 
25318   /* "View.MemoryView":803
25319  *
25320  * @cname('__pyx_memoryview_slice_memviewslice')
25321  * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
25322  *         __Pyx_memviewslice *dst,
25323  *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
25324  */
25325 
25326   /* function exit code */
25327   __pyx_L1_error:;
25328   {
25329     #ifdef WITH_THREAD
25330     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
25331     #endif
25332     __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
25333     #ifdef WITH_THREAD
25334     __Pyx_PyGILState_Release(__pyx_gilstate_save);
25335     #endif
25336   }
25337   __pyx_r = -1;
25338   __pyx_L0:;
25339   return __pyx_r;
25340 }
25341 
25342 /* "View.MemoryView":906
25343  *
25344  * @cname('__pyx_pybuffer_index')
25345  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
25346  *                           Py_ssize_t dim) except NULL:
25347  *     cdef Py_ssize_t shape, stride, suboffset = -1
25348  */
25349 
25350 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) {
25351   Py_ssize_t __pyx_v_shape;
25352   Py_ssize_t __pyx_v_stride;
25353   Py_ssize_t __pyx_v_suboffset;
25354   Py_ssize_t __pyx_v_itemsize;
25355   char *__pyx_v_resultp;
25356   char *__pyx_r;
25357   __Pyx_RefNannyDeclarations
25358   Py_ssize_t __pyx_t_1;
25359   int __pyx_t_2;
25360   PyObject *__pyx_t_3 = NULL;
25361   PyObject *__pyx_t_4 = NULL;
25362   __Pyx_RefNannySetupContext("pybuffer_index", 0);
25363 
25364   /* "View.MemoryView":908
25365  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
25366  *                           Py_ssize_t dim) except NULL:
25367  *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
25368  *     cdef Py_ssize_t itemsize = view.itemsize
25369  *     cdef char *resultp
25370  */
25371   __pyx_v_suboffset = -1L;
25372 
25373   /* "View.MemoryView":909
25374  *                           Py_ssize_t dim) except NULL:
25375  *     cdef Py_ssize_t shape, stride, suboffset = -1
25376  *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
25377  *     cdef char *resultp
25378  *
25379  */
25380   __pyx_t_1 = __pyx_v_view->itemsize;
25381   __pyx_v_itemsize = __pyx_t_1;
25382 
25383   /* "View.MemoryView":912
25384  *     cdef char *resultp
25385  *
25386  *     if view.ndim == 0:             # <<<<<<<<<<<<<<
25387  *         shape = view.len / itemsize
25388  *         stride = itemsize
25389  */
25390   __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
25391   if (__pyx_t_2) {
25392 
25393     /* "View.MemoryView":913
25394  *
25395  *     if view.ndim == 0:
25396  *         shape = view.len / itemsize             # <<<<<<<<<<<<<<
25397  *         stride = itemsize
25398  *     else:
25399  */
25400     if (unlikely(__pyx_v_itemsize == 0)) {
25401       PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
25402       __PYX_ERR(1, 913, __pyx_L1_error)
25403     }
25404     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))) {
25405       PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
25406       __PYX_ERR(1, 913, __pyx_L1_error)
25407     }
25408     __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
25409 
25410     /* "View.MemoryView":914
25411  *     if view.ndim == 0:
25412  *         shape = view.len / itemsize
25413  *         stride = itemsize             # <<<<<<<<<<<<<<
25414  *     else:
25415  *         shape = view.shape[dim]
25416  */
25417     __pyx_v_stride = __pyx_v_itemsize;
25418 
25419     /* "View.MemoryView":912
25420  *     cdef char *resultp
25421  *
25422  *     if view.ndim == 0:             # <<<<<<<<<<<<<<
25423  *         shape = view.len / itemsize
25424  *         stride = itemsize
25425  */
25426     goto __pyx_L3;
25427   }
25428 
25429   /* "View.MemoryView":916
25430  *         stride = itemsize
25431  *     else:
25432  *         shape = view.shape[dim]             # <<<<<<<<<<<<<<
25433  *         stride = view.strides[dim]
25434  *         if view.suboffsets != NULL:
25435  */
25436   /*else*/ {
25437     __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
25438 
25439     /* "View.MemoryView":917
25440  *     else:
25441  *         shape = view.shape[dim]
25442  *         stride = view.strides[dim]             # <<<<<<<<<<<<<<
25443  *         if view.suboffsets != NULL:
25444  *             suboffset = view.suboffsets[dim]
25445  */
25446     __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
25447 
25448     /* "View.MemoryView":918
25449  *         shape = view.shape[dim]
25450  *         stride = view.strides[dim]
25451  *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
25452  *             suboffset = view.suboffsets[dim]
25453  *
25454  */
25455     __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
25456     if (__pyx_t_2) {
25457 
25458       /* "View.MemoryView":919
25459  *         stride = view.strides[dim]
25460  *         if view.suboffsets != NULL:
25461  *             suboffset = view.suboffsets[dim]             # <<<<<<<<<<<<<<
25462  *
25463  *     if index < 0:
25464  */
25465       __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
25466 
25467       /* "View.MemoryView":918
25468  *         shape = view.shape[dim]
25469  *         stride = view.strides[dim]
25470  *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
25471  *             suboffset = view.suboffsets[dim]
25472  *
25473  */
25474     }
25475   }
25476   __pyx_L3:;
25477 
25478   /* "View.MemoryView":921
25479  *             suboffset = view.suboffsets[dim]
25480  *
25481  *     if index < 0:             # <<<<<<<<<<<<<<
25482  *         index += view.shape[dim]
25483  *         if index < 0:
25484  */
25485   __pyx_t_2 = ((__pyx_v_index < 0) != 0);
25486   if (__pyx_t_2) {
25487 
25488     /* "View.MemoryView":922
25489  *
25490  *     if index < 0:
25491  *         index += view.shape[dim]             # <<<<<<<<<<<<<<
25492  *         if index < 0:
25493  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
25494  */
25495     __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
25496 
25497     /* "View.MemoryView":923
25498  *     if index < 0:
25499  *         index += view.shape[dim]
25500  *         if index < 0:             # <<<<<<<<<<<<<<
25501  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
25502  *
25503  */
25504     __pyx_t_2 = ((__pyx_v_index < 0) != 0);
25505     if (unlikely(__pyx_t_2)) {
25506 
25507       /* "View.MemoryView":924
25508  *         index += view.shape[dim]
25509  *         if index < 0:
25510  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
25511  *
25512  *     if index >= shape:
25513  */
25514       __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 924, __pyx_L1_error)
25515       __Pyx_GOTREF(__pyx_t_3);
25516       __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 924, __pyx_L1_error)
25517       __Pyx_GOTREF(__pyx_t_4);
25518       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25519       __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 924, __pyx_L1_error)
25520       __Pyx_GOTREF(__pyx_t_3);
25521       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
25522       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
25523       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25524       __PYX_ERR(1, 924, __pyx_L1_error)
25525 
25526       /* "View.MemoryView":923
25527  *     if index < 0:
25528  *         index += view.shape[dim]
25529  *         if index < 0:             # <<<<<<<<<<<<<<
25530  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
25531  *
25532  */
25533     }
25534 
25535     /* "View.MemoryView":921
25536  *             suboffset = view.suboffsets[dim]
25537  *
25538  *     if index < 0:             # <<<<<<<<<<<<<<
25539  *         index += view.shape[dim]
25540  *         if index < 0:
25541  */
25542   }
25543 
25544   /* "View.MemoryView":926
25545  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
25546  *
25547  *     if index >= shape:             # <<<<<<<<<<<<<<
25548  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
25549  *
25550  */
25551   __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
25552   if (unlikely(__pyx_t_2)) {
25553 
25554     /* "View.MemoryView":927
25555  *
25556  *     if index >= shape:
25557  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
25558  *
25559  *     resultp = bufp + index * stride
25560  */
25561     __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 927, __pyx_L1_error)
25562     __Pyx_GOTREF(__pyx_t_3);
25563     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 927, __pyx_L1_error)
25564     __Pyx_GOTREF(__pyx_t_4);
25565     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25566     __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 927, __pyx_L1_error)
25567     __Pyx_GOTREF(__pyx_t_3);
25568     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
25569     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
25570     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25571     __PYX_ERR(1, 927, __pyx_L1_error)
25572 
25573     /* "View.MemoryView":926
25574  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
25575  *
25576  *     if index >= shape:             # <<<<<<<<<<<<<<
25577  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
25578  *
25579  */
25580   }
25581 
25582   /* "View.MemoryView":929
25583  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
25584  *
25585  *     resultp = bufp + index * stride             # <<<<<<<<<<<<<<
25586  *     if suboffset >= 0:
25587  *         resultp = (<char **> resultp)[0] + suboffset
25588  */
25589   __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
25590 
25591   /* "View.MemoryView":930
25592  *
25593  *     resultp = bufp + index * stride
25594  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
25595  *         resultp = (<char **> resultp)[0] + suboffset
25596  *
25597  */
25598   __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
25599   if (__pyx_t_2) {
25600 
25601     /* "View.MemoryView":931
25602  *     resultp = bufp + index * stride
25603  *     if suboffset >= 0:
25604  *         resultp = (<char **> resultp)[0] + suboffset             # <<<<<<<<<<<<<<
25605  *
25606  *     return resultp
25607  */
25608     __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
25609 
25610     /* "View.MemoryView":930
25611  *
25612  *     resultp = bufp + index * stride
25613  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
25614  *         resultp = (<char **> resultp)[0] + suboffset
25615  *
25616  */
25617   }
25618 
25619   /* "View.MemoryView":933
25620  *         resultp = (<char **> resultp)[0] + suboffset
25621  *
25622  *     return resultp             # <<<<<<<<<<<<<<
25623  *
25624  *
25625  */
25626   __pyx_r = __pyx_v_resultp;
25627   goto __pyx_L0;
25628 
25629   /* "View.MemoryView":906
25630  *
25631  * @cname('__pyx_pybuffer_index')
25632  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
25633  *                           Py_ssize_t dim) except NULL:
25634  *     cdef Py_ssize_t shape, stride, suboffset = -1
25635  */
25636 
25637   /* function exit code */
25638   __pyx_L1_error:;
25639   __Pyx_XDECREF(__pyx_t_3);
25640   __Pyx_XDECREF(__pyx_t_4);
25641   __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
25642   __pyx_r = NULL;
25643   __pyx_L0:;
25644   __Pyx_RefNannyFinishContext();
25645   return __pyx_r;
25646 }
25647 
25648 /* "View.MemoryView":939
25649  *
25650  * @cname('__pyx_memslice_transpose')
25651  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
25652  *     cdef int ndim = memslice.memview.view.ndim
25653  *
25654  */
25655 
25656 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
25657   int __pyx_v_ndim;
25658   Py_ssize_t *__pyx_v_shape;
25659   Py_ssize_t *__pyx_v_strides;
25660   int __pyx_v_i;
25661   int __pyx_v_j;
25662   int __pyx_r;
25663   int __pyx_t_1;
25664   Py_ssize_t *__pyx_t_2;
25665   long __pyx_t_3;
25666   long __pyx_t_4;
25667   Py_ssize_t __pyx_t_5;
25668   Py_ssize_t __pyx_t_6;
25669   int __pyx_t_7;
25670   int __pyx_t_8;
25671   int __pyx_t_9;
25672 
25673   /* "View.MemoryView":940
25674  * @cname('__pyx_memslice_transpose')
25675  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
25676  *     cdef int ndim = memslice.memview.view.ndim             # <<<<<<<<<<<<<<
25677  *
25678  *     cdef Py_ssize_t *shape = memslice.shape
25679  */
25680   __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
25681   __pyx_v_ndim = __pyx_t_1;
25682 
25683   /* "View.MemoryView":942
25684  *     cdef int ndim = memslice.memview.view.ndim
25685  *
25686  *     cdef Py_ssize_t *shape = memslice.shape             # <<<<<<<<<<<<<<
25687  *     cdef Py_ssize_t *strides = memslice.strides
25688  *
25689  */
25690   __pyx_t_2 = __pyx_v_memslice->shape;
25691   __pyx_v_shape = __pyx_t_2;
25692 
25693   /* "View.MemoryView":943
25694  *
25695  *     cdef Py_ssize_t *shape = memslice.shape
25696  *     cdef Py_ssize_t *strides = memslice.strides             # <<<<<<<<<<<<<<
25697  *
25698  *
25699  */
25700   __pyx_t_2 = __pyx_v_memslice->strides;
25701   __pyx_v_strides = __pyx_t_2;
25702 
25703   /* "View.MemoryView":947
25704  *
25705  *     cdef int i, j
25706  *     for i in range(ndim / 2):             # <<<<<<<<<<<<<<
25707  *         j = ndim - 1 - i
25708  *         strides[i], strides[j] = strides[j], strides[i]
25709  */
25710   __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
25711   __pyx_t_4 = __pyx_t_3;
25712   for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
25713     __pyx_v_i = __pyx_t_1;
25714 
25715     /* "View.MemoryView":948
25716  *     cdef int i, j
25717  *     for i in range(ndim / 2):
25718  *         j = ndim - 1 - i             # <<<<<<<<<<<<<<
25719  *         strides[i], strides[j] = strides[j], strides[i]
25720  *         shape[i], shape[j] = shape[j], shape[i]
25721  */
25722     __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
25723 
25724     /* "View.MemoryView":949
25725  *     for i in range(ndim / 2):
25726  *         j = ndim - 1 - i
25727  *         strides[i], strides[j] = strides[j], strides[i]             # <<<<<<<<<<<<<<
25728  *         shape[i], shape[j] = shape[j], shape[i]
25729  *
25730  */
25731     __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
25732     __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
25733     (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
25734     (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
25735 
25736     /* "View.MemoryView":950
25737  *         j = ndim - 1 - i
25738  *         strides[i], strides[j] = strides[j], strides[i]
25739  *         shape[i], shape[j] = shape[j], shape[i]             # <<<<<<<<<<<<<<
25740  *
25741  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
25742  */
25743     __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
25744     __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
25745     (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
25746     (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
25747 
25748     /* "View.MemoryView":952
25749  *         shape[i], shape[j] = shape[j], shape[i]
25750  *
25751  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
25752  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
25753  *
25754  */
25755     __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
25756     if (!__pyx_t_8) {
25757     } else {
25758       __pyx_t_7 = __pyx_t_8;
25759       goto __pyx_L6_bool_binop_done;
25760     }
25761     __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
25762     __pyx_t_7 = __pyx_t_8;
25763     __pyx_L6_bool_binop_done:;
25764     if (__pyx_t_7) {
25765 
25766       /* "View.MemoryView":953
25767  *
25768  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
25769  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")             # <<<<<<<<<<<<<<
25770  *
25771  *     return 1
25772  */
25773       __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 953, __pyx_L1_error)
25774 
25775       /* "View.MemoryView":952
25776  *         shape[i], shape[j] = shape[j], shape[i]
25777  *
25778  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
25779  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
25780  *
25781  */
25782     }
25783   }
25784 
25785   /* "View.MemoryView":955
25786  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
25787  *
25788  *     return 1             # <<<<<<<<<<<<<<
25789  *
25790  *
25791  */
25792   __pyx_r = 1;
25793   goto __pyx_L0;
25794 
25795   /* "View.MemoryView":939
25796  *
25797  * @cname('__pyx_memslice_transpose')
25798  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
25799  *     cdef int ndim = memslice.memview.view.ndim
25800  *
25801  */
25802 
25803   /* function exit code */
25804   __pyx_L1_error:;
25805   {
25806     #ifdef WITH_THREAD
25807     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
25808     #endif
25809     __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
25810     #ifdef WITH_THREAD
25811     __Pyx_PyGILState_Release(__pyx_gilstate_save);
25812     #endif
25813   }
25814   __pyx_r = 0;
25815   __pyx_L0:;
25816   return __pyx_r;
25817 }
25818 
25819 /* "View.MemoryView":972
25820  *     cdef int (*to_dtype_func)(char *, object) except 0
25821  *
25822  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
25823  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
25824  *
25825  */
25826 
25827 /* Python wrapper */
25828 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
25829 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
25830   __Pyx_RefNannyDeclarations
25831   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
25832   __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
25833 
25834   /* function exit code */
25835   __Pyx_RefNannyFinishContext();
25836 }
25837 
25838 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
25839   __Pyx_RefNannyDeclarations
25840   __Pyx_RefNannySetupContext("__dealloc__", 0);
25841 
25842   /* "View.MemoryView":973
25843  *
25844  *     def __dealloc__(self):
25845  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)             # <<<<<<<<<<<<<<
25846  *
25847  *     cdef convert_item_to_object(self, char *itemp):
25848  */
25849   __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
25850 
25851   /* "View.MemoryView":972
25852  *     cdef int (*to_dtype_func)(char *, object) except 0
25853  *
25854  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
25855  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
25856  *
25857  */
25858 
25859   /* function exit code */
25860   __Pyx_RefNannyFinishContext();
25861 }
25862 
25863 /* "View.MemoryView":975
25864  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
25865  *
25866  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
25867  *         if self.to_object_func != NULL:
25868  *             return self.to_object_func(itemp)
25869  */
25870 
25871 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
25872   PyObject *__pyx_r = NULL;
25873   __Pyx_RefNannyDeclarations
25874   int __pyx_t_1;
25875   PyObject *__pyx_t_2 = NULL;
25876   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
25877 
25878   /* "View.MemoryView":976
25879  *
25880  *     cdef convert_item_to_object(self, char *itemp):
25881  *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
25882  *             return self.to_object_func(itemp)
25883  *         else:
25884  */
25885   __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
25886   if (__pyx_t_1) {
25887 
25888     /* "View.MemoryView":977
25889  *     cdef convert_item_to_object(self, char *itemp):
25890  *         if self.to_object_func != NULL:
25891  *             return self.to_object_func(itemp)             # <<<<<<<<<<<<<<
25892  *         else:
25893  *             return memoryview.convert_item_to_object(self, itemp)
25894  */
25895     __Pyx_XDECREF(__pyx_r);
25896     __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 977, __pyx_L1_error)
25897     __Pyx_GOTREF(__pyx_t_2);
25898     __pyx_r = __pyx_t_2;
25899     __pyx_t_2 = 0;
25900     goto __pyx_L0;
25901 
25902     /* "View.MemoryView":976
25903  *
25904  *     cdef convert_item_to_object(self, char *itemp):
25905  *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
25906  *             return self.to_object_func(itemp)
25907  *         else:
25908  */
25909   }
25910 
25911   /* "View.MemoryView":979
25912  *             return self.to_object_func(itemp)
25913  *         else:
25914  *             return memoryview.convert_item_to_object(self, itemp)             # <<<<<<<<<<<<<<
25915  *
25916  *     cdef assign_item_from_object(self, char *itemp, object value):
25917  */
25918   /*else*/ {
25919     __Pyx_XDECREF(__pyx_r);
25920     __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 979, __pyx_L1_error)
25921     __Pyx_GOTREF(__pyx_t_2);
25922     __pyx_r = __pyx_t_2;
25923     __pyx_t_2 = 0;
25924     goto __pyx_L0;
25925   }
25926 
25927   /* "View.MemoryView":975
25928  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
25929  *
25930  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
25931  *         if self.to_object_func != NULL:
25932  *             return self.to_object_func(itemp)
25933  */
25934 
25935   /* function exit code */
25936   __pyx_L1_error:;
25937   __Pyx_XDECREF(__pyx_t_2);
25938   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
25939   __pyx_r = 0;
25940   __pyx_L0:;
25941   __Pyx_XGIVEREF(__pyx_r);
25942   __Pyx_RefNannyFinishContext();
25943   return __pyx_r;
25944 }
25945 
25946 /* "View.MemoryView":981
25947  *             return memoryview.convert_item_to_object(self, itemp)
25948  *
25949  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
25950  *         if self.to_dtype_func != NULL:
25951  *             self.to_dtype_func(itemp, value)
25952  */
25953 
25954 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
25955   PyObject *__pyx_r = NULL;
25956   __Pyx_RefNannyDeclarations
25957   int __pyx_t_1;
25958   int __pyx_t_2;
25959   PyObject *__pyx_t_3 = NULL;
25960   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
25961 
25962   /* "View.MemoryView":982
25963  *
25964  *     cdef assign_item_from_object(self, char *itemp, object value):
25965  *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
25966  *             self.to_dtype_func(itemp, value)
25967  *         else:
25968  */
25969   __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
25970   if (__pyx_t_1) {
25971 
25972     /* "View.MemoryView":983
25973  *     cdef assign_item_from_object(self, char *itemp, object value):
25974  *         if self.to_dtype_func != NULL:
25975  *             self.to_dtype_func(itemp, value)             # <<<<<<<<<<<<<<
25976  *         else:
25977  *             memoryview.assign_item_from_object(self, itemp, value)
25978  */
25979     __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 983, __pyx_L1_error)
25980 
25981     /* "View.MemoryView":982
25982  *
25983  *     cdef assign_item_from_object(self, char *itemp, object value):
25984  *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
25985  *             self.to_dtype_func(itemp, value)
25986  *         else:
25987  */
25988     goto __pyx_L3;
25989   }
25990 
25991   /* "View.MemoryView":985
25992  *             self.to_dtype_func(itemp, value)
25993  *         else:
25994  *             memoryview.assign_item_from_object(self, itemp, value)             # <<<<<<<<<<<<<<
25995  *
25996  *     @property
25997  */
25998   /*else*/ {
25999     __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 985, __pyx_L1_error)
26000     __Pyx_GOTREF(__pyx_t_3);
26001     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26002   }
26003   __pyx_L3:;
26004 
26005   /* "View.MemoryView":981
26006  *             return memoryview.convert_item_to_object(self, itemp)
26007  *
26008  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
26009  *         if self.to_dtype_func != NULL:
26010  *             self.to_dtype_func(itemp, value)
26011  */
26012 
26013   /* function exit code */
26014   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
26015   goto __pyx_L0;
26016   __pyx_L1_error:;
26017   __Pyx_XDECREF(__pyx_t_3);
26018   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
26019   __pyx_r = 0;
26020   __pyx_L0:;
26021   __Pyx_XGIVEREF(__pyx_r);
26022   __Pyx_RefNannyFinishContext();
26023   return __pyx_r;
26024 }
26025 
26026 /* "View.MemoryView":988
26027  *
26028  *     @property
26029  *     def base(self):             # <<<<<<<<<<<<<<
26030  *         return self.from_object
26031  *
26032  */
26033 
26034 /* Python wrapper */
26035 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
26036 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
26037   PyObject *__pyx_r = 0;
26038   __Pyx_RefNannyDeclarations
26039   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
26040   __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
26041 
26042   /* function exit code */
26043   __Pyx_RefNannyFinishContext();
26044   return __pyx_r;
26045 }
26046 
26047 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
26048   PyObject *__pyx_r = NULL;
26049   __Pyx_RefNannyDeclarations
26050   __Pyx_RefNannySetupContext("__get__", 0);
26051 
26052   /* "View.MemoryView":989
26053  *     @property
26054  *     def base(self):
26055  *         return self.from_object             # <<<<<<<<<<<<<<
26056  *
26057  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
26058  */
26059   __Pyx_XDECREF(__pyx_r);
26060   __Pyx_INCREF(__pyx_v_self->from_object);
26061   __pyx_r = __pyx_v_self->from_object;
26062   goto __pyx_L0;
26063 
26064   /* "View.MemoryView":988
26065  *
26066  *     @property
26067  *     def base(self):             # <<<<<<<<<<<<<<
26068  *         return self.from_object
26069  *
26070  */
26071 
26072   /* function exit code */
26073   __pyx_L0:;
26074   __Pyx_XGIVEREF(__pyx_r);
26075   __Pyx_RefNannyFinishContext();
26076   return __pyx_r;
26077 }
26078 
26079 /* "(tree fragment)":1
26080  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
26081  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
26082  * def __setstate_cython__(self, __pyx_state):
26083  */
26084 
26085 /* Python wrapper */
26086 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
26087 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
26088   PyObject *__pyx_r = 0;
26089   __Pyx_RefNannyDeclarations
26090   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
26091   __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
26092 
26093   /* function exit code */
26094   __Pyx_RefNannyFinishContext();
26095   return __pyx_r;
26096 }
26097 
26098 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
26099   PyObject *__pyx_r = NULL;
26100   __Pyx_RefNannyDeclarations
26101   PyObject *__pyx_t_1 = NULL;
26102   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
26103 
26104   /* "(tree fragment)":2
26105  * def __reduce_cython__(self):
26106  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
26107  * def __setstate_cython__(self, __pyx_state):
26108  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
26109  */
26110   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
26111   __Pyx_GOTREF(__pyx_t_1);
26112   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
26113   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26114   __PYX_ERR(1, 2, __pyx_L1_error)
26115 
26116   /* "(tree fragment)":1
26117  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
26118  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
26119  * def __setstate_cython__(self, __pyx_state):
26120  */
26121 
26122   /* function exit code */
26123   __pyx_L1_error:;
26124   __Pyx_XDECREF(__pyx_t_1);
26125   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26126   __pyx_r = NULL;
26127   __Pyx_XGIVEREF(__pyx_r);
26128   __Pyx_RefNannyFinishContext();
26129   return __pyx_r;
26130 }
26131 
26132 /* "(tree fragment)":3
26133  * def __reduce_cython__(self):
26134  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
26135  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
26136  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
26137  */
26138 
26139 /* Python wrapper */
26140 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
26141 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
26142   PyObject *__pyx_r = 0;
26143   __Pyx_RefNannyDeclarations
26144   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
26145   __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
26146 
26147   /* function exit code */
26148   __Pyx_RefNannyFinishContext();
26149   return __pyx_r;
26150 }
26151 
26152 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) {
26153   PyObject *__pyx_r = NULL;
26154   __Pyx_RefNannyDeclarations
26155   PyObject *__pyx_t_1 = NULL;
26156   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
26157 
26158   /* "(tree fragment)":4
26159  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
26160  * def __setstate_cython__(self, __pyx_state):
26161  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
26162  */
26163   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
26164   __Pyx_GOTREF(__pyx_t_1);
26165   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
26166   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26167   __PYX_ERR(1, 4, __pyx_L1_error)
26168 
26169   /* "(tree fragment)":3
26170  * def __reduce_cython__(self):
26171  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
26172  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
26173  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
26174  */
26175 
26176   /* function exit code */
26177   __pyx_L1_error:;
26178   __Pyx_XDECREF(__pyx_t_1);
26179   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26180   __pyx_r = NULL;
26181   __Pyx_XGIVEREF(__pyx_r);
26182   __Pyx_RefNannyFinishContext();
26183   return __pyx_r;
26184 }
26185 
26186 /* "View.MemoryView":995
26187  *
26188  * @cname('__pyx_memoryview_fromslice')
26189  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
26190  *                           int ndim,
26191  *                           object (*to_object_func)(char *),
26192  */
26193 
26194 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) {
26195   struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
26196   Py_ssize_t __pyx_v_suboffset;
26197   PyObject *__pyx_v_length = NULL;
26198   PyObject *__pyx_r = NULL;
26199   __Pyx_RefNannyDeclarations
26200   int __pyx_t_1;
26201   PyObject *__pyx_t_2 = NULL;
26202   PyObject *__pyx_t_3 = NULL;
26203   __Pyx_TypeInfo *__pyx_t_4;
26204   Py_buffer __pyx_t_5;
26205   Py_ssize_t *__pyx_t_6;
26206   Py_ssize_t *__pyx_t_7;
26207   Py_ssize_t *__pyx_t_8;
26208   Py_ssize_t __pyx_t_9;
26209   __Pyx_RefNannySetupContext("memoryview_fromslice", 0);
26210 
26211   /* "View.MemoryView":1003
26212  *     cdef _memoryviewslice result
26213  *
26214  *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
26215  *         return None
26216  *
26217  */
26218   __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
26219   if (__pyx_t_1) {
26220 
26221     /* "View.MemoryView":1004
26222  *
26223  *     if <PyObject *> memviewslice.memview == Py_None:
26224  *         return None             # <<<<<<<<<<<<<<
26225  *
26226  *
26227  */
26228     __Pyx_XDECREF(__pyx_r);
26229     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
26230     goto __pyx_L0;
26231 
26232     /* "View.MemoryView":1003
26233  *     cdef _memoryviewslice result
26234  *
26235  *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
26236  *         return None
26237  *
26238  */
26239   }
26240 
26241   /* "View.MemoryView":1009
26242  *
26243  *
26244  *     result = _memoryviewslice(None, 0, dtype_is_object)             # <<<<<<<<<<<<<<
26245  *
26246  *     result.from_slice = memviewslice
26247  */
26248   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1009, __pyx_L1_error)
26249   __Pyx_GOTREF(__pyx_t_2);
26250   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1009, __pyx_L1_error)
26251   __Pyx_GOTREF(__pyx_t_3);
26252   __Pyx_INCREF(Py_None);
26253   __Pyx_GIVEREF(Py_None);
26254   PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
26255   __Pyx_INCREF(__pyx_int_0);
26256   __Pyx_GIVEREF(__pyx_int_0);
26257   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
26258   __Pyx_GIVEREF(__pyx_t_2);
26259   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
26260   __pyx_t_2 = 0;
26261   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1009, __pyx_L1_error)
26262   __Pyx_GOTREF(__pyx_t_2);
26263   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26264   __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
26265   __pyx_t_2 = 0;
26266 
26267   /* "View.MemoryView":1011
26268  *     result = _memoryviewslice(None, 0, dtype_is_object)
26269  *
26270  *     result.from_slice = memviewslice             # <<<<<<<<<<<<<<
26271  *     __PYX_INC_MEMVIEW(&memviewslice, 1)
26272  *
26273  */
26274   __pyx_v_result->from_slice = __pyx_v_memviewslice;
26275 
26276   /* "View.MemoryView":1012
26277  *
26278  *     result.from_slice = memviewslice
26279  *     __PYX_INC_MEMVIEW(&memviewslice, 1)             # <<<<<<<<<<<<<<
26280  *
26281  *     result.from_object = (<memoryview> memviewslice.memview).base
26282  */
26283   __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
26284 
26285   /* "View.MemoryView":1014
26286  *     __PYX_INC_MEMVIEW(&memviewslice, 1)
26287  *
26288  *     result.from_object = (<memoryview> memviewslice.memview).base             # <<<<<<<<<<<<<<
26289  *     result.typeinfo = memviewslice.memview.typeinfo
26290  *
26291  */
26292   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1014, __pyx_L1_error)
26293   __Pyx_GOTREF(__pyx_t_2);
26294   __Pyx_GIVEREF(__pyx_t_2);
26295   __Pyx_GOTREF(__pyx_v_result->from_object);
26296   __Pyx_DECREF(__pyx_v_result->from_object);
26297   __pyx_v_result->from_object = __pyx_t_2;
26298   __pyx_t_2 = 0;
26299 
26300   /* "View.MemoryView":1015
26301  *
26302  *     result.from_object = (<memoryview> memviewslice.memview).base
26303  *     result.typeinfo = memviewslice.memview.typeinfo             # <<<<<<<<<<<<<<
26304  *
26305  *     result.view = memviewslice.memview.view
26306  */
26307   __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
26308   __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
26309 
26310   /* "View.MemoryView":1017
26311  *     result.typeinfo = memviewslice.memview.typeinfo
26312  *
26313  *     result.view = memviewslice.memview.view             # <<<<<<<<<<<<<<
26314  *     result.view.buf = <void *> memviewslice.data
26315  *     result.view.ndim = ndim
26316  */
26317   __pyx_t_5 = __pyx_v_memviewslice.memview->view;
26318   __pyx_v_result->__pyx_base.view = __pyx_t_5;
26319 
26320   /* "View.MemoryView":1018
26321  *
26322  *     result.view = memviewslice.memview.view
26323  *     result.view.buf = <void *> memviewslice.data             # <<<<<<<<<<<<<<
26324  *     result.view.ndim = ndim
26325  *     (<__pyx_buffer *> &result.view).obj = Py_None
26326  */
26327   __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
26328 
26329   /* "View.MemoryView":1019
26330  *     result.view = memviewslice.memview.view
26331  *     result.view.buf = <void *> memviewslice.data
26332  *     result.view.ndim = ndim             # <<<<<<<<<<<<<<
26333  *     (<__pyx_buffer *> &result.view).obj = Py_None
26334  *     Py_INCREF(Py_None)
26335  */
26336   __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
26337 
26338   /* "View.MemoryView":1020
26339  *     result.view.buf = <void *> memviewslice.data
26340  *     result.view.ndim = ndim
26341  *     (<__pyx_buffer *> &result.view).obj = Py_None             # <<<<<<<<<<<<<<
26342  *     Py_INCREF(Py_None)
26343  *
26344  */
26345   ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
26346 
26347   /* "View.MemoryView":1021
26348  *     result.view.ndim = ndim
26349  *     (<__pyx_buffer *> &result.view).obj = Py_None
26350  *     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
26351  *
26352  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
26353  */
26354   Py_INCREF(Py_None);
26355 
26356   /* "View.MemoryView":1023
26357  *     Py_INCREF(Py_None)
26358  *
26359  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
26360  *         result.flags = PyBUF_RECORDS
26361  *     else:
26362  */
26363   __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
26364   if (__pyx_t_1) {
26365 
26366     /* "View.MemoryView":1024
26367  *
26368  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
26369  *         result.flags = PyBUF_RECORDS             # <<<<<<<<<<<<<<
26370  *     else:
26371  *         result.flags = PyBUF_RECORDS_RO
26372  */
26373     __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
26374 
26375     /* "View.MemoryView":1023
26376  *     Py_INCREF(Py_None)
26377  *
26378  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
26379  *         result.flags = PyBUF_RECORDS
26380  *     else:
26381  */
26382     goto __pyx_L4;
26383   }
26384 
26385   /* "View.MemoryView":1026
26386  *         result.flags = PyBUF_RECORDS
26387  *     else:
26388  *         result.flags = PyBUF_RECORDS_RO             # <<<<<<<<<<<<<<
26389  *
26390  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
26391  */
26392   /*else*/ {
26393     __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
26394   }
26395   __pyx_L4:;
26396 
26397   /* "View.MemoryView":1028
26398  *         result.flags = PyBUF_RECORDS_RO
26399  *
26400  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape             # <<<<<<<<<<<<<<
26401  *     result.view.strides = <Py_ssize_t *> result.from_slice.strides
26402  *
26403  */
26404   __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
26405 
26406   /* "View.MemoryView":1029
26407  *
26408  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
26409  *     result.view.strides = <Py_ssize_t *> result.from_slice.strides             # <<<<<<<<<<<<<<
26410  *
26411  *
26412  */
26413   __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
26414 
26415   /* "View.MemoryView":1032
26416  *
26417  *
26418  *     result.view.suboffsets = NULL             # <<<<<<<<<<<<<<
26419  *     for suboffset in result.from_slice.suboffsets[:ndim]:
26420  *         if suboffset >= 0:
26421  */
26422   __pyx_v_result->__pyx_base.view.suboffsets = NULL;
26423 
26424   /* "View.MemoryView":1033
26425  *
26426  *     result.view.suboffsets = NULL
26427  *     for suboffset in result.from_slice.suboffsets[:ndim]:             # <<<<<<<<<<<<<<
26428  *         if suboffset >= 0:
26429  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
26430  */
26431   __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
26432   for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
26433     __pyx_t_6 = __pyx_t_8;
26434     __pyx_v_suboffset = (__pyx_t_6[0]);
26435 
26436     /* "View.MemoryView":1034
26437  *     result.view.suboffsets = NULL
26438  *     for suboffset in result.from_slice.suboffsets[:ndim]:
26439  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
26440  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
26441  *             break
26442  */
26443     __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
26444     if (__pyx_t_1) {
26445 
26446       /* "View.MemoryView":1035
26447  *     for suboffset in result.from_slice.suboffsets[:ndim]:
26448  *         if suboffset >= 0:
26449  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets             # <<<<<<<<<<<<<<
26450  *             break
26451  *
26452  */
26453       __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
26454 
26455       /* "View.MemoryView":1036
26456  *         if suboffset >= 0:
26457  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
26458  *             break             # <<<<<<<<<<<<<<
26459  *
26460  *     result.view.len = result.view.itemsize
26461  */
26462       goto __pyx_L6_break;
26463 
26464       /* "View.MemoryView":1034
26465  *     result.view.suboffsets = NULL
26466  *     for suboffset in result.from_slice.suboffsets[:ndim]:
26467  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
26468  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
26469  *             break
26470  */
26471     }
26472   }
26473   __pyx_L6_break:;
26474 
26475   /* "View.MemoryView":1038
26476  *             break
26477  *
26478  *     result.view.len = result.view.itemsize             # <<<<<<<<<<<<<<
26479  *     for length in result.view.shape[:ndim]:
26480  *         result.view.len *= length
26481  */
26482   __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
26483   __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
26484 
26485   /* "View.MemoryView":1039
26486  *
26487  *     result.view.len = result.view.itemsize
26488  *     for length in result.view.shape[:ndim]:             # <<<<<<<<<<<<<<
26489  *         result.view.len *= length
26490  *
26491  */
26492   __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
26493   for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
26494     __pyx_t_6 = __pyx_t_8;
26495     __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1039, __pyx_L1_error)
26496     __Pyx_GOTREF(__pyx_t_2);
26497     __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
26498     __pyx_t_2 = 0;
26499 
26500     /* "View.MemoryView":1040
26501  *     result.view.len = result.view.itemsize
26502  *     for length in result.view.shape[:ndim]:
26503  *         result.view.len *= length             # <<<<<<<<<<<<<<
26504  *
26505  *     result.to_object_func = to_object_func
26506  */
26507     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1040, __pyx_L1_error)
26508     __Pyx_GOTREF(__pyx_t_2);
26509     __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1040, __pyx_L1_error)
26510     __Pyx_GOTREF(__pyx_t_3);
26511     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
26512     __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1040, __pyx_L1_error)
26513     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26514     __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
26515   }
26516 
26517   /* "View.MemoryView":1042
26518  *         result.view.len *= length
26519  *
26520  *     result.to_object_func = to_object_func             # <<<<<<<<<<<<<<
26521  *     result.to_dtype_func = to_dtype_func
26522  *
26523  */
26524   __pyx_v_result->to_object_func = __pyx_v_to_object_func;
26525 
26526   /* "View.MemoryView":1043
26527  *
26528  *     result.to_object_func = to_object_func
26529  *     result.to_dtype_func = to_dtype_func             # <<<<<<<<<<<<<<
26530  *
26531  *     return result
26532  */
26533   __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
26534 
26535   /* "View.MemoryView":1045
26536  *     result.to_dtype_func = to_dtype_func
26537  *
26538  *     return result             # <<<<<<<<<<<<<<
26539  *
26540  * @cname('__pyx_memoryview_get_slice_from_memoryview')
26541  */
26542   __Pyx_XDECREF(__pyx_r);
26543   __Pyx_INCREF(((PyObject *)__pyx_v_result));
26544   __pyx_r = ((PyObject *)__pyx_v_result);
26545   goto __pyx_L0;
26546 
26547   /* "View.MemoryView":995
26548  *
26549  * @cname('__pyx_memoryview_fromslice')
26550  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
26551  *                           int ndim,
26552  *                           object (*to_object_func)(char *),
26553  */
26554 
26555   /* function exit code */
26556   __pyx_L1_error:;
26557   __Pyx_XDECREF(__pyx_t_2);
26558   __Pyx_XDECREF(__pyx_t_3);
26559   __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
26560   __pyx_r = 0;
26561   __pyx_L0:;
26562   __Pyx_XDECREF((PyObject *)__pyx_v_result);
26563   __Pyx_XDECREF(__pyx_v_length);
26564   __Pyx_XGIVEREF(__pyx_r);
26565   __Pyx_RefNannyFinishContext();
26566   return __pyx_r;
26567 }
26568 
26569 /* "View.MemoryView":1048
26570  *
26571  * @cname('__pyx_memoryview_get_slice_from_memoryview')
26572  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
26573  *                                                    __Pyx_memviewslice *mslice):
26574  *     cdef _memoryviewslice obj
26575  */
26576 
26577 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
26578   struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
26579   __Pyx_memviewslice *__pyx_r;
26580   __Pyx_RefNannyDeclarations
26581   int __pyx_t_1;
26582   int __pyx_t_2;
26583   PyObject *__pyx_t_3 = NULL;
26584   __Pyx_RefNannySetupContext("get_slice_from_memview", 0);
26585 
26586   /* "View.MemoryView":1051
26587  *                                                    __Pyx_memviewslice *mslice):
26588  *     cdef _memoryviewslice obj
26589  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
26590  *         obj = memview
26591  *         return &obj.from_slice
26592  */
26593   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
26594   __pyx_t_2 = (__pyx_t_1 != 0);
26595   if (__pyx_t_2) {
26596 
26597     /* "View.MemoryView":1052
26598  *     cdef _memoryviewslice obj
26599  *     if isinstance(memview, _memoryviewslice):
26600  *         obj = memview             # <<<<<<<<<<<<<<
26601  *         return &obj.from_slice
26602  *     else:
26603  */
26604     if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 1052, __pyx_L1_error)
26605     __pyx_t_3 = ((PyObject *)__pyx_v_memview);
26606     __Pyx_INCREF(__pyx_t_3);
26607     __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
26608     __pyx_t_3 = 0;
26609 
26610     /* "View.MemoryView":1053
26611  *     if isinstance(memview, _memoryviewslice):
26612  *         obj = memview
26613  *         return &obj.from_slice             # <<<<<<<<<<<<<<
26614  *     else:
26615  *         slice_copy(memview, mslice)
26616  */
26617     __pyx_r = (&__pyx_v_obj->from_slice);
26618     goto __pyx_L0;
26619 
26620     /* "View.MemoryView":1051
26621  *                                                    __Pyx_memviewslice *mslice):
26622  *     cdef _memoryviewslice obj
26623  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
26624  *         obj = memview
26625  *         return &obj.from_slice
26626  */
26627   }
26628 
26629   /* "View.MemoryView":1055
26630  *         return &obj.from_slice
26631  *     else:
26632  *         slice_copy(memview, mslice)             # <<<<<<<<<<<<<<
26633  *         return mslice
26634  *
26635  */
26636   /*else*/ {
26637     __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
26638 
26639     /* "View.MemoryView":1056
26640  *     else:
26641  *         slice_copy(memview, mslice)
26642  *         return mslice             # <<<<<<<<<<<<<<
26643  *
26644  * @cname('__pyx_memoryview_slice_copy')
26645  */
26646     __pyx_r = __pyx_v_mslice;
26647     goto __pyx_L0;
26648   }
26649 
26650   /* "View.MemoryView":1048
26651  *
26652  * @cname('__pyx_memoryview_get_slice_from_memoryview')
26653  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
26654  *                                                    __Pyx_memviewslice *mslice):
26655  *     cdef _memoryviewslice obj
26656  */
26657 
26658   /* function exit code */
26659   __pyx_L1_error:;
26660   __Pyx_XDECREF(__pyx_t_3);
26661   __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
26662   __pyx_r = 0;
26663   __pyx_L0:;
26664   __Pyx_XDECREF((PyObject *)__pyx_v_obj);
26665   __Pyx_RefNannyFinishContext();
26666   return __pyx_r;
26667 }
26668 
26669 /* "View.MemoryView":1059
26670  *
26671  * @cname('__pyx_memoryview_slice_copy')
26672  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
26673  *     cdef int dim
26674  *     cdef (Py_ssize_t*) shape, strides, suboffsets
26675  */
26676 
26677 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
26678   int __pyx_v_dim;
26679   Py_ssize_t *__pyx_v_shape;
26680   Py_ssize_t *__pyx_v_strides;
26681   Py_ssize_t *__pyx_v_suboffsets;
26682   __Pyx_RefNannyDeclarations
26683   Py_ssize_t *__pyx_t_1;
26684   int __pyx_t_2;
26685   int __pyx_t_3;
26686   int __pyx_t_4;
26687   Py_ssize_t __pyx_t_5;
26688   __Pyx_RefNannySetupContext("slice_copy", 0);
26689 
26690   /* "View.MemoryView":1063
26691  *     cdef (Py_ssize_t*) shape, strides, suboffsets
26692  *
26693  *     shape = memview.view.shape             # <<<<<<<<<<<<<<
26694  *     strides = memview.view.strides
26695  *     suboffsets = memview.view.suboffsets
26696  */
26697   __pyx_t_1 = __pyx_v_memview->view.shape;
26698   __pyx_v_shape = __pyx_t_1;
26699 
26700   /* "View.MemoryView":1064
26701  *
26702  *     shape = memview.view.shape
26703  *     strides = memview.view.strides             # <<<<<<<<<<<<<<
26704  *     suboffsets = memview.view.suboffsets
26705  *
26706  */
26707   __pyx_t_1 = __pyx_v_memview->view.strides;
26708   __pyx_v_strides = __pyx_t_1;
26709 
26710   /* "View.MemoryView":1065
26711  *     shape = memview.view.shape
26712  *     strides = memview.view.strides
26713  *     suboffsets = memview.view.suboffsets             # <<<<<<<<<<<<<<
26714  *
26715  *     dst.memview = <__pyx_memoryview *> memview
26716  */
26717   __pyx_t_1 = __pyx_v_memview->view.suboffsets;
26718   __pyx_v_suboffsets = __pyx_t_1;
26719 
26720   /* "View.MemoryView":1067
26721  *     suboffsets = memview.view.suboffsets
26722  *
26723  *     dst.memview = <__pyx_memoryview *> memview             # <<<<<<<<<<<<<<
26724  *     dst.data = <char *> memview.view.buf
26725  *
26726  */
26727   __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);
26728 
26729   /* "View.MemoryView":1068
26730  *
26731  *     dst.memview = <__pyx_memoryview *> memview
26732  *     dst.data = <char *> memview.view.buf             # <<<<<<<<<<<<<<
26733  *
26734  *     for dim in range(memview.view.ndim):
26735  */
26736   __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);
26737 
26738   /* "View.MemoryView":1070
26739  *     dst.data = <char *> memview.view.buf
26740  *
26741  *     for dim in range(memview.view.ndim):             # <<<<<<<<<<<<<<
26742  *         dst.shape[dim] = shape[dim]
26743  *         dst.strides[dim] = strides[dim]
26744  */
26745   __pyx_t_2 = __pyx_v_memview->view.ndim;
26746   __pyx_t_3 = __pyx_t_2;
26747   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
26748     __pyx_v_dim = __pyx_t_4;
26749 
26750     /* "View.MemoryView":1071
26751  *
26752  *     for dim in range(memview.view.ndim):
26753  *         dst.shape[dim] = shape[dim]             # <<<<<<<<<<<<<<
26754  *         dst.strides[dim] = strides[dim]
26755  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
26756  */
26757     (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
26758 
26759     /* "View.MemoryView":1072
26760  *     for dim in range(memview.view.ndim):
26761  *         dst.shape[dim] = shape[dim]
26762  *         dst.strides[dim] = strides[dim]             # <<<<<<<<<<<<<<
26763  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
26764  *
26765  */
26766     (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
26767 
26768     /* "View.MemoryView":1073
26769  *         dst.shape[dim] = shape[dim]
26770  *         dst.strides[dim] = strides[dim]
26771  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1             # <<<<<<<<<<<<<<
26772  *
26773  * @cname('__pyx_memoryview_copy_object')
26774  */
26775     if ((__pyx_v_suboffsets != 0)) {
26776       __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
26777     } else {
26778       __pyx_t_5 = -1L;
26779     }
26780     (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
26781   }
26782 
26783   /* "View.MemoryView":1059
26784  *
26785  * @cname('__pyx_memoryview_slice_copy')
26786  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
26787  *     cdef int dim
26788  *     cdef (Py_ssize_t*) shape, strides, suboffsets
26789  */
26790 
26791   /* function exit code */
26792   __Pyx_RefNannyFinishContext();
26793 }
26794 
26795 /* "View.MemoryView":1076
26796  *
26797  * @cname('__pyx_memoryview_copy_object')
26798  * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
26799  *     "Create a new memoryview object"
26800  *     cdef __Pyx_memviewslice memviewslice
26801  */
26802 
26803 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
26804   __Pyx_memviewslice __pyx_v_memviewslice;
26805   PyObject *__pyx_r = NULL;
26806   __Pyx_RefNannyDeclarations
26807   PyObject *__pyx_t_1 = NULL;
26808   __Pyx_RefNannySetupContext("memoryview_copy", 0);
26809 
26810   /* "View.MemoryView":1079
26811  *     "Create a new memoryview object"
26812  *     cdef __Pyx_memviewslice memviewslice
26813  *     slice_copy(memview, &memviewslice)             # <<<<<<<<<<<<<<
26814  *     return memoryview_copy_from_slice(memview, &memviewslice)
26815  *
26816  */
26817   __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
26818 
26819   /* "View.MemoryView":1080
26820  *     cdef __Pyx_memviewslice memviewslice
26821  *     slice_copy(memview, &memviewslice)
26822  *     return memoryview_copy_from_slice(memview, &memviewslice)             # <<<<<<<<<<<<<<
26823  *
26824  * @cname('__pyx_memoryview_copy_object_from_slice')
26825  */
26826   __Pyx_XDECREF(__pyx_r);
26827   __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1080, __pyx_L1_error)
26828   __Pyx_GOTREF(__pyx_t_1);
26829   __pyx_r = __pyx_t_1;
26830   __pyx_t_1 = 0;
26831   goto __pyx_L0;
26832 
26833   /* "View.MemoryView":1076
26834  *
26835  * @cname('__pyx_memoryview_copy_object')
26836  * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
26837  *     "Create a new memoryview object"
26838  *     cdef __Pyx_memviewslice memviewslice
26839  */
26840 
26841   /* function exit code */
26842   __pyx_L1_error:;
26843   __Pyx_XDECREF(__pyx_t_1);
26844   __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
26845   __pyx_r = 0;
26846   __pyx_L0:;
26847   __Pyx_XGIVEREF(__pyx_r);
26848   __Pyx_RefNannyFinishContext();
26849   return __pyx_r;
26850 }
26851 
26852 /* "View.MemoryView":1083
26853  *
26854  * @cname('__pyx_memoryview_copy_object_from_slice')
26855  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
26856  *     """
26857  *     Create a new memoryview object from a given memoryview object and slice.
26858  */
26859 
26860 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
26861   PyObject *(*__pyx_v_to_object_func)(char *);
26862   int (*__pyx_v_to_dtype_func)(char *, PyObject *);
26863   PyObject *__pyx_r = NULL;
26864   __Pyx_RefNannyDeclarations
26865   int __pyx_t_1;
26866   int __pyx_t_2;
26867   PyObject *(*__pyx_t_3)(char *);
26868   int (*__pyx_t_4)(char *, PyObject *);
26869   PyObject *__pyx_t_5 = NULL;
26870   __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);
26871 
26872   /* "View.MemoryView":1090
26873  *     cdef int (*to_dtype_func)(char *, object) except 0
26874  *
26875  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
26876  *         to_object_func = (<_memoryviewslice> memview).to_object_func
26877  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
26878  */
26879   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
26880   __pyx_t_2 = (__pyx_t_1 != 0);
26881   if (__pyx_t_2) {
26882 
26883     /* "View.MemoryView":1091
26884  *
26885  *     if isinstance(memview, _memoryviewslice):
26886  *         to_object_func = (<_memoryviewslice> memview).to_object_func             # <<<<<<<<<<<<<<
26887  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
26888  *     else:
26889  */
26890     __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
26891     __pyx_v_to_object_func = __pyx_t_3;
26892 
26893     /* "View.MemoryView":1092
26894  *     if isinstance(memview, _memoryviewslice):
26895  *         to_object_func = (<_memoryviewslice> memview).to_object_func
26896  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func             # <<<<<<<<<<<<<<
26897  *     else:
26898  *         to_object_func = NULL
26899  */
26900     __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
26901     __pyx_v_to_dtype_func = __pyx_t_4;
26902 
26903     /* "View.MemoryView":1090
26904  *     cdef int (*to_dtype_func)(char *, object) except 0
26905  *
26906  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
26907  *         to_object_func = (<_memoryviewslice> memview).to_object_func
26908  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
26909  */
26910     goto __pyx_L3;
26911   }
26912 
26913   /* "View.MemoryView":1094
26914  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
26915  *     else:
26916  *         to_object_func = NULL             # <<<<<<<<<<<<<<
26917  *         to_dtype_func = NULL
26918  *
26919  */
26920   /*else*/ {
26921     __pyx_v_to_object_func = NULL;
26922 
26923     /* "View.MemoryView":1095
26924  *     else:
26925  *         to_object_func = NULL
26926  *         to_dtype_func = NULL             # <<<<<<<<<<<<<<
26927  *
26928  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
26929  */
26930     __pyx_v_to_dtype_func = NULL;
26931   }
26932   __pyx_L3:;
26933 
26934   /* "View.MemoryView":1097
26935  *         to_dtype_func = NULL
26936  *
26937  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,             # <<<<<<<<<<<<<<
26938  *                                 to_object_func, to_dtype_func,
26939  *                                 memview.dtype_is_object)
26940  */
26941   __Pyx_XDECREF(__pyx_r);
26942 
26943   /* "View.MemoryView":1099
26944  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
26945  *                                 to_object_func, to_dtype_func,
26946  *                                 memview.dtype_is_object)             # <<<<<<<<<<<<<<
26947  *
26948  *
26949  */
26950   __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1097, __pyx_L1_error)
26951   __Pyx_GOTREF(__pyx_t_5);
26952   __pyx_r = __pyx_t_5;
26953   __pyx_t_5 = 0;
26954   goto __pyx_L0;
26955 
26956   /* "View.MemoryView":1083
26957  *
26958  * @cname('__pyx_memoryview_copy_object_from_slice')
26959  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
26960  *     """
26961  *     Create a new memoryview object from a given memoryview object and slice.
26962  */
26963 
26964   /* function exit code */
26965   __pyx_L1_error:;
26966   __Pyx_XDECREF(__pyx_t_5);
26967   __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
26968   __pyx_r = 0;
26969   __pyx_L0:;
26970   __Pyx_XGIVEREF(__pyx_r);
26971   __Pyx_RefNannyFinishContext();
26972   return __pyx_r;
26973 }
26974 
26975 /* "View.MemoryView":1105
26976  *
26977  *
26978  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
26979  *     if arg < 0:
26980  *         return -arg
26981  */
26982 
26983 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
26984   Py_ssize_t __pyx_r;
26985   int __pyx_t_1;
26986 
26987   /* "View.MemoryView":1106
26988  *
26989  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
26990  *     if arg < 0:             # <<<<<<<<<<<<<<
26991  *         return -arg
26992  *     else:
26993  */
26994   __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
26995   if (__pyx_t_1) {
26996 
26997     /* "View.MemoryView":1107
26998  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
26999  *     if arg < 0:
27000  *         return -arg             # <<<<<<<<<<<<<<
27001  *     else:
27002  *         return arg
27003  */
27004     __pyx_r = (-__pyx_v_arg);
27005     goto __pyx_L0;
27006 
27007     /* "View.MemoryView":1106
27008  *
27009  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
27010  *     if arg < 0:             # <<<<<<<<<<<<<<
27011  *         return -arg
27012  *     else:
27013  */
27014   }
27015 
27016   /* "View.MemoryView":1109
27017  *         return -arg
27018  *     else:
27019  *         return arg             # <<<<<<<<<<<<<<
27020  *
27021  * @cname('__pyx_get_best_slice_order')
27022  */
27023   /*else*/ {
27024     __pyx_r = __pyx_v_arg;
27025     goto __pyx_L0;
27026   }
27027 
27028   /* "View.MemoryView":1105
27029  *
27030  *
27031  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
27032  *     if arg < 0:
27033  *         return -arg
27034  */
27035 
27036   /* function exit code */
27037   __pyx_L0:;
27038   return __pyx_r;
27039 }
27040 
27041 /* "View.MemoryView":1112
27042  *
27043  * @cname('__pyx_get_best_slice_order')
27044  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
27045  *     """
27046  *     Figure out the best memory access order for a given slice.
27047  */
27048 
27049 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
27050   int __pyx_v_i;
27051   Py_ssize_t __pyx_v_c_stride;
27052   Py_ssize_t __pyx_v_f_stride;
27053   char __pyx_r;
27054   int __pyx_t_1;
27055   int __pyx_t_2;
27056   int __pyx_t_3;
27057   int __pyx_t_4;
27058 
27059   /* "View.MemoryView":1117
27060  *     """
27061  *     cdef int i
27062  *     cdef Py_ssize_t c_stride = 0             # <<<<<<<<<<<<<<
27063  *     cdef Py_ssize_t f_stride = 0
27064  *
27065  */
27066   __pyx_v_c_stride = 0;
27067 
27068   /* "View.MemoryView":1118
27069  *     cdef int i
27070  *     cdef Py_ssize_t c_stride = 0
27071  *     cdef Py_ssize_t f_stride = 0             # <<<<<<<<<<<<<<
27072  *
27073  *     for i in range(ndim - 1, -1, -1):
27074  */
27075   __pyx_v_f_stride = 0;
27076 
27077   /* "View.MemoryView":1120
27078  *     cdef Py_ssize_t f_stride = 0
27079  *
27080  *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
27081  *         if mslice.shape[i] > 1:
27082  *             c_stride = mslice.strides[i]
27083  */
27084   for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
27085     __pyx_v_i = __pyx_t_1;
27086 
27087     /* "View.MemoryView":1121
27088  *
27089  *     for i in range(ndim - 1, -1, -1):
27090  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
27091  *             c_stride = mslice.strides[i]
27092  *             break
27093  */
27094     __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
27095     if (__pyx_t_2) {
27096 
27097       /* "View.MemoryView":1122
27098  *     for i in range(ndim - 1, -1, -1):
27099  *         if mslice.shape[i] > 1:
27100  *             c_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
27101  *             break
27102  *
27103  */
27104       __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
27105 
27106       /* "View.MemoryView":1123
27107  *         if mslice.shape[i] > 1:
27108  *             c_stride = mslice.strides[i]
27109  *             break             # <<<<<<<<<<<<<<
27110  *
27111  *     for i in range(ndim):
27112  */
27113       goto __pyx_L4_break;
27114 
27115       /* "View.MemoryView":1121
27116  *
27117  *     for i in range(ndim - 1, -1, -1):
27118  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
27119  *             c_stride = mslice.strides[i]
27120  *             break
27121  */
27122     }
27123   }
27124   __pyx_L4_break:;
27125 
27126   /* "View.MemoryView":1125
27127  *             break
27128  *
27129  *     for i in range(ndim):             # <<<<<<<<<<<<<<
27130  *         if mslice.shape[i] > 1:
27131  *             f_stride = mslice.strides[i]
27132  */
27133   __pyx_t_1 = __pyx_v_ndim;
27134   __pyx_t_3 = __pyx_t_1;
27135   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
27136     __pyx_v_i = __pyx_t_4;
27137 
27138     /* "View.MemoryView":1126
27139  *
27140  *     for i in range(ndim):
27141  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
27142  *             f_stride = mslice.strides[i]
27143  *             break
27144  */
27145     __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
27146     if (__pyx_t_2) {
27147 
27148       /* "View.MemoryView":1127
27149  *     for i in range(ndim):
27150  *         if mslice.shape[i] > 1:
27151  *             f_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
27152  *             break
27153  *
27154  */
27155       __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
27156 
27157       /* "View.MemoryView":1128
27158  *         if mslice.shape[i] > 1:
27159  *             f_stride = mslice.strides[i]
27160  *             break             # <<<<<<<<<<<<<<
27161  *
27162  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
27163  */
27164       goto __pyx_L7_break;
27165 
27166       /* "View.MemoryView":1126
27167  *
27168  *     for i in range(ndim):
27169  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
27170  *             f_stride = mslice.strides[i]
27171  *             break
27172  */
27173     }
27174   }
27175   __pyx_L7_break:;
27176 
27177   /* "View.MemoryView":1130
27178  *             break
27179  *
27180  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
27181  *         return 'C'
27182  *     else:
27183  */
27184   __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
27185   if (__pyx_t_2) {
27186 
27187     /* "View.MemoryView":1131
27188  *
27189  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
27190  *         return 'C'             # <<<<<<<<<<<<<<
27191  *     else:
27192  *         return 'F'
27193  */
27194     __pyx_r = 'C';
27195     goto __pyx_L0;
27196 
27197     /* "View.MemoryView":1130
27198  *             break
27199  *
27200  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
27201  *         return 'C'
27202  *     else:
27203  */
27204   }
27205 
27206   /* "View.MemoryView":1133
27207  *         return 'C'
27208  *     else:
27209  *         return 'F'             # <<<<<<<<<<<<<<
27210  *
27211  * @cython.cdivision(True)
27212  */
27213   /*else*/ {
27214     __pyx_r = 'F';
27215     goto __pyx_L0;
27216   }
27217 
27218   /* "View.MemoryView":1112
27219  *
27220  * @cname('__pyx_get_best_slice_order')
27221  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
27222  *     """
27223  *     Figure out the best memory access order for a given slice.
27224  */
27225 
27226   /* function exit code */
27227   __pyx_L0:;
27228   return __pyx_r;
27229 }
27230 
27231 /* "View.MemoryView":1136
27232  *
27233  * @cython.cdivision(True)
27234  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
27235  *                                    char *dst_data, Py_ssize_t *dst_strides,
27236  *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
27237  */
27238 
27239 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) {
27240   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
27241   CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
27242   Py_ssize_t __pyx_v_dst_extent;
27243   Py_ssize_t __pyx_v_src_stride;
27244   Py_ssize_t __pyx_v_dst_stride;
27245   int __pyx_t_1;
27246   int __pyx_t_2;
27247   int __pyx_t_3;
27248   Py_ssize_t __pyx_t_4;
27249   Py_ssize_t __pyx_t_5;
27250   Py_ssize_t __pyx_t_6;
27251 
27252   /* "View.MemoryView":1143
27253  *
27254  *     cdef Py_ssize_t i
27255  *     cdef Py_ssize_t src_extent = src_shape[0]             # <<<<<<<<<<<<<<
27256  *     cdef Py_ssize_t dst_extent = dst_shape[0]
27257  *     cdef Py_ssize_t src_stride = src_strides[0]
27258  */
27259   __pyx_v_src_extent = (__pyx_v_src_shape[0]);
27260 
27261   /* "View.MemoryView":1144
27262  *     cdef Py_ssize_t i
27263  *     cdef Py_ssize_t src_extent = src_shape[0]
27264  *     cdef Py_ssize_t dst_extent = dst_shape[0]             # <<<<<<<<<<<<<<
27265  *     cdef Py_ssize_t src_stride = src_strides[0]
27266  *     cdef Py_ssize_t dst_stride = dst_strides[0]
27267  */
27268   __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
27269 
27270   /* "View.MemoryView":1145
27271  *     cdef Py_ssize_t src_extent = src_shape[0]
27272  *     cdef Py_ssize_t dst_extent = dst_shape[0]
27273  *     cdef Py_ssize_t src_stride = src_strides[0]             # <<<<<<<<<<<<<<
27274  *     cdef Py_ssize_t dst_stride = dst_strides[0]
27275  *
27276  */
27277   __pyx_v_src_stride = (__pyx_v_src_strides[0]);
27278 
27279   /* "View.MemoryView":1146
27280  *     cdef Py_ssize_t dst_extent = dst_shape[0]
27281  *     cdef Py_ssize_t src_stride = src_strides[0]
27282  *     cdef Py_ssize_t dst_stride = dst_strides[0]             # <<<<<<<<<<<<<<
27283  *
27284  *     if ndim == 1:
27285  */
27286   __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
27287 
27288   /* "View.MemoryView":1148
27289  *     cdef Py_ssize_t dst_stride = dst_strides[0]
27290  *
27291  *     if ndim == 1:             # <<<<<<<<<<<<<<
27292  *        if (src_stride > 0 and dst_stride > 0 and
27293  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
27294  */
27295   __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
27296   if (__pyx_t_1) {
27297 
27298     /* "View.MemoryView":1149
27299  *
27300  *     if ndim == 1:
27301  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
27302  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
27303  *            memcpy(dst_data, src_data, itemsize * dst_extent)
27304  */
27305     __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
27306     if (__pyx_t_2) {
27307     } else {
27308       __pyx_t_1 = __pyx_t_2;
27309       goto __pyx_L5_bool_binop_done;
27310     }
27311     __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
27312     if (__pyx_t_2) {
27313     } else {
27314       __pyx_t_1 = __pyx_t_2;
27315       goto __pyx_L5_bool_binop_done;
27316     }
27317 
27318     /* "View.MemoryView":1150
27319  *     if ndim == 1:
27320  *        if (src_stride > 0 and dst_stride > 0 and
27321  *            <size_t> src_stride == itemsize == <size_t> dst_stride):             # <<<<<<<<<<<<<<
27322  *            memcpy(dst_data, src_data, itemsize * dst_extent)
27323  *        else:
27324  */
27325     __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
27326     if (__pyx_t_2) {
27327       __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
27328     }
27329     __pyx_t_3 = (__pyx_t_2 != 0);
27330     __pyx_t_1 = __pyx_t_3;
27331     __pyx_L5_bool_binop_done:;
27332 
27333     /* "View.MemoryView":1149
27334  *
27335  *     if ndim == 1:
27336  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
27337  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
27338  *            memcpy(dst_data, src_data, itemsize * dst_extent)
27339  */
27340     if (__pyx_t_1) {
27341 
27342       /* "View.MemoryView":1151
27343  *        if (src_stride > 0 and dst_stride > 0 and
27344  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
27345  *            memcpy(dst_data, src_data, itemsize * dst_extent)             # <<<<<<<<<<<<<<
27346  *        else:
27347  *            for i in range(dst_extent):
27348  */
27349       (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
27350 
27351       /* "View.MemoryView":1149
27352  *
27353  *     if ndim == 1:
27354  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
27355  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
27356  *            memcpy(dst_data, src_data, itemsize * dst_extent)
27357  */
27358       goto __pyx_L4;
27359     }
27360 
27361     /* "View.MemoryView":1153
27362  *            memcpy(dst_data, src_data, itemsize * dst_extent)
27363  *        else:
27364  *            for i in range(dst_extent):             # <<<<<<<<<<<<<<
27365  *                memcpy(dst_data, src_data, itemsize)
27366  *                src_data += src_stride
27367  */
27368     /*else*/ {
27369       __pyx_t_4 = __pyx_v_dst_extent;
27370       __pyx_t_5 = __pyx_t_4;
27371       for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
27372         __pyx_v_i = __pyx_t_6;
27373 
27374         /* "View.MemoryView":1154
27375  *        else:
27376  *            for i in range(dst_extent):
27377  *                memcpy(dst_data, src_data, itemsize)             # <<<<<<<<<<<<<<
27378  *                src_data += src_stride
27379  *                dst_data += dst_stride
27380  */
27381         (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
27382 
27383         /* "View.MemoryView":1155
27384  *            for i in range(dst_extent):
27385  *                memcpy(dst_data, src_data, itemsize)
27386  *                src_data += src_stride             # <<<<<<<<<<<<<<
27387  *                dst_data += dst_stride
27388  *     else:
27389  */
27390         __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
27391 
27392         /* "View.MemoryView":1156
27393  *                memcpy(dst_data, src_data, itemsize)
27394  *                src_data += src_stride
27395  *                dst_data += dst_stride             # <<<<<<<<<<<<<<
27396  *     else:
27397  *         for i in range(dst_extent):
27398  */
27399         __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
27400       }
27401     }
27402     __pyx_L4:;
27403 
27404     /* "View.MemoryView":1148
27405  *     cdef Py_ssize_t dst_stride = dst_strides[0]
27406  *
27407  *     if ndim == 1:             # <<<<<<<<<<<<<<
27408  *        if (src_stride > 0 and dst_stride > 0 and
27409  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
27410  */
27411     goto __pyx_L3;
27412   }
27413 
27414   /* "View.MemoryView":1158
27415  *                dst_data += dst_stride
27416  *     else:
27417  *         for i in range(dst_extent):             # <<<<<<<<<<<<<<
27418  *             _copy_strided_to_strided(src_data, src_strides + 1,
27419  *                                      dst_data, dst_strides + 1,
27420  */
27421   /*else*/ {
27422     __pyx_t_4 = __pyx_v_dst_extent;
27423     __pyx_t_5 = __pyx_t_4;
27424     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
27425       __pyx_v_i = __pyx_t_6;
27426 
27427       /* "View.MemoryView":1159
27428  *     else:
27429  *         for i in range(dst_extent):
27430  *             _copy_strided_to_strided(src_data, src_strides + 1,             # <<<<<<<<<<<<<<
27431  *                                      dst_data, dst_strides + 1,
27432  *                                      src_shape + 1, dst_shape + 1,
27433  */
27434       _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);
27435 
27436       /* "View.MemoryView":1163
27437  *                                      src_shape + 1, dst_shape + 1,
27438  *                                      ndim - 1, itemsize)
27439  *             src_data += src_stride             # <<<<<<<<<<<<<<
27440  *             dst_data += dst_stride
27441  *
27442  */
27443       __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
27444 
27445       /* "View.MemoryView":1164
27446  *                                      ndim - 1, itemsize)
27447  *             src_data += src_stride
27448  *             dst_data += dst_stride             # <<<<<<<<<<<<<<
27449  *
27450  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
27451  */
27452       __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
27453     }
27454   }
27455   __pyx_L3:;
27456 
27457   /* "View.MemoryView":1136
27458  *
27459  * @cython.cdivision(True)
27460  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
27461  *                                    char *dst_data, Py_ssize_t *dst_strides,
27462  *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
27463  */
27464 
27465   /* function exit code */
27466 }
27467 
27468 /* "View.MemoryView":1166
27469  *             dst_data += dst_stride
27470  *
27471  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
27472  *                                   __Pyx_memviewslice *dst,
27473  *                                   int ndim, size_t itemsize) nogil:
27474  */
27475 
27476 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) {
27477 
27478   /* "View.MemoryView":1169
27479  *                                   __Pyx_memviewslice *dst,
27480  *                                   int ndim, size_t itemsize) nogil:
27481  *     _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides,             # <<<<<<<<<<<<<<
27482  *                              src.shape, dst.shape, ndim, itemsize)
27483  *
27484  */
27485   _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);
27486 
27487   /* "View.MemoryView":1166
27488  *             dst_data += dst_stride
27489  *
27490  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
27491  *                                   __Pyx_memviewslice *dst,
27492  *                                   int ndim, size_t itemsize) nogil:
27493  */
27494 
27495   /* function exit code */
27496 }
27497 
27498 /* "View.MemoryView":1173
27499  *
27500  * @cname('__pyx_memoryview_slice_get_size')
27501  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
27502  *     "Return the size of the memory occupied by the slice in number of bytes"
27503  *     cdef int i
27504  */
27505 
27506 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
27507   int __pyx_v_i;
27508   Py_ssize_t __pyx_v_size;
27509   Py_ssize_t __pyx_r;
27510   Py_ssize_t __pyx_t_1;
27511   int __pyx_t_2;
27512   int __pyx_t_3;
27513   int __pyx_t_4;
27514 
27515   /* "View.MemoryView":1176
27516  *     "Return the size of the memory occupied by the slice in number of bytes"
27517  *     cdef int i
27518  *     cdef Py_ssize_t size = src.memview.view.itemsize             # <<<<<<<<<<<<<<
27519  *
27520  *     for i in range(ndim):
27521  */
27522   __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
27523   __pyx_v_size = __pyx_t_1;
27524 
27525   /* "View.MemoryView":1178
27526  *     cdef Py_ssize_t size = src.memview.view.itemsize
27527  *
27528  *     for i in range(ndim):             # <<<<<<<<<<<<<<
27529  *         size *= src.shape[i]
27530  *
27531  */
27532   __pyx_t_2 = __pyx_v_ndim;
27533   __pyx_t_3 = __pyx_t_2;
27534   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
27535     __pyx_v_i = __pyx_t_4;
27536 
27537     /* "View.MemoryView":1179
27538  *
27539  *     for i in range(ndim):
27540  *         size *= src.shape[i]             # <<<<<<<<<<<<<<
27541  *
27542  *     return size
27543  */
27544     __pyx_v_size = (__pyx_v_size * (__pyx_v_src->shape[__pyx_v_i]));
27545   }
27546 
27547   /* "View.MemoryView":1181
27548  *         size *= src.shape[i]
27549  *
27550  *     return size             # <<<<<<<<<<<<<<
27551  *
27552  * @cname('__pyx_fill_contig_strides_array')
27553  */
27554   __pyx_r = __pyx_v_size;
27555   goto __pyx_L0;
27556 
27557   /* "View.MemoryView":1173
27558  *
27559  * @cname('__pyx_memoryview_slice_get_size')
27560  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
27561  *     "Return the size of the memory occupied by the slice in number of bytes"
27562  *     cdef int i
27563  */
27564 
27565   /* function exit code */
27566   __pyx_L0:;
27567   return __pyx_r;
27568 }
27569 
27570 /* "View.MemoryView":1184
27571  *
27572  * @cname('__pyx_fill_contig_strides_array')
27573  * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
27574  *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
27575  *                 int ndim, char order) nogil:
27576  */
27577 
27578 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) {
27579   int __pyx_v_idx;
27580   Py_ssize_t __pyx_r;
27581   int __pyx_t_1;
27582   int __pyx_t_2;
27583   int __pyx_t_3;
27584   int __pyx_t_4;
27585 
27586   /* "View.MemoryView":1193
27587  *     cdef int idx
27588  *
27589  *     if order == 'F':             # <<<<<<<<<<<<<<
27590  *         for idx in range(ndim):
27591  *             strides[idx] = stride
27592  */
27593   __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
27594   if (__pyx_t_1) {
27595 
27596     /* "View.MemoryView":1194
27597  *
27598  *     if order == 'F':
27599  *         for idx in range(ndim):             # <<<<<<<<<<<<<<
27600  *             strides[idx] = stride
27601  *             stride = stride * shape[idx]
27602  */
27603     __pyx_t_2 = __pyx_v_ndim;
27604     __pyx_t_3 = __pyx_t_2;
27605     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
27606       __pyx_v_idx = __pyx_t_4;
27607 
27608       /* "View.MemoryView":1195
27609  *     if order == 'F':
27610  *         for idx in range(ndim):
27611  *             strides[idx] = stride             # <<<<<<<<<<<<<<
27612  *             stride = stride * shape[idx]
27613  *     else:
27614  */
27615       (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
27616 
27617       /* "View.MemoryView":1196
27618  *         for idx in range(ndim):
27619  *             strides[idx] = stride
27620  *             stride = stride * shape[idx]             # <<<<<<<<<<<<<<
27621  *     else:
27622  *         for idx in range(ndim - 1, -1, -1):
27623  */
27624       __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
27625     }
27626 
27627     /* "View.MemoryView":1193
27628  *     cdef int idx
27629  *
27630  *     if order == 'F':             # <<<<<<<<<<<<<<
27631  *         for idx in range(ndim):
27632  *             strides[idx] = stride
27633  */
27634     goto __pyx_L3;
27635   }
27636 
27637   /* "View.MemoryView":1198
27638  *             stride = stride * shape[idx]
27639  *     else:
27640  *         for idx in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
27641  *             strides[idx] = stride
27642  *             stride = stride * shape[idx]
27643  */
27644   /*else*/ {
27645     for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
27646       __pyx_v_idx = __pyx_t_2;
27647 
27648       /* "View.MemoryView":1199
27649  *     else:
27650  *         for idx in range(ndim - 1, -1, -1):
27651  *             strides[idx] = stride             # <<<<<<<<<<<<<<
27652  *             stride = stride * shape[idx]
27653  *
27654  */
27655       (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
27656 
27657       /* "View.MemoryView":1200
27658  *         for idx in range(ndim - 1, -1, -1):
27659  *             strides[idx] = stride
27660  *             stride = stride * shape[idx]             # <<<<<<<<<<<<<<
27661  *
27662  *     return stride
27663  */
27664       __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
27665     }
27666   }
27667   __pyx_L3:;
27668 
27669   /* "View.MemoryView":1202
27670  *             stride = stride * shape[idx]
27671  *
27672  *     return stride             # <<<<<<<<<<<<<<
27673  *
27674  * @cname('__pyx_memoryview_copy_data_to_temp')
27675  */
27676   __pyx_r = __pyx_v_stride;
27677   goto __pyx_L0;
27678 
27679   /* "View.MemoryView":1184
27680  *
27681  * @cname('__pyx_fill_contig_strides_array')
27682  * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
27683  *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
27684  *                 int ndim, char order) nogil:
27685  */
27686 
27687   /* function exit code */
27688   __pyx_L0:;
27689   return __pyx_r;
27690 }
27691 
27692 /* "View.MemoryView":1205
27693  *
27694  * @cname('__pyx_memoryview_copy_data_to_temp')
27695  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
27696  *                              __Pyx_memviewslice *tmpslice,
27697  *                              char order,
27698  */
27699 
27700 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) {
27701   int __pyx_v_i;
27702   void *__pyx_v_result;
27703   size_t __pyx_v_itemsize;
27704   size_t __pyx_v_size;
27705   void *__pyx_r;
27706   Py_ssize_t __pyx_t_1;
27707   int __pyx_t_2;
27708   int __pyx_t_3;
27709   struct __pyx_memoryview_obj *__pyx_t_4;
27710   int __pyx_t_5;
27711   int __pyx_t_6;
27712 
27713   /* "View.MemoryView":1216
27714  *     cdef void *result
27715  *
27716  *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
27717  *     cdef size_t size = slice_get_size(src, ndim)
27718  *
27719  */
27720   __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
27721   __pyx_v_itemsize = __pyx_t_1;
27722 
27723   /* "View.MemoryView":1217
27724  *
27725  *     cdef size_t itemsize = src.memview.view.itemsize
27726  *     cdef size_t size = slice_get_size(src, ndim)             # <<<<<<<<<<<<<<
27727  *
27728  *     result = malloc(size)
27729  */
27730   __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
27731 
27732   /* "View.MemoryView":1219
27733  *     cdef size_t size = slice_get_size(src, ndim)
27734  *
27735  *     result = malloc(size)             # <<<<<<<<<<<<<<
27736  *     if not result:
27737  *         _err(MemoryError, NULL)
27738  */
27739   __pyx_v_result = malloc(__pyx_v_size);
27740 
27741   /* "View.MemoryView":1220
27742  *
27743  *     result = malloc(size)
27744  *     if not result:             # <<<<<<<<<<<<<<
27745  *         _err(MemoryError, NULL)
27746  *
27747  */
27748   __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
27749   if (__pyx_t_2) {
27750 
27751     /* "View.MemoryView":1221
27752  *     result = malloc(size)
27753  *     if not result:
27754  *         _err(MemoryError, NULL)             # <<<<<<<<<<<<<<
27755  *
27756  *
27757  */
27758     __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1221, __pyx_L1_error)
27759 
27760     /* "View.MemoryView":1220
27761  *
27762  *     result = malloc(size)
27763  *     if not result:             # <<<<<<<<<<<<<<
27764  *         _err(MemoryError, NULL)
27765  *
27766  */
27767   }
27768 
27769   /* "View.MemoryView":1224
27770  *
27771  *
27772  *     tmpslice.data = <char *> result             # <<<<<<<<<<<<<<
27773  *     tmpslice.memview = src.memview
27774  *     for i in range(ndim):
27775  */
27776   __pyx_v_tmpslice->data = ((char *)__pyx_v_result);
27777 
27778   /* "View.MemoryView":1225
27779  *
27780  *     tmpslice.data = <char *> result
27781  *     tmpslice.memview = src.memview             # <<<<<<<<<<<<<<
27782  *     for i in range(ndim):
27783  *         tmpslice.shape[i] = src.shape[i]
27784  */
27785   __pyx_t_4 = __pyx_v_src->memview;
27786   __pyx_v_tmpslice->memview = __pyx_t_4;
27787 
27788   /* "View.MemoryView":1226
27789  *     tmpslice.data = <char *> result
27790  *     tmpslice.memview = src.memview
27791  *     for i in range(ndim):             # <<<<<<<<<<<<<<
27792  *         tmpslice.shape[i] = src.shape[i]
27793  *         tmpslice.suboffsets[i] = -1
27794  */
27795   __pyx_t_3 = __pyx_v_ndim;
27796   __pyx_t_5 = __pyx_t_3;
27797   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
27798     __pyx_v_i = __pyx_t_6;
27799 
27800     /* "View.MemoryView":1227
27801  *     tmpslice.memview = src.memview
27802  *     for i in range(ndim):
27803  *         tmpslice.shape[i] = src.shape[i]             # <<<<<<<<<<<<<<
27804  *         tmpslice.suboffsets[i] = -1
27805  *
27806  */
27807     (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
27808 
27809     /* "View.MemoryView":1228
27810  *     for i in range(ndim):
27811  *         tmpslice.shape[i] = src.shape[i]
27812  *         tmpslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
27813  *
27814  *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
27815  */
27816     (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
27817   }
27818 
27819   /* "View.MemoryView":1230
27820  *         tmpslice.suboffsets[i] = -1
27821  *
27822  *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,             # <<<<<<<<<<<<<<
27823  *                               ndim, order)
27824  *
27825  */
27826   (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));
27827 
27828   /* "View.MemoryView":1234
27829  *
27830  *
27831  *     for i in range(ndim):             # <<<<<<<<<<<<<<
27832  *         if tmpslice.shape[i] == 1:
27833  *             tmpslice.strides[i] = 0
27834  */
27835   __pyx_t_3 = __pyx_v_ndim;
27836   __pyx_t_5 = __pyx_t_3;
27837   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
27838     __pyx_v_i = __pyx_t_6;
27839 
27840     /* "View.MemoryView":1235
27841  *
27842  *     for i in range(ndim):
27843  *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
27844  *             tmpslice.strides[i] = 0
27845  *
27846  */
27847     __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
27848     if (__pyx_t_2) {
27849 
27850       /* "View.MemoryView":1236
27851  *     for i in range(ndim):
27852  *         if tmpslice.shape[i] == 1:
27853  *             tmpslice.strides[i] = 0             # <<<<<<<<<<<<<<
27854  *
27855  *     if slice_is_contig(src[0], order, ndim):
27856  */
27857       (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
27858 
27859       /* "View.MemoryView":1235
27860  *
27861  *     for i in range(ndim):
27862  *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
27863  *             tmpslice.strides[i] = 0
27864  *
27865  */
27866     }
27867   }
27868 
27869   /* "View.MemoryView":1238
27870  *             tmpslice.strides[i] = 0
27871  *
27872  *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
27873  *         memcpy(result, src.data, size)
27874  *     else:
27875  */
27876   __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
27877   if (__pyx_t_2) {
27878 
27879     /* "View.MemoryView":1239
27880  *
27881  *     if slice_is_contig(src[0], order, ndim):
27882  *         memcpy(result, src.data, size)             # <<<<<<<<<<<<<<
27883  *     else:
27884  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
27885  */
27886     (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
27887 
27888     /* "View.MemoryView":1238
27889  *             tmpslice.strides[i] = 0
27890  *
27891  *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
27892  *         memcpy(result, src.data, size)
27893  *     else:
27894  */
27895     goto __pyx_L9;
27896   }
27897 
27898   /* "View.MemoryView":1241
27899  *         memcpy(result, src.data, size)
27900  *     else:
27901  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)             # <<<<<<<<<<<<<<
27902  *
27903  *     return result
27904  */
27905   /*else*/ {
27906     copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
27907   }
27908   __pyx_L9:;
27909 
27910   /* "View.MemoryView":1243
27911  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
27912  *
27913  *     return result             # <<<<<<<<<<<<<<
27914  *
27915  *
27916  */
27917   __pyx_r = __pyx_v_result;
27918   goto __pyx_L0;
27919 
27920   /* "View.MemoryView":1205
27921  *
27922  * @cname('__pyx_memoryview_copy_data_to_temp')
27923  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
27924  *                              __Pyx_memviewslice *tmpslice,
27925  *                              char order,
27926  */
27927 
27928   /* function exit code */
27929   __pyx_L1_error:;
27930   {
27931     #ifdef WITH_THREAD
27932     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
27933     #endif
27934     __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
27935     #ifdef WITH_THREAD
27936     __Pyx_PyGILState_Release(__pyx_gilstate_save);
27937     #endif
27938   }
27939   __pyx_r = NULL;
27940   __pyx_L0:;
27941   return __pyx_r;
27942 }
27943 
27944 /* "View.MemoryView":1248
27945  *
27946  * @cname('__pyx_memoryview_err_extents')
27947  * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
27948  *                              Py_ssize_t extent2) except -1 with gil:
27949  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
27950  */
27951 
27952 static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
27953   int __pyx_r;
27954   __Pyx_RefNannyDeclarations
27955   PyObject *__pyx_t_1 = NULL;
27956   PyObject *__pyx_t_2 = NULL;
27957   PyObject *__pyx_t_3 = NULL;
27958   PyObject *__pyx_t_4 = NULL;
27959   #ifdef WITH_THREAD
27960   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
27961   #endif
27962   __Pyx_RefNannySetupContext("_err_extents", 0);
27963 
27964   /* "View.MemoryView":1251
27965  *                              Py_ssize_t extent2) except -1 with gil:
27966  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
27967  *                                                         (i, extent1, extent2))             # <<<<<<<<<<<<<<
27968  *
27969  * @cname('__pyx_memoryview_err_dim')
27970  */
27971   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1251, __pyx_L1_error)
27972   __Pyx_GOTREF(__pyx_t_1);
27973   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1251, __pyx_L1_error)
27974   __Pyx_GOTREF(__pyx_t_2);
27975   __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1251, __pyx_L1_error)
27976   __Pyx_GOTREF(__pyx_t_3);
27977   __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1251, __pyx_L1_error)
27978   __Pyx_GOTREF(__pyx_t_4);
27979   __Pyx_GIVEREF(__pyx_t_1);
27980   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
27981   __Pyx_GIVEREF(__pyx_t_2);
27982   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
27983   __Pyx_GIVEREF(__pyx_t_3);
27984   PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
27985   __pyx_t_1 = 0;
27986   __pyx_t_2 = 0;
27987   __pyx_t_3 = 0;
27988 
27989   /* "View.MemoryView":1250
27990  * cdef int _err_extents(int i, Py_ssize_t extent1,
27991  *                              Py_ssize_t extent2) except -1 with gil:
27992  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %             # <<<<<<<<<<<<<<
27993  *                                                         (i, extent1, extent2))
27994  *
27995  */
27996   __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1250, __pyx_L1_error)
27997   __Pyx_GOTREF(__pyx_t_3);
27998   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
27999   __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1250, __pyx_L1_error)
28000   __Pyx_GOTREF(__pyx_t_4);
28001   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
28002   __Pyx_Raise(__pyx_t_4, 0, 0, 0);
28003   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
28004   __PYX_ERR(1, 1250, __pyx_L1_error)
28005 
28006   /* "View.MemoryView":1248
28007  *
28008  * @cname('__pyx_memoryview_err_extents')
28009  * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
28010  *                              Py_ssize_t extent2) except -1 with gil:
28011  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
28012  */
28013 
28014   /* function exit code */
28015   __pyx_L1_error:;
28016   __Pyx_XDECREF(__pyx_t_1);
28017   __Pyx_XDECREF(__pyx_t_2);
28018   __Pyx_XDECREF(__pyx_t_3);
28019   __Pyx_XDECREF(__pyx_t_4);
28020   __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
28021   __pyx_r = -1;
28022   __Pyx_RefNannyFinishContext();
28023   #ifdef WITH_THREAD
28024   __Pyx_PyGILState_Release(__pyx_gilstate_save);
28025   #endif
28026   return __pyx_r;
28027 }
28028 
28029 /* "View.MemoryView":1254
28030  *
28031  * @cname('__pyx_memoryview_err_dim')
28032  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
28033  *     raise error(msg.decode('ascii') % dim)
28034  *
28035  */
28036 
28037 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
28038   int __pyx_r;
28039   __Pyx_RefNannyDeclarations
28040   PyObject *__pyx_t_1 = NULL;
28041   PyObject *__pyx_t_2 = NULL;
28042   PyObject *__pyx_t_3 = NULL;
28043   PyObject *__pyx_t_4 = NULL;
28044   #ifdef WITH_THREAD
28045   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
28046   #endif
28047   __Pyx_RefNannySetupContext("_err_dim", 0);
28048   __Pyx_INCREF(__pyx_v_error);
28049 
28050   /* "View.MemoryView":1255
28051  * @cname('__pyx_memoryview_err_dim')
28052  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
28053  *     raise error(msg.decode('ascii') % dim)             # <<<<<<<<<<<<<<
28054  *
28055  * @cname('__pyx_memoryview_err')
28056  */
28057   __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1255, __pyx_L1_error)
28058   __Pyx_GOTREF(__pyx_t_2);
28059   __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1255, __pyx_L1_error)
28060   __Pyx_GOTREF(__pyx_t_3);
28061   __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1255, __pyx_L1_error)
28062   __Pyx_GOTREF(__pyx_t_4);
28063   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
28064   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
28065   __Pyx_INCREF(__pyx_v_error);
28066   __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
28067   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
28068     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
28069     if (likely(__pyx_t_2)) {
28070       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
28071       __Pyx_INCREF(__pyx_t_2);
28072       __Pyx_INCREF(function);
28073       __Pyx_DECREF_SET(__pyx_t_3, function);
28074     }
28075   }
28076   __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);
28077   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
28078   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
28079   if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1255, __pyx_L1_error)
28080   __Pyx_GOTREF(__pyx_t_1);
28081   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
28082   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
28083   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
28084   __PYX_ERR(1, 1255, __pyx_L1_error)
28085 
28086   /* "View.MemoryView":1254
28087  *
28088  * @cname('__pyx_memoryview_err_dim')
28089  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
28090  *     raise error(msg.decode('ascii') % dim)
28091  *
28092  */
28093 
28094   /* function exit code */
28095   __pyx_L1_error:;
28096   __Pyx_XDECREF(__pyx_t_1);
28097   __Pyx_XDECREF(__pyx_t_2);
28098   __Pyx_XDECREF(__pyx_t_3);
28099   __Pyx_XDECREF(__pyx_t_4);
28100   __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
28101   __pyx_r = -1;
28102   __Pyx_XDECREF(__pyx_v_error);
28103   __Pyx_RefNannyFinishContext();
28104   #ifdef WITH_THREAD
28105   __Pyx_PyGILState_Release(__pyx_gilstate_save);
28106   #endif
28107   return __pyx_r;
28108 }
28109 
28110 /* "View.MemoryView":1258
28111  *
28112  * @cname('__pyx_memoryview_err')
28113  * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
28114  *     if msg != NULL:
28115  *         raise error(msg.decode('ascii'))
28116  */
28117 
28118 static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
28119   int __pyx_r;
28120   __Pyx_RefNannyDeclarations
28121   int __pyx_t_1;
28122   PyObject *__pyx_t_2 = NULL;
28123   PyObject *__pyx_t_3 = NULL;
28124   PyObject *__pyx_t_4 = NULL;
28125   PyObject *__pyx_t_5 = NULL;
28126   #ifdef WITH_THREAD
28127   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
28128   #endif
28129   __Pyx_RefNannySetupContext("_err", 0);
28130   __Pyx_INCREF(__pyx_v_error);
28131 
28132   /* "View.MemoryView":1259
28133  * @cname('__pyx_memoryview_err')
28134  * cdef int _err(object error, char *msg) except -1 with gil:
28135  *     if msg != NULL:             # <<<<<<<<<<<<<<
28136  *         raise error(msg.decode('ascii'))
28137  *     else:
28138  */
28139   __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
28140   if (unlikely(__pyx_t_1)) {
28141 
28142     /* "View.MemoryView":1260
28143  * cdef int _err(object error, char *msg) except -1 with gil:
28144  *     if msg != NULL:
28145  *         raise error(msg.decode('ascii'))             # <<<<<<<<<<<<<<
28146  *     else:
28147  *         raise error
28148  */
28149     __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1260, __pyx_L1_error)
28150     __Pyx_GOTREF(__pyx_t_3);
28151     __Pyx_INCREF(__pyx_v_error);
28152     __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
28153     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
28154       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
28155       if (likely(__pyx_t_5)) {
28156         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
28157         __Pyx_INCREF(__pyx_t_5);
28158         __Pyx_INCREF(function);
28159         __Pyx_DECREF_SET(__pyx_t_4, function);
28160       }
28161     }
28162     __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);
28163     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
28164     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
28165     if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1260, __pyx_L1_error)
28166     __Pyx_GOTREF(__pyx_t_2);
28167     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
28168     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
28169     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
28170     __PYX_ERR(1, 1260, __pyx_L1_error)
28171 
28172     /* "View.MemoryView":1259
28173  * @cname('__pyx_memoryview_err')
28174  * cdef int _err(object error, char *msg) except -1 with gil:
28175  *     if msg != NULL:             # <<<<<<<<<<<<<<
28176  *         raise error(msg.decode('ascii'))
28177  *     else:
28178  */
28179   }
28180 
28181   /* "View.MemoryView":1262
28182  *         raise error(msg.decode('ascii'))
28183  *     else:
28184  *         raise error             # <<<<<<<<<<<<<<
28185  *
28186  * @cname('__pyx_memoryview_copy_contents')
28187  */
28188   /*else*/ {
28189     __Pyx_Raise(__pyx_v_error, 0, 0, 0);
28190     __PYX_ERR(1, 1262, __pyx_L1_error)
28191   }
28192 
28193   /* "View.MemoryView":1258
28194  *
28195  * @cname('__pyx_memoryview_err')
28196  * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
28197  *     if msg != NULL:
28198  *         raise error(msg.decode('ascii'))
28199  */
28200 
28201   /* function exit code */
28202   __pyx_L1_error:;
28203   __Pyx_XDECREF(__pyx_t_2);
28204   __Pyx_XDECREF(__pyx_t_3);
28205   __Pyx_XDECREF(__pyx_t_4);
28206   __Pyx_XDECREF(__pyx_t_5);
28207   __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
28208   __pyx_r = -1;
28209   __Pyx_XDECREF(__pyx_v_error);
28210   __Pyx_RefNannyFinishContext();
28211   #ifdef WITH_THREAD
28212   __Pyx_PyGILState_Release(__pyx_gilstate_save);
28213   #endif
28214   return __pyx_r;
28215 }
28216 
28217 /* "View.MemoryView":1265
28218  *
28219  * @cname('__pyx_memoryview_copy_contents')
28220  * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
28221  *                                   __Pyx_memviewslice dst,
28222  *                                   int src_ndim, int dst_ndim,
28223  */
28224 
28225 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) {
28226   void *__pyx_v_tmpdata;
28227   size_t __pyx_v_itemsize;
28228   int __pyx_v_i;
28229   char __pyx_v_order;
28230   int __pyx_v_broadcasting;
28231   int __pyx_v_direct_copy;
28232   __Pyx_memviewslice __pyx_v_tmp;
28233   int __pyx_v_ndim;
28234   int __pyx_r;
28235   Py_ssize_t __pyx_t_1;
28236   int __pyx_t_2;
28237   int __pyx_t_3;
28238   int __pyx_t_4;
28239   int __pyx_t_5;
28240   int __pyx_t_6;
28241   void *__pyx_t_7;
28242   int __pyx_t_8;
28243 
28244   /* "View.MemoryView":1273
28245  *     Check for overlapping memory and verify the shapes.
28246  *     """
28247  *     cdef void *tmpdata = NULL             # <<<<<<<<<<<<<<
28248  *     cdef size_t itemsize = src.memview.view.itemsize
28249  *     cdef int i
28250  */
28251   __pyx_v_tmpdata = NULL;
28252 
28253   /* "View.MemoryView":1274
28254  *     """
28255  *     cdef void *tmpdata = NULL
28256  *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
28257  *     cdef int i
28258  *     cdef char order = get_best_order(&src, src_ndim)
28259  */
28260   __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
28261   __pyx_v_itemsize = __pyx_t_1;
28262 
28263   /* "View.MemoryView":1276
28264  *     cdef size_t itemsize = src.memview.view.itemsize
28265  *     cdef int i
28266  *     cdef char order = get_best_order(&src, src_ndim)             # <<<<<<<<<<<<<<
28267  *     cdef bint broadcasting = False
28268  *     cdef bint direct_copy = False
28269  */
28270   __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
28271 
28272   /* "View.MemoryView":1277
28273  *     cdef int i
28274  *     cdef char order = get_best_order(&src, src_ndim)
28275  *     cdef bint broadcasting = False             # <<<<<<<<<<<<<<
28276  *     cdef bint direct_copy = False
28277  *     cdef __Pyx_memviewslice tmp
28278  */
28279   __pyx_v_broadcasting = 0;
28280 
28281   /* "View.MemoryView":1278
28282  *     cdef char order = get_best_order(&src, src_ndim)
28283  *     cdef bint broadcasting = False
28284  *     cdef bint direct_copy = False             # <<<<<<<<<<<<<<
28285  *     cdef __Pyx_memviewslice tmp
28286  *
28287  */
28288   __pyx_v_direct_copy = 0;
28289 
28290   /* "View.MemoryView":1281
28291  *     cdef __Pyx_memviewslice tmp
28292  *
28293  *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
28294  *         broadcast_leading(&src, src_ndim, dst_ndim)
28295  *     elif dst_ndim < src_ndim:
28296  */
28297   __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
28298   if (__pyx_t_2) {
28299 
28300     /* "View.MemoryView":1282
28301  *
28302  *     if src_ndim < dst_ndim:
28303  *         broadcast_leading(&src, src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
28304  *     elif dst_ndim < src_ndim:
28305  *         broadcast_leading(&dst, dst_ndim, src_ndim)
28306  */
28307     __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
28308 
28309     /* "View.MemoryView":1281
28310  *     cdef __Pyx_memviewslice tmp
28311  *
28312  *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
28313  *         broadcast_leading(&src, src_ndim, dst_ndim)
28314  *     elif dst_ndim < src_ndim:
28315  */
28316     goto __pyx_L3;
28317   }
28318 
28319   /* "View.MemoryView":1283
28320  *     if src_ndim < dst_ndim:
28321  *         broadcast_leading(&src, src_ndim, dst_ndim)
28322  *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
28323  *         broadcast_leading(&dst, dst_ndim, src_ndim)
28324  *
28325  */
28326   __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
28327   if (__pyx_t_2) {
28328 
28329     /* "View.MemoryView":1284
28330  *         broadcast_leading(&src, src_ndim, dst_ndim)
28331  *     elif dst_ndim < src_ndim:
28332  *         broadcast_leading(&dst, dst_ndim, src_ndim)             # <<<<<<<<<<<<<<
28333  *
28334  *     cdef int ndim = max(src_ndim, dst_ndim)
28335  */
28336     __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
28337 
28338     /* "View.MemoryView":1283
28339  *     if src_ndim < dst_ndim:
28340  *         broadcast_leading(&src, src_ndim, dst_ndim)
28341  *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
28342  *         broadcast_leading(&dst, dst_ndim, src_ndim)
28343  *
28344  */
28345   }
28346   __pyx_L3:;
28347 
28348   /* "View.MemoryView":1286
28349  *         broadcast_leading(&dst, dst_ndim, src_ndim)
28350  *
28351  *     cdef int ndim = max(src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
28352  *
28353  *     for i in range(ndim):
28354  */
28355   __pyx_t_3 = __pyx_v_dst_ndim;
28356   __pyx_t_4 = __pyx_v_src_ndim;
28357   if (((__pyx_t_3 > __pyx_t_4) != 0)) {
28358     __pyx_t_5 = __pyx_t_3;
28359   } else {
28360     __pyx_t_5 = __pyx_t_4;
28361   }
28362   __pyx_v_ndim = __pyx_t_5;
28363 
28364   /* "View.MemoryView":1288
28365  *     cdef int ndim = max(src_ndim, dst_ndim)
28366  *
28367  *     for i in range(ndim):             # <<<<<<<<<<<<<<
28368  *         if src.shape[i] != dst.shape[i]:
28369  *             if src.shape[i] == 1:
28370  */
28371   __pyx_t_5 = __pyx_v_ndim;
28372   __pyx_t_3 = __pyx_t_5;
28373   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
28374     __pyx_v_i = __pyx_t_4;
28375 
28376     /* "View.MemoryView":1289
28377  *
28378  *     for i in range(ndim):
28379  *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
28380  *             if src.shape[i] == 1:
28381  *                 broadcasting = True
28382  */
28383     __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
28384     if (__pyx_t_2) {
28385 
28386       /* "View.MemoryView":1290
28387  *     for i in range(ndim):
28388  *         if src.shape[i] != dst.shape[i]:
28389  *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
28390  *                 broadcasting = True
28391  *                 src.strides[i] = 0
28392  */
28393       __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
28394       if (__pyx_t_2) {
28395 
28396         /* "View.MemoryView":1291
28397  *         if src.shape[i] != dst.shape[i]:
28398  *             if src.shape[i] == 1:
28399  *                 broadcasting = True             # <<<<<<<<<<<<<<
28400  *                 src.strides[i] = 0
28401  *             else:
28402  */
28403         __pyx_v_broadcasting = 1;
28404 
28405         /* "View.MemoryView":1292
28406  *             if src.shape[i] == 1:
28407  *                 broadcasting = True
28408  *                 src.strides[i] = 0             # <<<<<<<<<<<<<<
28409  *             else:
28410  *                 _err_extents(i, dst.shape[i], src.shape[i])
28411  */
28412         (__pyx_v_src.strides[__pyx_v_i]) = 0;
28413 
28414         /* "View.MemoryView":1290
28415  *     for i in range(ndim):
28416  *         if src.shape[i] != dst.shape[i]:
28417  *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
28418  *                 broadcasting = True
28419  *                 src.strides[i] = 0
28420  */
28421         goto __pyx_L7;
28422       }
28423 
28424       /* "View.MemoryView":1294
28425  *                 src.strides[i] = 0
28426  *             else:
28427  *                 _err_extents(i, dst.shape[i], src.shape[i])             # <<<<<<<<<<<<<<
28428  *
28429  *         if src.suboffsets[i] >= 0:
28430  */
28431       /*else*/ {
28432         __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1294, __pyx_L1_error)
28433       }
28434       __pyx_L7:;
28435 
28436       /* "View.MemoryView":1289
28437  *
28438  *     for i in range(ndim):
28439  *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
28440  *             if src.shape[i] == 1:
28441  *                 broadcasting = True
28442  */
28443     }
28444 
28445     /* "View.MemoryView":1296
28446  *                 _err_extents(i, dst.shape[i], src.shape[i])
28447  *
28448  *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
28449  *             _err_dim(ValueError, "Dimension %d is not direct", i)
28450  *
28451  */
28452     __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
28453     if (__pyx_t_2) {
28454 
28455       /* "View.MemoryView":1297
28456  *
28457  *         if src.suboffsets[i] >= 0:
28458  *             _err_dim(ValueError, "Dimension %d is not direct", i)             # <<<<<<<<<<<<<<
28459  *
28460  *     if slices_overlap(&src, &dst, ndim, itemsize):
28461  */
28462       __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1297, __pyx_L1_error)
28463 
28464       /* "View.MemoryView":1296
28465  *                 _err_extents(i, dst.shape[i], src.shape[i])
28466  *
28467  *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
28468  *             _err_dim(ValueError, "Dimension %d is not direct", i)
28469  *
28470  */
28471     }
28472   }
28473 
28474   /* "View.MemoryView":1299
28475  *             _err_dim(ValueError, "Dimension %d is not direct", i)
28476  *
28477  *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
28478  *
28479  *         if not slice_is_contig(src, order, ndim):
28480  */
28481   __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
28482   if (__pyx_t_2) {
28483 
28484     /* "View.MemoryView":1301
28485  *     if slices_overlap(&src, &dst, ndim, itemsize):
28486  *
28487  *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
28488  *             order = get_best_order(&dst, ndim)
28489  *
28490  */
28491     __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
28492     if (__pyx_t_2) {
28493 
28494       /* "View.MemoryView":1302
28495  *
28496  *         if not slice_is_contig(src, order, ndim):
28497  *             order = get_best_order(&dst, ndim)             # <<<<<<<<<<<<<<
28498  *
28499  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
28500  */
28501       __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
28502 
28503       /* "View.MemoryView":1301
28504  *     if slices_overlap(&src, &dst, ndim, itemsize):
28505  *
28506  *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
28507  *             order = get_best_order(&dst, ndim)
28508  *
28509  */
28510     }
28511 
28512     /* "View.MemoryView":1304
28513  *             order = get_best_order(&dst, ndim)
28514  *
28515  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)             # <<<<<<<<<<<<<<
28516  *         src = tmp
28517  *
28518  */
28519     __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1304, __pyx_L1_error)
28520     __pyx_v_tmpdata = __pyx_t_7;
28521 
28522     /* "View.MemoryView":1305
28523  *
28524  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
28525  *         src = tmp             # <<<<<<<<<<<<<<
28526  *
28527  *     if not broadcasting:
28528  */
28529     __pyx_v_src = __pyx_v_tmp;
28530 
28531     /* "View.MemoryView":1299
28532  *             _err_dim(ValueError, "Dimension %d is not direct", i)
28533  *
28534  *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
28535  *
28536  *         if not slice_is_contig(src, order, ndim):
28537  */
28538   }
28539 
28540   /* "View.MemoryView":1307
28541  *         src = tmp
28542  *
28543  *     if not broadcasting:             # <<<<<<<<<<<<<<
28544  *
28545  *
28546  */
28547   __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
28548   if (__pyx_t_2) {
28549 
28550     /* "View.MemoryView":1310
28551  *
28552  *
28553  *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
28554  *             direct_copy = slice_is_contig(dst, 'C', ndim)
28555  *         elif slice_is_contig(src, 'F', ndim):
28556  */
28557     __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
28558     if (__pyx_t_2) {
28559 
28560       /* "View.MemoryView":1311
28561  *
28562  *         if slice_is_contig(src, 'C', ndim):
28563  *             direct_copy = slice_is_contig(dst, 'C', ndim)             # <<<<<<<<<<<<<<
28564  *         elif slice_is_contig(src, 'F', ndim):
28565  *             direct_copy = slice_is_contig(dst, 'F', ndim)
28566  */
28567       __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);
28568 
28569       /* "View.MemoryView":1310
28570  *
28571  *
28572  *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
28573  *             direct_copy = slice_is_contig(dst, 'C', ndim)
28574  *         elif slice_is_contig(src, 'F', ndim):
28575  */
28576       goto __pyx_L12;
28577     }
28578 
28579     /* "View.MemoryView":1312
28580  *         if slice_is_contig(src, 'C', ndim):
28581  *             direct_copy = slice_is_contig(dst, 'C', ndim)
28582  *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
28583  *             direct_copy = slice_is_contig(dst, 'F', ndim)
28584  *
28585  */
28586     __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
28587     if (__pyx_t_2) {
28588 
28589       /* "View.MemoryView":1313
28590  *             direct_copy = slice_is_contig(dst, 'C', ndim)
28591  *         elif slice_is_contig(src, 'F', ndim):
28592  *             direct_copy = slice_is_contig(dst, 'F', ndim)             # <<<<<<<<<<<<<<
28593  *
28594  *         if direct_copy:
28595  */
28596       __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);
28597 
28598       /* "View.MemoryView":1312
28599  *         if slice_is_contig(src, 'C', ndim):
28600  *             direct_copy = slice_is_contig(dst, 'C', ndim)
28601  *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
28602  *             direct_copy = slice_is_contig(dst, 'F', ndim)
28603  *
28604  */
28605     }
28606     __pyx_L12:;
28607 
28608     /* "View.MemoryView":1315
28609  *             direct_copy = slice_is_contig(dst, 'F', ndim)
28610  *
28611  *         if direct_copy:             # <<<<<<<<<<<<<<
28612  *
28613  *             refcount_copying(&dst, dtype_is_object, ndim, False)
28614  */
28615     __pyx_t_2 = (__pyx_v_direct_copy != 0);
28616     if (__pyx_t_2) {
28617 
28618       /* "View.MemoryView":1317
28619  *         if direct_copy:
28620  *
28621  *             refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
28622  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
28623  *             refcount_copying(&dst, dtype_is_object, ndim, True)
28624  */
28625       __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
28626 
28627       /* "View.MemoryView":1318
28628  *
28629  *             refcount_copying(&dst, dtype_is_object, ndim, False)
28630  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))             # <<<<<<<<<<<<<<
28631  *             refcount_copying(&dst, dtype_is_object, ndim, True)
28632  *             free(tmpdata)
28633  */
28634       (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
28635 
28636       /* "View.MemoryView":1319
28637  *             refcount_copying(&dst, dtype_is_object, ndim, False)
28638  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
28639  *             refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
28640  *             free(tmpdata)
28641  *             return 0
28642  */
28643       __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
28644 
28645       /* "View.MemoryView":1320
28646  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
28647  *             refcount_copying(&dst, dtype_is_object, ndim, True)
28648  *             free(tmpdata)             # <<<<<<<<<<<<<<
28649  *             return 0
28650  *
28651  */
28652       free(__pyx_v_tmpdata);
28653 
28654       /* "View.MemoryView":1321
28655  *             refcount_copying(&dst, dtype_is_object, ndim, True)
28656  *             free(tmpdata)
28657  *             return 0             # <<<<<<<<<<<<<<
28658  *
28659  *     if order == 'F' == get_best_order(&dst, ndim):
28660  */
28661       __pyx_r = 0;
28662       goto __pyx_L0;
28663 
28664       /* "View.MemoryView":1315
28665  *             direct_copy = slice_is_contig(dst, 'F', ndim)
28666  *
28667  *         if direct_copy:             # <<<<<<<<<<<<<<
28668  *
28669  *             refcount_copying(&dst, dtype_is_object, ndim, False)
28670  */
28671     }
28672 
28673     /* "View.MemoryView":1307
28674  *         src = tmp
28675  *
28676  *     if not broadcasting:             # <<<<<<<<<<<<<<
28677  *
28678  *
28679  */
28680   }
28681 
28682   /* "View.MemoryView":1323
28683  *             return 0
28684  *
28685  *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
28686  *
28687  *
28688  */
28689   __pyx_t_2 = (__pyx_v_order == 'F');
28690   if (__pyx_t_2) {
28691     __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
28692   }
28693   __pyx_t_8 = (__pyx_t_2 != 0);
28694   if (__pyx_t_8) {
28695 
28696     /* "View.MemoryView":1326
28697  *
28698  *
28699  *         transpose_memslice(&src)             # <<<<<<<<<<<<<<
28700  *         transpose_memslice(&dst)
28701  *
28702  */
28703     __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(1, 1326, __pyx_L1_error)
28704 
28705     /* "View.MemoryView":1327
28706  *
28707  *         transpose_memslice(&src)
28708  *         transpose_memslice(&dst)             # <<<<<<<<<<<<<<
28709  *
28710  *     refcount_copying(&dst, dtype_is_object, ndim, False)
28711  */
28712     __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(1, 1327, __pyx_L1_error)
28713 
28714     /* "View.MemoryView":1323
28715  *             return 0
28716  *
28717  *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
28718  *
28719  *
28720  */
28721   }
28722 
28723   /* "View.MemoryView":1329
28724  *         transpose_memslice(&dst)
28725  *
28726  *     refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
28727  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
28728  *     refcount_copying(&dst, dtype_is_object, ndim, True)
28729  */
28730   __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
28731 
28732   /* "View.MemoryView":1330
28733  *
28734  *     refcount_copying(&dst, dtype_is_object, ndim, False)
28735  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)             # <<<<<<<<<<<<<<
28736  *     refcount_copying(&dst, dtype_is_object, ndim, True)
28737  *
28738  */
28739   copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
28740 
28741   /* "View.MemoryView":1331
28742  *     refcount_copying(&dst, dtype_is_object, ndim, False)
28743  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
28744  *     refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
28745  *
28746  *     free(tmpdata)
28747  */
28748   __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
28749 
28750   /* "View.MemoryView":1333
28751  *     refcount_copying(&dst, dtype_is_object, ndim, True)
28752  *
28753  *     free(tmpdata)             # <<<<<<<<<<<<<<
28754  *     return 0
28755  *
28756  */
28757   free(__pyx_v_tmpdata);
28758 
28759   /* "View.MemoryView":1334
28760  *
28761  *     free(tmpdata)
28762  *     return 0             # <<<<<<<<<<<<<<
28763  *
28764  * @cname('__pyx_memoryview_broadcast_leading')
28765  */
28766   __pyx_r = 0;
28767   goto __pyx_L0;
28768 
28769   /* "View.MemoryView":1265
28770  *
28771  * @cname('__pyx_memoryview_copy_contents')
28772  * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
28773  *                                   __Pyx_memviewslice dst,
28774  *                                   int src_ndim, int dst_ndim,
28775  */
28776 
28777   /* function exit code */
28778   __pyx_L1_error:;
28779   {
28780     #ifdef WITH_THREAD
28781     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
28782     #endif
28783     __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
28784     #ifdef WITH_THREAD
28785     __Pyx_PyGILState_Release(__pyx_gilstate_save);
28786     #endif
28787   }
28788   __pyx_r = -1;
28789   __pyx_L0:;
28790   return __pyx_r;
28791 }
28792 
28793 /* "View.MemoryView":1337
28794  *
28795  * @cname('__pyx_memoryview_broadcast_leading')
28796  * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
28797  *                             int ndim,
28798  *                             int ndim_other) nogil:
28799  */
28800 
28801 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
28802   int __pyx_v_i;
28803   int __pyx_v_offset;
28804   int __pyx_t_1;
28805   int __pyx_t_2;
28806   int __pyx_t_3;
28807 
28808   /* "View.MemoryView":1341
28809  *                             int ndim_other) nogil:
28810  *     cdef int i
28811  *     cdef int offset = ndim_other - ndim             # <<<<<<<<<<<<<<
28812  *
28813  *     for i in range(ndim - 1, -1, -1):
28814  */
28815   __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
28816 
28817   /* "View.MemoryView":1343
28818  *     cdef int offset = ndim_other - ndim
28819  *
28820  *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
28821  *         mslice.shape[i + offset] = mslice.shape[i]
28822  *         mslice.strides[i + offset] = mslice.strides[i]
28823  */
28824   for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
28825     __pyx_v_i = __pyx_t_1;
28826 
28827     /* "View.MemoryView":1344
28828  *
28829  *     for i in range(ndim - 1, -1, -1):
28830  *         mslice.shape[i + offset] = mslice.shape[i]             # <<<<<<<<<<<<<<
28831  *         mslice.strides[i + offset] = mslice.strides[i]
28832  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
28833  */
28834     (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
28835 
28836     /* "View.MemoryView":1345
28837  *     for i in range(ndim - 1, -1, -1):
28838  *         mslice.shape[i + offset] = mslice.shape[i]
28839  *         mslice.strides[i + offset] = mslice.strides[i]             # <<<<<<<<<<<<<<
28840  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
28841  *
28842  */
28843     (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
28844 
28845     /* "View.MemoryView":1346
28846  *         mslice.shape[i + offset] = mslice.shape[i]
28847  *         mslice.strides[i + offset] = mslice.strides[i]
28848  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]             # <<<<<<<<<<<<<<
28849  *
28850  *     for i in range(offset):
28851  */
28852     (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
28853   }
28854 
28855   /* "View.MemoryView":1348
28856  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
28857  *
28858  *     for i in range(offset):             # <<<<<<<<<<<<<<
28859  *         mslice.shape[i] = 1
28860  *         mslice.strides[i] = mslice.strides[0]
28861  */
28862   __pyx_t_1 = __pyx_v_offset;
28863   __pyx_t_2 = __pyx_t_1;
28864   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
28865     __pyx_v_i = __pyx_t_3;
28866 
28867     /* "View.MemoryView":1349
28868  *
28869  *     for i in range(offset):
28870  *         mslice.shape[i] = 1             # <<<<<<<<<<<<<<
28871  *         mslice.strides[i] = mslice.strides[0]
28872  *         mslice.suboffsets[i] = -1
28873  */
28874     (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
28875 
28876     /* "View.MemoryView":1350
28877  *     for i in range(offset):
28878  *         mslice.shape[i] = 1
28879  *         mslice.strides[i] = mslice.strides[0]             # <<<<<<<<<<<<<<
28880  *         mslice.suboffsets[i] = -1
28881  *
28882  */
28883     (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
28884 
28885     /* "View.MemoryView":1351
28886  *         mslice.shape[i] = 1
28887  *         mslice.strides[i] = mslice.strides[0]
28888  *         mslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
28889  *
28890  *
28891  */
28892     (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
28893   }
28894 
28895   /* "View.MemoryView":1337
28896  *
28897  * @cname('__pyx_memoryview_broadcast_leading')
28898  * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
28899  *                             int ndim,
28900  *                             int ndim_other) nogil:
28901  */
28902 
28903   /* function exit code */
28904 }
28905 
28906 /* "View.MemoryView":1359
28907  *
28908  * @cname('__pyx_memoryview_refcount_copying')
28909  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
28910  *                            int ndim, bint inc) nogil:
28911  *
28912  */
28913 
28914 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) {
28915   int __pyx_t_1;
28916 
28917   /* "View.MemoryView":1363
28918  *
28919  *
28920  *     if dtype_is_object:             # <<<<<<<<<<<<<<
28921  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
28922  *                                            dst.strides, ndim, inc)
28923  */
28924   __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
28925   if (__pyx_t_1) {
28926 
28927     /* "View.MemoryView":1364
28928  *
28929  *     if dtype_is_object:
28930  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,             # <<<<<<<<<<<<<<
28931  *                                            dst.strides, ndim, inc)
28932  *
28933  */
28934     __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);
28935 
28936     /* "View.MemoryView":1363
28937  *
28938  *
28939  *     if dtype_is_object:             # <<<<<<<<<<<<<<
28940  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
28941  *                                            dst.strides, ndim, inc)
28942  */
28943   }
28944 
28945   /* "View.MemoryView":1359
28946  *
28947  * @cname('__pyx_memoryview_refcount_copying')
28948  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
28949  *                            int ndim, bint inc) nogil:
28950  *
28951  */
28952 
28953   /* function exit code */
28954 }
28955 
28956 /* "View.MemoryView":1368
28957  *
28958  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
28959  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
28960  *                                              Py_ssize_t *strides, int ndim,
28961  *                                              bint inc) with gil:
28962  */
28963 
28964 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) {
28965   __Pyx_RefNannyDeclarations
28966   #ifdef WITH_THREAD
28967   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
28968   #endif
28969   __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);
28970 
28971   /* "View.MemoryView":1371
28972  *                                              Py_ssize_t *strides, int ndim,
28973  *                                              bint inc) with gil:
28974  *     refcount_objects_in_slice(data, shape, strides, ndim, inc)             # <<<<<<<<<<<<<<
28975  *
28976  * @cname('__pyx_memoryview_refcount_objects_in_slice')
28977  */
28978   __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
28979 
28980   /* "View.MemoryView":1368
28981  *
28982  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
28983  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
28984  *                                              Py_ssize_t *strides, int ndim,
28985  *                                              bint inc) with gil:
28986  */
28987 
28988   /* function exit code */
28989   __Pyx_RefNannyFinishContext();
28990   #ifdef WITH_THREAD
28991   __Pyx_PyGILState_Release(__pyx_gilstate_save);
28992   #endif
28993 }
28994 
28995 /* "View.MemoryView":1374
28996  *
28997  * @cname('__pyx_memoryview_refcount_objects_in_slice')
28998  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
28999  *                                     Py_ssize_t *strides, int ndim, bint inc):
29000  *     cdef Py_ssize_t i
29001  */
29002 
29003 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) {
29004   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
29005   __Pyx_RefNannyDeclarations
29006   Py_ssize_t __pyx_t_1;
29007   Py_ssize_t __pyx_t_2;
29008   Py_ssize_t __pyx_t_3;
29009   int __pyx_t_4;
29010   __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);
29011 
29012   /* "View.MemoryView":1378
29013  *     cdef Py_ssize_t i
29014  *
29015  *     for i in range(shape[0]):             # <<<<<<<<<<<<<<
29016  *         if ndim == 1:
29017  *             if inc:
29018  */
29019   __pyx_t_1 = (__pyx_v_shape[0]);
29020   __pyx_t_2 = __pyx_t_1;
29021   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
29022     __pyx_v_i = __pyx_t_3;
29023 
29024     /* "View.MemoryView":1379
29025  *
29026  *     for i in range(shape[0]):
29027  *         if ndim == 1:             # <<<<<<<<<<<<<<
29028  *             if inc:
29029  *                 Py_INCREF((<PyObject **> data)[0])
29030  */
29031     __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
29032     if (__pyx_t_4) {
29033 
29034       /* "View.MemoryView":1380
29035  *     for i in range(shape[0]):
29036  *         if ndim == 1:
29037  *             if inc:             # <<<<<<<<<<<<<<
29038  *                 Py_INCREF((<PyObject **> data)[0])
29039  *             else:
29040  */
29041       __pyx_t_4 = (__pyx_v_inc != 0);
29042       if (__pyx_t_4) {
29043 
29044         /* "View.MemoryView":1381
29045  *         if ndim == 1:
29046  *             if inc:
29047  *                 Py_INCREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
29048  *             else:
29049  *                 Py_DECREF((<PyObject **> data)[0])
29050  */
29051         Py_INCREF((((PyObject **)__pyx_v_data)[0]));
29052 
29053         /* "View.MemoryView":1380
29054  *     for i in range(shape[0]):
29055  *         if ndim == 1:
29056  *             if inc:             # <<<<<<<<<<<<<<
29057  *                 Py_INCREF((<PyObject **> data)[0])
29058  *             else:
29059  */
29060         goto __pyx_L6;
29061       }
29062 
29063       /* "View.MemoryView":1383
29064  *                 Py_INCREF((<PyObject **> data)[0])
29065  *             else:
29066  *                 Py_DECREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
29067  *         else:
29068  *             refcount_objects_in_slice(data, shape + 1, strides + 1,
29069  */
29070       /*else*/ {
29071         Py_DECREF((((PyObject **)__pyx_v_data)[0]));
29072       }
29073       __pyx_L6:;
29074 
29075       /* "View.MemoryView":1379
29076  *
29077  *     for i in range(shape[0]):
29078  *         if ndim == 1:             # <<<<<<<<<<<<<<
29079  *             if inc:
29080  *                 Py_INCREF((<PyObject **> data)[0])
29081  */
29082       goto __pyx_L5;
29083     }
29084 
29085     /* "View.MemoryView":1385
29086  *                 Py_DECREF((<PyObject **> data)[0])
29087  *         else:
29088  *             refcount_objects_in_slice(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
29089  *                                       ndim - 1, inc)
29090  *
29091  */
29092     /*else*/ {
29093 
29094       /* "View.MemoryView":1386
29095  *         else:
29096  *             refcount_objects_in_slice(data, shape + 1, strides + 1,
29097  *                                       ndim - 1, inc)             # <<<<<<<<<<<<<<
29098  *
29099  *         data += strides[0]
29100  */
29101       __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
29102     }
29103     __pyx_L5:;
29104 
29105     /* "View.MemoryView":1388
29106  *                                       ndim - 1, inc)
29107  *
29108  *         data += strides[0]             # <<<<<<<<<<<<<<
29109  *
29110  *
29111  */
29112     __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
29113   }
29114 
29115   /* "View.MemoryView":1374
29116  *
29117  * @cname('__pyx_memoryview_refcount_objects_in_slice')
29118  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
29119  *                                     Py_ssize_t *strides, int ndim, bint inc):
29120  *     cdef Py_ssize_t i
29121  */
29122 
29123   /* function exit code */
29124   __Pyx_RefNannyFinishContext();
29125 }
29126 
29127 /* "View.MemoryView":1394
29128  *
29129  * @cname('__pyx_memoryview_slice_assign_scalar')
29130  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
29131  *                               size_t itemsize, void *item,
29132  *                               bint dtype_is_object) nogil:
29133  */
29134 
29135 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) {
29136 
29137   /* "View.MemoryView":1397
29138  *                               size_t itemsize, void *item,
29139  *                               bint dtype_is_object) nogil:
29140  *     refcount_copying(dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
29141  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
29142  *                          itemsize, item)
29143  */
29144   __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
29145 
29146   /* "View.MemoryView":1398
29147  *                               bint dtype_is_object) nogil:
29148  *     refcount_copying(dst, dtype_is_object, ndim, False)
29149  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,             # <<<<<<<<<<<<<<
29150  *                          itemsize, item)
29151  *     refcount_copying(dst, dtype_is_object, ndim, True)
29152  */
29153   __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);
29154 
29155   /* "View.MemoryView":1400
29156  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
29157  *                          itemsize, item)
29158  *     refcount_copying(dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
29159  *
29160  *
29161  */
29162   __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
29163 
29164   /* "View.MemoryView":1394
29165  *
29166  * @cname('__pyx_memoryview_slice_assign_scalar')
29167  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
29168  *                               size_t itemsize, void *item,
29169  *                               bint dtype_is_object) nogil:
29170  */
29171 
29172   /* function exit code */
29173 }
29174 
29175 /* "View.MemoryView":1404
29176  *
29177  * @cname('__pyx_memoryview__slice_assign_scalar')
29178  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
29179  *                               Py_ssize_t *strides, int ndim,
29180  *                               size_t itemsize, void *item) nogil:
29181  */
29182 
29183 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) {
29184   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
29185   Py_ssize_t __pyx_v_stride;
29186   Py_ssize_t __pyx_v_extent;
29187   int __pyx_t_1;
29188   Py_ssize_t __pyx_t_2;
29189   Py_ssize_t __pyx_t_3;
29190   Py_ssize_t __pyx_t_4;
29191 
29192   /* "View.MemoryView":1408
29193  *                               size_t itemsize, void *item) nogil:
29194  *     cdef Py_ssize_t i
29195  *     cdef Py_ssize_t stride = strides[0]             # <<<<<<<<<<<<<<
29196  *     cdef Py_ssize_t extent = shape[0]
29197  *
29198  */
29199   __pyx_v_stride = (__pyx_v_strides[0]);
29200 
29201   /* "View.MemoryView":1409
29202  *     cdef Py_ssize_t i
29203  *     cdef Py_ssize_t stride = strides[0]
29204  *     cdef Py_ssize_t extent = shape[0]             # <<<<<<<<<<<<<<
29205  *
29206  *     if ndim == 1:
29207  */
29208   __pyx_v_extent = (__pyx_v_shape[0]);
29209 
29210   /* "View.MemoryView":1411
29211  *     cdef Py_ssize_t extent = shape[0]
29212  *
29213  *     if ndim == 1:             # <<<<<<<<<<<<<<
29214  *         for i in range(extent):
29215  *             memcpy(data, item, itemsize)
29216  */
29217   __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
29218   if (__pyx_t_1) {
29219 
29220     /* "View.MemoryView":1412
29221  *
29222  *     if ndim == 1:
29223  *         for i in range(extent):             # <<<<<<<<<<<<<<
29224  *             memcpy(data, item, itemsize)
29225  *             data += stride
29226  */
29227     __pyx_t_2 = __pyx_v_extent;
29228     __pyx_t_3 = __pyx_t_2;
29229     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
29230       __pyx_v_i = __pyx_t_4;
29231 
29232       /* "View.MemoryView":1413
29233  *     if ndim == 1:
29234  *         for i in range(extent):
29235  *             memcpy(data, item, itemsize)             # <<<<<<<<<<<<<<
29236  *             data += stride
29237  *     else:
29238  */
29239       (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
29240 
29241       /* "View.MemoryView":1414
29242  *         for i in range(extent):
29243  *             memcpy(data, item, itemsize)
29244  *             data += stride             # <<<<<<<<<<<<<<
29245  *     else:
29246  *         for i in range(extent):
29247  */
29248       __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
29249     }
29250 
29251     /* "View.MemoryView":1411
29252  *     cdef Py_ssize_t extent = shape[0]
29253  *
29254  *     if ndim == 1:             # <<<<<<<<<<<<<<
29255  *         for i in range(extent):
29256  *             memcpy(data, item, itemsize)
29257  */
29258     goto __pyx_L3;
29259   }
29260 
29261   /* "View.MemoryView":1416
29262  *             data += stride
29263  *     else:
29264  *         for i in range(extent):             # <<<<<<<<<<<<<<
29265  *             _slice_assign_scalar(data, shape + 1, strides + 1,
29266  *                                 ndim - 1, itemsize, item)
29267  */
29268   /*else*/ {
29269     __pyx_t_2 = __pyx_v_extent;
29270     __pyx_t_3 = __pyx_t_2;
29271     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
29272       __pyx_v_i = __pyx_t_4;
29273 
29274       /* "View.MemoryView":1417
29275  *     else:
29276  *         for i in range(extent):
29277  *             _slice_assign_scalar(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
29278  *                                 ndim - 1, itemsize, item)
29279  *             data += stride
29280  */
29281       __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);
29282 
29283       /* "View.MemoryView":1419
29284  *             _slice_assign_scalar(data, shape + 1, strides + 1,
29285  *                                 ndim - 1, itemsize, item)
29286  *             data += stride             # <<<<<<<<<<<<<<
29287  *
29288  *
29289  */
29290       __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
29291     }
29292   }
29293   __pyx_L3:;
29294 
29295   /* "View.MemoryView":1404
29296  *
29297  * @cname('__pyx_memoryview__slice_assign_scalar')
29298  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
29299  *                               Py_ssize_t *strides, int ndim,
29300  *                               size_t itemsize, void *item) nogil:
29301  */
29302 
29303   /* function exit code */
29304 }
29305 
29306 /* "(tree fragment)":1
29307  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
29308  *     cdef object __pyx_PickleError
29309  *     cdef object __pyx_result
29310  */
29311 
29312 /* Python wrapper */
29313 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
29314 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};
29315 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
29316   PyObject *__pyx_v___pyx_type = 0;
29317   long __pyx_v___pyx_checksum;
29318   PyObject *__pyx_v___pyx_state = 0;
29319   PyObject *__pyx_r = 0;
29320   __Pyx_RefNannyDeclarations
29321   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
29322   {
29323     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
29324     PyObject* values[3] = {0,0,0};
29325     if (unlikely(__pyx_kwds)) {
29326       Py_ssize_t kw_args;
29327       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
29328       switch (pos_args) {
29329         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
29330         CYTHON_FALLTHROUGH;
29331         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
29332         CYTHON_FALLTHROUGH;
29333         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
29334         CYTHON_FALLTHROUGH;
29335         case  0: break;
29336         default: goto __pyx_L5_argtuple_error;
29337       }
29338       kw_args = PyDict_Size(__pyx_kwds);
29339       switch (pos_args) {
29340         case  0:
29341         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
29342         else goto __pyx_L5_argtuple_error;
29343         CYTHON_FALLTHROUGH;
29344         case  1:
29345         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
29346         else {
29347           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
29348         }
29349         CYTHON_FALLTHROUGH;
29350         case  2:
29351         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
29352         else {
29353           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
29354         }
29355       }
29356       if (unlikely(kw_args > 0)) {
29357         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
29358       }
29359     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
29360       goto __pyx_L5_argtuple_error;
29361     } else {
29362       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
29363       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
29364       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
29365     }
29366     __pyx_v___pyx_type = values[0];
29367     __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
29368     __pyx_v___pyx_state = values[2];
29369   }
29370   goto __pyx_L4_argument_unpacking_done;
29371   __pyx_L5_argtuple_error:;
29372   __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
29373   __pyx_L3_error:;
29374   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
29375   __Pyx_RefNannyFinishContext();
29376   return NULL;
29377   __pyx_L4_argument_unpacking_done:;
29378   __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
29379 
29380   /* function exit code */
29381   __Pyx_RefNannyFinishContext();
29382   return __pyx_r;
29383 }
29384 
29385 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) {
29386   PyObject *__pyx_v___pyx_PickleError = 0;
29387   PyObject *__pyx_v___pyx_result = 0;
29388   PyObject *__pyx_r = NULL;
29389   __Pyx_RefNannyDeclarations
29390   int __pyx_t_1;
29391   PyObject *__pyx_t_2 = NULL;
29392   PyObject *__pyx_t_3 = NULL;
29393   PyObject *__pyx_t_4 = NULL;
29394   PyObject *__pyx_t_5 = NULL;
29395   int __pyx_t_6;
29396   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);
29397 
29398   /* "(tree fragment)":4
29399  *     cdef object __pyx_PickleError
29400  *     cdef object __pyx_result
29401  *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
29402  *         from pickle import PickleError as __pyx_PickleError
29403  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
29404  */
29405   __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
29406   if (__pyx_t_1) {
29407 
29408     /* "(tree fragment)":5
29409  *     cdef object __pyx_result
29410  *     if __pyx_checksum != 0xb068931:
29411  *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
29412  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
29413  *     __pyx_result = Enum.__new__(__pyx_type)
29414  */
29415     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
29416     __Pyx_GOTREF(__pyx_t_2);
29417     __Pyx_INCREF(__pyx_n_s_PickleError);
29418     __Pyx_GIVEREF(__pyx_n_s_PickleError);
29419     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
29420     __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
29421     __Pyx_GOTREF(__pyx_t_3);
29422     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
29423     __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
29424     __Pyx_GOTREF(__pyx_t_2);
29425     __Pyx_INCREF(__pyx_t_2);
29426     __pyx_v___pyx_PickleError = __pyx_t_2;
29427     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
29428     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29429 
29430     /* "(tree fragment)":6
29431  *     if __pyx_checksum != 0xb068931:
29432  *         from pickle import PickleError as __pyx_PickleError
29433  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)             # <<<<<<<<<<<<<<
29434  *     __pyx_result = Enum.__new__(__pyx_type)
29435  *     if __pyx_state is not None:
29436  */
29437     __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
29438     __Pyx_GOTREF(__pyx_t_2);
29439     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
29440     __Pyx_GOTREF(__pyx_t_4);
29441     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
29442     __Pyx_INCREF(__pyx_v___pyx_PickleError);
29443     __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
29444     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
29445       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
29446       if (likely(__pyx_t_5)) {
29447         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
29448         __Pyx_INCREF(__pyx_t_5);
29449         __Pyx_INCREF(function);
29450         __Pyx_DECREF_SET(__pyx_t_2, function);
29451       }
29452     }
29453     __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);
29454     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
29455     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
29456     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
29457     __Pyx_GOTREF(__pyx_t_3);
29458     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
29459     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
29460     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29461     __PYX_ERR(1, 6, __pyx_L1_error)
29462 
29463     /* "(tree fragment)":4
29464  *     cdef object __pyx_PickleError
29465  *     cdef object __pyx_result
29466  *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
29467  *         from pickle import PickleError as __pyx_PickleError
29468  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
29469  */
29470   }
29471 
29472   /* "(tree fragment)":7
29473  *         from pickle import PickleError as __pyx_PickleError
29474  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
29475  *     __pyx_result = Enum.__new__(__pyx_type)             # <<<<<<<<<<<<<<
29476  *     if __pyx_state is not None:
29477  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
29478  */
29479   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
29480   __Pyx_GOTREF(__pyx_t_2);
29481   __pyx_t_4 = NULL;
29482   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
29483     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
29484     if (likely(__pyx_t_4)) {
29485       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
29486       __Pyx_INCREF(__pyx_t_4);
29487       __Pyx_INCREF(function);
29488       __Pyx_DECREF_SET(__pyx_t_2, function);
29489     }
29490   }
29491   __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);
29492   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
29493   if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
29494   __Pyx_GOTREF(__pyx_t_3);
29495   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
29496   __pyx_v___pyx_result = __pyx_t_3;
29497   __pyx_t_3 = 0;
29498 
29499   /* "(tree fragment)":8
29500  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
29501  *     __pyx_result = Enum.__new__(__pyx_type)
29502  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
29503  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
29504  *     return __pyx_result
29505  */
29506   __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
29507   __pyx_t_6 = (__pyx_t_1 != 0);
29508   if (__pyx_t_6) {
29509 
29510     /* "(tree fragment)":9
29511  *     __pyx_result = Enum.__new__(__pyx_type)
29512  *     if __pyx_state is not None:
29513  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
29514  *     return __pyx_result
29515  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
29516  */
29517     if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
29518     __pyx_t_3 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
29519     __Pyx_GOTREF(__pyx_t_3);
29520     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29521 
29522     /* "(tree fragment)":8
29523  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
29524  *     __pyx_result = Enum.__new__(__pyx_type)
29525  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
29526  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
29527  *     return __pyx_result
29528  */
29529   }
29530 
29531   /* "(tree fragment)":10
29532  *     if __pyx_state is not None:
29533  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
29534  *     return __pyx_result             # <<<<<<<<<<<<<<
29535  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
29536  *     __pyx_result.name = __pyx_state[0]
29537  */
29538   __Pyx_XDECREF(__pyx_r);
29539   __Pyx_INCREF(__pyx_v___pyx_result);
29540   __pyx_r = __pyx_v___pyx_result;
29541   goto __pyx_L0;
29542 
29543   /* "(tree fragment)":1
29544  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
29545  *     cdef object __pyx_PickleError
29546  *     cdef object __pyx_result
29547  */
29548 
29549   /* function exit code */
29550   __pyx_L1_error:;
29551   __Pyx_XDECREF(__pyx_t_2);
29552   __Pyx_XDECREF(__pyx_t_3);
29553   __Pyx_XDECREF(__pyx_t_4);
29554   __Pyx_XDECREF(__pyx_t_5);
29555   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
29556   __pyx_r = NULL;
29557   __pyx_L0:;
29558   __Pyx_XDECREF(__pyx_v___pyx_PickleError);
29559   __Pyx_XDECREF(__pyx_v___pyx_result);
29560   __Pyx_XGIVEREF(__pyx_r);
29561   __Pyx_RefNannyFinishContext();
29562   return __pyx_r;
29563 }
29564 
29565 /* "(tree fragment)":11
29566  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
29567  *     return __pyx_result
29568  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
29569  *     __pyx_result.name = __pyx_state[0]
29570  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
29571  */
29572 
29573 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
29574   PyObject *__pyx_r = NULL;
29575   __Pyx_RefNannyDeclarations
29576   PyObject *__pyx_t_1 = NULL;
29577   int __pyx_t_2;
29578   Py_ssize_t __pyx_t_3;
29579   int __pyx_t_4;
29580   int __pyx_t_5;
29581   PyObject *__pyx_t_6 = NULL;
29582   PyObject *__pyx_t_7 = NULL;
29583   PyObject *__pyx_t_8 = NULL;
29584   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);
29585 
29586   /* "(tree fragment)":12
29587  *     return __pyx_result
29588  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
29589  *     __pyx_result.name = __pyx_state[0]             # <<<<<<<<<<<<<<
29590  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
29591  *         __pyx_result.__dict__.update(__pyx_state[1])
29592  */
29593   if (unlikely(__pyx_v___pyx_state == Py_None)) {
29594     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
29595     __PYX_ERR(1, 12, __pyx_L1_error)
29596   }
29597   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
29598   __Pyx_GOTREF(__pyx_t_1);
29599   __Pyx_GIVEREF(__pyx_t_1);
29600   __Pyx_GOTREF(__pyx_v___pyx_result->name);
29601   __Pyx_DECREF(__pyx_v___pyx_result->name);
29602   __pyx_v___pyx_result->name = __pyx_t_1;
29603   __pyx_t_1 = 0;
29604 
29605   /* "(tree fragment)":13
29606  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
29607  *     __pyx_result.name = __pyx_state[0]
29608  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
29609  *         __pyx_result.__dict__.update(__pyx_state[1])
29610  */
29611   if (unlikely(__pyx_v___pyx_state == Py_None)) {
29612     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
29613     __PYX_ERR(1, 13, __pyx_L1_error)
29614   }
29615   __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
29616   __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
29617   if (__pyx_t_4) {
29618   } else {
29619     __pyx_t_2 = __pyx_t_4;
29620     goto __pyx_L4_bool_binop_done;
29621   }
29622   __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
29623   __pyx_t_5 = (__pyx_t_4 != 0);
29624   __pyx_t_2 = __pyx_t_5;
29625   __pyx_L4_bool_binop_done:;
29626   if (__pyx_t_2) {
29627 
29628     /* "(tree fragment)":14
29629  *     __pyx_result.name = __pyx_state[0]
29630  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
29631  *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
29632  */
29633     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
29634     __Pyx_GOTREF(__pyx_t_6);
29635     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
29636     __Pyx_GOTREF(__pyx_t_7);
29637     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29638     if (unlikely(__pyx_v___pyx_state == Py_None)) {
29639       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
29640       __PYX_ERR(1, 14, __pyx_L1_error)
29641     }
29642     __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
29643     __Pyx_GOTREF(__pyx_t_6);
29644     __pyx_t_8 = NULL;
29645     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
29646       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
29647       if (likely(__pyx_t_8)) {
29648         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
29649         __Pyx_INCREF(__pyx_t_8);
29650         __Pyx_INCREF(function);
29651         __Pyx_DECREF_SET(__pyx_t_7, function);
29652       }
29653     }
29654     __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);
29655     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
29656     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29657     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
29658     __Pyx_GOTREF(__pyx_t_1);
29659     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
29660     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
29661 
29662     /* "(tree fragment)":13
29663  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
29664  *     __pyx_result.name = __pyx_state[0]
29665  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
29666  *         __pyx_result.__dict__.update(__pyx_state[1])
29667  */
29668   }
29669 
29670   /* "(tree fragment)":11
29671  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
29672  *     return __pyx_result
29673  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
29674  *     __pyx_result.name = __pyx_state[0]
29675  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
29676  */
29677 
29678   /* function exit code */
29679   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
29680   goto __pyx_L0;
29681   __pyx_L1_error:;
29682   __Pyx_XDECREF(__pyx_t_1);
29683   __Pyx_XDECREF(__pyx_t_6);
29684   __Pyx_XDECREF(__pyx_t_7);
29685   __Pyx_XDECREF(__pyx_t_8);
29686   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
29687   __pyx_r = 0;
29688   __pyx_L0:;
29689   __Pyx_XGIVEREF(__pyx_r);
29690   __Pyx_RefNannyFinishContext();
29691   return __pyx_r;
29692 }
29693 
29694 /* "BufferFormatFromTypeInfo":1460
29695  *
29696  * @cname('__pyx_format_from_typeinfo')
29697  * cdef bytes format_from_typeinfo(__Pyx_TypeInfo *type):             # <<<<<<<<<<<<<<
29698  *     cdef __Pyx_StructField *field
29699  *     cdef __pyx_typeinfo_string fmt
29700  */
29701 
29702 static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo *__pyx_v_type) {
29703   __Pyx_StructField *__pyx_v_field;
29704   struct __pyx_typeinfo_string __pyx_v_fmt;
29705   PyObject *__pyx_v_part = 0;
29706   PyObject *__pyx_v_result = 0;
29707   PyObject *__pyx_v_alignment = NULL;
29708   PyObject *__pyx_v_parts = NULL;
29709   PyObject *__pyx_v_extents = NULL;
29710   int __pyx_v_i;
29711   PyObject *__pyx_r = NULL;
29712   __Pyx_RefNannyDeclarations
29713   int __pyx_t_1;
29714   int __pyx_t_2;
29715   PyObject *__pyx_t_3 = NULL;
29716   __Pyx_StructField *__pyx_t_4;
29717   PyObject *__pyx_t_5 = NULL;
29718   PyObject *__pyx_t_6 = NULL;
29719   int __pyx_t_7;
29720   int __pyx_t_8;
29721   int __pyx_t_9;
29722   int __pyx_t_10;
29723   __Pyx_RefNannySetupContext("format_from_typeinfo", 0);
29724 
29725   /* "BufferFormatFromTypeInfo":1465
29726  *     cdef bytes part, result
29727  *
29728  *     if type.typegroup == 'S':             # <<<<<<<<<<<<<<
29729  *         assert type.fields != NULL and type.fields.type != NULL
29730  *
29731  */
29732   __pyx_t_1 = ((__pyx_v_type->typegroup == 'S') != 0);
29733   if (__pyx_t_1) {
29734 
29735     /* "BufferFormatFromTypeInfo":1466
29736  *
29737  *     if type.typegroup == 'S':
29738  *         assert type.fields != NULL and type.fields.type != NULL             # <<<<<<<<<<<<<<
29739  *
29740  *         if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT:
29741  */
29742     #ifndef CYTHON_WITHOUT_ASSERTIONS
29743     if (unlikely(!Py_OptimizeFlag)) {
29744       __pyx_t_2 = ((__pyx_v_type->fields != NULL) != 0);
29745       if (__pyx_t_2) {
29746       } else {
29747         __pyx_t_1 = __pyx_t_2;
29748         goto __pyx_L4_bool_binop_done;
29749       }
29750       __pyx_t_2 = ((__pyx_v_type->fields->type != NULL) != 0);
29751       __pyx_t_1 = __pyx_t_2;
29752       __pyx_L4_bool_binop_done:;
29753       if (unlikely(!__pyx_t_1)) {
29754         PyErr_SetNone(PyExc_AssertionError);
29755         __PYX_ERR(1, 1466, __pyx_L1_error)
29756       }
29757     }
29758     #endif
29759 
29760     /* "BufferFormatFromTypeInfo":1468
29761  *         assert type.fields != NULL and type.fields.type != NULL
29762  *
29763  *         if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT:             # <<<<<<<<<<<<<<
29764  *             alignment = b'^'
29765  *         else:
29766  */
29767     __pyx_t_1 = ((__pyx_v_type->flags & __PYX_BUF_FLAGS_PACKED_STRUCT) != 0);
29768     if (__pyx_t_1) {
29769 
29770       /* "BufferFormatFromTypeInfo":1469
29771  *
29772  *         if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT:
29773  *             alignment = b'^'             # <<<<<<<<<<<<<<
29774  *         else:
29775  *             alignment = b''
29776  */
29777       __Pyx_INCREF(__pyx_kp_b__32);
29778       __pyx_v_alignment = __pyx_kp_b__32;
29779 
29780       /* "BufferFormatFromTypeInfo":1468
29781  *         assert type.fields != NULL and type.fields.type != NULL
29782  *
29783  *         if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT:             # <<<<<<<<<<<<<<
29784  *             alignment = b'^'
29785  *         else:
29786  */
29787       goto __pyx_L6;
29788     }
29789 
29790     /* "BufferFormatFromTypeInfo":1471
29791  *             alignment = b'^'
29792  *         else:
29793  *             alignment = b''             # <<<<<<<<<<<<<<
29794  *
29795  *         parts = [b"T{"]
29796  */
29797     /*else*/ {
29798       __Pyx_INCREF(__pyx_kp_b__33);
29799       __pyx_v_alignment = __pyx_kp_b__33;
29800     }
29801     __pyx_L6:;
29802 
29803     /* "BufferFormatFromTypeInfo":1473
29804  *             alignment = b''
29805  *
29806  *         parts = [b"T{"]             # <<<<<<<<<<<<<<
29807  *         field = type.fields
29808  *
29809  */
29810     __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1473, __pyx_L1_error)
29811     __Pyx_GOTREF(__pyx_t_3);
29812     __Pyx_INCREF(__pyx_kp_b_T);
29813     __Pyx_GIVEREF(__pyx_kp_b_T);
29814     PyList_SET_ITEM(__pyx_t_3, 0, __pyx_kp_b_T);
29815     __pyx_v_parts = ((PyObject*)__pyx_t_3);
29816     __pyx_t_3 = 0;
29817 
29818     /* "BufferFormatFromTypeInfo":1474
29819  *
29820  *         parts = [b"T{"]
29821  *         field = type.fields             # <<<<<<<<<<<<<<
29822  *
29823  *         while field.type:
29824  */
29825     __pyx_t_4 = __pyx_v_type->fields;
29826     __pyx_v_field = __pyx_t_4;
29827 
29828     /* "BufferFormatFromTypeInfo":1476
29829  *         field = type.fields
29830  *
29831  *         while field.type:             # <<<<<<<<<<<<<<
29832  *             part = format_from_typeinfo(field.type)
29833  *             parts.append(part + b':' + field.name + b':')
29834  */
29835     while (1) {
29836       __pyx_t_1 = (__pyx_v_field->type != 0);
29837       if (!__pyx_t_1) break;
29838 
29839       /* "BufferFormatFromTypeInfo":1477
29840  *
29841  *         while field.type:
29842  *             part = format_from_typeinfo(field.type)             # <<<<<<<<<<<<<<
29843  *             parts.append(part + b':' + field.name + b':')
29844  *             field += 1
29845  */
29846       __pyx_t_3 = __pyx_format_from_typeinfo(__pyx_v_field->type); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1477, __pyx_L1_error)
29847       __Pyx_GOTREF(__pyx_t_3);
29848       __Pyx_XDECREF_SET(__pyx_v_part, ((PyObject*)__pyx_t_3));
29849       __pyx_t_3 = 0;
29850 
29851       /* "BufferFormatFromTypeInfo":1478
29852  *         while field.type:
29853  *             part = format_from_typeinfo(field.type)
29854  *             parts.append(part + b':' + field.name + b':')             # <<<<<<<<<<<<<<
29855  *             field += 1
29856  *
29857  */
29858       __pyx_t_3 = PyNumber_Add(__pyx_v_part, __pyx_kp_b__34); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1478, __pyx_L1_error)
29859       __Pyx_GOTREF(__pyx_t_3);
29860       __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_field->name); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1478, __pyx_L1_error)
29861       __Pyx_GOTREF(__pyx_t_5);
29862       __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1478, __pyx_L1_error)
29863       __Pyx_GOTREF(__pyx_t_6);
29864       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29865       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
29866       __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_kp_b__34); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1478, __pyx_L1_error)
29867       __Pyx_GOTREF(__pyx_t_5);
29868       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29869       __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_parts, __pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(1, 1478, __pyx_L1_error)
29870       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
29871 
29872       /* "BufferFormatFromTypeInfo":1479
29873  *             part = format_from_typeinfo(field.type)
29874  *             parts.append(part + b':' + field.name + b':')
29875  *             field += 1             # <<<<<<<<<<<<<<
29876  *
29877  *         result = alignment.join(parts) + b'}'
29878  */
29879       __pyx_v_field = (__pyx_v_field + 1);
29880     }
29881 
29882     /* "BufferFormatFromTypeInfo":1481
29883  *             field += 1
29884  *
29885  *         result = alignment.join(parts) + b'}'             # <<<<<<<<<<<<<<
29886  *     else:
29887  *         fmt = __Pyx_TypeInfoToFormat(type)
29888  */
29889     __pyx_t_5 = __Pyx_PyBytes_Join(__pyx_v_alignment, __pyx_v_parts); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1481, __pyx_L1_error)
29890     __Pyx_GOTREF(__pyx_t_5);
29891     __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_kp_b__35); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1481, __pyx_L1_error)
29892     __Pyx_GOTREF(__pyx_t_6);
29893     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
29894     if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_6)->tp_name), 0))) __PYX_ERR(1, 1481, __pyx_L1_error)
29895     __pyx_v_result = ((PyObject*)__pyx_t_6);
29896     __pyx_t_6 = 0;
29897 
29898     /* "BufferFormatFromTypeInfo":1465
29899  *     cdef bytes part, result
29900  *
29901  *     if type.typegroup == 'S':             # <<<<<<<<<<<<<<
29902  *         assert type.fields != NULL and type.fields.type != NULL
29903  *
29904  */
29905     goto __pyx_L3;
29906   }
29907 
29908   /* "BufferFormatFromTypeInfo":1483
29909  *         result = alignment.join(parts) + b'}'
29910  *     else:
29911  *         fmt = __Pyx_TypeInfoToFormat(type)             # <<<<<<<<<<<<<<
29912  *         if type.arraysize[0]:
29913  *             extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]
29914  */
29915   /*else*/ {
29916     __pyx_v_fmt = __Pyx_TypeInfoToFormat(__pyx_v_type);
29917 
29918     /* "BufferFormatFromTypeInfo":1484
29919  *     else:
29920  *         fmt = __Pyx_TypeInfoToFormat(type)
29921  *         if type.arraysize[0]:             # <<<<<<<<<<<<<<
29922  *             extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]
29923  *             result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string
29924  */
29925     __pyx_t_1 = ((__pyx_v_type->arraysize[0]) != 0);
29926     if (__pyx_t_1) {
29927 
29928       /* "BufferFormatFromTypeInfo":1485
29929  *         fmt = __Pyx_TypeInfoToFormat(type)
29930  *         if type.arraysize[0]:
29931  *             extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]             # <<<<<<<<<<<<<<
29932  *             result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string
29933  *         else:
29934  */
29935       __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1485, __pyx_L1_error)
29936       __Pyx_GOTREF(__pyx_t_6);
29937       __pyx_t_8 = __pyx_v_type->ndim;
29938       __pyx_t_9 = __pyx_t_8;
29939       for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
29940         __pyx_v_i = __pyx_t_10;
29941         __pyx_t_5 = __Pyx_PyInt_FromSize_t((__pyx_v_type->arraysize[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1485, __pyx_L1_error)
29942         __Pyx_GOTREF(__pyx_t_5);
29943         __pyx_t_3 = __Pyx_PyObject_Unicode(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1485, __pyx_L1_error)
29944         __Pyx_GOTREF(__pyx_t_3);
29945         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
29946         if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_3))) __PYX_ERR(1, 1485, __pyx_L1_error)
29947         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29948       }
29949       __pyx_v_extents = ((PyObject*)__pyx_t_6);
29950       __pyx_t_6 = 0;
29951 
29952       /* "BufferFormatFromTypeInfo":1486
29953  *         if type.arraysize[0]:
29954  *             extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]
29955  *             result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string             # <<<<<<<<<<<<<<
29956  *         else:
29957  *             result = fmt.string
29958  */
29959       __pyx_t_6 = PyUnicode_Join(__pyx_kp_u__36, __pyx_v_extents); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1486, __pyx_L1_error)
29960       __Pyx_GOTREF(__pyx_t_6);
29961       __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_s, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1486, __pyx_L1_error)
29962       __Pyx_GOTREF(__pyx_t_3);
29963       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29964       __pyx_t_6 = PyUnicode_AsASCIIString(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1486, __pyx_L1_error)
29965       __Pyx_GOTREF(__pyx_t_6);
29966       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29967       __pyx_t_3 = __Pyx_PyObject_FromString(__pyx_v_fmt.string); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1486, __pyx_L1_error)
29968       __Pyx_GOTREF(__pyx_t_3);
29969       __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1486, __pyx_L1_error)
29970       __Pyx_GOTREF(__pyx_t_5);
29971       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29972       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29973       if (!(likely(PyBytes_CheckExact(__pyx_t_5))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(1, 1486, __pyx_L1_error)
29974       __pyx_v_result = ((PyObject*)__pyx_t_5);
29975       __pyx_t_5 = 0;
29976 
29977       /* "BufferFormatFromTypeInfo":1484
29978  *     else:
29979  *         fmt = __Pyx_TypeInfoToFormat(type)
29980  *         if type.arraysize[0]:             # <<<<<<<<<<<<<<
29981  *             extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]
29982  *             result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string
29983  */
29984       goto __pyx_L9;
29985     }
29986 
29987     /* "BufferFormatFromTypeInfo":1488
29988  *             result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string
29989  *         else:
29990  *             result = fmt.string             # <<<<<<<<<<<<<<
29991  *
29992  *     return result
29993  */
29994     /*else*/ {
29995       __pyx_t_5 = __Pyx_PyObject_FromString(__pyx_v_fmt.string); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1488, __pyx_L1_error)
29996       __Pyx_GOTREF(__pyx_t_5);
29997       __pyx_v_result = ((PyObject*)__pyx_t_5);
29998       __pyx_t_5 = 0;
29999     }
30000     __pyx_L9:;
30001   }
30002   __pyx_L3:;
30003 
30004   /* "BufferFormatFromTypeInfo":1490
30005  *             result = fmt.string
30006  *
30007  *     return result             # <<<<<<<<<<<<<<
30008  */
30009   __Pyx_XDECREF(__pyx_r);
30010   __Pyx_INCREF(__pyx_v_result);
30011   __pyx_r = __pyx_v_result;
30012   goto __pyx_L0;
30013 
30014   /* "BufferFormatFromTypeInfo":1460
30015  *
30016  * @cname('__pyx_format_from_typeinfo')
30017  * cdef bytes format_from_typeinfo(__Pyx_TypeInfo *type):             # <<<<<<<<<<<<<<
30018  *     cdef __Pyx_StructField *field
30019  *     cdef __pyx_typeinfo_string fmt
30020  */
30021 
30022   /* function exit code */
30023   __pyx_L1_error:;
30024   __Pyx_XDECREF(__pyx_t_3);
30025   __Pyx_XDECREF(__pyx_t_5);
30026   __Pyx_XDECREF(__pyx_t_6);
30027   __Pyx_AddTraceback("BufferFormatFromTypeInfo.format_from_typeinfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
30028   __pyx_r = 0;
30029   __pyx_L0:;
30030   __Pyx_XDECREF(__pyx_v_part);
30031   __Pyx_XDECREF(__pyx_v_result);
30032   __Pyx_XDECREF(__pyx_v_alignment);
30033   __Pyx_XDECREF(__pyx_v_parts);
30034   __Pyx_XDECREF(__pyx_v_extents);
30035   __Pyx_XGIVEREF(__pyx_r);
30036   __Pyx_RefNannyFinishContext();
30037   return __pyx_r;
30038 }
30039 static struct __pyx_vtabstruct_2yt_9utilities_3lib_11amr_kdtools_Node __pyx_vtable_2yt_9utilities_3lib_11amr_kdtools_Node;
30040 
30041 static PyObject *__pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools_Node(PyTypeObject *t, PyObject *a, PyObject *k) {
30042   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *p;
30043   PyObject *o;
30044   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
30045     o = (*t->tp_alloc)(t, 0);
30046   } else {
30047     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
30048   }
30049   if (unlikely(!o)) return 0;
30050   p = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)o);
30051   p->__pyx_vtab = __pyx_vtabptr_2yt_9utilities_3lib_11amr_kdtools_Node;
30052   p->left = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)Py_None); Py_INCREF(Py_None);
30053   p->right = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)Py_None); Py_INCREF(Py_None);
30054   p->parent = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)Py_None); Py_INCREF(Py_None);
30055   p->data = Py_None; Py_INCREF(Py_None);
30056   if (unlikely(__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_1__cinit__(o, a, k) < 0)) goto bad;
30057   return o;
30058   bad:
30059   Py_DECREF(o); o = 0;
30060   return NULL;
30061 }
30062 
30063 static void __pyx_tp_dealloc_2yt_9utilities_3lib_11amr_kdtools_Node(PyObject *o) {
30064   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *p = (struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)o;
30065   #if CYTHON_USE_TP_FINALIZE
30066   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
30067     if (PyObject_CallFinalizerFromDealloc(o)) return;
30068   }
30069   #endif
30070   PyObject_GC_UnTrack(o);
30071   {
30072     PyObject *etype, *eval, *etb;
30073     PyErr_Fetch(&etype, &eval, &etb);
30074     ++Py_REFCNT(o);
30075     __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_15__dealloc__(o);
30076     --Py_REFCNT(o);
30077     PyErr_Restore(etype, eval, etb);
30078   }
30079   Py_CLEAR(p->left);
30080   Py_CLEAR(p->right);
30081   Py_CLEAR(p->parent);
30082   Py_CLEAR(p->data);
30083   (*Py_TYPE(o)->tp_free)(o);
30084 }
30085 
30086 static int __pyx_tp_traverse_2yt_9utilities_3lib_11amr_kdtools_Node(PyObject *o, visitproc v, void *a) {
30087   int e;
30088   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *p = (struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)o;
30089   if (p->left) {
30090     e = (*v)(((PyObject *)p->left), a); if (e) return e;
30091   }
30092   if (p->right) {
30093     e = (*v)(((PyObject *)p->right), a); if (e) return e;
30094   }
30095   if (p->parent) {
30096     e = (*v)(((PyObject *)p->parent), a); if (e) return e;
30097   }
30098   if (p->data) {
30099     e = (*v)(p->data, a); if (e) return e;
30100   }
30101   return 0;
30102 }
30103 
30104 static int __pyx_tp_clear_2yt_9utilities_3lib_11amr_kdtools_Node(PyObject *o) {
30105   PyObject* tmp;
30106   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *p = (struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)o;
30107   tmp = ((PyObject*)p->left);
30108   p->left = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)Py_None); Py_INCREF(Py_None);
30109   Py_XDECREF(tmp);
30110   tmp = ((PyObject*)p->right);
30111   p->right = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)Py_None); Py_INCREF(Py_None);
30112   Py_XDECREF(tmp);
30113   tmp = ((PyObject*)p->parent);
30114   p->parent = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *)Py_None); Py_INCREF(Py_None);
30115   Py_XDECREF(tmp);
30116   tmp = ((PyObject*)p->data);
30117   p->data = Py_None; Py_INCREF(Py_None);
30118   Py_XDECREF(tmp);
30119   return 0;
30120 }
30121 
30122 static PyObject *__pyx_getprop_2yt_9utilities_3lib_11amr_kdtools_4Node_left(PyObject *o, CYTHON_UNUSED void *x) {
30123   return __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4left_1__get__(o);
30124 }
30125 
30126 static int __pyx_setprop_2yt_9utilities_3lib_11amr_kdtools_4Node_left(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
30127   if (v) {
30128     return __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4left_3__set__(o, v);
30129   }
30130   else {
30131     return __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4left_5__del__(o);
30132   }
30133 }
30134 
30135 static PyObject *__pyx_getprop_2yt_9utilities_3lib_11amr_kdtools_4Node_right(PyObject *o, CYTHON_UNUSED void *x) {
30136   return __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_5right_1__get__(o);
30137 }
30138 
30139 static int __pyx_setprop_2yt_9utilities_3lib_11amr_kdtools_4Node_right(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
30140   if (v) {
30141     return __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_5right_3__set__(o, v);
30142   }
30143   else {
30144     return __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_5right_5__del__(o);
30145   }
30146 }
30147 
30148 static PyObject *__pyx_getprop_2yt_9utilities_3lib_11amr_kdtools_4Node_parent(PyObject *o, CYTHON_UNUSED void *x) {
30149   return __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_6parent_1__get__(o);
30150 }
30151 
30152 static int __pyx_setprop_2yt_9utilities_3lib_11amr_kdtools_4Node_parent(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
30153   if (v) {
30154     return __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_6parent_3__set__(o, v);
30155   }
30156   else {
30157     return __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_6parent_5__del__(o);
30158   }
30159 }
30160 
30161 static PyObject *__pyx_getprop_2yt_9utilities_3lib_11amr_kdtools_4Node_grid(PyObject *o, CYTHON_UNUSED void *x) {
30162   return __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4grid_1__get__(o);
30163 }
30164 
30165 static int __pyx_setprop_2yt_9utilities_3lib_11amr_kdtools_4Node_grid(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
30166   if (v) {
30167     return __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4grid_3__set__(o, v);
30168   }
30169   else {
30170     PyErr_SetString(PyExc_NotImplementedError, "__del__");
30171     return -1;
30172   }
30173 }
30174 
30175 static PyObject *__pyx_getprop_2yt_9utilities_3lib_11amr_kdtools_4Node_dirty(PyObject *o, CYTHON_UNUSED void *x) {
30176   return __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_5dirty_1__get__(o);
30177 }
30178 
30179 static int __pyx_setprop_2yt_9utilities_3lib_11amr_kdtools_4Node_dirty(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
30180   if (v) {
30181     return __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_5dirty_3__set__(o, v);
30182   }
30183   else {
30184     PyErr_SetString(PyExc_NotImplementedError, "__del__");
30185     return -1;
30186   }
30187 }
30188 
30189 static PyObject *__pyx_getprop_2yt_9utilities_3lib_11amr_kdtools_4Node_node_id(PyObject *o, CYTHON_UNUSED void *x) {
30190   return __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_7node_id_1__get__(o);
30191 }
30192 
30193 static int __pyx_setprop_2yt_9utilities_3lib_11amr_kdtools_4Node_node_id(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
30194   if (v) {
30195     return __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_7node_id_3__set__(o, v);
30196   }
30197   else {
30198     PyErr_SetString(PyExc_NotImplementedError, "__del__");
30199     return -1;
30200   }
30201 }
30202 
30203 static PyObject *__pyx_getprop_2yt_9utilities_3lib_11amr_kdtools_4Node_node_ind(PyObject *o, CYTHON_UNUSED void *x) {
30204   return __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_8node_ind_1__get__(o);
30205 }
30206 
30207 static int __pyx_setprop_2yt_9utilities_3lib_11amr_kdtools_4Node_node_ind(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
30208   if (v) {
30209     return __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_8node_ind_3__set__(o, v);
30210   }
30211   else {
30212     PyErr_SetString(PyExc_NotImplementedError, "__del__");
30213     return -1;
30214   }
30215 }
30216 
30217 static PyObject *__pyx_getprop_2yt_9utilities_3lib_11amr_kdtools_4Node_data(PyObject *o, CYTHON_UNUSED void *x) {
30218   return __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4data_1__get__(o);
30219 }
30220 
30221 static int __pyx_setprop_2yt_9utilities_3lib_11amr_kdtools_4Node_data(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
30222   if (v) {
30223     return __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4data_3__set__(o, v);
30224   }
30225   else {
30226     return __pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_4data_5__del__(o);
30227   }
30228 }
30229 
30230 static PyMethodDef __pyx_methods_2yt_9utilities_3lib_11amr_kdtools_Node[] = {
30231   {"print_me", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_3print_me, METH_NOARGS, 0},
30232   {"get_split_dim", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_5get_split_dim, METH_NOARGS, 0},
30233   {"get_split_pos", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_7get_split_pos, METH_NOARGS, 0},
30234   {"set_left_edge", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_9set_left_edge, METH_O, 0},
30235   {"set_right_edge", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_11set_right_edge, METH_O, 0},
30236   {"create_split", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_13create_split, METH_VARARGS|METH_KEYWORDS, 0},
30237   {"get_left_edge", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_17get_left_edge, METH_NOARGS, 0},
30238   {"get_right_edge", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_19get_right_edge, METH_NOARGS, 0},
30239   {"set_dirty", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_21set_dirty, METH_O, 0},
30240   {"kd_traverse", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_23kd_traverse, METH_VARARGS|METH_KEYWORDS, 0},
30241   {"add_pygrid", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_26add_pygrid, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2yt_9utilities_3lib_11amr_kdtools_4Node_25add_pygrid},
30242   {"add_grids", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_28add_grids, METH_VARARGS|METH_KEYWORDS, 0},
30243   {"kd_sum_volume", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_30kd_sum_volume, METH_NOARGS, 0},
30244   {"kd_node_check", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_32kd_node_check, METH_NOARGS, 0},
30245   {"kd_is_leaf", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_34kd_is_leaf, METH_NOARGS, 0},
30246   {"depth_traverse", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_36depth_traverse, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2yt_9utilities_3lib_11amr_kdtools_4Node_35depth_traverse},
30247   {"depth_first_touch", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_39depth_first_touch, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2yt_9utilities_3lib_11amr_kdtools_4Node_38depth_first_touch},
30248   {"breadth_traverse", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_42breadth_traverse, METH_NOARGS, __pyx_doc_2yt_9utilities_3lib_11amr_kdtools_4Node_41breadth_traverse},
30249   {"viewpoint_traverse", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_45viewpoint_traverse, METH_O, __pyx_doc_2yt_9utilities_3lib_11amr_kdtools_4Node_44viewpoint_traverse},
30250   {"find_node", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_48find_node, METH_O, __pyx_doc_2yt_9utilities_3lib_11amr_kdtools_4Node_47find_node},
30251   {"__reduce_cython__", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_50__reduce_cython__, METH_NOARGS, 0},
30252   {"__setstate_cython__", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_11amr_kdtools_4Node_52__setstate_cython__, METH_O, 0},
30253   {0, 0, 0, 0}
30254 };
30255 
30256 static struct PyGetSetDef __pyx_getsets_2yt_9utilities_3lib_11amr_kdtools_Node[] = {
30257   {(char *)"left", __pyx_getprop_2yt_9utilities_3lib_11amr_kdtools_4Node_left, __pyx_setprop_2yt_9utilities_3lib_11amr_kdtools_4Node_left, (char *)0, 0},
30258   {(char *)"right", __pyx_getprop_2yt_9utilities_3lib_11amr_kdtools_4Node_right, __pyx_setprop_2yt_9utilities_3lib_11amr_kdtools_4Node_right, (char *)0, 0},
30259   {(char *)"parent", __pyx_getprop_2yt_9utilities_3lib_11amr_kdtools_4Node_parent, __pyx_setprop_2yt_9utilities_3lib_11amr_kdtools_4Node_parent, (char *)0, 0},
30260   {(char *)"grid", __pyx_getprop_2yt_9utilities_3lib_11amr_kdtools_4Node_grid, __pyx_setprop_2yt_9utilities_3lib_11amr_kdtools_4Node_grid, (char *)0, 0},
30261   {(char *)"dirty", __pyx_getprop_2yt_9utilities_3lib_11amr_kdtools_4Node_dirty, __pyx_setprop_2yt_9utilities_3lib_11amr_kdtools_4Node_dirty, (char *)0, 0},
30262   {(char *)"node_id", __pyx_getprop_2yt_9utilities_3lib_11amr_kdtools_4Node_node_id, __pyx_setprop_2yt_9utilities_3lib_11amr_kdtools_4Node_node_id, (char *)0, 0},
30263   {(char *)"node_ind", __pyx_getprop_2yt_9utilities_3lib_11amr_kdtools_4Node_node_ind, __pyx_setprop_2yt_9utilities_3lib_11amr_kdtools_4Node_node_ind, (char *)0, 0},
30264   {(char *)"data", __pyx_getprop_2yt_9utilities_3lib_11amr_kdtools_4Node_data, __pyx_setprop_2yt_9utilities_3lib_11amr_kdtools_4Node_data, (char *)0, 0},
30265   {0, 0, 0, 0, 0}
30266 };
30267 
30268 static PyTypeObject __pyx_type_2yt_9utilities_3lib_11amr_kdtools_Node = {
30269   PyVarObject_HEAD_INIT(0, 0)
30270   "yt.utilities.lib.amr_kdtools.Node", /*tp_name*/
30271   sizeof(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node), /*tp_basicsize*/
30272   0, /*tp_itemsize*/
30273   __pyx_tp_dealloc_2yt_9utilities_3lib_11amr_kdtools_Node, /*tp_dealloc*/
30274   0, /*tp_print*/
30275   0, /*tp_getattr*/
30276   0, /*tp_setattr*/
30277   #if PY_MAJOR_VERSION < 3
30278   0, /*tp_compare*/
30279   #endif
30280   #if PY_MAJOR_VERSION >= 3
30281   0, /*tp_as_async*/
30282   #endif
30283   0, /*tp_repr*/
30284   0, /*tp_as_number*/
30285   0, /*tp_as_sequence*/
30286   0, /*tp_as_mapping*/
30287   0, /*tp_hash*/
30288   0, /*tp_call*/
30289   0, /*tp_str*/
30290   0, /*tp_getattro*/
30291   0, /*tp_setattro*/
30292   0, /*tp_as_buffer*/
30293   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
30294   0, /*tp_doc*/
30295   __pyx_tp_traverse_2yt_9utilities_3lib_11amr_kdtools_Node, /*tp_traverse*/
30296   __pyx_tp_clear_2yt_9utilities_3lib_11amr_kdtools_Node, /*tp_clear*/
30297   0, /*tp_richcompare*/
30298   0, /*tp_weaklistoffset*/
30299   0, /*tp_iter*/
30300   0, /*tp_iternext*/
30301   __pyx_methods_2yt_9utilities_3lib_11amr_kdtools_Node, /*tp_methods*/
30302   0, /*tp_members*/
30303   __pyx_getsets_2yt_9utilities_3lib_11amr_kdtools_Node, /*tp_getset*/
30304   0, /*tp_base*/
30305   0, /*tp_dict*/
30306   0, /*tp_descr_get*/
30307   0, /*tp_descr_set*/
30308   0, /*tp_dictoffset*/
30309   0, /*tp_init*/
30310   0, /*tp_alloc*/
30311   __pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools_Node, /*tp_new*/
30312   0, /*tp_free*/
30313   0, /*tp_is_gc*/
30314   0, /*tp_bases*/
30315   0, /*tp_mro*/
30316   0, /*tp_cache*/
30317   0, /*tp_subclasses*/
30318   0, /*tp_weaklist*/
30319   0, /*tp_del*/
30320   0, /*tp_version_tag*/
30321   #if PY_VERSION_HEX >= 0x030400a1
30322   0, /*tp_finalize*/
30323   #endif
30324   #if PY_VERSION_HEX >= 0x030800b1
30325   0, /*tp_vectorcall*/
30326   #endif
30327 };
30328 
30329 static struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse *__pyx_freelist_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse[8];
30330 static int __pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse = 0;
30331 
30332 static PyObject *__pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
30333   PyObject *o;
30334   if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse)))) {
30335     o = (PyObject*)__pyx_freelist_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse[--__pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse];
30336     memset(o, 0, sizeof(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse));
30337     (void) PyObject_INIT(o, t);
30338     PyObject_GC_Track(o);
30339   } else {
30340     o = (*t->tp_alloc)(t, 0);
30341     if (unlikely(!o)) return 0;
30342   }
30343   return o;
30344 }
30345 
30346 static void __pyx_tp_dealloc_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse(PyObject *o) {
30347   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse *p = (struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse *)o;
30348   PyObject_GC_UnTrack(o);
30349   Py_CLEAR(p->__pyx_v_node);
30350   Py_CLEAR(p->__pyx_v_self);
30351   Py_CLEAR(p->__pyx_v_viewpoint);
30352   Py_CLEAR(p->__pyx_t_0);
30353   if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse)))) {
30354     __pyx_freelist_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse[__pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse++] = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse *)o);
30355   } else {
30356     (*Py_TYPE(o)->tp_free)(o);
30357   }
30358 }
30359 
30360 static int __pyx_tp_traverse_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse(PyObject *o, visitproc v, void *a) {
30361   int e;
30362   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse *p = (struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse *)o;
30363   if (p->__pyx_v_node) {
30364     e = (*v)(((PyObject *)p->__pyx_v_node), a); if (e) return e;
30365   }
30366   if (p->__pyx_v_self) {
30367     e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
30368   }
30369   if (p->__pyx_v_viewpoint) {
30370     e = (*v)(p->__pyx_v_viewpoint, a); if (e) return e;
30371   }
30372   if (p->__pyx_t_0) {
30373     e = (*v)(p->__pyx_t_0, a); if (e) return e;
30374   }
30375   return 0;
30376 }
30377 
30378 static PyTypeObject __pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse = {
30379   PyVarObject_HEAD_INIT(0, 0)
30380   "yt.utilities.lib.amr_kdtools.__pyx_scope_struct__kd_traverse", /*tp_name*/
30381   sizeof(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse), /*tp_basicsize*/
30382   0, /*tp_itemsize*/
30383   __pyx_tp_dealloc_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse, /*tp_dealloc*/
30384   0, /*tp_print*/
30385   0, /*tp_getattr*/
30386   0, /*tp_setattr*/
30387   #if PY_MAJOR_VERSION < 3
30388   0, /*tp_compare*/
30389   #endif
30390   #if PY_MAJOR_VERSION >= 3
30391   0, /*tp_as_async*/
30392   #endif
30393   0, /*tp_repr*/
30394   0, /*tp_as_number*/
30395   0, /*tp_as_sequence*/
30396   0, /*tp_as_mapping*/
30397   0, /*tp_hash*/
30398   0, /*tp_call*/
30399   0, /*tp_str*/
30400   0, /*tp_getattro*/
30401   0, /*tp_setattro*/
30402   0, /*tp_as_buffer*/
30403   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
30404   0, /*tp_doc*/
30405   __pyx_tp_traverse_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse, /*tp_traverse*/
30406   0, /*tp_clear*/
30407   0, /*tp_richcompare*/
30408   0, /*tp_weaklistoffset*/
30409   0, /*tp_iter*/
30410   0, /*tp_iternext*/
30411   0, /*tp_methods*/
30412   0, /*tp_members*/
30413   0, /*tp_getset*/
30414   0, /*tp_base*/
30415   0, /*tp_dict*/
30416   0, /*tp_descr_get*/
30417   0, /*tp_descr_set*/
30418   0, /*tp_dictoffset*/
30419   0, /*tp_init*/
30420   0, /*tp_alloc*/
30421   __pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse, /*tp_new*/
30422   0, /*tp_free*/
30423   0, /*tp_is_gc*/
30424   0, /*tp_bases*/
30425   0, /*tp_mro*/
30426   0, /*tp_cache*/
30427   0, /*tp_subclasses*/
30428   0, /*tp_weaklist*/
30429   0, /*tp_del*/
30430   0, /*tp_version_tag*/
30431   #if PY_VERSION_HEX >= 0x030400a1
30432   0, /*tp_finalize*/
30433   #endif
30434   #if PY_VERSION_HEX >= 0x030800b1
30435   0, /*tp_vectorcall*/
30436   #endif
30437 };
30438 
30439 static struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse *__pyx_freelist_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse[8];
30440 static int __pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse = 0;
30441 
30442 static PyObject *__pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
30443   PyObject *o;
30444   if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse)))) {
30445     o = (PyObject*)__pyx_freelist_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse[--__pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse];
30446     memset(o, 0, sizeof(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse));
30447     (void) PyObject_INIT(o, t);
30448     PyObject_GC_Track(o);
30449   } else {
30450     o = (*t->tp_alloc)(t, 0);
30451     if (unlikely(!o)) return 0;
30452   }
30453   return o;
30454 }
30455 
30456 static void __pyx_tp_dealloc_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse(PyObject *o) {
30457   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse *p = (struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse *)o;
30458   PyObject_GC_UnTrack(o);
30459   Py_CLEAR(p->__pyx_v_current);
30460   Py_CLEAR(p->__pyx_v_max_node);
30461   Py_CLEAR(p->__pyx_v_previous);
30462   Py_CLEAR(p->__pyx_v_self);
30463   if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse)))) {
30464     __pyx_freelist_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse[__pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse++] = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse *)o);
30465   } else {
30466     (*Py_TYPE(o)->tp_free)(o);
30467   }
30468 }
30469 
30470 static int __pyx_tp_traverse_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse(PyObject *o, visitproc v, void *a) {
30471   int e;
30472   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse *p = (struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse *)o;
30473   if (p->__pyx_v_current) {
30474     e = (*v)(p->__pyx_v_current, a); if (e) return e;
30475   }
30476   if (p->__pyx_v_max_node) {
30477     e = (*v)(p->__pyx_v_max_node, a); if (e) return e;
30478   }
30479   if (p->__pyx_v_previous) {
30480     e = (*v)(p->__pyx_v_previous, a); if (e) return e;
30481   }
30482   if (p->__pyx_v_self) {
30483     e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
30484   }
30485   return 0;
30486 }
30487 
30488 static PyTypeObject __pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse = {
30489   PyVarObject_HEAD_INIT(0, 0)
30490   "yt.utilities.lib.amr_kdtools.__pyx_scope_struct_1_depth_traverse", /*tp_name*/
30491   sizeof(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse), /*tp_basicsize*/
30492   0, /*tp_itemsize*/
30493   __pyx_tp_dealloc_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse, /*tp_dealloc*/
30494   0, /*tp_print*/
30495   0, /*tp_getattr*/
30496   0, /*tp_setattr*/
30497   #if PY_MAJOR_VERSION < 3
30498   0, /*tp_compare*/
30499   #endif
30500   #if PY_MAJOR_VERSION >= 3
30501   0, /*tp_as_async*/
30502   #endif
30503   0, /*tp_repr*/
30504   0, /*tp_as_number*/
30505   0, /*tp_as_sequence*/
30506   0, /*tp_as_mapping*/
30507   0, /*tp_hash*/
30508   0, /*tp_call*/
30509   0, /*tp_str*/
30510   0, /*tp_getattro*/
30511   0, /*tp_setattro*/
30512   0, /*tp_as_buffer*/
30513   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
30514   0, /*tp_doc*/
30515   __pyx_tp_traverse_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse, /*tp_traverse*/
30516   0, /*tp_clear*/
30517   0, /*tp_richcompare*/
30518   0, /*tp_weaklistoffset*/
30519   0, /*tp_iter*/
30520   0, /*tp_iternext*/
30521   0, /*tp_methods*/
30522   0, /*tp_members*/
30523   0, /*tp_getset*/
30524   0, /*tp_base*/
30525   0, /*tp_dict*/
30526   0, /*tp_descr_get*/
30527   0, /*tp_descr_set*/
30528   0, /*tp_dictoffset*/
30529   0, /*tp_init*/
30530   0, /*tp_alloc*/
30531   __pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse, /*tp_new*/
30532   0, /*tp_free*/
30533   0, /*tp_is_gc*/
30534   0, /*tp_bases*/
30535   0, /*tp_mro*/
30536   0, /*tp_cache*/
30537   0, /*tp_subclasses*/
30538   0, /*tp_weaklist*/
30539   0, /*tp_del*/
30540   0, /*tp_version_tag*/
30541   #if PY_VERSION_HEX >= 0x030400a1
30542   0, /*tp_finalize*/
30543   #endif
30544   #if PY_VERSION_HEX >= 0x030800b1
30545   0, /*tp_vectorcall*/
30546   #endif
30547 };
30548 
30549 static struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch *__pyx_freelist_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch[8];
30550 static int __pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch = 0;
30551 
30552 static PyObject *__pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
30553   PyObject *o;
30554   if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch)))) {
30555     o = (PyObject*)__pyx_freelist_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch[--__pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch];
30556     memset(o, 0, sizeof(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch));
30557     (void) PyObject_INIT(o, t);
30558     PyObject_GC_Track(o);
30559   } else {
30560     o = (*t->tp_alloc)(t, 0);
30561     if (unlikely(!o)) return 0;
30562   }
30563   return o;
30564 }
30565 
30566 static void __pyx_tp_dealloc_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch(PyObject *o) {
30567   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch *p = (struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch *)o;
30568   PyObject_GC_UnTrack(o);
30569   Py_CLEAR(p->__pyx_v_current);
30570   Py_CLEAR(p->__pyx_v_max_node);
30571   Py_CLEAR(p->__pyx_v_previous);
30572   Py_CLEAR(p->__pyx_v_self);
30573   if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch)))) {
30574     __pyx_freelist_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch[__pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch++] = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch *)o);
30575   } else {
30576     (*Py_TYPE(o)->tp_free)(o);
30577   }
30578 }
30579 
30580 static int __pyx_tp_traverse_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch(PyObject *o, visitproc v, void *a) {
30581   int e;
30582   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch *p = (struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch *)o;
30583   if (p->__pyx_v_current) {
30584     e = (*v)(p->__pyx_v_current, a); if (e) return e;
30585   }
30586   if (p->__pyx_v_max_node) {
30587     e = (*v)(p->__pyx_v_max_node, a); if (e) return e;
30588   }
30589   if (p->__pyx_v_previous) {
30590     e = (*v)(p->__pyx_v_previous, a); if (e) return e;
30591   }
30592   if (p->__pyx_v_self) {
30593     e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
30594   }
30595   return 0;
30596 }
30597 
30598 static PyTypeObject __pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch = {
30599   PyVarObject_HEAD_INIT(0, 0)
30600   "yt.utilities.lib.amr_kdtools.__pyx_scope_struct_2_depth_first_touch", /*tp_name*/
30601   sizeof(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch), /*tp_basicsize*/
30602   0, /*tp_itemsize*/
30603   __pyx_tp_dealloc_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch, /*tp_dealloc*/
30604   0, /*tp_print*/
30605   0, /*tp_getattr*/
30606   0, /*tp_setattr*/
30607   #if PY_MAJOR_VERSION < 3
30608   0, /*tp_compare*/
30609   #endif
30610   #if PY_MAJOR_VERSION >= 3
30611   0, /*tp_as_async*/
30612   #endif
30613   0, /*tp_repr*/
30614   0, /*tp_as_number*/
30615   0, /*tp_as_sequence*/
30616   0, /*tp_as_mapping*/
30617   0, /*tp_hash*/
30618   0, /*tp_call*/
30619   0, /*tp_str*/
30620   0, /*tp_getattro*/
30621   0, /*tp_setattro*/
30622   0, /*tp_as_buffer*/
30623   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
30624   0, /*tp_doc*/
30625   __pyx_tp_traverse_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch, /*tp_traverse*/
30626   0, /*tp_clear*/
30627   0, /*tp_richcompare*/
30628   0, /*tp_weaklistoffset*/
30629   0, /*tp_iter*/
30630   0, /*tp_iternext*/
30631   0, /*tp_methods*/
30632   0, /*tp_members*/
30633   0, /*tp_getset*/
30634   0, /*tp_base*/
30635   0, /*tp_dict*/
30636   0, /*tp_descr_get*/
30637   0, /*tp_descr_set*/
30638   0, /*tp_dictoffset*/
30639   0, /*tp_init*/
30640   0, /*tp_alloc*/
30641   __pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch, /*tp_new*/
30642   0, /*tp_free*/
30643   0, /*tp_is_gc*/
30644   0, /*tp_bases*/
30645   0, /*tp_mro*/
30646   0, /*tp_cache*/
30647   0, /*tp_subclasses*/
30648   0, /*tp_weaklist*/
30649   0, /*tp_del*/
30650   0, /*tp_version_tag*/
30651   #if PY_VERSION_HEX >= 0x030400a1
30652   0, /*tp_finalize*/
30653   #endif
30654   #if PY_VERSION_HEX >= 0x030800b1
30655   0, /*tp_vectorcall*/
30656   #endif
30657 };
30658 
30659 static struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse *__pyx_freelist_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse[8];
30660 static int __pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse = 0;
30661 
30662 static PyObject *__pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
30663   PyObject *o;
30664   if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse)))) {
30665     o = (PyObject*)__pyx_freelist_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse[--__pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse];
30666     memset(o, 0, sizeof(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse));
30667     (void) PyObject_INIT(o, t);
30668     PyObject_GC_Track(o);
30669   } else {
30670     o = (*t->tp_alloc)(t, 0);
30671     if (unlikely(!o)) return 0;
30672   }
30673   return o;
30674 }
30675 
30676 static void __pyx_tp_dealloc_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse(PyObject *o) {
30677   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse *p = (struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse *)o;
30678   PyObject_GC_UnTrack(o);
30679   Py_CLEAR(p->__pyx_v_current);
30680   Py_CLEAR(p->__pyx_v_previous);
30681   Py_CLEAR(p->__pyx_v_self);
30682   if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse)))) {
30683     __pyx_freelist_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse[__pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse++] = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse *)o);
30684   } else {
30685     (*Py_TYPE(o)->tp_free)(o);
30686   }
30687 }
30688 
30689 static int __pyx_tp_traverse_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse(PyObject *o, visitproc v, void *a) {
30690   int e;
30691   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse *p = (struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse *)o;
30692   if (p->__pyx_v_current) {
30693     e = (*v)(p->__pyx_v_current, a); if (e) return e;
30694   }
30695   if (p->__pyx_v_previous) {
30696     e = (*v)(p->__pyx_v_previous, a); if (e) return e;
30697   }
30698   if (p->__pyx_v_self) {
30699     e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
30700   }
30701   return 0;
30702 }
30703 
30704 static PyTypeObject __pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse = {
30705   PyVarObject_HEAD_INIT(0, 0)
30706   "yt.utilities.lib.amr_kdtools.__pyx_scope_struct_3_breadth_traverse", /*tp_name*/
30707   sizeof(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse), /*tp_basicsize*/
30708   0, /*tp_itemsize*/
30709   __pyx_tp_dealloc_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse, /*tp_dealloc*/
30710   0, /*tp_print*/
30711   0, /*tp_getattr*/
30712   0, /*tp_setattr*/
30713   #if PY_MAJOR_VERSION < 3
30714   0, /*tp_compare*/
30715   #endif
30716   #if PY_MAJOR_VERSION >= 3
30717   0, /*tp_as_async*/
30718   #endif
30719   0, /*tp_repr*/
30720   0, /*tp_as_number*/
30721   0, /*tp_as_sequence*/
30722   0, /*tp_as_mapping*/
30723   0, /*tp_hash*/
30724   0, /*tp_call*/
30725   0, /*tp_str*/
30726   0, /*tp_getattro*/
30727   0, /*tp_setattro*/
30728   0, /*tp_as_buffer*/
30729   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
30730   0, /*tp_doc*/
30731   __pyx_tp_traverse_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse, /*tp_traverse*/
30732   0, /*tp_clear*/
30733   0, /*tp_richcompare*/
30734   0, /*tp_weaklistoffset*/
30735   0, /*tp_iter*/
30736   0, /*tp_iternext*/
30737   0, /*tp_methods*/
30738   0, /*tp_members*/
30739   0, /*tp_getset*/
30740   0, /*tp_base*/
30741   0, /*tp_dict*/
30742   0, /*tp_descr_get*/
30743   0, /*tp_descr_set*/
30744   0, /*tp_dictoffset*/
30745   0, /*tp_init*/
30746   0, /*tp_alloc*/
30747   __pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse, /*tp_new*/
30748   0, /*tp_free*/
30749   0, /*tp_is_gc*/
30750   0, /*tp_bases*/
30751   0, /*tp_mro*/
30752   0, /*tp_cache*/
30753   0, /*tp_subclasses*/
30754   0, /*tp_weaklist*/
30755   0, /*tp_del*/
30756   0, /*tp_version_tag*/
30757   #if PY_VERSION_HEX >= 0x030400a1
30758   0, /*tp_finalize*/
30759   #endif
30760   #if PY_VERSION_HEX >= 0x030800b1
30761   0, /*tp_vectorcall*/
30762   #endif
30763 };
30764 
30765 static struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse *__pyx_freelist_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse[8];
30766 static int __pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse = 0;
30767 
30768 static PyObject *__pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
30769   PyObject *o;
30770   if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse)))) {
30771     o = (PyObject*)__pyx_freelist_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse[--__pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse];
30772     memset(o, 0, sizeof(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse));
30773     (void) PyObject_INIT(o, t);
30774     PyObject_GC_Track(o);
30775   } else {
30776     o = (*t->tp_alloc)(t, 0);
30777     if (unlikely(!o)) return 0;
30778   }
30779   return o;
30780 }
30781 
30782 static void __pyx_tp_dealloc_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse(PyObject *o) {
30783   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse *p = (struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse *)o;
30784   PyObject_GC_UnTrack(o);
30785   Py_CLEAR(p->__pyx_v_current);
30786   Py_CLEAR(p->__pyx_v_previous);
30787   Py_CLEAR(p->__pyx_v_self);
30788   Py_CLEAR(p->__pyx_v_viewpoint);
30789   if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse)))) {
30790     __pyx_freelist_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse[__pyx_freecount_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse++] = ((struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse *)o);
30791   } else {
30792     (*Py_TYPE(o)->tp_free)(o);
30793   }
30794 }
30795 
30796 static int __pyx_tp_traverse_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse(PyObject *o, visitproc v, void *a) {
30797   int e;
30798   struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse *p = (struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse *)o;
30799   if (p->__pyx_v_current) {
30800     e = (*v)(p->__pyx_v_current, a); if (e) return e;
30801   }
30802   if (p->__pyx_v_previous) {
30803     e = (*v)(p->__pyx_v_previous, a); if (e) return e;
30804   }
30805   if (p->__pyx_v_self) {
30806     e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
30807   }
30808   if (p->__pyx_v_viewpoint) {
30809     e = (*v)(p->__pyx_v_viewpoint, a); if (e) return e;
30810   }
30811   return 0;
30812 }
30813 
30814 static PyTypeObject __pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse = {
30815   PyVarObject_HEAD_INIT(0, 0)
30816   "yt.utilities.lib.amr_kdtools.__pyx_scope_struct_4_viewpoint_traverse", /*tp_name*/
30817   sizeof(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse), /*tp_basicsize*/
30818   0, /*tp_itemsize*/
30819   __pyx_tp_dealloc_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse, /*tp_dealloc*/
30820   0, /*tp_print*/
30821   0, /*tp_getattr*/
30822   0, /*tp_setattr*/
30823   #if PY_MAJOR_VERSION < 3
30824   0, /*tp_compare*/
30825   #endif
30826   #if PY_MAJOR_VERSION >= 3
30827   0, /*tp_as_async*/
30828   #endif
30829   0, /*tp_repr*/
30830   0, /*tp_as_number*/
30831   0, /*tp_as_sequence*/
30832   0, /*tp_as_mapping*/
30833   0, /*tp_hash*/
30834   0, /*tp_call*/
30835   0, /*tp_str*/
30836   0, /*tp_getattro*/
30837   0, /*tp_setattro*/
30838   0, /*tp_as_buffer*/
30839   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
30840   0, /*tp_doc*/
30841   __pyx_tp_traverse_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse, /*tp_traverse*/
30842   0, /*tp_clear*/
30843   0, /*tp_richcompare*/
30844   0, /*tp_weaklistoffset*/
30845   0, /*tp_iter*/
30846   0, /*tp_iternext*/
30847   0, /*tp_methods*/
30848   0, /*tp_members*/
30849   0, /*tp_getset*/
30850   0, /*tp_base*/
30851   0, /*tp_dict*/
30852   0, /*tp_descr_get*/
30853   0, /*tp_descr_set*/
30854   0, /*tp_dictoffset*/
30855   0, /*tp_init*/
30856   0, /*tp_alloc*/
30857   __pyx_tp_new_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse, /*tp_new*/
30858   0, /*tp_free*/
30859   0, /*tp_is_gc*/
30860   0, /*tp_bases*/
30861   0, /*tp_mro*/
30862   0, /*tp_cache*/
30863   0, /*tp_subclasses*/
30864   0, /*tp_weaklist*/
30865   0, /*tp_del*/
30866   0, /*tp_version_tag*/
30867   #if PY_VERSION_HEX >= 0x030400a1
30868   0, /*tp_finalize*/
30869   #endif
30870   #if PY_VERSION_HEX >= 0x030800b1
30871   0, /*tp_vectorcall*/
30872   #endif
30873 };
30874 static struct __pyx_vtabstruct_array __pyx_vtable_array;
30875 
30876 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
30877   struct __pyx_array_obj *p;
30878   PyObject *o;
30879   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
30880     o = (*t->tp_alloc)(t, 0);
30881   } else {
30882     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
30883   }
30884   if (unlikely(!o)) return 0;
30885   p = ((struct __pyx_array_obj *)o);
30886   p->__pyx_vtab = __pyx_vtabptr_array;
30887   p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
30888   p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
30889   if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
30890   return o;
30891   bad:
30892   Py_DECREF(o); o = 0;
30893   return NULL;
30894 }
30895 
30896 static void __pyx_tp_dealloc_array(PyObject *o) {
30897   struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
30898   #if CYTHON_USE_TP_FINALIZE
30899   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))) {
30900     if (PyObject_CallFinalizerFromDealloc(o)) return;
30901   }
30902   #endif
30903   {
30904     PyObject *etype, *eval, *etb;
30905     PyErr_Fetch(&etype, &eval, &etb);
30906     ++Py_REFCNT(o);
30907     __pyx_array___dealloc__(o);
30908     --Py_REFCNT(o);
30909     PyErr_Restore(etype, eval, etb);
30910   }
30911   Py_CLEAR(p->mode);
30912   Py_CLEAR(p->_format);
30913   (*Py_TYPE(o)->tp_free)(o);
30914 }
30915 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
30916   PyObject *r;
30917   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
30918   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
30919   Py_DECREF(x);
30920   return r;
30921 }
30922 
30923 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
30924   if (v) {
30925     return __pyx_array___setitem__(o, i, v);
30926   }
30927   else {
30928     PyErr_Format(PyExc_NotImplementedError,
30929       "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
30930     return -1;
30931   }
30932 }
30933 
30934 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
30935   PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
30936   if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
30937     PyErr_Clear();
30938     v = __pyx_array___getattr__(o, n);
30939   }
30940   return v;
30941 }
30942 
30943 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
30944   return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
30945 }
30946 
30947 static PyMethodDef __pyx_methods_array[] = {
30948   {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
30949   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
30950   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
30951   {0, 0, 0, 0}
30952 };
30953 
30954 static struct PyGetSetDef __pyx_getsets_array[] = {
30955   {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
30956   {0, 0, 0, 0, 0}
30957 };
30958 
30959 static PySequenceMethods __pyx_tp_as_sequence_array = {
30960   __pyx_array___len__, /*sq_length*/
30961   0, /*sq_concat*/
30962   0, /*sq_repeat*/
30963   __pyx_sq_item_array, /*sq_item*/
30964   0, /*sq_slice*/
30965   0, /*sq_ass_item*/
30966   0, /*sq_ass_slice*/
30967   0, /*sq_contains*/
30968   0, /*sq_inplace_concat*/
30969   0, /*sq_inplace_repeat*/
30970 };
30971 
30972 static PyMappingMethods __pyx_tp_as_mapping_array = {
30973   __pyx_array___len__, /*mp_length*/
30974   __pyx_array___getitem__, /*mp_subscript*/
30975   __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
30976 };
30977 
30978 static PyBufferProcs __pyx_tp_as_buffer_array = {
30979   #if PY_MAJOR_VERSION < 3
30980   0, /*bf_getreadbuffer*/
30981   #endif
30982   #if PY_MAJOR_VERSION < 3
30983   0, /*bf_getwritebuffer*/
30984   #endif
30985   #if PY_MAJOR_VERSION < 3
30986   0, /*bf_getsegcount*/
30987   #endif
30988   #if PY_MAJOR_VERSION < 3
30989   0, /*bf_getcharbuffer*/
30990   #endif
30991   __pyx_array_getbuffer, /*bf_getbuffer*/
30992   0, /*bf_releasebuffer*/
30993 };
30994 
30995 static PyTypeObject __pyx_type___pyx_array = {
30996   PyVarObject_HEAD_INIT(0, 0)
30997   "yt.utilities.lib.amr_kdtools.array", /*tp_name*/
30998   sizeof(struct __pyx_array_obj), /*tp_basicsize*/
30999   0, /*tp_itemsize*/
31000   __pyx_tp_dealloc_array, /*tp_dealloc*/
31001   0, /*tp_print*/
31002   0, /*tp_getattr*/
31003   0, /*tp_setattr*/
31004   #if PY_MAJOR_VERSION < 3
31005   0, /*tp_compare*/
31006   #endif
31007   #if PY_MAJOR_VERSION >= 3
31008   0, /*tp_as_async*/
31009   #endif
31010   0, /*tp_repr*/
31011   0, /*tp_as_number*/
31012   &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
31013   &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
31014   0, /*tp_hash*/
31015   0, /*tp_call*/
31016   0, /*tp_str*/
31017   __pyx_tp_getattro_array, /*tp_getattro*/
31018   0, /*tp_setattro*/
31019   &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
31020   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
31021   0, /*tp_doc*/
31022   0, /*tp_traverse*/
31023   0, /*tp_clear*/
31024   0, /*tp_richcompare*/
31025   0, /*tp_weaklistoffset*/
31026   0, /*tp_iter*/
31027   0, /*tp_iternext*/
31028   __pyx_methods_array, /*tp_methods*/
31029   0, /*tp_members*/
31030   __pyx_getsets_array, /*tp_getset*/
31031   0, /*tp_base*/
31032   0, /*tp_dict*/
31033   0, /*tp_descr_get*/
31034   0, /*tp_descr_set*/
31035   0, /*tp_dictoffset*/
31036   0, /*tp_init*/
31037   0, /*tp_alloc*/
31038   __pyx_tp_new_array, /*tp_new*/
31039   0, /*tp_free*/
31040   0, /*tp_is_gc*/
31041   0, /*tp_bases*/
31042   0, /*tp_mro*/
31043   0, /*tp_cache*/
31044   0, /*tp_subclasses*/
31045   0, /*tp_weaklist*/
31046   0, /*tp_del*/
31047   0, /*tp_version_tag*/
31048   #if PY_VERSION_HEX >= 0x030400a1
31049   0, /*tp_finalize*/
31050   #endif
31051   #if PY_VERSION_HEX >= 0x030800b1
31052   0, /*tp_vectorcall*/
31053   #endif
31054 };
31055 
31056 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
31057   struct __pyx_MemviewEnum_obj *p;
31058   PyObject *o;
31059   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
31060     o = (*t->tp_alloc)(t, 0);
31061   } else {
31062     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
31063   }
31064   if (unlikely(!o)) return 0;
31065   p = ((struct __pyx_MemviewEnum_obj *)o);
31066   p->name = Py_None; Py_INCREF(Py_None);
31067   return o;
31068 }
31069 
31070 static void __pyx_tp_dealloc_Enum(PyObject *o) {
31071   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
31072   #if CYTHON_USE_TP_FINALIZE
31073   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
31074     if (PyObject_CallFinalizerFromDealloc(o)) return;
31075   }
31076   #endif
31077   PyObject_GC_UnTrack(o);
31078   Py_CLEAR(p->name);
31079   (*Py_TYPE(o)->tp_free)(o);
31080 }
31081 
31082 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
31083   int e;
31084   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
31085   if (p->name) {
31086     e = (*v)(p->name, a); if (e) return e;
31087   }
31088   return 0;
31089 }
31090 
31091 static int __pyx_tp_clear_Enum(PyObject *o) {
31092   PyObject* tmp;
31093   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
31094   tmp = ((PyObject*)p->name);
31095   p->name = Py_None; Py_INCREF(Py_None);
31096   Py_XDECREF(tmp);
31097   return 0;
31098 }
31099 
31100 static PyMethodDef __pyx_methods_Enum[] = {
31101   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
31102   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
31103   {0, 0, 0, 0}
31104 };
31105 
31106 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
31107   PyVarObject_HEAD_INIT(0, 0)
31108   "yt.utilities.lib.amr_kdtools.Enum", /*tp_name*/
31109   sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
31110   0, /*tp_itemsize*/
31111   __pyx_tp_dealloc_Enum, /*tp_dealloc*/
31112   0, /*tp_print*/
31113   0, /*tp_getattr*/
31114   0, /*tp_setattr*/
31115   #if PY_MAJOR_VERSION < 3
31116   0, /*tp_compare*/
31117   #endif
31118   #if PY_MAJOR_VERSION >= 3
31119   0, /*tp_as_async*/
31120   #endif
31121   __pyx_MemviewEnum___repr__, /*tp_repr*/
31122   0, /*tp_as_number*/
31123   0, /*tp_as_sequence*/
31124   0, /*tp_as_mapping*/
31125   0, /*tp_hash*/
31126   0, /*tp_call*/
31127   0, /*tp_str*/
31128   0, /*tp_getattro*/
31129   0, /*tp_setattro*/
31130   0, /*tp_as_buffer*/
31131   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
31132   0, /*tp_doc*/
31133   __pyx_tp_traverse_Enum, /*tp_traverse*/
31134   __pyx_tp_clear_Enum, /*tp_clear*/
31135   0, /*tp_richcompare*/
31136   0, /*tp_weaklistoffset*/
31137   0, /*tp_iter*/
31138   0, /*tp_iternext*/
31139   __pyx_methods_Enum, /*tp_methods*/
31140   0, /*tp_members*/
31141   0, /*tp_getset*/
31142   0, /*tp_base*/
31143   0, /*tp_dict*/
31144   0, /*tp_descr_get*/
31145   0, /*tp_descr_set*/
31146   0, /*tp_dictoffset*/
31147   __pyx_MemviewEnum___init__, /*tp_init*/
31148   0, /*tp_alloc*/
31149   __pyx_tp_new_Enum, /*tp_new*/
31150   0, /*tp_free*/
31151   0, /*tp_is_gc*/
31152   0, /*tp_bases*/
31153   0, /*tp_mro*/
31154   0, /*tp_cache*/
31155   0, /*tp_subclasses*/
31156   0, /*tp_weaklist*/
31157   0, /*tp_del*/
31158   0, /*tp_version_tag*/
31159   #if PY_VERSION_HEX >= 0x030400a1
31160   0, /*tp_finalize*/
31161   #endif
31162   #if PY_VERSION_HEX >= 0x030800b1
31163   0, /*tp_vectorcall*/
31164   #endif
31165 };
31166 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
31167 
31168 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
31169   struct __pyx_memoryview_obj *p;
31170   PyObject *o;
31171   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
31172     o = (*t->tp_alloc)(t, 0);
31173   } else {
31174     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
31175   }
31176   if (unlikely(!o)) return 0;
31177   p = ((struct __pyx_memoryview_obj *)o);
31178   p->__pyx_vtab = __pyx_vtabptr_memoryview;
31179   p->obj = Py_None; Py_INCREF(Py_None);
31180   p->_size = Py_None; Py_INCREF(Py_None);
31181   p->_array_interface = Py_None; Py_INCREF(Py_None);
31182   p->view.obj = NULL;
31183   if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
31184   return o;
31185   bad:
31186   Py_DECREF(o); o = 0;
31187   return NULL;
31188 }
31189 
31190 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
31191   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
31192   #if CYTHON_USE_TP_FINALIZE
31193   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
31194     if (PyObject_CallFinalizerFromDealloc(o)) return;
31195   }
31196   #endif
31197   PyObject_GC_UnTrack(o);
31198   {
31199     PyObject *etype, *eval, *etb;
31200     PyErr_Fetch(&etype, &eval, &etb);
31201     ++Py_REFCNT(o);
31202     __pyx_memoryview___dealloc__(o);
31203     --Py_REFCNT(o);
31204     PyErr_Restore(etype, eval, etb);
31205   }
31206   Py_CLEAR(p->obj);
31207   Py_CLEAR(p->_size);
31208   Py_CLEAR(p->_array_interface);
31209   (*Py_TYPE(o)->tp_free)(o);
31210 }
31211 
31212 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
31213   int e;
31214   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
31215   if (p->obj) {
31216     e = (*v)(p->obj, a); if (e) return e;
31217   }
31218   if (p->_size) {
31219     e = (*v)(p->_size, a); if (e) return e;
31220   }
31221   if (p->_array_interface) {
31222     e = (*v)(p->_array_interface, a); if (e) return e;
31223   }
31224   if (p->view.obj) {
31225     e = (*v)(p->view.obj, a); if (e) return e;
31226   }
31227   return 0;
31228 }
31229 
31230 static int __pyx_tp_clear_memoryview(PyObject *o) {
31231   PyObject* tmp;
31232   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
31233   tmp = ((PyObject*)p->obj);
31234   p->obj = Py_None; Py_INCREF(Py_None);
31235   Py_XDECREF(tmp);
31236   tmp = ((PyObject*)p->_size);
31237   p->_size = Py_None; Py_INCREF(Py_None);
31238   Py_XDECREF(tmp);
31239   tmp = ((PyObject*)p->_array_interface);
31240   p->_array_interface = Py_None; Py_INCREF(Py_None);
31241   Py_XDECREF(tmp);
31242   Py_CLEAR(p->view.obj);
31243   return 0;
31244 }
31245 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
31246   PyObject *r;
31247   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
31248   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
31249   Py_DECREF(x);
31250   return r;
31251 }
31252 
31253 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
31254   if (v) {
31255     return __pyx_memoryview___setitem__(o, i, v);
31256   }
31257   else {
31258     PyErr_Format(PyExc_NotImplementedError,
31259       "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
31260     return -1;
31261   }
31262 }
31263 
31264 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
31265   return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
31266 }
31267 
31268 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
31269   return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
31270 }
31271 
31272 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
31273   return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
31274 }
31275 
31276 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
31277   return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
31278 }
31279 
31280 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
31281   return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
31282 }
31283 
31284 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
31285   return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
31286 }
31287 
31288 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
31289   return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
31290 }
31291 
31292 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
31293   return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
31294 }
31295 
31296 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
31297   return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
31298 }
31299 
31300 static PyMethodDef __pyx_methods_memoryview[] = {
31301   {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
31302   {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
31303   {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
31304   {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
31305   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
31306   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
31307   {0, 0, 0, 0}
31308 };
31309 
31310 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
31311   {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
31312   {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
31313   {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
31314   {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
31315   {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
31316   {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
31317   {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
31318   {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
31319   {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
31320   {0, 0, 0, 0, 0}
31321 };
31322 
31323 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
31324   __pyx_memoryview___len__, /*sq_length*/
31325   0, /*sq_concat*/
31326   0, /*sq_repeat*/
31327   __pyx_sq_item_memoryview, /*sq_item*/
31328   0, /*sq_slice*/
31329   0, /*sq_ass_item*/
31330   0, /*sq_ass_slice*/
31331   0, /*sq_contains*/
31332   0, /*sq_inplace_concat*/
31333   0, /*sq_inplace_repeat*/
31334 };
31335 
31336 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
31337   __pyx_memoryview___len__, /*mp_length*/
31338   __pyx_memoryview___getitem__, /*mp_subscript*/
31339   __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
31340 };
31341 
31342 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
31343   #if PY_MAJOR_VERSION < 3
31344   0, /*bf_getreadbuffer*/
31345   #endif
31346   #if PY_MAJOR_VERSION < 3
31347   0, /*bf_getwritebuffer*/
31348   #endif
31349   #if PY_MAJOR_VERSION < 3
31350   0, /*bf_getsegcount*/
31351   #endif
31352   #if PY_MAJOR_VERSION < 3
31353   0, /*bf_getcharbuffer*/
31354   #endif
31355   __pyx_memoryview_getbuffer, /*bf_getbuffer*/
31356   0, /*bf_releasebuffer*/
31357 };
31358 
31359 static PyTypeObject __pyx_type___pyx_memoryview = {
31360   PyVarObject_HEAD_INIT(0, 0)
31361   "yt.utilities.lib.amr_kdtools.memoryview", /*tp_name*/
31362   sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
31363   0, /*tp_itemsize*/
31364   __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
31365   0, /*tp_print*/
31366   0, /*tp_getattr*/
31367   0, /*tp_setattr*/
31368   #if PY_MAJOR_VERSION < 3
31369   0, /*tp_compare*/
31370   #endif
31371   #if PY_MAJOR_VERSION >= 3
31372   0, /*tp_as_async*/
31373   #endif
31374   __pyx_memoryview___repr__, /*tp_repr*/
31375   0, /*tp_as_number*/
31376   &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
31377   &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
31378   0, /*tp_hash*/
31379   0, /*tp_call*/
31380   __pyx_memoryview___str__, /*tp_str*/
31381   0, /*tp_getattro*/
31382   0, /*tp_setattro*/
31383   &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
31384   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
31385   0, /*tp_doc*/
31386   __pyx_tp_traverse_memoryview, /*tp_traverse*/
31387   __pyx_tp_clear_memoryview, /*tp_clear*/
31388   0, /*tp_richcompare*/
31389   0, /*tp_weaklistoffset*/
31390   0, /*tp_iter*/
31391   0, /*tp_iternext*/
31392   __pyx_methods_memoryview, /*tp_methods*/
31393   0, /*tp_members*/
31394   __pyx_getsets_memoryview, /*tp_getset*/
31395   0, /*tp_base*/
31396   0, /*tp_dict*/
31397   0, /*tp_descr_get*/
31398   0, /*tp_descr_set*/
31399   0, /*tp_dictoffset*/
31400   0, /*tp_init*/
31401   0, /*tp_alloc*/
31402   __pyx_tp_new_memoryview, /*tp_new*/
31403   0, /*tp_free*/
31404   0, /*tp_is_gc*/
31405   0, /*tp_bases*/
31406   0, /*tp_mro*/
31407   0, /*tp_cache*/
31408   0, /*tp_subclasses*/
31409   0, /*tp_weaklist*/
31410   0, /*tp_del*/
31411   0, /*tp_version_tag*/
31412   #if PY_VERSION_HEX >= 0x030400a1
31413   0, /*tp_finalize*/
31414   #endif
31415   #if PY_VERSION_HEX >= 0x030800b1
31416   0, /*tp_vectorcall*/
31417   #endif
31418 };
31419 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
31420 
31421 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
31422   struct __pyx_memoryviewslice_obj *p;
31423   PyObject *o = __pyx_tp_new_memoryview(t, a, k);
31424   if (unlikely(!o)) return 0;
31425   p = ((struct __pyx_memoryviewslice_obj *)o);
31426   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
31427   p->from_object = Py_None; Py_INCREF(Py_None);
31428   p->from_slice.memview = NULL;
31429   return o;
31430 }
31431 
31432 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
31433   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
31434   #if CYTHON_USE_TP_FINALIZE
31435   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
31436     if (PyObject_CallFinalizerFromDealloc(o)) return;
31437   }
31438   #endif
31439   PyObject_GC_UnTrack(o);
31440   {
31441     PyObject *etype, *eval, *etb;
31442     PyErr_Fetch(&etype, &eval, &etb);
31443     ++Py_REFCNT(o);
31444     __pyx_memoryviewslice___dealloc__(o);
31445     --Py_REFCNT(o);
31446     PyErr_Restore(etype, eval, etb);
31447   }
31448   Py_CLEAR(p->from_object);
31449   PyObject_GC_Track(o);
31450   __pyx_tp_dealloc_memoryview(o);
31451 }
31452 
31453 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
31454   int e;
31455   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
31456   e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
31457   if (p->from_object) {
31458     e = (*v)(p->from_object, a); if (e) return e;
31459   }
31460   return 0;
31461 }
31462 
31463 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
31464   PyObject* tmp;
31465   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
31466   __pyx_tp_clear_memoryview(o);
31467   tmp = ((PyObject*)p->from_object);
31468   p->from_object = Py_None; Py_INCREF(Py_None);
31469   Py_XDECREF(tmp);
31470   __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
31471   return 0;
31472 }
31473 
31474 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
31475   return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
31476 }
31477 
31478 static PyMethodDef __pyx_methods__memoryviewslice[] = {
31479   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
31480   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
31481   {0, 0, 0, 0}
31482 };
31483 
31484 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
31485   {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
31486   {0, 0, 0, 0, 0}
31487 };
31488 
31489 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
31490   PyVarObject_HEAD_INIT(0, 0)
31491   "yt.utilities.lib.amr_kdtools._memoryviewslice", /*tp_name*/
31492   sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
31493   0, /*tp_itemsize*/
31494   __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
31495   0, /*tp_print*/
31496   0, /*tp_getattr*/
31497   0, /*tp_setattr*/
31498   #if PY_MAJOR_VERSION < 3
31499   0, /*tp_compare*/
31500   #endif
31501   #if PY_MAJOR_VERSION >= 3
31502   0, /*tp_as_async*/
31503   #endif
31504   #if CYTHON_COMPILING_IN_PYPY
31505   __pyx_memoryview___repr__, /*tp_repr*/
31506   #else
31507   0, /*tp_repr*/
31508   #endif
31509   0, /*tp_as_number*/
31510   0, /*tp_as_sequence*/
31511   0, /*tp_as_mapping*/
31512   0, /*tp_hash*/
31513   0, /*tp_call*/
31514   #if CYTHON_COMPILING_IN_PYPY
31515   __pyx_memoryview___str__, /*tp_str*/
31516   #else
31517   0, /*tp_str*/
31518   #endif
31519   0, /*tp_getattro*/
31520   0, /*tp_setattro*/
31521   0, /*tp_as_buffer*/
31522   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
31523   "Internal class for passing memoryview slices to Python", /*tp_doc*/
31524   __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
31525   __pyx_tp_clear__memoryviewslice, /*tp_clear*/
31526   0, /*tp_richcompare*/
31527   0, /*tp_weaklistoffset*/
31528   0, /*tp_iter*/
31529   0, /*tp_iternext*/
31530   __pyx_methods__memoryviewslice, /*tp_methods*/
31531   0, /*tp_members*/
31532   __pyx_getsets__memoryviewslice, /*tp_getset*/
31533   0, /*tp_base*/
31534   0, /*tp_dict*/
31535   0, /*tp_descr_get*/
31536   0, /*tp_descr_set*/
31537   0, /*tp_dictoffset*/
31538   0, /*tp_init*/
31539   0, /*tp_alloc*/
31540   __pyx_tp_new__memoryviewslice, /*tp_new*/
31541   0, /*tp_free*/
31542   0, /*tp_is_gc*/
31543   0, /*tp_bases*/
31544   0, /*tp_mro*/
31545   0, /*tp_cache*/
31546   0, /*tp_subclasses*/
31547   0, /*tp_weaklist*/
31548   0, /*tp_del*/
31549   0, /*tp_version_tag*/
31550   #if PY_VERSION_HEX >= 0x030400a1
31551   0, /*tp_finalize*/
31552   #endif
31553   #if PY_VERSION_HEX >= 0x030800b1
31554   0, /*tp_vectorcall*/
31555   #endif
31556 };
31557 
31558 static PyMethodDef __pyx_methods[] = {
31559   {0, 0, 0, 0}
31560 };
31561 
31562 #if PY_MAJOR_VERSION >= 3
31563 #if CYTHON_PEP489_MULTI_PHASE_INIT
31564 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
31565 static int __pyx_pymod_exec_amr_kdtools(PyObject* module); /*proto*/
31566 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
31567   {Py_mod_create, (void*)__pyx_pymod_create},
31568   {Py_mod_exec, (void*)__pyx_pymod_exec_amr_kdtools},
31569   {0, NULL}
31570 };
31571 #endif
31572 
31573 static struct PyModuleDef __pyx_moduledef = {
31574     PyModuleDef_HEAD_INIT,
31575     "amr_kdtools",
31576     __pyx_k_AMR_kD_Tree_Cython_Tools, /* m_doc */
31577   #if CYTHON_PEP489_MULTI_PHASE_INIT
31578     0, /* m_size */
31579   #else
31580     -1, /* m_size */
31581   #endif
31582     __pyx_methods /* m_methods */,
31583   #if CYTHON_PEP489_MULTI_PHASE_INIT
31584     __pyx_moduledef_slots, /* m_slots */
31585   #else
31586     NULL, /* m_reload */
31587   #endif
31588     NULL, /* m_traverse */
31589     NULL, /* m_clear */
31590     NULL /* m_free */
31591 };
31592 #endif
31593 #ifndef CYTHON_SMALL_CODE
31594 #if defined(__clang__)
31595     #define CYTHON_SMALL_CODE
31596 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
31597     #define CYTHON_SMALL_CODE __attribute__((cold))
31598 #else
31599     #define CYTHON_SMALL_CODE
31600 #endif
31601 #endif
31602 
31603 static __Pyx_StringTabEntry __pyx_string_tab[] = {
31604   {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
31605   {&__pyx_n_s_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 0, 1, 1},
31606   {&__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},
31607   {&__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},
31608   {&__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},
31609   {&__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},
31610   {&__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},
31611   {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
31612   {&__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},
31613   {&__pyx_kp_s_Failed_to_split_grids, __pyx_k_Failed_to_split_grids, sizeof(__pyx_k_Failed_to_split_grids), 0, 0, 1, 0},
31614   {&__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},
31615   {&__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},
31616   {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
31617   {&__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},
31618   {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
31619   {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
31620   {&__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},
31621   {&__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},
31622   {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
31623   {&__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},
31624   {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
31625   {&__pyx_n_s_Node, __pyx_k_Node, sizeof(__pyx_k_Node), 0, 0, 1, 1},
31626   {&__pyx_n_s_Node_breadth_traverse, __pyx_k_Node_breadth_traverse, sizeof(__pyx_k_Node_breadth_traverse), 0, 0, 1, 1},
31627   {&__pyx_n_s_Node_depth_first_touch, __pyx_k_Node_depth_first_touch, sizeof(__pyx_k_Node_depth_first_touch), 0, 0, 1, 1},
31628   {&__pyx_n_s_Node_depth_traverse, __pyx_k_Node_depth_traverse, sizeof(__pyx_k_Node_depth_traverse), 0, 0, 1, 1},
31629   {&__pyx_kp_s_Node_i, __pyx_k_Node_i, sizeof(__pyx_k_Node_i), 0, 0, 1, 0},
31630   {&__pyx_n_s_Node_kd_traverse, __pyx_k_Node_kd_traverse, sizeof(__pyx_k_Node_kd_traverse), 0, 0, 1, 1},
31631   {&__pyx_n_s_Node_viewpoint_traverse, __pyx_k_Node_viewpoint_traverse, sizeof(__pyx_k_Node_viewpoint_traverse), 0, 0, 1, 1},
31632   {&__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},
31633   {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
31634   {&__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},
31635   {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
31636   {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
31637   {&__pyx_kp_b_T, __pyx_k_T, sizeof(__pyx_k_T), 0, 0, 0, 0},
31638   {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
31639   {&__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},
31640   {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
31641   {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
31642   {&__pyx_kp_b__32, __pyx_k__32, sizeof(__pyx_k__32), 0, 0, 0, 0},
31643   {&__pyx_kp_b__33, __pyx_k__33, sizeof(__pyx_k__33), 0, 0, 0, 0},
31644   {&__pyx_kp_b__34, __pyx_k__34, sizeof(__pyx_k__34), 0, 0, 0, 0},
31645   {&__pyx_kp_b__35, __pyx_k__35, sizeof(__pyx_k__35), 0, 0, 0, 0},
31646   {&__pyx_kp_u__36, __pyx_k__36, sizeof(__pyx_k__36), 0, 1, 0, 0},
31647   {&__pyx_n_s_add_grids, __pyx_k_add_grids, sizeof(__pyx_k_add_grids), 0, 0, 1, 1},
31648   {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
31649   {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
31650   {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
31651   {&__pyx_n_s_breadth_traverse, __pyx_k_breadth_traverse, sizeof(__pyx_k_breadth_traverse), 0, 0, 1, 1},
31652   {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
31653   {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
31654   {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
31655   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
31656   {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
31657   {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
31658   {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
31659   {&__pyx_n_s_current, __pyx_k_current, sizeof(__pyx_k_current), 0, 0, 1, 1},
31660   {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
31661   {&__pyx_n_s_depth_first_touch, __pyx_k_depth_first_touch, sizeof(__pyx_k_depth_first_touch), 0, 0, 1, 1},
31662   {&__pyx_n_s_depth_traverse, __pyx_k_depth_traverse, sizeof(__pyx_k_depth_traverse), 0, 0, 1, 1},
31663   {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
31664   {&__pyx_n_s_dim, __pyx_k_dim, sizeof(__pyx_k_dim), 0, 0, 1, 1},
31665   {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
31666   {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
31667   {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1},
31668   {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
31669   {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
31670   {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
31671   {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
31672   {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
31673   {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
31674   {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1},
31675   {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
31676   {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
31677   {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
31678   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
31679   {&__pyx_n_s_gid, __pyx_k_gid, sizeof(__pyx_k_gid), 0, 0, 1, 1},
31680   {&__pyx_n_s_gids, __pyx_k_gids, sizeof(__pyx_k_gids), 0, 0, 1, 1},
31681   {&__pyx_n_s_gle, __pyx_k_gle, sizeof(__pyx_k_gle), 0, 0, 1, 1},
31682   {&__pyx_n_s_gles, __pyx_k_gles, sizeof(__pyx_k_gles), 0, 0, 1, 1},
31683   {&__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},
31684   {&__pyx_n_s_gre, __pyx_k_gre, sizeof(__pyx_k_gre), 0, 0, 1, 1},
31685   {&__pyx_n_s_gres, __pyx_k_gres, sizeof(__pyx_k_gres), 0, 0, 1, 1},
31686   {&__pyx_n_s_grid, __pyx_k_grid, sizeof(__pyx_k_grid), 0, 0, 1, 1},
31687   {&__pyx_kp_s_grid_i, __pyx_k_grid_i, sizeof(__pyx_k_grid_i), 0, 0, 1, 0},
31688   {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
31689   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
31690   {&__pyx_n_s_inf, __pyx_k_inf, sizeof(__pyx_k_inf), 0, 0, 1, 1},
31691   {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
31692   {&__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},
31693   {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
31694   {&__pyx_n_s_kd_node_check, __pyx_k_kd_node_check, sizeof(__pyx_k_kd_node_check), 0, 0, 1, 1},
31695   {&__pyx_n_s_kd_sum_volume, __pyx_k_kd_sum_volume, sizeof(__pyx_k_kd_sum_volume), 0, 0, 1, 1},
31696   {&__pyx_n_s_kd_traverse, __pyx_k_kd_traverse, sizeof(__pyx_k_kd_traverse), 0, 0, 1, 1},
31697   {&__pyx_kp_s_le_e_e_e, __pyx_k_le_e_e_e, sizeof(__pyx_k_le_e_e_e), 0, 0, 1, 0},
31698   {&__pyx_n_s_left, __pyx_k_left, sizeof(__pyx_k_left), 0, 0, 1, 1},
31699   {&__pyx_n_s_left_edge, __pyx_k_left_edge, sizeof(__pyx_k_left_edge), 0, 0, 1, 1},
31700   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
31701   {&__pyx_n_s_max_node, __pyx_k_max_node, sizeof(__pyx_k_max_node), 0, 0, 1, 1},
31702   {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
31703   {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
31704   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
31705   {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
31706   {&__pyx_n_s_nan, __pyx_k_nan, sizeof(__pyx_k_nan), 0, 0, 1, 1},
31707   {&__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},
31708   {&__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},
31709   {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
31710   {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
31711   {&__pyx_n_s_ngrids, __pyx_k_ngrids, sizeof(__pyx_k_ngrids), 0, 0, 1, 1},
31712   {&__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},
31713   {&__pyx_n_s_node_id, __pyx_k_node_id, sizeof(__pyx_k_node_id), 0, 0, 1, 1},
31714   {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
31715   {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
31716   {&__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},
31717   {&__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},
31718   {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
31719   {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
31720   {&__pyx_n_s_parent, __pyx_k_parent, sizeof(__pyx_k_parent), 0, 0, 1, 1},
31721   {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
31722   {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1},
31723   {&__pyx_n_s_previous, __pyx_k_previous, sizeof(__pyx_k_previous), 0, 0, 1, 1},
31724   {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1},
31725   {&__pyx_n_s_prod, __pyx_k_prod, sizeof(__pyx_k_prod), 0, 0, 1, 1},
31726   {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
31727   {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
31728   {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
31729   {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
31730   {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
31731   {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
31732   {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
31733   {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
31734   {&__pyx_n_s_q, __pyx_k_q, sizeof(__pyx_k_q), 0, 0, 1, 1},
31735   {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
31736   {&__pyx_n_s_rank, __pyx_k_rank, sizeof(__pyx_k_rank), 0, 0, 1, 1},
31737   {&__pyx_kp_s_re_e_e_e, __pyx_k_re_e_e_e, sizeof(__pyx_k_re_e_e_e), 0, 0, 1, 0},
31738   {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
31739   {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
31740   {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
31741   {&__pyx_n_s_right, __pyx_k_right, sizeof(__pyx_k_right), 0, 0, 1, 1},
31742   {&__pyx_n_s_right_edge, __pyx_k_right_edge, sizeof(__pyx_k_right_edge), 0, 0, 1, 1},
31743   {&__pyx_kp_u_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 1, 0, 0},
31744   {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
31745   {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
31746   {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
31747   {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
31748   {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
31749   {&__pyx_n_s_sort, __pyx_k_sort, sizeof(__pyx_k_sort), 0, 0, 1, 1},
31750   {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
31751   {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
31752   {&__pyx_n_s_step_depth, __pyx_k_step_depth, sizeof(__pyx_k_step_depth), 0, 0, 1, 1},
31753   {&__pyx_n_s_step_viewpoint, __pyx_k_step_viewpoint, sizeof(__pyx_k_step_viewpoint), 0, 0, 1, 1},
31754   {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
31755   {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
31756   {&__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},
31757   {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
31758   {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
31759   {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
31760   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
31761   {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
31762   {&__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},
31763   {&__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},
31764   {&__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},
31765   {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
31766   {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
31767   {&__pyx_n_s_viewpoint, __pyx_k_viewpoint, sizeof(__pyx_k_viewpoint), 0, 0, 1, 1},
31768   {&__pyx_n_s_viewpoint_traverse, __pyx_k_viewpoint_traverse, sizeof(__pyx_k_viewpoint_traverse), 0, 0, 1, 1},
31769   {&__pyx_n_s_yt_utilities_lib_amr_kdtools, __pyx_k_yt_utilities_lib_amr_kdtools, sizeof(__pyx_k_yt_utilities_lib_amr_kdtools), 0, 0, 1, 1},
31770   {&__pyx_kp_s_yt_utilities_lib_amr_kdtools_pyx, __pyx_k_yt_utilities_lib_amr_kdtools_pyx, sizeof(__pyx_k_yt_utilities_lib_amr_kdtools_pyx), 0, 0, 1, 0},
31771   {0, 0, 0, 0, 0, 0, 0}
31772 };
31773 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
31774   __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 38, __pyx_L1_error)
31775   __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
31776   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(3, 272, __pyx_L1_error)
31777   __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(3, 856, __pyx_L1_error)
31778   __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(3, 1038, __pyx_L1_error)
31779   __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 148, __pyx_L1_error)
31780   __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 151, __pyx_L1_error)
31781   __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 400, __pyx_L1_error)
31782   __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(1, 609, __pyx_L1_error)
31783   __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(1, 828, __pyx_L1_error)
31784   return 0;
31785   __pyx_L1_error:;
31786   return -1;
31787 }
31788 
31789 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
31790   __Pyx_RefNannyDeclarations
31791   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
31792 
31793   /* "yt/utilities/lib/amr_kdtools.pyx":88
31794  *
31795  *     def get_left_edge(self):
31796  *         le = np.empty(3, dtype='float64')             # <<<<<<<<<<<<<<
31797  *         for i in range(3):
31798  *             le[i] = self.left_edge[i]
31799  */
31800   __pyx_tuple_ = PyTuple_Pack(1, __pyx_int_3); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 88, __pyx_L1_error)
31801   __Pyx_GOTREF(__pyx_tuple_);
31802   __Pyx_GIVEREF(__pyx_tuple_);
31803 
31804   /* "yt/utilities/lib/amr_kdtools.pyx":329
31805  *         cdef int j
31806  *         cdef np.uint8_t[:] less_ids, greater_ids
31807  *         data = cvarray(format="d", shape=(1,2,3), itemsize=sizeof(np.float64_t))             # <<<<<<<<<<<<<<
31808  *         for j in range(3):
31809  *             data[0,0,j] = gle[j]
31810  */
31811   __pyx_tuple__2 = PyTuple_Pack(3, __pyx_int_1, __pyx_int_2, __pyx_int_3); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 329, __pyx_L1_error)
31812   __Pyx_GOTREF(__pyx_tuple__2);
31813   __Pyx_GIVEREF(__pyx_tuple__2);
31814 
31815   /* "yt/utilities/lib/amr_kdtools.pyx":334
31816  *             data[0,1,j] = gre[j]
31817  *
31818  *         less_ids = cvarray(format="B", shape=(1,), itemsize=sizeof(np.uint8_t))             # <<<<<<<<<<<<<<
31819  *         greater_ids = cvarray(format="B", shape=(1,), itemsize=sizeof(np.uint8_t))
31820  *
31821  */
31822   __pyx_tuple__3 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 334, __pyx_L1_error)
31823   __Pyx_GOTREF(__pyx_tuple__3);
31824   __Pyx_GIVEREF(__pyx_tuple__3);
31825 
31826   /* "(tree fragment)":2
31827  * def __reduce_cython__(self):
31828  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
31829  * def __setstate_cython__(self, __pyx_state):
31830  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31831  */
31832   __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 2, __pyx_L1_error)
31833   __Pyx_GOTREF(__pyx_tuple__4);
31834   __Pyx_GIVEREF(__pyx_tuple__4);
31835 
31836   /* "(tree fragment)":4
31837  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31838  * def __setstate_cython__(self, __pyx_state):
31839  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
31840  */
31841   __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 4, __pyx_L1_error)
31842   __Pyx_GOTREF(__pyx_tuple__5);
31843   __Pyx_GIVEREF(__pyx_tuple__5);
31844 
31845   /* "yt/utilities/lib/amr_kdtools.pyx":803
31846  *             my_split = (n_unique-1)/2
31847  *     if best_dim == -1:
31848  *         return -1, 0, 0, 0             # <<<<<<<<<<<<<<
31849  *     # I recognize how lame this is.
31850  *     cdef np.ndarray[np.float64_t, ndim=1] tarr = np.empty(my_max, dtype='float64')
31851  */
31852   __pyx_tuple__6 = PyTuple_Pack(4, __pyx_int_neg_1, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 803, __pyx_L1_error)
31853   __Pyx_GOTREF(__pyx_tuple__6);
31854   __Pyx_GIVEREF(__pyx_tuple__6);
31855 
31856   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272
31857  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
31858  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
31859  *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
31860  *
31861  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
31862  */
31863   __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(3, 272, __pyx_L1_error)
31864   __Pyx_GOTREF(__pyx_tuple__7);
31865   __Pyx_GIVEREF(__pyx_tuple__7);
31866 
31867   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276
31868  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
31869  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
31870  *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
31871  *
31872  *             info.buf = PyArray_DATA(self)
31873  */
31874   __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(3, 276, __pyx_L1_error)
31875   __Pyx_GOTREF(__pyx_tuple__8);
31876   __Pyx_GIVEREF(__pyx_tuple__8);
31877 
31878   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":306
31879  *                 if ((descr.byteorder == c'>' and little_endian) or
31880  *                     (descr.byteorder == c'<' and not little_endian)):
31881  *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
31882  *                 if   t == NPY_BYTE:        f = "b"
31883  *                 elif t == NPY_UBYTE:       f = "B"
31884  */
31885   __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(3, 306, __pyx_L1_error)
31886   __Pyx_GOTREF(__pyx_tuple__9);
31887   __Pyx_GIVEREF(__pyx_tuple__9);
31888 
31889   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856
31890  *
31891  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
31892  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
31893  *
31894  *         if ((child.byteorder == c'>' and little_endian) or
31895  */
31896   __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(3, 856, __pyx_L1_error)
31897   __Pyx_GOTREF(__pyx_tuple__10);
31898   __Pyx_GIVEREF(__pyx_tuple__10);
31899 
31900   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":880
31901  *             t = child.type_num
31902  *             if end - f < 5:
31903  *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
31904  *
31905  *             # Until ticket #99 is fixed, use integers to avoid warnings
31906  */
31907   __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(3, 880, __pyx_L1_error)
31908   __Pyx_GOTREF(__pyx_tuple__11);
31909   __Pyx_GIVEREF(__pyx_tuple__11);
31910 
31911   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1038
31912  *         _import_array()
31913  *     except Exception:
31914  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
31915  *
31916  * cdef inline int import_umath() except -1:
31917  */
31918   __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(3, 1038, __pyx_L1_error)
31919   __Pyx_GOTREF(__pyx_tuple__12);
31920   __Pyx_GIVEREF(__pyx_tuple__12);
31921 
31922   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1044
31923  *         _import_umath()
31924  *     except Exception:
31925  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
31926  *
31927  * cdef inline int import_ufunc() except -1:
31928  */
31929   __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(3, 1044, __pyx_L1_error)
31930   __Pyx_GOTREF(__pyx_tuple__13);
31931   __Pyx_GIVEREF(__pyx_tuple__13);
31932 
31933   /* "View.MemoryView":133
31934  *
31935  *         if not self.ndim:
31936  *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
31937  *
31938  *         if itemsize <= 0:
31939  */
31940   __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 133, __pyx_L1_error)
31941   __Pyx_GOTREF(__pyx_tuple__14);
31942   __Pyx_GIVEREF(__pyx_tuple__14);
31943 
31944   /* "View.MemoryView":136
31945  *
31946  *         if itemsize <= 0:
31947  *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
31948  *
31949  *         if not isinstance(format, bytes):
31950  */
31951   __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 136, __pyx_L1_error)
31952   __Pyx_GOTREF(__pyx_tuple__15);
31953   __Pyx_GIVEREF(__pyx_tuple__15);
31954 
31955   /* "View.MemoryView":148
31956  *
31957  *         if not self._shape:
31958  *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
31959  *
31960  *
31961  */
31962   __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 148, __pyx_L1_error)
31963   __Pyx_GOTREF(__pyx_tuple__16);
31964   __Pyx_GIVEREF(__pyx_tuple__16);
31965 
31966   /* "View.MemoryView":176
31967  *             self.data = <char *>malloc(self.len)
31968  *             if not self.data:
31969  *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
31970  *
31971  *             if self.dtype_is_object:
31972  */
31973   __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 176, __pyx_L1_error)
31974   __Pyx_GOTREF(__pyx_tuple__17);
31975   __Pyx_GIVEREF(__pyx_tuple__17);
31976 
31977   /* "View.MemoryView":192
31978  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
31979  *         if not (flags & bufmode):
31980  *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
31981  *         info.buf = self.data
31982  *         info.len = self.len
31983  */
31984   __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 192, __pyx_L1_error)
31985   __Pyx_GOTREF(__pyx_tuple__18);
31986   __Pyx_GIVEREF(__pyx_tuple__18);
31987 
31988   /* "(tree fragment)":2
31989  * def __reduce_cython__(self):
31990  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
31991  * def __setstate_cython__(self, __pyx_state):
31992  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31993  */
31994   __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 2, __pyx_L1_error)
31995   __Pyx_GOTREF(__pyx_tuple__19);
31996   __Pyx_GIVEREF(__pyx_tuple__19);
31997 
31998   /* "(tree fragment)":4
31999  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
32000  * def __setstate_cython__(self, __pyx_state):
32001  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
32002  */
32003   __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 4, __pyx_L1_error)
32004   __Pyx_GOTREF(__pyx_tuple__20);
32005   __Pyx_GIVEREF(__pyx_tuple__20);
32006 
32007   /* "View.MemoryView":414
32008  *     def __setitem__(memoryview self, object index, object value):
32009  *         if self.view.readonly:
32010  *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
32011  *
32012  *         have_slices, index = _unellipsify(index, self.view.ndim)
32013  */
32014   __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 414, __pyx_L1_error)
32015   __Pyx_GOTREF(__pyx_tuple__21);
32016   __Pyx_GIVEREF(__pyx_tuple__21);
32017 
32018   /* "View.MemoryView":491
32019  *             result = struct.unpack(self.view.format, bytesitem)
32020  *         except struct.error:
32021  *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
32022  *         else:
32023  *             if len(self.view.format) == 1:
32024  */
32025   __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 491, __pyx_L1_error)
32026   __Pyx_GOTREF(__pyx_tuple__22);
32027   __Pyx_GIVEREF(__pyx_tuple__22);
32028 
32029   /* "View.MemoryView":516
32030  *     def __getbuffer__(self, Py_buffer *info, int flags):
32031  *         if flags & PyBUF_WRITABLE and self.view.readonly:
32032  *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
32033  *
32034  *         if flags & PyBUF_ND:
32035  */
32036   __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 516, __pyx_L1_error)
32037   __Pyx_GOTREF(__pyx_tuple__23);
32038   __Pyx_GIVEREF(__pyx_tuple__23);
32039 
32040   /* "View.MemoryView":566
32041  *         if self.view.strides == NULL:
32042  *
32043  *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
32044  *
32045  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
32046  */
32047   __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 566, __pyx_L1_error)
32048   __Pyx_GOTREF(__pyx_tuple__24);
32049   __Pyx_GIVEREF(__pyx_tuple__24);
32050 
32051   /* "View.MemoryView":573
32052  *     def suboffsets(self):
32053  *         if self.view.suboffsets == NULL:
32054  *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
32055  *
32056  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
32057  */
32058   __pyx_tuple__25 = PyTuple_New(1); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 573, __pyx_L1_error)
32059   __Pyx_GOTREF(__pyx_tuple__25);
32060   __Pyx_INCREF(__pyx_int_neg_1);
32061   __Pyx_GIVEREF(__pyx_int_neg_1);
32062   PyTuple_SET_ITEM(__pyx_tuple__25, 0, __pyx_int_neg_1);
32063   __Pyx_GIVEREF(__pyx_tuple__25);
32064 
32065   /* "(tree fragment)":2
32066  * def __reduce_cython__(self):
32067  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
32068  * def __setstate_cython__(self, __pyx_state):
32069  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
32070  */
32071   __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 2, __pyx_L1_error)
32072   __Pyx_GOTREF(__pyx_tuple__26);
32073   __Pyx_GIVEREF(__pyx_tuple__26);
32074 
32075   /* "(tree fragment)":4
32076  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
32077  * def __setstate_cython__(self, __pyx_state):
32078  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
32079  */
32080   __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 4, __pyx_L1_error)
32081   __Pyx_GOTREF(__pyx_tuple__27);
32082   __Pyx_GIVEREF(__pyx_tuple__27);
32083 
32084   /* "View.MemoryView":678
32085  *         if item is Ellipsis:
32086  *             if not seen_ellipsis:
32087  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
32088  *                 seen_ellipsis = True
32089  *             else:
32090  */
32091   __pyx_slice__28 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__28)) __PYX_ERR(1, 678, __pyx_L1_error)
32092   __Pyx_GOTREF(__pyx_slice__28);
32093   __Pyx_GIVEREF(__pyx_slice__28);
32094 
32095   /* "View.MemoryView":699
32096  *     for suboffset in suboffsets[:ndim]:
32097  *         if suboffset >= 0:
32098  *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
32099  *
32100  *
32101  */
32102   __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 699, __pyx_L1_error)
32103   __Pyx_GOTREF(__pyx_tuple__29);
32104   __Pyx_GIVEREF(__pyx_tuple__29);
32105 
32106   /* "(tree fragment)":2
32107  * def __reduce_cython__(self):
32108  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
32109  * def __setstate_cython__(self, __pyx_state):
32110  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
32111  */
32112   __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(1, 2, __pyx_L1_error)
32113   __Pyx_GOTREF(__pyx_tuple__30);
32114   __Pyx_GIVEREF(__pyx_tuple__30);
32115 
32116   /* "(tree fragment)":4
32117  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
32118  * def __setstate_cython__(self, __pyx_state):
32119  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
32120  */
32121   __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(1, 4, __pyx_L1_error)
32122   __Pyx_GOTREF(__pyx_tuple__31);
32123   __Pyx_GIVEREF(__pyx_tuple__31);
32124 
32125   /* "yt/utilities/lib/amr_kdtools.pyx":680
32126  *         return 0
32127  *
32128  * def step_depth(Node current, Node previous):             # <<<<<<<<<<<<<<
32129  *     '''
32130  *     Takes a single step in the depth-first traversal
32131  */
32132   __pyx_tuple__37 = PyTuple_Pack(2, __pyx_n_s_current, __pyx_n_s_previous); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 680, __pyx_L1_error)
32133   __Pyx_GOTREF(__pyx_tuple__37);
32134   __Pyx_GIVEREF(__pyx_tuple__37);
32135   __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_amr_kdtools_pyx, __pyx_n_s_step_depth, 680, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 680, __pyx_L1_error)
32136 
32137   /* "yt/utilities/lib/amr_kdtools.pyx":710
32138  *     return current, previous
32139  *
32140  * def step_viewpoint(Node current,             # <<<<<<<<<<<<<<
32141  *                    Node previous,
32142  *                    viewpoint):
32143  */
32144   __pyx_tuple__39 = PyTuple_Pack(3, __pyx_n_s_current, __pyx_n_s_previous, __pyx_n_s_viewpoint); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 710, __pyx_L1_error)
32145   __Pyx_GOTREF(__pyx_tuple__39);
32146   __Pyx_GIVEREF(__pyx_tuple__39);
32147   __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_amr_kdtools_pyx, __pyx_n_s_step_viewpoint, 710, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 710, __pyx_L1_error)
32148 
32149   /* "View.MemoryView":286
32150  *         return self.name
32151  *
32152  * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
32153  * cdef strided = Enum("<strided and direct>") # default
32154  * cdef indirect = Enum("<strided and indirect>")
32155  */
32156   __pyx_tuple__41 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(1, 286, __pyx_L1_error)
32157   __Pyx_GOTREF(__pyx_tuple__41);
32158   __Pyx_GIVEREF(__pyx_tuple__41);
32159 
32160   /* "View.MemoryView":287
32161  *
32162  * cdef generic = Enum("<strided and direct or indirect>")
32163  * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
32164  * cdef indirect = Enum("<strided and indirect>")
32165  *
32166  */
32167   __pyx_tuple__42 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(1, 287, __pyx_L1_error)
32168   __Pyx_GOTREF(__pyx_tuple__42);
32169   __Pyx_GIVEREF(__pyx_tuple__42);
32170 
32171   /* "View.MemoryView":288
32172  * cdef generic = Enum("<strided and direct or indirect>")
32173  * cdef strided = Enum("<strided and direct>") # default
32174  * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
32175  *
32176  *
32177  */
32178   __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(1, 288, __pyx_L1_error)
32179   __Pyx_GOTREF(__pyx_tuple__43);
32180   __Pyx_GIVEREF(__pyx_tuple__43);
32181 
32182   /* "View.MemoryView":291
32183  *
32184  *
32185  * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
32186  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
32187  *
32188  */
32189   __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(1, 291, __pyx_L1_error)
32190   __Pyx_GOTREF(__pyx_tuple__44);
32191   __Pyx_GIVEREF(__pyx_tuple__44);
32192 
32193   /* "View.MemoryView":292
32194  *
32195  * cdef contiguous = Enum("<contiguous and direct>")
32196  * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
32197  *
32198  *
32199  */
32200   __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(1, 292, __pyx_L1_error)
32201   __Pyx_GOTREF(__pyx_tuple__45);
32202   __Pyx_GIVEREF(__pyx_tuple__45);
32203 
32204   /* "(tree fragment)":1
32205  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
32206  *     cdef object __pyx_PickleError
32207  *     cdef object __pyx_result
32208  */
32209   __pyx_tuple__46 = 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__46)) __PYX_ERR(1, 1, __pyx_L1_error)
32210   __Pyx_GOTREF(__pyx_tuple__46);
32211   __Pyx_GIVEREF(__pyx_tuple__46);
32212   __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(1, 1, __pyx_L1_error)
32213   __Pyx_RefNannyFinishContext();
32214   return 0;
32215   __pyx_L1_error:;
32216   __Pyx_RefNannyFinishContext();
32217   return -1;
32218 }
32219 
32220 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
32221   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 2, __pyx_L1_error);
32222   __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __PYX_ERR(0, 2, __pyx_L1_error)
32223   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 2, __pyx_L1_error)
32224   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 2, __pyx_L1_error)
32225   __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 2, __pyx_L1_error)
32226   __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 2, __pyx_L1_error)
32227   __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 2, __pyx_L1_error)
32228   __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 2, __pyx_L1_error)
32229   return 0;
32230   __pyx_L1_error:;
32231   return -1;
32232 }
32233 
32234 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
32235 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
32236 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
32237 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
32238 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
32239 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
32240 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
32241 
32242 static int __Pyx_modinit_global_init_code(void) {
32243   __Pyx_RefNannyDeclarations
32244   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
32245   /*--- Global init code ---*/
32246   generic = Py_None; Py_INCREF(Py_None);
32247   strided = Py_None; Py_INCREF(Py_None);
32248   indirect = Py_None; Py_INCREF(Py_None);
32249   contiguous = Py_None; Py_INCREF(Py_None);
32250   indirect_contiguous = Py_None; Py_INCREF(Py_None);
32251   __Pyx_RefNannyFinishContext();
32252   return 0;
32253 }
32254 
32255 static int __Pyx_modinit_variable_export_code(void) {
32256   __Pyx_RefNannyDeclarations
32257   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
32258   /*--- Variable export code ---*/
32259   __Pyx_RefNannyFinishContext();
32260   return 0;
32261 }
32262 
32263 static int __Pyx_modinit_function_export_code(void) {
32264   __Pyx_RefNannyDeclarations
32265   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
32266   /*--- Function export code ---*/
32267   __Pyx_RefNannyFinishContext();
32268   return 0;
32269 }
32270 
32271 static int __Pyx_modinit_type_init_code(void) {
32272   __Pyx_RefNannyDeclarations
32273   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
32274   /*--- Type init code ---*/
32275   __pyx_vtabptr_2yt_9utilities_3lib_11amr_kdtools_Node = &__pyx_vtable_2yt_9utilities_3lib_11amr_kdtools_Node;
32276   __pyx_vtable_2yt_9utilities_3lib_11amr_kdtools_Node.point_in_node = (int (*)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, __Pyx_memviewslice))__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_point_in_node;
32277   __pyx_vtable_2yt_9utilities_3lib_11amr_kdtools_Node._find_node = (struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *(*)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, __Pyx_memviewslice))__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node__find_node;
32278   __pyx_vtable_2yt_9utilities_3lib_11amr_kdtools_Node._kd_is_leaf = (int (*)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *))__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node__kd_is_leaf;
32279   __pyx_vtable_2yt_9utilities_3lib_11amr_kdtools_Node.add_grid = (PyObject *(*)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, __Pyx_memviewslice, __Pyx_memviewslice, int, int, int))__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_add_grid;
32280   __pyx_vtable_2yt_9utilities_3lib_11amr_kdtools_Node.insert_grid = (PyObject *(*)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, __Pyx_memviewslice, __Pyx_memviewslice, int, int, int))__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_insert_grid;
32281   __pyx_vtable_2yt_9utilities_3lib_11amr_kdtools_Node.add_grids = (PyObject *(*)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, int, int __pyx_skip_dispatch))__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_add_grids;
32282   __pyx_vtable_2yt_9utilities_3lib_11amr_kdtools_Node.should_i_split = (int (*)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, int, int))__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_should_i_split;
32283   __pyx_vtable_2yt_9utilities_3lib_11amr_kdtools_Node.insert_grids = (void (*)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, int))__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_insert_grids;
32284   __pyx_vtable_2yt_9utilities_3lib_11amr_kdtools_Node.split_grid = (PyObject *(*)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, __Pyx_memviewslice, __Pyx_memviewslice, int, int, int))__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_split_grid;
32285   __pyx_vtable_2yt_9utilities_3lib_11amr_kdtools_Node.split_grids = (int (*)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, int))__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_split_grids;
32286   __pyx_vtable_2yt_9utilities_3lib_11amr_kdtools_Node.geo_split = (PyObject *(*)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, __Pyx_memviewslice, __Pyx_memviewslice, int, int, int))__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_geo_split;
32287   __pyx_vtable_2yt_9utilities_3lib_11amr_kdtools_Node.divide = (void (*)(struct __pyx_obj_2yt_9utilities_3lib_11amr_kdtools_Node *, struct __pyx_t_2yt_9utilities_3lib_11amr_kdtools_Split *))__pyx_f_2yt_9utilities_3lib_11amr_kdtools_4Node_divide;
32288   if (PyType_Ready(&__pyx_type_2yt_9utilities_3lib_11amr_kdtools_Node) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
32289   #if PY_VERSION_HEX < 0x030800B1
32290   __pyx_type_2yt_9utilities_3lib_11amr_kdtools_Node.tp_print = 0;
32291   #endif
32292   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_2yt_9utilities_3lib_11amr_kdtools_Node.tp_dictoffset && __pyx_type_2yt_9utilities_3lib_11amr_kdtools_Node.tp_getattro == PyObject_GenericGetAttr)) {
32293     __pyx_type_2yt_9utilities_3lib_11amr_kdtools_Node.tp_getattro = __Pyx_PyObject_GenericGetAttr;
32294   }
32295   if (__Pyx_SetVtable(__pyx_type_2yt_9utilities_3lib_11amr_kdtools_Node.tp_dict, __pyx_vtabptr_2yt_9utilities_3lib_11amr_kdtools_Node) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
32296   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Node, (PyObject *)&__pyx_type_2yt_9utilities_3lib_11amr_kdtools_Node) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
32297   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_2yt_9utilities_3lib_11amr_kdtools_Node) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
32298   __pyx_ptype_2yt_9utilities_3lib_11amr_kdtools_Node = &__pyx_type_2yt_9utilities_3lib_11amr_kdtools_Node;
32299   if (PyType_Ready(&__pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse) < 0) __PYX_ERR(0, 104, __pyx_L1_error)
32300   #if PY_VERSION_HEX < 0x030800B1
32301   __pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse.tp_print = 0;
32302   #endif
32303   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse.tp_dictoffset && __pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse.tp_getattro == PyObject_GenericGetAttr)) {
32304     __pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
32305   }
32306   __pyx_ptype_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse = &__pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct__kd_traverse;
32307   if (PyType_Ready(&__pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse) < 0) __PYX_ERR(0, 567, __pyx_L1_error)
32308   #if PY_VERSION_HEX < 0x030800B1
32309   __pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse.tp_print = 0;
32310   #endif
32311   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse.tp_dictoffset && __pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse.tp_getattro == PyObject_GenericGetAttr)) {
32312     __pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
32313   }
32314   __pyx_ptype_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse = &__pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_1_depth_traverse;
32315   if (PyType_Ready(&__pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch) < 0) __PYX_ERR(0, 584, __pyx_L1_error)
32316   #if PY_VERSION_HEX < 0x030800B1
32317   __pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch.tp_print = 0;
32318   #endif
32319   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch.tp_dictoffset && __pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch.tp_getattro == PyObject_GenericGetAttr)) {
32320     __pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
32321   }
32322   __pyx_ptype_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch = &__pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_2_depth_first_touch;
32323   if (PyType_Ready(&__pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse) < 0) __PYX_ERR(0, 602, __pyx_L1_error)
32324   #if PY_VERSION_HEX < 0x030800B1
32325   __pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse.tp_print = 0;
32326   #endif
32327   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse.tp_dictoffset && __pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse.tp_getattro == PyObject_GenericGetAttr)) {
32328     __pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
32329   }
32330   __pyx_ptype_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse = &__pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_3_breadth_traverse;
32331   if (PyType_Ready(&__pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse) < 0) __PYX_ERR(0, 614, __pyx_L1_error)
32332   #if PY_VERSION_HEX < 0x030800B1
32333   __pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse.tp_print = 0;
32334   #endif
32335   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse.tp_dictoffset && __pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse.tp_getattro == PyObject_GenericGetAttr)) {
32336     __pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
32337   }
32338   __pyx_ptype_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse = &__pyx_type_2yt_9utilities_3lib_11amr_kdtools___pyx_scope_struct_4_viewpoint_traverse;
32339   __pyx_vtabptr_array = &__pyx_vtable_array;
32340   __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
32341   if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
32342   #if PY_VERSION_HEX < 0x030800B1
32343   __pyx_type___pyx_array.tp_print = 0;
32344   #endif
32345   if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
32346   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
32347   __pyx_array_type = &__pyx_type___pyx_array;
32348   if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 279, __pyx_L1_error)
32349   #if PY_VERSION_HEX < 0x030800B1
32350   __pyx_type___pyx_MemviewEnum.tp_print = 0;
32351   #endif
32352   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
32353     __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
32354   }
32355   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 279, __pyx_L1_error)
32356   __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
32357   __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
32358   __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
32359   __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
32360   __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
32361   __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
32362   __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
32363   __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
32364   __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
32365   if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
32366   #if PY_VERSION_HEX < 0x030800B1
32367   __pyx_type___pyx_memoryview.tp_print = 0;
32368   #endif
32369   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
32370     __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
32371   }
32372   if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
32373   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
32374   __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
32375   __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
32376   __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
32377   __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
32378   __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
32379   __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
32380   if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 961, __pyx_L1_error)
32381   #if PY_VERSION_HEX < 0x030800B1
32382   __pyx_type___pyx_memoryviewslice.tp_print = 0;
32383   #endif
32384   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
32385     __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
32386   }
32387   if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(1, 961, __pyx_L1_error)
32388   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 961, __pyx_L1_error)
32389   __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
32390   __Pyx_RefNannyFinishContext();
32391   return 0;
32392   __pyx_L1_error:;
32393   __Pyx_RefNannyFinishContext();
32394   return -1;
32395 }
32396 
32397 static int __Pyx_modinit_type_import_code(void) {
32398   __Pyx_RefNannyDeclarations
32399   PyObject *__pyx_t_1 = NULL;
32400   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
32401   /*--- Type import code ---*/
32402   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9, __pyx_L1_error)
32403   __Pyx_GOTREF(__pyx_t_1);
32404   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
32405   #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
32406   sizeof(PyTypeObject),
32407   #else
32408   sizeof(PyHeapTypeObject),
32409   #endif
32410   __Pyx_ImportType_CheckSize_Warn);
32411    if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(4, 9, __pyx_L1_error)
32412   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32413   __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 206, __pyx_L1_error)
32414   __Pyx_GOTREF(__pyx_t_1);
32415   __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
32416    if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(3, 206, __pyx_L1_error)
32417   __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn);
32418    if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(3, 229, __pyx_L1_error)
32419   __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn);
32420    if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(3, 233, __pyx_L1_error)
32421   __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
32422    if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(3, 242, __pyx_L1_error)
32423   __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn);
32424    if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(3, 918, __pyx_L1_error)
32425   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32426   __Pyx_RefNannyFinishContext();
32427   return 0;
32428   __pyx_L1_error:;
32429   __Pyx_XDECREF(__pyx_t_1);
32430   __Pyx_RefNannyFinishContext();
32431   return -1;
32432 }
32433 
32434 static int __Pyx_modinit_variable_import_code(void) {
32435   __Pyx_RefNannyDeclarations
32436   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
32437   /*--- Variable import code ---*/
32438   __Pyx_RefNannyFinishContext();
32439   return 0;
32440 }
32441 
32442 static int __Pyx_modinit_function_import_code(void) {
32443   __Pyx_RefNannyDeclarations
32444   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
32445   /*--- Function import code ---*/
32446   __Pyx_RefNannyFinishContext();
32447   return 0;
32448 }
32449 
32450 
32451 #if PY_MAJOR_VERSION < 3
32452 #ifdef CYTHON_NO_PYINIT_EXPORT
32453 #define __Pyx_PyMODINIT_FUNC void
32454 #else
32455 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
32456 #endif
32457 #else
32458 #ifdef CYTHON_NO_PYINIT_EXPORT
32459 #define __Pyx_PyMODINIT_FUNC PyObject *
32460 #else
32461 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
32462 #endif
32463 #endif
32464 
32465 
32466 #if PY_MAJOR_VERSION < 3
32467 __Pyx_PyMODINIT_FUNC initamr_kdtools(void) CYTHON_SMALL_CODE; /*proto*/
32468 __Pyx_PyMODINIT_FUNC initamr_kdtools(void)
32469 #else
32470 __Pyx_PyMODINIT_FUNC PyInit_amr_kdtools(void) CYTHON_SMALL_CODE; /*proto*/
32471 __Pyx_PyMODINIT_FUNC PyInit_amr_kdtools(void)
32472 #if CYTHON_PEP489_MULTI_PHASE_INIT
32473 {
32474   return PyModuleDef_Init(&__pyx_moduledef);
32475 }
32476 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
32477     #if PY_VERSION_HEX >= 0x030700A1
32478     static PY_INT64_T main_interpreter_id = -1;
32479     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
32480     if (main_interpreter_id == -1) {
32481         main_interpreter_id = current_id;
32482         return (unlikely(current_id == -1)) ? -1 : 0;
32483     } else if (unlikely(main_interpreter_id != current_id))
32484     #else
32485     static PyInterpreterState *main_interpreter = NULL;
32486     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
32487     if (!main_interpreter) {
32488         main_interpreter = current_interpreter;
32489     } else if (unlikely(main_interpreter != current_interpreter))
32490     #endif
32491     {
32492         PyErr_SetString(
32493             PyExc_ImportError,
32494             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
32495         return -1;
32496     }
32497     return 0;
32498 }
32499 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) {
32500     PyObject *value = PyObject_GetAttrString(spec, from_name);
32501     int result = 0;
32502     if (likely(value)) {
32503         if (allow_none || value != Py_None) {
32504             result = PyDict_SetItemString(moddict, to_name, value);
32505         }
32506         Py_DECREF(value);
32507     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
32508         PyErr_Clear();
32509     } else {
32510         result = -1;
32511     }
32512     return result;
32513 }
32514 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
32515     PyObject *module = NULL, *moddict, *modname;
32516     if (__Pyx_check_single_interpreter())
32517         return NULL;
32518     if (__pyx_m)
32519         return __Pyx_NewRef(__pyx_m);
32520     modname = PyObject_GetAttrString(spec, "name");
32521     if (unlikely(!modname)) goto bad;
32522     module = PyModule_NewObject(modname);
32523     Py_DECREF(modname);
32524     if (unlikely(!module)) goto bad;
32525     moddict = PyModule_GetDict(module);
32526     if (unlikely(!moddict)) goto bad;
32527     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
32528     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
32529     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
32530     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
32531     return module;
32532 bad:
32533     Py_XDECREF(module);
32534     return NULL;
32535 }
32536 
32537 
32538 static CYTHON_SMALL_CODE int __pyx_pymod_exec_amr_kdtools(PyObject *__pyx_pyinit_module)
32539 #endif
32540 #endif
32541 {
32542   PyObject *__pyx_t_1 = NULL;
32543   static PyThread_type_lock __pyx_t_2[8];
32544   __Pyx_RefNannyDeclarations
32545   #if CYTHON_PEP489_MULTI_PHASE_INIT
32546   if (__pyx_m) {
32547     if (__pyx_m == __pyx_pyinit_module) return 0;
32548     PyErr_SetString(PyExc_RuntimeError, "Module 'amr_kdtools' has already been imported. Re-initialisation is not supported.");
32549     return -1;
32550   }
32551   #elif PY_MAJOR_VERSION >= 3
32552   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
32553   #endif
32554   #if CYTHON_REFNANNY
32555 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
32556 if (!__Pyx_RefNanny) {
32557   PyErr_Clear();
32558   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
32559   if (!__Pyx_RefNanny)
32560       Py_FatalError("failed to import 'refnanny' module");
32561 }
32562 #endif
32563   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_amr_kdtools(void)", 0);
32564   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
32565   #ifdef __Pxy_PyFrame_Initialize_Offsets
32566   __Pxy_PyFrame_Initialize_Offsets();
32567   #endif
32568   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 2, __pyx_L1_error)
32569   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 2, __pyx_L1_error)
32570   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 2, __pyx_L1_error)
32571   #ifdef __Pyx_CyFunction_USED
32572   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
32573   #endif
32574   #ifdef __Pyx_FusedFunction_USED
32575   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
32576   #endif
32577   #ifdef __Pyx_Coroutine_USED
32578   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
32579   #endif
32580   #ifdef __Pyx_Generator_USED
32581   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
32582   #endif
32583   #ifdef __Pyx_AsyncGen_USED
32584   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
32585   #endif
32586   #ifdef __Pyx_StopAsyncIteration_USED
32587   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
32588   #endif
32589   /*--- Library function declarations ---*/
32590   /*--- Threads initialization code ---*/
32591   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
32592   #ifdef WITH_THREAD /* Python build with threading support? */
32593   PyEval_InitThreads();
32594   #endif
32595   #endif
32596   /*--- Module creation code ---*/
32597   #if CYTHON_PEP489_MULTI_PHASE_INIT
32598   __pyx_m = __pyx_pyinit_module;
32599   Py_INCREF(__pyx_m);
32600   #else
32601   #if PY_MAJOR_VERSION < 3
32602   __pyx_m = Py_InitModule4("amr_kdtools", __pyx_methods, __pyx_k_AMR_kD_Tree_Cython_Tools, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
32603   #else
32604   __pyx_m = PyModule_Create(&__pyx_moduledef);
32605   #endif
32606   if (unlikely(!__pyx_m)) __PYX_ERR(0, 2, __pyx_L1_error)
32607   #endif
32608   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 2, __pyx_L1_error)
32609   Py_INCREF(__pyx_d);
32610   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 2, __pyx_L1_error)
32611   Py_INCREF(__pyx_b);
32612   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 2, __pyx_L1_error)
32613   Py_INCREF(__pyx_cython_runtime);
32614   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 2, __pyx_L1_error);
32615   /*--- Initialize various global constants etc. ---*/
32616   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
32617   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
32618   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
32619   #endif
32620   if (__pyx_module_is_main_yt__utilities__lib__amr_kdtools) {
32621     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
32622   }
32623   #if PY_MAJOR_VERSION >= 3
32624   {
32625     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 2, __pyx_L1_error)
32626     if (!PyDict_GetItemString(modules, "yt.utilities.lib.amr_kdtools")) {
32627       if (unlikely(PyDict_SetItemString(modules, "yt.utilities.lib.amr_kdtools", __pyx_m) < 0)) __PYX_ERR(0, 2, __pyx_L1_error)
32628     }
32629   }
32630   #endif
32631   /*--- Builtin init code ---*/
32632   if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error;
32633   /*--- Constants init code ---*/
32634   if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error;
32635   /*--- Global type/function init code ---*/
32636   (void)__Pyx_modinit_global_init_code();
32637   (void)__Pyx_modinit_variable_export_code();
32638   (void)__Pyx_modinit_function_export_code();
32639   if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
32640   if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
32641   (void)__Pyx_modinit_variable_import_code();
32642   (void)__Pyx_modinit_function_import_code();
32643   /*--- Execution code ---*/
32644   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
32645   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
32646   #endif
32647 
32648   /* "yt/utilities/lib/amr_kdtools.pyx":11
32649  *
32650  *
32651  * import numpy as np             # <<<<<<<<<<<<<<
32652  *
32653  * cimport cython
32654  */
32655   __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
32656   __Pyx_GOTREF(__pyx_t_1);
32657   if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
32658   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32659 
32660   /* "yt/utilities/lib/amr_kdtools.pyx":680
32661  *         return 0
32662  *
32663  * def step_depth(Node current, Node previous):             # <<<<<<<<<<<<<<
32664  *     '''
32665  *     Takes a single step in the depth-first traversal
32666  */
32667   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_11amr_kdtools_1step_depth, NULL, __pyx_n_s_yt_utilities_lib_amr_kdtools); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 680, __pyx_L1_error)
32668   __Pyx_GOTREF(__pyx_t_1);
32669   if (PyDict_SetItem(__pyx_d, __pyx_n_s_step_depth, __pyx_t_1) < 0) __PYX_ERR(0, 680, __pyx_L1_error)
32670   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32671 
32672   /* "yt/utilities/lib/amr_kdtools.pyx":710
32673  *     return current, previous
32674  *
32675  * def step_viewpoint(Node current,             # <<<<<<<<<<<<<<
32676  *                    Node previous,
32677  *                    viewpoint):
32678  */
32679   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_11amr_kdtools_3step_viewpoint, NULL, __pyx_n_s_yt_utilities_lib_amr_kdtools); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 710, __pyx_L1_error)
32680   __Pyx_GOTREF(__pyx_t_1);
32681   if (PyDict_SetItem(__pyx_d, __pyx_n_s_step_viewpoint, __pyx_t_1) < 0) __PYX_ERR(0, 710, __pyx_L1_error)
32682   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32683 
32684   /* "yt/utilities/lib/amr_kdtools.pyx":2
32685  *
32686  * # distutils: libraries = STD_LIBS             # <<<<<<<<<<<<<<
32687  * """
32688  * AMR kD-Tree Cython Tools
32689  */
32690   __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
32691   __Pyx_GOTREF(__pyx_t_1);
32692   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
32693   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32694 
32695   /* "View.MemoryView":209
32696  *         info.obj = self
32697  *
32698  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
32699  *
32700  *     def __dealloc__(array self):
32701  */
32702   __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 209, __pyx_L1_error)
32703   __Pyx_GOTREF(__pyx_t_1);
32704   if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 209, __pyx_L1_error)
32705   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32706   PyType_Modified(__pyx_array_type);
32707 
32708   /* "View.MemoryView":286
32709  *         return self.name
32710  *
32711  * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
32712  * cdef strided = Enum("<strided and direct>") # default
32713  * cdef indirect = Enum("<strided and indirect>")
32714  */
32715   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 286, __pyx_L1_error)
32716   __Pyx_GOTREF(__pyx_t_1);
32717   __Pyx_XGOTREF(generic);
32718   __Pyx_DECREF_SET(generic, __pyx_t_1);
32719   __Pyx_GIVEREF(__pyx_t_1);
32720   __pyx_t_1 = 0;
32721 
32722   /* "View.MemoryView":287
32723  *
32724  * cdef generic = Enum("<strided and direct or indirect>")
32725  * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
32726  * cdef indirect = Enum("<strided and indirect>")
32727  *
32728  */
32729   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 287, __pyx_L1_error)
32730   __Pyx_GOTREF(__pyx_t_1);
32731   __Pyx_XGOTREF(strided);
32732   __Pyx_DECREF_SET(strided, __pyx_t_1);
32733   __Pyx_GIVEREF(__pyx_t_1);
32734   __pyx_t_1 = 0;
32735 
32736   /* "View.MemoryView":288
32737  * cdef generic = Enum("<strided and direct or indirect>")
32738  * cdef strided = Enum("<strided and direct>") # default
32739  * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
32740  *
32741  *
32742  */
32743   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 288, __pyx_L1_error)
32744   __Pyx_GOTREF(__pyx_t_1);
32745   __Pyx_XGOTREF(indirect);
32746   __Pyx_DECREF_SET(indirect, __pyx_t_1);
32747   __Pyx_GIVEREF(__pyx_t_1);
32748   __pyx_t_1 = 0;
32749 
32750   /* "View.MemoryView":291
32751  *
32752  *
32753  * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
32754  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
32755  *
32756  */
32757   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 291, __pyx_L1_error)
32758   __Pyx_GOTREF(__pyx_t_1);
32759   __Pyx_XGOTREF(contiguous);
32760   __Pyx_DECREF_SET(contiguous, __pyx_t_1);
32761   __Pyx_GIVEREF(__pyx_t_1);
32762   __pyx_t_1 = 0;
32763 
32764   /* "View.MemoryView":292
32765  *
32766  * cdef contiguous = Enum("<contiguous and direct>")
32767  * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
32768  *
32769  *
32770  */
32771   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 292, __pyx_L1_error)
32772   __Pyx_GOTREF(__pyx_t_1);
32773   __Pyx_XGOTREF(indirect_contiguous);
32774   __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
32775   __Pyx_GIVEREF(__pyx_t_1);
32776   __pyx_t_1 = 0;
32777 
32778   /* "View.MemoryView":316
32779  *
32780  * DEF THREAD_LOCKS_PREALLOCATED = 8
32781  * cdef int __pyx_memoryview_thread_locks_used = 0             # <<<<<<<<<<<<<<
32782  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
32783  *     PyThread_allocate_lock(),
32784  */
32785   __pyx_memoryview_thread_locks_used = 0;
32786 
32787   /* "View.MemoryView":317
32788  * DEF THREAD_LOCKS_PREALLOCATED = 8
32789  * cdef int __pyx_memoryview_thread_locks_used = 0
32790  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [             # <<<<<<<<<<<<<<
32791  *     PyThread_allocate_lock(),
32792  *     PyThread_allocate_lock(),
32793  */
32794   __pyx_t_2[0] = PyThread_allocate_lock();
32795   __pyx_t_2[1] = PyThread_allocate_lock();
32796   __pyx_t_2[2] = PyThread_allocate_lock();
32797   __pyx_t_2[3] = PyThread_allocate_lock();
32798   __pyx_t_2[4] = PyThread_allocate_lock();
32799   __pyx_t_2[5] = PyThread_allocate_lock();
32800   __pyx_t_2[6] = PyThread_allocate_lock();
32801   __pyx_t_2[7] = PyThread_allocate_lock();
32802   memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_2, sizeof(__pyx_memoryview_thread_locks[0]) * (8));
32803 
32804   /* "View.MemoryView":545
32805  *         info.obj = self
32806  *
32807  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
32808  *
32809  *
32810  */
32811   __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 545, __pyx_L1_error)
32812   __Pyx_GOTREF(__pyx_t_1);
32813   if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 545, __pyx_L1_error)
32814   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32815   PyType_Modified(__pyx_memoryview_type);
32816 
32817   /* "View.MemoryView":991
32818  *         return self.from_object
32819  *
32820  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
32821  *
32822  *
32823  */
32824   __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 991, __pyx_L1_error)
32825   __Pyx_GOTREF(__pyx_t_1);
32826   if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 991, __pyx_L1_error)
32827   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32828   PyType_Modified(__pyx_memoryviewslice_type);
32829 
32830   /* "(tree fragment)":1
32831  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
32832  *     cdef object __pyx_PickleError
32833  *     cdef object __pyx_result
32834  */
32835   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
32836   __Pyx_GOTREF(__pyx_t_1);
32837   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
32838   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
32839 
32840   /* "BufferFormatFromTypeInfo":1460
32841  *
32842  * @cname('__pyx_format_from_typeinfo')
32843  * cdef bytes format_from_typeinfo(__Pyx_TypeInfo *type):             # <<<<<<<<<<<<<<
32844  *     cdef __Pyx_StructField *field
32845  *     cdef __pyx_typeinfo_string fmt
32846  */
32847 
32848   /*--- Wrapped vars code ---*/
32849 
32850   goto __pyx_L0;
32851   __pyx_L1_error:;
32852   __Pyx_XDECREF(__pyx_t_1);
32853   if (__pyx_m) {
32854     if (__pyx_d) {
32855       __Pyx_AddTraceback("init yt.utilities.lib.amr_kdtools", __pyx_clineno, __pyx_lineno, __pyx_filename);
32856     }
32857     Py_CLEAR(__pyx_m);
32858   } else if (!PyErr_Occurred()) {
32859     PyErr_SetString(PyExc_ImportError, "init yt.utilities.lib.amr_kdtools");
32860   }
32861   __pyx_L0:;
32862   __Pyx_RefNannyFinishContext();
32863   #if CYTHON_PEP489_MULTI_PHASE_INIT
32864   return (__pyx_m != NULL) ? 0 : -1;
32865   #elif PY_MAJOR_VERSION >= 3
32866   return __pyx_m;
32867   #else
32868   return;
32869   #endif
32870 }
32871 
32872 /* --- Runtime support code --- */
32873 /* Refnanny */
32874 #if CYTHON_REFNANNY
32875 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
32876     PyObject *m = NULL, *p = NULL;
32877     void *r = NULL;
32878     m = PyImport_ImportModule(modname);
32879     if (!m) goto end;
32880     p = PyObject_GetAttrString(m, "RefNannyAPI");
32881     if (!p) goto end;
32882     r = PyLong_AsVoidPtr(p);
32883 end:
32884     Py_XDECREF(p);
32885     Py_XDECREF(m);
32886     return (__Pyx_RefNannyAPIStruct *)r;
32887 }
32888 #endif
32889 
32890 /* PyObjectGetAttrStr */
32891 #if CYTHON_USE_TYPE_SLOTS
32892 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
32893     PyTypeObject* tp = Py_TYPE(obj);
32894     if (likely(tp->tp_getattro))
32895         return tp->tp_getattro(obj, attr_name);
32896 #if PY_MAJOR_VERSION < 3
32897     if (likely(tp->tp_getattr))
32898         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
32899 #endif
32900     return PyObject_GetAttr(obj, attr_name);
32901 }
32902 #endif
32903 
32904 /* GetBuiltinName */
32905 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
32906     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
32907     if (unlikely(!result)) {
32908         PyErr_Format(PyExc_NameError,
32909 #if PY_MAJOR_VERSION >= 3
32910             "name '%U' is not defined", name);
32911 #else
32912             "name '%.200s' is not defined", PyString_AS_STRING(name));
32913 #endif
32914     }
32915     return result;
32916 }
32917 
32918 /* RaiseArgTupleInvalid */
32919 static void __Pyx_RaiseArgtupleInvalid(
32920     const char* func_name,
32921     int exact,
32922     Py_ssize_t num_min,
32923     Py_ssize_t num_max,
32924     Py_ssize_t num_found)
32925 {
32926     Py_ssize_t num_expected;
32927     const char *more_or_less;
32928     if (num_found < num_min) {
32929         num_expected = num_min;
32930         more_or_less = "at least";
32931     } else {
32932         num_expected = num_max;
32933         more_or_less = "at most";
32934     }
32935     if (exact) {
32936         more_or_less = "exactly";
32937     }
32938     PyErr_Format(PyExc_TypeError,
32939                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
32940                  func_name, more_or_less, num_expected,
32941                  (num_expected == 1) ? "" : "s", num_found);
32942 }
32943 
32944 /* RaiseDoubleKeywords */
32945 static void __Pyx_RaiseDoubleKeywordsError(
32946     const char* func_name,
32947     PyObject* kw_name)
32948 {
32949     PyErr_Format(PyExc_TypeError,
32950         #if PY_MAJOR_VERSION >= 3
32951         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
32952         #else
32953         "%s() got multiple values for keyword argument '%s'", func_name,
32954         PyString_AsString(kw_name));
32955         #endif
32956 }
32957 
32958 /* ParseKeywords */
32959 static int __Pyx_ParseOptionalKeywords(
32960     PyObject *kwds,
32961     PyObject **argnames[],
32962     PyObject *kwds2,
32963     PyObject *values[],
32964     Py_ssize_t num_pos_args,
32965     const char* function_name)
32966 {
32967     PyObject *key = 0, *value = 0;
32968     Py_ssize_t pos = 0;
32969     PyObject*** name;
32970     PyObject*** first_kw_arg = argnames + num_pos_args;
32971     while (PyDict_Next(kwds, &pos, &key, &value)) {
32972         name = first_kw_arg;
32973         while (*name && (**name != key)) name++;
32974         if (*name) {
32975             values[name-argnames] = value;
32976             continue;
32977         }
32978         name = first_kw_arg;
32979         #if PY_MAJOR_VERSION < 3
32980         if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
32981             while (*name) {
32982                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
32983                         && _PyString_Eq(**name, key)) {
32984                     values[name-argnames] = value;
32985                     break;
32986                 }
32987                 name++;
32988             }
32989             if (*name) continue;
32990             else {
32991                 PyObject*** argname = argnames;
32992                 while (argname != first_kw_arg) {
32993                     if ((**argname == key) || (
32994                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
32995                              && _PyString_Eq(**argname, key))) {
32996                         goto arg_passed_twice;
32997                     }
32998                     argname++;
32999                 }
33000             }
33001         } else
33002         #endif
33003         if (likely(PyUnicode_Check(key))) {
33004             while (*name) {
33005                 int cmp = (**name == key) ? 0 :
33006                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
33007                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
33008                 #endif
33009                     PyUnicode_Compare(**name, key);
33010                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
33011                 if (cmp == 0) {
33012                     values[name-argnames] = value;
33013                     break;
33014                 }
33015                 name++;
33016             }
33017             if (*name) continue;
33018             else {
33019                 PyObject*** argname = argnames;
33020                 while (argname != first_kw_arg) {
33021                     int cmp = (**argname == key) ? 0 :
33022                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
33023                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
33024                     #endif
33025                         PyUnicode_Compare(**argname, key);
33026                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
33027                     if (cmp == 0) goto arg_passed_twice;
33028                     argname++;
33029                 }
33030             }
33031         } else
33032             goto invalid_keyword_type;
33033         if (kwds2) {
33034             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
33035         } else {
33036             goto invalid_keyword;
33037         }
33038     }
33039     return 0;
33040 arg_passed_twice:
33041     __Pyx_RaiseDoubleKeywordsError(function_name, key);
33042     goto bad;
33043 invalid_keyword_type:
33044     PyErr_Format(PyExc_TypeError,
33045         "%.200s() keywords must be strings", function_name);
33046     goto bad;
33047 invalid_keyword:
33048     PyErr_Format(PyExc_TypeError,
33049     #if PY_MAJOR_VERSION < 3
33050         "%.200s() got an unexpected keyword argument '%.200s'",
33051         function_name, PyString_AsString(key));
33052     #else
33053         "%s() got an unexpected keyword argument '%U'",
33054         function_name, key);
33055     #endif
33056 bad:
33057     return -1;
33058 }
33059 
33060 /* ArgTypeTest */
33061 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
33062 {
33063     if (unlikely(!type)) {
33064         PyErr_SetString(PyExc_SystemError, "Missing type object");
33065         return 0;
33066     }
33067     else if (exact) {
33068         #if PY_MAJOR_VERSION == 2
33069         if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
33070         #endif
33071     }
33072     else {
33073         if (likely(__Pyx_TypeCheck(obj, type))) return 1;
33074     }
33075     PyErr_Format(PyExc_TypeError,
33076         "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
33077         name, type->tp_name, Py_TYPE(obj)->tp_name);
33078     return 0;
33079 }
33080 
33081 /* MemviewSliceInit */
33082 static int
33083 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
33084                         int ndim,
33085                         __Pyx_memviewslice *memviewslice,
33086                         int memview_is_new_reference)
33087 {
33088     __Pyx_RefNannyDeclarations
33089     int i, retval=-1;
33090     Py_buffer *buf = &memview->view;
33091     __Pyx_RefNannySetupContext("init_memviewslice", 0);
33092     if (memviewslice->memview || memviewslice->data) {
33093         PyErr_SetString(PyExc_ValueError,
33094             "memviewslice is already initialized!");
33095         goto fail;
33096     }
33097     if (buf->strides) {
33098         for (i = 0; i < ndim; i++) {
33099             memviewslice->strides[i] = buf->strides[i];
33100         }
33101     } else {
33102         Py_ssize_t stride = buf->itemsize;
33103         for (i = ndim - 1; i >= 0; i--) {
33104             memviewslice->strides[i] = stride;
33105             stride *= buf->shape[i];
33106         }
33107     }
33108     for (i = 0; i < ndim; i++) {
33109         memviewslice->shape[i]   = buf->shape[i];
33110         if (buf->suboffsets) {
33111             memviewslice->suboffsets[i] = buf->suboffsets[i];
33112         } else {
33113             memviewslice->suboffsets[i] = -1;
33114         }
33115     }
33116     memviewslice->memview = memview;
33117     memviewslice->data = (char *)buf->buf;
33118     if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
33119         Py_INCREF(memview);
33120     }
33121     retval = 0;
33122     goto no_fail;
33123 fail:
33124     memviewslice->memview = 0;
33125     memviewslice->data = 0;
33126     retval = -1;
33127 no_fail:
33128     __Pyx_RefNannyFinishContext();
33129     return retval;
33130 }
33131 #ifndef Py_NO_RETURN
33132 #define Py_NO_RETURN
33133 #endif
33134 static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
33135     va_list vargs;
33136     char msg[200];
33137 #ifdef HAVE_STDARG_PROTOTYPES
33138     va_start(vargs, fmt);
33139 #else
33140     va_start(vargs);
33141 #endif
33142     vsnprintf(msg, 200, fmt, vargs);
33143     va_end(vargs);
33144     Py_FatalError(msg);
33145 }
33146 static CYTHON_INLINE int
33147 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
33148                                    PyThread_type_lock lock)
33149 {
33150     int result;
33151     PyThread_acquire_lock(lock, 1);
33152     result = (*acquisition_count)++;
33153     PyThread_release_lock(lock);
33154     return result;
33155 }
33156 static CYTHON_INLINE int
33157 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
33158                                    PyThread_type_lock lock)
33159 {
33160     int result;
33161     PyThread_acquire_lock(lock, 1);
33162     result = (*acquisition_count)--;
33163     PyThread_release_lock(lock);
33164     return result;
33165 }
33166 static CYTHON_INLINE void
33167 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
33168 {
33169     int first_time;
33170     struct __pyx_memoryview_obj *memview = memslice->memview;
33171     if (!memview || (PyObject *) memview == Py_None)
33172         return;
33173     if (__pyx_get_slice_count(memview) < 0)
33174         __pyx_fatalerror("Acquisition count is %d (line %d)",
33175                          __pyx_get_slice_count(memview), lineno);
33176     first_time = __pyx_add_acquisition_count(memview) == 0;
33177     if (first_time) {
33178         if (have_gil) {
33179             Py_INCREF((PyObject *) memview);
33180         } else {
33181             PyGILState_STATE _gilstate = PyGILState_Ensure();
33182             Py_INCREF((PyObject *) memview);
33183             PyGILState_Release(_gilstate);
33184         }
33185     }
33186 }
33187 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
33188                                              int have_gil, int lineno) {
33189     int last_time;
33190     struct __pyx_memoryview_obj *memview = memslice->memview;
33191     if (!memview ) {
33192         return;
33193     } else if ((PyObject *) memview == Py_None) {
33194         memslice->memview = NULL;
33195         return;
33196     }
33197     if (__pyx_get_slice_count(memview) <= 0)
33198         __pyx_fatalerror("Acquisition count is %d (line %d)",
33199                          __pyx_get_slice_count(memview), lineno);
33200     last_time = __pyx_sub_acquisition_count(memview) == 1;
33201     memslice->data = NULL;
33202     if (last_time) {
33203         if (have_gil) {
33204             Py_CLEAR(memslice->memview);
33205         } else {
33206             PyGILState_STATE _gilstate = PyGILState_Ensure();
33207             Py_CLEAR(memslice->memview);
33208             PyGILState_Release(_gilstate);
33209         }
33210     } else {
33211         memslice->memview = NULL;
33212     }
33213 }
33214 
33215 /* PyDictVersioning */
33216 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
33217 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
33218     PyObject *dict = Py_TYPE(obj)->tp_dict;
33219     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
33220 }
33221 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
33222     PyObject **dictptr = NULL;
33223     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
33224     if (offset) {
33225 #if CYTHON_COMPILING_IN_CPYTHON
33226         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
33227 #else
33228         dictptr = _PyObject_GetDictPtr(obj);
33229 #endif
33230     }
33231     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
33232 }
33233 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
33234     PyObject *dict = Py_TYPE(obj)->tp_dict;
33235     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
33236         return 0;
33237     return obj_dict_version == __Pyx_get_object_dict_version(obj);
33238 }
33239 #endif
33240 
33241 /* GetModuleGlobalName */
33242 #if CYTHON_USE_DICT_VERSIONS
33243 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
33244 #else
33245 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
33246 #endif
33247 {
33248     PyObject *result;
33249 #if !CYTHON_AVOID_BORROWED_REFS
33250 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
33251     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
33252     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
33253     if (likely(result)) {
33254         return __Pyx_NewRef(result);
33255     } else if (unlikely(PyErr_Occurred())) {
33256         return NULL;
33257     }
33258 #else
33259     result = PyDict_GetItem(__pyx_d, name);
33260     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
33261     if (likely(result)) {
33262         return __Pyx_NewRef(result);
33263     }
33264 #endif
33265 #else
33266     result = PyObject_GetItem(__pyx_d, name);
33267     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
33268     if (likely(result)) {
33269         return __Pyx_NewRef(result);
33270     }
33271     PyErr_Clear();
33272 #endif
33273     return __Pyx_GetBuiltinName(name);
33274 }
33275 
33276 /* PyObjectCall */
33277 #if CYTHON_COMPILING_IN_CPYTHON
33278 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
33279     PyObject *result;
33280     ternaryfunc call = func->ob_type->tp_call;
33281     if (unlikely(!call))
33282         return PyObject_Call(func, arg, kw);
33283     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
33284         return NULL;
33285     result = (*call)(func, arg, kw);
33286     Py_LeaveRecursiveCall();
33287     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
33288         PyErr_SetString(
33289             PyExc_SystemError,
33290             "NULL result without error in PyObject_Call");
33291     }
33292     return result;
33293 }
33294 #endif
33295 
33296 /* SetItemInt */
33297 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
33298     int r;
33299     if (!j) return -1;
33300     r = PyObject_SetItem(o, j, v);
33301     Py_DECREF(j);
33302     return r;
33303 }
33304 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
33305                                                CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
33306 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
33307     if (is_list || PyList_CheckExact(o)) {
33308         Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
33309         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
33310             PyObject* old = PyList_GET_ITEM(o, n);
33311             Py_INCREF(v);
33312             PyList_SET_ITEM(o, n, v);
33313             Py_DECREF(old);
33314             return 1;
33315         }
33316     } else {
33317         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
33318         if (likely(m && m->sq_ass_item)) {
33319             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
33320                 Py_ssize_t l = m->sq_length(o);
33321                 if (likely(l >= 0)) {
33322                     i += l;
33323                 } else {
33324                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
33325                         return -1;
33326                     PyErr_Clear();
33327                 }
33328             }
33329             return m->sq_ass_item(o, i, v);
33330         }
33331     }
33332 #else
33333 #if CYTHON_COMPILING_IN_PYPY
33334     if (is_list || (PySequence_Check(o) && !PyDict_Check(o)))
33335 #else
33336     if (is_list || PySequence_Check(o))
33337 #endif
33338     {
33339         return PySequence_SetItem(o, i, v);
33340     }
33341 #endif
33342     return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
33343 }
33344 
33345 /* PyFunctionFastCall */
33346 #if CYTHON_FAST_PYCALL
33347 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
33348                                                PyObject *globals) {
33349     PyFrameObject *f;
33350     PyThreadState *tstate = __Pyx_PyThreadState_Current;
33351     PyObject **fastlocals;
33352     Py_ssize_t i;
33353     PyObject *result;
33354     assert(globals != NULL);
33355     /* XXX Perhaps we should create a specialized
33356        PyFrame_New() that doesn't take locals, but does
33357        take builtins without sanity checking them.
33358        */
33359     assert(tstate != NULL);
33360     f = PyFrame_New(tstate, co, globals, NULL);
33361     if (f == NULL) {
33362         return NULL;
33363     }
33364     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
33365     for (i = 0; i < na; i++) {
33366         Py_INCREF(*args);
33367         fastlocals[i] = *args++;
33368     }
33369     result = PyEval_EvalFrameEx(f,0);
33370     ++tstate->recursion_depth;
33371     Py_DECREF(f);
33372     --tstate->recursion_depth;
33373     return result;
33374 }
33375 #if 1 || PY_VERSION_HEX < 0x030600B1
33376 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
33377     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
33378     PyObject *globals = PyFunction_GET_GLOBALS(func);
33379     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
33380     PyObject *closure;
33381 #if PY_MAJOR_VERSION >= 3
33382     PyObject *kwdefs;
33383 #endif
33384     PyObject *kwtuple, **k;
33385     PyObject **d;
33386     Py_ssize_t nd;
33387     Py_ssize_t nk;
33388     PyObject *result;
33389     assert(kwargs == NULL || PyDict_Check(kwargs));
33390     nk = kwargs ? PyDict_Size(kwargs) : 0;
33391     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
33392         return NULL;
33393     }
33394     if (
33395 #if PY_MAJOR_VERSION >= 3
33396             co->co_kwonlyargcount == 0 &&
33397 #endif
33398             likely(kwargs == NULL || nk == 0) &&
33399             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
33400         if (argdefs == NULL && co->co_argcount == nargs) {
33401             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
33402             goto done;
33403         }
33404         else if (nargs == 0 && argdefs != NULL
33405                  && co->co_argcount == Py_SIZE(argdefs)) {
33406             /* function called with no arguments, but all parameters have
33407                a default value: use default values as arguments .*/
33408             args = &PyTuple_GET_ITEM(argdefs, 0);
33409             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
33410             goto done;
33411         }
33412     }
33413     if (kwargs != NULL) {
33414         Py_ssize_t pos, i;
33415         kwtuple = PyTuple_New(2 * nk);
33416         if (kwtuple == NULL) {
33417             result = NULL;
33418             goto done;
33419         }
33420         k = &PyTuple_GET_ITEM(kwtuple, 0);
33421         pos = i = 0;
33422         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
33423             Py_INCREF(k[i]);
33424             Py_INCREF(k[i+1]);
33425             i += 2;
33426         }
33427         nk = i / 2;
33428     }
33429     else {
33430         kwtuple = NULL;
33431         k = NULL;
33432     }
33433     closure = PyFunction_GET_CLOSURE(func);
33434 #if PY_MAJOR_VERSION >= 3
33435     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
33436 #endif
33437     if (argdefs != NULL) {
33438         d = &PyTuple_GET_ITEM(argdefs, 0);
33439         nd = Py_SIZE(argdefs);
33440     }
33441     else {
33442         d = NULL;
33443         nd = 0;
33444     }
33445 #if PY_MAJOR_VERSION >= 3
33446     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
33447                                args, (int)nargs,
33448                                k, (int)nk,
33449                                d, (int)nd, kwdefs, closure);
33450 #else
33451     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
33452                                args, (int)nargs,
33453                                k, (int)nk,
33454                                d, (int)nd, closure);
33455 #endif
33456     Py_XDECREF(kwtuple);
33457 done:
33458     Py_LeaveRecursiveCall();
33459     return result;
33460 }
33461 #endif
33462 #endif
33463 
33464 /* PyObjectCallMethO */
33465 #if CYTHON_COMPILING_IN_CPYTHON
33466 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
33467     PyObject *self, *result;
33468     PyCFunction cfunc;
33469     cfunc = PyCFunction_GET_FUNCTION(func);
33470     self = PyCFunction_GET_SELF(func);
33471     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
33472         return NULL;
33473     result = cfunc(self, arg);
33474     Py_LeaveRecursiveCall();
33475     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
33476         PyErr_SetString(
33477             PyExc_SystemError,
33478             "NULL result without error in PyObject_Call");
33479     }
33480     return result;
33481 }
33482 #endif
33483 
33484 /* PyObjectCallNoArg */
33485 #if CYTHON_COMPILING_IN_CPYTHON
33486 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
33487 #if CYTHON_FAST_PYCALL
33488     if (PyFunction_Check(func)) {
33489         return __Pyx_PyFunction_FastCall(func, NULL, 0);
33490     }
33491 #endif
33492 #ifdef __Pyx_CyFunction_USED
33493     if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
33494 #else
33495     if (likely(PyCFunction_Check(func)))
33496 #endif
33497     {
33498         if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
33499             return __Pyx_PyObject_CallMethO(func, NULL);
33500         }
33501     }
33502     return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
33503 }
33504 #endif
33505 
33506 /* PyCFunctionFastCall */
33507 #if CYTHON_FAST_PYCCALL
33508 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
33509     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
33510     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
33511     PyObject *self = PyCFunction_GET_SELF(func);
33512     int flags = PyCFunction_GET_FLAGS(func);
33513     assert(PyCFunction_Check(func));
33514     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
33515     assert(nargs >= 0);
33516     assert(nargs == 0 || args != NULL);
33517     /* _PyCFunction_FastCallDict() must not be called with an exception set,
33518        because it may clear it (directly or indirectly) and so the
33519        caller loses its exception */
33520     assert(!PyErr_Occurred());
33521     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
33522         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
33523     } else {
33524         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
33525     }
33526 }
33527 #endif
33528 
33529 /* PyObjectCallOneArg */
33530 #if CYTHON_COMPILING_IN_CPYTHON
33531 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
33532     PyObject *result;
33533     PyObject *args = PyTuple_New(1);
33534     if (unlikely(!args)) return NULL;
33535     Py_INCREF(arg);
33536     PyTuple_SET_ITEM(args, 0, arg);
33537     result = __Pyx_PyObject_Call(func, args, NULL);
33538     Py_DECREF(args);
33539     return result;
33540 }
33541 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
33542 #if CYTHON_FAST_PYCALL
33543     if (PyFunction_Check(func)) {
33544         return __Pyx_PyFunction_FastCall(func, &arg, 1);
33545     }
33546 #endif
33547     if (likely(PyCFunction_Check(func))) {
33548         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
33549             return __Pyx_PyObject_CallMethO(func, arg);
33550 #if CYTHON_FAST_PYCCALL
33551         } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
33552             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
33553 #endif
33554         }
33555     }
33556     return __Pyx__PyObject_CallOneArg(func, arg);
33557 }
33558 #else
33559 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
33560     PyObject *result;
33561     PyObject *args = PyTuple_Pack(1, arg);
33562     if (unlikely(!args)) return NULL;
33563     result = __Pyx_PyObject_Call(func, args, NULL);
33564     Py_DECREF(args);
33565     return result;
33566 }
33567 #endif
33568 
33569 /* ExtTypeTest */
33570 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
33571     if (unlikely(!type)) {
33572         PyErr_SetString(PyExc_SystemError, "Missing type object");
33573         return 0;
33574     }
33575     if (likely(__Pyx_TypeCheck(obj, type)))
33576         return 1;
33577     PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
33578                  Py_TYPE(obj)->tp_name, type->tp_name);
33579     return 0;
33580 }
33581 
33582 /* PyObjectCall2Args */
33583 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
33584     PyObject *args, *result = NULL;
33585     #if CYTHON_FAST_PYCALL
33586     if (PyFunction_Check(function)) {
33587         PyObject *args[2] = {arg1, arg2};
33588         return __Pyx_PyFunction_FastCall(function, args, 2);
33589     }
33590     #endif
33591     #if CYTHON_FAST_PYCCALL
33592     if (__Pyx_PyFastCFunction_Check(function)) {
33593         PyObject *args[2] = {arg1, arg2};
33594         return __Pyx_PyCFunction_FastCall(function, args, 2);
33595     }
33596     #endif
33597     args = PyTuple_New(2);
33598     if (unlikely(!args)) goto done;
33599     Py_INCREF(arg1);
33600     PyTuple_SET_ITEM(args, 0, arg1);
33601     Py_INCREF(arg2);
33602     PyTuple_SET_ITEM(args, 1, arg2);
33603     Py_INCREF(function);
33604     result = __Pyx_PyObject_Call(function, args, NULL);
33605     Py_DECREF(args);
33606     Py_DECREF(function);
33607 done:
33608     return result;
33609 }
33610 
33611 /* None */
33612 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
33613     PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
33614 }
33615 
33616 /* GetItemInt */
33617 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
33618     PyObject *r;
33619     if (!j) return NULL;
33620     r = PyObject_GetItem(o, j);
33621     Py_DECREF(j);
33622     return r;
33623 }
33624 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
33625                                                               CYTHON_NCP_UNUSED int wraparound,
33626                                                               CYTHON_NCP_UNUSED int boundscheck) {
33627 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
33628     Py_ssize_t wrapped_i = i;
33629     if (wraparound & unlikely(i < 0)) {
33630         wrapped_i += PyList_GET_SIZE(o);
33631     }
33632     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
33633         PyObject *r = PyList_GET_ITEM(o, wrapped_i);
33634         Py_INCREF(r);
33635         return r;
33636     }
33637     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
33638 #else
33639     return PySequence_GetItem(o, i);
33640 #endif
33641 }
33642 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
33643                                                               CYTHON_NCP_UNUSED int wraparound,
33644                                                               CYTHON_NCP_UNUSED int boundscheck) {
33645 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
33646     Py_ssize_t wrapped_i = i;
33647     if (wraparound & unlikely(i < 0)) {
33648         wrapped_i += PyTuple_GET_SIZE(o);
33649     }
33650     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
33651         PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
33652         Py_INCREF(r);
33653         return r;
33654     }
33655     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
33656 #else
33657     return PySequence_GetItem(o, i);
33658 #endif
33659 }
33660 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
33661                                                      CYTHON_NCP_UNUSED int wraparound,
33662                                                      CYTHON_NCP_UNUSED int boundscheck) {
33663 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
33664     if (is_list || PyList_CheckExact(o)) {
33665         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
33666         if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
33667             PyObject *r = PyList_GET_ITEM(o, n);
33668             Py_INCREF(r);
33669             return r;
33670         }
33671     }
33672     else if (PyTuple_CheckExact(o)) {
33673         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
33674         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
33675             PyObject *r = PyTuple_GET_ITEM(o, n);
33676             Py_INCREF(r);
33677             return r;
33678         }
33679     } else {
33680         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
33681         if (likely(m && m->sq_item)) {
33682             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
33683                 Py_ssize_t l = m->sq_length(o);
33684                 if (likely(l >= 0)) {
33685                     i += l;
33686                 } else {
33687                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
33688                         return NULL;
33689                     PyErr_Clear();
33690                 }
33691             }
33692             return m->sq_item(o, i);
33693         }
33694     }
33695 #else
33696     if (is_list || PySequence_Check(o)) {
33697         return PySequence_GetItem(o, i);
33698     }
33699 #endif
33700     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
33701 }
33702 
33703 /* PyErrFetchRestore */
33704 #if CYTHON_FAST_THREAD_STATE
33705 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
33706     PyObject *tmp_type, *tmp_value, *tmp_tb;
33707     tmp_type = tstate->curexc_type;
33708     tmp_value = tstate->curexc_value;
33709     tmp_tb = tstate->curexc_traceback;
33710     tstate->curexc_type = type;
33711     tstate->curexc_value = value;
33712     tstate->curexc_traceback = tb;
33713     Py_XDECREF(tmp_type);
33714     Py_XDECREF(tmp_value);
33715     Py_XDECREF(tmp_tb);
33716 }
33717 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
33718     *type = tstate->curexc_type;
33719     *value = tstate->curexc_value;
33720     *tb = tstate->curexc_traceback;
33721     tstate->curexc_type = 0;
33722     tstate->curexc_value = 0;
33723     tstate->curexc_traceback = 0;
33724 }
33725 #endif
33726 
33727 /* WriteUnraisableException */
33728 static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
33729                                   CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
33730                                   int full_traceback, CYTHON_UNUSED int nogil) {
33731     PyObject *old_exc, *old_val, *old_tb;
33732     PyObject *ctx;
33733     __Pyx_PyThreadState_declare
33734 #ifdef WITH_THREAD
33735     PyGILState_STATE state;
33736     if (nogil)
33737         state = PyGILState_Ensure();
33738 #ifdef _MSC_VER
33739     else state = (PyGILState_STATE)-1;
33740 #endif
33741 #endif
33742     __Pyx_PyThreadState_assign
33743     __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
33744     if (full_traceback) {
33745         Py_XINCREF(old_exc);
33746         Py_XINCREF(old_val);
33747         Py_XINCREF(old_tb);
33748         __Pyx_ErrRestore(old_exc, old_val, old_tb);
33749         PyErr_PrintEx(1);
33750     }
33751     #if PY_MAJOR_VERSION < 3
33752     ctx = PyString_FromString(name);
33753     #else
33754     ctx = PyUnicode_FromString(name);
33755     #endif
33756     __Pyx_ErrRestore(old_exc, old_val, old_tb);
33757     if (!ctx) {
33758         PyErr_WriteUnraisable(Py_None);
33759     } else {
33760         PyErr_WriteUnraisable(ctx);
33761         Py_DECREF(ctx);
33762     }
33763 #ifdef WITH_THREAD
33764     if (nogil)
33765         PyGILState_Release(state);
33766 #endif
33767 }
33768 
33769 /* RaiseTooManyValuesToUnpack */
33770 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
33771     PyErr_Format(PyExc_ValueError,
33772                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
33773 }
33774 
33775 /* RaiseNeedMoreValuesToUnpack */
33776 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
33777     PyErr_Format(PyExc_ValueError,
33778                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
33779                  index, (index == 1) ? "" : "s");
33780 }
33781 
33782 /* IterFinish */
33783 static CYTHON_INLINE int __Pyx_IterFinish(void) {
33784 #if CYTHON_FAST_THREAD_STATE
33785     PyThreadState *tstate = __Pyx_PyThreadState_Current;
33786     PyObject* exc_type = tstate->curexc_type;
33787     if (unlikely(exc_type)) {
33788         if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
33789             PyObject *exc_value, *exc_tb;
33790             exc_value = tstate->curexc_value;
33791             exc_tb = tstate->curexc_traceback;
33792             tstate->curexc_type = 0;
33793             tstate->curexc_value = 0;
33794             tstate->curexc_traceback = 0;
33795             Py_DECREF(exc_type);
33796             Py_XDECREF(exc_value);
33797             Py_XDECREF(exc_tb);
33798             return 0;
33799         } else {
33800             return -1;
33801         }
33802     }
33803     return 0;
33804 #else
33805     if (unlikely(PyErr_Occurred())) {
33806         if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
33807             PyErr_Clear();
33808             return 0;
33809         } else {
33810             return -1;
33811         }
33812     }
33813     return 0;
33814 #endif
33815 }
33816 
33817 /* UnpackItemEndCheck */
33818 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
33819     if (unlikely(retval)) {
33820         Py_DECREF(retval);
33821         __Pyx_RaiseTooManyValuesError(expected);
33822         return -1;
33823     } else {
33824         return __Pyx_IterFinish();
33825     }
33826     return 0;
33827 }
33828 
33829 /* PyIntCompare */
33830 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
33831     if (op1 == op2) {
33832         Py_RETURN_TRUE;
33833     }
33834     #if PY_MAJOR_VERSION < 3
33835     if (likely(PyInt_CheckExact(op1))) {
33836         const long b = intval;
33837         long a = PyInt_AS_LONG(op1);
33838         if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
33839     }
33840     #endif
33841     #if CYTHON_USE_PYLONG_INTERNALS
33842     if (likely(PyLong_CheckExact(op1))) {
33843         int unequal;
33844         unsigned long uintval;
33845         Py_ssize_t size = Py_SIZE(op1);
33846         const digit* digits = ((PyLongObject*)op1)->ob_digit;
33847         if (intval == 0) {
33848             if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
33849         } else if (intval < 0) {
33850             if (size >= 0)
33851                 Py_RETURN_FALSE;
33852             intval = -intval;
33853             size = -size;
33854         } else {
33855             if (size <= 0)
33856                 Py_RETURN_FALSE;
33857         }
33858         uintval = (unsigned long) intval;
33859 #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
33860         if (uintval >> (PyLong_SHIFT * 4)) {
33861             unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
33862                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
33863         } else
33864 #endif
33865 #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
33866         if (uintval >> (PyLong_SHIFT * 3)) {
33867             unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
33868                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
33869         } else
33870 #endif
33871 #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
33872         if (uintval >> (PyLong_SHIFT * 2)) {
33873             unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
33874                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
33875         } else
33876 #endif
33877 #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
33878         if (uintval >> (PyLong_SHIFT * 1)) {
33879             unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
33880                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
33881         } else
33882 #endif
33883             unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
33884         if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
33885     }
33886     #endif
33887     if (PyFloat_CheckExact(op1)) {
33888         const long b = intval;
33889         double a = PyFloat_AS_DOUBLE(op1);
33890         if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
33891     }
33892     return (
33893         PyObject_RichCompare(op1, op2, Py_EQ));
33894 }
33895 
33896 /* PyIntBinop */
33897 #if !CYTHON_COMPILING_IN_PYPY
33898 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
33899     (void)inplace;
33900     (void)zerodivision_check;
33901     #if PY_MAJOR_VERSION < 3
33902     if (likely(PyInt_CheckExact(op1))) {
33903         const long b = intval;
33904         long x;
33905         long a = PyInt_AS_LONG(op1);
33906             x = (long)((unsigned long)a + b);
33907             if (likely((x^a) >= 0 || (x^b) >= 0))
33908                 return PyInt_FromLong(x);
33909             return PyLong_Type.tp_as_number->nb_add(op1, op2);
33910     }
33911     #endif
33912     #if CYTHON_USE_PYLONG_INTERNALS
33913     if (likely(PyLong_CheckExact(op1))) {
33914         const long b = intval;
33915         long a, x;
33916 #ifdef HAVE_LONG_LONG
33917         const PY_LONG_LONG llb = intval;
33918         PY_LONG_LONG lla, llx;
33919 #endif
33920         const digit* digits = ((PyLongObject*)op1)->ob_digit;
33921         const Py_ssize_t size = Py_SIZE(op1);
33922         if (likely(__Pyx_sst_abs(size) <= 1)) {
33923             a = likely(size) ? digits[0] : 0;
33924             if (size == -1) a = -a;
33925         } else {
33926             switch (size) {
33927                 case -2:
33928                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
33929                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
33930                         break;
33931 #ifdef HAVE_LONG_LONG
33932                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
33933                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
33934                         goto long_long;
33935 #endif
33936                     }
33937                     CYTHON_FALLTHROUGH;
33938                 case 2:
33939                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
33940                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
33941                         break;
33942 #ifdef HAVE_LONG_LONG
33943                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
33944                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
33945                         goto long_long;
33946 #endif
33947                     }
33948                     CYTHON_FALLTHROUGH;
33949                 case -3:
33950                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
33951                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
33952                         break;
33953 #ifdef HAVE_LONG_LONG
33954                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
33955                         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]));
33956                         goto long_long;
33957 #endif
33958                     }
33959                     CYTHON_FALLTHROUGH;
33960                 case 3:
33961                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
33962                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
33963                         break;
33964 #ifdef HAVE_LONG_LONG
33965                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
33966                         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]));
33967                         goto long_long;
33968 #endif
33969                     }
33970                     CYTHON_FALLTHROUGH;
33971                 case -4:
33972                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
33973                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
33974                         break;
33975 #ifdef HAVE_LONG_LONG
33976                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
33977                         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]));
33978                         goto long_long;
33979 #endif
33980                     }
33981                     CYTHON_FALLTHROUGH;
33982                 case 4:
33983                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
33984                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
33985                         break;
33986 #ifdef HAVE_LONG_LONG
33987                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
33988                         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]));
33989                         goto long_long;
33990 #endif
33991                     }
33992                     CYTHON_FALLTHROUGH;
33993                 default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
33994             }
33995         }
33996                 x = a + b;
33997             return PyLong_FromLong(x);
33998 #ifdef HAVE_LONG_LONG
33999         long_long:
34000                 llx = lla + llb;
34001             return PyLong_FromLongLong(llx);
34002 #endif
34003 
34004 
34005     }
34006     #endif
34007     if (PyFloat_CheckExact(op1)) {
34008         const long b = intval;
34009         double a = PyFloat_AS_DOUBLE(op1);
34010             double result;
34011             PyFPE_START_PROTECT("add", return NULL)
34012             result = ((double)a) + (double)b;
34013             PyFPE_END_PROTECT(result)
34014             return PyFloat_FromDouble(result);
34015     }
34016     return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
34017 }
34018 #endif
34019 
34020 /* RaiseException */
34021 #if PY_MAJOR_VERSION < 3
34022 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
34023                         CYTHON_UNUSED PyObject *cause) {
34024     __Pyx_PyThreadState_declare
34025     Py_XINCREF(type);
34026     if (!value || value == Py_None)
34027         value = NULL;
34028     else
34029         Py_INCREF(value);
34030     if (!tb || tb == Py_None)
34031         tb = NULL;
34032     else {
34033         Py_INCREF(tb);
34034         if (!PyTraceBack_Check(tb)) {
34035             PyErr_SetString(PyExc_TypeError,
34036                 "raise: arg 3 must be a traceback or None");
34037             goto raise_error;
34038         }
34039     }
34040     if (PyType_Check(type)) {
34041 #if CYTHON_COMPILING_IN_PYPY
34042         if (!value) {
34043             Py_INCREF(Py_None);
34044             value = Py_None;
34045         }
34046 #endif
34047         PyErr_NormalizeException(&type, &value, &tb);
34048     } else {
34049         if (value) {
34050             PyErr_SetString(PyExc_TypeError,
34051                 "instance exception may not have a separate value");
34052             goto raise_error;
34053         }
34054         value = type;
34055         type = (PyObject*) Py_TYPE(type);
34056         Py_INCREF(type);
34057         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
34058             PyErr_SetString(PyExc_TypeError,
34059                 "raise: exception class must be a subclass of BaseException");
34060             goto raise_error;
34061         }
34062     }
34063     __Pyx_PyThreadState_assign
34064     __Pyx_ErrRestore(type, value, tb);
34065     return;
34066 raise_error:
34067     Py_XDECREF(value);
34068     Py_XDECREF(type);
34069     Py_XDECREF(tb);
34070     return;
34071 }
34072 #else
34073 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
34074     PyObject* owned_instance = NULL;
34075     if (tb == Py_None) {
34076         tb = 0;
34077     } else if (tb && !PyTraceBack_Check(tb)) {
34078         PyErr_SetString(PyExc_TypeError,
34079             "raise: arg 3 must be a traceback or None");
34080         goto bad;
34081     }
34082     if (value == Py_None)
34083         value = 0;
34084     if (PyExceptionInstance_Check(type)) {
34085         if (value) {
34086             PyErr_SetString(PyExc_TypeError,
34087                 "instance exception may not have a separate value");
34088             goto bad;
34089         }
34090         value = type;
34091         type = (PyObject*) Py_TYPE(value);
34092     } else if (PyExceptionClass_Check(type)) {
34093         PyObject *instance_class = NULL;
34094         if (value && PyExceptionInstance_Check(value)) {
34095             instance_class = (PyObject*) Py_TYPE(value);
34096             if (instance_class != type) {
34097                 int is_subclass = PyObject_IsSubclass(instance_class, type);
34098                 if (!is_subclass) {
34099                     instance_class = NULL;
34100                 } else if (unlikely(is_subclass == -1)) {
34101                     goto bad;
34102                 } else {
34103                     type = instance_class;
34104                 }
34105             }
34106         }
34107         if (!instance_class) {
34108             PyObject *args;
34109             if (!value)
34110                 args = PyTuple_New(0);
34111             else if (PyTuple_Check(value)) {
34112                 Py_INCREF(value);
34113                 args = value;
34114             } else
34115                 args = PyTuple_Pack(1, value);
34116             if (!args)
34117                 goto bad;
34118             owned_instance = PyObject_Call(type, args, NULL);
34119             Py_DECREF(args);
34120             if (!owned_instance)
34121                 goto bad;
34122             value = owned_instance;
34123             if (!PyExceptionInstance_Check(value)) {
34124                 PyErr_Format(PyExc_TypeError,
34125                              "calling %R should have returned an instance of "
34126                              "BaseException, not %R",
34127                              type, Py_TYPE(value));
34128                 goto bad;
34129             }
34130         }
34131     } else {
34132         PyErr_SetString(PyExc_TypeError,
34133             "raise: exception class must be a subclass of BaseException");
34134         goto bad;
34135     }
34136     if (cause) {
34137         PyObject *fixed_cause;
34138         if (cause == Py_None) {
34139             fixed_cause = NULL;
34140         } else if (PyExceptionClass_Check(cause)) {
34141             fixed_cause = PyObject_CallObject(cause, NULL);
34142             if (fixed_cause == NULL)
34143                 goto bad;
34144         } else if (PyExceptionInstance_Check(cause)) {
34145             fixed_cause = cause;
34146             Py_INCREF(fixed_cause);
34147         } else {
34148             PyErr_SetString(PyExc_TypeError,
34149                             "exception causes must derive from "
34150                             "BaseException");
34151             goto bad;
34152         }
34153         PyException_SetCause(value, fixed_cause);
34154     }
34155     PyErr_SetObject(type, value);
34156     if (tb) {
34157 #if CYTHON_COMPILING_IN_PYPY
34158         PyObject *tmp_type, *tmp_value, *tmp_tb;
34159         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
34160         Py_INCREF(tb);
34161         PyErr_Restore(tmp_type, tmp_value, tb);
34162         Py_XDECREF(tmp_tb);
34163 #else
34164         PyThreadState *tstate = __Pyx_PyThreadState_Current;
34165         PyObject* tmp_tb = tstate->curexc_traceback;
34166         if (tb != tmp_tb) {
34167             Py_INCREF(tb);
34168             tstate->curexc_traceback = tb;
34169             Py_XDECREF(tmp_tb);
34170         }
34171 #endif
34172     }
34173 bad:
34174     Py_XDECREF(owned_instance);
34175     return;
34176 }
34177 #endif
34178 
34179 /* IsLittleEndian */
34180 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
34181 {
34182   union {
34183     uint32_t u32;
34184     uint8_t u8[4];
34185   } S;
34186   S.u32 = 0x01020304;
34187   return S.u8[0] == 4;
34188 }
34189 
34190 /* BufferFormatCheck */
34191 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
34192                               __Pyx_BufFmt_StackElem* stack,
34193                               __Pyx_TypeInfo* type) {
34194   stack[0].field = &ctx->root;
34195   stack[0].parent_offset = 0;
34196   ctx->root.type = type;
34197   ctx->root.name = "buffer dtype";
34198   ctx->root.offset = 0;
34199   ctx->head = stack;
34200   ctx->head->field = &ctx->root;
34201   ctx->fmt_offset = 0;
34202   ctx->head->parent_offset = 0;
34203   ctx->new_packmode = '@';
34204   ctx->enc_packmode = '@';
34205   ctx->new_count = 1;
34206   ctx->enc_count = 0;
34207   ctx->enc_type = 0;
34208   ctx->is_complex = 0;
34209   ctx->is_valid_array = 0;
34210   ctx->struct_alignment = 0;
34211   while (type->typegroup == 'S') {
34212     ++ctx->head;
34213     ctx->head->field = type->fields;
34214     ctx->head->parent_offset = 0;
34215     type = type->fields->type;
34216   }
34217 }
34218 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
34219     int count;
34220     const char* t = *ts;
34221     if (*t < '0' || *t > '9') {
34222       return -1;
34223     } else {
34224         count = *t++ - '0';
34225         while (*t >= '0' && *t <= '9') {
34226             count *= 10;
34227             count += *t++ - '0';
34228         }
34229     }
34230     *ts = t;
34231     return count;
34232 }
34233 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
34234     int number = __Pyx_BufFmt_ParseNumber(ts);
34235     if (number == -1)
34236         PyErr_Format(PyExc_ValueError,\
34237                      "Does not understand character buffer dtype format string ('%c')", **ts);
34238     return number;
34239 }
34240 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
34241   PyErr_Format(PyExc_ValueError,
34242                "Unexpected format string character: '%c'", ch);
34243 }
34244 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
34245   switch (ch) {
34246     case 'c': return "'char'";
34247     case 'b': return "'signed char'";
34248     case 'B': return "'unsigned char'";
34249     case 'h': return "'short'";
34250     case 'H': return "'unsigned short'";
34251     case 'i': return "'int'";
34252     case 'I': return "'unsigned int'";
34253     case 'l': return "'long'";
34254     case 'L': return "'unsigned long'";
34255     case 'q': return "'long long'";
34256     case 'Q': return "'unsigned long long'";
34257     case 'f': return (is_complex ? "'complex float'" : "'float'");
34258     case 'd': return (is_complex ? "'complex double'" : "'double'");
34259     case 'g': return (is_complex ? "'complex long double'" : "'long double'");
34260     case 'T': return "a struct";
34261     case 'O': return "Python object";
34262     case 'P': return "a pointer";
34263     case 's': case 'p': return "a string";
34264     case 0: return "end";
34265     default: return "unparseable format string";
34266   }
34267 }
34268 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
34269   switch (ch) {
34270     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
34271     case 'h': case 'H': return 2;
34272     case 'i': case 'I': case 'l': case 'L': return 4;
34273     case 'q': case 'Q': return 8;
34274     case 'f': return (is_complex ? 8 : 4);
34275     case 'd': return (is_complex ? 16 : 8);
34276     case 'g': {
34277       PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
34278       return 0;
34279     }
34280     case 'O': case 'P': return sizeof(void*);
34281     default:
34282       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
34283       return 0;
34284     }
34285 }
34286 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
34287   switch (ch) {
34288     case 'c': case 'b': case 'B': case 's': case 'p': return 1;
34289     case 'h': case 'H': return sizeof(short);
34290     case 'i': case 'I': return sizeof(int);
34291     case 'l': case 'L': return sizeof(long);
34292     #ifdef HAVE_LONG_LONG
34293     case 'q': case 'Q': return sizeof(PY_LONG_LONG);
34294     #endif
34295     case 'f': return sizeof(float) * (is_complex ? 2 : 1);
34296     case 'd': return sizeof(double) * (is_complex ? 2 : 1);
34297     case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
34298     case 'O': case 'P': return sizeof(void*);
34299     default: {
34300       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
34301       return 0;
34302     }
34303   }
34304 }
34305 typedef struct { char c; short x; } __Pyx_st_short;
34306 typedef struct { char c; int x; } __Pyx_st_int;
34307 typedef struct { char c; long x; } __Pyx_st_long;
34308 typedef struct { char c; float x; } __Pyx_st_float;
34309 typedef struct { char c; double x; } __Pyx_st_double;
34310 typedef struct { char c; long double x; } __Pyx_st_longdouble;
34311 typedef struct { char c; void *x; } __Pyx_st_void_p;
34312 #ifdef HAVE_LONG_LONG
34313 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
34314 #endif
34315 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
34316   switch (ch) {
34317     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
34318     case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
34319     case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
34320     case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
34321 #ifdef HAVE_LONG_LONG
34322     case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
34323 #endif
34324     case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
34325     case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
34326     case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
34327     case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
34328     default:
34329       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
34330       return 0;
34331     }
34332 }
34333 /* These are for computing the padding at the end of the struct to align
34334    on the first member of the struct. This will probably the same as above,
34335    but we don't have any guarantees.
34336  */
34337 typedef struct { short x; char c; } __Pyx_pad_short;
34338 typedef struct { int x; char c; } __Pyx_pad_int;
34339 typedef struct { long x; char c; } __Pyx_pad_long;
34340 typedef struct { float x; char c; } __Pyx_pad_float;
34341 typedef struct { double x; char c; } __Pyx_pad_double;
34342 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
34343 typedef struct { void *x; char c; } __Pyx_pad_void_p;
34344 #ifdef HAVE_LONG_LONG
34345 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
34346 #endif
34347 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
34348   switch (ch) {
34349     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
34350     case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
34351     case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
34352     case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
34353 #ifdef HAVE_LONG_LONG
34354     case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
34355 #endif
34356     case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
34357     case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
34358     case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
34359     case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
34360     default:
34361       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
34362       return 0;
34363     }
34364 }
34365 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
34366   switch (ch) {
34367     case 'c':
34368         return 'H';
34369     case 'b': case 'h': case 'i':
34370     case 'l': case 'q': case 's': case 'p':
34371         return 'I';
34372     case 'B': case 'H': case 'I': case 'L': case 'Q':
34373         return 'U';
34374     case 'f': case 'd': case 'g':
34375         return (is_complex ? 'C' : 'R');
34376     case 'O':
34377         return 'O';
34378     case 'P':
34379         return 'P';
34380     default: {
34381       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
34382       return 0;
34383     }
34384   }
34385 }
34386 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
34387   if (ctx->head == NULL || ctx->head->field == &ctx->root) {
34388     const char* expected;
34389     const char* quote;
34390     if (ctx->head == NULL) {
34391       expected = "end";
34392       quote = "";
34393     } else {
34394       expected = ctx->head->field->type->name;
34395       quote = "'";
34396     }
34397     PyErr_Format(PyExc_ValueError,
34398                  "Buffer dtype mismatch, expected %s%s%s but got %s",
34399                  quote, expected, quote,
34400                  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
34401   } else {
34402     __Pyx_StructField* field = ctx->head->field;
34403     __Pyx_StructField* parent = (ctx->head - 1)->field;
34404     PyErr_Format(PyExc_ValueError,
34405                  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
34406                  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
34407                  parent->type->name, field->name);
34408   }
34409 }
34410 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
34411   char group;
34412   size_t size, offset, arraysize = 1;
34413   if (ctx->enc_type == 0) return 0;
34414   if (ctx->head->field->type->arraysize[0]) {
34415     int i, ndim = 0;
34416     if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
34417         ctx->is_valid_array = ctx->head->field->type->ndim == 1;
34418         ndim = 1;
34419         if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
34420             PyErr_Format(PyExc_ValueError,
34421                          "Expected a dimension of size %zu, got %zu",
34422                          ctx->head->field->type->arraysize[0], ctx->enc_count);
34423             return -1;
34424         }
34425     }
34426     if (!ctx->is_valid_array) {
34427       PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
34428                    ctx->head->field->type->ndim, ndim);
34429       return -1;
34430     }
34431     for (i = 0; i < ctx->head->field->type->ndim; i++) {
34432       arraysize *= ctx->head->field->type->arraysize[i];
34433     }
34434     ctx->is_valid_array = 0;
34435     ctx->enc_count = 1;
34436   }
34437   group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
34438   do {
34439     __Pyx_StructField* field = ctx->head->field;
34440     __Pyx_TypeInfo* type = field->type;
34441     if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
34442       size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
34443     } else {
34444       size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
34445     }
34446     if (ctx->enc_packmode == '@') {
34447       size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
34448       size_t align_mod_offset;
34449       if (align_at == 0) return -1;
34450       align_mod_offset = ctx->fmt_offset % align_at;
34451       if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
34452       if (ctx->struct_alignment == 0)
34453           ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
34454                                                                  ctx->is_complex);
34455     }
34456     if (type->size != size || type->typegroup != group) {
34457       if (type->typegroup == 'C' && type->fields != NULL) {
34458         size_t parent_offset = ctx->head->parent_offset + field->offset;
34459         ++ctx->head;
34460         ctx->head->field = type->fields;
34461         ctx->head->parent_offset = parent_offset;
34462         continue;
34463       }
34464       if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
34465       } else {
34466           __Pyx_BufFmt_RaiseExpected(ctx);
34467           return -1;
34468       }
34469     }
34470     offset = ctx->head->parent_offset + field->offset;
34471     if (ctx->fmt_offset != offset) {
34472       PyErr_Format(PyExc_ValueError,
34473                    "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
34474                    (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
34475       return -1;
34476     }
34477     ctx->fmt_offset += size;
34478     if (arraysize)
34479       ctx->fmt_offset += (arraysize - 1) * size;
34480     --ctx->enc_count;
34481     while (1) {
34482       if (field == &ctx->root) {
34483         ctx->head = NULL;
34484         if (ctx->enc_count != 0) {
34485           __Pyx_BufFmt_RaiseExpected(ctx);
34486           return -1;
34487         }
34488         break;
34489       }
34490       ctx->head->field = ++field;
34491       if (field->type == NULL) {
34492         --ctx->head;
34493         field = ctx->head->field;
34494         continue;
34495       } else if (field->type->typegroup == 'S') {
34496         size_t parent_offset = ctx->head->parent_offset + field->offset;
34497         if (field->type->fields->type == NULL) continue;
34498         field = field->type->fields;
34499         ++ctx->head;
34500         ctx->head->field = field;
34501         ctx->head->parent_offset = parent_offset;
34502         break;
34503       } else {
34504         break;
34505       }
34506     }
34507   } while (ctx->enc_count);
34508   ctx->enc_type = 0;
34509   ctx->is_complex = 0;
34510   return 0;
34511 }
34512 static PyObject *
34513 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
34514 {
34515     const char *ts = *tsp;
34516     int i = 0, number;
34517     int ndim = ctx->head->field->type->ndim;
34518 ;
34519     ++ts;
34520     if (ctx->new_count != 1) {
34521         PyErr_SetString(PyExc_ValueError,
34522                         "Cannot handle repeated arrays in format string");
34523         return NULL;
34524     }
34525     if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
34526     while (*ts && *ts != ')') {
34527         switch (*ts) {
34528             case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
34529             default:  break;
34530         }
34531         number = __Pyx_BufFmt_ExpectNumber(&ts);
34532         if (number == -1) return NULL;
34533         if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
34534             return PyErr_Format(PyExc_ValueError,
34535                         "Expected a dimension of size %zu, got %d",
34536                         ctx->head->field->type->arraysize[i], number);
34537         if (*ts != ',' && *ts != ')')
34538             return PyErr_Format(PyExc_ValueError,
34539                                 "Expected a comma in format string, got '%c'", *ts);
34540         if (*ts == ',') ts++;
34541         i++;
34542     }
34543     if (i != ndim)
34544         return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
34545                             ctx->head->field->type->ndim, i);
34546     if (!*ts) {
34547         PyErr_SetString(PyExc_ValueError,
34548                         "Unexpected end of format string, expected ')'");
34549         return NULL;
34550     }
34551     ctx->is_valid_array = 1;
34552     ctx->new_count = 1;
34553     *tsp = ++ts;
34554     return Py_None;
34555 }
34556 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
34557   int got_Z = 0;
34558   while (1) {
34559     switch(*ts) {
34560       case 0:
34561         if (ctx->enc_type != 0 && ctx->head == NULL) {
34562           __Pyx_BufFmt_RaiseExpected(ctx);
34563           return NULL;
34564         }
34565         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
34566         if (ctx->head != NULL) {
34567           __Pyx_BufFmt_RaiseExpected(ctx);
34568           return NULL;
34569         }
34570         return ts;
34571       case ' ':
34572       case '\r':
34573       case '\n':
34574         ++ts;
34575         break;
34576       case '<':
34577         if (!__Pyx_Is_Little_Endian()) {
34578           PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
34579           return NULL;
34580         }
34581         ctx->new_packmode = '=';
34582         ++ts;
34583         break;
34584       case '>':
34585       case '!':
34586         if (__Pyx_Is_Little_Endian()) {
34587           PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
34588           return NULL;
34589         }
34590         ctx->new_packmode = '=';
34591         ++ts;
34592         break;
34593       case '=':
34594       case '@':
34595       case '^':
34596         ctx->new_packmode = *ts++;
34597         break;
34598       case 'T':
34599         {
34600           const char* ts_after_sub;
34601           size_t i, struct_count = ctx->new_count;
34602           size_t struct_alignment = ctx->struct_alignment;
34603           ctx->new_count = 1;
34604           ++ts;
34605           if (*ts != '{') {
34606             PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
34607             return NULL;
34608           }
34609           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
34610           ctx->enc_type = 0;
34611           ctx->enc_count = 0;
34612           ctx->struct_alignment = 0;
34613           ++ts;
34614           ts_after_sub = ts;
34615           for (i = 0; i != struct_count; ++i) {
34616             ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
34617             if (!ts_after_sub) return NULL;
34618           }
34619           ts = ts_after_sub;
34620           if (struct_alignment) ctx->struct_alignment = struct_alignment;
34621         }
34622         break;
34623       case '}':
34624         {
34625           size_t alignment = ctx->struct_alignment;
34626           ++ts;
34627           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
34628           ctx->enc_type = 0;
34629           if (alignment && ctx->fmt_offset % alignment) {
34630             ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
34631           }
34632         }
34633         return ts;
34634       case 'x':
34635         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
34636         ctx->fmt_offset += ctx->new_count;
34637         ctx->new_count = 1;
34638         ctx->enc_count = 0;
34639         ctx->enc_type = 0;
34640         ctx->enc_packmode = ctx->new_packmode;
34641         ++ts;
34642         break;
34643       case 'Z':
34644         got_Z = 1;
34645         ++ts;
34646         if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
34647           __Pyx_BufFmt_RaiseUnexpectedChar('Z');
34648           return NULL;
34649         }
34650         CYTHON_FALLTHROUGH;
34651       case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
34652       case 'l': case 'L': case 'q': case 'Q':
34653       case 'f': case 'd': case 'g':
34654       case 'O': case 'p':
34655         if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
34656             ctx->enc_packmode == ctx->new_packmode) {
34657           ctx->enc_count += ctx->new_count;
34658           ctx->new_count = 1;
34659           got_Z = 0;
34660           ++ts;
34661           break;
34662         }
34663         CYTHON_FALLTHROUGH;
34664       case 's':
34665         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
34666         ctx->enc_count = ctx->new_count;
34667         ctx->enc_packmode = ctx->new_packmode;
34668         ctx->enc_type = *ts;
34669         ctx->is_complex = got_Z;
34670         ++ts;
34671         ctx->new_count = 1;
34672         got_Z = 0;
34673         break;
34674       case ':':
34675         ++ts;
34676         while(*ts != ':') ++ts;
34677         ++ts;
34678         break;
34679       case '(':
34680         if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
34681         break;
34682       default:
34683         {
34684           int number = __Pyx_BufFmt_ExpectNumber(&ts);
34685           if (number == -1) return NULL;
34686           ctx->new_count = (size_t)number;
34687         }
34688     }
34689   }
34690 }
34691 
34692 /* BufferGetAndValidate */
34693   static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
34694   if (unlikely(info->buf == NULL)) return;
34695   if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
34696   __Pyx_ReleaseBuffer(info);
34697 }
34698 static void __Pyx_ZeroBuffer(Py_buffer* buf) {
34699   buf->buf = NULL;
34700   buf->obj = NULL;
34701   buf->strides = __Pyx_zeros;
34702   buf->shape = __Pyx_zeros;
34703   buf->suboffsets = __Pyx_minusones;
34704 }
34705 static int __Pyx__GetBufferAndValidate(
34706         Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
34707         int nd, int cast, __Pyx_BufFmt_StackElem* stack)
34708 {
34709   buf->buf = NULL;
34710   if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
34711     __Pyx_ZeroBuffer(buf);
34712     return -1;
34713   }
34714   if (unlikely(buf->ndim != nd)) {
34715     PyErr_Format(PyExc_ValueError,
34716                  "Buffer has wrong number of dimensions (expected %d, got %d)",
34717                  nd, buf->ndim);
34718     goto fail;
34719   }
34720   if (!cast) {
34721     __Pyx_BufFmt_Context ctx;
34722     __Pyx_BufFmt_Init(&ctx, stack, dtype);
34723     if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
34724   }
34725   if (unlikely((size_t)buf->itemsize != dtype->size)) {
34726     PyErr_Format(PyExc_ValueError,
34727       "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
34728       buf->itemsize, (buf->itemsize > 1) ? "s" : "",
34729       dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
34730     goto fail;
34731   }
34732   if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
34733   return 0;
34734 fail:;
34735   __Pyx_SafeReleaseBuffer(buf);
34736   return -1;
34737 }
34738 
34739 /* DictGetItem */
34740   #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
34741 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
34742     PyObject *value;
34743     value = PyDict_GetItemWithError(d, key);
34744     if (unlikely(!value)) {
34745         if (!PyErr_Occurred()) {
34746             if (unlikely(PyTuple_Check(key))) {
34747                 PyObject* args = PyTuple_Pack(1, key);
34748                 if (likely(args)) {
34749                     PyErr_SetObject(PyExc_KeyError, args);
34750                     Py_DECREF(args);
34751                 }
34752             } else {
34753                 PyErr_SetObject(PyExc_KeyError, key);
34754             }
34755         }
34756         return NULL;
34757     }
34758     Py_INCREF(value);
34759     return value;
34760 }
34761 #endif
34762 
34763 /* RaiseNoneIterError */
34764   static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
34765     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
34766 }
34767 
34768 /* GetTopmostException */
34769   #if CYTHON_USE_EXC_INFO_STACK
34770 static _PyErr_StackItem *
34771 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
34772 {
34773     _PyErr_StackItem *exc_info = tstate->exc_info;
34774     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
34775            exc_info->previous_item != NULL)
34776     {
34777         exc_info = exc_info->previous_item;
34778     }
34779     return exc_info;
34780 }
34781 #endif
34782 
34783 /* SaveResetException */
34784   #if CYTHON_FAST_THREAD_STATE
34785 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
34786     #if CYTHON_USE_EXC_INFO_STACK
34787     _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
34788     *type = exc_info->exc_type;
34789     *value = exc_info->exc_value;
34790     *tb = exc_info->exc_traceback;
34791     #else
34792     *type = tstate->exc_type;
34793     *value = tstate->exc_value;
34794     *tb = tstate->exc_traceback;
34795     #endif
34796     Py_XINCREF(*type);
34797     Py_XINCREF(*value);
34798     Py_XINCREF(*tb);
34799 }
34800 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
34801     PyObject *tmp_type, *tmp_value, *tmp_tb;
34802     #if CYTHON_USE_EXC_INFO_STACK
34803     _PyErr_StackItem *exc_info = tstate->exc_info;
34804     tmp_type = exc_info->exc_type;
34805     tmp_value = exc_info->exc_value;
34806     tmp_tb = exc_info->exc_traceback;
34807     exc_info->exc_type = type;
34808     exc_info->exc_value = value;
34809     exc_info->exc_traceback = tb;
34810     #else
34811     tmp_type = tstate->exc_type;
34812     tmp_value = tstate->exc_value;
34813     tmp_tb = tstate->exc_traceback;
34814     tstate->exc_type = type;
34815     tstate->exc_value = value;
34816     tstate->exc_traceback = tb;
34817     #endif
34818     Py_XDECREF(tmp_type);
34819     Py_XDECREF(tmp_value);
34820     Py_XDECREF(tmp_tb);
34821 }
34822 #endif
34823 
34824 /* PyErrExceptionMatches */
34825   #if CYTHON_FAST_THREAD_STATE
34826 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
34827     Py_ssize_t i, n;
34828     n = PyTuple_GET_SIZE(tuple);
34829 #if PY_MAJOR_VERSION >= 3
34830     for (i=0; i<n; i++) {
34831         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
34832     }
34833 #endif
34834     for (i=0; i<n; i++) {
34835         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
34836     }
34837     return 0;
34838 }
34839 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
34840     PyObject *exc_type = tstate->curexc_type;
34841     if (exc_type == err) return 1;
34842     if (unlikely(!exc_type)) return 0;
34843     if (unlikely(PyTuple_Check(err)))
34844         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
34845     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
34846 }
34847 #endif
34848 
34849 /* GetException */
34850   #if CYTHON_FAST_THREAD_STATE
34851 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
34852 #else
34853 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
34854 #endif
34855 {
34856     PyObject *local_type, *local_value, *local_tb;
34857 #if CYTHON_FAST_THREAD_STATE
34858     PyObject *tmp_type, *tmp_value, *tmp_tb;
34859     local_type = tstate->curexc_type;
34860     local_value = tstate->curexc_value;
34861     local_tb = tstate->curexc_traceback;
34862     tstate->curexc_type = 0;
34863     tstate->curexc_value = 0;
34864     tstate->curexc_traceback = 0;
34865 #else
34866     PyErr_Fetch(&local_type, &local_value, &local_tb);
34867 #endif
34868     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
34869 #if CYTHON_FAST_THREAD_STATE
34870     if (unlikely(tstate->curexc_type))
34871 #else
34872     if (unlikely(PyErr_Occurred()))
34873 #endif
34874         goto bad;
34875     #if PY_MAJOR_VERSION >= 3
34876     if (local_tb) {
34877         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
34878             goto bad;
34879     }
34880     #endif
34881     Py_XINCREF(local_tb);
34882     Py_XINCREF(local_type);
34883     Py_XINCREF(local_value);
34884     *type = local_type;
34885     *value = local_value;
34886     *tb = local_tb;
34887 #if CYTHON_FAST_THREAD_STATE
34888     #if CYTHON_USE_EXC_INFO_STACK
34889     {
34890         _PyErr_StackItem *exc_info = tstate->exc_info;
34891         tmp_type = exc_info->exc_type;
34892         tmp_value = exc_info->exc_value;
34893         tmp_tb = exc_info->exc_traceback;
34894         exc_info->exc_type = local_type;
34895         exc_info->exc_value = local_value;
34896         exc_info->exc_traceback = local_tb;
34897     }
34898     #else
34899     tmp_type = tstate->exc_type;
34900     tmp_value = tstate->exc_value;
34901     tmp_tb = tstate->exc_traceback;
34902     tstate->exc_type = local_type;
34903     tstate->exc_value = local_value;
34904     tstate->exc_traceback = local_tb;
34905     #endif
34906     Py_XDECREF(tmp_type);
34907     Py_XDECREF(tmp_value);
34908     Py_XDECREF(tmp_tb);
34909 #else
34910     PyErr_SetExcInfo(local_type, local_value, local_tb);
34911 #endif
34912     return 0;
34913 bad:
34914     *type = 0;
34915     *value = 0;
34916     *tb = 0;
34917     Py_XDECREF(local_type);
34918     Py_XDECREF(local_value);
34919     Py_XDECREF(local_tb);
34920     return -1;
34921 }
34922 
34923 /* BytesEquals */
34924   static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
34925 #if CYTHON_COMPILING_IN_PYPY
34926     return PyObject_RichCompareBool(s1, s2, equals);
34927 #else
34928     if (s1 == s2) {
34929         return (equals == Py_EQ);
34930     } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
34931         const char *ps1, *ps2;
34932         Py_ssize_t length = PyBytes_GET_SIZE(s1);
34933         if (length != PyBytes_GET_SIZE(s2))
34934             return (equals == Py_NE);
34935         ps1 = PyBytes_AS_STRING(s1);
34936         ps2 = PyBytes_AS_STRING(s2);
34937         if (ps1[0] != ps2[0]) {
34938             return (equals == Py_NE);
34939         } else if (length == 1) {
34940             return (equals == Py_EQ);
34941         } else {
34942             int result;
34943 #if CYTHON_USE_UNICODE_INTERNALS
34944             Py_hash_t hash1, hash2;
34945             hash1 = ((PyBytesObject*)s1)->ob_shash;
34946             hash2 = ((PyBytesObject*)s2)->ob_shash;
34947             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
34948                 return (equals == Py_NE);
34949             }
34950 #endif
34951             result = memcmp(ps1, ps2, (size_t)length);
34952             return (equals == Py_EQ) ? (result == 0) : (result != 0);
34953         }
34954     } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
34955         return (equals == Py_NE);
34956     } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
34957         return (equals == Py_NE);
34958     } else {
34959         int result;
34960         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
34961         if (!py_result)
34962             return -1;
34963         result = __Pyx_PyObject_IsTrue(py_result);
34964         Py_DECREF(py_result);
34965         return result;
34966     }
34967 #endif
34968 }
34969 
34970 /* UnicodeEquals */
34971   static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
34972 #if CYTHON_COMPILING_IN_PYPY
34973     return PyObject_RichCompareBool(s1, s2, equals);
34974 #else
34975 #if PY_MAJOR_VERSION < 3
34976     PyObject* owned_ref = NULL;
34977 #endif
34978     int s1_is_unicode, s2_is_unicode;
34979     if (s1 == s2) {
34980         goto return_eq;
34981     }
34982     s1_is_unicode = PyUnicode_CheckExact(s1);
34983     s2_is_unicode = PyUnicode_CheckExact(s2);
34984 #if PY_MAJOR_VERSION < 3
34985     if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
34986         owned_ref = PyUnicode_FromObject(s2);
34987         if (unlikely(!owned_ref))
34988             return -1;
34989         s2 = owned_ref;
34990         s2_is_unicode = 1;
34991     } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
34992         owned_ref = PyUnicode_FromObject(s1);
34993         if (unlikely(!owned_ref))
34994             return -1;
34995         s1 = owned_ref;
34996         s1_is_unicode = 1;
34997     } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
34998         return __Pyx_PyBytes_Equals(s1, s2, equals);
34999     }
35000 #endif
35001     if (s1_is_unicode & s2_is_unicode) {
35002         Py_ssize_t length;
35003         int kind;
35004         void *data1, *data2;
35005         if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
35006             return -1;
35007         length = __Pyx_PyUnicode_GET_LENGTH(s1);
35008         if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
35009             goto return_ne;
35010         }
35011 #if CYTHON_USE_UNICODE_INTERNALS
35012         {
35013             Py_hash_t hash1, hash2;
35014         #if CYTHON_PEP393_ENABLED
35015             hash1 = ((PyASCIIObject*)s1)->hash;
35016             hash2 = ((PyASCIIObject*)s2)->hash;
35017         #else
35018             hash1 = ((PyUnicodeObject*)s1)->hash;
35019             hash2 = ((PyUnicodeObject*)s2)->hash;
35020         #endif
35021             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
35022                 goto return_ne;
35023             }
35024         }
35025 #endif
35026         kind = __Pyx_PyUnicode_KIND(s1);
35027         if (kind != __Pyx_PyUnicode_KIND(s2)) {
35028             goto return_ne;
35029         }
35030         data1 = __Pyx_PyUnicode_DATA(s1);
35031         data2 = __Pyx_PyUnicode_DATA(s2);
35032         if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
35033             goto return_ne;
35034         } else if (length == 1) {
35035             goto return_eq;
35036         } else {
35037             int result = memcmp(data1, data2, (size_t)(length * kind));
35038             #if PY_MAJOR_VERSION < 3
35039             Py_XDECREF(owned_ref);
35040             #endif
35041             return (equals == Py_EQ) ? (result == 0) : (result != 0);
35042         }
35043     } else if ((s1 == Py_None) & s2_is_unicode) {
35044         goto return_ne;
35045     } else if ((s2 == Py_None) & s1_is_unicode) {
35046         goto return_ne;
35047     } else {
35048         int result;
35049         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
35050         #if PY_MAJOR_VERSION < 3
35051         Py_XDECREF(owned_ref);
35052         #endif
35053         if (!py_result)
35054             return -1;
35055         result = __Pyx_PyObject_IsTrue(py_result);
35056         Py_DECREF(py_result);
35057         return result;
35058     }
35059 return_eq:
35060     #if PY_MAJOR_VERSION < 3
35061     Py_XDECREF(owned_ref);
35062     #endif
35063     return (equals == Py_EQ);
35064 return_ne:
35065     #if PY_MAJOR_VERSION < 3
35066     Py_XDECREF(owned_ref);
35067     #endif
35068     return (equals == Py_NE);
35069 #endif
35070 }
35071 
35072 /* None */
35073   static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
35074     Py_ssize_t q = a / b;
35075     Py_ssize_t r = a - q*b;
35076     q -= ((r != 0) & ((r ^ b) < 0));
35077     return q;
35078 }
35079 
35080 /* GetAttr */
35081   static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
35082 #if CYTHON_USE_TYPE_SLOTS
35083 #if PY_MAJOR_VERSION >= 3
35084     if (likely(PyUnicode_Check(n)))
35085 #else
35086     if (likely(PyString_Check(n)))
35087 #endif
35088         return __Pyx_PyObject_GetAttrStr(o, n);
35089 #endif
35090     return PyObject_GetAttr(o, n);
35091 }
35092 
35093 /* ObjectGetItem */
35094   #if CYTHON_USE_TYPE_SLOTS
35095 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
35096     PyObject *runerr;
35097     Py_ssize_t key_value;
35098     PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
35099     if (unlikely(!(m && m->sq_item))) {
35100         PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
35101         return NULL;
35102     }
35103     key_value = __Pyx_PyIndex_AsSsize_t(index);
35104     if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
35105         return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
35106     }
35107     if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
35108         PyErr_Clear();
35109         PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
35110     }
35111     return NULL;
35112 }
35113 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
35114     PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
35115     if (likely(m && m->mp_subscript)) {
35116         return m->mp_subscript(obj, key);
35117     }
35118     return __Pyx_PyObject_GetIndex(obj, key);
35119 }
35120 #endif
35121 
35122 /* decode_c_string */
35123   static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
35124          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
35125          const char* encoding, const char* errors,
35126          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
35127     Py_ssize_t length;
35128     if (unlikely((start < 0) | (stop < 0))) {
35129         size_t slen = strlen(cstring);
35130         if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
35131             PyErr_SetString(PyExc_OverflowError,
35132                             "c-string too long to convert to Python");
35133             return NULL;
35134         }
35135         length = (Py_ssize_t) slen;
35136         if (start < 0) {
35137             start += length;
35138             if (start < 0)
35139                 start = 0;
35140         }
35141         if (stop < 0)
35142             stop += length;
35143     }
35144     length = stop - start;
35145     if (unlikely(length <= 0))
35146         return PyUnicode_FromUnicode(NULL, 0);
35147     cstring += start;
35148     if (decode_func) {
35149         return decode_func(cstring, length, errors);
35150     } else {
35151         return PyUnicode_Decode(cstring, length, encoding, errors);
35152     }
35153 }
35154 
35155 /* GetAttr3 */
35156   static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
35157     __Pyx_PyThreadState_declare
35158     __Pyx_PyThreadState_assign
35159     if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
35160         return NULL;
35161     __Pyx_PyErr_Clear();
35162     Py_INCREF(d);
35163     return d;
35164 }
35165 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
35166     PyObject *r = __Pyx_GetAttr(o, n);
35167     return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
35168 }
35169 
35170 /* SwapException */
35171   #if CYTHON_FAST_THREAD_STATE
35172 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
35173     PyObject *tmp_type, *tmp_value, *tmp_tb;
35174     #if CYTHON_USE_EXC_INFO_STACK
35175     _PyErr_StackItem *exc_info = tstate->exc_info;
35176     tmp_type = exc_info->exc_type;
35177     tmp_value = exc_info->exc_value;
35178     tmp_tb = exc_info->exc_traceback;
35179     exc_info->exc_type = *type;
35180     exc_info->exc_value = *value;
35181     exc_info->exc_traceback = *tb;
35182     #else
35183     tmp_type = tstate->exc_type;
35184     tmp_value = tstate->exc_value;
35185     tmp_tb = tstate->exc_traceback;
35186     tstate->exc_type = *type;
35187     tstate->exc_value = *value;
35188     tstate->exc_traceback = *tb;
35189     #endif
35190     *type = tmp_type;
35191     *value = tmp_value;
35192     *tb = tmp_tb;
35193 }
35194 #else
35195 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
35196     PyObject *tmp_type, *tmp_value, *tmp_tb;
35197     PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
35198     PyErr_SetExcInfo(*type, *value, *tb);
35199     *type = tmp_type;
35200     *value = tmp_value;
35201     *tb = tmp_tb;
35202 }
35203 #endif
35204 
35205 /* Import */
35206   static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
35207     PyObject *empty_list = 0;
35208     PyObject *module = 0;
35209     PyObject *global_dict = 0;
35210     PyObject *empty_dict = 0;
35211     PyObject *list;
35212     #if PY_MAJOR_VERSION < 3
35213     PyObject *py_import;
35214     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
35215     if (!py_import)
35216         goto bad;
35217     #endif
35218     if (from_list)
35219         list = from_list;
35220     else {
35221         empty_list = PyList_New(0);
35222         if (!empty_list)
35223             goto bad;
35224         list = empty_list;
35225     }
35226     global_dict = PyModule_GetDict(__pyx_m);
35227     if (!global_dict)
35228         goto bad;
35229     empty_dict = PyDict_New();
35230     if (!empty_dict)
35231         goto bad;
35232     {
35233         #if PY_MAJOR_VERSION >= 3
35234         if (level == -1) {
35235             if (strchr(__Pyx_MODULE_NAME, '.')) {
35236                 module = PyImport_ImportModuleLevelObject(
35237                     name, global_dict, empty_dict, list, 1);
35238                 if (!module) {
35239                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
35240                         goto bad;
35241                     PyErr_Clear();
35242                 }
35243             }
35244             level = 0;
35245         }
35246         #endif
35247         if (!module) {
35248             #if PY_MAJOR_VERSION < 3
35249             PyObject *py_level = PyInt_FromLong(level);
35250             if (!py_level)
35251                 goto bad;
35252             module = PyObject_CallFunctionObjArgs(py_import,
35253                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
35254             Py_DECREF(py_level);
35255             #else
35256             module = PyImport_ImportModuleLevelObject(
35257                 name, global_dict, empty_dict, list, level);
35258             #endif
35259         }
35260     }
35261 bad:
35262     #if PY_MAJOR_VERSION < 3
35263     Py_XDECREF(py_import);
35264     #endif
35265     Py_XDECREF(empty_list);
35266     Py_XDECREF(empty_dict);
35267     return module;
35268 }
35269 
35270 /* FastTypeChecks */
35271   #if CYTHON_COMPILING_IN_CPYTHON
35272 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
35273     while (a) {
35274         a = a->tp_base;
35275         if (a == b)
35276             return 1;
35277     }
35278     return b == &PyBaseObject_Type;
35279 }
35280 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
35281     PyObject *mro;
35282     if (a == b) return 1;
35283     mro = a->tp_mro;
35284     if (likely(mro)) {
35285         Py_ssize_t i, n;
35286         n = PyTuple_GET_SIZE(mro);
35287         for (i = 0; i < n; i++) {
35288             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
35289                 return 1;
35290         }
35291         return 0;
35292     }
35293     return __Pyx_InBases(a, b);
35294 }
35295 #if PY_MAJOR_VERSION == 2
35296 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
35297     PyObject *exception, *value, *tb;
35298     int res;
35299     __Pyx_PyThreadState_declare
35300     __Pyx_PyThreadState_assign
35301     __Pyx_ErrFetch(&exception, &value, &tb);
35302     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
35303     if (unlikely(res == -1)) {
35304         PyErr_WriteUnraisable(err);
35305         res = 0;
35306     }
35307     if (!res) {
35308         res = PyObject_IsSubclass(err, exc_type2);
35309         if (unlikely(res == -1)) {
35310             PyErr_WriteUnraisable(err);
35311             res = 0;
35312         }
35313     }
35314     __Pyx_ErrRestore(exception, value, tb);
35315     return res;
35316 }
35317 #else
35318 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
35319     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
35320     if (!res) {
35321         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
35322     }
35323     return res;
35324 }
35325 #endif
35326 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
35327     Py_ssize_t i, n;
35328     assert(PyExceptionClass_Check(exc_type));
35329     n = PyTuple_GET_SIZE(tuple);
35330 #if PY_MAJOR_VERSION >= 3
35331     for (i=0; i<n; i++) {
35332         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
35333     }
35334 #endif
35335     for (i=0; i<n; i++) {
35336         PyObject *t = PyTuple_GET_ITEM(tuple, i);
35337         #if PY_MAJOR_VERSION < 3
35338         if (likely(exc_type == t)) return 1;
35339         #endif
35340         if (likely(PyExceptionClass_Check(t))) {
35341             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
35342         } else {
35343         }
35344     }
35345     return 0;
35346 }
35347 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
35348     if (likely(err == exc_type)) return 1;
35349     if (likely(PyExceptionClass_Check(err))) {
35350         if (likely(PyExceptionClass_Check(exc_type))) {
35351             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
35352         } else if (likely(PyTuple_Check(exc_type))) {
35353             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
35354         } else {
35355         }
35356     }
35357     return PyErr_GivenExceptionMatches(err, exc_type);
35358 }
35359 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
35360     assert(PyExceptionClass_Check(exc_type1));
35361     assert(PyExceptionClass_Check(exc_type2));
35362     if (likely(err == exc_type1 || err == exc_type2)) return 1;
35363     if (likely(PyExceptionClass_Check(err))) {
35364         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
35365     }
35366     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
35367 }
35368 #endif
35369 
35370 /* None */
35371   static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
35372     long q = a / b;
35373     long r = a - q*b;
35374     q -= ((r != 0) & ((r ^ b) < 0));
35375     return q;
35376 }
35377 
35378 /* ImportFrom */
35379   static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
35380     PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
35381     if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
35382         PyErr_Format(PyExc_ImportError,
35383         #if PY_MAJOR_VERSION < 3
35384             "cannot import name %.230s", PyString_AS_STRING(name));
35385         #else
35386             "cannot import name %S", name);
35387         #endif
35388     }
35389     return value;
35390 }
35391 
35392 /* HasAttr */
35393   static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
35394     PyObject *r;
35395     if (unlikely(!__Pyx_PyBaseString_Check(n))) {
35396         PyErr_SetString(PyExc_TypeError,
35397                         "hasattr(): attribute name must be string");
35398         return -1;
35399     }
35400     r = __Pyx_GetAttr(o, n);
35401     if (unlikely(!r)) {
35402         PyErr_Clear();
35403         return 0;
35404     } else {
35405         Py_DECREF(r);
35406         return 1;
35407     }
35408 }
35409 
35410 /* StringJoin */
35411   #if !CYTHON_COMPILING_IN_CPYTHON
35412 static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
35413     return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
35414 }
35415 #endif
35416 
35417 /* PyObject_GenericGetAttrNoDict */
35418   #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
35419 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
35420     PyErr_Format(PyExc_AttributeError,
35421 #if PY_MAJOR_VERSION >= 3
35422                  "'%.50s' object has no attribute '%U'",
35423                  tp->tp_name, attr_name);
35424 #else
35425                  "'%.50s' object has no attribute '%.400s'",
35426                  tp->tp_name, PyString_AS_STRING(attr_name));
35427 #endif
35428     return NULL;
35429 }
35430 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
35431     PyObject *descr;
35432     PyTypeObject *tp = Py_TYPE(obj);
35433     if (unlikely(!PyString_Check(attr_name))) {
35434         return PyObject_GenericGetAttr(obj, attr_name);
35435     }
35436     assert(!tp->tp_dictoffset);
35437     descr = _PyType_Lookup(tp, attr_name);
35438     if (unlikely(!descr)) {
35439         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
35440     }
35441     Py_INCREF(descr);
35442     #if PY_MAJOR_VERSION < 3
35443     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
35444     #endif
35445     {
35446         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
35447         if (unlikely(f)) {
35448             PyObject *res = f(descr, obj, (PyObject *)tp);
35449             Py_DECREF(descr);
35450             return res;
35451         }
35452     }
35453     return descr;
35454 }
35455 #endif
35456 
35457 /* PyObject_GenericGetAttr */
35458   #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
35459 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
35460     if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
35461         return PyObject_GenericGetAttr(obj, attr_name);
35462     }
35463     return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
35464 }
35465 #endif
35466 
35467 /* SetVTable */
35468   static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
35469 #if PY_VERSION_HEX >= 0x02070000
35470     PyObject *ob = PyCapsule_New(vtable, 0, 0);
35471 #else
35472     PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
35473 #endif
35474     if (!ob)
35475         goto bad;
35476     if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
35477         goto bad;
35478     Py_DECREF(ob);
35479     return 0;
35480 bad:
35481     Py_XDECREF(ob);
35482     return -1;
35483 }
35484 
35485 /* SetupReduce */
35486   static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
35487   int ret;
35488   PyObject *name_attr;
35489   name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
35490   if (likely(name_attr)) {
35491       ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
35492   } else {
35493       ret = -1;
35494   }
35495   if (unlikely(ret < 0)) {
35496       PyErr_Clear();
35497       ret = 0;
35498   }
35499   Py_XDECREF(name_attr);
35500   return ret;
35501 }
35502 static int __Pyx_setup_reduce(PyObject* type_obj) {
35503     int ret = 0;
35504     PyObject *object_reduce = NULL;
35505     PyObject *object_reduce_ex = NULL;
35506     PyObject *reduce = NULL;
35507     PyObject *reduce_ex = NULL;
35508     PyObject *reduce_cython = NULL;
35509     PyObject *setstate = NULL;
35510     PyObject *setstate_cython = NULL;
35511 #if CYTHON_USE_PYTYPE_LOOKUP
35512     if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD;
35513 #else
35514     if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD;
35515 #endif
35516 #if CYTHON_USE_PYTYPE_LOOKUP
35517     object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
35518 #else
35519     object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
35520 #endif
35521     reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto BAD;
35522     if (reduce_ex == object_reduce_ex) {
35523 #if CYTHON_USE_PYTYPE_LOOKUP
35524         object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
35525 #else
35526         object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
35527 #endif
35528         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto BAD;
35529         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
35530             reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD;
35531             ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD;
35532             ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD;
35533             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
35534             if (!setstate) PyErr_Clear();
35535             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
35536                 setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD;
35537                 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD;
35538                 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD;
35539             }
35540             PyType_Modified((PyTypeObject*)type_obj);
35541         }
35542     }
35543     goto GOOD;
35544 BAD:
35545     if (!PyErr_Occurred())
35546         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
35547     ret = -1;
35548 GOOD:
35549 #if !CYTHON_USE_PYTYPE_LOOKUP
35550     Py_XDECREF(object_reduce);
35551     Py_XDECREF(object_reduce_ex);
35552 #endif
35553     Py_XDECREF(reduce);
35554     Py_XDECREF(reduce_ex);
35555     Py_XDECREF(reduce_cython);
35556     Py_XDECREF(setstate);
35557     Py_XDECREF(setstate_cython);
35558     return ret;
35559 }
35560 
35561 /* TypeImport */
35562   #ifndef __PYX_HAVE_RT_ImportType
35563 #define __PYX_HAVE_RT_ImportType
35564 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
35565     size_t size, enum __Pyx_ImportType_CheckSize check_size)
35566 {
35567     PyObject *result = 0;
35568     char warning[200];
35569     Py_ssize_t basicsize;
35570 #ifdef Py_LIMITED_API
35571     PyObject *py_basicsize;
35572 #endif
35573     result = PyObject_GetAttrString(module, class_name);
35574     if (!result)
35575         goto bad;
35576     if (!PyType_Check(result)) {
35577         PyErr_Format(PyExc_TypeError,
35578             "%.200s.%.200s is not a type object",
35579             module_name, class_name);
35580         goto bad;
35581     }
35582 #ifndef Py_LIMITED_API
35583     basicsize = ((PyTypeObject *)result)->tp_basicsize;
35584 #else
35585     py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
35586     if (!py_basicsize)
35587         goto bad;
35588     basicsize = PyLong_AsSsize_t(py_basicsize);
35589     Py_DECREF(py_basicsize);
35590     py_basicsize = 0;
35591     if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
35592         goto bad;
35593 #endif
35594     if ((size_t)basicsize < size) {
35595         PyErr_Format(PyExc_ValueError,
35596             "%.200s.%.200s size changed, may indicate binary incompatibility. "
35597             "Expected %zd from C header, got %zd from PyObject",
35598             module_name, class_name, size, basicsize);
35599         goto bad;
35600     }
35601     if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
35602         PyErr_Format(PyExc_ValueError,
35603             "%.200s.%.200s size changed, may indicate binary incompatibility. "
35604             "Expected %zd from C header, got %zd from PyObject",
35605             module_name, class_name, size, basicsize);
35606         goto bad;
35607     }
35608     else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
35609         PyOS_snprintf(warning, sizeof(warning),
35610             "%s.%s size changed, may indicate binary incompatibility. "
35611             "Expected %zd from C header, got %zd from PyObject",
35612             module_name, class_name, size, basicsize);
35613         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
35614     }
35615     return (PyTypeObject *)result;
35616 bad:
35617     Py_XDECREF(result);
35618     return NULL;
35619 }
35620 #endif
35621 
35622 /* CLineInTraceback */
35623   #ifndef CYTHON_CLINE_IN_TRACEBACK
35624 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
35625     PyObject *use_cline;
35626     PyObject *ptype, *pvalue, *ptraceback;
35627 #if CYTHON_COMPILING_IN_CPYTHON
35628     PyObject **cython_runtime_dict;
35629 #endif
35630     if (unlikely(!__pyx_cython_runtime)) {
35631         return c_line;
35632     }
35633     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
35634 #if CYTHON_COMPILING_IN_CPYTHON
35635     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
35636     if (likely(cython_runtime_dict)) {
35637         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
35638             use_cline, *cython_runtime_dict,
35639             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
35640     } else
35641 #endif
35642     {
35643       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
35644       if (use_cline_obj) {
35645         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
35646         Py_DECREF(use_cline_obj);
35647       } else {
35648         PyErr_Clear();
35649         use_cline = NULL;
35650       }
35651     }
35652     if (!use_cline) {
35653         c_line = 0;
35654         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
35655     }
35656     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
35657         c_line = 0;
35658     }
35659     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
35660     return c_line;
35661 }
35662 #endif
35663 
35664 /* CodeObjectCache */
35665   static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
35666     int start = 0, mid = 0, end = count - 1;
35667     if (end >= 0 && code_line > entries[end].code_line) {
35668         return count;
35669     }
35670     while (start < end) {
35671         mid = start + (end - start) / 2;
35672         if (code_line < entries[mid].code_line) {
35673             end = mid;
35674         } else if (code_line > entries[mid].code_line) {
35675              start = mid + 1;
35676         } else {
35677             return mid;
35678         }
35679     }
35680     if (code_line <= entries[mid].code_line) {
35681         return mid;
35682     } else {
35683         return mid + 1;
35684     }
35685 }
35686 static PyCodeObject *__pyx_find_code_object(int code_line) {
35687     PyCodeObject* code_object;
35688     int pos;
35689     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
35690         return NULL;
35691     }
35692     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
35693     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
35694         return NULL;
35695     }
35696     code_object = __pyx_code_cache.entries[pos].code_object;
35697     Py_INCREF(code_object);
35698     return code_object;
35699 }
35700 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
35701     int pos, i;
35702     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
35703     if (unlikely(!code_line)) {
35704         return;
35705     }
35706     if (unlikely(!entries)) {
35707         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
35708         if (likely(entries)) {
35709             __pyx_code_cache.entries = entries;
35710             __pyx_code_cache.max_count = 64;
35711             __pyx_code_cache.count = 1;
35712             entries[0].code_line = code_line;
35713             entries[0].code_object = code_object;
35714             Py_INCREF(code_object);
35715         }
35716         return;
35717     }
35718     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
35719     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
35720         PyCodeObject* tmp = entries[pos].code_object;
35721         entries[pos].code_object = code_object;
35722         Py_DECREF(tmp);
35723         return;
35724     }
35725     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
35726         int new_max = __pyx_code_cache.max_count + 64;
35727         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
35728             __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
35729         if (unlikely(!entries)) {
35730             return;
35731         }
35732         __pyx_code_cache.entries = entries;
35733         __pyx_code_cache.max_count = new_max;
35734     }
35735     for (i=__pyx_code_cache.count; i>pos; i--) {
35736         entries[i] = entries[i-1];
35737     }
35738     entries[pos].code_line = code_line;
35739     entries[pos].code_object = code_object;
35740     __pyx_code_cache.count++;
35741     Py_INCREF(code_object);
35742 }
35743 
35744 /* AddTraceback */
35745   #include "compile.h"
35746 #include "frameobject.h"
35747 #include "traceback.h"
35748 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
35749             const char *funcname, int c_line,
35750             int py_line, const char *filename) {
35751     PyCodeObject *py_code = 0;
35752     PyObject *py_srcfile = 0;
35753     PyObject *py_funcname = 0;
35754     #if PY_MAJOR_VERSION < 3
35755     py_srcfile = PyString_FromString(filename);
35756     #else
35757     py_srcfile = PyUnicode_FromString(filename);
35758     #endif
35759     if (!py_srcfile) goto bad;
35760     if (c_line) {
35761         #if PY_MAJOR_VERSION < 3
35762         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
35763         #else
35764         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
35765         #endif
35766     }
35767     else {
35768         #if PY_MAJOR_VERSION < 3
35769         py_funcname = PyString_FromString(funcname);
35770         #else
35771         py_funcname = PyUnicode_FromString(funcname);
35772         #endif
35773     }
35774     if (!py_funcname) goto bad;
35775     py_code = __Pyx_PyCode_New(
35776         0,
35777         0,
35778         0,
35779         0,
35780         0,
35781         __pyx_empty_bytes, /*PyObject *code,*/
35782         __pyx_empty_tuple, /*PyObject *consts,*/
35783         __pyx_empty_tuple, /*PyObject *names,*/
35784         __pyx_empty_tuple, /*PyObject *varnames,*/
35785         __pyx_empty_tuple, /*PyObject *freevars,*/
35786         __pyx_empty_tuple, /*PyObject *cellvars,*/
35787         py_srcfile,   /*PyObject *filename,*/
35788         py_funcname,  /*PyObject *name,*/
35789         py_line,
35790         __pyx_empty_bytes  /*PyObject *lnotab*/
35791     );
35792     Py_DECREF(py_srcfile);
35793     Py_DECREF(py_funcname);
35794     return py_code;
35795 bad:
35796     Py_XDECREF(py_srcfile);
35797     Py_XDECREF(py_funcname);
35798     return NULL;
35799 }
35800 static void __Pyx_AddTraceback(const char *funcname, int c_line,
35801                                int py_line, const char *filename) {
35802     PyCodeObject *py_code = 0;
35803     PyFrameObject *py_frame = 0;
35804     PyThreadState *tstate = __Pyx_PyThreadState_Current;
35805     if (c_line) {
35806         c_line = __Pyx_CLineForTraceback(tstate, c_line);
35807     }
35808     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
35809     if (!py_code) {
35810         py_code = __Pyx_CreateCodeObjectForTraceback(
35811             funcname, c_line, py_line, filename);
35812         if (!py_code) goto bad;
35813         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
35814     }
35815     py_frame = PyFrame_New(
35816         tstate,            /*PyThreadState *tstate,*/
35817         py_code,           /*PyCodeObject *code,*/
35818         __pyx_d,    /*PyObject *globals,*/
35819         0                  /*PyObject *locals*/
35820     );
35821     if (!py_frame) goto bad;
35822     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
35823     PyTraceBack_Here(py_frame);
35824 bad:
35825     Py_XDECREF(py_code);
35826     Py_XDECREF(py_frame);
35827 }
35828 
35829 #if PY_MAJOR_VERSION < 3
35830 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
35831     if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
35832         if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
35833         if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
35834         if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
35835     PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
35836     return -1;
35837 }
35838 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
35839     PyObject *obj = view->obj;
35840     if (!obj) return;
35841     if (PyObject_CheckBuffer(obj)) {
35842         PyBuffer_Release(view);
35843         return;
35844     }
35845     if ((0)) {}
35846         else if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view);
35847     view->obj = NULL;
35848     Py_DECREF(obj);
35849 }
35850 #endif
35851 
35852 
35853   /* MemviewSliceIsContig */
35854   static int
35855 __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
35856 {
35857     int i, index, step, start;
35858     Py_ssize_t itemsize = mvs.memview->view.itemsize;
35859     if (order == 'F') {
35860         step = 1;
35861         start = 0;
35862     } else {
35863         step = -1;
35864         start = ndim - 1;
35865     }
35866     for (i = 0; i < ndim; i++) {
35867         index = start + step * i;
35868         if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
35869             return 0;
35870         itemsize *= mvs.shape[index];
35871     }
35872     return 1;
35873 }
35874 
35875 /* OverlappingSlices */
35876   static void
35877 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
35878                                void **out_start, void **out_end,
35879                                int ndim, size_t itemsize)
35880 {
35881     char *start, *end;
35882     int i;
35883     start = end = slice->data;
35884     for (i = 0; i < ndim; i++) {
35885         Py_ssize_t stride = slice->strides[i];
35886         Py_ssize_t extent = slice->shape[i];
35887         if (extent == 0) {
35888             *out_start = *out_end = start;
35889             return;
35890         } else {
35891             if (stride > 0)
35892                 end += stride * (extent - 1);
35893             else
35894                 start += stride * (extent - 1);
35895         }
35896     }
35897     *out_start = start;
35898     *out_end = end + itemsize;
35899 }
35900 static int
35901 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
35902                      __Pyx_memviewslice *slice2,
35903                      int ndim, size_t itemsize)
35904 {
35905     void *start1, *end1, *start2, *end2;
35906     __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
35907     __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
35908     return (start1 < end2) && (start2 < end1);
35909 }
35910 
35911 /* Capsule */
35912   static CYTHON_INLINE PyObject *
35913 __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
35914 {
35915     PyObject *cobj;
35916 #if PY_VERSION_HEX >= 0x02070000
35917     cobj = PyCapsule_New(p, sig, NULL);
35918 #else
35919     cobj = PyCObject_FromVoidPtr(p, NULL);
35920 #endif
35921     return cobj;
35922 }
35923 
35924 /* TypeInfoCompare */
35925   static int
35926 __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
35927 {
35928     int i;
35929     if (!a || !b)
35930         return 0;
35931     if (a == b)
35932         return 1;
35933     if (a->size != b->size || a->typegroup != b->typegroup ||
35934             a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
35935         if (a->typegroup == 'H' || b->typegroup == 'H') {
35936             return a->size == b->size;
35937         } else {
35938             return 0;
35939         }
35940     }
35941     if (a->ndim) {
35942         for (i = 0; i < a->ndim; i++)
35943             if (a->arraysize[i] != b->arraysize[i])
35944                 return 0;
35945     }
35946     if (a->typegroup == 'S') {
35947         if (a->flags != b->flags)
35948             return 0;
35949         if (a->fields || b->fields) {
35950             if (!(a->fields && b->fields))
35951                 return 0;
35952             for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
35953                 __Pyx_StructField *field_a = a->fields + i;
35954                 __Pyx_StructField *field_b = b->fields + i;
35955                 if (field_a->offset != field_b->offset ||
35956                     !__pyx_typeinfo_cmp(field_a->type, field_b->type))
35957                     return 0;
35958             }
35959             return !a->fields[i].type && !b->fields[i].type;
35960         }
35961     }
35962     return 1;
35963 }
35964 
35965 /* MemviewSliceValidateAndInit */
35966   static int
35967 __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
35968 {
35969     if (buf->shape[dim] <= 1)
35970         return 1;
35971     if (buf->strides) {
35972         if (spec & __Pyx_MEMVIEW_CONTIG) {
35973             if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
35974                 if (buf->strides[dim] != sizeof(void *)) {
35975                     PyErr_Format(PyExc_ValueError,
35976                                  "Buffer is not indirectly contiguous "
35977                                  "in dimension %d.", dim);
35978                     goto fail;
35979                 }
35980             } else if (buf->strides[dim] != buf->itemsize) {
35981                 PyErr_SetString(PyExc_ValueError,
35982                                 "Buffer and memoryview are not contiguous "
35983                                 "in the same dimension.");
35984                 goto fail;
35985             }
35986         }
35987         if (spec & __Pyx_MEMVIEW_FOLLOW) {
35988             Py_ssize_t stride = buf->strides[dim];
35989             if (stride < 0)
35990                 stride = -stride;
35991             if (stride < buf->itemsize) {
35992                 PyErr_SetString(PyExc_ValueError,
35993                                 "Buffer and memoryview are not contiguous "
35994                                 "in the same dimension.");
35995                 goto fail;
35996             }
35997         }
35998     } else {
35999         if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) {
36000             PyErr_Format(PyExc_ValueError,
36001                          "C-contiguous buffer is not contiguous in "
36002                          "dimension %d", dim);
36003             goto fail;
36004         } else if (spec & (__Pyx_MEMVIEW_PTR)) {
36005             PyErr_Format(PyExc_ValueError,
36006                          "C-contiguous buffer is not indirect in "
36007                          "dimension %d", dim);
36008             goto fail;
36009         } else if (buf->suboffsets) {
36010             PyErr_SetString(PyExc_ValueError,
36011                             "Buffer exposes suboffsets but no strides");
36012             goto fail;
36013         }
36014     }
36015     return 1;
36016 fail:
36017     return 0;
36018 }
36019 static int
36020 __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
36021 {
36022     if (spec & __Pyx_MEMVIEW_DIRECT) {
36023         if (buf->suboffsets && buf->suboffsets[dim] >= 0) {
36024             PyErr_Format(PyExc_ValueError,
36025                          "Buffer not compatible with direct access "
36026                          "in dimension %d.", dim);
36027             goto fail;
36028         }
36029     }
36030     if (spec & __Pyx_MEMVIEW_PTR) {
36031         if (!buf->suboffsets || (buf->suboffsets[dim] < 0)) {
36032             PyErr_Format(PyExc_ValueError,
36033                          "Buffer is not indirectly accessible "
36034                          "in dimension %d.", dim);
36035             goto fail;
36036         }
36037     }
36038     return 1;
36039 fail:
36040     return 0;
36041 }
36042 static int
36043 __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
36044 {
36045     int i;
36046     if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
36047         Py_ssize_t stride = 1;
36048         for (i = 0; i < ndim; i++) {
36049             if (stride * buf->itemsize != buf->strides[i] &&
36050                     buf->shape[i] > 1)
36051             {
36052                 PyErr_SetString(PyExc_ValueError,
36053                     "Buffer not fortran contiguous.");
36054                 goto fail;
36055             }
36056             stride = stride * buf->shape[i];
36057         }
36058     } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
36059         Py_ssize_t stride = 1;
36060         for (i = ndim - 1; i >- 1; i--) {
36061             if (stride * buf->itemsize != buf->strides[i] &&
36062                     buf->shape[i] > 1) {
36063                 PyErr_SetString(PyExc_ValueError,
36064                     "Buffer not C contiguous.");
36065                 goto fail;
36066             }
36067             stride = stride * buf->shape[i];
36068         }
36069     }
36070     return 1;
36071 fail:
36072     return 0;
36073 }
36074 static int __Pyx_ValidateAndInit_memviewslice(
36075                 int *axes_specs,
36076                 int c_or_f_flag,
36077                 int buf_flags,
36078                 int ndim,
36079                 __Pyx_TypeInfo *dtype,
36080                 __Pyx_BufFmt_StackElem stack[],
36081                 __Pyx_memviewslice *memviewslice,
36082                 PyObject *original_obj)
36083 {
36084     struct __pyx_memoryview_obj *memview, *new_memview;
36085     __Pyx_RefNannyDeclarations
36086     Py_buffer *buf;
36087     int i, spec = 0, retval = -1;
36088     __Pyx_BufFmt_Context ctx;
36089     int from_memoryview = __pyx_memoryview_check(original_obj);
36090     __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
36091     if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
36092                                                             original_obj)->typeinfo)) {
36093         memview = (struct __pyx_memoryview_obj *) original_obj;
36094         new_memview = NULL;
36095     } else {
36096         memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
36097                                             original_obj, buf_flags, 0, dtype);
36098         new_memview = memview;
36099         if (unlikely(!memview))
36100             goto fail;
36101     }
36102     buf = &memview->view;
36103     if (buf->ndim != ndim) {
36104         PyErr_Format(PyExc_ValueError,
36105                 "Buffer has wrong number of dimensions (expected %d, got %d)",
36106                 ndim, buf->ndim);
36107         goto fail;
36108     }
36109     if (new_memview) {
36110         __Pyx_BufFmt_Init(&ctx, stack, dtype);
36111         if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
36112     }
36113     if ((unsigned) buf->itemsize != dtype->size) {
36114         PyErr_Format(PyExc_ValueError,
36115                      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
36116                      "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
36117                      buf->itemsize,
36118                      (buf->itemsize > 1) ? "s" : "",
36119                      dtype->name,
36120                      dtype->size,
36121                      (dtype->size > 1) ? "s" : "");
36122         goto fail;
36123     }
36124     for (i = 0; i < ndim; i++) {
36125         spec = axes_specs[i];
36126         if (!__pyx_check_strides(buf, i, ndim, spec))
36127             goto fail;
36128         if (!__pyx_check_suboffsets(buf, i, ndim, spec))
36129             goto fail;
36130     }
36131     if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))
36132         goto fail;
36133     if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
36134                                          new_memview != NULL) == -1)) {
36135         goto fail;
36136     }
36137     retval = 0;
36138     goto no_fail;
36139 fail:
36140     Py_XDECREF(new_memview);
36141     retval = -1;
36142 no_fail:
36143     __Pyx_RefNannyFinishContext();
36144     return retval;
36145 }
36146 
36147 /* ObjectToMemviewSlice */
36148   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(PyObject *obj, int writable_flag) {
36149     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
36150     __Pyx_BufFmt_StackElem stack[1];
36151     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
36152     int retcode;
36153     if (obj == Py_None) {
36154         result.memview = (struct __pyx_memoryview_obj *) Py_None;
36155         return result;
36156     }
36157     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
36158                                                  PyBUF_RECORDS_RO | writable_flag, 1,
36159                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, stack,
36160                                                  &result, obj);
36161     if (unlikely(retcode == -1))
36162         goto __pyx_fail;
36163     return result;
36164 __pyx_fail:
36165     result.memview = NULL;
36166     result.data = NULL;
36167     return result;
36168 }
36169 
36170 /* CIntFromPyVerify */
36171   #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
36172     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
36173 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
36174     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
36175 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
36176     {\
36177         func_type value = func_value;\
36178         if (sizeof(target_type) < sizeof(func_type)) {\
36179             if (unlikely(value != (func_type) (target_type) value)) {\
36180                 func_type zero = 0;\
36181                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
36182                     return (target_type) -1;\
36183                 if (is_unsigned && unlikely(value < zero))\
36184                     goto raise_neg_overflow;\
36185                 else\
36186                     goto raise_overflow;\
36187             }\
36188         }\
36189         return (target_type) value;\
36190     }
36191 
36192 /* ObjectToMemviewSlice */
36193   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float64_t(PyObject *obj, int writable_flag) {
36194     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
36195     __Pyx_BufFmt_StackElem stack[1];
36196     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
36197     int retcode;
36198     if (obj == Py_None) {
36199         result.memview = (struct __pyx_memoryview_obj *) Py_None;
36200         return result;
36201     }
36202     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
36203                                                  PyBUF_RECORDS_RO | writable_flag, 2,
36204                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, stack,
36205                                                  &result, obj);
36206     if (unlikely(retcode == -1))
36207         goto __pyx_fail;
36208     return result;
36209 __pyx_fail:
36210     result.memview = NULL;
36211     result.data = NULL;
36212     return result;
36213 }
36214 
36215 /* ObjectToMemviewSlice */
36216   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int64_t(PyObject *obj, int writable_flag) {
36217     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
36218     __Pyx_BufFmt_StackElem stack[1];
36219     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
36220     int retcode;
36221     if (obj == Py_None) {
36222         result.memview = (struct __pyx_memoryview_obj *) Py_None;
36223         return result;
36224     }
36225     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
36226                                                  PyBUF_RECORDS_RO | writable_flag, 1,
36227                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, stack,
36228                                                  &result, obj);
36229     if (unlikely(retcode == -1))
36230         goto __pyx_fail;
36231     return result;
36232 __pyx_fail:
36233     result.memview = NULL;
36234     result.data = NULL;
36235     return result;
36236 }
36237 
36238 /* CIntToPy */
36239   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int64(npy_int64 value) {
36240     const npy_int64 neg_one = (npy_int64) ((npy_int64) 0 - (npy_int64) 1), const_zero = (npy_int64) 0;
36241     const int is_unsigned = neg_one > const_zero;
36242     if (is_unsigned) {
36243         if (sizeof(npy_int64) < sizeof(long)) {
36244             return PyInt_FromLong((long) value);
36245         } else if (sizeof(npy_int64) <= sizeof(unsigned long)) {
36246             return PyLong_FromUnsignedLong((unsigned long) value);
36247 #ifdef HAVE_LONG_LONG
36248         } else if (sizeof(npy_int64) <= sizeof(unsigned PY_LONG_LONG)) {
36249             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
36250 #endif
36251         }
36252     } else {
36253         if (sizeof(npy_int64) <= sizeof(long)) {
36254             return PyInt_FromLong((long) value);
36255 #ifdef HAVE_LONG_LONG
36256         } else if (sizeof(npy_int64) <= sizeof(PY_LONG_LONG)) {
36257             return PyLong_FromLongLong((PY_LONG_LONG) value);
36258 #endif
36259         }
36260     }
36261     {
36262         int one = 1; int little = (int)*(unsigned char *)&one;
36263         unsigned char *bytes = (unsigned char *)&value;
36264         return _PyLong_FromByteArray(bytes, sizeof(npy_int64),
36265                                      little, !is_unsigned);
36266     }
36267 }
36268 
36269 /* Print */
36270   #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
36271 static PyObject *__Pyx_GetStdout(void) {
36272     PyObject *f = PySys_GetObject((char *)"stdout");
36273     if (!f) {
36274         PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
36275     }
36276     return f;
36277 }
36278 static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
36279     int i;
36280     if (!f) {
36281         if (!(f = __Pyx_GetStdout()))
36282             return -1;
36283     }
36284     Py_INCREF(f);
36285     for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
36286         PyObject* v;
36287         if (PyFile_SoftSpace(f, 1)) {
36288             if (PyFile_WriteString(" ", f) < 0)
36289                 goto error;
36290         }
36291         v = PyTuple_GET_ITEM(arg_tuple, i);
36292         if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
36293             goto error;
36294         if (PyString_Check(v)) {
36295             char *s = PyString_AsString(v);
36296             Py_ssize_t len = PyString_Size(v);
36297             if (len > 0) {
36298                 switch (s[len-1]) {
36299                     case ' ': break;
36300                     case '\f': case '\r': case '\n': case '\t': case '\v':
36301                         PyFile_SoftSpace(f, 0);
36302                         break;
36303                     default:  break;
36304                 }
36305             }
36306         }
36307     }
36308     if (newline) {
36309         if (PyFile_WriteString("\n", f) < 0)
36310             goto error;
36311         PyFile_SoftSpace(f, 0);
36312     }
36313     Py_DECREF(f);
36314     return 0;
36315 error:
36316     Py_DECREF(f);
36317     return -1;
36318 }
36319 #else
36320 static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
36321     PyObject* kwargs = 0;
36322     PyObject* result = 0;
36323     PyObject* end_string;
36324     if (unlikely(!__pyx_print)) {
36325         __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print);
36326         if (!__pyx_print)
36327             return -1;
36328     }
36329     if (stream) {
36330         kwargs = PyDict_New();
36331         if (unlikely(!kwargs))
36332             return -1;
36333         if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0))
36334             goto bad;
36335         if (!newline) {
36336             end_string = PyUnicode_FromStringAndSize(" ", 1);
36337             if (unlikely(!end_string))
36338                 goto bad;
36339             if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) {
36340                 Py_DECREF(end_string);
36341                 goto bad;
36342             }
36343             Py_DECREF(end_string);
36344         }
36345     } else if (!newline) {
36346         if (unlikely(!__pyx_print_kwargs)) {
36347             __pyx_print_kwargs = PyDict_New();
36348             if (unlikely(!__pyx_print_kwargs))
36349                 return -1;
36350             end_string = PyUnicode_FromStringAndSize(" ", 1);
36351             if (unlikely(!end_string))
36352                 return -1;
36353             if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) {
36354                 Py_DECREF(end_string);
36355                 return -1;
36356             }
36357             Py_DECREF(end_string);
36358         }
36359         kwargs = __pyx_print_kwargs;
36360     }
36361     result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
36362     if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
36363         Py_DECREF(kwargs);
36364     if (!result)
36365         return -1;
36366     Py_DECREF(result);
36367     return 0;
36368 bad:
36369     if (kwargs != __pyx_print_kwargs)
36370         Py_XDECREF(kwargs);
36371     return -1;
36372 }
36373 #endif
36374 
36375 /* CIntToPy */
36376   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
36377     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
36378     const int is_unsigned = neg_one > const_zero;
36379     if (is_unsigned) {
36380         if (sizeof(int) < sizeof(long)) {
36381             return PyInt_FromLong((long) value);
36382         } else if (sizeof(int) <= sizeof(unsigned long)) {
36383             return PyLong_FromUnsignedLong((unsigned long) value);
36384 #ifdef HAVE_LONG_LONG
36385         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
36386             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
36387 #endif
36388         }
36389     } else {
36390         if (sizeof(int) <= sizeof(long)) {
36391             return PyInt_FromLong((long) value);
36392 #ifdef HAVE_LONG_LONG
36393         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
36394             return PyLong_FromLongLong((PY_LONG_LONG) value);
36395 #endif
36396         }
36397     }
36398     {
36399         int one = 1; int little = (int)*(unsigned char *)&one;
36400         unsigned char *bytes = (unsigned char *)&value;
36401         return _PyLong_FromByteArray(bytes, sizeof(int),
36402                                      little, !is_unsigned);
36403     }
36404 }
36405 
36406 /* CIntToPy */
36407   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
36408     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
36409     const int is_unsigned = neg_one > const_zero;
36410     if (is_unsigned) {
36411         if (sizeof(long) < sizeof(long)) {
36412             return PyInt_FromLong((long) value);
36413         } else if (sizeof(long) <= sizeof(unsigned long)) {
36414             return PyLong_FromUnsignedLong((unsigned long) value);
36415 #ifdef HAVE_LONG_LONG
36416         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
36417             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
36418 #endif
36419         }
36420     } else {
36421         if (sizeof(long) <= sizeof(long)) {
36422             return PyInt_FromLong((long) value);
36423 #ifdef HAVE_LONG_LONG
36424         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
36425             return PyLong_FromLongLong((PY_LONG_LONG) value);
36426 #endif
36427         }
36428     }
36429     {
36430         int one = 1; int little = (int)*(unsigned char *)&one;
36431         unsigned char *bytes = (unsigned char *)&value;
36432         return _PyLong_FromByteArray(bytes, sizeof(long),
36433                                      little, !is_unsigned);
36434     }
36435 }
36436 
36437 /* MemviewDtypeToObject */
36438   static CYTHON_INLINE PyObject *__pyx_memview_get_nn___pyx_t_5numpy_float64_t(const char *itemp) {
36439     return (PyObject *) PyFloat_FromDouble(*(__pyx_t_5numpy_float64_t *) itemp);
36440 }
36441 static CYTHON_INLINE int __pyx_memview_set_nn___pyx_t_5numpy_float64_t(const char *itemp, PyObject *obj) {
36442     __pyx_t_5numpy_float64_t value = __pyx_PyFloat_AsDouble(obj);
36443     if ((value == ((npy_float64)-1)) && PyErr_Occurred())
36444         return 0;
36445     *(__pyx_t_5numpy_float64_t *) itemp = value;
36446     return 1;
36447 }
36448 
36449 /* MemviewDtypeToObject */
36450   static CYTHON_INLINE PyObject *__pyx_memview_get_nn___pyx_t_5numpy_int64_t(const char *itemp) {
36451     return (PyObject *) __Pyx_PyInt_From_npy_int64(*(__pyx_t_5numpy_int64_t *) itemp);
36452 }
36453 static CYTHON_INLINE int __pyx_memview_set_nn___pyx_t_5numpy_int64_t(const char *itemp, PyObject *obj) {
36454     __pyx_t_5numpy_int64_t value = __Pyx_PyInt_As_npy_int64(obj);
36455     if ((value == ((npy_int64)-1)) && PyErr_Occurred())
36456         return 0;
36457     *(__pyx_t_5numpy_int64_t *) itemp = value;
36458     return 1;
36459 }
36460 
36461 /* CIntToPy */
36462   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ptrdiff_t(ptrdiff_t value) {
36463     const ptrdiff_t neg_one = (ptrdiff_t) ((ptrdiff_t) 0 - (ptrdiff_t) 1), const_zero = (ptrdiff_t) 0;
36464     const int is_unsigned = neg_one > const_zero;
36465     if (is_unsigned) {
36466         if (sizeof(ptrdiff_t) < sizeof(long)) {
36467             return PyInt_FromLong((long) value);
36468         } else if (sizeof(ptrdiff_t) <= sizeof(unsigned long)) {
36469             return PyLong_FromUnsignedLong((unsigned long) value);
36470 #ifdef HAVE_LONG_LONG
36471         } else if (sizeof(ptrdiff_t) <= sizeof(unsigned PY_LONG_LONG)) {
36472             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
36473 #endif
36474         }
36475     } else {
36476         if (sizeof(ptrdiff_t) <= sizeof(long)) {
36477             return PyInt_FromLong((long) value);
36478 #ifdef HAVE_LONG_LONG
36479         } else if (sizeof(ptrdiff_t) <= sizeof(PY_LONG_LONG)) {
36480             return PyLong_FromLongLong((PY_LONG_LONG) value);
36481 #endif
36482         }
36483     }
36484     {
36485         int one = 1; int little = (int)*(unsigned char *)&one;
36486         unsigned char *bytes = (unsigned char *)&value;
36487         return _PyLong_FromByteArray(bytes, sizeof(ptrdiff_t),
36488                                      little, !is_unsigned);
36489     }
36490 }
36491 
36492 /* Declarations */
36493   #if CYTHON_CCOMPLEX
36494   #ifdef __cplusplus
36495     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
36496       return ::std::complex< float >(x, y);
36497     }
36498   #else
36499     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
36500       return x + y*(__pyx_t_float_complex)_Complex_I;
36501     }
36502   #endif
36503 #else
36504     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
36505       __pyx_t_float_complex z;
36506       z.real = x;
36507       z.imag = y;
36508       return z;
36509     }
36510 #endif
36511 
36512 /* Arithmetic */
36513   #if CYTHON_CCOMPLEX
36514 #else
36515     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
36516        return (a.real == b.real) && (a.imag == b.imag);
36517     }
36518     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
36519         __pyx_t_float_complex z;
36520         z.real = a.real + b.real;
36521         z.imag = a.imag + b.imag;
36522         return z;
36523     }
36524     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
36525         __pyx_t_float_complex z;
36526         z.real = a.real - b.real;
36527         z.imag = a.imag - b.imag;
36528         return z;
36529     }
36530     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
36531         __pyx_t_float_complex z;
36532         z.real = a.real * b.real - a.imag * b.imag;
36533         z.imag = a.real * b.imag + a.imag * b.real;
36534         return z;
36535     }
36536     #if 1
36537     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
36538         if (b.imag == 0) {
36539             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
36540         } else if (fabsf(b.real) >= fabsf(b.imag)) {
36541             if (b.real == 0 && b.imag == 0) {
36542                 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
36543             } else {
36544                 float r = b.imag / b.real;
36545                 float s = (float)(1.0) / (b.real + b.imag * r);
36546                 return __pyx_t_float_complex_from_parts(
36547                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
36548             }
36549         } else {
36550             float r = b.real / b.imag;
36551             float s = (float)(1.0) / (b.imag + b.real * r);
36552             return __pyx_t_float_complex_from_parts(
36553                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
36554         }
36555     }
36556     #else
36557     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
36558         if (b.imag == 0) {
36559             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
36560         } else {
36561             float denom = b.real * b.real + b.imag * b.imag;
36562             return __pyx_t_float_complex_from_parts(
36563                 (a.real * b.real + a.imag * b.imag) / denom,
36564                 (a.imag * b.real - a.real * b.imag) / denom);
36565         }
36566     }
36567     #endif
36568     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
36569         __pyx_t_float_complex z;
36570         z.real = -a.real;
36571         z.imag = -a.imag;
36572         return z;
36573     }
36574     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
36575        return (a.real == 0) && (a.imag == 0);
36576     }
36577     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
36578         __pyx_t_float_complex z;
36579         z.real =  a.real;
36580         z.imag = -a.imag;
36581         return z;
36582     }
36583     #if 1
36584         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
36585           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
36586             return sqrtf(z.real*z.real + z.imag*z.imag);
36587           #else
36588             return hypotf(z.real, z.imag);
36589           #endif
36590         }
36591         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
36592             __pyx_t_float_complex z;
36593             float r, lnr, theta, z_r, z_theta;
36594             if (b.imag == 0 && b.real == (int)b.real) {
36595                 if (b.real < 0) {
36596                     float denom = a.real * a.real + a.imag * a.imag;
36597                     a.real = a.real / denom;
36598                     a.imag = -a.imag / denom;
36599                     b.real = -b.real;
36600                 }
36601                 switch ((int)b.real) {
36602                     case 0:
36603                         z.real = 1;
36604                         z.imag = 0;
36605                         return z;
36606                     case 1:
36607                         return a;
36608                     case 2:
36609                         z = __Pyx_c_prod_float(a, a);
36610                         return __Pyx_c_prod_float(a, a);
36611                     case 3:
36612                         z = __Pyx_c_prod_float(a, a);
36613                         return __Pyx_c_prod_float(z, a);
36614                     case 4:
36615                         z = __Pyx_c_prod_float(a, a);
36616                         return __Pyx_c_prod_float(z, z);
36617                 }
36618             }
36619             if (a.imag == 0) {
36620                 if (a.real == 0) {
36621                     return a;
36622                 } else if (b.imag == 0) {
36623                     z.real = powf(a.real, b.real);
36624                     z.imag = 0;
36625                     return z;
36626                 } else if (a.real > 0) {
36627                     r = a.real;
36628                     theta = 0;
36629                 } else {
36630                     r = -a.real;
36631                     theta = atan2f(0.0, -1.0);
36632                 }
36633             } else {
36634                 r = __Pyx_c_abs_float(a);
36635                 theta = atan2f(a.imag, a.real);
36636             }
36637             lnr = logf(r);
36638             z_r = expf(lnr * b.real - theta * b.imag);
36639             z_theta = theta * b.real + lnr * b.imag;
36640             z.real = z_r * cosf(z_theta);
36641             z.imag = z_r * sinf(z_theta);
36642             return z;
36643         }
36644     #endif
36645 #endif
36646 
36647 /* Declarations */
36648   #if CYTHON_CCOMPLEX
36649   #ifdef __cplusplus
36650     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
36651       return ::std::complex< double >(x, y);
36652     }
36653   #else
36654     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
36655       return x + y*(__pyx_t_double_complex)_Complex_I;
36656     }
36657   #endif
36658 #else
36659     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
36660       __pyx_t_double_complex z;
36661       z.real = x;
36662       z.imag = y;
36663       return z;
36664     }
36665 #endif
36666 
36667 /* Arithmetic */
36668   #if CYTHON_CCOMPLEX
36669 #else
36670     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
36671        return (a.real == b.real) && (a.imag == b.imag);
36672     }
36673     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
36674         __pyx_t_double_complex z;
36675         z.real = a.real + b.real;
36676         z.imag = a.imag + b.imag;
36677         return z;
36678     }
36679     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
36680         __pyx_t_double_complex z;
36681         z.real = a.real - b.real;
36682         z.imag = a.imag - b.imag;
36683         return z;
36684     }
36685     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
36686         __pyx_t_double_complex z;
36687         z.real = a.real * b.real - a.imag * b.imag;
36688         z.imag = a.real * b.imag + a.imag * b.real;
36689         return z;
36690     }
36691     #if 1
36692     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
36693         if (b.imag == 0) {
36694             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
36695         } else if (fabs(b.real) >= fabs(b.imag)) {
36696             if (b.real == 0 && b.imag == 0) {
36697                 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
36698             } else {
36699                 double r = b.imag / b.real;
36700                 double s = (double)(1.0) / (b.real + b.imag * r);
36701                 return __pyx_t_double_complex_from_parts(
36702                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
36703             }
36704         } else {
36705             double r = b.real / b.imag;
36706             double s = (double)(1.0) / (b.imag + b.real * r);
36707             return __pyx_t_double_complex_from_parts(
36708                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
36709         }
36710     }
36711     #else
36712     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
36713         if (b.imag == 0) {
36714             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
36715         } else {
36716             double denom = b.real * b.real + b.imag * b.imag;
36717             return __pyx_t_double_complex_from_parts(
36718                 (a.real * b.real + a.imag * b.imag) / denom,
36719                 (a.imag * b.real - a.real * b.imag) / denom);
36720         }
36721     }
36722     #endif
36723     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
36724         __pyx_t_double_complex z;
36725         z.real = -a.real;
36726         z.imag = -a.imag;
36727         return z;
36728     }
36729     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
36730        return (a.real == 0) && (a.imag == 0);
36731     }
36732     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
36733         __pyx_t_double_complex z;
36734         z.real =  a.real;
36735         z.imag = -a.imag;
36736         return z;
36737     }
36738     #if 1
36739         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
36740           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
36741             return sqrt(z.real*z.real + z.imag*z.imag);
36742           #else
36743             return hypot(z.real, z.imag);
36744           #endif
36745         }
36746         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
36747             __pyx_t_double_complex z;
36748             double r, lnr, theta, z_r, z_theta;
36749             if (b.imag == 0 && b.real == (int)b.real) {
36750                 if (b.real < 0) {
36751                     double denom = a.real * a.real + a.imag * a.imag;
36752                     a.real = a.real / denom;
36753                     a.imag = -a.imag / denom;
36754                     b.real = -b.real;
36755                 }
36756                 switch ((int)b.real) {
36757                     case 0:
36758                         z.real = 1;
36759                         z.imag = 0;
36760                         return z;
36761                     case 1:
36762                         return a;
36763                     case 2:
36764                         z = __Pyx_c_prod_double(a, a);
36765                         return __Pyx_c_prod_double(a, a);
36766                     case 3:
36767                         z = __Pyx_c_prod_double(a, a);
36768                         return __Pyx_c_prod_double(z, a);
36769                     case 4:
36770                         z = __Pyx_c_prod_double(a, a);
36771                         return __Pyx_c_prod_double(z, z);
36772                 }
36773             }
36774             if (a.imag == 0) {
36775                 if (a.real == 0) {
36776                     return a;
36777                 } else if (b.imag == 0) {
36778                     z.real = pow(a.real, b.real);
36779                     z.imag = 0;
36780                     return z;
36781                 } else if (a.real > 0) {
36782                     r = a.real;
36783                     theta = 0;
36784                 } else {
36785                     r = -a.real;
36786                     theta = atan2(0.0, -1.0);
36787                 }
36788             } else {
36789                 r = __Pyx_c_abs_double(a);
36790                 theta = atan2(a.imag, a.real);
36791             }
36792             lnr = log(r);
36793             z_r = exp(lnr * b.real - theta * b.imag);
36794             z_theta = theta * b.real + lnr * b.imag;
36795             z.real = z_r * cos(z_theta);
36796             z.imag = z_r * sin(z_theta);
36797             return z;
36798         }
36799     #endif
36800 #endif
36801 
36802 /* CIntToPy */
36803   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
36804     const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0;
36805     const int is_unsigned = neg_one > const_zero;
36806     if (is_unsigned) {
36807         if (sizeof(enum NPY_TYPES) < sizeof(long)) {
36808             return PyInt_FromLong((long) value);
36809         } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
36810             return PyLong_FromUnsignedLong((unsigned long) value);
36811 #ifdef HAVE_LONG_LONG
36812         } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
36813             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
36814 #endif
36815         }
36816     } else {
36817         if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
36818             return PyInt_FromLong((long) value);
36819 #ifdef HAVE_LONG_LONG
36820         } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
36821             return PyLong_FromLongLong((PY_LONG_LONG) value);
36822 #endif
36823         }
36824     }
36825     {
36826         int one = 1; int little = (int)*(unsigned char *)&one;
36827         unsigned char *bytes = (unsigned char *)&value;
36828         return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
36829                                      little, !is_unsigned);
36830     }
36831 }
36832 
36833 /* MemviewSliceCopyTemplate */
36834   static __Pyx_memviewslice
36835 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
36836                                  const char *mode, int ndim,
36837                                  size_t sizeof_dtype, int contig_flag,
36838                                  int dtype_is_object)
36839 {
36840     __Pyx_RefNannyDeclarations
36841     int i;
36842     __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
36843     struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
36844     Py_buffer *buf = &from_memview->view;
36845     PyObject *shape_tuple = NULL;
36846     PyObject *temp_int = NULL;
36847     struct __pyx_array_obj *array_obj = NULL;
36848     struct __pyx_memoryview_obj *memview_obj = NULL;
36849     __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
36850     for (i = 0; i < ndim; i++) {
36851         if (from_mvs->suboffsets[i] >= 0) {
36852             PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
36853                                            "indirect dimensions (axis %d)", i);
36854             goto fail;
36855         }
36856     }
36857     shape_tuple = PyTuple_New(ndim);
36858     if (unlikely(!shape_tuple)) {
36859         goto fail;
36860     }
36861     __Pyx_GOTREF(shape_tuple);
36862     for(i = 0; i < ndim; i++) {
36863         temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
36864         if(unlikely(!temp_int)) {
36865             goto fail;
36866         } else {
36867             PyTuple_SET_ITEM(shape_tuple, i, temp_int);
36868             temp_int = NULL;
36869         }
36870     }
36871     array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
36872     if (unlikely(!array_obj)) {
36873         goto fail;
36874     }
36875     __Pyx_GOTREF(array_obj);
36876     memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
36877                                     (PyObject *) array_obj, contig_flag,
36878                                     dtype_is_object,
36879                                     from_mvs->memview->typeinfo);
36880     if (unlikely(!memview_obj))
36881         goto fail;
36882     if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
36883         goto fail;
36884     if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
36885                                                 dtype_is_object) < 0))
36886         goto fail;
36887     goto no_fail;
36888 fail:
36889     __Pyx_XDECREF(new_mvs.memview);
36890     new_mvs.memview = NULL;
36891     new_mvs.data = NULL;
36892 no_fail:
36893     __Pyx_XDECREF(shape_tuple);
36894     __Pyx_XDECREF(temp_int);
36895     __Pyx_XDECREF(array_obj);
36896     __Pyx_RefNannyFinishContext();
36897     return new_mvs;
36898 }
36899 
36900 /* CIntFromPy */
36901   static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
36902     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
36903     const int is_unsigned = neg_one > const_zero;
36904 #if PY_MAJOR_VERSION < 3
36905     if (likely(PyInt_Check(x))) {
36906         if (sizeof(int) < sizeof(long)) {
36907             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
36908         } else {
36909             long val = PyInt_AS_LONG(x);
36910             if (is_unsigned && unlikely(val < 0)) {
36911                 goto raise_neg_overflow;
36912             }
36913             return (int) val;
36914         }
36915     } else
36916 #endif
36917     if (likely(PyLong_Check(x))) {
36918         if (is_unsigned) {
36919 #if CYTHON_USE_PYLONG_INTERNALS
36920             const digit* digits = ((PyLongObject*)x)->ob_digit;
36921             switch (Py_SIZE(x)) {
36922                 case  0: return (int) 0;
36923                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
36924                 case 2:
36925                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
36926                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
36927                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
36928                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
36929                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
36930                         }
36931                     }
36932                     break;
36933                 case 3:
36934                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
36935                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
36936                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
36937                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
36938                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
36939                         }
36940                     }
36941                     break;
36942                 case 4:
36943                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
36944                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
36945                             __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])))
36946                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
36947                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
36948                         }
36949                     }
36950                     break;
36951             }
36952 #endif
36953 #if CYTHON_COMPILING_IN_CPYTHON
36954             if (unlikely(Py_SIZE(x) < 0)) {
36955                 goto raise_neg_overflow;
36956             }
36957 #else
36958             {
36959                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
36960                 if (unlikely(result < 0))
36961                     return (int) -1;
36962                 if (unlikely(result == 1))
36963                     goto raise_neg_overflow;
36964             }
36965 #endif
36966             if (sizeof(int) <= sizeof(unsigned long)) {
36967                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
36968 #ifdef HAVE_LONG_LONG
36969             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
36970                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
36971 #endif
36972             }
36973         } else {
36974 #if CYTHON_USE_PYLONG_INTERNALS
36975             const digit* digits = ((PyLongObject*)x)->ob_digit;
36976             switch (Py_SIZE(x)) {
36977                 case  0: return (int) 0;
36978                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
36979                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
36980                 case -2:
36981                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
36982                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
36983                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
36984                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
36985                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
36986                         }
36987                     }
36988                     break;
36989                 case 2:
36990                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
36991                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
36992                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
36993                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
36994                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
36995                         }
36996                     }
36997                     break;
36998                 case -3:
36999                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
37000                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
37001                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
37002                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
37003                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
37004                         }
37005                     }
37006                     break;
37007                 case 3:
37008                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
37009                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
37010                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
37011                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
37012                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
37013                         }
37014                     }
37015                     break;
37016                 case -4:
37017                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
37018                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
37019                             __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])))
37020                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
37021                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
37022                         }
37023                     }
37024                     break;
37025                 case 4:
37026                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
37027                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
37028                             __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])))
37029                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
37030                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
37031                         }
37032                     }
37033                     break;
37034             }
37035 #endif
37036             if (sizeof(int) <= sizeof(long)) {
37037                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
37038 #ifdef HAVE_LONG_LONG
37039             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
37040                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
37041 #endif
37042             }
37043         }
37044         {
37045 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
37046             PyErr_SetString(PyExc_RuntimeError,
37047                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
37048 #else
37049             int val;
37050             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
37051  #if PY_MAJOR_VERSION < 3
37052             if (likely(v) && !PyLong_Check(v)) {
37053                 PyObject *tmp = v;
37054                 v = PyNumber_Long(tmp);
37055                 Py_DECREF(tmp);
37056             }
37057  #endif
37058             if (likely(v)) {
37059                 int one = 1; int is_little = (int)*(unsigned char *)&one;
37060                 unsigned char *bytes = (unsigned char *)&val;
37061                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
37062                                               bytes, sizeof(val),
37063                                               is_little, !is_unsigned);
37064                 Py_DECREF(v);
37065                 if (likely(!ret))
37066                     return val;
37067             }
37068 #endif
37069             return (int) -1;
37070         }
37071     } else {
37072         int val;
37073         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
37074         if (!tmp) return (int) -1;
37075         val = __Pyx_PyInt_As_int(tmp);
37076         Py_DECREF(tmp);
37077         return val;
37078     }
37079 raise_overflow:
37080     PyErr_SetString(PyExc_OverflowError,
37081         "value too large to convert to int");
37082     return (int) -1;
37083 raise_neg_overflow:
37084     PyErr_SetString(PyExc_OverflowError,
37085         "can't convert negative value to int");
37086     return (int) -1;
37087 }
37088 
37089 /* CIntFromPy */
37090   static CYTHON_INLINE npy_int64 __Pyx_PyInt_As_npy_int64(PyObject *x) {
37091     const npy_int64 neg_one = (npy_int64) ((npy_int64) 0 - (npy_int64) 1), const_zero = (npy_int64) 0;
37092     const int is_unsigned = neg_one > const_zero;
37093 #if PY_MAJOR_VERSION < 3
37094     if (likely(PyInt_Check(x))) {
37095         if (sizeof(npy_int64) < sizeof(long)) {
37096             __PYX_VERIFY_RETURN_INT(npy_int64, long, PyInt_AS_LONG(x))
37097         } else {
37098             long val = PyInt_AS_LONG(x);
37099             if (is_unsigned && unlikely(val < 0)) {
37100                 goto raise_neg_overflow;
37101             }
37102             return (npy_int64) val;
37103         }
37104     } else
37105 #endif
37106     if (likely(PyLong_Check(x))) {
37107         if (is_unsigned) {
37108 #if CYTHON_USE_PYLONG_INTERNALS
37109             const digit* digits = ((PyLongObject*)x)->ob_digit;
37110             switch (Py_SIZE(x)) {
37111                 case  0: return (npy_int64) 0;
37112                 case  1: __PYX_VERIFY_RETURN_INT(npy_int64, digit, digits[0])
37113                 case 2:
37114                     if (8 * sizeof(npy_int64) > 1 * PyLong_SHIFT) {
37115                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
37116                             __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
37117                         } else if (8 * sizeof(npy_int64) >= 2 * PyLong_SHIFT) {
37118                             return (npy_int64) (((((npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0]));
37119                         }
37120                     }
37121                     break;
37122                 case 3:
37123                     if (8 * sizeof(npy_int64) > 2 * PyLong_SHIFT) {
37124                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
37125                             __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
37126                         } else if (8 * sizeof(npy_int64) >= 3 * PyLong_SHIFT) {
37127                             return (npy_int64) (((((((npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0]));
37128                         }
37129                     }
37130                     break;
37131                 case 4:
37132                     if (8 * sizeof(npy_int64) > 3 * PyLong_SHIFT) {
37133                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
37134                             __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])))
37135                         } else if (8 * sizeof(npy_int64) >= 4 * PyLong_SHIFT) {
37136                             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]));
37137                         }
37138                     }
37139                     break;
37140             }
37141 #endif
37142 #if CYTHON_COMPILING_IN_CPYTHON
37143             if (unlikely(Py_SIZE(x) < 0)) {
37144                 goto raise_neg_overflow;
37145             }
37146 #else
37147             {
37148                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
37149                 if (unlikely(result < 0))
37150                     return (npy_int64) -1;
37151                 if (unlikely(result == 1))
37152                     goto raise_neg_overflow;
37153             }
37154 #endif
37155             if (sizeof(npy_int64) <= sizeof(unsigned long)) {
37156                 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, unsigned long, PyLong_AsUnsignedLong(x))
37157 #ifdef HAVE_LONG_LONG
37158             } else if (sizeof(npy_int64) <= sizeof(unsigned PY_LONG_LONG)) {
37159                 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
37160 #endif
37161             }
37162         } else {
37163 #if CYTHON_USE_PYLONG_INTERNALS
37164             const digit* digits = ((PyLongObject*)x)->ob_digit;
37165             switch (Py_SIZE(x)) {
37166                 case  0: return (npy_int64) 0;
37167                 case -1: __PYX_VERIFY_RETURN_INT(npy_int64, sdigit, (sdigit) (-(sdigit)digits[0]))
37168                 case  1: __PYX_VERIFY_RETURN_INT(npy_int64,  digit, +digits[0])
37169                 case -2:
37170                     if (8 * sizeof(npy_int64) - 1 > 1 * PyLong_SHIFT) {
37171                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
37172                             __PYX_VERIFY_RETURN_INT(npy_int64, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
37173                         } else if (8 * sizeof(npy_int64) - 1 > 2 * PyLong_SHIFT) {
37174                             return (npy_int64) (((npy_int64)-1)*(((((npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
37175                         }
37176                     }
37177                     break;
37178                 case 2:
37179                     if (8 * sizeof(npy_int64) > 1 * PyLong_SHIFT) {
37180                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
37181                             __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
37182                         } else if (8 * sizeof(npy_int64) - 1 > 2 * PyLong_SHIFT) {
37183                             return (npy_int64) ((((((npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
37184                         }
37185                     }
37186                     break;
37187                 case -3:
37188                     if (8 * sizeof(npy_int64) - 1 > 2 * PyLong_SHIFT) {
37189                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
37190                             __PYX_VERIFY_RETURN_INT(npy_int64, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
37191                         } else if (8 * sizeof(npy_int64) - 1 > 3 * PyLong_SHIFT) {
37192                             return (npy_int64) (((npy_int64)-1)*(((((((npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
37193                         }
37194                     }
37195                     break;
37196                 case 3:
37197                     if (8 * sizeof(npy_int64) > 2 * PyLong_SHIFT) {
37198                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
37199                             __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
37200                         } else if (8 * sizeof(npy_int64) - 1 > 3 * PyLong_SHIFT) {
37201                             return (npy_int64) ((((((((npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
37202                         }
37203                     }
37204                     break;
37205                 case -4:
37206                     if (8 * sizeof(npy_int64) - 1 > 3 * PyLong_SHIFT) {
37207                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
37208                             __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])))
37209                         } else if (8 * sizeof(npy_int64) - 1 > 4 * PyLong_SHIFT) {
37210                             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])));
37211                         }
37212                     }
37213                     break;
37214                 case 4:
37215                     if (8 * sizeof(npy_int64) > 3 * PyLong_SHIFT) {
37216                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
37217                             __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])))
37218                         } else if (8 * sizeof(npy_int64) - 1 > 4 * PyLong_SHIFT) {
37219                             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])));
37220                         }
37221                     }
37222                     break;
37223             }
37224 #endif
37225             if (sizeof(npy_int64) <= sizeof(long)) {
37226                 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, long, PyLong_AsLong(x))
37227 #ifdef HAVE_LONG_LONG
37228             } else if (sizeof(npy_int64) <= sizeof(PY_LONG_LONG)) {
37229                 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, PY_LONG_LONG, PyLong_AsLongLong(x))
37230 #endif
37231             }
37232         }
37233         {
37234 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
37235             PyErr_SetString(PyExc_RuntimeError,
37236                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
37237 #else
37238             npy_int64 val;
37239             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
37240  #if PY_MAJOR_VERSION < 3
37241             if (likely(v) && !PyLong_Check(v)) {
37242                 PyObject *tmp = v;
37243                 v = PyNumber_Long(tmp);
37244                 Py_DECREF(tmp);
37245             }
37246  #endif
37247             if (likely(v)) {
37248                 int one = 1; int is_little = (int)*(unsigned char *)&one;
37249                 unsigned char *bytes = (unsigned char *)&val;
37250                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
37251                                               bytes, sizeof(val),
37252                                               is_little, !is_unsigned);
37253                 Py_DECREF(v);
37254                 if (likely(!ret))
37255                     return val;
37256             }
37257 #endif
37258             return (npy_int64) -1;
37259         }
37260     } else {
37261         npy_int64 val;
37262         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
37263         if (!tmp) return (npy_int64) -1;
37264         val = __Pyx_PyInt_As_npy_int64(tmp);
37265         Py_DECREF(tmp);
37266         return val;
37267     }
37268 raise_overflow:
37269     PyErr_SetString(PyExc_OverflowError,
37270         "value too large to convert to npy_int64");
37271     return (npy_int64) -1;
37272 raise_neg_overflow:
37273     PyErr_SetString(PyExc_OverflowError,
37274         "can't convert negative value to npy_int64");
37275     return (npy_int64) -1;
37276 }
37277 
37278 /* TypeInfoToFormat */
37279   static struct __pyx_typeinfo_string __Pyx_TypeInfoToFormat(__Pyx_TypeInfo *type) {
37280     struct __pyx_typeinfo_string result = { {0} };
37281     char *buf = (char *) result.string;
37282     size_t size = type->size;
37283     switch (type->typegroup) {
37284         case 'H':
37285             *buf = 'c';
37286             break;
37287         case 'I':
37288         case 'U':
37289             if (size == 1)
37290                 *buf = (type->is_unsigned) ? 'B' : 'b';
37291             else if (size == 2)
37292                 *buf = (type->is_unsigned) ? 'H' : 'h';
37293             else if (size == 4)
37294                 *buf = (type->is_unsigned) ? 'I' : 'i';
37295             else if (size == 8)
37296                 *buf = (type->is_unsigned) ? 'Q' : 'q';
37297             break;
37298         case 'P':
37299             *buf = 'P';
37300             break;
37301         case 'C':
37302          {
37303             __Pyx_TypeInfo complex_type = *type;
37304             complex_type.typegroup = 'R';
37305             complex_type.size /= 2;
37306             *buf++ = 'Z';
37307             *buf = __Pyx_TypeInfoToFormat(&complex_type).string[0];
37308             break;
37309          }
37310         case 'R':
37311             if (size == 4)
37312                 *buf = 'f';
37313             else if (size == 8)
37314                 *buf = 'd';
37315             else
37316                 *buf = 'g';
37317             break;
37318     }
37319     return result;
37320 }
37321 
37322 /* CIntFromPy */
37323   static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
37324     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
37325     const int is_unsigned = neg_one > const_zero;
37326 #if PY_MAJOR_VERSION < 3
37327     if (likely(PyInt_Check(x))) {
37328         if (sizeof(long) < sizeof(long)) {
37329             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
37330         } else {
37331             long val = PyInt_AS_LONG(x);
37332             if (is_unsigned && unlikely(val < 0)) {
37333                 goto raise_neg_overflow;
37334             }
37335             return (long) val;
37336         }
37337     } else
37338 #endif
37339     if (likely(PyLong_Check(x))) {
37340         if (is_unsigned) {
37341 #if CYTHON_USE_PYLONG_INTERNALS
37342             const digit* digits = ((PyLongObject*)x)->ob_digit;
37343             switch (Py_SIZE(x)) {
37344                 case  0: return (long) 0;
37345                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
37346                 case 2:
37347                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
37348                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
37349                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
37350                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
37351                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
37352                         }
37353                     }
37354                     break;
37355                 case 3:
37356                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
37357                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
37358                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
37359                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
37360                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
37361                         }
37362                     }
37363                     break;
37364                 case 4:
37365                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
37366                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
37367                             __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])))
37368                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
37369                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
37370                         }
37371                     }
37372                     break;
37373             }
37374 #endif
37375 #if CYTHON_COMPILING_IN_CPYTHON
37376             if (unlikely(Py_SIZE(x) < 0)) {
37377                 goto raise_neg_overflow;
37378             }
37379 #else
37380             {
37381                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
37382                 if (unlikely(result < 0))
37383                     return (long) -1;
37384                 if (unlikely(result == 1))
37385                     goto raise_neg_overflow;
37386             }
37387 #endif
37388             if (sizeof(long) <= sizeof(unsigned long)) {
37389                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
37390 #ifdef HAVE_LONG_LONG
37391             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
37392                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
37393 #endif
37394             }
37395         } else {
37396 #if CYTHON_USE_PYLONG_INTERNALS
37397             const digit* digits = ((PyLongObject*)x)->ob_digit;
37398             switch (Py_SIZE(x)) {
37399                 case  0: return (long) 0;
37400                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
37401                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
37402                 case -2:
37403                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
37404                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
37405                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
37406                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
37407                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
37408                         }
37409                     }
37410                     break;
37411                 case 2:
37412                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
37413                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
37414                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
37415                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
37416                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
37417                         }
37418                     }
37419                     break;
37420                 case -3:
37421                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
37422                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
37423                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
37424                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
37425                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
37426                         }
37427                     }
37428                     break;
37429                 case 3:
37430                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
37431                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
37432                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
37433                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
37434                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
37435                         }
37436                     }
37437                     break;
37438                 case -4:
37439                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
37440                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
37441                             __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])))
37442                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
37443                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
37444                         }
37445                     }
37446                     break;
37447                 case 4:
37448                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
37449                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
37450                             __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])))
37451                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
37452                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
37453                         }
37454                     }
37455                     break;
37456             }
37457 #endif
37458             if (sizeof(long) <= sizeof(long)) {
37459                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
37460 #ifdef HAVE_LONG_LONG
37461             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
37462                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
37463 #endif
37464             }
37465         }
37466         {
37467 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
37468             PyErr_SetString(PyExc_RuntimeError,
37469                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
37470 #else
37471             long val;
37472             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
37473  #if PY_MAJOR_VERSION < 3
37474             if (likely(v) && !PyLong_Check(v)) {
37475                 PyObject *tmp = v;
37476                 v = PyNumber_Long(tmp);
37477                 Py_DECREF(tmp);
37478             }
37479  #endif
37480             if (likely(v)) {
37481                 int one = 1; int is_little = (int)*(unsigned char *)&one;
37482                 unsigned char *bytes = (unsigned char *)&val;
37483                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
37484                                               bytes, sizeof(val),
37485                                               is_little, !is_unsigned);
37486                 Py_DECREF(v);
37487                 if (likely(!ret))
37488                     return val;
37489             }
37490 #endif
37491             return (long) -1;
37492         }
37493     } else {
37494         long val;
37495         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
37496         if (!tmp) return (long) -1;
37497         val = __Pyx_PyInt_As_long(tmp);
37498         Py_DECREF(tmp);
37499         return val;
37500     }
37501 raise_overflow:
37502     PyErr_SetString(PyExc_OverflowError,
37503         "value too large to convert to long");
37504     return (long) -1;
37505 raise_neg_overflow:
37506     PyErr_SetString(PyExc_OverflowError,
37507         "can't convert negative value to long");
37508     return (long) -1;
37509 }
37510 
37511 /* PrintOne */
37512   #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
37513 static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
37514     if (!f) {
37515         if (!(f = __Pyx_GetStdout()))
37516             return -1;
37517     }
37518     Py_INCREF(f);
37519     if (PyFile_SoftSpace(f, 0)) {
37520         if (PyFile_WriteString(" ", f) < 0)
37521             goto error;
37522     }
37523     if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
37524         goto error;
37525     if (PyFile_WriteString("\n", f) < 0)
37526         goto error;
37527     Py_DECREF(f);
37528     return 0;
37529 error:
37530     Py_DECREF(f);
37531     return -1;
37532     /* the line below is just to avoid C compiler
37533      * warnings about unused functions */
37534     return __Pyx_Print(f, NULL, 0);
37535 }
37536 #else
37537 static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
37538     int res;
37539     PyObject* arg_tuple = PyTuple_Pack(1, o);
37540     if (unlikely(!arg_tuple))
37541         return -1;
37542     res = __Pyx_Print(stream, arg_tuple, 1);
37543     Py_DECREF(arg_tuple);
37544     return res;
37545 }
37546 #endif
37547 
37548 /* CIntFromPy */
37549   static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
37550     const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0;
37551     const int is_unsigned = neg_one > const_zero;
37552 #if PY_MAJOR_VERSION < 3
37553     if (likely(PyInt_Check(x))) {
37554         if (sizeof(char) < sizeof(long)) {
37555             __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
37556         } else {
37557             long val = PyInt_AS_LONG(x);
37558             if (is_unsigned && unlikely(val < 0)) {
37559                 goto raise_neg_overflow;
37560             }
37561             return (char) val;
37562         }
37563     } else
37564 #endif
37565     if (likely(PyLong_Check(x))) {
37566         if (is_unsigned) {
37567 #if CYTHON_USE_PYLONG_INTERNALS
37568             const digit* digits = ((PyLongObject*)x)->ob_digit;
37569             switch (Py_SIZE(x)) {
37570                 case  0: return (char) 0;
37571                 case  1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
37572                 case 2:
37573                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
37574                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
37575                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
37576                         } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
37577                             return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
37578                         }
37579                     }
37580                     break;
37581                 case 3:
37582                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
37583                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
37584                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
37585                         } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
37586                             return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
37587                         }
37588                     }
37589                     break;
37590                 case 4:
37591                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
37592                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
37593                             __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])))
37594                         } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
37595                             return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
37596                         }
37597                     }
37598                     break;
37599             }
37600 #endif
37601 #if CYTHON_COMPILING_IN_CPYTHON
37602             if (unlikely(Py_SIZE(x) < 0)) {
37603                 goto raise_neg_overflow;
37604             }
37605 #else
37606             {
37607                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
37608                 if (unlikely(result < 0))
37609                     return (char) -1;
37610                 if (unlikely(result == 1))
37611                     goto raise_neg_overflow;
37612             }
37613 #endif
37614             if (sizeof(char) <= sizeof(unsigned long)) {
37615                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
37616 #ifdef HAVE_LONG_LONG
37617             } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
37618                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
37619 #endif
37620             }
37621         } else {
37622 #if CYTHON_USE_PYLONG_INTERNALS
37623             const digit* digits = ((PyLongObject*)x)->ob_digit;
37624             switch (Py_SIZE(x)) {
37625                 case  0: return (char) 0;
37626                 case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
37627                 case  1: __PYX_VERIFY_RETURN_INT(char,  digit, +digits[0])
37628                 case -2:
37629                     if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
37630                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
37631                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
37632                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
37633                             return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
37634                         }
37635                     }
37636                     break;
37637                 case 2:
37638                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
37639                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
37640                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
37641                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
37642                             return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
37643                         }
37644                     }
37645                     break;
37646                 case -3:
37647                     if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
37648                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
37649                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
37650                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
37651                             return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
37652                         }
37653                     }
37654                     break;
37655                 case 3:
37656                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
37657                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
37658                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
37659                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
37660                             return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
37661                         }
37662                     }
37663                     break;
37664                 case -4:
37665                     if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
37666                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
37667                             __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])))
37668                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
37669                             return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
37670                         }
37671                     }
37672                     break;
37673                 case 4:
37674                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
37675                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
37676                             __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])))
37677                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
37678                             return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
37679                         }
37680                     }
37681                     break;
37682             }
37683 #endif
37684             if (sizeof(char) <= sizeof(long)) {
37685                 __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
37686 #ifdef HAVE_LONG_LONG
37687             } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
37688                 __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
37689 #endif
37690             }
37691         }
37692         {
37693 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
37694             PyErr_SetString(PyExc_RuntimeError,
37695                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
37696 #else
37697             char val;
37698             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
37699  #if PY_MAJOR_VERSION < 3
37700             if (likely(v) && !PyLong_Check(v)) {
37701                 PyObject *tmp = v;
37702                 v = PyNumber_Long(tmp);
37703                 Py_DECREF(tmp);
37704             }
37705  #endif
37706             if (likely(v)) {
37707                 int one = 1; int is_little = (int)*(unsigned char *)&one;
37708                 unsigned char *bytes = (unsigned char *)&val;
37709                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
37710                                               bytes, sizeof(val),
37711                                               is_little, !is_unsigned);
37712                 Py_DECREF(v);
37713                 if (likely(!ret))
37714                     return val;
37715             }
37716 #endif
37717             return (char) -1;
37718         }
37719     } else {
37720         char val;
37721         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
37722         if (!tmp) return (char) -1;
37723         val = __Pyx_PyInt_As_char(tmp);
37724         Py_DECREF(tmp);
37725         return val;
37726     }
37727 raise_overflow:
37728     PyErr_SetString(PyExc_OverflowError,
37729         "value too large to convert to char");
37730     return (char) -1;
37731 raise_neg_overflow:
37732     PyErr_SetString(PyExc_OverflowError,
37733         "can't convert negative value to char");
37734     return (char) -1;
37735 }
37736 
37737 /* FetchCommonType */
37738   static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
37739     PyObject* fake_module;
37740     PyTypeObject* cached_type = NULL;
37741     fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
37742     if (!fake_module) return NULL;
37743     Py_INCREF(fake_module);
37744     cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
37745     if (cached_type) {
37746         if (!PyType_Check((PyObject*)cached_type)) {
37747             PyErr_Format(PyExc_TypeError,
37748                 "Shared Cython type %.200s is not a type object",
37749                 type->tp_name);
37750             goto bad;
37751         }
37752         if (cached_type->tp_basicsize != type->tp_basicsize) {
37753             PyErr_Format(PyExc_TypeError,
37754                 "Shared Cython type %.200s has the wrong size, try recompiling",
37755                 type->tp_name);
37756             goto bad;
37757         }
37758     } else {
37759         if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
37760         PyErr_Clear();
37761         if (PyType_Ready(type) < 0) goto bad;
37762         if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
37763             goto bad;
37764         Py_INCREF(type);
37765         cached_type = type;
37766     }
37767 done:
37768     Py_DECREF(fake_module);
37769     return cached_type;
37770 bad:
37771     Py_XDECREF(cached_type);
37772     cached_type = NULL;
37773     goto done;
37774 }
37775 
37776 /* PyObjectGetMethod */
37777   static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
37778     PyObject *attr;
37779 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
37780     PyTypeObject *tp = Py_TYPE(obj);
37781     PyObject *descr;
37782     descrgetfunc f = NULL;
37783     PyObject **dictptr, *dict;
37784     int meth_found = 0;
37785     assert (*method == NULL);
37786     if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
37787         attr = __Pyx_PyObject_GetAttrStr(obj, name);
37788         goto try_unpack;
37789     }
37790     if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
37791         return 0;
37792     }
37793     descr = _PyType_Lookup(tp, name);
37794     if (likely(descr != NULL)) {
37795         Py_INCREF(descr);
37796 #if PY_MAJOR_VERSION >= 3
37797         #ifdef __Pyx_CyFunction_USED
37798         if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
37799         #else
37800         if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
37801         #endif
37802 #else
37803         #ifdef __Pyx_CyFunction_USED
37804         if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
37805         #else
37806         if (likely(PyFunction_Check(descr)))
37807         #endif
37808 #endif
37809         {
37810             meth_found = 1;
37811         } else {
37812             f = Py_TYPE(descr)->tp_descr_get;
37813             if (f != NULL && PyDescr_IsData(descr)) {
37814                 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
37815                 Py_DECREF(descr);
37816                 goto try_unpack;
37817             }
37818         }
37819     }
37820     dictptr = _PyObject_GetDictPtr(obj);
37821     if (dictptr != NULL && (dict = *dictptr) != NULL) {
37822         Py_INCREF(dict);
37823         attr = __Pyx_PyDict_GetItemStr(dict, name);
37824         if (attr != NULL) {
37825             Py_INCREF(attr);
37826             Py_DECREF(dict);
37827             Py_XDECREF(descr);
37828             goto try_unpack;
37829         }
37830         Py_DECREF(dict);
37831     }
37832     if (meth_found) {
37833         *method = descr;
37834         return 1;
37835     }
37836     if (f != NULL) {
37837         attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
37838         Py_DECREF(descr);
37839         goto try_unpack;
37840     }
37841     if (descr != NULL) {
37842         *method = descr;
37843         return 0;
37844     }
37845     PyErr_Format(PyExc_AttributeError,
37846 #if PY_MAJOR_VERSION >= 3
37847                  "'%.50s' object has no attribute '%U'",
37848                  tp->tp_name, name);
37849 #else
37850                  "'%.50s' object has no attribute '%.400s'",
37851                  tp->tp_name, PyString_AS_STRING(name));
37852 #endif
37853     return 0;
37854 #else
37855     attr = __Pyx_PyObject_GetAttrStr(obj, name);
37856     goto try_unpack;
37857 #endif
37858 try_unpack:
37859 #if CYTHON_UNPACK_METHODS
37860     if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
37861         PyObject *function = PyMethod_GET_FUNCTION(attr);
37862         Py_INCREF(function);
37863         Py_DECREF(attr);
37864         *method = function;
37865         return 1;
37866     }
37867 #endif
37868     *method = attr;
37869     return 0;
37870 }
37871 
37872 /* PyObjectCallMethod1 */
37873   static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
37874     PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
37875     Py_DECREF(method);
37876     return result;
37877 }
37878 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
37879     PyObject *method = NULL, *result;
37880     int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
37881     if (likely(is_method)) {
37882         result = __Pyx_PyObject_Call2Args(method, obj, arg);
37883         Py_DECREF(method);
37884         return result;
37885     }
37886     if (unlikely(!method)) return NULL;
37887     return __Pyx__PyObject_CallMethod1(method, arg);
37888 }
37889 
37890 /* CoroutineBase */
37891   #include <structmember.h>
37892 #include <frameobject.h>
37893 #define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
37894 static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) {
37895     PyObject *et, *ev, *tb;
37896     PyObject *value = NULL;
37897     __Pyx_ErrFetch(&et, &ev, &tb);
37898     if (!et) {
37899         Py_XDECREF(tb);
37900         Py_XDECREF(ev);
37901         Py_INCREF(Py_None);
37902         *pvalue = Py_None;
37903         return 0;
37904     }
37905     if (likely(et == PyExc_StopIteration)) {
37906         if (!ev) {
37907             Py_INCREF(Py_None);
37908             value = Py_None;
37909         }
37910 #if PY_VERSION_HEX >= 0x030300A0
37911         else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
37912             value = ((PyStopIterationObject *)ev)->value;
37913             Py_INCREF(value);
37914             Py_DECREF(ev);
37915         }
37916 #endif
37917         else if (unlikely(PyTuple_Check(ev))) {
37918             if (PyTuple_GET_SIZE(ev) >= 1) {
37919 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
37920                 value = PyTuple_GET_ITEM(ev, 0);
37921                 Py_INCREF(value);
37922 #else
37923                 value = PySequence_ITEM(ev, 0);
37924 #endif
37925             } else {
37926                 Py_INCREF(Py_None);
37927                 value = Py_None;
37928             }
37929             Py_DECREF(ev);
37930         }
37931         else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
37932             value = ev;
37933         }
37934         if (likely(value)) {
37935             Py_XDECREF(tb);
37936             Py_DECREF(et);
37937             *pvalue = value;
37938             return 0;
37939         }
37940     } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
37941         __Pyx_ErrRestore(et, ev, tb);
37942         return -1;
37943     }
37944     PyErr_NormalizeException(&et, &ev, &tb);
37945     if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
37946         __Pyx_ErrRestore(et, ev, tb);
37947         return -1;
37948     }
37949     Py_XDECREF(tb);
37950     Py_DECREF(et);
37951 #if PY_VERSION_HEX >= 0x030300A0
37952     value = ((PyStopIterationObject *)ev)->value;
37953     Py_INCREF(value);
37954     Py_DECREF(ev);
37955 #else
37956     {
37957         PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
37958         Py_DECREF(ev);
37959         if (likely(args)) {
37960             value = PySequence_GetItem(args, 0);
37961             Py_DECREF(args);
37962         }
37963         if (unlikely(!value)) {
37964             __Pyx_ErrRestore(NULL, NULL, NULL);
37965             Py_INCREF(Py_None);
37966             value = Py_None;
37967         }
37968     }
37969 #endif
37970     *pvalue = value;
37971     return 0;
37972 }
37973 static CYTHON_INLINE
37974 void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
37975     PyObject *t, *v, *tb;
37976     t = exc_state->exc_type;
37977     v = exc_state->exc_value;
37978     tb = exc_state->exc_traceback;
37979     exc_state->exc_type = NULL;
37980     exc_state->exc_value = NULL;
37981     exc_state->exc_traceback = NULL;
37982     Py_XDECREF(t);
37983     Py_XDECREF(v);
37984     Py_XDECREF(tb);
37985 }
37986 #define __Pyx_Coroutine_AlreadyRunningError(gen)  (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
37987 static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) {
37988     const char *msg;
37989     if ((0)) {
37990     #ifdef __Pyx_Coroutine_USED
37991     } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
37992         msg = "coroutine already executing";
37993     #endif
37994     #ifdef __Pyx_AsyncGen_USED
37995     } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
37996         msg = "async generator already executing";
37997     #endif
37998     } else {
37999         msg = "generator already executing";
38000     }
38001     PyErr_SetString(PyExc_ValueError, msg);
38002 }
38003 #define __Pyx_Coroutine_NotStartedError(gen)  (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
38004 static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) {
38005     const char *msg;
38006     if ((0)) {
38007     #ifdef __Pyx_Coroutine_USED
38008     } else if (__Pyx_Coroutine_Check(gen)) {
38009         msg = "can't send non-None value to a just-started coroutine";
38010     #endif
38011     #ifdef __Pyx_AsyncGen_USED
38012     } else if (__Pyx_AsyncGen_CheckExact(gen)) {
38013         msg = "can't send non-None value to a just-started async generator";
38014     #endif
38015     } else {
38016         msg = "can't send non-None value to a just-started generator";
38017     }
38018     PyErr_SetString(PyExc_TypeError, msg);
38019 }
38020 #define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing)  (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
38021 static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int closing) {
38022     #ifdef __Pyx_Coroutine_USED
38023     if (!closing && __Pyx_Coroutine_Check(gen)) {
38024         PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
38025     } else
38026     #endif
38027     if (value) {
38028         #ifdef __Pyx_AsyncGen_USED
38029         if (__Pyx_AsyncGen_CheckExact(gen))
38030             PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration);
38031         else
38032         #endif
38033         PyErr_SetNone(PyExc_StopIteration);
38034     }
38035 }
38036 static
38037 PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
38038     __Pyx_PyThreadState_declare
38039     PyThreadState *tstate;
38040     __Pyx_ExcInfoStruct *exc_state;
38041     PyObject *retval;
38042     assert(!self->is_running);
38043     if (unlikely(self->resume_label == 0)) {
38044         if (unlikely(value && value != Py_None)) {
38045             return __Pyx_Coroutine_NotStartedError((PyObject*)self);
38046         }
38047     }
38048     if (unlikely(self->resume_label == -1)) {
38049         return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
38050     }
38051 #if CYTHON_FAST_THREAD_STATE
38052     __Pyx_PyThreadState_assign
38053     tstate = __pyx_tstate;
38054 #else
38055     tstate = __Pyx_PyThreadState_Current;
38056 #endif
38057     exc_state = &self->gi_exc_state;
38058     if (exc_state->exc_type) {
38059         #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
38060         #else
38061         if (exc_state->exc_traceback) {
38062             PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback;
38063             PyFrameObject *f = tb->tb_frame;
38064             Py_XINCREF(tstate->frame);
38065             assert(f->f_back == NULL);
38066             f->f_back = tstate->frame;
38067         }
38068         #endif
38069     }
38070 #if CYTHON_USE_EXC_INFO_STACK
38071     exc_state->previous_item = tstate->exc_info;
38072     tstate->exc_info = exc_state;
38073 #else
38074     if (exc_state->exc_type) {
38075         __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
38076     } else {
38077         __Pyx_Coroutine_ExceptionClear(exc_state);
38078         __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
38079     }
38080 #endif
38081     self->is_running = 1;
38082     retval = self->body((PyObject *) self, tstate, value);
38083     self->is_running = 0;
38084 #if CYTHON_USE_EXC_INFO_STACK
38085     exc_state = &self->gi_exc_state;
38086     tstate->exc_info = exc_state->previous_item;
38087     exc_state->previous_item = NULL;
38088     __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
38089 #endif
38090     return retval;
38091 }
38092 static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
38093     PyObject *exc_tb = exc_state->exc_traceback;
38094     if (likely(exc_tb)) {
38095 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
38096 #else
38097         PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
38098         PyFrameObject *f = tb->tb_frame;
38099         Py_CLEAR(f->f_back);
38100 #endif
38101     }
38102 }
38103 static CYTHON_INLINE
38104 PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) {
38105     if (unlikely(!retval)) {
38106         __Pyx_PyThreadState_declare
38107         __Pyx_PyThreadState_assign
38108         if (!__Pyx_PyErr_Occurred()) {
38109             PyObject *exc = PyExc_StopIteration;
38110             #ifdef __Pyx_AsyncGen_USED
38111             if (__Pyx_AsyncGen_CheckExact(gen))
38112                 exc = __Pyx_PyExc_StopAsyncIteration;
38113             #endif
38114             __Pyx_PyErr_SetNone(exc);
38115         }
38116     }
38117     return retval;
38118 }
38119 static CYTHON_INLINE
38120 PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
38121     PyObject *ret;
38122     PyObject *val = NULL;
38123     __Pyx_Coroutine_Undelegate(gen);
38124     __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
38125     ret = __Pyx_Coroutine_SendEx(gen, val, 0);
38126     Py_XDECREF(val);
38127     return ret;
38128 }
38129 static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
38130     PyObject *retval;
38131     __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
38132     PyObject *yf = gen->yieldfrom;
38133     if (unlikely(gen->is_running))
38134         return __Pyx_Coroutine_AlreadyRunningError(gen);
38135     if (yf) {
38136         PyObject *ret;
38137         gen->is_running = 1;
38138         #ifdef __Pyx_Generator_USED
38139         if (__Pyx_Generator_CheckExact(yf)) {
38140             ret = __Pyx_Coroutine_Send(yf, value);
38141         } else
38142         #endif
38143         #ifdef __Pyx_Coroutine_USED
38144         if (__Pyx_Coroutine_Check(yf)) {
38145             ret = __Pyx_Coroutine_Send(yf, value);
38146         } else
38147         #endif
38148         #ifdef __Pyx_AsyncGen_USED
38149         if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
38150             ret = __Pyx_async_gen_asend_send(yf, value);
38151         } else
38152         #endif
38153         #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
38154         if (PyGen_CheckExact(yf)) {
38155             ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
38156         } else
38157         #endif
38158         #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
38159         if (PyCoro_CheckExact(yf)) {
38160             ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
38161         } else
38162         #endif
38163         {
38164             if (value == Py_None)
38165                 ret = Py_TYPE(yf)->tp_iternext(yf);
38166             else
38167                 ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
38168         }
38169         gen->is_running = 0;
38170         if (likely(ret)) {
38171             return ret;
38172         }
38173         retval = __Pyx_Coroutine_FinishDelegation(gen);
38174     } else {
38175         retval = __Pyx_Coroutine_SendEx(gen, value, 0);
38176     }
38177     return __Pyx_Coroutine_MethodReturn(self, retval);
38178 }
38179 static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
38180     PyObject *retval = NULL;
38181     int err = 0;
38182     #ifdef __Pyx_Generator_USED
38183     if (__Pyx_Generator_CheckExact(yf)) {
38184         retval = __Pyx_Coroutine_Close(yf);
38185         if (!retval)
38186             return -1;
38187     } else
38188     #endif
38189     #ifdef __Pyx_Coroutine_USED
38190     if (__Pyx_Coroutine_Check(yf)) {
38191         retval = __Pyx_Coroutine_Close(yf);
38192         if (!retval)
38193             return -1;
38194     } else
38195     if (__Pyx_CoroutineAwait_CheckExact(yf)) {
38196         retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
38197         if (!retval)
38198             return -1;
38199     } else
38200     #endif
38201     #ifdef __Pyx_AsyncGen_USED
38202     if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
38203         retval = __Pyx_async_gen_asend_close(yf, NULL);
38204     } else
38205     if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
38206         retval = __Pyx_async_gen_athrow_close(yf, NULL);
38207     } else
38208     #endif
38209     {
38210         PyObject *meth;
38211         gen->is_running = 1;
38212         meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
38213         if (unlikely(!meth)) {
38214             if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
38215                 PyErr_WriteUnraisable(yf);
38216             }
38217             PyErr_Clear();
38218         } else {
38219             retval = PyObject_CallFunction(meth, NULL);
38220             Py_DECREF(meth);
38221             if (!retval)
38222                 err = -1;
38223         }
38224         gen->is_running = 0;
38225     }
38226     Py_XDECREF(retval);
38227     return err;
38228 }
38229 static PyObject *__Pyx_Generator_Next(PyObject *self) {
38230     __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
38231     PyObject *yf = gen->yieldfrom;
38232     if (unlikely(gen->is_running))
38233         return __Pyx_Coroutine_AlreadyRunningError(gen);
38234     if (yf) {
38235         PyObject *ret;
38236         gen->is_running = 1;
38237         #ifdef __Pyx_Generator_USED
38238         if (__Pyx_Generator_CheckExact(yf)) {
38239             ret = __Pyx_Generator_Next(yf);
38240         } else
38241         #endif
38242         #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
38243         if (PyGen_CheckExact(yf)) {
38244             ret = _PyGen_Send((PyGenObject*)yf, NULL);
38245         } else
38246         #endif
38247         #ifdef __Pyx_Coroutine_USED
38248         if (__Pyx_Coroutine_Check(yf)) {
38249             ret = __Pyx_Coroutine_Send(yf, Py_None);
38250         } else
38251         #endif
38252             ret = Py_TYPE(yf)->tp_iternext(yf);
38253         gen->is_running = 0;
38254         if (likely(ret)) {
38255             return ret;
38256         }
38257         return __Pyx_Coroutine_FinishDelegation(gen);
38258     }
38259     return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
38260 }
38261 static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) {
38262     return __Pyx_Coroutine_Close(self);
38263 }
38264 static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
38265     __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
38266     PyObject *retval, *raised_exception;
38267     PyObject *yf = gen->yieldfrom;
38268     int err = 0;
38269     if (unlikely(gen->is_running))
38270         return __Pyx_Coroutine_AlreadyRunningError(gen);
38271     if (yf) {
38272         Py_INCREF(yf);
38273         err = __Pyx_Coroutine_CloseIter(gen, yf);
38274         __Pyx_Coroutine_Undelegate(gen);
38275         Py_DECREF(yf);
38276     }
38277     if (err == 0)
38278         PyErr_SetNone(PyExc_GeneratorExit);
38279     retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
38280     if (unlikely(retval)) {
38281         const char *msg;
38282         Py_DECREF(retval);
38283         if ((0)) {
38284         #ifdef __Pyx_Coroutine_USED
38285         } else if (__Pyx_Coroutine_Check(self)) {
38286             msg = "coroutine ignored GeneratorExit";
38287         #endif
38288         #ifdef __Pyx_AsyncGen_USED
38289         } else if (__Pyx_AsyncGen_CheckExact(self)) {
38290 #if PY_VERSION_HEX < 0x03060000
38291             msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
38292 #else
38293             msg = "async generator ignored GeneratorExit";
38294 #endif
38295         #endif
38296         } else {
38297             msg = "generator ignored GeneratorExit";
38298         }
38299         PyErr_SetString(PyExc_RuntimeError, msg);
38300         return NULL;
38301     }
38302     raised_exception = PyErr_Occurred();
38303     if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
38304         if (raised_exception) PyErr_Clear();
38305         Py_INCREF(Py_None);
38306         return Py_None;
38307     }
38308     return NULL;
38309 }
38310 static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
38311                                         PyObject *args, int close_on_genexit) {
38312     __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
38313     PyObject *yf = gen->yieldfrom;
38314     if (unlikely(gen->is_running))
38315         return __Pyx_Coroutine_AlreadyRunningError(gen);
38316     if (yf) {
38317         PyObject *ret;
38318         Py_INCREF(yf);
38319         if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
38320             int err = __Pyx_Coroutine_CloseIter(gen, yf);
38321             Py_DECREF(yf);
38322             __Pyx_Coroutine_Undelegate(gen);
38323             if (err < 0)
38324                 return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
38325             goto throw_here;
38326         }
38327         gen->is_running = 1;
38328         if (0
38329         #ifdef __Pyx_Generator_USED
38330             || __Pyx_Generator_CheckExact(yf)
38331         #endif
38332         #ifdef __Pyx_Coroutine_USED
38333             || __Pyx_Coroutine_Check(yf)
38334         #endif
38335             ) {
38336             ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
38337         #ifdef __Pyx_Coroutine_USED
38338         } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
38339             ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
38340         #endif
38341         } else {
38342             PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
38343             if (unlikely(!meth)) {
38344                 Py_DECREF(yf);
38345                 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
38346                     gen->is_running = 0;
38347                     return NULL;
38348                 }
38349                 PyErr_Clear();
38350                 __Pyx_Coroutine_Undelegate(gen);
38351                 gen->is_running = 0;
38352                 goto throw_here;
38353             }
38354             if (likely(args)) {
38355                 ret = PyObject_CallObject(meth, args);
38356             } else {
38357                 ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL);
38358             }
38359             Py_DECREF(meth);
38360         }
38361         gen->is_running = 0;
38362         Py_DECREF(yf);
38363         if (!ret) {
38364             ret = __Pyx_Coroutine_FinishDelegation(gen);
38365         }
38366         return __Pyx_Coroutine_MethodReturn(self, ret);
38367     }
38368 throw_here:
38369     __Pyx_Raise(typ, val, tb, NULL);
38370     return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
38371 }
38372 static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
38373     PyObject *typ;
38374     PyObject *val = NULL;
38375     PyObject *tb = NULL;
38376     if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
38377         return NULL;
38378     return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
38379 }
38380 static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
38381     Py_VISIT(exc_state->exc_type);
38382     Py_VISIT(exc_state->exc_value);
38383     Py_VISIT(exc_state->exc_traceback);
38384     return 0;
38385 }
38386 static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
38387     Py_VISIT(gen->closure);
38388     Py_VISIT(gen->classobj);
38389     Py_VISIT(gen->yieldfrom);
38390     return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
38391 }
38392 static int __Pyx_Coroutine_clear(PyObject *self) {
38393     __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
38394     Py_CLEAR(gen->closure);
38395     Py_CLEAR(gen->classobj);
38396     Py_CLEAR(gen->yieldfrom);
38397     __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
38398 #ifdef __Pyx_AsyncGen_USED
38399     if (__Pyx_AsyncGen_CheckExact(self)) {
38400         Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
38401     }
38402 #endif
38403     Py_CLEAR(gen->gi_code);
38404     Py_CLEAR(gen->gi_name);
38405     Py_CLEAR(gen->gi_qualname);
38406     Py_CLEAR(gen->gi_modulename);
38407     return 0;
38408 }
38409 static void __Pyx_Coroutine_dealloc(PyObject *self) {
38410     __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
38411     PyObject_GC_UnTrack(gen);
38412     if (gen->gi_weakreflist != NULL)
38413         PyObject_ClearWeakRefs(self);
38414     if (gen->resume_label >= 0) {
38415         PyObject_GC_Track(self);
38416 #if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE
38417         if (PyObject_CallFinalizerFromDealloc(self))
38418 #else
38419         Py_TYPE(gen)->tp_del(self);
38420         if (self->ob_refcnt > 0)
38421 #endif
38422         {
38423             return;
38424         }
38425         PyObject_GC_UnTrack(self);
38426     }
38427 #ifdef __Pyx_AsyncGen_USED
38428     if (__Pyx_AsyncGen_CheckExact(self)) {
38429         /* We have to handle this case for asynchronous generators
38430            right here, because this code has to be between UNTRACK
38431            and GC_Del. */
38432         Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
38433     }
38434 #endif
38435     __Pyx_Coroutine_clear(self);
38436     PyObject_GC_Del(gen);
38437 }
38438 static void __Pyx_Coroutine_del(PyObject *self) {
38439     PyObject *error_type, *error_value, *error_traceback;
38440     __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
38441     __Pyx_PyThreadState_declare
38442     if (gen->resume_label < 0) {
38443         return;
38444     }
38445 #if !CYTHON_USE_TP_FINALIZE
38446     assert(self->ob_refcnt == 0);
38447     self->ob_refcnt = 1;
38448 #endif
38449     __Pyx_PyThreadState_assign
38450     __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
38451 #ifdef __Pyx_AsyncGen_USED
38452     if (__Pyx_AsyncGen_CheckExact(self)) {
38453         __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
38454         PyObject *finalizer = agen->ag_finalizer;
38455         if (finalizer && !agen->ag_closed) {
38456             PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
38457             if (unlikely(!res)) {
38458                 PyErr_WriteUnraisable(self);
38459             } else {
38460                 Py_DECREF(res);
38461             }
38462             __Pyx_ErrRestore(error_type, error_value, error_traceback);
38463             return;
38464         }
38465     }
38466 #endif
38467     if (unlikely(gen->resume_label == 0 && !error_value)) {
38468 #ifdef __Pyx_Coroutine_USED
38469 #ifdef __Pyx_Generator_USED
38470     if (!__Pyx_Generator_CheckExact(self))
38471 #endif
38472         {
38473         PyObject_GC_UnTrack(self);
38474 #if PY_MAJOR_VERSION >= 3  || defined(PyErr_WarnFormat)
38475         if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
38476             PyErr_WriteUnraisable(self);
38477 #else
38478         {PyObject *msg;
38479         char *cmsg;
38480         #if CYTHON_COMPILING_IN_PYPY
38481         msg = NULL;
38482         cmsg = (char*) "coroutine was never awaited";
38483         #else
38484         char *cname;
38485         PyObject *qualname;
38486         qualname = gen->gi_qualname;
38487         cname = PyString_AS_STRING(qualname);
38488         msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
38489         if (unlikely(!msg)) {
38490             PyErr_Clear();
38491             cmsg = (char*) "coroutine was never awaited";
38492         } else {
38493             cmsg = PyString_AS_STRING(msg);
38494         }
38495         #endif
38496         if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
38497             PyErr_WriteUnraisable(self);
38498         Py_XDECREF(msg);}
38499 #endif
38500         PyObject_GC_Track(self);
38501         }
38502 #endif
38503     } else {
38504         PyObject *res = __Pyx_Coroutine_Close(self);
38505         if (unlikely(!res)) {
38506             if (PyErr_Occurred())
38507                 PyErr_WriteUnraisable(self);
38508         } else {
38509             Py_DECREF(res);
38510         }
38511     }
38512     __Pyx_ErrRestore(error_type, error_value, error_traceback);
38513 #if !CYTHON_USE_TP_FINALIZE
38514     assert(self->ob_refcnt > 0);
38515     if (--self->ob_refcnt == 0) {
38516         return;
38517     }
38518     {
38519         Py_ssize_t refcnt = self->ob_refcnt;
38520         _Py_NewReference(self);
38521         self->ob_refcnt = refcnt;
38522     }
38523 #if CYTHON_COMPILING_IN_CPYTHON
38524     assert(PyType_IS_GC(self->ob_type) &&
38525            _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
38526     _Py_DEC_REFTOTAL;
38527 #endif
38528 #ifdef COUNT_ALLOCS
38529     --Py_TYPE(self)->tp_frees;
38530     --Py_TYPE(self)->tp_allocs;
38531 #endif
38532 #endif
38533 }
38534 static PyObject *
38535 __Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
38536 {
38537     PyObject *name = self->gi_name;
38538     if (unlikely(!name)) name = Py_None;
38539     Py_INCREF(name);
38540     return name;
38541 }
38542 static int
38543 __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
38544 {
38545     PyObject *tmp;
38546 #if PY_MAJOR_VERSION >= 3
38547     if (unlikely(value == NULL || !PyUnicode_Check(value)))
38548 #else
38549     if (unlikely(value == NULL || !PyString_Check(value)))
38550 #endif
38551     {
38552         PyErr_SetString(PyExc_TypeError,
38553                         "__name__ must be set to a string object");
38554         return -1;
38555     }
38556     tmp = self->gi_name;
38557     Py_INCREF(value);
38558     self->gi_name = value;
38559     Py_XDECREF(tmp);
38560     return 0;
38561 }
38562 static PyObject *
38563 __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
38564 {
38565     PyObject *name = self->gi_qualname;
38566     if (unlikely(!name)) name = Py_None;
38567     Py_INCREF(name);
38568     return name;
38569 }
38570 static int
38571 __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
38572 {
38573     PyObject *tmp;
38574 #if PY_MAJOR_VERSION >= 3
38575     if (unlikely(value == NULL || !PyUnicode_Check(value)))
38576 #else
38577     if (unlikely(value == NULL || !PyString_Check(value)))
38578 #endif
38579     {
38580         PyErr_SetString(PyExc_TypeError,
38581                         "__qualname__ must be set to a string object");
38582         return -1;
38583     }
38584     tmp = self->gi_qualname;
38585     Py_INCREF(value);
38586     self->gi_qualname = value;
38587     Py_XDECREF(tmp);
38588     return 0;
38589 }
38590 static __pyx_CoroutineObject *__Pyx__Coroutine_New(
38591             PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
38592             PyObject *name, PyObject *qualname, PyObject *module_name) {
38593     __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
38594     if (unlikely(!gen))
38595         return NULL;
38596     return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
38597 }
38598 static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
38599             __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
38600             PyObject *name, PyObject *qualname, PyObject *module_name) {
38601     gen->body = body;
38602     gen->closure = closure;
38603     Py_XINCREF(closure);
38604     gen->is_running = 0;
38605     gen->resume_label = 0;
38606     gen->classobj = NULL;
38607     gen->yieldfrom = NULL;
38608     gen->gi_exc_state.exc_type = NULL;
38609     gen->gi_exc_state.exc_value = NULL;
38610     gen->gi_exc_state.exc_traceback = NULL;
38611 #if CYTHON_USE_EXC_INFO_STACK
38612     gen->gi_exc_state.previous_item = NULL;
38613 #endif
38614     gen->gi_weakreflist = NULL;
38615     Py_XINCREF(qualname);
38616     gen->gi_qualname = qualname;
38617     Py_XINCREF(name);
38618     gen->gi_name = name;
38619     Py_XINCREF(module_name);
38620     gen->gi_modulename = module_name;
38621     Py_XINCREF(code);
38622     gen->gi_code = code;
38623     PyObject_GC_Track(gen);
38624     return gen;
38625 }
38626 
38627 /* PatchModuleWithCoroutine */
38628   static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
38629 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
38630     int result;
38631     PyObject *globals, *result_obj;
38632     globals = PyDict_New();  if (unlikely(!globals)) goto ignore;
38633     result = PyDict_SetItemString(globals, "_cython_coroutine_type",
38634     #ifdef __Pyx_Coroutine_USED
38635         (PyObject*)__pyx_CoroutineType);
38636     #else
38637         Py_None);
38638     #endif
38639     if (unlikely(result < 0)) goto ignore;
38640     result = PyDict_SetItemString(globals, "_cython_generator_type",
38641     #ifdef __Pyx_Generator_USED
38642         (PyObject*)__pyx_GeneratorType);
38643     #else
38644         Py_None);
38645     #endif
38646     if (unlikely(result < 0)) goto ignore;
38647     if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
38648     if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
38649     result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
38650     if (unlikely(!result_obj)) goto ignore;
38651     Py_DECREF(result_obj);
38652     Py_DECREF(globals);
38653     return module;
38654 ignore:
38655     Py_XDECREF(globals);
38656     PyErr_WriteUnraisable(module);
38657     if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
38658         Py_DECREF(module);
38659         module = NULL;
38660     }
38661 #else
38662     py_code++;
38663 #endif
38664     return module;
38665 }
38666 
38667 /* PatchGeneratorABC */
38668   #ifndef CYTHON_REGISTER_ABCS
38669 #define CYTHON_REGISTER_ABCS 1
38670 #endif
38671 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
38672 static PyObject* __Pyx_patch_abc_module(PyObject *module);
38673 static PyObject* __Pyx_patch_abc_module(PyObject *module) {
38674     module = __Pyx_Coroutine_patch_module(
38675         module, ""
38676 "if _cython_generator_type is not None:\n"
38677 "    try: Generator = _module.Generator\n"
38678 "    except AttributeError: pass\n"
38679 "    else: Generator.register(_cython_generator_type)\n"
38680 "if _cython_coroutine_type is not None:\n"
38681 "    try: Coroutine = _module.Coroutine\n"
38682 "    except AttributeError: pass\n"
38683 "    else: Coroutine.register(_cython_coroutine_type)\n"
38684     );
38685     return module;
38686 }
38687 #endif
38688 static int __Pyx_patch_abc(void) {
38689 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
38690     static int abc_patched = 0;
38691     if (CYTHON_REGISTER_ABCS && !abc_patched) {
38692         PyObject *module;
38693         module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
38694         if (!module) {
38695             PyErr_WriteUnraisable(NULL);
38696             if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
38697                     ((PY_MAJOR_VERSION >= 3) ?
38698                         "Cython module failed to register with collections.abc module" :
38699                         "Cython module failed to register with collections module"), 1) < 0)) {
38700                 return -1;
38701             }
38702         } else {
38703             module = __Pyx_patch_abc_module(module);
38704             abc_patched = 1;
38705             if (unlikely(!module))
38706                 return -1;
38707             Py_DECREF(module);
38708         }
38709         module = PyImport_ImportModule("backports_abc");
38710         if (module) {
38711             module = __Pyx_patch_abc_module(module);
38712             Py_XDECREF(module);
38713         }
38714         if (!module) {
38715             PyErr_Clear();
38716         }
38717     }
38718 #else
38719     if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
38720 #endif
38721     return 0;
38722 }
38723 
38724 /* Generator */
38725   static PyMethodDef __pyx_Generator_methods[] = {
38726     {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
38727      (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
38728     {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
38729      (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
38730     {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
38731      (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
38732     {0, 0, 0, 0}
38733 };
38734 static PyMemberDef __pyx_Generator_memberlist[] = {
38735     {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
38736     {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
38737      (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
38738     {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
38739     {0, 0, 0, 0, 0}
38740 };
38741 static PyGetSetDef __pyx_Generator_getsets[] = {
38742     {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
38743      (char*) PyDoc_STR("name of the generator"), 0},
38744     {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
38745      (char*) PyDoc_STR("qualified name of the generator"), 0},
38746     {0, 0, 0, 0, 0}
38747 };
38748 static PyTypeObject __pyx_GeneratorType_type = {
38749     PyVarObject_HEAD_INIT(0, 0)
38750     "generator",
38751     sizeof(__pyx_CoroutineObject),
38752     0,
38753     (destructor) __Pyx_Coroutine_dealloc,
38754     0,
38755     0,
38756     0,
38757     0,
38758     0,
38759     0,
38760     0,
38761     0,
38762     0,
38763     0,
38764     0,
38765     0,
38766     0,
38767     0,
38768     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
38769     0,
38770     (traverseproc) __Pyx_Coroutine_traverse,
38771     0,
38772     0,
38773     offsetof(__pyx_CoroutineObject, gi_weakreflist),
38774     0,
38775     (iternextfunc) __Pyx_Generator_Next,
38776     __pyx_Generator_methods,
38777     __pyx_Generator_memberlist,
38778     __pyx_Generator_getsets,
38779     0,
38780     0,
38781     0,
38782     0,
38783     0,
38784     0,
38785     0,
38786     0,
38787     0,
38788     0,
38789     0,
38790     0,
38791     0,
38792     0,
38793     0,
38794 #if CYTHON_USE_TP_FINALIZE
38795     0,
38796 #else
38797     __Pyx_Coroutine_del,
38798 #endif
38799     0,
38800 #if CYTHON_USE_TP_FINALIZE
38801     __Pyx_Coroutine_del,
38802 #elif PY_VERSION_HEX >= 0x030400a1
38803     0,
38804 #endif
38805 #if PY_VERSION_HEX >= 0x030800b1
38806     0,
38807 #endif
38808 };
38809 static int __pyx_Generator_init(void) {
38810     __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
38811     __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
38812     __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
38813     if (unlikely(!__pyx_GeneratorType)) {
38814         return -1;
38815     }
38816     return 0;
38817 }
38818 
38819 /* ObjectToMemviewSlice */
38820   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_uint8_t(PyObject *obj, int writable_flag) {
38821     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
38822     __Pyx_BufFmt_StackElem stack[1];
38823     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
38824     int retcode;
38825     if (obj == Py_None) {
38826         result.memview = (struct __pyx_memoryview_obj *) Py_None;
38827         return result;
38828     }
38829     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
38830                                                  PyBUF_RECORDS_RO | writable_flag, 1,
38831                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, stack,
38832                                                  &result, obj);
38833     if (unlikely(retcode == -1))
38834         goto __pyx_fail;
38835     return result;
38836 __pyx_fail:
38837     result.memview = NULL;
38838     result.data = NULL;
38839     return result;
38840 }
38841 
38842 /* ObjectToMemviewSlice */
38843   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_nn___pyx_t_5numpy_float64_t(PyObject *obj, int writable_flag) {
38844     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
38845     __Pyx_BufFmt_StackElem stack[1];
38846     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
38847     int retcode;
38848     if (obj == Py_None) {
38849         result.memview = (struct __pyx_memoryview_obj *) Py_None;
38850         return result;
38851     }
38852     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
38853                                                  PyBUF_RECORDS_RO | writable_flag, 3,
38854                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, stack,
38855                                                  &result, obj);
38856     if (unlikely(retcode == -1))
38857         goto __pyx_fail;
38858     return result;
38859 __pyx_fail:
38860     result.memview = NULL;
38861     result.data = NULL;
38862     return result;
38863 }
38864 
38865 /* CheckBinaryVersion */
38866   static int __Pyx_check_binary_version(void) {
38867     char ctversion[4], rtversion[4];
38868     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
38869     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
38870     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
38871         char message[200];
38872         PyOS_snprintf(message, sizeof(message),
38873                       "compiletime version %s of module '%.100s' "
38874                       "does not match runtime version %s",
38875                       ctversion, __Pyx_MODULE_NAME, rtversion);
38876         return PyErr_WarnEx(NULL, message, 1);
38877     }
38878     return 0;
38879 }
38880 
38881 /* InitStrings */
38882   static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
38883     while (t->p) {
38884         #if PY_MAJOR_VERSION < 3
38885         if (t->is_unicode) {
38886             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
38887         } else if (t->intern) {
38888             *t->p = PyString_InternFromString(t->s);
38889         } else {
38890             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
38891         }
38892         #else
38893         if (t->is_unicode | t->is_str) {
38894             if (t->intern) {
38895                 *t->p = PyUnicode_InternFromString(t->s);
38896             } else if (t->encoding) {
38897                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
38898             } else {
38899                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
38900             }
38901         } else {
38902             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
38903         }
38904         #endif
38905         if (!*t->p)
38906             return -1;
38907         if (PyObject_Hash(*t->p) == -1)
38908             return -1;
38909         ++t;
38910     }
38911     return 0;
38912 }
38913 
38914 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
38915     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
38916 }
38917 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
38918     Py_ssize_t ignore;
38919     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
38920 }
38921 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
38922 #if !CYTHON_PEP393_ENABLED
38923 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
38924     char* defenc_c;
38925     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
38926     if (!defenc) return NULL;
38927     defenc_c = PyBytes_AS_STRING(defenc);
38928 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
38929     {
38930         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
38931         char* c;
38932         for (c = defenc_c; c < end; c++) {
38933             if ((unsigned char) (*c) >= 128) {
38934                 PyUnicode_AsASCIIString(o);
38935                 return NULL;
38936             }
38937         }
38938     }
38939 #endif
38940     *length = PyBytes_GET_SIZE(defenc);
38941     return defenc_c;
38942 }
38943 #else
38944 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
38945     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
38946 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
38947     if (likely(PyUnicode_IS_ASCII(o))) {
38948         *length = PyUnicode_GET_LENGTH(o);
38949         return PyUnicode_AsUTF8(o);
38950     } else {
38951         PyUnicode_AsASCIIString(o);
38952         return NULL;
38953     }
38954 #else
38955     return PyUnicode_AsUTF8AndSize(o, length);
38956 #endif
38957 }
38958 #endif
38959 #endif
38960 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
38961 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
38962     if (
38963 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
38964             __Pyx_sys_getdefaultencoding_not_ascii &&
38965 #endif
38966             PyUnicode_Check(o)) {
38967         return __Pyx_PyUnicode_AsStringAndSize(o, length);
38968     } else
38969 #endif
38970 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
38971     if (PyByteArray_Check(o)) {
38972         *length = PyByteArray_GET_SIZE(o);
38973         return PyByteArray_AS_STRING(o);
38974     } else
38975 #endif
38976     {
38977         char* result;
38978         int r = PyBytes_AsStringAndSize(o, &result, length);
38979         if (unlikely(r < 0)) {
38980             return NULL;
38981         } else {
38982             return result;
38983         }
38984     }
38985 }
38986 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
38987    int is_true = x == Py_True;
38988    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
38989    else return PyObject_IsTrue(x);
38990 }
38991 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
38992     int retval;
38993     if (unlikely(!x)) return -1;
38994     retval = __Pyx_PyObject_IsTrue(x);
38995     Py_DECREF(x);
38996     return retval;
38997 }
38998 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
38999 #if PY_MAJOR_VERSION >= 3
39000     if (PyLong_Check(result)) {
39001         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
39002                 "__int__ returned non-int (type %.200s).  "
39003                 "The ability to return an instance of a strict subclass of int "
39004                 "is deprecated, and may be removed in a future version of Python.",
39005                 Py_TYPE(result)->tp_name)) {
39006             Py_DECREF(result);
39007             return NULL;
39008         }
39009         return result;
39010     }
39011 #endif
39012     PyErr_Format(PyExc_TypeError,
39013                  "__%.4s__ returned non-%.4s (type %.200s)",
39014                  type_name, type_name, Py_TYPE(result)->tp_name);
39015     Py_DECREF(result);
39016     return NULL;
39017 }
39018 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
39019 #if CYTHON_USE_TYPE_SLOTS
39020   PyNumberMethods *m;
39021 #endif
39022   const char *name = NULL;
39023   PyObject *res = NULL;
39024 #if PY_MAJOR_VERSION < 3
39025   if (likely(PyInt_Check(x) || PyLong_Check(x)))
39026 #else
39027   if (likely(PyLong_Check(x)))
39028 #endif
39029     return __Pyx_NewRef(x);
39030 #if CYTHON_USE_TYPE_SLOTS
39031   m = Py_TYPE(x)->tp_as_number;
39032   #if PY_MAJOR_VERSION < 3
39033   if (m && m->nb_int) {
39034     name = "int";
39035     res = m->nb_int(x);
39036   }
39037   else if (m && m->nb_long) {
39038     name = "long";
39039     res = m->nb_long(x);
39040   }
39041   #else
39042   if (likely(m && m->nb_int)) {
39043     name = "int";
39044     res = m->nb_int(x);
39045   }
39046   #endif
39047 #else
39048   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
39049     res = PyNumber_Int(x);
39050   }
39051 #endif
39052   if (likely(res)) {
39053 #if PY_MAJOR_VERSION < 3
39054     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
39055 #else
39056     if (unlikely(!PyLong_CheckExact(res))) {
39057 #endif
39058         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
39059     }
39060   }
39061   else if (!PyErr_Occurred()) {
39062     PyErr_SetString(PyExc_TypeError,
39063                     "an integer is required");
39064   }
39065   return res;
39066 }
39067 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
39068   Py_ssize_t ival;
39069   PyObject *x;
39070 #if PY_MAJOR_VERSION < 3
39071   if (likely(PyInt_CheckExact(b))) {
39072     if (sizeof(Py_ssize_t) >= sizeof(long))
39073         return PyInt_AS_LONG(b);
39074     else
39075         return PyInt_AsSsize_t(b);
39076   }
39077 #endif
39078   if (likely(PyLong_CheckExact(b))) {
39079     #if CYTHON_USE_PYLONG_INTERNALS
39080     const digit* digits = ((PyLongObject*)b)->ob_digit;
39081     const Py_ssize_t size = Py_SIZE(b);
39082     if (likely(__Pyx_sst_abs(size) <= 1)) {
39083         ival = likely(size) ? digits[0] : 0;
39084         if (size == -1) ival = -ival;
39085         return ival;
39086     } else {
39087       switch (size) {
39088          case 2:
39089            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
39090              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
39091            }
39092            break;
39093          case -2:
39094            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
39095              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
39096            }
39097            break;
39098          case 3:
39099            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
39100              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
39101            }
39102            break;
39103          case -3:
39104            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
39105              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
39106            }
39107            break;
39108          case 4:
39109            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
39110              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]));
39111            }
39112            break;
39113          case -4:
39114            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
39115              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]));
39116            }
39117            break;
39118       }
39119     }
39120     #endif
39121     return PyLong_AsSsize_t(b);
39122   }
39123   x = PyNumber_Index(b);
39124   if (!x) return -1;
39125   ival = PyInt_AsSsize_t(x);
39126   Py_DECREF(x);
39127   return ival;
39128 }
39129 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
39130   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
39131 }
39132 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
39133     return PyInt_FromSize_t(ival);
39134 }
39135 
39136 
39137 #endif /* Py_PYTHON_H */
39138