1 /* Generated by Cython 0.29.12 */
2 
3 /* BEGIN: Cython Metadata
4 {
5     "distutils": {
6         "depends": [
7             "yt/utilities/lib/platform_dep.h"
8         ],
9         "extra_compile_args": [
10             "-std=c++14",
11             "-fopenmp"
12         ],
13         "extra_link_args": [
14             "-std=c++14",
15             "-fopenmp"
16         ],
17         "include_dirs": [
18             "yt/utilities/lib"
19         ],
20         "language": "c++",
21         "libraries": [
22             "m"
23         ],
24         "name": "yt.utilities.lib.geometry_utils",
25         "sources": [
26             "yt/utilities/lib/geometry_utils.pyx"
27         ]
28     },
29     "module_name": "yt.utilities.lib.geometry_utils"
30 }
31 END: Cython Metadata */
32 
33 #define PY_SSIZE_T_CLEAN
34 #include "Python.h"
35 #ifndef Py_PYTHON_H
36     #error Python headers needed to compile C extensions, please install development version of Python.
37 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
38     #error Cython requires Python 2.6+ or Python 3.3+.
39 #else
40 #define CYTHON_ABI "0_29_12"
41 #define CYTHON_HEX_VERSION 0x001D0CF0
42 #define CYTHON_FUTURE_DIVISION 0
43 #include <stddef.h>
44 #ifndef offsetof
45   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
46 #endif
47 #if !defined(WIN32) && !defined(MS_WINDOWS)
48   #ifndef __stdcall
49     #define __stdcall
50   #endif
51   #ifndef __cdecl
52     #define __cdecl
53   #endif
54   #ifndef __fastcall
55     #define __fastcall
56   #endif
57 #endif
58 #ifndef DL_IMPORT
59   #define DL_IMPORT(t) t
60 #endif
61 #ifndef DL_EXPORT
62   #define DL_EXPORT(t) t
63 #endif
64 #define __PYX_COMMA ,
65 #ifndef HAVE_LONG_LONG
66   #if PY_VERSION_HEX >= 0x02070000
67     #define HAVE_LONG_LONG
68   #endif
69 #endif
70 #ifndef PY_LONG_LONG
71   #define PY_LONG_LONG LONG_LONG
72 #endif
73 #ifndef Py_HUGE_VAL
74   #define Py_HUGE_VAL HUGE_VAL
75 #endif
76 #ifdef PYPY_VERSION
77   #define CYTHON_COMPILING_IN_PYPY 1
78   #define CYTHON_COMPILING_IN_PYSTON 0
79   #define CYTHON_COMPILING_IN_CPYTHON 0
80   #undef CYTHON_USE_TYPE_SLOTS
81   #define CYTHON_USE_TYPE_SLOTS 0
82   #undef CYTHON_USE_PYTYPE_LOOKUP
83   #define CYTHON_USE_PYTYPE_LOOKUP 0
84   #if PY_VERSION_HEX < 0x03050000
85     #undef CYTHON_USE_ASYNC_SLOTS
86     #define CYTHON_USE_ASYNC_SLOTS 0
87   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
88     #define CYTHON_USE_ASYNC_SLOTS 1
89   #endif
90   #undef CYTHON_USE_PYLIST_INTERNALS
91   #define CYTHON_USE_PYLIST_INTERNALS 0
92   #undef CYTHON_USE_UNICODE_INTERNALS
93   #define CYTHON_USE_UNICODE_INTERNALS 0
94   #undef CYTHON_USE_UNICODE_WRITER
95   #define CYTHON_USE_UNICODE_WRITER 0
96   #undef CYTHON_USE_PYLONG_INTERNALS
97   #define CYTHON_USE_PYLONG_INTERNALS 0
98   #undef CYTHON_AVOID_BORROWED_REFS
99   #define CYTHON_AVOID_BORROWED_REFS 1
100   #undef CYTHON_ASSUME_SAFE_MACROS
101   #define CYTHON_ASSUME_SAFE_MACROS 0
102   #undef CYTHON_UNPACK_METHODS
103   #define CYTHON_UNPACK_METHODS 0
104   #undef CYTHON_FAST_THREAD_STATE
105   #define CYTHON_FAST_THREAD_STATE 0
106   #undef CYTHON_FAST_PYCALL
107   #define CYTHON_FAST_PYCALL 0
108   #undef CYTHON_PEP489_MULTI_PHASE_INIT
109   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
110   #undef CYTHON_USE_TP_FINALIZE
111   #define CYTHON_USE_TP_FINALIZE 0
112   #undef CYTHON_USE_DICT_VERSIONS
113   #define CYTHON_USE_DICT_VERSIONS 0
114   #undef CYTHON_USE_EXC_INFO_STACK
115   #define CYTHON_USE_EXC_INFO_STACK 0
116 #elif defined(PYSTON_VERSION)
117   #define CYTHON_COMPILING_IN_PYPY 0
118   #define CYTHON_COMPILING_IN_PYSTON 1
119   #define CYTHON_COMPILING_IN_CPYTHON 0
120   #ifndef CYTHON_USE_TYPE_SLOTS
121     #define CYTHON_USE_TYPE_SLOTS 1
122   #endif
123   #undef CYTHON_USE_PYTYPE_LOOKUP
124   #define CYTHON_USE_PYTYPE_LOOKUP 0
125   #undef CYTHON_USE_ASYNC_SLOTS
126   #define CYTHON_USE_ASYNC_SLOTS 0
127   #undef CYTHON_USE_PYLIST_INTERNALS
128   #define CYTHON_USE_PYLIST_INTERNALS 0
129   #ifndef CYTHON_USE_UNICODE_INTERNALS
130     #define CYTHON_USE_UNICODE_INTERNALS 1
131   #endif
132   #undef CYTHON_USE_UNICODE_WRITER
133   #define CYTHON_USE_UNICODE_WRITER 0
134   #undef CYTHON_USE_PYLONG_INTERNALS
135   #define CYTHON_USE_PYLONG_INTERNALS 0
136   #ifndef CYTHON_AVOID_BORROWED_REFS
137     #define CYTHON_AVOID_BORROWED_REFS 0
138   #endif
139   #ifndef CYTHON_ASSUME_SAFE_MACROS
140     #define CYTHON_ASSUME_SAFE_MACROS 1
141   #endif
142   #ifndef CYTHON_UNPACK_METHODS
143     #define CYTHON_UNPACK_METHODS 1
144   #endif
145   #undef CYTHON_FAST_THREAD_STATE
146   #define CYTHON_FAST_THREAD_STATE 0
147   #undef CYTHON_FAST_PYCALL
148   #define CYTHON_FAST_PYCALL 0
149   #undef CYTHON_PEP489_MULTI_PHASE_INIT
150   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
151   #undef CYTHON_USE_TP_FINALIZE
152   #define CYTHON_USE_TP_FINALIZE 0
153   #undef CYTHON_USE_DICT_VERSIONS
154   #define CYTHON_USE_DICT_VERSIONS 0
155   #undef CYTHON_USE_EXC_INFO_STACK
156   #define CYTHON_USE_EXC_INFO_STACK 0
157 #else
158   #define CYTHON_COMPILING_IN_PYPY 0
159   #define CYTHON_COMPILING_IN_PYSTON 0
160   #define CYTHON_COMPILING_IN_CPYTHON 1
161   #ifndef CYTHON_USE_TYPE_SLOTS
162     #define CYTHON_USE_TYPE_SLOTS 1
163   #endif
164   #if PY_VERSION_HEX < 0x02070000
165     #undef CYTHON_USE_PYTYPE_LOOKUP
166     #define CYTHON_USE_PYTYPE_LOOKUP 0
167   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
168     #define CYTHON_USE_PYTYPE_LOOKUP 1
169   #endif
170   #if PY_MAJOR_VERSION < 3
171     #undef CYTHON_USE_ASYNC_SLOTS
172     #define CYTHON_USE_ASYNC_SLOTS 0
173   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
174     #define CYTHON_USE_ASYNC_SLOTS 1
175   #endif
176   #if PY_VERSION_HEX < 0x02070000
177     #undef CYTHON_USE_PYLONG_INTERNALS
178     #define CYTHON_USE_PYLONG_INTERNALS 0
179   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
180     #define CYTHON_USE_PYLONG_INTERNALS 1
181   #endif
182   #ifndef CYTHON_USE_PYLIST_INTERNALS
183     #define CYTHON_USE_PYLIST_INTERNALS 1
184   #endif
185   #ifndef CYTHON_USE_UNICODE_INTERNALS
186     #define CYTHON_USE_UNICODE_INTERNALS 1
187   #endif
188   #if PY_VERSION_HEX < 0x030300F0
189     #undef CYTHON_USE_UNICODE_WRITER
190     #define CYTHON_USE_UNICODE_WRITER 0
191   #elif !defined(CYTHON_USE_UNICODE_WRITER)
192     #define CYTHON_USE_UNICODE_WRITER 1
193   #endif
194   #ifndef CYTHON_AVOID_BORROWED_REFS
195     #define CYTHON_AVOID_BORROWED_REFS 0
196   #endif
197   #ifndef CYTHON_ASSUME_SAFE_MACROS
198     #define CYTHON_ASSUME_SAFE_MACROS 1
199   #endif
200   #ifndef CYTHON_UNPACK_METHODS
201     #define CYTHON_UNPACK_METHODS 1
202   #endif
203   #ifndef CYTHON_FAST_THREAD_STATE
204     #define CYTHON_FAST_THREAD_STATE 1
205   #endif
206   #ifndef CYTHON_FAST_PYCALL
207     #define CYTHON_FAST_PYCALL 1
208   #endif
209   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
210     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
211   #endif
212   #ifndef CYTHON_USE_TP_FINALIZE
213     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
214   #endif
215   #ifndef CYTHON_USE_DICT_VERSIONS
216     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
217   #endif
218   #ifndef CYTHON_USE_EXC_INFO_STACK
219     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
220   #endif
221 #endif
222 #if !defined(CYTHON_FAST_PYCCALL)
223 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
224 #endif
225 #if CYTHON_USE_PYLONG_INTERNALS
226   #include "longintrepr.h"
227   #undef SHIFT
228   #undef BASE
229   #undef MASK
230   #ifdef SIZEOF_VOID_P
231     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
232   #endif
233 #endif
234 #ifndef __has_attribute
235   #define __has_attribute(x) 0
236 #endif
237 #ifndef __has_cpp_attribute
238   #define __has_cpp_attribute(x) 0
239 #endif
240 #ifndef CYTHON_RESTRICT
241   #if defined(__GNUC__)
242     #define CYTHON_RESTRICT __restrict__
243   #elif defined(_MSC_VER) && _MSC_VER >= 1400
244     #define CYTHON_RESTRICT __restrict
245   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
246     #define CYTHON_RESTRICT restrict
247   #else
248     #define CYTHON_RESTRICT
249   #endif
250 #endif
251 #ifndef CYTHON_UNUSED
252 # if defined(__GNUC__)
253 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
254 #     define CYTHON_UNUSED __attribute__ ((__unused__))
255 #   else
256 #     define CYTHON_UNUSED
257 #   endif
258 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
259 #   define CYTHON_UNUSED __attribute__ ((__unused__))
260 # else
261 #   define CYTHON_UNUSED
262 # endif
263 #endif
264 #ifndef CYTHON_MAYBE_UNUSED_VAR
265 #  if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)266      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
267 #  else
268 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
269 #  endif
270 #endif
271 #ifndef CYTHON_NCP_UNUSED
272 # if CYTHON_COMPILING_IN_CPYTHON
273 #  define CYTHON_NCP_UNUSED
274 # else
275 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
276 # endif
277 #endif
278 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
279 #ifdef _MSC_VER
280     #ifndef _MSC_STDINT_H_
281         #if _MSC_VER < 1300
282            typedef unsigned char     uint8_t;
283            typedef unsigned int      uint32_t;
284         #else
285            typedef unsigned __int8   uint8_t;
286            typedef unsigned __int32  uint32_t;
287         #endif
288     #endif
289 #else
290    #include <stdint.h>
291 #endif
292 #ifndef CYTHON_FALLTHROUGH
293   #if defined(__cplusplus) && __cplusplus >= 201103L
294     #if __has_cpp_attribute(fallthrough)
295       #define CYTHON_FALLTHROUGH [[fallthrough]]
296     #elif __has_cpp_attribute(clang::fallthrough)
297       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
298     #elif __has_cpp_attribute(gnu::fallthrough)
299       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
300     #endif
301   #endif
302   #ifndef CYTHON_FALLTHROUGH
303     #if __has_attribute(fallthrough)
304       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
305     #else
306       #define CYTHON_FALLTHROUGH
307     #endif
308   #endif
309   #if defined(__clang__ ) && defined(__apple_build_version__)
310     #if __apple_build_version__ < 7000000
311       #undef  CYTHON_FALLTHROUGH
312       #define CYTHON_FALLTHROUGH
313     #endif
314   #endif
315 #endif
316 
317 #ifndef __cplusplus
318   #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
319 #endif
320 #ifndef CYTHON_INLINE
321   #if defined(__clang__)
322     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
323   #else
324     #define CYTHON_INLINE inline
325   #endif
326 #endif
327 template<typename T>
__Pyx_call_destructor(T & x)328 void __Pyx_call_destructor(T& x) {
329     x.~T();
330 }
331 template<typename T>
332 class __Pyx_FakeReference {
333   public:
__Pyx_FakeReference()334     __Pyx_FakeReference() : ptr(NULL) { }
__Pyx_FakeReference(const T & ref)335     __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
operator ->()336     T *operator->() { return ptr; }
operator &()337     T *operator&() { return ptr; }
operator T&()338     operator T&() { return *ptr; }
operator ==(U other)339     template<typename U> bool operator ==(U other) { return *ptr == other; }
operator !=(U other)340     template<typename U> bool operator !=(U other) { return *ptr != other; }
341   private:
342     T *ptr;
343 };
344 
345 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
346   #define Py_OptimizeFlag 0
347 #endif
348 #define __PYX_BUILD_PY_SSIZE_T "n"
349 #define CYTHON_FORMAT_SSIZE_T "z"
350 #if PY_MAJOR_VERSION < 3
351   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
352   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
353           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
354   #define __Pyx_DefaultClassType PyClass_Type
355 #else
356   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
357 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
358   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
359           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
360 #else
361   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
362           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
363 #endif
364   #define __Pyx_DefaultClassType PyType_Type
365 #endif
366 #ifndef Py_TPFLAGS_CHECKTYPES
367   #define Py_TPFLAGS_CHECKTYPES 0
368 #endif
369 #ifndef Py_TPFLAGS_HAVE_INDEX
370   #define Py_TPFLAGS_HAVE_INDEX 0
371 #endif
372 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
373   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
374 #endif
375 #ifndef Py_TPFLAGS_HAVE_FINALIZE
376   #define Py_TPFLAGS_HAVE_FINALIZE 0
377 #endif
378 #ifndef METH_STACKLESS
379   #define METH_STACKLESS 0
380 #endif
381 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
382   #ifndef METH_FASTCALL
383      #define METH_FASTCALL 0x80
384   #endif
385   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
386   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
387                                                           Py_ssize_t nargs, PyObject *kwnames);
388 #else
389   #define __Pyx_PyCFunctionFast _PyCFunctionFast
390   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
391 #endif
392 #if CYTHON_FAST_PYCCALL
393 #define __Pyx_PyFastCFunction_Check(func)\
394     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
395 #else
396 #define __Pyx_PyFastCFunction_Check(func) 0
397 #endif
398 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
399   #define PyObject_Malloc(s)   PyMem_Malloc(s)
400   #define PyObject_Free(p)     PyMem_Free(p)
401   #define PyObject_Realloc(p)  PyMem_Realloc(p)
402 #endif
403 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
404   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
405   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
406   #define PyMem_RawFree(p)             PyMem_Free(p)
407 #endif
408 #if CYTHON_COMPILING_IN_PYSTON
409   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
410   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
411 #else
412   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
413   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
414 #endif
415 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
416   #define __Pyx_PyThreadState_Current PyThreadState_GET()
417 #elif PY_VERSION_HEX >= 0x03060000
418   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
419 #elif PY_VERSION_HEX >= 0x03000000
420   #define __Pyx_PyThreadState_Current PyThreadState_GET()
421 #else
422   #define __Pyx_PyThreadState_Current _PyThreadState_Current
423 #endif
424 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
425 #include "pythread.h"
426 #define Py_tss_NEEDS_INIT 0
427 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)428 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
429   *key = PyThread_create_key();
430   return 0;
431 }
PyThread_tss_alloc(void)432 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
433   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
434   *key = Py_tss_NEEDS_INIT;
435   return key;
436 }
PyThread_tss_free(Py_tss_t * key)437 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
438   PyObject_Free(key);
439 }
PyThread_tss_is_created(Py_tss_t * key)440 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
441   return *key != Py_tss_NEEDS_INIT;
442 }
PyThread_tss_delete(Py_tss_t * key)443 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
444   PyThread_delete_key(*key);
445   *key = Py_tss_NEEDS_INIT;
446 }
PyThread_tss_set(Py_tss_t * key,void * value)447 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
448   return PyThread_set_key_value(*key, value);
449 }
PyThread_tss_get(Py_tss_t * key)450 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
451   return PyThread_get_key_value(*key);
452 }
453 #endif
454 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
455 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
456 #else
457 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
458 #endif
459 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
460   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
461   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
462 #else
463   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
464   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
465 #endif
466 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
467 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
468 #else
469 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
470 #endif
471 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
472   #define CYTHON_PEP393_ENABLED 1
473   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
474                                               0 : _PyUnicode_Ready((PyObject *)(op)))
475   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
476   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
477   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
478   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
479   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
480   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
481   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
482   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
483 #else
484   #define CYTHON_PEP393_ENABLED 0
485   #define PyUnicode_1BYTE_KIND  1
486   #define PyUnicode_2BYTE_KIND  2
487   #define PyUnicode_4BYTE_KIND  4
488   #define __Pyx_PyUnicode_READY(op)       (0)
489   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
490   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
491   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
492   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
493   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
494   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
495   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
496   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
497 #endif
498 #if CYTHON_COMPILING_IN_PYPY
499   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
500   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
501 #else
502   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
503   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
504       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
505 #endif
506 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
507   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
508 #endif
509 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
510   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
511 #endif
512 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
513   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
514 #endif
515 #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))
516 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
517 #if PY_MAJOR_VERSION >= 3
518   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
519 #else
520   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
521 #endif
522 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
523   #define PyObject_ASCII(o)            PyObject_Repr(o)
524 #endif
525 #if PY_MAJOR_VERSION >= 3
526   #define PyBaseString_Type            PyUnicode_Type
527   #define PyStringObject               PyUnicodeObject
528   #define PyString_Type                PyUnicode_Type
529   #define PyString_Check               PyUnicode_Check
530   #define PyString_CheckExact          PyUnicode_CheckExact
531   #define PyObject_Unicode             PyObject_Str
532 #endif
533 #if PY_MAJOR_VERSION >= 3
534   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
535   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
536 #else
537   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
538   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
539 #endif
540 #ifndef PySet_CheckExact
541   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
542 #endif
543 #if CYTHON_ASSUME_SAFE_MACROS
544   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
545 #else
546   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
547 #endif
548 #if PY_MAJOR_VERSION >= 3
549   #define PyIntObject                  PyLongObject
550   #define PyInt_Type                   PyLong_Type
551   #define PyInt_Check(op)              PyLong_Check(op)
552   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
553   #define PyInt_FromString             PyLong_FromString
554   #define PyInt_FromUnicode            PyLong_FromUnicode
555   #define PyInt_FromLong               PyLong_FromLong
556   #define PyInt_FromSize_t             PyLong_FromSize_t
557   #define PyInt_FromSsize_t            PyLong_FromSsize_t
558   #define PyInt_AsLong                 PyLong_AsLong
559   #define PyInt_AS_LONG                PyLong_AS_LONG
560   #define PyInt_AsSsize_t              PyLong_AsSsize_t
561   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
562   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
563   #define PyNumber_Int                 PyNumber_Long
564 #endif
565 #if PY_MAJOR_VERSION >= 3
566   #define PyBoolObject                 PyLongObject
567 #endif
568 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
569   #ifndef PyUnicode_InternFromString
570     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
571   #endif
572 #endif
573 #if PY_VERSION_HEX < 0x030200A4
574   typedef long Py_hash_t;
575   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
576   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
577 #else
578   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
579   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
580 #endif
581 #if PY_MAJOR_VERSION >= 3
582   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
583 #else
584   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
585 #endif
586 #if CYTHON_USE_ASYNC_SLOTS
587   #if PY_VERSION_HEX >= 0x030500B1
588     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
589     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
590   #else
591     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
592   #endif
593 #else
594   #define __Pyx_PyType_AsAsync(obj) NULL
595 #endif
596 #ifndef __Pyx_PyAsyncMethodsStruct
597     typedef struct {
598         unaryfunc am_await;
599         unaryfunc am_aiter;
600         unaryfunc am_anext;
601     } __Pyx_PyAsyncMethodsStruct;
602 #endif
603 
604 #if defined(WIN32) || defined(MS_WINDOWS)
605   #define _USE_MATH_DEFINES
606 #endif
607 #include <math.h>
608 #ifdef NAN
609 #define __PYX_NAN() ((float) NAN)
610 #else
__PYX_NAN()611 static CYTHON_INLINE float __PYX_NAN() {
612   float value;
613   memset(&value, 0xFF, sizeof(value));
614   return value;
615 }
616 #endif
617 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
618 #define __Pyx_truncl trunc
619 #else
620 #define __Pyx_truncl truncl
621 #endif
622 
623 
624 #define __PYX_ERR(f_index, lineno, Ln_error) \
625 { \
626   __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
627 }
628 
629 #ifndef __PYX_EXTERN_C
630   #ifdef __cplusplus
631     #define __PYX_EXTERN_C extern "C"
632   #else
633     #define __PYX_EXTERN_C extern
634   #endif
635 #endif
636 
637 #define __PYX_HAVE__yt__utilities__lib__geometry_utils
638 #define __PYX_HAVE_API__yt__utilities__lib__geometry_utils
639 /* Early includes */
640 #include <string.h>
641 #include <stdio.h>
642 #include "numpy/arrayobject.h"
643 #include "numpy/ufuncobject.h"
644 #include <float.h>
645 #include <math.h>
646 #include <stdlib.h>
647 #include "math.h"
648 #include "platform_dep.h"
649 #include "pythread.h"
650 #include "pystate.h"
651 #ifdef _OPENMP
652 #include <omp.h>
653 #endif /* _OPENMP */
654 
655 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
656 #define CYTHON_WITHOUT_ASSERTIONS
657 #endif
658 
659 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
660                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
661 
662 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
663 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
664 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
665 #define __PYX_DEFAULT_STRING_ENCODING ""
666 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
667 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
668 #define __Pyx_uchar_cast(c) ((unsigned char)c)
669 #define __Pyx_long_cast(x) ((long)x)
670 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
671     (sizeof(type) < sizeof(Py_ssize_t))  ||\
672     (sizeof(type) > sizeof(Py_ssize_t) &&\
673           likely(v < (type)PY_SSIZE_T_MAX ||\
674                  v == (type)PY_SSIZE_T_MAX)  &&\
675           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
676                                 v == (type)PY_SSIZE_T_MIN)))  ||\
677     (sizeof(type) == sizeof(Py_ssize_t) &&\
678           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
679                                v == (type)PY_SSIZE_T_MAX)))  )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)680 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
681     return (size_t) i < (size_t) limit;
682 }
683 #if defined (__cplusplus) && __cplusplus >= 201103L
684     #include <cstdlib>
685     #define __Pyx_sst_abs(value) std::abs(value)
686 #elif SIZEOF_INT >= SIZEOF_SIZE_T
687     #define __Pyx_sst_abs(value) abs(value)
688 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
689     #define __Pyx_sst_abs(value) labs(value)
690 #elif defined (_MSC_VER)
691     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
692 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
693     #define __Pyx_sst_abs(value) llabs(value)
694 #elif defined (__GNUC__)
695     #define __Pyx_sst_abs(value) __builtin_llabs(value)
696 #else
697     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
698 #endif
699 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
700 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
701 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
702 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
703 #define __Pyx_PyBytes_FromString        PyBytes_FromString
704 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
705 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
706 #if PY_MAJOR_VERSION < 3
707     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
708     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
709 #else
710     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
711     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
712 #endif
713 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
714 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
715 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
716 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
717 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
718 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
719 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
720 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
721 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
722 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
723 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
724 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
725 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
726 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
727 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
728 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)729 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
730     const Py_UNICODE *u_end = u;
731     while (*u_end++) ;
732     return (size_t)(u_end - u - 1);
733 }
734 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
735 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
736 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
737 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
738 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
739 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
740 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
741 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
742 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
743 #define __Pyx_PySequence_Tuple(obj)\
744     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
745 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
746 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
747 #if CYTHON_ASSUME_SAFE_MACROS
748 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
749 #else
750 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
751 #endif
752 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
753 #if PY_MAJOR_VERSION >= 3
754 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
755 #else
756 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
757 #endif
758 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
759 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
760 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)761 static int __Pyx_init_sys_getdefaultencoding_params(void) {
762     PyObject* sys;
763     PyObject* default_encoding = NULL;
764     PyObject* ascii_chars_u = NULL;
765     PyObject* ascii_chars_b = NULL;
766     const char* default_encoding_c;
767     sys = PyImport_ImportModule("sys");
768     if (!sys) goto bad;
769     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
770     Py_DECREF(sys);
771     if (!default_encoding) goto bad;
772     default_encoding_c = PyBytes_AsString(default_encoding);
773     if (!default_encoding_c) goto bad;
774     if (strcmp(default_encoding_c, "ascii") == 0) {
775         __Pyx_sys_getdefaultencoding_not_ascii = 0;
776     } else {
777         char ascii_chars[128];
778         int c;
779         for (c = 0; c < 128; c++) {
780             ascii_chars[c] = c;
781         }
782         __Pyx_sys_getdefaultencoding_not_ascii = 1;
783         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
784         if (!ascii_chars_u) goto bad;
785         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
786         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
787             PyErr_Format(
788                 PyExc_ValueError,
789                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
790                 default_encoding_c);
791             goto bad;
792         }
793         Py_DECREF(ascii_chars_u);
794         Py_DECREF(ascii_chars_b);
795     }
796     Py_DECREF(default_encoding);
797     return 0;
798 bad:
799     Py_XDECREF(default_encoding);
800     Py_XDECREF(ascii_chars_u);
801     Py_XDECREF(ascii_chars_b);
802     return -1;
803 }
804 #endif
805 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
806 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
807 #else
808 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
809 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
810 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)811 static int __Pyx_init_sys_getdefaultencoding_params(void) {
812     PyObject* sys;
813     PyObject* default_encoding = NULL;
814     char* default_encoding_c;
815     sys = PyImport_ImportModule("sys");
816     if (!sys) goto bad;
817     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
818     Py_DECREF(sys);
819     if (!default_encoding) goto bad;
820     default_encoding_c = PyBytes_AsString(default_encoding);
821     if (!default_encoding_c) goto bad;
822     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
823     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
824     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
825     Py_DECREF(default_encoding);
826     return 0;
827 bad:
828     Py_XDECREF(default_encoding);
829     return -1;
830 }
831 #endif
832 #endif
833 
834 
835 /* Test for GCC > 2.95 */
836 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
837   #define likely(x)   __builtin_expect(!!(x), 1)
838   #define unlikely(x) __builtin_expect(!!(x), 0)
839 #else /* !__GNUC__ or GCC < 2.95 */
840   #define likely(x)   (x)
841   #define unlikely(x) (x)
842 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)843 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
844 
845 static PyObject *__pyx_m = NULL;
846 static PyObject *__pyx_d;
847 static PyObject *__pyx_b;
848 static PyObject *__pyx_cython_runtime = NULL;
849 static PyObject *__pyx_empty_tuple;
850 static PyObject *__pyx_empty_bytes;
851 static PyObject *__pyx_empty_unicode;
852 static int __pyx_lineno;
853 static int __pyx_clineno = 0;
854 static const char * __pyx_cfilenm= __FILE__;
855 static const char *__pyx_filename;
856 
857 /* Header.proto */
858 #if !defined(CYTHON_CCOMPLEX)
859   #if defined(__cplusplus)
860     #define CYTHON_CCOMPLEX 1
861   #elif defined(_Complex_I)
862     #define CYTHON_CCOMPLEX 1
863   #else
864     #define CYTHON_CCOMPLEX 0
865   #endif
866 #endif
867 #if CYTHON_CCOMPLEX
868   #ifdef __cplusplus
869     #include <complex>
870   #else
871     #include <complex.h>
872   #endif
873 #endif
874 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
875   #undef _Complex_I
876   #define _Complex_I 1.0fj
877 #endif
878 
879 
880 static const char *__pyx_f[] = {
881   "yt/utilities/lib/geometry_utils.pxd",
882   "yt/utilities/lib/geometry_utils.pyx",
883   "__init__.pxd",
884   "yt/utilities/lib/fp_utils.pxd",
885   "stringsource",
886   "type.pxd",
887 };
888 /* BufferFormatStructs.proto */
889 #define IS_UNSIGNED(type) (((type) -1) > 0)
890 struct __Pyx_StructField_;
891 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
892 typedef struct {
893   const char* name;
894   struct __Pyx_StructField_* fields;
895   size_t size;
896   size_t arraysize[8];
897   int ndim;
898   char typegroup;
899   char is_unsigned;
900   int flags;
901 } __Pyx_TypeInfo;
902 typedef struct __Pyx_StructField_ {
903   __Pyx_TypeInfo* type;
904   const char* name;
905   size_t offset;
906 } __Pyx_StructField;
907 typedef struct {
908   __Pyx_StructField* field;
909   size_t parent_offset;
910 } __Pyx_BufFmt_StackElem;
911 typedef struct {
912   __Pyx_StructField root;
913   __Pyx_BufFmt_StackElem* head;
914   size_t fmt_offset;
915   size_t new_count, enc_count;
916   size_t struct_alignment;
917   int is_complex;
918   char enc_type;
919   char new_packmode;
920   char enc_packmode;
921   char is_valid_array;
922 } __Pyx_BufFmt_Context;
923 
924 /* MemviewSliceStruct.proto */
925 struct __pyx_memoryview_obj;
926 typedef struct {
927   struct __pyx_memoryview_obj *memview;
928   char *data;
929   Py_ssize_t shape[8];
930   Py_ssize_t strides[8];
931   Py_ssize_t suboffsets[8];
932 } __Pyx_memviewslice;
933 #define __Pyx_MemoryView_Len(m)  (m.shape[0])
934 
935 /* Atomics.proto */
936 #include <pythread.h>
937 #ifndef CYTHON_ATOMICS
938     #define CYTHON_ATOMICS 1
939 #endif
940 #define __pyx_atomic_int_type int
941 #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
942                     (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
943                     !defined(__i386__)
944     #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
945     #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
946     #ifdef __PYX_DEBUG_ATOMICS
947         #warning "Using GNU atomics"
948     #endif
949 #elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
950     #include <Windows.h>
951     #undef __pyx_atomic_int_type
952     #define __pyx_atomic_int_type LONG
953     #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
954     #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
955     #ifdef __PYX_DEBUG_ATOMICS
956         #pragma message ("Using MSVC atomics")
957     #endif
958 #elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
959     #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
960     #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
961     #ifdef __PYX_DEBUG_ATOMICS
962         #warning "Using Intel atomics"
963     #endif
964 #else
965     #undef CYTHON_ATOMICS
966     #define CYTHON_ATOMICS 0
967     #ifdef __PYX_DEBUG_ATOMICS
968         #warning "Not using atomics"
969     #endif
970 #endif
971 typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
972 #if CYTHON_ATOMICS
973     #define __pyx_add_acquisition_count(memview)\
974              __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
975     #define __pyx_sub_acquisition_count(memview)\
976             __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
977 #else
978     #define __pyx_add_acquisition_count(memview)\
979             __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
980     #define __pyx_sub_acquisition_count(memview)\
981             __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
982 #endif
983 
984 /* ForceInitThreads.proto */
985 #ifndef __PYX_FORCE_INIT_THREADS
986   #define __PYX_FORCE_INIT_THREADS 0
987 #endif
988 
989 /* NoFastGil.proto */
990 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
991 #define __Pyx_PyGILState_Release PyGILState_Release
992 #define __Pyx_FastGIL_Remember()
993 #define __Pyx_FastGIL_Forget()
994 #define __Pyx_FastGilFuncInit()
995 
996 
997 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":776
998  * # in Cython to enable them only on the right systems.
999  *
1000  * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
1001  * ctypedef npy_int16      int16_t
1002  * ctypedef npy_int32      int32_t
1003  */
1004 typedef npy_int8 __pyx_t_5numpy_int8_t;
1005 
1006 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":777
1007  *
1008  * ctypedef npy_int8       int8_t
1009  * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
1010  * ctypedef npy_int32      int32_t
1011  * ctypedef npy_int64      int64_t
1012  */
1013 typedef npy_int16 __pyx_t_5numpy_int16_t;
1014 
1015 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":778
1016  * ctypedef npy_int8       int8_t
1017  * ctypedef npy_int16      int16_t
1018  * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
1019  * ctypedef npy_int64      int64_t
1020  * #ctypedef npy_int96      int96_t
1021  */
1022 typedef npy_int32 __pyx_t_5numpy_int32_t;
1023 
1024 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":779
1025  * ctypedef npy_int16      int16_t
1026  * ctypedef npy_int32      int32_t
1027  * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
1028  * #ctypedef npy_int96      int96_t
1029  * #ctypedef npy_int128     int128_t
1030  */
1031 typedef npy_int64 __pyx_t_5numpy_int64_t;
1032 
1033 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":783
1034  * #ctypedef npy_int128     int128_t
1035  *
1036  * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
1037  * ctypedef npy_uint16     uint16_t
1038  * ctypedef npy_uint32     uint32_t
1039  */
1040 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1041 
1042 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":784
1043  *
1044  * ctypedef npy_uint8      uint8_t
1045  * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
1046  * ctypedef npy_uint32     uint32_t
1047  * ctypedef npy_uint64     uint64_t
1048  */
1049 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1050 
1051 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":785
1052  * ctypedef npy_uint8      uint8_t
1053  * ctypedef npy_uint16     uint16_t
1054  * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
1055  * ctypedef npy_uint64     uint64_t
1056  * #ctypedef npy_uint96     uint96_t
1057  */
1058 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1059 
1060 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":786
1061  * ctypedef npy_uint16     uint16_t
1062  * ctypedef npy_uint32     uint32_t
1063  * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
1064  * #ctypedef npy_uint96     uint96_t
1065  * #ctypedef npy_uint128    uint128_t
1066  */
1067 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1068 
1069 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":790
1070  * #ctypedef npy_uint128    uint128_t
1071  *
1072  * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
1073  * ctypedef npy_float64    float64_t
1074  * #ctypedef npy_float80    float80_t
1075  */
1076 typedef npy_float32 __pyx_t_5numpy_float32_t;
1077 
1078 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":791
1079  *
1080  * ctypedef npy_float32    float32_t
1081  * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
1082  * #ctypedef npy_float80    float80_t
1083  * #ctypedef npy_float128   float128_t
1084  */
1085 typedef npy_float64 __pyx_t_5numpy_float64_t;
1086 
1087 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":800
1088  * # The int types are mapped a bit surprising --
1089  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1090  * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
1091  * ctypedef npy_longlong   long_t
1092  * ctypedef npy_longlong   longlong_t
1093  */
1094 typedef npy_long __pyx_t_5numpy_int_t;
1095 
1096 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":801
1097  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1098  * ctypedef npy_long       int_t
1099  * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
1100  * ctypedef npy_longlong   longlong_t
1101  *
1102  */
1103 typedef npy_longlong __pyx_t_5numpy_long_t;
1104 
1105 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":802
1106  * ctypedef npy_long       int_t
1107  * ctypedef npy_longlong   long_t
1108  * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
1109  *
1110  * ctypedef npy_ulong      uint_t
1111  */
1112 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1113 
1114 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":804
1115  * ctypedef npy_longlong   longlong_t
1116  *
1117  * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
1118  * ctypedef npy_ulonglong  ulong_t
1119  * ctypedef npy_ulonglong  ulonglong_t
1120  */
1121 typedef npy_ulong __pyx_t_5numpy_uint_t;
1122 
1123 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":805
1124  *
1125  * ctypedef npy_ulong      uint_t
1126  * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
1127  * ctypedef npy_ulonglong  ulonglong_t
1128  *
1129  */
1130 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1131 
1132 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":806
1133  * ctypedef npy_ulong      uint_t
1134  * ctypedef npy_ulonglong  ulong_t
1135  * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
1136  *
1137  * ctypedef npy_intp       intp_t
1138  */
1139 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1140 
1141 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":808
1142  * ctypedef npy_ulonglong  ulonglong_t
1143  *
1144  * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
1145  * ctypedef npy_uintp      uintp_t
1146  *
1147  */
1148 typedef npy_intp __pyx_t_5numpy_intp_t;
1149 
1150 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":809
1151  *
1152  * ctypedef npy_intp       intp_t
1153  * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
1154  *
1155  * ctypedef npy_double     float_t
1156  */
1157 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1158 
1159 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":811
1160  * ctypedef npy_uintp      uintp_t
1161  *
1162  * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
1163  * ctypedef npy_double     double_t
1164  * ctypedef npy_longdouble longdouble_t
1165  */
1166 typedef npy_double __pyx_t_5numpy_float_t;
1167 
1168 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":812
1169  *
1170  * ctypedef npy_double     float_t
1171  * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
1172  * ctypedef npy_longdouble longdouble_t
1173  *
1174  */
1175 typedef npy_double __pyx_t_5numpy_double_t;
1176 
1177 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":813
1178  * ctypedef npy_double     float_t
1179  * ctypedef npy_double     double_t
1180  * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
1181  *
1182  * ctypedef npy_cfloat      cfloat_t
1183  */
1184 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1185 /* Declarations.proto */
1186 #if CYTHON_CCOMPLEX
1187   #ifdef __cplusplus
1188     typedef ::std::complex< float > __pyx_t_float_complex;
1189   #else
1190     typedef float _Complex __pyx_t_float_complex;
1191   #endif
1192 #else
1193     typedef struct { float real, imag; } __pyx_t_float_complex;
1194 #endif
1195 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1196 
1197 /* Declarations.proto */
1198 #if CYTHON_CCOMPLEX
1199   #ifdef __cplusplus
1200     typedef ::std::complex< double > __pyx_t_double_complex;
1201   #else
1202     typedef double _Complex __pyx_t_double_complex;
1203   #endif
1204 #else
1205     typedef struct { double real, imag; } __pyx_t_double_complex;
1206 #endif
1207 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1208 
1209 
1210 /*--- Type declarations ---*/
1211 struct __pyx_array_obj;
1212 struct __pyx_MemviewEnum_obj;
1213 struct __pyx_memoryview_obj;
1214 struct __pyx_memoryviewslice_obj;
1215 
1216 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":815
1217  * ctypedef npy_longdouble longdouble_t
1218  *
1219  * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
1220  * ctypedef npy_cdouble     cdouble_t
1221  * ctypedef npy_clongdouble clongdouble_t
1222  */
1223 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1224 
1225 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":816
1226  *
1227  * ctypedef npy_cfloat      cfloat_t
1228  * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
1229  * ctypedef npy_clongdouble clongdouble_t
1230  *
1231  */
1232 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1233 
1234 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":817
1235  * ctypedef npy_cfloat      cfloat_t
1236  * ctypedef npy_cdouble     cdouble_t
1237  * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
1238  *
1239  * ctypedef npy_cdouble     complex_t
1240  */
1241 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1242 
1243 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":819
1244  * ctypedef npy_clongdouble clongdouble_t
1245  *
1246  * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
1247  *
1248  * cdef inline object PyArray_MultiIterNew1(a):
1249  */
1250 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1251 struct __pyx_t_2yt_9utilities_3lib_14geometry_utils_PointSet;
1252 struct __pyx_defaults;
1253 typedef struct __pyx_defaults __pyx_defaults;
1254 struct __pyx_defaults1;
1255 typedef struct __pyx_defaults1 __pyx_defaults1;
1256 struct __pyx_defaults2;
1257 typedef struct __pyx_defaults2 __pyx_defaults2;
1258 struct __pyx_defaults3;
1259 typedef struct __pyx_defaults3 __pyx_defaults3;
1260 struct __pyx_defaults4;
1261 typedef struct __pyx_defaults4 __pyx_defaults4;
1262 struct __pyx_defaults5;
1263 typedef struct __pyx_defaults5 __pyx_defaults5;
1264 struct __pyx_defaults6;
1265 typedef struct __pyx_defaults6 __pyx_defaults6;
1266 struct __pyx_defaults7;
1267 typedef struct __pyx_defaults7 __pyx_defaults7;
1268 struct __pyx_defaults8;
1269 typedef struct __pyx_defaults8 __pyx_defaults8;
1270 struct __pyx_defaults9;
1271 typedef struct __pyx_defaults9 __pyx_defaults9;
1272 struct __pyx_defaults10;
1273 typedef struct __pyx_defaults10 __pyx_defaults10;
1274 struct __pyx_defaults11;
1275 typedef struct __pyx_defaults11 __pyx_defaults11;
1276 struct __pyx_defaults12;
1277 typedef struct __pyx_defaults12 __pyx_defaults12;
1278 struct __pyx_defaults13;
1279 typedef struct __pyx_defaults13 __pyx_defaults13;
1280 struct __pyx_defaults14;
1281 typedef struct __pyx_defaults14 __pyx_defaults14;
1282 struct __pyx_defaults15;
1283 typedef struct __pyx_defaults15 __pyx_defaults15;
1284 
1285 /* "yt/utilities/lib/geometry_utils.pyx":1245
1286  *         return sort_fwd[Ai]
1287  *
1288  * cdef struct PointSet             # <<<<<<<<<<<<<<
1289  * cdef struct PointSet:
1290  *     int count
1291  */
1292 struct __pyx_t_2yt_9utilities_3lib_14geometry_utils_PointSet {
1293   int count;
1294   __pyx_t_5numpy_float64_t points[2][3];
1295   struct __pyx_t_2yt_9utilities_3lib_14geometry_utils_PointSet *next;
1296 };
1297 struct __pyx_defaults {
1298   PyObject *__pyx_arg_use_loop;
1299 };
1300 struct __pyx_defaults1 {
1301   PyObject *__pyx_arg_use_loop;
1302 };
1303 struct __pyx_defaults2 {
1304   PyObject *__pyx_arg_use_loop;
1305 };
1306 struct __pyx_defaults3 {
1307   PyObject *__pyx_arg_use_loop;
1308 };
1309 struct __pyx_defaults4 {
1310   PyObject *__pyx_arg_use_loop;
1311 };
1312 struct __pyx_defaults5 {
1313   PyObject *__pyx_arg_use_loop;
1314 };
1315 struct __pyx_defaults6 {
1316   PyObject *__pyx_arg_use_loop;
1317 };
1318 struct __pyx_defaults7 {
1319   PyObject *__pyx_arg_use_loop;
1320 };
1321 struct __pyx_defaults8 {
1322   PyObject *__pyx_arg_use_loop;
1323 };
1324 struct __pyx_defaults9 {
1325   PyObject *__pyx_arg_use_loop;
1326 };
1327 struct __pyx_defaults10 {
1328   PyObject *__pyx_arg_use_loop;
1329 };
1330 struct __pyx_defaults11 {
1331   PyObject *__pyx_arg_use_loop;
1332 };
1333 struct __pyx_defaults12 {
1334   PyObject *__pyx_arg_recursive;
1335   PyObject *__pyx_arg_use_loop;
1336 };
1337 struct __pyx_defaults13 {
1338   PyObject *__pyx_arg_recursive;
1339   PyObject *__pyx_arg_use_loop;
1340 };
1341 struct __pyx_defaults14 {
1342   PyObject *__pyx_arg_recursive;
1343   PyObject *__pyx_arg_use_loop;
1344 };
1345 struct __pyx_defaults15 {
1346   PyObject *__pyx_arg_recursive;
1347   PyObject *__pyx_arg_use_loop;
1348 };
1349 
1350 /* "View.MemoryView":105
1351  *
1352  * @cname("__pyx_array")
1353  * cdef class array:             # <<<<<<<<<<<<<<
1354  *
1355  *     cdef:
1356  */
1357 struct __pyx_array_obj {
1358   PyObject_HEAD
1359   struct __pyx_vtabstruct_array *__pyx_vtab;
1360   char *data;
1361   Py_ssize_t len;
1362   char *format;
1363   int ndim;
1364   Py_ssize_t *_shape;
1365   Py_ssize_t *_strides;
1366   Py_ssize_t itemsize;
1367   PyObject *mode;
1368   PyObject *_format;
1369   void (*callback_free_data)(void *);
1370   int free_data;
1371   int dtype_is_object;
1372 };
1373 
1374 
1375 /* "View.MemoryView":279
1376  *
1377  * @cname('__pyx_MemviewEnum')
1378  * cdef class Enum(object):             # <<<<<<<<<<<<<<
1379  *     cdef object name
1380  *     def __init__(self, name):
1381  */
1382 struct __pyx_MemviewEnum_obj {
1383   PyObject_HEAD
1384   PyObject *name;
1385 };
1386 
1387 
1388 /* "View.MemoryView":330
1389  *
1390  * @cname('__pyx_memoryview')
1391  * cdef class memoryview(object):             # <<<<<<<<<<<<<<
1392  *
1393  *     cdef object obj
1394  */
1395 struct __pyx_memoryview_obj {
1396   PyObject_HEAD
1397   struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1398   PyObject *obj;
1399   PyObject *_size;
1400   PyObject *_array_interface;
1401   PyThread_type_lock lock;
1402   __pyx_atomic_int acquisition_count[2];
1403   __pyx_atomic_int *acquisition_count_aligned_p;
1404   Py_buffer view;
1405   int flags;
1406   int dtype_is_object;
1407   __Pyx_TypeInfo *typeinfo;
1408 };
1409 
1410 
1411 /* "View.MemoryView":961
1412  *
1413  * @cname('__pyx_memoryviewslice')
1414  * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
1415  *     "Internal class for passing memoryview slices to Python"
1416  *
1417  */
1418 struct __pyx_memoryviewslice_obj {
1419   struct __pyx_memoryview_obj __pyx_base;
1420   __Pyx_memviewslice from_slice;
1421   PyObject *from_object;
1422   PyObject *(*to_object_func)(char *);
1423   int (*to_dtype_func)(char *, PyObject *);
1424 };
1425 
1426 
1427 
1428 /* "View.MemoryView":105
1429  *
1430  * @cname("__pyx_array")
1431  * cdef class array:             # <<<<<<<<<<<<<<
1432  *
1433  *     cdef:
1434  */
1435 
1436 struct __pyx_vtabstruct_array {
1437   PyObject *(*get_memview)(struct __pyx_array_obj *);
1438 };
1439 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1440 
1441 
1442 /* "View.MemoryView":330
1443  *
1444  * @cname('__pyx_memoryview')
1445  * cdef class memoryview(object):             # <<<<<<<<<<<<<<
1446  *
1447  *     cdef object obj
1448  */
1449 
1450 struct __pyx_vtabstruct_memoryview {
1451   char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
1452   PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
1453   PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1454   PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
1455   PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1456   PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
1457   PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
1458 };
1459 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1460 
1461 
1462 /* "View.MemoryView":961
1463  *
1464  * @cname('__pyx_memoryviewslice')
1465  * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
1466  *     "Internal class for passing memoryview slices to Python"
1467  *
1468  */
1469 
1470 struct __pyx_vtabstruct__memoryviewslice {
1471   struct __pyx_vtabstruct_memoryview __pyx_base;
1472 };
1473 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1474 
1475 /* --- Runtime support code (head) --- */
1476 /* Refnanny.proto */
1477 #ifndef CYTHON_REFNANNY
1478   #define CYTHON_REFNANNY 0
1479 #endif
1480 #if CYTHON_REFNANNY
1481   typedef struct {
1482     void (*INCREF)(void*, PyObject*, int);
1483     void (*DECREF)(void*, PyObject*, int);
1484     void (*GOTREF)(void*, PyObject*, int);
1485     void (*GIVEREF)(void*, PyObject*, int);
1486     void* (*SetupContext)(const char*, int, const char*);
1487     void (*FinishContext)(void**);
1488   } __Pyx_RefNannyAPIStruct;
1489   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1490   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1491   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1492 #ifdef WITH_THREAD
1493   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1494           if (acquire_gil) {\
1495               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1496               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1497               PyGILState_Release(__pyx_gilstate_save);\
1498           } else {\
1499               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1500           }
1501 #else
1502   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1503           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1504 #endif
1505   #define __Pyx_RefNannyFinishContext()\
1506           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1507   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1508   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1509   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1510   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1511   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1512   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1513   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1514   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1515 #else
1516   #define __Pyx_RefNannyDeclarations
1517   #define __Pyx_RefNannySetupContext(name, acquire_gil)
1518   #define __Pyx_RefNannyFinishContext()
1519   #define __Pyx_INCREF(r) Py_INCREF(r)
1520   #define __Pyx_DECREF(r) Py_DECREF(r)
1521   #define __Pyx_GOTREF(r)
1522   #define __Pyx_GIVEREF(r)
1523   #define __Pyx_XINCREF(r) Py_XINCREF(r)
1524   #define __Pyx_XDECREF(r) Py_XDECREF(r)
1525   #define __Pyx_XGOTREF(r)
1526   #define __Pyx_XGIVEREF(r)
1527 #endif
1528 #define __Pyx_XDECREF_SET(r, v) do {\
1529         PyObject *tmp = (PyObject *) r;\
1530         r = v; __Pyx_XDECREF(tmp);\
1531     } while (0)
1532 #define __Pyx_DECREF_SET(r, v) do {\
1533         PyObject *tmp = (PyObject *) r;\
1534         r = v; __Pyx_DECREF(tmp);\
1535     } while (0)
1536 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1537 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1538 
1539 /* PyObjectGetAttrStr.proto */
1540 #if CYTHON_USE_TYPE_SLOTS
1541 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1542 #else
1543 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1544 #endif
1545 
1546 /* GetBuiltinName.proto */
1547 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1548 
1549 /* RaiseDoubleKeywords.proto */
1550 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1551 
1552 /* ParseKeywords.proto */
1553 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1554     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1555     const char* function_name);
1556 
1557 /* RaiseArgTupleInvalid.proto */
1558 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1559     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1560 
1561 /* PyDictVersioning.proto */
1562 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1563 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1564 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1565 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1566     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1567     (cache_var) = (value);
1568 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1569     static PY_UINT64_T __pyx_dict_version = 0;\
1570     static PyObject *__pyx_dict_cached_value = NULL;\
1571     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1572         (VAR) = __pyx_dict_cached_value;\
1573     } else {\
1574         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1575         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1576     }\
1577 }
1578 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1579 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1580 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1581 #else
1582 #define __PYX_GET_DICT_VERSION(dict)  (0)
1583 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1584 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1585 #endif
1586 
1587 /* GetModuleGlobalName.proto */
1588 #if CYTHON_USE_DICT_VERSIONS
1589 #define __Pyx_GetModuleGlobalName(var, name)  {\
1590     static PY_UINT64_T __pyx_dict_version = 0;\
1591     static PyObject *__pyx_dict_cached_value = NULL;\
1592     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1593         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1594         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1595 }
1596 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1597     PY_UINT64_T __pyx_dict_version;\
1598     PyObject *__pyx_dict_cached_value;\
1599     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1600 }
1601 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1602 #else
1603 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1604 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1605 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1606 #endif
1607 
1608 /* PyCFunctionFastCall.proto */
1609 #if CYTHON_FAST_PYCCALL
1610 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1611 #else
1612 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1613 #endif
1614 
1615 /* PyFunctionFastCall.proto */
1616 #if CYTHON_FAST_PYCALL
1617 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1618     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1619 #if 1 || PY_VERSION_HEX < 0x030600B1
1620 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1621 #else
1622 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1623 #endif
1624 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1625     (sizeof(char [1 - 2*!(cond)]) - 1)
1626 #ifndef Py_MEMBER_SIZE
1627 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1628 #endif
1629   static size_t __pyx_pyframe_localsplus_offset = 0;
1630   #include "frameobject.h"
1631   #define __Pxy_PyFrame_Initialize_Offsets()\
1632     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1633      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1634   #define __Pyx_PyFrame_GetLocalsplus(frame)\
1635     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1636 #endif
1637 
1638 /* PyObjectCall.proto */
1639 #if CYTHON_COMPILING_IN_CPYTHON
1640 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1641 #else
1642 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1643 #endif
1644 
1645 /* PyObjectCall2Args.proto */
1646 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1647 
1648 /* PyObjectCallMethO.proto */
1649 #if CYTHON_COMPILING_IN_CPYTHON
1650 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1651 #endif
1652 
1653 /* PyObjectCallOneArg.proto */
1654 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1655 
1656 /* SetItemInt.proto */
1657 #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1658     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1659     __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
1660     (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
1661                __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
1662 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
1663 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
1664                                                int is_list, int wraparound, int boundscheck);
1665 
1666 /* StringJoin.proto */
1667 #if PY_MAJOR_VERSION < 3
1668 #define __Pyx_PyString_Join __Pyx_PyBytes_Join
1669 #define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
1670 #else
1671 #define __Pyx_PyString_Join PyUnicode_Join
1672 #define __Pyx_PyBaseString_Join PyUnicode_Join
1673 #endif
1674 #if CYTHON_COMPILING_IN_CPYTHON
1675     #if PY_MAJOR_VERSION < 3
1676     #define __Pyx_PyBytes_Join _PyString_Join
1677     #else
1678     #define __Pyx_PyBytes_Join _PyBytes_Join
1679     #endif
1680 #else
1681 static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);
1682 #endif
1683 
1684 /* GetItemInt.proto */
1685 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1686     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1687     __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1688     (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1689                __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1690 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1691     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1692     __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1693     (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1694 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1695                                                               int wraparound, int boundscheck);
1696 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1697     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1698     __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1699     (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1700 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1701                                                               int wraparound, int boundscheck);
1702 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1703 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1704                                                      int is_list, int wraparound, int boundscheck);
1705 
1706 /* ObjectGetItem.proto */
1707 #if CYTHON_USE_TYPE_SLOTS
1708 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1709 #else
1710 #define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
1711 #endif
1712 
1713 /* ArgTypeTest.proto */
1714 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1715     ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1716         __Pyx__ArgTypeTest(obj, type, name, exact))
1717 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1718 
1719 /* IsLittleEndian.proto */
1720 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
1721 
1722 /* BufferFormatCheck.proto */
1723 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
1724 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
1725                               __Pyx_BufFmt_StackElem* stack,
1726                               __Pyx_TypeInfo* type);
1727 
1728 /* BufferGetAndValidate.proto */
1729 #define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
1730     ((obj == Py_None || obj == NULL) ?\
1731     (__Pyx_ZeroBuffer(buf), 0) :\
1732     __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
1733 static int  __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
1734     __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
1735 static void __Pyx_ZeroBuffer(Py_buffer* buf);
1736 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
1737 static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
1738 static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
1739 
1740 /* ExtTypeTest.proto */
1741 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1742 
1743 /* BufferFallbackError.proto */
1744 static void __Pyx_RaiseBufferFallbackError(void);
1745 
1746 #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
1747 #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
1748 /* PyThreadStateGet.proto */
1749 #if CYTHON_FAST_THREAD_STATE
1750 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
1751 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
1752 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
1753 #else
1754 #define __Pyx_PyThreadState_declare
1755 #define __Pyx_PyThreadState_assign
1756 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
1757 #endif
1758 
1759 /* PyErrFetchRestore.proto */
1760 #if CYTHON_FAST_THREAD_STATE
1761 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1762 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1763 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1764 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1765 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1766 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1767 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1768 #if CYTHON_COMPILING_IN_CPYTHON
1769 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1770 #else
1771 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1772 #endif
1773 #else
1774 #define __Pyx_PyErr_Clear() PyErr_Clear()
1775 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1776 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
1777 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
1778 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
1779 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
1780 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
1781 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
1782 #endif
1783 
1784 /* RaiseException.proto */
1785 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1786 
1787 /* PyIntBinop.proto */
1788 #if !CYTHON_COMPILING_IN_PYPY
1789 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1790 #else
1791 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1792     (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1793 #endif
1794 
1795 /* MemviewSliceInit.proto */
1796 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
1797 #define __Pyx_MEMVIEW_DIRECT   1
1798 #define __Pyx_MEMVIEW_PTR      2
1799 #define __Pyx_MEMVIEW_FULL     4
1800 #define __Pyx_MEMVIEW_CONTIG   8
1801 #define __Pyx_MEMVIEW_STRIDED  16
1802 #define __Pyx_MEMVIEW_FOLLOW   32
1803 #define __Pyx_IS_C_CONTIG 1
1804 #define __Pyx_IS_F_CONTIG 2
1805 static int __Pyx_init_memviewslice(
1806                 struct __pyx_memoryview_obj *memview,
1807                 int ndim,
1808                 __Pyx_memviewslice *memviewslice,
1809                 int memview_is_new_reference);
1810 static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
1811     __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1812 static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
1813     __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1814 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
1815 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
1816 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
1817 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
1818 static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
1819 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
1820 
1821 /* RaiseTooManyValuesToUnpack.proto */
1822 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1823 
1824 /* RaiseNeedMoreValuesToUnpack.proto */
1825 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1826 
1827 /* IterFinish.proto */
1828 static CYTHON_INLINE int __Pyx_IterFinish(void);
1829 
1830 /* UnpackItemEndCheck.proto */
1831 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1832 
1833 /* BufferIndexError.proto */
1834 static void __Pyx_RaiseBufferIndexError(int axis);
1835 
1836 /* PyDictContains.proto */
__Pyx_PyDict_ContainsTF(PyObject * item,PyObject * dict,int eq)1837 static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) {
1838     int result = PyDict_Contains(dict, item);
1839     return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
1840 }
1841 
1842 /* DictGetItem.proto */
1843 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1844 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1845 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1846     (likely(PyDict_CheckExact(obj)) ?\
1847      __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1848 #else
1849 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1850 #define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
1851 #endif
1852 
1853 /* UnicodeAsUCS4.proto */
1854 static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject*);
1855 
1856 /* object_ord.proto */
1857 #if PY_MAJOR_VERSION >= 3
1858 #define __Pyx_PyObject_Ord(c)\
1859     (likely(PyUnicode_Check(c)) ? (long)__Pyx_PyUnicode_AsPy_UCS4(c) : __Pyx__PyObject_Ord(c))
1860 #else
1861 #define __Pyx_PyObject_Ord(c) __Pyx__PyObject_Ord(c)
1862 #endif
1863 static long __Pyx__PyObject_Ord(PyObject* c);
1864 
1865 /* PyObjectCallNoArg.proto */
1866 #if CYTHON_COMPILING_IN_CPYTHON
1867 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1868 #else
1869 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1870 #endif
1871 
1872 /* PyObjectGetMethod.proto */
1873 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
1874 
1875 /* PyObjectCallMethod0.proto */
1876 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
1877 
1878 /* RaiseNoneIterError.proto */
1879 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1880 
1881 /* UnpackTupleError.proto */
1882 static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);
1883 
1884 /* UnpackTuple2.proto */
1885 #define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
1886     (likely(is_tuple || PyTuple_Check(tuple)) ?\
1887         (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
1888             __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
1889             (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
1890         __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
1891 static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
1892     PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
1893 static int __Pyx_unpack_tuple2_generic(
1894     PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);
1895 
1896 /* dict_iter.proto */
1897 static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
1898                                                    Py_ssize_t* p_orig_length, int* p_is_dict);
1899 static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
1900                                               PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);
1901 
1902 /* ListAppend.proto */
1903 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_PyList_Append(PyObject * list,PyObject * x)1904 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1905     PyListObject* L = (PyListObject*) list;
1906     Py_ssize_t len = Py_SIZE(list);
1907     if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1908         Py_INCREF(x);
1909         PyList_SET_ITEM(list, len, x);
1910         Py_SIZE(list) = len+1;
1911         return 0;
1912     }
1913     return PyList_Append(list, x);
1914 }
1915 #else
1916 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1917 #endif
1918 
1919 /* WriteUnraisableException.proto */
1920 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1921                                   int lineno, const char *filename,
1922                                   int full_traceback, int nogil);
1923 
1924 /* SliceObject.proto */
1925 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
1926         PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
1927         PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1928         int has_cstart, int has_cstop, int wraparound);
1929 
1930 #define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2)
1931 /* GetTopmostException.proto */
1932 #if CYTHON_USE_EXC_INFO_STACK
1933 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1934 #endif
1935 
1936 /* SaveResetException.proto */
1937 #if CYTHON_FAST_THREAD_STATE
1938 #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1939 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1940 #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1941 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1942 #else
1943 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1944 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1945 #endif
1946 
1947 /* PyErrExceptionMatches.proto */
1948 #if CYTHON_FAST_THREAD_STATE
1949 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1950 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1951 #else
1952 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1953 #endif
1954 
1955 /* GetException.proto */
1956 #if CYTHON_FAST_THREAD_STATE
1957 #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
1958 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1959 #else
1960 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1961 #endif
1962 
1963 /* GetAttr.proto */
1964 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1965 
1966 /* HasAttr.proto */
1967 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
1968 
1969 /* IncludeStringH.proto */
1970 #include <string.h>
1971 
1972 /* BytesEquals.proto */
1973 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1974 
1975 /* UnicodeEquals.proto */
1976 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1977 
1978 /* StrEquals.proto */
1979 #if PY_MAJOR_VERSION >= 3
1980 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1981 #else
1982 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1983 #endif
1984 
1985 /* None.proto */
1986 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
1987 
1988 /* UnaryNegOverflows.proto */
1989 #define UNARY_NEG_WOULD_OVERFLOW(x)\
1990         (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1991 
1992 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1993 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
1994 /* decode_c_string_utf16.proto */
__Pyx_PyUnicode_DecodeUTF16(const char * s,Py_ssize_t size,const char * errors)1995 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
1996     int byteorder = 0;
1997     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1998 }
__Pyx_PyUnicode_DecodeUTF16LE(const char * s,Py_ssize_t size,const char * errors)1999 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
2000     int byteorder = -1;
2001     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
2002 }
__Pyx_PyUnicode_DecodeUTF16BE(const char * s,Py_ssize_t size,const char * errors)2003 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
2004     int byteorder = 1;
2005     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
2006 }
2007 
2008 /* decode_c_string.proto */
2009 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
2010          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
2011          const char* encoding, const char* errors,
2012          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
2013 
2014 /* GetAttr3.proto */
2015 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
2016 
2017 /* SwapException.proto */
2018 #if CYTHON_FAST_THREAD_STATE
2019 #define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
2020 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
2021 #else
2022 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
2023 #endif
2024 
2025 /* Import.proto */
2026 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
2027 
2028 /* FastTypeChecks.proto */
2029 #if CYTHON_COMPILING_IN_CPYTHON
2030 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
2031 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
2032 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
2033 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
2034 #else
2035 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
2036 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
2037 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
2038 #endif
2039 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
2040 
2041 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
2042 /* ListCompAppend.proto */
2043 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_ListComp_Append(PyObject * list,PyObject * x)2044 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
2045     PyListObject* L = (PyListObject*) list;
2046     Py_ssize_t len = Py_SIZE(list);
2047     if (likely(L->allocated > len)) {
2048         Py_INCREF(x);
2049         PyList_SET_ITEM(list, len, x);
2050         Py_SIZE(list) = len+1;
2051         return 0;
2052     }
2053     return PyList_Append(list, x);
2054 }
2055 #else
2056 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
2057 #endif
2058 
2059 /* ListExtend.proto */
__Pyx_PyList_Extend(PyObject * L,PyObject * v)2060 static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
2061 #if CYTHON_COMPILING_IN_CPYTHON
2062     PyObject* none = _PyList_Extend((PyListObject*)L, v);
2063     if (unlikely(!none))
2064         return -1;
2065     Py_DECREF(none);
2066     return 0;
2067 #else
2068     return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
2069 #endif
2070 }
2071 
2072 /* None.proto */
2073 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
2074 
2075 /* None.proto */
2076 static CYTHON_INLINE long __Pyx_div_long(long, long);
2077 
2078 /* ImportFrom.proto */
2079 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
2080 
2081 /* PyObject_Unicode.proto */
2082 #if PY_MAJOR_VERSION >= 3
2083 #define __Pyx_PyObject_Unicode(obj)\
2084     (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj))
2085 #else
2086 #define __Pyx_PyObject_Unicode(obj)\
2087     (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Unicode(obj))
2088 #endif
2089 
2090 /* PyObject_GenericGetAttrNoDict.proto */
2091 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2092 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
2093 #else
2094 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
2095 #endif
2096 
2097 /* PyObject_GenericGetAttr.proto */
2098 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2099 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
2100 #else
2101 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
2102 #endif
2103 
2104 /* SetVTable.proto */
2105 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
2106 
2107 /* SetupReduce.proto */
2108 static int __Pyx_setup_reduce(PyObject* type_obj);
2109 
2110 /* TypeImport.proto */
2111 #ifndef __PYX_HAVE_RT_ImportType_proto
2112 #define __PYX_HAVE_RT_ImportType_proto
2113 enum __Pyx_ImportType_CheckSize {
2114    __Pyx_ImportType_CheckSize_Error = 0,
2115    __Pyx_ImportType_CheckSize_Warn = 1,
2116    __Pyx_ImportType_CheckSize_Ignore = 2
2117 };
2118 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
2119 #endif
2120 
2121 /* FetchCommonType.proto */
2122 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
2123 
2124 /* CythonFunction.proto */
2125 #define __Pyx_CyFunction_USED 1
2126 #define __Pyx_CYFUNCTION_STATICMETHOD  0x01
2127 #define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
2128 #define __Pyx_CYFUNCTION_CCLASS        0x04
2129 #define __Pyx_CyFunction_GetClosure(f)\
2130     (((__pyx_CyFunctionObject *) (f))->func_closure)
2131 #define __Pyx_CyFunction_GetClassObj(f)\
2132     (((__pyx_CyFunctionObject *) (f))->func_classobj)
2133 #define __Pyx_CyFunction_Defaults(type, f)\
2134     ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
2135 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
2136     ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
2137 typedef struct {
2138     PyCFunctionObject func;
2139 #if PY_VERSION_HEX < 0x030500A0
2140     PyObject *func_weakreflist;
2141 #endif
2142     PyObject *func_dict;
2143     PyObject *func_name;
2144     PyObject *func_qualname;
2145     PyObject *func_doc;
2146     PyObject *func_globals;
2147     PyObject *func_code;
2148     PyObject *func_closure;
2149     PyObject *func_classobj;
2150     void *defaults;
2151     int defaults_pyobjects;
2152     int flags;
2153     PyObject *defaults_tuple;
2154     PyObject *defaults_kwdict;
2155     PyObject *(*defaults_getter)(PyObject *);
2156     PyObject *func_annotations;
2157 } __pyx_CyFunctionObject;
2158 static PyTypeObject *__pyx_CyFunctionType = 0;
2159 #define __Pyx_CyFunction_Check(obj)  (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
2160 #define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
2161     __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
2162 static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
2163                                       int flags, PyObject* qualname,
2164                                       PyObject *self,
2165                                       PyObject *module, PyObject *globals,
2166                                       PyObject* code);
2167 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
2168                                                          size_t size,
2169                                                          int pyobjects);
2170 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
2171                                                             PyObject *tuple);
2172 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
2173                                                              PyObject *dict);
2174 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
2175                                                               PyObject *dict);
2176 static int __pyx_CyFunction_init(void);
2177 
2178 /* FusedFunction.proto */
2179 typedef struct {
2180     __pyx_CyFunctionObject func;
2181     PyObject *__signatures__;
2182     PyObject *type;
2183     PyObject *self;
2184 } __pyx_FusedFunctionObject;
2185 #define __pyx_FusedFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
2186         __pyx_FusedFunction_New(__pyx_FusedFunctionType, ml, flags, qualname, self, module, globals, code)
2187 static PyObject *__pyx_FusedFunction_New(PyTypeObject *type,
2188                                          PyMethodDef *ml, int flags,
2189                                          PyObject *qualname, PyObject *self,
2190                                          PyObject *module, PyObject *globals,
2191                                          PyObject *code);
2192 static int __pyx_FusedFunction_clear(__pyx_FusedFunctionObject *self);
2193 static PyTypeObject *__pyx_FusedFunctionType = NULL;
2194 static int __pyx_FusedFunction_init(void);
2195 #define __Pyx_FusedFunction_USED
2196 
2197 /* CLineInTraceback.proto */
2198 #ifdef CYTHON_CLINE_IN_TRACEBACK
2199 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
2200 #else
2201 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
2202 #endif
2203 
2204 /* CodeObjectCache.proto */
2205 typedef struct {
2206     PyCodeObject* code_object;
2207     int code_line;
2208 } __Pyx_CodeObjectCacheEntry;
2209 struct __Pyx_CodeObjectCache {
2210     int count;
2211     int max_count;
2212     __Pyx_CodeObjectCacheEntry* entries;
2213 };
2214 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
2215 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
2216 static PyCodeObject *__pyx_find_code_object(int code_line);
2217 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
2218 
2219 /* AddTraceback.proto */
2220 static void __Pyx_AddTraceback(const char *funcname, int c_line,
2221                                int py_line, const char *filename);
2222 
2223 #if PY_MAJOR_VERSION < 3
2224     static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
2225     static void __Pyx_ReleaseBuffer(Py_buffer *view);
2226 #else
2227     #define __Pyx_GetBuffer PyObject_GetBuffer
2228     #define __Pyx_ReleaseBuffer PyBuffer_Release
2229 #endif
2230 
2231 
2232 /* BufferStructDeclare.proto */
2233 typedef struct {
2234   Py_ssize_t shape, strides, suboffsets;
2235 } __Pyx_Buf_DimInfo;
2236 typedef struct {
2237   size_t refcount;
2238   Py_buffer pybuffer;
2239 } __Pyx_Buffer;
2240 typedef struct {
2241   __Pyx_Buffer *rcbuffer;
2242   char *data;
2243   __Pyx_Buf_DimInfo diminfo[8];
2244 } __Pyx_LocalBuf_ND;
2245 
2246 /* MemviewSliceIsContig.proto */
2247 static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);
2248 
2249 /* OverlappingSlices.proto */
2250 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
2251                                 __Pyx_memviewslice *slice2,
2252                                 int ndim, size_t itemsize);
2253 
2254 /* Capsule.proto */
2255 static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
2256 
2257 /* TypeInfoCompare.proto */
2258 static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
2259 
2260 /* MemviewSliceValidateAndInit.proto */
2261 static int __Pyx_ValidateAndInit_memviewslice(
2262                 int *axes_specs,
2263                 int c_or_f_flag,
2264                 int buf_flags,
2265                 int ndim,
2266                 __Pyx_TypeInfo *dtype,
2267                 __Pyx_BufFmt_StackElem stack[],
2268                 __Pyx_memviewslice *memviewslice,
2269                 PyObject *original_obj);
2270 
2271 /* ObjectToMemviewSlice.proto */
2272 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *, int writable_flag);
2273 
2274 /* ObjectToMemviewSlice.proto */
2275 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_double(PyObject *, int writable_flag);
2276 
2277 /* ObjectToMemviewSlice.proto */
2278 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *, int writable_flag);
2279 
2280 /* ObjectToMemviewSlice.proto */
2281 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *, int writable_flag);
2282 
2283 /* CIntToPy.proto */
2284 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int64(npy_int64 value);
2285 
2286 /* None.proto */
2287 static CYTHON_INLINE __pyx_t_5numpy_int64_t __Pyx_pow___pyx_t_5numpy_int64_t(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t);
2288 
2289 /* CIntToPy.proto */
2290 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_uint64(npy_uint64 value);
2291 
2292 /* CIntToPy.proto */
2293 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
2294 
2295 /* CIntToPy.proto */
2296 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
2297 
2298 /* CIntToPy.proto */
2299 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);
2300 
2301 /* CIntToPy.proto */
2302 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_uint32(npy_uint32 value);
2303 
2304 /* Print.proto */
2305 static int __Pyx_Print(PyObject*, PyObject *, int);
2306 #if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3
2307 static PyObject* __pyx_print = 0;
2308 static PyObject* __pyx_print_kwargs = 0;
2309 #endif
2310 
2311 /* MemviewDtypeToObject.proto */
2312 static CYTHON_INLINE PyObject *__pyx_memview_get_nn___pyx_t_5numpy_float64_t(const char *itemp);
2313 static CYTHON_INLINE int __pyx_memview_set_nn___pyx_t_5numpy_float64_t(const char *itemp, PyObject *obj);
2314 
2315 /* MemviewDtypeToObject.proto */
2316 static CYTHON_INLINE PyObject *__pyx_memview_get_nn___pyx_t_5numpy_int64_t(const char *itemp);
2317 static CYTHON_INLINE int __pyx_memview_set_nn___pyx_t_5numpy_int64_t(const char *itemp, PyObject *obj);
2318 
2319 /* RealImag.proto */
2320 #if CYTHON_CCOMPLEX
2321   #ifdef __cplusplus
2322     #define __Pyx_CREAL(z) ((z).real())
2323     #define __Pyx_CIMAG(z) ((z).imag())
2324   #else
2325     #define __Pyx_CREAL(z) (__real__(z))
2326     #define __Pyx_CIMAG(z) (__imag__(z))
2327   #endif
2328 #else
2329     #define __Pyx_CREAL(z) ((z).real)
2330     #define __Pyx_CIMAG(z) ((z).imag)
2331 #endif
2332 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
2333         && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
2334     #define __Pyx_SET_CREAL(z,x) ((z).real(x))
2335     #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
2336 #else
2337     #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
2338     #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
2339 #endif
2340 
2341 /* Arithmetic.proto */
2342 #if CYTHON_CCOMPLEX
2343     #define __Pyx_c_eq_float(a, b)   ((a)==(b))
2344     #define __Pyx_c_sum_float(a, b)  ((a)+(b))
2345     #define __Pyx_c_diff_float(a, b) ((a)-(b))
2346     #define __Pyx_c_prod_float(a, b) ((a)*(b))
2347     #define __Pyx_c_quot_float(a, b) ((a)/(b))
2348     #define __Pyx_c_neg_float(a)     (-(a))
2349   #ifdef __cplusplus
2350     #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
2351     #define __Pyx_c_conj_float(z)    (::std::conj(z))
2352     #if 1
2353         #define __Pyx_c_abs_float(z)     (::std::abs(z))
2354         #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
2355     #endif
2356   #else
2357     #define __Pyx_c_is_zero_float(z) ((z)==0)
2358     #define __Pyx_c_conj_float(z)    (conjf(z))
2359     #if 1
2360         #define __Pyx_c_abs_float(z)     (cabsf(z))
2361         #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
2362     #endif
2363  #endif
2364 #else
2365     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
2366     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
2367     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
2368     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
2369     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
2370     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
2371     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
2372     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
2373     #if 1
2374         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
2375         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
2376     #endif
2377 #endif
2378 
2379 /* Arithmetic.proto */
2380 #if CYTHON_CCOMPLEX
2381     #define __Pyx_c_eq_double(a, b)   ((a)==(b))
2382     #define __Pyx_c_sum_double(a, b)  ((a)+(b))
2383     #define __Pyx_c_diff_double(a, b) ((a)-(b))
2384     #define __Pyx_c_prod_double(a, b) ((a)*(b))
2385     #define __Pyx_c_quot_double(a, b) ((a)/(b))
2386     #define __Pyx_c_neg_double(a)     (-(a))
2387   #ifdef __cplusplus
2388     #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
2389     #define __Pyx_c_conj_double(z)    (::std::conj(z))
2390     #if 1
2391         #define __Pyx_c_abs_double(z)     (::std::abs(z))
2392         #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
2393     #endif
2394   #else
2395     #define __Pyx_c_is_zero_double(z) ((z)==0)
2396     #define __Pyx_c_conj_double(z)    (conj(z))
2397     #if 1
2398         #define __Pyx_c_abs_double(z)     (cabs(z))
2399         #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
2400     #endif
2401  #endif
2402 #else
2403     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
2404     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
2405     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
2406     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
2407     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
2408     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
2409     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
2410     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
2411     #if 1
2412         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
2413         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
2414     #endif
2415 #endif
2416 
2417 /* CIntToPy.proto */
2418 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
2419 
2420 /* MemviewSliceCopyTemplate.proto */
2421 static __Pyx_memviewslice
2422 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
2423                                  const char *mode, int ndim,
2424                                  size_t sizeof_dtype, int contig_flag,
2425                                  int dtype_is_object);
2426 
2427 /* CIntFromPy.proto */
2428 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
2429 
2430 /* CIntFromPy.proto */
2431 static CYTHON_INLINE npy_uint64 __Pyx_PyInt_As_npy_uint64(PyObject *);
2432 
2433 /* CIntFromPy.proto */
2434 static CYTHON_INLINE npy_uint32 __Pyx_PyInt_As_npy_uint32(PyObject *);
2435 
2436 /* CIntFromPy.proto */
2437 static CYTHON_INLINE npy_int64 __Pyx_PyInt_As_npy_int64(PyObject *);
2438 
2439 /* TypeInfoToFormat.proto */
2440 struct __pyx_typeinfo_string {
2441     char string[3];
2442 };
2443 static struct __pyx_typeinfo_string __Pyx_TypeInfoToFormat(__Pyx_TypeInfo *type);
2444 
2445 /* CIntFromPy.proto */
2446 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
2447 
2448 /* BytesContains.proto */
2449 static CYTHON_INLINE int __Pyx_BytesContains(PyObject* bytes, char character);
2450 
2451 /* PrintOne.proto */
2452 static int __Pyx_PrintOne(PyObject* stream, PyObject *o);
2453 
2454 /* ImportNumPyArray.proto */
2455 static PyObject *__pyx_numpy_ndarray = NULL;
2456 static PyObject* __Pyx_ImportNumPyArrayTypeIfAvailable(void);
2457 
2458 /* CIntFromPy.proto */
2459 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
2460 
2461 /* ObjectToMemviewSlice.proto */
2462 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_uint32_t(PyObject *, int writable_flag);
2463 
2464 /* ObjectToMemviewSlice.proto */
2465 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_uint64_t(PyObject *, int writable_flag);
2466 
2467 /* ObjectToMemviewSlice.proto */
2468 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_uint64_t(PyObject *, int writable_flag);
2469 
2470 /* ObjectToMemviewSlice.proto */
2471 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(PyObject *, int writable_flag);
2472 
2473 /* ObjectToMemviewSlice.proto */
2474 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int64_t(PyObject *, int writable_flag);
2475 
2476 /* CheckBinaryVersion.proto */
2477 static int __Pyx_check_binary_version(void);
2478 
2479 /* FunctionExport.proto */
2480 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);
2481 
2482 /* InitStrings.proto */
2483 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2484 
2485 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
2486 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
2487 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
2488 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
2489 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*/
2490 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
2491 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2492 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2493 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2494 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2495 
2496 /* Module declarations from 'cython.view' */
2497 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
2498 
2499 /* Module declarations from 'cython' */
2500 
2501 /* Module declarations from 'cpython.buffer' */
2502 
2503 /* Module declarations from 'libc.string' */
2504 
2505 /* Module declarations from 'libc.stdio' */
2506 
2507 /* Module declarations from '__builtin__' */
2508 
2509 /* Module declarations from 'cpython.type' */
2510 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2511 
2512 /* Module declarations from 'cpython' */
2513 
2514 /* Module declarations from 'cpython.object' */
2515 
2516 /* Module declarations from 'cpython.ref' */
2517 
2518 /* Module declarations from 'cpython.mem' */
2519 
2520 /* Module declarations from 'numpy' */
2521 
2522 /* Module declarations from 'numpy' */
2523 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
2524 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
2525 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
2526 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
2527 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
2528 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
2529 
2530 /* Module declarations from 'libc.float' */
2531 
2532 /* Module declarations from 'libc.math' */
2533 
2534 /* Module declarations from 'libc.stdlib' */
2535 
2536 /* Module declarations from 'yt.utilities.lib.fp_utils' */
2537 static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fmax(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
2538 static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fmin(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
2539 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_i64clip(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /*proto*/
2540 static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fclip(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
2541 
2542 /* Module declarations from 'yt.utilities.lib.vec3_ops' */
2543 static CYTHON_INLINE double __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(double *, double *); /*proto*/
2544 static CYTHON_INLINE void __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_cross(double *, double *, double *); /*proto*/
2545 static CYTHON_INLINE void __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_subtract(double *, double *, double *); /*proto*/
2546 static CYTHON_INLINE double __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_L2_norm(double *); /*proto*/
2547 
2548 /* Module declarations from 'yt.utilities.lib.geometry_utils' */
2549 static PyTypeObject *__pyx_array_type = 0;
2550 static PyTypeObject *__pyx_MemviewEnum_type = 0;
2551 static PyTypeObject *__pyx_memoryview_type = 0;
2552 static PyTypeObject *__pyx_memoryviewslice_type = 0;
2553 static PyObject *generic = 0;
2554 static PyObject *strided = 0;
2555 static PyObject *indirect = 0;
2556 static PyObject *contiguous = 0;
2557 static PyObject *indirect_contiguous = 0;
2558 static int __pyx_memoryview_thread_locks_used;
2559 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2560 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_ifrexp(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_int64_t *); /*proto*/
2561 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_msdb(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /*proto*/
2562 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_xor_msb(__pyx_t_5numpy_float64_t, __pyx_t_5numpy_float64_t); /*proto*/
2563 static CYTHON_INLINE int __pyx_f_2yt_9utilities_3lib_14geometry_utils_compare_floats_morton(__pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *); /*proto*/
2564 static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_euclidean_distance(__Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
2565 static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_smallest_quadtree_box(__pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_int32_t, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *); /*proto*/
2566 static CYTHON_INLINE __pyx_t_5numpy_uint64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_spread_64bits_by2(__pyx_t_5numpy_uint64_t); /*proto*/
2567 static CYTHON_INLINE __pyx_t_5numpy_uint64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_compact_64bits_by2(__pyx_t_5numpy_uint64_t); /*proto*/
2568 static CYTHON_INLINE __pyx_t_5numpy_uint64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_masked_merge_64bit(__pyx_t_5numpy_uint64_t, __pyx_t_5numpy_uint64_t, __pyx_t_5numpy_uint64_t); /*proto*/
2569 static CYTHON_INLINE __pyx_t_5numpy_uint64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_encode_morton_64bit(__pyx_t_5numpy_uint64_t, __pyx_t_5numpy_uint64_t, __pyx_t_5numpy_uint64_t); /*proto*/
2570 static CYTHON_INLINE void __pyx_f_2yt_9utilities_3lib_14geometry_utils_decode_morton_64bit(__pyx_t_5numpy_uint64_t, __pyx_t_5numpy_uint64_t *); /*proto*/
2571 static __pyx_t_5numpy_uint32_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_morton_neighbors_coarse(__pyx_t_5numpy_uint64_t, __pyx_t_5numpy_uint64_t, int *, __pyx_t_5numpy_uint32_t, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
2572 static __pyx_t_5numpy_uint32_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_morton_neighbors_refined(__pyx_t_5numpy_uint64_t, __pyx_t_5numpy_uint64_t, __pyx_t_5numpy_uint64_t, __pyx_t_5numpy_uint64_t, int *, __pyx_t_5numpy_uint32_t, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
2573 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_graycode(__pyx_t_5numpy_int64_t); /*proto*/
2574 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_igraycode(__pyx_t_5numpy_int64_t); /*proto*/
2575 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_direction(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /*proto*/
2576 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_tsb(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /*proto*/
2577 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_bitrange(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /*proto*/
2578 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_rrot(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /*proto*/
2579 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_lrot(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /*proto*/
2580 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_transform(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /*proto*/
2581 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_entry(__pyx_t_5numpy_int64_t); /*proto*/
2582 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_setbit(__pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t); /*proto*/
2583 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_point_to_hilbert(int, __pyx_t_5numpy_int64_t *); /*proto*/
2584 static void __pyx_f_2yt_9utilities_3lib_14geometry_utils_hilbert_to_point(int, __pyx_t_5numpy_int64_t, __pyx_t_5numpy_int64_t *); /*proto*/
2585 static __pyx_t_5numpy_uint64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_point_to_morton(__pyx_t_5numpy_uint64_t *); /*proto*/
2586 static void __pyx_f_2yt_9utilities_3lib_14geometry_utils_morton_to_point(__pyx_t_5numpy_uint64_t, __pyx_t_5numpy_uint64_t *); /*proto*/
2587 static CYTHON_INLINE void __pyx_f_2yt_9utilities_3lib_14geometry_utils_get_intersection(__pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, int, __pyx_t_5numpy_float64_t, struct __pyx_t_2yt_9utilities_3lib_14geometry_utils_PointSet *); /*proto*/
2588 static __pyx_t_5numpy_int64_t __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_14geometry_utils_position_to_morton(PyArrayObject *, PyArrayObject *, PyArrayObject *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, PyArrayObject *, int); /*proto*/
2589 static __pyx_t_5numpy_int64_t __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_14geometry_utils_position_to_morton(PyArrayObject *, PyArrayObject *, PyArrayObject *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, __pyx_t_5numpy_float64_t *, PyArrayObject *, int); /*proto*/
2590 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
2591 static void *__pyx_align_pointer(void *, size_t); /*proto*/
2592 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
2593 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
2594 static PyObject *_unellipsify(PyObject *, int); /*proto*/
2595 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
2596 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
2597 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*/
2598 static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
2599 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
2600 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
2601 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2602 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2603 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
2604 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2605 static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
2606 static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
2607 static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
2608 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
2609 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
2610 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
2611 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
2612 static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
2613 static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
2614 static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
2615 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
2616 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
2617 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
2618 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2619 static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2620 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
2621 static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
2622 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
2623 static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo *); /*proto*/
2624 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 };
2625 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t = { "uint64_t", NULL, sizeof(__pyx_t_5numpy_uint64_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_uint64_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_uint64_t), 0 };
2626 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint32_t = { "uint32_t", NULL, sizeof(__pyx_t_5numpy_uint32_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_uint32_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_uint32_t), 0 };
2627 static __Pyx_TypeInfo __Pyx_TypeInfo_float = { "float", NULL, sizeof(float), { 0 }, 0, 'R', 0, 0 };
2628 static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 };
2629 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 };
2630 #define __Pyx_MODULE_NAME "yt.utilities.lib.geometry_utils"
2631 extern int __pyx_module_is_main_yt__utilities__lib__geometry_utils;
2632 int __pyx_module_is_main_yt__utilities__lib__geometry_utils = 0;
2633 
2634 /* Implementation of 'yt.utilities.lib.geometry_utils' */
2635 static PyObject *__pyx_builtin_range;
2636 static PyObject *__pyx_builtin_ValueError;
2637 static PyObject *__pyx_builtin_enumerate;
2638 static PyObject *__pyx_builtin_zip;
2639 static PyObject *__pyx_builtin_TypeError;
2640 static PyObject *__pyx_builtin_NotImplementedError;
2641 static PyObject *__pyx_builtin_min;
2642 static PyObject *__pyx_builtin_max;
2643 static PyObject *__pyx_builtin_RuntimeError;
2644 static PyObject *__pyx_builtin_ImportError;
2645 static PyObject *__pyx_builtin_MemoryError;
2646 static PyObject *__pyx_builtin_Ellipsis;
2647 static PyObject *__pyx_builtin_id;
2648 static PyObject *__pyx_builtin_IndexError;
2649 static const char __pyx_k_[] = "";
2650 static const char __pyx_k_0[] = "0";
2651 static const char __pyx_k_1[] = "1";
2652 static const char __pyx_k_I[] = "I";
2653 static const char __pyx_k_N[] = "N";
2654 static const char __pyx_k_O[] = "O";
2655 static const char __pyx_k_P[] = "P";
2656 static const char __pyx_k_T[] = "T{";
2657   static const char __pyx_k_a[] = "a";
2658   static const char __pyx_k_b[] = "b";
2659   static const char __pyx_k_c[] = "c";
2660   static const char __pyx_k_d[] = "d";
2661   static const char __pyx_k_e[] = "e";
2662   static const char __pyx_k_h[] = "h";
2663   static const char __pyx_k_i[] = "i";
2664   static const char __pyx_k_j[] = "j";
2665   static const char __pyx_k_k[] = "k";
2666   static const char __pyx_k_l[] = "l";
2667   static const char __pyx_k_m[] = "m";
2668   static const char __pyx_k_n[] = "n";
2669   static const char __pyx_k_p[] = "p";
2670   static const char __pyx_k_q[] = "q";
2671   static const char __pyx_k_s[] = "s";
2672   static const char __pyx_k_t[] = "t";
2673   static const char __pyx_k_u[] = "u";
2674   static const char __pyx_k_v[] = "v";
2675   static const char __pyx_k_x[] = "x";
2676   static const char __pyx_k_y[] = "y";
2677   static const char __pyx_k_Ai[] = "Ai";
2678   static const char __pyx_k_E0[] = "E0";
2679   static const char __pyx_k_E1[] = "E1";
2680   static const char __pyx_k_P0[] = "P0";
2681   static const char __pyx_k__5[] = "()";
2682   static const char __pyx_k__6[] = "|";
2683   static const char __pyx_k_ax[] = "ax";
2684   static const char __pyx_k_dp[] = "dp";
2685   static const char __pyx_k_i0[] = "i0";
2686   static const char __pyx_k_id[] = "id";
2687   static const char __pyx_k_mi[] = "mi";
2688   static const char __pyx_k_nn[] = "nn";
2689   static const char __pyx_k_np[] = "np";
2690   static const char __pyx_k_nu[] = "nu";
2691   static const char __pyx_k_p0[] = "p0";
2692   static const char __pyx_k_p1[] = "p1";
2693   static const char __pyx_k_p2[] = "p2";
2694   static const char __pyx_k_q0[] = "q0";
2695   static const char __pyx_k_rv[] = "rv";
2696   static const char __pyx_k_y0[] = "y0";
2697   static const char __pyx_k_DLE[] = "DLE";
2698   static const char __pyx_k_DRE[] = "DRE";
2699   static const char __pyx_k__38[] = "^";
2700   static const char __pyx_k__39[] = ":";
2701 static const char __pyx_k__40[] = "}";
2702 static const char __pyx_k__41[] = ",";
2703 static const char __pyx_k_abs[] = "abs";
2704 static const char __pyx_k_dds[] = "dds";
2705 static const char __pyx_k_dim[] = "dim";
2706 static const char __pyx_k_end[] = "end";
2707 static const char __pyx_k_idx[] = "idx";
2708 static const char __pyx_k_ind[] = "ind";
2709 static const char __pyx_k_lsb[] = "lsb";
2710 static const char __pyx_k_lsz[] = "lsz";
2711 static const char __pyx_k_mas[] = "mas";
2712 static const char __pyx_k_max[] = "max";
2713 static const char __pyx_k_mi1[] = "mi1";
2714 static const char __pyx_k_mi2[] = "mi2";
2715 static const char __pyx_k_min[] = "min";
2716 static const char __pyx_k_mis[] = "mis";
2717 static const char __pyx_k_new[] = "__new__";
2718 static const char __pyx_k_nmi[] = "nmi";
2719 static const char __pyx_k_num[] = "num";
2720 static const char __pyx_k_obj[] = "obj";
2721 static const char __pyx_k_out[] = "out";
2722 static const char __pyx_k_pos[] = "pos";
2723 static const char __pyx_k_s_2[] = "(%s)";
2724 static const char __pyx_k_top[] = "top";
2725 static const char __pyx_k_zip[] = "zip";
2726 static const char __pyx_k_DLE1[] = "DLE1";
2727 static const char __pyx_k_DRE1[] = "DRE1";
2728 static const char __pyx_k_args[] = "args";
2729 static const char __pyx_k_base[] = "base";
2730 static const char __pyx_k_cbox[] = "cbox";
2731 static const char __pyx_k_dict[] = "__dict__";
2732 static const char __pyx_k_dist[] = "dist";
2733 static const char __pyx_k_done[] = "done";
2734 static const char __pyx_k_file[] = "file";
2735 static const char __pyx_k_ipos[] = "ipos";
2736 static const char __pyx_k_join[] = "join";
2737 static const char __pyx_k_jpos[] = "jpos";
2738 static const char __pyx_k_kind[] = "kind";
2739 static const char __pyx_k_last[] = "last";
2740 static const char __pyx_k_main[] = "__main__";
2741 static const char __pyx_k_mode[] = "mode";
2742 static const char __pyx_k_mstr[] = "mstr";
2743 static const char __pyx_k_name[] = "name";
2744 static const char __pyx_k_ndim[] = "ndim";
2745 static const char __pyx_k_ntot[] = "ntot";
2746 static const char __pyx_k_ntri[] = "ntri";
2747 static const char __pyx_k_pack[] = "pack";
2748 static const char __pyx_k_ppos[] = "ppos";
2749 static const char __pyx_k_qpos[] = "qpos";
2750 static const char __pyx_k_rbox[] = "rbox";
2751 static const char __pyx_k_size[] = "size";
2752 static const char __pyx_k_sqrt[] = "sqrt";
2753 static const char __pyx_k_step[] = "step";
2754 static const char __pyx_k_stop[] = "stop";
2755 static const char __pyx_k_test[] = "__test__";
2756 static const char __pyx_k_ASCII[] = "ASCII";
2757 static const char __pyx_k_array[] = "array";
2758 static const char __pyx_k_class[] = "__class__";
2759 static const char __pyx_k_coord[] = "coord";
2760 static const char __pyx_k_count[] = "count";
2761 static const char __pyx_k_dtype[] = "dtype";
2762 static const char __pyx_k_empty[] = "empty";
2763 static const char __pyx_k_error[] = "error";
2764 static const char __pyx_k_first[] = "first";
2765 static const char __pyx_k_flags[] = "flags";
2766 static const char __pyx_k_float[] = "float";
2767 static const char __pyx_k_index[] = "index";
2768 static const char __pyx_k_int64[] = "int64";
2769 static const char __pyx_k_numpy[] = "numpy";
2770 static const char __pyx_k_order[] = "order";
2771 static const char __pyx_k_pivot[] = "pivot";
2772 static const char __pyx_k_pos_x[] = "pos_x";
2773 static const char __pyx_k_pos_y[] = "pos_y";
2774 static const char __pyx_k_pos_z[] = "pos_z";
2775 static const char __pyx_k_print[] = "print";
2776 static const char __pyx_k_range[] = "range";
2777 static const char __pyx_k_shape[] = "shape";
2778 static const char __pyx_k_split[] = "split";
2779 static const char __pyx_k_stack[] = "stack";
2780 static const char __pyx_k_start[] = "start";
2781 static const char __pyx_k_strip[] = "strip";
2782 static const char __pyx_k_units[] = "units";
2783 static const char __pyx_k_zeros[] = "zeros";
2784 static const char __pyx_k_arange[] = "arange";
2785 static const char __pyx_k_astype[] = "astype";
2786 static const char __pyx_k_double[] = "double";
2787 static const char __pyx_k_encode[] = "encode";
2788 static const char __pyx_k_filter[] = "filter";
2789 static const char __pyx_k_format[] = "format";
2790 static const char __pyx_k_hstack[] = "hstack";
2791 static const char __pyx_k_idxmax[] = "idxmax";
2792 static const char __pyx_k_idxmin[] = "idxmin";
2793 static const char __pyx_k_import[] = "__import__";
2794 static const char __pyx_k_ind1_n[] = "ind1_n";
2795 static const char __pyx_k_ind2_n[] = "ind2_n";
2796 static const char __pyx_k_kwargs[] = "kwargs";
2797 static const char __pyx_k_left_x[] = "left_x";
2798 static const char __pyx_k_left_y[] = "left_y";
2799 static const char __pyx_k_left_z[] = "left_z";
2800 static const char __pyx_k_name_2[] = "__name__";
2801 static const char __pyx_k_nlines[] = "nlines";
2802 static const char __pyx_k_pickle[] = "pickle";
2803 static const char __pyx_k_points[] = "points";
2804 static const char __pyx_k_pstart[] = "pstart";
2805 static const char __pyx_k_rad_Ai[] = "rad_Ai";
2806 static const char __pyx_k_reduce[] = "__reduce__";
2807 static const char __pyx_k_resize[] = "resize";
2808 static const char __pyx_k_stride[] = "stride";
2809 static const char __pyx_k_struct[] = "struct";
2810 static const char __pyx_k_uint32[] = "uint32";
2811 static const char __pyx_k_uint64[] = "uint64";
2812 static const char __pyx_k_unique[] = "unique";
2813 static const char __pyx_k_unpack[] = "unpack";
2814 static const char __pyx_k_update[] = "update";
2815 static const char __pyx_k_argsort[] = "argsort";
2816 static const char __pyx_k_cbox_Ai[] = "cbox_Ai";
2817 static const char __pyx_k_cbox_hl[] = "cbox_hl";
2818 static const char __pyx_k_float32[] = "float32";
2819 static const char __pyx_k_float64[] = "float64";
2820 static const char __pyx_k_fortran[] = "fortran";
2821 static const char __pyx_k_func_ls[] = "func_ls";
2822 static const char __pyx_k_indices[] = "indices";
2823 static const char __pyx_k_memview[] = "memview";
2824 static const char __pyx_k_msdb_cy[] = "msdb_cy";
2825 static const char __pyx_k_rbox_Ai[] = "rbox_Ai";
2826 static const char __pyx_k_rbox_hl[] = "rbox_hl";
2827 static const char __pyx_k_Ellipsis[] = "Ellipsis";
2828 static const char __pyx_k_cbox_sol[] = "cbox_sol";
2829 static const char __pyx_k_defaults[] = "defaults";
2830 static const char __pyx_k_dim_list[] = "dim_list";
2831 static const char __pyx_k_getstate[] = "__getstate__";
2832 static const char __pyx_k_issorted[] = "issorted";
2833 static const char __pyx_k_itemsize[] = "itemsize";
2834 static const char __pyx_k_num_list[] = "num_list";
2835 static const char __pyx_k_periodic[] = "periodic";
2836 static const char __pyx_k_position[] = "position";
2837 static const char __pyx_k_pyx_type[] = "__pyx_type";
2838 static const char __pyx_k_rbox_sol[] = "rbox_sol";
2839 static const char __pyx_k_setstate[] = "__setstate__";
2840 static const char __pyx_k_sort_fwd[] = "sort_fwd";
2841 static const char __pyx_k_sort_rev[] = "sort_rev";
2842 static const char __pyx_k_tri_norm[] = "tri_norm";
2843 static const char __pyx_k_use_loop[] = "use_loop";
2844 static const char __pyx_k_TypeError[] = "TypeError";
2845 static const char __pyx_k_enumerate[] = "enumerate";
2846 static const char __pyx_k_fneighbor[] = "fneighbor";
2847 static const char __pyx_k_ifrexp_cy[] = "ifrexp_cy";
2848 static const char __pyx_k_max_index[] = "max_index";
2849 static const char __pyx_k_mergesort[] = "mergesort";
2850 static const char __pyx_k_neighbors[] = "neighbors";
2851 static const char __pyx_k_positions[] = "positions";
2852 static const char __pyx_k_pyx_state[] = "__pyx_state";
2853 static const char __pyx_k_recursive[] = "recursive";
2854 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
2855 static const char __pyx_k_triangles[] = "triangles";
2856 static const char __pyx_k_IndexError[] = "IndexError";
2857 static const char __pyx_k_ValueError[] = "ValueError";
2858 static const char __pyx_k_knn_direct[] = "knn_direct";
2859 static const char __pyx_k_knn_morton[] = "knn_morton";
2860 static const char __pyx_k_left_index[] = "left_index";
2861 static const char __pyx_k_max_index1[] = "max_index1";
2862 static const char __pyx_k_max_index2[] = "max_index2";
2863 static const char __pyx_k_neighbors1[] = "neighbors1";
2864 static const char __pyx_k_neighbors2[] = "neighbors2";
2865 static const char __pyx_k_plane_norm[] = "plane_norm";
2866 static const char __pyx_k_pyx_result[] = "__pyx_result";
2867 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
2868 static const char __pyx_k_return_rad[] = "return_rad";
2869 static const char __pyx_k_signatures[] = "signatures";
2870 static const char __pyx_k_xor_msb_cy[] = "xor_msb_cy";
2871 static const char __pyx_k_ImportError[] = "ImportError";
2872 static const char __pyx_k_MemoryError[] = "MemoryError";
2873 static const char __pyx_k_PickleError[] = "PickleError";
2874 static const char __pyx_k_code_length[] = "code_length";
2875 static const char __pyx_k_dist_to_box[] = "dist_to_box";
2876 static const char __pyx_k_filter_bbox[] = "filter_bbox";
2877 static const char __pyx_k_periodicity[] = "periodicity";
2878 static const char __pyx_k_return_dist[] = "return_dist";
2879 static const char __pyx_k_spread_bits[] = "spread_bits";
2880 static const char __pyx_k_RuntimeError[] = "RuntimeError";
2881 static const char __pyx_k_compact_bits[] = "compact_bits";
2882 static const char __pyx_k_mi_neighbors[] = "mi_neighbors";
2883 static const char __pyx_k_morton_index[] = "morton_index";
2884 static const char __pyx_k_morton_qsort[] = "morton_qsort";
2885 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
2886 static const char __pyx_k_quadtree_box[] = "quadtree_box";
2887 static const char __pyx_k_stringsource[] = "stringsource";
2888 static const char __pyx_k_line_segments[] = "line_segments";
2889 static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
2890 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
2891 static const char __pyx_k_compare_morton[] = "compare_morton";
2892 static const char __pyx_k_compute_morton[] = "compute_morton";
2893 static const char __pyx_k_csearch_morton[] = "csearch_morton";
2894 static const char __pyx_k_morton_indices[] = "morton_indices";
2895 static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
2896 static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
2897 static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
2898 static const char __pyx_k_hilbert_indices[] = "hilbert_indices";
2899 static const char __pyx_k_morton_neighbor[] = "morton_neighbor";
2900 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
2901 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
2902 static const char __pyx_k_solution_radius[] = "solution_radius";
2903 static const char __pyx_k_YTDomainOverflow[] = "YTDomainOverflow";
2904 static const char __pyx_k_bitwise_addition[] = "bitwise_addition";
2905 static const char __pyx_k_convert_to_units[] = "convert_to_units";
2906 static const char __pyx_k_domain_left_edge[] = "domain_left_edge";
2907 static const char __pyx_k_get_morton_index[] = "get_morton_index";
2908 static const char __pyx_k_get_morton_point[] = "get_morton_point";
2909 static const char __pyx_k_Point_exceeds_max[] = "Point exceeds max ({}) ";
2910 static const char __pyx_k_domain_right_edge[] = "domain_right_edge";
2911 static const char __pyx_k_get_morton_points[] = "get_morton_points";
2912 static const char __pyx_k_morton_qsort_swap[] = "morton_qsort_swap";
2913 static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
2914 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2915 static const char __pyx_k_get_hilbert_points[] = "get_hilbert_points";
2916 static const char __pyx_k_get_morton_indices[] = "get_morton_indices";
2917 static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
2918 static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
2919 static const char __pyx_k_get_hilbert_indices[] = "get_hilbert_indices";
2920 static const char __pyx_k_get_morton_argsort1[] = "get_morton_argsort1";
2921 static const char __pyx_k_for_64bit_interleave[] = "for 64bit interleave.";
2922 static const char __pyx_k_get_morton_neighbors[] = "get_morton_neighbors";
2923 static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
2924 static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
2925 static const char __pyx_k_for_64_bit_interleave[] = "for 64 bit interleave.";
2926 static const char __pyx_k_outside_rad_rbox_dist[] = "{} outside: rad = {}, rbox = {}, dist = {}";
2927 static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
2928 static const char __pyx_k_morton_qsort_iterative[] = "morton_qsort_iterative";
2929 static const char __pyx_k_morton_qsort_partition[] = "morton_qsort_partition";
2930 static const char __pyx_k_morton_qsort_recursive[] = "morton_qsort_recursive";
2931 static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
2932 static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
2933 static const char __pyx_k_morton_neighbor_bounded[] = "morton_neighbor_bounded";
2934 static const char __pyx_k_yt_utilities_exceptions[] = "yt.utilities.exceptions";
2935 static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
2936 static const char __pyx_k_Could_not_identify_dtype[] = "Could not identify dtype.";
2937 static const char __pyx_k_morton_neighbor_periodic[] = "morton_neighbor_periodic";
2938 static const char __pyx_k_triangle_plane_intersect[] = "triangle_plane_intersect";
2939 static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
2940 static const char __pyx_k_get_morton_indices_unravel[] = "get_morton_indices_unravel";
2941 static const char __pyx_k_No_matching_signature_found[] = "No matching signature found";
2942 static const char __pyx_k_get_morton_neighbors_coarse[] = "get_morton_neighbors_coarse";
2943 static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
2944 static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
2945 static const char __pyx_k_get_morton_neighbors_refined[] = "get_morton_neighbors_refined";
2946 static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
2947 static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
2948 static const char __pyx_k_Simple_integrators_for_the_radi[] = "\nSimple integrators for the radiative transfer equation\n\n\n\n";
2949 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
2950 static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
2951 static const char __pyx_k_yt_utilities_lib_geometry_utils[] = "yt/utilities/lib/geometry_utils.pyx";
2952 static const char __pyx_k_Both_l_and_h_must_be_on_the_same[] = "Both l and h must be on the same side of i.";
2953 static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
2954 static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
2955 static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
2956 static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
2957 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
2958 static const char __pyx_k_Expected_at_least_d_argument_s_g[] = "Expected at least %d argument%s, got %d";
2959 static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
2960 static const char __pyx_k_Function_call_with_ambiguous_arg[] = "Function call with ambiguous argument types";
2961 static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))";
2962 static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
2963 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
2964 static const char __pyx_k_It_should_be_geometrically_impos[] = "It should be geometrically impossible for a plane toto intersect all three legs of a triangle. Please contactyt developers with your mesh";
2965 static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
2966 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
2967 static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
2968 static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
2969 static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
2970 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
2971 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
2972 static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
2973 static const char __pyx_k_yt_utilities_lib_geometry_utils_2[] = "yt.utilities.lib.geometry_utils";
2974 static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
2975 static PyObject *__pyx_kp_b_;
2976 static PyObject *__pyx_kp_s_;
2977 static PyObject *__pyx_kp_s_0;
2978 static PyObject *__pyx_kp_s_1;
2979 static PyObject *__pyx_n_s_ASCII;
2980 static PyObject *__pyx_n_s_Ai;
2981 static PyObject *__pyx_kp_s_Both_l_and_h_must_be_on_the_same;
2982 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
2983 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
2984 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
2985 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
2986 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
2987 static PyObject *__pyx_kp_s_Could_not_identify_dtype;
2988 static PyObject *__pyx_n_s_DLE;
2989 static PyObject *__pyx_n_s_DLE1;
2990 static PyObject *__pyx_n_s_DRE;
2991 static PyObject *__pyx_n_s_DRE1;
2992 static PyObject *__pyx_n_s_E0;
2993 static PyObject *__pyx_n_s_E1;
2994 static PyObject *__pyx_n_s_Ellipsis;
2995 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
2996 static PyObject *__pyx_kp_s_Expected_at_least_d_argument_s_g;
2997 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
2998 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
2999 static PyObject *__pyx_kp_s_Function_call_with_ambiguous_arg;
3000 static PyObject *__pyx_n_s_I;
3001 static PyObject *__pyx_n_s_ImportError;
3002 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
3003 static PyObject *__pyx_n_s_IndexError;
3004 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
3005 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
3006 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
3007 static PyObject *__pyx_kp_s_It_should_be_geometrically_impos;
3008 static PyObject *__pyx_n_s_MemoryError;
3009 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
3010 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
3011 static PyObject *__pyx_n_s_N;
3012 static PyObject *__pyx_kp_s_No_matching_signature_found;
3013 static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
3014 static PyObject *__pyx_n_s_NotImplementedError;
3015 static PyObject *__pyx_n_b_O;
3016 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
3017 static PyObject *__pyx_n_s_P;
3018 static PyObject *__pyx_n_s_P0;
3019 static PyObject *__pyx_n_s_PickleError;
3020 static PyObject *__pyx_kp_s_Point_exceeds_max;
3021 static PyObject *__pyx_n_s_RuntimeError;
3022 static PyObject *__pyx_kp_b_T;
3023 static PyObject *__pyx_n_s_TypeError;
3024 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
3025 static PyObject *__pyx_n_s_ValueError;
3026 static PyObject *__pyx_n_s_View_MemoryView;
3027 static PyObject *__pyx_n_s_YTDomainOverflow;
3028 static PyObject *__pyx_kp_b__38;
3029 static PyObject *__pyx_kp_b__39;
3030 static PyObject *__pyx_kp_b__40;
3031 static PyObject *__pyx_kp_u__41;
3032 static PyObject *__pyx_kp_s__5;
3033 static PyObject *__pyx_kp_s__6;
3034 static PyObject *__pyx_n_s_a;
3035 static PyObject *__pyx_n_s_abs;
3036 static PyObject *__pyx_n_s_allocate_buffer;
3037 static PyObject *__pyx_n_s_arange;
3038 static PyObject *__pyx_n_s_args;
3039 static PyObject *__pyx_n_s_argsort;
3040 static PyObject *__pyx_n_s_array;
3041 static PyObject *__pyx_n_s_astype;
3042 static PyObject *__pyx_n_s_ax;
3043 static PyObject *__pyx_n_s_b;
3044 static PyObject *__pyx_n_s_base;
3045 static PyObject *__pyx_n_s_bitwise_addition;
3046 static PyObject *__pyx_n_s_c;
3047 static PyObject *__pyx_n_u_c;
3048 static PyObject *__pyx_n_s_cbox;
3049 static PyObject *__pyx_n_s_cbox_Ai;
3050 static PyObject *__pyx_n_s_cbox_hl;
3051 static PyObject *__pyx_n_s_cbox_sol;
3052 static PyObject *__pyx_n_s_class;
3053 static PyObject *__pyx_n_s_cline_in_traceback;
3054 static PyObject *__pyx_n_s_code_length;
3055 static PyObject *__pyx_n_s_compact_bits;
3056 static PyObject *__pyx_n_s_compare_morton;
3057 static PyObject *__pyx_n_s_compute_morton;
3058 static PyObject *__pyx_kp_s_contiguous_and_direct;
3059 static PyObject *__pyx_kp_s_contiguous_and_indirect;
3060 static PyObject *__pyx_n_s_convert_to_units;
3061 static PyObject *__pyx_n_s_coord;
3062 static PyObject *__pyx_n_s_count;
3063 static PyObject *__pyx_n_s_csearch_morton;
3064 static PyObject *__pyx_n_s_d;
3065 static PyObject *__pyx_n_s_dds;
3066 static PyObject *__pyx_n_s_defaults;
3067 static PyObject *__pyx_n_s_dict;
3068 static PyObject *__pyx_n_s_dim;
3069 static PyObject *__pyx_n_s_dim_list;
3070 static PyObject *__pyx_n_s_dist;
3071 static PyObject *__pyx_n_s_dist_to_box;
3072 static PyObject *__pyx_n_s_domain_left_edge;
3073 static PyObject *__pyx_n_s_domain_right_edge;
3074 static PyObject *__pyx_n_s_done;
3075 static PyObject *__pyx_n_s_double;
3076 static PyObject *__pyx_n_s_dp;
3077 static PyObject *__pyx_n_s_dtype;
3078 static PyObject *__pyx_n_s_dtype_is_object;
3079 static PyObject *__pyx_n_s_e;
3080 static PyObject *__pyx_n_s_empty;
3081 static PyObject *__pyx_n_s_encode;
3082 static PyObject *__pyx_n_s_end;
3083 static PyObject *__pyx_n_s_enumerate;
3084 static PyObject *__pyx_n_s_error;
3085 static PyObject *__pyx_n_s_file;
3086 static PyObject *__pyx_n_s_filter;
3087 static PyObject *__pyx_n_s_filter_bbox;
3088 static PyObject *__pyx_n_s_first;
3089 static PyObject *__pyx_n_s_flags;
3090 static PyObject *__pyx_n_s_float;
3091 static PyObject *__pyx_n_s_float32;
3092 static PyObject *__pyx_n_s_float64;
3093 static PyObject *__pyx_n_s_fneighbor;
3094 static PyObject *__pyx_kp_s_for_64_bit_interleave;
3095 static PyObject *__pyx_kp_s_for_64bit_interleave;
3096 static PyObject *__pyx_n_s_format;
3097 static PyObject *__pyx_n_s_fortran;
3098 static PyObject *__pyx_n_u_fortran;
3099 static PyObject *__pyx_n_s_func_ls;
3100 static PyObject *__pyx_n_s_get_hilbert_indices;
3101 static PyObject *__pyx_n_s_get_hilbert_points;
3102 static PyObject *__pyx_n_s_get_morton_argsort1;
3103 static PyObject *__pyx_n_s_get_morton_index;
3104 static PyObject *__pyx_n_s_get_morton_indices;
3105 static PyObject *__pyx_n_s_get_morton_indices_unravel;
3106 static PyObject *__pyx_n_s_get_morton_neighbors;
3107 static PyObject *__pyx_n_s_get_morton_neighbors_coarse;
3108 static PyObject *__pyx_n_s_get_morton_neighbors_refined;
3109 static PyObject *__pyx_n_s_get_morton_point;
3110 static PyObject *__pyx_n_s_get_morton_points;
3111 static PyObject *__pyx_n_s_getstate;
3112 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
3113 static PyObject *__pyx_n_s_h;
3114 static PyObject *__pyx_n_s_hilbert_indices;
3115 static PyObject *__pyx_n_s_hstack;
3116 static PyObject *__pyx_n_s_i;
3117 static PyObject *__pyx_n_s_i0;
3118 static PyObject *__pyx_n_s_id;
3119 static PyObject *__pyx_n_s_idx;
3120 static PyObject *__pyx_n_s_idxmax;
3121 static PyObject *__pyx_n_s_idxmin;
3122 static PyObject *__pyx_n_s_ifrexp_cy;
3123 static PyObject *__pyx_n_s_import;
3124 static PyObject *__pyx_n_s_ind;
3125 static PyObject *__pyx_n_s_ind1_n;
3126 static PyObject *__pyx_n_s_ind2_n;
3127 static PyObject *__pyx_n_s_index;
3128 static PyObject *__pyx_n_s_indices;
3129 static PyObject *__pyx_n_s_int64;
3130 static PyObject *__pyx_n_s_ipos;
3131 static PyObject *__pyx_n_s_issorted;
3132 static PyObject *__pyx_n_s_itemsize;
3133 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
3134 static PyObject *__pyx_n_s_j;
3135 static PyObject *__pyx_n_s_join;
3136 static PyObject *__pyx_n_s_jpos;
3137 static PyObject *__pyx_n_s_k;
3138 static PyObject *__pyx_n_s_kind;
3139 static PyObject *__pyx_n_s_knn_direct;
3140 static PyObject *__pyx_n_s_knn_morton;
3141 static PyObject *__pyx_n_s_kwargs;
3142 static PyObject *__pyx_n_s_l;
3143 static PyObject *__pyx_n_s_last;
3144 static PyObject *__pyx_n_s_left_index;
3145 static PyObject *__pyx_n_s_left_x;
3146 static PyObject *__pyx_n_s_left_y;
3147 static PyObject *__pyx_n_s_left_z;
3148 static PyObject *__pyx_n_s_line_segments;
3149 static PyObject *__pyx_n_s_lsb;
3150 static PyObject *__pyx_n_s_lsz;
3151 static PyObject *__pyx_n_s_m;
3152 static PyObject *__pyx_n_s_main;
3153 static PyObject *__pyx_n_s_mas;
3154 static PyObject *__pyx_n_s_max;
3155 static PyObject *__pyx_n_s_max_index;
3156 static PyObject *__pyx_n_s_max_index1;
3157 static PyObject *__pyx_n_s_max_index2;
3158 static PyObject *__pyx_n_s_memview;
3159 static PyObject *__pyx_n_s_mergesort;
3160 static PyObject *__pyx_n_s_mi;
3161 static PyObject *__pyx_n_s_mi1;
3162 static PyObject *__pyx_n_s_mi2;
3163 static PyObject *__pyx_n_s_mi_neighbors;
3164 static PyObject *__pyx_n_s_min;
3165 static PyObject *__pyx_n_s_mis;
3166 static PyObject *__pyx_n_s_mode;
3167 static PyObject *__pyx_n_s_morton_index;
3168 static PyObject *__pyx_n_s_morton_indices;
3169 static PyObject *__pyx_n_s_morton_neighbor;
3170 static PyObject *__pyx_n_s_morton_neighbor_bounded;
3171 static PyObject *__pyx_n_s_morton_neighbor_periodic;
3172 static PyObject *__pyx_n_s_morton_qsort;
3173 static PyObject *__pyx_n_s_morton_qsort_iterative;
3174 static PyObject *__pyx_n_s_morton_qsort_partition;
3175 static PyObject *__pyx_n_s_morton_qsort_recursive;
3176 static PyObject *__pyx_n_s_morton_qsort_swap;
3177 static PyObject *__pyx_n_s_msdb_cy;
3178 static PyObject *__pyx_n_s_mstr;
3179 static PyObject *__pyx_n_s_n;
3180 static PyObject *__pyx_n_s_name;
3181 static PyObject *__pyx_n_s_name_2;
3182 static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
3183 static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
3184 static PyObject *__pyx_n_s_ndim;
3185 static PyObject *__pyx_n_s_neighbors;
3186 static PyObject *__pyx_n_s_neighbors1;
3187 static PyObject *__pyx_n_s_neighbors2;
3188 static PyObject *__pyx_n_s_new;
3189 static PyObject *__pyx_n_s_nlines;
3190 static PyObject *__pyx_n_s_nmi;
3191 static PyObject *__pyx_n_s_nn;
3192 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
3193 static PyObject *__pyx_n_s_np;
3194 static PyObject *__pyx_n_s_ntot;
3195 static PyObject *__pyx_n_s_ntri;
3196 static PyObject *__pyx_n_s_nu;
3197 static PyObject *__pyx_n_s_num;
3198 static PyObject *__pyx_n_s_num_list;
3199 static PyObject *__pyx_n_s_numpy;
3200 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
3201 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
3202 static PyObject *__pyx_n_s_obj;
3203 static PyObject *__pyx_n_s_order;
3204 static PyObject *__pyx_n_s_out;
3205 static PyObject *__pyx_kp_s_outside_rad_rbox_dist;
3206 static PyObject *__pyx_n_s_p;
3207 static PyObject *__pyx_n_s_p0;
3208 static PyObject *__pyx_n_s_p1;
3209 static PyObject *__pyx_n_s_p2;
3210 static PyObject *__pyx_n_s_pack;
3211 static PyObject *__pyx_n_s_periodic;
3212 static PyObject *__pyx_n_s_periodicity;
3213 static PyObject *__pyx_n_s_pickle;
3214 static PyObject *__pyx_n_s_pivot;
3215 static PyObject *__pyx_n_s_plane_norm;
3216 static PyObject *__pyx_n_s_points;
3217 static PyObject *__pyx_n_s_pos;
3218 static PyObject *__pyx_n_s_pos_x;
3219 static PyObject *__pyx_n_s_pos_y;
3220 static PyObject *__pyx_n_s_pos_z;
3221 static PyObject *__pyx_n_s_position;
3222 static PyObject *__pyx_n_s_positions;
3223 static PyObject *__pyx_n_s_ppos;
3224 static PyObject *__pyx_n_s_print;
3225 static PyObject *__pyx_n_s_pstart;
3226 static PyObject *__pyx_n_s_pyx_PickleError;
3227 static PyObject *__pyx_n_s_pyx_checksum;
3228 static PyObject *__pyx_n_s_pyx_getbuffer;
3229 static PyObject *__pyx_n_s_pyx_result;
3230 static PyObject *__pyx_n_s_pyx_state;
3231 static PyObject *__pyx_n_s_pyx_type;
3232 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
3233 static PyObject *__pyx_n_s_pyx_vtable;
3234 static PyObject *__pyx_n_s_q;
3235 static PyObject *__pyx_n_s_q0;
3236 static PyObject *__pyx_n_s_qpos;
3237 static PyObject *__pyx_n_s_quadtree_box;
3238 static PyObject *__pyx_n_s_rad_Ai;
3239 static PyObject *__pyx_n_s_range;
3240 static PyObject *__pyx_n_s_rbox;
3241 static PyObject *__pyx_n_s_rbox_Ai;
3242 static PyObject *__pyx_n_s_rbox_hl;
3243 static PyObject *__pyx_n_s_rbox_sol;
3244 static PyObject *__pyx_n_s_recursive;
3245 static PyObject *__pyx_n_s_reduce;
3246 static PyObject *__pyx_n_s_reduce_cython;
3247 static PyObject *__pyx_n_s_reduce_ex;
3248 static PyObject *__pyx_n_s_resize;
3249 static PyObject *__pyx_n_s_return_dist;
3250 static PyObject *__pyx_n_s_return_rad;
3251 static PyObject *__pyx_n_s_rv;
3252 static PyObject *__pyx_n_s_s;
3253 static PyObject *__pyx_kp_u_s_2;
3254 static PyObject *__pyx_n_s_setstate;
3255 static PyObject *__pyx_n_s_setstate_cython;
3256 static PyObject *__pyx_n_s_shape;
3257 static PyObject *__pyx_n_s_signatures;
3258 static PyObject *__pyx_n_s_size;
3259 static PyObject *__pyx_n_s_solution_radius;
3260 static PyObject *__pyx_n_s_sort_fwd;
3261 static PyObject *__pyx_n_s_sort_rev;
3262 static PyObject *__pyx_n_s_split;
3263 static PyObject *__pyx_n_s_spread_bits;
3264 static PyObject *__pyx_n_s_sqrt;
3265 static PyObject *__pyx_n_s_stack;
3266 static PyObject *__pyx_n_s_start;
3267 static PyObject *__pyx_n_s_step;
3268 static PyObject *__pyx_n_s_stop;
3269 static PyObject *__pyx_n_s_stride;
3270 static PyObject *__pyx_kp_s_strided_and_direct;
3271 static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
3272 static PyObject *__pyx_kp_s_strided_and_indirect;
3273 static PyObject *__pyx_kp_s_stringsource;
3274 static PyObject *__pyx_n_s_strip;
3275 static PyObject *__pyx_n_s_struct;
3276 static PyObject *__pyx_n_s_t;
3277 static PyObject *__pyx_n_s_test;
3278 static PyObject *__pyx_n_s_top;
3279 static PyObject *__pyx_n_s_tri_norm;
3280 static PyObject *__pyx_n_s_triangle_plane_intersect;
3281 static PyObject *__pyx_n_s_triangles;
3282 static PyObject *__pyx_n_s_u;
3283 static PyObject *__pyx_n_s_uint32;
3284 static PyObject *__pyx_n_s_uint64;
3285 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
3286 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
3287 static PyObject *__pyx_n_s_unique;
3288 static PyObject *__pyx_n_s_units;
3289 static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
3290 static PyObject *__pyx_n_s_unpack;
3291 static PyObject *__pyx_n_s_update;
3292 static PyObject *__pyx_n_s_use_loop;
3293 static PyObject *__pyx_n_s_v;
3294 static PyObject *__pyx_n_s_x;
3295 static PyObject *__pyx_n_s_xor_msb_cy;
3296 static PyObject *__pyx_n_s_y;
3297 static PyObject *__pyx_n_s_y0;
3298 static PyObject *__pyx_n_s_yt_utilities_exceptions;
3299 static PyObject *__pyx_kp_s_yt_utilities_lib_geometry_utils;
3300 static PyObject *__pyx_n_s_yt_utilities_lib_geometry_utils_2;
3301 static PyObject *__pyx_n_s_zeros;
3302 static PyObject *__pyx_n_s_zip;
3303 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_spread_bits(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_uint64_t __pyx_v_x); /* proto */
3304 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_2compact_bits(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_uint64_t __pyx_v_x); /* proto */
3305 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_4lsz(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_uint64_t __pyx_v_v, int __pyx_v_stride, int __pyx_v_start); /* proto */
3306 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_6lsb(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_uint64_t __pyx_v_v, int __pyx_v_stride, int __pyx_v_start); /* proto */
3307 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_8bitwise_addition(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_uint64_t __pyx_v_x, __pyx_t_5numpy_int64_t __pyx_v_y0, int __pyx_v_stride, int __pyx_v_start); /* proto */
3308 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_10get_hilbert_indices(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_order, PyArrayObject *__pyx_v_left_index); /* proto */
3309 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_12get_hilbert_points(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_order, PyArrayObject *__pyx_v_indices); /* proto */
3310 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_14get_morton_index(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left_index); /* proto */
3311 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_16get_morton_indices(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left_index); /* proto */
3312 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_18get_morton_indices_unravel(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left_x, PyArrayObject *__pyx_v_left_y, PyArrayObject *__pyx_v_left_z); /* proto */
3313 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_20get_morton_point(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_uint64_t __pyx_v_index); /* proto */
3314 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_22get_morton_points(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_indices); /* proto */
3315 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_24get_morton_neighbors_coarse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_mi1, PyObject *__pyx_v_max_index1, PyObject *__pyx_v_periodic, PyObject *__pyx_v_nn); /* proto */
3316 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_26get_morton_neighbors_refined(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_mi1, PyObject *__pyx_v_mi2, PyObject *__pyx_v_max_index1, PyObject *__pyx_v_max_index2, PyObject *__pyx_v_periodic, PyObject *__pyx_v_nn); /* proto */
3317 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_28morton_neighbor_periodic(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_p, PyObject *__pyx_v_dim_list, PyObject *__pyx_v_num_list, __pyx_t_5numpy_uint64_t __pyx_v_max_index); /* proto */
3318 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_30morton_neighbor_bounded(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_p, PyObject *__pyx_v_dim_list, PyObject *__pyx_v_num_list, __pyx_t_5numpy_uint64_t __pyx_v_max_index); /* proto */
3319 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_32morton_neighbor(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_p, PyObject *__pyx_v_dim_list, PyObject *__pyx_v_num_list, __pyx_t_5numpy_uint64_t __pyx_v_max_index, PyObject *__pyx_v_periodic); /* proto */
3320 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_34get_morton_neighbors(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mi, int __pyx_v_order, PyObject *__pyx_v_periodic); /* proto */
3321 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_36ifrexp_cy(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_float64_t __pyx_v_x); /* proto */
3322 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_38msdb_cy(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_int64_t __pyx_v_a, __pyx_t_5numpy_int64_t __pyx_v_b); /* proto */
3323 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_40msdb_cy(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_int64_t __pyx_v_a, __pyx_t_5numpy_int64_t __pyx_v_b); /* proto */
3324 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_42xor_msb_cy(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b); /* proto */
3325 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_44morton_qsort_swap(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_ind, __pyx_t_5numpy_uint64_t __pyx_v_a, __pyx_t_5numpy_uint64_t __pyx_v_b); /* proto */
3326 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_46morton_qsort_partition(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults); /* proto */
3327 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_116__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
3328 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_76morton_qsort_partition(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_int64_t __pyx_v_l, __pyx_t_5numpy_int64_t __pyx_v_h, PyArrayObject *__pyx_v_ind, PyObject *__pyx_v_use_loop); /* proto */
3329 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_118__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
3330 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_78morton_qsort_partition(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_int64_t __pyx_v_l, __pyx_t_5numpy_int64_t __pyx_v_h, PyArrayObject *__pyx_v_ind, PyObject *__pyx_v_use_loop); /* proto */
3331 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_48morton_qsort_recursive(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults); /* proto */
3332 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_124__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
3333 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_82morton_qsort_recursive(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_int64_t __pyx_v_l, __pyx_t_5numpy_int64_t __pyx_v_h, PyArrayObject *__pyx_v_ind, PyObject *__pyx_v_use_loop); /* proto */
3334 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_126__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
3335 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_84morton_qsort_recursive(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_int64_t __pyx_v_l, __pyx_t_5numpy_int64_t __pyx_v_h, PyArrayObject *__pyx_v_ind, PyObject *__pyx_v_use_loop); /* proto */
3336 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_50morton_qsort_iterative(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults); /* proto */
3337 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_132__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
3338 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_88morton_qsort_iterative(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_int64_t __pyx_v_l, __pyx_t_5numpy_int64_t __pyx_v_h, PyArrayObject *__pyx_v_ind, PyObject *__pyx_v_use_loop); /* proto */
3339 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_134__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
3340 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_90morton_qsort_iterative(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_int64_t __pyx_v_l, __pyx_t_5numpy_int64_t __pyx_v_h, PyArrayObject *__pyx_v_ind, PyObject *__pyx_v_use_loop); /* proto */
3341 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_52morton_qsort(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults); /* proto */
3342 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_140__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
3343 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_94morton_qsort(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_int64_t __pyx_v_l, __pyx_t_5numpy_int64_t __pyx_v_h, PyArrayObject *__pyx_v_ind, PyObject *__pyx_v_recursive, PyObject *__pyx_v_use_loop); /* proto */
3344 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_142__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
3345 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_96morton_qsort(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_int64_t __pyx_v_l, __pyx_t_5numpy_int64_t __pyx_v_h, PyArrayObject *__pyx_v_ind, PyObject *__pyx_v_recursive, PyObject *__pyx_v_use_loop); /* proto */
3346 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_54get_morton_argsort1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults); /* proto */
3347 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_100get_morton_argsort1(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_int64_t __pyx_v_start, __pyx_t_5numpy_int64_t __pyx_v_end, PyArrayObject *__pyx_v_ind); /* proto */
3348 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_102get_morton_argsort1(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_int64_t __pyx_v_start, __pyx_t_5numpy_int64_t __pyx_v_end, PyArrayObject *__pyx_v_ind); /* proto */
3349 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_56compare_morton(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults); /* proto */
3350 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_106compare_morton(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_p0, PyArrayObject *__pyx_v_q0); /* proto */
3351 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_108compare_morton(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_p0, PyArrayObject *__pyx_v_q0); /* proto */
3352 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_58compute_morton(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos_x, PyArrayObject *__pyx_v_pos_y, PyArrayObject *__pyx_v_pos_z, PyObject *__pyx_v_domain_left_edge, PyObject *__pyx_v_domain_right_edge, PyObject *__pyx_v_filter_bbox, PyObject *__pyx_v_order); /* proto */
3353 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_60dist(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_p0, PyArrayObject *__pyx_v_q0); /* proto */
3354 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_62dist_to_box(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_p, PyArrayObject *__pyx_v_cbox, __pyx_t_5numpy_float64_t __pyx_v_rbox); /* proto */
3355 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_64solution_radius(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_P, int __pyx_v_k, __pyx_t_5numpy_uint64_t __pyx_v_i, PyArrayObject *__pyx_v_idx, int __pyx_v_order, PyArrayObject *__pyx_v_DLE, PyArrayObject *__pyx_v_DRE); /* proto */
3356 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_66knn_direct(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_P, __pyx_t_5numpy_uint64_t __pyx_v_k, __pyx_t_5numpy_uint64_t __pyx_v_i, PyArrayObject *__pyx_v_idx, PyObject *__pyx_v_return_dist, PyObject *__pyx_v_return_rad); /* proto */
3357 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_68quadtree_box(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_p, PyArrayObject *__pyx_v_q, int __pyx_v_order, PyArrayObject *__pyx_v_DLE, PyArrayObject *__pyx_v_DRE, PyArrayObject *__pyx_v_c); /* proto */
3358 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_70csearch_morton(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_P, int __pyx_v_k, __pyx_t_5numpy_uint64_t __pyx_v_i, PyArrayObject *__pyx_v_Ai, __pyx_t_5numpy_uint64_t __pyx_v_l, __pyx_t_5numpy_uint64_t __pyx_v_h, int __pyx_v_order, PyArrayObject *__pyx_v_DLE, PyArrayObject *__pyx_v_DRE, int __pyx_v_nu); /* proto */
3359 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_72knn_morton(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_P0, int __pyx_v_k, __pyx_t_5numpy_uint64_t __pyx_v_i0, float __pyx_v_c, int __pyx_v_nu, PyObject *__pyx_v_issorted, int __pyx_v_order, PyArrayObject *__pyx_v_DLE, PyArrayObject *__pyx_v_DRE); /* proto */
3360 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_74triangle_plane_intersect(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_ax, __pyx_t_5numpy_float64_t __pyx_v_coord, PyArrayObject *__pyx_v_triangles); /* proto */
3361 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
3362 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
3363 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 */
3364 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 */
3365 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
3366 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
3367 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
3368 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
3369 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
3370 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 */
3371 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
3372 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 */
3373 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
3374 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
3375 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
3376 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
3377 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 */
3378 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3379 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
3380 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 */
3381 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 */
3382 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3383 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3384 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3385 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3386 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3387 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3388 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3389 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3390 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3391 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3392 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3393 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3394 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3395 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3396 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3397 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3398 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3399 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 */
3400 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
3401 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
3402 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
3403 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 */
3404 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 */
3405 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3406 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3407 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3408 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3409 static PyObject *__pyx_float_1_5;
3410 static PyObject *__pyx_int_0;
3411 static PyObject *__pyx_int_1;
3412 static PyObject *__pyx_int_2;
3413 static PyObject *__pyx_int_3;
3414 static PyObject *__pyx_int_4;
3415 static PyObject *__pyx_int_20;
3416 static PyObject *__pyx_int_2097151;
3417 static PyObject *__pyx_int_184977713;
3418 static PyObject *__pyx_int_neg_1;
3419 static PyArrayObject *__pyx_k__11;
3420 static PyArrayObject *__pyx_k__12;
3421 static PyObject *__pyx_slice__2;
3422 static PyObject *__pyx_slice__4;
3423 static PyObject *__pyx_tuple__3;
3424 static PyObject *__pyx_tuple__7;
3425 static PyObject *__pyx_tuple__8;
3426 static PyObject *__pyx_tuple__9;
3427 static PyObject *__pyx_tuple__10;
3428 static PyObject *__pyx_tuple__13;
3429 static PyObject *__pyx_tuple__14;
3430 static PyObject *__pyx_tuple__15;
3431 static PyObject *__pyx_tuple__16;
3432 static PyObject *__pyx_tuple__17;
3433 static PyObject *__pyx_tuple__18;
3434 static PyObject *__pyx_tuple__19;
3435 static PyObject *__pyx_tuple__20;
3436 static PyObject *__pyx_tuple__21;
3437 static PyObject *__pyx_tuple__22;
3438 static PyObject *__pyx_tuple__23;
3439 static PyObject *__pyx_tuple__24;
3440 static PyObject *__pyx_tuple__25;
3441 static PyObject *__pyx_tuple__26;
3442 static PyObject *__pyx_tuple__27;
3443 static PyObject *__pyx_tuple__28;
3444 static PyObject *__pyx_tuple__29;
3445 static PyObject *__pyx_tuple__30;
3446 static PyObject *__pyx_tuple__31;
3447 static PyObject *__pyx_tuple__32;
3448 static PyObject *__pyx_tuple__33;
3449 static PyObject *__pyx_tuple__34;
3450 static PyObject *__pyx_tuple__35;
3451 static PyObject *__pyx_tuple__36;
3452 static PyObject *__pyx_tuple__37;
3453 static PyObject *__pyx_tuple__42;
3454 static PyObject *__pyx_tuple__44;
3455 static PyObject *__pyx_tuple__46;
3456 static PyObject *__pyx_tuple__48;
3457 static PyObject *__pyx_tuple__50;
3458 static PyObject *__pyx_tuple__52;
3459 static PyObject *__pyx_tuple__54;
3460 static PyObject *__pyx_tuple__56;
3461 static PyObject *__pyx_tuple__58;
3462 static PyObject *__pyx_tuple__60;
3463 static PyObject *__pyx_tuple__62;
3464 static PyObject *__pyx_tuple__64;
3465 static PyObject *__pyx_tuple__66;
3466 static PyObject *__pyx_tuple__68;
3467 static PyObject *__pyx_tuple__70;
3468 static PyObject *__pyx_tuple__72;
3469 static PyObject *__pyx_tuple__74;
3470 static PyObject *__pyx_tuple__76;
3471 static PyObject *__pyx_tuple__78;
3472 static PyObject *__pyx_tuple__80;
3473 static PyObject *__pyx_tuple__82;
3474 static PyObject *__pyx_tuple__84;
3475 static PyObject *__pyx_tuple__86;
3476 static PyObject *__pyx_tuple__88;
3477 static PyObject *__pyx_tuple__90;
3478 static PyObject *__pyx_tuple__92;
3479 static PyObject *__pyx_tuple__94;
3480 static PyObject *__pyx_tuple__96;
3481 static PyObject *__pyx_tuple__98;
3482 static PyObject *__pyx_tuple__100;
3483 static PyObject *__pyx_tuple__102;
3484 static PyObject *__pyx_tuple__104;
3485 static PyObject *__pyx_tuple__106;
3486 static PyObject *__pyx_tuple__108;
3487 static PyObject *__pyx_tuple__110;
3488 static PyObject *__pyx_tuple__112;
3489 static PyObject *__pyx_tuple__114;
3490 static PyObject *__pyx_tuple__116;
3491 static PyObject *__pyx_tuple__118;
3492 static PyObject *__pyx_tuple__119;
3493 static PyObject *__pyx_tuple__120;
3494 static PyObject *__pyx_tuple__121;
3495 static PyObject *__pyx_tuple__122;
3496 static PyObject *__pyx_tuple__123;
3497 static PyObject *__pyx_codeobj__43;
3498 static PyObject *__pyx_codeobj__45;
3499 static PyObject *__pyx_codeobj__47;
3500 static PyObject *__pyx_codeobj__49;
3501 static PyObject *__pyx_codeobj__51;
3502 static PyObject *__pyx_codeobj__53;
3503 static PyObject *__pyx_codeobj__55;
3504 static PyObject *__pyx_codeobj__57;
3505 static PyObject *__pyx_codeobj__59;
3506 static PyObject *__pyx_codeobj__61;
3507 static PyObject *__pyx_codeobj__63;
3508 static PyObject *__pyx_codeobj__65;
3509 static PyObject *__pyx_codeobj__67;
3510 static PyObject *__pyx_codeobj__69;
3511 static PyObject *__pyx_codeobj__71;
3512 static PyObject *__pyx_codeobj__73;
3513 static PyObject *__pyx_codeobj__75;
3514 static PyObject *__pyx_codeobj__77;
3515 static PyObject *__pyx_codeobj__79;
3516 static PyObject *__pyx_codeobj__81;
3517 static PyObject *__pyx_codeobj__83;
3518 static PyObject *__pyx_codeobj__85;
3519 static PyObject *__pyx_codeobj__87;
3520 static PyObject *__pyx_codeobj__89;
3521 static PyObject *__pyx_codeobj__91;
3522 static PyObject *__pyx_codeobj__93;
3523 static PyObject *__pyx_codeobj__95;
3524 static PyObject *__pyx_codeobj__97;
3525 static PyObject *__pyx_codeobj__99;
3526 static PyObject *__pyx_codeobj__101;
3527 static PyObject *__pyx_codeobj__103;
3528 static PyObject *__pyx_codeobj__105;
3529 static PyObject *__pyx_codeobj__107;
3530 static PyObject *__pyx_codeobj__109;
3531 static PyObject *__pyx_codeobj__111;
3532 static PyObject *__pyx_codeobj__113;
3533 static PyObject *__pyx_codeobj__115;
3534 static PyObject *__pyx_codeobj__117;
3535 static PyObject *__pyx_codeobj__124;
3536 /* Late includes */
3537 
3538 /* "yt/utilities/lib/geometry_utils.pyx":49
3539  * @cython.boundscheck(False)
3540  * @cython.wraparound(False)
3541  * cdef np.int64_t graycode(np.int64_t x):             # <<<<<<<<<<<<<<
3542  *     return x^(x>>1)
3543  *
3544  */
3545 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_graycode(__pyx_t_5numpy_int64_t __pyx_v_x)3546 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_graycode(__pyx_t_5numpy_int64_t __pyx_v_x) {
3547   __pyx_t_5numpy_int64_t __pyx_r;
3548   __Pyx_RefNannyDeclarations
3549   __Pyx_RefNannySetupContext("graycode", 0);
3550 
3551   /* "yt/utilities/lib/geometry_utils.pyx":50
3552  * @cython.wraparound(False)
3553  * cdef np.int64_t graycode(np.int64_t x):
3554  *     return x^(x>>1)             # <<<<<<<<<<<<<<
3555  *
3556  * @cython.cdivision(True)
3557  */
3558   __pyx_r = (__pyx_v_x ^ (__pyx_v_x >> 1));
3559   goto __pyx_L0;
3560 
3561   /* "yt/utilities/lib/geometry_utils.pyx":49
3562  * @cython.boundscheck(False)
3563  * @cython.wraparound(False)
3564  * cdef np.int64_t graycode(np.int64_t x):             # <<<<<<<<<<<<<<
3565  *     return x^(x>>1)
3566  *
3567  */
3568 
3569   /* function exit code */
3570   __pyx_L0:;
3571   __Pyx_RefNannyFinishContext();
3572   return __pyx_r;
3573 }
3574 
3575 /* "yt/utilities/lib/geometry_utils.pyx":55
3576  * @cython.boundscheck(False)
3577  * @cython.wraparound(False)
3578  * cdef np.int64_t igraycode(np.int64_t x):             # <<<<<<<<<<<<<<
3579  *     cdef np.int64_t i, j
3580  *     if x == 0:
3581  */
3582 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_igraycode(__pyx_t_5numpy_int64_t __pyx_v_x)3583 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_igraycode(__pyx_t_5numpy_int64_t __pyx_v_x) {
3584   __pyx_t_5numpy_int64_t __pyx_v_i;
3585   __pyx_t_5numpy_int64_t __pyx_v_j;
3586   __pyx_t_5numpy_int64_t __pyx_v_m;
3587   __pyx_t_5numpy_int64_t __pyx_r;
3588   __Pyx_RefNannyDeclarations
3589   int __pyx_t_1;
3590   __pyx_t_5numpy_int64_t __pyx_t_2;
3591   __pyx_t_5numpy_int64_t __pyx_t_3;
3592   __Pyx_RefNannySetupContext("igraycode", 0);
3593 
3594   /* "yt/utilities/lib/geometry_utils.pyx":57
3595  * cdef np.int64_t igraycode(np.int64_t x):
3596  *     cdef np.int64_t i, j
3597  *     if x == 0:             # <<<<<<<<<<<<<<
3598  *         return x
3599  *     m = <np.int64_t> ceil(log2(x)) + 1
3600  */
3601   __pyx_t_1 = ((__pyx_v_x == 0) != 0);
3602   if (__pyx_t_1) {
3603 
3604     /* "yt/utilities/lib/geometry_utils.pyx":58
3605  *     cdef np.int64_t i, j
3606  *     if x == 0:
3607  *         return x             # <<<<<<<<<<<<<<
3608  *     m = <np.int64_t> ceil(log2(x)) + 1
3609  *     i, j = x, 1
3610  */
3611     __pyx_r = __pyx_v_x;
3612     goto __pyx_L0;
3613 
3614     /* "yt/utilities/lib/geometry_utils.pyx":57
3615  * cdef np.int64_t igraycode(np.int64_t x):
3616  *     cdef np.int64_t i, j
3617  *     if x == 0:             # <<<<<<<<<<<<<<
3618  *         return x
3619  *     m = <np.int64_t> ceil(log2(x)) + 1
3620  */
3621   }
3622 
3623   /* "yt/utilities/lib/geometry_utils.pyx":59
3624  *     if x == 0:
3625  *         return x
3626  *     m = <np.int64_t> ceil(log2(x)) + 1             # <<<<<<<<<<<<<<
3627  *     i, j = x, 1
3628  *     while j < m:
3629  */
3630   __pyx_v_m = (((__pyx_t_5numpy_int64_t)ceil(log2(__pyx_v_x))) + 1);
3631 
3632   /* "yt/utilities/lib/geometry_utils.pyx":60
3633  *         return x
3634  *     m = <np.int64_t> ceil(log2(x)) + 1
3635  *     i, j = x, 1             # <<<<<<<<<<<<<<
3636  *     while j < m:
3637  *         i = i ^ (x>>j)
3638  */
3639   __pyx_t_2 = __pyx_v_x;
3640   __pyx_t_3 = 1;
3641   __pyx_v_i = __pyx_t_2;
3642   __pyx_v_j = __pyx_t_3;
3643 
3644   /* "yt/utilities/lib/geometry_utils.pyx":61
3645  *     m = <np.int64_t> ceil(log2(x)) + 1
3646  *     i, j = x, 1
3647  *     while j < m:             # <<<<<<<<<<<<<<
3648  *         i = i ^ (x>>j)
3649  *         j += 1
3650  */
3651   while (1) {
3652     __pyx_t_1 = ((__pyx_v_j < __pyx_v_m) != 0);
3653     if (!__pyx_t_1) break;
3654 
3655     /* "yt/utilities/lib/geometry_utils.pyx":62
3656  *     i, j = x, 1
3657  *     while j < m:
3658  *         i = i ^ (x>>j)             # <<<<<<<<<<<<<<
3659  *         j += 1
3660  *     return i
3661  */
3662     __pyx_v_i = (__pyx_v_i ^ (__pyx_v_x >> __pyx_v_j));
3663 
3664     /* "yt/utilities/lib/geometry_utils.pyx":63
3665  *     while j < m:
3666  *         i = i ^ (x>>j)
3667  *         j += 1             # <<<<<<<<<<<<<<
3668  *     return i
3669  *
3670  */
3671     __pyx_v_j = (__pyx_v_j + 1);
3672   }
3673 
3674   /* "yt/utilities/lib/geometry_utils.pyx":64
3675  *         i = i ^ (x>>j)
3676  *         j += 1
3677  *     return i             # <<<<<<<<<<<<<<
3678  *
3679  * @cython.cdivision(True)
3680  */
3681   __pyx_r = __pyx_v_i;
3682   goto __pyx_L0;
3683 
3684   /* "yt/utilities/lib/geometry_utils.pyx":55
3685  * @cython.boundscheck(False)
3686  * @cython.wraparound(False)
3687  * cdef np.int64_t igraycode(np.int64_t x):             # <<<<<<<<<<<<<<
3688  *     cdef np.int64_t i, j
3689  *     if x == 0:
3690  */
3691 
3692   /* function exit code */
3693   __pyx_L0:;
3694   __Pyx_RefNannyFinishContext();
3695   return __pyx_r;
3696 }
3697 
3698 /* "yt/utilities/lib/geometry_utils.pyx":69
3699  * @cython.boundscheck(False)
3700  * @cython.wraparound(False)
3701  * cdef np.int64_t direction(np.int64_t x, np.int64_t n):             # <<<<<<<<<<<<<<
3702  *     #assert x < 2**n
3703  *     if x == 0:
3704  */
3705 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_direction(__pyx_t_5numpy_int64_t __pyx_v_x,__pyx_t_5numpy_int64_t __pyx_v_n)3706 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_direction(__pyx_t_5numpy_int64_t __pyx_v_x, __pyx_t_5numpy_int64_t __pyx_v_n) {
3707   __pyx_t_5numpy_int64_t __pyx_r;
3708   __Pyx_RefNannyDeclarations
3709   int __pyx_t_1;
3710   __Pyx_RefNannySetupContext("direction", 0);
3711 
3712   /* "yt/utilities/lib/geometry_utils.pyx":71
3713  * cdef np.int64_t direction(np.int64_t x, np.int64_t n):
3714  *     #assert x < 2**n
3715  *     if x == 0:             # <<<<<<<<<<<<<<
3716  *         return 0
3717  *     elif x%2 == 0:
3718  */
3719   __pyx_t_1 = ((__pyx_v_x == 0) != 0);
3720   if (__pyx_t_1) {
3721 
3722     /* "yt/utilities/lib/geometry_utils.pyx":72
3723  *     #assert x < 2**n
3724  *     if x == 0:
3725  *         return 0             # <<<<<<<<<<<<<<
3726  *     elif x%2 == 0:
3727  *         return tsb(x-1, n)%n
3728  */
3729     __pyx_r = 0;
3730     goto __pyx_L0;
3731 
3732     /* "yt/utilities/lib/geometry_utils.pyx":71
3733  * cdef np.int64_t direction(np.int64_t x, np.int64_t n):
3734  *     #assert x < 2**n
3735  *     if x == 0:             # <<<<<<<<<<<<<<
3736  *         return 0
3737  *     elif x%2 == 0:
3738  */
3739   }
3740 
3741   /* "yt/utilities/lib/geometry_utils.pyx":73
3742  *     if x == 0:
3743  *         return 0
3744  *     elif x%2 == 0:             # <<<<<<<<<<<<<<
3745  *         return tsb(x-1, n)%n
3746  *     else:
3747  */
3748   __pyx_t_1 = (((__pyx_v_x % 2) == 0) != 0);
3749   if (__pyx_t_1) {
3750 
3751     /* "yt/utilities/lib/geometry_utils.pyx":74
3752  *         return 0
3753  *     elif x%2 == 0:
3754  *         return tsb(x-1, n)%n             # <<<<<<<<<<<<<<
3755  *     else:
3756  *         return tsb(x, n)%n
3757  */
3758     __pyx_r = (__pyx_f_2yt_9utilities_3lib_14geometry_utils_tsb((__pyx_v_x - 1), __pyx_v_n) % __pyx_v_n);
3759     goto __pyx_L0;
3760 
3761     /* "yt/utilities/lib/geometry_utils.pyx":73
3762  *     if x == 0:
3763  *         return 0
3764  *     elif x%2 == 0:             # <<<<<<<<<<<<<<
3765  *         return tsb(x-1, n)%n
3766  *     else:
3767  */
3768   }
3769 
3770   /* "yt/utilities/lib/geometry_utils.pyx":76
3771  *         return tsb(x-1, n)%n
3772  *     else:
3773  *         return tsb(x, n)%n             # <<<<<<<<<<<<<<
3774  *
3775  * @cython.cdivision(True)
3776  */
3777   /*else*/ {
3778     __pyx_r = (__pyx_f_2yt_9utilities_3lib_14geometry_utils_tsb(__pyx_v_x, __pyx_v_n) % __pyx_v_n);
3779     goto __pyx_L0;
3780   }
3781 
3782   /* "yt/utilities/lib/geometry_utils.pyx":69
3783  * @cython.boundscheck(False)
3784  * @cython.wraparound(False)
3785  * cdef np.int64_t direction(np.int64_t x, np.int64_t n):             # <<<<<<<<<<<<<<
3786  *     #assert x < 2**n
3787  *     if x == 0:
3788  */
3789 
3790   /* function exit code */
3791   __pyx_L0:;
3792   __Pyx_RefNannyFinishContext();
3793   return __pyx_r;
3794 }
3795 
3796 /* "yt/utilities/lib/geometry_utils.pyx":81
3797  * @cython.boundscheck(False)
3798  * @cython.wraparound(False)
3799  * cdef np.int64_t tsb(np.int64_t x, np.int64_t width):             # <<<<<<<<<<<<<<
3800  *     #assert x < 2**width
3801  *     cdef np.int64_t i = 0
3802  */
3803 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_tsb(__pyx_t_5numpy_int64_t __pyx_v_x,__pyx_t_5numpy_int64_t __pyx_v_width)3804 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_tsb(__pyx_t_5numpy_int64_t __pyx_v_x, __pyx_t_5numpy_int64_t __pyx_v_width) {
3805   __pyx_t_5numpy_int64_t __pyx_v_i;
3806   __pyx_t_5numpy_int64_t __pyx_r;
3807   __Pyx_RefNannyDeclarations
3808   int __pyx_t_1;
3809   int __pyx_t_2;
3810   __Pyx_RefNannySetupContext("tsb", 0);
3811 
3812   /* "yt/utilities/lib/geometry_utils.pyx":83
3813  * cdef np.int64_t tsb(np.int64_t x, np.int64_t width):
3814  *     #assert x < 2**width
3815  *     cdef np.int64_t i = 0             # <<<<<<<<<<<<<<
3816  *     while x&1 and i <= width:
3817  *         x = x >> 1
3818  */
3819   __pyx_v_i = 0;
3820 
3821   /* "yt/utilities/lib/geometry_utils.pyx":84
3822  *     #assert x < 2**width
3823  *     cdef np.int64_t i = 0
3824  *     while x&1 and i <= width:             # <<<<<<<<<<<<<<
3825  *         x = x >> 1
3826  *         i += 1
3827  */
3828   while (1) {
3829     __pyx_t_2 = ((__pyx_v_x & 1) != 0);
3830     if (__pyx_t_2) {
3831     } else {
3832       __pyx_t_1 = __pyx_t_2;
3833       goto __pyx_L5_bool_binop_done;
3834     }
3835     __pyx_t_2 = ((__pyx_v_i <= __pyx_v_width) != 0);
3836     __pyx_t_1 = __pyx_t_2;
3837     __pyx_L5_bool_binop_done:;
3838     if (!__pyx_t_1) break;
3839 
3840     /* "yt/utilities/lib/geometry_utils.pyx":85
3841  *     cdef np.int64_t i = 0
3842  *     while x&1 and i <= width:
3843  *         x = x >> 1             # <<<<<<<<<<<<<<
3844  *         i += 1
3845  *     return i
3846  */
3847     __pyx_v_x = (__pyx_v_x >> 1);
3848 
3849     /* "yt/utilities/lib/geometry_utils.pyx":86
3850  *     while x&1 and i <= width:
3851  *         x = x >> 1
3852  *         i += 1             # <<<<<<<<<<<<<<
3853  *     return i
3854  *
3855  */
3856     __pyx_v_i = (__pyx_v_i + 1);
3857   }
3858 
3859   /* "yt/utilities/lib/geometry_utils.pyx":87
3860  *         x = x >> 1
3861  *         i += 1
3862  *     return i             # <<<<<<<<<<<<<<
3863  *
3864  * @cython.cdivision(True)
3865  */
3866   __pyx_r = __pyx_v_i;
3867   goto __pyx_L0;
3868 
3869   /* "yt/utilities/lib/geometry_utils.pyx":81
3870  * @cython.boundscheck(False)
3871  * @cython.wraparound(False)
3872  * cdef np.int64_t tsb(np.int64_t x, np.int64_t width):             # <<<<<<<<<<<<<<
3873  *     #assert x < 2**width
3874  *     cdef np.int64_t i = 0
3875  */
3876 
3877   /* function exit code */
3878   __pyx_L0:;
3879   __Pyx_RefNannyFinishContext();
3880   return __pyx_r;
3881 }
3882 
3883 /* "yt/utilities/lib/geometry_utils.pyx":92
3884  * @cython.boundscheck(False)
3885  * @cython.wraparound(False)
3886  * cdef np.int64_t bitrange(np.int64_t x, np.int64_t width,             # <<<<<<<<<<<<<<
3887  *                          np.int64_t start, np.int64_t end):
3888  *     return x >> (width-end) & ((2**(end-start))-1)
3889  */
3890 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_bitrange(__pyx_t_5numpy_int64_t __pyx_v_x,__pyx_t_5numpy_int64_t __pyx_v_width,__pyx_t_5numpy_int64_t __pyx_v_start,__pyx_t_5numpy_int64_t __pyx_v_end)3891 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_bitrange(__pyx_t_5numpy_int64_t __pyx_v_x, __pyx_t_5numpy_int64_t __pyx_v_width, __pyx_t_5numpy_int64_t __pyx_v_start, __pyx_t_5numpy_int64_t __pyx_v_end) {
3892   __pyx_t_5numpy_int64_t __pyx_r;
3893   __Pyx_RefNannyDeclarations
3894   __Pyx_RefNannySetupContext("bitrange", 0);
3895 
3896   /* "yt/utilities/lib/geometry_utils.pyx":94
3897  * cdef np.int64_t bitrange(np.int64_t x, np.int64_t width,
3898  *                          np.int64_t start, np.int64_t end):
3899  *     return x >> (width-end) & ((2**(end-start))-1)             # <<<<<<<<<<<<<<
3900  *
3901  * @cython.cdivision(True)
3902  */
3903   __pyx_r = ((__pyx_v_x >> (__pyx_v_width - __pyx_v_end)) & (__Pyx_pow___pyx_t_5numpy_int64_t(2, (__pyx_v_end - __pyx_v_start)) - 1));
3904   goto __pyx_L0;
3905 
3906   /* "yt/utilities/lib/geometry_utils.pyx":92
3907  * @cython.boundscheck(False)
3908  * @cython.wraparound(False)
3909  * cdef np.int64_t bitrange(np.int64_t x, np.int64_t width,             # <<<<<<<<<<<<<<
3910  *                          np.int64_t start, np.int64_t end):
3911  *     return x >> (width-end) & ((2**(end-start))-1)
3912  */
3913 
3914   /* function exit code */
3915   __pyx_L0:;
3916   __Pyx_RefNannyFinishContext();
3917   return __pyx_r;
3918 }
3919 
3920 /* "yt/utilities/lib/geometry_utils.pyx":99
3921  * @cython.boundscheck(False)
3922  * @cython.wraparound(False)
3923  * cdef np.int64_t rrot(np.int64_t x, np.int64_t i, np.int64_t width):             # <<<<<<<<<<<<<<
3924  *     i = i%width
3925  *     x = (x>>i) | (x<<width-i)
3926  */
3927 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_rrot(__pyx_t_5numpy_int64_t __pyx_v_x,__pyx_t_5numpy_int64_t __pyx_v_i,__pyx_t_5numpy_int64_t __pyx_v_width)3928 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_rrot(__pyx_t_5numpy_int64_t __pyx_v_x, __pyx_t_5numpy_int64_t __pyx_v_i, __pyx_t_5numpy_int64_t __pyx_v_width) {
3929   __pyx_t_5numpy_int64_t __pyx_r;
3930   __Pyx_RefNannyDeclarations
3931   __Pyx_RefNannySetupContext("rrot", 0);
3932 
3933   /* "yt/utilities/lib/geometry_utils.pyx":100
3934  * @cython.wraparound(False)
3935  * cdef np.int64_t rrot(np.int64_t x, np.int64_t i, np.int64_t width):
3936  *     i = i%width             # <<<<<<<<<<<<<<
3937  *     x = (x>>i) | (x<<width-i)
3938  *     return x&(2**width-1)
3939  */
3940   __pyx_v_i = (__pyx_v_i % __pyx_v_width);
3941 
3942   /* "yt/utilities/lib/geometry_utils.pyx":101
3943  * cdef np.int64_t rrot(np.int64_t x, np.int64_t i, np.int64_t width):
3944  *     i = i%width
3945  *     x = (x>>i) | (x<<width-i)             # <<<<<<<<<<<<<<
3946  *     return x&(2**width-1)
3947  *
3948  */
3949   __pyx_v_x = ((__pyx_v_x >> __pyx_v_i) | (__pyx_v_x << (__pyx_v_width - __pyx_v_i)));
3950 
3951   /* "yt/utilities/lib/geometry_utils.pyx":102
3952  *     i = i%width
3953  *     x = (x>>i) | (x<<width-i)
3954  *     return x&(2**width-1)             # <<<<<<<<<<<<<<
3955  *
3956  * @cython.cdivision(True)
3957  */
3958   __pyx_r = (__pyx_v_x & (__Pyx_pow___pyx_t_5numpy_int64_t(2, __pyx_v_width) - 1));
3959   goto __pyx_L0;
3960 
3961   /* "yt/utilities/lib/geometry_utils.pyx":99
3962  * @cython.boundscheck(False)
3963  * @cython.wraparound(False)
3964  * cdef np.int64_t rrot(np.int64_t x, np.int64_t i, np.int64_t width):             # <<<<<<<<<<<<<<
3965  *     i = i%width
3966  *     x = (x>>i) | (x<<width-i)
3967  */
3968 
3969   /* function exit code */
3970   __pyx_L0:;
3971   __Pyx_RefNannyFinishContext();
3972   return __pyx_r;
3973 }
3974 
3975 /* "yt/utilities/lib/geometry_utils.pyx":107
3976  * @cython.boundscheck(False)
3977  * @cython.wraparound(False)
3978  * cdef np.int64_t lrot(np.int64_t x, np.int64_t i, np.int64_t width):             # <<<<<<<<<<<<<<
3979  *     i = i%width
3980  *     x = (x<<i) | (x>>width-i)
3981  */
3982 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_lrot(__pyx_t_5numpy_int64_t __pyx_v_x,__pyx_t_5numpy_int64_t __pyx_v_i,__pyx_t_5numpy_int64_t __pyx_v_width)3983 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_lrot(__pyx_t_5numpy_int64_t __pyx_v_x, __pyx_t_5numpy_int64_t __pyx_v_i, __pyx_t_5numpy_int64_t __pyx_v_width) {
3984   __pyx_t_5numpy_int64_t __pyx_r;
3985   __Pyx_RefNannyDeclarations
3986   __Pyx_RefNannySetupContext("lrot", 0);
3987 
3988   /* "yt/utilities/lib/geometry_utils.pyx":108
3989  * @cython.wraparound(False)
3990  * cdef np.int64_t lrot(np.int64_t x, np.int64_t i, np.int64_t width):
3991  *     i = i%width             # <<<<<<<<<<<<<<
3992  *     x = (x<<i) | (x>>width-i)
3993  *     return x&(2**width-1)
3994  */
3995   __pyx_v_i = (__pyx_v_i % __pyx_v_width);
3996 
3997   /* "yt/utilities/lib/geometry_utils.pyx":109
3998  * cdef np.int64_t lrot(np.int64_t x, np.int64_t i, np.int64_t width):
3999  *     i = i%width
4000  *     x = (x<<i) | (x>>width-i)             # <<<<<<<<<<<<<<
4001  *     return x&(2**width-1)
4002  *
4003  */
4004   __pyx_v_x = ((__pyx_v_x << __pyx_v_i) | (__pyx_v_x >> (__pyx_v_width - __pyx_v_i)));
4005 
4006   /* "yt/utilities/lib/geometry_utils.pyx":110
4007  *     i = i%width
4008  *     x = (x<<i) | (x>>width-i)
4009  *     return x&(2**width-1)             # <<<<<<<<<<<<<<
4010  *
4011  * @cython.cdivision(True)
4012  */
4013   __pyx_r = (__pyx_v_x & (__Pyx_pow___pyx_t_5numpy_int64_t(2, __pyx_v_width) - 1));
4014   goto __pyx_L0;
4015 
4016   /* "yt/utilities/lib/geometry_utils.pyx":107
4017  * @cython.boundscheck(False)
4018  * @cython.wraparound(False)
4019  * cdef np.int64_t lrot(np.int64_t x, np.int64_t i, np.int64_t width):             # <<<<<<<<<<<<<<
4020  *     i = i%width
4021  *     x = (x<<i) | (x>>width-i)
4022  */
4023 
4024   /* function exit code */
4025   __pyx_L0:;
4026   __Pyx_RefNannyFinishContext();
4027   return __pyx_r;
4028 }
4029 
4030 /* "yt/utilities/lib/geometry_utils.pyx":115
4031  * @cython.boundscheck(False)
4032  * @cython.wraparound(False)
4033  * cdef np.int64_t transform(np.int64_t entry, np.int64_t direction,             # <<<<<<<<<<<<<<
4034  *                           np.int64_t width, np.int64_t x):
4035  *     return rrot((x^entry), direction + 1, width)
4036  */
4037 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_transform(__pyx_t_5numpy_int64_t __pyx_v_entry,__pyx_t_5numpy_int64_t __pyx_v_direction,__pyx_t_5numpy_int64_t __pyx_v_width,__pyx_t_5numpy_int64_t __pyx_v_x)4038 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_transform(__pyx_t_5numpy_int64_t __pyx_v_entry, __pyx_t_5numpy_int64_t __pyx_v_direction, __pyx_t_5numpy_int64_t __pyx_v_width, __pyx_t_5numpy_int64_t __pyx_v_x) {
4039   __pyx_t_5numpy_int64_t __pyx_r;
4040   __Pyx_RefNannyDeclarations
4041   __Pyx_RefNannySetupContext("transform", 0);
4042 
4043   /* "yt/utilities/lib/geometry_utils.pyx":117
4044  * cdef np.int64_t transform(np.int64_t entry, np.int64_t direction,
4045  *                           np.int64_t width, np.int64_t x):
4046  *     return rrot((x^entry), direction + 1, width)             # <<<<<<<<<<<<<<
4047  *
4048  * @cython.cdivision(True)
4049  */
4050   __pyx_r = __pyx_f_2yt_9utilities_3lib_14geometry_utils_rrot((__pyx_v_x ^ __pyx_v_entry), (__pyx_v_direction + 1), __pyx_v_width);
4051   goto __pyx_L0;
4052 
4053   /* "yt/utilities/lib/geometry_utils.pyx":115
4054  * @cython.boundscheck(False)
4055  * @cython.wraparound(False)
4056  * cdef np.int64_t transform(np.int64_t entry, np.int64_t direction,             # <<<<<<<<<<<<<<
4057  *                           np.int64_t width, np.int64_t x):
4058  *     return rrot((x^entry), direction + 1, width)
4059  */
4060 
4061   /* function exit code */
4062   __pyx_L0:;
4063   __Pyx_RefNannyFinishContext();
4064   return __pyx_r;
4065 }
4066 
4067 /* "yt/utilities/lib/geometry_utils.pyx":122
4068  * @cython.boundscheck(False)
4069  * @cython.wraparound(False)
4070  * cdef np.int64_t entry(np.int64_t x):             # <<<<<<<<<<<<<<
4071  *     if x == 0: return 0
4072  *     return graycode(2*((x-1)/2))
4073  */
4074 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_entry(__pyx_t_5numpy_int64_t __pyx_v_x)4075 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_entry(__pyx_t_5numpy_int64_t __pyx_v_x) {
4076   __pyx_t_5numpy_int64_t __pyx_r;
4077   __Pyx_RefNannyDeclarations
4078   int __pyx_t_1;
4079   __Pyx_RefNannySetupContext("entry", 0);
4080 
4081   /* "yt/utilities/lib/geometry_utils.pyx":123
4082  * @cython.wraparound(False)
4083  * cdef np.int64_t entry(np.int64_t x):
4084  *     if x == 0: return 0             # <<<<<<<<<<<<<<
4085  *     return graycode(2*((x-1)/2))
4086  *
4087  */
4088   __pyx_t_1 = ((__pyx_v_x == 0) != 0);
4089   if (__pyx_t_1) {
4090     __pyx_r = 0;
4091     goto __pyx_L0;
4092   }
4093 
4094   /* "yt/utilities/lib/geometry_utils.pyx":124
4095  * cdef np.int64_t entry(np.int64_t x):
4096  *     if x == 0: return 0
4097  *     return graycode(2*((x-1)/2))             # <<<<<<<<<<<<<<
4098  *
4099  * @cython.cdivision(True)
4100  */
4101   __pyx_r = __pyx_f_2yt_9utilities_3lib_14geometry_utils_graycode((2 * ((__pyx_v_x - 1) / 2)));
4102   goto __pyx_L0;
4103 
4104   /* "yt/utilities/lib/geometry_utils.pyx":122
4105  * @cython.boundscheck(False)
4106  * @cython.wraparound(False)
4107  * cdef np.int64_t entry(np.int64_t x):             # <<<<<<<<<<<<<<
4108  *     if x == 0: return 0
4109  *     return graycode(2*((x-1)/2))
4110  */
4111 
4112   /* function exit code */
4113   __pyx_L0:;
4114   __Pyx_RefNannyFinishContext();
4115   return __pyx_r;
4116 }
4117 
4118 /* "yt/utilities/lib/geometry_utils.pyx":129
4119  * @cython.boundscheck(False)
4120  * @cython.wraparound(False)
4121  * cdef np.int64_t setbit(np.int64_t x, np.int64_t w, np.int64_t i, np.int64_t b):             # <<<<<<<<<<<<<<
4122  *     if b == 1:
4123  *         return x | 2**(w-i-1)
4124  */
4125 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_setbit(__pyx_t_5numpy_int64_t __pyx_v_x,__pyx_t_5numpy_int64_t __pyx_v_w,__pyx_t_5numpy_int64_t __pyx_v_i,__pyx_t_5numpy_int64_t __pyx_v_b)4126 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_setbit(__pyx_t_5numpy_int64_t __pyx_v_x, __pyx_t_5numpy_int64_t __pyx_v_w, __pyx_t_5numpy_int64_t __pyx_v_i, __pyx_t_5numpy_int64_t __pyx_v_b) {
4127   __pyx_t_5numpy_int64_t __pyx_r;
4128   __Pyx_RefNannyDeclarations
4129   __Pyx_RefNannySetupContext("setbit", 0);
4130 
4131   /* "yt/utilities/lib/geometry_utils.pyx":130
4132  * @cython.wraparound(False)
4133  * cdef np.int64_t setbit(np.int64_t x, np.int64_t w, np.int64_t i, np.int64_t b):
4134  *     if b == 1:             # <<<<<<<<<<<<<<
4135  *         return x | 2**(w-i-1)
4136  *     elif b == 0:
4137  */
4138   switch (__pyx_v_b) {
4139     case 1:
4140 
4141     /* "yt/utilities/lib/geometry_utils.pyx":131
4142  * cdef np.int64_t setbit(np.int64_t x, np.int64_t w, np.int64_t i, np.int64_t b):
4143  *     if b == 1:
4144  *         return x | 2**(w-i-1)             # <<<<<<<<<<<<<<
4145  *     elif b == 0:
4146  *         return x & ~2**(w-i-1)
4147  */
4148     __pyx_r = (__pyx_v_x | __Pyx_pow___pyx_t_5numpy_int64_t(2, ((__pyx_v_w - __pyx_v_i) - 1)));
4149     goto __pyx_L0;
4150 
4151     /* "yt/utilities/lib/geometry_utils.pyx":130
4152  * @cython.wraparound(False)
4153  * cdef np.int64_t setbit(np.int64_t x, np.int64_t w, np.int64_t i, np.int64_t b):
4154  *     if b == 1:             # <<<<<<<<<<<<<<
4155  *         return x | 2**(w-i-1)
4156  *     elif b == 0:
4157  */
4158     break;
4159     case 0:
4160 
4161     /* "yt/utilities/lib/geometry_utils.pyx":133
4162  *         return x | 2**(w-i-1)
4163  *     elif b == 0:
4164  *         return x & ~2**(w-i-1)             # <<<<<<<<<<<<<<
4165  *
4166  * @cython.cdivision(True)
4167  */
4168     __pyx_r = (__pyx_v_x & (~__Pyx_pow___pyx_t_5numpy_int64_t(2, ((__pyx_v_w - __pyx_v_i) - 1))));
4169     goto __pyx_L0;
4170 
4171     /* "yt/utilities/lib/geometry_utils.pyx":132
4172  *     if b == 1:
4173  *         return x | 2**(w-i-1)
4174  *     elif b == 0:             # <<<<<<<<<<<<<<
4175  *         return x & ~2**(w-i-1)
4176  *
4177  */
4178     break;
4179     default: break;
4180   }
4181 
4182   /* "yt/utilities/lib/geometry_utils.pyx":129
4183  * @cython.boundscheck(False)
4184  * @cython.wraparound(False)
4185  * cdef np.int64_t setbit(np.int64_t x, np.int64_t w, np.int64_t i, np.int64_t b):             # <<<<<<<<<<<<<<
4186  *     if b == 1:
4187  *         return x | 2**(w-i-1)
4188  */
4189 
4190   /* function exit code */
4191   __pyx_r = 0;
4192   __pyx_L0:;
4193   __Pyx_RefNannyFinishContext();
4194   return __pyx_r;
4195 }
4196 
4197 /* "yt/utilities/lib/geometry_utils.pyx":138
4198  * @cython.boundscheck(False)
4199  * @cython.wraparound(False)
4200  * def spread_bits(np.uint64_t x):             # <<<<<<<<<<<<<<
4201  *     return spread_64bits_by2(x)
4202  *
4203  */
4204 
4205 /* Python wrapper */
4206 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_1spread_bits(PyObject *__pyx_self, PyObject *__pyx_arg_x); /*proto*/
4207 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_1spread_bits = {"spread_bits", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_1spread_bits, METH_O, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_1spread_bits(PyObject * __pyx_self,PyObject * __pyx_arg_x)4208 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_1spread_bits(PyObject *__pyx_self, PyObject *__pyx_arg_x) {
4209   __pyx_t_5numpy_uint64_t __pyx_v_x;
4210   PyObject *__pyx_r = 0;
4211   __Pyx_RefNannyDeclarations
4212   __Pyx_RefNannySetupContext("spread_bits (wrapper)", 0);
4213   assert(__pyx_arg_x); {
4214     __pyx_v_x = __Pyx_PyInt_As_npy_uint64(__pyx_arg_x); if (unlikely((__pyx_v_x == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 138, __pyx_L3_error)
4215   }
4216   goto __pyx_L4_argument_unpacking_done;
4217   __pyx_L3_error:;
4218   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.spread_bits", __pyx_clineno, __pyx_lineno, __pyx_filename);
4219   __Pyx_RefNannyFinishContext();
4220   return NULL;
4221   __pyx_L4_argument_unpacking_done:;
4222   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_spread_bits(__pyx_self, ((__pyx_t_5numpy_uint64_t)__pyx_v_x));
4223 
4224   /* function exit code */
4225   __Pyx_RefNannyFinishContext();
4226   return __pyx_r;
4227 }
4228 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_spread_bits(CYTHON_UNUSED PyObject * __pyx_self,__pyx_t_5numpy_uint64_t __pyx_v_x)4229 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_spread_bits(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_uint64_t __pyx_v_x) {
4230   PyObject *__pyx_r = NULL;
4231   __Pyx_RefNannyDeclarations
4232   PyObject *__pyx_t_1 = NULL;
4233   __Pyx_RefNannySetupContext("spread_bits", 0);
4234 
4235   /* "yt/utilities/lib/geometry_utils.pyx":139
4236  * @cython.wraparound(False)
4237  * def spread_bits(np.uint64_t x):
4238  *     return spread_64bits_by2(x)             # <<<<<<<<<<<<<<
4239  *
4240  * @cython.cdivision(True)
4241  */
4242   __Pyx_XDECREF(__pyx_r);
4243   __pyx_t_1 = __Pyx_PyInt_From_npy_uint64(__pyx_f_2yt_9utilities_3lib_14geometry_utils_spread_64bits_by2(__pyx_v_x)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 139, __pyx_L1_error)
4244   __Pyx_GOTREF(__pyx_t_1);
4245   __pyx_r = __pyx_t_1;
4246   __pyx_t_1 = 0;
4247   goto __pyx_L0;
4248 
4249   /* "yt/utilities/lib/geometry_utils.pyx":138
4250  * @cython.boundscheck(False)
4251  * @cython.wraparound(False)
4252  * def spread_bits(np.uint64_t x):             # <<<<<<<<<<<<<<
4253  *     return spread_64bits_by2(x)
4254  *
4255  */
4256 
4257   /* function exit code */
4258   __pyx_L1_error:;
4259   __Pyx_XDECREF(__pyx_t_1);
4260   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.spread_bits", __pyx_clineno, __pyx_lineno, __pyx_filename);
4261   __pyx_r = NULL;
4262   __pyx_L0:;
4263   __Pyx_XGIVEREF(__pyx_r);
4264   __Pyx_RefNannyFinishContext();
4265   return __pyx_r;
4266 }
4267 
4268 /* "yt/utilities/lib/geometry_utils.pyx":144
4269  * @cython.boundscheck(False)
4270  * @cython.wraparound(False)
4271  * def compact_bits(np.uint64_t x):             # <<<<<<<<<<<<<<
4272  *     return compact_64bits_by2(x)
4273  *
4274  */
4275 
4276 /* Python wrapper */
4277 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_3compact_bits(PyObject *__pyx_self, PyObject *__pyx_arg_x); /*proto*/
4278 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_3compact_bits = {"compact_bits", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_3compact_bits, METH_O, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_3compact_bits(PyObject * __pyx_self,PyObject * __pyx_arg_x)4279 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_3compact_bits(PyObject *__pyx_self, PyObject *__pyx_arg_x) {
4280   __pyx_t_5numpy_uint64_t __pyx_v_x;
4281   PyObject *__pyx_r = 0;
4282   __Pyx_RefNannyDeclarations
4283   __Pyx_RefNannySetupContext("compact_bits (wrapper)", 0);
4284   assert(__pyx_arg_x); {
4285     __pyx_v_x = __Pyx_PyInt_As_npy_uint64(__pyx_arg_x); if (unlikely((__pyx_v_x == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 144, __pyx_L3_error)
4286   }
4287   goto __pyx_L4_argument_unpacking_done;
4288   __pyx_L3_error:;
4289   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.compact_bits", __pyx_clineno, __pyx_lineno, __pyx_filename);
4290   __Pyx_RefNannyFinishContext();
4291   return NULL;
4292   __pyx_L4_argument_unpacking_done:;
4293   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_2compact_bits(__pyx_self, ((__pyx_t_5numpy_uint64_t)__pyx_v_x));
4294 
4295   /* function exit code */
4296   __Pyx_RefNannyFinishContext();
4297   return __pyx_r;
4298 }
4299 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_2compact_bits(CYTHON_UNUSED PyObject * __pyx_self,__pyx_t_5numpy_uint64_t __pyx_v_x)4300 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_2compact_bits(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_uint64_t __pyx_v_x) {
4301   PyObject *__pyx_r = NULL;
4302   __Pyx_RefNannyDeclarations
4303   PyObject *__pyx_t_1 = NULL;
4304   __Pyx_RefNannySetupContext("compact_bits", 0);
4305 
4306   /* "yt/utilities/lib/geometry_utils.pyx":145
4307  * @cython.wraparound(False)
4308  * def compact_bits(np.uint64_t x):
4309  *     return compact_64bits_by2(x)             # <<<<<<<<<<<<<<
4310  *
4311  * @cython.cdivision(True)
4312  */
4313   __Pyx_XDECREF(__pyx_r);
4314   __pyx_t_1 = __Pyx_PyInt_From_npy_uint64(__pyx_f_2yt_9utilities_3lib_14geometry_utils_compact_64bits_by2(__pyx_v_x)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 145, __pyx_L1_error)
4315   __Pyx_GOTREF(__pyx_t_1);
4316   __pyx_r = __pyx_t_1;
4317   __pyx_t_1 = 0;
4318   goto __pyx_L0;
4319 
4320   /* "yt/utilities/lib/geometry_utils.pyx":144
4321  * @cython.boundscheck(False)
4322  * @cython.wraparound(False)
4323  * def compact_bits(np.uint64_t x):             # <<<<<<<<<<<<<<
4324  *     return compact_64bits_by2(x)
4325  *
4326  */
4327 
4328   /* function exit code */
4329   __pyx_L1_error:;
4330   __Pyx_XDECREF(__pyx_t_1);
4331   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.compact_bits", __pyx_clineno, __pyx_lineno, __pyx_filename);
4332   __pyx_r = NULL;
4333   __pyx_L0:;
4334   __Pyx_XGIVEREF(__pyx_r);
4335   __Pyx_RefNannyFinishContext();
4336   return __pyx_r;
4337 }
4338 
4339 /* "yt/utilities/lib/geometry_utils.pyx":150
4340  * @cython.boundscheck(False)
4341  * @cython.wraparound(False)
4342  * def lsz(np.uint64_t v, int stride = 1, int start = 0):             # <<<<<<<<<<<<<<
4343  *     cdef int c
4344  *     c = start
4345  */
4346 
4347 /* Python wrapper */
4348 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_5lsz(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4349 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_5lsz = {"lsz", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_5lsz, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_5lsz(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4350 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_5lsz(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4351   __pyx_t_5numpy_uint64_t __pyx_v_v;
4352   int __pyx_v_stride;
4353   int __pyx_v_start;
4354   PyObject *__pyx_r = 0;
4355   __Pyx_RefNannyDeclarations
4356   __Pyx_RefNannySetupContext("lsz (wrapper)", 0);
4357   {
4358     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_stride,&__pyx_n_s_start,0};
4359     PyObject* values[3] = {0,0,0};
4360     if (unlikely(__pyx_kwds)) {
4361       Py_ssize_t kw_args;
4362       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4363       switch (pos_args) {
4364         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4365         CYTHON_FALLTHROUGH;
4366         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4367         CYTHON_FALLTHROUGH;
4368         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4369         CYTHON_FALLTHROUGH;
4370         case  0: break;
4371         default: goto __pyx_L5_argtuple_error;
4372       }
4373       kw_args = PyDict_Size(__pyx_kwds);
4374       switch (pos_args) {
4375         case  0:
4376         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
4377         else goto __pyx_L5_argtuple_error;
4378         CYTHON_FALLTHROUGH;
4379         case  1:
4380         if (kw_args > 0) {
4381           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stride);
4382           if (value) { values[1] = value; kw_args--; }
4383         }
4384         CYTHON_FALLTHROUGH;
4385         case  2:
4386         if (kw_args > 0) {
4387           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start);
4388           if (value) { values[2] = value; kw_args--; }
4389         }
4390       }
4391       if (unlikely(kw_args > 0)) {
4392         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lsz") < 0)) __PYX_ERR(1, 150, __pyx_L3_error)
4393       }
4394     } else {
4395       switch (PyTuple_GET_SIZE(__pyx_args)) {
4396         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4397         CYTHON_FALLTHROUGH;
4398         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4399         CYTHON_FALLTHROUGH;
4400         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4401         break;
4402         default: goto __pyx_L5_argtuple_error;
4403       }
4404     }
4405     __pyx_v_v = __Pyx_PyInt_As_npy_uint64(values[0]); if (unlikely((__pyx_v_v == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 150, __pyx_L3_error)
4406     if (values[1]) {
4407       __pyx_v_stride = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_stride == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 150, __pyx_L3_error)
4408     } else {
4409       __pyx_v_stride = ((int)1);
4410     }
4411     if (values[2]) {
4412       __pyx_v_start = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 150, __pyx_L3_error)
4413     } else {
4414       __pyx_v_start = ((int)0);
4415     }
4416   }
4417   goto __pyx_L4_argument_unpacking_done;
4418   __pyx_L5_argtuple_error:;
4419   __Pyx_RaiseArgtupleInvalid("lsz", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 150, __pyx_L3_error)
4420   __pyx_L3_error:;
4421   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.lsz", __pyx_clineno, __pyx_lineno, __pyx_filename);
4422   __Pyx_RefNannyFinishContext();
4423   return NULL;
4424   __pyx_L4_argument_unpacking_done:;
4425   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_4lsz(__pyx_self, __pyx_v_v, __pyx_v_stride, __pyx_v_start);
4426 
4427   /* function exit code */
4428   __Pyx_RefNannyFinishContext();
4429   return __pyx_r;
4430 }
4431 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_4lsz(CYTHON_UNUSED PyObject * __pyx_self,__pyx_t_5numpy_uint64_t __pyx_v_v,int __pyx_v_stride,int __pyx_v_start)4432 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_4lsz(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_uint64_t __pyx_v_v, int __pyx_v_stride, int __pyx_v_start) {
4433   int __pyx_v_c;
4434   PyObject *__pyx_r = NULL;
4435   __Pyx_RefNannyDeclarations
4436   PyObject *__pyx_t_1 = NULL;
4437   PyObject *__pyx_t_2 = NULL;
4438   PyObject *__pyx_t_3 = NULL;
4439   PyObject *__pyx_t_4 = NULL;
4440   PyObject *__pyx_t_5 = NULL;
4441   int __pyx_t_6;
4442   __Pyx_RefNannySetupContext("lsz", 0);
4443 
4444   /* "yt/utilities/lib/geometry_utils.pyx":152
4445  * def lsz(np.uint64_t v, int stride = 1, int start = 0):
4446  *     cdef int c
4447  *     c = start             # <<<<<<<<<<<<<<
4448  *     while ((np.uint64(1) << np.uint64(c)) & np.uint64(v)):
4449  *         c += stride
4450  */
4451   __pyx_v_c = __pyx_v_start;
4452 
4453   /* "yt/utilities/lib/geometry_utils.pyx":153
4454  *     cdef int c
4455  *     c = start
4456  *     while ((np.uint64(1) << np.uint64(c)) & np.uint64(v)):             # <<<<<<<<<<<<<<
4457  *         c += stride
4458  *     return c
4459  */
4460   while (1) {
4461     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 153, __pyx_L1_error)
4462     __Pyx_GOTREF(__pyx_t_2);
4463     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_uint64); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 153, __pyx_L1_error)
4464     __Pyx_GOTREF(__pyx_t_3);
4465     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4466     __pyx_t_2 = NULL;
4467     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
4468       __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
4469       if (likely(__pyx_t_2)) {
4470         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
4471         __Pyx_INCREF(__pyx_t_2);
4472         __Pyx_INCREF(function);
4473         __Pyx_DECREF_SET(__pyx_t_3, function);
4474       }
4475     }
4476     __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_1);
4477     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4478     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 153, __pyx_L1_error)
4479     __Pyx_GOTREF(__pyx_t_1);
4480     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4481     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 153, __pyx_L1_error)
4482     __Pyx_GOTREF(__pyx_t_2);
4483     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_uint64); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 153, __pyx_L1_error)
4484     __Pyx_GOTREF(__pyx_t_4);
4485     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4486     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_c); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 153, __pyx_L1_error)
4487     __Pyx_GOTREF(__pyx_t_2);
4488     __pyx_t_5 = NULL;
4489     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
4490       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
4491       if (likely(__pyx_t_5)) {
4492         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4493         __Pyx_INCREF(__pyx_t_5);
4494         __Pyx_INCREF(function);
4495         __Pyx_DECREF_SET(__pyx_t_4, function);
4496       }
4497     }
4498     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2);
4499     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4500     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4501     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 153, __pyx_L1_error)
4502     __Pyx_GOTREF(__pyx_t_3);
4503     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4504     __pyx_t_4 = PyNumber_Lshift(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 153, __pyx_L1_error)
4505     __Pyx_GOTREF(__pyx_t_4);
4506     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4507     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4508     __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 153, __pyx_L1_error)
4509     __Pyx_GOTREF(__pyx_t_1);
4510     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_uint64); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 153, __pyx_L1_error)
4511     __Pyx_GOTREF(__pyx_t_2);
4512     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4513     __pyx_t_1 = __Pyx_PyInt_From_npy_uint64(__pyx_v_v); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 153, __pyx_L1_error)
4514     __Pyx_GOTREF(__pyx_t_1);
4515     __pyx_t_5 = NULL;
4516     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
4517       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
4518       if (likely(__pyx_t_5)) {
4519         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4520         __Pyx_INCREF(__pyx_t_5);
4521         __Pyx_INCREF(function);
4522         __Pyx_DECREF_SET(__pyx_t_2, function);
4523       }
4524     }
4525     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1);
4526     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4527     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4528     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 153, __pyx_L1_error)
4529     __Pyx_GOTREF(__pyx_t_3);
4530     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4531     __pyx_t_2 = PyNumber_And(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 153, __pyx_L1_error)
4532     __Pyx_GOTREF(__pyx_t_2);
4533     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4534     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4535     __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 153, __pyx_L1_error)
4536     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4537     if (!__pyx_t_6) break;
4538 
4539     /* "yt/utilities/lib/geometry_utils.pyx":154
4540  *     c = start
4541  *     while ((np.uint64(1) << np.uint64(c)) & np.uint64(v)):
4542  *         c += stride             # <<<<<<<<<<<<<<
4543  *     return c
4544  *
4545  */
4546     __pyx_v_c = (__pyx_v_c + __pyx_v_stride);
4547   }
4548 
4549   /* "yt/utilities/lib/geometry_utils.pyx":155
4550  *     while ((np.uint64(1) << np.uint64(c)) & np.uint64(v)):
4551  *         c += stride
4552  *     return c             # <<<<<<<<<<<<<<
4553  *
4554  * @cython.cdivision(True)
4555  */
4556   __Pyx_XDECREF(__pyx_r);
4557   __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_c); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 155, __pyx_L1_error)
4558   __Pyx_GOTREF(__pyx_t_2);
4559   __pyx_r = __pyx_t_2;
4560   __pyx_t_2 = 0;
4561   goto __pyx_L0;
4562 
4563   /* "yt/utilities/lib/geometry_utils.pyx":150
4564  * @cython.boundscheck(False)
4565  * @cython.wraparound(False)
4566  * def lsz(np.uint64_t v, int stride = 1, int start = 0):             # <<<<<<<<<<<<<<
4567  *     cdef int c
4568  *     c = start
4569  */
4570 
4571   /* function exit code */
4572   __pyx_L1_error:;
4573   __Pyx_XDECREF(__pyx_t_1);
4574   __Pyx_XDECREF(__pyx_t_2);
4575   __Pyx_XDECREF(__pyx_t_3);
4576   __Pyx_XDECREF(__pyx_t_4);
4577   __Pyx_XDECREF(__pyx_t_5);
4578   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.lsz", __pyx_clineno, __pyx_lineno, __pyx_filename);
4579   __pyx_r = NULL;
4580   __pyx_L0:;
4581   __Pyx_XGIVEREF(__pyx_r);
4582   __Pyx_RefNannyFinishContext();
4583   return __pyx_r;
4584 }
4585 
4586 /* "yt/utilities/lib/geometry_utils.pyx":160
4587  * @cython.boundscheck(False)
4588  * @cython.wraparound(False)
4589  * def lsb(np.uint64_t v, int stride = 1, int start = 0):             # <<<<<<<<<<<<<<
4590  *     cdef int c
4591  *     c = start
4592  */
4593 
4594 /* Python wrapper */
4595 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_7lsb(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4596 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_7lsb = {"lsb", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_7lsb, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_7lsb(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4597 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_7lsb(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4598   __pyx_t_5numpy_uint64_t __pyx_v_v;
4599   int __pyx_v_stride;
4600   int __pyx_v_start;
4601   PyObject *__pyx_r = 0;
4602   __Pyx_RefNannyDeclarations
4603   __Pyx_RefNannySetupContext("lsb (wrapper)", 0);
4604   {
4605     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_stride,&__pyx_n_s_start,0};
4606     PyObject* values[3] = {0,0,0};
4607     if (unlikely(__pyx_kwds)) {
4608       Py_ssize_t kw_args;
4609       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4610       switch (pos_args) {
4611         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4612         CYTHON_FALLTHROUGH;
4613         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4614         CYTHON_FALLTHROUGH;
4615         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4616         CYTHON_FALLTHROUGH;
4617         case  0: break;
4618         default: goto __pyx_L5_argtuple_error;
4619       }
4620       kw_args = PyDict_Size(__pyx_kwds);
4621       switch (pos_args) {
4622         case  0:
4623         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
4624         else goto __pyx_L5_argtuple_error;
4625         CYTHON_FALLTHROUGH;
4626         case  1:
4627         if (kw_args > 0) {
4628           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stride);
4629           if (value) { values[1] = value; kw_args--; }
4630         }
4631         CYTHON_FALLTHROUGH;
4632         case  2:
4633         if (kw_args > 0) {
4634           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start);
4635           if (value) { values[2] = value; kw_args--; }
4636         }
4637       }
4638       if (unlikely(kw_args > 0)) {
4639         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lsb") < 0)) __PYX_ERR(1, 160, __pyx_L3_error)
4640       }
4641     } else {
4642       switch (PyTuple_GET_SIZE(__pyx_args)) {
4643         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4644         CYTHON_FALLTHROUGH;
4645         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4646         CYTHON_FALLTHROUGH;
4647         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4648         break;
4649         default: goto __pyx_L5_argtuple_error;
4650       }
4651     }
4652     __pyx_v_v = __Pyx_PyInt_As_npy_uint64(values[0]); if (unlikely((__pyx_v_v == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 160, __pyx_L3_error)
4653     if (values[1]) {
4654       __pyx_v_stride = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_stride == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 160, __pyx_L3_error)
4655     } else {
4656       __pyx_v_stride = ((int)1);
4657     }
4658     if (values[2]) {
4659       __pyx_v_start = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 160, __pyx_L3_error)
4660     } else {
4661       __pyx_v_start = ((int)0);
4662     }
4663   }
4664   goto __pyx_L4_argument_unpacking_done;
4665   __pyx_L5_argtuple_error:;
4666   __Pyx_RaiseArgtupleInvalid("lsb", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 160, __pyx_L3_error)
4667   __pyx_L3_error:;
4668   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.lsb", __pyx_clineno, __pyx_lineno, __pyx_filename);
4669   __Pyx_RefNannyFinishContext();
4670   return NULL;
4671   __pyx_L4_argument_unpacking_done:;
4672   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_6lsb(__pyx_self, __pyx_v_v, __pyx_v_stride, __pyx_v_start);
4673 
4674   /* function exit code */
4675   __Pyx_RefNannyFinishContext();
4676   return __pyx_r;
4677 }
4678 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_6lsb(CYTHON_UNUSED PyObject * __pyx_self,__pyx_t_5numpy_uint64_t __pyx_v_v,int __pyx_v_stride,int __pyx_v_start)4679 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_6lsb(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_uint64_t __pyx_v_v, int __pyx_v_stride, int __pyx_v_start) {
4680   int __pyx_v_c;
4681   PyObject *__pyx_r = NULL;
4682   __Pyx_RefNannyDeclarations
4683   int __pyx_t_1;
4684   PyObject *__pyx_t_2 = NULL;
4685   PyObject *__pyx_t_3 = NULL;
4686   PyObject *__pyx_t_4 = NULL;
4687   PyObject *__pyx_t_5 = NULL;
4688   PyObject *__pyx_t_6 = NULL;
4689   int __pyx_t_7;
4690   int __pyx_t_8;
4691   __Pyx_RefNannySetupContext("lsb", 0);
4692 
4693   /* "yt/utilities/lib/geometry_utils.pyx":162
4694  * def lsb(np.uint64_t v, int stride = 1, int start = 0):
4695  *     cdef int c
4696  *     c = start             # <<<<<<<<<<<<<<
4697  *     while (np.uint64(v) << np.uint64(c)) and not ((np.uint64(1) << np.uint64(c)) & np.uint64(v)):
4698  *         c += stride
4699  */
4700   __pyx_v_c = __pyx_v_start;
4701 
4702   /* "yt/utilities/lib/geometry_utils.pyx":163
4703  *     cdef int c
4704  *     c = start
4705  *     while (np.uint64(v) << np.uint64(c)) and not ((np.uint64(1) << np.uint64(c)) & np.uint64(v)):             # <<<<<<<<<<<<<<
4706  *         c += stride
4707  *     return c
4708  */
4709   while (1) {
4710     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 163, __pyx_L1_error)
4711     __Pyx_GOTREF(__pyx_t_3);
4712     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint64); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 163, __pyx_L1_error)
4713     __Pyx_GOTREF(__pyx_t_4);
4714     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4715     __pyx_t_3 = __Pyx_PyInt_From_npy_uint64(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 163, __pyx_L1_error)
4716     __Pyx_GOTREF(__pyx_t_3);
4717     __pyx_t_5 = NULL;
4718     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
4719       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
4720       if (likely(__pyx_t_5)) {
4721         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4722         __Pyx_INCREF(__pyx_t_5);
4723         __Pyx_INCREF(function);
4724         __Pyx_DECREF_SET(__pyx_t_4, function);
4725       }
4726     }
4727     __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);
4728     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4729     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4730     if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 163, __pyx_L1_error)
4731     __Pyx_GOTREF(__pyx_t_2);
4732     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4733     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 163, __pyx_L1_error)
4734     __Pyx_GOTREF(__pyx_t_3);
4735     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint64); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 163, __pyx_L1_error)
4736     __Pyx_GOTREF(__pyx_t_5);
4737     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4738     __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 163, __pyx_L1_error)
4739     __Pyx_GOTREF(__pyx_t_3);
4740     __pyx_t_6 = NULL;
4741     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
4742       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
4743       if (likely(__pyx_t_6)) {
4744         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
4745         __Pyx_INCREF(__pyx_t_6);
4746         __Pyx_INCREF(function);
4747         __Pyx_DECREF_SET(__pyx_t_5, function);
4748       }
4749     }
4750     __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3);
4751     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
4752     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4753     if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 163, __pyx_L1_error)
4754     __Pyx_GOTREF(__pyx_t_4);
4755     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4756     __pyx_t_5 = PyNumber_Lshift(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 163, __pyx_L1_error)
4757     __Pyx_GOTREF(__pyx_t_5);
4758     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4759     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4760     __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(1, 163, __pyx_L1_error)
4761     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4762     if (__pyx_t_7) {
4763     } else {
4764       __pyx_t_1 = __pyx_t_7;
4765       goto __pyx_L5_bool_binop_done;
4766     }
4767     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 163, __pyx_L1_error)
4768     __Pyx_GOTREF(__pyx_t_4);
4769     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint64); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 163, __pyx_L1_error)
4770     __Pyx_GOTREF(__pyx_t_2);
4771     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4772     __pyx_t_4 = NULL;
4773     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
4774       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
4775       if (likely(__pyx_t_4)) {
4776         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4777         __Pyx_INCREF(__pyx_t_4);
4778         __Pyx_INCREF(function);
4779         __Pyx_DECREF_SET(__pyx_t_2, function);
4780       }
4781     }
4782     __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_1);
4783     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4784     if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 163, __pyx_L1_error)
4785     __Pyx_GOTREF(__pyx_t_5);
4786     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4787     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 163, __pyx_L1_error)
4788     __Pyx_GOTREF(__pyx_t_4);
4789     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint64); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 163, __pyx_L1_error)
4790     __Pyx_GOTREF(__pyx_t_3);
4791     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4792     __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_c); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 163, __pyx_L1_error)
4793     __Pyx_GOTREF(__pyx_t_4);
4794     __pyx_t_6 = NULL;
4795     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
4796       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
4797       if (likely(__pyx_t_6)) {
4798         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
4799         __Pyx_INCREF(__pyx_t_6);
4800         __Pyx_INCREF(function);
4801         __Pyx_DECREF_SET(__pyx_t_3, function);
4802       }
4803     }
4804     __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
4805     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
4806     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4807     if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 163, __pyx_L1_error)
4808     __Pyx_GOTREF(__pyx_t_2);
4809     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4810     __pyx_t_3 = PyNumber_Lshift(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 163, __pyx_L1_error)
4811     __Pyx_GOTREF(__pyx_t_3);
4812     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4813     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4814     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 163, __pyx_L1_error)
4815     __Pyx_GOTREF(__pyx_t_5);
4816     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_uint64); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 163, __pyx_L1_error)
4817     __Pyx_GOTREF(__pyx_t_4);
4818     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4819     __pyx_t_5 = __Pyx_PyInt_From_npy_uint64(__pyx_v_v); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 163, __pyx_L1_error)
4820     __Pyx_GOTREF(__pyx_t_5);
4821     __pyx_t_6 = NULL;
4822     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
4823       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
4824       if (likely(__pyx_t_6)) {
4825         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4826         __Pyx_INCREF(__pyx_t_6);
4827         __Pyx_INCREF(function);
4828         __Pyx_DECREF_SET(__pyx_t_4, function);
4829       }
4830     }
4831     __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
4832     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
4833     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4834     if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 163, __pyx_L1_error)
4835     __Pyx_GOTREF(__pyx_t_2);
4836     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4837     __pyx_t_4 = PyNumber_And(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 163, __pyx_L1_error)
4838     __Pyx_GOTREF(__pyx_t_4);
4839     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4840     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4841     __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(1, 163, __pyx_L1_error)
4842     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4843     __pyx_t_8 = ((!__pyx_t_7) != 0);
4844     __pyx_t_1 = __pyx_t_8;
4845     __pyx_L5_bool_binop_done:;
4846     if (!__pyx_t_1) break;
4847 
4848     /* "yt/utilities/lib/geometry_utils.pyx":164
4849  *     c = start
4850  *     while (np.uint64(v) << np.uint64(c)) and not ((np.uint64(1) << np.uint64(c)) & np.uint64(v)):
4851  *         c += stride             # <<<<<<<<<<<<<<
4852  *     return c
4853  *
4854  */
4855     __pyx_v_c = (__pyx_v_c + __pyx_v_stride);
4856   }
4857 
4858   /* "yt/utilities/lib/geometry_utils.pyx":165
4859  *     while (np.uint64(v) << np.uint64(c)) and not ((np.uint64(1) << np.uint64(c)) & np.uint64(v)):
4860  *         c += stride
4861  *     return c             # <<<<<<<<<<<<<<
4862  *
4863  * @cython.cdivision(True)
4864  */
4865   __Pyx_XDECREF(__pyx_r);
4866   __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_c); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 165, __pyx_L1_error)
4867   __Pyx_GOTREF(__pyx_t_4);
4868   __pyx_r = __pyx_t_4;
4869   __pyx_t_4 = 0;
4870   goto __pyx_L0;
4871 
4872   /* "yt/utilities/lib/geometry_utils.pyx":160
4873  * @cython.boundscheck(False)
4874  * @cython.wraparound(False)
4875  * def lsb(np.uint64_t v, int stride = 1, int start = 0):             # <<<<<<<<<<<<<<
4876  *     cdef int c
4877  *     c = start
4878  */
4879 
4880   /* function exit code */
4881   __pyx_L1_error:;
4882   __Pyx_XDECREF(__pyx_t_2);
4883   __Pyx_XDECREF(__pyx_t_3);
4884   __Pyx_XDECREF(__pyx_t_4);
4885   __Pyx_XDECREF(__pyx_t_5);
4886   __Pyx_XDECREF(__pyx_t_6);
4887   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.lsb", __pyx_clineno, __pyx_lineno, __pyx_filename);
4888   __pyx_r = NULL;
4889   __pyx_L0:;
4890   __Pyx_XGIVEREF(__pyx_r);
4891   __Pyx_RefNannyFinishContext();
4892   return __pyx_r;
4893 }
4894 
4895 /* "yt/utilities/lib/geometry_utils.pyx":170
4896  * @cython.boundscheck(False)
4897  * @cython.wraparound(False)
4898  * def bitwise_addition(np.uint64_t x, np.int64_t y0,             # <<<<<<<<<<<<<<
4899  *                      int stride = 1, int start = 0):
4900  *     if (y0 == 0): return x
4901  */
4902 
4903 /* Python wrapper */
4904 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_9bitwise_addition(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4905 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_9bitwise_addition = {"bitwise_addition", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_9bitwise_addition, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_9bitwise_addition(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4906 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_9bitwise_addition(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4907   __pyx_t_5numpy_uint64_t __pyx_v_x;
4908   __pyx_t_5numpy_int64_t __pyx_v_y0;
4909   int __pyx_v_stride;
4910   int __pyx_v_start;
4911   PyObject *__pyx_r = 0;
4912   __Pyx_RefNannyDeclarations
4913   __Pyx_RefNannySetupContext("bitwise_addition (wrapper)", 0);
4914   {
4915     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y0,&__pyx_n_s_stride,&__pyx_n_s_start,0};
4916     PyObject* values[4] = {0,0,0,0};
4917     if (unlikely(__pyx_kwds)) {
4918       Py_ssize_t kw_args;
4919       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4920       switch (pos_args) {
4921         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4922         CYTHON_FALLTHROUGH;
4923         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4924         CYTHON_FALLTHROUGH;
4925         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4926         CYTHON_FALLTHROUGH;
4927         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4928         CYTHON_FALLTHROUGH;
4929         case  0: break;
4930         default: goto __pyx_L5_argtuple_error;
4931       }
4932       kw_args = PyDict_Size(__pyx_kwds);
4933       switch (pos_args) {
4934         case  0:
4935         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
4936         else goto __pyx_L5_argtuple_error;
4937         CYTHON_FALLTHROUGH;
4938         case  1:
4939         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y0)) != 0)) kw_args--;
4940         else {
4941           __Pyx_RaiseArgtupleInvalid("bitwise_addition", 0, 2, 4, 1); __PYX_ERR(1, 170, __pyx_L3_error)
4942         }
4943         CYTHON_FALLTHROUGH;
4944         case  2:
4945         if (kw_args > 0) {
4946           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stride);
4947           if (value) { values[2] = value; kw_args--; }
4948         }
4949         CYTHON_FALLTHROUGH;
4950         case  3:
4951         if (kw_args > 0) {
4952           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start);
4953           if (value) { values[3] = value; kw_args--; }
4954         }
4955       }
4956       if (unlikely(kw_args > 0)) {
4957         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bitwise_addition") < 0)) __PYX_ERR(1, 170, __pyx_L3_error)
4958       }
4959     } else {
4960       switch (PyTuple_GET_SIZE(__pyx_args)) {
4961         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4962         CYTHON_FALLTHROUGH;
4963         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4964         CYTHON_FALLTHROUGH;
4965         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4966         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4967         break;
4968         default: goto __pyx_L5_argtuple_error;
4969       }
4970     }
4971     __pyx_v_x = __Pyx_PyInt_As_npy_uint64(values[0]); if (unlikely((__pyx_v_x == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 170, __pyx_L3_error)
4972     __pyx_v_y0 = __Pyx_PyInt_As_npy_int64(values[1]); if (unlikely((__pyx_v_y0 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 170, __pyx_L3_error)
4973     if (values[2]) {
4974       __pyx_v_stride = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_stride == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 171, __pyx_L3_error)
4975     } else {
4976       __pyx_v_stride = ((int)1);
4977     }
4978     if (values[3]) {
4979       __pyx_v_start = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_start == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 171, __pyx_L3_error)
4980     } else {
4981       __pyx_v_start = ((int)0);
4982     }
4983   }
4984   goto __pyx_L4_argument_unpacking_done;
4985   __pyx_L5_argtuple_error:;
4986   __Pyx_RaiseArgtupleInvalid("bitwise_addition", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 170, __pyx_L3_error)
4987   __pyx_L3_error:;
4988   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.bitwise_addition", __pyx_clineno, __pyx_lineno, __pyx_filename);
4989   __Pyx_RefNannyFinishContext();
4990   return NULL;
4991   __pyx_L4_argument_unpacking_done:;
4992   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_8bitwise_addition(__pyx_self, __pyx_v_x, __pyx_v_y0, __pyx_v_stride, __pyx_v_start);
4993 
4994   /* function exit code */
4995   __Pyx_RefNannyFinishContext();
4996   return __pyx_r;
4997 }
4998 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_8bitwise_addition(CYTHON_UNUSED PyObject * __pyx_self,__pyx_t_5numpy_uint64_t __pyx_v_x,__pyx_t_5numpy_int64_t __pyx_v_y0,int __pyx_v_stride,int __pyx_v_start)4999 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_8bitwise_addition(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_uint64_t __pyx_v_x, __pyx_t_5numpy_int64_t __pyx_v_y0, int __pyx_v_stride, int __pyx_v_start) {
5000   int __pyx_v_end;
5001   int __pyx_v_p;
5002   int __pyx_v_pstart;
5003   PyObject *__pyx_v_mstr = 0;
5004   __pyx_t_5numpy_uint64_t __pyx_v_m;
5005   __pyx_t_5numpy_uint64_t __pyx_v_y;
5006   __pyx_t_5numpy_uint64_t __pyx_v_out;
5007   PyObject *__pyx_v_func_ls = NULL;
5008   long __pyx_v_i;
5009   PyObject *__pyx_r = NULL;
5010   __Pyx_RefNannyDeclarations
5011   int __pyx_t_1;
5012   PyObject *__pyx_t_2 = NULL;
5013   PyObject *__pyx_t_3 = NULL;
5014   PyObject *__pyx_t_4 = NULL;
5015   PyObject *__pyx_t_5 = NULL;
5016   PyObject *__pyx_t_6 = NULL;
5017   PyObject *__pyx_t_7 = NULL;
5018   __pyx_t_5numpy_uint64_t __pyx_t_8;
5019   int __pyx_t_9;
5020   Py_ssize_t __pyx_t_10;
5021   PyObject *(*__pyx_t_11)(PyObject *);
5022   long __pyx_t_12;
5023   __Pyx_RefNannySetupContext("bitwise_addition", 0);
5024 
5025   /* "yt/utilities/lib/geometry_utils.pyx":172
5026  * def bitwise_addition(np.uint64_t x, np.int64_t y0,
5027  *                      int stride = 1, int start = 0):
5028  *     if (y0 == 0): return x             # <<<<<<<<<<<<<<
5029  *     cdef int end, p, pstart
5030  *     cdef list mstr
5031  */
5032   __pyx_t_1 = ((__pyx_v_y0 == 0) != 0);
5033   if (__pyx_t_1) {
5034     __Pyx_XDECREF(__pyx_r);
5035     __pyx_t_2 = __Pyx_PyInt_From_npy_uint64(__pyx_v_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 172, __pyx_L1_error)
5036     __Pyx_GOTREF(__pyx_t_2);
5037     __pyx_r = __pyx_t_2;
5038     __pyx_t_2 = 0;
5039     goto __pyx_L0;
5040   }
5041 
5042   /* "yt/utilities/lib/geometry_utils.pyx":176
5043  *     cdef list mstr
5044  *     cdef np.uint64_t m, y, out
5045  *     y = np.uint64(np.abs(y0))             # <<<<<<<<<<<<<<
5046  *     if (y0 > 0):
5047  *         func_ls = lsz
5048  */
5049   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 176, __pyx_L1_error)
5050   __Pyx_GOTREF(__pyx_t_3);
5051   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint64); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 176, __pyx_L1_error)
5052   __Pyx_GOTREF(__pyx_t_4);
5053   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5054   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 176, __pyx_L1_error)
5055   __Pyx_GOTREF(__pyx_t_5);
5056   __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_abs); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 176, __pyx_L1_error)
5057   __Pyx_GOTREF(__pyx_t_6);
5058   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5059   __pyx_t_5 = __Pyx_PyInt_From_npy_int64(__pyx_v_y0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 176, __pyx_L1_error)
5060   __Pyx_GOTREF(__pyx_t_5);
5061   __pyx_t_7 = NULL;
5062   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
5063     __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
5064     if (likely(__pyx_t_7)) {
5065       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
5066       __Pyx_INCREF(__pyx_t_7);
5067       __Pyx_INCREF(function);
5068       __Pyx_DECREF_SET(__pyx_t_6, function);
5069     }
5070   }
5071   __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5);
5072   __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
5073   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5074   if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 176, __pyx_L1_error)
5075   __Pyx_GOTREF(__pyx_t_3);
5076   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5077   __pyx_t_6 = NULL;
5078   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
5079     __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
5080     if (likely(__pyx_t_6)) {
5081       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
5082       __Pyx_INCREF(__pyx_t_6);
5083       __Pyx_INCREF(function);
5084       __Pyx_DECREF_SET(__pyx_t_4, function);
5085     }
5086   }
5087   __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
5088   __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
5089   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5090   if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 176, __pyx_L1_error)
5091   __Pyx_GOTREF(__pyx_t_2);
5092   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5093   __pyx_t_8 = __Pyx_PyInt_As_npy_uint64(__pyx_t_2); if (unlikely((__pyx_t_8 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 176, __pyx_L1_error)
5094   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5095   __pyx_v_y = __pyx_t_8;
5096 
5097   /* "yt/utilities/lib/geometry_utils.pyx":177
5098  *     cdef np.uint64_t m, y, out
5099  *     y = np.uint64(np.abs(y0))
5100  *     if (y0 > 0):             # <<<<<<<<<<<<<<
5101  *         func_ls = lsz
5102  *     else:
5103  */
5104   __pyx_t_1 = ((__pyx_v_y0 > 0) != 0);
5105   if (__pyx_t_1) {
5106 
5107     /* "yt/utilities/lib/geometry_utils.pyx":178
5108  *     y = np.uint64(np.abs(y0))
5109  *     if (y0 > 0):
5110  *         func_ls = lsz             # <<<<<<<<<<<<<<
5111  *     else:
5112  *         func_ls = lsb
5113  */
5114     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_lsz); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 178, __pyx_L1_error)
5115     __Pyx_GOTREF(__pyx_t_2);
5116     __pyx_v_func_ls = __pyx_t_2;
5117     __pyx_t_2 = 0;
5118 
5119     /* "yt/utilities/lib/geometry_utils.pyx":177
5120  *     cdef np.uint64_t m, y, out
5121  *     y = np.uint64(np.abs(y0))
5122  *     if (y0 > 0):             # <<<<<<<<<<<<<<
5123  *         func_ls = lsz
5124  *     else:
5125  */
5126     goto __pyx_L4;
5127   }
5128 
5129   /* "yt/utilities/lib/geometry_utils.pyx":180
5130  *         func_ls = lsz
5131  *     else:
5132  *         func_ls = lsb             # <<<<<<<<<<<<<<
5133  *     # Continue until all bits added
5134  *     p = 0
5135  */
5136   /*else*/ {
5137     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_lsb); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 180, __pyx_L1_error)
5138     __Pyx_GOTREF(__pyx_t_2);
5139     __pyx_v_func_ls = __pyx_t_2;
5140     __pyx_t_2 = 0;
5141   }
5142   __pyx_L4:;
5143 
5144   /* "yt/utilities/lib/geometry_utils.pyx":182
5145  *         func_ls = lsb
5146  *     # Continue until all bits added
5147  *     p = 0             # <<<<<<<<<<<<<<
5148  *     out = x
5149  *     while (y >> p):
5150  */
5151   __pyx_v_p = 0;
5152 
5153   /* "yt/utilities/lib/geometry_utils.pyx":183
5154  *     # Continue until all bits added
5155  *     p = 0
5156  *     out = x             # <<<<<<<<<<<<<<
5157  *     while (y >> p):
5158  *         if (y & (1 << p)):
5159  */
5160   __pyx_v_out = __pyx_v_x;
5161 
5162   /* "yt/utilities/lib/geometry_utils.pyx":184
5163  *     p = 0
5164  *     out = x
5165  *     while (y >> p):             # <<<<<<<<<<<<<<
5166  *         if (y & (1 << p)):
5167  *             # Get end point
5168  */
5169   while (1) {
5170     __pyx_t_1 = ((__pyx_v_y >> __pyx_v_p) != 0);
5171     if (!__pyx_t_1) break;
5172 
5173     /* "yt/utilities/lib/geometry_utils.pyx":185
5174  *     out = x
5175  *     while (y >> p):
5176  *         if (y & (1 << p)):             # <<<<<<<<<<<<<<
5177  *             # Get end point
5178  *             pstart = start + p*stride
5179  */
5180     __pyx_t_1 = ((__pyx_v_y & (1 << __pyx_v_p)) != 0);
5181     if (__pyx_t_1) {
5182 
5183       /* "yt/utilities/lib/geometry_utils.pyx":187
5184  *         if (y & (1 << p)):
5185  *             # Get end point
5186  *             pstart = start + p*stride             # <<<<<<<<<<<<<<
5187  *             end = func_ls(out,stride=stride,start=pstart)
5188  *             # Create mask
5189  */
5190       __pyx_v_pstart = (__pyx_v_start + (__pyx_v_p * __pyx_v_stride));
5191 
5192       /* "yt/utilities/lib/geometry_utils.pyx":188
5193  *             # Get end point
5194  *             pstart = start + p*stride
5195  *             end = func_ls(out,stride=stride,start=pstart)             # <<<<<<<<<<<<<<
5196  *             # Create mask
5197  *             mstr = (end + 1) * ['0']
5198  */
5199       __pyx_t_2 = __Pyx_PyInt_From_npy_uint64(__pyx_v_out); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 188, __pyx_L1_error)
5200       __Pyx_GOTREF(__pyx_t_2);
5201       __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 188, __pyx_L1_error)
5202       __Pyx_GOTREF(__pyx_t_4);
5203       __Pyx_GIVEREF(__pyx_t_2);
5204       PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
5205       __pyx_t_2 = 0;
5206       __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 188, __pyx_L1_error)
5207       __Pyx_GOTREF(__pyx_t_2);
5208       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_stride); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 188, __pyx_L1_error)
5209       __Pyx_GOTREF(__pyx_t_3);
5210       if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_stride, __pyx_t_3) < 0) __PYX_ERR(1, 188, __pyx_L1_error)
5211       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5212       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_pstart); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 188, __pyx_L1_error)
5213       __Pyx_GOTREF(__pyx_t_3);
5214       if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_start, __pyx_t_3) < 0) __PYX_ERR(1, 188, __pyx_L1_error)
5215       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5216       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_func_ls, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 188, __pyx_L1_error)
5217       __Pyx_GOTREF(__pyx_t_3);
5218       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5219       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5220       __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 188, __pyx_L1_error)
5221       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5222       __pyx_v_end = __pyx_t_9;
5223 
5224       /* "yt/utilities/lib/geometry_utils.pyx":190
5225  *             end = func_ls(out,stride=stride,start=pstart)
5226  *             # Create mask
5227  *             mstr = (end + 1) * ['0']             # <<<<<<<<<<<<<<
5228  *             for i in range(pstart,end+1,stride):
5229  *                 mstr[i] = '1'
5230  */
5231       __pyx_t_3 = __Pyx_PyInt_From_long((__pyx_v_end + 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 190, __pyx_L1_error)
5232       __Pyx_GOTREF(__pyx_t_3);
5233       __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 190, __pyx_L1_error)
5234       __Pyx_GOTREF(__pyx_t_2);
5235       __Pyx_INCREF(__pyx_kp_s_0);
5236       __Pyx_GIVEREF(__pyx_kp_s_0);
5237       PyList_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s_0);
5238       __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 190, __pyx_L1_error)
5239       __Pyx_GOTREF(__pyx_t_4);
5240       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5241       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5242       if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(1, 190, __pyx_L1_error)
5243       __Pyx_XDECREF_SET(__pyx_v_mstr, ((PyObject*)__pyx_t_4));
5244       __pyx_t_4 = 0;
5245 
5246       /* "yt/utilities/lib/geometry_utils.pyx":191
5247  *             # Create mask
5248  *             mstr = (end + 1) * ['0']
5249  *             for i in range(pstart,end+1,stride):             # <<<<<<<<<<<<<<
5250  *                 mstr[i] = '1'
5251  *                 m = int(''.join(mstr[::-1]), 2)
5252  */
5253       __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_pstart); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 191, __pyx_L1_error)
5254       __Pyx_GOTREF(__pyx_t_4);
5255       __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_end + 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 191, __pyx_L1_error)
5256       __Pyx_GOTREF(__pyx_t_2);
5257       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_stride); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 191, __pyx_L1_error)
5258       __Pyx_GOTREF(__pyx_t_3);
5259       __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 191, __pyx_L1_error)
5260       __Pyx_GOTREF(__pyx_t_6);
5261       __Pyx_GIVEREF(__pyx_t_4);
5262       PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
5263       __Pyx_GIVEREF(__pyx_t_2);
5264       PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
5265       __Pyx_GIVEREF(__pyx_t_3);
5266       PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3);
5267       __pyx_t_4 = 0;
5268       __pyx_t_2 = 0;
5269       __pyx_t_3 = 0;
5270       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 191, __pyx_L1_error)
5271       __Pyx_GOTREF(__pyx_t_3);
5272       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5273       if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
5274         __pyx_t_6 = __pyx_t_3; __Pyx_INCREF(__pyx_t_6); __pyx_t_10 = 0;
5275         __pyx_t_11 = NULL;
5276       } else {
5277         __pyx_t_10 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 191, __pyx_L1_error)
5278         __Pyx_GOTREF(__pyx_t_6);
5279         __pyx_t_11 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 191, __pyx_L1_error)
5280       }
5281       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5282       for (;;) {
5283         if (likely(!__pyx_t_11)) {
5284           if (likely(PyList_CheckExact(__pyx_t_6))) {
5285             if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_6)) break;
5286             #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5287             __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(1, 191, __pyx_L1_error)
5288             #else
5289             __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 191, __pyx_L1_error)
5290             __Pyx_GOTREF(__pyx_t_3);
5291             #endif
5292           } else {
5293             if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
5294             #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5295             __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(1, 191, __pyx_L1_error)
5296             #else
5297             __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 191, __pyx_L1_error)
5298             __Pyx_GOTREF(__pyx_t_3);
5299             #endif
5300           }
5301         } else {
5302           __pyx_t_3 = __pyx_t_11(__pyx_t_6);
5303           if (unlikely(!__pyx_t_3)) {
5304             PyObject* exc_type = PyErr_Occurred();
5305             if (exc_type) {
5306               if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5307               else __PYX_ERR(1, 191, __pyx_L1_error)
5308             }
5309             break;
5310           }
5311           __Pyx_GOTREF(__pyx_t_3);
5312         }
5313         __pyx_t_12 = __Pyx_PyInt_As_long(__pyx_t_3); if (unlikely((__pyx_t_12 == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 191, __pyx_L1_error)
5314         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5315         __pyx_v_i = __pyx_t_12;
5316 
5317         /* "yt/utilities/lib/geometry_utils.pyx":192
5318  *             mstr = (end + 1) * ['0']
5319  *             for i in range(pstart,end+1,stride):
5320  *                 mstr[i] = '1'             # <<<<<<<<<<<<<<
5321  *                 m = int(''.join(mstr[::-1]), 2)
5322  *             # Invert portion in mask
5323  */
5324         if (unlikely(__pyx_v_mstr == Py_None)) {
5325           PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5326           __PYX_ERR(1, 192, __pyx_L1_error)
5327         }
5328         if (unlikely(__Pyx_SetItemInt(__pyx_v_mstr, __pyx_v_i, __pyx_kp_s_1, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(1, 192, __pyx_L1_error)
5329 
5330         /* "yt/utilities/lib/geometry_utils.pyx":193
5331  *             for i in range(pstart,end+1,stride):
5332  *                 mstr[i] = '1'
5333  *                 m = int(''.join(mstr[::-1]), 2)             # <<<<<<<<<<<<<<
5334  *             # Invert portion in mask
5335  *             # print(mstr[::-1])
5336  */
5337         __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_mstr, __pyx_slice__2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 193, __pyx_L1_error)
5338         __Pyx_GOTREF(__pyx_t_3);
5339         __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s_, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 193, __pyx_L1_error)
5340         __Pyx_GOTREF(__pyx_t_2);
5341         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5342         __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 193, __pyx_L1_error)
5343         __Pyx_GOTREF(__pyx_t_3);
5344         __Pyx_GIVEREF(__pyx_t_2);
5345         PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
5346         __Pyx_INCREF(__pyx_int_2);
5347         __Pyx_GIVEREF(__pyx_int_2);
5348         PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_2);
5349         __pyx_t_2 = 0;
5350         __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyInt_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 193, __pyx_L1_error)
5351         __Pyx_GOTREF(__pyx_t_2);
5352         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5353         __pyx_t_8 = __Pyx_PyInt_As_npy_uint64(__pyx_t_2); if (unlikely((__pyx_t_8 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 193, __pyx_L1_error)
5354         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5355         __pyx_v_m = __pyx_t_8;
5356 
5357         /* "yt/utilities/lib/geometry_utils.pyx":191
5358  *             # Create mask
5359  *             mstr = (end + 1) * ['0']
5360  *             for i in range(pstart,end+1,stride):             # <<<<<<<<<<<<<<
5361  *                 mstr[i] = '1'
5362  *                 m = int(''.join(mstr[::-1]), 2)
5363  */
5364       }
5365       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5366 
5367       /* "yt/utilities/lib/geometry_utils.pyx":197
5368  *             # print(mstr[::-1])
5369  *             # print(y,p,(pstart,end+1),bin(m),bin(out),bin(~out))
5370  *             out = masked_merge_64bit(out, ~out, m)             # <<<<<<<<<<<<<<
5371  *         # Move to next bit
5372  *         p += 1
5373  */
5374       __pyx_v_out = __pyx_f_2yt_9utilities_3lib_14geometry_utils_masked_merge_64bit(__pyx_v_out, (~__pyx_v_out), __pyx_v_m);
5375 
5376       /* "yt/utilities/lib/geometry_utils.pyx":185
5377  *     out = x
5378  *     while (y >> p):
5379  *         if (y & (1 << p)):             # <<<<<<<<<<<<<<
5380  *             # Get end point
5381  *             pstart = start + p*stride
5382  */
5383     }
5384 
5385     /* "yt/utilities/lib/geometry_utils.pyx":199
5386  *             out = masked_merge_64bit(out, ~out, m)
5387  *         # Move to next bit
5388  *         p += 1             # <<<<<<<<<<<<<<
5389  *     return out
5390  *
5391  */
5392     __pyx_v_p = (__pyx_v_p + 1);
5393   }
5394 
5395   /* "yt/utilities/lib/geometry_utils.pyx":200
5396  *         # Move to next bit
5397  *         p += 1
5398  *     return out             # <<<<<<<<<<<<<<
5399  *
5400  * @cython.cdivision(True)
5401  */
5402   __Pyx_XDECREF(__pyx_r);
5403   __pyx_t_6 = __Pyx_PyInt_From_npy_uint64(__pyx_v_out); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 200, __pyx_L1_error)
5404   __Pyx_GOTREF(__pyx_t_6);
5405   __pyx_r = __pyx_t_6;
5406   __pyx_t_6 = 0;
5407   goto __pyx_L0;
5408 
5409   /* "yt/utilities/lib/geometry_utils.pyx":170
5410  * @cython.boundscheck(False)
5411  * @cython.wraparound(False)
5412  * def bitwise_addition(np.uint64_t x, np.int64_t y0,             # <<<<<<<<<<<<<<
5413  *                      int stride = 1, int start = 0):
5414  *     if (y0 == 0): return x
5415  */
5416 
5417   /* function exit code */
5418   __pyx_L1_error:;
5419   __Pyx_XDECREF(__pyx_t_2);
5420   __Pyx_XDECREF(__pyx_t_3);
5421   __Pyx_XDECREF(__pyx_t_4);
5422   __Pyx_XDECREF(__pyx_t_5);
5423   __Pyx_XDECREF(__pyx_t_6);
5424   __Pyx_XDECREF(__pyx_t_7);
5425   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.bitwise_addition", __pyx_clineno, __pyx_lineno, __pyx_filename);
5426   __pyx_r = NULL;
5427   __pyx_L0:;
5428   __Pyx_XDECREF(__pyx_v_mstr);
5429   __Pyx_XDECREF(__pyx_v_func_ls);
5430   __Pyx_XGIVEREF(__pyx_r);
5431   __Pyx_RefNannyFinishContext();
5432   return __pyx_r;
5433 }
5434 
5435 /* "yt/utilities/lib/geometry_utils.pyx":205
5436  * @cython.boundscheck(False)
5437  * @cython.wraparound(False)
5438  * cdef np.int64_t point_to_hilbert(int order, np.int64_t p[3]):             # <<<<<<<<<<<<<<
5439  *     cdef np.int64_t h, e, d, l, b, w, i, x
5440  *     h = e = d = 0
5441  */
5442 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_point_to_hilbert(int __pyx_v_order,__pyx_t_5numpy_int64_t * __pyx_v_p)5443 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_point_to_hilbert(int __pyx_v_order, __pyx_t_5numpy_int64_t *__pyx_v_p) {
5444   __pyx_t_5numpy_int64_t __pyx_v_h;
5445   __pyx_t_5numpy_int64_t __pyx_v_e;
5446   __pyx_t_5numpy_int64_t __pyx_v_d;
5447   __pyx_t_5numpy_int64_t __pyx_v_l;
5448   __pyx_t_5numpy_int64_t __pyx_v_b;
5449   __pyx_t_5numpy_int64_t __pyx_v_w;
5450   __pyx_t_5numpy_int64_t __pyx_v_i;
5451   __pyx_t_5numpy_int64_t __pyx_v_x;
5452   __pyx_t_5numpy_int64_t __pyx_r;
5453   __Pyx_RefNannyDeclarations
5454   int __pyx_t_1;
5455   int __pyx_t_2;
5456   __pyx_t_5numpy_int64_t __pyx_t_3;
5457   __pyx_t_5numpy_int64_t __pyx_t_4;
5458   __Pyx_RefNannySetupContext("point_to_hilbert", 0);
5459 
5460   /* "yt/utilities/lib/geometry_utils.pyx":207
5461  * cdef np.int64_t point_to_hilbert(int order, np.int64_t p[3]):
5462  *     cdef np.int64_t h, e, d, l, b, w, i, x
5463  *     h = e = d = 0             # <<<<<<<<<<<<<<
5464  *     for i in range(order):
5465  *         l = 0
5466  */
5467   __pyx_v_h = 0;
5468   __pyx_v_e = 0;
5469   __pyx_v_d = 0;
5470 
5471   /* "yt/utilities/lib/geometry_utils.pyx":208
5472  *     cdef np.int64_t h, e, d, l, b, w, i, x
5473  *     h = e = d = 0
5474  *     for i in range(order):             # <<<<<<<<<<<<<<
5475  *         l = 0
5476  *         for x in range(3):
5477  */
5478   __pyx_t_1 = __pyx_v_order;
5479   __pyx_t_2 = __pyx_t_1;
5480   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
5481     __pyx_v_i = __pyx_t_3;
5482 
5483     /* "yt/utilities/lib/geometry_utils.pyx":209
5484  *     h = e = d = 0
5485  *     for i in range(order):
5486  *         l = 0             # <<<<<<<<<<<<<<
5487  *         for x in range(3):
5488  *             b = bitrange(p[3-x-1], order, i, i+1)
5489  */
5490     __pyx_v_l = 0;
5491 
5492     /* "yt/utilities/lib/geometry_utils.pyx":210
5493  *     for i in range(order):
5494  *         l = 0
5495  *         for x in range(3):             # <<<<<<<<<<<<<<
5496  *             b = bitrange(p[3-x-1], order, i, i+1)
5497  *             l |= (b<<x)
5498  */
5499     for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) {
5500       __pyx_v_x = __pyx_t_4;
5501 
5502       /* "yt/utilities/lib/geometry_utils.pyx":211
5503  *         l = 0
5504  *         for x in range(3):
5505  *             b = bitrange(p[3-x-1], order, i, i+1)             # <<<<<<<<<<<<<<
5506  *             l |= (b<<x)
5507  *         l = transform(e, d, 3, l)
5508  */
5509       __pyx_v_b = __pyx_f_2yt_9utilities_3lib_14geometry_utils_bitrange((__pyx_v_p[((3 - __pyx_v_x) - 1)]), __pyx_v_order, __pyx_v_i, (__pyx_v_i + 1));
5510 
5511       /* "yt/utilities/lib/geometry_utils.pyx":212
5512  *         for x in range(3):
5513  *             b = bitrange(p[3-x-1], order, i, i+1)
5514  *             l |= (b<<x)             # <<<<<<<<<<<<<<
5515  *         l = transform(e, d, 3, l)
5516  *         w = igraycode(l)
5517  */
5518       __pyx_v_l = (__pyx_v_l | (__pyx_v_b << __pyx_v_x));
5519     }
5520 
5521     /* "yt/utilities/lib/geometry_utils.pyx":213
5522  *             b = bitrange(p[3-x-1], order, i, i+1)
5523  *             l |= (b<<x)
5524  *         l = transform(e, d, 3, l)             # <<<<<<<<<<<<<<
5525  *         w = igraycode(l)
5526  *         e = e ^ lrot(entry(w), d+1, 3)
5527  */
5528     __pyx_v_l = __pyx_f_2yt_9utilities_3lib_14geometry_utils_transform(__pyx_v_e, __pyx_v_d, 3, __pyx_v_l);
5529 
5530     /* "yt/utilities/lib/geometry_utils.pyx":214
5531  *             l |= (b<<x)
5532  *         l = transform(e, d, 3, l)
5533  *         w = igraycode(l)             # <<<<<<<<<<<<<<
5534  *         e = e ^ lrot(entry(w), d+1, 3)
5535  *         d = (d + direction(w, 3) + 1)%3
5536  */
5537     __pyx_v_w = __pyx_f_2yt_9utilities_3lib_14geometry_utils_igraycode(__pyx_v_l);
5538 
5539     /* "yt/utilities/lib/geometry_utils.pyx":215
5540  *         l = transform(e, d, 3, l)
5541  *         w = igraycode(l)
5542  *         e = e ^ lrot(entry(w), d+1, 3)             # <<<<<<<<<<<<<<
5543  *         d = (d + direction(w, 3) + 1)%3
5544  *         h = (h<<3)|w
5545  */
5546     __pyx_v_e = (__pyx_v_e ^ __pyx_f_2yt_9utilities_3lib_14geometry_utils_lrot(__pyx_f_2yt_9utilities_3lib_14geometry_utils_entry(__pyx_v_w), (__pyx_v_d + 1), 3));
5547 
5548     /* "yt/utilities/lib/geometry_utils.pyx":216
5549  *         w = igraycode(l)
5550  *         e = e ^ lrot(entry(w), d+1, 3)
5551  *         d = (d + direction(w, 3) + 1)%3             # <<<<<<<<<<<<<<
5552  *         h = (h<<3)|w
5553  *     return h
5554  */
5555     __pyx_v_d = (((__pyx_v_d + __pyx_f_2yt_9utilities_3lib_14geometry_utils_direction(__pyx_v_w, 3)) + 1) % 3);
5556 
5557     /* "yt/utilities/lib/geometry_utils.pyx":217
5558  *         e = e ^ lrot(entry(w), d+1, 3)
5559  *         d = (d + direction(w, 3) + 1)%3
5560  *         h = (h<<3)|w             # <<<<<<<<<<<<<<
5561  *     return h
5562  *
5563  */
5564     __pyx_v_h = ((__pyx_v_h << 3) | __pyx_v_w);
5565   }
5566 
5567   /* "yt/utilities/lib/geometry_utils.pyx":218
5568  *         d = (d + direction(w, 3) + 1)%3
5569  *         h = (h<<3)|w
5570  *     return h             # <<<<<<<<<<<<<<
5571  *
5572  * #def hilbert_point(dimension, order, h):
5573  */
5574   __pyx_r = __pyx_v_h;
5575   goto __pyx_L0;
5576 
5577   /* "yt/utilities/lib/geometry_utils.pyx":205
5578  * @cython.boundscheck(False)
5579  * @cython.wraparound(False)
5580  * cdef np.int64_t point_to_hilbert(int order, np.int64_t p[3]):             # <<<<<<<<<<<<<<
5581  *     cdef np.int64_t h, e, d, l, b, w, i, x
5582  *     h = e = d = 0
5583  */
5584 
5585   /* function exit code */
5586   __pyx_L0:;
5587   __Pyx_RefNannyFinishContext();
5588   return __pyx_r;
5589 }
5590 
5591 /* "yt/utilities/lib/geometry_utils.pyx":247
5592  * @cython.boundscheck(False)
5593  * @cython.wraparound(False)
5594  * cdef void hilbert_to_point(int order, np.int64_t h, np.int64_t *p):             # <<<<<<<<<<<<<<
5595  *     cdef np.int64_t hwidth, e, d, w, l, b
5596  *     cdef int i, j
5597  */
5598 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_hilbert_to_point(int __pyx_v_order,__pyx_t_5numpy_int64_t __pyx_v_h,__pyx_t_5numpy_int64_t * __pyx_v_p)5599 static void __pyx_f_2yt_9utilities_3lib_14geometry_utils_hilbert_to_point(int __pyx_v_order, __pyx_t_5numpy_int64_t __pyx_v_h, __pyx_t_5numpy_int64_t *__pyx_v_p) {
5600   __pyx_t_5numpy_int64_t __pyx_v_hwidth;
5601   __pyx_t_5numpy_int64_t __pyx_v_e;
5602   __pyx_t_5numpy_int64_t __pyx_v_d;
5603   __pyx_t_5numpy_int64_t __pyx_v_w;
5604   __pyx_t_5numpy_int64_t __pyx_v_l;
5605   __pyx_t_5numpy_int64_t __pyx_v_b;
5606   int __pyx_v_i;
5607   int __pyx_v_j;
5608   __Pyx_RefNannyDeclarations
5609   int __pyx_t_1;
5610   int __pyx_t_2;
5611   int __pyx_t_3;
5612   int __pyx_t_4;
5613   __Pyx_RefNannySetupContext("hilbert_to_point", 0);
5614 
5615   /* "yt/utilities/lib/geometry_utils.pyx":250
5616  *     cdef np.int64_t hwidth, e, d, w, l, b
5617  *     cdef int i, j
5618  *     hwidth = 3 * order             # <<<<<<<<<<<<<<
5619  *     e = d = p[0] = p[1] = p[2] = 0
5620  *     for i in range(order):
5621  */
5622   __pyx_v_hwidth = (3 * __pyx_v_order);
5623 
5624   /* "yt/utilities/lib/geometry_utils.pyx":251
5625  *     cdef int i, j
5626  *     hwidth = 3 * order
5627  *     e = d = p[0] = p[1] = p[2] = 0             # <<<<<<<<<<<<<<
5628  *     for i in range(order):
5629  *         w = bitrange(h, hwidth, i*3, i*3+3)
5630  */
5631   __pyx_v_e = 0;
5632   __pyx_v_d = 0;
5633   (__pyx_v_p[0]) = 0;
5634   (__pyx_v_p[1]) = 0;
5635   (__pyx_v_p[2]) = 0;
5636 
5637   /* "yt/utilities/lib/geometry_utils.pyx":252
5638  *     hwidth = 3 * order
5639  *     e = d = p[0] = p[1] = p[2] = 0
5640  *     for i in range(order):             # <<<<<<<<<<<<<<
5641  *         w = bitrange(h, hwidth, i*3, i*3+3)
5642  *         l = graycode(w)
5643  */
5644   __pyx_t_1 = __pyx_v_order;
5645   __pyx_t_2 = __pyx_t_1;
5646   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
5647     __pyx_v_i = __pyx_t_3;
5648 
5649     /* "yt/utilities/lib/geometry_utils.pyx":253
5650  *     e = d = p[0] = p[1] = p[2] = 0
5651  *     for i in range(order):
5652  *         w = bitrange(h, hwidth, i*3, i*3+3)             # <<<<<<<<<<<<<<
5653  *         l = graycode(w)
5654  *         l = lrot(l, d +1, 3)^e
5655  */
5656     __pyx_v_w = __pyx_f_2yt_9utilities_3lib_14geometry_utils_bitrange(__pyx_v_h, __pyx_v_hwidth, (__pyx_v_i * 3), ((__pyx_v_i * 3) + 3));
5657 
5658     /* "yt/utilities/lib/geometry_utils.pyx":254
5659  *     for i in range(order):
5660  *         w = bitrange(h, hwidth, i*3, i*3+3)
5661  *         l = graycode(w)             # <<<<<<<<<<<<<<
5662  *         l = lrot(l, d +1, 3)^e
5663  *         for j in range(3):
5664  */
5665     __pyx_v_l = __pyx_f_2yt_9utilities_3lib_14geometry_utils_graycode(__pyx_v_w);
5666 
5667     /* "yt/utilities/lib/geometry_utils.pyx":255
5668  *         w = bitrange(h, hwidth, i*3, i*3+3)
5669  *         l = graycode(w)
5670  *         l = lrot(l, d +1, 3)^e             # <<<<<<<<<<<<<<
5671  *         for j in range(3):
5672  *             b = bitrange(l, 3, j, j+1)
5673  */
5674     __pyx_v_l = (__pyx_f_2yt_9utilities_3lib_14geometry_utils_lrot(__pyx_v_l, (__pyx_v_d + 1), 3) ^ __pyx_v_e);
5675 
5676     /* "yt/utilities/lib/geometry_utils.pyx":256
5677  *         l = graycode(w)
5678  *         l = lrot(l, d +1, 3)^e
5679  *         for j in range(3):             # <<<<<<<<<<<<<<
5680  *             b = bitrange(l, 3, j, j+1)
5681  *             p[j] = setbit(p[j], order, i, b)
5682  */
5683     for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) {
5684       __pyx_v_j = __pyx_t_4;
5685 
5686       /* "yt/utilities/lib/geometry_utils.pyx":257
5687  *         l = lrot(l, d +1, 3)^e
5688  *         for j in range(3):
5689  *             b = bitrange(l, 3, j, j+1)             # <<<<<<<<<<<<<<
5690  *             p[j] = setbit(p[j], order, i, b)
5691  *         e = e ^ lrot(entry(w), d+1, 3)
5692  */
5693       __pyx_v_b = __pyx_f_2yt_9utilities_3lib_14geometry_utils_bitrange(__pyx_v_l, 3, __pyx_v_j, (__pyx_v_j + 1));
5694 
5695       /* "yt/utilities/lib/geometry_utils.pyx":258
5696  *         for j in range(3):
5697  *             b = bitrange(l, 3, j, j+1)
5698  *             p[j] = setbit(p[j], order, i, b)             # <<<<<<<<<<<<<<
5699  *         e = e ^ lrot(entry(w), d+1, 3)
5700  *         d = (d + direction(w, 3) + 1)%3
5701  */
5702       (__pyx_v_p[__pyx_v_j]) = __pyx_f_2yt_9utilities_3lib_14geometry_utils_setbit((__pyx_v_p[__pyx_v_j]), __pyx_v_order, __pyx_v_i, __pyx_v_b);
5703     }
5704 
5705     /* "yt/utilities/lib/geometry_utils.pyx":259
5706  *             b = bitrange(l, 3, j, j+1)
5707  *             p[j] = setbit(p[j], order, i, b)
5708  *         e = e ^ lrot(entry(w), d+1, 3)             # <<<<<<<<<<<<<<
5709  *         d = (d + direction(w, 3) + 1)%3
5710  *
5711  */
5712     __pyx_v_e = (__pyx_v_e ^ __pyx_f_2yt_9utilities_3lib_14geometry_utils_lrot(__pyx_f_2yt_9utilities_3lib_14geometry_utils_entry(__pyx_v_w), (__pyx_v_d + 1), 3));
5713 
5714     /* "yt/utilities/lib/geometry_utils.pyx":260
5715  *             p[j] = setbit(p[j], order, i, b)
5716  *         e = e ^ lrot(entry(w), d+1, 3)
5717  *         d = (d + direction(w, 3) + 1)%3             # <<<<<<<<<<<<<<
5718  *
5719  * @cython.cdivision(True)
5720  */
5721     __pyx_v_d = (((__pyx_v_d + __pyx_f_2yt_9utilities_3lib_14geometry_utils_direction(__pyx_v_w, 3)) + 1) % 3);
5722   }
5723 
5724   /* "yt/utilities/lib/geometry_utils.pyx":247
5725  * @cython.boundscheck(False)
5726  * @cython.wraparound(False)
5727  * cdef void hilbert_to_point(int order, np.int64_t h, np.int64_t *p):             # <<<<<<<<<<<<<<
5728  *     cdef np.int64_t hwidth, e, d, w, l, b
5729  *     cdef int i, j
5730  */
5731 
5732   /* function exit code */
5733   __Pyx_RefNannyFinishContext();
5734 }
5735 
5736 /* "yt/utilities/lib/geometry_utils.pyx":265
5737  * @cython.boundscheck(False)
5738  * @cython.wraparound(False)
5739  * def get_hilbert_indices(int order, np.ndarray[np.int64_t, ndim=2] left_index):             # <<<<<<<<<<<<<<
5740  *     # This is inspired by the scurve package by user cortesi on GH.
5741  *     cdef int i
5742  */
5743 
5744 /* Python wrapper */
5745 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_11get_hilbert_indices(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5746 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_11get_hilbert_indices = {"get_hilbert_indices", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_11get_hilbert_indices, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_11get_hilbert_indices(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)5747 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_11get_hilbert_indices(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5748   int __pyx_v_order;
5749   PyArrayObject *__pyx_v_left_index = 0;
5750   PyObject *__pyx_r = 0;
5751   __Pyx_RefNannyDeclarations
5752   __Pyx_RefNannySetupContext("get_hilbert_indices (wrapper)", 0);
5753   {
5754     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_order,&__pyx_n_s_left_index,0};
5755     PyObject* values[2] = {0,0};
5756     if (unlikely(__pyx_kwds)) {
5757       Py_ssize_t kw_args;
5758       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5759       switch (pos_args) {
5760         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5761         CYTHON_FALLTHROUGH;
5762         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5763         CYTHON_FALLTHROUGH;
5764         case  0: break;
5765         default: goto __pyx_L5_argtuple_error;
5766       }
5767       kw_args = PyDict_Size(__pyx_kwds);
5768       switch (pos_args) {
5769         case  0:
5770         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_order)) != 0)) kw_args--;
5771         else goto __pyx_L5_argtuple_error;
5772         CYTHON_FALLTHROUGH;
5773         case  1:
5774         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_left_index)) != 0)) kw_args--;
5775         else {
5776           __Pyx_RaiseArgtupleInvalid("get_hilbert_indices", 1, 2, 2, 1); __PYX_ERR(1, 265, __pyx_L3_error)
5777         }
5778       }
5779       if (unlikely(kw_args > 0)) {
5780         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_hilbert_indices") < 0)) __PYX_ERR(1, 265, __pyx_L3_error)
5781       }
5782     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5783       goto __pyx_L5_argtuple_error;
5784     } else {
5785       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5786       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5787     }
5788     __pyx_v_order = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 265, __pyx_L3_error)
5789     __pyx_v_left_index = ((PyArrayObject *)values[1]);
5790   }
5791   goto __pyx_L4_argument_unpacking_done;
5792   __pyx_L5_argtuple_error:;
5793   __Pyx_RaiseArgtupleInvalid("get_hilbert_indices", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 265, __pyx_L3_error)
5794   __pyx_L3_error:;
5795   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.get_hilbert_indices", __pyx_clineno, __pyx_lineno, __pyx_filename);
5796   __Pyx_RefNannyFinishContext();
5797   return NULL;
5798   __pyx_L4_argument_unpacking_done:;
5799   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_index), __pyx_ptype_5numpy_ndarray, 1, "left_index", 0))) __PYX_ERR(1, 265, __pyx_L1_error)
5800   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_10get_hilbert_indices(__pyx_self, __pyx_v_order, __pyx_v_left_index);
5801 
5802   /* function exit code */
5803   goto __pyx_L0;
5804   __pyx_L1_error:;
5805   __pyx_r = NULL;
5806   __pyx_L0:;
5807   __Pyx_RefNannyFinishContext();
5808   return __pyx_r;
5809 }
5810 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_10get_hilbert_indices(CYTHON_UNUSED PyObject * __pyx_self,int __pyx_v_order,PyArrayObject * __pyx_v_left_index)5811 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_10get_hilbert_indices(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_order, PyArrayObject *__pyx_v_left_index) {
5812   int __pyx_v_i;
5813   __pyx_t_5numpy_int64_t __pyx_v_p[3];
5814   PyArrayObject *__pyx_v_hilbert_indices = 0;
5815   __Pyx_LocalBuf_ND __pyx_pybuffernd_hilbert_indices;
5816   __Pyx_Buffer __pyx_pybuffer_hilbert_indices;
5817   __Pyx_LocalBuf_ND __pyx_pybuffernd_left_index;
5818   __Pyx_Buffer __pyx_pybuffer_left_index;
5819   PyObject *__pyx_r = NULL;
5820   __Pyx_RefNannyDeclarations
5821   PyObject *__pyx_t_1 = NULL;
5822   PyObject *__pyx_t_2 = NULL;
5823   PyObject *__pyx_t_3 = NULL;
5824   PyObject *__pyx_t_4 = NULL;
5825   int __pyx_t_5;
5826   PyObject *__pyx_t_6 = NULL;
5827   PyArrayObject *__pyx_t_7 = NULL;
5828   PyObject *__pyx_t_8 = NULL;
5829   PyObject *__pyx_t_9 = NULL;
5830   PyObject *__pyx_t_10 = NULL;
5831   npy_intp __pyx_t_11;
5832   npy_intp __pyx_t_12;
5833   Py_ssize_t __pyx_t_13;
5834   Py_ssize_t __pyx_t_14;
5835   Py_ssize_t __pyx_t_15;
5836   Py_ssize_t __pyx_t_16;
5837   Py_ssize_t __pyx_t_17;
5838   Py_ssize_t __pyx_t_18;
5839   Py_ssize_t __pyx_t_19;
5840   __Pyx_RefNannySetupContext("get_hilbert_indices", 0);
5841   __pyx_pybuffer_hilbert_indices.pybuffer.buf = NULL;
5842   __pyx_pybuffer_hilbert_indices.refcount = 0;
5843   __pyx_pybuffernd_hilbert_indices.data = NULL;
5844   __pyx_pybuffernd_hilbert_indices.rcbuffer = &__pyx_pybuffer_hilbert_indices;
5845   __pyx_pybuffer_left_index.pybuffer.buf = NULL;
5846   __pyx_pybuffer_left_index.refcount = 0;
5847   __pyx_pybuffernd_left_index.data = NULL;
5848   __pyx_pybuffernd_left_index.rcbuffer = &__pyx_pybuffer_left_index;
5849   {
5850     __Pyx_BufFmt_StackElem __pyx_stack[1];
5851     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_left_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(1, 265, __pyx_L1_error)
5852   }
5853   __pyx_pybuffernd_left_index.diminfo[0].strides = __pyx_pybuffernd_left_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_index.diminfo[0].shape = __pyx_pybuffernd_left_index.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_left_index.diminfo[1].strides = __pyx_pybuffernd_left_index.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_left_index.diminfo[1].shape = __pyx_pybuffernd_left_index.rcbuffer->pybuffer.shape[1];
5854 
5855   /* "yt/utilities/lib/geometry_utils.pyx":270
5856  *     cdef np.int64_t p[3]
5857  *     cdef np.ndarray[np.int64_t, ndim=1] hilbert_indices
5858  *     hilbert_indices = np.zeros(left_index.shape[0], 'int64')             # <<<<<<<<<<<<<<
5859  *     for i in range(left_index.shape[0]):
5860  *         p[0] = left_index[i, 0]
5861  */
5862   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 270, __pyx_L1_error)
5863   __Pyx_GOTREF(__pyx_t_2);
5864   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 270, __pyx_L1_error)
5865   __Pyx_GOTREF(__pyx_t_3);
5866   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5867   __pyx_t_2 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_left_index->dimensions[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 270, __pyx_L1_error)
5868   __Pyx_GOTREF(__pyx_t_2);
5869   __pyx_t_4 = NULL;
5870   __pyx_t_5 = 0;
5871   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
5872     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
5873     if (likely(__pyx_t_4)) {
5874       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
5875       __Pyx_INCREF(__pyx_t_4);
5876       __Pyx_INCREF(function);
5877       __Pyx_DECREF_SET(__pyx_t_3, function);
5878       __pyx_t_5 = 1;
5879     }
5880   }
5881   #if CYTHON_FAST_PYCALL
5882   if (PyFunction_Check(__pyx_t_3)) {
5883     PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, __pyx_n_s_int64};
5884     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 270, __pyx_L1_error)
5885     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5886     __Pyx_GOTREF(__pyx_t_1);
5887     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5888   } else
5889   #endif
5890   #if CYTHON_FAST_PYCCALL
5891   if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
5892     PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, __pyx_n_s_int64};
5893     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 270, __pyx_L1_error)
5894     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5895     __Pyx_GOTREF(__pyx_t_1);
5896     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5897   } else
5898   #endif
5899   {
5900     __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 270, __pyx_L1_error)
5901     __Pyx_GOTREF(__pyx_t_6);
5902     if (__pyx_t_4) {
5903       __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
5904     }
5905     __Pyx_GIVEREF(__pyx_t_2);
5906     PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_2);
5907     __Pyx_INCREF(__pyx_n_s_int64);
5908     __Pyx_GIVEREF(__pyx_n_s_int64);
5909     PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_n_s_int64);
5910     __pyx_t_2 = 0;
5911     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 270, __pyx_L1_error)
5912     __Pyx_GOTREF(__pyx_t_1);
5913     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
5914   }
5915   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5916   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 270, __pyx_L1_error)
5917   __pyx_t_7 = ((PyArrayObject *)__pyx_t_1);
5918   {
5919     __Pyx_BufFmt_StackElem __pyx_stack[1];
5920     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hilbert_indices.rcbuffer->pybuffer);
5921     __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hilbert_indices.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
5922     if (unlikely(__pyx_t_5 < 0)) {
5923       PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
5924       if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_hilbert_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_hilbert_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
5925         Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
5926         __Pyx_RaiseBufferFallbackError();
5927       } else {
5928         PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
5929       }
5930       __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
5931     }
5932     __pyx_pybuffernd_hilbert_indices.diminfo[0].strides = __pyx_pybuffernd_hilbert_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_hilbert_indices.diminfo[0].shape = __pyx_pybuffernd_hilbert_indices.rcbuffer->pybuffer.shape[0];
5933     if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(1, 270, __pyx_L1_error)
5934   }
5935   __pyx_t_7 = 0;
5936   __pyx_v_hilbert_indices = ((PyArrayObject *)__pyx_t_1);
5937   __pyx_t_1 = 0;
5938 
5939   /* "yt/utilities/lib/geometry_utils.pyx":271
5940  *     cdef np.ndarray[np.int64_t, ndim=1] hilbert_indices
5941  *     hilbert_indices = np.zeros(left_index.shape[0], 'int64')
5942  *     for i in range(left_index.shape[0]):             # <<<<<<<<<<<<<<
5943  *         p[0] = left_index[i, 0]
5944  *         p[1] = left_index[i, 1]
5945  */
5946   __pyx_t_11 = (__pyx_v_left_index->dimensions[0]);
5947   __pyx_t_12 = __pyx_t_11;
5948   for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_12; __pyx_t_5+=1) {
5949     __pyx_v_i = __pyx_t_5;
5950 
5951     /* "yt/utilities/lib/geometry_utils.pyx":272
5952  *     hilbert_indices = np.zeros(left_index.shape[0], 'int64')
5953  *     for i in range(left_index.shape[0]):
5954  *         p[0] = left_index[i, 0]             # <<<<<<<<<<<<<<
5955  *         p[1] = left_index[i, 1]
5956  *         p[2] = left_index[i, 2]
5957  */
5958     __pyx_t_13 = __pyx_v_i;
5959     __pyx_t_14 = 0;
5960     (__pyx_v_p[0]) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left_index.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_left_index.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_left_index.diminfo[1].strides));
5961 
5962     /* "yt/utilities/lib/geometry_utils.pyx":273
5963  *     for i in range(left_index.shape[0]):
5964  *         p[0] = left_index[i, 0]
5965  *         p[1] = left_index[i, 1]             # <<<<<<<<<<<<<<
5966  *         p[2] = left_index[i, 2]
5967  *         hilbert_indices[i] = point_to_hilbert(order, p)
5968  */
5969     __pyx_t_15 = __pyx_v_i;
5970     __pyx_t_16 = 1;
5971     (__pyx_v_p[1]) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left_index.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_left_index.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_left_index.diminfo[1].strides));
5972 
5973     /* "yt/utilities/lib/geometry_utils.pyx":274
5974  *         p[0] = left_index[i, 0]
5975  *         p[1] = left_index[i, 1]
5976  *         p[2] = left_index[i, 2]             # <<<<<<<<<<<<<<
5977  *         hilbert_indices[i] = point_to_hilbert(order, p)
5978  *     return hilbert_indices
5979  */
5980     __pyx_t_17 = __pyx_v_i;
5981     __pyx_t_18 = 2;
5982     (__pyx_v_p[2]) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_left_index.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_left_index.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_left_index.diminfo[1].strides));
5983 
5984     /* "yt/utilities/lib/geometry_utils.pyx":275
5985  *         p[1] = left_index[i, 1]
5986  *         p[2] = left_index[i, 2]
5987  *         hilbert_indices[i] = point_to_hilbert(order, p)             # <<<<<<<<<<<<<<
5988  *     return hilbert_indices
5989  *
5990  */
5991     __pyx_t_19 = __pyx_v_i;
5992     *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_hilbert_indices.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_hilbert_indices.diminfo[0].strides) = __pyx_f_2yt_9utilities_3lib_14geometry_utils_point_to_hilbert(__pyx_v_order, __pyx_v_p);
5993   }
5994 
5995   /* "yt/utilities/lib/geometry_utils.pyx":276
5996  *         p[2] = left_index[i, 2]
5997  *         hilbert_indices[i] = point_to_hilbert(order, p)
5998  *     return hilbert_indices             # <<<<<<<<<<<<<<
5999  *
6000  * @cython.cdivision(True)
6001  */
6002   __Pyx_XDECREF(__pyx_r);
6003   __Pyx_INCREF(((PyObject *)__pyx_v_hilbert_indices));
6004   __pyx_r = ((PyObject *)__pyx_v_hilbert_indices);
6005   goto __pyx_L0;
6006 
6007   /* "yt/utilities/lib/geometry_utils.pyx":265
6008  * @cython.boundscheck(False)
6009  * @cython.wraparound(False)
6010  * def get_hilbert_indices(int order, np.ndarray[np.int64_t, ndim=2] left_index):             # <<<<<<<<<<<<<<
6011  *     # This is inspired by the scurve package by user cortesi on GH.
6012  *     cdef int i
6013  */
6014 
6015   /* function exit code */
6016   __pyx_L1_error:;
6017   __Pyx_XDECREF(__pyx_t_1);
6018   __Pyx_XDECREF(__pyx_t_2);
6019   __Pyx_XDECREF(__pyx_t_3);
6020   __Pyx_XDECREF(__pyx_t_4);
6021   __Pyx_XDECREF(__pyx_t_6);
6022   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
6023     __Pyx_PyThreadState_declare
6024     __Pyx_PyThreadState_assign
6025     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
6026     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hilbert_indices.rcbuffer->pybuffer);
6027     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_index.rcbuffer->pybuffer);
6028   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
6029   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.get_hilbert_indices", __pyx_clineno, __pyx_lineno, __pyx_filename);
6030   __pyx_r = NULL;
6031   goto __pyx_L2;
6032   __pyx_L0:;
6033   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_hilbert_indices.rcbuffer->pybuffer);
6034   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_index.rcbuffer->pybuffer);
6035   __pyx_L2:;
6036   __Pyx_XDECREF((PyObject *)__pyx_v_hilbert_indices);
6037   __Pyx_XGIVEREF(__pyx_r);
6038   __Pyx_RefNannyFinishContext();
6039   return __pyx_r;
6040 }
6041 
6042 /* "yt/utilities/lib/geometry_utils.pyx":281
6043  * @cython.boundscheck(False)
6044  * @cython.wraparound(False)
6045  * def get_hilbert_points(int order, np.ndarray[np.int64_t, ndim=1] indices):             # <<<<<<<<<<<<<<
6046  *     # This is inspired by the scurve package by user cortesi on GH.
6047  *     cdef int i, j
6048  */
6049 
6050 /* Python wrapper */
6051 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_13get_hilbert_points(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6052 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_13get_hilbert_points = {"get_hilbert_points", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_13get_hilbert_points, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_13get_hilbert_points(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)6053 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_13get_hilbert_points(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6054   int __pyx_v_order;
6055   PyArrayObject *__pyx_v_indices = 0;
6056   PyObject *__pyx_r = 0;
6057   __Pyx_RefNannyDeclarations
6058   __Pyx_RefNannySetupContext("get_hilbert_points (wrapper)", 0);
6059   {
6060     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_order,&__pyx_n_s_indices,0};
6061     PyObject* values[2] = {0,0};
6062     if (unlikely(__pyx_kwds)) {
6063       Py_ssize_t kw_args;
6064       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6065       switch (pos_args) {
6066         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6067         CYTHON_FALLTHROUGH;
6068         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6069         CYTHON_FALLTHROUGH;
6070         case  0: break;
6071         default: goto __pyx_L5_argtuple_error;
6072       }
6073       kw_args = PyDict_Size(__pyx_kwds);
6074       switch (pos_args) {
6075         case  0:
6076         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_order)) != 0)) kw_args--;
6077         else goto __pyx_L5_argtuple_error;
6078         CYTHON_FALLTHROUGH;
6079         case  1:
6080         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_indices)) != 0)) kw_args--;
6081         else {
6082           __Pyx_RaiseArgtupleInvalid("get_hilbert_points", 1, 2, 2, 1); __PYX_ERR(1, 281, __pyx_L3_error)
6083         }
6084       }
6085       if (unlikely(kw_args > 0)) {
6086         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_hilbert_points") < 0)) __PYX_ERR(1, 281, __pyx_L3_error)
6087       }
6088     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
6089       goto __pyx_L5_argtuple_error;
6090     } else {
6091       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6092       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6093     }
6094     __pyx_v_order = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 281, __pyx_L3_error)
6095     __pyx_v_indices = ((PyArrayObject *)values[1]);
6096   }
6097   goto __pyx_L4_argument_unpacking_done;
6098   __pyx_L5_argtuple_error:;
6099   __Pyx_RaiseArgtupleInvalid("get_hilbert_points", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 281, __pyx_L3_error)
6100   __pyx_L3_error:;
6101   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.get_hilbert_points", __pyx_clineno, __pyx_lineno, __pyx_filename);
6102   __Pyx_RefNannyFinishContext();
6103   return NULL;
6104   __pyx_L4_argument_unpacking_done:;
6105   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indices), __pyx_ptype_5numpy_ndarray, 1, "indices", 0))) __PYX_ERR(1, 281, __pyx_L1_error)
6106   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_12get_hilbert_points(__pyx_self, __pyx_v_order, __pyx_v_indices);
6107 
6108   /* function exit code */
6109   goto __pyx_L0;
6110   __pyx_L1_error:;
6111   __pyx_r = NULL;
6112   __pyx_L0:;
6113   __Pyx_RefNannyFinishContext();
6114   return __pyx_r;
6115 }
6116 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_12get_hilbert_points(CYTHON_UNUSED PyObject * __pyx_self,int __pyx_v_order,PyArrayObject * __pyx_v_indices)6117 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_12get_hilbert_points(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_order, PyArrayObject *__pyx_v_indices) {
6118   int __pyx_v_i;
6119   int __pyx_v_j;
6120   __pyx_t_5numpy_int64_t __pyx_v_p[3];
6121   PyArrayObject *__pyx_v_positions = 0;
6122   __Pyx_LocalBuf_ND __pyx_pybuffernd_indices;
6123   __Pyx_Buffer __pyx_pybuffer_indices;
6124   __Pyx_LocalBuf_ND __pyx_pybuffernd_positions;
6125   __Pyx_Buffer __pyx_pybuffer_positions;
6126   PyObject *__pyx_r = NULL;
6127   __Pyx_RefNannyDeclarations
6128   PyObject *__pyx_t_1 = NULL;
6129   PyObject *__pyx_t_2 = NULL;
6130   PyObject *__pyx_t_3 = NULL;
6131   PyObject *__pyx_t_4 = NULL;
6132   int __pyx_t_5;
6133   PyObject *__pyx_t_6 = NULL;
6134   PyArrayObject *__pyx_t_7 = NULL;
6135   PyObject *__pyx_t_8 = NULL;
6136   PyObject *__pyx_t_9 = NULL;
6137   PyObject *__pyx_t_10 = NULL;
6138   npy_intp __pyx_t_11;
6139   npy_intp __pyx_t_12;
6140   Py_ssize_t __pyx_t_13;
6141   int __pyx_t_14;
6142   Py_ssize_t __pyx_t_15;
6143   Py_ssize_t __pyx_t_16;
6144   __Pyx_RefNannySetupContext("get_hilbert_points", 0);
6145   __pyx_pybuffer_positions.pybuffer.buf = NULL;
6146   __pyx_pybuffer_positions.refcount = 0;
6147   __pyx_pybuffernd_positions.data = NULL;
6148   __pyx_pybuffernd_positions.rcbuffer = &__pyx_pybuffer_positions;
6149   __pyx_pybuffer_indices.pybuffer.buf = NULL;
6150   __pyx_pybuffer_indices.refcount = 0;
6151   __pyx_pybuffernd_indices.data = NULL;
6152   __pyx_pybuffernd_indices.rcbuffer = &__pyx_pybuffer_indices;
6153   {
6154     __Pyx_BufFmt_StackElem __pyx_stack[1];
6155     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 281, __pyx_L1_error)
6156   }
6157   __pyx_pybuffernd_indices.diminfo[0].strides = __pyx_pybuffernd_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indices.diminfo[0].shape = __pyx_pybuffernd_indices.rcbuffer->pybuffer.shape[0];
6158 
6159   /* "yt/utilities/lib/geometry_utils.pyx":286
6160  *     cdef np.int64_t p[3]
6161  *     cdef np.ndarray[np.int64_t, ndim=2] positions
6162  *     positions = np.zeros((indices.shape[0], 3), 'int64')             # <<<<<<<<<<<<<<
6163  *     for i in range(indices.shape[0]):
6164  *         hilbert_to_point(order, indices[i], p)
6165  */
6166   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 286, __pyx_L1_error)
6167   __Pyx_GOTREF(__pyx_t_2);
6168   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 286, __pyx_L1_error)
6169   __Pyx_GOTREF(__pyx_t_3);
6170   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6171   __pyx_t_2 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_indices->dimensions[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 286, __pyx_L1_error)
6172   __Pyx_GOTREF(__pyx_t_2);
6173   __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 286, __pyx_L1_error)
6174   __Pyx_GOTREF(__pyx_t_4);
6175   __Pyx_GIVEREF(__pyx_t_2);
6176   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
6177   __Pyx_INCREF(__pyx_int_3);
6178   __Pyx_GIVEREF(__pyx_int_3);
6179   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_3);
6180   __pyx_t_2 = 0;
6181   __pyx_t_2 = NULL;
6182   __pyx_t_5 = 0;
6183   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
6184     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
6185     if (likely(__pyx_t_2)) {
6186       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
6187       __Pyx_INCREF(__pyx_t_2);
6188       __Pyx_INCREF(function);
6189       __Pyx_DECREF_SET(__pyx_t_3, function);
6190       __pyx_t_5 = 1;
6191     }
6192   }
6193   #if CYTHON_FAST_PYCALL
6194   if (PyFunction_Check(__pyx_t_3)) {
6195     PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_4, __pyx_n_s_int64};
6196     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 286, __pyx_L1_error)
6197     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6198     __Pyx_GOTREF(__pyx_t_1);
6199     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6200   } else
6201   #endif
6202   #if CYTHON_FAST_PYCCALL
6203   if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
6204     PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_4, __pyx_n_s_int64};
6205     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 286, __pyx_L1_error)
6206     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6207     __Pyx_GOTREF(__pyx_t_1);
6208     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6209   } else
6210   #endif
6211   {
6212     __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 286, __pyx_L1_error)
6213     __Pyx_GOTREF(__pyx_t_6);
6214     if (__pyx_t_2) {
6215       __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
6216     }
6217     __Pyx_GIVEREF(__pyx_t_4);
6218     PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_4);
6219     __Pyx_INCREF(__pyx_n_s_int64);
6220     __Pyx_GIVEREF(__pyx_n_s_int64);
6221     PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_n_s_int64);
6222     __pyx_t_4 = 0;
6223     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 286, __pyx_L1_error)
6224     __Pyx_GOTREF(__pyx_t_1);
6225     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6226   }
6227   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6228   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 286, __pyx_L1_error)
6229   __pyx_t_7 = ((PyArrayObject *)__pyx_t_1);
6230   {
6231     __Pyx_BufFmt_StackElem __pyx_stack[1];
6232     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_positions.rcbuffer->pybuffer);
6233     __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_positions.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
6234     if (unlikely(__pyx_t_5 < 0)) {
6235       PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
6236       if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_positions.rcbuffer->pybuffer, (PyObject*)__pyx_v_positions, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
6237         Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
6238         __Pyx_RaiseBufferFallbackError();
6239       } else {
6240         PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
6241       }
6242       __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
6243     }
6244     __pyx_pybuffernd_positions.diminfo[0].strides = __pyx_pybuffernd_positions.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_positions.diminfo[0].shape = __pyx_pybuffernd_positions.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_positions.diminfo[1].strides = __pyx_pybuffernd_positions.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_positions.diminfo[1].shape = __pyx_pybuffernd_positions.rcbuffer->pybuffer.shape[1];
6245     if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(1, 286, __pyx_L1_error)
6246   }
6247   __pyx_t_7 = 0;
6248   __pyx_v_positions = ((PyArrayObject *)__pyx_t_1);
6249   __pyx_t_1 = 0;
6250 
6251   /* "yt/utilities/lib/geometry_utils.pyx":287
6252  *     cdef np.ndarray[np.int64_t, ndim=2] positions
6253  *     positions = np.zeros((indices.shape[0], 3), 'int64')
6254  *     for i in range(indices.shape[0]):             # <<<<<<<<<<<<<<
6255  *         hilbert_to_point(order, indices[i], p)
6256  *         for j in range(3):
6257  */
6258   __pyx_t_11 = (__pyx_v_indices->dimensions[0]);
6259   __pyx_t_12 = __pyx_t_11;
6260   for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_12; __pyx_t_5+=1) {
6261     __pyx_v_i = __pyx_t_5;
6262 
6263     /* "yt/utilities/lib/geometry_utils.pyx":288
6264  *     positions = np.zeros((indices.shape[0], 3), 'int64')
6265  *     for i in range(indices.shape[0]):
6266  *         hilbert_to_point(order, indices[i], p)             # <<<<<<<<<<<<<<
6267  *         for j in range(3):
6268  *             positions[i, j] = p[j]
6269  */
6270     __pyx_t_13 = __pyx_v_i;
6271     __pyx_f_2yt_9utilities_3lib_14geometry_utils_hilbert_to_point(__pyx_v_order, (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_indices.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_indices.diminfo[0].strides)), __pyx_v_p);
6272 
6273     /* "yt/utilities/lib/geometry_utils.pyx":289
6274  *     for i in range(indices.shape[0]):
6275  *         hilbert_to_point(order, indices[i], p)
6276  *         for j in range(3):             # <<<<<<<<<<<<<<
6277  *             positions[i, j] = p[j]
6278  *     return positions
6279  */
6280     for (__pyx_t_14 = 0; __pyx_t_14 < 3; __pyx_t_14+=1) {
6281       __pyx_v_j = __pyx_t_14;
6282 
6283       /* "yt/utilities/lib/geometry_utils.pyx":290
6284  *         hilbert_to_point(order, indices[i], p)
6285  *         for j in range(3):
6286  *             positions[i, j] = p[j]             # <<<<<<<<<<<<<<
6287  *     return positions
6288  *
6289  */
6290       __pyx_t_15 = __pyx_v_i;
6291       __pyx_t_16 = __pyx_v_j;
6292       *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_positions.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_positions.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_positions.diminfo[1].strides) = (__pyx_v_p[__pyx_v_j]);
6293     }
6294   }
6295 
6296   /* "yt/utilities/lib/geometry_utils.pyx":291
6297  *         for j in range(3):
6298  *             positions[i, j] = p[j]
6299  *     return positions             # <<<<<<<<<<<<<<
6300  *
6301  * @cython.cdivision(True)
6302  */
6303   __Pyx_XDECREF(__pyx_r);
6304   __Pyx_INCREF(((PyObject *)__pyx_v_positions));
6305   __pyx_r = ((PyObject *)__pyx_v_positions);
6306   goto __pyx_L0;
6307 
6308   /* "yt/utilities/lib/geometry_utils.pyx":281
6309  * @cython.boundscheck(False)
6310  * @cython.wraparound(False)
6311  * def get_hilbert_points(int order, np.ndarray[np.int64_t, ndim=1] indices):             # <<<<<<<<<<<<<<
6312  *     # This is inspired by the scurve package by user cortesi on GH.
6313  *     cdef int i, j
6314  */
6315 
6316   /* function exit code */
6317   __pyx_L1_error:;
6318   __Pyx_XDECREF(__pyx_t_1);
6319   __Pyx_XDECREF(__pyx_t_2);
6320   __Pyx_XDECREF(__pyx_t_3);
6321   __Pyx_XDECREF(__pyx_t_4);
6322   __Pyx_XDECREF(__pyx_t_6);
6323   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
6324     __Pyx_PyThreadState_declare
6325     __Pyx_PyThreadState_assign
6326     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
6327     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indices.rcbuffer->pybuffer);
6328     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_positions.rcbuffer->pybuffer);
6329   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
6330   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.get_hilbert_points", __pyx_clineno, __pyx_lineno, __pyx_filename);
6331   __pyx_r = NULL;
6332   goto __pyx_L2;
6333   __pyx_L0:;
6334   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indices.rcbuffer->pybuffer);
6335   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_positions.rcbuffer->pybuffer);
6336   __pyx_L2:;
6337   __Pyx_XDECREF((PyObject *)__pyx_v_positions);
6338   __Pyx_XGIVEREF(__pyx_r);
6339   __Pyx_RefNannyFinishContext();
6340   return __pyx_r;
6341 }
6342 
6343 /* "yt/utilities/lib/geometry_utils.pyx":296
6344  * @cython.boundscheck(False)
6345  * @cython.wraparound(False)
6346  * cdef np.uint64_t point_to_morton(np.uint64_t p[3]):             # <<<<<<<<<<<<<<
6347  *     # Weird indent thing going on... also, should this reference the pxd func?
6348  *     return encode_morton_64bit(p[0],p[1],p[2])
6349  */
6350 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_point_to_morton(__pyx_t_5numpy_uint64_t * __pyx_v_p)6351 static __pyx_t_5numpy_uint64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_point_to_morton(__pyx_t_5numpy_uint64_t *__pyx_v_p) {
6352   __pyx_t_5numpy_uint64_t __pyx_r;
6353   __Pyx_RefNannyDeclarations
6354   __Pyx_RefNannySetupContext("point_to_morton", 0);
6355 
6356   /* "yt/utilities/lib/geometry_utils.pyx":298
6357  * cdef np.uint64_t point_to_morton(np.uint64_t p[3]):
6358  *     # Weird indent thing going on... also, should this reference the pxd func?
6359  *     return encode_morton_64bit(p[0],p[1],p[2])             # <<<<<<<<<<<<<<
6360  *
6361  * @cython.cdivision(True)
6362  */
6363   __pyx_r = __pyx_f_2yt_9utilities_3lib_14geometry_utils_encode_morton_64bit((__pyx_v_p[0]), (__pyx_v_p[1]), (__pyx_v_p[2]));
6364   goto __pyx_L0;
6365 
6366   /* "yt/utilities/lib/geometry_utils.pyx":296
6367  * @cython.boundscheck(False)
6368  * @cython.wraparound(False)
6369  * cdef np.uint64_t point_to_morton(np.uint64_t p[3]):             # <<<<<<<<<<<<<<
6370  *     # Weird indent thing going on... also, should this reference the pxd func?
6371  *     return encode_morton_64bit(p[0],p[1],p[2])
6372  */
6373 
6374   /* function exit code */
6375   __pyx_L0:;
6376   __Pyx_RefNannyFinishContext();
6377   return __pyx_r;
6378 }
6379 
6380 /* "yt/utilities/lib/geometry_utils.pyx":303
6381  * @cython.boundscheck(False)
6382  * @cython.wraparound(False)
6383  * cdef void morton_to_point(np.uint64_t mi, np.uint64_t *p):             # <<<<<<<<<<<<<<
6384  *     decode_morton_64bit(mi,p)
6385  *
6386  */
6387 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_morton_to_point(__pyx_t_5numpy_uint64_t __pyx_v_mi,__pyx_t_5numpy_uint64_t * __pyx_v_p)6388 static void __pyx_f_2yt_9utilities_3lib_14geometry_utils_morton_to_point(__pyx_t_5numpy_uint64_t __pyx_v_mi, __pyx_t_5numpy_uint64_t *__pyx_v_p) {
6389   __Pyx_RefNannyDeclarations
6390   __Pyx_RefNannySetupContext("morton_to_point", 0);
6391 
6392   /* "yt/utilities/lib/geometry_utils.pyx":304
6393  * @cython.wraparound(False)
6394  * cdef void morton_to_point(np.uint64_t mi, np.uint64_t *p):
6395  *     decode_morton_64bit(mi,p)             # <<<<<<<<<<<<<<
6396  *
6397  * @cython.cdivision(True)
6398  */
6399   __pyx_f_2yt_9utilities_3lib_14geometry_utils_decode_morton_64bit(__pyx_v_mi, __pyx_v_p);
6400 
6401   /* "yt/utilities/lib/geometry_utils.pyx":303
6402  * @cython.boundscheck(False)
6403  * @cython.wraparound(False)
6404  * cdef void morton_to_point(np.uint64_t mi, np.uint64_t *p):             # <<<<<<<<<<<<<<
6405  *     decode_morton_64bit(mi,p)
6406  *
6407  */
6408 
6409   /* function exit code */
6410   __Pyx_RefNannyFinishContext();
6411 }
6412 
6413 /* "yt/utilities/lib/geometry_utils.pyx":309
6414  * @cython.boundscheck(False)
6415  * @cython.wraparound(False)
6416  * def get_morton_index(np.ndarray[np.uint64_t, ndim=1] left_index):             # <<<<<<<<<<<<<<
6417  *     cdef int j
6418  *     cdef np.uint64_t morton_index
6419  */
6420 
6421 /* Python wrapper */
6422 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_15get_morton_index(PyObject *__pyx_self, PyObject *__pyx_v_left_index); /*proto*/
6423 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_15get_morton_index = {"get_morton_index", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_15get_morton_index, METH_O, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_15get_morton_index(PyObject * __pyx_self,PyObject * __pyx_v_left_index)6424 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_15get_morton_index(PyObject *__pyx_self, PyObject *__pyx_v_left_index) {
6425   PyObject *__pyx_r = 0;
6426   __Pyx_RefNannyDeclarations
6427   __Pyx_RefNannySetupContext("get_morton_index (wrapper)", 0);
6428   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_index), __pyx_ptype_5numpy_ndarray, 1, "left_index", 0))) __PYX_ERR(1, 309, __pyx_L1_error)
6429   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_14get_morton_index(__pyx_self, ((PyArrayObject *)__pyx_v_left_index));
6430 
6431   /* function exit code */
6432   goto __pyx_L0;
6433   __pyx_L1_error:;
6434   __pyx_r = NULL;
6435   __pyx_L0:;
6436   __Pyx_RefNannyFinishContext();
6437   return __pyx_r;
6438 }
6439 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_14get_morton_index(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_left_index)6440 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_14get_morton_index(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left_index) {
6441   int __pyx_v_j;
6442   __pyx_t_5numpy_uint64_t __pyx_v_morton_index;
6443   __pyx_t_5numpy_uint64_t __pyx_v_p[3];
6444   __Pyx_LocalBuf_ND __pyx_pybuffernd_left_index;
6445   __Pyx_Buffer __pyx_pybuffer_left_index;
6446   PyObject *__pyx_r = NULL;
6447   __Pyx_RefNannyDeclarations
6448   int __pyx_t_1;
6449   Py_ssize_t __pyx_t_2;
6450   int __pyx_t_3;
6451   PyObject *__pyx_t_4 = NULL;
6452   PyObject *__pyx_t_5 = NULL;
6453   PyObject *__pyx_t_6 = NULL;
6454   Py_ssize_t __pyx_t_7;
6455   __Pyx_RefNannySetupContext("get_morton_index", 0);
6456   __pyx_pybuffer_left_index.pybuffer.buf = NULL;
6457   __pyx_pybuffer_left_index.refcount = 0;
6458   __pyx_pybuffernd_left_index.data = NULL;
6459   __pyx_pybuffernd_left_index.rcbuffer = &__pyx_pybuffer_left_index;
6460   {
6461     __Pyx_BufFmt_StackElem __pyx_stack[1];
6462     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_left_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 309, __pyx_L1_error)
6463   }
6464   __pyx_pybuffernd_left_index.diminfo[0].strides = __pyx_pybuffernd_left_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_index.diminfo[0].shape = __pyx_pybuffernd_left_index.rcbuffer->pybuffer.shape[0];
6465 
6466   /* "yt/utilities/lib/geometry_utils.pyx":313
6467  *     cdef np.uint64_t morton_index
6468  *     cdef np.uint64_t p[3]
6469  *     for j in range(3):             # <<<<<<<<<<<<<<
6470  *         if left_index[j] >= INDEX_MAX_64:
6471  *             raise ValueError("Point exceeds max ({}) ".format(INDEX_MAX_64)+
6472  */
6473   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
6474     __pyx_v_j = __pyx_t_1;
6475 
6476     /* "yt/utilities/lib/geometry_utils.pyx":314
6477  *     cdef np.uint64_t p[3]
6478  *     for j in range(3):
6479  *         if left_index[j] >= INDEX_MAX_64:             # <<<<<<<<<<<<<<
6480  *             raise ValueError("Point exceeds max ({}) ".format(INDEX_MAX_64)+
6481  *                              "for 64bit interleave.")
6482  */
6483     __pyx_t_2 = __pyx_v_j;
6484     __pyx_t_3 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_left_index.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_left_index.diminfo[0].strides)) >= 0x1FFFFF) != 0);
6485     if (unlikely(__pyx_t_3)) {
6486 
6487       /* "yt/utilities/lib/geometry_utils.pyx":315
6488  *     for j in range(3):
6489  *         if left_index[j] >= INDEX_MAX_64:
6490  *             raise ValueError("Point exceeds max ({}) ".format(INDEX_MAX_64)+             # <<<<<<<<<<<<<<
6491  *                              "for 64bit interleave.")
6492  *         p[j] = left_index[j]
6493  */
6494       __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Point_exceeds_max, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 315, __pyx_L1_error)
6495       __Pyx_GOTREF(__pyx_t_5);
6496       __pyx_t_6 = NULL;
6497       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
6498         __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
6499         if (likely(__pyx_t_6)) {
6500           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
6501           __Pyx_INCREF(__pyx_t_6);
6502           __Pyx_INCREF(function);
6503           __Pyx_DECREF_SET(__pyx_t_5, function);
6504         }
6505       }
6506       __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_int_2097151) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_int_2097151);
6507       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
6508       if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 315, __pyx_L1_error)
6509       __Pyx_GOTREF(__pyx_t_4);
6510       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6511       __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_kp_s_for_64bit_interleave); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 315, __pyx_L1_error)
6512       __Pyx_GOTREF(__pyx_t_5);
6513       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6514       __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 315, __pyx_L1_error)
6515       __Pyx_GOTREF(__pyx_t_4);
6516       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6517       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
6518       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6519       __PYX_ERR(1, 315, __pyx_L1_error)
6520 
6521       /* "yt/utilities/lib/geometry_utils.pyx":314
6522  *     cdef np.uint64_t p[3]
6523  *     for j in range(3):
6524  *         if left_index[j] >= INDEX_MAX_64:             # <<<<<<<<<<<<<<
6525  *             raise ValueError("Point exceeds max ({}) ".format(INDEX_MAX_64)+
6526  *                              "for 64bit interleave.")
6527  */
6528     }
6529 
6530     /* "yt/utilities/lib/geometry_utils.pyx":317
6531  *             raise ValueError("Point exceeds max ({}) ".format(INDEX_MAX_64)+
6532  *                              "for 64bit interleave.")
6533  *         p[j] = left_index[j]             # <<<<<<<<<<<<<<
6534  *     morton_index = point_to_morton(p)
6535  *     return morton_index
6536  */
6537     __pyx_t_7 = __pyx_v_j;
6538     (__pyx_v_p[__pyx_v_j]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_left_index.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_left_index.diminfo[0].strides));
6539   }
6540 
6541   /* "yt/utilities/lib/geometry_utils.pyx":318
6542  *                              "for 64bit interleave.")
6543  *         p[j] = left_index[j]
6544  *     morton_index = point_to_morton(p)             # <<<<<<<<<<<<<<
6545  *     return morton_index
6546  *
6547  */
6548   __pyx_v_morton_index = __pyx_f_2yt_9utilities_3lib_14geometry_utils_point_to_morton(__pyx_v_p);
6549 
6550   /* "yt/utilities/lib/geometry_utils.pyx":319
6551  *         p[j] = left_index[j]
6552  *     morton_index = point_to_morton(p)
6553  *     return morton_index             # <<<<<<<<<<<<<<
6554  *
6555  * @cython.cdivision(True)
6556  */
6557   __Pyx_XDECREF(__pyx_r);
6558   __pyx_t_4 = __Pyx_PyInt_From_npy_uint64(__pyx_v_morton_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 319, __pyx_L1_error)
6559   __Pyx_GOTREF(__pyx_t_4);
6560   __pyx_r = __pyx_t_4;
6561   __pyx_t_4 = 0;
6562   goto __pyx_L0;
6563 
6564   /* "yt/utilities/lib/geometry_utils.pyx":309
6565  * @cython.boundscheck(False)
6566  * @cython.wraparound(False)
6567  * def get_morton_index(np.ndarray[np.uint64_t, ndim=1] left_index):             # <<<<<<<<<<<<<<
6568  *     cdef int j
6569  *     cdef np.uint64_t morton_index
6570  */
6571 
6572   /* function exit code */
6573   __pyx_L1_error:;
6574   __Pyx_XDECREF(__pyx_t_4);
6575   __Pyx_XDECREF(__pyx_t_5);
6576   __Pyx_XDECREF(__pyx_t_6);
6577   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
6578     __Pyx_PyThreadState_declare
6579     __Pyx_PyThreadState_assign
6580     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
6581     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_index.rcbuffer->pybuffer);
6582   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
6583   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.get_morton_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
6584   __pyx_r = NULL;
6585   goto __pyx_L2;
6586   __pyx_L0:;
6587   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_index.rcbuffer->pybuffer);
6588   __pyx_L2:;
6589   __Pyx_XGIVEREF(__pyx_r);
6590   __Pyx_RefNannyFinishContext();
6591   return __pyx_r;
6592 }
6593 
6594 /* "yt/utilities/lib/geometry_utils.pyx":324
6595  * @cython.boundscheck(False)
6596  * @cython.wraparound(False)
6597  * def get_morton_indices(np.ndarray[np.uint64_t, ndim=2] left_index):             # <<<<<<<<<<<<<<
6598  *     cdef np.int64_t i
6599  *     cdef int j
6600  */
6601 
6602 /* Python wrapper */
6603 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_17get_morton_indices(PyObject *__pyx_self, PyObject *__pyx_v_left_index); /*proto*/
6604 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_17get_morton_indices = {"get_morton_indices", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_17get_morton_indices, METH_O, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_17get_morton_indices(PyObject * __pyx_self,PyObject * __pyx_v_left_index)6605 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_17get_morton_indices(PyObject *__pyx_self, PyObject *__pyx_v_left_index) {
6606   PyObject *__pyx_r = 0;
6607   __Pyx_RefNannyDeclarations
6608   __Pyx_RefNannySetupContext("get_morton_indices (wrapper)", 0);
6609   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_index), __pyx_ptype_5numpy_ndarray, 1, "left_index", 0))) __PYX_ERR(1, 324, __pyx_L1_error)
6610   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_16get_morton_indices(__pyx_self, ((PyArrayObject *)__pyx_v_left_index));
6611 
6612   /* function exit code */
6613   goto __pyx_L0;
6614   __pyx_L1_error:;
6615   __pyx_r = NULL;
6616   __pyx_L0:;
6617   __Pyx_RefNannyFinishContext();
6618   return __pyx_r;
6619 }
6620 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_16get_morton_indices(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_left_index)6621 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_16get_morton_indices(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left_index) {
6622   __pyx_t_5numpy_int64_t __pyx_v_i;
6623   int __pyx_v_j;
6624   PyArrayObject *__pyx_v_morton_indices = 0;
6625   __pyx_t_5numpy_uint64_t __pyx_v_p[3];
6626   __Pyx_LocalBuf_ND __pyx_pybuffernd_left_index;
6627   __Pyx_Buffer __pyx_pybuffer_left_index;
6628   __Pyx_LocalBuf_ND __pyx_pybuffernd_morton_indices;
6629   __Pyx_Buffer __pyx_pybuffer_morton_indices;
6630   PyObject *__pyx_r = NULL;
6631   __Pyx_RefNannyDeclarations
6632   PyObject *__pyx_t_1 = NULL;
6633   PyObject *__pyx_t_2 = NULL;
6634   PyObject *__pyx_t_3 = NULL;
6635   PyObject *__pyx_t_4 = NULL;
6636   int __pyx_t_5;
6637   PyObject *__pyx_t_6 = NULL;
6638   PyArrayObject *__pyx_t_7 = NULL;
6639   PyObject *__pyx_t_8 = NULL;
6640   PyObject *__pyx_t_9 = NULL;
6641   PyObject *__pyx_t_10 = NULL;
6642   npy_intp __pyx_t_11;
6643   npy_intp __pyx_t_12;
6644   __pyx_t_5numpy_int64_t __pyx_t_13;
6645   __pyx_t_5numpy_int64_t __pyx_t_14;
6646   Py_ssize_t __pyx_t_15;
6647   int __pyx_t_16;
6648   __pyx_t_5numpy_int64_t __pyx_t_17;
6649   Py_ssize_t __pyx_t_18;
6650   __pyx_t_5numpy_int64_t __pyx_t_19;
6651   __Pyx_RefNannySetupContext("get_morton_indices", 0);
6652   __pyx_pybuffer_morton_indices.pybuffer.buf = NULL;
6653   __pyx_pybuffer_morton_indices.refcount = 0;
6654   __pyx_pybuffernd_morton_indices.data = NULL;
6655   __pyx_pybuffernd_morton_indices.rcbuffer = &__pyx_pybuffer_morton_indices;
6656   __pyx_pybuffer_left_index.pybuffer.buf = NULL;
6657   __pyx_pybuffer_left_index.refcount = 0;
6658   __pyx_pybuffernd_left_index.data = NULL;
6659   __pyx_pybuffernd_left_index.rcbuffer = &__pyx_pybuffer_left_index;
6660   {
6661     __Pyx_BufFmt_StackElem __pyx_stack[1];
6662     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_index.rcbuffer->pybuffer, (PyObject*)__pyx_v_left_index, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(1, 324, __pyx_L1_error)
6663   }
6664   __pyx_pybuffernd_left_index.diminfo[0].strides = __pyx_pybuffernd_left_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_index.diminfo[0].shape = __pyx_pybuffernd_left_index.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_left_index.diminfo[1].strides = __pyx_pybuffernd_left_index.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_left_index.diminfo[1].shape = __pyx_pybuffernd_left_index.rcbuffer->pybuffer.shape[1];
6665 
6666   /* "yt/utilities/lib/geometry_utils.pyx":329
6667  *     cdef np.ndarray[np.uint64_t, ndim=1] morton_indices
6668  *     cdef np.uint64_t p[3]
6669  *     morton_indices = np.zeros(left_index.shape[0], 'uint64')             # <<<<<<<<<<<<<<
6670  *     for i in range(left_index.shape[0]):
6671  *         for j in range(3):
6672  */
6673   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 329, __pyx_L1_error)
6674   __Pyx_GOTREF(__pyx_t_2);
6675   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 329, __pyx_L1_error)
6676   __Pyx_GOTREF(__pyx_t_3);
6677   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6678   __pyx_t_2 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_left_index->dimensions[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 329, __pyx_L1_error)
6679   __Pyx_GOTREF(__pyx_t_2);
6680   __pyx_t_4 = NULL;
6681   __pyx_t_5 = 0;
6682   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
6683     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
6684     if (likely(__pyx_t_4)) {
6685       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
6686       __Pyx_INCREF(__pyx_t_4);
6687       __Pyx_INCREF(function);
6688       __Pyx_DECREF_SET(__pyx_t_3, function);
6689       __pyx_t_5 = 1;
6690     }
6691   }
6692   #if CYTHON_FAST_PYCALL
6693   if (PyFunction_Check(__pyx_t_3)) {
6694     PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, __pyx_n_s_uint64};
6695     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 329, __pyx_L1_error)
6696     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
6697     __Pyx_GOTREF(__pyx_t_1);
6698     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6699   } else
6700   #endif
6701   #if CYTHON_FAST_PYCCALL
6702   if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
6703     PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, __pyx_n_s_uint64};
6704     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 329, __pyx_L1_error)
6705     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
6706     __Pyx_GOTREF(__pyx_t_1);
6707     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6708   } else
6709   #endif
6710   {
6711     __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 329, __pyx_L1_error)
6712     __Pyx_GOTREF(__pyx_t_6);
6713     if (__pyx_t_4) {
6714       __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
6715     }
6716     __Pyx_GIVEREF(__pyx_t_2);
6717     PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_2);
6718     __Pyx_INCREF(__pyx_n_s_uint64);
6719     __Pyx_GIVEREF(__pyx_n_s_uint64);
6720     PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_n_s_uint64);
6721     __pyx_t_2 = 0;
6722     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 329, __pyx_L1_error)
6723     __Pyx_GOTREF(__pyx_t_1);
6724     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6725   }
6726   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6727   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 329, __pyx_L1_error)
6728   __pyx_t_7 = ((PyArrayObject *)__pyx_t_1);
6729   {
6730     __Pyx_BufFmt_StackElem __pyx_stack[1];
6731     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_morton_indices.rcbuffer->pybuffer);
6732     __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_morton_indices.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
6733     if (unlikely(__pyx_t_5 < 0)) {
6734       PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
6735       if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_morton_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_morton_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
6736         Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
6737         __Pyx_RaiseBufferFallbackError();
6738       } else {
6739         PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
6740       }
6741       __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
6742     }
6743     __pyx_pybuffernd_morton_indices.diminfo[0].strides = __pyx_pybuffernd_morton_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_morton_indices.diminfo[0].shape = __pyx_pybuffernd_morton_indices.rcbuffer->pybuffer.shape[0];
6744     if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(1, 329, __pyx_L1_error)
6745   }
6746   __pyx_t_7 = 0;
6747   __pyx_v_morton_indices = ((PyArrayObject *)__pyx_t_1);
6748   __pyx_t_1 = 0;
6749 
6750   /* "yt/utilities/lib/geometry_utils.pyx":330
6751  *     cdef np.uint64_t p[3]
6752  *     morton_indices = np.zeros(left_index.shape[0], 'uint64')
6753  *     for i in range(left_index.shape[0]):             # <<<<<<<<<<<<<<
6754  *         for j in range(3):
6755  *             if left_index[i, j] >= INDEX_MAX_64:
6756  */
6757   __pyx_t_11 = (__pyx_v_left_index->dimensions[0]);
6758   __pyx_t_12 = __pyx_t_11;
6759   for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
6760     __pyx_v_i = __pyx_t_13;
6761 
6762     /* "yt/utilities/lib/geometry_utils.pyx":331
6763  *     morton_indices = np.zeros(left_index.shape[0], 'uint64')
6764  *     for i in range(left_index.shape[0]):
6765  *         for j in range(3):             # <<<<<<<<<<<<<<
6766  *             if left_index[i, j] >= INDEX_MAX_64:
6767  *                 raise ValueError("Point exceeds max ({}) ".format(INDEX_MAX_64)+
6768  */
6769     for (__pyx_t_5 = 0; __pyx_t_5 < 3; __pyx_t_5+=1) {
6770       __pyx_v_j = __pyx_t_5;
6771 
6772       /* "yt/utilities/lib/geometry_utils.pyx":332
6773  *     for i in range(left_index.shape[0]):
6774  *         for j in range(3):
6775  *             if left_index[i, j] >= INDEX_MAX_64:             # <<<<<<<<<<<<<<
6776  *                 raise ValueError("Point exceeds max ({}) ".format(INDEX_MAX_64)+
6777  *                                  "for 64bit interleave.")
6778  */
6779       __pyx_t_14 = __pyx_v_i;
6780       __pyx_t_15 = __pyx_v_j;
6781       __pyx_t_16 = (((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_left_index.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_left_index.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_left_index.diminfo[1].strides)) >= 0x1FFFFF) != 0);
6782       if (unlikely(__pyx_t_16)) {
6783 
6784         /* "yt/utilities/lib/geometry_utils.pyx":333
6785  *         for j in range(3):
6786  *             if left_index[i, j] >= INDEX_MAX_64:
6787  *                 raise ValueError("Point exceeds max ({}) ".format(INDEX_MAX_64)+             # <<<<<<<<<<<<<<
6788  *                                  "for 64bit interleave.")
6789  *             p[j] = left_index[i, j]
6790  */
6791         __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Point_exceeds_max, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 333, __pyx_L1_error)
6792         __Pyx_GOTREF(__pyx_t_3);
6793         __pyx_t_6 = NULL;
6794         if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
6795           __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
6796           if (likely(__pyx_t_6)) {
6797             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
6798             __Pyx_INCREF(__pyx_t_6);
6799             __Pyx_INCREF(function);
6800             __Pyx_DECREF_SET(__pyx_t_3, function);
6801           }
6802         }
6803         __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_int_2097151) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_2097151);
6804         __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
6805         if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 333, __pyx_L1_error)
6806         __Pyx_GOTREF(__pyx_t_1);
6807         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6808         __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_kp_s_for_64bit_interleave); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 333, __pyx_L1_error)
6809         __Pyx_GOTREF(__pyx_t_3);
6810         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6811         __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 333, __pyx_L1_error)
6812         __Pyx_GOTREF(__pyx_t_1);
6813         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6814         __Pyx_Raise(__pyx_t_1, 0, 0, 0);
6815         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6816         __PYX_ERR(1, 333, __pyx_L1_error)
6817 
6818         /* "yt/utilities/lib/geometry_utils.pyx":332
6819  *     for i in range(left_index.shape[0]):
6820  *         for j in range(3):
6821  *             if left_index[i, j] >= INDEX_MAX_64:             # <<<<<<<<<<<<<<
6822  *                 raise ValueError("Point exceeds max ({}) ".format(INDEX_MAX_64)+
6823  *                                  "for 64bit interleave.")
6824  */
6825       }
6826 
6827       /* "yt/utilities/lib/geometry_utils.pyx":335
6828  *                 raise ValueError("Point exceeds max ({}) ".format(INDEX_MAX_64)+
6829  *                                  "for 64bit interleave.")
6830  *             p[j] = left_index[i, j]             # <<<<<<<<<<<<<<
6831  *         morton_indices[i] = point_to_morton(p)
6832  *     return morton_indices
6833  */
6834       __pyx_t_17 = __pyx_v_i;
6835       __pyx_t_18 = __pyx_v_j;
6836       (__pyx_v_p[__pyx_v_j]) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_left_index.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_left_index.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_left_index.diminfo[1].strides));
6837     }
6838 
6839     /* "yt/utilities/lib/geometry_utils.pyx":336
6840  *                                  "for 64bit interleave.")
6841  *             p[j] = left_index[i, j]
6842  *         morton_indices[i] = point_to_morton(p)             # <<<<<<<<<<<<<<
6843  *     return morton_indices
6844  *
6845  */
6846     __pyx_t_19 = __pyx_v_i;
6847     *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_morton_indices.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_morton_indices.diminfo[0].strides) = __pyx_f_2yt_9utilities_3lib_14geometry_utils_point_to_morton(__pyx_v_p);
6848   }
6849 
6850   /* "yt/utilities/lib/geometry_utils.pyx":337
6851  *             p[j] = left_index[i, j]
6852  *         morton_indices[i] = point_to_morton(p)
6853  *     return morton_indices             # <<<<<<<<<<<<<<
6854  *
6855  * @cython.cdivision(True)
6856  */
6857   __Pyx_XDECREF(__pyx_r);
6858   __Pyx_INCREF(((PyObject *)__pyx_v_morton_indices));
6859   __pyx_r = ((PyObject *)__pyx_v_morton_indices);
6860   goto __pyx_L0;
6861 
6862   /* "yt/utilities/lib/geometry_utils.pyx":324
6863  * @cython.boundscheck(False)
6864  * @cython.wraparound(False)
6865  * def get_morton_indices(np.ndarray[np.uint64_t, ndim=2] left_index):             # <<<<<<<<<<<<<<
6866  *     cdef np.int64_t i
6867  *     cdef int j
6868  */
6869 
6870   /* function exit code */
6871   __pyx_L1_error:;
6872   __Pyx_XDECREF(__pyx_t_1);
6873   __Pyx_XDECREF(__pyx_t_2);
6874   __Pyx_XDECREF(__pyx_t_3);
6875   __Pyx_XDECREF(__pyx_t_4);
6876   __Pyx_XDECREF(__pyx_t_6);
6877   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
6878     __Pyx_PyThreadState_declare
6879     __Pyx_PyThreadState_assign
6880     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
6881     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_index.rcbuffer->pybuffer);
6882     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_morton_indices.rcbuffer->pybuffer);
6883   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
6884   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.get_morton_indices", __pyx_clineno, __pyx_lineno, __pyx_filename);
6885   __pyx_r = NULL;
6886   goto __pyx_L2;
6887   __pyx_L0:;
6888   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_index.rcbuffer->pybuffer);
6889   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_morton_indices.rcbuffer->pybuffer);
6890   __pyx_L2:;
6891   __Pyx_XDECREF((PyObject *)__pyx_v_morton_indices);
6892   __Pyx_XGIVEREF(__pyx_r);
6893   __Pyx_RefNannyFinishContext();
6894   return __pyx_r;
6895 }
6896 
6897 /* "yt/utilities/lib/geometry_utils.pyx":342
6898  * @cython.boundscheck(False)
6899  * @cython.wraparound(False)
6900  * def get_morton_indices_unravel(np.ndarray[np.uint64_t, ndim=1] left_x,             # <<<<<<<<<<<<<<
6901  *                                np.ndarray[np.uint64_t, ndim=1] left_y,
6902  *                                np.ndarray[np.uint64_t, ndim=1] left_z):
6903  */
6904 
6905 /* Python wrapper */
6906 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_19get_morton_indices_unravel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6907 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_19get_morton_indices_unravel = {"get_morton_indices_unravel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_19get_morton_indices_unravel, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_19get_morton_indices_unravel(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)6908 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_19get_morton_indices_unravel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6909   PyArrayObject *__pyx_v_left_x = 0;
6910   PyArrayObject *__pyx_v_left_y = 0;
6911   PyArrayObject *__pyx_v_left_z = 0;
6912   PyObject *__pyx_r = 0;
6913   __Pyx_RefNannyDeclarations
6914   __Pyx_RefNannySetupContext("get_morton_indices_unravel (wrapper)", 0);
6915   {
6916     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_left_x,&__pyx_n_s_left_y,&__pyx_n_s_left_z,0};
6917     PyObject* values[3] = {0,0,0};
6918     if (unlikely(__pyx_kwds)) {
6919       Py_ssize_t kw_args;
6920       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6921       switch (pos_args) {
6922         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6923         CYTHON_FALLTHROUGH;
6924         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6925         CYTHON_FALLTHROUGH;
6926         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6927         CYTHON_FALLTHROUGH;
6928         case  0: break;
6929         default: goto __pyx_L5_argtuple_error;
6930       }
6931       kw_args = PyDict_Size(__pyx_kwds);
6932       switch (pos_args) {
6933         case  0:
6934         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_left_x)) != 0)) kw_args--;
6935         else goto __pyx_L5_argtuple_error;
6936         CYTHON_FALLTHROUGH;
6937         case  1:
6938         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_left_y)) != 0)) kw_args--;
6939         else {
6940           __Pyx_RaiseArgtupleInvalid("get_morton_indices_unravel", 1, 3, 3, 1); __PYX_ERR(1, 342, __pyx_L3_error)
6941         }
6942         CYTHON_FALLTHROUGH;
6943         case  2:
6944         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_left_z)) != 0)) kw_args--;
6945         else {
6946           __Pyx_RaiseArgtupleInvalid("get_morton_indices_unravel", 1, 3, 3, 2); __PYX_ERR(1, 342, __pyx_L3_error)
6947         }
6948       }
6949       if (unlikely(kw_args > 0)) {
6950         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_morton_indices_unravel") < 0)) __PYX_ERR(1, 342, __pyx_L3_error)
6951       }
6952     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
6953       goto __pyx_L5_argtuple_error;
6954     } else {
6955       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6956       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6957       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6958     }
6959     __pyx_v_left_x = ((PyArrayObject *)values[0]);
6960     __pyx_v_left_y = ((PyArrayObject *)values[1]);
6961     __pyx_v_left_z = ((PyArrayObject *)values[2]);
6962   }
6963   goto __pyx_L4_argument_unpacking_done;
6964   __pyx_L5_argtuple_error:;
6965   __Pyx_RaiseArgtupleInvalid("get_morton_indices_unravel", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 342, __pyx_L3_error)
6966   __pyx_L3_error:;
6967   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.get_morton_indices_unravel", __pyx_clineno, __pyx_lineno, __pyx_filename);
6968   __Pyx_RefNannyFinishContext();
6969   return NULL;
6970   __pyx_L4_argument_unpacking_done:;
6971   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_x), __pyx_ptype_5numpy_ndarray, 1, "left_x", 0))) __PYX_ERR(1, 342, __pyx_L1_error)
6972   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_y), __pyx_ptype_5numpy_ndarray, 1, "left_y", 0))) __PYX_ERR(1, 343, __pyx_L1_error)
6973   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_left_z), __pyx_ptype_5numpy_ndarray, 1, "left_z", 0))) __PYX_ERR(1, 344, __pyx_L1_error)
6974   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_18get_morton_indices_unravel(__pyx_self, __pyx_v_left_x, __pyx_v_left_y, __pyx_v_left_z);
6975 
6976   /* function exit code */
6977   goto __pyx_L0;
6978   __pyx_L1_error:;
6979   __pyx_r = NULL;
6980   __pyx_L0:;
6981   __Pyx_RefNannyFinishContext();
6982   return __pyx_r;
6983 }
6984 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_18get_morton_indices_unravel(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_left_x,PyArrayObject * __pyx_v_left_y,PyArrayObject * __pyx_v_left_z)6985 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_18get_morton_indices_unravel(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_left_x, PyArrayObject *__pyx_v_left_y, PyArrayObject *__pyx_v_left_z) {
6986   __pyx_t_5numpy_int64_t __pyx_v_i;
6987   PyArrayObject *__pyx_v_morton_indices = 0;
6988   __pyx_t_5numpy_uint64_t __pyx_v_p[3];
6989   long __pyx_v_j;
6990   __Pyx_LocalBuf_ND __pyx_pybuffernd_left_x;
6991   __Pyx_Buffer __pyx_pybuffer_left_x;
6992   __Pyx_LocalBuf_ND __pyx_pybuffernd_left_y;
6993   __Pyx_Buffer __pyx_pybuffer_left_y;
6994   __Pyx_LocalBuf_ND __pyx_pybuffernd_left_z;
6995   __Pyx_Buffer __pyx_pybuffer_left_z;
6996   __Pyx_LocalBuf_ND __pyx_pybuffernd_morton_indices;
6997   __Pyx_Buffer __pyx_pybuffer_morton_indices;
6998   PyObject *__pyx_r = NULL;
6999   __Pyx_RefNannyDeclarations
7000   PyObject *__pyx_t_1 = NULL;
7001   PyObject *__pyx_t_2 = NULL;
7002   PyObject *__pyx_t_3 = NULL;
7003   PyObject *__pyx_t_4 = NULL;
7004   int __pyx_t_5;
7005   PyObject *__pyx_t_6 = NULL;
7006   PyArrayObject *__pyx_t_7 = NULL;
7007   PyObject *__pyx_t_8 = NULL;
7008   PyObject *__pyx_t_9 = NULL;
7009   PyObject *__pyx_t_10 = NULL;
7010   npy_intp __pyx_t_11;
7011   npy_intp __pyx_t_12;
7012   __pyx_t_5numpy_int64_t __pyx_t_13;
7013   __pyx_t_5numpy_int64_t __pyx_t_14;
7014   __pyx_t_5numpy_int64_t __pyx_t_15;
7015   __pyx_t_5numpy_int64_t __pyx_t_16;
7016   long __pyx_t_17;
7017   int __pyx_t_18;
7018   __pyx_t_5numpy_int64_t __pyx_t_19;
7019   __Pyx_RefNannySetupContext("get_morton_indices_unravel", 0);
7020   __pyx_pybuffer_morton_indices.pybuffer.buf = NULL;
7021   __pyx_pybuffer_morton_indices.refcount = 0;
7022   __pyx_pybuffernd_morton_indices.data = NULL;
7023   __pyx_pybuffernd_morton_indices.rcbuffer = &__pyx_pybuffer_morton_indices;
7024   __pyx_pybuffer_left_x.pybuffer.buf = NULL;
7025   __pyx_pybuffer_left_x.refcount = 0;
7026   __pyx_pybuffernd_left_x.data = NULL;
7027   __pyx_pybuffernd_left_x.rcbuffer = &__pyx_pybuffer_left_x;
7028   __pyx_pybuffer_left_y.pybuffer.buf = NULL;
7029   __pyx_pybuffer_left_y.refcount = 0;
7030   __pyx_pybuffernd_left_y.data = NULL;
7031   __pyx_pybuffernd_left_y.rcbuffer = &__pyx_pybuffer_left_y;
7032   __pyx_pybuffer_left_z.pybuffer.buf = NULL;
7033   __pyx_pybuffer_left_z.refcount = 0;
7034   __pyx_pybuffernd_left_z.data = NULL;
7035   __pyx_pybuffernd_left_z.rcbuffer = &__pyx_pybuffer_left_z;
7036   {
7037     __Pyx_BufFmt_StackElem __pyx_stack[1];
7038     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_left_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 342, __pyx_L1_error)
7039   }
7040   __pyx_pybuffernd_left_x.diminfo[0].strides = __pyx_pybuffernd_left_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_x.diminfo[0].shape = __pyx_pybuffernd_left_x.rcbuffer->pybuffer.shape[0];
7041   {
7042     __Pyx_BufFmt_StackElem __pyx_stack[1];
7043     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_left_y, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 342, __pyx_L1_error)
7044   }
7045   __pyx_pybuffernd_left_y.diminfo[0].strides = __pyx_pybuffernd_left_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_y.diminfo[0].shape = __pyx_pybuffernd_left_y.rcbuffer->pybuffer.shape[0];
7046   {
7047     __Pyx_BufFmt_StackElem __pyx_stack[1];
7048     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_left_z.rcbuffer->pybuffer, (PyObject*)__pyx_v_left_z, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 342, __pyx_L1_error)
7049   }
7050   __pyx_pybuffernd_left_z.diminfo[0].strides = __pyx_pybuffernd_left_z.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_left_z.diminfo[0].shape = __pyx_pybuffernd_left_z.rcbuffer->pybuffer.shape[0];
7051 
7052   /* "yt/utilities/lib/geometry_utils.pyx":348
7053  *     cdef np.ndarray[np.uint64_t, ndim=1] morton_indices
7054  *     cdef np.uint64_t p[3]
7055  *     morton_indices = np.zeros(left_x.shape[0], 'uint64')             # <<<<<<<<<<<<<<
7056  *     for i in range(left_x.shape[0]):
7057  *         p[0] = left_x[i]
7058  */
7059   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 348, __pyx_L1_error)
7060   __Pyx_GOTREF(__pyx_t_2);
7061   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 348, __pyx_L1_error)
7062   __Pyx_GOTREF(__pyx_t_3);
7063   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7064   __pyx_t_2 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_left_x->dimensions[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 348, __pyx_L1_error)
7065   __Pyx_GOTREF(__pyx_t_2);
7066   __pyx_t_4 = NULL;
7067   __pyx_t_5 = 0;
7068   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
7069     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
7070     if (likely(__pyx_t_4)) {
7071       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7072       __Pyx_INCREF(__pyx_t_4);
7073       __Pyx_INCREF(function);
7074       __Pyx_DECREF_SET(__pyx_t_3, function);
7075       __pyx_t_5 = 1;
7076     }
7077   }
7078   #if CYTHON_FAST_PYCALL
7079   if (PyFunction_Check(__pyx_t_3)) {
7080     PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, __pyx_n_s_uint64};
7081     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 348, __pyx_L1_error)
7082     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7083     __Pyx_GOTREF(__pyx_t_1);
7084     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7085   } else
7086   #endif
7087   #if CYTHON_FAST_PYCCALL
7088   if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
7089     PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, __pyx_n_s_uint64};
7090     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 348, __pyx_L1_error)
7091     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7092     __Pyx_GOTREF(__pyx_t_1);
7093     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7094   } else
7095   #endif
7096   {
7097     __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 348, __pyx_L1_error)
7098     __Pyx_GOTREF(__pyx_t_6);
7099     if (__pyx_t_4) {
7100       __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
7101     }
7102     __Pyx_GIVEREF(__pyx_t_2);
7103     PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_2);
7104     __Pyx_INCREF(__pyx_n_s_uint64);
7105     __Pyx_GIVEREF(__pyx_n_s_uint64);
7106     PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_n_s_uint64);
7107     __pyx_t_2 = 0;
7108     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 348, __pyx_L1_error)
7109     __Pyx_GOTREF(__pyx_t_1);
7110     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7111   }
7112   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7113   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 348, __pyx_L1_error)
7114   __pyx_t_7 = ((PyArrayObject *)__pyx_t_1);
7115   {
7116     __Pyx_BufFmt_StackElem __pyx_stack[1];
7117     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_morton_indices.rcbuffer->pybuffer);
7118     __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_morton_indices.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
7119     if (unlikely(__pyx_t_5 < 0)) {
7120       PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
7121       if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_morton_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_morton_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
7122         Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
7123         __Pyx_RaiseBufferFallbackError();
7124       } else {
7125         PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
7126       }
7127       __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
7128     }
7129     __pyx_pybuffernd_morton_indices.diminfo[0].strides = __pyx_pybuffernd_morton_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_morton_indices.diminfo[0].shape = __pyx_pybuffernd_morton_indices.rcbuffer->pybuffer.shape[0];
7130     if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(1, 348, __pyx_L1_error)
7131   }
7132   __pyx_t_7 = 0;
7133   __pyx_v_morton_indices = ((PyArrayObject *)__pyx_t_1);
7134   __pyx_t_1 = 0;
7135 
7136   /* "yt/utilities/lib/geometry_utils.pyx":349
7137  *     cdef np.uint64_t p[3]
7138  *     morton_indices = np.zeros(left_x.shape[0], 'uint64')
7139  *     for i in range(left_x.shape[0]):             # <<<<<<<<<<<<<<
7140  *         p[0] = left_x[i]
7141  *         p[1] = left_y[i]
7142  */
7143   __pyx_t_11 = (__pyx_v_left_x->dimensions[0]);
7144   __pyx_t_12 = __pyx_t_11;
7145   for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
7146     __pyx_v_i = __pyx_t_13;
7147 
7148     /* "yt/utilities/lib/geometry_utils.pyx":350
7149  *     morton_indices = np.zeros(left_x.shape[0], 'uint64')
7150  *     for i in range(left_x.shape[0]):
7151  *         p[0] = left_x[i]             # <<<<<<<<<<<<<<
7152  *         p[1] = left_y[i]
7153  *         p[2] = left_z[i]
7154  */
7155     __pyx_t_14 = __pyx_v_i;
7156     (__pyx_v_p[0]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_left_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_left_x.diminfo[0].strides));
7157 
7158     /* "yt/utilities/lib/geometry_utils.pyx":351
7159  *     for i in range(left_x.shape[0]):
7160  *         p[0] = left_x[i]
7161  *         p[1] = left_y[i]             # <<<<<<<<<<<<<<
7162  *         p[2] = left_z[i]
7163  *         for j in range(3):
7164  */
7165     __pyx_t_15 = __pyx_v_i;
7166     (__pyx_v_p[1]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_left_y.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_left_y.diminfo[0].strides));
7167 
7168     /* "yt/utilities/lib/geometry_utils.pyx":352
7169  *         p[0] = left_x[i]
7170  *         p[1] = left_y[i]
7171  *         p[2] = left_z[i]             # <<<<<<<<<<<<<<
7172  *         for j in range(3):
7173  *             if p[j] >= INDEX_MAX_64:
7174  */
7175     __pyx_t_16 = __pyx_v_i;
7176     (__pyx_v_p[2]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_left_z.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_left_z.diminfo[0].strides));
7177 
7178     /* "yt/utilities/lib/geometry_utils.pyx":353
7179  *         p[1] = left_y[i]
7180  *         p[2] = left_z[i]
7181  *         for j in range(3):             # <<<<<<<<<<<<<<
7182  *             if p[j] >= INDEX_MAX_64:
7183  *                 raise ValueError("Point exceeds max ({}) ".format(INDEX_MAX_64)+
7184  */
7185     for (__pyx_t_17 = 0; __pyx_t_17 < 3; __pyx_t_17+=1) {
7186       __pyx_v_j = __pyx_t_17;
7187 
7188       /* "yt/utilities/lib/geometry_utils.pyx":354
7189  *         p[2] = left_z[i]
7190  *         for j in range(3):
7191  *             if p[j] >= INDEX_MAX_64:             # <<<<<<<<<<<<<<
7192  *                 raise ValueError("Point exceeds max ({}) ".format(INDEX_MAX_64)+
7193  *                                  "for 64 bit interleave.")
7194  */
7195       __pyx_t_18 = (((__pyx_v_p[__pyx_v_j]) >= 0x1FFFFF) != 0);
7196       if (unlikely(__pyx_t_18)) {
7197 
7198         /* "yt/utilities/lib/geometry_utils.pyx":355
7199  *         for j in range(3):
7200  *             if p[j] >= INDEX_MAX_64:
7201  *                 raise ValueError("Point exceeds max ({}) ".format(INDEX_MAX_64)+             # <<<<<<<<<<<<<<
7202  *                                  "for 64 bit interleave.")
7203  *         morton_indices[i] = point_to_morton(p)
7204  */
7205         __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Point_exceeds_max, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 355, __pyx_L1_error)
7206         __Pyx_GOTREF(__pyx_t_3);
7207         __pyx_t_6 = NULL;
7208         if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
7209           __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
7210           if (likely(__pyx_t_6)) {
7211             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7212             __Pyx_INCREF(__pyx_t_6);
7213             __Pyx_INCREF(function);
7214             __Pyx_DECREF_SET(__pyx_t_3, function);
7215           }
7216         }
7217         __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_int_2097151) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_2097151);
7218         __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7219         if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 355, __pyx_L1_error)
7220         __Pyx_GOTREF(__pyx_t_1);
7221         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7222         __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_kp_s_for_64_bit_interleave); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 355, __pyx_L1_error)
7223         __Pyx_GOTREF(__pyx_t_3);
7224         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7225         __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 355, __pyx_L1_error)
7226         __Pyx_GOTREF(__pyx_t_1);
7227         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7228         __Pyx_Raise(__pyx_t_1, 0, 0, 0);
7229         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7230         __PYX_ERR(1, 355, __pyx_L1_error)
7231 
7232         /* "yt/utilities/lib/geometry_utils.pyx":354
7233  *         p[2] = left_z[i]
7234  *         for j in range(3):
7235  *             if p[j] >= INDEX_MAX_64:             # <<<<<<<<<<<<<<
7236  *                 raise ValueError("Point exceeds max ({}) ".format(INDEX_MAX_64)+
7237  *                                  "for 64 bit interleave.")
7238  */
7239       }
7240     }
7241 
7242     /* "yt/utilities/lib/geometry_utils.pyx":357
7243  *                 raise ValueError("Point exceeds max ({}) ".format(INDEX_MAX_64)+
7244  *                                  "for 64 bit interleave.")
7245  *         morton_indices[i] = point_to_morton(p)             # <<<<<<<<<<<<<<
7246  *     return morton_indices
7247  *
7248  */
7249     __pyx_t_19 = __pyx_v_i;
7250     *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_morton_indices.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_morton_indices.diminfo[0].strides) = __pyx_f_2yt_9utilities_3lib_14geometry_utils_point_to_morton(__pyx_v_p);
7251   }
7252 
7253   /* "yt/utilities/lib/geometry_utils.pyx":358
7254  *                                  "for 64 bit interleave.")
7255  *         morton_indices[i] = point_to_morton(p)
7256  *     return morton_indices             # <<<<<<<<<<<<<<
7257  *
7258  * @cython.cdivision(True)
7259  */
7260   __Pyx_XDECREF(__pyx_r);
7261   __Pyx_INCREF(((PyObject *)__pyx_v_morton_indices));
7262   __pyx_r = ((PyObject *)__pyx_v_morton_indices);
7263   goto __pyx_L0;
7264 
7265   /* "yt/utilities/lib/geometry_utils.pyx":342
7266  * @cython.boundscheck(False)
7267  * @cython.wraparound(False)
7268  * def get_morton_indices_unravel(np.ndarray[np.uint64_t, ndim=1] left_x,             # <<<<<<<<<<<<<<
7269  *                                np.ndarray[np.uint64_t, ndim=1] left_y,
7270  *                                np.ndarray[np.uint64_t, ndim=1] left_z):
7271  */
7272 
7273   /* function exit code */
7274   __pyx_L1_error:;
7275   __Pyx_XDECREF(__pyx_t_1);
7276   __Pyx_XDECREF(__pyx_t_2);
7277   __Pyx_XDECREF(__pyx_t_3);
7278   __Pyx_XDECREF(__pyx_t_4);
7279   __Pyx_XDECREF(__pyx_t_6);
7280   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
7281     __Pyx_PyThreadState_declare
7282     __Pyx_PyThreadState_assign
7283     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
7284     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_x.rcbuffer->pybuffer);
7285     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_y.rcbuffer->pybuffer);
7286     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_z.rcbuffer->pybuffer);
7287     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_morton_indices.rcbuffer->pybuffer);
7288   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
7289   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.get_morton_indices_unravel", __pyx_clineno, __pyx_lineno, __pyx_filename);
7290   __pyx_r = NULL;
7291   goto __pyx_L2;
7292   __pyx_L0:;
7293   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_x.rcbuffer->pybuffer);
7294   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_y.rcbuffer->pybuffer);
7295   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_left_z.rcbuffer->pybuffer);
7296   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_morton_indices.rcbuffer->pybuffer);
7297   __pyx_L2:;
7298   __Pyx_XDECREF((PyObject *)__pyx_v_morton_indices);
7299   __Pyx_XGIVEREF(__pyx_r);
7300   __Pyx_RefNannyFinishContext();
7301   return __pyx_r;
7302 }
7303 
7304 /* "yt/utilities/lib/geometry_utils.pyx":363
7305  * @cython.boundscheck(False)
7306  * @cython.wraparound(False)
7307  * def get_morton_point(np.uint64_t index):             # <<<<<<<<<<<<<<
7308  *     cdef int j
7309  *     cdef np.uint64_t p[3]
7310  */
7311 
7312 /* Python wrapper */
7313 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_21get_morton_point(PyObject *__pyx_self, PyObject *__pyx_arg_index); /*proto*/
7314 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_21get_morton_point = {"get_morton_point", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_21get_morton_point, METH_O, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_21get_morton_point(PyObject * __pyx_self,PyObject * __pyx_arg_index)7315 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_21get_morton_point(PyObject *__pyx_self, PyObject *__pyx_arg_index) {
7316   __pyx_t_5numpy_uint64_t __pyx_v_index;
7317   PyObject *__pyx_r = 0;
7318   __Pyx_RefNannyDeclarations
7319   __Pyx_RefNannySetupContext("get_morton_point (wrapper)", 0);
7320   assert(__pyx_arg_index); {
7321     __pyx_v_index = __Pyx_PyInt_As_npy_uint64(__pyx_arg_index); if (unlikely((__pyx_v_index == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 363, __pyx_L3_error)
7322   }
7323   goto __pyx_L4_argument_unpacking_done;
7324   __pyx_L3_error:;
7325   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.get_morton_point", __pyx_clineno, __pyx_lineno, __pyx_filename);
7326   __Pyx_RefNannyFinishContext();
7327   return NULL;
7328   __pyx_L4_argument_unpacking_done:;
7329   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_20get_morton_point(__pyx_self, ((__pyx_t_5numpy_uint64_t)__pyx_v_index));
7330 
7331   /* function exit code */
7332   __Pyx_RefNannyFinishContext();
7333   return __pyx_r;
7334 }
7335 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_20get_morton_point(CYTHON_UNUSED PyObject * __pyx_self,__pyx_t_5numpy_uint64_t __pyx_v_index)7336 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_20get_morton_point(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_uint64_t __pyx_v_index) {
7337   int __pyx_v_j;
7338   __pyx_t_5numpy_uint64_t __pyx_v_p[3];
7339   PyArrayObject *__pyx_v_position = 0;
7340   __Pyx_LocalBuf_ND __pyx_pybuffernd_position;
7341   __Pyx_Buffer __pyx_pybuffer_position;
7342   PyObject *__pyx_r = NULL;
7343   __Pyx_RefNannyDeclarations
7344   PyObject *__pyx_t_1 = NULL;
7345   PyObject *__pyx_t_2 = NULL;
7346   PyArrayObject *__pyx_t_3 = NULL;
7347   int __pyx_t_4;
7348   PyObject *__pyx_t_5 = NULL;
7349   PyObject *__pyx_t_6 = NULL;
7350   PyObject *__pyx_t_7 = NULL;
7351   Py_ssize_t __pyx_t_8;
7352   __Pyx_RefNannySetupContext("get_morton_point", 0);
7353   __pyx_pybuffer_position.pybuffer.buf = NULL;
7354   __pyx_pybuffer_position.refcount = 0;
7355   __pyx_pybuffernd_position.data = NULL;
7356   __pyx_pybuffernd_position.rcbuffer = &__pyx_pybuffer_position;
7357 
7358   /* "yt/utilities/lib/geometry_utils.pyx":367
7359  *     cdef np.uint64_t p[3]
7360  *     cdef np.ndarray[np.uint64_t, ndim=1] position
7361  *     position = np.zeros(3, 'uint64')             # <<<<<<<<<<<<<<
7362  *     morton_to_point(index, p)
7363  *     for j in range(3):
7364  */
7365   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 367, __pyx_L1_error)
7366   __Pyx_GOTREF(__pyx_t_1);
7367   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 367, __pyx_L1_error)
7368   __Pyx_GOTREF(__pyx_t_2);
7369   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7370   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 367, __pyx_L1_error)
7371   __Pyx_GOTREF(__pyx_t_1);
7372   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7373   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 367, __pyx_L1_error)
7374   __pyx_t_3 = ((PyArrayObject *)__pyx_t_1);
7375   {
7376     __Pyx_BufFmt_StackElem __pyx_stack[1];
7377     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_position.rcbuffer->pybuffer);
7378     __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_position.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
7379     if (unlikely(__pyx_t_4 < 0)) {
7380       PyErr_Fetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
7381       if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_position.rcbuffer->pybuffer, (PyObject*)__pyx_v_position, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
7382         Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7);
7383         __Pyx_RaiseBufferFallbackError();
7384       } else {
7385         PyErr_Restore(__pyx_t_5, __pyx_t_6, __pyx_t_7);
7386       }
7387       __pyx_t_5 = __pyx_t_6 = __pyx_t_7 = 0;
7388     }
7389     __pyx_pybuffernd_position.diminfo[0].strides = __pyx_pybuffernd_position.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_position.diminfo[0].shape = __pyx_pybuffernd_position.rcbuffer->pybuffer.shape[0];
7390     if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 367, __pyx_L1_error)
7391   }
7392   __pyx_t_3 = 0;
7393   __pyx_v_position = ((PyArrayObject *)__pyx_t_1);
7394   __pyx_t_1 = 0;
7395 
7396   /* "yt/utilities/lib/geometry_utils.pyx":368
7397  *     cdef np.ndarray[np.uint64_t, ndim=1] position
7398  *     position = np.zeros(3, 'uint64')
7399  *     morton_to_point(index, p)             # <<<<<<<<<<<<<<
7400  *     for j in range(3):
7401  *         position[j] = p[j]
7402  */
7403   __pyx_f_2yt_9utilities_3lib_14geometry_utils_morton_to_point(__pyx_v_index, __pyx_v_p);
7404 
7405   /* "yt/utilities/lib/geometry_utils.pyx":369
7406  *     position = np.zeros(3, 'uint64')
7407  *     morton_to_point(index, p)
7408  *     for j in range(3):             # <<<<<<<<<<<<<<
7409  *         position[j] = p[j]
7410  *     return position
7411  */
7412   for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) {
7413     __pyx_v_j = __pyx_t_4;
7414 
7415     /* "yt/utilities/lib/geometry_utils.pyx":370
7416  *     morton_to_point(index, p)
7417  *     for j in range(3):
7418  *         position[j] = p[j]             # <<<<<<<<<<<<<<
7419  *     return position
7420  *
7421  */
7422     __pyx_t_8 = __pyx_v_j;
7423     *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_position.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_position.diminfo[0].strides) = (__pyx_v_p[__pyx_v_j]);
7424   }
7425 
7426   /* "yt/utilities/lib/geometry_utils.pyx":371
7427  *     for j in range(3):
7428  *         position[j] = p[j]
7429  *     return position             # <<<<<<<<<<<<<<
7430  *
7431  * @cython.cdivision(True)
7432  */
7433   __Pyx_XDECREF(__pyx_r);
7434   __Pyx_INCREF(((PyObject *)__pyx_v_position));
7435   __pyx_r = ((PyObject *)__pyx_v_position);
7436   goto __pyx_L0;
7437 
7438   /* "yt/utilities/lib/geometry_utils.pyx":363
7439  * @cython.boundscheck(False)
7440  * @cython.wraparound(False)
7441  * def get_morton_point(np.uint64_t index):             # <<<<<<<<<<<<<<
7442  *     cdef int j
7443  *     cdef np.uint64_t p[3]
7444  */
7445 
7446   /* function exit code */
7447   __pyx_L1_error:;
7448   __Pyx_XDECREF(__pyx_t_1);
7449   __Pyx_XDECREF(__pyx_t_2);
7450   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
7451     __Pyx_PyThreadState_declare
7452     __Pyx_PyThreadState_assign
7453     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
7454     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_position.rcbuffer->pybuffer);
7455   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
7456   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.get_morton_point", __pyx_clineno, __pyx_lineno, __pyx_filename);
7457   __pyx_r = NULL;
7458   goto __pyx_L2;
7459   __pyx_L0:;
7460   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_position.rcbuffer->pybuffer);
7461   __pyx_L2:;
7462   __Pyx_XDECREF((PyObject *)__pyx_v_position);
7463   __Pyx_XGIVEREF(__pyx_r);
7464   __Pyx_RefNannyFinishContext();
7465   return __pyx_r;
7466 }
7467 
7468 /* "yt/utilities/lib/geometry_utils.pyx":376
7469  * @cython.boundscheck(False)
7470  * @cython.wraparound(False)
7471  * def get_morton_points(np.ndarray[np.uint64_t, ndim=1] indices):             # <<<<<<<<<<<<<<
7472  *     # This is inspired by the scurve package by user cortesi on GH.
7473  *     cdef int i, j
7474  */
7475 
7476 /* Python wrapper */
7477 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_23get_morton_points(PyObject *__pyx_self, PyObject *__pyx_v_indices); /*proto*/
7478 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_23get_morton_points = {"get_morton_points", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_23get_morton_points, METH_O, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_23get_morton_points(PyObject * __pyx_self,PyObject * __pyx_v_indices)7479 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_23get_morton_points(PyObject *__pyx_self, PyObject *__pyx_v_indices) {
7480   PyObject *__pyx_r = 0;
7481   __Pyx_RefNannyDeclarations
7482   __Pyx_RefNannySetupContext("get_morton_points (wrapper)", 0);
7483   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indices), __pyx_ptype_5numpy_ndarray, 1, "indices", 0))) __PYX_ERR(1, 376, __pyx_L1_error)
7484   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_22get_morton_points(__pyx_self, ((PyArrayObject *)__pyx_v_indices));
7485 
7486   /* function exit code */
7487   goto __pyx_L0;
7488   __pyx_L1_error:;
7489   __pyx_r = NULL;
7490   __pyx_L0:;
7491   __Pyx_RefNannyFinishContext();
7492   return __pyx_r;
7493 }
7494 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_22get_morton_points(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_indices)7495 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_22get_morton_points(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_indices) {
7496   int __pyx_v_i;
7497   int __pyx_v_j;
7498   __pyx_t_5numpy_uint64_t __pyx_v_p[3];
7499   PyArrayObject *__pyx_v_positions = 0;
7500   __Pyx_LocalBuf_ND __pyx_pybuffernd_indices;
7501   __Pyx_Buffer __pyx_pybuffer_indices;
7502   __Pyx_LocalBuf_ND __pyx_pybuffernd_positions;
7503   __Pyx_Buffer __pyx_pybuffer_positions;
7504   PyObject *__pyx_r = NULL;
7505   __Pyx_RefNannyDeclarations
7506   PyObject *__pyx_t_1 = NULL;
7507   PyObject *__pyx_t_2 = NULL;
7508   PyObject *__pyx_t_3 = NULL;
7509   PyObject *__pyx_t_4 = NULL;
7510   int __pyx_t_5;
7511   PyObject *__pyx_t_6 = NULL;
7512   PyArrayObject *__pyx_t_7 = NULL;
7513   PyObject *__pyx_t_8 = NULL;
7514   PyObject *__pyx_t_9 = NULL;
7515   PyObject *__pyx_t_10 = NULL;
7516   npy_intp __pyx_t_11;
7517   npy_intp __pyx_t_12;
7518   Py_ssize_t __pyx_t_13;
7519   int __pyx_t_14;
7520   Py_ssize_t __pyx_t_15;
7521   Py_ssize_t __pyx_t_16;
7522   __Pyx_RefNannySetupContext("get_morton_points", 0);
7523   __pyx_pybuffer_positions.pybuffer.buf = NULL;
7524   __pyx_pybuffer_positions.refcount = 0;
7525   __pyx_pybuffernd_positions.data = NULL;
7526   __pyx_pybuffernd_positions.rcbuffer = &__pyx_pybuffer_positions;
7527   __pyx_pybuffer_indices.pybuffer.buf = NULL;
7528   __pyx_pybuffer_indices.refcount = 0;
7529   __pyx_pybuffernd_indices.data = NULL;
7530   __pyx_pybuffernd_indices.rcbuffer = &__pyx_pybuffer_indices;
7531   {
7532     __Pyx_BufFmt_StackElem __pyx_stack[1];
7533     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 376, __pyx_L1_error)
7534   }
7535   __pyx_pybuffernd_indices.diminfo[0].strides = __pyx_pybuffernd_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indices.diminfo[0].shape = __pyx_pybuffernd_indices.rcbuffer->pybuffer.shape[0];
7536 
7537   /* "yt/utilities/lib/geometry_utils.pyx":381
7538  *     cdef np.uint64_t p[3]
7539  *     cdef np.ndarray[np.uint64_t, ndim=2] positions
7540  *     positions = np.zeros((indices.shape[0], 3), 'uint64')             # <<<<<<<<<<<<<<
7541  *     for i in range(indices.shape[0]):
7542  *         morton_to_point(indices[i], p)
7543  */
7544   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 381, __pyx_L1_error)
7545   __Pyx_GOTREF(__pyx_t_2);
7546   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 381, __pyx_L1_error)
7547   __Pyx_GOTREF(__pyx_t_3);
7548   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7549   __pyx_t_2 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_indices->dimensions[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 381, __pyx_L1_error)
7550   __Pyx_GOTREF(__pyx_t_2);
7551   __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 381, __pyx_L1_error)
7552   __Pyx_GOTREF(__pyx_t_4);
7553   __Pyx_GIVEREF(__pyx_t_2);
7554   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
7555   __Pyx_INCREF(__pyx_int_3);
7556   __Pyx_GIVEREF(__pyx_int_3);
7557   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_3);
7558   __pyx_t_2 = 0;
7559   __pyx_t_2 = NULL;
7560   __pyx_t_5 = 0;
7561   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
7562     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
7563     if (likely(__pyx_t_2)) {
7564       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7565       __Pyx_INCREF(__pyx_t_2);
7566       __Pyx_INCREF(function);
7567       __Pyx_DECREF_SET(__pyx_t_3, function);
7568       __pyx_t_5 = 1;
7569     }
7570   }
7571   #if CYTHON_FAST_PYCALL
7572   if (PyFunction_Check(__pyx_t_3)) {
7573     PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_4, __pyx_n_s_uint64};
7574     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 381, __pyx_L1_error)
7575     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7576     __Pyx_GOTREF(__pyx_t_1);
7577     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7578   } else
7579   #endif
7580   #if CYTHON_FAST_PYCCALL
7581   if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
7582     PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_4, __pyx_n_s_uint64};
7583     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 381, __pyx_L1_error)
7584     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7585     __Pyx_GOTREF(__pyx_t_1);
7586     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7587   } else
7588   #endif
7589   {
7590     __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 381, __pyx_L1_error)
7591     __Pyx_GOTREF(__pyx_t_6);
7592     if (__pyx_t_2) {
7593       __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
7594     }
7595     __Pyx_GIVEREF(__pyx_t_4);
7596     PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_4);
7597     __Pyx_INCREF(__pyx_n_s_uint64);
7598     __Pyx_GIVEREF(__pyx_n_s_uint64);
7599     PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_n_s_uint64);
7600     __pyx_t_4 = 0;
7601     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 381, __pyx_L1_error)
7602     __Pyx_GOTREF(__pyx_t_1);
7603     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7604   }
7605   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7606   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 381, __pyx_L1_error)
7607   __pyx_t_7 = ((PyArrayObject *)__pyx_t_1);
7608   {
7609     __Pyx_BufFmt_StackElem __pyx_stack[1];
7610     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_positions.rcbuffer->pybuffer);
7611     __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_positions.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
7612     if (unlikely(__pyx_t_5 < 0)) {
7613       PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
7614       if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_positions.rcbuffer->pybuffer, (PyObject*)__pyx_v_positions, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
7615         Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
7616         __Pyx_RaiseBufferFallbackError();
7617       } else {
7618         PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
7619       }
7620       __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
7621     }
7622     __pyx_pybuffernd_positions.diminfo[0].strides = __pyx_pybuffernd_positions.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_positions.diminfo[0].shape = __pyx_pybuffernd_positions.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_positions.diminfo[1].strides = __pyx_pybuffernd_positions.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_positions.diminfo[1].shape = __pyx_pybuffernd_positions.rcbuffer->pybuffer.shape[1];
7623     if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(1, 381, __pyx_L1_error)
7624   }
7625   __pyx_t_7 = 0;
7626   __pyx_v_positions = ((PyArrayObject *)__pyx_t_1);
7627   __pyx_t_1 = 0;
7628 
7629   /* "yt/utilities/lib/geometry_utils.pyx":382
7630  *     cdef np.ndarray[np.uint64_t, ndim=2] positions
7631  *     positions = np.zeros((indices.shape[0], 3), 'uint64')
7632  *     for i in range(indices.shape[0]):             # <<<<<<<<<<<<<<
7633  *         morton_to_point(indices[i], p)
7634  *         for j in range(3):
7635  */
7636   __pyx_t_11 = (__pyx_v_indices->dimensions[0]);
7637   __pyx_t_12 = __pyx_t_11;
7638   for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_12; __pyx_t_5+=1) {
7639     __pyx_v_i = __pyx_t_5;
7640 
7641     /* "yt/utilities/lib/geometry_utils.pyx":383
7642  *     positions = np.zeros((indices.shape[0], 3), 'uint64')
7643  *     for i in range(indices.shape[0]):
7644  *         morton_to_point(indices[i], p)             # <<<<<<<<<<<<<<
7645  *         for j in range(3):
7646  *             positions[i, j] = p[j]
7647  */
7648     __pyx_t_13 = __pyx_v_i;
7649     __pyx_f_2yt_9utilities_3lib_14geometry_utils_morton_to_point((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_indices.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_indices.diminfo[0].strides)), __pyx_v_p);
7650 
7651     /* "yt/utilities/lib/geometry_utils.pyx":384
7652  *     for i in range(indices.shape[0]):
7653  *         morton_to_point(indices[i], p)
7654  *         for j in range(3):             # <<<<<<<<<<<<<<
7655  *             positions[i, j] = p[j]
7656  *     return positions
7657  */
7658     for (__pyx_t_14 = 0; __pyx_t_14 < 3; __pyx_t_14+=1) {
7659       __pyx_v_j = __pyx_t_14;
7660 
7661       /* "yt/utilities/lib/geometry_utils.pyx":385
7662  *         morton_to_point(indices[i], p)
7663  *         for j in range(3):
7664  *             positions[i, j] = p[j]             # <<<<<<<<<<<<<<
7665  *     return positions
7666  *
7667  */
7668       __pyx_t_15 = __pyx_v_i;
7669       __pyx_t_16 = __pyx_v_j;
7670       *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_positions.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_positions.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_positions.diminfo[1].strides) = (__pyx_v_p[__pyx_v_j]);
7671     }
7672   }
7673 
7674   /* "yt/utilities/lib/geometry_utils.pyx":386
7675  *         for j in range(3):
7676  *             positions[i, j] = p[j]
7677  *     return positions             # <<<<<<<<<<<<<<
7678  *
7679  * @cython.cdivision(True)
7680  */
7681   __Pyx_XDECREF(__pyx_r);
7682   __Pyx_INCREF(((PyObject *)__pyx_v_positions));
7683   __pyx_r = ((PyObject *)__pyx_v_positions);
7684   goto __pyx_L0;
7685 
7686   /* "yt/utilities/lib/geometry_utils.pyx":376
7687  * @cython.boundscheck(False)
7688  * @cython.wraparound(False)
7689  * def get_morton_points(np.ndarray[np.uint64_t, ndim=1] indices):             # <<<<<<<<<<<<<<
7690  *     # This is inspired by the scurve package by user cortesi on GH.
7691  *     cdef int i, j
7692  */
7693 
7694   /* function exit code */
7695   __pyx_L1_error:;
7696   __Pyx_XDECREF(__pyx_t_1);
7697   __Pyx_XDECREF(__pyx_t_2);
7698   __Pyx_XDECREF(__pyx_t_3);
7699   __Pyx_XDECREF(__pyx_t_4);
7700   __Pyx_XDECREF(__pyx_t_6);
7701   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
7702     __Pyx_PyThreadState_declare
7703     __Pyx_PyThreadState_assign
7704     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
7705     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indices.rcbuffer->pybuffer);
7706     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_positions.rcbuffer->pybuffer);
7707   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
7708   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.get_morton_points", __pyx_clineno, __pyx_lineno, __pyx_filename);
7709   __pyx_r = NULL;
7710   goto __pyx_L2;
7711   __pyx_L0:;
7712   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indices.rcbuffer->pybuffer);
7713   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_positions.rcbuffer->pybuffer);
7714   __pyx_L2:;
7715   __Pyx_XDECREF((PyObject *)__pyx_v_positions);
7716   __Pyx_XGIVEREF(__pyx_r);
7717   __Pyx_RefNannyFinishContext();
7718   return __pyx_r;
7719 }
7720 
7721 /* "yt/utilities/lib/geometry_utils.pyx":391
7722  * @cython.boundscheck(False)
7723  * @cython.wraparound(False)
7724  * def get_morton_neighbors_coarse(mi1, max_index1, periodic, nn):             # <<<<<<<<<<<<<<
7725  *     cdef int i
7726  *     cdef np.uint32_t ntot
7727  */
7728 
7729 /* Python wrapper */
7730 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_25get_morton_neighbors_coarse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7731 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_25get_morton_neighbors_coarse = {"get_morton_neighbors_coarse", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_25get_morton_neighbors_coarse, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_25get_morton_neighbors_coarse(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)7732 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_25get_morton_neighbors_coarse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7733   PyObject *__pyx_v_mi1 = 0;
7734   PyObject *__pyx_v_max_index1 = 0;
7735   PyObject *__pyx_v_periodic = 0;
7736   PyObject *__pyx_v_nn = 0;
7737   PyObject *__pyx_r = 0;
7738   __Pyx_RefNannyDeclarations
7739   __Pyx_RefNannySetupContext("get_morton_neighbors_coarse (wrapper)", 0);
7740   {
7741     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mi1,&__pyx_n_s_max_index1,&__pyx_n_s_periodic,&__pyx_n_s_nn,0};
7742     PyObject* values[4] = {0,0,0,0};
7743     if (unlikely(__pyx_kwds)) {
7744       Py_ssize_t kw_args;
7745       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7746       switch (pos_args) {
7747         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7748         CYTHON_FALLTHROUGH;
7749         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7750         CYTHON_FALLTHROUGH;
7751         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7752         CYTHON_FALLTHROUGH;
7753         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7754         CYTHON_FALLTHROUGH;
7755         case  0: break;
7756         default: goto __pyx_L5_argtuple_error;
7757       }
7758       kw_args = PyDict_Size(__pyx_kwds);
7759       switch (pos_args) {
7760         case  0:
7761         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mi1)) != 0)) kw_args--;
7762         else goto __pyx_L5_argtuple_error;
7763         CYTHON_FALLTHROUGH;
7764         case  1:
7765         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_index1)) != 0)) kw_args--;
7766         else {
7767           __Pyx_RaiseArgtupleInvalid("get_morton_neighbors_coarse", 1, 4, 4, 1); __PYX_ERR(1, 391, __pyx_L3_error)
7768         }
7769         CYTHON_FALLTHROUGH;
7770         case  2:
7771         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_periodic)) != 0)) kw_args--;
7772         else {
7773           __Pyx_RaiseArgtupleInvalid("get_morton_neighbors_coarse", 1, 4, 4, 2); __PYX_ERR(1, 391, __pyx_L3_error)
7774         }
7775         CYTHON_FALLTHROUGH;
7776         case  3:
7777         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nn)) != 0)) kw_args--;
7778         else {
7779           __Pyx_RaiseArgtupleInvalid("get_morton_neighbors_coarse", 1, 4, 4, 3); __PYX_ERR(1, 391, __pyx_L3_error)
7780         }
7781       }
7782       if (unlikely(kw_args > 0)) {
7783         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_morton_neighbors_coarse") < 0)) __PYX_ERR(1, 391, __pyx_L3_error)
7784       }
7785     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
7786       goto __pyx_L5_argtuple_error;
7787     } else {
7788       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7789       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7790       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7791       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7792     }
7793     __pyx_v_mi1 = values[0];
7794     __pyx_v_max_index1 = values[1];
7795     __pyx_v_periodic = values[2];
7796     __pyx_v_nn = values[3];
7797   }
7798   goto __pyx_L4_argument_unpacking_done;
7799   __pyx_L5_argtuple_error:;
7800   __Pyx_RaiseArgtupleInvalid("get_morton_neighbors_coarse", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 391, __pyx_L3_error)
7801   __pyx_L3_error:;
7802   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.get_morton_neighbors_coarse", __pyx_clineno, __pyx_lineno, __pyx_filename);
7803   __Pyx_RefNannyFinishContext();
7804   return NULL;
7805   __pyx_L4_argument_unpacking_done:;
7806   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_24get_morton_neighbors_coarse(__pyx_self, __pyx_v_mi1, __pyx_v_max_index1, __pyx_v_periodic, __pyx_v_nn);
7807 
7808   /* function exit code */
7809   __Pyx_RefNannyFinishContext();
7810   return __pyx_r;
7811 }
7812 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_24get_morton_neighbors_coarse(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_mi1,PyObject * __pyx_v_max_index1,PyObject * __pyx_v_periodic,PyObject * __pyx_v_nn)7813 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_24get_morton_neighbors_coarse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_mi1, PyObject *__pyx_v_max_index1, PyObject *__pyx_v_periodic, PyObject *__pyx_v_nn) {
7814   int __pyx_v_i;
7815   __pyx_t_5numpy_uint32_t __pyx_v_ntot;
7816   PyArrayObject *__pyx_v_index = 0;
7817   PyArrayObject *__pyx_v_ind1_n = 0;
7818   PyArrayObject *__pyx_v_neighbors = 0;
7819   int __pyx_v_periodicity[3];
7820   __Pyx_LocalBuf_ND __pyx_pybuffernd_ind1_n;
7821   __Pyx_Buffer __pyx_pybuffer_ind1_n;
7822   __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
7823   __Pyx_Buffer __pyx_pybuffer_index;
7824   __Pyx_LocalBuf_ND __pyx_pybuffernd_neighbors;
7825   __Pyx_Buffer __pyx_pybuffer_neighbors;
7826   PyObject *__pyx_r = NULL;
7827   __Pyx_RefNannyDeclarations
7828   PyObject *__pyx_t_1 = NULL;
7829   PyObject *__pyx_t_2 = NULL;
7830   PyObject *__pyx_t_3 = NULL;
7831   PyObject *__pyx_t_4 = NULL;
7832   PyArrayObject *__pyx_t_5 = NULL;
7833   PyArrayObject *__pyx_t_6 = NULL;
7834   PyArrayObject *__pyx_t_7 = NULL;
7835   int __pyx_t_8;
7836   int __pyx_t_9;
7837   __pyx_t_5numpy_uint64_t __pyx_t_10;
7838   __pyx_t_5numpy_uint64_t __pyx_t_11;
7839   __pyx_t_5numpy_uint32_t __pyx_t_12;
7840   __Pyx_memviewslice __pyx_t_13 = { 0, 0, { 0 }, { 0 }, { 0 } };
7841   __Pyx_memviewslice __pyx_t_14 = { 0, 0, { 0 }, { 0 }, { 0 } };
7842   __Pyx_memviewslice __pyx_t_15 = { 0, 0, { 0 }, { 0 }, { 0 } };
7843   PyObject *__pyx_t_16 = NULL;
7844   __Pyx_RefNannySetupContext("get_morton_neighbors_coarse", 0);
7845   __pyx_pybuffer_index.pybuffer.buf = NULL;
7846   __pyx_pybuffer_index.refcount = 0;
7847   __pyx_pybuffernd_index.data = NULL;
7848   __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
7849   __pyx_pybuffer_ind1_n.pybuffer.buf = NULL;
7850   __pyx_pybuffer_ind1_n.refcount = 0;
7851   __pyx_pybuffernd_ind1_n.data = NULL;
7852   __pyx_pybuffernd_ind1_n.rcbuffer = &__pyx_pybuffer_ind1_n;
7853   __pyx_pybuffer_neighbors.pybuffer.buf = NULL;
7854   __pyx_pybuffer_neighbors.refcount = 0;
7855   __pyx_pybuffernd_neighbors.data = NULL;
7856   __pyx_pybuffernd_neighbors.rcbuffer = &__pyx_pybuffer_neighbors;
7857 
7858   /* "yt/utilities/lib/geometry_utils.pyx":394
7859  *     cdef int i
7860  *     cdef np.uint32_t ntot
7861  *     cdef np.ndarray[np.uint32_t, ndim=2] index = np.zeros((2*nn+1,3), dtype='uint32')             # <<<<<<<<<<<<<<
7862  *     cdef np.ndarray[np.uint64_t, ndim=2] ind1_n = np.zeros((2*nn+1,3), dtype='uint64')
7863  *     cdef np.ndarray[np.uint64_t, ndim=1] neighbors = np.zeros((2*nn+1)**3, dtype='uint64')
7864  */
7865   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 394, __pyx_L1_error)
7866   __Pyx_GOTREF(__pyx_t_1);
7867   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 394, __pyx_L1_error)
7868   __Pyx_GOTREF(__pyx_t_2);
7869   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7870   __pyx_t_1 = PyNumber_Multiply(__pyx_int_2, __pyx_v_nn); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 394, __pyx_L1_error)
7871   __Pyx_GOTREF(__pyx_t_1);
7872   __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 394, __pyx_L1_error)
7873   __Pyx_GOTREF(__pyx_t_3);
7874   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7875   __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 394, __pyx_L1_error)
7876   __Pyx_GOTREF(__pyx_t_1);
7877   __Pyx_GIVEREF(__pyx_t_3);
7878   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
7879   __Pyx_INCREF(__pyx_int_3);
7880   __Pyx_GIVEREF(__pyx_int_3);
7881   PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_3);
7882   __pyx_t_3 = 0;
7883   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 394, __pyx_L1_error)
7884   __Pyx_GOTREF(__pyx_t_3);
7885   __Pyx_GIVEREF(__pyx_t_1);
7886   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
7887   __pyx_t_1 = 0;
7888   __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 394, __pyx_L1_error)
7889   __Pyx_GOTREF(__pyx_t_1);
7890   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_uint32) < 0) __PYX_ERR(1, 394, __pyx_L1_error)
7891   __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 394, __pyx_L1_error)
7892   __Pyx_GOTREF(__pyx_t_4);
7893   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7894   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7895   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7896   if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 394, __pyx_L1_error)
7897   __pyx_t_5 = ((PyArrayObject *)__pyx_t_4);
7898   {
7899     __Pyx_BufFmt_StackElem __pyx_stack[1];
7900     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
7901       __pyx_v_index = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_index.rcbuffer->pybuffer.buf = NULL;
7902       __PYX_ERR(1, 394, __pyx_L1_error)
7903     } else {__pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_index.diminfo[1].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_index.diminfo[1].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[1];
7904     }
7905   }
7906   __pyx_t_5 = 0;
7907   __pyx_v_index = ((PyArrayObject *)__pyx_t_4);
7908   __pyx_t_4 = 0;
7909 
7910   /* "yt/utilities/lib/geometry_utils.pyx":395
7911  *     cdef np.uint32_t ntot
7912  *     cdef np.ndarray[np.uint32_t, ndim=2] index = np.zeros((2*nn+1,3), dtype='uint32')
7913  *     cdef np.ndarray[np.uint64_t, ndim=2] ind1_n = np.zeros((2*nn+1,3), dtype='uint64')             # <<<<<<<<<<<<<<
7914  *     cdef np.ndarray[np.uint64_t, ndim=1] neighbors = np.zeros((2*nn+1)**3, dtype='uint64')
7915  *     cdef bint periodicity[3]
7916  */
7917   __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 395, __pyx_L1_error)
7918   __Pyx_GOTREF(__pyx_t_4);
7919   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 395, __pyx_L1_error)
7920   __Pyx_GOTREF(__pyx_t_1);
7921   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7922   __pyx_t_4 = PyNumber_Multiply(__pyx_int_2, __pyx_v_nn); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 395, __pyx_L1_error)
7923   __Pyx_GOTREF(__pyx_t_4);
7924   __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 395, __pyx_L1_error)
7925   __Pyx_GOTREF(__pyx_t_3);
7926   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7927   __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 395, __pyx_L1_error)
7928   __Pyx_GOTREF(__pyx_t_4);
7929   __Pyx_GIVEREF(__pyx_t_3);
7930   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
7931   __Pyx_INCREF(__pyx_int_3);
7932   __Pyx_GIVEREF(__pyx_int_3);
7933   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_3);
7934   __pyx_t_3 = 0;
7935   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 395, __pyx_L1_error)
7936   __Pyx_GOTREF(__pyx_t_3);
7937   __Pyx_GIVEREF(__pyx_t_4);
7938   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
7939   __pyx_t_4 = 0;
7940   __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 395, __pyx_L1_error)
7941   __Pyx_GOTREF(__pyx_t_4);
7942   if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_n_s_uint64) < 0) __PYX_ERR(1, 395, __pyx_L1_error)
7943   __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 395, __pyx_L1_error)
7944   __Pyx_GOTREF(__pyx_t_2);
7945   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7946   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7947   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7948   if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 395, __pyx_L1_error)
7949   __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
7950   {
7951     __Pyx_BufFmt_StackElem __pyx_stack[1];
7952     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind1_n.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
7953       __pyx_v_ind1_n = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ind1_n.rcbuffer->pybuffer.buf = NULL;
7954       __PYX_ERR(1, 395, __pyx_L1_error)
7955     } else {__pyx_pybuffernd_ind1_n.diminfo[0].strides = __pyx_pybuffernd_ind1_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind1_n.diminfo[0].shape = __pyx_pybuffernd_ind1_n.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ind1_n.diminfo[1].strides = __pyx_pybuffernd_ind1_n.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ind1_n.diminfo[1].shape = __pyx_pybuffernd_ind1_n.rcbuffer->pybuffer.shape[1];
7956     }
7957   }
7958   __pyx_t_6 = 0;
7959   __pyx_v_ind1_n = ((PyArrayObject *)__pyx_t_2);
7960   __pyx_t_2 = 0;
7961 
7962   /* "yt/utilities/lib/geometry_utils.pyx":396
7963  *     cdef np.ndarray[np.uint32_t, ndim=2] index = np.zeros((2*nn+1,3), dtype='uint32')
7964  *     cdef np.ndarray[np.uint64_t, ndim=2] ind1_n = np.zeros((2*nn+1,3), dtype='uint64')
7965  *     cdef np.ndarray[np.uint64_t, ndim=1] neighbors = np.zeros((2*nn+1)**3, dtype='uint64')             # <<<<<<<<<<<<<<
7966  *     cdef bint periodicity[3]
7967  *     if periodic:
7968  */
7969   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 396, __pyx_L1_error)
7970   __Pyx_GOTREF(__pyx_t_2);
7971   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 396, __pyx_L1_error)
7972   __Pyx_GOTREF(__pyx_t_4);
7973   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7974   __pyx_t_2 = PyNumber_Multiply(__pyx_int_2, __pyx_v_nn); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 396, __pyx_L1_error)
7975   __Pyx_GOTREF(__pyx_t_2);
7976   __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 396, __pyx_L1_error)
7977   __Pyx_GOTREF(__pyx_t_3);
7978   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7979   __pyx_t_2 = PyNumber_Power(__pyx_t_3, __pyx_int_3, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 396, __pyx_L1_error)
7980   __Pyx_GOTREF(__pyx_t_2);
7981   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7982   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 396, __pyx_L1_error)
7983   __Pyx_GOTREF(__pyx_t_3);
7984   __Pyx_GIVEREF(__pyx_t_2);
7985   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
7986   __pyx_t_2 = 0;
7987   __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 396, __pyx_L1_error)
7988   __Pyx_GOTREF(__pyx_t_2);
7989   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_n_s_uint64) < 0) __PYX_ERR(1, 396, __pyx_L1_error)
7990   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 396, __pyx_L1_error)
7991   __Pyx_GOTREF(__pyx_t_1);
7992   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7993   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7994   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7995   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 396, __pyx_L1_error)
7996   __pyx_t_7 = ((PyArrayObject *)__pyx_t_1);
7997   {
7998     __Pyx_BufFmt_StackElem __pyx_stack[1];
7999     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_neighbors.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
8000       __pyx_v_neighbors = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_neighbors.rcbuffer->pybuffer.buf = NULL;
8001       __PYX_ERR(1, 396, __pyx_L1_error)
8002     } else {__pyx_pybuffernd_neighbors.diminfo[0].strides = __pyx_pybuffernd_neighbors.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_neighbors.diminfo[0].shape = __pyx_pybuffernd_neighbors.rcbuffer->pybuffer.shape[0];
8003     }
8004   }
8005   __pyx_t_7 = 0;
8006   __pyx_v_neighbors = ((PyArrayObject *)__pyx_t_1);
8007   __pyx_t_1 = 0;
8008 
8009   /* "yt/utilities/lib/geometry_utils.pyx":398
8010  *     cdef np.ndarray[np.uint64_t, ndim=1] neighbors = np.zeros((2*nn+1)**3, dtype='uint64')
8011  *     cdef bint periodicity[3]
8012  *     if periodic:             # <<<<<<<<<<<<<<
8013  *         for i in range(3): periodicity[i] = 1
8014  *     else:
8015  */
8016   __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_periodic); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(1, 398, __pyx_L1_error)
8017   if (__pyx_t_8) {
8018 
8019     /* "yt/utilities/lib/geometry_utils.pyx":399
8020  *     cdef bint periodicity[3]
8021  *     if periodic:
8022  *         for i in range(3): periodicity[i] = 1             # <<<<<<<<<<<<<<
8023  *     else:
8024  *         for i in range(3): periodicity[i] = 0
8025  */
8026     for (__pyx_t_9 = 0; __pyx_t_9 < 3; __pyx_t_9+=1) {
8027       __pyx_v_i = __pyx_t_9;
8028       (__pyx_v_periodicity[__pyx_v_i]) = 1;
8029     }
8030 
8031     /* "yt/utilities/lib/geometry_utils.pyx":398
8032  *     cdef np.ndarray[np.uint64_t, ndim=1] neighbors = np.zeros((2*nn+1)**3, dtype='uint64')
8033  *     cdef bint periodicity[3]
8034  *     if periodic:             # <<<<<<<<<<<<<<
8035  *         for i in range(3): periodicity[i] = 1
8036  *     else:
8037  */
8038     goto __pyx_L3;
8039   }
8040 
8041   /* "yt/utilities/lib/geometry_utils.pyx":401
8042  *         for i in range(3): periodicity[i] = 1
8043  *     else:
8044  *         for i in range(3): periodicity[i] = 0             # <<<<<<<<<<<<<<
8045  *     ntot = morton_neighbors_coarse(mi1, max_index1, periodicity, nn,
8046  *                                    index, ind1_n, neighbors)
8047  */
8048   /*else*/ {
8049     for (__pyx_t_9 = 0; __pyx_t_9 < 3; __pyx_t_9+=1) {
8050       __pyx_v_i = __pyx_t_9;
8051       (__pyx_v_periodicity[__pyx_v_i]) = 0;
8052     }
8053   }
8054   __pyx_L3:;
8055 
8056   /* "yt/utilities/lib/geometry_utils.pyx":402
8057  *     else:
8058  *         for i in range(3): periodicity[i] = 0
8059  *     ntot = morton_neighbors_coarse(mi1, max_index1, periodicity, nn,             # <<<<<<<<<<<<<<
8060  *                                    index, ind1_n, neighbors)
8061  *     return np.resize(neighbors, (ntot,))
8062  */
8063   __pyx_t_10 = __Pyx_PyInt_As_npy_uint64(__pyx_v_mi1); if (unlikely((__pyx_t_10 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 402, __pyx_L1_error)
8064   __pyx_t_11 = __Pyx_PyInt_As_npy_uint64(__pyx_v_max_index1); if (unlikely((__pyx_t_11 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 402, __pyx_L1_error)
8065   __pyx_t_12 = __Pyx_PyInt_As_npy_uint32(__pyx_v_nn); if (unlikely((__pyx_t_12 == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(1, 402, __pyx_L1_error)
8066 
8067   /* "yt/utilities/lib/geometry_utils.pyx":403
8068  *         for i in range(3): periodicity[i] = 0
8069  *     ntot = morton_neighbors_coarse(mi1, max_index1, periodicity, nn,
8070  *                                    index, ind1_n, neighbors)             # <<<<<<<<<<<<<<
8071  *     return np.resize(neighbors, (ntot,))
8072  *
8073  */
8074   __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_uint32_t(((PyObject *)__pyx_v_index), PyBUF_WRITABLE); if (unlikely(!__pyx_t_13.memview)) __PYX_ERR(1, 403, __pyx_L1_error)
8075   __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_uint64_t(((PyObject *)__pyx_v_ind1_n), PyBUF_WRITABLE); if (unlikely(!__pyx_t_14.memview)) __PYX_ERR(1, 403, __pyx_L1_error)
8076   __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_uint64_t(((PyObject *)__pyx_v_neighbors), PyBUF_WRITABLE); if (unlikely(!__pyx_t_15.memview)) __PYX_ERR(1, 403, __pyx_L1_error)
8077 
8078   /* "yt/utilities/lib/geometry_utils.pyx":402
8079  *     else:
8080  *         for i in range(3): periodicity[i] = 0
8081  *     ntot = morton_neighbors_coarse(mi1, max_index1, periodicity, nn,             # <<<<<<<<<<<<<<
8082  *                                    index, ind1_n, neighbors)
8083  *     return np.resize(neighbors, (ntot,))
8084  */
8085   __pyx_v_ntot = __pyx_f_2yt_9utilities_3lib_14geometry_utils_morton_neighbors_coarse(__pyx_t_10, __pyx_t_11, __pyx_v_periodicity, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15);
8086   __PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
8087   __pyx_t_13.memview = NULL;
8088   __pyx_t_13.data = NULL;
8089   __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
8090   __pyx_t_14.memview = NULL;
8091   __pyx_t_14.data = NULL;
8092   __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
8093   __pyx_t_15.memview = NULL;
8094   __pyx_t_15.data = NULL;
8095 
8096   /* "yt/utilities/lib/geometry_utils.pyx":404
8097  *     ntot = morton_neighbors_coarse(mi1, max_index1, periodicity, nn,
8098  *                                    index, ind1_n, neighbors)
8099  *     return np.resize(neighbors, (ntot,))             # <<<<<<<<<<<<<<
8100  *
8101  * @cython.cdivision(True)
8102  */
8103   __Pyx_XDECREF(__pyx_r);
8104   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 404, __pyx_L1_error)
8105   __Pyx_GOTREF(__pyx_t_2);
8106   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_resize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 404, __pyx_L1_error)
8107   __Pyx_GOTREF(__pyx_t_3);
8108   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8109   __pyx_t_2 = __Pyx_PyInt_From_npy_uint32(__pyx_v_ntot); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 404, __pyx_L1_error)
8110   __Pyx_GOTREF(__pyx_t_2);
8111   __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 404, __pyx_L1_error)
8112   __Pyx_GOTREF(__pyx_t_4);
8113   __Pyx_GIVEREF(__pyx_t_2);
8114   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
8115   __pyx_t_2 = 0;
8116   __pyx_t_2 = NULL;
8117   __pyx_t_9 = 0;
8118   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
8119     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
8120     if (likely(__pyx_t_2)) {
8121       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
8122       __Pyx_INCREF(__pyx_t_2);
8123       __Pyx_INCREF(function);
8124       __Pyx_DECREF_SET(__pyx_t_3, function);
8125       __pyx_t_9 = 1;
8126     }
8127   }
8128   #if CYTHON_FAST_PYCALL
8129   if (PyFunction_Check(__pyx_t_3)) {
8130     PyObject *__pyx_temp[3] = {__pyx_t_2, ((PyObject *)__pyx_v_neighbors), __pyx_t_4};
8131     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 404, __pyx_L1_error)
8132     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
8133     __Pyx_GOTREF(__pyx_t_1);
8134     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8135   } else
8136   #endif
8137   #if CYTHON_FAST_PYCCALL
8138   if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
8139     PyObject *__pyx_temp[3] = {__pyx_t_2, ((PyObject *)__pyx_v_neighbors), __pyx_t_4};
8140     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 404, __pyx_L1_error)
8141     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
8142     __Pyx_GOTREF(__pyx_t_1);
8143     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8144   } else
8145   #endif
8146   {
8147     __pyx_t_16 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 404, __pyx_L1_error)
8148     __Pyx_GOTREF(__pyx_t_16);
8149     if (__pyx_t_2) {
8150       __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_2); __pyx_t_2 = NULL;
8151     }
8152     __Pyx_INCREF(((PyObject *)__pyx_v_neighbors));
8153     __Pyx_GIVEREF(((PyObject *)__pyx_v_neighbors));
8154     PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_9, ((PyObject *)__pyx_v_neighbors));
8155     __Pyx_GIVEREF(__pyx_t_4);
8156     PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_9, __pyx_t_4);
8157     __pyx_t_4 = 0;
8158     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 404, __pyx_L1_error)
8159     __Pyx_GOTREF(__pyx_t_1);
8160     __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8161   }
8162   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8163   __pyx_r = __pyx_t_1;
8164   __pyx_t_1 = 0;
8165   goto __pyx_L0;
8166 
8167   /* "yt/utilities/lib/geometry_utils.pyx":391
8168  * @cython.boundscheck(False)
8169  * @cython.wraparound(False)
8170  * def get_morton_neighbors_coarse(mi1, max_index1, periodic, nn):             # <<<<<<<<<<<<<<
8171  *     cdef int i
8172  *     cdef np.uint32_t ntot
8173  */
8174 
8175   /* function exit code */
8176   __pyx_L1_error:;
8177   __Pyx_XDECREF(__pyx_t_1);
8178   __Pyx_XDECREF(__pyx_t_2);
8179   __Pyx_XDECREF(__pyx_t_3);
8180   __Pyx_XDECREF(__pyx_t_4);
8181   __PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
8182   __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
8183   __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
8184   __Pyx_XDECREF(__pyx_t_16);
8185   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
8186     __Pyx_PyThreadState_declare
8187     __Pyx_PyThreadState_assign
8188     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
8189     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind1_n.rcbuffer->pybuffer);
8190     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
8191     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighbors.rcbuffer->pybuffer);
8192   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
8193   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.get_morton_neighbors_coarse", __pyx_clineno, __pyx_lineno, __pyx_filename);
8194   __pyx_r = NULL;
8195   goto __pyx_L2;
8196   __pyx_L0:;
8197   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind1_n.rcbuffer->pybuffer);
8198   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
8199   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighbors.rcbuffer->pybuffer);
8200   __pyx_L2:;
8201   __Pyx_XDECREF((PyObject *)__pyx_v_index);
8202   __Pyx_XDECREF((PyObject *)__pyx_v_ind1_n);
8203   __Pyx_XDECREF((PyObject *)__pyx_v_neighbors);
8204   __Pyx_XGIVEREF(__pyx_r);
8205   __Pyx_RefNannyFinishContext();
8206   return __pyx_r;
8207 }
8208 
8209 /* "yt/utilities/lib/geometry_utils.pyx":409
8210  * @cython.boundscheck(False)
8211  * @cython.wraparound(False)
8212  * cdef np.uint32_t morton_neighbors_coarse(np.uint64_t mi1, np.uint64_t max_index1,             # <<<<<<<<<<<<<<
8213  *                                          bint periodicity[3], np.uint32_t nn,
8214  *                                          np.uint32_t[:,:] index,
8215  */
8216 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_morton_neighbors_coarse(__pyx_t_5numpy_uint64_t __pyx_v_mi1,__pyx_t_5numpy_uint64_t __pyx_v_max_index1,int * __pyx_v_periodicity,__pyx_t_5numpy_uint32_t __pyx_v_nn,__Pyx_memviewslice __pyx_v_index,__Pyx_memviewslice __pyx_v_ind1_n,__Pyx_memviewslice __pyx_v_neighbors)8217 static __pyx_t_5numpy_uint32_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_morton_neighbors_coarse(__pyx_t_5numpy_uint64_t __pyx_v_mi1, __pyx_t_5numpy_uint64_t __pyx_v_max_index1, int *__pyx_v_periodicity, __pyx_t_5numpy_uint32_t __pyx_v_nn, __Pyx_memviewslice __pyx_v_index, __Pyx_memviewslice __pyx_v_ind1_n, __Pyx_memviewslice __pyx_v_neighbors) {
8218   __pyx_t_5numpy_uint32_t __pyx_v_ntot;
8219   __pyx_t_5numpy_uint64_t __pyx_v_ind1[3];
8220   __pyx_t_5numpy_uint32_t __pyx_v_count[3];
8221   __pyx_t_5numpy_uint32_t __pyx_v_origin[3];
8222   __pyx_t_5numpy_int64_t __pyx_v_adv;
8223   int __pyx_v_i;
8224   int __pyx_v_j;
8225   int __pyx_v_k;
8226   int __pyx_v_ii;
8227   int __pyx_v_ij;
8228   int __pyx_v_ik;
8229   __pyx_t_5numpy_uint32_t __pyx_r;
8230   __Pyx_RefNannyDeclarations
8231   int __pyx_t_1;
8232   long __pyx_t_2;
8233   long __pyx_t_3;
8234   int __pyx_t_4;
8235   int __pyx_t_5;
8236   int __pyx_t_6;
8237   Py_ssize_t __pyx_t_7;
8238   Py_ssize_t __pyx_t_8;
8239   size_t __pyx_t_9;
8240   Py_ssize_t __pyx_t_10;
8241   int __pyx_t_11;
8242   Py_ssize_t __pyx_t_12;
8243   Py_ssize_t __pyx_t_13;
8244   Py_ssize_t __pyx_t_14;
8245   Py_ssize_t __pyx_t_15;
8246   Py_ssize_t __pyx_t_16;
8247   Py_ssize_t __pyx_t_17;
8248   size_t __pyx_t_18;
8249   Py_ssize_t __pyx_t_19;
8250   __pyx_t_5numpy_uint32_t __pyx_t_20;
8251   __pyx_t_5numpy_uint32_t __pyx_t_21;
8252   Py_ssize_t __pyx_t_22;
8253   Py_ssize_t __pyx_t_23;
8254   __pyx_t_5numpy_uint32_t __pyx_t_24;
8255   __pyx_t_5numpy_uint32_t __pyx_t_25;
8256   Py_ssize_t __pyx_t_26;
8257   Py_ssize_t __pyx_t_27;
8258   __pyx_t_5numpy_uint32_t __pyx_t_28;
8259   __pyx_t_5numpy_uint32_t __pyx_t_29;
8260   Py_ssize_t __pyx_t_30;
8261   Py_ssize_t __pyx_t_31;
8262   int __pyx_t_32;
8263   Py_ssize_t __pyx_t_33;
8264   Py_ssize_t __pyx_t_34;
8265   Py_ssize_t __pyx_t_35;
8266   Py_ssize_t __pyx_t_36;
8267   Py_ssize_t __pyx_t_37;
8268   Py_ssize_t __pyx_t_38;
8269   size_t __pyx_t_39;
8270   __Pyx_RefNannySetupContext("morton_neighbors_coarse", 0);
8271 
8272   /* "yt/utilities/lib/geometry_utils.pyx":414
8273  *                                          np.uint64_t[:,:] ind1_n,
8274  *                                          np.uint64_t[:] neighbors):
8275  *     cdef np.uint32_t ntot = 0             # <<<<<<<<<<<<<<
8276  *     cdef np.uint64_t ind1[3]
8277  *     cdef np.uint32_t count[3]
8278  */
8279   __pyx_v_ntot = 0;
8280 
8281   /* "yt/utilities/lib/geometry_utils.pyx":420
8282  *     cdef np.int64_t adv
8283  *     cdef int i, j, k, ii, ij, ik
8284  *     for i in range(3):             # <<<<<<<<<<<<<<
8285  *         count[i] = 0
8286  *         origin[i] = 0
8287  */
8288   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
8289     __pyx_v_i = __pyx_t_1;
8290 
8291     /* "yt/utilities/lib/geometry_utils.pyx":421
8292  *     cdef int i, j, k, ii, ij, ik
8293  *     for i in range(3):
8294  *         count[i] = 0             # <<<<<<<<<<<<<<
8295  *         origin[i] = 0
8296  *     # Get indices
8297  */
8298     (__pyx_v_count[__pyx_v_i]) = 0;
8299 
8300     /* "yt/utilities/lib/geometry_utils.pyx":422
8301  *     for i in range(3):
8302  *         count[i] = 0
8303  *         origin[i] = 0             # <<<<<<<<<<<<<<
8304  *     # Get indices
8305  *     decode_morton_64bit(mi1,ind1)
8306  */
8307     (__pyx_v_origin[__pyx_v_i]) = 0;
8308   }
8309 
8310   /* "yt/utilities/lib/geometry_utils.pyx":424
8311  *         origin[i] = 0
8312  *     # Get indices
8313  *     decode_morton_64bit(mi1,ind1)             # <<<<<<<<<<<<<<
8314  *     # Determine which directions are valid
8315  *     for j,i in enumerate(range(-nn,(nn+1))):
8316  */
8317   __pyx_f_2yt_9utilities_3lib_14geometry_utils_decode_morton_64bit(__pyx_v_mi1, __pyx_v_ind1);
8318 
8319   /* "yt/utilities/lib/geometry_utils.pyx":426
8320  *     decode_morton_64bit(mi1,ind1)
8321  *     # Determine which directions are valid
8322  *     for j,i in enumerate(range(-nn,(nn+1))):             # <<<<<<<<<<<<<<
8323  *         if i == 0:
8324  *             for k in range(3):
8325  */
8326   __pyx_t_1 = 0;
8327   __pyx_t_2 = (__pyx_v_nn + 1);
8328   __pyx_t_3 = __pyx_t_2;
8329   for (__pyx_t_4 = (-__pyx_v_nn); __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
8330     __pyx_v_i = __pyx_t_4;
8331     __pyx_v_j = __pyx_t_1;
8332     __pyx_t_1 = (__pyx_t_1 + 1);
8333 
8334     /* "yt/utilities/lib/geometry_utils.pyx":427
8335  *     # Determine which directions are valid
8336  *     for j,i in enumerate(range(-nn,(nn+1))):
8337  *         if i == 0:             # <<<<<<<<<<<<<<
8338  *             for k in range(3):
8339  *                 ind1_n[j,k] = ind1[k]
8340  */
8341     __pyx_t_5 = ((__pyx_v_i == 0) != 0);
8342     if (__pyx_t_5) {
8343 
8344       /* "yt/utilities/lib/geometry_utils.pyx":428
8345  *     for j,i in enumerate(range(-nn,(nn+1))):
8346  *         if i == 0:
8347  *             for k in range(3):             # <<<<<<<<<<<<<<
8348  *                 ind1_n[j,k] = ind1[k]
8349  *                 index[count[k],k] = j
8350  */
8351       for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) {
8352         __pyx_v_k = __pyx_t_6;
8353 
8354         /* "yt/utilities/lib/geometry_utils.pyx":429
8355  *         if i == 0:
8356  *             for k in range(3):
8357  *                 ind1_n[j,k] = ind1[k]             # <<<<<<<<<<<<<<
8358  *                 index[count[k],k] = j
8359  *                 origin[k] = count[k]
8360  */
8361         __pyx_t_7 = __pyx_v_j;
8362         __pyx_t_8 = __pyx_v_k;
8363         *((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind1_n.data + __pyx_t_7 * __pyx_v_ind1_n.strides[0]) ) + __pyx_t_8 * __pyx_v_ind1_n.strides[1]) )) = (__pyx_v_ind1[__pyx_v_k]);
8364 
8365         /* "yt/utilities/lib/geometry_utils.pyx":430
8366  *             for k in range(3):
8367  *                 ind1_n[j,k] = ind1[k]
8368  *                 index[count[k],k] = j             # <<<<<<<<<<<<<<
8369  *                 origin[k] = count[k]
8370  *                 count[k] += 1
8371  */
8372         __pyx_t_9 = (__pyx_v_count[__pyx_v_k]);
8373         __pyx_t_10 = __pyx_v_k;
8374         *((__pyx_t_5numpy_uint32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_index.data + __pyx_t_9 * __pyx_v_index.strides[0]) ) + __pyx_t_10 * __pyx_v_index.strides[1]) )) = __pyx_v_j;
8375 
8376         /* "yt/utilities/lib/geometry_utils.pyx":431
8377  *                 ind1_n[j,k] = ind1[k]
8378  *                 index[count[k],k] = j
8379  *                 origin[k] = count[k]             # <<<<<<<<<<<<<<
8380  *                 count[k] += 1
8381  *         else:
8382  */
8383         (__pyx_v_origin[__pyx_v_k]) = (__pyx_v_count[__pyx_v_k]);
8384 
8385         /* "yt/utilities/lib/geometry_utils.pyx":432
8386  *                 index[count[k],k] = j
8387  *                 origin[k] = count[k]
8388  *                 count[k] += 1             # <<<<<<<<<<<<<<
8389  *         else:
8390  *             for k in range(3):
8391  */
8392         __pyx_t_11 = __pyx_v_k;
8393         (__pyx_v_count[__pyx_t_11]) = ((__pyx_v_count[__pyx_t_11]) + 1);
8394       }
8395 
8396       /* "yt/utilities/lib/geometry_utils.pyx":427
8397  *     # Determine which directions are valid
8398  *     for j,i in enumerate(range(-nn,(nn+1))):
8399  *         if i == 0:             # <<<<<<<<<<<<<<
8400  *             for k in range(3):
8401  *                 ind1_n[j,k] = ind1[k]
8402  */
8403       goto __pyx_L7;
8404     }
8405 
8406     /* "yt/utilities/lib/geometry_utils.pyx":434
8407  *                 count[k] += 1
8408  *         else:
8409  *             for k in range(3):             # <<<<<<<<<<<<<<
8410  *                 adv = <np.int64_t>((<np.int64_t>ind1[k]) + i)
8411  *                 if (adv < 0):
8412  */
8413     /*else*/ {
8414       for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) {
8415         __pyx_v_k = __pyx_t_6;
8416 
8417         /* "yt/utilities/lib/geometry_utils.pyx":435
8418  *         else:
8419  *             for k in range(3):
8420  *                 adv = <np.int64_t>((<np.int64_t>ind1[k]) + i)             # <<<<<<<<<<<<<<
8421  *                 if (adv < 0):
8422  *                     if periodicity[k]:
8423  */
8424         __pyx_v_adv = ((__pyx_t_5numpy_int64_t)(((__pyx_t_5numpy_int64_t)(__pyx_v_ind1[__pyx_v_k])) + __pyx_v_i));
8425 
8426         /* "yt/utilities/lib/geometry_utils.pyx":436
8427  *             for k in range(3):
8428  *                 adv = <np.int64_t>((<np.int64_t>ind1[k]) + i)
8429  *                 if (adv < 0):             # <<<<<<<<<<<<<<
8430  *                     if periodicity[k]:
8431  *                         while adv < 0:
8432  */
8433         __pyx_t_5 = ((__pyx_v_adv < 0) != 0);
8434         if (__pyx_t_5) {
8435 
8436           /* "yt/utilities/lib/geometry_utils.pyx":437
8437  *                 adv = <np.int64_t>((<np.int64_t>ind1[k]) + i)
8438  *                 if (adv < 0):
8439  *                     if periodicity[k]:             # <<<<<<<<<<<<<<
8440  *                         while adv < 0:
8441  *                             adv += max_index1
8442  */
8443           __pyx_t_5 = ((__pyx_v_periodicity[__pyx_v_k]) != 0);
8444           if (__pyx_t_5) {
8445 
8446             /* "yt/utilities/lib/geometry_utils.pyx":438
8447  *                 if (adv < 0):
8448  *                     if periodicity[k]:
8449  *                         while adv < 0:             # <<<<<<<<<<<<<<
8450  *                             adv += max_index1
8451  *                         ind1_n[j,k] = <np.uint64_t>(adv % max_index1)
8452  */
8453             while (1) {
8454               __pyx_t_5 = ((__pyx_v_adv < 0) != 0);
8455               if (!__pyx_t_5) break;
8456 
8457               /* "yt/utilities/lib/geometry_utils.pyx":439
8458  *                     if periodicity[k]:
8459  *                         while adv < 0:
8460  *                             adv += max_index1             # <<<<<<<<<<<<<<
8461  *                         ind1_n[j,k] = <np.uint64_t>(adv % max_index1)
8462  *                     else:
8463  */
8464               __pyx_v_adv = (__pyx_v_adv + __pyx_v_max_index1);
8465             }
8466 
8467             /* "yt/utilities/lib/geometry_utils.pyx":440
8468  *                         while adv < 0:
8469  *                             adv += max_index1
8470  *                         ind1_n[j,k] = <np.uint64_t>(adv % max_index1)             # <<<<<<<<<<<<<<
8471  *                     else:
8472  *                         continue
8473  */
8474             __pyx_t_12 = __pyx_v_j;
8475             __pyx_t_13 = __pyx_v_k;
8476             *((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind1_n.data + __pyx_t_12 * __pyx_v_ind1_n.strides[0]) ) + __pyx_t_13 * __pyx_v_ind1_n.strides[1]) )) = ((__pyx_t_5numpy_uint64_t)(__pyx_v_adv % __pyx_v_max_index1));
8477 
8478             /* "yt/utilities/lib/geometry_utils.pyx":437
8479  *                 adv = <np.int64_t>((<np.int64_t>ind1[k]) + i)
8480  *                 if (adv < 0):
8481  *                     if periodicity[k]:             # <<<<<<<<<<<<<<
8482  *                         while adv < 0:
8483  *                             adv += max_index1
8484  */
8485             goto __pyx_L13;
8486           }
8487 
8488           /* "yt/utilities/lib/geometry_utils.pyx":442
8489  *                         ind1_n[j,k] = <np.uint64_t>(adv % max_index1)
8490  *                     else:
8491  *                         continue             # <<<<<<<<<<<<<<
8492  *                 elif (adv >= max_index1):
8493  *                     if periodicity[k]:
8494  */
8495           /*else*/ {
8496             goto __pyx_L10_continue;
8497           }
8498           __pyx_L13:;
8499 
8500           /* "yt/utilities/lib/geometry_utils.pyx":436
8501  *             for k in range(3):
8502  *                 adv = <np.int64_t>((<np.int64_t>ind1[k]) + i)
8503  *                 if (adv < 0):             # <<<<<<<<<<<<<<
8504  *                     if periodicity[k]:
8505  *                         while adv < 0:
8506  */
8507           goto __pyx_L12;
8508         }
8509 
8510         /* "yt/utilities/lib/geometry_utils.pyx":443
8511  *                     else:
8512  *                         continue
8513  *                 elif (adv >= max_index1):             # <<<<<<<<<<<<<<
8514  *                     if periodicity[k]:
8515  *                         ind1_n[j,k] = <np.uint64_t>(adv % max_index1)
8516  */
8517         __pyx_t_5 = ((__pyx_v_adv >= __pyx_v_max_index1) != 0);
8518         if (__pyx_t_5) {
8519 
8520           /* "yt/utilities/lib/geometry_utils.pyx":444
8521  *                         continue
8522  *                 elif (adv >= max_index1):
8523  *                     if periodicity[k]:             # <<<<<<<<<<<<<<
8524  *                         ind1_n[j,k] = <np.uint64_t>(adv % max_index1)
8525  *                     else:
8526  */
8527           __pyx_t_5 = ((__pyx_v_periodicity[__pyx_v_k]) != 0);
8528           if (__pyx_t_5) {
8529 
8530             /* "yt/utilities/lib/geometry_utils.pyx":445
8531  *                 elif (adv >= max_index1):
8532  *                     if periodicity[k]:
8533  *                         ind1_n[j,k] = <np.uint64_t>(adv % max_index1)             # <<<<<<<<<<<<<<
8534  *                     else:
8535  *                         continue
8536  */
8537             __pyx_t_14 = __pyx_v_j;
8538             __pyx_t_15 = __pyx_v_k;
8539             *((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind1_n.data + __pyx_t_14 * __pyx_v_ind1_n.strides[0]) ) + __pyx_t_15 * __pyx_v_ind1_n.strides[1]) )) = ((__pyx_t_5numpy_uint64_t)(__pyx_v_adv % __pyx_v_max_index1));
8540 
8541             /* "yt/utilities/lib/geometry_utils.pyx":444
8542  *                         continue
8543  *                 elif (adv >= max_index1):
8544  *                     if periodicity[k]:             # <<<<<<<<<<<<<<
8545  *                         ind1_n[j,k] = <np.uint64_t>(adv % max_index1)
8546  *                     else:
8547  */
8548             goto __pyx_L16;
8549           }
8550 
8551           /* "yt/utilities/lib/geometry_utils.pyx":447
8552  *                         ind1_n[j,k] = <np.uint64_t>(adv % max_index1)
8553  *                     else:
8554  *                         continue             # <<<<<<<<<<<<<<
8555  *                 else:
8556  *                     ind1_n[j,k] = <np.uint64_t>(adv)
8557  */
8558           /*else*/ {
8559             goto __pyx_L10_continue;
8560           }
8561           __pyx_L16:;
8562 
8563           /* "yt/utilities/lib/geometry_utils.pyx":443
8564  *                     else:
8565  *                         continue
8566  *                 elif (adv >= max_index1):             # <<<<<<<<<<<<<<
8567  *                     if periodicity[k]:
8568  *                         ind1_n[j,k] = <np.uint64_t>(adv % max_index1)
8569  */
8570           goto __pyx_L12;
8571         }
8572 
8573         /* "yt/utilities/lib/geometry_utils.pyx":449
8574  *                         continue
8575  *                 else:
8576  *                     ind1_n[j,k] = <np.uint64_t>(adv)             # <<<<<<<<<<<<<<
8577  *                 # print(i,k,adv,max_index1,ind1_n[j,k],adv % max_index1)
8578  *                 index[count[k],k] = j
8579  */
8580         /*else*/ {
8581           __pyx_t_16 = __pyx_v_j;
8582           __pyx_t_17 = __pyx_v_k;
8583           *((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind1_n.data + __pyx_t_16 * __pyx_v_ind1_n.strides[0]) ) + __pyx_t_17 * __pyx_v_ind1_n.strides[1]) )) = ((__pyx_t_5numpy_uint64_t)__pyx_v_adv);
8584         }
8585         __pyx_L12:;
8586 
8587         /* "yt/utilities/lib/geometry_utils.pyx":451
8588  *                     ind1_n[j,k] = <np.uint64_t>(adv)
8589  *                 # print(i,k,adv,max_index1,ind1_n[j,k],adv % max_index1)
8590  *                 index[count[k],k] = j             # <<<<<<<<<<<<<<
8591  *                 count[k] += 1
8592  *     # Iterate over ever combinations
8593  */
8594         __pyx_t_18 = (__pyx_v_count[__pyx_v_k]);
8595         __pyx_t_19 = __pyx_v_k;
8596         *((__pyx_t_5numpy_uint32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_index.data + __pyx_t_18 * __pyx_v_index.strides[0]) ) + __pyx_t_19 * __pyx_v_index.strides[1]) )) = __pyx_v_j;
8597 
8598         /* "yt/utilities/lib/geometry_utils.pyx":452
8599  *                 # print(i,k,adv,max_index1,ind1_n[j,k],adv % max_index1)
8600  *                 index[count[k],k] = j
8601  *                 count[k] += 1             # <<<<<<<<<<<<<<
8602  *     # Iterate over ever combinations
8603  *     for ii in range(count[0]):
8604  */
8605         __pyx_t_11 = __pyx_v_k;
8606         (__pyx_v_count[__pyx_t_11]) = ((__pyx_v_count[__pyx_t_11]) + 1);
8607         __pyx_L10_continue:;
8608       }
8609     }
8610     __pyx_L7:;
8611   }
8612 
8613   /* "yt/utilities/lib/geometry_utils.pyx":454
8614  *                 count[k] += 1
8615  *     # Iterate over ever combinations
8616  *     for ii in range(count[0]):             # <<<<<<<<<<<<<<
8617  *         i = index[ii,0]
8618  *         for ij in range(count[1]):
8619  */
8620   __pyx_t_20 = (__pyx_v_count[0]);
8621   __pyx_t_21 = __pyx_t_20;
8622   for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_21; __pyx_t_1+=1) {
8623     __pyx_v_ii = __pyx_t_1;
8624 
8625     /* "yt/utilities/lib/geometry_utils.pyx":455
8626  *     # Iterate over ever combinations
8627  *     for ii in range(count[0]):
8628  *         i = index[ii,0]             # <<<<<<<<<<<<<<
8629  *         for ij in range(count[1]):
8630  *             j = index[ij,1]
8631  */
8632     __pyx_t_22 = __pyx_v_ii;
8633     __pyx_t_23 = 0;
8634     __pyx_v_i = (*((__pyx_t_5numpy_uint32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_index.data + __pyx_t_22 * __pyx_v_index.strides[0]) ) + __pyx_t_23 * __pyx_v_index.strides[1]) )));
8635 
8636     /* "yt/utilities/lib/geometry_utils.pyx":456
8637  *     for ii in range(count[0]):
8638  *         i = index[ii,0]
8639  *         for ij in range(count[1]):             # <<<<<<<<<<<<<<
8640  *             j = index[ij,1]
8641  *             for ik in range(count[2]):
8642  */
8643     __pyx_t_24 = (__pyx_v_count[1]);
8644     __pyx_t_25 = __pyx_t_24;
8645     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_25; __pyx_t_4+=1) {
8646       __pyx_v_ij = __pyx_t_4;
8647 
8648       /* "yt/utilities/lib/geometry_utils.pyx":457
8649  *         i = index[ii,0]
8650  *         for ij in range(count[1]):
8651  *             j = index[ij,1]             # <<<<<<<<<<<<<<
8652  *             for ik in range(count[2]):
8653  *                 k = index[ik,2]
8654  */
8655       __pyx_t_26 = __pyx_v_ij;
8656       __pyx_t_27 = 1;
8657       __pyx_v_j = (*((__pyx_t_5numpy_uint32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_index.data + __pyx_t_26 * __pyx_v_index.strides[0]) ) + __pyx_t_27 * __pyx_v_index.strides[1]) )));
8658 
8659       /* "yt/utilities/lib/geometry_utils.pyx":458
8660  *         for ij in range(count[1]):
8661  *             j = index[ij,1]
8662  *             for ik in range(count[2]):             # <<<<<<<<<<<<<<
8663  *                 k = index[ik,2]
8664  *                 if (ii != origin[0]) or (ij != origin[1]) or (ik != origin[2]):
8665  */
8666       __pyx_t_28 = (__pyx_v_count[2]);
8667       __pyx_t_29 = __pyx_t_28;
8668       for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_29; __pyx_t_6+=1) {
8669         __pyx_v_ik = __pyx_t_6;
8670 
8671         /* "yt/utilities/lib/geometry_utils.pyx":459
8672  *             j = index[ij,1]
8673  *             for ik in range(count[2]):
8674  *                 k = index[ik,2]             # <<<<<<<<<<<<<<
8675  *                 if (ii != origin[0]) or (ij != origin[1]) or (ik != origin[2]):
8676  *                     neighbors[ntot] = encode_morton_64bit(ind1_n[i,0],
8677  */
8678         __pyx_t_30 = __pyx_v_ik;
8679         __pyx_t_31 = 2;
8680         __pyx_v_k = (*((__pyx_t_5numpy_uint32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_index.data + __pyx_t_30 * __pyx_v_index.strides[0]) ) + __pyx_t_31 * __pyx_v_index.strides[1]) )));
8681 
8682         /* "yt/utilities/lib/geometry_utils.pyx":460
8683  *             for ik in range(count[2]):
8684  *                 k = index[ik,2]
8685  *                 if (ii != origin[0]) or (ij != origin[1]) or (ik != origin[2]):             # <<<<<<<<<<<<<<
8686  *                     neighbors[ntot] = encode_morton_64bit(ind1_n[i,0],
8687  *                                                           ind1_n[j,1],
8688  */
8689         __pyx_t_32 = ((__pyx_v_ii != (__pyx_v_origin[0])) != 0);
8690         if (!__pyx_t_32) {
8691         } else {
8692           __pyx_t_5 = __pyx_t_32;
8693           goto __pyx_L24_bool_binop_done;
8694         }
8695         __pyx_t_32 = ((__pyx_v_ij != (__pyx_v_origin[1])) != 0);
8696         if (!__pyx_t_32) {
8697         } else {
8698           __pyx_t_5 = __pyx_t_32;
8699           goto __pyx_L24_bool_binop_done;
8700         }
8701         __pyx_t_32 = ((__pyx_v_ik != (__pyx_v_origin[2])) != 0);
8702         __pyx_t_5 = __pyx_t_32;
8703         __pyx_L24_bool_binop_done:;
8704         if (__pyx_t_5) {
8705 
8706           /* "yt/utilities/lib/geometry_utils.pyx":461
8707  *                 k = index[ik,2]
8708  *                 if (ii != origin[0]) or (ij != origin[1]) or (ik != origin[2]):
8709  *                     neighbors[ntot] = encode_morton_64bit(ind1_n[i,0],             # <<<<<<<<<<<<<<
8710  *                                                           ind1_n[j,1],
8711  *                                                           ind1_n[k,2])
8712  */
8713           __pyx_t_33 = __pyx_v_i;
8714           __pyx_t_34 = 0;
8715 
8716           /* "yt/utilities/lib/geometry_utils.pyx":462
8717  *                 if (ii != origin[0]) or (ij != origin[1]) or (ik != origin[2]):
8718  *                     neighbors[ntot] = encode_morton_64bit(ind1_n[i,0],
8719  *                                                           ind1_n[j,1],             # <<<<<<<<<<<<<<
8720  *                                                           ind1_n[k,2])
8721  *                     ntot += 1
8722  */
8723           __pyx_t_35 = __pyx_v_j;
8724           __pyx_t_36 = 1;
8725 
8726           /* "yt/utilities/lib/geometry_utils.pyx":463
8727  *                     neighbors[ntot] = encode_morton_64bit(ind1_n[i,0],
8728  *                                                           ind1_n[j,1],
8729  *                                                           ind1_n[k,2])             # <<<<<<<<<<<<<<
8730  *                     ntot += 1
8731  *     return ntot
8732  */
8733           __pyx_t_37 = __pyx_v_k;
8734           __pyx_t_38 = 2;
8735 
8736           /* "yt/utilities/lib/geometry_utils.pyx":461
8737  *                 k = index[ik,2]
8738  *                 if (ii != origin[0]) or (ij != origin[1]) or (ik != origin[2]):
8739  *                     neighbors[ntot] = encode_morton_64bit(ind1_n[i,0],             # <<<<<<<<<<<<<<
8740  *                                                           ind1_n[j,1],
8741  *                                                           ind1_n[k,2])
8742  */
8743           __pyx_t_39 = __pyx_v_ntot;
8744           *((__pyx_t_5numpy_uint64_t *) ( /* dim=0 */ (__pyx_v_neighbors.data + __pyx_t_39 * __pyx_v_neighbors.strides[0]) )) = __pyx_f_2yt_9utilities_3lib_14geometry_utils_encode_morton_64bit((*((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind1_n.data + __pyx_t_33 * __pyx_v_ind1_n.strides[0]) ) + __pyx_t_34 * __pyx_v_ind1_n.strides[1]) ))), (*((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind1_n.data + __pyx_t_35 * __pyx_v_ind1_n.strides[0]) ) + __pyx_t_36 * __pyx_v_ind1_n.strides[1]) ))), (*((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind1_n.data + __pyx_t_37 * __pyx_v_ind1_n.strides[0]) ) + __pyx_t_38 * __pyx_v_ind1_n.strides[1]) ))));
8745 
8746           /* "yt/utilities/lib/geometry_utils.pyx":464
8747  *                                                           ind1_n[j,1],
8748  *                                                           ind1_n[k,2])
8749  *                     ntot += 1             # <<<<<<<<<<<<<<
8750  *     return ntot
8751  *
8752  */
8753           __pyx_v_ntot = (__pyx_v_ntot + 1);
8754 
8755           /* "yt/utilities/lib/geometry_utils.pyx":460
8756  *             for ik in range(count[2]):
8757  *                 k = index[ik,2]
8758  *                 if (ii != origin[0]) or (ij != origin[1]) or (ik != origin[2]):             # <<<<<<<<<<<<<<
8759  *                     neighbors[ntot] = encode_morton_64bit(ind1_n[i,0],
8760  *                                                           ind1_n[j,1],
8761  */
8762         }
8763       }
8764     }
8765   }
8766 
8767   /* "yt/utilities/lib/geometry_utils.pyx":465
8768  *                                                           ind1_n[k,2])
8769  *                     ntot += 1
8770  *     return ntot             # <<<<<<<<<<<<<<
8771  *
8772  * @cython.cdivision(True)
8773  */
8774   __pyx_r = __pyx_v_ntot;
8775   goto __pyx_L0;
8776 
8777   /* "yt/utilities/lib/geometry_utils.pyx":409
8778  * @cython.boundscheck(False)
8779  * @cython.wraparound(False)
8780  * cdef np.uint32_t morton_neighbors_coarse(np.uint64_t mi1, np.uint64_t max_index1,             # <<<<<<<<<<<<<<
8781  *                                          bint periodicity[3], np.uint32_t nn,
8782  *                                          np.uint32_t[:,:] index,
8783  */
8784 
8785   /* function exit code */
8786   __pyx_L0:;
8787   __Pyx_RefNannyFinishContext();
8788   return __pyx_r;
8789 }
8790 
8791 /* "yt/utilities/lib/geometry_utils.pyx":470
8792  * @cython.boundscheck(False)
8793  * @cython.wraparound(False)
8794  * def get_morton_neighbors_refined(mi1, mi2, max_index1, max_index2, periodic, nn):             # <<<<<<<<<<<<<<
8795  *     cdef int i
8796  *     cdef np.uint32_t ntot
8797  */
8798 
8799 /* Python wrapper */
8800 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_27get_morton_neighbors_refined(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8801 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_27get_morton_neighbors_refined = {"get_morton_neighbors_refined", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_27get_morton_neighbors_refined, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_27get_morton_neighbors_refined(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)8802 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_27get_morton_neighbors_refined(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8803   PyObject *__pyx_v_mi1 = 0;
8804   PyObject *__pyx_v_mi2 = 0;
8805   PyObject *__pyx_v_max_index1 = 0;
8806   PyObject *__pyx_v_max_index2 = 0;
8807   PyObject *__pyx_v_periodic = 0;
8808   PyObject *__pyx_v_nn = 0;
8809   PyObject *__pyx_r = 0;
8810   __Pyx_RefNannyDeclarations
8811   __Pyx_RefNannySetupContext("get_morton_neighbors_refined (wrapper)", 0);
8812   {
8813     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mi1,&__pyx_n_s_mi2,&__pyx_n_s_max_index1,&__pyx_n_s_max_index2,&__pyx_n_s_periodic,&__pyx_n_s_nn,0};
8814     PyObject* values[6] = {0,0,0,0,0,0};
8815     if (unlikely(__pyx_kwds)) {
8816       Py_ssize_t kw_args;
8817       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8818       switch (pos_args) {
8819         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8820         CYTHON_FALLTHROUGH;
8821         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8822         CYTHON_FALLTHROUGH;
8823         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8824         CYTHON_FALLTHROUGH;
8825         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8826         CYTHON_FALLTHROUGH;
8827         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8828         CYTHON_FALLTHROUGH;
8829         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8830         CYTHON_FALLTHROUGH;
8831         case  0: break;
8832         default: goto __pyx_L5_argtuple_error;
8833       }
8834       kw_args = PyDict_Size(__pyx_kwds);
8835       switch (pos_args) {
8836         case  0:
8837         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mi1)) != 0)) kw_args--;
8838         else goto __pyx_L5_argtuple_error;
8839         CYTHON_FALLTHROUGH;
8840         case  1:
8841         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mi2)) != 0)) kw_args--;
8842         else {
8843           __Pyx_RaiseArgtupleInvalid("get_morton_neighbors_refined", 1, 6, 6, 1); __PYX_ERR(1, 470, __pyx_L3_error)
8844         }
8845         CYTHON_FALLTHROUGH;
8846         case  2:
8847         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_index1)) != 0)) kw_args--;
8848         else {
8849           __Pyx_RaiseArgtupleInvalid("get_morton_neighbors_refined", 1, 6, 6, 2); __PYX_ERR(1, 470, __pyx_L3_error)
8850         }
8851         CYTHON_FALLTHROUGH;
8852         case  3:
8853         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_index2)) != 0)) kw_args--;
8854         else {
8855           __Pyx_RaiseArgtupleInvalid("get_morton_neighbors_refined", 1, 6, 6, 3); __PYX_ERR(1, 470, __pyx_L3_error)
8856         }
8857         CYTHON_FALLTHROUGH;
8858         case  4:
8859         if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_periodic)) != 0)) kw_args--;
8860         else {
8861           __Pyx_RaiseArgtupleInvalid("get_morton_neighbors_refined", 1, 6, 6, 4); __PYX_ERR(1, 470, __pyx_L3_error)
8862         }
8863         CYTHON_FALLTHROUGH;
8864         case  5:
8865         if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nn)) != 0)) kw_args--;
8866         else {
8867           __Pyx_RaiseArgtupleInvalid("get_morton_neighbors_refined", 1, 6, 6, 5); __PYX_ERR(1, 470, __pyx_L3_error)
8868         }
8869       }
8870       if (unlikely(kw_args > 0)) {
8871         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_morton_neighbors_refined") < 0)) __PYX_ERR(1, 470, __pyx_L3_error)
8872       }
8873     } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
8874       goto __pyx_L5_argtuple_error;
8875     } else {
8876       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8877       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8878       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8879       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8880       values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8881       values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8882     }
8883     __pyx_v_mi1 = values[0];
8884     __pyx_v_mi2 = values[1];
8885     __pyx_v_max_index1 = values[2];
8886     __pyx_v_max_index2 = values[3];
8887     __pyx_v_periodic = values[4];
8888     __pyx_v_nn = values[5];
8889   }
8890   goto __pyx_L4_argument_unpacking_done;
8891   __pyx_L5_argtuple_error:;
8892   __Pyx_RaiseArgtupleInvalid("get_morton_neighbors_refined", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 470, __pyx_L3_error)
8893   __pyx_L3_error:;
8894   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.get_morton_neighbors_refined", __pyx_clineno, __pyx_lineno, __pyx_filename);
8895   __Pyx_RefNannyFinishContext();
8896   return NULL;
8897   __pyx_L4_argument_unpacking_done:;
8898   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_26get_morton_neighbors_refined(__pyx_self, __pyx_v_mi1, __pyx_v_mi2, __pyx_v_max_index1, __pyx_v_max_index2, __pyx_v_periodic, __pyx_v_nn);
8899 
8900   /* function exit code */
8901   __Pyx_RefNannyFinishContext();
8902   return __pyx_r;
8903 }
8904 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_26get_morton_neighbors_refined(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_mi1,PyObject * __pyx_v_mi2,PyObject * __pyx_v_max_index1,PyObject * __pyx_v_max_index2,PyObject * __pyx_v_periodic,PyObject * __pyx_v_nn)8905 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_26get_morton_neighbors_refined(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_mi1, PyObject *__pyx_v_mi2, PyObject *__pyx_v_max_index1, PyObject *__pyx_v_max_index2, PyObject *__pyx_v_periodic, PyObject *__pyx_v_nn) {
8906   int __pyx_v_i;
8907   __pyx_t_5numpy_uint32_t __pyx_v_ntot;
8908   PyArrayObject *__pyx_v_index = 0;
8909   PyArrayObject *__pyx_v_ind1_n = 0;
8910   PyArrayObject *__pyx_v_ind2_n = 0;
8911   PyArrayObject *__pyx_v_neighbors1 = 0;
8912   PyArrayObject *__pyx_v_neighbors2 = 0;
8913   int __pyx_v_periodicity[3];
8914   __Pyx_LocalBuf_ND __pyx_pybuffernd_ind1_n;
8915   __Pyx_Buffer __pyx_pybuffer_ind1_n;
8916   __Pyx_LocalBuf_ND __pyx_pybuffernd_ind2_n;
8917   __Pyx_Buffer __pyx_pybuffer_ind2_n;
8918   __Pyx_LocalBuf_ND __pyx_pybuffernd_index;
8919   __Pyx_Buffer __pyx_pybuffer_index;
8920   __Pyx_LocalBuf_ND __pyx_pybuffernd_neighbors1;
8921   __Pyx_Buffer __pyx_pybuffer_neighbors1;
8922   __Pyx_LocalBuf_ND __pyx_pybuffernd_neighbors2;
8923   __Pyx_Buffer __pyx_pybuffer_neighbors2;
8924   PyObject *__pyx_r = NULL;
8925   __Pyx_RefNannyDeclarations
8926   PyObject *__pyx_t_1 = NULL;
8927   PyObject *__pyx_t_2 = NULL;
8928   PyObject *__pyx_t_3 = NULL;
8929   PyObject *__pyx_t_4 = NULL;
8930   PyArrayObject *__pyx_t_5 = NULL;
8931   PyArrayObject *__pyx_t_6 = NULL;
8932   PyArrayObject *__pyx_t_7 = NULL;
8933   PyArrayObject *__pyx_t_8 = NULL;
8934   PyArrayObject *__pyx_t_9 = NULL;
8935   int __pyx_t_10;
8936   int __pyx_t_11;
8937   __pyx_t_5numpy_uint64_t __pyx_t_12;
8938   __pyx_t_5numpy_uint64_t __pyx_t_13;
8939   __pyx_t_5numpy_uint64_t __pyx_t_14;
8940   __pyx_t_5numpy_uint64_t __pyx_t_15;
8941   __pyx_t_5numpy_uint32_t __pyx_t_16;
8942   __Pyx_memviewslice __pyx_t_17 = { 0, 0, { 0 }, { 0 }, { 0 } };
8943   __Pyx_memviewslice __pyx_t_18 = { 0, 0, { 0 }, { 0 }, { 0 } };
8944   __Pyx_memviewslice __pyx_t_19 = { 0, 0, { 0 }, { 0 }, { 0 } };
8945   __Pyx_memviewslice __pyx_t_20 = { 0, 0, { 0 }, { 0 }, { 0 } };
8946   __Pyx_memviewslice __pyx_t_21 = { 0, 0, { 0 }, { 0 }, { 0 } };
8947   PyObject *__pyx_t_22 = NULL;
8948   PyObject *__pyx_t_23 = NULL;
8949   __Pyx_RefNannySetupContext("get_morton_neighbors_refined", 0);
8950   __pyx_pybuffer_index.pybuffer.buf = NULL;
8951   __pyx_pybuffer_index.refcount = 0;
8952   __pyx_pybuffernd_index.data = NULL;
8953   __pyx_pybuffernd_index.rcbuffer = &__pyx_pybuffer_index;
8954   __pyx_pybuffer_ind1_n.pybuffer.buf = NULL;
8955   __pyx_pybuffer_ind1_n.refcount = 0;
8956   __pyx_pybuffernd_ind1_n.data = NULL;
8957   __pyx_pybuffernd_ind1_n.rcbuffer = &__pyx_pybuffer_ind1_n;
8958   __pyx_pybuffer_ind2_n.pybuffer.buf = NULL;
8959   __pyx_pybuffer_ind2_n.refcount = 0;
8960   __pyx_pybuffernd_ind2_n.data = NULL;
8961   __pyx_pybuffernd_ind2_n.rcbuffer = &__pyx_pybuffer_ind2_n;
8962   __pyx_pybuffer_neighbors1.pybuffer.buf = NULL;
8963   __pyx_pybuffer_neighbors1.refcount = 0;
8964   __pyx_pybuffernd_neighbors1.data = NULL;
8965   __pyx_pybuffernd_neighbors1.rcbuffer = &__pyx_pybuffer_neighbors1;
8966   __pyx_pybuffer_neighbors2.pybuffer.buf = NULL;
8967   __pyx_pybuffer_neighbors2.refcount = 0;
8968   __pyx_pybuffernd_neighbors2.data = NULL;
8969   __pyx_pybuffernd_neighbors2.rcbuffer = &__pyx_pybuffer_neighbors2;
8970 
8971   /* "yt/utilities/lib/geometry_utils.pyx":473
8972  *     cdef int i
8973  *     cdef np.uint32_t ntot
8974  *     cdef np.ndarray[np.uint32_t, ndim=2] index = np.zeros((2*nn+1,3), dtype='uint32')             # <<<<<<<<<<<<<<
8975  *     cdef np.ndarray[np.uint64_t, ndim=2] ind1_n = np.zeros((2*nn+1,3), dtype='uint64')
8976  *     cdef np.ndarray[np.uint64_t, ndim=2] ind2_n = np.zeros((2*nn+1,3), dtype='uint64')
8977  */
8978   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 473, __pyx_L1_error)
8979   __Pyx_GOTREF(__pyx_t_1);
8980   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 473, __pyx_L1_error)
8981   __Pyx_GOTREF(__pyx_t_2);
8982   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8983   __pyx_t_1 = PyNumber_Multiply(__pyx_int_2, __pyx_v_nn); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 473, __pyx_L1_error)
8984   __Pyx_GOTREF(__pyx_t_1);
8985   __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 473, __pyx_L1_error)
8986   __Pyx_GOTREF(__pyx_t_3);
8987   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8988   __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 473, __pyx_L1_error)
8989   __Pyx_GOTREF(__pyx_t_1);
8990   __Pyx_GIVEREF(__pyx_t_3);
8991   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
8992   __Pyx_INCREF(__pyx_int_3);
8993   __Pyx_GIVEREF(__pyx_int_3);
8994   PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_3);
8995   __pyx_t_3 = 0;
8996   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 473, __pyx_L1_error)
8997   __Pyx_GOTREF(__pyx_t_3);
8998   __Pyx_GIVEREF(__pyx_t_1);
8999   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
9000   __pyx_t_1 = 0;
9001   __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 473, __pyx_L1_error)
9002   __Pyx_GOTREF(__pyx_t_1);
9003   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_uint32) < 0) __PYX_ERR(1, 473, __pyx_L1_error)
9004   __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 473, __pyx_L1_error)
9005   __Pyx_GOTREF(__pyx_t_4);
9006   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9007   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9008   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9009   if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 473, __pyx_L1_error)
9010   __pyx_t_5 = ((PyArrayObject *)__pyx_t_4);
9011   {
9012     __Pyx_BufFmt_StackElem __pyx_stack[1];
9013     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint32_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
9014       __pyx_v_index = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_index.rcbuffer->pybuffer.buf = NULL;
9015       __PYX_ERR(1, 473, __pyx_L1_error)
9016     } else {__pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_index.diminfo[1].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_index.diminfo[1].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[1];
9017     }
9018   }
9019   __pyx_t_5 = 0;
9020   __pyx_v_index = ((PyArrayObject *)__pyx_t_4);
9021   __pyx_t_4 = 0;
9022 
9023   /* "yt/utilities/lib/geometry_utils.pyx":474
9024  *     cdef np.uint32_t ntot
9025  *     cdef np.ndarray[np.uint32_t, ndim=2] index = np.zeros((2*nn+1,3), dtype='uint32')
9026  *     cdef np.ndarray[np.uint64_t, ndim=2] ind1_n = np.zeros((2*nn+1,3), dtype='uint64')             # <<<<<<<<<<<<<<
9027  *     cdef np.ndarray[np.uint64_t, ndim=2] ind2_n = np.zeros((2*nn+1,3), dtype='uint64')
9028  *     cdef np.ndarray[np.uint64_t, ndim=1] neighbors1 = np.zeros((2*nn+1)**3, dtype='uint64')
9029  */
9030   __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 474, __pyx_L1_error)
9031   __Pyx_GOTREF(__pyx_t_4);
9032   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 474, __pyx_L1_error)
9033   __Pyx_GOTREF(__pyx_t_1);
9034   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9035   __pyx_t_4 = PyNumber_Multiply(__pyx_int_2, __pyx_v_nn); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 474, __pyx_L1_error)
9036   __Pyx_GOTREF(__pyx_t_4);
9037   __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 474, __pyx_L1_error)
9038   __Pyx_GOTREF(__pyx_t_3);
9039   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9040   __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 474, __pyx_L1_error)
9041   __Pyx_GOTREF(__pyx_t_4);
9042   __Pyx_GIVEREF(__pyx_t_3);
9043   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
9044   __Pyx_INCREF(__pyx_int_3);
9045   __Pyx_GIVEREF(__pyx_int_3);
9046   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_3);
9047   __pyx_t_3 = 0;
9048   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 474, __pyx_L1_error)
9049   __Pyx_GOTREF(__pyx_t_3);
9050   __Pyx_GIVEREF(__pyx_t_4);
9051   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
9052   __pyx_t_4 = 0;
9053   __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 474, __pyx_L1_error)
9054   __Pyx_GOTREF(__pyx_t_4);
9055   if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_n_s_uint64) < 0) __PYX_ERR(1, 474, __pyx_L1_error)
9056   __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 474, __pyx_L1_error)
9057   __Pyx_GOTREF(__pyx_t_2);
9058   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9059   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9060   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9061   if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 474, __pyx_L1_error)
9062   __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
9063   {
9064     __Pyx_BufFmt_StackElem __pyx_stack[1];
9065     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind1_n.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
9066       __pyx_v_ind1_n = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ind1_n.rcbuffer->pybuffer.buf = NULL;
9067       __PYX_ERR(1, 474, __pyx_L1_error)
9068     } else {__pyx_pybuffernd_ind1_n.diminfo[0].strides = __pyx_pybuffernd_ind1_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind1_n.diminfo[0].shape = __pyx_pybuffernd_ind1_n.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ind1_n.diminfo[1].strides = __pyx_pybuffernd_ind1_n.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ind1_n.diminfo[1].shape = __pyx_pybuffernd_ind1_n.rcbuffer->pybuffer.shape[1];
9069     }
9070   }
9071   __pyx_t_6 = 0;
9072   __pyx_v_ind1_n = ((PyArrayObject *)__pyx_t_2);
9073   __pyx_t_2 = 0;
9074 
9075   /* "yt/utilities/lib/geometry_utils.pyx":475
9076  *     cdef np.ndarray[np.uint32_t, ndim=2] index = np.zeros((2*nn+1,3), dtype='uint32')
9077  *     cdef np.ndarray[np.uint64_t, ndim=2] ind1_n = np.zeros((2*nn+1,3), dtype='uint64')
9078  *     cdef np.ndarray[np.uint64_t, ndim=2] ind2_n = np.zeros((2*nn+1,3), dtype='uint64')             # <<<<<<<<<<<<<<
9079  *     cdef np.ndarray[np.uint64_t, ndim=1] neighbors1 = np.zeros((2*nn+1)**3, dtype='uint64')
9080  *     cdef np.ndarray[np.uint64_t, ndim=1] neighbors2 = np.zeros((2*nn+1)**3, dtype='uint64')
9081  */
9082   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 475, __pyx_L1_error)
9083   __Pyx_GOTREF(__pyx_t_2);
9084   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 475, __pyx_L1_error)
9085   __Pyx_GOTREF(__pyx_t_4);
9086   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9087   __pyx_t_2 = PyNumber_Multiply(__pyx_int_2, __pyx_v_nn); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 475, __pyx_L1_error)
9088   __Pyx_GOTREF(__pyx_t_2);
9089   __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 475, __pyx_L1_error)
9090   __Pyx_GOTREF(__pyx_t_3);
9091   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9092   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 475, __pyx_L1_error)
9093   __Pyx_GOTREF(__pyx_t_2);
9094   __Pyx_GIVEREF(__pyx_t_3);
9095   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
9096   __Pyx_INCREF(__pyx_int_3);
9097   __Pyx_GIVEREF(__pyx_int_3);
9098   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_3);
9099   __pyx_t_3 = 0;
9100   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 475, __pyx_L1_error)
9101   __Pyx_GOTREF(__pyx_t_3);
9102   __Pyx_GIVEREF(__pyx_t_2);
9103   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
9104   __pyx_t_2 = 0;
9105   __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 475, __pyx_L1_error)
9106   __Pyx_GOTREF(__pyx_t_2);
9107   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_n_s_uint64) < 0) __PYX_ERR(1, 475, __pyx_L1_error)
9108   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 475, __pyx_L1_error)
9109   __Pyx_GOTREF(__pyx_t_1);
9110   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9111   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9112   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9113   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 475, __pyx_L1_error)
9114   __pyx_t_7 = ((PyArrayObject *)__pyx_t_1);
9115   {
9116     __Pyx_BufFmt_StackElem __pyx_stack[1];
9117     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind2_n.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
9118       __pyx_v_ind2_n = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ind2_n.rcbuffer->pybuffer.buf = NULL;
9119       __PYX_ERR(1, 475, __pyx_L1_error)
9120     } else {__pyx_pybuffernd_ind2_n.diminfo[0].strides = __pyx_pybuffernd_ind2_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind2_n.diminfo[0].shape = __pyx_pybuffernd_ind2_n.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ind2_n.diminfo[1].strides = __pyx_pybuffernd_ind2_n.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ind2_n.diminfo[1].shape = __pyx_pybuffernd_ind2_n.rcbuffer->pybuffer.shape[1];
9121     }
9122   }
9123   __pyx_t_7 = 0;
9124   __pyx_v_ind2_n = ((PyArrayObject *)__pyx_t_1);
9125   __pyx_t_1 = 0;
9126 
9127   /* "yt/utilities/lib/geometry_utils.pyx":476
9128  *     cdef np.ndarray[np.uint64_t, ndim=2] ind1_n = np.zeros((2*nn+1,3), dtype='uint64')
9129  *     cdef np.ndarray[np.uint64_t, ndim=2] ind2_n = np.zeros((2*nn+1,3), dtype='uint64')
9130  *     cdef np.ndarray[np.uint64_t, ndim=1] neighbors1 = np.zeros((2*nn+1)**3, dtype='uint64')             # <<<<<<<<<<<<<<
9131  *     cdef np.ndarray[np.uint64_t, ndim=1] neighbors2 = np.zeros((2*nn+1)**3, dtype='uint64')
9132  *     cdef bint periodicity[3]
9133  */
9134   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 476, __pyx_L1_error)
9135   __Pyx_GOTREF(__pyx_t_1);
9136   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 476, __pyx_L1_error)
9137   __Pyx_GOTREF(__pyx_t_2);
9138   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9139   __pyx_t_1 = PyNumber_Multiply(__pyx_int_2, __pyx_v_nn); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 476, __pyx_L1_error)
9140   __Pyx_GOTREF(__pyx_t_1);
9141   __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 476, __pyx_L1_error)
9142   __Pyx_GOTREF(__pyx_t_3);
9143   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9144   __pyx_t_1 = PyNumber_Power(__pyx_t_3, __pyx_int_3, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 476, __pyx_L1_error)
9145   __Pyx_GOTREF(__pyx_t_1);
9146   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9147   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 476, __pyx_L1_error)
9148   __Pyx_GOTREF(__pyx_t_3);
9149   __Pyx_GIVEREF(__pyx_t_1);
9150   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
9151   __pyx_t_1 = 0;
9152   __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 476, __pyx_L1_error)
9153   __Pyx_GOTREF(__pyx_t_1);
9154   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_uint64) < 0) __PYX_ERR(1, 476, __pyx_L1_error)
9155   __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 476, __pyx_L1_error)
9156   __Pyx_GOTREF(__pyx_t_4);
9157   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9158   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9159   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9160   if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 476, __pyx_L1_error)
9161   __pyx_t_8 = ((PyArrayObject *)__pyx_t_4);
9162   {
9163     __Pyx_BufFmt_StackElem __pyx_stack[1];
9164     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_neighbors1.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
9165       __pyx_v_neighbors1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_neighbors1.rcbuffer->pybuffer.buf = NULL;
9166       __PYX_ERR(1, 476, __pyx_L1_error)
9167     } else {__pyx_pybuffernd_neighbors1.diminfo[0].strides = __pyx_pybuffernd_neighbors1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_neighbors1.diminfo[0].shape = __pyx_pybuffernd_neighbors1.rcbuffer->pybuffer.shape[0];
9168     }
9169   }
9170   __pyx_t_8 = 0;
9171   __pyx_v_neighbors1 = ((PyArrayObject *)__pyx_t_4);
9172   __pyx_t_4 = 0;
9173 
9174   /* "yt/utilities/lib/geometry_utils.pyx":477
9175  *     cdef np.ndarray[np.uint64_t, ndim=2] ind2_n = np.zeros((2*nn+1,3), dtype='uint64')
9176  *     cdef np.ndarray[np.uint64_t, ndim=1] neighbors1 = np.zeros((2*nn+1)**3, dtype='uint64')
9177  *     cdef np.ndarray[np.uint64_t, ndim=1] neighbors2 = np.zeros((2*nn+1)**3, dtype='uint64')             # <<<<<<<<<<<<<<
9178  *     cdef bint periodicity[3]
9179  *     if periodic:
9180  */
9181   __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 477, __pyx_L1_error)
9182   __Pyx_GOTREF(__pyx_t_4);
9183   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 477, __pyx_L1_error)
9184   __Pyx_GOTREF(__pyx_t_1);
9185   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9186   __pyx_t_4 = PyNumber_Multiply(__pyx_int_2, __pyx_v_nn); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 477, __pyx_L1_error)
9187   __Pyx_GOTREF(__pyx_t_4);
9188   __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_4, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 477, __pyx_L1_error)
9189   __Pyx_GOTREF(__pyx_t_3);
9190   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9191   __pyx_t_4 = PyNumber_Power(__pyx_t_3, __pyx_int_3, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 477, __pyx_L1_error)
9192   __Pyx_GOTREF(__pyx_t_4);
9193   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9194   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 477, __pyx_L1_error)
9195   __Pyx_GOTREF(__pyx_t_3);
9196   __Pyx_GIVEREF(__pyx_t_4);
9197   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
9198   __pyx_t_4 = 0;
9199   __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 477, __pyx_L1_error)
9200   __Pyx_GOTREF(__pyx_t_4);
9201   if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_n_s_uint64) < 0) __PYX_ERR(1, 477, __pyx_L1_error)
9202   __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 477, __pyx_L1_error)
9203   __Pyx_GOTREF(__pyx_t_2);
9204   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9205   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9206   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9207   if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 477, __pyx_L1_error)
9208   __pyx_t_9 = ((PyArrayObject *)__pyx_t_2);
9209   {
9210     __Pyx_BufFmt_StackElem __pyx_stack[1];
9211     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_neighbors2.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
9212       __pyx_v_neighbors2 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_neighbors2.rcbuffer->pybuffer.buf = NULL;
9213       __PYX_ERR(1, 477, __pyx_L1_error)
9214     } else {__pyx_pybuffernd_neighbors2.diminfo[0].strides = __pyx_pybuffernd_neighbors2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_neighbors2.diminfo[0].shape = __pyx_pybuffernd_neighbors2.rcbuffer->pybuffer.shape[0];
9215     }
9216   }
9217   __pyx_t_9 = 0;
9218   __pyx_v_neighbors2 = ((PyArrayObject *)__pyx_t_2);
9219   __pyx_t_2 = 0;
9220 
9221   /* "yt/utilities/lib/geometry_utils.pyx":479
9222  *     cdef np.ndarray[np.uint64_t, ndim=1] neighbors2 = np.zeros((2*nn+1)**3, dtype='uint64')
9223  *     cdef bint periodicity[3]
9224  *     if periodic:             # <<<<<<<<<<<<<<
9225  *         for i in range(3): periodicity[i] = 1
9226  *     else:
9227  */
9228   __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_periodic); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(1, 479, __pyx_L1_error)
9229   if (__pyx_t_10) {
9230 
9231     /* "yt/utilities/lib/geometry_utils.pyx":480
9232  *     cdef bint periodicity[3]
9233  *     if periodic:
9234  *         for i in range(3): periodicity[i] = 1             # <<<<<<<<<<<<<<
9235  *     else:
9236  *         for i in range(3): periodicity[i] = 0
9237  */
9238     for (__pyx_t_11 = 0; __pyx_t_11 < 3; __pyx_t_11+=1) {
9239       __pyx_v_i = __pyx_t_11;
9240       (__pyx_v_periodicity[__pyx_v_i]) = 1;
9241     }
9242 
9243     /* "yt/utilities/lib/geometry_utils.pyx":479
9244  *     cdef np.ndarray[np.uint64_t, ndim=1] neighbors2 = np.zeros((2*nn+1)**3, dtype='uint64')
9245  *     cdef bint periodicity[3]
9246  *     if periodic:             # <<<<<<<<<<<<<<
9247  *         for i in range(3): periodicity[i] = 1
9248  *     else:
9249  */
9250     goto __pyx_L3;
9251   }
9252 
9253   /* "yt/utilities/lib/geometry_utils.pyx":482
9254  *         for i in range(3): periodicity[i] = 1
9255  *     else:
9256  *         for i in range(3): periodicity[i] = 0             # <<<<<<<<<<<<<<
9257  *     ntot = morton_neighbors_refined(mi1, mi2, max_index1, max_index2,
9258  *                                     periodicity, nn,
9259  */
9260   /*else*/ {
9261     for (__pyx_t_11 = 0; __pyx_t_11 < 3; __pyx_t_11+=1) {
9262       __pyx_v_i = __pyx_t_11;
9263       (__pyx_v_periodicity[__pyx_v_i]) = 0;
9264     }
9265   }
9266   __pyx_L3:;
9267 
9268   /* "yt/utilities/lib/geometry_utils.pyx":483
9269  *     else:
9270  *         for i in range(3): periodicity[i] = 0
9271  *     ntot = morton_neighbors_refined(mi1, mi2, max_index1, max_index2,             # <<<<<<<<<<<<<<
9272  *                                     periodicity, nn,
9273  *                                     index, ind1_n, ind2_n,
9274  */
9275   __pyx_t_12 = __Pyx_PyInt_As_npy_uint64(__pyx_v_mi1); if (unlikely((__pyx_t_12 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 483, __pyx_L1_error)
9276   __pyx_t_13 = __Pyx_PyInt_As_npy_uint64(__pyx_v_mi2); if (unlikely((__pyx_t_13 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 483, __pyx_L1_error)
9277   __pyx_t_14 = __Pyx_PyInt_As_npy_uint64(__pyx_v_max_index1); if (unlikely((__pyx_t_14 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 483, __pyx_L1_error)
9278   __pyx_t_15 = __Pyx_PyInt_As_npy_uint64(__pyx_v_max_index2); if (unlikely((__pyx_t_15 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 483, __pyx_L1_error)
9279 
9280   /* "yt/utilities/lib/geometry_utils.pyx":484
9281  *         for i in range(3): periodicity[i] = 0
9282  *     ntot = morton_neighbors_refined(mi1, mi2, max_index1, max_index2,
9283  *                                     periodicity, nn,             # <<<<<<<<<<<<<<
9284  *                                     index, ind1_n, ind2_n,
9285  *                                     neighbors1, neighbors2)
9286  */
9287   __pyx_t_16 = __Pyx_PyInt_As_npy_uint32(__pyx_v_nn); if (unlikely((__pyx_t_16 == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(1, 484, __pyx_L1_error)
9288 
9289   /* "yt/utilities/lib/geometry_utils.pyx":485
9290  *     ntot = morton_neighbors_refined(mi1, mi2, max_index1, max_index2,
9291  *                                     periodicity, nn,
9292  *                                     index, ind1_n, ind2_n,             # <<<<<<<<<<<<<<
9293  *                                     neighbors1, neighbors2)
9294  *     return np.resize(neighbors1, (ntot,)), np.resize(neighbors2, (ntot,))
9295  */
9296   __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_uint32_t(((PyObject *)__pyx_v_index), PyBUF_WRITABLE); if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(1, 485, __pyx_L1_error)
9297   __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_uint64_t(((PyObject *)__pyx_v_ind1_n), PyBUF_WRITABLE); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(1, 485, __pyx_L1_error)
9298   __pyx_t_19 = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_uint64_t(((PyObject *)__pyx_v_ind2_n), PyBUF_WRITABLE); if (unlikely(!__pyx_t_19.memview)) __PYX_ERR(1, 485, __pyx_L1_error)
9299 
9300   /* "yt/utilities/lib/geometry_utils.pyx":486
9301  *                                     periodicity, nn,
9302  *                                     index, ind1_n, ind2_n,
9303  *                                     neighbors1, neighbors2)             # <<<<<<<<<<<<<<
9304  *     return np.resize(neighbors1, (ntot,)), np.resize(neighbors2, (ntot,))
9305  *
9306  */
9307   __pyx_t_20 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_uint64_t(((PyObject *)__pyx_v_neighbors1), PyBUF_WRITABLE); if (unlikely(!__pyx_t_20.memview)) __PYX_ERR(1, 486, __pyx_L1_error)
9308   __pyx_t_21 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_uint64_t(((PyObject *)__pyx_v_neighbors2), PyBUF_WRITABLE); if (unlikely(!__pyx_t_21.memview)) __PYX_ERR(1, 486, __pyx_L1_error)
9309 
9310   /* "yt/utilities/lib/geometry_utils.pyx":483
9311  *     else:
9312  *         for i in range(3): periodicity[i] = 0
9313  *     ntot = morton_neighbors_refined(mi1, mi2, max_index1, max_index2,             # <<<<<<<<<<<<<<
9314  *                                     periodicity, nn,
9315  *                                     index, ind1_n, ind2_n,
9316  */
9317   __pyx_v_ntot = __pyx_f_2yt_9utilities_3lib_14geometry_utils_morton_neighbors_refined(__pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_v_periodicity, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21);
9318   __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
9319   __pyx_t_17.memview = NULL;
9320   __pyx_t_17.data = NULL;
9321   __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
9322   __pyx_t_18.memview = NULL;
9323   __pyx_t_18.data = NULL;
9324   __PYX_XDEC_MEMVIEW(&__pyx_t_19, 1);
9325   __pyx_t_19.memview = NULL;
9326   __pyx_t_19.data = NULL;
9327   __PYX_XDEC_MEMVIEW(&__pyx_t_20, 1);
9328   __pyx_t_20.memview = NULL;
9329   __pyx_t_20.data = NULL;
9330   __PYX_XDEC_MEMVIEW(&__pyx_t_21, 1);
9331   __pyx_t_21.memview = NULL;
9332   __pyx_t_21.data = NULL;
9333 
9334   /* "yt/utilities/lib/geometry_utils.pyx":487
9335  *                                     index, ind1_n, ind2_n,
9336  *                                     neighbors1, neighbors2)
9337  *     return np.resize(neighbors1, (ntot,)), np.resize(neighbors2, (ntot,))             # <<<<<<<<<<<<<<
9338  *
9339  * @cython.cdivision(True)
9340  */
9341   __Pyx_XDECREF(__pyx_r);
9342   __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 487, __pyx_L1_error)
9343   __Pyx_GOTREF(__pyx_t_4);
9344   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_resize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 487, __pyx_L1_error)
9345   __Pyx_GOTREF(__pyx_t_3);
9346   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9347   __pyx_t_4 = __Pyx_PyInt_From_npy_uint32(__pyx_v_ntot); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 487, __pyx_L1_error)
9348   __Pyx_GOTREF(__pyx_t_4);
9349   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 487, __pyx_L1_error)
9350   __Pyx_GOTREF(__pyx_t_1);
9351   __Pyx_GIVEREF(__pyx_t_4);
9352   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
9353   __pyx_t_4 = 0;
9354   __pyx_t_4 = NULL;
9355   __pyx_t_11 = 0;
9356   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
9357     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
9358     if (likely(__pyx_t_4)) {
9359       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
9360       __Pyx_INCREF(__pyx_t_4);
9361       __Pyx_INCREF(function);
9362       __Pyx_DECREF_SET(__pyx_t_3, function);
9363       __pyx_t_11 = 1;
9364     }
9365   }
9366   #if CYTHON_FAST_PYCALL
9367   if (PyFunction_Check(__pyx_t_3)) {
9368     PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_neighbors1), __pyx_t_1};
9369     __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 487, __pyx_L1_error)
9370     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9371     __Pyx_GOTREF(__pyx_t_2);
9372     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9373   } else
9374   #endif
9375   #if CYTHON_FAST_PYCCALL
9376   if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
9377     PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_neighbors1), __pyx_t_1};
9378     __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 487, __pyx_L1_error)
9379     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9380     __Pyx_GOTREF(__pyx_t_2);
9381     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9382   } else
9383   #endif
9384   {
9385     __pyx_t_22 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_22)) __PYX_ERR(1, 487, __pyx_L1_error)
9386     __Pyx_GOTREF(__pyx_t_22);
9387     if (__pyx_t_4) {
9388       __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_4); __pyx_t_4 = NULL;
9389     }
9390     __Pyx_INCREF(((PyObject *)__pyx_v_neighbors1));
9391     __Pyx_GIVEREF(((PyObject *)__pyx_v_neighbors1));
9392     PyTuple_SET_ITEM(__pyx_t_22, 0+__pyx_t_11, ((PyObject *)__pyx_v_neighbors1));
9393     __Pyx_GIVEREF(__pyx_t_1);
9394     PyTuple_SET_ITEM(__pyx_t_22, 1+__pyx_t_11, __pyx_t_1);
9395     __pyx_t_1 = 0;
9396     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_22, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 487, __pyx_L1_error)
9397     __Pyx_GOTREF(__pyx_t_2);
9398     __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
9399   }
9400   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9401   __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_np); if (unlikely(!__pyx_t_22)) __PYX_ERR(1, 487, __pyx_L1_error)
9402   __Pyx_GOTREF(__pyx_t_22);
9403   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_22, __pyx_n_s_resize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 487, __pyx_L1_error)
9404   __Pyx_GOTREF(__pyx_t_1);
9405   __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
9406   __pyx_t_22 = __Pyx_PyInt_From_npy_uint32(__pyx_v_ntot); if (unlikely(!__pyx_t_22)) __PYX_ERR(1, 487, __pyx_L1_error)
9407   __Pyx_GOTREF(__pyx_t_22);
9408   __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 487, __pyx_L1_error)
9409   __Pyx_GOTREF(__pyx_t_4);
9410   __Pyx_GIVEREF(__pyx_t_22);
9411   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_22);
9412   __pyx_t_22 = 0;
9413   __pyx_t_22 = NULL;
9414   __pyx_t_11 = 0;
9415   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
9416     __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_1);
9417     if (likely(__pyx_t_22)) {
9418       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
9419       __Pyx_INCREF(__pyx_t_22);
9420       __Pyx_INCREF(function);
9421       __Pyx_DECREF_SET(__pyx_t_1, function);
9422       __pyx_t_11 = 1;
9423     }
9424   }
9425   #if CYTHON_FAST_PYCALL
9426   if (PyFunction_Check(__pyx_t_1)) {
9427     PyObject *__pyx_temp[3] = {__pyx_t_22, ((PyObject *)__pyx_v_neighbors2), __pyx_t_4};
9428     __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 487, __pyx_L1_error)
9429     __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
9430     __Pyx_GOTREF(__pyx_t_3);
9431     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9432   } else
9433   #endif
9434   #if CYTHON_FAST_PYCCALL
9435   if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
9436     PyObject *__pyx_temp[3] = {__pyx_t_22, ((PyObject *)__pyx_v_neighbors2), __pyx_t_4};
9437     __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 487, __pyx_L1_error)
9438     __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
9439     __Pyx_GOTREF(__pyx_t_3);
9440     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9441   } else
9442   #endif
9443   {
9444     __pyx_t_23 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_23)) __PYX_ERR(1, 487, __pyx_L1_error)
9445     __Pyx_GOTREF(__pyx_t_23);
9446     if (__pyx_t_22) {
9447       __Pyx_GIVEREF(__pyx_t_22); PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_22); __pyx_t_22 = NULL;
9448     }
9449     __Pyx_INCREF(((PyObject *)__pyx_v_neighbors2));
9450     __Pyx_GIVEREF(((PyObject *)__pyx_v_neighbors2));
9451     PyTuple_SET_ITEM(__pyx_t_23, 0+__pyx_t_11, ((PyObject *)__pyx_v_neighbors2));
9452     __Pyx_GIVEREF(__pyx_t_4);
9453     PyTuple_SET_ITEM(__pyx_t_23, 1+__pyx_t_11, __pyx_t_4);
9454     __pyx_t_4 = 0;
9455     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_23, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 487, __pyx_L1_error)
9456     __Pyx_GOTREF(__pyx_t_3);
9457     __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
9458   }
9459   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9460   __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 487, __pyx_L1_error)
9461   __Pyx_GOTREF(__pyx_t_1);
9462   __Pyx_GIVEREF(__pyx_t_2);
9463   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
9464   __Pyx_GIVEREF(__pyx_t_3);
9465   PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
9466   __pyx_t_2 = 0;
9467   __pyx_t_3 = 0;
9468   __pyx_r = __pyx_t_1;
9469   __pyx_t_1 = 0;
9470   goto __pyx_L0;
9471 
9472   /* "yt/utilities/lib/geometry_utils.pyx":470
9473  * @cython.boundscheck(False)
9474  * @cython.wraparound(False)
9475  * def get_morton_neighbors_refined(mi1, mi2, max_index1, max_index2, periodic, nn):             # <<<<<<<<<<<<<<
9476  *     cdef int i
9477  *     cdef np.uint32_t ntot
9478  */
9479 
9480   /* function exit code */
9481   __pyx_L1_error:;
9482   __Pyx_XDECREF(__pyx_t_1);
9483   __Pyx_XDECREF(__pyx_t_2);
9484   __Pyx_XDECREF(__pyx_t_3);
9485   __Pyx_XDECREF(__pyx_t_4);
9486   __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
9487   __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
9488   __PYX_XDEC_MEMVIEW(&__pyx_t_19, 1);
9489   __PYX_XDEC_MEMVIEW(&__pyx_t_20, 1);
9490   __PYX_XDEC_MEMVIEW(&__pyx_t_21, 1);
9491   __Pyx_XDECREF(__pyx_t_22);
9492   __Pyx_XDECREF(__pyx_t_23);
9493   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
9494     __Pyx_PyThreadState_declare
9495     __Pyx_PyThreadState_assign
9496     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
9497     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind1_n.rcbuffer->pybuffer);
9498     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind2_n.rcbuffer->pybuffer);
9499     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
9500     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighbors1.rcbuffer->pybuffer);
9501     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighbors2.rcbuffer->pybuffer);
9502   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
9503   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.get_morton_neighbors_refined", __pyx_clineno, __pyx_lineno, __pyx_filename);
9504   __pyx_r = NULL;
9505   goto __pyx_L2;
9506   __pyx_L0:;
9507   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind1_n.rcbuffer->pybuffer);
9508   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind2_n.rcbuffer->pybuffer);
9509   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_index.rcbuffer->pybuffer);
9510   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighbors1.rcbuffer->pybuffer);
9511   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighbors2.rcbuffer->pybuffer);
9512   __pyx_L2:;
9513   __Pyx_XDECREF((PyObject *)__pyx_v_index);
9514   __Pyx_XDECREF((PyObject *)__pyx_v_ind1_n);
9515   __Pyx_XDECREF((PyObject *)__pyx_v_ind2_n);
9516   __Pyx_XDECREF((PyObject *)__pyx_v_neighbors1);
9517   __Pyx_XDECREF((PyObject *)__pyx_v_neighbors2);
9518   __Pyx_XGIVEREF(__pyx_r);
9519   __Pyx_RefNannyFinishContext();
9520   return __pyx_r;
9521 }
9522 
9523 /* "yt/utilities/lib/geometry_utils.pyx":492
9524  * @cython.boundscheck(False)
9525  * @cython.wraparound(False)
9526  * cdef np.uint32_t morton_neighbors_refined(np.uint64_t mi1, np.uint64_t mi2,             # <<<<<<<<<<<<<<
9527  *                                           np.uint64_t max_index1, np.uint64_t max_index2,
9528  *                                           bint periodicity[3], np.uint32_t nn,
9529  */
9530 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_morton_neighbors_refined(__pyx_t_5numpy_uint64_t __pyx_v_mi1,__pyx_t_5numpy_uint64_t __pyx_v_mi2,__pyx_t_5numpy_uint64_t __pyx_v_max_index1,__pyx_t_5numpy_uint64_t __pyx_v_max_index2,int * __pyx_v_periodicity,__pyx_t_5numpy_uint32_t __pyx_v_nn,__Pyx_memviewslice __pyx_v_index,__Pyx_memviewslice __pyx_v_ind1_n,__Pyx_memviewslice __pyx_v_ind2_n,__Pyx_memviewslice __pyx_v_neighbors1,__Pyx_memviewslice __pyx_v_neighbors2)9531 static __pyx_t_5numpy_uint32_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_morton_neighbors_refined(__pyx_t_5numpy_uint64_t __pyx_v_mi1, __pyx_t_5numpy_uint64_t __pyx_v_mi2, __pyx_t_5numpy_uint64_t __pyx_v_max_index1, __pyx_t_5numpy_uint64_t __pyx_v_max_index2, int *__pyx_v_periodicity, __pyx_t_5numpy_uint32_t __pyx_v_nn, __Pyx_memviewslice __pyx_v_index, __Pyx_memviewslice __pyx_v_ind1_n, __Pyx_memviewslice __pyx_v_ind2_n, __Pyx_memviewslice __pyx_v_neighbors1, __Pyx_memviewslice __pyx_v_neighbors2) {
9532   __pyx_t_5numpy_uint32_t __pyx_v_ntot;
9533   __pyx_t_5numpy_uint64_t __pyx_v_ind1[3];
9534   __pyx_t_5numpy_uint64_t __pyx_v_ind2[3];
9535   __pyx_t_5numpy_uint32_t __pyx_v_count[3];
9536   __pyx_t_5numpy_uint32_t __pyx_v_origin[3];
9537   __pyx_t_5numpy_int64_t __pyx_v_adv;
9538   __pyx_t_5numpy_int64_t __pyx_v_maj;
9539   __pyx_t_5numpy_int64_t __pyx_v_rem;
9540   __pyx_t_5numpy_int64_t __pyx_v_adv1;
9541   int __pyx_v_i;
9542   int __pyx_v_j;
9543   int __pyx_v_k;
9544   int __pyx_v_ii;
9545   int __pyx_v_ij;
9546   int __pyx_v_ik;
9547   __pyx_t_5numpy_uint32_t __pyx_r;
9548   __Pyx_RefNannyDeclarations
9549   int __pyx_t_1;
9550   long __pyx_t_2;
9551   long __pyx_t_3;
9552   int __pyx_t_4;
9553   int __pyx_t_5;
9554   int __pyx_t_6;
9555   Py_ssize_t __pyx_t_7;
9556   Py_ssize_t __pyx_t_8;
9557   Py_ssize_t __pyx_t_9;
9558   Py_ssize_t __pyx_t_10;
9559   size_t __pyx_t_11;
9560   Py_ssize_t __pyx_t_12;
9561   int __pyx_t_13;
9562   Py_ssize_t __pyx_t_14;
9563   Py_ssize_t __pyx_t_15;
9564   Py_ssize_t __pyx_t_16;
9565   Py_ssize_t __pyx_t_17;
9566   Py_ssize_t __pyx_t_18;
9567   Py_ssize_t __pyx_t_19;
9568   Py_ssize_t __pyx_t_20;
9569   Py_ssize_t __pyx_t_21;
9570   Py_ssize_t __pyx_t_22;
9571   Py_ssize_t __pyx_t_23;
9572   Py_ssize_t __pyx_t_24;
9573   Py_ssize_t __pyx_t_25;
9574   Py_ssize_t __pyx_t_26;
9575   Py_ssize_t __pyx_t_27;
9576   Py_ssize_t __pyx_t_28;
9577   Py_ssize_t __pyx_t_29;
9578   size_t __pyx_t_30;
9579   Py_ssize_t __pyx_t_31;
9580   __pyx_t_5numpy_uint32_t __pyx_t_32;
9581   __pyx_t_5numpy_uint32_t __pyx_t_33;
9582   Py_ssize_t __pyx_t_34;
9583   Py_ssize_t __pyx_t_35;
9584   __pyx_t_5numpy_uint32_t __pyx_t_36;
9585   __pyx_t_5numpy_uint32_t __pyx_t_37;
9586   Py_ssize_t __pyx_t_38;
9587   Py_ssize_t __pyx_t_39;
9588   __pyx_t_5numpy_uint32_t __pyx_t_40;
9589   __pyx_t_5numpy_uint32_t __pyx_t_41;
9590   Py_ssize_t __pyx_t_42;
9591   Py_ssize_t __pyx_t_43;
9592   int __pyx_t_44;
9593   Py_ssize_t __pyx_t_45;
9594   Py_ssize_t __pyx_t_46;
9595   Py_ssize_t __pyx_t_47;
9596   Py_ssize_t __pyx_t_48;
9597   Py_ssize_t __pyx_t_49;
9598   Py_ssize_t __pyx_t_50;
9599   size_t __pyx_t_51;
9600   Py_ssize_t __pyx_t_52;
9601   Py_ssize_t __pyx_t_53;
9602   Py_ssize_t __pyx_t_54;
9603   Py_ssize_t __pyx_t_55;
9604   Py_ssize_t __pyx_t_56;
9605   Py_ssize_t __pyx_t_57;
9606   size_t __pyx_t_58;
9607   __Pyx_RefNannySetupContext("morton_neighbors_refined", 0);
9608 
9609   /* "yt/utilities/lib/geometry_utils.pyx":500
9610  *                                           np.uint64_t[:] neighbors1,
9611  *                                           np.uint64_t[:] neighbors2):
9612  *     cdef np.uint32_t ntot = 0             # <<<<<<<<<<<<<<
9613  *     cdef np.uint64_t ind1[3]
9614  *     cdef np.uint64_t ind2[3]
9615  */
9616   __pyx_v_ntot = 0;
9617 
9618   /* "yt/utilities/lib/geometry_utils.pyx":507
9619  *     cdef np.int64_t adv, maj, rem, adv1
9620  *     cdef int i, j, k, ii, ij, ik
9621  *     for i in range(3):             # <<<<<<<<<<<<<<
9622  *         count[i] = 0
9623  *         origin[i] = 0
9624  */
9625   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
9626     __pyx_v_i = __pyx_t_1;
9627 
9628     /* "yt/utilities/lib/geometry_utils.pyx":508
9629  *     cdef int i, j, k, ii, ij, ik
9630  *     for i in range(3):
9631  *         count[i] = 0             # <<<<<<<<<<<<<<
9632  *         origin[i] = 0
9633  *     # Get indices
9634  */
9635     (__pyx_v_count[__pyx_v_i]) = 0;
9636 
9637     /* "yt/utilities/lib/geometry_utils.pyx":509
9638  *     for i in range(3):
9639  *         count[i] = 0
9640  *         origin[i] = 0             # <<<<<<<<<<<<<<
9641  *     # Get indices
9642  *     decode_morton_64bit(mi1,ind1)
9643  */
9644     (__pyx_v_origin[__pyx_v_i]) = 0;
9645   }
9646 
9647   /* "yt/utilities/lib/geometry_utils.pyx":511
9648  *         origin[i] = 0
9649  *     # Get indices
9650  *     decode_morton_64bit(mi1,ind1)             # <<<<<<<<<<<<<<
9651  *     decode_morton_64bit(mi2,ind2)
9652  *     # Determine which directions are valid
9653  */
9654   __pyx_f_2yt_9utilities_3lib_14geometry_utils_decode_morton_64bit(__pyx_v_mi1, __pyx_v_ind1);
9655 
9656   /* "yt/utilities/lib/geometry_utils.pyx":512
9657  *     # Get indices
9658  *     decode_morton_64bit(mi1,ind1)
9659  *     decode_morton_64bit(mi2,ind2)             # <<<<<<<<<<<<<<
9660  *     # Determine which directions are valid
9661  *     for j,i in enumerate(range(-nn,(nn+1))):
9662  */
9663   __pyx_f_2yt_9utilities_3lib_14geometry_utils_decode_morton_64bit(__pyx_v_mi2, __pyx_v_ind2);
9664 
9665   /* "yt/utilities/lib/geometry_utils.pyx":514
9666  *     decode_morton_64bit(mi2,ind2)
9667  *     # Determine which directions are valid
9668  *     for j,i in enumerate(range(-nn,(nn+1))):             # <<<<<<<<<<<<<<
9669  *         if i == 0:
9670  *             for k in range(3):
9671  */
9672   __pyx_t_1 = 0;
9673   __pyx_t_2 = (__pyx_v_nn + 1);
9674   __pyx_t_3 = __pyx_t_2;
9675   for (__pyx_t_4 = (-__pyx_v_nn); __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
9676     __pyx_v_i = __pyx_t_4;
9677     __pyx_v_j = __pyx_t_1;
9678     __pyx_t_1 = (__pyx_t_1 + 1);
9679 
9680     /* "yt/utilities/lib/geometry_utils.pyx":515
9681  *     # Determine which directions are valid
9682  *     for j,i in enumerate(range(-nn,(nn+1))):
9683  *         if i == 0:             # <<<<<<<<<<<<<<
9684  *             for k in range(3):
9685  *                 ind1_n[j,k] = ind1[k]
9686  */
9687     __pyx_t_5 = ((__pyx_v_i == 0) != 0);
9688     if (__pyx_t_5) {
9689 
9690       /* "yt/utilities/lib/geometry_utils.pyx":516
9691  *     for j,i in enumerate(range(-nn,(nn+1))):
9692  *         if i == 0:
9693  *             for k in range(3):             # <<<<<<<<<<<<<<
9694  *                 ind1_n[j,k] = ind1[k]
9695  *                 ind2_n[j,k] = ind2[k]
9696  */
9697       for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) {
9698         __pyx_v_k = __pyx_t_6;
9699 
9700         /* "yt/utilities/lib/geometry_utils.pyx":517
9701  *         if i == 0:
9702  *             for k in range(3):
9703  *                 ind1_n[j,k] = ind1[k]             # <<<<<<<<<<<<<<
9704  *                 ind2_n[j,k] = ind2[k]
9705  *                 index[count[k],k] = j
9706  */
9707         __pyx_t_7 = __pyx_v_j;
9708         __pyx_t_8 = __pyx_v_k;
9709         *((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind1_n.data + __pyx_t_7 * __pyx_v_ind1_n.strides[0]) ) + __pyx_t_8 * __pyx_v_ind1_n.strides[1]) )) = (__pyx_v_ind1[__pyx_v_k]);
9710 
9711         /* "yt/utilities/lib/geometry_utils.pyx":518
9712  *             for k in range(3):
9713  *                 ind1_n[j,k] = ind1[k]
9714  *                 ind2_n[j,k] = ind2[k]             # <<<<<<<<<<<<<<
9715  *                 index[count[k],k] = j
9716  *                 origin[k] = count[k]
9717  */
9718         __pyx_t_9 = __pyx_v_j;
9719         __pyx_t_10 = __pyx_v_k;
9720         *((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind2_n.data + __pyx_t_9 * __pyx_v_ind2_n.strides[0]) ) + __pyx_t_10 * __pyx_v_ind2_n.strides[1]) )) = (__pyx_v_ind2[__pyx_v_k]);
9721 
9722         /* "yt/utilities/lib/geometry_utils.pyx":519
9723  *                 ind1_n[j,k] = ind1[k]
9724  *                 ind2_n[j,k] = ind2[k]
9725  *                 index[count[k],k] = j             # <<<<<<<<<<<<<<
9726  *                 origin[k] = count[k]
9727  *                 count[k] += 1
9728  */
9729         __pyx_t_11 = (__pyx_v_count[__pyx_v_k]);
9730         __pyx_t_12 = __pyx_v_k;
9731         *((__pyx_t_5numpy_uint32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_index.data + __pyx_t_11 * __pyx_v_index.strides[0]) ) + __pyx_t_12 * __pyx_v_index.strides[1]) )) = __pyx_v_j;
9732 
9733         /* "yt/utilities/lib/geometry_utils.pyx":520
9734  *                 ind2_n[j,k] = ind2[k]
9735  *                 index[count[k],k] = j
9736  *                 origin[k] = count[k]             # <<<<<<<<<<<<<<
9737  *                 count[k] += 1
9738  *         else:
9739  */
9740         (__pyx_v_origin[__pyx_v_k]) = (__pyx_v_count[__pyx_v_k]);
9741 
9742         /* "yt/utilities/lib/geometry_utils.pyx":521
9743  *                 index[count[k],k] = j
9744  *                 origin[k] = count[k]
9745  *                 count[k] += 1             # <<<<<<<<<<<<<<
9746  *         else:
9747  *             for k in range(3):
9748  */
9749         __pyx_t_13 = __pyx_v_k;
9750         (__pyx_v_count[__pyx_t_13]) = ((__pyx_v_count[__pyx_t_13]) + 1);
9751       }
9752 
9753       /* "yt/utilities/lib/geometry_utils.pyx":515
9754  *     # Determine which directions are valid
9755  *     for j,i in enumerate(range(-nn,(nn+1))):
9756  *         if i == 0:             # <<<<<<<<<<<<<<
9757  *             for k in range(3):
9758  *                 ind1_n[j,k] = ind1[k]
9759  */
9760       goto __pyx_L7;
9761     }
9762 
9763     /* "yt/utilities/lib/geometry_utils.pyx":523
9764  *                 count[k] += 1
9765  *         else:
9766  *             for k in range(3):             # <<<<<<<<<<<<<<
9767  *                 adv = <np.int64_t>(ind2[k] + i)
9768  *                 maj = adv / (<np.int64_t>max_index2)
9769  */
9770     /*else*/ {
9771       for (__pyx_t_6 = 0; __pyx_t_6 < 3; __pyx_t_6+=1) {
9772         __pyx_v_k = __pyx_t_6;
9773 
9774         /* "yt/utilities/lib/geometry_utils.pyx":524
9775  *         else:
9776  *             for k in range(3):
9777  *                 adv = <np.int64_t>(ind2[k] + i)             # <<<<<<<<<<<<<<
9778  *                 maj = adv / (<np.int64_t>max_index2)
9779  *                 rem = adv % (<np.int64_t>max_index2)
9780  */
9781         __pyx_v_adv = ((__pyx_t_5numpy_int64_t)((__pyx_v_ind2[__pyx_v_k]) + __pyx_v_i));
9782 
9783         /* "yt/utilities/lib/geometry_utils.pyx":525
9784  *             for k in range(3):
9785  *                 adv = <np.int64_t>(ind2[k] + i)
9786  *                 maj = adv / (<np.int64_t>max_index2)             # <<<<<<<<<<<<<<
9787  *                 rem = adv % (<np.int64_t>max_index2)
9788  *                 if adv < 0:
9789  */
9790         __pyx_v_maj = (__pyx_v_adv / ((__pyx_t_5numpy_int64_t)__pyx_v_max_index2));
9791 
9792         /* "yt/utilities/lib/geometry_utils.pyx":526
9793  *                 adv = <np.int64_t>(ind2[k] + i)
9794  *                 maj = adv / (<np.int64_t>max_index2)
9795  *                 rem = adv % (<np.int64_t>max_index2)             # <<<<<<<<<<<<<<
9796  *                 if adv < 0:
9797  *                     adv1 = <np.int64_t>(ind1[k] + (maj-1))
9798  */
9799         __pyx_v_rem = (__pyx_v_adv % ((__pyx_t_5numpy_int64_t)__pyx_v_max_index2));
9800 
9801         /* "yt/utilities/lib/geometry_utils.pyx":527
9802  *                 maj = adv / (<np.int64_t>max_index2)
9803  *                 rem = adv % (<np.int64_t>max_index2)
9804  *                 if adv < 0:             # <<<<<<<<<<<<<<
9805  *                     adv1 = <np.int64_t>(ind1[k] + (maj-1))
9806  *                     if adv1 < 0:
9807  */
9808         __pyx_t_5 = ((__pyx_v_adv < 0) != 0);
9809         if (__pyx_t_5) {
9810 
9811           /* "yt/utilities/lib/geometry_utils.pyx":528
9812  *                 rem = adv % (<np.int64_t>max_index2)
9813  *                 if adv < 0:
9814  *                     adv1 = <np.int64_t>(ind1[k] + (maj-1))             # <<<<<<<<<<<<<<
9815  *                     if adv1 < 0:
9816  *                         if periodicity[k]:
9817  */
9818           __pyx_v_adv1 = ((__pyx_t_5numpy_int64_t)((__pyx_v_ind1[__pyx_v_k]) + (__pyx_v_maj - 1)));
9819 
9820           /* "yt/utilities/lib/geometry_utils.pyx":529
9821  *                 if adv < 0:
9822  *                     adv1 = <np.int64_t>(ind1[k] + (maj-1))
9823  *                     if adv1 < 0:             # <<<<<<<<<<<<<<
9824  *                         if periodicity[k]:
9825  *                             while adv1 < 0:
9826  */
9827           __pyx_t_5 = ((__pyx_v_adv1 < 0) != 0);
9828           if (__pyx_t_5) {
9829 
9830             /* "yt/utilities/lib/geometry_utils.pyx":530
9831  *                     adv1 = <np.int64_t>(ind1[k] + (maj-1))
9832  *                     if adv1 < 0:
9833  *                         if periodicity[k]:             # <<<<<<<<<<<<<<
9834  *                             while adv1 < 0:
9835  *                                 adv1 += max_index1
9836  */
9837             __pyx_t_5 = ((__pyx_v_periodicity[__pyx_v_k]) != 0);
9838             if (__pyx_t_5) {
9839 
9840               /* "yt/utilities/lib/geometry_utils.pyx":531
9841  *                     if adv1 < 0:
9842  *                         if periodicity[k]:
9843  *                             while adv1 < 0:             # <<<<<<<<<<<<<<
9844  *                                 adv1 += max_index1
9845  *                             ind1_n[j,k] = <np.uint64_t>adv1
9846  */
9847               while (1) {
9848                 __pyx_t_5 = ((__pyx_v_adv1 < 0) != 0);
9849                 if (!__pyx_t_5) break;
9850 
9851                 /* "yt/utilities/lib/geometry_utils.pyx":532
9852  *                         if periodicity[k]:
9853  *                             while adv1 < 0:
9854  *                                 adv1 += max_index1             # <<<<<<<<<<<<<<
9855  *                             ind1_n[j,k] = <np.uint64_t>adv1
9856  *                         else:
9857  */
9858                 __pyx_v_adv1 = (__pyx_v_adv1 + __pyx_v_max_index1);
9859               }
9860 
9861               /* "yt/utilities/lib/geometry_utils.pyx":533
9862  *                             while adv1 < 0:
9863  *                                 adv1 += max_index1
9864  *                             ind1_n[j,k] = <np.uint64_t>adv1             # <<<<<<<<<<<<<<
9865  *                         else:
9866  *                             continue
9867  */
9868               __pyx_t_14 = __pyx_v_j;
9869               __pyx_t_15 = __pyx_v_k;
9870               *((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind1_n.data + __pyx_t_14 * __pyx_v_ind1_n.strides[0]) ) + __pyx_t_15 * __pyx_v_ind1_n.strides[1]) )) = ((__pyx_t_5numpy_uint64_t)__pyx_v_adv1);
9871 
9872               /* "yt/utilities/lib/geometry_utils.pyx":530
9873  *                     adv1 = <np.int64_t>(ind1[k] + (maj-1))
9874  *                     if adv1 < 0:
9875  *                         if periodicity[k]:             # <<<<<<<<<<<<<<
9876  *                             while adv1 < 0:
9877  *                                 adv1 += max_index1
9878  */
9879               goto __pyx_L14;
9880             }
9881 
9882             /* "yt/utilities/lib/geometry_utils.pyx":535
9883  *                             ind1_n[j,k] = <np.uint64_t>adv1
9884  *                         else:
9885  *                             continue             # <<<<<<<<<<<<<<
9886  *                     else:
9887  *                         ind1_n[j,k] = <np.uint64_t>adv1
9888  */
9889             /*else*/ {
9890               goto __pyx_L10_continue;
9891             }
9892             __pyx_L14:;
9893 
9894             /* "yt/utilities/lib/geometry_utils.pyx":529
9895  *                 if adv < 0:
9896  *                     adv1 = <np.int64_t>(ind1[k] + (maj-1))
9897  *                     if adv1 < 0:             # <<<<<<<<<<<<<<
9898  *                         if periodicity[k]:
9899  *                             while adv1 < 0:
9900  */
9901             goto __pyx_L13;
9902           }
9903 
9904           /* "yt/utilities/lib/geometry_utils.pyx":537
9905  *                             continue
9906  *                     else:
9907  *                         ind1_n[j,k] = <np.uint64_t>adv1             # <<<<<<<<<<<<<<
9908  *                     while adv < 0:
9909  *                         adv += max_index2
9910  */
9911           /*else*/ {
9912             __pyx_t_16 = __pyx_v_j;
9913             __pyx_t_17 = __pyx_v_k;
9914             *((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind1_n.data + __pyx_t_16 * __pyx_v_ind1_n.strides[0]) ) + __pyx_t_17 * __pyx_v_ind1_n.strides[1]) )) = ((__pyx_t_5numpy_uint64_t)__pyx_v_adv1);
9915           }
9916           __pyx_L13:;
9917 
9918           /* "yt/utilities/lib/geometry_utils.pyx":538
9919  *                     else:
9920  *                         ind1_n[j,k] = <np.uint64_t>adv1
9921  *                     while adv < 0:             # <<<<<<<<<<<<<<
9922  *                         adv += max_index2
9923  *                     ind2_n[j,k] = <np.uint64_t>adv
9924  */
9925           while (1) {
9926             __pyx_t_5 = ((__pyx_v_adv < 0) != 0);
9927             if (!__pyx_t_5) break;
9928 
9929             /* "yt/utilities/lib/geometry_utils.pyx":539
9930  *                         ind1_n[j,k] = <np.uint64_t>adv1
9931  *                     while adv < 0:
9932  *                         adv += max_index2             # <<<<<<<<<<<<<<
9933  *                     ind2_n[j,k] = <np.uint64_t>adv
9934  *                 elif adv >= max_index2:
9935  */
9936             __pyx_v_adv = (__pyx_v_adv + __pyx_v_max_index2);
9937           }
9938 
9939           /* "yt/utilities/lib/geometry_utils.pyx":540
9940  *                     while adv < 0:
9941  *                         adv += max_index2
9942  *                     ind2_n[j,k] = <np.uint64_t>adv             # <<<<<<<<<<<<<<
9943  *                 elif adv >= max_index2:
9944  *                     adv1 = <np.int64_t>(ind1[k] + maj)
9945  */
9946           __pyx_t_18 = __pyx_v_j;
9947           __pyx_t_19 = __pyx_v_k;
9948           *((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind2_n.data + __pyx_t_18 * __pyx_v_ind2_n.strides[0]) ) + __pyx_t_19 * __pyx_v_ind2_n.strides[1]) )) = ((__pyx_t_5numpy_uint64_t)__pyx_v_adv);
9949 
9950           /* "yt/utilities/lib/geometry_utils.pyx":527
9951  *                 maj = adv / (<np.int64_t>max_index2)
9952  *                 rem = adv % (<np.int64_t>max_index2)
9953  *                 if adv < 0:             # <<<<<<<<<<<<<<
9954  *                     adv1 = <np.int64_t>(ind1[k] + (maj-1))
9955  *                     if adv1 < 0:
9956  */
9957           goto __pyx_L12;
9958         }
9959 
9960         /* "yt/utilities/lib/geometry_utils.pyx":541
9961  *                         adv += max_index2
9962  *                     ind2_n[j,k] = <np.uint64_t>adv
9963  *                 elif adv >= max_index2:             # <<<<<<<<<<<<<<
9964  *                     adv1 = <np.int64_t>(ind1[k] + maj)
9965  *                     if adv1 >= max_index1:
9966  */
9967         __pyx_t_5 = ((__pyx_v_adv >= __pyx_v_max_index2) != 0);
9968         if (__pyx_t_5) {
9969 
9970           /* "yt/utilities/lib/geometry_utils.pyx":542
9971  *                     ind2_n[j,k] = <np.uint64_t>adv
9972  *                 elif adv >= max_index2:
9973  *                     adv1 = <np.int64_t>(ind1[k] + maj)             # <<<<<<<<<<<<<<
9974  *                     if adv1 >= max_index1:
9975  *                         if periodicity[k]:
9976  */
9977           __pyx_v_adv1 = ((__pyx_t_5numpy_int64_t)((__pyx_v_ind1[__pyx_v_k]) + __pyx_v_maj));
9978 
9979           /* "yt/utilities/lib/geometry_utils.pyx":543
9980  *                 elif adv >= max_index2:
9981  *                     adv1 = <np.int64_t>(ind1[k] + maj)
9982  *                     if adv1 >= max_index1:             # <<<<<<<<<<<<<<
9983  *                         if periodicity[k]:
9984  *                             ind1_n[j,k] = <np.uint64_t>(adv1 % <np.int64_t>max_index1)
9985  */
9986           __pyx_t_5 = ((__pyx_v_adv1 >= __pyx_v_max_index1) != 0);
9987           if (__pyx_t_5) {
9988 
9989             /* "yt/utilities/lib/geometry_utils.pyx":544
9990  *                     adv1 = <np.int64_t>(ind1[k] + maj)
9991  *                     if adv1 >= max_index1:
9992  *                         if periodicity[k]:             # <<<<<<<<<<<<<<
9993  *                             ind1_n[j,k] = <np.uint64_t>(adv1 % <np.int64_t>max_index1)
9994  *                         else:
9995  */
9996             __pyx_t_5 = ((__pyx_v_periodicity[__pyx_v_k]) != 0);
9997             if (__pyx_t_5) {
9998 
9999               /* "yt/utilities/lib/geometry_utils.pyx":545
10000  *                     if adv1 >= max_index1:
10001  *                         if periodicity[k]:
10002  *                             ind1_n[j,k] = <np.uint64_t>(adv1 % <np.int64_t>max_index1)             # <<<<<<<<<<<<<<
10003  *                         else:
10004  *                             continue
10005  */
10006               __pyx_t_20 = __pyx_v_j;
10007               __pyx_t_21 = __pyx_v_k;
10008               *((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind1_n.data + __pyx_t_20 * __pyx_v_ind1_n.strides[0]) ) + __pyx_t_21 * __pyx_v_ind1_n.strides[1]) )) = ((__pyx_t_5numpy_uint64_t)(__pyx_v_adv1 % ((__pyx_t_5numpy_int64_t)__pyx_v_max_index1)));
10009 
10010               /* "yt/utilities/lib/geometry_utils.pyx":544
10011  *                     adv1 = <np.int64_t>(ind1[k] + maj)
10012  *                     if adv1 >= max_index1:
10013  *                         if periodicity[k]:             # <<<<<<<<<<<<<<
10014  *                             ind1_n[j,k] = <np.uint64_t>(adv1 % <np.int64_t>max_index1)
10015  *                         else:
10016  */
10017               goto __pyx_L20;
10018             }
10019 
10020             /* "yt/utilities/lib/geometry_utils.pyx":547
10021  *                             ind1_n[j,k] = <np.uint64_t>(adv1 % <np.int64_t>max_index1)
10022  *                         else:
10023  *                             continue             # <<<<<<<<<<<<<<
10024  *                     else:
10025  *                         ind1_n[j,k] = <np.uint64_t>adv1
10026  */
10027             /*else*/ {
10028               goto __pyx_L10_continue;
10029             }
10030             __pyx_L20:;
10031 
10032             /* "yt/utilities/lib/geometry_utils.pyx":543
10033  *                 elif adv >= max_index2:
10034  *                     adv1 = <np.int64_t>(ind1[k] + maj)
10035  *                     if adv1 >= max_index1:             # <<<<<<<<<<<<<<
10036  *                         if periodicity[k]:
10037  *                             ind1_n[j,k] = <np.uint64_t>(adv1 % <np.int64_t>max_index1)
10038  */
10039             goto __pyx_L19;
10040           }
10041 
10042           /* "yt/utilities/lib/geometry_utils.pyx":549
10043  *                             continue
10044  *                     else:
10045  *                         ind1_n[j,k] = <np.uint64_t>adv1             # <<<<<<<<<<<<<<
10046  *                     ind2_n[j,k] = <np.uint64_t>rem
10047  *                 else:
10048  */
10049           /*else*/ {
10050             __pyx_t_22 = __pyx_v_j;
10051             __pyx_t_23 = __pyx_v_k;
10052             *((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind1_n.data + __pyx_t_22 * __pyx_v_ind1_n.strides[0]) ) + __pyx_t_23 * __pyx_v_ind1_n.strides[1]) )) = ((__pyx_t_5numpy_uint64_t)__pyx_v_adv1);
10053           }
10054           __pyx_L19:;
10055 
10056           /* "yt/utilities/lib/geometry_utils.pyx":550
10057  *                     else:
10058  *                         ind1_n[j,k] = <np.uint64_t>adv1
10059  *                     ind2_n[j,k] = <np.uint64_t>rem             # <<<<<<<<<<<<<<
10060  *                 else:
10061  *                     ind1_n[j,k] = ind1[k]
10062  */
10063           __pyx_t_24 = __pyx_v_j;
10064           __pyx_t_25 = __pyx_v_k;
10065           *((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind2_n.data + __pyx_t_24 * __pyx_v_ind2_n.strides[0]) ) + __pyx_t_25 * __pyx_v_ind2_n.strides[1]) )) = ((__pyx_t_5numpy_uint64_t)__pyx_v_rem);
10066 
10067           /* "yt/utilities/lib/geometry_utils.pyx":541
10068  *                         adv += max_index2
10069  *                     ind2_n[j,k] = <np.uint64_t>adv
10070  *                 elif adv >= max_index2:             # <<<<<<<<<<<<<<
10071  *                     adv1 = <np.int64_t>(ind1[k] + maj)
10072  *                     if adv1 >= max_index1:
10073  */
10074           goto __pyx_L12;
10075         }
10076 
10077         /* "yt/utilities/lib/geometry_utils.pyx":552
10078  *                     ind2_n[j,k] = <np.uint64_t>rem
10079  *                 else:
10080  *                     ind1_n[j,k] = ind1[k]             # <<<<<<<<<<<<<<
10081  *                     ind2_n[j,k] = <np.uint64_t>(adv)
10082  *                 index[count[k],k] = j
10083  */
10084         /*else*/ {
10085           __pyx_t_26 = __pyx_v_j;
10086           __pyx_t_27 = __pyx_v_k;
10087           *((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind1_n.data + __pyx_t_26 * __pyx_v_ind1_n.strides[0]) ) + __pyx_t_27 * __pyx_v_ind1_n.strides[1]) )) = (__pyx_v_ind1[__pyx_v_k]);
10088 
10089           /* "yt/utilities/lib/geometry_utils.pyx":553
10090  *                 else:
10091  *                     ind1_n[j,k] = ind1[k]
10092  *                     ind2_n[j,k] = <np.uint64_t>(adv)             # <<<<<<<<<<<<<<
10093  *                 index[count[k],k] = j
10094  *                 count[k] += 1
10095  */
10096           __pyx_t_28 = __pyx_v_j;
10097           __pyx_t_29 = __pyx_v_k;
10098           *((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind2_n.data + __pyx_t_28 * __pyx_v_ind2_n.strides[0]) ) + __pyx_t_29 * __pyx_v_ind2_n.strides[1]) )) = ((__pyx_t_5numpy_uint64_t)__pyx_v_adv);
10099         }
10100         __pyx_L12:;
10101 
10102         /* "yt/utilities/lib/geometry_utils.pyx":554
10103  *                     ind1_n[j,k] = ind1[k]
10104  *                     ind2_n[j,k] = <np.uint64_t>(adv)
10105  *                 index[count[k],k] = j             # <<<<<<<<<<<<<<
10106  *                 count[k] += 1
10107  *     # Iterate over ever combinations
10108  */
10109         __pyx_t_30 = (__pyx_v_count[__pyx_v_k]);
10110         __pyx_t_31 = __pyx_v_k;
10111         *((__pyx_t_5numpy_uint32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_index.data + __pyx_t_30 * __pyx_v_index.strides[0]) ) + __pyx_t_31 * __pyx_v_index.strides[1]) )) = __pyx_v_j;
10112 
10113         /* "yt/utilities/lib/geometry_utils.pyx":555
10114  *                     ind2_n[j,k] = <np.uint64_t>(adv)
10115  *                 index[count[k],k] = j
10116  *                 count[k] += 1             # <<<<<<<<<<<<<<
10117  *     # Iterate over ever combinations
10118  *     for ii in range(count[0]):
10119  */
10120         __pyx_t_13 = __pyx_v_k;
10121         (__pyx_v_count[__pyx_t_13]) = ((__pyx_v_count[__pyx_t_13]) + 1);
10122         __pyx_L10_continue:;
10123       }
10124     }
10125     __pyx_L7:;
10126   }
10127 
10128   /* "yt/utilities/lib/geometry_utils.pyx":557
10129  *                 count[k] += 1
10130  *     # Iterate over ever combinations
10131  *     for ii in range(count[0]):             # <<<<<<<<<<<<<<
10132  *         i = index[ii,0]
10133  *         for ij in range(count[1]):
10134  */
10135   __pyx_t_32 = (__pyx_v_count[0]);
10136   __pyx_t_33 = __pyx_t_32;
10137   for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_33; __pyx_t_1+=1) {
10138     __pyx_v_ii = __pyx_t_1;
10139 
10140     /* "yt/utilities/lib/geometry_utils.pyx":558
10141  *     # Iterate over ever combinations
10142  *     for ii in range(count[0]):
10143  *         i = index[ii,0]             # <<<<<<<<<<<<<<
10144  *         for ij in range(count[1]):
10145  *             j = index[ij,1]
10146  */
10147     __pyx_t_34 = __pyx_v_ii;
10148     __pyx_t_35 = 0;
10149     __pyx_v_i = (*((__pyx_t_5numpy_uint32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_index.data + __pyx_t_34 * __pyx_v_index.strides[0]) ) + __pyx_t_35 * __pyx_v_index.strides[1]) )));
10150 
10151     /* "yt/utilities/lib/geometry_utils.pyx":559
10152  *     for ii in range(count[0]):
10153  *         i = index[ii,0]
10154  *         for ij in range(count[1]):             # <<<<<<<<<<<<<<
10155  *             j = index[ij,1]
10156  *             for ik in range(count[2]):
10157  */
10158     __pyx_t_36 = (__pyx_v_count[1]);
10159     __pyx_t_37 = __pyx_t_36;
10160     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_37; __pyx_t_4+=1) {
10161       __pyx_v_ij = __pyx_t_4;
10162 
10163       /* "yt/utilities/lib/geometry_utils.pyx":560
10164  *         i = index[ii,0]
10165  *         for ij in range(count[1]):
10166  *             j = index[ij,1]             # <<<<<<<<<<<<<<
10167  *             for ik in range(count[2]):
10168  *                 k = index[ik,2]
10169  */
10170       __pyx_t_38 = __pyx_v_ij;
10171       __pyx_t_39 = 1;
10172       __pyx_v_j = (*((__pyx_t_5numpy_uint32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_index.data + __pyx_t_38 * __pyx_v_index.strides[0]) ) + __pyx_t_39 * __pyx_v_index.strides[1]) )));
10173 
10174       /* "yt/utilities/lib/geometry_utils.pyx":561
10175  *         for ij in range(count[1]):
10176  *             j = index[ij,1]
10177  *             for ik in range(count[2]):             # <<<<<<<<<<<<<<
10178  *                 k = index[ik,2]
10179  *                 if (ii != origin[0]) or (ij != origin[1]) or (ik != origin[2]):
10180  */
10181       __pyx_t_40 = (__pyx_v_count[2]);
10182       __pyx_t_41 = __pyx_t_40;
10183       for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_41; __pyx_t_6+=1) {
10184         __pyx_v_ik = __pyx_t_6;
10185 
10186         /* "yt/utilities/lib/geometry_utils.pyx":562
10187  *             j = index[ij,1]
10188  *             for ik in range(count[2]):
10189  *                 k = index[ik,2]             # <<<<<<<<<<<<<<
10190  *                 if (ii != origin[0]) or (ij != origin[1]) or (ik != origin[2]):
10191  *                     neighbors1[ntot] = encode_morton_64bit(ind1_n[i,0],
10192  */
10193         __pyx_t_42 = __pyx_v_ik;
10194         __pyx_t_43 = 2;
10195         __pyx_v_k = (*((__pyx_t_5numpy_uint32_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_index.data + __pyx_t_42 * __pyx_v_index.strides[0]) ) + __pyx_t_43 * __pyx_v_index.strides[1]) )));
10196 
10197         /* "yt/utilities/lib/geometry_utils.pyx":563
10198  *             for ik in range(count[2]):
10199  *                 k = index[ik,2]
10200  *                 if (ii != origin[0]) or (ij != origin[1]) or (ik != origin[2]):             # <<<<<<<<<<<<<<
10201  *                     neighbors1[ntot] = encode_morton_64bit(ind1_n[i,0],
10202  *                                                            ind1_n[j,1],
10203  */
10204         __pyx_t_44 = ((__pyx_v_ii != (__pyx_v_origin[0])) != 0);
10205         if (!__pyx_t_44) {
10206         } else {
10207           __pyx_t_5 = __pyx_t_44;
10208           goto __pyx_L28_bool_binop_done;
10209         }
10210         __pyx_t_44 = ((__pyx_v_ij != (__pyx_v_origin[1])) != 0);
10211         if (!__pyx_t_44) {
10212         } else {
10213           __pyx_t_5 = __pyx_t_44;
10214           goto __pyx_L28_bool_binop_done;
10215         }
10216         __pyx_t_44 = ((__pyx_v_ik != (__pyx_v_origin[2])) != 0);
10217         __pyx_t_5 = __pyx_t_44;
10218         __pyx_L28_bool_binop_done:;
10219         if (__pyx_t_5) {
10220 
10221           /* "yt/utilities/lib/geometry_utils.pyx":564
10222  *                 k = index[ik,2]
10223  *                 if (ii != origin[0]) or (ij != origin[1]) or (ik != origin[2]):
10224  *                     neighbors1[ntot] = encode_morton_64bit(ind1_n[i,0],             # <<<<<<<<<<<<<<
10225  *                                                            ind1_n[j,1],
10226  *                                                            ind1_n[k,2])
10227  */
10228           __pyx_t_45 = __pyx_v_i;
10229           __pyx_t_46 = 0;
10230 
10231           /* "yt/utilities/lib/geometry_utils.pyx":565
10232  *                 if (ii != origin[0]) or (ij != origin[1]) or (ik != origin[2]):
10233  *                     neighbors1[ntot] = encode_morton_64bit(ind1_n[i,0],
10234  *                                                            ind1_n[j,1],             # <<<<<<<<<<<<<<
10235  *                                                            ind1_n[k,2])
10236  *                     neighbors2[ntot] = encode_morton_64bit(ind2_n[i,0],
10237  */
10238           __pyx_t_47 = __pyx_v_j;
10239           __pyx_t_48 = 1;
10240 
10241           /* "yt/utilities/lib/geometry_utils.pyx":566
10242  *                     neighbors1[ntot] = encode_morton_64bit(ind1_n[i,0],
10243  *                                                            ind1_n[j,1],
10244  *                                                            ind1_n[k,2])             # <<<<<<<<<<<<<<
10245  *                     neighbors2[ntot] = encode_morton_64bit(ind2_n[i,0],
10246  *                                                            ind2_n[j,1],
10247  */
10248           __pyx_t_49 = __pyx_v_k;
10249           __pyx_t_50 = 2;
10250 
10251           /* "yt/utilities/lib/geometry_utils.pyx":564
10252  *                 k = index[ik,2]
10253  *                 if (ii != origin[0]) or (ij != origin[1]) or (ik != origin[2]):
10254  *                     neighbors1[ntot] = encode_morton_64bit(ind1_n[i,0],             # <<<<<<<<<<<<<<
10255  *                                                            ind1_n[j,1],
10256  *                                                            ind1_n[k,2])
10257  */
10258           __pyx_t_51 = __pyx_v_ntot;
10259           *((__pyx_t_5numpy_uint64_t *) ( /* dim=0 */ (__pyx_v_neighbors1.data + __pyx_t_51 * __pyx_v_neighbors1.strides[0]) )) = __pyx_f_2yt_9utilities_3lib_14geometry_utils_encode_morton_64bit((*((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind1_n.data + __pyx_t_45 * __pyx_v_ind1_n.strides[0]) ) + __pyx_t_46 * __pyx_v_ind1_n.strides[1]) ))), (*((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind1_n.data + __pyx_t_47 * __pyx_v_ind1_n.strides[0]) ) + __pyx_t_48 * __pyx_v_ind1_n.strides[1]) ))), (*((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind1_n.data + __pyx_t_49 * __pyx_v_ind1_n.strides[0]) ) + __pyx_t_50 * __pyx_v_ind1_n.strides[1]) ))));
10260 
10261           /* "yt/utilities/lib/geometry_utils.pyx":567
10262  *                                                            ind1_n[j,1],
10263  *                                                            ind1_n[k,2])
10264  *                     neighbors2[ntot] = encode_morton_64bit(ind2_n[i,0],             # <<<<<<<<<<<<<<
10265  *                                                            ind2_n[j,1],
10266  *                                                            ind2_n[k,2])
10267  */
10268           __pyx_t_52 = __pyx_v_i;
10269           __pyx_t_53 = 0;
10270 
10271           /* "yt/utilities/lib/geometry_utils.pyx":568
10272  *                                                            ind1_n[k,2])
10273  *                     neighbors2[ntot] = encode_morton_64bit(ind2_n[i,0],
10274  *                                                            ind2_n[j,1],             # <<<<<<<<<<<<<<
10275  *                                                            ind2_n[k,2])
10276  *                     ntot += 1
10277  */
10278           __pyx_t_54 = __pyx_v_j;
10279           __pyx_t_55 = 1;
10280 
10281           /* "yt/utilities/lib/geometry_utils.pyx":569
10282  *                     neighbors2[ntot] = encode_morton_64bit(ind2_n[i,0],
10283  *                                                            ind2_n[j,1],
10284  *                                                            ind2_n[k,2])             # <<<<<<<<<<<<<<
10285  *                     ntot += 1
10286  *     return ntot
10287  */
10288           __pyx_t_56 = __pyx_v_k;
10289           __pyx_t_57 = 2;
10290 
10291           /* "yt/utilities/lib/geometry_utils.pyx":567
10292  *                                                            ind1_n[j,1],
10293  *                                                            ind1_n[k,2])
10294  *                     neighbors2[ntot] = encode_morton_64bit(ind2_n[i,0],             # <<<<<<<<<<<<<<
10295  *                                                            ind2_n[j,1],
10296  *                                                            ind2_n[k,2])
10297  */
10298           __pyx_t_58 = __pyx_v_ntot;
10299           *((__pyx_t_5numpy_uint64_t *) ( /* dim=0 */ (__pyx_v_neighbors2.data + __pyx_t_58 * __pyx_v_neighbors2.strides[0]) )) = __pyx_f_2yt_9utilities_3lib_14geometry_utils_encode_morton_64bit((*((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind2_n.data + __pyx_t_52 * __pyx_v_ind2_n.strides[0]) ) + __pyx_t_53 * __pyx_v_ind2_n.strides[1]) ))), (*((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind2_n.data + __pyx_t_54 * __pyx_v_ind2_n.strides[0]) ) + __pyx_t_55 * __pyx_v_ind2_n.strides[1]) ))), (*((__pyx_t_5numpy_uint64_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_ind2_n.data + __pyx_t_56 * __pyx_v_ind2_n.strides[0]) ) + __pyx_t_57 * __pyx_v_ind2_n.strides[1]) ))));
10300 
10301           /* "yt/utilities/lib/geometry_utils.pyx":570
10302  *                                                            ind2_n[j,1],
10303  *                                                            ind2_n[k,2])
10304  *                     ntot += 1             # <<<<<<<<<<<<<<
10305  *     return ntot
10306  *
10307  */
10308           __pyx_v_ntot = (__pyx_v_ntot + 1);
10309 
10310           /* "yt/utilities/lib/geometry_utils.pyx":563
10311  *             for ik in range(count[2]):
10312  *                 k = index[ik,2]
10313  *                 if (ii != origin[0]) or (ij != origin[1]) or (ik != origin[2]):             # <<<<<<<<<<<<<<
10314  *                     neighbors1[ntot] = encode_morton_64bit(ind1_n[i,0],
10315  *                                                            ind1_n[j,1],
10316  */
10317         }
10318       }
10319     }
10320   }
10321 
10322   /* "yt/utilities/lib/geometry_utils.pyx":571
10323  *                                                            ind2_n[k,2])
10324  *                     ntot += 1
10325  *     return ntot             # <<<<<<<<<<<<<<
10326  *
10327  * @cython.cdivision(True)
10328  */
10329   __pyx_r = __pyx_v_ntot;
10330   goto __pyx_L0;
10331 
10332   /* "yt/utilities/lib/geometry_utils.pyx":492
10333  * @cython.boundscheck(False)
10334  * @cython.wraparound(False)
10335  * cdef np.uint32_t morton_neighbors_refined(np.uint64_t mi1, np.uint64_t mi2,             # <<<<<<<<<<<<<<
10336  *                                           np.uint64_t max_index1, np.uint64_t max_index2,
10337  *                                           bint periodicity[3], np.uint32_t nn,
10338  */
10339 
10340   /* function exit code */
10341   __pyx_L0:;
10342   __Pyx_RefNannyFinishContext();
10343   return __pyx_r;
10344 }
10345 
10346 /* "yt/utilities/lib/geometry_utils.pyx":576
10347  * @cython.boundscheck(False)
10348  * @cython.wraparound(False)
10349  * def morton_neighbor_periodic(np.ndarray[np.uint64_t,ndim=1] p,             # <<<<<<<<<<<<<<
10350  *                              list dim_list, list num_list,
10351  *                              np.uint64_t max_index):
10352  */
10353 
10354 /* Python wrapper */
10355 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_29morton_neighbor_periodic(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
10356 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_29morton_neighbor_periodic = {"morton_neighbor_periodic", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_29morton_neighbor_periodic, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_29morton_neighbor_periodic(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)10357 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_29morton_neighbor_periodic(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10358   PyArrayObject *__pyx_v_p = 0;
10359   PyObject *__pyx_v_dim_list = 0;
10360   PyObject *__pyx_v_num_list = 0;
10361   __pyx_t_5numpy_uint64_t __pyx_v_max_index;
10362   PyObject *__pyx_r = 0;
10363   __Pyx_RefNannyDeclarations
10364   __Pyx_RefNannySetupContext("morton_neighbor_periodic (wrapper)", 0);
10365   {
10366     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_dim_list,&__pyx_n_s_num_list,&__pyx_n_s_max_index,0};
10367     PyObject* values[4] = {0,0,0,0};
10368     if (unlikely(__pyx_kwds)) {
10369       Py_ssize_t kw_args;
10370       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
10371       switch (pos_args) {
10372         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10373         CYTHON_FALLTHROUGH;
10374         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10375         CYTHON_FALLTHROUGH;
10376         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10377         CYTHON_FALLTHROUGH;
10378         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10379         CYTHON_FALLTHROUGH;
10380         case  0: break;
10381         default: goto __pyx_L5_argtuple_error;
10382       }
10383       kw_args = PyDict_Size(__pyx_kwds);
10384       switch (pos_args) {
10385         case  0:
10386         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
10387         else goto __pyx_L5_argtuple_error;
10388         CYTHON_FALLTHROUGH;
10389         case  1:
10390         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dim_list)) != 0)) kw_args--;
10391         else {
10392           __Pyx_RaiseArgtupleInvalid("morton_neighbor_periodic", 1, 4, 4, 1); __PYX_ERR(1, 576, __pyx_L3_error)
10393         }
10394         CYTHON_FALLTHROUGH;
10395         case  2:
10396         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_list)) != 0)) kw_args--;
10397         else {
10398           __Pyx_RaiseArgtupleInvalid("morton_neighbor_periodic", 1, 4, 4, 2); __PYX_ERR(1, 576, __pyx_L3_error)
10399         }
10400         CYTHON_FALLTHROUGH;
10401         case  3:
10402         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_index)) != 0)) kw_args--;
10403         else {
10404           __Pyx_RaiseArgtupleInvalid("morton_neighbor_periodic", 1, 4, 4, 3); __PYX_ERR(1, 576, __pyx_L3_error)
10405         }
10406       }
10407       if (unlikely(kw_args > 0)) {
10408         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "morton_neighbor_periodic") < 0)) __PYX_ERR(1, 576, __pyx_L3_error)
10409       }
10410     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
10411       goto __pyx_L5_argtuple_error;
10412     } else {
10413       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10414       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10415       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10416       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10417     }
10418     __pyx_v_p = ((PyArrayObject *)values[0]);
10419     __pyx_v_dim_list = ((PyObject*)values[1]);
10420     __pyx_v_num_list = ((PyObject*)values[2]);
10421     __pyx_v_max_index = __Pyx_PyInt_As_npy_uint64(values[3]); if (unlikely((__pyx_v_max_index == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 578, __pyx_L3_error)
10422   }
10423   goto __pyx_L4_argument_unpacking_done;
10424   __pyx_L5_argtuple_error:;
10425   __Pyx_RaiseArgtupleInvalid("morton_neighbor_periodic", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 576, __pyx_L3_error)
10426   __pyx_L3_error:;
10427   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_neighbor_periodic", __pyx_clineno, __pyx_lineno, __pyx_filename);
10428   __Pyx_RefNannyFinishContext();
10429   return NULL;
10430   __pyx_L4_argument_unpacking_done:;
10431   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5numpy_ndarray, 1, "p", 0))) __PYX_ERR(1, 576, __pyx_L1_error)
10432   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dim_list), (&PyList_Type), 1, "dim_list", 1))) __PYX_ERR(1, 577, __pyx_L1_error)
10433   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_num_list), (&PyList_Type), 1, "num_list", 1))) __PYX_ERR(1, 577, __pyx_L1_error)
10434   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_28morton_neighbor_periodic(__pyx_self, __pyx_v_p, __pyx_v_dim_list, __pyx_v_num_list, __pyx_v_max_index);
10435 
10436   /* function exit code */
10437   goto __pyx_L0;
10438   __pyx_L1_error:;
10439   __pyx_r = NULL;
10440   __pyx_L0:;
10441   __Pyx_RefNannyFinishContext();
10442   return __pyx_r;
10443 }
10444 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_28morton_neighbor_periodic(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_p,PyObject * __pyx_v_dim_list,PyObject * __pyx_v_num_list,__pyx_t_5numpy_uint64_t __pyx_v_max_index)10445 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_28morton_neighbor_periodic(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_p, PyObject *__pyx_v_dim_list, PyObject *__pyx_v_num_list, __pyx_t_5numpy_uint64_t __pyx_v_max_index) {
10446   __pyx_t_5numpy_uint64_t __pyx_v_p1[3];
10447   int __pyx_v_j;
10448   int __pyx_v_dim;
10449   int __pyx_v_num;
10450   __Pyx_LocalBuf_ND __pyx_pybuffernd_p;
10451   __Pyx_Buffer __pyx_pybuffer_p;
10452   PyObject *__pyx_r = NULL;
10453   __Pyx_RefNannyDeclarations
10454   int __pyx_t_1;
10455   PyObject *__pyx_t_2 = NULL;
10456   PyObject *__pyx_t_3 = NULL;
10457   PyObject *__pyx_t_4 = NULL;
10458   Py_ssize_t __pyx_t_5;
10459   PyObject *__pyx_t_6 = NULL;
10460   __pyx_t_5numpy_uint64_t __pyx_t_7;
10461   Py_ssize_t __pyx_t_8;
10462   PyObject *(*__pyx_t_9)(PyObject *);
10463   PyObject *__pyx_t_10 = NULL;
10464   PyObject *(*__pyx_t_11)(PyObject *);
10465   int __pyx_t_12;
10466   PyObject *__pyx_t_13 = NULL;
10467   Py_ssize_t __pyx_t_14;
10468   PyObject *__pyx_t_15 = NULL;
10469   __Pyx_RefNannySetupContext("morton_neighbor_periodic", 0);
10470   __pyx_pybuffer_p.pybuffer.buf = NULL;
10471   __pyx_pybuffer_p.refcount = 0;
10472   __pyx_pybuffernd_p.data = NULL;
10473   __pyx_pybuffernd_p.rcbuffer = &__pyx_pybuffer_p;
10474   {
10475     __Pyx_BufFmt_StackElem __pyx_stack[1];
10476     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_p.rcbuffer->pybuffer, (PyObject*)__pyx_v_p, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 576, __pyx_L1_error)
10477   }
10478   __pyx_pybuffernd_p.diminfo[0].strides = __pyx_pybuffernd_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_p.diminfo[0].shape = __pyx_pybuffernd_p.rcbuffer->pybuffer.shape[0];
10479 
10480   /* "yt/utilities/lib/geometry_utils.pyx":581
10481  *     cdef np.uint64_t p1[3]
10482  *     cdef int j, dim, num
10483  *     for j in range(3):             # <<<<<<<<<<<<<<
10484  *         p1[j] = np.uint64(p[j])
10485  *     for dim,num in zip(dim_list,num_list):
10486  */
10487   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
10488     __pyx_v_j = __pyx_t_1;
10489 
10490     /* "yt/utilities/lib/geometry_utils.pyx":582
10491  *     cdef int j, dim, num
10492  *     for j in range(3):
10493  *         p1[j] = np.uint64(p[j])             # <<<<<<<<<<<<<<
10494  *     for dim,num in zip(dim_list,num_list):
10495  *         p1[dim] = np.uint64((np.int64(p[dim]) + num) % max_index)
10496  */
10497     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 582, __pyx_L1_error)
10498     __Pyx_GOTREF(__pyx_t_3);
10499     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint64); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 582, __pyx_L1_error)
10500     __Pyx_GOTREF(__pyx_t_4);
10501     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10502     __pyx_t_5 = __pyx_v_j;
10503     __pyx_t_3 = __Pyx_PyInt_From_npy_uint64((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_p.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_p.diminfo[0].strides))); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 582, __pyx_L1_error)
10504     __Pyx_GOTREF(__pyx_t_3);
10505     __pyx_t_6 = NULL;
10506     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
10507       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
10508       if (likely(__pyx_t_6)) {
10509         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
10510         __Pyx_INCREF(__pyx_t_6);
10511         __Pyx_INCREF(function);
10512         __Pyx_DECREF_SET(__pyx_t_4, function);
10513       }
10514     }
10515     __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
10516     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
10517     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10518     if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 582, __pyx_L1_error)
10519     __Pyx_GOTREF(__pyx_t_2);
10520     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10521     __pyx_t_7 = __Pyx_PyInt_As_npy_uint64(__pyx_t_2); if (unlikely((__pyx_t_7 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 582, __pyx_L1_error)
10522     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10523     (__pyx_v_p1[__pyx_v_j]) = __pyx_t_7;
10524   }
10525 
10526   /* "yt/utilities/lib/geometry_utils.pyx":583
10527  *     for j in range(3):
10528  *         p1[j] = np.uint64(p[j])
10529  *     for dim,num in zip(dim_list,num_list):             # <<<<<<<<<<<<<<
10530  *         p1[dim] = np.uint64((np.int64(p[dim]) + num) % max_index)
10531  *     return np.int64(point_to_morton(p1))
10532  */
10533   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 583, __pyx_L1_error)
10534   __Pyx_GOTREF(__pyx_t_2);
10535   __Pyx_INCREF(__pyx_v_dim_list);
10536   __Pyx_GIVEREF(__pyx_v_dim_list);
10537   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_dim_list);
10538   __Pyx_INCREF(__pyx_v_num_list);
10539   __Pyx_GIVEREF(__pyx_v_num_list);
10540   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_num_list);
10541   __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 583, __pyx_L1_error)
10542   __Pyx_GOTREF(__pyx_t_4);
10543   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10544   if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
10545     __pyx_t_2 = __pyx_t_4; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0;
10546     __pyx_t_9 = NULL;
10547   } else {
10548     __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 583, __pyx_L1_error)
10549     __Pyx_GOTREF(__pyx_t_2);
10550     __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 583, __pyx_L1_error)
10551   }
10552   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10553   for (;;) {
10554     if (likely(!__pyx_t_9)) {
10555       if (likely(PyList_CheckExact(__pyx_t_2))) {
10556         if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
10557         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10558         __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(1, 583, __pyx_L1_error)
10559         #else
10560         __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 583, __pyx_L1_error)
10561         __Pyx_GOTREF(__pyx_t_4);
10562         #endif
10563       } else {
10564         if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
10565         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10566         __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(1, 583, __pyx_L1_error)
10567         #else
10568         __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 583, __pyx_L1_error)
10569         __Pyx_GOTREF(__pyx_t_4);
10570         #endif
10571       }
10572     } else {
10573       __pyx_t_4 = __pyx_t_9(__pyx_t_2);
10574       if (unlikely(!__pyx_t_4)) {
10575         PyObject* exc_type = PyErr_Occurred();
10576         if (exc_type) {
10577           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
10578           else __PYX_ERR(1, 583, __pyx_L1_error)
10579         }
10580         break;
10581       }
10582       __Pyx_GOTREF(__pyx_t_4);
10583     }
10584     if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
10585       PyObject* sequence = __pyx_t_4;
10586       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
10587       if (unlikely(size != 2)) {
10588         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
10589         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
10590         __PYX_ERR(1, 583, __pyx_L1_error)
10591       }
10592       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10593       if (likely(PyTuple_CheckExact(sequence))) {
10594         __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
10595         __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
10596       } else {
10597         __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
10598         __pyx_t_6 = PyList_GET_ITEM(sequence, 1);
10599       }
10600       __Pyx_INCREF(__pyx_t_3);
10601       __Pyx_INCREF(__pyx_t_6);
10602       #else
10603       __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 583, __pyx_L1_error)
10604       __Pyx_GOTREF(__pyx_t_3);
10605       __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 583, __pyx_L1_error)
10606       __Pyx_GOTREF(__pyx_t_6);
10607       #endif
10608       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10609     } else {
10610       Py_ssize_t index = -1;
10611       __pyx_t_10 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 583, __pyx_L1_error)
10612       __Pyx_GOTREF(__pyx_t_10);
10613       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10614       __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
10615       index = 0; __pyx_t_3 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L7_unpacking_failed;
10616       __Pyx_GOTREF(__pyx_t_3);
10617       index = 1; __pyx_t_6 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_6)) goto __pyx_L7_unpacking_failed;
10618       __Pyx_GOTREF(__pyx_t_6);
10619       if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(1, 583, __pyx_L1_error)
10620       __pyx_t_11 = NULL;
10621       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
10622       goto __pyx_L8_unpacking_done;
10623       __pyx_L7_unpacking_failed:;
10624       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
10625       __pyx_t_11 = NULL;
10626       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
10627       __PYX_ERR(1, 583, __pyx_L1_error)
10628       __pyx_L8_unpacking_done:;
10629     }
10630     __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 583, __pyx_L1_error)
10631     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10632     __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 583, __pyx_L1_error)
10633     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10634     __pyx_v_dim = __pyx_t_1;
10635     __pyx_v_num = __pyx_t_12;
10636 
10637     /* "yt/utilities/lib/geometry_utils.pyx":584
10638  *         p1[j] = np.uint64(p[j])
10639  *     for dim,num in zip(dim_list,num_list):
10640  *         p1[dim] = np.uint64((np.int64(p[dim]) + num) % max_index)             # <<<<<<<<<<<<<<
10641  *     return np.int64(point_to_morton(p1))
10642  *
10643  */
10644     __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 584, __pyx_L1_error)
10645     __Pyx_GOTREF(__pyx_t_6);
10646     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint64); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 584, __pyx_L1_error)
10647     __Pyx_GOTREF(__pyx_t_3);
10648     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10649     __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 584, __pyx_L1_error)
10650     __Pyx_GOTREF(__pyx_t_10);
10651     __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_int64); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 584, __pyx_L1_error)
10652     __Pyx_GOTREF(__pyx_t_13);
10653     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
10654     __pyx_t_14 = __pyx_v_dim;
10655     __pyx_t_10 = __Pyx_PyInt_From_npy_uint64((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_p.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_p.diminfo[0].strides))); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 584, __pyx_L1_error)
10656     __Pyx_GOTREF(__pyx_t_10);
10657     __pyx_t_15 = NULL;
10658     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
10659       __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_13);
10660       if (likely(__pyx_t_15)) {
10661         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
10662         __Pyx_INCREF(__pyx_t_15);
10663         __Pyx_INCREF(function);
10664         __Pyx_DECREF_SET(__pyx_t_13, function);
10665       }
10666     }
10667     __pyx_t_6 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_15, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_10);
10668     __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
10669     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
10670     if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 584, __pyx_L1_error)
10671     __Pyx_GOTREF(__pyx_t_6);
10672     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
10673     __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_num); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 584, __pyx_L1_error)
10674     __Pyx_GOTREF(__pyx_t_13);
10675     __pyx_t_10 = PyNumber_Add(__pyx_t_6, __pyx_t_13); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 584, __pyx_L1_error)
10676     __Pyx_GOTREF(__pyx_t_10);
10677     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10678     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
10679     __pyx_t_13 = __Pyx_PyInt_From_npy_uint64(__pyx_v_max_index); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 584, __pyx_L1_error)
10680     __Pyx_GOTREF(__pyx_t_13);
10681     __pyx_t_6 = PyNumber_Remainder(__pyx_t_10, __pyx_t_13); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 584, __pyx_L1_error)
10682     __Pyx_GOTREF(__pyx_t_6);
10683     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
10684     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
10685     __pyx_t_13 = NULL;
10686     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
10687       __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_3);
10688       if (likely(__pyx_t_13)) {
10689         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
10690         __Pyx_INCREF(__pyx_t_13);
10691         __Pyx_INCREF(function);
10692         __Pyx_DECREF_SET(__pyx_t_3, function);
10693       }
10694     }
10695     __pyx_t_4 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_13, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6);
10696     __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
10697     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10698     if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 584, __pyx_L1_error)
10699     __Pyx_GOTREF(__pyx_t_4);
10700     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10701     __pyx_t_7 = __Pyx_PyInt_As_npy_uint64(__pyx_t_4); if (unlikely((__pyx_t_7 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 584, __pyx_L1_error)
10702     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10703     (__pyx_v_p1[__pyx_v_dim]) = __pyx_t_7;
10704 
10705     /* "yt/utilities/lib/geometry_utils.pyx":583
10706  *     for j in range(3):
10707  *         p1[j] = np.uint64(p[j])
10708  *     for dim,num in zip(dim_list,num_list):             # <<<<<<<<<<<<<<
10709  *         p1[dim] = np.uint64((np.int64(p[dim]) + num) % max_index)
10710  *     return np.int64(point_to_morton(p1))
10711  */
10712   }
10713   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10714 
10715   /* "yt/utilities/lib/geometry_utils.pyx":585
10716  *     for dim,num in zip(dim_list,num_list):
10717  *         p1[dim] = np.uint64((np.int64(p[dim]) + num) % max_index)
10718  *     return np.int64(point_to_morton(p1))             # <<<<<<<<<<<<<<
10719  *
10720  * @cython.cdivision(True)
10721  */
10722   __Pyx_XDECREF(__pyx_r);
10723   __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 585, __pyx_L1_error)
10724   __Pyx_GOTREF(__pyx_t_4);
10725   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int64); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 585, __pyx_L1_error)
10726   __Pyx_GOTREF(__pyx_t_3);
10727   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10728   __pyx_t_4 = __Pyx_PyInt_From_npy_uint64(__pyx_f_2yt_9utilities_3lib_14geometry_utils_point_to_morton(__pyx_v_p1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 585, __pyx_L1_error)
10729   __Pyx_GOTREF(__pyx_t_4);
10730   __pyx_t_6 = NULL;
10731   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
10732     __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
10733     if (likely(__pyx_t_6)) {
10734       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
10735       __Pyx_INCREF(__pyx_t_6);
10736       __Pyx_INCREF(function);
10737       __Pyx_DECREF_SET(__pyx_t_3, function);
10738     }
10739   }
10740   __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
10741   __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
10742   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10743   if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 585, __pyx_L1_error)
10744   __Pyx_GOTREF(__pyx_t_2);
10745   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10746   __pyx_r = __pyx_t_2;
10747   __pyx_t_2 = 0;
10748   goto __pyx_L0;
10749 
10750   /* "yt/utilities/lib/geometry_utils.pyx":576
10751  * @cython.boundscheck(False)
10752  * @cython.wraparound(False)
10753  * def morton_neighbor_periodic(np.ndarray[np.uint64_t,ndim=1] p,             # <<<<<<<<<<<<<<
10754  *                              list dim_list, list num_list,
10755  *                              np.uint64_t max_index):
10756  */
10757 
10758   /* function exit code */
10759   __pyx_L1_error:;
10760   __Pyx_XDECREF(__pyx_t_2);
10761   __Pyx_XDECREF(__pyx_t_3);
10762   __Pyx_XDECREF(__pyx_t_4);
10763   __Pyx_XDECREF(__pyx_t_6);
10764   __Pyx_XDECREF(__pyx_t_10);
10765   __Pyx_XDECREF(__pyx_t_13);
10766   __Pyx_XDECREF(__pyx_t_15);
10767   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
10768     __Pyx_PyThreadState_declare
10769     __Pyx_PyThreadState_assign
10770     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
10771     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_p.rcbuffer->pybuffer);
10772   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
10773   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_neighbor_periodic", __pyx_clineno, __pyx_lineno, __pyx_filename);
10774   __pyx_r = NULL;
10775   goto __pyx_L2;
10776   __pyx_L0:;
10777   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_p.rcbuffer->pybuffer);
10778   __pyx_L2:;
10779   __Pyx_XGIVEREF(__pyx_r);
10780   __Pyx_RefNannyFinishContext();
10781   return __pyx_r;
10782 }
10783 
10784 /* "yt/utilities/lib/geometry_utils.pyx":590
10785  * @cython.boundscheck(False)
10786  * @cython.wraparound(False)
10787  * def morton_neighbor_bounded(np.ndarray[np.uint64_t,ndim=1] p,             # <<<<<<<<<<<<<<
10788  *                             list dim_list, list num_list,
10789  *                             np.uint64_t max_index):
10790  */
10791 
10792 /* Python wrapper */
10793 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_31morton_neighbor_bounded(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
10794 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_31morton_neighbor_bounded = {"morton_neighbor_bounded", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_31morton_neighbor_bounded, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_31morton_neighbor_bounded(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)10795 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_31morton_neighbor_bounded(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10796   PyArrayObject *__pyx_v_p = 0;
10797   PyObject *__pyx_v_dim_list = 0;
10798   PyObject *__pyx_v_num_list = 0;
10799   __pyx_t_5numpy_uint64_t __pyx_v_max_index;
10800   PyObject *__pyx_r = 0;
10801   __Pyx_RefNannyDeclarations
10802   __Pyx_RefNannySetupContext("morton_neighbor_bounded (wrapper)", 0);
10803   {
10804     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_dim_list,&__pyx_n_s_num_list,&__pyx_n_s_max_index,0};
10805     PyObject* values[4] = {0,0,0,0};
10806     if (unlikely(__pyx_kwds)) {
10807       Py_ssize_t kw_args;
10808       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
10809       switch (pos_args) {
10810         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10811         CYTHON_FALLTHROUGH;
10812         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10813         CYTHON_FALLTHROUGH;
10814         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10815         CYTHON_FALLTHROUGH;
10816         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10817         CYTHON_FALLTHROUGH;
10818         case  0: break;
10819         default: goto __pyx_L5_argtuple_error;
10820       }
10821       kw_args = PyDict_Size(__pyx_kwds);
10822       switch (pos_args) {
10823         case  0:
10824         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
10825         else goto __pyx_L5_argtuple_error;
10826         CYTHON_FALLTHROUGH;
10827         case  1:
10828         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dim_list)) != 0)) kw_args--;
10829         else {
10830           __Pyx_RaiseArgtupleInvalid("morton_neighbor_bounded", 1, 4, 4, 1); __PYX_ERR(1, 590, __pyx_L3_error)
10831         }
10832         CYTHON_FALLTHROUGH;
10833         case  2:
10834         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_list)) != 0)) kw_args--;
10835         else {
10836           __Pyx_RaiseArgtupleInvalid("morton_neighbor_bounded", 1, 4, 4, 2); __PYX_ERR(1, 590, __pyx_L3_error)
10837         }
10838         CYTHON_FALLTHROUGH;
10839         case  3:
10840         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_index)) != 0)) kw_args--;
10841         else {
10842           __Pyx_RaiseArgtupleInvalid("morton_neighbor_bounded", 1, 4, 4, 3); __PYX_ERR(1, 590, __pyx_L3_error)
10843         }
10844       }
10845       if (unlikely(kw_args > 0)) {
10846         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "morton_neighbor_bounded") < 0)) __PYX_ERR(1, 590, __pyx_L3_error)
10847       }
10848     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
10849       goto __pyx_L5_argtuple_error;
10850     } else {
10851       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10852       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10853       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10854       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10855     }
10856     __pyx_v_p = ((PyArrayObject *)values[0]);
10857     __pyx_v_dim_list = ((PyObject*)values[1]);
10858     __pyx_v_num_list = ((PyObject*)values[2]);
10859     __pyx_v_max_index = __Pyx_PyInt_As_npy_uint64(values[3]); if (unlikely((__pyx_v_max_index == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 592, __pyx_L3_error)
10860   }
10861   goto __pyx_L4_argument_unpacking_done;
10862   __pyx_L5_argtuple_error:;
10863   __Pyx_RaiseArgtupleInvalid("morton_neighbor_bounded", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 590, __pyx_L3_error)
10864   __pyx_L3_error:;
10865   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_neighbor_bounded", __pyx_clineno, __pyx_lineno, __pyx_filename);
10866   __Pyx_RefNannyFinishContext();
10867   return NULL;
10868   __pyx_L4_argument_unpacking_done:;
10869   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5numpy_ndarray, 1, "p", 0))) __PYX_ERR(1, 590, __pyx_L1_error)
10870   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dim_list), (&PyList_Type), 1, "dim_list", 1))) __PYX_ERR(1, 591, __pyx_L1_error)
10871   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_num_list), (&PyList_Type), 1, "num_list", 1))) __PYX_ERR(1, 591, __pyx_L1_error)
10872   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_30morton_neighbor_bounded(__pyx_self, __pyx_v_p, __pyx_v_dim_list, __pyx_v_num_list, __pyx_v_max_index);
10873 
10874   /* function exit code */
10875   goto __pyx_L0;
10876   __pyx_L1_error:;
10877   __pyx_r = NULL;
10878   __pyx_L0:;
10879   __Pyx_RefNannyFinishContext();
10880   return __pyx_r;
10881 }
10882 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_30morton_neighbor_bounded(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_p,PyObject * __pyx_v_dim_list,PyObject * __pyx_v_num_list,__pyx_t_5numpy_uint64_t __pyx_v_max_index)10883 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_30morton_neighbor_bounded(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_p, PyObject *__pyx_v_dim_list, PyObject *__pyx_v_num_list, __pyx_t_5numpy_uint64_t __pyx_v_max_index) {
10884   __pyx_t_5numpy_int64_t __pyx_v_x;
10885   __pyx_t_5numpy_uint64_t __pyx_v_p1[3];
10886   int __pyx_v_j;
10887   int __pyx_v_dim;
10888   int __pyx_v_num;
10889   __Pyx_LocalBuf_ND __pyx_pybuffernd_p;
10890   __Pyx_Buffer __pyx_pybuffer_p;
10891   PyObject *__pyx_r = NULL;
10892   __Pyx_RefNannyDeclarations
10893   int __pyx_t_1;
10894   PyObject *__pyx_t_2 = NULL;
10895   PyObject *__pyx_t_3 = NULL;
10896   PyObject *__pyx_t_4 = NULL;
10897   Py_ssize_t __pyx_t_5;
10898   PyObject *__pyx_t_6 = NULL;
10899   __pyx_t_5numpy_uint64_t __pyx_t_7;
10900   Py_ssize_t __pyx_t_8;
10901   PyObject *(*__pyx_t_9)(PyObject *);
10902   PyObject *__pyx_t_10 = NULL;
10903   PyObject *(*__pyx_t_11)(PyObject *);
10904   int __pyx_t_12;
10905   Py_ssize_t __pyx_t_13;
10906   __pyx_t_5numpy_int64_t __pyx_t_14;
10907   int __pyx_t_15;
10908   int __pyx_t_16;
10909   __Pyx_RefNannySetupContext("morton_neighbor_bounded", 0);
10910   __pyx_pybuffer_p.pybuffer.buf = NULL;
10911   __pyx_pybuffer_p.refcount = 0;
10912   __pyx_pybuffernd_p.data = NULL;
10913   __pyx_pybuffernd_p.rcbuffer = &__pyx_pybuffer_p;
10914   {
10915     __Pyx_BufFmt_StackElem __pyx_stack[1];
10916     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_p.rcbuffer->pybuffer, (PyObject*)__pyx_v_p, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 590, __pyx_L1_error)
10917   }
10918   __pyx_pybuffernd_p.diminfo[0].strides = __pyx_pybuffernd_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_p.diminfo[0].shape = __pyx_pybuffernd_p.rcbuffer->pybuffer.shape[0];
10919 
10920   /* "yt/utilities/lib/geometry_utils.pyx":596
10921  *     cdef np.uint64_t p1[3]
10922  *     cdef int j, dim, num
10923  *     for j in range(3):             # <<<<<<<<<<<<<<
10924  *         p1[j] = np.uint64(p[j])
10925  *     for dim,num in zip(dim_list,num_list):
10926  */
10927   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
10928     __pyx_v_j = __pyx_t_1;
10929 
10930     /* "yt/utilities/lib/geometry_utils.pyx":597
10931  *     cdef int j, dim, num
10932  *     for j in range(3):
10933  *         p1[j] = np.uint64(p[j])             # <<<<<<<<<<<<<<
10934  *     for dim,num in zip(dim_list,num_list):
10935  *         x = np.int64(p[dim]) + num
10936  */
10937     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 597, __pyx_L1_error)
10938     __Pyx_GOTREF(__pyx_t_3);
10939     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint64); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 597, __pyx_L1_error)
10940     __Pyx_GOTREF(__pyx_t_4);
10941     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10942     __pyx_t_5 = __pyx_v_j;
10943     __pyx_t_3 = __Pyx_PyInt_From_npy_uint64((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_p.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_p.diminfo[0].strides))); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 597, __pyx_L1_error)
10944     __Pyx_GOTREF(__pyx_t_3);
10945     __pyx_t_6 = NULL;
10946     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
10947       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
10948       if (likely(__pyx_t_6)) {
10949         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
10950         __Pyx_INCREF(__pyx_t_6);
10951         __Pyx_INCREF(function);
10952         __Pyx_DECREF_SET(__pyx_t_4, function);
10953       }
10954     }
10955     __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
10956     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
10957     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10958     if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 597, __pyx_L1_error)
10959     __Pyx_GOTREF(__pyx_t_2);
10960     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10961     __pyx_t_7 = __Pyx_PyInt_As_npy_uint64(__pyx_t_2); if (unlikely((__pyx_t_7 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 597, __pyx_L1_error)
10962     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10963     (__pyx_v_p1[__pyx_v_j]) = __pyx_t_7;
10964   }
10965 
10966   /* "yt/utilities/lib/geometry_utils.pyx":598
10967  *     for j in range(3):
10968  *         p1[j] = np.uint64(p[j])
10969  *     for dim,num in zip(dim_list,num_list):             # <<<<<<<<<<<<<<
10970  *         x = np.int64(p[dim]) + num
10971  *         if (x >= 0) and (x < max_index):
10972  */
10973   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 598, __pyx_L1_error)
10974   __Pyx_GOTREF(__pyx_t_2);
10975   __Pyx_INCREF(__pyx_v_dim_list);
10976   __Pyx_GIVEREF(__pyx_v_dim_list);
10977   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_dim_list);
10978   __Pyx_INCREF(__pyx_v_num_list);
10979   __Pyx_GIVEREF(__pyx_v_num_list);
10980   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_num_list);
10981   __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 598, __pyx_L1_error)
10982   __Pyx_GOTREF(__pyx_t_4);
10983   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10984   if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
10985     __pyx_t_2 = __pyx_t_4; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0;
10986     __pyx_t_9 = NULL;
10987   } else {
10988     __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 598, __pyx_L1_error)
10989     __Pyx_GOTREF(__pyx_t_2);
10990     __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 598, __pyx_L1_error)
10991   }
10992   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10993   for (;;) {
10994     if (likely(!__pyx_t_9)) {
10995       if (likely(PyList_CheckExact(__pyx_t_2))) {
10996         if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
10997         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10998         __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(1, 598, __pyx_L1_error)
10999         #else
11000         __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 598, __pyx_L1_error)
11001         __Pyx_GOTREF(__pyx_t_4);
11002         #endif
11003       } else {
11004         if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
11005         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11006         __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(1, 598, __pyx_L1_error)
11007         #else
11008         __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 598, __pyx_L1_error)
11009         __Pyx_GOTREF(__pyx_t_4);
11010         #endif
11011       }
11012     } else {
11013       __pyx_t_4 = __pyx_t_9(__pyx_t_2);
11014       if (unlikely(!__pyx_t_4)) {
11015         PyObject* exc_type = PyErr_Occurred();
11016         if (exc_type) {
11017           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
11018           else __PYX_ERR(1, 598, __pyx_L1_error)
11019         }
11020         break;
11021       }
11022       __Pyx_GOTREF(__pyx_t_4);
11023     }
11024     if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
11025       PyObject* sequence = __pyx_t_4;
11026       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
11027       if (unlikely(size != 2)) {
11028         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
11029         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
11030         __PYX_ERR(1, 598, __pyx_L1_error)
11031       }
11032       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11033       if (likely(PyTuple_CheckExact(sequence))) {
11034         __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
11035         __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
11036       } else {
11037         __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
11038         __pyx_t_6 = PyList_GET_ITEM(sequence, 1);
11039       }
11040       __Pyx_INCREF(__pyx_t_3);
11041       __Pyx_INCREF(__pyx_t_6);
11042       #else
11043       __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 598, __pyx_L1_error)
11044       __Pyx_GOTREF(__pyx_t_3);
11045       __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 598, __pyx_L1_error)
11046       __Pyx_GOTREF(__pyx_t_6);
11047       #endif
11048       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11049     } else {
11050       Py_ssize_t index = -1;
11051       __pyx_t_10 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 598, __pyx_L1_error)
11052       __Pyx_GOTREF(__pyx_t_10);
11053       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11054       __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
11055       index = 0; __pyx_t_3 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L7_unpacking_failed;
11056       __Pyx_GOTREF(__pyx_t_3);
11057       index = 1; __pyx_t_6 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_6)) goto __pyx_L7_unpacking_failed;
11058       __Pyx_GOTREF(__pyx_t_6);
11059       if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) __PYX_ERR(1, 598, __pyx_L1_error)
11060       __pyx_t_11 = NULL;
11061       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
11062       goto __pyx_L8_unpacking_done;
11063       __pyx_L7_unpacking_failed:;
11064       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
11065       __pyx_t_11 = NULL;
11066       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
11067       __PYX_ERR(1, 598, __pyx_L1_error)
11068       __pyx_L8_unpacking_done:;
11069     }
11070     __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 598, __pyx_L1_error)
11071     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11072     __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 598, __pyx_L1_error)
11073     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11074     __pyx_v_dim = __pyx_t_1;
11075     __pyx_v_num = __pyx_t_12;
11076 
11077     /* "yt/utilities/lib/geometry_utils.pyx":599
11078  *         p1[j] = np.uint64(p[j])
11079  *     for dim,num in zip(dim_list,num_list):
11080  *         x = np.int64(p[dim]) + num             # <<<<<<<<<<<<<<
11081  *         if (x >= 0) and (x < max_index):
11082  *             p1[dim] = np.uint64(x)
11083  */
11084     __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 599, __pyx_L1_error)
11085     __Pyx_GOTREF(__pyx_t_6);
11086     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int64); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 599, __pyx_L1_error)
11087     __Pyx_GOTREF(__pyx_t_3);
11088     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11089     __pyx_t_13 = __pyx_v_dim;
11090     __pyx_t_6 = __Pyx_PyInt_From_npy_uint64((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_p.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_p.diminfo[0].strides))); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 599, __pyx_L1_error)
11091     __Pyx_GOTREF(__pyx_t_6);
11092     __pyx_t_10 = NULL;
11093     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
11094       __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_3);
11095       if (likely(__pyx_t_10)) {
11096         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
11097         __Pyx_INCREF(__pyx_t_10);
11098         __Pyx_INCREF(function);
11099         __Pyx_DECREF_SET(__pyx_t_3, function);
11100       }
11101     }
11102     __pyx_t_4 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_10, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6);
11103     __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
11104     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11105     if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 599, __pyx_L1_error)
11106     __Pyx_GOTREF(__pyx_t_4);
11107     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11108     __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_num); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 599, __pyx_L1_error)
11109     __Pyx_GOTREF(__pyx_t_3);
11110     __pyx_t_6 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 599, __pyx_L1_error)
11111     __Pyx_GOTREF(__pyx_t_6);
11112     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11113     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11114     __pyx_t_14 = __Pyx_PyInt_As_npy_int64(__pyx_t_6); if (unlikely((__pyx_t_14 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 599, __pyx_L1_error)
11115     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11116     __pyx_v_x = __pyx_t_14;
11117 
11118     /* "yt/utilities/lib/geometry_utils.pyx":600
11119  *     for dim,num in zip(dim_list,num_list):
11120  *         x = np.int64(p[dim]) + num
11121  *         if (x >= 0) and (x < max_index):             # <<<<<<<<<<<<<<
11122  *             p1[dim] = np.uint64(x)
11123  *         else:
11124  */
11125     __pyx_t_16 = ((__pyx_v_x >= 0) != 0);
11126     if (__pyx_t_16) {
11127     } else {
11128       __pyx_t_15 = __pyx_t_16;
11129       goto __pyx_L10_bool_binop_done;
11130     }
11131     __pyx_t_16 = ((__pyx_v_x < __pyx_v_max_index) != 0);
11132     __pyx_t_15 = __pyx_t_16;
11133     __pyx_L10_bool_binop_done:;
11134     if (__pyx_t_15) {
11135 
11136       /* "yt/utilities/lib/geometry_utils.pyx":601
11137  *         x = np.int64(p[dim]) + num
11138  *         if (x >= 0) and (x < max_index):
11139  *             p1[dim] = np.uint64(x)             # <<<<<<<<<<<<<<
11140  *         else:
11141  *             return np.int64(-1)
11142  */
11143       __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 601, __pyx_L1_error)
11144       __Pyx_GOTREF(__pyx_t_3);
11145       __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint64); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 601, __pyx_L1_error)
11146       __Pyx_GOTREF(__pyx_t_4);
11147       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11148       __pyx_t_3 = __Pyx_PyInt_From_npy_int64(__pyx_v_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 601, __pyx_L1_error)
11149       __Pyx_GOTREF(__pyx_t_3);
11150       __pyx_t_10 = NULL;
11151       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
11152         __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4);
11153         if (likely(__pyx_t_10)) {
11154           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
11155           __Pyx_INCREF(__pyx_t_10);
11156           __Pyx_INCREF(function);
11157           __Pyx_DECREF_SET(__pyx_t_4, function);
11158         }
11159       }
11160       __pyx_t_6 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_10, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
11161       __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
11162       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11163       if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 601, __pyx_L1_error)
11164       __Pyx_GOTREF(__pyx_t_6);
11165       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11166       __pyx_t_7 = __Pyx_PyInt_As_npy_uint64(__pyx_t_6); if (unlikely((__pyx_t_7 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 601, __pyx_L1_error)
11167       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11168       (__pyx_v_p1[__pyx_v_dim]) = __pyx_t_7;
11169 
11170       /* "yt/utilities/lib/geometry_utils.pyx":600
11171  *     for dim,num in zip(dim_list,num_list):
11172  *         x = np.int64(p[dim]) + num
11173  *         if (x >= 0) and (x < max_index):             # <<<<<<<<<<<<<<
11174  *             p1[dim] = np.uint64(x)
11175  *         else:
11176  */
11177       goto __pyx_L9;
11178     }
11179 
11180     /* "yt/utilities/lib/geometry_utils.pyx":603
11181  *             p1[dim] = np.uint64(x)
11182  *         else:
11183  *             return np.int64(-1)             # <<<<<<<<<<<<<<
11184  *     return np.int64(point_to_morton(p1))
11185  *
11186  */
11187     /*else*/ {
11188       __Pyx_XDECREF(__pyx_r);
11189       __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 603, __pyx_L1_error)
11190       __Pyx_GOTREF(__pyx_t_4);
11191       __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int64); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 603, __pyx_L1_error)
11192       __Pyx_GOTREF(__pyx_t_3);
11193       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11194       __pyx_t_4 = NULL;
11195       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
11196         __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
11197         if (likely(__pyx_t_4)) {
11198           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
11199           __Pyx_INCREF(__pyx_t_4);
11200           __Pyx_INCREF(function);
11201           __Pyx_DECREF_SET(__pyx_t_3, function);
11202         }
11203       }
11204       __pyx_t_6 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_int_neg_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_neg_1);
11205       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11206       if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 603, __pyx_L1_error)
11207       __Pyx_GOTREF(__pyx_t_6);
11208       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11209       __pyx_r = __pyx_t_6;
11210       __pyx_t_6 = 0;
11211       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11212       goto __pyx_L0;
11213     }
11214     __pyx_L9:;
11215 
11216     /* "yt/utilities/lib/geometry_utils.pyx":598
11217  *     for j in range(3):
11218  *         p1[j] = np.uint64(p[j])
11219  *     for dim,num in zip(dim_list,num_list):             # <<<<<<<<<<<<<<
11220  *         x = np.int64(p[dim]) + num
11221  *         if (x >= 0) and (x < max_index):
11222  */
11223   }
11224   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11225 
11226   /* "yt/utilities/lib/geometry_utils.pyx":604
11227  *         else:
11228  *             return np.int64(-1)
11229  *     return np.int64(point_to_morton(p1))             # <<<<<<<<<<<<<<
11230  *
11231  * @cython.cdivision(True)
11232  */
11233   __Pyx_XDECREF(__pyx_r);
11234   __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 604, __pyx_L1_error)
11235   __Pyx_GOTREF(__pyx_t_6);
11236   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int64); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 604, __pyx_L1_error)
11237   __Pyx_GOTREF(__pyx_t_3);
11238   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11239   __pyx_t_6 = __Pyx_PyInt_From_npy_uint64(__pyx_f_2yt_9utilities_3lib_14geometry_utils_point_to_morton(__pyx_v_p1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 604, __pyx_L1_error)
11240   __Pyx_GOTREF(__pyx_t_6);
11241   __pyx_t_4 = NULL;
11242   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
11243     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
11244     if (likely(__pyx_t_4)) {
11245       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
11246       __Pyx_INCREF(__pyx_t_4);
11247       __Pyx_INCREF(function);
11248       __Pyx_DECREF_SET(__pyx_t_3, function);
11249     }
11250   }
11251   __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6);
11252   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11253   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11254   if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 604, __pyx_L1_error)
11255   __Pyx_GOTREF(__pyx_t_2);
11256   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11257   __pyx_r = __pyx_t_2;
11258   __pyx_t_2 = 0;
11259   goto __pyx_L0;
11260 
11261   /* "yt/utilities/lib/geometry_utils.pyx":590
11262  * @cython.boundscheck(False)
11263  * @cython.wraparound(False)
11264  * def morton_neighbor_bounded(np.ndarray[np.uint64_t,ndim=1] p,             # <<<<<<<<<<<<<<
11265  *                             list dim_list, list num_list,
11266  *                             np.uint64_t max_index):
11267  */
11268 
11269   /* function exit code */
11270   __pyx_L1_error:;
11271   __Pyx_XDECREF(__pyx_t_2);
11272   __Pyx_XDECREF(__pyx_t_3);
11273   __Pyx_XDECREF(__pyx_t_4);
11274   __Pyx_XDECREF(__pyx_t_6);
11275   __Pyx_XDECREF(__pyx_t_10);
11276   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
11277     __Pyx_PyThreadState_declare
11278     __Pyx_PyThreadState_assign
11279     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
11280     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_p.rcbuffer->pybuffer);
11281   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
11282   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_neighbor_bounded", __pyx_clineno, __pyx_lineno, __pyx_filename);
11283   __pyx_r = NULL;
11284   goto __pyx_L2;
11285   __pyx_L0:;
11286   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_p.rcbuffer->pybuffer);
11287   __pyx_L2:;
11288   __Pyx_XGIVEREF(__pyx_r);
11289   __Pyx_RefNannyFinishContext();
11290   return __pyx_r;
11291 }
11292 
11293 /* "yt/utilities/lib/geometry_utils.pyx":609
11294  * @cython.boundscheck(False)
11295  * @cython.wraparound(False)
11296  * def morton_neighbor(np.ndarray[np.uint64_t,ndim=1] p,             # <<<<<<<<<<<<<<
11297  *                     list dim_list, list num_list,
11298  *                     np.uint64_t max_index, periodic = False):
11299  */
11300 
11301 /* Python wrapper */
11302 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_33morton_neighbor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11303 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_33morton_neighbor = {"morton_neighbor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_33morton_neighbor, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_33morton_neighbor(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)11304 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_33morton_neighbor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11305   PyArrayObject *__pyx_v_p = 0;
11306   PyObject *__pyx_v_dim_list = 0;
11307   PyObject *__pyx_v_num_list = 0;
11308   __pyx_t_5numpy_uint64_t __pyx_v_max_index;
11309   PyObject *__pyx_v_periodic = 0;
11310   PyObject *__pyx_r = 0;
11311   __Pyx_RefNannyDeclarations
11312   __Pyx_RefNannySetupContext("morton_neighbor (wrapper)", 0);
11313   {
11314     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_dim_list,&__pyx_n_s_num_list,&__pyx_n_s_max_index,&__pyx_n_s_periodic,0};
11315     PyObject* values[5] = {0,0,0,0,0};
11316 
11317     /* "yt/utilities/lib/geometry_utils.pyx":611
11318  * def morton_neighbor(np.ndarray[np.uint64_t,ndim=1] p,
11319  *                     list dim_list, list num_list,
11320  *                     np.uint64_t max_index, periodic = False):             # <<<<<<<<<<<<<<
11321  *     if periodic:
11322  *         return morton_neighbor_periodic(p, dim_list, num_list, max_index)
11323  */
11324     values[4] = ((PyObject *)Py_False);
11325     if (unlikely(__pyx_kwds)) {
11326       Py_ssize_t kw_args;
11327       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11328       switch (pos_args) {
11329         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11330         CYTHON_FALLTHROUGH;
11331         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11332         CYTHON_FALLTHROUGH;
11333         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11334         CYTHON_FALLTHROUGH;
11335         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11336         CYTHON_FALLTHROUGH;
11337         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11338         CYTHON_FALLTHROUGH;
11339         case  0: break;
11340         default: goto __pyx_L5_argtuple_error;
11341       }
11342       kw_args = PyDict_Size(__pyx_kwds);
11343       switch (pos_args) {
11344         case  0:
11345         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
11346         else goto __pyx_L5_argtuple_error;
11347         CYTHON_FALLTHROUGH;
11348         case  1:
11349         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dim_list)) != 0)) kw_args--;
11350         else {
11351           __Pyx_RaiseArgtupleInvalid("morton_neighbor", 0, 4, 5, 1); __PYX_ERR(1, 609, __pyx_L3_error)
11352         }
11353         CYTHON_FALLTHROUGH;
11354         case  2:
11355         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_list)) != 0)) kw_args--;
11356         else {
11357           __Pyx_RaiseArgtupleInvalid("morton_neighbor", 0, 4, 5, 2); __PYX_ERR(1, 609, __pyx_L3_error)
11358         }
11359         CYTHON_FALLTHROUGH;
11360         case  3:
11361         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_index)) != 0)) kw_args--;
11362         else {
11363           __Pyx_RaiseArgtupleInvalid("morton_neighbor", 0, 4, 5, 3); __PYX_ERR(1, 609, __pyx_L3_error)
11364         }
11365         CYTHON_FALLTHROUGH;
11366         case  4:
11367         if (kw_args > 0) {
11368           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_periodic);
11369           if (value) { values[4] = value; kw_args--; }
11370         }
11371       }
11372       if (unlikely(kw_args > 0)) {
11373         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "morton_neighbor") < 0)) __PYX_ERR(1, 609, __pyx_L3_error)
11374       }
11375     } else {
11376       switch (PyTuple_GET_SIZE(__pyx_args)) {
11377         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11378         CYTHON_FALLTHROUGH;
11379         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11380         values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11381         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11382         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11383         break;
11384         default: goto __pyx_L5_argtuple_error;
11385       }
11386     }
11387     __pyx_v_p = ((PyArrayObject *)values[0]);
11388     __pyx_v_dim_list = ((PyObject*)values[1]);
11389     __pyx_v_num_list = ((PyObject*)values[2]);
11390     __pyx_v_max_index = __Pyx_PyInt_As_npy_uint64(values[3]); if (unlikely((__pyx_v_max_index == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 611, __pyx_L3_error)
11391     __pyx_v_periodic = values[4];
11392   }
11393   goto __pyx_L4_argument_unpacking_done;
11394   __pyx_L5_argtuple_error:;
11395   __Pyx_RaiseArgtupleInvalid("morton_neighbor", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 609, __pyx_L3_error)
11396   __pyx_L3_error:;
11397   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_neighbor", __pyx_clineno, __pyx_lineno, __pyx_filename);
11398   __Pyx_RefNannyFinishContext();
11399   return NULL;
11400   __pyx_L4_argument_unpacking_done:;
11401   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5numpy_ndarray, 1, "p", 0))) __PYX_ERR(1, 609, __pyx_L1_error)
11402   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dim_list), (&PyList_Type), 1, "dim_list", 1))) __PYX_ERR(1, 610, __pyx_L1_error)
11403   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_num_list), (&PyList_Type), 1, "num_list", 1))) __PYX_ERR(1, 610, __pyx_L1_error)
11404   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_32morton_neighbor(__pyx_self, __pyx_v_p, __pyx_v_dim_list, __pyx_v_num_list, __pyx_v_max_index, __pyx_v_periodic);
11405 
11406   /* "yt/utilities/lib/geometry_utils.pyx":609
11407  * @cython.boundscheck(False)
11408  * @cython.wraparound(False)
11409  * def morton_neighbor(np.ndarray[np.uint64_t,ndim=1] p,             # <<<<<<<<<<<<<<
11410  *                     list dim_list, list num_list,
11411  *                     np.uint64_t max_index, periodic = False):
11412  */
11413 
11414   /* function exit code */
11415   goto __pyx_L0;
11416   __pyx_L1_error:;
11417   __pyx_r = NULL;
11418   __pyx_L0:;
11419   __Pyx_RefNannyFinishContext();
11420   return __pyx_r;
11421 }
11422 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_32morton_neighbor(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_p,PyObject * __pyx_v_dim_list,PyObject * __pyx_v_num_list,__pyx_t_5numpy_uint64_t __pyx_v_max_index,PyObject * __pyx_v_periodic)11423 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_32morton_neighbor(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_p, PyObject *__pyx_v_dim_list, PyObject *__pyx_v_num_list, __pyx_t_5numpy_uint64_t __pyx_v_max_index, PyObject *__pyx_v_periodic) {
11424   __Pyx_LocalBuf_ND __pyx_pybuffernd_p;
11425   __Pyx_Buffer __pyx_pybuffer_p;
11426   PyObject *__pyx_r = NULL;
11427   __Pyx_RefNannyDeclarations
11428   int __pyx_t_1;
11429   PyObject *__pyx_t_2 = NULL;
11430   PyObject *__pyx_t_3 = NULL;
11431   PyObject *__pyx_t_4 = NULL;
11432   PyObject *__pyx_t_5 = NULL;
11433   int __pyx_t_6;
11434   PyObject *__pyx_t_7 = NULL;
11435   __Pyx_RefNannySetupContext("morton_neighbor", 0);
11436   __pyx_pybuffer_p.pybuffer.buf = NULL;
11437   __pyx_pybuffer_p.refcount = 0;
11438   __pyx_pybuffernd_p.data = NULL;
11439   __pyx_pybuffernd_p.rcbuffer = &__pyx_pybuffer_p;
11440   {
11441     __Pyx_BufFmt_StackElem __pyx_stack[1];
11442     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_p.rcbuffer->pybuffer, (PyObject*)__pyx_v_p, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 609, __pyx_L1_error)
11443   }
11444   __pyx_pybuffernd_p.diminfo[0].strides = __pyx_pybuffernd_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_p.diminfo[0].shape = __pyx_pybuffernd_p.rcbuffer->pybuffer.shape[0];
11445 
11446   /* "yt/utilities/lib/geometry_utils.pyx":612
11447  *                     list dim_list, list num_list,
11448  *                     np.uint64_t max_index, periodic = False):
11449  *     if periodic:             # <<<<<<<<<<<<<<
11450  *         return morton_neighbor_periodic(p, dim_list, num_list, max_index)
11451  *     else:
11452  */
11453   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_periodic); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 612, __pyx_L1_error)
11454   if (__pyx_t_1) {
11455 
11456     /* "yt/utilities/lib/geometry_utils.pyx":613
11457  *                     np.uint64_t max_index, periodic = False):
11458  *     if periodic:
11459  *         return morton_neighbor_periodic(p, dim_list, num_list, max_index)             # <<<<<<<<<<<<<<
11460  *     else:
11461  *         return morton_neighbor_bounded(p, dim_list, num_list, max_index)
11462  */
11463     __Pyx_XDECREF(__pyx_r);
11464     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_morton_neighbor_periodic); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 613, __pyx_L1_error)
11465     __Pyx_GOTREF(__pyx_t_3);
11466     __pyx_t_4 = __Pyx_PyInt_From_npy_uint64(__pyx_v_max_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 613, __pyx_L1_error)
11467     __Pyx_GOTREF(__pyx_t_4);
11468     __pyx_t_5 = NULL;
11469     __pyx_t_6 = 0;
11470     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
11471       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
11472       if (likely(__pyx_t_5)) {
11473         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
11474         __Pyx_INCREF(__pyx_t_5);
11475         __Pyx_INCREF(function);
11476         __Pyx_DECREF_SET(__pyx_t_3, function);
11477         __pyx_t_6 = 1;
11478       }
11479     }
11480     #if CYTHON_FAST_PYCALL
11481     if (PyFunction_Check(__pyx_t_3)) {
11482       PyObject *__pyx_temp[5] = {__pyx_t_5, ((PyObject *)__pyx_v_p), __pyx_v_dim_list, __pyx_v_num_list, __pyx_t_4};
11483       __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 613, __pyx_L1_error)
11484       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11485       __Pyx_GOTREF(__pyx_t_2);
11486       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11487     } else
11488     #endif
11489     #if CYTHON_FAST_PYCCALL
11490     if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
11491       PyObject *__pyx_temp[5] = {__pyx_t_5, ((PyObject *)__pyx_v_p), __pyx_v_dim_list, __pyx_v_num_list, __pyx_t_4};
11492       __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 613, __pyx_L1_error)
11493       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11494       __Pyx_GOTREF(__pyx_t_2);
11495       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11496     } else
11497     #endif
11498     {
11499       __pyx_t_7 = PyTuple_New(4+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 613, __pyx_L1_error)
11500       __Pyx_GOTREF(__pyx_t_7);
11501       if (__pyx_t_5) {
11502         __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
11503       }
11504       __Pyx_INCREF(((PyObject *)__pyx_v_p));
11505       __Pyx_GIVEREF(((PyObject *)__pyx_v_p));
11506       PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, ((PyObject *)__pyx_v_p));
11507       __Pyx_INCREF(__pyx_v_dim_list);
11508       __Pyx_GIVEREF(__pyx_v_dim_list);
11509       PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_dim_list);
11510       __Pyx_INCREF(__pyx_v_num_list);
11511       __Pyx_GIVEREF(__pyx_v_num_list);
11512       PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_num_list);
11513       __Pyx_GIVEREF(__pyx_t_4);
11514       PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_6, __pyx_t_4);
11515       __pyx_t_4 = 0;
11516       __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 613, __pyx_L1_error)
11517       __Pyx_GOTREF(__pyx_t_2);
11518       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11519     }
11520     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11521     __pyx_r = __pyx_t_2;
11522     __pyx_t_2 = 0;
11523     goto __pyx_L0;
11524 
11525     /* "yt/utilities/lib/geometry_utils.pyx":612
11526  *                     list dim_list, list num_list,
11527  *                     np.uint64_t max_index, periodic = False):
11528  *     if periodic:             # <<<<<<<<<<<<<<
11529  *         return morton_neighbor_periodic(p, dim_list, num_list, max_index)
11530  *     else:
11531  */
11532   }
11533 
11534   /* "yt/utilities/lib/geometry_utils.pyx":615
11535  *         return morton_neighbor_periodic(p, dim_list, num_list, max_index)
11536  *     else:
11537  *         return morton_neighbor_bounded(p, dim_list, num_list, max_index)             # <<<<<<<<<<<<<<
11538  *
11539  * @cython.cdivision(True)
11540  */
11541   /*else*/ {
11542     __Pyx_XDECREF(__pyx_r);
11543     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_morton_neighbor_bounded); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 615, __pyx_L1_error)
11544     __Pyx_GOTREF(__pyx_t_3);
11545     __pyx_t_7 = __Pyx_PyInt_From_npy_uint64(__pyx_v_max_index); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 615, __pyx_L1_error)
11546     __Pyx_GOTREF(__pyx_t_7);
11547     __pyx_t_4 = NULL;
11548     __pyx_t_6 = 0;
11549     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
11550       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
11551       if (likely(__pyx_t_4)) {
11552         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
11553         __Pyx_INCREF(__pyx_t_4);
11554         __Pyx_INCREF(function);
11555         __Pyx_DECREF_SET(__pyx_t_3, function);
11556         __pyx_t_6 = 1;
11557       }
11558     }
11559     #if CYTHON_FAST_PYCALL
11560     if (PyFunction_Check(__pyx_t_3)) {
11561       PyObject *__pyx_temp[5] = {__pyx_t_4, ((PyObject *)__pyx_v_p), __pyx_v_dim_list, __pyx_v_num_list, __pyx_t_7};
11562       __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 615, __pyx_L1_error)
11563       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11564       __Pyx_GOTREF(__pyx_t_2);
11565       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11566     } else
11567     #endif
11568     #if CYTHON_FAST_PYCCALL
11569     if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
11570       PyObject *__pyx_temp[5] = {__pyx_t_4, ((PyObject *)__pyx_v_p), __pyx_v_dim_list, __pyx_v_num_list, __pyx_t_7};
11571       __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 615, __pyx_L1_error)
11572       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11573       __Pyx_GOTREF(__pyx_t_2);
11574       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11575     } else
11576     #endif
11577     {
11578       __pyx_t_5 = PyTuple_New(4+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 615, __pyx_L1_error)
11579       __Pyx_GOTREF(__pyx_t_5);
11580       if (__pyx_t_4) {
11581         __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
11582       }
11583       __Pyx_INCREF(((PyObject *)__pyx_v_p));
11584       __Pyx_GIVEREF(((PyObject *)__pyx_v_p));
11585       PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, ((PyObject *)__pyx_v_p));
11586       __Pyx_INCREF(__pyx_v_dim_list);
11587       __Pyx_GIVEREF(__pyx_v_dim_list);
11588       PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_v_dim_list);
11589       __Pyx_INCREF(__pyx_v_num_list);
11590       __Pyx_GIVEREF(__pyx_v_num_list);
11591       PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, __pyx_v_num_list);
11592       __Pyx_GIVEREF(__pyx_t_7);
11593       PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_6, __pyx_t_7);
11594       __pyx_t_7 = 0;
11595       __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 615, __pyx_L1_error)
11596       __Pyx_GOTREF(__pyx_t_2);
11597       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11598     }
11599     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11600     __pyx_r = __pyx_t_2;
11601     __pyx_t_2 = 0;
11602     goto __pyx_L0;
11603   }
11604 
11605   /* "yt/utilities/lib/geometry_utils.pyx":609
11606  * @cython.boundscheck(False)
11607  * @cython.wraparound(False)
11608  * def morton_neighbor(np.ndarray[np.uint64_t,ndim=1] p,             # <<<<<<<<<<<<<<
11609  *                     list dim_list, list num_list,
11610  *                     np.uint64_t max_index, periodic = False):
11611  */
11612 
11613   /* function exit code */
11614   __pyx_L1_error:;
11615   __Pyx_XDECREF(__pyx_t_2);
11616   __Pyx_XDECREF(__pyx_t_3);
11617   __Pyx_XDECREF(__pyx_t_4);
11618   __Pyx_XDECREF(__pyx_t_5);
11619   __Pyx_XDECREF(__pyx_t_7);
11620   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
11621     __Pyx_PyThreadState_declare
11622     __Pyx_PyThreadState_assign
11623     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
11624     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_p.rcbuffer->pybuffer);
11625   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
11626   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_neighbor", __pyx_clineno, __pyx_lineno, __pyx_filename);
11627   __pyx_r = NULL;
11628   goto __pyx_L2;
11629   __pyx_L0:;
11630   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_p.rcbuffer->pybuffer);
11631   __pyx_L2:;
11632   __Pyx_XGIVEREF(__pyx_r);
11633   __Pyx_RefNannyFinishContext();
11634   return __pyx_r;
11635 }
11636 
11637 /* "yt/utilities/lib/geometry_utils.pyx":620
11638  * @cython.boundscheck(False)
11639  * @cython.wraparound(False)
11640  * def get_morton_neighbors(np.ndarray[np.uint64_t,ndim=1] mi,             # <<<<<<<<<<<<<<
11641  *                          int order = ORDER_MAX, periodic = False):
11642  *     """Returns array of neighboring morton indices"""
11643  */
11644 
11645 /* Python wrapper */
11646 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_35get_morton_neighbors(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11647 static char __pyx_doc_2yt_9utilities_3lib_14geometry_utils_34get_morton_neighbors[] = "Returns array of neighboring morton indices";
11648 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_35get_morton_neighbors = {"get_morton_neighbors", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_35get_morton_neighbors, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2yt_9utilities_3lib_14geometry_utils_34get_morton_neighbors};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_35get_morton_neighbors(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)11649 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_35get_morton_neighbors(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11650   PyArrayObject *__pyx_v_mi = 0;
11651   int __pyx_v_order;
11652   PyObject *__pyx_v_periodic = 0;
11653   PyObject *__pyx_r = 0;
11654   __Pyx_RefNannyDeclarations
11655   __Pyx_RefNannySetupContext("get_morton_neighbors (wrapper)", 0);
11656   {
11657     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mi,&__pyx_n_s_order,&__pyx_n_s_periodic,0};
11658     PyObject* values[3] = {0,0,0};
11659 
11660     /* "yt/utilities/lib/geometry_utils.pyx":621
11661  * @cython.wraparound(False)
11662  * def get_morton_neighbors(np.ndarray[np.uint64_t,ndim=1] mi,
11663  *                          int order = ORDER_MAX, periodic = False):             # <<<<<<<<<<<<<<
11664  *     """Returns array of neighboring morton indices"""
11665  *     # Declare
11666  */
11667     values[2] = ((PyObject *)Py_False);
11668     if (unlikely(__pyx_kwds)) {
11669       Py_ssize_t kw_args;
11670       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11671       switch (pos_args) {
11672         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11673         CYTHON_FALLTHROUGH;
11674         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11675         CYTHON_FALLTHROUGH;
11676         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11677         CYTHON_FALLTHROUGH;
11678         case  0: break;
11679         default: goto __pyx_L5_argtuple_error;
11680       }
11681       kw_args = PyDict_Size(__pyx_kwds);
11682       switch (pos_args) {
11683         case  0:
11684         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mi)) != 0)) kw_args--;
11685         else goto __pyx_L5_argtuple_error;
11686         CYTHON_FALLTHROUGH;
11687         case  1:
11688         if (kw_args > 0) {
11689           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_order);
11690           if (value) { values[1] = value; kw_args--; }
11691         }
11692         CYTHON_FALLTHROUGH;
11693         case  2:
11694         if (kw_args > 0) {
11695           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_periodic);
11696           if (value) { values[2] = value; kw_args--; }
11697         }
11698       }
11699       if (unlikely(kw_args > 0)) {
11700         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_morton_neighbors") < 0)) __PYX_ERR(1, 620, __pyx_L3_error)
11701       }
11702     } else {
11703       switch (PyTuple_GET_SIZE(__pyx_args)) {
11704         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11705         CYTHON_FALLTHROUGH;
11706         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11707         CYTHON_FALLTHROUGH;
11708         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11709         break;
11710         default: goto __pyx_L5_argtuple_error;
11711       }
11712     }
11713     __pyx_v_mi = ((PyArrayObject *)values[0]);
11714     if (values[1]) {
11715       __pyx_v_order = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 621, __pyx_L3_error)
11716     } else {
11717       __pyx_v_order = ((int)20);
11718     }
11719     __pyx_v_periodic = values[2];
11720   }
11721   goto __pyx_L4_argument_unpacking_done;
11722   __pyx_L5_argtuple_error:;
11723   __Pyx_RaiseArgtupleInvalid("get_morton_neighbors", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 620, __pyx_L3_error)
11724   __pyx_L3_error:;
11725   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.get_morton_neighbors", __pyx_clineno, __pyx_lineno, __pyx_filename);
11726   __Pyx_RefNannyFinishContext();
11727   return NULL;
11728   __pyx_L4_argument_unpacking_done:;
11729   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mi), __pyx_ptype_5numpy_ndarray, 1, "mi", 0))) __PYX_ERR(1, 620, __pyx_L1_error)
11730   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_34get_morton_neighbors(__pyx_self, __pyx_v_mi, __pyx_v_order, __pyx_v_periodic);
11731 
11732   /* "yt/utilities/lib/geometry_utils.pyx":620
11733  * @cython.boundscheck(False)
11734  * @cython.wraparound(False)
11735  * def get_morton_neighbors(np.ndarray[np.uint64_t,ndim=1] mi,             # <<<<<<<<<<<<<<
11736  *                          int order = ORDER_MAX, periodic = False):
11737  *     """Returns array of neighboring morton indices"""
11738  */
11739 
11740   /* function exit code */
11741   goto __pyx_L0;
11742   __pyx_L1_error:;
11743   __pyx_r = NULL;
11744   __pyx_L0:;
11745   __Pyx_RefNannyFinishContext();
11746   return __pyx_r;
11747 }
11748 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_34get_morton_neighbors(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_mi,int __pyx_v_order,PyObject * __pyx_v_periodic)11749 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_34get_morton_neighbors(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mi, int __pyx_v_order, PyObject *__pyx_v_periodic) {
11750   int __pyx_v_i;
11751   int __pyx_v_j;
11752   int __pyx_v_k;
11753   int __pyx_v_l;
11754   int __pyx_v_n;
11755   __pyx_t_5numpy_uint64_t __pyx_v_max_index;
11756   PyArrayObject *__pyx_v_p = 0;
11757   __pyx_t_5numpy_int64_t __pyx_v_nmi;
11758   PyArrayObject *__pyx_v_mi_neighbors = 0;
11759   PyObject *__pyx_v_fneighbor = NULL;
11760   __Pyx_LocalBuf_ND __pyx_pybuffernd_mi;
11761   __Pyx_Buffer __pyx_pybuffer_mi;
11762   __Pyx_LocalBuf_ND __pyx_pybuffernd_mi_neighbors;
11763   __Pyx_Buffer __pyx_pybuffer_mi_neighbors;
11764   __Pyx_LocalBuf_ND __pyx_pybuffernd_p;
11765   __Pyx_Buffer __pyx_pybuffer_p;
11766   PyObject *__pyx_r = NULL;
11767   __Pyx_RefNannyDeclarations
11768   PyObject *__pyx_t_1 = NULL;
11769   PyObject *__pyx_t_2 = NULL;
11770   PyObject *__pyx_t_3 = NULL;
11771   PyArrayObject *__pyx_t_4 = NULL;
11772   int __pyx_t_5;
11773   PyObject *__pyx_t_6 = NULL;
11774   PyObject *__pyx_t_7 = NULL;
11775   PyObject *__pyx_t_8 = NULL;
11776   PyObject *__pyx_t_9 = NULL;
11777   PyObject *__pyx_t_10 = NULL;
11778   PyArrayObject *__pyx_t_11 = NULL;
11779   __pyx_t_5numpy_uint64_t __pyx_t_12;
11780   int __pyx_t_13;
11781   npy_intp __pyx_t_14;
11782   npy_intp __pyx_t_15;
11783   int __pyx_t_16;
11784   PyObject *__pyx_t_17 = NULL;
11785   PyObject *__pyx_t_18 = NULL;
11786   int __pyx_t_19;
11787   PyObject *__pyx_t_20 = NULL;
11788   __pyx_t_5numpy_int64_t __pyx_t_21;
11789   Py_ssize_t __pyx_t_22;
11790   int __pyx_t_23;
11791   Py_ssize_t __pyx_t_24;
11792   int __pyx_t_25;
11793   Py_ssize_t __pyx_t_26;
11794   Py_ssize_t __pyx_t_27;
11795   Py_ssize_t __pyx_t_28;
11796   Py_ssize_t __pyx_t_29;
11797   Py_ssize_t __pyx_t_30;
11798   Py_ssize_t __pyx_t_31;
11799   Py_ssize_t __pyx_t_32;
11800   Py_ssize_t __pyx_t_33;
11801   Py_ssize_t __pyx_t_34;
11802   Py_ssize_t __pyx_t_35;
11803   Py_ssize_t __pyx_t_36;
11804   Py_ssize_t __pyx_t_37;
11805   __Pyx_RefNannySetupContext("get_morton_neighbors", 0);
11806   __pyx_pybuffer_p.pybuffer.buf = NULL;
11807   __pyx_pybuffer_p.refcount = 0;
11808   __pyx_pybuffernd_p.data = NULL;
11809   __pyx_pybuffernd_p.rcbuffer = &__pyx_pybuffer_p;
11810   __pyx_pybuffer_mi_neighbors.pybuffer.buf = NULL;
11811   __pyx_pybuffer_mi_neighbors.refcount = 0;
11812   __pyx_pybuffernd_mi_neighbors.data = NULL;
11813   __pyx_pybuffernd_mi_neighbors.rcbuffer = &__pyx_pybuffer_mi_neighbors;
11814   __pyx_pybuffer_mi.pybuffer.buf = NULL;
11815   __pyx_pybuffer_mi.refcount = 0;
11816   __pyx_pybuffernd_mi.data = NULL;
11817   __pyx_pybuffernd_mi.rcbuffer = &__pyx_pybuffer_mi;
11818   {
11819     __Pyx_BufFmt_StackElem __pyx_stack[1];
11820     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mi.rcbuffer->pybuffer, (PyObject*)__pyx_v_mi, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 620, __pyx_L1_error)
11821   }
11822   __pyx_pybuffernd_mi.diminfo[0].strides = __pyx_pybuffernd_mi.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mi.diminfo[0].shape = __pyx_pybuffernd_mi.rcbuffer->pybuffer.shape[0];
11823 
11824   /* "yt/utilities/lib/geometry_utils.pyx":629
11825  *     cdef np.int64_t nmi
11826  *     cdef np.ndarray[np.uint64_t, ndim=1] mi_neighbors
11827  *     p = get_morton_points(mi)             # <<<<<<<<<<<<<<
11828  *     mi_neighbors = np.zeros(26*mi.shape[0], 'uint64')
11829  *     n = 0
11830  */
11831   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_morton_points); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 629, __pyx_L1_error)
11832   __Pyx_GOTREF(__pyx_t_2);
11833   __pyx_t_3 = NULL;
11834   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
11835     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
11836     if (likely(__pyx_t_3)) {
11837       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
11838       __Pyx_INCREF(__pyx_t_3);
11839       __Pyx_INCREF(function);
11840       __Pyx_DECREF_SET(__pyx_t_2, function);
11841     }
11842   }
11843   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_v_mi)) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_mi));
11844   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11845   if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 629, __pyx_L1_error)
11846   __Pyx_GOTREF(__pyx_t_1);
11847   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11848   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 629, __pyx_L1_error)
11849   __pyx_t_4 = ((PyArrayObject *)__pyx_t_1);
11850   {
11851     __Pyx_BufFmt_StackElem __pyx_stack[1];
11852     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_p.rcbuffer->pybuffer);
11853     __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_p.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
11854     if (unlikely(__pyx_t_5 < 0)) {
11855       PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
11856       if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_p.rcbuffer->pybuffer, (PyObject*)__pyx_v_p, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
11857         Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
11858         __Pyx_RaiseBufferFallbackError();
11859       } else {
11860         PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
11861       }
11862       __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
11863     }
11864     __pyx_pybuffernd_p.diminfo[0].strides = __pyx_pybuffernd_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_p.diminfo[0].shape = __pyx_pybuffernd_p.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_p.diminfo[1].strides = __pyx_pybuffernd_p.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_p.diminfo[1].shape = __pyx_pybuffernd_p.rcbuffer->pybuffer.shape[1];
11865     if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(1, 629, __pyx_L1_error)
11866   }
11867   __pyx_t_4 = 0;
11868   __pyx_v_p = ((PyArrayObject *)__pyx_t_1);
11869   __pyx_t_1 = 0;
11870 
11871   /* "yt/utilities/lib/geometry_utils.pyx":630
11872  *     cdef np.ndarray[np.uint64_t, ndim=1] mi_neighbors
11873  *     p = get_morton_points(mi)
11874  *     mi_neighbors = np.zeros(26*mi.shape[0], 'uint64')             # <<<<<<<<<<<<<<
11875  *     n = 0
11876  *     max_index = np.int64(1 << order)
11877  */
11878   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 630, __pyx_L1_error)
11879   __Pyx_GOTREF(__pyx_t_2);
11880   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 630, __pyx_L1_error)
11881   __Pyx_GOTREF(__pyx_t_3);
11882   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11883   __pyx_t_2 = __Pyx_PyInt_From_long((26 * (__pyx_v_mi->dimensions[0]))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 630, __pyx_L1_error)
11884   __Pyx_GOTREF(__pyx_t_2);
11885   __pyx_t_9 = NULL;
11886   __pyx_t_5 = 0;
11887   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
11888     __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
11889     if (likely(__pyx_t_9)) {
11890       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
11891       __Pyx_INCREF(__pyx_t_9);
11892       __Pyx_INCREF(function);
11893       __Pyx_DECREF_SET(__pyx_t_3, function);
11894       __pyx_t_5 = 1;
11895     }
11896   }
11897   #if CYTHON_FAST_PYCALL
11898   if (PyFunction_Check(__pyx_t_3)) {
11899     PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_2, __pyx_n_s_uint64};
11900     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 630, __pyx_L1_error)
11901     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
11902     __Pyx_GOTREF(__pyx_t_1);
11903     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11904   } else
11905   #endif
11906   #if CYTHON_FAST_PYCCALL
11907   if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
11908     PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_2, __pyx_n_s_uint64};
11909     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 630, __pyx_L1_error)
11910     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
11911     __Pyx_GOTREF(__pyx_t_1);
11912     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11913   } else
11914   #endif
11915   {
11916     __pyx_t_10 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 630, __pyx_L1_error)
11917     __Pyx_GOTREF(__pyx_t_10);
11918     if (__pyx_t_9) {
11919       __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
11920     }
11921     __Pyx_GIVEREF(__pyx_t_2);
11922     PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_5, __pyx_t_2);
11923     __Pyx_INCREF(__pyx_n_s_uint64);
11924     __Pyx_GIVEREF(__pyx_n_s_uint64);
11925     PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_5, __pyx_n_s_uint64);
11926     __pyx_t_2 = 0;
11927     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 630, __pyx_L1_error)
11928     __Pyx_GOTREF(__pyx_t_1);
11929     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
11930   }
11931   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11932   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 630, __pyx_L1_error)
11933   __pyx_t_11 = ((PyArrayObject *)__pyx_t_1);
11934   {
11935     __Pyx_BufFmt_StackElem __pyx_stack[1];
11936     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer);
11937     __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
11938     if (unlikely(__pyx_t_5 < 0)) {
11939       PyErr_Fetch(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
11940       if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer, (PyObject*)__pyx_v_mi_neighbors, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
11941         Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_6);
11942         __Pyx_RaiseBufferFallbackError();
11943       } else {
11944         PyErr_Restore(__pyx_t_8, __pyx_t_7, __pyx_t_6);
11945       }
11946       __pyx_t_8 = __pyx_t_7 = __pyx_t_6 = 0;
11947     }
11948     __pyx_pybuffernd_mi_neighbors.diminfo[0].strides = __pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mi_neighbors.diminfo[0].shape = __pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer.shape[0];
11949     if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(1, 630, __pyx_L1_error)
11950   }
11951   __pyx_t_11 = 0;
11952   __pyx_v_mi_neighbors = ((PyArrayObject *)__pyx_t_1);
11953   __pyx_t_1 = 0;
11954 
11955   /* "yt/utilities/lib/geometry_utils.pyx":631
11956  *     p = get_morton_points(mi)
11957  *     mi_neighbors = np.zeros(26*mi.shape[0], 'uint64')
11958  *     n = 0             # <<<<<<<<<<<<<<
11959  *     max_index = np.int64(1 << order)
11960  *     # Define function
11961  */
11962   __pyx_v_n = 0;
11963 
11964   /* "yt/utilities/lib/geometry_utils.pyx":632
11965  *     mi_neighbors = np.zeros(26*mi.shape[0], 'uint64')
11966  *     n = 0
11967  *     max_index = np.int64(1 << order)             # <<<<<<<<<<<<<<
11968  *     # Define function
11969  *     if periodic:
11970  */
11971   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 632, __pyx_L1_error)
11972   __Pyx_GOTREF(__pyx_t_3);
11973   __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int64); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 632, __pyx_L1_error)
11974   __Pyx_GOTREF(__pyx_t_10);
11975   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11976   __pyx_t_3 = __Pyx_PyInt_From_long((1 << __pyx_v_order)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 632, __pyx_L1_error)
11977   __Pyx_GOTREF(__pyx_t_3);
11978   __pyx_t_2 = NULL;
11979   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
11980     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10);
11981     if (likely(__pyx_t_2)) {
11982       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
11983       __Pyx_INCREF(__pyx_t_2);
11984       __Pyx_INCREF(function);
11985       __Pyx_DECREF_SET(__pyx_t_10, function);
11986     }
11987   }
11988   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_3);
11989   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11990   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11991   if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 632, __pyx_L1_error)
11992   __Pyx_GOTREF(__pyx_t_1);
11993   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
11994   __pyx_t_12 = __Pyx_PyInt_As_npy_uint64(__pyx_t_1); if (unlikely((__pyx_t_12 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 632, __pyx_L1_error)
11995   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11996   __pyx_v_max_index = __pyx_t_12;
11997 
11998   /* "yt/utilities/lib/geometry_utils.pyx":634
11999  *     max_index = np.int64(1 << order)
12000  *     # Define function
12001  *     if periodic:             # <<<<<<<<<<<<<<
12002  *         fneighbor = morton_neighbor_periodic
12003  *     else:
12004  */
12005   __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_periodic); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(1, 634, __pyx_L1_error)
12006   if (__pyx_t_13) {
12007 
12008     /* "yt/utilities/lib/geometry_utils.pyx":635
12009  *     # Define function
12010  *     if periodic:
12011  *         fneighbor = morton_neighbor_periodic             # <<<<<<<<<<<<<<
12012  *     else:
12013  *         fneighbor = morton_neighbor_bounded
12014  */
12015     __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_morton_neighbor_periodic); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 635, __pyx_L1_error)
12016     __Pyx_GOTREF(__pyx_t_1);
12017     __pyx_v_fneighbor = __pyx_t_1;
12018     __pyx_t_1 = 0;
12019 
12020     /* "yt/utilities/lib/geometry_utils.pyx":634
12021  *     max_index = np.int64(1 << order)
12022  *     # Define function
12023  *     if periodic:             # <<<<<<<<<<<<<<
12024  *         fneighbor = morton_neighbor_periodic
12025  *     else:
12026  */
12027     goto __pyx_L3;
12028   }
12029 
12030   /* "yt/utilities/lib/geometry_utils.pyx":637
12031  *         fneighbor = morton_neighbor_periodic
12032  *     else:
12033  *         fneighbor = morton_neighbor_bounded             # <<<<<<<<<<<<<<
12034  *     for i in range(mi.shape[0]):
12035  *         for j in range(3):
12036  */
12037   /*else*/ {
12038     __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_morton_neighbor_bounded); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 637, __pyx_L1_error)
12039     __Pyx_GOTREF(__pyx_t_1);
12040     __pyx_v_fneighbor = __pyx_t_1;
12041     __pyx_t_1 = 0;
12042   }
12043   __pyx_L3:;
12044 
12045   /* "yt/utilities/lib/geometry_utils.pyx":638
12046  *     else:
12047  *         fneighbor = morton_neighbor_bounded
12048  *     for i in range(mi.shape[0]):             # <<<<<<<<<<<<<<
12049  *         for j in range(3):
12050  *             # +1 in dimension j
12051  */
12052   __pyx_t_14 = (__pyx_v_mi->dimensions[0]);
12053   __pyx_t_15 = __pyx_t_14;
12054   for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_15; __pyx_t_5+=1) {
12055     __pyx_v_i = __pyx_t_5;
12056 
12057     /* "yt/utilities/lib/geometry_utils.pyx":639
12058  *         fneighbor = morton_neighbor_bounded
12059  *     for i in range(mi.shape[0]):
12060  *         for j in range(3):             # <<<<<<<<<<<<<<
12061  *             # +1 in dimension j
12062  *             nmi = fneighbor(p[i,:],[j],[+1],max_index)
12063  */
12064     for (__pyx_t_16 = 0; __pyx_t_16 < 3; __pyx_t_16+=1) {
12065       __pyx_v_j = __pyx_t_16;
12066 
12067       /* "yt/utilities/lib/geometry_utils.pyx":641
12068  *         for j in range(3):
12069  *             # +1 in dimension j
12070  *             nmi = fneighbor(p[i,:],[j],[+1],max_index)             # <<<<<<<<<<<<<<
12071  *             if nmi > 0:
12072  *                 mi_neighbors[n] = np.uint64(nmi)
12073  */
12074       __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 641, __pyx_L1_error)
12075       __Pyx_GOTREF(__pyx_t_10);
12076       __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 641, __pyx_L1_error)
12077       __Pyx_GOTREF(__pyx_t_3);
12078       __Pyx_GIVEREF(__pyx_t_10);
12079       PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10);
12080       __Pyx_INCREF(__pyx_slice__4);
12081       __Pyx_GIVEREF(__pyx_slice__4);
12082       PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_slice__4);
12083       __pyx_t_10 = 0;
12084       __pyx_t_10 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_p), __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 641, __pyx_L1_error)
12085       __Pyx_GOTREF(__pyx_t_10);
12086       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12087       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 641, __pyx_L1_error)
12088       __Pyx_GOTREF(__pyx_t_3);
12089       __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 641, __pyx_L1_error)
12090       __Pyx_GOTREF(__pyx_t_2);
12091       __Pyx_GIVEREF(__pyx_t_3);
12092       PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
12093       __pyx_t_3 = 0;
12094       __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 641, __pyx_L1_error)
12095       __Pyx_GOTREF(__pyx_t_3);
12096       __Pyx_INCREF(__pyx_int_1);
12097       __Pyx_GIVEREF(__pyx_int_1);
12098       PyList_SET_ITEM(__pyx_t_3, 0, __pyx_int_1);
12099       __pyx_t_9 = __Pyx_PyInt_From_npy_uint64(__pyx_v_max_index); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 641, __pyx_L1_error)
12100       __Pyx_GOTREF(__pyx_t_9);
12101       __Pyx_INCREF(__pyx_v_fneighbor);
12102       __pyx_t_17 = __pyx_v_fneighbor; __pyx_t_18 = NULL;
12103       __pyx_t_19 = 0;
12104       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) {
12105         __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_17);
12106         if (likely(__pyx_t_18)) {
12107           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
12108           __Pyx_INCREF(__pyx_t_18);
12109           __Pyx_INCREF(function);
12110           __Pyx_DECREF_SET(__pyx_t_17, function);
12111           __pyx_t_19 = 1;
12112         }
12113       }
12114       #if CYTHON_FAST_PYCALL
12115       if (PyFunction_Check(__pyx_t_17)) {
12116         PyObject *__pyx_temp[5] = {__pyx_t_18, __pyx_t_10, __pyx_t_2, __pyx_t_3, __pyx_t_9};
12117         __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_19, 4+__pyx_t_19); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 641, __pyx_L1_error)
12118         __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
12119         __Pyx_GOTREF(__pyx_t_1);
12120         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
12121         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12122         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12123         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12124       } else
12125       #endif
12126       #if CYTHON_FAST_PYCCALL
12127       if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) {
12128         PyObject *__pyx_temp[5] = {__pyx_t_18, __pyx_t_10, __pyx_t_2, __pyx_t_3, __pyx_t_9};
12129         __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_19, 4+__pyx_t_19); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 641, __pyx_L1_error)
12130         __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
12131         __Pyx_GOTREF(__pyx_t_1);
12132         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
12133         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12134         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12135         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12136       } else
12137       #endif
12138       {
12139         __pyx_t_20 = PyTuple_New(4+__pyx_t_19); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 641, __pyx_L1_error)
12140         __Pyx_GOTREF(__pyx_t_20);
12141         if (__pyx_t_18) {
12142           __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_18); __pyx_t_18 = NULL;
12143         }
12144         __Pyx_GIVEREF(__pyx_t_10);
12145         PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_19, __pyx_t_10);
12146         __Pyx_GIVEREF(__pyx_t_2);
12147         PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_19, __pyx_t_2);
12148         __Pyx_GIVEREF(__pyx_t_3);
12149         PyTuple_SET_ITEM(__pyx_t_20, 2+__pyx_t_19, __pyx_t_3);
12150         __Pyx_GIVEREF(__pyx_t_9);
12151         PyTuple_SET_ITEM(__pyx_t_20, 3+__pyx_t_19, __pyx_t_9);
12152         __pyx_t_10 = 0;
12153         __pyx_t_2 = 0;
12154         __pyx_t_3 = 0;
12155         __pyx_t_9 = 0;
12156         __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 641, __pyx_L1_error)
12157         __Pyx_GOTREF(__pyx_t_1);
12158         __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
12159       }
12160       __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
12161       __pyx_t_21 = __Pyx_PyInt_As_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_21 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 641, __pyx_L1_error)
12162       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12163       __pyx_v_nmi = __pyx_t_21;
12164 
12165       /* "yt/utilities/lib/geometry_utils.pyx":642
12166  *             # +1 in dimension j
12167  *             nmi = fneighbor(p[i,:],[j],[+1],max_index)
12168  *             if nmi > 0:             # <<<<<<<<<<<<<<
12169  *                 mi_neighbors[n] = np.uint64(nmi)
12170  *                 n+=1
12171  */
12172       __pyx_t_13 = ((__pyx_v_nmi > 0) != 0);
12173       if (__pyx_t_13) {
12174 
12175         /* "yt/utilities/lib/geometry_utils.pyx":643
12176  *             nmi = fneighbor(p[i,:],[j],[+1],max_index)
12177  *             if nmi > 0:
12178  *                 mi_neighbors[n] = np.uint64(nmi)             # <<<<<<<<<<<<<<
12179  *                 n+=1
12180  *                 # +/- in dimension k
12181  */
12182         __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_n_s_np); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 643, __pyx_L1_error)
12183         __Pyx_GOTREF(__pyx_t_17);
12184         __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_uint64); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 643, __pyx_L1_error)
12185         __Pyx_GOTREF(__pyx_t_20);
12186         __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
12187         __pyx_t_17 = __Pyx_PyInt_From_npy_int64(__pyx_v_nmi); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 643, __pyx_L1_error)
12188         __Pyx_GOTREF(__pyx_t_17);
12189         __pyx_t_9 = NULL;
12190         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
12191           __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_20);
12192           if (likely(__pyx_t_9)) {
12193             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
12194             __Pyx_INCREF(__pyx_t_9);
12195             __Pyx_INCREF(function);
12196             __Pyx_DECREF_SET(__pyx_t_20, function);
12197           }
12198         }
12199         __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_20, __pyx_t_9, __pyx_t_17) : __Pyx_PyObject_CallOneArg(__pyx_t_20, __pyx_t_17);
12200         __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
12201         __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
12202         if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 643, __pyx_L1_error)
12203         __Pyx_GOTREF(__pyx_t_1);
12204         __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
12205         __pyx_t_12 = __Pyx_PyInt_As_npy_uint64(__pyx_t_1); if (unlikely((__pyx_t_12 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 643, __pyx_L1_error)
12206         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12207         __pyx_t_22 = __pyx_v_n;
12208         *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_mi_neighbors.diminfo[0].strides) = __pyx_t_12;
12209 
12210         /* "yt/utilities/lib/geometry_utils.pyx":644
12211  *             if nmi > 0:
12212  *                 mi_neighbors[n] = np.uint64(nmi)
12213  *                 n+=1             # <<<<<<<<<<<<<<
12214  *                 # +/- in dimension k
12215  *                 for k in range(j+1,3):
12216  */
12217         __pyx_v_n = (__pyx_v_n + 1);
12218 
12219         /* "yt/utilities/lib/geometry_utils.pyx":646
12220  *                 n+=1
12221  *                 # +/- in dimension k
12222  *                 for k in range(j+1,3):             # <<<<<<<<<<<<<<
12223  *                     # +1 in dimension k
12224  *                     nmi = fneighbor(p[i,:],[j,k],[+1,+1],max_index)
12225  */
12226         for (__pyx_t_19 = (__pyx_v_j + 1); __pyx_t_19 < 3; __pyx_t_19+=1) {
12227           __pyx_v_k = __pyx_t_19;
12228 
12229           /* "yt/utilities/lib/geometry_utils.pyx":648
12230  *                 for k in range(j+1,3):
12231  *                     # +1 in dimension k
12232  *                     nmi = fneighbor(p[i,:],[j,k],[+1,+1],max_index)             # <<<<<<<<<<<<<<
12233  *                     if nmi > 0:
12234  *                         mi_neighbors[n] = np.uint64(nmi)
12235  */
12236           __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 648, __pyx_L1_error)
12237           __Pyx_GOTREF(__pyx_t_20);
12238           __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 648, __pyx_L1_error)
12239           __Pyx_GOTREF(__pyx_t_17);
12240           __Pyx_GIVEREF(__pyx_t_20);
12241           PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_20);
12242           __Pyx_INCREF(__pyx_slice__4);
12243           __Pyx_GIVEREF(__pyx_slice__4);
12244           PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_slice__4);
12245           __pyx_t_20 = 0;
12246           __pyx_t_20 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_p), __pyx_t_17); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 648, __pyx_L1_error)
12247           __Pyx_GOTREF(__pyx_t_20);
12248           __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
12249           __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 648, __pyx_L1_error)
12250           __Pyx_GOTREF(__pyx_t_17);
12251           __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 648, __pyx_L1_error)
12252           __Pyx_GOTREF(__pyx_t_9);
12253           __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 648, __pyx_L1_error)
12254           __Pyx_GOTREF(__pyx_t_3);
12255           __Pyx_GIVEREF(__pyx_t_17);
12256           PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_17);
12257           __Pyx_GIVEREF(__pyx_t_9);
12258           PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_9);
12259           __pyx_t_17 = 0;
12260           __pyx_t_9 = 0;
12261           __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 648, __pyx_L1_error)
12262           __Pyx_GOTREF(__pyx_t_9);
12263           __Pyx_INCREF(__pyx_int_1);
12264           __Pyx_GIVEREF(__pyx_int_1);
12265           PyList_SET_ITEM(__pyx_t_9, 0, __pyx_int_1);
12266           __Pyx_INCREF(__pyx_int_1);
12267           __Pyx_GIVEREF(__pyx_int_1);
12268           PyList_SET_ITEM(__pyx_t_9, 1, __pyx_int_1);
12269           __pyx_t_17 = __Pyx_PyInt_From_npy_uint64(__pyx_v_max_index); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 648, __pyx_L1_error)
12270           __Pyx_GOTREF(__pyx_t_17);
12271           __Pyx_INCREF(__pyx_v_fneighbor);
12272           __pyx_t_2 = __pyx_v_fneighbor; __pyx_t_10 = NULL;
12273           __pyx_t_23 = 0;
12274           if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
12275             __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
12276             if (likely(__pyx_t_10)) {
12277               PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12278               __Pyx_INCREF(__pyx_t_10);
12279               __Pyx_INCREF(function);
12280               __Pyx_DECREF_SET(__pyx_t_2, function);
12281               __pyx_t_23 = 1;
12282             }
12283           }
12284           #if CYTHON_FAST_PYCALL
12285           if (PyFunction_Check(__pyx_t_2)) {
12286             PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_t_20, __pyx_t_3, __pyx_t_9, __pyx_t_17};
12287             __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_23, 4+__pyx_t_23); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 648, __pyx_L1_error)
12288             __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
12289             __Pyx_GOTREF(__pyx_t_1);
12290             __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
12291             __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12292             __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12293             __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
12294           } else
12295           #endif
12296           #if CYTHON_FAST_PYCCALL
12297           if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
12298             PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_t_20, __pyx_t_3, __pyx_t_9, __pyx_t_17};
12299             __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_23, 4+__pyx_t_23); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 648, __pyx_L1_error)
12300             __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
12301             __Pyx_GOTREF(__pyx_t_1);
12302             __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
12303             __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12304             __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12305             __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
12306           } else
12307           #endif
12308           {
12309             __pyx_t_18 = PyTuple_New(4+__pyx_t_23); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 648, __pyx_L1_error)
12310             __Pyx_GOTREF(__pyx_t_18);
12311             if (__pyx_t_10) {
12312               __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_10); __pyx_t_10 = NULL;
12313             }
12314             __Pyx_GIVEREF(__pyx_t_20);
12315             PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_23, __pyx_t_20);
12316             __Pyx_GIVEREF(__pyx_t_3);
12317             PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_23, __pyx_t_3);
12318             __Pyx_GIVEREF(__pyx_t_9);
12319             PyTuple_SET_ITEM(__pyx_t_18, 2+__pyx_t_23, __pyx_t_9);
12320             __Pyx_GIVEREF(__pyx_t_17);
12321             PyTuple_SET_ITEM(__pyx_t_18, 3+__pyx_t_23, __pyx_t_17);
12322             __pyx_t_20 = 0;
12323             __pyx_t_3 = 0;
12324             __pyx_t_9 = 0;
12325             __pyx_t_17 = 0;
12326             __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 648, __pyx_L1_error)
12327             __Pyx_GOTREF(__pyx_t_1);
12328             __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
12329           }
12330           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12331           __pyx_t_21 = __Pyx_PyInt_As_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_21 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 648, __pyx_L1_error)
12332           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12333           __pyx_v_nmi = __pyx_t_21;
12334 
12335           /* "yt/utilities/lib/geometry_utils.pyx":649
12336  *                     # +1 in dimension k
12337  *                     nmi = fneighbor(p[i,:],[j,k],[+1,+1],max_index)
12338  *                     if nmi > 0:             # <<<<<<<<<<<<<<
12339  *                         mi_neighbors[n] = np.uint64(nmi)
12340  *                         n+=1
12341  */
12342           __pyx_t_13 = ((__pyx_v_nmi > 0) != 0);
12343           if (__pyx_t_13) {
12344 
12345             /* "yt/utilities/lib/geometry_utils.pyx":650
12346  *                     nmi = fneighbor(p[i,:],[j,k],[+1,+1],max_index)
12347  *                     if nmi > 0:
12348  *                         mi_neighbors[n] = np.uint64(nmi)             # <<<<<<<<<<<<<<
12349  *                         n+=1
12350  *                         # +/- in dimension l
12351  */
12352             __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 650, __pyx_L1_error)
12353             __Pyx_GOTREF(__pyx_t_2);
12354             __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_uint64); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 650, __pyx_L1_error)
12355             __Pyx_GOTREF(__pyx_t_18);
12356             __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12357             __pyx_t_2 = __Pyx_PyInt_From_npy_int64(__pyx_v_nmi); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 650, __pyx_L1_error)
12358             __Pyx_GOTREF(__pyx_t_2);
12359             __pyx_t_17 = NULL;
12360             if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_18))) {
12361               __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_18);
12362               if (likely(__pyx_t_17)) {
12363                 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
12364                 __Pyx_INCREF(__pyx_t_17);
12365                 __Pyx_INCREF(function);
12366                 __Pyx_DECREF_SET(__pyx_t_18, function);
12367               }
12368             }
12369             __pyx_t_1 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_18, __pyx_t_17, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_t_2);
12370             __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
12371             __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12372             if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 650, __pyx_L1_error)
12373             __Pyx_GOTREF(__pyx_t_1);
12374             __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
12375             __pyx_t_12 = __Pyx_PyInt_As_npy_uint64(__pyx_t_1); if (unlikely((__pyx_t_12 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 650, __pyx_L1_error)
12376             __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12377             __pyx_t_24 = __pyx_v_n;
12378             *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_mi_neighbors.diminfo[0].strides) = __pyx_t_12;
12379 
12380             /* "yt/utilities/lib/geometry_utils.pyx":651
12381  *                     if nmi > 0:
12382  *                         mi_neighbors[n] = np.uint64(nmi)
12383  *                         n+=1             # <<<<<<<<<<<<<<
12384  *                         # +/- in dimension l
12385  *                         for l in range(k+1,3):
12386  */
12387             __pyx_v_n = (__pyx_v_n + 1);
12388 
12389             /* "yt/utilities/lib/geometry_utils.pyx":653
12390  *                         n+=1
12391  *                         # +/- in dimension l
12392  *                         for l in range(k+1,3):             # <<<<<<<<<<<<<<
12393  *                             nmi = fneighbor(p[i,:],[j,k,l],[+1,+1,+1],max_index)
12394  *                             if nmi > 0:
12395  */
12396             for (__pyx_t_23 = (__pyx_v_k + 1); __pyx_t_23 < 3; __pyx_t_23+=1) {
12397               __pyx_v_l = __pyx_t_23;
12398 
12399               /* "yt/utilities/lib/geometry_utils.pyx":654
12400  *                         # +/- in dimension l
12401  *                         for l in range(k+1,3):
12402  *                             nmi = fneighbor(p[i,:],[j,k,l],[+1,+1,+1],max_index)             # <<<<<<<<<<<<<<
12403  *                             if nmi > 0:
12404  *                                 mi_neighbors[n] = np.uint64(nmi)
12405  */
12406               __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 654, __pyx_L1_error)
12407               __Pyx_GOTREF(__pyx_t_18);
12408               __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 654, __pyx_L1_error)
12409               __Pyx_GOTREF(__pyx_t_2);
12410               __Pyx_GIVEREF(__pyx_t_18);
12411               PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_18);
12412               __Pyx_INCREF(__pyx_slice__4);
12413               __Pyx_GIVEREF(__pyx_slice__4);
12414               PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_slice__4);
12415               __pyx_t_18 = 0;
12416               __pyx_t_18 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_p), __pyx_t_2); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 654, __pyx_L1_error)
12417               __Pyx_GOTREF(__pyx_t_18);
12418               __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12419               __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 654, __pyx_L1_error)
12420               __Pyx_GOTREF(__pyx_t_2);
12421               __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 654, __pyx_L1_error)
12422               __Pyx_GOTREF(__pyx_t_17);
12423               __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_l); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 654, __pyx_L1_error)
12424               __Pyx_GOTREF(__pyx_t_9);
12425               __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 654, __pyx_L1_error)
12426               __Pyx_GOTREF(__pyx_t_3);
12427               __Pyx_GIVEREF(__pyx_t_2);
12428               PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
12429               __Pyx_GIVEREF(__pyx_t_17);
12430               PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_17);
12431               __Pyx_GIVEREF(__pyx_t_9);
12432               PyList_SET_ITEM(__pyx_t_3, 2, __pyx_t_9);
12433               __pyx_t_2 = 0;
12434               __pyx_t_17 = 0;
12435               __pyx_t_9 = 0;
12436               __pyx_t_9 = PyList_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 654, __pyx_L1_error)
12437               __Pyx_GOTREF(__pyx_t_9);
12438               __Pyx_INCREF(__pyx_int_1);
12439               __Pyx_GIVEREF(__pyx_int_1);
12440               PyList_SET_ITEM(__pyx_t_9, 0, __pyx_int_1);
12441               __Pyx_INCREF(__pyx_int_1);
12442               __Pyx_GIVEREF(__pyx_int_1);
12443               PyList_SET_ITEM(__pyx_t_9, 1, __pyx_int_1);
12444               __Pyx_INCREF(__pyx_int_1);
12445               __Pyx_GIVEREF(__pyx_int_1);
12446               PyList_SET_ITEM(__pyx_t_9, 2, __pyx_int_1);
12447               __pyx_t_17 = __Pyx_PyInt_From_npy_uint64(__pyx_v_max_index); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 654, __pyx_L1_error)
12448               __Pyx_GOTREF(__pyx_t_17);
12449               __Pyx_INCREF(__pyx_v_fneighbor);
12450               __pyx_t_2 = __pyx_v_fneighbor; __pyx_t_20 = NULL;
12451               __pyx_t_25 = 0;
12452               if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
12453                 __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_2);
12454                 if (likely(__pyx_t_20)) {
12455                   PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12456                   __Pyx_INCREF(__pyx_t_20);
12457                   __Pyx_INCREF(function);
12458                   __Pyx_DECREF_SET(__pyx_t_2, function);
12459                   __pyx_t_25 = 1;
12460                 }
12461               }
12462               #if CYTHON_FAST_PYCALL
12463               if (PyFunction_Check(__pyx_t_2)) {
12464                 PyObject *__pyx_temp[5] = {__pyx_t_20, __pyx_t_18, __pyx_t_3, __pyx_t_9, __pyx_t_17};
12465                 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_25, 4+__pyx_t_25); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 654, __pyx_L1_error)
12466                 __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
12467                 __Pyx_GOTREF(__pyx_t_1);
12468                 __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
12469                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12470                 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12471                 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
12472               } else
12473               #endif
12474               #if CYTHON_FAST_PYCCALL
12475               if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
12476                 PyObject *__pyx_temp[5] = {__pyx_t_20, __pyx_t_18, __pyx_t_3, __pyx_t_9, __pyx_t_17};
12477                 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_25, 4+__pyx_t_25); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 654, __pyx_L1_error)
12478                 __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
12479                 __Pyx_GOTREF(__pyx_t_1);
12480                 __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
12481                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12482                 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12483                 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
12484               } else
12485               #endif
12486               {
12487                 __pyx_t_10 = PyTuple_New(4+__pyx_t_25); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 654, __pyx_L1_error)
12488                 __Pyx_GOTREF(__pyx_t_10);
12489                 if (__pyx_t_20) {
12490                   __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_20); __pyx_t_20 = NULL;
12491                 }
12492                 __Pyx_GIVEREF(__pyx_t_18);
12493                 PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_25, __pyx_t_18);
12494                 __Pyx_GIVEREF(__pyx_t_3);
12495                 PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_25, __pyx_t_3);
12496                 __Pyx_GIVEREF(__pyx_t_9);
12497                 PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_25, __pyx_t_9);
12498                 __Pyx_GIVEREF(__pyx_t_17);
12499                 PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_25, __pyx_t_17);
12500                 __pyx_t_18 = 0;
12501                 __pyx_t_3 = 0;
12502                 __pyx_t_9 = 0;
12503                 __pyx_t_17 = 0;
12504                 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 654, __pyx_L1_error)
12505                 __Pyx_GOTREF(__pyx_t_1);
12506                 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
12507               }
12508               __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12509               __pyx_t_21 = __Pyx_PyInt_As_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_21 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 654, __pyx_L1_error)
12510               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12511               __pyx_v_nmi = __pyx_t_21;
12512 
12513               /* "yt/utilities/lib/geometry_utils.pyx":655
12514  *                         for l in range(k+1,3):
12515  *                             nmi = fneighbor(p[i,:],[j,k,l],[+1,+1,+1],max_index)
12516  *                             if nmi > 0:             # <<<<<<<<<<<<<<
12517  *                                 mi_neighbors[n] = np.uint64(nmi)
12518  *                                 n+=1
12519  */
12520               __pyx_t_13 = ((__pyx_v_nmi > 0) != 0);
12521               if (__pyx_t_13) {
12522 
12523                 /* "yt/utilities/lib/geometry_utils.pyx":656
12524  *                             nmi = fneighbor(p[i,:],[j,k,l],[+1,+1,+1],max_index)
12525  *                             if nmi > 0:
12526  *                                 mi_neighbors[n] = np.uint64(nmi)             # <<<<<<<<<<<<<<
12527  *                                 n+=1
12528  *                             nmi = fneighbor(p[i,:],[j,k,l],[+1,+1,-1],max_index)
12529  */
12530                 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 656, __pyx_L1_error)
12531                 __Pyx_GOTREF(__pyx_t_2);
12532                 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_uint64); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 656, __pyx_L1_error)
12533                 __Pyx_GOTREF(__pyx_t_10);
12534                 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12535                 __pyx_t_2 = __Pyx_PyInt_From_npy_int64(__pyx_v_nmi); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 656, __pyx_L1_error)
12536                 __Pyx_GOTREF(__pyx_t_2);
12537                 __pyx_t_17 = NULL;
12538                 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
12539                   __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_10);
12540                   if (likely(__pyx_t_17)) {
12541                     PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
12542                     __Pyx_INCREF(__pyx_t_17);
12543                     __Pyx_INCREF(function);
12544                     __Pyx_DECREF_SET(__pyx_t_10, function);
12545                   }
12546                 }
12547                 __pyx_t_1 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_17, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_2);
12548                 __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
12549                 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12550                 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 656, __pyx_L1_error)
12551                 __Pyx_GOTREF(__pyx_t_1);
12552                 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
12553                 __pyx_t_12 = __Pyx_PyInt_As_npy_uint64(__pyx_t_1); if (unlikely((__pyx_t_12 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 656, __pyx_L1_error)
12554                 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12555                 __pyx_t_26 = __pyx_v_n;
12556                 *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_mi_neighbors.diminfo[0].strides) = __pyx_t_12;
12557 
12558                 /* "yt/utilities/lib/geometry_utils.pyx":657
12559  *                             if nmi > 0:
12560  *                                 mi_neighbors[n] = np.uint64(nmi)
12561  *                                 n+=1             # <<<<<<<<<<<<<<
12562  *                             nmi = fneighbor(p[i,:],[j,k,l],[+1,+1,-1],max_index)
12563  *                             if nmi > 0:
12564  */
12565                 __pyx_v_n = (__pyx_v_n + 1);
12566 
12567                 /* "yt/utilities/lib/geometry_utils.pyx":655
12568  *                         for l in range(k+1,3):
12569  *                             nmi = fneighbor(p[i,:],[j,k,l],[+1,+1,+1],max_index)
12570  *                             if nmi > 0:             # <<<<<<<<<<<<<<
12571  *                                 mi_neighbors[n] = np.uint64(nmi)
12572  *                                 n+=1
12573  */
12574               }
12575 
12576               /* "yt/utilities/lib/geometry_utils.pyx":658
12577  *                                 mi_neighbors[n] = np.uint64(nmi)
12578  *                                 n+=1
12579  *                             nmi = fneighbor(p[i,:],[j,k,l],[+1,+1,-1],max_index)             # <<<<<<<<<<<<<<
12580  *                             if nmi > 0:
12581  *                                 mi_neighbors[n] = np.uint64(nmi)
12582  */
12583               __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 658, __pyx_L1_error)
12584               __Pyx_GOTREF(__pyx_t_10);
12585               __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error)
12586               __Pyx_GOTREF(__pyx_t_2);
12587               __Pyx_GIVEREF(__pyx_t_10);
12588               PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10);
12589               __Pyx_INCREF(__pyx_slice__4);
12590               __Pyx_GIVEREF(__pyx_slice__4);
12591               PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_slice__4);
12592               __pyx_t_10 = 0;
12593               __pyx_t_10 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_p), __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 658, __pyx_L1_error)
12594               __Pyx_GOTREF(__pyx_t_10);
12595               __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12596               __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error)
12597               __Pyx_GOTREF(__pyx_t_2);
12598               __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 658, __pyx_L1_error)
12599               __Pyx_GOTREF(__pyx_t_17);
12600               __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_l); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 658, __pyx_L1_error)
12601               __Pyx_GOTREF(__pyx_t_9);
12602               __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 658, __pyx_L1_error)
12603               __Pyx_GOTREF(__pyx_t_3);
12604               __Pyx_GIVEREF(__pyx_t_2);
12605               PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
12606               __Pyx_GIVEREF(__pyx_t_17);
12607               PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_17);
12608               __Pyx_GIVEREF(__pyx_t_9);
12609               PyList_SET_ITEM(__pyx_t_3, 2, __pyx_t_9);
12610               __pyx_t_2 = 0;
12611               __pyx_t_17 = 0;
12612               __pyx_t_9 = 0;
12613               __pyx_t_9 = PyList_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 658, __pyx_L1_error)
12614               __Pyx_GOTREF(__pyx_t_9);
12615               __Pyx_INCREF(__pyx_int_1);
12616               __Pyx_GIVEREF(__pyx_int_1);
12617               PyList_SET_ITEM(__pyx_t_9, 0, __pyx_int_1);
12618               __Pyx_INCREF(__pyx_int_1);
12619               __Pyx_GIVEREF(__pyx_int_1);
12620               PyList_SET_ITEM(__pyx_t_9, 1, __pyx_int_1);
12621               __Pyx_INCREF(__pyx_int_neg_1);
12622               __Pyx_GIVEREF(__pyx_int_neg_1);
12623               PyList_SET_ITEM(__pyx_t_9, 2, __pyx_int_neg_1);
12624               __pyx_t_17 = __Pyx_PyInt_From_npy_uint64(__pyx_v_max_index); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 658, __pyx_L1_error)
12625               __Pyx_GOTREF(__pyx_t_17);
12626               __Pyx_INCREF(__pyx_v_fneighbor);
12627               __pyx_t_2 = __pyx_v_fneighbor; __pyx_t_18 = NULL;
12628               __pyx_t_25 = 0;
12629               if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
12630                 __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_2);
12631                 if (likely(__pyx_t_18)) {
12632                   PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
12633                   __Pyx_INCREF(__pyx_t_18);
12634                   __Pyx_INCREF(function);
12635                   __Pyx_DECREF_SET(__pyx_t_2, function);
12636                   __pyx_t_25 = 1;
12637                 }
12638               }
12639               #if CYTHON_FAST_PYCALL
12640               if (PyFunction_Check(__pyx_t_2)) {
12641                 PyObject *__pyx_temp[5] = {__pyx_t_18, __pyx_t_10, __pyx_t_3, __pyx_t_9, __pyx_t_17};
12642                 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_25, 4+__pyx_t_25); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 658, __pyx_L1_error)
12643                 __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
12644                 __Pyx_GOTREF(__pyx_t_1);
12645                 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
12646                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12647                 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12648                 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
12649               } else
12650               #endif
12651               #if CYTHON_FAST_PYCCALL
12652               if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
12653                 PyObject *__pyx_temp[5] = {__pyx_t_18, __pyx_t_10, __pyx_t_3, __pyx_t_9, __pyx_t_17};
12654                 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_25, 4+__pyx_t_25); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 658, __pyx_L1_error)
12655                 __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
12656                 __Pyx_GOTREF(__pyx_t_1);
12657                 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
12658                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12659                 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12660                 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
12661               } else
12662               #endif
12663               {
12664                 __pyx_t_20 = PyTuple_New(4+__pyx_t_25); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 658, __pyx_L1_error)
12665                 __Pyx_GOTREF(__pyx_t_20);
12666                 if (__pyx_t_18) {
12667                   __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_18); __pyx_t_18 = NULL;
12668                 }
12669                 __Pyx_GIVEREF(__pyx_t_10);
12670                 PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_25, __pyx_t_10);
12671                 __Pyx_GIVEREF(__pyx_t_3);
12672                 PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_25, __pyx_t_3);
12673                 __Pyx_GIVEREF(__pyx_t_9);
12674                 PyTuple_SET_ITEM(__pyx_t_20, 2+__pyx_t_25, __pyx_t_9);
12675                 __Pyx_GIVEREF(__pyx_t_17);
12676                 PyTuple_SET_ITEM(__pyx_t_20, 3+__pyx_t_25, __pyx_t_17);
12677                 __pyx_t_10 = 0;
12678                 __pyx_t_3 = 0;
12679                 __pyx_t_9 = 0;
12680                 __pyx_t_17 = 0;
12681                 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 658, __pyx_L1_error)
12682                 __Pyx_GOTREF(__pyx_t_1);
12683                 __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
12684               }
12685               __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12686               __pyx_t_21 = __Pyx_PyInt_As_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_21 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 658, __pyx_L1_error)
12687               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12688               __pyx_v_nmi = __pyx_t_21;
12689 
12690               /* "yt/utilities/lib/geometry_utils.pyx":659
12691  *                                 n+=1
12692  *                             nmi = fneighbor(p[i,:],[j,k,l],[+1,+1,-1],max_index)
12693  *                             if nmi > 0:             # <<<<<<<<<<<<<<
12694  *                                 mi_neighbors[n] = np.uint64(nmi)
12695  *                                 n+=1
12696  */
12697               __pyx_t_13 = ((__pyx_v_nmi > 0) != 0);
12698               if (__pyx_t_13) {
12699 
12700                 /* "yt/utilities/lib/geometry_utils.pyx":660
12701  *                             nmi = fneighbor(p[i,:],[j,k,l],[+1,+1,-1],max_index)
12702  *                             if nmi > 0:
12703  *                                 mi_neighbors[n] = np.uint64(nmi)             # <<<<<<<<<<<<<<
12704  *                                 n+=1
12705  *                     # -1 in dimension k
12706  */
12707                 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 660, __pyx_L1_error)
12708                 __Pyx_GOTREF(__pyx_t_2);
12709                 __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_uint64); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 660, __pyx_L1_error)
12710                 __Pyx_GOTREF(__pyx_t_20);
12711                 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12712                 __pyx_t_2 = __Pyx_PyInt_From_npy_int64(__pyx_v_nmi); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 660, __pyx_L1_error)
12713                 __Pyx_GOTREF(__pyx_t_2);
12714                 __pyx_t_17 = NULL;
12715                 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
12716                   __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_20);
12717                   if (likely(__pyx_t_17)) {
12718                     PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
12719                     __Pyx_INCREF(__pyx_t_17);
12720                     __Pyx_INCREF(function);
12721                     __Pyx_DECREF_SET(__pyx_t_20, function);
12722                   }
12723                 }
12724                 __pyx_t_1 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_20, __pyx_t_17, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_20, __pyx_t_2);
12725                 __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
12726                 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12727                 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 660, __pyx_L1_error)
12728                 __Pyx_GOTREF(__pyx_t_1);
12729                 __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
12730                 __pyx_t_12 = __Pyx_PyInt_As_npy_uint64(__pyx_t_1); if (unlikely((__pyx_t_12 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 660, __pyx_L1_error)
12731                 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12732                 __pyx_t_27 = __pyx_v_n;
12733                 *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_mi_neighbors.diminfo[0].strides) = __pyx_t_12;
12734 
12735                 /* "yt/utilities/lib/geometry_utils.pyx":661
12736  *                             if nmi > 0:
12737  *                                 mi_neighbors[n] = np.uint64(nmi)
12738  *                                 n+=1             # <<<<<<<<<<<<<<
12739  *                     # -1 in dimension k
12740  *                     nmi = fneighbor(p[i,:],[j,k],[+1,-1],max_index)
12741  */
12742                 __pyx_v_n = (__pyx_v_n + 1);
12743 
12744                 /* "yt/utilities/lib/geometry_utils.pyx":659
12745  *                                 n+=1
12746  *                             nmi = fneighbor(p[i,:],[j,k,l],[+1,+1,-1],max_index)
12747  *                             if nmi > 0:             # <<<<<<<<<<<<<<
12748  *                                 mi_neighbors[n] = np.uint64(nmi)
12749  *                                 n+=1
12750  */
12751               }
12752             }
12753 
12754             /* "yt/utilities/lib/geometry_utils.pyx":649
12755  *                     # +1 in dimension k
12756  *                     nmi = fneighbor(p[i,:],[j,k],[+1,+1],max_index)
12757  *                     if nmi > 0:             # <<<<<<<<<<<<<<
12758  *                         mi_neighbors[n] = np.uint64(nmi)
12759  *                         n+=1
12760  */
12761           }
12762 
12763           /* "yt/utilities/lib/geometry_utils.pyx":663
12764  *                                 n+=1
12765  *                     # -1 in dimension k
12766  *                     nmi = fneighbor(p[i,:],[j,k],[+1,-1],max_index)             # <<<<<<<<<<<<<<
12767  *                     if nmi > 0:
12768  *                         mi_neighbors[n] = np.uint64(nmi)
12769  */
12770           __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 663, __pyx_L1_error)
12771           __Pyx_GOTREF(__pyx_t_20);
12772           __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error)
12773           __Pyx_GOTREF(__pyx_t_2);
12774           __Pyx_GIVEREF(__pyx_t_20);
12775           PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_20);
12776           __Pyx_INCREF(__pyx_slice__4);
12777           __Pyx_GIVEREF(__pyx_slice__4);
12778           PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_slice__4);
12779           __pyx_t_20 = 0;
12780           __pyx_t_20 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_p), __pyx_t_2); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 663, __pyx_L1_error)
12781           __Pyx_GOTREF(__pyx_t_20);
12782           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12783           __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error)
12784           __Pyx_GOTREF(__pyx_t_2);
12785           __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 663, __pyx_L1_error)
12786           __Pyx_GOTREF(__pyx_t_17);
12787           __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 663, __pyx_L1_error)
12788           __Pyx_GOTREF(__pyx_t_9);
12789           __Pyx_GIVEREF(__pyx_t_2);
12790           PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
12791           __Pyx_GIVEREF(__pyx_t_17);
12792           PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_17);
12793           __pyx_t_2 = 0;
12794           __pyx_t_17 = 0;
12795           __pyx_t_17 = PyList_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 663, __pyx_L1_error)
12796           __Pyx_GOTREF(__pyx_t_17);
12797           __Pyx_INCREF(__pyx_int_1);
12798           __Pyx_GIVEREF(__pyx_int_1);
12799           PyList_SET_ITEM(__pyx_t_17, 0, __pyx_int_1);
12800           __Pyx_INCREF(__pyx_int_neg_1);
12801           __Pyx_GIVEREF(__pyx_int_neg_1);
12802           PyList_SET_ITEM(__pyx_t_17, 1, __pyx_int_neg_1);
12803           __pyx_t_2 = __Pyx_PyInt_From_npy_uint64(__pyx_v_max_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 663, __pyx_L1_error)
12804           __Pyx_GOTREF(__pyx_t_2);
12805           __Pyx_INCREF(__pyx_v_fneighbor);
12806           __pyx_t_3 = __pyx_v_fneighbor; __pyx_t_10 = NULL;
12807           __pyx_t_23 = 0;
12808           if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
12809             __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_3);
12810             if (likely(__pyx_t_10)) {
12811               PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
12812               __Pyx_INCREF(__pyx_t_10);
12813               __Pyx_INCREF(function);
12814               __Pyx_DECREF_SET(__pyx_t_3, function);
12815               __pyx_t_23 = 1;
12816             }
12817           }
12818           #if CYTHON_FAST_PYCALL
12819           if (PyFunction_Check(__pyx_t_3)) {
12820             PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_t_20, __pyx_t_9, __pyx_t_17, __pyx_t_2};
12821             __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_23, 4+__pyx_t_23); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 663, __pyx_L1_error)
12822             __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
12823             __Pyx_GOTREF(__pyx_t_1);
12824             __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
12825             __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12826             __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
12827             __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12828           } else
12829           #endif
12830           #if CYTHON_FAST_PYCCALL
12831           if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
12832             PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_t_20, __pyx_t_9, __pyx_t_17, __pyx_t_2};
12833             __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_23, 4+__pyx_t_23); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 663, __pyx_L1_error)
12834             __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
12835             __Pyx_GOTREF(__pyx_t_1);
12836             __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
12837             __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12838             __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
12839             __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12840           } else
12841           #endif
12842           {
12843             __pyx_t_18 = PyTuple_New(4+__pyx_t_23); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 663, __pyx_L1_error)
12844             __Pyx_GOTREF(__pyx_t_18);
12845             if (__pyx_t_10) {
12846               __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_10); __pyx_t_10 = NULL;
12847             }
12848             __Pyx_GIVEREF(__pyx_t_20);
12849             PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_23, __pyx_t_20);
12850             __Pyx_GIVEREF(__pyx_t_9);
12851             PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_23, __pyx_t_9);
12852             __Pyx_GIVEREF(__pyx_t_17);
12853             PyTuple_SET_ITEM(__pyx_t_18, 2+__pyx_t_23, __pyx_t_17);
12854             __Pyx_GIVEREF(__pyx_t_2);
12855             PyTuple_SET_ITEM(__pyx_t_18, 3+__pyx_t_23, __pyx_t_2);
12856             __pyx_t_20 = 0;
12857             __pyx_t_9 = 0;
12858             __pyx_t_17 = 0;
12859             __pyx_t_2 = 0;
12860             __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 663, __pyx_L1_error)
12861             __Pyx_GOTREF(__pyx_t_1);
12862             __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
12863           }
12864           __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12865           __pyx_t_21 = __Pyx_PyInt_As_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_21 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 663, __pyx_L1_error)
12866           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12867           __pyx_v_nmi = __pyx_t_21;
12868 
12869           /* "yt/utilities/lib/geometry_utils.pyx":664
12870  *                     # -1 in dimension k
12871  *                     nmi = fneighbor(p[i,:],[j,k],[+1,-1],max_index)
12872  *                     if nmi > 0:             # <<<<<<<<<<<<<<
12873  *                         mi_neighbors[n] = np.uint64(nmi)
12874  *                         n+=1
12875  */
12876           __pyx_t_13 = ((__pyx_v_nmi > 0) != 0);
12877           if (__pyx_t_13) {
12878 
12879             /* "yt/utilities/lib/geometry_utils.pyx":665
12880  *                     nmi = fneighbor(p[i,:],[j,k],[+1,-1],max_index)
12881  *                     if nmi > 0:
12882  *                         mi_neighbors[n] = np.uint64(nmi)             # <<<<<<<<<<<<<<
12883  *                         n+=1
12884  *                         # +/- in dimension l
12885  */
12886             __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 665, __pyx_L1_error)
12887             __Pyx_GOTREF(__pyx_t_3);
12888             __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint64); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 665, __pyx_L1_error)
12889             __Pyx_GOTREF(__pyx_t_18);
12890             __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12891             __pyx_t_3 = __Pyx_PyInt_From_npy_int64(__pyx_v_nmi); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 665, __pyx_L1_error)
12892             __Pyx_GOTREF(__pyx_t_3);
12893             __pyx_t_2 = NULL;
12894             if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_18))) {
12895               __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_18);
12896               if (likely(__pyx_t_2)) {
12897                 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
12898                 __Pyx_INCREF(__pyx_t_2);
12899                 __Pyx_INCREF(function);
12900                 __Pyx_DECREF_SET(__pyx_t_18, function);
12901               }
12902             }
12903             __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_18, __pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_t_3);
12904             __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
12905             __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12906             if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 665, __pyx_L1_error)
12907             __Pyx_GOTREF(__pyx_t_1);
12908             __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
12909             __pyx_t_12 = __Pyx_PyInt_As_npy_uint64(__pyx_t_1); if (unlikely((__pyx_t_12 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 665, __pyx_L1_error)
12910             __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12911             __pyx_t_28 = __pyx_v_n;
12912             *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_mi_neighbors.diminfo[0].strides) = __pyx_t_12;
12913 
12914             /* "yt/utilities/lib/geometry_utils.pyx":666
12915  *                     if nmi > 0:
12916  *                         mi_neighbors[n] = np.uint64(nmi)
12917  *                         n+=1             # <<<<<<<<<<<<<<
12918  *                         # +/- in dimension l
12919  *                         for l in range(k+1,3):
12920  */
12921             __pyx_v_n = (__pyx_v_n + 1);
12922 
12923             /* "yt/utilities/lib/geometry_utils.pyx":668
12924  *                         n+=1
12925  *                         # +/- in dimension l
12926  *                         for l in range(k+1,3):             # <<<<<<<<<<<<<<
12927  *                             nmi = fneighbor(p[i,:],[j,k,l],[+1,-1,+1],max_index)
12928  *                             if nmi > 0:
12929  */
12930             for (__pyx_t_23 = (__pyx_v_k + 1); __pyx_t_23 < 3; __pyx_t_23+=1) {
12931               __pyx_v_l = __pyx_t_23;
12932 
12933               /* "yt/utilities/lib/geometry_utils.pyx":669
12934  *                         # +/- in dimension l
12935  *                         for l in range(k+1,3):
12936  *                             nmi = fneighbor(p[i,:],[j,k,l],[+1,-1,+1],max_index)             # <<<<<<<<<<<<<<
12937  *                             if nmi > 0:
12938  *                                 mi_neighbors[n] = np.uint64(nmi)
12939  */
12940               __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 669, __pyx_L1_error)
12941               __Pyx_GOTREF(__pyx_t_18);
12942               __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 669, __pyx_L1_error)
12943               __Pyx_GOTREF(__pyx_t_3);
12944               __Pyx_GIVEREF(__pyx_t_18);
12945               PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_18);
12946               __Pyx_INCREF(__pyx_slice__4);
12947               __Pyx_GIVEREF(__pyx_slice__4);
12948               PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_slice__4);
12949               __pyx_t_18 = 0;
12950               __pyx_t_18 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_p), __pyx_t_3); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 669, __pyx_L1_error)
12951               __Pyx_GOTREF(__pyx_t_18);
12952               __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12953               __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 669, __pyx_L1_error)
12954               __Pyx_GOTREF(__pyx_t_3);
12955               __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 669, __pyx_L1_error)
12956               __Pyx_GOTREF(__pyx_t_2);
12957               __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_l); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 669, __pyx_L1_error)
12958               __Pyx_GOTREF(__pyx_t_17);
12959               __pyx_t_9 = PyList_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 669, __pyx_L1_error)
12960               __Pyx_GOTREF(__pyx_t_9);
12961               __Pyx_GIVEREF(__pyx_t_3);
12962               PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_3);
12963               __Pyx_GIVEREF(__pyx_t_2);
12964               PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_2);
12965               __Pyx_GIVEREF(__pyx_t_17);
12966               PyList_SET_ITEM(__pyx_t_9, 2, __pyx_t_17);
12967               __pyx_t_3 = 0;
12968               __pyx_t_2 = 0;
12969               __pyx_t_17 = 0;
12970               __pyx_t_17 = PyList_New(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 669, __pyx_L1_error)
12971               __Pyx_GOTREF(__pyx_t_17);
12972               __Pyx_INCREF(__pyx_int_1);
12973               __Pyx_GIVEREF(__pyx_int_1);
12974               PyList_SET_ITEM(__pyx_t_17, 0, __pyx_int_1);
12975               __Pyx_INCREF(__pyx_int_neg_1);
12976               __Pyx_GIVEREF(__pyx_int_neg_1);
12977               PyList_SET_ITEM(__pyx_t_17, 1, __pyx_int_neg_1);
12978               __Pyx_INCREF(__pyx_int_1);
12979               __Pyx_GIVEREF(__pyx_int_1);
12980               PyList_SET_ITEM(__pyx_t_17, 2, __pyx_int_1);
12981               __pyx_t_2 = __Pyx_PyInt_From_npy_uint64(__pyx_v_max_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 669, __pyx_L1_error)
12982               __Pyx_GOTREF(__pyx_t_2);
12983               __Pyx_INCREF(__pyx_v_fneighbor);
12984               __pyx_t_3 = __pyx_v_fneighbor; __pyx_t_20 = NULL;
12985               __pyx_t_25 = 0;
12986               if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
12987                 __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_3);
12988                 if (likely(__pyx_t_20)) {
12989                   PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
12990                   __Pyx_INCREF(__pyx_t_20);
12991                   __Pyx_INCREF(function);
12992                   __Pyx_DECREF_SET(__pyx_t_3, function);
12993                   __pyx_t_25 = 1;
12994                 }
12995               }
12996               #if CYTHON_FAST_PYCALL
12997               if (PyFunction_Check(__pyx_t_3)) {
12998                 PyObject *__pyx_temp[5] = {__pyx_t_20, __pyx_t_18, __pyx_t_9, __pyx_t_17, __pyx_t_2};
12999                 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_25, 4+__pyx_t_25); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 669, __pyx_L1_error)
13000                 __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
13001                 __Pyx_GOTREF(__pyx_t_1);
13002                 __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
13003                 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13004                 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
13005                 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13006               } else
13007               #endif
13008               #if CYTHON_FAST_PYCCALL
13009               if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
13010                 PyObject *__pyx_temp[5] = {__pyx_t_20, __pyx_t_18, __pyx_t_9, __pyx_t_17, __pyx_t_2};
13011                 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_25, 4+__pyx_t_25); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 669, __pyx_L1_error)
13012                 __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
13013                 __Pyx_GOTREF(__pyx_t_1);
13014                 __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
13015                 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13016                 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
13017                 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13018               } else
13019               #endif
13020               {
13021                 __pyx_t_10 = PyTuple_New(4+__pyx_t_25); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 669, __pyx_L1_error)
13022                 __Pyx_GOTREF(__pyx_t_10);
13023                 if (__pyx_t_20) {
13024                   __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_20); __pyx_t_20 = NULL;
13025                 }
13026                 __Pyx_GIVEREF(__pyx_t_18);
13027                 PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_25, __pyx_t_18);
13028                 __Pyx_GIVEREF(__pyx_t_9);
13029                 PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_25, __pyx_t_9);
13030                 __Pyx_GIVEREF(__pyx_t_17);
13031                 PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_25, __pyx_t_17);
13032                 __Pyx_GIVEREF(__pyx_t_2);
13033                 PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_25, __pyx_t_2);
13034                 __pyx_t_18 = 0;
13035                 __pyx_t_9 = 0;
13036                 __pyx_t_17 = 0;
13037                 __pyx_t_2 = 0;
13038                 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 669, __pyx_L1_error)
13039                 __Pyx_GOTREF(__pyx_t_1);
13040                 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
13041               }
13042               __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13043               __pyx_t_21 = __Pyx_PyInt_As_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_21 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 669, __pyx_L1_error)
13044               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13045               __pyx_v_nmi = __pyx_t_21;
13046 
13047               /* "yt/utilities/lib/geometry_utils.pyx":670
13048  *                         for l in range(k+1,3):
13049  *                             nmi = fneighbor(p[i,:],[j,k,l],[+1,-1,+1],max_index)
13050  *                             if nmi > 0:             # <<<<<<<<<<<<<<
13051  *                                 mi_neighbors[n] = np.uint64(nmi)
13052  *                                 n+=1
13053  */
13054               __pyx_t_13 = ((__pyx_v_nmi > 0) != 0);
13055               if (__pyx_t_13) {
13056 
13057                 /* "yt/utilities/lib/geometry_utils.pyx":671
13058  *                             nmi = fneighbor(p[i,:],[j,k,l],[+1,-1,+1],max_index)
13059  *                             if nmi > 0:
13060  *                                 mi_neighbors[n] = np.uint64(nmi)             # <<<<<<<<<<<<<<
13061  *                                 n+=1
13062  *                             nmi = fneighbor(p[i,:],[j,k,l],[+1,-1,-1],max_index)
13063  */
13064                 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 671, __pyx_L1_error)
13065                 __Pyx_GOTREF(__pyx_t_3);
13066                 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint64); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 671, __pyx_L1_error)
13067                 __Pyx_GOTREF(__pyx_t_10);
13068                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13069                 __pyx_t_3 = __Pyx_PyInt_From_npy_int64(__pyx_v_nmi); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 671, __pyx_L1_error)
13070                 __Pyx_GOTREF(__pyx_t_3);
13071                 __pyx_t_2 = NULL;
13072                 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
13073                   __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10);
13074                   if (likely(__pyx_t_2)) {
13075                     PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
13076                     __Pyx_INCREF(__pyx_t_2);
13077                     __Pyx_INCREF(function);
13078                     __Pyx_DECREF_SET(__pyx_t_10, function);
13079                   }
13080                 }
13081                 __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_3);
13082                 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
13083                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13084                 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 671, __pyx_L1_error)
13085                 __Pyx_GOTREF(__pyx_t_1);
13086                 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
13087                 __pyx_t_12 = __Pyx_PyInt_As_npy_uint64(__pyx_t_1); if (unlikely((__pyx_t_12 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 671, __pyx_L1_error)
13088                 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13089                 __pyx_t_29 = __pyx_v_n;
13090                 *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_mi_neighbors.diminfo[0].strides) = __pyx_t_12;
13091 
13092                 /* "yt/utilities/lib/geometry_utils.pyx":672
13093  *                             if nmi > 0:
13094  *                                 mi_neighbors[n] = np.uint64(nmi)
13095  *                                 n+=1             # <<<<<<<<<<<<<<
13096  *                             nmi = fneighbor(p[i,:],[j,k,l],[+1,-1,-1],max_index)
13097  *                             if nmi > 0:
13098  */
13099                 __pyx_v_n = (__pyx_v_n + 1);
13100 
13101                 /* "yt/utilities/lib/geometry_utils.pyx":670
13102  *                         for l in range(k+1,3):
13103  *                             nmi = fneighbor(p[i,:],[j,k,l],[+1,-1,+1],max_index)
13104  *                             if nmi > 0:             # <<<<<<<<<<<<<<
13105  *                                 mi_neighbors[n] = np.uint64(nmi)
13106  *                                 n+=1
13107  */
13108               }
13109 
13110               /* "yt/utilities/lib/geometry_utils.pyx":673
13111  *                                 mi_neighbors[n] = np.uint64(nmi)
13112  *                                 n+=1
13113  *                             nmi = fneighbor(p[i,:],[j,k,l],[+1,-1,-1],max_index)             # <<<<<<<<<<<<<<
13114  *                             if nmi > 0:
13115  *                                 mi_neighbors[n] = np.uint64(nmi)
13116  */
13117               __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 673, __pyx_L1_error)
13118               __Pyx_GOTREF(__pyx_t_10);
13119               __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 673, __pyx_L1_error)
13120               __Pyx_GOTREF(__pyx_t_3);
13121               __Pyx_GIVEREF(__pyx_t_10);
13122               PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10);
13123               __Pyx_INCREF(__pyx_slice__4);
13124               __Pyx_GIVEREF(__pyx_slice__4);
13125               PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_slice__4);
13126               __pyx_t_10 = 0;
13127               __pyx_t_10 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_p), __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 673, __pyx_L1_error)
13128               __Pyx_GOTREF(__pyx_t_10);
13129               __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13130               __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 673, __pyx_L1_error)
13131               __Pyx_GOTREF(__pyx_t_3);
13132               __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 673, __pyx_L1_error)
13133               __Pyx_GOTREF(__pyx_t_2);
13134               __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_l); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 673, __pyx_L1_error)
13135               __Pyx_GOTREF(__pyx_t_17);
13136               __pyx_t_9 = PyList_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 673, __pyx_L1_error)
13137               __Pyx_GOTREF(__pyx_t_9);
13138               __Pyx_GIVEREF(__pyx_t_3);
13139               PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_3);
13140               __Pyx_GIVEREF(__pyx_t_2);
13141               PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_2);
13142               __Pyx_GIVEREF(__pyx_t_17);
13143               PyList_SET_ITEM(__pyx_t_9, 2, __pyx_t_17);
13144               __pyx_t_3 = 0;
13145               __pyx_t_2 = 0;
13146               __pyx_t_17 = 0;
13147               __pyx_t_17 = PyList_New(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 673, __pyx_L1_error)
13148               __Pyx_GOTREF(__pyx_t_17);
13149               __Pyx_INCREF(__pyx_int_1);
13150               __Pyx_GIVEREF(__pyx_int_1);
13151               PyList_SET_ITEM(__pyx_t_17, 0, __pyx_int_1);
13152               __Pyx_INCREF(__pyx_int_neg_1);
13153               __Pyx_GIVEREF(__pyx_int_neg_1);
13154               PyList_SET_ITEM(__pyx_t_17, 1, __pyx_int_neg_1);
13155               __Pyx_INCREF(__pyx_int_neg_1);
13156               __Pyx_GIVEREF(__pyx_int_neg_1);
13157               PyList_SET_ITEM(__pyx_t_17, 2, __pyx_int_neg_1);
13158               __pyx_t_2 = __Pyx_PyInt_From_npy_uint64(__pyx_v_max_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 673, __pyx_L1_error)
13159               __Pyx_GOTREF(__pyx_t_2);
13160               __Pyx_INCREF(__pyx_v_fneighbor);
13161               __pyx_t_3 = __pyx_v_fneighbor; __pyx_t_18 = NULL;
13162               __pyx_t_25 = 0;
13163               if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
13164                 __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_3);
13165                 if (likely(__pyx_t_18)) {
13166                   PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
13167                   __Pyx_INCREF(__pyx_t_18);
13168                   __Pyx_INCREF(function);
13169                   __Pyx_DECREF_SET(__pyx_t_3, function);
13170                   __pyx_t_25 = 1;
13171                 }
13172               }
13173               #if CYTHON_FAST_PYCALL
13174               if (PyFunction_Check(__pyx_t_3)) {
13175                 PyObject *__pyx_temp[5] = {__pyx_t_18, __pyx_t_10, __pyx_t_9, __pyx_t_17, __pyx_t_2};
13176                 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_25, 4+__pyx_t_25); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 673, __pyx_L1_error)
13177                 __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
13178                 __Pyx_GOTREF(__pyx_t_1);
13179                 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
13180                 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13181                 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
13182                 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13183               } else
13184               #endif
13185               #if CYTHON_FAST_PYCCALL
13186               if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
13187                 PyObject *__pyx_temp[5] = {__pyx_t_18, __pyx_t_10, __pyx_t_9, __pyx_t_17, __pyx_t_2};
13188                 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_25, 4+__pyx_t_25); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 673, __pyx_L1_error)
13189                 __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
13190                 __Pyx_GOTREF(__pyx_t_1);
13191                 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
13192                 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13193                 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
13194                 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13195               } else
13196               #endif
13197               {
13198                 __pyx_t_20 = PyTuple_New(4+__pyx_t_25); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 673, __pyx_L1_error)
13199                 __Pyx_GOTREF(__pyx_t_20);
13200                 if (__pyx_t_18) {
13201                   __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_18); __pyx_t_18 = NULL;
13202                 }
13203                 __Pyx_GIVEREF(__pyx_t_10);
13204                 PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_25, __pyx_t_10);
13205                 __Pyx_GIVEREF(__pyx_t_9);
13206                 PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_25, __pyx_t_9);
13207                 __Pyx_GIVEREF(__pyx_t_17);
13208                 PyTuple_SET_ITEM(__pyx_t_20, 2+__pyx_t_25, __pyx_t_17);
13209                 __Pyx_GIVEREF(__pyx_t_2);
13210                 PyTuple_SET_ITEM(__pyx_t_20, 3+__pyx_t_25, __pyx_t_2);
13211                 __pyx_t_10 = 0;
13212                 __pyx_t_9 = 0;
13213                 __pyx_t_17 = 0;
13214                 __pyx_t_2 = 0;
13215                 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 673, __pyx_L1_error)
13216                 __Pyx_GOTREF(__pyx_t_1);
13217                 __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
13218               }
13219               __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13220               __pyx_t_21 = __Pyx_PyInt_As_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_21 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 673, __pyx_L1_error)
13221               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13222               __pyx_v_nmi = __pyx_t_21;
13223 
13224               /* "yt/utilities/lib/geometry_utils.pyx":674
13225  *                                 n+=1
13226  *                             nmi = fneighbor(p[i,:],[j,k,l],[+1,-1,-1],max_index)
13227  *                             if nmi > 0:             # <<<<<<<<<<<<<<
13228  *                                 mi_neighbors[n] = np.uint64(nmi)
13229  *                                 n+=1
13230  */
13231               __pyx_t_13 = ((__pyx_v_nmi > 0) != 0);
13232               if (__pyx_t_13) {
13233 
13234                 /* "yt/utilities/lib/geometry_utils.pyx":675
13235  *                             nmi = fneighbor(p[i,:],[j,k,l],[+1,-1,-1],max_index)
13236  *                             if nmi > 0:
13237  *                                 mi_neighbors[n] = np.uint64(nmi)             # <<<<<<<<<<<<<<
13238  *                                 n+=1
13239  *             # -1 in dimension j
13240  */
13241                 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 675, __pyx_L1_error)
13242                 __Pyx_GOTREF(__pyx_t_3);
13243                 __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint64); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 675, __pyx_L1_error)
13244                 __Pyx_GOTREF(__pyx_t_20);
13245                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13246                 __pyx_t_3 = __Pyx_PyInt_From_npy_int64(__pyx_v_nmi); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 675, __pyx_L1_error)
13247                 __Pyx_GOTREF(__pyx_t_3);
13248                 __pyx_t_2 = NULL;
13249                 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
13250                   __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_20);
13251                   if (likely(__pyx_t_2)) {
13252                     PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
13253                     __Pyx_INCREF(__pyx_t_2);
13254                     __Pyx_INCREF(function);
13255                     __Pyx_DECREF_SET(__pyx_t_20, function);
13256                   }
13257                 }
13258                 __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_20, __pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_20, __pyx_t_3);
13259                 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
13260                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13261                 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 675, __pyx_L1_error)
13262                 __Pyx_GOTREF(__pyx_t_1);
13263                 __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
13264                 __pyx_t_12 = __Pyx_PyInt_As_npy_uint64(__pyx_t_1); if (unlikely((__pyx_t_12 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 675, __pyx_L1_error)
13265                 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13266                 __pyx_t_30 = __pyx_v_n;
13267                 *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_mi_neighbors.diminfo[0].strides) = __pyx_t_12;
13268 
13269                 /* "yt/utilities/lib/geometry_utils.pyx":676
13270  *                             if nmi > 0:
13271  *                                 mi_neighbors[n] = np.uint64(nmi)
13272  *                                 n+=1             # <<<<<<<<<<<<<<
13273  *             # -1 in dimension j
13274  *             nmi = fneighbor(p[i,:],[j],[-1],max_index)
13275  */
13276                 __pyx_v_n = (__pyx_v_n + 1);
13277 
13278                 /* "yt/utilities/lib/geometry_utils.pyx":674
13279  *                                 n+=1
13280  *                             nmi = fneighbor(p[i,:],[j,k,l],[+1,-1,-1],max_index)
13281  *                             if nmi > 0:             # <<<<<<<<<<<<<<
13282  *                                 mi_neighbors[n] = np.uint64(nmi)
13283  *                                 n+=1
13284  */
13285               }
13286             }
13287 
13288             /* "yt/utilities/lib/geometry_utils.pyx":664
13289  *                     # -1 in dimension k
13290  *                     nmi = fneighbor(p[i,:],[j,k],[+1,-1],max_index)
13291  *                     if nmi > 0:             # <<<<<<<<<<<<<<
13292  *                         mi_neighbors[n] = np.uint64(nmi)
13293  *                         n+=1
13294  */
13295           }
13296         }
13297 
13298         /* "yt/utilities/lib/geometry_utils.pyx":642
13299  *             # +1 in dimension j
13300  *             nmi = fneighbor(p[i,:],[j],[+1],max_index)
13301  *             if nmi > 0:             # <<<<<<<<<<<<<<
13302  *                 mi_neighbors[n] = np.uint64(nmi)
13303  *                 n+=1
13304  */
13305       }
13306 
13307       /* "yt/utilities/lib/geometry_utils.pyx":678
13308  *                                 n+=1
13309  *             # -1 in dimension j
13310  *             nmi = fneighbor(p[i,:],[j],[-1],max_index)             # <<<<<<<<<<<<<<
13311  *             if nmi > 0:
13312  *                 mi_neighbors[n] = np.uint64(nmi)
13313  */
13314       __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 678, __pyx_L1_error)
13315       __Pyx_GOTREF(__pyx_t_20);
13316       __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 678, __pyx_L1_error)
13317       __Pyx_GOTREF(__pyx_t_3);
13318       __Pyx_GIVEREF(__pyx_t_20);
13319       PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_20);
13320       __Pyx_INCREF(__pyx_slice__4);
13321       __Pyx_GIVEREF(__pyx_slice__4);
13322       PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_slice__4);
13323       __pyx_t_20 = 0;
13324       __pyx_t_20 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_p), __pyx_t_3); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 678, __pyx_L1_error)
13325       __Pyx_GOTREF(__pyx_t_20);
13326       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13327       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 678, __pyx_L1_error)
13328       __Pyx_GOTREF(__pyx_t_3);
13329       __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 678, __pyx_L1_error)
13330       __Pyx_GOTREF(__pyx_t_2);
13331       __Pyx_GIVEREF(__pyx_t_3);
13332       PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
13333       __pyx_t_3 = 0;
13334       __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 678, __pyx_L1_error)
13335       __Pyx_GOTREF(__pyx_t_3);
13336       __Pyx_INCREF(__pyx_int_neg_1);
13337       __Pyx_GIVEREF(__pyx_int_neg_1);
13338       PyList_SET_ITEM(__pyx_t_3, 0, __pyx_int_neg_1);
13339       __pyx_t_17 = __Pyx_PyInt_From_npy_uint64(__pyx_v_max_index); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 678, __pyx_L1_error)
13340       __Pyx_GOTREF(__pyx_t_17);
13341       __Pyx_INCREF(__pyx_v_fneighbor);
13342       __pyx_t_9 = __pyx_v_fneighbor; __pyx_t_10 = NULL;
13343       __pyx_t_19 = 0;
13344       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
13345         __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
13346         if (likely(__pyx_t_10)) {
13347           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
13348           __Pyx_INCREF(__pyx_t_10);
13349           __Pyx_INCREF(function);
13350           __Pyx_DECREF_SET(__pyx_t_9, function);
13351           __pyx_t_19 = 1;
13352         }
13353       }
13354       #if CYTHON_FAST_PYCALL
13355       if (PyFunction_Check(__pyx_t_9)) {
13356         PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_t_20, __pyx_t_2, __pyx_t_3, __pyx_t_17};
13357         __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_19, 4+__pyx_t_19); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 678, __pyx_L1_error)
13358         __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
13359         __Pyx_GOTREF(__pyx_t_1);
13360         __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
13361         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13362         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13363         __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
13364       } else
13365       #endif
13366       #if CYTHON_FAST_PYCCALL
13367       if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
13368         PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_t_20, __pyx_t_2, __pyx_t_3, __pyx_t_17};
13369         __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_19, 4+__pyx_t_19); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 678, __pyx_L1_error)
13370         __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
13371         __Pyx_GOTREF(__pyx_t_1);
13372         __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
13373         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13374         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13375         __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
13376       } else
13377       #endif
13378       {
13379         __pyx_t_18 = PyTuple_New(4+__pyx_t_19); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 678, __pyx_L1_error)
13380         __Pyx_GOTREF(__pyx_t_18);
13381         if (__pyx_t_10) {
13382           __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_10); __pyx_t_10 = NULL;
13383         }
13384         __Pyx_GIVEREF(__pyx_t_20);
13385         PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_19, __pyx_t_20);
13386         __Pyx_GIVEREF(__pyx_t_2);
13387         PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_19, __pyx_t_2);
13388         __Pyx_GIVEREF(__pyx_t_3);
13389         PyTuple_SET_ITEM(__pyx_t_18, 2+__pyx_t_19, __pyx_t_3);
13390         __Pyx_GIVEREF(__pyx_t_17);
13391         PyTuple_SET_ITEM(__pyx_t_18, 3+__pyx_t_19, __pyx_t_17);
13392         __pyx_t_20 = 0;
13393         __pyx_t_2 = 0;
13394         __pyx_t_3 = 0;
13395         __pyx_t_17 = 0;
13396         __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 678, __pyx_L1_error)
13397         __Pyx_GOTREF(__pyx_t_1);
13398         __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
13399       }
13400       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13401       __pyx_t_21 = __Pyx_PyInt_As_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_21 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 678, __pyx_L1_error)
13402       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13403       __pyx_v_nmi = __pyx_t_21;
13404 
13405       /* "yt/utilities/lib/geometry_utils.pyx":679
13406  *             # -1 in dimension j
13407  *             nmi = fneighbor(p[i,:],[j],[-1],max_index)
13408  *             if nmi > 0:             # <<<<<<<<<<<<<<
13409  *                 mi_neighbors[n] = np.uint64(nmi)
13410  *                 n+=1
13411  */
13412       __pyx_t_13 = ((__pyx_v_nmi > 0) != 0);
13413       if (__pyx_t_13) {
13414 
13415         /* "yt/utilities/lib/geometry_utils.pyx":680
13416  *             nmi = fneighbor(p[i,:],[j],[-1],max_index)
13417  *             if nmi > 0:
13418  *                 mi_neighbors[n] = np.uint64(nmi)             # <<<<<<<<<<<<<<
13419  *                 n+=1
13420  *                 # +/- in dimension k
13421  */
13422         __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 680, __pyx_L1_error)
13423         __Pyx_GOTREF(__pyx_t_9);
13424         __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_uint64); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 680, __pyx_L1_error)
13425         __Pyx_GOTREF(__pyx_t_18);
13426         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13427         __pyx_t_9 = __Pyx_PyInt_From_npy_int64(__pyx_v_nmi); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 680, __pyx_L1_error)
13428         __Pyx_GOTREF(__pyx_t_9);
13429         __pyx_t_17 = NULL;
13430         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_18))) {
13431           __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_18);
13432           if (likely(__pyx_t_17)) {
13433             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
13434             __Pyx_INCREF(__pyx_t_17);
13435             __Pyx_INCREF(function);
13436             __Pyx_DECREF_SET(__pyx_t_18, function);
13437           }
13438         }
13439         __pyx_t_1 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_18, __pyx_t_17, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_t_9);
13440         __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
13441         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13442         if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 680, __pyx_L1_error)
13443         __Pyx_GOTREF(__pyx_t_1);
13444         __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
13445         __pyx_t_12 = __Pyx_PyInt_As_npy_uint64(__pyx_t_1); if (unlikely((__pyx_t_12 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 680, __pyx_L1_error)
13446         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13447         __pyx_t_31 = __pyx_v_n;
13448         *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_mi_neighbors.diminfo[0].strides) = __pyx_t_12;
13449 
13450         /* "yt/utilities/lib/geometry_utils.pyx":681
13451  *             if nmi > 0:
13452  *                 mi_neighbors[n] = np.uint64(nmi)
13453  *                 n+=1             # <<<<<<<<<<<<<<
13454  *                 # +/- in dimension k
13455  *                 for k in range(j+1,3):
13456  */
13457         __pyx_v_n = (__pyx_v_n + 1);
13458 
13459         /* "yt/utilities/lib/geometry_utils.pyx":683
13460  *                 n+=1
13461  *                 # +/- in dimension k
13462  *                 for k in range(j+1,3):             # <<<<<<<<<<<<<<
13463  *                     # +1 in dimension k
13464  *                     nmi = fneighbor(p[i,:],[j,k],[-1,+1],max_index)
13465  */
13466         for (__pyx_t_19 = (__pyx_v_j + 1); __pyx_t_19 < 3; __pyx_t_19+=1) {
13467           __pyx_v_k = __pyx_t_19;
13468 
13469           /* "yt/utilities/lib/geometry_utils.pyx":685
13470  *                 for k in range(j+1,3):
13471  *                     # +1 in dimension k
13472  *                     nmi = fneighbor(p[i,:],[j,k],[-1,+1],max_index)             # <<<<<<<<<<<<<<
13473  *                     if nmi > 0:
13474  *                         mi_neighbors[n] = np.uint64(nmi)
13475  */
13476           __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 685, __pyx_L1_error)
13477           __Pyx_GOTREF(__pyx_t_18);
13478           __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 685, __pyx_L1_error)
13479           __Pyx_GOTREF(__pyx_t_9);
13480           __Pyx_GIVEREF(__pyx_t_18);
13481           PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_18);
13482           __Pyx_INCREF(__pyx_slice__4);
13483           __Pyx_GIVEREF(__pyx_slice__4);
13484           PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_slice__4);
13485           __pyx_t_18 = 0;
13486           __pyx_t_18 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_p), __pyx_t_9); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 685, __pyx_L1_error)
13487           __Pyx_GOTREF(__pyx_t_18);
13488           __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13489           __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 685, __pyx_L1_error)
13490           __Pyx_GOTREF(__pyx_t_9);
13491           __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 685, __pyx_L1_error)
13492           __Pyx_GOTREF(__pyx_t_17);
13493           __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 685, __pyx_L1_error)
13494           __Pyx_GOTREF(__pyx_t_3);
13495           __Pyx_GIVEREF(__pyx_t_9);
13496           PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_9);
13497           __Pyx_GIVEREF(__pyx_t_17);
13498           PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_17);
13499           __pyx_t_9 = 0;
13500           __pyx_t_17 = 0;
13501           __pyx_t_17 = PyList_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 685, __pyx_L1_error)
13502           __Pyx_GOTREF(__pyx_t_17);
13503           __Pyx_INCREF(__pyx_int_neg_1);
13504           __Pyx_GIVEREF(__pyx_int_neg_1);
13505           PyList_SET_ITEM(__pyx_t_17, 0, __pyx_int_neg_1);
13506           __Pyx_INCREF(__pyx_int_1);
13507           __Pyx_GIVEREF(__pyx_int_1);
13508           PyList_SET_ITEM(__pyx_t_17, 1, __pyx_int_1);
13509           __pyx_t_9 = __Pyx_PyInt_From_npy_uint64(__pyx_v_max_index); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 685, __pyx_L1_error)
13510           __Pyx_GOTREF(__pyx_t_9);
13511           __Pyx_INCREF(__pyx_v_fneighbor);
13512           __pyx_t_2 = __pyx_v_fneighbor; __pyx_t_20 = NULL;
13513           __pyx_t_23 = 0;
13514           if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
13515             __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_2);
13516             if (likely(__pyx_t_20)) {
13517               PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
13518               __Pyx_INCREF(__pyx_t_20);
13519               __Pyx_INCREF(function);
13520               __Pyx_DECREF_SET(__pyx_t_2, function);
13521               __pyx_t_23 = 1;
13522             }
13523           }
13524           #if CYTHON_FAST_PYCALL
13525           if (PyFunction_Check(__pyx_t_2)) {
13526             PyObject *__pyx_temp[5] = {__pyx_t_20, __pyx_t_18, __pyx_t_3, __pyx_t_17, __pyx_t_9};
13527             __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_23, 4+__pyx_t_23); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 685, __pyx_L1_error)
13528             __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
13529             __Pyx_GOTREF(__pyx_t_1);
13530             __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
13531             __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13532             __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
13533             __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13534           } else
13535           #endif
13536           #if CYTHON_FAST_PYCCALL
13537           if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
13538             PyObject *__pyx_temp[5] = {__pyx_t_20, __pyx_t_18, __pyx_t_3, __pyx_t_17, __pyx_t_9};
13539             __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_23, 4+__pyx_t_23); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 685, __pyx_L1_error)
13540             __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
13541             __Pyx_GOTREF(__pyx_t_1);
13542             __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
13543             __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13544             __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
13545             __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13546           } else
13547           #endif
13548           {
13549             __pyx_t_10 = PyTuple_New(4+__pyx_t_23); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 685, __pyx_L1_error)
13550             __Pyx_GOTREF(__pyx_t_10);
13551             if (__pyx_t_20) {
13552               __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_20); __pyx_t_20 = NULL;
13553             }
13554             __Pyx_GIVEREF(__pyx_t_18);
13555             PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_23, __pyx_t_18);
13556             __Pyx_GIVEREF(__pyx_t_3);
13557             PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_23, __pyx_t_3);
13558             __Pyx_GIVEREF(__pyx_t_17);
13559             PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_23, __pyx_t_17);
13560             __Pyx_GIVEREF(__pyx_t_9);
13561             PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_23, __pyx_t_9);
13562             __pyx_t_18 = 0;
13563             __pyx_t_3 = 0;
13564             __pyx_t_17 = 0;
13565             __pyx_t_9 = 0;
13566             __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 685, __pyx_L1_error)
13567             __Pyx_GOTREF(__pyx_t_1);
13568             __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
13569           }
13570           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13571           __pyx_t_21 = __Pyx_PyInt_As_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_21 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 685, __pyx_L1_error)
13572           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13573           __pyx_v_nmi = __pyx_t_21;
13574 
13575           /* "yt/utilities/lib/geometry_utils.pyx":686
13576  *                     # +1 in dimension k
13577  *                     nmi = fneighbor(p[i,:],[j,k],[-1,+1],max_index)
13578  *                     if nmi > 0:             # <<<<<<<<<<<<<<
13579  *                         mi_neighbors[n] = np.uint64(nmi)
13580  *                         n+=1
13581  */
13582           __pyx_t_13 = ((__pyx_v_nmi > 0) != 0);
13583           if (__pyx_t_13) {
13584 
13585             /* "yt/utilities/lib/geometry_utils.pyx":687
13586  *                     nmi = fneighbor(p[i,:],[j,k],[-1,+1],max_index)
13587  *                     if nmi > 0:
13588  *                         mi_neighbors[n] = np.uint64(nmi)             # <<<<<<<<<<<<<<
13589  *                         n+=1
13590  *                         # +/- in dimension l
13591  */
13592             __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 687, __pyx_L1_error)
13593             __Pyx_GOTREF(__pyx_t_2);
13594             __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_uint64); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 687, __pyx_L1_error)
13595             __Pyx_GOTREF(__pyx_t_10);
13596             __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13597             __pyx_t_2 = __Pyx_PyInt_From_npy_int64(__pyx_v_nmi); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 687, __pyx_L1_error)
13598             __Pyx_GOTREF(__pyx_t_2);
13599             __pyx_t_9 = NULL;
13600             if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
13601               __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
13602               if (likely(__pyx_t_9)) {
13603                 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
13604                 __Pyx_INCREF(__pyx_t_9);
13605                 __Pyx_INCREF(function);
13606                 __Pyx_DECREF_SET(__pyx_t_10, function);
13607               }
13608             }
13609             __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_9, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_2);
13610             __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
13611             __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13612             if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 687, __pyx_L1_error)
13613             __Pyx_GOTREF(__pyx_t_1);
13614             __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
13615             __pyx_t_12 = __Pyx_PyInt_As_npy_uint64(__pyx_t_1); if (unlikely((__pyx_t_12 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 687, __pyx_L1_error)
13616             __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13617             __pyx_t_32 = __pyx_v_n;
13618             *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_mi_neighbors.diminfo[0].strides) = __pyx_t_12;
13619 
13620             /* "yt/utilities/lib/geometry_utils.pyx":688
13621  *                     if nmi > 0:
13622  *                         mi_neighbors[n] = np.uint64(nmi)
13623  *                         n+=1             # <<<<<<<<<<<<<<
13624  *                         # +/- in dimension l
13625  *                         for l in range(k+1,3):
13626  */
13627             __pyx_v_n = (__pyx_v_n + 1);
13628 
13629             /* "yt/utilities/lib/geometry_utils.pyx":690
13630  *                         n+=1
13631  *                         # +/- in dimension l
13632  *                         for l in range(k+1,3):             # <<<<<<<<<<<<<<
13633  *                             nmi = fneighbor(p[i,:],[j,k,l],[-1,+1,+1],max_index)
13634  *                             if nmi > 0:
13635  */
13636             for (__pyx_t_23 = (__pyx_v_k + 1); __pyx_t_23 < 3; __pyx_t_23+=1) {
13637               __pyx_v_l = __pyx_t_23;
13638 
13639               /* "yt/utilities/lib/geometry_utils.pyx":691
13640  *                         # +/- in dimension l
13641  *                         for l in range(k+1,3):
13642  *                             nmi = fneighbor(p[i,:],[j,k,l],[-1,+1,+1],max_index)             # <<<<<<<<<<<<<<
13643  *                             if nmi > 0:
13644  *                                 mi_neighbors[n] = np.uint64(nmi)
13645  */
13646               __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 691, __pyx_L1_error)
13647               __Pyx_GOTREF(__pyx_t_10);
13648               __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 691, __pyx_L1_error)
13649               __Pyx_GOTREF(__pyx_t_2);
13650               __Pyx_GIVEREF(__pyx_t_10);
13651               PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10);
13652               __Pyx_INCREF(__pyx_slice__4);
13653               __Pyx_GIVEREF(__pyx_slice__4);
13654               PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_slice__4);
13655               __pyx_t_10 = 0;
13656               __pyx_t_10 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_p), __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 691, __pyx_L1_error)
13657               __Pyx_GOTREF(__pyx_t_10);
13658               __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13659               __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 691, __pyx_L1_error)
13660               __Pyx_GOTREF(__pyx_t_2);
13661               __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 691, __pyx_L1_error)
13662               __Pyx_GOTREF(__pyx_t_9);
13663               __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_l); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 691, __pyx_L1_error)
13664               __Pyx_GOTREF(__pyx_t_17);
13665               __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 691, __pyx_L1_error)
13666               __Pyx_GOTREF(__pyx_t_3);
13667               __Pyx_GIVEREF(__pyx_t_2);
13668               PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
13669               __Pyx_GIVEREF(__pyx_t_9);
13670               PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_9);
13671               __Pyx_GIVEREF(__pyx_t_17);
13672               PyList_SET_ITEM(__pyx_t_3, 2, __pyx_t_17);
13673               __pyx_t_2 = 0;
13674               __pyx_t_9 = 0;
13675               __pyx_t_17 = 0;
13676               __pyx_t_17 = PyList_New(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 691, __pyx_L1_error)
13677               __Pyx_GOTREF(__pyx_t_17);
13678               __Pyx_INCREF(__pyx_int_neg_1);
13679               __Pyx_GIVEREF(__pyx_int_neg_1);
13680               PyList_SET_ITEM(__pyx_t_17, 0, __pyx_int_neg_1);
13681               __Pyx_INCREF(__pyx_int_1);
13682               __Pyx_GIVEREF(__pyx_int_1);
13683               PyList_SET_ITEM(__pyx_t_17, 1, __pyx_int_1);
13684               __Pyx_INCREF(__pyx_int_1);
13685               __Pyx_GIVEREF(__pyx_int_1);
13686               PyList_SET_ITEM(__pyx_t_17, 2, __pyx_int_1);
13687               __pyx_t_9 = __Pyx_PyInt_From_npy_uint64(__pyx_v_max_index); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 691, __pyx_L1_error)
13688               __Pyx_GOTREF(__pyx_t_9);
13689               __Pyx_INCREF(__pyx_v_fneighbor);
13690               __pyx_t_2 = __pyx_v_fneighbor; __pyx_t_18 = NULL;
13691               __pyx_t_25 = 0;
13692               if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
13693                 __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_2);
13694                 if (likely(__pyx_t_18)) {
13695                   PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
13696                   __Pyx_INCREF(__pyx_t_18);
13697                   __Pyx_INCREF(function);
13698                   __Pyx_DECREF_SET(__pyx_t_2, function);
13699                   __pyx_t_25 = 1;
13700                 }
13701               }
13702               #if CYTHON_FAST_PYCALL
13703               if (PyFunction_Check(__pyx_t_2)) {
13704                 PyObject *__pyx_temp[5] = {__pyx_t_18, __pyx_t_10, __pyx_t_3, __pyx_t_17, __pyx_t_9};
13705                 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_25, 4+__pyx_t_25); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 691, __pyx_L1_error)
13706                 __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
13707                 __Pyx_GOTREF(__pyx_t_1);
13708                 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
13709                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13710                 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
13711                 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13712               } else
13713               #endif
13714               #if CYTHON_FAST_PYCCALL
13715               if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
13716                 PyObject *__pyx_temp[5] = {__pyx_t_18, __pyx_t_10, __pyx_t_3, __pyx_t_17, __pyx_t_9};
13717                 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_25, 4+__pyx_t_25); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 691, __pyx_L1_error)
13718                 __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
13719                 __Pyx_GOTREF(__pyx_t_1);
13720                 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
13721                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13722                 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
13723                 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13724               } else
13725               #endif
13726               {
13727                 __pyx_t_20 = PyTuple_New(4+__pyx_t_25); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 691, __pyx_L1_error)
13728                 __Pyx_GOTREF(__pyx_t_20);
13729                 if (__pyx_t_18) {
13730                   __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_18); __pyx_t_18 = NULL;
13731                 }
13732                 __Pyx_GIVEREF(__pyx_t_10);
13733                 PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_25, __pyx_t_10);
13734                 __Pyx_GIVEREF(__pyx_t_3);
13735                 PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_25, __pyx_t_3);
13736                 __Pyx_GIVEREF(__pyx_t_17);
13737                 PyTuple_SET_ITEM(__pyx_t_20, 2+__pyx_t_25, __pyx_t_17);
13738                 __Pyx_GIVEREF(__pyx_t_9);
13739                 PyTuple_SET_ITEM(__pyx_t_20, 3+__pyx_t_25, __pyx_t_9);
13740                 __pyx_t_10 = 0;
13741                 __pyx_t_3 = 0;
13742                 __pyx_t_17 = 0;
13743                 __pyx_t_9 = 0;
13744                 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 691, __pyx_L1_error)
13745                 __Pyx_GOTREF(__pyx_t_1);
13746                 __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
13747               }
13748               __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13749               __pyx_t_21 = __Pyx_PyInt_As_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_21 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 691, __pyx_L1_error)
13750               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13751               __pyx_v_nmi = __pyx_t_21;
13752 
13753               /* "yt/utilities/lib/geometry_utils.pyx":692
13754  *                         for l in range(k+1,3):
13755  *                             nmi = fneighbor(p[i,:],[j,k,l],[-1,+1,+1],max_index)
13756  *                             if nmi > 0:             # <<<<<<<<<<<<<<
13757  *                                 mi_neighbors[n] = np.uint64(nmi)
13758  *                                 n+=1
13759  */
13760               __pyx_t_13 = ((__pyx_v_nmi > 0) != 0);
13761               if (__pyx_t_13) {
13762 
13763                 /* "yt/utilities/lib/geometry_utils.pyx":693
13764  *                             nmi = fneighbor(p[i,:],[j,k,l],[-1,+1,+1],max_index)
13765  *                             if nmi > 0:
13766  *                                 mi_neighbors[n] = np.uint64(nmi)             # <<<<<<<<<<<<<<
13767  *                                 n+=1
13768  *                             nmi = fneighbor(p[i,:],[j,k,l],[-1,+1,-1],max_index)
13769  */
13770                 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 693, __pyx_L1_error)
13771                 __Pyx_GOTREF(__pyx_t_2);
13772                 __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_uint64); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 693, __pyx_L1_error)
13773                 __Pyx_GOTREF(__pyx_t_20);
13774                 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13775                 __pyx_t_2 = __Pyx_PyInt_From_npy_int64(__pyx_v_nmi); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 693, __pyx_L1_error)
13776                 __Pyx_GOTREF(__pyx_t_2);
13777                 __pyx_t_9 = NULL;
13778                 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
13779                   __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_20);
13780                   if (likely(__pyx_t_9)) {
13781                     PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
13782                     __Pyx_INCREF(__pyx_t_9);
13783                     __Pyx_INCREF(function);
13784                     __Pyx_DECREF_SET(__pyx_t_20, function);
13785                   }
13786                 }
13787                 __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_20, __pyx_t_9, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_20, __pyx_t_2);
13788                 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
13789                 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13790                 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 693, __pyx_L1_error)
13791                 __Pyx_GOTREF(__pyx_t_1);
13792                 __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
13793                 __pyx_t_12 = __Pyx_PyInt_As_npy_uint64(__pyx_t_1); if (unlikely((__pyx_t_12 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 693, __pyx_L1_error)
13794                 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13795                 __pyx_t_33 = __pyx_v_n;
13796                 *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_mi_neighbors.diminfo[0].strides) = __pyx_t_12;
13797 
13798                 /* "yt/utilities/lib/geometry_utils.pyx":694
13799  *                             if nmi > 0:
13800  *                                 mi_neighbors[n] = np.uint64(nmi)
13801  *                                 n+=1             # <<<<<<<<<<<<<<
13802  *                             nmi = fneighbor(p[i,:],[j,k,l],[-1,+1,-1],max_index)
13803  *                             if nmi > 0:
13804  */
13805                 __pyx_v_n = (__pyx_v_n + 1);
13806 
13807                 /* "yt/utilities/lib/geometry_utils.pyx":692
13808  *                         for l in range(k+1,3):
13809  *                             nmi = fneighbor(p[i,:],[j,k,l],[-1,+1,+1],max_index)
13810  *                             if nmi > 0:             # <<<<<<<<<<<<<<
13811  *                                 mi_neighbors[n] = np.uint64(nmi)
13812  *                                 n+=1
13813  */
13814               }
13815 
13816               /* "yt/utilities/lib/geometry_utils.pyx":695
13817  *                                 mi_neighbors[n] = np.uint64(nmi)
13818  *                                 n+=1
13819  *                             nmi = fneighbor(p[i,:],[j,k,l],[-1,+1,-1],max_index)             # <<<<<<<<<<<<<<
13820  *                             if nmi > 0:
13821  *                                 mi_neighbors[n] = np.uint64(nmi)
13822  */
13823               __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 695, __pyx_L1_error)
13824               __Pyx_GOTREF(__pyx_t_20);
13825               __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 695, __pyx_L1_error)
13826               __Pyx_GOTREF(__pyx_t_2);
13827               __Pyx_GIVEREF(__pyx_t_20);
13828               PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_20);
13829               __Pyx_INCREF(__pyx_slice__4);
13830               __Pyx_GIVEREF(__pyx_slice__4);
13831               PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_slice__4);
13832               __pyx_t_20 = 0;
13833               __pyx_t_20 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_p), __pyx_t_2); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 695, __pyx_L1_error)
13834               __Pyx_GOTREF(__pyx_t_20);
13835               __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13836               __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 695, __pyx_L1_error)
13837               __Pyx_GOTREF(__pyx_t_2);
13838               __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 695, __pyx_L1_error)
13839               __Pyx_GOTREF(__pyx_t_9);
13840               __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_l); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 695, __pyx_L1_error)
13841               __Pyx_GOTREF(__pyx_t_17);
13842               __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 695, __pyx_L1_error)
13843               __Pyx_GOTREF(__pyx_t_3);
13844               __Pyx_GIVEREF(__pyx_t_2);
13845               PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
13846               __Pyx_GIVEREF(__pyx_t_9);
13847               PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_9);
13848               __Pyx_GIVEREF(__pyx_t_17);
13849               PyList_SET_ITEM(__pyx_t_3, 2, __pyx_t_17);
13850               __pyx_t_2 = 0;
13851               __pyx_t_9 = 0;
13852               __pyx_t_17 = 0;
13853               __pyx_t_17 = PyList_New(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 695, __pyx_L1_error)
13854               __Pyx_GOTREF(__pyx_t_17);
13855               __Pyx_INCREF(__pyx_int_neg_1);
13856               __Pyx_GIVEREF(__pyx_int_neg_1);
13857               PyList_SET_ITEM(__pyx_t_17, 0, __pyx_int_neg_1);
13858               __Pyx_INCREF(__pyx_int_1);
13859               __Pyx_GIVEREF(__pyx_int_1);
13860               PyList_SET_ITEM(__pyx_t_17, 1, __pyx_int_1);
13861               __Pyx_INCREF(__pyx_int_neg_1);
13862               __Pyx_GIVEREF(__pyx_int_neg_1);
13863               PyList_SET_ITEM(__pyx_t_17, 2, __pyx_int_neg_1);
13864               __pyx_t_9 = __Pyx_PyInt_From_npy_uint64(__pyx_v_max_index); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 695, __pyx_L1_error)
13865               __Pyx_GOTREF(__pyx_t_9);
13866               __Pyx_INCREF(__pyx_v_fneighbor);
13867               __pyx_t_2 = __pyx_v_fneighbor; __pyx_t_10 = NULL;
13868               __pyx_t_25 = 0;
13869               if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
13870                 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
13871                 if (likely(__pyx_t_10)) {
13872                   PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
13873                   __Pyx_INCREF(__pyx_t_10);
13874                   __Pyx_INCREF(function);
13875                   __Pyx_DECREF_SET(__pyx_t_2, function);
13876                   __pyx_t_25 = 1;
13877                 }
13878               }
13879               #if CYTHON_FAST_PYCALL
13880               if (PyFunction_Check(__pyx_t_2)) {
13881                 PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_t_20, __pyx_t_3, __pyx_t_17, __pyx_t_9};
13882                 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_25, 4+__pyx_t_25); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 695, __pyx_L1_error)
13883                 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
13884                 __Pyx_GOTREF(__pyx_t_1);
13885                 __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
13886                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13887                 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
13888                 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13889               } else
13890               #endif
13891               #if CYTHON_FAST_PYCCALL
13892               if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
13893                 PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_t_20, __pyx_t_3, __pyx_t_17, __pyx_t_9};
13894                 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_25, 4+__pyx_t_25); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 695, __pyx_L1_error)
13895                 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
13896                 __Pyx_GOTREF(__pyx_t_1);
13897                 __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
13898                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13899                 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
13900                 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13901               } else
13902               #endif
13903               {
13904                 __pyx_t_18 = PyTuple_New(4+__pyx_t_25); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 695, __pyx_L1_error)
13905                 __Pyx_GOTREF(__pyx_t_18);
13906                 if (__pyx_t_10) {
13907                   __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_10); __pyx_t_10 = NULL;
13908                 }
13909                 __Pyx_GIVEREF(__pyx_t_20);
13910                 PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_25, __pyx_t_20);
13911                 __Pyx_GIVEREF(__pyx_t_3);
13912                 PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_25, __pyx_t_3);
13913                 __Pyx_GIVEREF(__pyx_t_17);
13914                 PyTuple_SET_ITEM(__pyx_t_18, 2+__pyx_t_25, __pyx_t_17);
13915                 __Pyx_GIVEREF(__pyx_t_9);
13916                 PyTuple_SET_ITEM(__pyx_t_18, 3+__pyx_t_25, __pyx_t_9);
13917                 __pyx_t_20 = 0;
13918                 __pyx_t_3 = 0;
13919                 __pyx_t_17 = 0;
13920                 __pyx_t_9 = 0;
13921                 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 695, __pyx_L1_error)
13922                 __Pyx_GOTREF(__pyx_t_1);
13923                 __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
13924               }
13925               __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13926               __pyx_t_21 = __Pyx_PyInt_As_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_21 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 695, __pyx_L1_error)
13927               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13928               __pyx_v_nmi = __pyx_t_21;
13929 
13930               /* "yt/utilities/lib/geometry_utils.pyx":696
13931  *                                 n+=1
13932  *                             nmi = fneighbor(p[i,:],[j,k,l],[-1,+1,-1],max_index)
13933  *                             if nmi > 0:             # <<<<<<<<<<<<<<
13934  *                                 mi_neighbors[n] = np.uint64(nmi)
13935  *                                 n+=1
13936  */
13937               __pyx_t_13 = ((__pyx_v_nmi > 0) != 0);
13938               if (__pyx_t_13) {
13939 
13940                 /* "yt/utilities/lib/geometry_utils.pyx":697
13941  *                             nmi = fneighbor(p[i,:],[j,k,l],[-1,+1,-1],max_index)
13942  *                             if nmi > 0:
13943  *                                 mi_neighbors[n] = np.uint64(nmi)             # <<<<<<<<<<<<<<
13944  *                                 n+=1
13945  *                     # -1 in dimension k
13946  */
13947                 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 697, __pyx_L1_error)
13948                 __Pyx_GOTREF(__pyx_t_2);
13949                 __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_uint64); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 697, __pyx_L1_error)
13950                 __Pyx_GOTREF(__pyx_t_18);
13951                 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13952                 __pyx_t_2 = __Pyx_PyInt_From_npy_int64(__pyx_v_nmi); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 697, __pyx_L1_error)
13953                 __Pyx_GOTREF(__pyx_t_2);
13954                 __pyx_t_9 = NULL;
13955                 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_18))) {
13956                   __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_18);
13957                   if (likely(__pyx_t_9)) {
13958                     PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
13959                     __Pyx_INCREF(__pyx_t_9);
13960                     __Pyx_INCREF(function);
13961                     __Pyx_DECREF_SET(__pyx_t_18, function);
13962                   }
13963                 }
13964                 __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_18, __pyx_t_9, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_t_2);
13965                 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
13966                 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13967                 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 697, __pyx_L1_error)
13968                 __Pyx_GOTREF(__pyx_t_1);
13969                 __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
13970                 __pyx_t_12 = __Pyx_PyInt_As_npy_uint64(__pyx_t_1); if (unlikely((__pyx_t_12 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 697, __pyx_L1_error)
13971                 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13972                 __pyx_t_34 = __pyx_v_n;
13973                 *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_mi_neighbors.diminfo[0].strides) = __pyx_t_12;
13974 
13975                 /* "yt/utilities/lib/geometry_utils.pyx":698
13976  *                             if nmi > 0:
13977  *                                 mi_neighbors[n] = np.uint64(nmi)
13978  *                                 n+=1             # <<<<<<<<<<<<<<
13979  *                     # -1 in dimension k
13980  *                     nmi = fneighbor(p[i,:],[j,k],[-1,-1],max_index)
13981  */
13982                 __pyx_v_n = (__pyx_v_n + 1);
13983 
13984                 /* "yt/utilities/lib/geometry_utils.pyx":696
13985  *                                 n+=1
13986  *                             nmi = fneighbor(p[i,:],[j,k,l],[-1,+1,-1],max_index)
13987  *                             if nmi > 0:             # <<<<<<<<<<<<<<
13988  *                                 mi_neighbors[n] = np.uint64(nmi)
13989  *                                 n+=1
13990  */
13991               }
13992             }
13993 
13994             /* "yt/utilities/lib/geometry_utils.pyx":686
13995  *                     # +1 in dimension k
13996  *                     nmi = fneighbor(p[i,:],[j,k],[-1,+1],max_index)
13997  *                     if nmi > 0:             # <<<<<<<<<<<<<<
13998  *                         mi_neighbors[n] = np.uint64(nmi)
13999  *                         n+=1
14000  */
14001           }
14002 
14003           /* "yt/utilities/lib/geometry_utils.pyx":700
14004  *                                 n+=1
14005  *                     # -1 in dimension k
14006  *                     nmi = fneighbor(p[i,:],[j,k],[-1,-1],max_index)             # <<<<<<<<<<<<<<
14007  *                     if nmi > 0:
14008  *                         mi_neighbors[n] = np.uint64(nmi)
14009  */
14010           __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 700, __pyx_L1_error)
14011           __Pyx_GOTREF(__pyx_t_18);
14012           __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 700, __pyx_L1_error)
14013           __Pyx_GOTREF(__pyx_t_2);
14014           __Pyx_GIVEREF(__pyx_t_18);
14015           PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_18);
14016           __Pyx_INCREF(__pyx_slice__4);
14017           __Pyx_GIVEREF(__pyx_slice__4);
14018           PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_slice__4);
14019           __pyx_t_18 = 0;
14020           __pyx_t_18 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_p), __pyx_t_2); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 700, __pyx_L1_error)
14021           __Pyx_GOTREF(__pyx_t_18);
14022           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14023           __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 700, __pyx_L1_error)
14024           __Pyx_GOTREF(__pyx_t_2);
14025           __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 700, __pyx_L1_error)
14026           __Pyx_GOTREF(__pyx_t_9);
14027           __pyx_t_17 = PyList_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 700, __pyx_L1_error)
14028           __Pyx_GOTREF(__pyx_t_17);
14029           __Pyx_GIVEREF(__pyx_t_2);
14030           PyList_SET_ITEM(__pyx_t_17, 0, __pyx_t_2);
14031           __Pyx_GIVEREF(__pyx_t_9);
14032           PyList_SET_ITEM(__pyx_t_17, 1, __pyx_t_9);
14033           __pyx_t_2 = 0;
14034           __pyx_t_9 = 0;
14035           __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 700, __pyx_L1_error)
14036           __Pyx_GOTREF(__pyx_t_9);
14037           __Pyx_INCREF(__pyx_int_neg_1);
14038           __Pyx_GIVEREF(__pyx_int_neg_1);
14039           PyList_SET_ITEM(__pyx_t_9, 0, __pyx_int_neg_1);
14040           __Pyx_INCREF(__pyx_int_neg_1);
14041           __Pyx_GIVEREF(__pyx_int_neg_1);
14042           PyList_SET_ITEM(__pyx_t_9, 1, __pyx_int_neg_1);
14043           __pyx_t_2 = __Pyx_PyInt_From_npy_uint64(__pyx_v_max_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 700, __pyx_L1_error)
14044           __Pyx_GOTREF(__pyx_t_2);
14045           __Pyx_INCREF(__pyx_v_fneighbor);
14046           __pyx_t_3 = __pyx_v_fneighbor; __pyx_t_20 = NULL;
14047           __pyx_t_23 = 0;
14048           if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
14049             __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_3);
14050             if (likely(__pyx_t_20)) {
14051               PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
14052               __Pyx_INCREF(__pyx_t_20);
14053               __Pyx_INCREF(function);
14054               __Pyx_DECREF_SET(__pyx_t_3, function);
14055               __pyx_t_23 = 1;
14056             }
14057           }
14058           #if CYTHON_FAST_PYCALL
14059           if (PyFunction_Check(__pyx_t_3)) {
14060             PyObject *__pyx_temp[5] = {__pyx_t_20, __pyx_t_18, __pyx_t_17, __pyx_t_9, __pyx_t_2};
14061             __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_23, 4+__pyx_t_23); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 700, __pyx_L1_error)
14062             __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
14063             __Pyx_GOTREF(__pyx_t_1);
14064             __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
14065             __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
14066             __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14067             __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14068           } else
14069           #endif
14070           #if CYTHON_FAST_PYCCALL
14071           if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
14072             PyObject *__pyx_temp[5] = {__pyx_t_20, __pyx_t_18, __pyx_t_17, __pyx_t_9, __pyx_t_2};
14073             __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_23, 4+__pyx_t_23); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 700, __pyx_L1_error)
14074             __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
14075             __Pyx_GOTREF(__pyx_t_1);
14076             __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
14077             __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
14078             __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14079             __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14080           } else
14081           #endif
14082           {
14083             __pyx_t_10 = PyTuple_New(4+__pyx_t_23); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 700, __pyx_L1_error)
14084             __Pyx_GOTREF(__pyx_t_10);
14085             if (__pyx_t_20) {
14086               __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_20); __pyx_t_20 = NULL;
14087             }
14088             __Pyx_GIVEREF(__pyx_t_18);
14089             PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_23, __pyx_t_18);
14090             __Pyx_GIVEREF(__pyx_t_17);
14091             PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_23, __pyx_t_17);
14092             __Pyx_GIVEREF(__pyx_t_9);
14093             PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_23, __pyx_t_9);
14094             __Pyx_GIVEREF(__pyx_t_2);
14095             PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_23, __pyx_t_2);
14096             __pyx_t_18 = 0;
14097             __pyx_t_17 = 0;
14098             __pyx_t_9 = 0;
14099             __pyx_t_2 = 0;
14100             __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 700, __pyx_L1_error)
14101             __Pyx_GOTREF(__pyx_t_1);
14102             __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14103           }
14104           __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14105           __pyx_t_21 = __Pyx_PyInt_As_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_21 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 700, __pyx_L1_error)
14106           __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14107           __pyx_v_nmi = __pyx_t_21;
14108 
14109           /* "yt/utilities/lib/geometry_utils.pyx":701
14110  *                     # -1 in dimension k
14111  *                     nmi = fneighbor(p[i,:],[j,k],[-1,-1],max_index)
14112  *                     if nmi > 0:             # <<<<<<<<<<<<<<
14113  *                         mi_neighbors[n] = np.uint64(nmi)
14114  *                         n+=1
14115  */
14116           __pyx_t_13 = ((__pyx_v_nmi > 0) != 0);
14117           if (__pyx_t_13) {
14118 
14119             /* "yt/utilities/lib/geometry_utils.pyx":702
14120  *                     nmi = fneighbor(p[i,:],[j,k],[-1,-1],max_index)
14121  *                     if nmi > 0:
14122  *                         mi_neighbors[n] = np.uint64(nmi)             # <<<<<<<<<<<<<<
14123  *                         n+=1
14124  *                         # +/- in dimension l
14125  */
14126             __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 702, __pyx_L1_error)
14127             __Pyx_GOTREF(__pyx_t_3);
14128             __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint64); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 702, __pyx_L1_error)
14129             __Pyx_GOTREF(__pyx_t_10);
14130             __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14131             __pyx_t_3 = __Pyx_PyInt_From_npy_int64(__pyx_v_nmi); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 702, __pyx_L1_error)
14132             __Pyx_GOTREF(__pyx_t_3);
14133             __pyx_t_2 = NULL;
14134             if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
14135               __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10);
14136               if (likely(__pyx_t_2)) {
14137                 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
14138                 __Pyx_INCREF(__pyx_t_2);
14139                 __Pyx_INCREF(function);
14140                 __Pyx_DECREF_SET(__pyx_t_10, function);
14141               }
14142             }
14143             __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_3);
14144             __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
14145             __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14146             if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 702, __pyx_L1_error)
14147             __Pyx_GOTREF(__pyx_t_1);
14148             __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14149             __pyx_t_12 = __Pyx_PyInt_As_npy_uint64(__pyx_t_1); if (unlikely((__pyx_t_12 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 702, __pyx_L1_error)
14150             __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14151             __pyx_t_35 = __pyx_v_n;
14152             *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_mi_neighbors.diminfo[0].strides) = __pyx_t_12;
14153 
14154             /* "yt/utilities/lib/geometry_utils.pyx":703
14155  *                     if nmi > 0:
14156  *                         mi_neighbors[n] = np.uint64(nmi)
14157  *                         n+=1             # <<<<<<<<<<<<<<
14158  *                         # +/- in dimension l
14159  *                         for l in range(k+1,3):
14160  */
14161             __pyx_v_n = (__pyx_v_n + 1);
14162 
14163             /* "yt/utilities/lib/geometry_utils.pyx":705
14164  *                         n+=1
14165  *                         # +/- in dimension l
14166  *                         for l in range(k+1,3):             # <<<<<<<<<<<<<<
14167  *                             nmi = fneighbor(p[i,:],[j,k,l],[-1,-1,+1],max_index)
14168  *                             if nmi > 0:
14169  */
14170             for (__pyx_t_23 = (__pyx_v_k + 1); __pyx_t_23 < 3; __pyx_t_23+=1) {
14171               __pyx_v_l = __pyx_t_23;
14172 
14173               /* "yt/utilities/lib/geometry_utils.pyx":706
14174  *                         # +/- in dimension l
14175  *                         for l in range(k+1,3):
14176  *                             nmi = fneighbor(p[i,:],[j,k,l],[-1,-1,+1],max_index)             # <<<<<<<<<<<<<<
14177  *                             if nmi > 0:
14178  *                                 mi_neighbors[n] = np.uint64(nmi)
14179  */
14180               __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 706, __pyx_L1_error)
14181               __Pyx_GOTREF(__pyx_t_10);
14182               __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 706, __pyx_L1_error)
14183               __Pyx_GOTREF(__pyx_t_3);
14184               __Pyx_GIVEREF(__pyx_t_10);
14185               PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10);
14186               __Pyx_INCREF(__pyx_slice__4);
14187               __Pyx_GIVEREF(__pyx_slice__4);
14188               PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_slice__4);
14189               __pyx_t_10 = 0;
14190               __pyx_t_10 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_p), __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 706, __pyx_L1_error)
14191               __Pyx_GOTREF(__pyx_t_10);
14192               __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14193               __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 706, __pyx_L1_error)
14194               __Pyx_GOTREF(__pyx_t_3);
14195               __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 706, __pyx_L1_error)
14196               __Pyx_GOTREF(__pyx_t_2);
14197               __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_l); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 706, __pyx_L1_error)
14198               __Pyx_GOTREF(__pyx_t_9);
14199               __pyx_t_17 = PyList_New(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 706, __pyx_L1_error)
14200               __Pyx_GOTREF(__pyx_t_17);
14201               __Pyx_GIVEREF(__pyx_t_3);
14202               PyList_SET_ITEM(__pyx_t_17, 0, __pyx_t_3);
14203               __Pyx_GIVEREF(__pyx_t_2);
14204               PyList_SET_ITEM(__pyx_t_17, 1, __pyx_t_2);
14205               __Pyx_GIVEREF(__pyx_t_9);
14206               PyList_SET_ITEM(__pyx_t_17, 2, __pyx_t_9);
14207               __pyx_t_3 = 0;
14208               __pyx_t_2 = 0;
14209               __pyx_t_9 = 0;
14210               __pyx_t_9 = PyList_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 706, __pyx_L1_error)
14211               __Pyx_GOTREF(__pyx_t_9);
14212               __Pyx_INCREF(__pyx_int_neg_1);
14213               __Pyx_GIVEREF(__pyx_int_neg_1);
14214               PyList_SET_ITEM(__pyx_t_9, 0, __pyx_int_neg_1);
14215               __Pyx_INCREF(__pyx_int_neg_1);
14216               __Pyx_GIVEREF(__pyx_int_neg_1);
14217               PyList_SET_ITEM(__pyx_t_9, 1, __pyx_int_neg_1);
14218               __Pyx_INCREF(__pyx_int_1);
14219               __Pyx_GIVEREF(__pyx_int_1);
14220               PyList_SET_ITEM(__pyx_t_9, 2, __pyx_int_1);
14221               __pyx_t_2 = __Pyx_PyInt_From_npy_uint64(__pyx_v_max_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 706, __pyx_L1_error)
14222               __Pyx_GOTREF(__pyx_t_2);
14223               __Pyx_INCREF(__pyx_v_fneighbor);
14224               __pyx_t_3 = __pyx_v_fneighbor; __pyx_t_18 = NULL;
14225               __pyx_t_25 = 0;
14226               if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
14227                 __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_3);
14228                 if (likely(__pyx_t_18)) {
14229                   PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
14230                   __Pyx_INCREF(__pyx_t_18);
14231                   __Pyx_INCREF(function);
14232                   __Pyx_DECREF_SET(__pyx_t_3, function);
14233                   __pyx_t_25 = 1;
14234                 }
14235               }
14236               #if CYTHON_FAST_PYCALL
14237               if (PyFunction_Check(__pyx_t_3)) {
14238                 PyObject *__pyx_temp[5] = {__pyx_t_18, __pyx_t_10, __pyx_t_17, __pyx_t_9, __pyx_t_2};
14239                 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_25, 4+__pyx_t_25); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 706, __pyx_L1_error)
14240                 __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
14241                 __Pyx_GOTREF(__pyx_t_1);
14242                 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14243                 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
14244                 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14245                 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14246               } else
14247               #endif
14248               #if CYTHON_FAST_PYCCALL
14249               if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
14250                 PyObject *__pyx_temp[5] = {__pyx_t_18, __pyx_t_10, __pyx_t_17, __pyx_t_9, __pyx_t_2};
14251                 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_25, 4+__pyx_t_25); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 706, __pyx_L1_error)
14252                 __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
14253                 __Pyx_GOTREF(__pyx_t_1);
14254                 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14255                 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
14256                 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14257                 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14258               } else
14259               #endif
14260               {
14261                 __pyx_t_20 = PyTuple_New(4+__pyx_t_25); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 706, __pyx_L1_error)
14262                 __Pyx_GOTREF(__pyx_t_20);
14263                 if (__pyx_t_18) {
14264                   __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_18); __pyx_t_18 = NULL;
14265                 }
14266                 __Pyx_GIVEREF(__pyx_t_10);
14267                 PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_25, __pyx_t_10);
14268                 __Pyx_GIVEREF(__pyx_t_17);
14269                 PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_25, __pyx_t_17);
14270                 __Pyx_GIVEREF(__pyx_t_9);
14271                 PyTuple_SET_ITEM(__pyx_t_20, 2+__pyx_t_25, __pyx_t_9);
14272                 __Pyx_GIVEREF(__pyx_t_2);
14273                 PyTuple_SET_ITEM(__pyx_t_20, 3+__pyx_t_25, __pyx_t_2);
14274                 __pyx_t_10 = 0;
14275                 __pyx_t_17 = 0;
14276                 __pyx_t_9 = 0;
14277                 __pyx_t_2 = 0;
14278                 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 706, __pyx_L1_error)
14279                 __Pyx_GOTREF(__pyx_t_1);
14280                 __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
14281               }
14282               __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14283               __pyx_t_21 = __Pyx_PyInt_As_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_21 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 706, __pyx_L1_error)
14284               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14285               __pyx_v_nmi = __pyx_t_21;
14286 
14287               /* "yt/utilities/lib/geometry_utils.pyx":707
14288  *                         for l in range(k+1,3):
14289  *                             nmi = fneighbor(p[i,:],[j,k,l],[-1,-1,+1],max_index)
14290  *                             if nmi > 0:             # <<<<<<<<<<<<<<
14291  *                                 mi_neighbors[n] = np.uint64(nmi)
14292  *                                 n+=1
14293  */
14294               __pyx_t_13 = ((__pyx_v_nmi > 0) != 0);
14295               if (__pyx_t_13) {
14296 
14297                 /* "yt/utilities/lib/geometry_utils.pyx":708
14298  *                             nmi = fneighbor(p[i,:],[j,k,l],[-1,-1,+1],max_index)
14299  *                             if nmi > 0:
14300  *                                 mi_neighbors[n] = np.uint64(nmi)             # <<<<<<<<<<<<<<
14301  *                                 n+=1
14302  *                             nmi = fneighbor(p[i,:],[j,k,l],[-1,-1,-1],max_index)
14303  */
14304                 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 708, __pyx_L1_error)
14305                 __Pyx_GOTREF(__pyx_t_3);
14306                 __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint64); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 708, __pyx_L1_error)
14307                 __Pyx_GOTREF(__pyx_t_20);
14308                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14309                 __pyx_t_3 = __Pyx_PyInt_From_npy_int64(__pyx_v_nmi); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 708, __pyx_L1_error)
14310                 __Pyx_GOTREF(__pyx_t_3);
14311                 __pyx_t_2 = NULL;
14312                 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
14313                   __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_20);
14314                   if (likely(__pyx_t_2)) {
14315                     PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
14316                     __Pyx_INCREF(__pyx_t_2);
14317                     __Pyx_INCREF(function);
14318                     __Pyx_DECREF_SET(__pyx_t_20, function);
14319                   }
14320                 }
14321                 __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_20, __pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_20, __pyx_t_3);
14322                 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
14323                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14324                 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 708, __pyx_L1_error)
14325                 __Pyx_GOTREF(__pyx_t_1);
14326                 __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
14327                 __pyx_t_12 = __Pyx_PyInt_As_npy_uint64(__pyx_t_1); if (unlikely((__pyx_t_12 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 708, __pyx_L1_error)
14328                 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14329                 __pyx_t_36 = __pyx_v_n;
14330                 *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_mi_neighbors.diminfo[0].strides) = __pyx_t_12;
14331 
14332                 /* "yt/utilities/lib/geometry_utils.pyx":709
14333  *                             if nmi > 0:
14334  *                                 mi_neighbors[n] = np.uint64(nmi)
14335  *                                 n+=1             # <<<<<<<<<<<<<<
14336  *                             nmi = fneighbor(p[i,:],[j,k,l],[-1,-1,-1],max_index)
14337  *                             if nmi > 0:
14338  */
14339                 __pyx_v_n = (__pyx_v_n + 1);
14340 
14341                 /* "yt/utilities/lib/geometry_utils.pyx":707
14342  *                         for l in range(k+1,3):
14343  *                             nmi = fneighbor(p[i,:],[j,k,l],[-1,-1,+1],max_index)
14344  *                             if nmi > 0:             # <<<<<<<<<<<<<<
14345  *                                 mi_neighbors[n] = np.uint64(nmi)
14346  *                                 n+=1
14347  */
14348               }
14349 
14350               /* "yt/utilities/lib/geometry_utils.pyx":710
14351  *                                 mi_neighbors[n] = np.uint64(nmi)
14352  *                                 n+=1
14353  *                             nmi = fneighbor(p[i,:],[j,k,l],[-1,-1,-1],max_index)             # <<<<<<<<<<<<<<
14354  *                             if nmi > 0:
14355  *                                 mi_neighbors[n] = np.uint64(nmi)
14356  */
14357               __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 710, __pyx_L1_error)
14358               __Pyx_GOTREF(__pyx_t_20);
14359               __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 710, __pyx_L1_error)
14360               __Pyx_GOTREF(__pyx_t_3);
14361               __Pyx_GIVEREF(__pyx_t_20);
14362               PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_20);
14363               __Pyx_INCREF(__pyx_slice__4);
14364               __Pyx_GIVEREF(__pyx_slice__4);
14365               PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_slice__4);
14366               __pyx_t_20 = 0;
14367               __pyx_t_20 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_p), __pyx_t_3); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 710, __pyx_L1_error)
14368               __Pyx_GOTREF(__pyx_t_20);
14369               __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14370               __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 710, __pyx_L1_error)
14371               __Pyx_GOTREF(__pyx_t_3);
14372               __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 710, __pyx_L1_error)
14373               __Pyx_GOTREF(__pyx_t_2);
14374               __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_l); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 710, __pyx_L1_error)
14375               __Pyx_GOTREF(__pyx_t_9);
14376               __pyx_t_17 = PyList_New(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 710, __pyx_L1_error)
14377               __Pyx_GOTREF(__pyx_t_17);
14378               __Pyx_GIVEREF(__pyx_t_3);
14379               PyList_SET_ITEM(__pyx_t_17, 0, __pyx_t_3);
14380               __Pyx_GIVEREF(__pyx_t_2);
14381               PyList_SET_ITEM(__pyx_t_17, 1, __pyx_t_2);
14382               __Pyx_GIVEREF(__pyx_t_9);
14383               PyList_SET_ITEM(__pyx_t_17, 2, __pyx_t_9);
14384               __pyx_t_3 = 0;
14385               __pyx_t_2 = 0;
14386               __pyx_t_9 = 0;
14387               __pyx_t_9 = PyList_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 710, __pyx_L1_error)
14388               __Pyx_GOTREF(__pyx_t_9);
14389               __Pyx_INCREF(__pyx_int_neg_1);
14390               __Pyx_GIVEREF(__pyx_int_neg_1);
14391               PyList_SET_ITEM(__pyx_t_9, 0, __pyx_int_neg_1);
14392               __Pyx_INCREF(__pyx_int_neg_1);
14393               __Pyx_GIVEREF(__pyx_int_neg_1);
14394               PyList_SET_ITEM(__pyx_t_9, 1, __pyx_int_neg_1);
14395               __Pyx_INCREF(__pyx_int_neg_1);
14396               __Pyx_GIVEREF(__pyx_int_neg_1);
14397               PyList_SET_ITEM(__pyx_t_9, 2, __pyx_int_neg_1);
14398               __pyx_t_2 = __Pyx_PyInt_From_npy_uint64(__pyx_v_max_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 710, __pyx_L1_error)
14399               __Pyx_GOTREF(__pyx_t_2);
14400               __Pyx_INCREF(__pyx_v_fneighbor);
14401               __pyx_t_3 = __pyx_v_fneighbor; __pyx_t_10 = NULL;
14402               __pyx_t_25 = 0;
14403               if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
14404                 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_3);
14405                 if (likely(__pyx_t_10)) {
14406                   PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
14407                   __Pyx_INCREF(__pyx_t_10);
14408                   __Pyx_INCREF(function);
14409                   __Pyx_DECREF_SET(__pyx_t_3, function);
14410                   __pyx_t_25 = 1;
14411                 }
14412               }
14413               #if CYTHON_FAST_PYCALL
14414               if (PyFunction_Check(__pyx_t_3)) {
14415                 PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_t_20, __pyx_t_17, __pyx_t_9, __pyx_t_2};
14416                 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_25, 4+__pyx_t_25); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 710, __pyx_L1_error)
14417                 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
14418                 __Pyx_GOTREF(__pyx_t_1);
14419                 __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
14420                 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
14421                 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14422                 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14423               } else
14424               #endif
14425               #if CYTHON_FAST_PYCCALL
14426               if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
14427                 PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_t_20, __pyx_t_17, __pyx_t_9, __pyx_t_2};
14428                 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_25, 4+__pyx_t_25); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 710, __pyx_L1_error)
14429                 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
14430                 __Pyx_GOTREF(__pyx_t_1);
14431                 __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
14432                 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
14433                 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14434                 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14435               } else
14436               #endif
14437               {
14438                 __pyx_t_18 = PyTuple_New(4+__pyx_t_25); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 710, __pyx_L1_error)
14439                 __Pyx_GOTREF(__pyx_t_18);
14440                 if (__pyx_t_10) {
14441                   __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_10); __pyx_t_10 = NULL;
14442                 }
14443                 __Pyx_GIVEREF(__pyx_t_20);
14444                 PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_25, __pyx_t_20);
14445                 __Pyx_GIVEREF(__pyx_t_17);
14446                 PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_25, __pyx_t_17);
14447                 __Pyx_GIVEREF(__pyx_t_9);
14448                 PyTuple_SET_ITEM(__pyx_t_18, 2+__pyx_t_25, __pyx_t_9);
14449                 __Pyx_GIVEREF(__pyx_t_2);
14450                 PyTuple_SET_ITEM(__pyx_t_18, 3+__pyx_t_25, __pyx_t_2);
14451                 __pyx_t_20 = 0;
14452                 __pyx_t_17 = 0;
14453                 __pyx_t_9 = 0;
14454                 __pyx_t_2 = 0;
14455                 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 710, __pyx_L1_error)
14456                 __Pyx_GOTREF(__pyx_t_1);
14457                 __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
14458               }
14459               __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14460               __pyx_t_21 = __Pyx_PyInt_As_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_21 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 710, __pyx_L1_error)
14461               __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14462               __pyx_v_nmi = __pyx_t_21;
14463 
14464               /* "yt/utilities/lib/geometry_utils.pyx":711
14465  *                                 n+=1
14466  *                             nmi = fneighbor(p[i,:],[j,k,l],[-1,-1,-1],max_index)
14467  *                             if nmi > 0:             # <<<<<<<<<<<<<<
14468  *                                 mi_neighbors[n] = np.uint64(nmi)
14469  *                                 n+=1
14470  */
14471               __pyx_t_13 = ((__pyx_v_nmi > 0) != 0);
14472               if (__pyx_t_13) {
14473 
14474                 /* "yt/utilities/lib/geometry_utils.pyx":712
14475  *                             nmi = fneighbor(p[i,:],[j,k,l],[-1,-1,-1],max_index)
14476  *                             if nmi > 0:
14477  *                                 mi_neighbors[n] = np.uint64(nmi)             # <<<<<<<<<<<<<<
14478  *                                 n+=1
14479  *     mi_neighbors = np.resize(mi_neighbors,(n,))
14480  */
14481                 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 712, __pyx_L1_error)
14482                 __Pyx_GOTREF(__pyx_t_3);
14483                 __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint64); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 712, __pyx_L1_error)
14484                 __Pyx_GOTREF(__pyx_t_18);
14485                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14486                 __pyx_t_3 = __Pyx_PyInt_From_npy_int64(__pyx_v_nmi); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 712, __pyx_L1_error)
14487                 __Pyx_GOTREF(__pyx_t_3);
14488                 __pyx_t_2 = NULL;
14489                 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_18))) {
14490                   __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_18);
14491                   if (likely(__pyx_t_2)) {
14492                     PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
14493                     __Pyx_INCREF(__pyx_t_2);
14494                     __Pyx_INCREF(function);
14495                     __Pyx_DECREF_SET(__pyx_t_18, function);
14496                   }
14497                 }
14498                 __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_18, __pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_t_3);
14499                 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
14500                 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14501                 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 712, __pyx_L1_error)
14502                 __Pyx_GOTREF(__pyx_t_1);
14503                 __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
14504                 __pyx_t_12 = __Pyx_PyInt_As_npy_uint64(__pyx_t_1); if (unlikely((__pyx_t_12 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 712, __pyx_L1_error)
14505                 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14506                 __pyx_t_37 = __pyx_v_n;
14507                 *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_mi_neighbors.diminfo[0].strides) = __pyx_t_12;
14508 
14509                 /* "yt/utilities/lib/geometry_utils.pyx":713
14510  *                             if nmi > 0:
14511  *                                 mi_neighbors[n] = np.uint64(nmi)
14512  *                                 n+=1             # <<<<<<<<<<<<<<
14513  *     mi_neighbors = np.resize(mi_neighbors,(n,))
14514  *     return np.unique(np.hstack([mi,mi_neighbors]))
14515  */
14516                 __pyx_v_n = (__pyx_v_n + 1);
14517 
14518                 /* "yt/utilities/lib/geometry_utils.pyx":711
14519  *                                 n+=1
14520  *                             nmi = fneighbor(p[i,:],[j,k,l],[-1,-1,-1],max_index)
14521  *                             if nmi > 0:             # <<<<<<<<<<<<<<
14522  *                                 mi_neighbors[n] = np.uint64(nmi)
14523  *                                 n+=1
14524  */
14525               }
14526             }
14527 
14528             /* "yt/utilities/lib/geometry_utils.pyx":701
14529  *                     # -1 in dimension k
14530  *                     nmi = fneighbor(p[i,:],[j,k],[-1,-1],max_index)
14531  *                     if nmi > 0:             # <<<<<<<<<<<<<<
14532  *                         mi_neighbors[n] = np.uint64(nmi)
14533  *                         n+=1
14534  */
14535           }
14536         }
14537 
14538         /* "yt/utilities/lib/geometry_utils.pyx":679
14539  *             # -1 in dimension j
14540  *             nmi = fneighbor(p[i,:],[j],[-1],max_index)
14541  *             if nmi > 0:             # <<<<<<<<<<<<<<
14542  *                 mi_neighbors[n] = np.uint64(nmi)
14543  *                 n+=1
14544  */
14545       }
14546     }
14547   }
14548 
14549   /* "yt/utilities/lib/geometry_utils.pyx":714
14550  *                                 mi_neighbors[n] = np.uint64(nmi)
14551  *                                 n+=1
14552  *     mi_neighbors = np.resize(mi_neighbors,(n,))             # <<<<<<<<<<<<<<
14553  *     return np.unique(np.hstack([mi,mi_neighbors]))
14554  *
14555  */
14556   __Pyx_GetModuleGlobalName(__pyx_t_18, __pyx_n_s_np); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 714, __pyx_L1_error)
14557   __Pyx_GOTREF(__pyx_t_18);
14558   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s_resize); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 714, __pyx_L1_error)
14559   __Pyx_GOTREF(__pyx_t_3);
14560   __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
14561   __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 714, __pyx_L1_error)
14562   __Pyx_GOTREF(__pyx_t_18);
14563   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 714, __pyx_L1_error)
14564   __Pyx_GOTREF(__pyx_t_2);
14565   __Pyx_GIVEREF(__pyx_t_18);
14566   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_18);
14567   __pyx_t_18 = 0;
14568   __pyx_t_18 = NULL;
14569   __pyx_t_5 = 0;
14570   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
14571     __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_3);
14572     if (likely(__pyx_t_18)) {
14573       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
14574       __Pyx_INCREF(__pyx_t_18);
14575       __Pyx_INCREF(function);
14576       __Pyx_DECREF_SET(__pyx_t_3, function);
14577       __pyx_t_5 = 1;
14578     }
14579   }
14580   #if CYTHON_FAST_PYCALL
14581   if (PyFunction_Check(__pyx_t_3)) {
14582     PyObject *__pyx_temp[3] = {__pyx_t_18, ((PyObject *)__pyx_v_mi_neighbors), __pyx_t_2};
14583     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 714, __pyx_L1_error)
14584     __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
14585     __Pyx_GOTREF(__pyx_t_1);
14586     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14587   } else
14588   #endif
14589   #if CYTHON_FAST_PYCCALL
14590   if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
14591     PyObject *__pyx_temp[3] = {__pyx_t_18, ((PyObject *)__pyx_v_mi_neighbors), __pyx_t_2};
14592     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 714, __pyx_L1_error)
14593     __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
14594     __Pyx_GOTREF(__pyx_t_1);
14595     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14596   } else
14597   #endif
14598   {
14599     __pyx_t_9 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 714, __pyx_L1_error)
14600     __Pyx_GOTREF(__pyx_t_9);
14601     if (__pyx_t_18) {
14602       __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_18); __pyx_t_18 = NULL;
14603     }
14604     __Pyx_INCREF(((PyObject *)__pyx_v_mi_neighbors));
14605     __Pyx_GIVEREF(((PyObject *)__pyx_v_mi_neighbors));
14606     PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_5, ((PyObject *)__pyx_v_mi_neighbors));
14607     __Pyx_GIVEREF(__pyx_t_2);
14608     PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_5, __pyx_t_2);
14609     __pyx_t_2 = 0;
14610     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 714, __pyx_L1_error)
14611     __Pyx_GOTREF(__pyx_t_1);
14612     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14613   }
14614   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14615   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 714, __pyx_L1_error)
14616   __pyx_t_11 = ((PyArrayObject *)__pyx_t_1);
14617   {
14618     __Pyx_BufFmt_StackElem __pyx_stack[1];
14619     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer);
14620     __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
14621     if (unlikely(__pyx_t_5 < 0)) {
14622       PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
14623       if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer, (PyObject*)__pyx_v_mi_neighbors, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
14624         Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8);
14625         __Pyx_RaiseBufferFallbackError();
14626       } else {
14627         PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
14628       }
14629       __pyx_t_6 = __pyx_t_7 = __pyx_t_8 = 0;
14630     }
14631     __pyx_pybuffernd_mi_neighbors.diminfo[0].strides = __pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mi_neighbors.diminfo[0].shape = __pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer.shape[0];
14632     if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(1, 714, __pyx_L1_error)
14633   }
14634   __pyx_t_11 = 0;
14635   __Pyx_DECREF_SET(__pyx_v_mi_neighbors, ((PyArrayObject *)__pyx_t_1));
14636   __pyx_t_1 = 0;
14637 
14638   /* "yt/utilities/lib/geometry_utils.pyx":715
14639  *                                 n+=1
14640  *     mi_neighbors = np.resize(mi_neighbors,(n,))
14641  *     return np.unique(np.hstack([mi,mi_neighbors]))             # <<<<<<<<<<<<<<
14642  *
14643  * def ifrexp_cy(np.float64_t x):
14644  */
14645   __Pyx_XDECREF(__pyx_r);
14646   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 715, __pyx_L1_error)
14647   __Pyx_GOTREF(__pyx_t_3);
14648   __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_unique); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 715, __pyx_L1_error)
14649   __Pyx_GOTREF(__pyx_t_9);
14650   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14651   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 715, __pyx_L1_error)
14652   __Pyx_GOTREF(__pyx_t_2);
14653   __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_hstack); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 715, __pyx_L1_error)
14654   __Pyx_GOTREF(__pyx_t_18);
14655   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14656   __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 715, __pyx_L1_error)
14657   __Pyx_GOTREF(__pyx_t_2);
14658   __Pyx_INCREF(((PyObject *)__pyx_v_mi));
14659   __Pyx_GIVEREF(((PyObject *)__pyx_v_mi));
14660   PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_mi));
14661   __Pyx_INCREF(((PyObject *)__pyx_v_mi_neighbors));
14662   __Pyx_GIVEREF(((PyObject *)__pyx_v_mi_neighbors));
14663   PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_mi_neighbors));
14664   __pyx_t_17 = NULL;
14665   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_18))) {
14666     __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_18);
14667     if (likely(__pyx_t_17)) {
14668       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
14669       __Pyx_INCREF(__pyx_t_17);
14670       __Pyx_INCREF(function);
14671       __Pyx_DECREF_SET(__pyx_t_18, function);
14672     }
14673   }
14674   __pyx_t_3 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_18, __pyx_t_17, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_t_2);
14675   __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
14676   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14677   if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 715, __pyx_L1_error)
14678   __Pyx_GOTREF(__pyx_t_3);
14679   __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
14680   __pyx_t_18 = NULL;
14681   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
14682     __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_9);
14683     if (likely(__pyx_t_18)) {
14684       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
14685       __Pyx_INCREF(__pyx_t_18);
14686       __Pyx_INCREF(function);
14687       __Pyx_DECREF_SET(__pyx_t_9, function);
14688     }
14689   }
14690   __pyx_t_1 = (__pyx_t_18) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_18, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_3);
14691   __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
14692   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14693   if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 715, __pyx_L1_error)
14694   __Pyx_GOTREF(__pyx_t_1);
14695   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14696   __pyx_r = __pyx_t_1;
14697   __pyx_t_1 = 0;
14698   goto __pyx_L0;
14699 
14700   /* "yt/utilities/lib/geometry_utils.pyx":620
14701  * @cython.boundscheck(False)
14702  * @cython.wraparound(False)
14703  * def get_morton_neighbors(np.ndarray[np.uint64_t,ndim=1] mi,             # <<<<<<<<<<<<<<
14704  *                          int order = ORDER_MAX, periodic = False):
14705  *     """Returns array of neighboring morton indices"""
14706  */
14707 
14708   /* function exit code */
14709   __pyx_L1_error:;
14710   __Pyx_XDECREF(__pyx_t_1);
14711   __Pyx_XDECREF(__pyx_t_2);
14712   __Pyx_XDECREF(__pyx_t_3);
14713   __Pyx_XDECREF(__pyx_t_9);
14714   __Pyx_XDECREF(__pyx_t_10);
14715   __Pyx_XDECREF(__pyx_t_17);
14716   __Pyx_XDECREF(__pyx_t_18);
14717   __Pyx_XDECREF(__pyx_t_20);
14718   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
14719     __Pyx_PyThreadState_declare
14720     __Pyx_PyThreadState_assign
14721     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
14722     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mi.rcbuffer->pybuffer);
14723     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer);
14724     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_p.rcbuffer->pybuffer);
14725   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
14726   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.get_morton_neighbors", __pyx_clineno, __pyx_lineno, __pyx_filename);
14727   __pyx_r = NULL;
14728   goto __pyx_L2;
14729   __pyx_L0:;
14730   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mi.rcbuffer->pybuffer);
14731   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mi_neighbors.rcbuffer->pybuffer);
14732   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_p.rcbuffer->pybuffer);
14733   __pyx_L2:;
14734   __Pyx_XDECREF((PyObject *)__pyx_v_p);
14735   __Pyx_XDECREF((PyObject *)__pyx_v_mi_neighbors);
14736   __Pyx_XDECREF(__pyx_v_fneighbor);
14737   __Pyx_XGIVEREF(__pyx_r);
14738   __Pyx_RefNannyFinishContext();
14739   return __pyx_r;
14740 }
14741 
14742 /* "yt/utilities/lib/geometry_utils.pyx":717
14743  *     return np.unique(np.hstack([mi,mi_neighbors]))
14744  *
14745  * def ifrexp_cy(np.float64_t x):             # <<<<<<<<<<<<<<
14746  *     cdef np.int64_t e, m
14747  *     m = ifrexp(x, &e)
14748  */
14749 
14750 /* Python wrapper */
14751 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_37ifrexp_cy(PyObject *__pyx_self, PyObject *__pyx_arg_x); /*proto*/
14752 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_37ifrexp_cy = {"ifrexp_cy", (PyCFunction)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_37ifrexp_cy, METH_O, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_37ifrexp_cy(PyObject * __pyx_self,PyObject * __pyx_arg_x)14753 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_37ifrexp_cy(PyObject *__pyx_self, PyObject *__pyx_arg_x) {
14754   __pyx_t_5numpy_float64_t __pyx_v_x;
14755   PyObject *__pyx_r = 0;
14756   __Pyx_RefNannyDeclarations
14757   __Pyx_RefNannySetupContext("ifrexp_cy (wrapper)", 0);
14758   assert(__pyx_arg_x); {
14759     __pyx_v_x = __pyx_PyFloat_AsDouble(__pyx_arg_x); if (unlikely((__pyx_v_x == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 717, __pyx_L3_error)
14760   }
14761   goto __pyx_L4_argument_unpacking_done;
14762   __pyx_L3_error:;
14763   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.ifrexp_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
14764   __Pyx_RefNannyFinishContext();
14765   return NULL;
14766   __pyx_L4_argument_unpacking_done:;
14767   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_36ifrexp_cy(__pyx_self, ((__pyx_t_5numpy_float64_t)__pyx_v_x));
14768 
14769   /* function exit code */
14770   __Pyx_RefNannyFinishContext();
14771   return __pyx_r;
14772 }
14773 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_36ifrexp_cy(CYTHON_UNUSED PyObject * __pyx_self,__pyx_t_5numpy_float64_t __pyx_v_x)14774 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_36ifrexp_cy(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_float64_t __pyx_v_x) {
14775   __pyx_t_5numpy_int64_t __pyx_v_e;
14776   __pyx_t_5numpy_int64_t __pyx_v_m;
14777   PyObject *__pyx_r = NULL;
14778   __Pyx_RefNannyDeclarations
14779   PyObject *__pyx_t_1 = NULL;
14780   PyObject *__pyx_t_2 = NULL;
14781   PyObject *__pyx_t_3 = NULL;
14782   __Pyx_RefNannySetupContext("ifrexp_cy", 0);
14783 
14784   /* "yt/utilities/lib/geometry_utils.pyx":719
14785  * def ifrexp_cy(np.float64_t x):
14786  *     cdef np.int64_t e, m
14787  *     m = ifrexp(x, &e)             # <<<<<<<<<<<<<<
14788  *     return m,e
14789  *
14790  */
14791   __pyx_v_m = __pyx_f_2yt_9utilities_3lib_14geometry_utils_ifrexp(__pyx_v_x, (&__pyx_v_e));
14792 
14793   /* "yt/utilities/lib/geometry_utils.pyx":720
14794  *     cdef np.int64_t e, m
14795  *     m = ifrexp(x, &e)
14796  *     return m,e             # <<<<<<<<<<<<<<
14797  *
14798  * def msdb_cy(np.int64_t a, np.int64_t b):
14799  */
14800   __Pyx_XDECREF(__pyx_r);
14801   __pyx_t_1 = __Pyx_PyInt_From_npy_int64(__pyx_v_m); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 720, __pyx_L1_error)
14802   __Pyx_GOTREF(__pyx_t_1);
14803   __pyx_t_2 = __Pyx_PyInt_From_npy_int64(__pyx_v_e); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 720, __pyx_L1_error)
14804   __Pyx_GOTREF(__pyx_t_2);
14805   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 720, __pyx_L1_error)
14806   __Pyx_GOTREF(__pyx_t_3);
14807   __Pyx_GIVEREF(__pyx_t_1);
14808   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
14809   __Pyx_GIVEREF(__pyx_t_2);
14810   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
14811   __pyx_t_1 = 0;
14812   __pyx_t_2 = 0;
14813   __pyx_r = __pyx_t_3;
14814   __pyx_t_3 = 0;
14815   goto __pyx_L0;
14816 
14817   /* "yt/utilities/lib/geometry_utils.pyx":717
14818  *     return np.unique(np.hstack([mi,mi_neighbors]))
14819  *
14820  * def ifrexp_cy(np.float64_t x):             # <<<<<<<<<<<<<<
14821  *     cdef np.int64_t e, m
14822  *     m = ifrexp(x, &e)
14823  */
14824 
14825   /* function exit code */
14826   __pyx_L1_error:;
14827   __Pyx_XDECREF(__pyx_t_1);
14828   __Pyx_XDECREF(__pyx_t_2);
14829   __Pyx_XDECREF(__pyx_t_3);
14830   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.ifrexp_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
14831   __pyx_r = NULL;
14832   __pyx_L0:;
14833   __Pyx_XGIVEREF(__pyx_r);
14834   __Pyx_RefNannyFinishContext();
14835   return __pyx_r;
14836 }
14837 
14838 /* "yt/utilities/lib/geometry_utils.pyx":722
14839  *     return m,e
14840  *
14841  * def msdb_cy(np.int64_t a, np.int64_t b):             # <<<<<<<<<<<<<<
14842  *     return msdb(a,b)
14843  *
14844  */
14845 
14846 /* Python wrapper */
14847 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_39msdb_cy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
14848 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_39msdb_cy = {"msdb_cy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_39msdb_cy, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_39msdb_cy(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)14849 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_39msdb_cy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
14850   __pyx_t_5numpy_int64_t __pyx_v_a;
14851   __pyx_t_5numpy_int64_t __pyx_v_b;
14852   PyObject *__pyx_r = 0;
14853   __Pyx_RefNannyDeclarations
14854   __Pyx_RefNannySetupContext("msdb_cy (wrapper)", 0);
14855   {
14856     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,0};
14857     PyObject* values[2] = {0,0};
14858     if (unlikely(__pyx_kwds)) {
14859       Py_ssize_t kw_args;
14860       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
14861       switch (pos_args) {
14862         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14863         CYTHON_FALLTHROUGH;
14864         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14865         CYTHON_FALLTHROUGH;
14866         case  0: break;
14867         default: goto __pyx_L5_argtuple_error;
14868       }
14869       kw_args = PyDict_Size(__pyx_kwds);
14870       switch (pos_args) {
14871         case  0:
14872         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--;
14873         else goto __pyx_L5_argtuple_error;
14874         CYTHON_FALLTHROUGH;
14875         case  1:
14876         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
14877         else {
14878           __Pyx_RaiseArgtupleInvalid("msdb_cy", 1, 2, 2, 1); __PYX_ERR(1, 722, __pyx_L3_error)
14879         }
14880       }
14881       if (unlikely(kw_args > 0)) {
14882         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msdb_cy") < 0)) __PYX_ERR(1, 722, __pyx_L3_error)
14883       }
14884     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
14885       goto __pyx_L5_argtuple_error;
14886     } else {
14887       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14888       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14889     }
14890     __pyx_v_a = __Pyx_PyInt_As_npy_int64(values[0]); if (unlikely((__pyx_v_a == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 722, __pyx_L3_error)
14891     __pyx_v_b = __Pyx_PyInt_As_npy_int64(values[1]); if (unlikely((__pyx_v_b == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 722, __pyx_L3_error)
14892   }
14893   goto __pyx_L4_argument_unpacking_done;
14894   __pyx_L5_argtuple_error:;
14895   __Pyx_RaiseArgtupleInvalid("msdb_cy", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 722, __pyx_L3_error)
14896   __pyx_L3_error:;
14897   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.msdb_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
14898   __Pyx_RefNannyFinishContext();
14899   return NULL;
14900   __pyx_L4_argument_unpacking_done:;
14901   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_38msdb_cy(__pyx_self, __pyx_v_a, __pyx_v_b);
14902 
14903   /* function exit code */
14904   __Pyx_RefNannyFinishContext();
14905   return __pyx_r;
14906 }
14907 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_38msdb_cy(CYTHON_UNUSED PyObject * __pyx_self,__pyx_t_5numpy_int64_t __pyx_v_a,__pyx_t_5numpy_int64_t __pyx_v_b)14908 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_38msdb_cy(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_int64_t __pyx_v_a, __pyx_t_5numpy_int64_t __pyx_v_b) {
14909   PyObject *__pyx_r = NULL;
14910   __Pyx_RefNannyDeclarations
14911   PyObject *__pyx_t_1 = NULL;
14912   __Pyx_RefNannySetupContext("msdb_cy", 0);
14913 
14914   /* "yt/utilities/lib/geometry_utils.pyx":723
14915  *
14916  * def msdb_cy(np.int64_t a, np.int64_t b):
14917  *     return msdb(a,b)             # <<<<<<<<<<<<<<
14918  *
14919  * def msdb_cy(np.int64_t a, np.int64_t b):
14920  */
14921   __Pyx_XDECREF(__pyx_r);
14922   __pyx_t_1 = __Pyx_PyInt_From_npy_int64(__pyx_f_2yt_9utilities_3lib_14geometry_utils_msdb(__pyx_v_a, __pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 723, __pyx_L1_error)
14923   __Pyx_GOTREF(__pyx_t_1);
14924   __pyx_r = __pyx_t_1;
14925   __pyx_t_1 = 0;
14926   goto __pyx_L0;
14927 
14928   /* "yt/utilities/lib/geometry_utils.pyx":722
14929  *     return m,e
14930  *
14931  * def msdb_cy(np.int64_t a, np.int64_t b):             # <<<<<<<<<<<<<<
14932  *     return msdb(a,b)
14933  *
14934  */
14935 
14936   /* function exit code */
14937   __pyx_L1_error:;
14938   __Pyx_XDECREF(__pyx_t_1);
14939   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.msdb_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
14940   __pyx_r = NULL;
14941   __pyx_L0:;
14942   __Pyx_XGIVEREF(__pyx_r);
14943   __Pyx_RefNannyFinishContext();
14944   return __pyx_r;
14945 }
14946 
14947 /* "yt/utilities/lib/geometry_utils.pyx":725
14948  *     return msdb(a,b)
14949  *
14950  * def msdb_cy(np.int64_t a, np.int64_t b):             # <<<<<<<<<<<<<<
14951  *     return msdb(a,b)
14952  *
14953  */
14954 
14955 /* Python wrapper */
14956 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_41msdb_cy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
14957 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_41msdb_cy = {"msdb_cy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_41msdb_cy, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_41msdb_cy(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)14958 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_41msdb_cy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
14959   __pyx_t_5numpy_int64_t __pyx_v_a;
14960   __pyx_t_5numpy_int64_t __pyx_v_b;
14961   PyObject *__pyx_r = 0;
14962   __Pyx_RefNannyDeclarations
14963   __Pyx_RefNannySetupContext("msdb_cy (wrapper)", 0);
14964   {
14965     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,0};
14966     PyObject* values[2] = {0,0};
14967     if (unlikely(__pyx_kwds)) {
14968       Py_ssize_t kw_args;
14969       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
14970       switch (pos_args) {
14971         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14972         CYTHON_FALLTHROUGH;
14973         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14974         CYTHON_FALLTHROUGH;
14975         case  0: break;
14976         default: goto __pyx_L5_argtuple_error;
14977       }
14978       kw_args = PyDict_Size(__pyx_kwds);
14979       switch (pos_args) {
14980         case  0:
14981         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--;
14982         else goto __pyx_L5_argtuple_error;
14983         CYTHON_FALLTHROUGH;
14984         case  1:
14985         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
14986         else {
14987           __Pyx_RaiseArgtupleInvalid("msdb_cy", 1, 2, 2, 1); __PYX_ERR(1, 725, __pyx_L3_error)
14988         }
14989       }
14990       if (unlikely(kw_args > 0)) {
14991         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msdb_cy") < 0)) __PYX_ERR(1, 725, __pyx_L3_error)
14992       }
14993     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
14994       goto __pyx_L5_argtuple_error;
14995     } else {
14996       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14997       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14998     }
14999     __pyx_v_a = __Pyx_PyInt_As_npy_int64(values[0]); if (unlikely((__pyx_v_a == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 725, __pyx_L3_error)
15000     __pyx_v_b = __Pyx_PyInt_As_npy_int64(values[1]); if (unlikely((__pyx_v_b == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 725, __pyx_L3_error)
15001   }
15002   goto __pyx_L4_argument_unpacking_done;
15003   __pyx_L5_argtuple_error:;
15004   __Pyx_RaiseArgtupleInvalid("msdb_cy", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 725, __pyx_L3_error)
15005   __pyx_L3_error:;
15006   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.msdb_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
15007   __Pyx_RefNannyFinishContext();
15008   return NULL;
15009   __pyx_L4_argument_unpacking_done:;
15010   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_40msdb_cy(__pyx_self, __pyx_v_a, __pyx_v_b);
15011 
15012   /* function exit code */
15013   __Pyx_RefNannyFinishContext();
15014   return __pyx_r;
15015 }
15016 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_40msdb_cy(CYTHON_UNUSED PyObject * __pyx_self,__pyx_t_5numpy_int64_t __pyx_v_a,__pyx_t_5numpy_int64_t __pyx_v_b)15017 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_40msdb_cy(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_int64_t __pyx_v_a, __pyx_t_5numpy_int64_t __pyx_v_b) {
15018   PyObject *__pyx_r = NULL;
15019   __Pyx_RefNannyDeclarations
15020   PyObject *__pyx_t_1 = NULL;
15021   __Pyx_RefNannySetupContext("msdb_cy", 0);
15022 
15023   /* "yt/utilities/lib/geometry_utils.pyx":726
15024  *
15025  * def msdb_cy(np.int64_t a, np.int64_t b):
15026  *     return msdb(a,b)             # <<<<<<<<<<<<<<
15027  *
15028  * def xor_msb_cy(np.float64_t a, np.float64_t b):
15029  */
15030   __Pyx_XDECREF(__pyx_r);
15031   __pyx_t_1 = __Pyx_PyInt_From_npy_int64(__pyx_f_2yt_9utilities_3lib_14geometry_utils_msdb(__pyx_v_a, __pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 726, __pyx_L1_error)
15032   __Pyx_GOTREF(__pyx_t_1);
15033   __pyx_r = __pyx_t_1;
15034   __pyx_t_1 = 0;
15035   goto __pyx_L0;
15036 
15037   /* "yt/utilities/lib/geometry_utils.pyx":725
15038  *     return msdb(a,b)
15039  *
15040  * def msdb_cy(np.int64_t a, np.int64_t b):             # <<<<<<<<<<<<<<
15041  *     return msdb(a,b)
15042  *
15043  */
15044 
15045   /* function exit code */
15046   __pyx_L1_error:;
15047   __Pyx_XDECREF(__pyx_t_1);
15048   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.msdb_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
15049   __pyx_r = NULL;
15050   __pyx_L0:;
15051   __Pyx_XGIVEREF(__pyx_r);
15052   __Pyx_RefNannyFinishContext();
15053   return __pyx_r;
15054 }
15055 
15056 /* "yt/utilities/lib/geometry_utils.pyx":728
15057  *     return msdb(a,b)
15058  *
15059  * def xor_msb_cy(np.float64_t a, np.float64_t b):             # <<<<<<<<<<<<<<
15060  *     return xor_msb(a,b)
15061  *
15062  */
15063 
15064 /* Python wrapper */
15065 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_43xor_msb_cy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15066 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_43xor_msb_cy = {"xor_msb_cy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_43xor_msb_cy, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_43xor_msb_cy(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)15067 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_43xor_msb_cy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15068   __pyx_t_5numpy_float64_t __pyx_v_a;
15069   __pyx_t_5numpy_float64_t __pyx_v_b;
15070   PyObject *__pyx_r = 0;
15071   __Pyx_RefNannyDeclarations
15072   __Pyx_RefNannySetupContext("xor_msb_cy (wrapper)", 0);
15073   {
15074     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,0};
15075     PyObject* values[2] = {0,0};
15076     if (unlikely(__pyx_kwds)) {
15077       Py_ssize_t kw_args;
15078       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15079       switch (pos_args) {
15080         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15081         CYTHON_FALLTHROUGH;
15082         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15083         CYTHON_FALLTHROUGH;
15084         case  0: break;
15085         default: goto __pyx_L5_argtuple_error;
15086       }
15087       kw_args = PyDict_Size(__pyx_kwds);
15088       switch (pos_args) {
15089         case  0:
15090         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--;
15091         else goto __pyx_L5_argtuple_error;
15092         CYTHON_FALLTHROUGH;
15093         case  1:
15094         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
15095         else {
15096           __Pyx_RaiseArgtupleInvalid("xor_msb_cy", 1, 2, 2, 1); __PYX_ERR(1, 728, __pyx_L3_error)
15097         }
15098       }
15099       if (unlikely(kw_args > 0)) {
15100         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "xor_msb_cy") < 0)) __PYX_ERR(1, 728, __pyx_L3_error)
15101       }
15102     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
15103       goto __pyx_L5_argtuple_error;
15104     } else {
15105       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15106       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15107     }
15108     __pyx_v_a = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_a == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 728, __pyx_L3_error)
15109     __pyx_v_b = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_b == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 728, __pyx_L3_error)
15110   }
15111   goto __pyx_L4_argument_unpacking_done;
15112   __pyx_L5_argtuple_error:;
15113   __Pyx_RaiseArgtupleInvalid("xor_msb_cy", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 728, __pyx_L3_error)
15114   __pyx_L3_error:;
15115   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.xor_msb_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
15116   __Pyx_RefNannyFinishContext();
15117   return NULL;
15118   __pyx_L4_argument_unpacking_done:;
15119   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_42xor_msb_cy(__pyx_self, __pyx_v_a, __pyx_v_b);
15120 
15121   /* function exit code */
15122   __Pyx_RefNannyFinishContext();
15123   return __pyx_r;
15124 }
15125 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_42xor_msb_cy(CYTHON_UNUSED PyObject * __pyx_self,__pyx_t_5numpy_float64_t __pyx_v_a,__pyx_t_5numpy_float64_t __pyx_v_b)15126 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_42xor_msb_cy(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) {
15127   PyObject *__pyx_r = NULL;
15128   __Pyx_RefNannyDeclarations
15129   PyObject *__pyx_t_1 = NULL;
15130   __Pyx_RefNannySetupContext("xor_msb_cy", 0);
15131 
15132   /* "yt/utilities/lib/geometry_utils.pyx":729
15133  *
15134  * def xor_msb_cy(np.float64_t a, np.float64_t b):
15135  *     return xor_msb(a,b)             # <<<<<<<<<<<<<<
15136  *
15137  * def morton_qsort_swap(np.ndarray[np.uint64_t, ndim=1] ind,
15138  */
15139   __Pyx_XDECREF(__pyx_r);
15140   __pyx_t_1 = __Pyx_PyInt_From_npy_int64(__pyx_f_2yt_9utilities_3lib_14geometry_utils_xor_msb(__pyx_v_a, __pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 729, __pyx_L1_error)
15141   __Pyx_GOTREF(__pyx_t_1);
15142   __pyx_r = __pyx_t_1;
15143   __pyx_t_1 = 0;
15144   goto __pyx_L0;
15145 
15146   /* "yt/utilities/lib/geometry_utils.pyx":728
15147  *     return msdb(a,b)
15148  *
15149  * def xor_msb_cy(np.float64_t a, np.float64_t b):             # <<<<<<<<<<<<<<
15150  *     return xor_msb(a,b)
15151  *
15152  */
15153 
15154   /* function exit code */
15155   __pyx_L1_error:;
15156   __Pyx_XDECREF(__pyx_t_1);
15157   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.xor_msb_cy", __pyx_clineno, __pyx_lineno, __pyx_filename);
15158   __pyx_r = NULL;
15159   __pyx_L0:;
15160   __Pyx_XGIVEREF(__pyx_r);
15161   __Pyx_RefNannyFinishContext();
15162   return __pyx_r;
15163 }
15164 
15165 /* "yt/utilities/lib/geometry_utils.pyx":731
15166  *     return xor_msb(a,b)
15167  *
15168  * def morton_qsort_swap(np.ndarray[np.uint64_t, ndim=1] ind,             # <<<<<<<<<<<<<<
15169  *                       np.uint64_t a, np.uint64_t b):
15170  *     # http://www.geeksforgeeks.org/iterative-quick-sort/
15171  */
15172 
15173 /* Python wrapper */
15174 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_45morton_qsort_swap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15175 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_45morton_qsort_swap = {"morton_qsort_swap", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_45morton_qsort_swap, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_45morton_qsort_swap(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)15176 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_45morton_qsort_swap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15177   PyArrayObject *__pyx_v_ind = 0;
15178   __pyx_t_5numpy_uint64_t __pyx_v_a;
15179   __pyx_t_5numpy_uint64_t __pyx_v_b;
15180   PyObject *__pyx_r = 0;
15181   __Pyx_RefNannyDeclarations
15182   __Pyx_RefNannySetupContext("morton_qsort_swap (wrapper)", 0);
15183   {
15184     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ind,&__pyx_n_s_a,&__pyx_n_s_b,0};
15185     PyObject* values[3] = {0,0,0};
15186     if (unlikely(__pyx_kwds)) {
15187       Py_ssize_t kw_args;
15188       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15189       switch (pos_args) {
15190         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15191         CYTHON_FALLTHROUGH;
15192         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15193         CYTHON_FALLTHROUGH;
15194         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15195         CYTHON_FALLTHROUGH;
15196         case  0: break;
15197         default: goto __pyx_L5_argtuple_error;
15198       }
15199       kw_args = PyDict_Size(__pyx_kwds);
15200       switch (pos_args) {
15201         case  0:
15202         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind)) != 0)) kw_args--;
15203         else goto __pyx_L5_argtuple_error;
15204         CYTHON_FALLTHROUGH;
15205         case  1:
15206         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--;
15207         else {
15208           __Pyx_RaiseArgtupleInvalid("morton_qsort_swap", 1, 3, 3, 1); __PYX_ERR(1, 731, __pyx_L3_error)
15209         }
15210         CYTHON_FALLTHROUGH;
15211         case  2:
15212         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
15213         else {
15214           __Pyx_RaiseArgtupleInvalid("morton_qsort_swap", 1, 3, 3, 2); __PYX_ERR(1, 731, __pyx_L3_error)
15215         }
15216       }
15217       if (unlikely(kw_args > 0)) {
15218         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "morton_qsort_swap") < 0)) __PYX_ERR(1, 731, __pyx_L3_error)
15219       }
15220     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
15221       goto __pyx_L5_argtuple_error;
15222     } else {
15223       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15224       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15225       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15226     }
15227     __pyx_v_ind = ((PyArrayObject *)values[0]);
15228     __pyx_v_a = __Pyx_PyInt_As_npy_uint64(values[1]); if (unlikely((__pyx_v_a == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 732, __pyx_L3_error)
15229     __pyx_v_b = __Pyx_PyInt_As_npy_uint64(values[2]); if (unlikely((__pyx_v_b == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 732, __pyx_L3_error)
15230   }
15231   goto __pyx_L4_argument_unpacking_done;
15232   __pyx_L5_argtuple_error:;
15233   __Pyx_RaiseArgtupleInvalid("morton_qsort_swap", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 731, __pyx_L3_error)
15234   __pyx_L3_error:;
15235   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_qsort_swap", __pyx_clineno, __pyx_lineno, __pyx_filename);
15236   __Pyx_RefNannyFinishContext();
15237   return NULL;
15238   __pyx_L4_argument_unpacking_done:;
15239   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ind), __pyx_ptype_5numpy_ndarray, 1, "ind", 0))) __PYX_ERR(1, 731, __pyx_L1_error)
15240   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_44morton_qsort_swap(__pyx_self, __pyx_v_ind, __pyx_v_a, __pyx_v_b);
15241 
15242   /* function exit code */
15243   goto __pyx_L0;
15244   __pyx_L1_error:;
15245   __pyx_r = NULL;
15246   __pyx_L0:;
15247   __Pyx_RefNannyFinishContext();
15248   return __pyx_r;
15249 }
15250 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_44morton_qsort_swap(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_ind,__pyx_t_5numpy_uint64_t __pyx_v_a,__pyx_t_5numpy_uint64_t __pyx_v_b)15251 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_44morton_qsort_swap(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_ind, __pyx_t_5numpy_uint64_t __pyx_v_a, __pyx_t_5numpy_uint64_t __pyx_v_b) {
15252   __pyx_t_5numpy_int64_t __pyx_v_t;
15253   __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
15254   __Pyx_Buffer __pyx_pybuffer_ind;
15255   PyObject *__pyx_r = NULL;
15256   __Pyx_RefNannyDeclarations
15257   __pyx_t_5numpy_uint64_t __pyx_t_1;
15258   int __pyx_t_2;
15259   __pyx_t_5numpy_uint64_t __pyx_t_3;
15260   __pyx_t_5numpy_uint64_t __pyx_t_4;
15261   __pyx_t_5numpy_uint64_t __pyx_t_5;
15262   __Pyx_RefNannySetupContext("morton_qsort_swap", 0);
15263   __pyx_pybuffer_ind.pybuffer.buf = NULL;
15264   __pyx_pybuffer_ind.refcount = 0;
15265   __pyx_pybuffernd_ind.data = NULL;
15266   __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;
15267   {
15268     __Pyx_BufFmt_StackElem __pyx_stack[1];
15269     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 731, __pyx_L1_error)
15270   }
15271   __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
15272 
15273   /* "yt/utilities/lib/geometry_utils.pyx":734
15274  *                       np.uint64_t a, np.uint64_t b):
15275  *     # http://www.geeksforgeeks.org/iterative-quick-sort/
15276  *     cdef np.int64_t t = ind[a]             # <<<<<<<<<<<<<<
15277  *     ind[a] = ind[b]
15278  *     ind[b] = t
15279  */
15280   __pyx_t_1 = __pyx_v_a;
15281   __pyx_t_2 = -1;
15282   if (unlikely(__pyx_t_1 >= (size_t)__pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_2 = 0;
15283   if (unlikely(__pyx_t_2 != -1)) {
15284     __Pyx_RaiseBufferIndexError(__pyx_t_2);
15285     __PYX_ERR(1, 734, __pyx_L1_error)
15286   }
15287   __pyx_v_t = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_ind.diminfo[0].strides));
15288 
15289   /* "yt/utilities/lib/geometry_utils.pyx":735
15290  *     # http://www.geeksforgeeks.org/iterative-quick-sort/
15291  *     cdef np.int64_t t = ind[a]
15292  *     ind[a] = ind[b]             # <<<<<<<<<<<<<<
15293  *     ind[b] = t
15294  *
15295  */
15296   __pyx_t_3 = __pyx_v_b;
15297   __pyx_t_2 = -1;
15298   if (unlikely(__pyx_t_3 >= (size_t)__pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_2 = 0;
15299   if (unlikely(__pyx_t_2 != -1)) {
15300     __Pyx_RaiseBufferIndexError(__pyx_t_2);
15301     __PYX_ERR(1, 735, __pyx_L1_error)
15302   }
15303   __pyx_t_4 = __pyx_v_a;
15304   __pyx_t_2 = -1;
15305   if (unlikely(__pyx_t_4 >= (size_t)__pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_2 = 0;
15306   if (unlikely(__pyx_t_2 != -1)) {
15307     __Pyx_RaiseBufferIndexError(__pyx_t_2);
15308     __PYX_ERR(1, 735, __pyx_L1_error)
15309   }
15310   *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_ind.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_ind.diminfo[0].strides));
15311 
15312   /* "yt/utilities/lib/geometry_utils.pyx":736
15313  *     cdef np.int64_t t = ind[a]
15314  *     ind[a] = ind[b]
15315  *     ind[b] = t             # <<<<<<<<<<<<<<
15316  *
15317  * def morton_qsort_partition(np.ndarray[floating, ndim=2] pos,
15318  */
15319   __pyx_t_5 = __pyx_v_b;
15320   __pyx_t_2 = -1;
15321   if (unlikely(__pyx_t_5 >= (size_t)__pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_2 = 0;
15322   if (unlikely(__pyx_t_2 != -1)) {
15323     __Pyx_RaiseBufferIndexError(__pyx_t_2);
15324     __PYX_ERR(1, 736, __pyx_L1_error)
15325   }
15326   *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_ind.diminfo[0].strides) = __pyx_v_t;
15327 
15328   /* "yt/utilities/lib/geometry_utils.pyx":731
15329  *     return xor_msb(a,b)
15330  *
15331  * def morton_qsort_swap(np.ndarray[np.uint64_t, ndim=1] ind,             # <<<<<<<<<<<<<<
15332  *                       np.uint64_t a, np.uint64_t b):
15333  *     # http://www.geeksforgeeks.org/iterative-quick-sort/
15334  */
15335 
15336   /* function exit code */
15337   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15338   goto __pyx_L0;
15339   __pyx_L1_error:;
15340   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
15341     __Pyx_PyThreadState_declare
15342     __Pyx_PyThreadState_assign
15343     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
15344     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
15345   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
15346   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_qsort_swap", __pyx_clineno, __pyx_lineno, __pyx_filename);
15347   __pyx_r = NULL;
15348   goto __pyx_L2;
15349   __pyx_L0:;
15350   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
15351   __pyx_L2:;
15352   __Pyx_XGIVEREF(__pyx_r);
15353   __Pyx_RefNannyFinishContext();
15354   return __pyx_r;
15355 }
15356 
15357 /* "yt/utilities/lib/geometry_utils.pyx":738
15358  *     ind[b] = t
15359  *
15360  * def morton_qsort_partition(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
15361  *                            np.int64_t l, np.int64_t h,
15362  *                            np.ndarray[np.uint64_t, ndim=1] ind,
15363  */
15364 
15365 /* Python wrapper */
15366 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_47morton_qsort_partition(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15367 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_47morton_qsort_partition = {"morton_qsort_partition", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_47morton_qsort_partition, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_47morton_qsort_partition(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)15368 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_47morton_qsort_partition(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15369   PyObject *__pyx_v_signatures = 0;
15370   PyObject *__pyx_v_args = 0;
15371   PyObject *__pyx_v_kwargs = 0;
15372   CYTHON_UNUSED PyObject *__pyx_v_defaults = 0;
15373   PyObject *__pyx_r = 0;
15374   __Pyx_RefNannyDeclarations
15375   __Pyx_RefNannySetupContext("__pyx_fused_cpdef (wrapper)", 0);
15376   {
15377     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_signatures,&__pyx_n_s_args,&__pyx_n_s_kwargs,&__pyx_n_s_defaults,0};
15378     PyObject* values[4] = {0,0,0,0};
15379     if (unlikely(__pyx_kwds)) {
15380       Py_ssize_t kw_args;
15381       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15382       switch (pos_args) {
15383         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15384         CYTHON_FALLTHROUGH;
15385         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15386         CYTHON_FALLTHROUGH;
15387         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15388         CYTHON_FALLTHROUGH;
15389         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15390         CYTHON_FALLTHROUGH;
15391         case  0: break;
15392         default: goto __pyx_L5_argtuple_error;
15393       }
15394       kw_args = PyDict_Size(__pyx_kwds);
15395       switch (pos_args) {
15396         case  0:
15397         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_signatures)) != 0)) kw_args--;
15398         else goto __pyx_L5_argtuple_error;
15399         CYTHON_FALLTHROUGH;
15400         case  1:
15401         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--;
15402         else {
15403           __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 1); __PYX_ERR(1, 738, __pyx_L3_error)
15404         }
15405         CYTHON_FALLTHROUGH;
15406         case  2:
15407         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--;
15408         else {
15409           __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 2); __PYX_ERR(1, 738, __pyx_L3_error)
15410         }
15411         CYTHON_FALLTHROUGH;
15412         case  3:
15413         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_defaults)) != 0)) kw_args--;
15414         else {
15415           __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 3); __PYX_ERR(1, 738, __pyx_L3_error)
15416         }
15417       }
15418       if (unlikely(kw_args > 0)) {
15419         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fused_cpdef") < 0)) __PYX_ERR(1, 738, __pyx_L3_error)
15420       }
15421     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
15422       goto __pyx_L5_argtuple_error;
15423     } else {
15424       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15425       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15426       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15427       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15428     }
15429     __pyx_v_signatures = values[0];
15430     __pyx_v_args = values[1];
15431     __pyx_v_kwargs = values[2];
15432     __pyx_v_defaults = values[3];
15433   }
15434   goto __pyx_L4_argument_unpacking_done;
15435   __pyx_L5_argtuple_error:;
15436   __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 738, __pyx_L3_error)
15437   __pyx_L3_error:;
15438   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename);
15439   __Pyx_RefNannyFinishContext();
15440   return NULL;
15441   __pyx_L4_argument_unpacking_done:;
15442   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_46morton_qsort_partition(__pyx_self, __pyx_v_signatures, __pyx_v_args, __pyx_v_kwargs, __pyx_v_defaults);
15443 
15444   /* function exit code */
15445   __Pyx_RefNannyFinishContext();
15446   return __pyx_r;
15447 }
15448 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_46morton_qsort_partition(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_signatures,PyObject * __pyx_v_args,PyObject * __pyx_v_kwargs,CYTHON_UNUSED PyObject * __pyx_v_defaults)15449 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_46morton_qsort_partition(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults) {
15450   PyObject *__pyx_v_dest_sig = NULL;
15451   Py_ssize_t __pyx_v_i;
15452   PyTypeObject *__pyx_v_ndarray = 0;
15453   __Pyx_memviewslice __pyx_v_memslice;
15454   Py_ssize_t __pyx_v_itemsize;
15455   CYTHON_UNUSED int __pyx_v_dtype_signed;
15456   char __pyx_v_kind;
15457   PyObject *__pyx_v_arg = NULL;
15458   PyObject *__pyx_v_dtype = NULL;
15459   PyObject *__pyx_v_arg_base = NULL;
15460   PyObject *__pyx_v_candidates = NULL;
15461   PyObject *__pyx_v_sig = NULL;
15462   int __pyx_v_match_found;
15463   PyObject *__pyx_v_src_sig = NULL;
15464   PyObject *__pyx_v_dst_type = NULL;
15465   PyObject *__pyx_r = NULL;
15466   __Pyx_RefNannyDeclarations
15467   PyObject *__pyx_t_1 = NULL;
15468   int __pyx_t_2;
15469   int __pyx_t_3;
15470   int __pyx_t_4;
15471   Py_ssize_t __pyx_t_5;
15472   PyObject *__pyx_t_6 = NULL;
15473   long __pyx_t_7;
15474   __Pyx_memviewslice __pyx_t_8;
15475   Py_ssize_t __pyx_t_9;
15476   int __pyx_t_10;
15477   int __pyx_t_11;
15478   PyObject *__pyx_t_12 = NULL;
15479   PyObject *__pyx_t_13 = NULL;
15480   PyObject *__pyx_t_14 = NULL;
15481   Py_ssize_t __pyx_t_15;
15482   Py_ssize_t __pyx_t_16;
15483   Py_ssize_t __pyx_t_17;
15484   int __pyx_t_18;
15485   __Pyx_RefNannySetupContext("morton_qsort_partition", 0);
15486   __Pyx_INCREF(__pyx_v_kwargs);
15487   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 738, __pyx_L1_error)
15488   __Pyx_GOTREF(__pyx_t_1);
15489   __Pyx_INCREF(Py_None);
15490   __Pyx_GIVEREF(Py_None);
15491   PyList_SET_ITEM(__pyx_t_1, 0, Py_None);
15492   __pyx_v_dest_sig = ((PyObject*)__pyx_t_1);
15493   __pyx_t_1 = 0;
15494   __pyx_t_3 = (__pyx_v_kwargs != Py_None);
15495   __pyx_t_4 = (__pyx_t_3 != 0);
15496   if (__pyx_t_4) {
15497   } else {
15498     __pyx_t_2 = __pyx_t_4;
15499     goto __pyx_L4_bool_binop_done;
15500   }
15501   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_kwargs); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 738, __pyx_L1_error)
15502   __pyx_t_3 = ((!__pyx_t_4) != 0);
15503   __pyx_t_2 = __pyx_t_3;
15504   __pyx_L4_bool_binop_done:;
15505   if (__pyx_t_2) {
15506     __Pyx_INCREF(Py_None);
15507     __Pyx_DECREF_SET(__pyx_v_kwargs, Py_None);
15508   }
15509   __pyx_t_1 = ((PyObject *)__Pyx_ImportNumPyArrayTypeIfAvailable()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 738, __pyx_L1_error)
15510   __Pyx_GOTREF(__pyx_t_1);
15511   __pyx_v_ndarray = ((PyTypeObject*)__pyx_t_1);
15512   __pyx_t_1 = 0;
15513   __pyx_v_itemsize = -1L;
15514   if (unlikely(__pyx_v_args == Py_None)) {
15515     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
15516     __PYX_ERR(1, 738, __pyx_L1_error)
15517   }
15518   __pyx_t_5 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 738, __pyx_L1_error)
15519   __pyx_t_2 = ((0 < __pyx_t_5) != 0);
15520   if (__pyx_t_2) {
15521     if (unlikely(__pyx_v_args == Py_None)) {
15522       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
15523       __PYX_ERR(1, 738, __pyx_L1_error)
15524     }
15525     __pyx_t_1 = __Pyx_GetItemInt_Tuple(((PyObject*)__pyx_v_args), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 738, __pyx_L1_error)
15526     __Pyx_GOTREF(__pyx_t_1);
15527     __pyx_v_arg = __pyx_t_1;
15528     __pyx_t_1 = 0;
15529     goto __pyx_L6;
15530   }
15531   __pyx_t_3 = (__pyx_v_kwargs != Py_None);
15532   __pyx_t_4 = (__pyx_t_3 != 0);
15533   if (__pyx_t_4) {
15534   } else {
15535     __pyx_t_2 = __pyx_t_4;
15536     goto __pyx_L7_bool_binop_done;
15537   }
15538   if (unlikely(__pyx_v_kwargs == Py_None)) {
15539     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
15540     __PYX_ERR(1, 738, __pyx_L1_error)
15541   }
15542   __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_pos, ((PyObject*)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 738, __pyx_L1_error)
15543   __pyx_t_3 = (__pyx_t_4 != 0);
15544   __pyx_t_2 = __pyx_t_3;
15545   __pyx_L7_bool_binop_done:;
15546   if (__pyx_t_2) {
15547     if (unlikely(__pyx_v_kwargs == Py_None)) {
15548       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
15549       __PYX_ERR(1, 738, __pyx_L1_error)
15550     }
15551     __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_kwargs), __pyx_n_s_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 738, __pyx_L1_error)
15552     __Pyx_GOTREF(__pyx_t_1);
15553     __pyx_v_arg = __pyx_t_1;
15554     __pyx_t_1 = 0;
15555     goto __pyx_L6;
15556   }
15557   /*else*/ {
15558     if (unlikely(__pyx_v_args == Py_None)) {
15559       PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
15560       __PYX_ERR(1, 738, __pyx_L1_error)
15561     }
15562     __pyx_t_5 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 738, __pyx_L1_error)
15563     __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 738, __pyx_L1_error)
15564     __Pyx_GOTREF(__pyx_t_1);
15565     __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 738, __pyx_L1_error)
15566     __Pyx_GOTREF(__pyx_t_6);
15567     __Pyx_INCREF(__pyx_int_4);
15568     __Pyx_GIVEREF(__pyx_int_4);
15569     PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_4);
15570     __Pyx_INCREF(__pyx_n_s_s);
15571     __Pyx_GIVEREF(__pyx_n_s_s);
15572     PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_n_s_s);
15573     __Pyx_GIVEREF(__pyx_t_1);
15574     PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1);
15575     __pyx_t_1 = 0;
15576     __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Expected_at_least_d_argument_s_g, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 738, __pyx_L1_error)
15577     __Pyx_GOTREF(__pyx_t_1);
15578     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15579     __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 738, __pyx_L1_error)
15580     __Pyx_GOTREF(__pyx_t_6);
15581     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15582     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
15583     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15584     __PYX_ERR(1, 738, __pyx_L1_error)
15585   }
15586   __pyx_L6:;
15587   while (1) {
15588     __pyx_t_2 = (__pyx_v_ndarray != ((PyTypeObject*)Py_None));
15589     __pyx_t_3 = (__pyx_t_2 != 0);
15590     if (__pyx_t_3) {
15591       __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_arg, __pyx_v_ndarray);
15592       __pyx_t_2 = (__pyx_t_3 != 0);
15593       if (__pyx_t_2) {
15594         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 738, __pyx_L1_error)
15595         __Pyx_GOTREF(__pyx_t_6);
15596         __pyx_v_dtype = __pyx_t_6;
15597         __pyx_t_6 = 0;
15598         goto __pyx_L12;
15599       }
15600       __pyx_t_2 = __pyx_memoryview_check(__pyx_v_arg);
15601       __pyx_t_3 = (__pyx_t_2 != 0);
15602       if (__pyx_t_3) {
15603         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_base); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 738, __pyx_L1_error)
15604         __Pyx_GOTREF(__pyx_t_6);
15605         __pyx_v_arg_base = __pyx_t_6;
15606         __pyx_t_6 = 0;
15607         __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_arg_base, __pyx_v_ndarray);
15608         __pyx_t_2 = (__pyx_t_3 != 0);
15609         if (__pyx_t_2) {
15610           __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg_base, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 738, __pyx_L1_error)
15611           __Pyx_GOTREF(__pyx_t_6);
15612           __pyx_v_dtype = __pyx_t_6;
15613           __pyx_t_6 = 0;
15614           goto __pyx_L13;
15615         }
15616         /*else*/ {
15617           __Pyx_INCREF(Py_None);
15618           __pyx_v_dtype = Py_None;
15619         }
15620         __pyx_L13:;
15621         goto __pyx_L12;
15622       }
15623       /*else*/ {
15624         __Pyx_INCREF(Py_None);
15625         __pyx_v_dtype = Py_None;
15626       }
15627       __pyx_L12:;
15628       __pyx_v_itemsize = -1L;
15629       __pyx_t_2 = (__pyx_v_dtype != Py_None);
15630       __pyx_t_3 = (__pyx_t_2 != 0);
15631       if (__pyx_t_3) {
15632         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 738, __pyx_L1_error)
15633         __Pyx_GOTREF(__pyx_t_6);
15634         __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 738, __pyx_L1_error)
15635         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15636         __pyx_v_itemsize = __pyx_t_5;
15637         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 738, __pyx_L1_error)
15638         __Pyx_GOTREF(__pyx_t_6);
15639         __pyx_t_7 = __Pyx_PyObject_Ord(__pyx_t_6); if (unlikely(__pyx_t_7 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(1, 738, __pyx_L1_error)
15640         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15641         __pyx_v_kind = __pyx_t_7;
15642         __pyx_v_dtype_signed = (__pyx_v_kind == 'i');
15643         switch (__pyx_v_kind) {
15644           case 'i':
15645           case 'u':
15646           break;
15647           case 'f':
15648           __pyx_t_2 = (((sizeof(float)) == __pyx_v_itemsize) != 0);
15649           if (__pyx_t_2) {
15650           } else {
15651             __pyx_t_3 = __pyx_t_2;
15652             goto __pyx_L16_bool_binop_done;
15653           }
15654           __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 738, __pyx_L1_error)
15655           __Pyx_GOTREF(__pyx_t_6);
15656           __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 738, __pyx_L1_error)
15657           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15658           __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
15659           __pyx_t_3 = __pyx_t_2;
15660           __pyx_L16_bool_binop_done:;
15661           if (__pyx_t_3) {
15662             if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(1, 738, __pyx_L1_error)
15663             goto __pyx_L10_break;
15664           }
15665           __pyx_t_2 = (((sizeof(double)) == __pyx_v_itemsize) != 0);
15666           if (__pyx_t_2) {
15667           } else {
15668             __pyx_t_3 = __pyx_t_2;
15669             goto __pyx_L19_bool_binop_done;
15670           }
15671           __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 738, __pyx_L1_error)
15672           __Pyx_GOTREF(__pyx_t_6);
15673           __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 738, __pyx_L1_error)
15674           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15675           __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
15676           __pyx_t_3 = __pyx_t_2;
15677           __pyx_L19_bool_binop_done:;
15678           if (__pyx_t_3) {
15679             if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_double, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(1, 738, __pyx_L1_error)
15680             goto __pyx_L10_break;
15681           }
15682           break;
15683           case 'c':
15684           break;
15685           case 'O':
15686           break;
15687           default: break;
15688         }
15689       }
15690     }
15691     __pyx_t_2 = ((__pyx_v_itemsize == -1L) != 0);
15692     if (!__pyx_t_2) {
15693     } else {
15694       __pyx_t_3 = __pyx_t_2;
15695       goto __pyx_L22_bool_binop_done;
15696     }
15697     __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(float))) != 0);
15698     __pyx_t_3 = __pyx_t_2;
15699     __pyx_L22_bool_binop_done:;
15700     if (__pyx_t_3) {
15701       __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_v_arg, 0);
15702       __pyx_v_memslice = __pyx_t_8;
15703       __pyx_t_3 = (__pyx_v_memslice.memview != 0);
15704       if (__pyx_t_3) {
15705         __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1);
15706         if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(1, 738, __pyx_L1_error)
15707         goto __pyx_L10_break;
15708       }
15709       /*else*/ {
15710         PyErr_Clear();
15711       }
15712     }
15713     __pyx_t_2 = ((__pyx_v_itemsize == -1L) != 0);
15714     if (!__pyx_t_2) {
15715     } else {
15716       __pyx_t_3 = __pyx_t_2;
15717       goto __pyx_L26_bool_binop_done;
15718     }
15719     __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(double))) != 0);
15720     __pyx_t_3 = __pyx_t_2;
15721     __pyx_L26_bool_binop_done:;
15722     if (__pyx_t_3) {
15723       __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_v_arg, 0);
15724       __pyx_v_memslice = __pyx_t_8;
15725       __pyx_t_3 = (__pyx_v_memslice.memview != 0);
15726       if (__pyx_t_3) {
15727         __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1);
15728         if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_double, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(1, 738, __pyx_L1_error)
15729         goto __pyx_L10_break;
15730       }
15731       /*else*/ {
15732         PyErr_Clear();
15733       }
15734     }
15735     if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, Py_None, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(1, 738, __pyx_L1_error)
15736     goto __pyx_L10_break;
15737   }
15738   __pyx_L10_break:;
15739   __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 738, __pyx_L1_error)
15740   __Pyx_GOTREF(__pyx_t_6);
15741   __pyx_v_candidates = ((PyObject*)__pyx_t_6);
15742   __pyx_t_6 = 0;
15743   __pyx_t_5 = 0;
15744   if (unlikely(__pyx_v_signatures == Py_None)) {
15745     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
15746     __PYX_ERR(1, 738, __pyx_L1_error)
15747   }
15748   __pyx_t_1 = __Pyx_dict_iterator(((PyObject*)__pyx_v_signatures), 1, ((PyObject *)NULL), (&__pyx_t_9), (&__pyx_t_10)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 738, __pyx_L1_error)
15749   __Pyx_GOTREF(__pyx_t_1);
15750   __Pyx_XDECREF(__pyx_t_6);
15751   __pyx_t_6 = __pyx_t_1;
15752   __pyx_t_1 = 0;
15753   while (1) {
15754     __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_9, &__pyx_t_5, &__pyx_t_1, NULL, NULL, __pyx_t_10);
15755     if (unlikely(__pyx_t_11 == 0)) break;
15756     if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(1, 738, __pyx_L1_error)
15757     __Pyx_GOTREF(__pyx_t_1);
15758     __Pyx_XDECREF_SET(__pyx_v_sig, __pyx_t_1);
15759     __pyx_t_1 = 0;
15760     __pyx_v_match_found = 0;
15761     __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_sig, __pyx_n_s_strip); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 738, __pyx_L1_error)
15762     __Pyx_GOTREF(__pyx_t_13);
15763     __pyx_t_14 = NULL;
15764     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
15765       __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_13);
15766       if (likely(__pyx_t_14)) {
15767         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
15768         __Pyx_INCREF(__pyx_t_14);
15769         __Pyx_INCREF(function);
15770         __Pyx_DECREF_SET(__pyx_t_13, function);
15771       }
15772     }
15773     __pyx_t_12 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_14, __pyx_kp_s__5) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_kp_s__5);
15774     __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
15775     if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 738, __pyx_L1_error)
15776     __Pyx_GOTREF(__pyx_t_12);
15777     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
15778     __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_split); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 738, __pyx_L1_error)
15779     __Pyx_GOTREF(__pyx_t_13);
15780     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
15781     __pyx_t_12 = NULL;
15782     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
15783       __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13);
15784       if (likely(__pyx_t_12)) {
15785         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
15786         __Pyx_INCREF(__pyx_t_12);
15787         __Pyx_INCREF(function);
15788         __Pyx_DECREF_SET(__pyx_t_13, function);
15789       }
15790     }
15791     __pyx_t_1 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_12, __pyx_kp_s__6) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_kp_s__6);
15792     __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
15793     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 738, __pyx_L1_error)
15794     __Pyx_GOTREF(__pyx_t_1);
15795     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
15796     __Pyx_XDECREF_SET(__pyx_v_src_sig, __pyx_t_1);
15797     __pyx_t_1 = 0;
15798     __pyx_t_15 = PyList_GET_SIZE(__pyx_v_dest_sig); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(1, 738, __pyx_L1_error)
15799     __pyx_t_16 = __pyx_t_15;
15800     for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
15801       __pyx_v_i = __pyx_t_17;
15802       __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_dest_sig, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 738, __pyx_L1_error)
15803       __Pyx_GOTREF(__pyx_t_1);
15804       __Pyx_XDECREF_SET(__pyx_v_dst_type, __pyx_t_1);
15805       __pyx_t_1 = 0;
15806       __pyx_t_3 = (__pyx_v_dst_type != Py_None);
15807       __pyx_t_2 = (__pyx_t_3 != 0);
15808       if (__pyx_t_2) {
15809         __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_src_sig, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 738, __pyx_L1_error)
15810         __Pyx_GOTREF(__pyx_t_1);
15811         __pyx_t_13 = PyObject_RichCompare(__pyx_t_1, __pyx_v_dst_type, Py_EQ); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 738, __pyx_L1_error)
15812         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15813         __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 738, __pyx_L1_error)
15814         __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
15815         if (__pyx_t_2) {
15816           __pyx_v_match_found = 1;
15817           goto __pyx_L34;
15818         }
15819         /*else*/ {
15820           __pyx_v_match_found = 0;
15821           goto __pyx_L32_break;
15822         }
15823         __pyx_L34:;
15824       }
15825     }
15826     __pyx_L32_break:;
15827     __pyx_t_2 = (__pyx_v_match_found != 0);
15828     if (__pyx_t_2) {
15829       __pyx_t_18 = __Pyx_PyList_Append(__pyx_v_candidates, __pyx_v_sig); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(1, 738, __pyx_L1_error)
15830     }
15831   }
15832   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15833   __pyx_t_2 = (PyList_GET_SIZE(__pyx_v_candidates) != 0);
15834   __pyx_t_3 = ((!__pyx_t_2) != 0);
15835   if (__pyx_t_3) {
15836     __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 738, __pyx_L1_error)
15837     __Pyx_GOTREF(__pyx_t_6);
15838     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
15839     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15840     __PYX_ERR(1, 738, __pyx_L1_error)
15841   }
15842   __pyx_t_9 = PyList_GET_SIZE(__pyx_v_candidates); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 738, __pyx_L1_error)
15843   __pyx_t_3 = ((__pyx_t_9 > 1) != 0);
15844   if (__pyx_t_3) {
15845     __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 738, __pyx_L1_error)
15846     __Pyx_GOTREF(__pyx_t_6);
15847     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
15848     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15849     __PYX_ERR(1, 738, __pyx_L1_error)
15850   }
15851   /*else*/ {
15852     __Pyx_XDECREF(__pyx_r);
15853     if (unlikely(__pyx_v_signatures == Py_None)) {
15854       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
15855       __PYX_ERR(1, 738, __pyx_L1_error)
15856     }
15857     __pyx_t_6 = __Pyx_GetItemInt_List(__pyx_v_candidates, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 738, __pyx_L1_error)
15858     __Pyx_GOTREF(__pyx_t_6);
15859     __pyx_t_13 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_signatures), __pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 738, __pyx_L1_error)
15860     __Pyx_GOTREF(__pyx_t_13);
15861     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15862     __pyx_r = __pyx_t_13;
15863     __pyx_t_13 = 0;
15864     goto __pyx_L0;
15865   }
15866 
15867   /* function exit code */
15868   __pyx_L1_error:;
15869   __Pyx_XDECREF(__pyx_t_1);
15870   __Pyx_XDECREF(__pyx_t_6);
15871   __Pyx_XDECREF(__pyx_t_12);
15872   __Pyx_XDECREF(__pyx_t_13);
15873   __Pyx_XDECREF(__pyx_t_14);
15874   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename);
15875   __pyx_r = NULL;
15876   __pyx_L0:;
15877   __Pyx_XDECREF(__pyx_v_dest_sig);
15878   __Pyx_XDECREF(__pyx_v_ndarray);
15879   __Pyx_XDECREF(__pyx_v_arg);
15880   __Pyx_XDECREF(__pyx_v_dtype);
15881   __Pyx_XDECREF(__pyx_v_arg_base);
15882   __Pyx_XDECREF(__pyx_v_candidates);
15883   __Pyx_XDECREF(__pyx_v_sig);
15884   __Pyx_XDECREF(__pyx_v_src_sig);
15885   __Pyx_XDECREF(__pyx_v_dst_type);
15886   __Pyx_XDECREF(__pyx_v_kwargs);
15887   __Pyx_XGIVEREF(__pyx_r);
15888   __Pyx_RefNannyFinishContext();
15889   return __pyx_r;
15890 }
15891 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_116__defaults__(CYTHON_UNUSED PyObject * __pyx_self)15892 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_116__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
15893   PyObject *__pyx_r = NULL;
15894   __Pyx_RefNannyDeclarations
15895   PyObject *__pyx_t_1 = NULL;
15896   PyObject *__pyx_t_2 = NULL;
15897   __Pyx_RefNannySetupContext("__defaults__", 0);
15898   __Pyx_XDECREF(__pyx_r);
15899   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 738, __pyx_L1_error)
15900   __Pyx_GOTREF(__pyx_t_1);
15901   __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_use_loop);
15902   __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_use_loop);
15903   PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_use_loop);
15904   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 738, __pyx_L1_error)
15905   __Pyx_GOTREF(__pyx_t_2);
15906   __Pyx_GIVEREF(__pyx_t_1);
15907   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
15908   __Pyx_INCREF(Py_None);
15909   __Pyx_GIVEREF(Py_None);
15910   PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
15911   __pyx_t_1 = 0;
15912   __pyx_r = __pyx_t_2;
15913   __pyx_t_2 = 0;
15914   goto __pyx_L0;
15915 
15916   /* function exit code */
15917   __pyx_L1_error:;
15918   __Pyx_XDECREF(__pyx_t_1);
15919   __Pyx_XDECREF(__pyx_t_2);
15920   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15921   __pyx_r = NULL;
15922   __pyx_L0:;
15923   __Pyx_XGIVEREF(__pyx_r);
15924   __Pyx_RefNannyFinishContext();
15925   return __pyx_r;
15926 }
15927 
15928 /* Python wrapper */
15929 static PyObject *__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_77morton_qsort_partition(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15930 static PyMethodDef __pyx_fuse_0__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_77morton_qsort_partition = {"__pyx_fuse_0morton_qsort_partition", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_77morton_qsort_partition, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_77morton_qsort_partition(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)15931 static PyObject *__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_77morton_qsort_partition(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15932   PyArrayObject *__pyx_v_pos = 0;
15933   __pyx_t_5numpy_int64_t __pyx_v_l;
15934   __pyx_t_5numpy_int64_t __pyx_v_h;
15935   PyArrayObject *__pyx_v_ind = 0;
15936   PyObject *__pyx_v_use_loop = 0;
15937   PyObject *__pyx_r = 0;
15938   __Pyx_RefNannyDeclarations
15939   __Pyx_RefNannySetupContext("morton_qsort_partition (wrapper)", 0);
15940   {
15941     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_l,&__pyx_n_s_h,&__pyx_n_s_ind,&__pyx_n_s_use_loop,0};
15942     PyObject* values[5] = {0,0,0,0,0};
15943     __pyx_defaults2 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self);
15944     values[4] = __pyx_dynamic_args->__pyx_arg_use_loop;
15945     if (unlikely(__pyx_kwds)) {
15946       Py_ssize_t kw_args;
15947       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15948       switch (pos_args) {
15949         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
15950         CYTHON_FALLTHROUGH;
15951         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15952         CYTHON_FALLTHROUGH;
15953         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15954         CYTHON_FALLTHROUGH;
15955         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15956         CYTHON_FALLTHROUGH;
15957         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15958         CYTHON_FALLTHROUGH;
15959         case  0: break;
15960         default: goto __pyx_L5_argtuple_error;
15961       }
15962       kw_args = PyDict_Size(__pyx_kwds);
15963       switch (pos_args) {
15964         case  0:
15965         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
15966         else goto __pyx_L5_argtuple_error;
15967         CYTHON_FALLTHROUGH;
15968         case  1:
15969         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_l)) != 0)) kw_args--;
15970         else {
15971           __Pyx_RaiseArgtupleInvalid("morton_qsort_partition", 0, 4, 5, 1); __PYX_ERR(1, 738, __pyx_L3_error)
15972         }
15973         CYTHON_FALLTHROUGH;
15974         case  2:
15975         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
15976         else {
15977           __Pyx_RaiseArgtupleInvalid("morton_qsort_partition", 0, 4, 5, 2); __PYX_ERR(1, 738, __pyx_L3_error)
15978         }
15979         CYTHON_FALLTHROUGH;
15980         case  3:
15981         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind)) != 0)) kw_args--;
15982         else {
15983           __Pyx_RaiseArgtupleInvalid("morton_qsort_partition", 0, 4, 5, 3); __PYX_ERR(1, 738, __pyx_L3_error)
15984         }
15985         CYTHON_FALLTHROUGH;
15986         case  4:
15987         if (kw_args > 0) {
15988           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_loop);
15989           if (value) { values[4] = value; kw_args--; }
15990         }
15991       }
15992       if (unlikely(kw_args > 0)) {
15993         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "morton_qsort_partition") < 0)) __PYX_ERR(1, 738, __pyx_L3_error)
15994       }
15995     } else {
15996       switch (PyTuple_GET_SIZE(__pyx_args)) {
15997         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
15998         CYTHON_FALLTHROUGH;
15999         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16000         values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16001         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16002         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16003         break;
16004         default: goto __pyx_L5_argtuple_error;
16005       }
16006     }
16007     __pyx_v_pos = ((PyArrayObject *)values[0]);
16008     __pyx_v_l = __Pyx_PyInt_As_npy_int64(values[1]); if (unlikely((__pyx_v_l == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 739, __pyx_L3_error)
16009     __pyx_v_h = __Pyx_PyInt_As_npy_int64(values[2]); if (unlikely((__pyx_v_h == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 739, __pyx_L3_error)
16010     __pyx_v_ind = ((PyArrayObject *)values[3]);
16011     __pyx_v_use_loop = values[4];
16012   }
16013   goto __pyx_L4_argument_unpacking_done;
16014   __pyx_L5_argtuple_error:;
16015   __Pyx_RaiseArgtupleInvalid("morton_qsort_partition", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 738, __pyx_L3_error)
16016   __pyx_L3_error:;
16017   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_qsort_partition", __pyx_clineno, __pyx_lineno, __pyx_filename);
16018   __Pyx_RefNannyFinishContext();
16019   return NULL;
16020   __pyx_L4_argument_unpacking_done:;
16021   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 1, "pos", 0))) __PYX_ERR(1, 738, __pyx_L1_error)
16022   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ind), __pyx_ptype_5numpy_ndarray, 1, "ind", 0))) __PYX_ERR(1, 740, __pyx_L1_error)
16023   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_76morton_qsort_partition(__pyx_self, __pyx_v_pos, __pyx_v_l, __pyx_v_h, __pyx_v_ind, __pyx_v_use_loop);
16024 
16025   /* function exit code */
16026   goto __pyx_L0;
16027   __pyx_L1_error:;
16028   __pyx_r = NULL;
16029   __pyx_L0:;
16030   __Pyx_RefNannyFinishContext();
16031   return __pyx_r;
16032 }
16033 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_76morton_qsort_partition(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_pos,__pyx_t_5numpy_int64_t __pyx_v_l,__pyx_t_5numpy_int64_t __pyx_v_h,PyArrayObject * __pyx_v_ind,PyObject * __pyx_v_use_loop)16034 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_76morton_qsort_partition(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_int64_t __pyx_v_l, __pyx_t_5numpy_int64_t __pyx_v_h, PyArrayObject *__pyx_v_ind, PyObject *__pyx_v_use_loop) {
16035   int __pyx_v_k;
16036   __pyx_t_5numpy_int64_t __pyx_v_i;
16037   __pyx_t_5numpy_int64_t __pyx_v_j;
16038   __pyx_t_5numpy_float64_t __pyx_v_ppos[3];
16039   __pyx_t_5numpy_float64_t __pyx_v_ipos[3];
16040   __pyx_t_5numpy_uint64_t __pyx_v_done;
16041   __pyx_t_5numpy_uint64_t __pyx_v_pivot;
16042   __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
16043   __Pyx_Buffer __pyx_pybuffer_ind;
16044   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos;
16045   __Pyx_Buffer __pyx_pybuffer_pos;
16046   PyObject *__pyx_r = NULL;
16047   __Pyx_RefNannyDeclarations
16048   int __pyx_t_1;
16049   int __pyx_t_2;
16050   __pyx_t_5numpy_int64_t __pyx_t_3;
16051   int __pyx_t_4;
16052   __pyx_t_5numpy_uint64_t __pyx_t_5;
16053   Py_ssize_t __pyx_t_6;
16054   __pyx_t_5numpy_int64_t __pyx_t_7;
16055   __pyx_t_5numpy_int64_t __pyx_t_8;
16056   __pyx_t_5numpy_int64_t __pyx_t_9;
16057   __pyx_t_5numpy_int64_t __pyx_t_10;
16058   __pyx_t_5numpy_uint64_t __pyx_t_11;
16059   Py_ssize_t __pyx_t_12;
16060   PyObject *__pyx_t_13 = NULL;
16061   PyObject *__pyx_t_14 = NULL;
16062   PyObject *__pyx_t_15 = NULL;
16063   PyObject *__pyx_t_16 = NULL;
16064   PyObject *__pyx_t_17 = NULL;
16065   PyObject *__pyx_t_18 = NULL;
16066   __pyx_t_5numpy_uint64_t __pyx_t_19;
16067   Py_ssize_t __pyx_t_20;
16068   __pyx_t_5numpy_uint64_t __pyx_t_21;
16069   Py_ssize_t __pyx_t_22;
16070   __pyx_t_5numpy_int64_t __pyx_t_23;
16071   __pyx_t_5numpy_int64_t __pyx_t_24;
16072   __pyx_t_5numpy_uint64_t __pyx_t_25;
16073   Py_ssize_t __pyx_t_26;
16074   __pyx_t_5numpy_int64_t __pyx_t_27;
16075   __pyx_t_5numpy_int64_t __pyx_t_28;
16076   __pyx_t_5numpy_int64_t __pyx_t_29;
16077   __Pyx_RefNannySetupContext("__pyx_fuse_0morton_qsort_partition", 0);
16078   __pyx_pybuffer_pos.pybuffer.buf = NULL;
16079   __pyx_pybuffer_pos.refcount = 0;
16080   __pyx_pybuffernd_pos.data = NULL;
16081   __pyx_pybuffernd_pos.rcbuffer = &__pyx_pybuffer_pos;
16082   __pyx_pybuffer_ind.pybuffer.buf = NULL;
16083   __pyx_pybuffer_ind.refcount = 0;
16084   __pyx_pybuffernd_ind.data = NULL;
16085   __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;
16086   {
16087     __Pyx_BufFmt_StackElem __pyx_stack[1];
16088     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_float, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(1, 738, __pyx_L1_error)
16089   }
16090   __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1];
16091   {
16092     __Pyx_BufFmt_StackElem __pyx_stack[1];
16093     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 738, __pyx_L1_error)
16094   }
16095   __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
16096 
16097   /* "yt/utilities/lib/geometry_utils.pyx":748
16098  *     cdef np.float64_t ipos[3]
16099  *     cdef np.uint64_t done, pivot
16100  *     if use_loop:             # <<<<<<<<<<<<<<
16101  *         # http://www.geeksforgeeks.org/iterative-quick-sort/
16102  *         # A bit slower
16103  */
16104   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_use_loop); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 748, __pyx_L1_error)
16105   if (__pyx_t_1) {
16106 
16107     /* "yt/utilities/lib/geometry_utils.pyx":752
16108  *         # A bit slower
16109  *         # Set starting point & pivot
16110  *         i = (l - 1)             # <<<<<<<<<<<<<<
16111  *         for k in range(3):
16112  *             ppos[k] = pos[ind[h],k]
16113  */
16114     __pyx_v_i = (__pyx_v_l - 1);
16115 
16116     /* "yt/utilities/lib/geometry_utils.pyx":753
16117  *         # Set starting point & pivot
16118  *         i = (l - 1)
16119  *         for k in range(3):             # <<<<<<<<<<<<<<
16120  *             ppos[k] = pos[ind[h],k]
16121  *         # Loop over array moving ind for points smaller than pivot to front
16122  */
16123     for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) {
16124       __pyx_v_k = __pyx_t_2;
16125 
16126       /* "yt/utilities/lib/geometry_utils.pyx":754
16127  *         i = (l - 1)
16128  *         for k in range(3):
16129  *             ppos[k] = pos[ind[h],k]             # <<<<<<<<<<<<<<
16130  *         # Loop over array moving ind for points smaller than pivot to front
16131  *         for j in range(l, h):
16132  */
16133       __pyx_t_3 = __pyx_v_h;
16134       __pyx_t_4 = -1;
16135       if (__pyx_t_3 < 0) {
16136         __pyx_t_3 += __pyx_pybuffernd_ind.diminfo[0].shape;
16137         if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0;
16138       } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_4 = 0;
16139       if (unlikely(__pyx_t_4 != -1)) {
16140         __Pyx_RaiseBufferIndexError(__pyx_t_4);
16141         __PYX_ERR(1, 754, __pyx_L1_error)
16142       }
16143       __pyx_t_5 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_ind.diminfo[0].strides));
16144       __pyx_t_6 = __pyx_v_k;
16145       __pyx_t_4 = -1;
16146       if (unlikely(__pyx_t_5 >= (size_t)__pyx_pybuffernd_pos.diminfo[0].shape)) __pyx_t_4 = 0;
16147       if (__pyx_t_6 < 0) {
16148         __pyx_t_6 += __pyx_pybuffernd_pos.diminfo[1].shape;
16149         if (unlikely(__pyx_t_6 < 0)) __pyx_t_4 = 1;
16150       } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_pos.diminfo[1].shape)) __pyx_t_4 = 1;
16151       if (unlikely(__pyx_t_4 != -1)) {
16152         __Pyx_RaiseBufferIndexError(__pyx_t_4);
16153         __PYX_ERR(1, 754, __pyx_L1_error)
16154       }
16155       (__pyx_v_ppos[__pyx_v_k]) = (*__Pyx_BufPtrStrided2d(float *, __pyx_pybuffernd_pos.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_pos.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_pos.diminfo[1].strides));
16156     }
16157 
16158     /* "yt/utilities/lib/geometry_utils.pyx":756
16159  *             ppos[k] = pos[ind[h],k]
16160  *         # Loop over array moving ind for points smaller than pivot to front
16161  *         for j in range(l, h):             # <<<<<<<<<<<<<<
16162  *             for k in range(3):
16163  *                 ipos[k] = pos[ind[j],k]
16164  */
16165     __pyx_t_7 = __pyx_v_h;
16166     __pyx_t_8 = __pyx_t_7;
16167     for (__pyx_t_9 = __pyx_v_l; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
16168       __pyx_v_j = __pyx_t_9;
16169 
16170       /* "yt/utilities/lib/geometry_utils.pyx":757
16171  *         # Loop over array moving ind for points smaller than pivot to front
16172  *         for j in range(l, h):
16173  *             for k in range(3):             # <<<<<<<<<<<<<<
16174  *                 ipos[k] = pos[ind[j],k]
16175  *             if compare_floats_morton(ipos,ppos):
16176  */
16177       for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) {
16178         __pyx_v_k = __pyx_t_2;
16179 
16180         /* "yt/utilities/lib/geometry_utils.pyx":758
16181  *         for j in range(l, h):
16182  *             for k in range(3):
16183  *                 ipos[k] = pos[ind[j],k]             # <<<<<<<<<<<<<<
16184  *             if compare_floats_morton(ipos,ppos):
16185  *                 i+=1
16186  */
16187         __pyx_t_10 = __pyx_v_j;
16188         __pyx_t_4 = -1;
16189         if (__pyx_t_10 < 0) {
16190           __pyx_t_10 += __pyx_pybuffernd_ind.diminfo[0].shape;
16191           if (unlikely(__pyx_t_10 < 0)) __pyx_t_4 = 0;
16192         } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_4 = 0;
16193         if (unlikely(__pyx_t_4 != -1)) {
16194           __Pyx_RaiseBufferIndexError(__pyx_t_4);
16195           __PYX_ERR(1, 758, __pyx_L1_error)
16196         }
16197         __pyx_t_11 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_ind.diminfo[0].strides));
16198         __pyx_t_12 = __pyx_v_k;
16199         __pyx_t_4 = -1;
16200         if (unlikely(__pyx_t_11 >= (size_t)__pyx_pybuffernd_pos.diminfo[0].shape)) __pyx_t_4 = 0;
16201         if (__pyx_t_12 < 0) {
16202           __pyx_t_12 += __pyx_pybuffernd_pos.diminfo[1].shape;
16203           if (unlikely(__pyx_t_12 < 0)) __pyx_t_4 = 1;
16204         } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_pos.diminfo[1].shape)) __pyx_t_4 = 1;
16205         if (unlikely(__pyx_t_4 != -1)) {
16206           __Pyx_RaiseBufferIndexError(__pyx_t_4);
16207           __PYX_ERR(1, 758, __pyx_L1_error)
16208         }
16209         (__pyx_v_ipos[__pyx_v_k]) = (*__Pyx_BufPtrStrided2d(float *, __pyx_pybuffernd_pos.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_pos.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_pos.diminfo[1].strides));
16210       }
16211 
16212       /* "yt/utilities/lib/geometry_utils.pyx":759
16213  *             for k in range(3):
16214  *                 ipos[k] = pos[ind[j],k]
16215  *             if compare_floats_morton(ipos,ppos):             # <<<<<<<<<<<<<<
16216  *                 i+=1
16217  *                 morton_qsort_swap(ind,i,j)
16218  */
16219       __pyx_t_1 = (__pyx_f_2yt_9utilities_3lib_14geometry_utils_compare_floats_morton(__pyx_v_ipos, __pyx_v_ppos) != 0);
16220       if (__pyx_t_1) {
16221 
16222         /* "yt/utilities/lib/geometry_utils.pyx":760
16223  *                 ipos[k] = pos[ind[j],k]
16224  *             if compare_floats_morton(ipos,ppos):
16225  *                 i+=1             # <<<<<<<<<<<<<<
16226  *                 morton_qsort_swap(ind,i,j)
16227  *         # Swap the pivot to the midpoint in the partition
16228  */
16229         __pyx_v_i = (__pyx_v_i + 1);
16230 
16231         /* "yt/utilities/lib/geometry_utils.pyx":761
16232  *             if compare_floats_morton(ipos,ppos):
16233  *                 i+=1
16234  *                 morton_qsort_swap(ind,i,j)             # <<<<<<<<<<<<<<
16235  *         # Swap the pivot to the midpoint in the partition
16236  *         i+=1
16237  */
16238         __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_morton_qsort_swap); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 761, __pyx_L1_error)
16239         __Pyx_GOTREF(__pyx_t_14);
16240         __pyx_t_15 = __Pyx_PyInt_From_npy_int64(__pyx_v_i); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 761, __pyx_L1_error)
16241         __Pyx_GOTREF(__pyx_t_15);
16242         __pyx_t_16 = __Pyx_PyInt_From_npy_int64(__pyx_v_j); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 761, __pyx_L1_error)
16243         __Pyx_GOTREF(__pyx_t_16);
16244         __pyx_t_17 = NULL;
16245         __pyx_t_2 = 0;
16246         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
16247           __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_14);
16248           if (likely(__pyx_t_17)) {
16249             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
16250             __Pyx_INCREF(__pyx_t_17);
16251             __Pyx_INCREF(function);
16252             __Pyx_DECREF_SET(__pyx_t_14, function);
16253             __pyx_t_2 = 1;
16254           }
16255         }
16256         #if CYTHON_FAST_PYCALL
16257         if (PyFunction_Check(__pyx_t_14)) {
16258           PyObject *__pyx_temp[4] = {__pyx_t_17, ((PyObject *)__pyx_v_ind), __pyx_t_15, __pyx_t_16};
16259           __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 761, __pyx_L1_error)
16260           __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
16261           __Pyx_GOTREF(__pyx_t_13);
16262           __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
16263           __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
16264         } else
16265         #endif
16266         #if CYTHON_FAST_PYCCALL
16267         if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
16268           PyObject *__pyx_temp[4] = {__pyx_t_17, ((PyObject *)__pyx_v_ind), __pyx_t_15, __pyx_t_16};
16269           __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 761, __pyx_L1_error)
16270           __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
16271           __Pyx_GOTREF(__pyx_t_13);
16272           __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
16273           __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
16274         } else
16275         #endif
16276         {
16277           __pyx_t_18 = PyTuple_New(3+__pyx_t_2); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 761, __pyx_L1_error)
16278           __Pyx_GOTREF(__pyx_t_18);
16279           if (__pyx_t_17) {
16280             __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_17); __pyx_t_17 = NULL;
16281           }
16282           __Pyx_INCREF(((PyObject *)__pyx_v_ind));
16283           __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
16284           PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_2, ((PyObject *)__pyx_v_ind));
16285           __Pyx_GIVEREF(__pyx_t_15);
16286           PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_2, __pyx_t_15);
16287           __Pyx_GIVEREF(__pyx_t_16);
16288           PyTuple_SET_ITEM(__pyx_t_18, 2+__pyx_t_2, __pyx_t_16);
16289           __pyx_t_15 = 0;
16290           __pyx_t_16 = 0;
16291           __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_18, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 761, __pyx_L1_error)
16292           __Pyx_GOTREF(__pyx_t_13);
16293           __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
16294         }
16295         __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
16296         __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
16297 
16298         /* "yt/utilities/lib/geometry_utils.pyx":759
16299  *             for k in range(3):
16300  *                 ipos[k] = pos[ind[j],k]
16301  *             if compare_floats_morton(ipos,ppos):             # <<<<<<<<<<<<<<
16302  *                 i+=1
16303  *                 morton_qsort_swap(ind,i,j)
16304  */
16305       }
16306     }
16307 
16308     /* "yt/utilities/lib/geometry_utils.pyx":763
16309  *                 morton_qsort_swap(ind,i,j)
16310  *         # Swap the pivot to the midpoint in the partition
16311  *         i+=1             # <<<<<<<<<<<<<<
16312  *         morton_qsort_swap(ind,i,h)
16313  *         return i
16314  */
16315     __pyx_v_i = (__pyx_v_i + 1);
16316 
16317     /* "yt/utilities/lib/geometry_utils.pyx":764
16318  *         # Swap the pivot to the midpoint in the partition
16319  *         i+=1
16320  *         morton_qsort_swap(ind,i,h)             # <<<<<<<<<<<<<<
16321  *         return i
16322  *     else:
16323  */
16324     __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_morton_qsort_swap); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 764, __pyx_L1_error)
16325     __Pyx_GOTREF(__pyx_t_14);
16326     __pyx_t_18 = __Pyx_PyInt_From_npy_int64(__pyx_v_i); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 764, __pyx_L1_error)
16327     __Pyx_GOTREF(__pyx_t_18);
16328     __pyx_t_16 = __Pyx_PyInt_From_npy_int64(__pyx_v_h); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 764, __pyx_L1_error)
16329     __Pyx_GOTREF(__pyx_t_16);
16330     __pyx_t_15 = NULL;
16331     __pyx_t_2 = 0;
16332     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
16333       __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
16334       if (likely(__pyx_t_15)) {
16335         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
16336         __Pyx_INCREF(__pyx_t_15);
16337         __Pyx_INCREF(function);
16338         __Pyx_DECREF_SET(__pyx_t_14, function);
16339         __pyx_t_2 = 1;
16340       }
16341     }
16342     #if CYTHON_FAST_PYCALL
16343     if (PyFunction_Check(__pyx_t_14)) {
16344       PyObject *__pyx_temp[4] = {__pyx_t_15, ((PyObject *)__pyx_v_ind), __pyx_t_18, __pyx_t_16};
16345       __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 764, __pyx_L1_error)
16346       __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
16347       __Pyx_GOTREF(__pyx_t_13);
16348       __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
16349       __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
16350     } else
16351     #endif
16352     #if CYTHON_FAST_PYCCALL
16353     if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
16354       PyObject *__pyx_temp[4] = {__pyx_t_15, ((PyObject *)__pyx_v_ind), __pyx_t_18, __pyx_t_16};
16355       __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 764, __pyx_L1_error)
16356       __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
16357       __Pyx_GOTREF(__pyx_t_13);
16358       __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
16359       __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
16360     } else
16361     #endif
16362     {
16363       __pyx_t_17 = PyTuple_New(3+__pyx_t_2); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 764, __pyx_L1_error)
16364       __Pyx_GOTREF(__pyx_t_17);
16365       if (__pyx_t_15) {
16366         __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_15); __pyx_t_15 = NULL;
16367       }
16368       __Pyx_INCREF(((PyObject *)__pyx_v_ind));
16369       __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
16370       PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_2, ((PyObject *)__pyx_v_ind));
16371       __Pyx_GIVEREF(__pyx_t_18);
16372       PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_2, __pyx_t_18);
16373       __Pyx_GIVEREF(__pyx_t_16);
16374       PyTuple_SET_ITEM(__pyx_t_17, 2+__pyx_t_2, __pyx_t_16);
16375       __pyx_t_18 = 0;
16376       __pyx_t_16 = 0;
16377       __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_17, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 764, __pyx_L1_error)
16378       __Pyx_GOTREF(__pyx_t_13);
16379       __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
16380     }
16381     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
16382     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
16383 
16384     /* "yt/utilities/lib/geometry_utils.pyx":765
16385  *         i+=1
16386  *         morton_qsort_swap(ind,i,h)
16387  *         return i             # <<<<<<<<<<<<<<
16388  *     else:
16389  *         # Set starting point & pivot
16390  */
16391     __Pyx_XDECREF(__pyx_r);
16392     __pyx_t_13 = __Pyx_PyInt_From_npy_int64(__pyx_v_i); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 765, __pyx_L1_error)
16393     __Pyx_GOTREF(__pyx_t_13);
16394     __pyx_r = __pyx_t_13;
16395     __pyx_t_13 = 0;
16396     goto __pyx_L0;
16397 
16398     /* "yt/utilities/lib/geometry_utils.pyx":748
16399  *     cdef np.float64_t ipos[3]
16400  *     cdef np.uint64_t done, pivot
16401  *     if use_loop:             # <<<<<<<<<<<<<<
16402  *         # http://www.geeksforgeeks.org/iterative-quick-sort/
16403  *         # A bit slower
16404  */
16405   }
16406 
16407   /* "yt/utilities/lib/geometry_utils.pyx":768
16408  *     else:
16409  *         # Set starting point & pivot
16410  *         i = l-1             # <<<<<<<<<<<<<<
16411  *         j = h
16412  *         done = 0
16413  */
16414   /*else*/ {
16415     __pyx_v_i = (__pyx_v_l - 1);
16416 
16417     /* "yt/utilities/lib/geometry_utils.pyx":769
16418  *         # Set starting point & pivot
16419  *         i = l-1
16420  *         j = h             # <<<<<<<<<<<<<<
16421  *         done = 0
16422  *         pivot = ind[h]
16423  */
16424     __pyx_v_j = __pyx_v_h;
16425 
16426     /* "yt/utilities/lib/geometry_utils.pyx":770
16427  *         i = l-1
16428  *         j = h
16429  *         done = 0             # <<<<<<<<<<<<<<
16430  *         pivot = ind[h]
16431  *         for k in range(3):
16432  */
16433     __pyx_v_done = 0;
16434 
16435     /* "yt/utilities/lib/geometry_utils.pyx":771
16436  *         j = h
16437  *         done = 0
16438  *         pivot = ind[h]             # <<<<<<<<<<<<<<
16439  *         for k in range(3):
16440  *             ppos[k] = pos[pivot,k]
16441  */
16442     __pyx_t_7 = __pyx_v_h;
16443     __pyx_t_2 = -1;
16444     if (__pyx_t_7 < 0) {
16445       __pyx_t_7 += __pyx_pybuffernd_ind.diminfo[0].shape;
16446       if (unlikely(__pyx_t_7 < 0)) __pyx_t_2 = 0;
16447     } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_2 = 0;
16448     if (unlikely(__pyx_t_2 != -1)) {
16449       __Pyx_RaiseBufferIndexError(__pyx_t_2);
16450       __PYX_ERR(1, 771, __pyx_L1_error)
16451     }
16452     __pyx_v_pivot = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_ind.diminfo[0].strides));
16453 
16454     /* "yt/utilities/lib/geometry_utils.pyx":772
16455  *         done = 0
16456  *         pivot = ind[h]
16457  *         for k in range(3):             # <<<<<<<<<<<<<<
16458  *             ppos[k] = pos[pivot,k]
16459  *         # Loop until entire array processed
16460  */
16461     for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) {
16462       __pyx_v_k = __pyx_t_2;
16463 
16464       /* "yt/utilities/lib/geometry_utils.pyx":773
16465  *         pivot = ind[h]
16466  *         for k in range(3):
16467  *             ppos[k] = pos[pivot,k]             # <<<<<<<<<<<<<<
16468  *         # Loop until entire array processed
16469  *         while not done:
16470  */
16471       __pyx_t_19 = __pyx_v_pivot;
16472       __pyx_t_20 = __pyx_v_k;
16473       __pyx_t_4 = -1;
16474       if (unlikely(__pyx_t_19 >= (size_t)__pyx_pybuffernd_pos.diminfo[0].shape)) __pyx_t_4 = 0;
16475       if (__pyx_t_20 < 0) {
16476         __pyx_t_20 += __pyx_pybuffernd_pos.diminfo[1].shape;
16477         if (unlikely(__pyx_t_20 < 0)) __pyx_t_4 = 1;
16478       } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_pos.diminfo[1].shape)) __pyx_t_4 = 1;
16479       if (unlikely(__pyx_t_4 != -1)) {
16480         __Pyx_RaiseBufferIndexError(__pyx_t_4);
16481         __PYX_ERR(1, 773, __pyx_L1_error)
16482       }
16483       (__pyx_v_ppos[__pyx_v_k]) = (*__Pyx_BufPtrStrided2d(float *, __pyx_pybuffernd_pos.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_pos.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_pos.diminfo[1].strides));
16484     }
16485 
16486     /* "yt/utilities/lib/geometry_utils.pyx":775
16487  *             ppos[k] = pos[pivot,k]
16488  *         # Loop until entire array processed
16489  *         while not done:             # <<<<<<<<<<<<<<
16490  *             # Process bottom
16491  *             while not done:
16492  */
16493     while (1) {
16494       __pyx_t_1 = ((!(__pyx_v_done != 0)) != 0);
16495       if (!__pyx_t_1) break;
16496 
16497       /* "yt/utilities/lib/geometry_utils.pyx":777
16498  *         while not done:
16499  *             # Process bottom
16500  *             while not done:             # <<<<<<<<<<<<<<
16501  *                 i+=1
16502  *                 if i == j:
16503  */
16504       while (1) {
16505         __pyx_t_1 = ((!(__pyx_v_done != 0)) != 0);
16506         if (!__pyx_t_1) break;
16507 
16508         /* "yt/utilities/lib/geometry_utils.pyx":778
16509  *             # Process bottom
16510  *             while not done:
16511  *                 i+=1             # <<<<<<<<<<<<<<
16512  *                 if i == j:
16513  *                     done = 1
16514  */
16515         __pyx_v_i = (__pyx_v_i + 1);
16516 
16517         /* "yt/utilities/lib/geometry_utils.pyx":779
16518  *             while not done:
16519  *                 i+=1
16520  *                 if i == j:             # <<<<<<<<<<<<<<
16521  *                     done = 1
16522  *                     break
16523  */
16524         __pyx_t_1 = ((__pyx_v_i == __pyx_v_j) != 0);
16525         if (__pyx_t_1) {
16526 
16527           /* "yt/utilities/lib/geometry_utils.pyx":780
16528  *                 i+=1
16529  *                 if i == j:
16530  *                     done = 1             # <<<<<<<<<<<<<<
16531  *                     break
16532  *                 for k in range(3):
16533  */
16534           __pyx_v_done = 1;
16535 
16536           /* "yt/utilities/lib/geometry_utils.pyx":781
16537  *                 if i == j:
16538  *                     done = 1
16539  *                     break             # <<<<<<<<<<<<<<
16540  *                 for k in range(3):
16541  *                     ipos[k] = pos[ind[i],k]
16542  */
16543           goto __pyx_L16_break;
16544 
16545           /* "yt/utilities/lib/geometry_utils.pyx":779
16546  *             while not done:
16547  *                 i+=1
16548  *                 if i == j:             # <<<<<<<<<<<<<<
16549  *                     done = 1
16550  *                     break
16551  */
16552         }
16553 
16554         /* "yt/utilities/lib/geometry_utils.pyx":782
16555  *                     done = 1
16556  *                     break
16557  *                 for k in range(3):             # <<<<<<<<<<<<<<
16558  *                     ipos[k] = pos[ind[i],k]
16559  *                 if compare_floats_morton(ppos,ipos):
16560  */
16561         for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) {
16562           __pyx_v_k = __pyx_t_2;
16563 
16564           /* "yt/utilities/lib/geometry_utils.pyx":783
16565  *                     break
16566  *                 for k in range(3):
16567  *                     ipos[k] = pos[ind[i],k]             # <<<<<<<<<<<<<<
16568  *                 if compare_floats_morton(ppos,ipos):
16569  *                     ind[j] = ind[i]
16570  */
16571           __pyx_t_8 = __pyx_v_i;
16572           __pyx_t_4 = -1;
16573           if (__pyx_t_8 < 0) {
16574             __pyx_t_8 += __pyx_pybuffernd_ind.diminfo[0].shape;
16575             if (unlikely(__pyx_t_8 < 0)) __pyx_t_4 = 0;
16576           } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_4 = 0;
16577           if (unlikely(__pyx_t_4 != -1)) {
16578             __Pyx_RaiseBufferIndexError(__pyx_t_4);
16579             __PYX_ERR(1, 783, __pyx_L1_error)
16580           }
16581           __pyx_t_21 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_ind.diminfo[0].strides));
16582           __pyx_t_22 = __pyx_v_k;
16583           __pyx_t_4 = -1;
16584           if (unlikely(__pyx_t_21 >= (size_t)__pyx_pybuffernd_pos.diminfo[0].shape)) __pyx_t_4 = 0;
16585           if (__pyx_t_22 < 0) {
16586             __pyx_t_22 += __pyx_pybuffernd_pos.diminfo[1].shape;
16587             if (unlikely(__pyx_t_22 < 0)) __pyx_t_4 = 1;
16588           } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_pos.diminfo[1].shape)) __pyx_t_4 = 1;
16589           if (unlikely(__pyx_t_4 != -1)) {
16590             __Pyx_RaiseBufferIndexError(__pyx_t_4);
16591             __PYX_ERR(1, 783, __pyx_L1_error)
16592           }
16593           (__pyx_v_ipos[__pyx_v_k]) = (*__Pyx_BufPtrStrided2d(float *, __pyx_pybuffernd_pos.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_pos.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_pos.diminfo[1].strides));
16594         }
16595 
16596         /* "yt/utilities/lib/geometry_utils.pyx":784
16597  *                 for k in range(3):
16598  *                     ipos[k] = pos[ind[i],k]
16599  *                 if compare_floats_morton(ppos,ipos):             # <<<<<<<<<<<<<<
16600  *                     ind[j] = ind[i]
16601  *                     break
16602  */
16603         __pyx_t_1 = (__pyx_f_2yt_9utilities_3lib_14geometry_utils_compare_floats_morton(__pyx_v_ppos, __pyx_v_ipos) != 0);
16604         if (__pyx_t_1) {
16605 
16606           /* "yt/utilities/lib/geometry_utils.pyx":785
16607  *                     ipos[k] = pos[ind[i],k]
16608  *                 if compare_floats_morton(ppos,ipos):
16609  *                     ind[j] = ind[i]             # <<<<<<<<<<<<<<
16610  *                     break
16611  *             # Process top
16612  */
16613           __pyx_t_9 = __pyx_v_i;
16614           __pyx_t_2 = -1;
16615           if (__pyx_t_9 < 0) {
16616             __pyx_t_9 += __pyx_pybuffernd_ind.diminfo[0].shape;
16617             if (unlikely(__pyx_t_9 < 0)) __pyx_t_2 = 0;
16618           } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_2 = 0;
16619           if (unlikely(__pyx_t_2 != -1)) {
16620             __Pyx_RaiseBufferIndexError(__pyx_t_2);
16621             __PYX_ERR(1, 785, __pyx_L1_error)
16622           }
16623           __pyx_t_23 = __pyx_v_j;
16624           __pyx_t_2 = -1;
16625           if (__pyx_t_23 < 0) {
16626             __pyx_t_23 += __pyx_pybuffernd_ind.diminfo[0].shape;
16627             if (unlikely(__pyx_t_23 < 0)) __pyx_t_2 = 0;
16628           } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_2 = 0;
16629           if (unlikely(__pyx_t_2 != -1)) {
16630             __Pyx_RaiseBufferIndexError(__pyx_t_2);
16631             __PYX_ERR(1, 785, __pyx_L1_error)
16632           }
16633           *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_ind.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_ind.diminfo[0].strides));
16634 
16635           /* "yt/utilities/lib/geometry_utils.pyx":786
16636  *                 if compare_floats_morton(ppos,ipos):
16637  *                     ind[j] = ind[i]
16638  *                     break             # <<<<<<<<<<<<<<
16639  *             # Process top
16640  *             while not done:
16641  */
16642           goto __pyx_L16_break;
16643 
16644           /* "yt/utilities/lib/geometry_utils.pyx":784
16645  *                 for k in range(3):
16646  *                     ipos[k] = pos[ind[i],k]
16647  *                 if compare_floats_morton(ppos,ipos):             # <<<<<<<<<<<<<<
16648  *                     ind[j] = ind[i]
16649  *                     break
16650  */
16651         }
16652       }
16653       __pyx_L16_break:;
16654 
16655       /* "yt/utilities/lib/geometry_utils.pyx":788
16656  *                     break
16657  *             # Process top
16658  *             while not done:             # <<<<<<<<<<<<<<
16659  *                 j-=1
16660  *                 if j == i:
16661  */
16662       while (1) {
16663         __pyx_t_1 = ((!(__pyx_v_done != 0)) != 0);
16664         if (!__pyx_t_1) break;
16665 
16666         /* "yt/utilities/lib/geometry_utils.pyx":789
16667  *             # Process top
16668  *             while not done:
16669  *                 j-=1             # <<<<<<<<<<<<<<
16670  *                 if j == i:
16671  *                     done = 1
16672  */
16673         __pyx_v_j = (__pyx_v_j - 1);
16674 
16675         /* "yt/utilities/lib/geometry_utils.pyx":790
16676  *             while not done:
16677  *                 j-=1
16678  *                 if j == i:             # <<<<<<<<<<<<<<
16679  *                     done = 1
16680  *                     break
16681  */
16682         __pyx_t_1 = ((__pyx_v_j == __pyx_v_i) != 0);
16683         if (__pyx_t_1) {
16684 
16685           /* "yt/utilities/lib/geometry_utils.pyx":791
16686  *                 j-=1
16687  *                 if j == i:
16688  *                     done = 1             # <<<<<<<<<<<<<<
16689  *                     break
16690  *                 for k in range(3):
16691  */
16692           __pyx_v_done = 1;
16693 
16694           /* "yt/utilities/lib/geometry_utils.pyx":792
16695  *                 if j == i:
16696  *                     done = 1
16697  *                     break             # <<<<<<<<<<<<<<
16698  *                 for k in range(3):
16699  *                     ipos[k] = pos[ind[j],k]
16700  */
16701           goto __pyx_L22_break;
16702 
16703           /* "yt/utilities/lib/geometry_utils.pyx":790
16704  *             while not done:
16705  *                 j-=1
16706  *                 if j == i:             # <<<<<<<<<<<<<<
16707  *                     done = 1
16708  *                     break
16709  */
16710         }
16711 
16712         /* "yt/utilities/lib/geometry_utils.pyx":793
16713  *                     done = 1
16714  *                     break
16715  *                 for k in range(3):             # <<<<<<<<<<<<<<
16716  *                     ipos[k] = pos[ind[j],k]
16717  *                 if compare_floats_morton(ipos,ppos):
16718  */
16719         for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) {
16720           __pyx_v_k = __pyx_t_2;
16721 
16722           /* "yt/utilities/lib/geometry_utils.pyx":794
16723  *                     break
16724  *                 for k in range(3):
16725  *                     ipos[k] = pos[ind[j],k]             # <<<<<<<<<<<<<<
16726  *                 if compare_floats_morton(ipos,ppos):
16727  *                     ind[i] = ind[j]
16728  */
16729           __pyx_t_24 = __pyx_v_j;
16730           __pyx_t_4 = -1;
16731           if (__pyx_t_24 < 0) {
16732             __pyx_t_24 += __pyx_pybuffernd_ind.diminfo[0].shape;
16733             if (unlikely(__pyx_t_24 < 0)) __pyx_t_4 = 0;
16734           } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_4 = 0;
16735           if (unlikely(__pyx_t_4 != -1)) {
16736             __Pyx_RaiseBufferIndexError(__pyx_t_4);
16737             __PYX_ERR(1, 794, __pyx_L1_error)
16738           }
16739           __pyx_t_25 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_ind.diminfo[0].strides));
16740           __pyx_t_26 = __pyx_v_k;
16741           __pyx_t_4 = -1;
16742           if (unlikely(__pyx_t_25 >= (size_t)__pyx_pybuffernd_pos.diminfo[0].shape)) __pyx_t_4 = 0;
16743           if (__pyx_t_26 < 0) {
16744             __pyx_t_26 += __pyx_pybuffernd_pos.diminfo[1].shape;
16745             if (unlikely(__pyx_t_26 < 0)) __pyx_t_4 = 1;
16746           } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_pos.diminfo[1].shape)) __pyx_t_4 = 1;
16747           if (unlikely(__pyx_t_4 != -1)) {
16748             __Pyx_RaiseBufferIndexError(__pyx_t_4);
16749             __PYX_ERR(1, 794, __pyx_L1_error)
16750           }
16751           (__pyx_v_ipos[__pyx_v_k]) = (*__Pyx_BufPtrStrided2d(float *, __pyx_pybuffernd_pos.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_pos.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_pos.diminfo[1].strides));
16752         }
16753 
16754         /* "yt/utilities/lib/geometry_utils.pyx":795
16755  *                 for k in range(3):
16756  *                     ipos[k] = pos[ind[j],k]
16757  *                 if compare_floats_morton(ipos,ppos):             # <<<<<<<<<<<<<<
16758  *                     ind[i] = ind[j]
16759  *                     break
16760  */
16761         __pyx_t_1 = (__pyx_f_2yt_9utilities_3lib_14geometry_utils_compare_floats_morton(__pyx_v_ipos, __pyx_v_ppos) != 0);
16762         if (__pyx_t_1) {
16763 
16764           /* "yt/utilities/lib/geometry_utils.pyx":796
16765  *                     ipos[k] = pos[ind[j],k]
16766  *                 if compare_floats_morton(ipos,ppos):
16767  *                     ind[i] = ind[j]             # <<<<<<<<<<<<<<
16768  *                     break
16769  *         ind[j] = pivot
16770  */
16771           __pyx_t_27 = __pyx_v_j;
16772           __pyx_t_2 = -1;
16773           if (__pyx_t_27 < 0) {
16774             __pyx_t_27 += __pyx_pybuffernd_ind.diminfo[0].shape;
16775             if (unlikely(__pyx_t_27 < 0)) __pyx_t_2 = 0;
16776           } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_2 = 0;
16777           if (unlikely(__pyx_t_2 != -1)) {
16778             __Pyx_RaiseBufferIndexError(__pyx_t_2);
16779             __PYX_ERR(1, 796, __pyx_L1_error)
16780           }
16781           __pyx_t_28 = __pyx_v_i;
16782           __pyx_t_2 = -1;
16783           if (__pyx_t_28 < 0) {
16784             __pyx_t_28 += __pyx_pybuffernd_ind.diminfo[0].shape;
16785             if (unlikely(__pyx_t_28 < 0)) __pyx_t_2 = 0;
16786           } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_2 = 0;
16787           if (unlikely(__pyx_t_2 != -1)) {
16788             __Pyx_RaiseBufferIndexError(__pyx_t_2);
16789             __PYX_ERR(1, 796, __pyx_L1_error)
16790           }
16791           *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_ind.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_ind.diminfo[0].strides));
16792 
16793           /* "yt/utilities/lib/geometry_utils.pyx":797
16794  *                 if compare_floats_morton(ipos,ppos):
16795  *                     ind[i] = ind[j]
16796  *                     break             # <<<<<<<<<<<<<<
16797  *         ind[j] = pivot
16798  *     return j
16799  */
16800           goto __pyx_L22_break;
16801 
16802           /* "yt/utilities/lib/geometry_utils.pyx":795
16803  *                 for k in range(3):
16804  *                     ipos[k] = pos[ind[j],k]
16805  *                 if compare_floats_morton(ipos,ppos):             # <<<<<<<<<<<<<<
16806  *                     ind[i] = ind[j]
16807  *                     break
16808  */
16809         }
16810       }
16811       __pyx_L22_break:;
16812     }
16813 
16814     /* "yt/utilities/lib/geometry_utils.pyx":798
16815  *                     ind[i] = ind[j]
16816  *                     break
16817  *         ind[j] = pivot             # <<<<<<<<<<<<<<
16818  *     return j
16819  *
16820  */
16821     __pyx_t_29 = __pyx_v_j;
16822     __pyx_t_2 = -1;
16823     if (__pyx_t_29 < 0) {
16824       __pyx_t_29 += __pyx_pybuffernd_ind.diminfo[0].shape;
16825       if (unlikely(__pyx_t_29 < 0)) __pyx_t_2 = 0;
16826     } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_2 = 0;
16827     if (unlikely(__pyx_t_2 != -1)) {
16828       __Pyx_RaiseBufferIndexError(__pyx_t_2);
16829       __PYX_ERR(1, 798, __pyx_L1_error)
16830     }
16831     *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_ind.diminfo[0].strides) = __pyx_v_pivot;
16832   }
16833 
16834   /* "yt/utilities/lib/geometry_utils.pyx":799
16835  *                     break
16836  *         ind[j] = pivot
16837  *     return j             # <<<<<<<<<<<<<<
16838  *
16839  * @cython.cdivision(True)
16840  */
16841   __Pyx_XDECREF(__pyx_r);
16842   __pyx_t_13 = __Pyx_PyInt_From_npy_int64(__pyx_v_j); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 799, __pyx_L1_error)
16843   __Pyx_GOTREF(__pyx_t_13);
16844   __pyx_r = __pyx_t_13;
16845   __pyx_t_13 = 0;
16846   goto __pyx_L0;
16847 
16848   /* "yt/utilities/lib/geometry_utils.pyx":738
16849  *     ind[b] = t
16850  *
16851  * def morton_qsort_partition(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
16852  *                            np.int64_t l, np.int64_t h,
16853  *                            np.ndarray[np.uint64_t, ndim=1] ind,
16854  */
16855 
16856   /* function exit code */
16857   __pyx_L1_error:;
16858   __Pyx_XDECREF(__pyx_t_13);
16859   __Pyx_XDECREF(__pyx_t_14);
16860   __Pyx_XDECREF(__pyx_t_15);
16861   __Pyx_XDECREF(__pyx_t_16);
16862   __Pyx_XDECREF(__pyx_t_17);
16863   __Pyx_XDECREF(__pyx_t_18);
16864   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
16865     __Pyx_PyThreadState_declare
16866     __Pyx_PyThreadState_assign
16867     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
16868     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
16869     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
16870   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
16871   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_qsort_partition", __pyx_clineno, __pyx_lineno, __pyx_filename);
16872   __pyx_r = NULL;
16873   goto __pyx_L2;
16874   __pyx_L0:;
16875   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
16876   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
16877   __pyx_L2:;
16878   __Pyx_XGIVEREF(__pyx_r);
16879   __Pyx_RefNannyFinishContext();
16880   return __pyx_r;
16881 }
16882 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_118__defaults__(CYTHON_UNUSED PyObject * __pyx_self)16883 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_118__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
16884   PyObject *__pyx_r = NULL;
16885   __Pyx_RefNannyDeclarations
16886   PyObject *__pyx_t_1 = NULL;
16887   PyObject *__pyx_t_2 = NULL;
16888   __Pyx_RefNannySetupContext("__defaults__", 0);
16889   __Pyx_XDECREF(__pyx_r);
16890   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 738, __pyx_L1_error)
16891   __Pyx_GOTREF(__pyx_t_1);
16892   __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_self)->__pyx_arg_use_loop);
16893   __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_self)->__pyx_arg_use_loop);
16894   PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_self)->__pyx_arg_use_loop);
16895   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 738, __pyx_L1_error)
16896   __Pyx_GOTREF(__pyx_t_2);
16897   __Pyx_GIVEREF(__pyx_t_1);
16898   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
16899   __Pyx_INCREF(Py_None);
16900   __Pyx_GIVEREF(Py_None);
16901   PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
16902   __pyx_t_1 = 0;
16903   __pyx_r = __pyx_t_2;
16904   __pyx_t_2 = 0;
16905   goto __pyx_L0;
16906 
16907   /* function exit code */
16908   __pyx_L1_error:;
16909   __Pyx_XDECREF(__pyx_t_1);
16910   __Pyx_XDECREF(__pyx_t_2);
16911   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16912   __pyx_r = NULL;
16913   __pyx_L0:;
16914   __Pyx_XGIVEREF(__pyx_r);
16915   __Pyx_RefNannyFinishContext();
16916   return __pyx_r;
16917 }
16918 
16919 /* Python wrapper */
16920 static PyObject *__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_79morton_qsort_partition(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
16921 static PyMethodDef __pyx_fuse_1__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_79morton_qsort_partition = {"__pyx_fuse_1morton_qsort_partition", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_79morton_qsort_partition, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_79morton_qsort_partition(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)16922 static PyObject *__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_79morton_qsort_partition(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16923   PyArrayObject *__pyx_v_pos = 0;
16924   __pyx_t_5numpy_int64_t __pyx_v_l;
16925   __pyx_t_5numpy_int64_t __pyx_v_h;
16926   PyArrayObject *__pyx_v_ind = 0;
16927   PyObject *__pyx_v_use_loop = 0;
16928   PyObject *__pyx_r = 0;
16929   __Pyx_RefNannyDeclarations
16930   __Pyx_RefNannySetupContext("morton_qsort_partition (wrapper)", 0);
16931   {
16932     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_l,&__pyx_n_s_h,&__pyx_n_s_ind,&__pyx_n_s_use_loop,0};
16933     PyObject* values[5] = {0,0,0,0,0};
16934     __pyx_defaults3 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_self);
16935     values[4] = __pyx_dynamic_args->__pyx_arg_use_loop;
16936     if (unlikely(__pyx_kwds)) {
16937       Py_ssize_t kw_args;
16938       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
16939       switch (pos_args) {
16940         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16941         CYTHON_FALLTHROUGH;
16942         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16943         CYTHON_FALLTHROUGH;
16944         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16945         CYTHON_FALLTHROUGH;
16946         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16947         CYTHON_FALLTHROUGH;
16948         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16949         CYTHON_FALLTHROUGH;
16950         case  0: break;
16951         default: goto __pyx_L5_argtuple_error;
16952       }
16953       kw_args = PyDict_Size(__pyx_kwds);
16954       switch (pos_args) {
16955         case  0:
16956         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
16957         else goto __pyx_L5_argtuple_error;
16958         CYTHON_FALLTHROUGH;
16959         case  1:
16960         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_l)) != 0)) kw_args--;
16961         else {
16962           __Pyx_RaiseArgtupleInvalid("morton_qsort_partition", 0, 4, 5, 1); __PYX_ERR(1, 738, __pyx_L3_error)
16963         }
16964         CYTHON_FALLTHROUGH;
16965         case  2:
16966         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
16967         else {
16968           __Pyx_RaiseArgtupleInvalid("morton_qsort_partition", 0, 4, 5, 2); __PYX_ERR(1, 738, __pyx_L3_error)
16969         }
16970         CYTHON_FALLTHROUGH;
16971         case  3:
16972         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind)) != 0)) kw_args--;
16973         else {
16974           __Pyx_RaiseArgtupleInvalid("morton_qsort_partition", 0, 4, 5, 3); __PYX_ERR(1, 738, __pyx_L3_error)
16975         }
16976         CYTHON_FALLTHROUGH;
16977         case  4:
16978         if (kw_args > 0) {
16979           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_loop);
16980           if (value) { values[4] = value; kw_args--; }
16981         }
16982       }
16983       if (unlikely(kw_args > 0)) {
16984         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "morton_qsort_partition") < 0)) __PYX_ERR(1, 738, __pyx_L3_error)
16985       }
16986     } else {
16987       switch (PyTuple_GET_SIZE(__pyx_args)) {
16988         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16989         CYTHON_FALLTHROUGH;
16990         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16991         values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16992         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16993         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16994         break;
16995         default: goto __pyx_L5_argtuple_error;
16996       }
16997     }
16998     __pyx_v_pos = ((PyArrayObject *)values[0]);
16999     __pyx_v_l = __Pyx_PyInt_As_npy_int64(values[1]); if (unlikely((__pyx_v_l == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 739, __pyx_L3_error)
17000     __pyx_v_h = __Pyx_PyInt_As_npy_int64(values[2]); if (unlikely((__pyx_v_h == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 739, __pyx_L3_error)
17001     __pyx_v_ind = ((PyArrayObject *)values[3]);
17002     __pyx_v_use_loop = values[4];
17003   }
17004   goto __pyx_L4_argument_unpacking_done;
17005   __pyx_L5_argtuple_error:;
17006   __Pyx_RaiseArgtupleInvalid("morton_qsort_partition", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 738, __pyx_L3_error)
17007   __pyx_L3_error:;
17008   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_qsort_partition", __pyx_clineno, __pyx_lineno, __pyx_filename);
17009   __Pyx_RefNannyFinishContext();
17010   return NULL;
17011   __pyx_L4_argument_unpacking_done:;
17012   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 1, "pos", 0))) __PYX_ERR(1, 738, __pyx_L1_error)
17013   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ind), __pyx_ptype_5numpy_ndarray, 1, "ind", 0))) __PYX_ERR(1, 740, __pyx_L1_error)
17014   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_78morton_qsort_partition(__pyx_self, __pyx_v_pos, __pyx_v_l, __pyx_v_h, __pyx_v_ind, __pyx_v_use_loop);
17015 
17016   /* function exit code */
17017   goto __pyx_L0;
17018   __pyx_L1_error:;
17019   __pyx_r = NULL;
17020   __pyx_L0:;
17021   __Pyx_RefNannyFinishContext();
17022   return __pyx_r;
17023 }
17024 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_78morton_qsort_partition(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_pos,__pyx_t_5numpy_int64_t __pyx_v_l,__pyx_t_5numpy_int64_t __pyx_v_h,PyArrayObject * __pyx_v_ind,PyObject * __pyx_v_use_loop)17025 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_78morton_qsort_partition(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_int64_t __pyx_v_l, __pyx_t_5numpy_int64_t __pyx_v_h, PyArrayObject *__pyx_v_ind, PyObject *__pyx_v_use_loop) {
17026   int __pyx_v_k;
17027   __pyx_t_5numpy_int64_t __pyx_v_i;
17028   __pyx_t_5numpy_int64_t __pyx_v_j;
17029   __pyx_t_5numpy_float64_t __pyx_v_ppos[3];
17030   __pyx_t_5numpy_float64_t __pyx_v_ipos[3];
17031   __pyx_t_5numpy_uint64_t __pyx_v_done;
17032   __pyx_t_5numpy_uint64_t __pyx_v_pivot;
17033   __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
17034   __Pyx_Buffer __pyx_pybuffer_ind;
17035   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos;
17036   __Pyx_Buffer __pyx_pybuffer_pos;
17037   PyObject *__pyx_r = NULL;
17038   __Pyx_RefNannyDeclarations
17039   int __pyx_t_1;
17040   int __pyx_t_2;
17041   __pyx_t_5numpy_int64_t __pyx_t_3;
17042   int __pyx_t_4;
17043   __pyx_t_5numpy_uint64_t __pyx_t_5;
17044   Py_ssize_t __pyx_t_6;
17045   __pyx_t_5numpy_int64_t __pyx_t_7;
17046   __pyx_t_5numpy_int64_t __pyx_t_8;
17047   __pyx_t_5numpy_int64_t __pyx_t_9;
17048   __pyx_t_5numpy_int64_t __pyx_t_10;
17049   __pyx_t_5numpy_uint64_t __pyx_t_11;
17050   Py_ssize_t __pyx_t_12;
17051   PyObject *__pyx_t_13 = NULL;
17052   PyObject *__pyx_t_14 = NULL;
17053   PyObject *__pyx_t_15 = NULL;
17054   PyObject *__pyx_t_16 = NULL;
17055   PyObject *__pyx_t_17 = NULL;
17056   PyObject *__pyx_t_18 = NULL;
17057   __pyx_t_5numpy_uint64_t __pyx_t_19;
17058   Py_ssize_t __pyx_t_20;
17059   __pyx_t_5numpy_uint64_t __pyx_t_21;
17060   Py_ssize_t __pyx_t_22;
17061   __pyx_t_5numpy_int64_t __pyx_t_23;
17062   __pyx_t_5numpy_int64_t __pyx_t_24;
17063   __pyx_t_5numpy_uint64_t __pyx_t_25;
17064   Py_ssize_t __pyx_t_26;
17065   __pyx_t_5numpy_int64_t __pyx_t_27;
17066   __pyx_t_5numpy_int64_t __pyx_t_28;
17067   __pyx_t_5numpy_int64_t __pyx_t_29;
17068   __Pyx_RefNannySetupContext("__pyx_fuse_1morton_qsort_partition", 0);
17069   __pyx_pybuffer_pos.pybuffer.buf = NULL;
17070   __pyx_pybuffer_pos.refcount = 0;
17071   __pyx_pybuffernd_pos.data = NULL;
17072   __pyx_pybuffernd_pos.rcbuffer = &__pyx_pybuffer_pos;
17073   __pyx_pybuffer_ind.pybuffer.buf = NULL;
17074   __pyx_pybuffer_ind.refcount = 0;
17075   __pyx_pybuffernd_ind.data = NULL;
17076   __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;
17077   {
17078     __Pyx_BufFmt_StackElem __pyx_stack[1];
17079     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(1, 738, __pyx_L1_error)
17080   }
17081   __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1];
17082   {
17083     __Pyx_BufFmt_StackElem __pyx_stack[1];
17084     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 738, __pyx_L1_error)
17085   }
17086   __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
17087 
17088   /* "yt/utilities/lib/geometry_utils.pyx":748
17089  *     cdef np.float64_t ipos[3]
17090  *     cdef np.uint64_t done, pivot
17091  *     if use_loop:             # <<<<<<<<<<<<<<
17092  *         # http://www.geeksforgeeks.org/iterative-quick-sort/
17093  *         # A bit slower
17094  */
17095   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_use_loop); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 748, __pyx_L1_error)
17096   if (__pyx_t_1) {
17097 
17098     /* "yt/utilities/lib/geometry_utils.pyx":752
17099  *         # A bit slower
17100  *         # Set starting point & pivot
17101  *         i = (l - 1)             # <<<<<<<<<<<<<<
17102  *         for k in range(3):
17103  *             ppos[k] = pos[ind[h],k]
17104  */
17105     __pyx_v_i = (__pyx_v_l - 1);
17106 
17107     /* "yt/utilities/lib/geometry_utils.pyx":753
17108  *         # Set starting point & pivot
17109  *         i = (l - 1)
17110  *         for k in range(3):             # <<<<<<<<<<<<<<
17111  *             ppos[k] = pos[ind[h],k]
17112  *         # Loop over array moving ind for points smaller than pivot to front
17113  */
17114     for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) {
17115       __pyx_v_k = __pyx_t_2;
17116 
17117       /* "yt/utilities/lib/geometry_utils.pyx":754
17118  *         i = (l - 1)
17119  *         for k in range(3):
17120  *             ppos[k] = pos[ind[h],k]             # <<<<<<<<<<<<<<
17121  *         # Loop over array moving ind for points smaller than pivot to front
17122  *         for j in range(l, h):
17123  */
17124       __pyx_t_3 = __pyx_v_h;
17125       __pyx_t_4 = -1;
17126       if (__pyx_t_3 < 0) {
17127         __pyx_t_3 += __pyx_pybuffernd_ind.diminfo[0].shape;
17128         if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0;
17129       } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_4 = 0;
17130       if (unlikely(__pyx_t_4 != -1)) {
17131         __Pyx_RaiseBufferIndexError(__pyx_t_4);
17132         __PYX_ERR(1, 754, __pyx_L1_error)
17133       }
17134       __pyx_t_5 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_ind.diminfo[0].strides));
17135       __pyx_t_6 = __pyx_v_k;
17136       __pyx_t_4 = -1;
17137       if (unlikely(__pyx_t_5 >= (size_t)__pyx_pybuffernd_pos.diminfo[0].shape)) __pyx_t_4 = 0;
17138       if (__pyx_t_6 < 0) {
17139         __pyx_t_6 += __pyx_pybuffernd_pos.diminfo[1].shape;
17140         if (unlikely(__pyx_t_6 < 0)) __pyx_t_4 = 1;
17141       } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_pos.diminfo[1].shape)) __pyx_t_4 = 1;
17142       if (unlikely(__pyx_t_4 != -1)) {
17143         __Pyx_RaiseBufferIndexError(__pyx_t_4);
17144         __PYX_ERR(1, 754, __pyx_L1_error)
17145       }
17146       (__pyx_v_ppos[__pyx_v_k]) = (*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pos.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_pos.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_pos.diminfo[1].strides));
17147     }
17148 
17149     /* "yt/utilities/lib/geometry_utils.pyx":756
17150  *             ppos[k] = pos[ind[h],k]
17151  *         # Loop over array moving ind for points smaller than pivot to front
17152  *         for j in range(l, h):             # <<<<<<<<<<<<<<
17153  *             for k in range(3):
17154  *                 ipos[k] = pos[ind[j],k]
17155  */
17156     __pyx_t_7 = __pyx_v_h;
17157     __pyx_t_8 = __pyx_t_7;
17158     for (__pyx_t_9 = __pyx_v_l; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
17159       __pyx_v_j = __pyx_t_9;
17160 
17161       /* "yt/utilities/lib/geometry_utils.pyx":757
17162  *         # Loop over array moving ind for points smaller than pivot to front
17163  *         for j in range(l, h):
17164  *             for k in range(3):             # <<<<<<<<<<<<<<
17165  *                 ipos[k] = pos[ind[j],k]
17166  *             if compare_floats_morton(ipos,ppos):
17167  */
17168       for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) {
17169         __pyx_v_k = __pyx_t_2;
17170 
17171         /* "yt/utilities/lib/geometry_utils.pyx":758
17172  *         for j in range(l, h):
17173  *             for k in range(3):
17174  *                 ipos[k] = pos[ind[j],k]             # <<<<<<<<<<<<<<
17175  *             if compare_floats_morton(ipos,ppos):
17176  *                 i+=1
17177  */
17178         __pyx_t_10 = __pyx_v_j;
17179         __pyx_t_4 = -1;
17180         if (__pyx_t_10 < 0) {
17181           __pyx_t_10 += __pyx_pybuffernd_ind.diminfo[0].shape;
17182           if (unlikely(__pyx_t_10 < 0)) __pyx_t_4 = 0;
17183         } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_4 = 0;
17184         if (unlikely(__pyx_t_4 != -1)) {
17185           __Pyx_RaiseBufferIndexError(__pyx_t_4);
17186           __PYX_ERR(1, 758, __pyx_L1_error)
17187         }
17188         __pyx_t_11 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_ind.diminfo[0].strides));
17189         __pyx_t_12 = __pyx_v_k;
17190         __pyx_t_4 = -1;
17191         if (unlikely(__pyx_t_11 >= (size_t)__pyx_pybuffernd_pos.diminfo[0].shape)) __pyx_t_4 = 0;
17192         if (__pyx_t_12 < 0) {
17193           __pyx_t_12 += __pyx_pybuffernd_pos.diminfo[1].shape;
17194           if (unlikely(__pyx_t_12 < 0)) __pyx_t_4 = 1;
17195         } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_pos.diminfo[1].shape)) __pyx_t_4 = 1;
17196         if (unlikely(__pyx_t_4 != -1)) {
17197           __Pyx_RaiseBufferIndexError(__pyx_t_4);
17198           __PYX_ERR(1, 758, __pyx_L1_error)
17199         }
17200         (__pyx_v_ipos[__pyx_v_k]) = (*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pos.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_pos.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_pos.diminfo[1].strides));
17201       }
17202 
17203       /* "yt/utilities/lib/geometry_utils.pyx":759
17204  *             for k in range(3):
17205  *                 ipos[k] = pos[ind[j],k]
17206  *             if compare_floats_morton(ipos,ppos):             # <<<<<<<<<<<<<<
17207  *                 i+=1
17208  *                 morton_qsort_swap(ind,i,j)
17209  */
17210       __pyx_t_1 = (__pyx_f_2yt_9utilities_3lib_14geometry_utils_compare_floats_morton(__pyx_v_ipos, __pyx_v_ppos) != 0);
17211       if (__pyx_t_1) {
17212 
17213         /* "yt/utilities/lib/geometry_utils.pyx":760
17214  *                 ipos[k] = pos[ind[j],k]
17215  *             if compare_floats_morton(ipos,ppos):
17216  *                 i+=1             # <<<<<<<<<<<<<<
17217  *                 morton_qsort_swap(ind,i,j)
17218  *         # Swap the pivot to the midpoint in the partition
17219  */
17220         __pyx_v_i = (__pyx_v_i + 1);
17221 
17222         /* "yt/utilities/lib/geometry_utils.pyx":761
17223  *             if compare_floats_morton(ipos,ppos):
17224  *                 i+=1
17225  *                 morton_qsort_swap(ind,i,j)             # <<<<<<<<<<<<<<
17226  *         # Swap the pivot to the midpoint in the partition
17227  *         i+=1
17228  */
17229         __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_morton_qsort_swap); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 761, __pyx_L1_error)
17230         __Pyx_GOTREF(__pyx_t_14);
17231         __pyx_t_15 = __Pyx_PyInt_From_npy_int64(__pyx_v_i); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 761, __pyx_L1_error)
17232         __Pyx_GOTREF(__pyx_t_15);
17233         __pyx_t_16 = __Pyx_PyInt_From_npy_int64(__pyx_v_j); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 761, __pyx_L1_error)
17234         __Pyx_GOTREF(__pyx_t_16);
17235         __pyx_t_17 = NULL;
17236         __pyx_t_2 = 0;
17237         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
17238           __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_14);
17239           if (likely(__pyx_t_17)) {
17240             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
17241             __Pyx_INCREF(__pyx_t_17);
17242             __Pyx_INCREF(function);
17243             __Pyx_DECREF_SET(__pyx_t_14, function);
17244             __pyx_t_2 = 1;
17245           }
17246         }
17247         #if CYTHON_FAST_PYCALL
17248         if (PyFunction_Check(__pyx_t_14)) {
17249           PyObject *__pyx_temp[4] = {__pyx_t_17, ((PyObject *)__pyx_v_ind), __pyx_t_15, __pyx_t_16};
17250           __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 761, __pyx_L1_error)
17251           __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
17252           __Pyx_GOTREF(__pyx_t_13);
17253           __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
17254           __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
17255         } else
17256         #endif
17257         #if CYTHON_FAST_PYCCALL
17258         if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
17259           PyObject *__pyx_temp[4] = {__pyx_t_17, ((PyObject *)__pyx_v_ind), __pyx_t_15, __pyx_t_16};
17260           __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 761, __pyx_L1_error)
17261           __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
17262           __Pyx_GOTREF(__pyx_t_13);
17263           __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
17264           __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
17265         } else
17266         #endif
17267         {
17268           __pyx_t_18 = PyTuple_New(3+__pyx_t_2); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 761, __pyx_L1_error)
17269           __Pyx_GOTREF(__pyx_t_18);
17270           if (__pyx_t_17) {
17271             __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_17); __pyx_t_17 = NULL;
17272           }
17273           __Pyx_INCREF(((PyObject *)__pyx_v_ind));
17274           __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
17275           PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_2, ((PyObject *)__pyx_v_ind));
17276           __Pyx_GIVEREF(__pyx_t_15);
17277           PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_2, __pyx_t_15);
17278           __Pyx_GIVEREF(__pyx_t_16);
17279           PyTuple_SET_ITEM(__pyx_t_18, 2+__pyx_t_2, __pyx_t_16);
17280           __pyx_t_15 = 0;
17281           __pyx_t_16 = 0;
17282           __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_18, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 761, __pyx_L1_error)
17283           __Pyx_GOTREF(__pyx_t_13);
17284           __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
17285         }
17286         __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
17287         __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
17288 
17289         /* "yt/utilities/lib/geometry_utils.pyx":759
17290  *             for k in range(3):
17291  *                 ipos[k] = pos[ind[j],k]
17292  *             if compare_floats_morton(ipos,ppos):             # <<<<<<<<<<<<<<
17293  *                 i+=1
17294  *                 morton_qsort_swap(ind,i,j)
17295  */
17296       }
17297     }
17298 
17299     /* "yt/utilities/lib/geometry_utils.pyx":763
17300  *                 morton_qsort_swap(ind,i,j)
17301  *         # Swap the pivot to the midpoint in the partition
17302  *         i+=1             # <<<<<<<<<<<<<<
17303  *         morton_qsort_swap(ind,i,h)
17304  *         return i
17305  */
17306     __pyx_v_i = (__pyx_v_i + 1);
17307 
17308     /* "yt/utilities/lib/geometry_utils.pyx":764
17309  *         # Swap the pivot to the midpoint in the partition
17310  *         i+=1
17311  *         morton_qsort_swap(ind,i,h)             # <<<<<<<<<<<<<<
17312  *         return i
17313  *     else:
17314  */
17315     __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_morton_qsort_swap); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 764, __pyx_L1_error)
17316     __Pyx_GOTREF(__pyx_t_14);
17317     __pyx_t_18 = __Pyx_PyInt_From_npy_int64(__pyx_v_i); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 764, __pyx_L1_error)
17318     __Pyx_GOTREF(__pyx_t_18);
17319     __pyx_t_16 = __Pyx_PyInt_From_npy_int64(__pyx_v_h); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 764, __pyx_L1_error)
17320     __Pyx_GOTREF(__pyx_t_16);
17321     __pyx_t_15 = NULL;
17322     __pyx_t_2 = 0;
17323     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
17324       __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
17325       if (likely(__pyx_t_15)) {
17326         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
17327         __Pyx_INCREF(__pyx_t_15);
17328         __Pyx_INCREF(function);
17329         __Pyx_DECREF_SET(__pyx_t_14, function);
17330         __pyx_t_2 = 1;
17331       }
17332     }
17333     #if CYTHON_FAST_PYCALL
17334     if (PyFunction_Check(__pyx_t_14)) {
17335       PyObject *__pyx_temp[4] = {__pyx_t_15, ((PyObject *)__pyx_v_ind), __pyx_t_18, __pyx_t_16};
17336       __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 764, __pyx_L1_error)
17337       __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
17338       __Pyx_GOTREF(__pyx_t_13);
17339       __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
17340       __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
17341     } else
17342     #endif
17343     #if CYTHON_FAST_PYCCALL
17344     if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
17345       PyObject *__pyx_temp[4] = {__pyx_t_15, ((PyObject *)__pyx_v_ind), __pyx_t_18, __pyx_t_16};
17346       __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_2, 3+__pyx_t_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 764, __pyx_L1_error)
17347       __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
17348       __Pyx_GOTREF(__pyx_t_13);
17349       __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
17350       __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
17351     } else
17352     #endif
17353     {
17354       __pyx_t_17 = PyTuple_New(3+__pyx_t_2); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 764, __pyx_L1_error)
17355       __Pyx_GOTREF(__pyx_t_17);
17356       if (__pyx_t_15) {
17357         __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_15); __pyx_t_15 = NULL;
17358       }
17359       __Pyx_INCREF(((PyObject *)__pyx_v_ind));
17360       __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
17361       PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_2, ((PyObject *)__pyx_v_ind));
17362       __Pyx_GIVEREF(__pyx_t_18);
17363       PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_2, __pyx_t_18);
17364       __Pyx_GIVEREF(__pyx_t_16);
17365       PyTuple_SET_ITEM(__pyx_t_17, 2+__pyx_t_2, __pyx_t_16);
17366       __pyx_t_18 = 0;
17367       __pyx_t_16 = 0;
17368       __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_17, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 764, __pyx_L1_error)
17369       __Pyx_GOTREF(__pyx_t_13);
17370       __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
17371     }
17372     __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
17373     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
17374 
17375     /* "yt/utilities/lib/geometry_utils.pyx":765
17376  *         i+=1
17377  *         morton_qsort_swap(ind,i,h)
17378  *         return i             # <<<<<<<<<<<<<<
17379  *     else:
17380  *         # Set starting point & pivot
17381  */
17382     __Pyx_XDECREF(__pyx_r);
17383     __pyx_t_13 = __Pyx_PyInt_From_npy_int64(__pyx_v_i); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 765, __pyx_L1_error)
17384     __Pyx_GOTREF(__pyx_t_13);
17385     __pyx_r = __pyx_t_13;
17386     __pyx_t_13 = 0;
17387     goto __pyx_L0;
17388 
17389     /* "yt/utilities/lib/geometry_utils.pyx":748
17390  *     cdef np.float64_t ipos[3]
17391  *     cdef np.uint64_t done, pivot
17392  *     if use_loop:             # <<<<<<<<<<<<<<
17393  *         # http://www.geeksforgeeks.org/iterative-quick-sort/
17394  *         # A bit slower
17395  */
17396   }
17397 
17398   /* "yt/utilities/lib/geometry_utils.pyx":768
17399  *     else:
17400  *         # Set starting point & pivot
17401  *         i = l-1             # <<<<<<<<<<<<<<
17402  *         j = h
17403  *         done = 0
17404  */
17405   /*else*/ {
17406     __pyx_v_i = (__pyx_v_l - 1);
17407 
17408     /* "yt/utilities/lib/geometry_utils.pyx":769
17409  *         # Set starting point & pivot
17410  *         i = l-1
17411  *         j = h             # <<<<<<<<<<<<<<
17412  *         done = 0
17413  *         pivot = ind[h]
17414  */
17415     __pyx_v_j = __pyx_v_h;
17416 
17417     /* "yt/utilities/lib/geometry_utils.pyx":770
17418  *         i = l-1
17419  *         j = h
17420  *         done = 0             # <<<<<<<<<<<<<<
17421  *         pivot = ind[h]
17422  *         for k in range(3):
17423  */
17424     __pyx_v_done = 0;
17425 
17426     /* "yt/utilities/lib/geometry_utils.pyx":771
17427  *         j = h
17428  *         done = 0
17429  *         pivot = ind[h]             # <<<<<<<<<<<<<<
17430  *         for k in range(3):
17431  *             ppos[k] = pos[pivot,k]
17432  */
17433     __pyx_t_7 = __pyx_v_h;
17434     __pyx_t_2 = -1;
17435     if (__pyx_t_7 < 0) {
17436       __pyx_t_7 += __pyx_pybuffernd_ind.diminfo[0].shape;
17437       if (unlikely(__pyx_t_7 < 0)) __pyx_t_2 = 0;
17438     } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_2 = 0;
17439     if (unlikely(__pyx_t_2 != -1)) {
17440       __Pyx_RaiseBufferIndexError(__pyx_t_2);
17441       __PYX_ERR(1, 771, __pyx_L1_error)
17442     }
17443     __pyx_v_pivot = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_ind.diminfo[0].strides));
17444 
17445     /* "yt/utilities/lib/geometry_utils.pyx":772
17446  *         done = 0
17447  *         pivot = ind[h]
17448  *         for k in range(3):             # <<<<<<<<<<<<<<
17449  *             ppos[k] = pos[pivot,k]
17450  *         # Loop until entire array processed
17451  */
17452     for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) {
17453       __pyx_v_k = __pyx_t_2;
17454 
17455       /* "yt/utilities/lib/geometry_utils.pyx":773
17456  *         pivot = ind[h]
17457  *         for k in range(3):
17458  *             ppos[k] = pos[pivot,k]             # <<<<<<<<<<<<<<
17459  *         # Loop until entire array processed
17460  *         while not done:
17461  */
17462       __pyx_t_19 = __pyx_v_pivot;
17463       __pyx_t_20 = __pyx_v_k;
17464       __pyx_t_4 = -1;
17465       if (unlikely(__pyx_t_19 >= (size_t)__pyx_pybuffernd_pos.diminfo[0].shape)) __pyx_t_4 = 0;
17466       if (__pyx_t_20 < 0) {
17467         __pyx_t_20 += __pyx_pybuffernd_pos.diminfo[1].shape;
17468         if (unlikely(__pyx_t_20 < 0)) __pyx_t_4 = 1;
17469       } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_pos.diminfo[1].shape)) __pyx_t_4 = 1;
17470       if (unlikely(__pyx_t_4 != -1)) {
17471         __Pyx_RaiseBufferIndexError(__pyx_t_4);
17472         __PYX_ERR(1, 773, __pyx_L1_error)
17473       }
17474       (__pyx_v_ppos[__pyx_v_k]) = (*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pos.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_pos.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_pos.diminfo[1].strides));
17475     }
17476 
17477     /* "yt/utilities/lib/geometry_utils.pyx":775
17478  *             ppos[k] = pos[pivot,k]
17479  *         # Loop until entire array processed
17480  *         while not done:             # <<<<<<<<<<<<<<
17481  *             # Process bottom
17482  *             while not done:
17483  */
17484     while (1) {
17485       __pyx_t_1 = ((!(__pyx_v_done != 0)) != 0);
17486       if (!__pyx_t_1) break;
17487 
17488       /* "yt/utilities/lib/geometry_utils.pyx":777
17489  *         while not done:
17490  *             # Process bottom
17491  *             while not done:             # <<<<<<<<<<<<<<
17492  *                 i+=1
17493  *                 if i == j:
17494  */
17495       while (1) {
17496         __pyx_t_1 = ((!(__pyx_v_done != 0)) != 0);
17497         if (!__pyx_t_1) break;
17498 
17499         /* "yt/utilities/lib/geometry_utils.pyx":778
17500  *             # Process bottom
17501  *             while not done:
17502  *                 i+=1             # <<<<<<<<<<<<<<
17503  *                 if i == j:
17504  *                     done = 1
17505  */
17506         __pyx_v_i = (__pyx_v_i + 1);
17507 
17508         /* "yt/utilities/lib/geometry_utils.pyx":779
17509  *             while not done:
17510  *                 i+=1
17511  *                 if i == j:             # <<<<<<<<<<<<<<
17512  *                     done = 1
17513  *                     break
17514  */
17515         __pyx_t_1 = ((__pyx_v_i == __pyx_v_j) != 0);
17516         if (__pyx_t_1) {
17517 
17518           /* "yt/utilities/lib/geometry_utils.pyx":780
17519  *                 i+=1
17520  *                 if i == j:
17521  *                     done = 1             # <<<<<<<<<<<<<<
17522  *                     break
17523  *                 for k in range(3):
17524  */
17525           __pyx_v_done = 1;
17526 
17527           /* "yt/utilities/lib/geometry_utils.pyx":781
17528  *                 if i == j:
17529  *                     done = 1
17530  *                     break             # <<<<<<<<<<<<<<
17531  *                 for k in range(3):
17532  *                     ipos[k] = pos[ind[i],k]
17533  */
17534           goto __pyx_L16_break;
17535 
17536           /* "yt/utilities/lib/geometry_utils.pyx":779
17537  *             while not done:
17538  *                 i+=1
17539  *                 if i == j:             # <<<<<<<<<<<<<<
17540  *                     done = 1
17541  *                     break
17542  */
17543         }
17544 
17545         /* "yt/utilities/lib/geometry_utils.pyx":782
17546  *                     done = 1
17547  *                     break
17548  *                 for k in range(3):             # <<<<<<<<<<<<<<
17549  *                     ipos[k] = pos[ind[i],k]
17550  *                 if compare_floats_morton(ppos,ipos):
17551  */
17552         for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) {
17553           __pyx_v_k = __pyx_t_2;
17554 
17555           /* "yt/utilities/lib/geometry_utils.pyx":783
17556  *                     break
17557  *                 for k in range(3):
17558  *                     ipos[k] = pos[ind[i],k]             # <<<<<<<<<<<<<<
17559  *                 if compare_floats_morton(ppos,ipos):
17560  *                     ind[j] = ind[i]
17561  */
17562           __pyx_t_8 = __pyx_v_i;
17563           __pyx_t_4 = -1;
17564           if (__pyx_t_8 < 0) {
17565             __pyx_t_8 += __pyx_pybuffernd_ind.diminfo[0].shape;
17566             if (unlikely(__pyx_t_8 < 0)) __pyx_t_4 = 0;
17567           } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_4 = 0;
17568           if (unlikely(__pyx_t_4 != -1)) {
17569             __Pyx_RaiseBufferIndexError(__pyx_t_4);
17570             __PYX_ERR(1, 783, __pyx_L1_error)
17571           }
17572           __pyx_t_21 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_ind.diminfo[0].strides));
17573           __pyx_t_22 = __pyx_v_k;
17574           __pyx_t_4 = -1;
17575           if (unlikely(__pyx_t_21 >= (size_t)__pyx_pybuffernd_pos.diminfo[0].shape)) __pyx_t_4 = 0;
17576           if (__pyx_t_22 < 0) {
17577             __pyx_t_22 += __pyx_pybuffernd_pos.diminfo[1].shape;
17578             if (unlikely(__pyx_t_22 < 0)) __pyx_t_4 = 1;
17579           } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_pos.diminfo[1].shape)) __pyx_t_4 = 1;
17580           if (unlikely(__pyx_t_4 != -1)) {
17581             __Pyx_RaiseBufferIndexError(__pyx_t_4);
17582             __PYX_ERR(1, 783, __pyx_L1_error)
17583           }
17584           (__pyx_v_ipos[__pyx_v_k]) = (*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pos.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_pos.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_pos.diminfo[1].strides));
17585         }
17586 
17587         /* "yt/utilities/lib/geometry_utils.pyx":784
17588  *                 for k in range(3):
17589  *                     ipos[k] = pos[ind[i],k]
17590  *                 if compare_floats_morton(ppos,ipos):             # <<<<<<<<<<<<<<
17591  *                     ind[j] = ind[i]
17592  *                     break
17593  */
17594         __pyx_t_1 = (__pyx_f_2yt_9utilities_3lib_14geometry_utils_compare_floats_morton(__pyx_v_ppos, __pyx_v_ipos) != 0);
17595         if (__pyx_t_1) {
17596 
17597           /* "yt/utilities/lib/geometry_utils.pyx":785
17598  *                     ipos[k] = pos[ind[i],k]
17599  *                 if compare_floats_morton(ppos,ipos):
17600  *                     ind[j] = ind[i]             # <<<<<<<<<<<<<<
17601  *                     break
17602  *             # Process top
17603  */
17604           __pyx_t_9 = __pyx_v_i;
17605           __pyx_t_2 = -1;
17606           if (__pyx_t_9 < 0) {
17607             __pyx_t_9 += __pyx_pybuffernd_ind.diminfo[0].shape;
17608             if (unlikely(__pyx_t_9 < 0)) __pyx_t_2 = 0;
17609           } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_2 = 0;
17610           if (unlikely(__pyx_t_2 != -1)) {
17611             __Pyx_RaiseBufferIndexError(__pyx_t_2);
17612             __PYX_ERR(1, 785, __pyx_L1_error)
17613           }
17614           __pyx_t_23 = __pyx_v_j;
17615           __pyx_t_2 = -1;
17616           if (__pyx_t_23 < 0) {
17617             __pyx_t_23 += __pyx_pybuffernd_ind.diminfo[0].shape;
17618             if (unlikely(__pyx_t_23 < 0)) __pyx_t_2 = 0;
17619           } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_2 = 0;
17620           if (unlikely(__pyx_t_2 != -1)) {
17621             __Pyx_RaiseBufferIndexError(__pyx_t_2);
17622             __PYX_ERR(1, 785, __pyx_L1_error)
17623           }
17624           *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_ind.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_ind.diminfo[0].strides));
17625 
17626           /* "yt/utilities/lib/geometry_utils.pyx":786
17627  *                 if compare_floats_morton(ppos,ipos):
17628  *                     ind[j] = ind[i]
17629  *                     break             # <<<<<<<<<<<<<<
17630  *             # Process top
17631  *             while not done:
17632  */
17633           goto __pyx_L16_break;
17634 
17635           /* "yt/utilities/lib/geometry_utils.pyx":784
17636  *                 for k in range(3):
17637  *                     ipos[k] = pos[ind[i],k]
17638  *                 if compare_floats_morton(ppos,ipos):             # <<<<<<<<<<<<<<
17639  *                     ind[j] = ind[i]
17640  *                     break
17641  */
17642         }
17643       }
17644       __pyx_L16_break:;
17645 
17646       /* "yt/utilities/lib/geometry_utils.pyx":788
17647  *                     break
17648  *             # Process top
17649  *             while not done:             # <<<<<<<<<<<<<<
17650  *                 j-=1
17651  *                 if j == i:
17652  */
17653       while (1) {
17654         __pyx_t_1 = ((!(__pyx_v_done != 0)) != 0);
17655         if (!__pyx_t_1) break;
17656 
17657         /* "yt/utilities/lib/geometry_utils.pyx":789
17658  *             # Process top
17659  *             while not done:
17660  *                 j-=1             # <<<<<<<<<<<<<<
17661  *                 if j == i:
17662  *                     done = 1
17663  */
17664         __pyx_v_j = (__pyx_v_j - 1);
17665 
17666         /* "yt/utilities/lib/geometry_utils.pyx":790
17667  *             while not done:
17668  *                 j-=1
17669  *                 if j == i:             # <<<<<<<<<<<<<<
17670  *                     done = 1
17671  *                     break
17672  */
17673         __pyx_t_1 = ((__pyx_v_j == __pyx_v_i) != 0);
17674         if (__pyx_t_1) {
17675 
17676           /* "yt/utilities/lib/geometry_utils.pyx":791
17677  *                 j-=1
17678  *                 if j == i:
17679  *                     done = 1             # <<<<<<<<<<<<<<
17680  *                     break
17681  *                 for k in range(3):
17682  */
17683           __pyx_v_done = 1;
17684 
17685           /* "yt/utilities/lib/geometry_utils.pyx":792
17686  *                 if j == i:
17687  *                     done = 1
17688  *                     break             # <<<<<<<<<<<<<<
17689  *                 for k in range(3):
17690  *                     ipos[k] = pos[ind[j],k]
17691  */
17692           goto __pyx_L22_break;
17693 
17694           /* "yt/utilities/lib/geometry_utils.pyx":790
17695  *             while not done:
17696  *                 j-=1
17697  *                 if j == i:             # <<<<<<<<<<<<<<
17698  *                     done = 1
17699  *                     break
17700  */
17701         }
17702 
17703         /* "yt/utilities/lib/geometry_utils.pyx":793
17704  *                     done = 1
17705  *                     break
17706  *                 for k in range(3):             # <<<<<<<<<<<<<<
17707  *                     ipos[k] = pos[ind[j],k]
17708  *                 if compare_floats_morton(ipos,ppos):
17709  */
17710         for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) {
17711           __pyx_v_k = __pyx_t_2;
17712 
17713           /* "yt/utilities/lib/geometry_utils.pyx":794
17714  *                     break
17715  *                 for k in range(3):
17716  *                     ipos[k] = pos[ind[j],k]             # <<<<<<<<<<<<<<
17717  *                 if compare_floats_morton(ipos,ppos):
17718  *                     ind[i] = ind[j]
17719  */
17720           __pyx_t_24 = __pyx_v_j;
17721           __pyx_t_4 = -1;
17722           if (__pyx_t_24 < 0) {
17723             __pyx_t_24 += __pyx_pybuffernd_ind.diminfo[0].shape;
17724             if (unlikely(__pyx_t_24 < 0)) __pyx_t_4 = 0;
17725           } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_4 = 0;
17726           if (unlikely(__pyx_t_4 != -1)) {
17727             __Pyx_RaiseBufferIndexError(__pyx_t_4);
17728             __PYX_ERR(1, 794, __pyx_L1_error)
17729           }
17730           __pyx_t_25 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_ind.diminfo[0].strides));
17731           __pyx_t_26 = __pyx_v_k;
17732           __pyx_t_4 = -1;
17733           if (unlikely(__pyx_t_25 >= (size_t)__pyx_pybuffernd_pos.diminfo[0].shape)) __pyx_t_4 = 0;
17734           if (__pyx_t_26 < 0) {
17735             __pyx_t_26 += __pyx_pybuffernd_pos.diminfo[1].shape;
17736             if (unlikely(__pyx_t_26 < 0)) __pyx_t_4 = 1;
17737           } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_pos.diminfo[1].shape)) __pyx_t_4 = 1;
17738           if (unlikely(__pyx_t_4 != -1)) {
17739             __Pyx_RaiseBufferIndexError(__pyx_t_4);
17740             __PYX_ERR(1, 794, __pyx_L1_error)
17741           }
17742           (__pyx_v_ipos[__pyx_v_k]) = (*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pos.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_pos.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_pos.diminfo[1].strides));
17743         }
17744 
17745         /* "yt/utilities/lib/geometry_utils.pyx":795
17746  *                 for k in range(3):
17747  *                     ipos[k] = pos[ind[j],k]
17748  *                 if compare_floats_morton(ipos,ppos):             # <<<<<<<<<<<<<<
17749  *                     ind[i] = ind[j]
17750  *                     break
17751  */
17752         __pyx_t_1 = (__pyx_f_2yt_9utilities_3lib_14geometry_utils_compare_floats_morton(__pyx_v_ipos, __pyx_v_ppos) != 0);
17753         if (__pyx_t_1) {
17754 
17755           /* "yt/utilities/lib/geometry_utils.pyx":796
17756  *                     ipos[k] = pos[ind[j],k]
17757  *                 if compare_floats_morton(ipos,ppos):
17758  *                     ind[i] = ind[j]             # <<<<<<<<<<<<<<
17759  *                     break
17760  *         ind[j] = pivot
17761  */
17762           __pyx_t_27 = __pyx_v_j;
17763           __pyx_t_2 = -1;
17764           if (__pyx_t_27 < 0) {
17765             __pyx_t_27 += __pyx_pybuffernd_ind.diminfo[0].shape;
17766             if (unlikely(__pyx_t_27 < 0)) __pyx_t_2 = 0;
17767           } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_2 = 0;
17768           if (unlikely(__pyx_t_2 != -1)) {
17769             __Pyx_RaiseBufferIndexError(__pyx_t_2);
17770             __PYX_ERR(1, 796, __pyx_L1_error)
17771           }
17772           __pyx_t_28 = __pyx_v_i;
17773           __pyx_t_2 = -1;
17774           if (__pyx_t_28 < 0) {
17775             __pyx_t_28 += __pyx_pybuffernd_ind.diminfo[0].shape;
17776             if (unlikely(__pyx_t_28 < 0)) __pyx_t_2 = 0;
17777           } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_2 = 0;
17778           if (unlikely(__pyx_t_2 != -1)) {
17779             __Pyx_RaiseBufferIndexError(__pyx_t_2);
17780             __PYX_ERR(1, 796, __pyx_L1_error)
17781           }
17782           *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_ind.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_ind.diminfo[0].strides));
17783 
17784           /* "yt/utilities/lib/geometry_utils.pyx":797
17785  *                 if compare_floats_morton(ipos,ppos):
17786  *                     ind[i] = ind[j]
17787  *                     break             # <<<<<<<<<<<<<<
17788  *         ind[j] = pivot
17789  *     return j
17790  */
17791           goto __pyx_L22_break;
17792 
17793           /* "yt/utilities/lib/geometry_utils.pyx":795
17794  *                 for k in range(3):
17795  *                     ipos[k] = pos[ind[j],k]
17796  *                 if compare_floats_morton(ipos,ppos):             # <<<<<<<<<<<<<<
17797  *                     ind[i] = ind[j]
17798  *                     break
17799  */
17800         }
17801       }
17802       __pyx_L22_break:;
17803     }
17804 
17805     /* "yt/utilities/lib/geometry_utils.pyx":798
17806  *                     ind[i] = ind[j]
17807  *                     break
17808  *         ind[j] = pivot             # <<<<<<<<<<<<<<
17809  *     return j
17810  *
17811  */
17812     __pyx_t_29 = __pyx_v_j;
17813     __pyx_t_2 = -1;
17814     if (__pyx_t_29 < 0) {
17815       __pyx_t_29 += __pyx_pybuffernd_ind.diminfo[0].shape;
17816       if (unlikely(__pyx_t_29 < 0)) __pyx_t_2 = 0;
17817     } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_ind.diminfo[0].shape)) __pyx_t_2 = 0;
17818     if (unlikely(__pyx_t_2 != -1)) {
17819       __Pyx_RaiseBufferIndexError(__pyx_t_2);
17820       __PYX_ERR(1, 798, __pyx_L1_error)
17821     }
17822     *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_ind.diminfo[0].strides) = __pyx_v_pivot;
17823   }
17824 
17825   /* "yt/utilities/lib/geometry_utils.pyx":799
17826  *                     break
17827  *         ind[j] = pivot
17828  *     return j             # <<<<<<<<<<<<<<
17829  *
17830  * @cython.cdivision(True)
17831  */
17832   __Pyx_XDECREF(__pyx_r);
17833   __pyx_t_13 = __Pyx_PyInt_From_npy_int64(__pyx_v_j); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 799, __pyx_L1_error)
17834   __Pyx_GOTREF(__pyx_t_13);
17835   __pyx_r = __pyx_t_13;
17836   __pyx_t_13 = 0;
17837   goto __pyx_L0;
17838 
17839   /* "yt/utilities/lib/geometry_utils.pyx":738
17840  *     ind[b] = t
17841  *
17842  * def morton_qsort_partition(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
17843  *                            np.int64_t l, np.int64_t h,
17844  *                            np.ndarray[np.uint64_t, ndim=1] ind,
17845  */
17846 
17847   /* function exit code */
17848   __pyx_L1_error:;
17849   __Pyx_XDECREF(__pyx_t_13);
17850   __Pyx_XDECREF(__pyx_t_14);
17851   __Pyx_XDECREF(__pyx_t_15);
17852   __Pyx_XDECREF(__pyx_t_16);
17853   __Pyx_XDECREF(__pyx_t_17);
17854   __Pyx_XDECREF(__pyx_t_18);
17855   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
17856     __Pyx_PyThreadState_declare
17857     __Pyx_PyThreadState_assign
17858     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
17859     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
17860     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
17861   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
17862   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_qsort_partition", __pyx_clineno, __pyx_lineno, __pyx_filename);
17863   __pyx_r = NULL;
17864   goto __pyx_L2;
17865   __pyx_L0:;
17866   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
17867   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
17868   __pyx_L2:;
17869   __Pyx_XGIVEREF(__pyx_r);
17870   __Pyx_RefNannyFinishContext();
17871   return __pyx_r;
17872 }
17873 
17874 /* "yt/utilities/lib/geometry_utils.pyx":804
17875  * @cython.boundscheck(False)
17876  * @cython.wraparound(False)
17877  * def morton_qsort_recursive(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
17878  *                            np.int64_t l, np.int64_t h,
17879  *                            np.ndarray[np.uint64_t, ndim=1] ind,
17880  */
17881 
17882 /* Python wrapper */
17883 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_49morton_qsort_recursive(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
17884 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_49morton_qsort_recursive = {"morton_qsort_recursive", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_49morton_qsort_recursive, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_49morton_qsort_recursive(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)17885 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_49morton_qsort_recursive(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
17886   PyObject *__pyx_v_signatures = 0;
17887   PyObject *__pyx_v_args = 0;
17888   PyObject *__pyx_v_kwargs = 0;
17889   CYTHON_UNUSED PyObject *__pyx_v_defaults = 0;
17890   PyObject *__pyx_r = 0;
17891   __Pyx_RefNannyDeclarations
17892   __Pyx_RefNannySetupContext("__pyx_fused_cpdef (wrapper)", 0);
17893   {
17894     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_signatures,&__pyx_n_s_args,&__pyx_n_s_kwargs,&__pyx_n_s_defaults,0};
17895     PyObject* values[4] = {0,0,0,0};
17896     if (unlikely(__pyx_kwds)) {
17897       Py_ssize_t kw_args;
17898       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
17899       switch (pos_args) {
17900         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
17901         CYTHON_FALLTHROUGH;
17902         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17903         CYTHON_FALLTHROUGH;
17904         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17905         CYTHON_FALLTHROUGH;
17906         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17907         CYTHON_FALLTHROUGH;
17908         case  0: break;
17909         default: goto __pyx_L5_argtuple_error;
17910       }
17911       kw_args = PyDict_Size(__pyx_kwds);
17912       switch (pos_args) {
17913         case  0:
17914         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_signatures)) != 0)) kw_args--;
17915         else goto __pyx_L5_argtuple_error;
17916         CYTHON_FALLTHROUGH;
17917         case  1:
17918         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--;
17919         else {
17920           __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 1); __PYX_ERR(1, 804, __pyx_L3_error)
17921         }
17922         CYTHON_FALLTHROUGH;
17923         case  2:
17924         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--;
17925         else {
17926           __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 2); __PYX_ERR(1, 804, __pyx_L3_error)
17927         }
17928         CYTHON_FALLTHROUGH;
17929         case  3:
17930         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_defaults)) != 0)) kw_args--;
17931         else {
17932           __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 3); __PYX_ERR(1, 804, __pyx_L3_error)
17933         }
17934       }
17935       if (unlikely(kw_args > 0)) {
17936         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fused_cpdef") < 0)) __PYX_ERR(1, 804, __pyx_L3_error)
17937       }
17938     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
17939       goto __pyx_L5_argtuple_error;
17940     } else {
17941       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17942       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17943       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17944       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
17945     }
17946     __pyx_v_signatures = values[0];
17947     __pyx_v_args = values[1];
17948     __pyx_v_kwargs = values[2];
17949     __pyx_v_defaults = values[3];
17950   }
17951   goto __pyx_L4_argument_unpacking_done;
17952   __pyx_L5_argtuple_error:;
17953   __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 804, __pyx_L3_error)
17954   __pyx_L3_error:;
17955   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename);
17956   __Pyx_RefNannyFinishContext();
17957   return NULL;
17958   __pyx_L4_argument_unpacking_done:;
17959   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_48morton_qsort_recursive(__pyx_self, __pyx_v_signatures, __pyx_v_args, __pyx_v_kwargs, __pyx_v_defaults);
17960 
17961   /* function exit code */
17962   __Pyx_RefNannyFinishContext();
17963   return __pyx_r;
17964 }
17965 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_48morton_qsort_recursive(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_signatures,PyObject * __pyx_v_args,PyObject * __pyx_v_kwargs,CYTHON_UNUSED PyObject * __pyx_v_defaults)17966 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_48morton_qsort_recursive(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults) {
17967   PyObject *__pyx_v_dest_sig = NULL;
17968   Py_ssize_t __pyx_v_i;
17969   PyTypeObject *__pyx_v_ndarray = 0;
17970   __Pyx_memviewslice __pyx_v_memslice;
17971   Py_ssize_t __pyx_v_itemsize;
17972   CYTHON_UNUSED int __pyx_v_dtype_signed;
17973   char __pyx_v_kind;
17974   PyObject *__pyx_v_arg = NULL;
17975   PyObject *__pyx_v_dtype = NULL;
17976   PyObject *__pyx_v_arg_base = NULL;
17977   PyObject *__pyx_v_candidates = NULL;
17978   PyObject *__pyx_v_sig = NULL;
17979   int __pyx_v_match_found;
17980   PyObject *__pyx_v_src_sig = NULL;
17981   PyObject *__pyx_v_dst_type = NULL;
17982   PyObject *__pyx_r = NULL;
17983   __Pyx_RefNannyDeclarations
17984   PyObject *__pyx_t_1 = NULL;
17985   int __pyx_t_2;
17986   int __pyx_t_3;
17987   int __pyx_t_4;
17988   Py_ssize_t __pyx_t_5;
17989   PyObject *__pyx_t_6 = NULL;
17990   long __pyx_t_7;
17991   __Pyx_memviewslice __pyx_t_8;
17992   Py_ssize_t __pyx_t_9;
17993   int __pyx_t_10;
17994   int __pyx_t_11;
17995   PyObject *__pyx_t_12 = NULL;
17996   PyObject *__pyx_t_13 = NULL;
17997   PyObject *__pyx_t_14 = NULL;
17998   Py_ssize_t __pyx_t_15;
17999   Py_ssize_t __pyx_t_16;
18000   Py_ssize_t __pyx_t_17;
18001   int __pyx_t_18;
18002   __Pyx_RefNannySetupContext("morton_qsort_recursive", 0);
18003   __Pyx_INCREF(__pyx_v_kwargs);
18004   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 804, __pyx_L1_error)
18005   __Pyx_GOTREF(__pyx_t_1);
18006   __Pyx_INCREF(Py_None);
18007   __Pyx_GIVEREF(Py_None);
18008   PyList_SET_ITEM(__pyx_t_1, 0, Py_None);
18009   __pyx_v_dest_sig = ((PyObject*)__pyx_t_1);
18010   __pyx_t_1 = 0;
18011   __pyx_t_3 = (__pyx_v_kwargs != Py_None);
18012   __pyx_t_4 = (__pyx_t_3 != 0);
18013   if (__pyx_t_4) {
18014   } else {
18015     __pyx_t_2 = __pyx_t_4;
18016     goto __pyx_L4_bool_binop_done;
18017   }
18018   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_kwargs); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 804, __pyx_L1_error)
18019   __pyx_t_3 = ((!__pyx_t_4) != 0);
18020   __pyx_t_2 = __pyx_t_3;
18021   __pyx_L4_bool_binop_done:;
18022   if (__pyx_t_2) {
18023     __Pyx_INCREF(Py_None);
18024     __Pyx_DECREF_SET(__pyx_v_kwargs, Py_None);
18025   }
18026   __pyx_t_1 = ((PyObject *)__Pyx_ImportNumPyArrayTypeIfAvailable()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 804, __pyx_L1_error)
18027   __Pyx_GOTREF(__pyx_t_1);
18028   __pyx_v_ndarray = ((PyTypeObject*)__pyx_t_1);
18029   __pyx_t_1 = 0;
18030   __pyx_v_itemsize = -1L;
18031   if (unlikely(__pyx_v_args == Py_None)) {
18032     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
18033     __PYX_ERR(1, 804, __pyx_L1_error)
18034   }
18035   __pyx_t_5 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 804, __pyx_L1_error)
18036   __pyx_t_2 = ((0 < __pyx_t_5) != 0);
18037   if (__pyx_t_2) {
18038     if (unlikely(__pyx_v_args == Py_None)) {
18039       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
18040       __PYX_ERR(1, 804, __pyx_L1_error)
18041     }
18042     __pyx_t_1 = PyTuple_GET_ITEM(((PyObject*)__pyx_v_args), 0);
18043     __Pyx_INCREF(__pyx_t_1);
18044     __pyx_v_arg = __pyx_t_1;
18045     __pyx_t_1 = 0;
18046     goto __pyx_L6;
18047   }
18048   __pyx_t_3 = (__pyx_v_kwargs != Py_None);
18049   __pyx_t_4 = (__pyx_t_3 != 0);
18050   if (__pyx_t_4) {
18051   } else {
18052     __pyx_t_2 = __pyx_t_4;
18053     goto __pyx_L7_bool_binop_done;
18054   }
18055   if (unlikely(__pyx_v_kwargs == Py_None)) {
18056     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
18057     __PYX_ERR(1, 804, __pyx_L1_error)
18058   }
18059   __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_pos, ((PyObject*)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 804, __pyx_L1_error)
18060   __pyx_t_3 = (__pyx_t_4 != 0);
18061   __pyx_t_2 = __pyx_t_3;
18062   __pyx_L7_bool_binop_done:;
18063   if (__pyx_t_2) {
18064     if (unlikely(__pyx_v_kwargs == Py_None)) {
18065       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
18066       __PYX_ERR(1, 804, __pyx_L1_error)
18067     }
18068     __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_kwargs), __pyx_n_s_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 804, __pyx_L1_error)
18069     __Pyx_GOTREF(__pyx_t_1);
18070     __pyx_v_arg = __pyx_t_1;
18071     __pyx_t_1 = 0;
18072     goto __pyx_L6;
18073   }
18074   /*else*/ {
18075     if (unlikely(__pyx_v_args == Py_None)) {
18076       PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
18077       __PYX_ERR(1, 804, __pyx_L1_error)
18078     }
18079     __pyx_t_5 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 804, __pyx_L1_error)
18080     __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 804, __pyx_L1_error)
18081     __Pyx_GOTREF(__pyx_t_1);
18082     __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 804, __pyx_L1_error)
18083     __Pyx_GOTREF(__pyx_t_6);
18084     __Pyx_INCREF(__pyx_int_4);
18085     __Pyx_GIVEREF(__pyx_int_4);
18086     PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_4);
18087     __Pyx_INCREF(__pyx_n_s_s);
18088     __Pyx_GIVEREF(__pyx_n_s_s);
18089     PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_n_s_s);
18090     __Pyx_GIVEREF(__pyx_t_1);
18091     PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1);
18092     __pyx_t_1 = 0;
18093     __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Expected_at_least_d_argument_s_g, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 804, __pyx_L1_error)
18094     __Pyx_GOTREF(__pyx_t_1);
18095     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
18096     __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 804, __pyx_L1_error)
18097     __Pyx_GOTREF(__pyx_t_6);
18098     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18099     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
18100     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
18101     __PYX_ERR(1, 804, __pyx_L1_error)
18102   }
18103   __pyx_L6:;
18104   while (1) {
18105     __pyx_t_2 = (__pyx_v_ndarray != ((PyTypeObject*)Py_None));
18106     __pyx_t_3 = (__pyx_t_2 != 0);
18107     if (__pyx_t_3) {
18108       __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_arg, __pyx_v_ndarray);
18109       __pyx_t_2 = (__pyx_t_3 != 0);
18110       if (__pyx_t_2) {
18111         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 804, __pyx_L1_error)
18112         __Pyx_GOTREF(__pyx_t_6);
18113         __pyx_v_dtype = __pyx_t_6;
18114         __pyx_t_6 = 0;
18115         goto __pyx_L12;
18116       }
18117       __pyx_t_2 = __pyx_memoryview_check(__pyx_v_arg);
18118       __pyx_t_3 = (__pyx_t_2 != 0);
18119       if (__pyx_t_3) {
18120         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_base); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 804, __pyx_L1_error)
18121         __Pyx_GOTREF(__pyx_t_6);
18122         __pyx_v_arg_base = __pyx_t_6;
18123         __pyx_t_6 = 0;
18124         __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_arg_base, __pyx_v_ndarray);
18125         __pyx_t_2 = (__pyx_t_3 != 0);
18126         if (__pyx_t_2) {
18127           __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg_base, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 804, __pyx_L1_error)
18128           __Pyx_GOTREF(__pyx_t_6);
18129           __pyx_v_dtype = __pyx_t_6;
18130           __pyx_t_6 = 0;
18131           goto __pyx_L13;
18132         }
18133         /*else*/ {
18134           __Pyx_INCREF(Py_None);
18135           __pyx_v_dtype = Py_None;
18136         }
18137         __pyx_L13:;
18138         goto __pyx_L12;
18139       }
18140       /*else*/ {
18141         __Pyx_INCREF(Py_None);
18142         __pyx_v_dtype = Py_None;
18143       }
18144       __pyx_L12:;
18145       __pyx_v_itemsize = -1L;
18146       __pyx_t_2 = (__pyx_v_dtype != Py_None);
18147       __pyx_t_3 = (__pyx_t_2 != 0);
18148       if (__pyx_t_3) {
18149         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 804, __pyx_L1_error)
18150         __Pyx_GOTREF(__pyx_t_6);
18151         __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 804, __pyx_L1_error)
18152         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
18153         __pyx_v_itemsize = __pyx_t_5;
18154         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 804, __pyx_L1_error)
18155         __Pyx_GOTREF(__pyx_t_6);
18156         __pyx_t_7 = __Pyx_PyObject_Ord(__pyx_t_6); if (unlikely(__pyx_t_7 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(1, 804, __pyx_L1_error)
18157         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
18158         __pyx_v_kind = __pyx_t_7;
18159         __pyx_v_dtype_signed = (__pyx_v_kind == 'i');
18160         switch (__pyx_v_kind) {
18161           case 'i':
18162           case 'u':
18163           break;
18164           case 'f':
18165           __pyx_t_2 = (((sizeof(float)) == __pyx_v_itemsize) != 0);
18166           if (__pyx_t_2) {
18167           } else {
18168             __pyx_t_3 = __pyx_t_2;
18169             goto __pyx_L16_bool_binop_done;
18170           }
18171           __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 804, __pyx_L1_error)
18172           __Pyx_GOTREF(__pyx_t_6);
18173           __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 804, __pyx_L1_error)
18174           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
18175           __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
18176           __pyx_t_3 = __pyx_t_2;
18177           __pyx_L16_bool_binop_done:;
18178           if (__pyx_t_3) {
18179             if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(1, 804, __pyx_L1_error)
18180             goto __pyx_L10_break;
18181           }
18182           __pyx_t_2 = (((sizeof(double)) == __pyx_v_itemsize) != 0);
18183           if (__pyx_t_2) {
18184           } else {
18185             __pyx_t_3 = __pyx_t_2;
18186             goto __pyx_L19_bool_binop_done;
18187           }
18188           __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 804, __pyx_L1_error)
18189           __Pyx_GOTREF(__pyx_t_6);
18190           __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 804, __pyx_L1_error)
18191           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
18192           __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
18193           __pyx_t_3 = __pyx_t_2;
18194           __pyx_L19_bool_binop_done:;
18195           if (__pyx_t_3) {
18196             if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_double, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(1, 804, __pyx_L1_error)
18197             goto __pyx_L10_break;
18198           }
18199           break;
18200           case 'c':
18201           break;
18202           case 'O':
18203           break;
18204           default: break;
18205         }
18206       }
18207     }
18208     __pyx_t_2 = ((__pyx_v_itemsize == -1L) != 0);
18209     if (!__pyx_t_2) {
18210     } else {
18211       __pyx_t_3 = __pyx_t_2;
18212       goto __pyx_L22_bool_binop_done;
18213     }
18214     __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(float))) != 0);
18215     __pyx_t_3 = __pyx_t_2;
18216     __pyx_L22_bool_binop_done:;
18217     if (__pyx_t_3) {
18218       __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_v_arg, 0);
18219       __pyx_v_memslice = __pyx_t_8;
18220       __pyx_t_3 = (__pyx_v_memslice.memview != 0);
18221       if (__pyx_t_3) {
18222         __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1);
18223         if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(1, 804, __pyx_L1_error)
18224         goto __pyx_L10_break;
18225       }
18226       /*else*/ {
18227         PyErr_Clear();
18228       }
18229     }
18230     __pyx_t_2 = ((__pyx_v_itemsize == -1L) != 0);
18231     if (!__pyx_t_2) {
18232     } else {
18233       __pyx_t_3 = __pyx_t_2;
18234       goto __pyx_L26_bool_binop_done;
18235     }
18236     __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(double))) != 0);
18237     __pyx_t_3 = __pyx_t_2;
18238     __pyx_L26_bool_binop_done:;
18239     if (__pyx_t_3) {
18240       __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_v_arg, 0);
18241       __pyx_v_memslice = __pyx_t_8;
18242       __pyx_t_3 = (__pyx_v_memslice.memview != 0);
18243       if (__pyx_t_3) {
18244         __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1);
18245         if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_double, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(1, 804, __pyx_L1_error)
18246         goto __pyx_L10_break;
18247       }
18248       /*else*/ {
18249         PyErr_Clear();
18250       }
18251     }
18252     if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, Py_None, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(1, 804, __pyx_L1_error)
18253     goto __pyx_L10_break;
18254   }
18255   __pyx_L10_break:;
18256   __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 804, __pyx_L1_error)
18257   __Pyx_GOTREF(__pyx_t_6);
18258   __pyx_v_candidates = ((PyObject*)__pyx_t_6);
18259   __pyx_t_6 = 0;
18260   __pyx_t_5 = 0;
18261   if (unlikely(__pyx_v_signatures == Py_None)) {
18262     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
18263     __PYX_ERR(1, 804, __pyx_L1_error)
18264   }
18265   __pyx_t_1 = __Pyx_dict_iterator(((PyObject*)__pyx_v_signatures), 1, ((PyObject *)NULL), (&__pyx_t_9), (&__pyx_t_10)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 804, __pyx_L1_error)
18266   __Pyx_GOTREF(__pyx_t_1);
18267   __Pyx_XDECREF(__pyx_t_6);
18268   __pyx_t_6 = __pyx_t_1;
18269   __pyx_t_1 = 0;
18270   while (1) {
18271     __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_9, &__pyx_t_5, &__pyx_t_1, NULL, NULL, __pyx_t_10);
18272     if (unlikely(__pyx_t_11 == 0)) break;
18273     if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(1, 804, __pyx_L1_error)
18274     __Pyx_GOTREF(__pyx_t_1);
18275     __Pyx_XDECREF_SET(__pyx_v_sig, __pyx_t_1);
18276     __pyx_t_1 = 0;
18277     __pyx_v_match_found = 0;
18278     __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_sig, __pyx_n_s_strip); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 804, __pyx_L1_error)
18279     __Pyx_GOTREF(__pyx_t_13);
18280     __pyx_t_14 = NULL;
18281     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
18282       __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_13);
18283       if (likely(__pyx_t_14)) {
18284         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
18285         __Pyx_INCREF(__pyx_t_14);
18286         __Pyx_INCREF(function);
18287         __Pyx_DECREF_SET(__pyx_t_13, function);
18288       }
18289     }
18290     __pyx_t_12 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_14, __pyx_kp_s__5) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_kp_s__5);
18291     __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
18292     if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 804, __pyx_L1_error)
18293     __Pyx_GOTREF(__pyx_t_12);
18294     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
18295     __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_split); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 804, __pyx_L1_error)
18296     __Pyx_GOTREF(__pyx_t_13);
18297     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
18298     __pyx_t_12 = NULL;
18299     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
18300       __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13);
18301       if (likely(__pyx_t_12)) {
18302         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
18303         __Pyx_INCREF(__pyx_t_12);
18304         __Pyx_INCREF(function);
18305         __Pyx_DECREF_SET(__pyx_t_13, function);
18306       }
18307     }
18308     __pyx_t_1 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_12, __pyx_kp_s__6) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_kp_s__6);
18309     __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
18310     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 804, __pyx_L1_error)
18311     __Pyx_GOTREF(__pyx_t_1);
18312     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
18313     __Pyx_XDECREF_SET(__pyx_v_src_sig, __pyx_t_1);
18314     __pyx_t_1 = 0;
18315     __pyx_t_15 = PyList_GET_SIZE(__pyx_v_dest_sig); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(1, 804, __pyx_L1_error)
18316     __pyx_t_16 = __pyx_t_15;
18317     for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
18318       __pyx_v_i = __pyx_t_17;
18319       __pyx_t_1 = PyList_GET_ITEM(__pyx_v_dest_sig, __pyx_v_i);
18320       __Pyx_INCREF(__pyx_t_1);
18321       __Pyx_XDECREF_SET(__pyx_v_dst_type, __pyx_t_1);
18322       __pyx_t_1 = 0;
18323       __pyx_t_3 = (__pyx_v_dst_type != Py_None);
18324       __pyx_t_2 = (__pyx_t_3 != 0);
18325       if (__pyx_t_2) {
18326         __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_src_sig, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 804, __pyx_L1_error)
18327         __Pyx_GOTREF(__pyx_t_1);
18328         __pyx_t_13 = PyObject_RichCompare(__pyx_t_1, __pyx_v_dst_type, Py_EQ); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 804, __pyx_L1_error)
18329         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18330         __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 804, __pyx_L1_error)
18331         __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
18332         if (__pyx_t_2) {
18333           __pyx_v_match_found = 1;
18334           goto __pyx_L34;
18335         }
18336         /*else*/ {
18337           __pyx_v_match_found = 0;
18338           goto __pyx_L32_break;
18339         }
18340         __pyx_L34:;
18341       }
18342     }
18343     __pyx_L32_break:;
18344     __pyx_t_2 = (__pyx_v_match_found != 0);
18345     if (__pyx_t_2) {
18346       __pyx_t_18 = __Pyx_PyList_Append(__pyx_v_candidates, __pyx_v_sig); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(1, 804, __pyx_L1_error)
18347     }
18348   }
18349   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
18350   __pyx_t_2 = (PyList_GET_SIZE(__pyx_v_candidates) != 0);
18351   __pyx_t_3 = ((!__pyx_t_2) != 0);
18352   if (__pyx_t_3) {
18353     __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 804, __pyx_L1_error)
18354     __Pyx_GOTREF(__pyx_t_6);
18355     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
18356     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
18357     __PYX_ERR(1, 804, __pyx_L1_error)
18358   }
18359   __pyx_t_9 = PyList_GET_SIZE(__pyx_v_candidates); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 804, __pyx_L1_error)
18360   __pyx_t_3 = ((__pyx_t_9 > 1) != 0);
18361   if (__pyx_t_3) {
18362     __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 804, __pyx_L1_error)
18363     __Pyx_GOTREF(__pyx_t_6);
18364     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
18365     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
18366     __PYX_ERR(1, 804, __pyx_L1_error)
18367   }
18368   /*else*/ {
18369     __Pyx_XDECREF(__pyx_r);
18370     if (unlikely(__pyx_v_signatures == Py_None)) {
18371       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
18372       __PYX_ERR(1, 804, __pyx_L1_error)
18373     }
18374     __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_signatures), PyList_GET_ITEM(__pyx_v_candidates, 0)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 804, __pyx_L1_error)
18375     __Pyx_GOTREF(__pyx_t_6);
18376     __pyx_r = __pyx_t_6;
18377     __pyx_t_6 = 0;
18378     goto __pyx_L0;
18379   }
18380 
18381   /* function exit code */
18382   __pyx_L1_error:;
18383   __Pyx_XDECREF(__pyx_t_1);
18384   __Pyx_XDECREF(__pyx_t_6);
18385   __Pyx_XDECREF(__pyx_t_12);
18386   __Pyx_XDECREF(__pyx_t_13);
18387   __Pyx_XDECREF(__pyx_t_14);
18388   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename);
18389   __pyx_r = NULL;
18390   __pyx_L0:;
18391   __Pyx_XDECREF(__pyx_v_dest_sig);
18392   __Pyx_XDECREF(__pyx_v_ndarray);
18393   __Pyx_XDECREF(__pyx_v_arg);
18394   __Pyx_XDECREF(__pyx_v_dtype);
18395   __Pyx_XDECREF(__pyx_v_arg_base);
18396   __Pyx_XDECREF(__pyx_v_candidates);
18397   __Pyx_XDECREF(__pyx_v_sig);
18398   __Pyx_XDECREF(__pyx_v_src_sig);
18399   __Pyx_XDECREF(__pyx_v_dst_type);
18400   __Pyx_XDECREF(__pyx_v_kwargs);
18401   __Pyx_XGIVEREF(__pyx_r);
18402   __Pyx_RefNannyFinishContext();
18403   return __pyx_r;
18404 }
18405 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_124__defaults__(CYTHON_UNUSED PyObject * __pyx_self)18406 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_124__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
18407   PyObject *__pyx_r = NULL;
18408   __Pyx_RefNannyDeclarations
18409   PyObject *__pyx_t_1 = NULL;
18410   PyObject *__pyx_t_2 = NULL;
18411   __Pyx_RefNannySetupContext("__defaults__", 0);
18412   __Pyx_XDECREF(__pyx_r);
18413   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 804, __pyx_L1_error)
18414   __Pyx_GOTREF(__pyx_t_1);
18415   __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults6, __pyx_self)->__pyx_arg_use_loop);
18416   __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults6, __pyx_self)->__pyx_arg_use_loop);
18417   PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults6, __pyx_self)->__pyx_arg_use_loop);
18418   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 804, __pyx_L1_error)
18419   __Pyx_GOTREF(__pyx_t_2);
18420   __Pyx_GIVEREF(__pyx_t_1);
18421   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
18422   __Pyx_INCREF(Py_None);
18423   __Pyx_GIVEREF(Py_None);
18424   PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
18425   __pyx_t_1 = 0;
18426   __pyx_r = __pyx_t_2;
18427   __pyx_t_2 = 0;
18428   goto __pyx_L0;
18429 
18430   /* function exit code */
18431   __pyx_L1_error:;
18432   __Pyx_XDECREF(__pyx_t_1);
18433   __Pyx_XDECREF(__pyx_t_2);
18434   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18435   __pyx_r = NULL;
18436   __pyx_L0:;
18437   __Pyx_XGIVEREF(__pyx_r);
18438   __Pyx_RefNannyFinishContext();
18439   return __pyx_r;
18440 }
18441 
18442 /* Python wrapper */
18443 static PyObject *__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_83morton_qsort_recursive(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
18444 static PyMethodDef __pyx_fuse_0__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_83morton_qsort_recursive = {"__pyx_fuse_0morton_qsort_recursive", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_83morton_qsort_recursive, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_83morton_qsort_recursive(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)18445 static PyObject *__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_83morton_qsort_recursive(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
18446   PyArrayObject *__pyx_v_pos = 0;
18447   __pyx_t_5numpy_int64_t __pyx_v_l;
18448   __pyx_t_5numpy_int64_t __pyx_v_h;
18449   PyArrayObject *__pyx_v_ind = 0;
18450   PyObject *__pyx_v_use_loop = 0;
18451   PyObject *__pyx_r = 0;
18452   __Pyx_RefNannyDeclarations
18453   __Pyx_RefNannySetupContext("morton_qsort_recursive (wrapper)", 0);
18454   {
18455     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_l,&__pyx_n_s_h,&__pyx_n_s_ind,&__pyx_n_s_use_loop,0};
18456     PyObject* values[5] = {0,0,0,0,0};
18457     __pyx_defaults6 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults6, __pyx_self);
18458     values[4] = __pyx_dynamic_args->__pyx_arg_use_loop;
18459     if (unlikely(__pyx_kwds)) {
18460       Py_ssize_t kw_args;
18461       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
18462       switch (pos_args) {
18463         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
18464         CYTHON_FALLTHROUGH;
18465         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
18466         CYTHON_FALLTHROUGH;
18467         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
18468         CYTHON_FALLTHROUGH;
18469         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
18470         CYTHON_FALLTHROUGH;
18471         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
18472         CYTHON_FALLTHROUGH;
18473         case  0: break;
18474         default: goto __pyx_L5_argtuple_error;
18475       }
18476       kw_args = PyDict_Size(__pyx_kwds);
18477       switch (pos_args) {
18478         case  0:
18479         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
18480         else goto __pyx_L5_argtuple_error;
18481         CYTHON_FALLTHROUGH;
18482         case  1:
18483         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_l)) != 0)) kw_args--;
18484         else {
18485           __Pyx_RaiseArgtupleInvalid("morton_qsort_recursive", 0, 4, 5, 1); __PYX_ERR(1, 804, __pyx_L3_error)
18486         }
18487         CYTHON_FALLTHROUGH;
18488         case  2:
18489         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
18490         else {
18491           __Pyx_RaiseArgtupleInvalid("morton_qsort_recursive", 0, 4, 5, 2); __PYX_ERR(1, 804, __pyx_L3_error)
18492         }
18493         CYTHON_FALLTHROUGH;
18494         case  3:
18495         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind)) != 0)) kw_args--;
18496         else {
18497           __Pyx_RaiseArgtupleInvalid("morton_qsort_recursive", 0, 4, 5, 3); __PYX_ERR(1, 804, __pyx_L3_error)
18498         }
18499         CYTHON_FALLTHROUGH;
18500         case  4:
18501         if (kw_args > 0) {
18502           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_loop);
18503           if (value) { values[4] = value; kw_args--; }
18504         }
18505       }
18506       if (unlikely(kw_args > 0)) {
18507         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "morton_qsort_recursive") < 0)) __PYX_ERR(1, 804, __pyx_L3_error)
18508       }
18509     } else {
18510       switch (PyTuple_GET_SIZE(__pyx_args)) {
18511         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
18512         CYTHON_FALLTHROUGH;
18513         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
18514         values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
18515         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
18516         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
18517         break;
18518         default: goto __pyx_L5_argtuple_error;
18519       }
18520     }
18521     __pyx_v_pos = ((PyArrayObject *)values[0]);
18522     __pyx_v_l = __Pyx_PyInt_As_npy_int64(values[1]); if (unlikely((__pyx_v_l == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 805, __pyx_L3_error)
18523     __pyx_v_h = __Pyx_PyInt_As_npy_int64(values[2]); if (unlikely((__pyx_v_h == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 805, __pyx_L3_error)
18524     __pyx_v_ind = ((PyArrayObject *)values[3]);
18525     __pyx_v_use_loop = values[4];
18526   }
18527   goto __pyx_L4_argument_unpacking_done;
18528   __pyx_L5_argtuple_error:;
18529   __Pyx_RaiseArgtupleInvalid("morton_qsort_recursive", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 804, __pyx_L3_error)
18530   __pyx_L3_error:;
18531   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_qsort_recursive", __pyx_clineno, __pyx_lineno, __pyx_filename);
18532   __Pyx_RefNannyFinishContext();
18533   return NULL;
18534   __pyx_L4_argument_unpacking_done:;
18535   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 1, "pos", 0))) __PYX_ERR(1, 804, __pyx_L1_error)
18536   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ind), __pyx_ptype_5numpy_ndarray, 1, "ind", 0))) __PYX_ERR(1, 806, __pyx_L1_error)
18537   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_82morton_qsort_recursive(__pyx_self, __pyx_v_pos, __pyx_v_l, __pyx_v_h, __pyx_v_ind, __pyx_v_use_loop);
18538 
18539   /* function exit code */
18540   goto __pyx_L0;
18541   __pyx_L1_error:;
18542   __pyx_r = NULL;
18543   __pyx_L0:;
18544   __Pyx_RefNannyFinishContext();
18545   return __pyx_r;
18546 }
18547 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_82morton_qsort_recursive(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_pos,__pyx_t_5numpy_int64_t __pyx_v_l,__pyx_t_5numpy_int64_t __pyx_v_h,PyArrayObject * __pyx_v_ind,PyObject * __pyx_v_use_loop)18548 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_82morton_qsort_recursive(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_int64_t __pyx_v_l, __pyx_t_5numpy_int64_t __pyx_v_h, PyArrayObject *__pyx_v_ind, PyObject *__pyx_v_use_loop) {
18549   __pyx_t_5numpy_int64_t __pyx_v_p;
18550   __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
18551   __Pyx_Buffer __pyx_pybuffer_ind;
18552   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos;
18553   __Pyx_Buffer __pyx_pybuffer_pos;
18554   PyObject *__pyx_r = NULL;
18555   __Pyx_RefNannyDeclarations
18556   int __pyx_t_1;
18557   PyObject *__pyx_t_2 = NULL;
18558   PyObject *__pyx_t_3 = NULL;
18559   PyObject *__pyx_t_4 = NULL;
18560   PyObject *__pyx_t_5 = NULL;
18561   __pyx_t_5numpy_int64_t __pyx_t_6;
18562   __Pyx_RefNannySetupContext("__pyx_fuse_0morton_qsort_recursive", 0);
18563   __pyx_pybuffer_pos.pybuffer.buf = NULL;
18564   __pyx_pybuffer_pos.refcount = 0;
18565   __pyx_pybuffernd_pos.data = NULL;
18566   __pyx_pybuffernd_pos.rcbuffer = &__pyx_pybuffer_pos;
18567   __pyx_pybuffer_ind.pybuffer.buf = NULL;
18568   __pyx_pybuffer_ind.refcount = 0;
18569   __pyx_pybuffernd_ind.data = NULL;
18570   __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;
18571   {
18572     __Pyx_BufFmt_StackElem __pyx_stack[1];
18573     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_float, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(1, 804, __pyx_L1_error)
18574   }
18575   __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1];
18576   {
18577     __Pyx_BufFmt_StackElem __pyx_stack[1];
18578     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 804, __pyx_L1_error)
18579   }
18580   __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
18581 
18582   /* "yt/utilities/lib/geometry_utils.pyx":810
18583  *     # http://www.geeksforgeeks.org/iterative-quick-sort/
18584  *     cdef np.int64_t p
18585  *     if (l < h):             # <<<<<<<<<<<<<<
18586  *         p = morton_qsort_partition(pos, l, h, ind, use_loop=use_loop)
18587  *         morton_qsort_recursive(pos, l, p-1, ind, use_loop=use_loop)
18588  */
18589   __pyx_t_1 = ((__pyx_v_l < __pyx_v_h) != 0);
18590   if (__pyx_t_1) {
18591 
18592     /* "yt/utilities/lib/geometry_utils.pyx":811
18593  *     cdef np.int64_t p
18594  *     if (l < h):
18595  *         p = morton_qsort_partition(pos, l, h, ind, use_loop=use_loop)             # <<<<<<<<<<<<<<
18596  *         morton_qsort_recursive(pos, l, p-1, ind, use_loop=use_loop)
18597  *         morton_qsort_recursive(pos, p+1, h, ind, use_loop=use_loop)
18598  */
18599     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_morton_qsort_partition); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 811, __pyx_L1_error)
18600     __Pyx_GOTREF(__pyx_t_2);
18601     __pyx_t_3 = __Pyx_PyInt_From_npy_int64(__pyx_v_l); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 811, __pyx_L1_error)
18602     __Pyx_GOTREF(__pyx_t_3);
18603     __pyx_t_4 = __Pyx_PyInt_From_npy_int64(__pyx_v_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 811, __pyx_L1_error)
18604     __Pyx_GOTREF(__pyx_t_4);
18605     __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 811, __pyx_L1_error)
18606     __Pyx_GOTREF(__pyx_t_5);
18607     __Pyx_INCREF(((PyObject *)__pyx_v_pos));
18608     __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
18609     PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_pos));
18610     __Pyx_GIVEREF(__pyx_t_3);
18611     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
18612     __Pyx_GIVEREF(__pyx_t_4);
18613     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
18614     __Pyx_INCREF(((PyObject *)__pyx_v_ind));
18615     __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
18616     PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_v_ind));
18617     __pyx_t_3 = 0;
18618     __pyx_t_4 = 0;
18619     __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 811, __pyx_L1_error)
18620     __Pyx_GOTREF(__pyx_t_4);
18621     if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_use_loop, __pyx_v_use_loop) < 0) __PYX_ERR(1, 811, __pyx_L1_error)
18622     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 811, __pyx_L1_error)
18623     __Pyx_GOTREF(__pyx_t_3);
18624     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18625     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
18626     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18627     __pyx_t_6 = __Pyx_PyInt_As_npy_int64(__pyx_t_3); if (unlikely((__pyx_t_6 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 811, __pyx_L1_error)
18628     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18629     __pyx_v_p = __pyx_t_6;
18630 
18631     /* "yt/utilities/lib/geometry_utils.pyx":812
18632  *     if (l < h):
18633  *         p = morton_qsort_partition(pos, l, h, ind, use_loop=use_loop)
18634  *         morton_qsort_recursive(pos, l, p-1, ind, use_loop=use_loop)             # <<<<<<<<<<<<<<
18635  *         morton_qsort_recursive(pos, p+1, h, ind, use_loop=use_loop)
18636  *
18637  */
18638     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_morton_qsort_recursive); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 812, __pyx_L1_error)
18639     __Pyx_GOTREF(__pyx_t_3);
18640     __pyx_t_4 = __Pyx_PyInt_From_npy_int64(__pyx_v_l); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 812, __pyx_L1_error)
18641     __Pyx_GOTREF(__pyx_t_4);
18642     __pyx_t_5 = __Pyx_PyInt_From_npy_int64((__pyx_v_p - 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 812, __pyx_L1_error)
18643     __Pyx_GOTREF(__pyx_t_5);
18644     __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 812, __pyx_L1_error)
18645     __Pyx_GOTREF(__pyx_t_2);
18646     __Pyx_INCREF(((PyObject *)__pyx_v_pos));
18647     __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
18648     PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_pos));
18649     __Pyx_GIVEREF(__pyx_t_4);
18650     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
18651     __Pyx_GIVEREF(__pyx_t_5);
18652     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
18653     __Pyx_INCREF(((PyObject *)__pyx_v_ind));
18654     __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
18655     PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_v_ind));
18656     __pyx_t_4 = 0;
18657     __pyx_t_5 = 0;
18658     __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 812, __pyx_L1_error)
18659     __Pyx_GOTREF(__pyx_t_5);
18660     if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_use_loop, __pyx_v_use_loop) < 0) __PYX_ERR(1, 812, __pyx_L1_error)
18661     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 812, __pyx_L1_error)
18662     __Pyx_GOTREF(__pyx_t_4);
18663     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18664     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18665     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
18666     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18667 
18668     /* "yt/utilities/lib/geometry_utils.pyx":813
18669  *         p = morton_qsort_partition(pos, l, h, ind, use_loop=use_loop)
18670  *         morton_qsort_recursive(pos, l, p-1, ind, use_loop=use_loop)
18671  *         morton_qsort_recursive(pos, p+1, h, ind, use_loop=use_loop)             # <<<<<<<<<<<<<<
18672  *
18673  * @cython.cdivision(True)
18674  */
18675     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_morton_qsort_recursive); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 813, __pyx_L1_error)
18676     __Pyx_GOTREF(__pyx_t_4);
18677     __pyx_t_5 = __Pyx_PyInt_From_npy_int64((__pyx_v_p + 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 813, __pyx_L1_error)
18678     __Pyx_GOTREF(__pyx_t_5);
18679     __pyx_t_2 = __Pyx_PyInt_From_npy_int64(__pyx_v_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 813, __pyx_L1_error)
18680     __Pyx_GOTREF(__pyx_t_2);
18681     __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 813, __pyx_L1_error)
18682     __Pyx_GOTREF(__pyx_t_3);
18683     __Pyx_INCREF(((PyObject *)__pyx_v_pos));
18684     __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
18685     PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_pos));
18686     __Pyx_GIVEREF(__pyx_t_5);
18687     PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
18688     __Pyx_GIVEREF(__pyx_t_2);
18689     PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
18690     __Pyx_INCREF(((PyObject *)__pyx_v_ind));
18691     __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
18692     PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_v_ind));
18693     __pyx_t_5 = 0;
18694     __pyx_t_2 = 0;
18695     __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 813, __pyx_L1_error)
18696     __Pyx_GOTREF(__pyx_t_2);
18697     if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_use_loop, __pyx_v_use_loop) < 0) __PYX_ERR(1, 813, __pyx_L1_error)
18698     __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 813, __pyx_L1_error)
18699     __Pyx_GOTREF(__pyx_t_5);
18700     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18701     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18702     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18703     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
18704 
18705     /* "yt/utilities/lib/geometry_utils.pyx":810
18706  *     # http://www.geeksforgeeks.org/iterative-quick-sort/
18707  *     cdef np.int64_t p
18708  *     if (l < h):             # <<<<<<<<<<<<<<
18709  *         p = morton_qsort_partition(pos, l, h, ind, use_loop=use_loop)
18710  *         morton_qsort_recursive(pos, l, p-1, ind, use_loop=use_loop)
18711  */
18712   }
18713 
18714   /* "yt/utilities/lib/geometry_utils.pyx":804
18715  * @cython.boundscheck(False)
18716  * @cython.wraparound(False)
18717  * def morton_qsort_recursive(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
18718  *                            np.int64_t l, np.int64_t h,
18719  *                            np.ndarray[np.uint64_t, ndim=1] ind,
18720  */
18721 
18722   /* function exit code */
18723   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18724   goto __pyx_L0;
18725   __pyx_L1_error:;
18726   __Pyx_XDECREF(__pyx_t_2);
18727   __Pyx_XDECREF(__pyx_t_3);
18728   __Pyx_XDECREF(__pyx_t_4);
18729   __Pyx_XDECREF(__pyx_t_5);
18730   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
18731     __Pyx_PyThreadState_declare
18732     __Pyx_PyThreadState_assign
18733     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
18734     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
18735     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
18736   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
18737   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_qsort_recursive", __pyx_clineno, __pyx_lineno, __pyx_filename);
18738   __pyx_r = NULL;
18739   goto __pyx_L2;
18740   __pyx_L0:;
18741   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
18742   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
18743   __pyx_L2:;
18744   __Pyx_XGIVEREF(__pyx_r);
18745   __Pyx_RefNannyFinishContext();
18746   return __pyx_r;
18747 }
18748 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_126__defaults__(CYTHON_UNUSED PyObject * __pyx_self)18749 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_126__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
18750   PyObject *__pyx_r = NULL;
18751   __Pyx_RefNannyDeclarations
18752   PyObject *__pyx_t_1 = NULL;
18753   PyObject *__pyx_t_2 = NULL;
18754   __Pyx_RefNannySetupContext("__defaults__", 0);
18755   __Pyx_XDECREF(__pyx_r);
18756   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 804, __pyx_L1_error)
18757   __Pyx_GOTREF(__pyx_t_1);
18758   __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults7, __pyx_self)->__pyx_arg_use_loop);
18759   __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults7, __pyx_self)->__pyx_arg_use_loop);
18760   PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults7, __pyx_self)->__pyx_arg_use_loop);
18761   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 804, __pyx_L1_error)
18762   __Pyx_GOTREF(__pyx_t_2);
18763   __Pyx_GIVEREF(__pyx_t_1);
18764   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
18765   __Pyx_INCREF(Py_None);
18766   __Pyx_GIVEREF(Py_None);
18767   PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
18768   __pyx_t_1 = 0;
18769   __pyx_r = __pyx_t_2;
18770   __pyx_t_2 = 0;
18771   goto __pyx_L0;
18772 
18773   /* function exit code */
18774   __pyx_L1_error:;
18775   __Pyx_XDECREF(__pyx_t_1);
18776   __Pyx_XDECREF(__pyx_t_2);
18777   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
18778   __pyx_r = NULL;
18779   __pyx_L0:;
18780   __Pyx_XGIVEREF(__pyx_r);
18781   __Pyx_RefNannyFinishContext();
18782   return __pyx_r;
18783 }
18784 
18785 /* Python wrapper */
18786 static PyObject *__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_85morton_qsort_recursive(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
18787 static PyMethodDef __pyx_fuse_1__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_85morton_qsort_recursive = {"__pyx_fuse_1morton_qsort_recursive", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_85morton_qsort_recursive, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_85morton_qsort_recursive(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)18788 static PyObject *__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_85morton_qsort_recursive(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
18789   PyArrayObject *__pyx_v_pos = 0;
18790   __pyx_t_5numpy_int64_t __pyx_v_l;
18791   __pyx_t_5numpy_int64_t __pyx_v_h;
18792   PyArrayObject *__pyx_v_ind = 0;
18793   PyObject *__pyx_v_use_loop = 0;
18794   PyObject *__pyx_r = 0;
18795   __Pyx_RefNannyDeclarations
18796   __Pyx_RefNannySetupContext("morton_qsort_recursive (wrapper)", 0);
18797   {
18798     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_l,&__pyx_n_s_h,&__pyx_n_s_ind,&__pyx_n_s_use_loop,0};
18799     PyObject* values[5] = {0,0,0,0,0};
18800     __pyx_defaults7 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults7, __pyx_self);
18801     values[4] = __pyx_dynamic_args->__pyx_arg_use_loop;
18802     if (unlikely(__pyx_kwds)) {
18803       Py_ssize_t kw_args;
18804       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
18805       switch (pos_args) {
18806         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
18807         CYTHON_FALLTHROUGH;
18808         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
18809         CYTHON_FALLTHROUGH;
18810         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
18811         CYTHON_FALLTHROUGH;
18812         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
18813         CYTHON_FALLTHROUGH;
18814         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
18815         CYTHON_FALLTHROUGH;
18816         case  0: break;
18817         default: goto __pyx_L5_argtuple_error;
18818       }
18819       kw_args = PyDict_Size(__pyx_kwds);
18820       switch (pos_args) {
18821         case  0:
18822         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
18823         else goto __pyx_L5_argtuple_error;
18824         CYTHON_FALLTHROUGH;
18825         case  1:
18826         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_l)) != 0)) kw_args--;
18827         else {
18828           __Pyx_RaiseArgtupleInvalid("morton_qsort_recursive", 0, 4, 5, 1); __PYX_ERR(1, 804, __pyx_L3_error)
18829         }
18830         CYTHON_FALLTHROUGH;
18831         case  2:
18832         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
18833         else {
18834           __Pyx_RaiseArgtupleInvalid("morton_qsort_recursive", 0, 4, 5, 2); __PYX_ERR(1, 804, __pyx_L3_error)
18835         }
18836         CYTHON_FALLTHROUGH;
18837         case  3:
18838         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind)) != 0)) kw_args--;
18839         else {
18840           __Pyx_RaiseArgtupleInvalid("morton_qsort_recursive", 0, 4, 5, 3); __PYX_ERR(1, 804, __pyx_L3_error)
18841         }
18842         CYTHON_FALLTHROUGH;
18843         case  4:
18844         if (kw_args > 0) {
18845           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_loop);
18846           if (value) { values[4] = value; kw_args--; }
18847         }
18848       }
18849       if (unlikely(kw_args > 0)) {
18850         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "morton_qsort_recursive") < 0)) __PYX_ERR(1, 804, __pyx_L3_error)
18851       }
18852     } else {
18853       switch (PyTuple_GET_SIZE(__pyx_args)) {
18854         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
18855         CYTHON_FALLTHROUGH;
18856         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
18857         values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
18858         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
18859         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
18860         break;
18861         default: goto __pyx_L5_argtuple_error;
18862       }
18863     }
18864     __pyx_v_pos = ((PyArrayObject *)values[0]);
18865     __pyx_v_l = __Pyx_PyInt_As_npy_int64(values[1]); if (unlikely((__pyx_v_l == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 805, __pyx_L3_error)
18866     __pyx_v_h = __Pyx_PyInt_As_npy_int64(values[2]); if (unlikely((__pyx_v_h == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 805, __pyx_L3_error)
18867     __pyx_v_ind = ((PyArrayObject *)values[3]);
18868     __pyx_v_use_loop = values[4];
18869   }
18870   goto __pyx_L4_argument_unpacking_done;
18871   __pyx_L5_argtuple_error:;
18872   __Pyx_RaiseArgtupleInvalid("morton_qsort_recursive", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 804, __pyx_L3_error)
18873   __pyx_L3_error:;
18874   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_qsort_recursive", __pyx_clineno, __pyx_lineno, __pyx_filename);
18875   __Pyx_RefNannyFinishContext();
18876   return NULL;
18877   __pyx_L4_argument_unpacking_done:;
18878   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 1, "pos", 0))) __PYX_ERR(1, 804, __pyx_L1_error)
18879   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ind), __pyx_ptype_5numpy_ndarray, 1, "ind", 0))) __PYX_ERR(1, 806, __pyx_L1_error)
18880   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_84morton_qsort_recursive(__pyx_self, __pyx_v_pos, __pyx_v_l, __pyx_v_h, __pyx_v_ind, __pyx_v_use_loop);
18881 
18882   /* function exit code */
18883   goto __pyx_L0;
18884   __pyx_L1_error:;
18885   __pyx_r = NULL;
18886   __pyx_L0:;
18887   __Pyx_RefNannyFinishContext();
18888   return __pyx_r;
18889 }
18890 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_84morton_qsort_recursive(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_pos,__pyx_t_5numpy_int64_t __pyx_v_l,__pyx_t_5numpy_int64_t __pyx_v_h,PyArrayObject * __pyx_v_ind,PyObject * __pyx_v_use_loop)18891 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_84morton_qsort_recursive(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_int64_t __pyx_v_l, __pyx_t_5numpy_int64_t __pyx_v_h, PyArrayObject *__pyx_v_ind, PyObject *__pyx_v_use_loop) {
18892   __pyx_t_5numpy_int64_t __pyx_v_p;
18893   __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
18894   __Pyx_Buffer __pyx_pybuffer_ind;
18895   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos;
18896   __Pyx_Buffer __pyx_pybuffer_pos;
18897   PyObject *__pyx_r = NULL;
18898   __Pyx_RefNannyDeclarations
18899   int __pyx_t_1;
18900   PyObject *__pyx_t_2 = NULL;
18901   PyObject *__pyx_t_3 = NULL;
18902   PyObject *__pyx_t_4 = NULL;
18903   PyObject *__pyx_t_5 = NULL;
18904   __pyx_t_5numpy_int64_t __pyx_t_6;
18905   __Pyx_RefNannySetupContext("__pyx_fuse_1morton_qsort_recursive", 0);
18906   __pyx_pybuffer_pos.pybuffer.buf = NULL;
18907   __pyx_pybuffer_pos.refcount = 0;
18908   __pyx_pybuffernd_pos.data = NULL;
18909   __pyx_pybuffernd_pos.rcbuffer = &__pyx_pybuffer_pos;
18910   __pyx_pybuffer_ind.pybuffer.buf = NULL;
18911   __pyx_pybuffer_ind.refcount = 0;
18912   __pyx_pybuffernd_ind.data = NULL;
18913   __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;
18914   {
18915     __Pyx_BufFmt_StackElem __pyx_stack[1];
18916     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(1, 804, __pyx_L1_error)
18917   }
18918   __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1];
18919   {
18920     __Pyx_BufFmt_StackElem __pyx_stack[1];
18921     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 804, __pyx_L1_error)
18922   }
18923   __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
18924 
18925   /* "yt/utilities/lib/geometry_utils.pyx":810
18926  *     # http://www.geeksforgeeks.org/iterative-quick-sort/
18927  *     cdef np.int64_t p
18928  *     if (l < h):             # <<<<<<<<<<<<<<
18929  *         p = morton_qsort_partition(pos, l, h, ind, use_loop=use_loop)
18930  *         morton_qsort_recursive(pos, l, p-1, ind, use_loop=use_loop)
18931  */
18932   __pyx_t_1 = ((__pyx_v_l < __pyx_v_h) != 0);
18933   if (__pyx_t_1) {
18934 
18935     /* "yt/utilities/lib/geometry_utils.pyx":811
18936  *     cdef np.int64_t p
18937  *     if (l < h):
18938  *         p = morton_qsort_partition(pos, l, h, ind, use_loop=use_loop)             # <<<<<<<<<<<<<<
18939  *         morton_qsort_recursive(pos, l, p-1, ind, use_loop=use_loop)
18940  *         morton_qsort_recursive(pos, p+1, h, ind, use_loop=use_loop)
18941  */
18942     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_morton_qsort_partition); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 811, __pyx_L1_error)
18943     __Pyx_GOTREF(__pyx_t_2);
18944     __pyx_t_3 = __Pyx_PyInt_From_npy_int64(__pyx_v_l); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 811, __pyx_L1_error)
18945     __Pyx_GOTREF(__pyx_t_3);
18946     __pyx_t_4 = __Pyx_PyInt_From_npy_int64(__pyx_v_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 811, __pyx_L1_error)
18947     __Pyx_GOTREF(__pyx_t_4);
18948     __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 811, __pyx_L1_error)
18949     __Pyx_GOTREF(__pyx_t_5);
18950     __Pyx_INCREF(((PyObject *)__pyx_v_pos));
18951     __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
18952     PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_pos));
18953     __Pyx_GIVEREF(__pyx_t_3);
18954     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
18955     __Pyx_GIVEREF(__pyx_t_4);
18956     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
18957     __Pyx_INCREF(((PyObject *)__pyx_v_ind));
18958     __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
18959     PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_v_ind));
18960     __pyx_t_3 = 0;
18961     __pyx_t_4 = 0;
18962     __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 811, __pyx_L1_error)
18963     __Pyx_GOTREF(__pyx_t_4);
18964     if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_use_loop, __pyx_v_use_loop) < 0) __PYX_ERR(1, 811, __pyx_L1_error)
18965     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 811, __pyx_L1_error)
18966     __Pyx_GOTREF(__pyx_t_3);
18967     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18968     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
18969     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18970     __pyx_t_6 = __Pyx_PyInt_As_npy_int64(__pyx_t_3); if (unlikely((__pyx_t_6 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 811, __pyx_L1_error)
18971     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18972     __pyx_v_p = __pyx_t_6;
18973 
18974     /* "yt/utilities/lib/geometry_utils.pyx":812
18975  *     if (l < h):
18976  *         p = morton_qsort_partition(pos, l, h, ind, use_loop=use_loop)
18977  *         morton_qsort_recursive(pos, l, p-1, ind, use_loop=use_loop)             # <<<<<<<<<<<<<<
18978  *         morton_qsort_recursive(pos, p+1, h, ind, use_loop=use_loop)
18979  *
18980  */
18981     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_morton_qsort_recursive); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 812, __pyx_L1_error)
18982     __Pyx_GOTREF(__pyx_t_3);
18983     __pyx_t_4 = __Pyx_PyInt_From_npy_int64(__pyx_v_l); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 812, __pyx_L1_error)
18984     __Pyx_GOTREF(__pyx_t_4);
18985     __pyx_t_5 = __Pyx_PyInt_From_npy_int64((__pyx_v_p - 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 812, __pyx_L1_error)
18986     __Pyx_GOTREF(__pyx_t_5);
18987     __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 812, __pyx_L1_error)
18988     __Pyx_GOTREF(__pyx_t_2);
18989     __Pyx_INCREF(((PyObject *)__pyx_v_pos));
18990     __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
18991     PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_pos));
18992     __Pyx_GIVEREF(__pyx_t_4);
18993     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
18994     __Pyx_GIVEREF(__pyx_t_5);
18995     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
18996     __Pyx_INCREF(((PyObject *)__pyx_v_ind));
18997     __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
18998     PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_v_ind));
18999     __pyx_t_4 = 0;
19000     __pyx_t_5 = 0;
19001     __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 812, __pyx_L1_error)
19002     __Pyx_GOTREF(__pyx_t_5);
19003     if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_use_loop, __pyx_v_use_loop) < 0) __PYX_ERR(1, 812, __pyx_L1_error)
19004     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 812, __pyx_L1_error)
19005     __Pyx_GOTREF(__pyx_t_4);
19006     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19007     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19008     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
19009     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19010 
19011     /* "yt/utilities/lib/geometry_utils.pyx":813
19012  *         p = morton_qsort_partition(pos, l, h, ind, use_loop=use_loop)
19013  *         morton_qsort_recursive(pos, l, p-1, ind, use_loop=use_loop)
19014  *         morton_qsort_recursive(pos, p+1, h, ind, use_loop=use_loop)             # <<<<<<<<<<<<<<
19015  *
19016  * @cython.cdivision(True)
19017  */
19018     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_morton_qsort_recursive); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 813, __pyx_L1_error)
19019     __Pyx_GOTREF(__pyx_t_4);
19020     __pyx_t_5 = __Pyx_PyInt_From_npy_int64((__pyx_v_p + 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 813, __pyx_L1_error)
19021     __Pyx_GOTREF(__pyx_t_5);
19022     __pyx_t_2 = __Pyx_PyInt_From_npy_int64(__pyx_v_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 813, __pyx_L1_error)
19023     __Pyx_GOTREF(__pyx_t_2);
19024     __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 813, __pyx_L1_error)
19025     __Pyx_GOTREF(__pyx_t_3);
19026     __Pyx_INCREF(((PyObject *)__pyx_v_pos));
19027     __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
19028     PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_pos));
19029     __Pyx_GIVEREF(__pyx_t_5);
19030     PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
19031     __Pyx_GIVEREF(__pyx_t_2);
19032     PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
19033     __Pyx_INCREF(((PyObject *)__pyx_v_ind));
19034     __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
19035     PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_v_ind));
19036     __pyx_t_5 = 0;
19037     __pyx_t_2 = 0;
19038     __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 813, __pyx_L1_error)
19039     __Pyx_GOTREF(__pyx_t_2);
19040     if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_use_loop, __pyx_v_use_loop) < 0) __PYX_ERR(1, 813, __pyx_L1_error)
19041     __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 813, __pyx_L1_error)
19042     __Pyx_GOTREF(__pyx_t_5);
19043     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19044     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19045     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19046     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
19047 
19048     /* "yt/utilities/lib/geometry_utils.pyx":810
19049  *     # http://www.geeksforgeeks.org/iterative-quick-sort/
19050  *     cdef np.int64_t p
19051  *     if (l < h):             # <<<<<<<<<<<<<<
19052  *         p = morton_qsort_partition(pos, l, h, ind, use_loop=use_loop)
19053  *         morton_qsort_recursive(pos, l, p-1, ind, use_loop=use_loop)
19054  */
19055   }
19056 
19057   /* "yt/utilities/lib/geometry_utils.pyx":804
19058  * @cython.boundscheck(False)
19059  * @cython.wraparound(False)
19060  * def morton_qsort_recursive(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
19061  *                            np.int64_t l, np.int64_t h,
19062  *                            np.ndarray[np.uint64_t, ndim=1] ind,
19063  */
19064 
19065   /* function exit code */
19066   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19067   goto __pyx_L0;
19068   __pyx_L1_error:;
19069   __Pyx_XDECREF(__pyx_t_2);
19070   __Pyx_XDECREF(__pyx_t_3);
19071   __Pyx_XDECREF(__pyx_t_4);
19072   __Pyx_XDECREF(__pyx_t_5);
19073   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
19074     __Pyx_PyThreadState_declare
19075     __Pyx_PyThreadState_assign
19076     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
19077     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
19078     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
19079   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
19080   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_qsort_recursive", __pyx_clineno, __pyx_lineno, __pyx_filename);
19081   __pyx_r = NULL;
19082   goto __pyx_L2;
19083   __pyx_L0:;
19084   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
19085   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
19086   __pyx_L2:;
19087   __Pyx_XGIVEREF(__pyx_r);
19088   __Pyx_RefNannyFinishContext();
19089   return __pyx_r;
19090 }
19091 
19092 /* "yt/utilities/lib/geometry_utils.pyx":818
19093  * @cython.boundscheck(False)
19094  * @cython.wraparound(False)
19095  * def morton_qsort_iterative(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
19096  *                            np.int64_t l, np.int64_t h,
19097  *                            np.ndarray[np.uint64_t, ndim=1] ind,
19098  */
19099 
19100 /* Python wrapper */
19101 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_51morton_qsort_iterative(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
19102 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_51morton_qsort_iterative = {"morton_qsort_iterative", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_51morton_qsort_iterative, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_51morton_qsort_iterative(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)19103 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_51morton_qsort_iterative(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
19104   PyObject *__pyx_v_signatures = 0;
19105   PyObject *__pyx_v_args = 0;
19106   PyObject *__pyx_v_kwargs = 0;
19107   CYTHON_UNUSED PyObject *__pyx_v_defaults = 0;
19108   PyObject *__pyx_r = 0;
19109   __Pyx_RefNannyDeclarations
19110   __Pyx_RefNannySetupContext("__pyx_fused_cpdef (wrapper)", 0);
19111   {
19112     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_signatures,&__pyx_n_s_args,&__pyx_n_s_kwargs,&__pyx_n_s_defaults,0};
19113     PyObject* values[4] = {0,0,0,0};
19114     if (unlikely(__pyx_kwds)) {
19115       Py_ssize_t kw_args;
19116       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19117       switch (pos_args) {
19118         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19119         CYTHON_FALLTHROUGH;
19120         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19121         CYTHON_FALLTHROUGH;
19122         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19123         CYTHON_FALLTHROUGH;
19124         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19125         CYTHON_FALLTHROUGH;
19126         case  0: break;
19127         default: goto __pyx_L5_argtuple_error;
19128       }
19129       kw_args = PyDict_Size(__pyx_kwds);
19130       switch (pos_args) {
19131         case  0:
19132         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_signatures)) != 0)) kw_args--;
19133         else goto __pyx_L5_argtuple_error;
19134         CYTHON_FALLTHROUGH;
19135         case  1:
19136         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--;
19137         else {
19138           __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 1); __PYX_ERR(1, 818, __pyx_L3_error)
19139         }
19140         CYTHON_FALLTHROUGH;
19141         case  2:
19142         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--;
19143         else {
19144           __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 2); __PYX_ERR(1, 818, __pyx_L3_error)
19145         }
19146         CYTHON_FALLTHROUGH;
19147         case  3:
19148         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_defaults)) != 0)) kw_args--;
19149         else {
19150           __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 3); __PYX_ERR(1, 818, __pyx_L3_error)
19151         }
19152       }
19153       if (unlikely(kw_args > 0)) {
19154         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fused_cpdef") < 0)) __PYX_ERR(1, 818, __pyx_L3_error)
19155       }
19156     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
19157       goto __pyx_L5_argtuple_error;
19158     } else {
19159       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19160       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19161       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19162       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19163     }
19164     __pyx_v_signatures = values[0];
19165     __pyx_v_args = values[1];
19166     __pyx_v_kwargs = values[2];
19167     __pyx_v_defaults = values[3];
19168   }
19169   goto __pyx_L4_argument_unpacking_done;
19170   __pyx_L5_argtuple_error:;
19171   __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 818, __pyx_L3_error)
19172   __pyx_L3_error:;
19173   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename);
19174   __Pyx_RefNannyFinishContext();
19175   return NULL;
19176   __pyx_L4_argument_unpacking_done:;
19177   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_50morton_qsort_iterative(__pyx_self, __pyx_v_signatures, __pyx_v_args, __pyx_v_kwargs, __pyx_v_defaults);
19178 
19179   /* function exit code */
19180   __Pyx_RefNannyFinishContext();
19181   return __pyx_r;
19182 }
19183 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_50morton_qsort_iterative(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_signatures,PyObject * __pyx_v_args,PyObject * __pyx_v_kwargs,CYTHON_UNUSED PyObject * __pyx_v_defaults)19184 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_50morton_qsort_iterative(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults) {
19185   PyObject *__pyx_v_dest_sig = NULL;
19186   Py_ssize_t __pyx_v_i;
19187   PyTypeObject *__pyx_v_ndarray = 0;
19188   __Pyx_memviewslice __pyx_v_memslice;
19189   Py_ssize_t __pyx_v_itemsize;
19190   CYTHON_UNUSED int __pyx_v_dtype_signed;
19191   char __pyx_v_kind;
19192   PyObject *__pyx_v_arg = NULL;
19193   PyObject *__pyx_v_dtype = NULL;
19194   PyObject *__pyx_v_arg_base = NULL;
19195   PyObject *__pyx_v_candidates = NULL;
19196   PyObject *__pyx_v_sig = NULL;
19197   int __pyx_v_match_found;
19198   PyObject *__pyx_v_src_sig = NULL;
19199   PyObject *__pyx_v_dst_type = NULL;
19200   PyObject *__pyx_r = NULL;
19201   __Pyx_RefNannyDeclarations
19202   PyObject *__pyx_t_1 = NULL;
19203   int __pyx_t_2;
19204   int __pyx_t_3;
19205   int __pyx_t_4;
19206   Py_ssize_t __pyx_t_5;
19207   PyObject *__pyx_t_6 = NULL;
19208   long __pyx_t_7;
19209   __Pyx_memviewslice __pyx_t_8;
19210   Py_ssize_t __pyx_t_9;
19211   int __pyx_t_10;
19212   int __pyx_t_11;
19213   PyObject *__pyx_t_12 = NULL;
19214   PyObject *__pyx_t_13 = NULL;
19215   PyObject *__pyx_t_14 = NULL;
19216   Py_ssize_t __pyx_t_15;
19217   Py_ssize_t __pyx_t_16;
19218   Py_ssize_t __pyx_t_17;
19219   int __pyx_t_18;
19220   __Pyx_RefNannySetupContext("morton_qsort_iterative", 0);
19221   __Pyx_INCREF(__pyx_v_kwargs);
19222   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 818, __pyx_L1_error)
19223   __Pyx_GOTREF(__pyx_t_1);
19224   __Pyx_INCREF(Py_None);
19225   __Pyx_GIVEREF(Py_None);
19226   PyList_SET_ITEM(__pyx_t_1, 0, Py_None);
19227   __pyx_v_dest_sig = ((PyObject*)__pyx_t_1);
19228   __pyx_t_1 = 0;
19229   __pyx_t_3 = (__pyx_v_kwargs != Py_None);
19230   __pyx_t_4 = (__pyx_t_3 != 0);
19231   if (__pyx_t_4) {
19232   } else {
19233     __pyx_t_2 = __pyx_t_4;
19234     goto __pyx_L4_bool_binop_done;
19235   }
19236   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_kwargs); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 818, __pyx_L1_error)
19237   __pyx_t_3 = ((!__pyx_t_4) != 0);
19238   __pyx_t_2 = __pyx_t_3;
19239   __pyx_L4_bool_binop_done:;
19240   if (__pyx_t_2) {
19241     __Pyx_INCREF(Py_None);
19242     __Pyx_DECREF_SET(__pyx_v_kwargs, Py_None);
19243   }
19244   __pyx_t_1 = ((PyObject *)__Pyx_ImportNumPyArrayTypeIfAvailable()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 818, __pyx_L1_error)
19245   __Pyx_GOTREF(__pyx_t_1);
19246   __pyx_v_ndarray = ((PyTypeObject*)__pyx_t_1);
19247   __pyx_t_1 = 0;
19248   __pyx_v_itemsize = -1L;
19249   if (unlikely(__pyx_v_args == Py_None)) {
19250     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
19251     __PYX_ERR(1, 818, __pyx_L1_error)
19252   }
19253   __pyx_t_5 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 818, __pyx_L1_error)
19254   __pyx_t_2 = ((0 < __pyx_t_5) != 0);
19255   if (__pyx_t_2) {
19256     if (unlikely(__pyx_v_args == Py_None)) {
19257       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
19258       __PYX_ERR(1, 818, __pyx_L1_error)
19259     }
19260     __pyx_t_1 = PyTuple_GET_ITEM(((PyObject*)__pyx_v_args), 0);
19261     __Pyx_INCREF(__pyx_t_1);
19262     __pyx_v_arg = __pyx_t_1;
19263     __pyx_t_1 = 0;
19264     goto __pyx_L6;
19265   }
19266   __pyx_t_3 = (__pyx_v_kwargs != Py_None);
19267   __pyx_t_4 = (__pyx_t_3 != 0);
19268   if (__pyx_t_4) {
19269   } else {
19270     __pyx_t_2 = __pyx_t_4;
19271     goto __pyx_L7_bool_binop_done;
19272   }
19273   if (unlikely(__pyx_v_kwargs == Py_None)) {
19274     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
19275     __PYX_ERR(1, 818, __pyx_L1_error)
19276   }
19277   __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_pos, ((PyObject*)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 818, __pyx_L1_error)
19278   __pyx_t_3 = (__pyx_t_4 != 0);
19279   __pyx_t_2 = __pyx_t_3;
19280   __pyx_L7_bool_binop_done:;
19281   if (__pyx_t_2) {
19282     if (unlikely(__pyx_v_kwargs == Py_None)) {
19283       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
19284       __PYX_ERR(1, 818, __pyx_L1_error)
19285     }
19286     __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_kwargs), __pyx_n_s_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 818, __pyx_L1_error)
19287     __Pyx_GOTREF(__pyx_t_1);
19288     __pyx_v_arg = __pyx_t_1;
19289     __pyx_t_1 = 0;
19290     goto __pyx_L6;
19291   }
19292   /*else*/ {
19293     if (unlikely(__pyx_v_args == Py_None)) {
19294       PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
19295       __PYX_ERR(1, 818, __pyx_L1_error)
19296     }
19297     __pyx_t_5 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 818, __pyx_L1_error)
19298     __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 818, __pyx_L1_error)
19299     __Pyx_GOTREF(__pyx_t_1);
19300     __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 818, __pyx_L1_error)
19301     __Pyx_GOTREF(__pyx_t_6);
19302     __Pyx_INCREF(__pyx_int_4);
19303     __Pyx_GIVEREF(__pyx_int_4);
19304     PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_4);
19305     __Pyx_INCREF(__pyx_n_s_s);
19306     __Pyx_GIVEREF(__pyx_n_s_s);
19307     PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_n_s_s);
19308     __Pyx_GIVEREF(__pyx_t_1);
19309     PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1);
19310     __pyx_t_1 = 0;
19311     __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Expected_at_least_d_argument_s_g, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 818, __pyx_L1_error)
19312     __Pyx_GOTREF(__pyx_t_1);
19313     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
19314     __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 818, __pyx_L1_error)
19315     __Pyx_GOTREF(__pyx_t_6);
19316     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19317     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
19318     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
19319     __PYX_ERR(1, 818, __pyx_L1_error)
19320   }
19321   __pyx_L6:;
19322   while (1) {
19323     __pyx_t_2 = (__pyx_v_ndarray != ((PyTypeObject*)Py_None));
19324     __pyx_t_3 = (__pyx_t_2 != 0);
19325     if (__pyx_t_3) {
19326       __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_arg, __pyx_v_ndarray);
19327       __pyx_t_2 = (__pyx_t_3 != 0);
19328       if (__pyx_t_2) {
19329         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 818, __pyx_L1_error)
19330         __Pyx_GOTREF(__pyx_t_6);
19331         __pyx_v_dtype = __pyx_t_6;
19332         __pyx_t_6 = 0;
19333         goto __pyx_L12;
19334       }
19335       __pyx_t_2 = __pyx_memoryview_check(__pyx_v_arg);
19336       __pyx_t_3 = (__pyx_t_2 != 0);
19337       if (__pyx_t_3) {
19338         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_base); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 818, __pyx_L1_error)
19339         __Pyx_GOTREF(__pyx_t_6);
19340         __pyx_v_arg_base = __pyx_t_6;
19341         __pyx_t_6 = 0;
19342         __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_arg_base, __pyx_v_ndarray);
19343         __pyx_t_2 = (__pyx_t_3 != 0);
19344         if (__pyx_t_2) {
19345           __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg_base, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 818, __pyx_L1_error)
19346           __Pyx_GOTREF(__pyx_t_6);
19347           __pyx_v_dtype = __pyx_t_6;
19348           __pyx_t_6 = 0;
19349           goto __pyx_L13;
19350         }
19351         /*else*/ {
19352           __Pyx_INCREF(Py_None);
19353           __pyx_v_dtype = Py_None;
19354         }
19355         __pyx_L13:;
19356         goto __pyx_L12;
19357       }
19358       /*else*/ {
19359         __Pyx_INCREF(Py_None);
19360         __pyx_v_dtype = Py_None;
19361       }
19362       __pyx_L12:;
19363       __pyx_v_itemsize = -1L;
19364       __pyx_t_2 = (__pyx_v_dtype != Py_None);
19365       __pyx_t_3 = (__pyx_t_2 != 0);
19366       if (__pyx_t_3) {
19367         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 818, __pyx_L1_error)
19368         __Pyx_GOTREF(__pyx_t_6);
19369         __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 818, __pyx_L1_error)
19370         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
19371         __pyx_v_itemsize = __pyx_t_5;
19372         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 818, __pyx_L1_error)
19373         __Pyx_GOTREF(__pyx_t_6);
19374         __pyx_t_7 = __Pyx_PyObject_Ord(__pyx_t_6); if (unlikely(__pyx_t_7 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(1, 818, __pyx_L1_error)
19375         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
19376         __pyx_v_kind = __pyx_t_7;
19377         __pyx_v_dtype_signed = (__pyx_v_kind == 'i');
19378         switch (__pyx_v_kind) {
19379           case 'i':
19380           case 'u':
19381           break;
19382           case 'f':
19383           __pyx_t_2 = (((sizeof(float)) == __pyx_v_itemsize) != 0);
19384           if (__pyx_t_2) {
19385           } else {
19386             __pyx_t_3 = __pyx_t_2;
19387             goto __pyx_L16_bool_binop_done;
19388           }
19389           __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 818, __pyx_L1_error)
19390           __Pyx_GOTREF(__pyx_t_6);
19391           __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 818, __pyx_L1_error)
19392           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
19393           __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
19394           __pyx_t_3 = __pyx_t_2;
19395           __pyx_L16_bool_binop_done:;
19396           if (__pyx_t_3) {
19397             if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(1, 818, __pyx_L1_error)
19398             goto __pyx_L10_break;
19399           }
19400           __pyx_t_2 = (((sizeof(double)) == __pyx_v_itemsize) != 0);
19401           if (__pyx_t_2) {
19402           } else {
19403             __pyx_t_3 = __pyx_t_2;
19404             goto __pyx_L19_bool_binop_done;
19405           }
19406           __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 818, __pyx_L1_error)
19407           __Pyx_GOTREF(__pyx_t_6);
19408           __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 818, __pyx_L1_error)
19409           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
19410           __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
19411           __pyx_t_3 = __pyx_t_2;
19412           __pyx_L19_bool_binop_done:;
19413           if (__pyx_t_3) {
19414             if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_double, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(1, 818, __pyx_L1_error)
19415             goto __pyx_L10_break;
19416           }
19417           break;
19418           case 'c':
19419           break;
19420           case 'O':
19421           break;
19422           default: break;
19423         }
19424       }
19425     }
19426     __pyx_t_2 = ((__pyx_v_itemsize == -1L) != 0);
19427     if (!__pyx_t_2) {
19428     } else {
19429       __pyx_t_3 = __pyx_t_2;
19430       goto __pyx_L22_bool_binop_done;
19431     }
19432     __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(float))) != 0);
19433     __pyx_t_3 = __pyx_t_2;
19434     __pyx_L22_bool_binop_done:;
19435     if (__pyx_t_3) {
19436       __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_v_arg, 0);
19437       __pyx_v_memslice = __pyx_t_8;
19438       __pyx_t_3 = (__pyx_v_memslice.memview != 0);
19439       if (__pyx_t_3) {
19440         __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1);
19441         if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(1, 818, __pyx_L1_error)
19442         goto __pyx_L10_break;
19443       }
19444       /*else*/ {
19445         PyErr_Clear();
19446       }
19447     }
19448     __pyx_t_2 = ((__pyx_v_itemsize == -1L) != 0);
19449     if (!__pyx_t_2) {
19450     } else {
19451       __pyx_t_3 = __pyx_t_2;
19452       goto __pyx_L26_bool_binop_done;
19453     }
19454     __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(double))) != 0);
19455     __pyx_t_3 = __pyx_t_2;
19456     __pyx_L26_bool_binop_done:;
19457     if (__pyx_t_3) {
19458       __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_v_arg, 0);
19459       __pyx_v_memslice = __pyx_t_8;
19460       __pyx_t_3 = (__pyx_v_memslice.memview != 0);
19461       if (__pyx_t_3) {
19462         __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1);
19463         if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_double, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(1, 818, __pyx_L1_error)
19464         goto __pyx_L10_break;
19465       }
19466       /*else*/ {
19467         PyErr_Clear();
19468       }
19469     }
19470     if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, Py_None, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(1, 818, __pyx_L1_error)
19471     goto __pyx_L10_break;
19472   }
19473   __pyx_L10_break:;
19474   __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 818, __pyx_L1_error)
19475   __Pyx_GOTREF(__pyx_t_6);
19476   __pyx_v_candidates = ((PyObject*)__pyx_t_6);
19477   __pyx_t_6 = 0;
19478   __pyx_t_5 = 0;
19479   if (unlikely(__pyx_v_signatures == Py_None)) {
19480     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
19481     __PYX_ERR(1, 818, __pyx_L1_error)
19482   }
19483   __pyx_t_1 = __Pyx_dict_iterator(((PyObject*)__pyx_v_signatures), 1, ((PyObject *)NULL), (&__pyx_t_9), (&__pyx_t_10)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 818, __pyx_L1_error)
19484   __Pyx_GOTREF(__pyx_t_1);
19485   __Pyx_XDECREF(__pyx_t_6);
19486   __pyx_t_6 = __pyx_t_1;
19487   __pyx_t_1 = 0;
19488   while (1) {
19489     __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_9, &__pyx_t_5, &__pyx_t_1, NULL, NULL, __pyx_t_10);
19490     if (unlikely(__pyx_t_11 == 0)) break;
19491     if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(1, 818, __pyx_L1_error)
19492     __Pyx_GOTREF(__pyx_t_1);
19493     __Pyx_XDECREF_SET(__pyx_v_sig, __pyx_t_1);
19494     __pyx_t_1 = 0;
19495     __pyx_v_match_found = 0;
19496     __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_sig, __pyx_n_s_strip); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 818, __pyx_L1_error)
19497     __Pyx_GOTREF(__pyx_t_13);
19498     __pyx_t_14 = NULL;
19499     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
19500       __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_13);
19501       if (likely(__pyx_t_14)) {
19502         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
19503         __Pyx_INCREF(__pyx_t_14);
19504         __Pyx_INCREF(function);
19505         __Pyx_DECREF_SET(__pyx_t_13, function);
19506       }
19507     }
19508     __pyx_t_12 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_14, __pyx_kp_s__5) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_kp_s__5);
19509     __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
19510     if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 818, __pyx_L1_error)
19511     __Pyx_GOTREF(__pyx_t_12);
19512     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
19513     __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_split); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 818, __pyx_L1_error)
19514     __Pyx_GOTREF(__pyx_t_13);
19515     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
19516     __pyx_t_12 = NULL;
19517     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
19518       __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13);
19519       if (likely(__pyx_t_12)) {
19520         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
19521         __Pyx_INCREF(__pyx_t_12);
19522         __Pyx_INCREF(function);
19523         __Pyx_DECREF_SET(__pyx_t_13, function);
19524       }
19525     }
19526     __pyx_t_1 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_12, __pyx_kp_s__6) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_kp_s__6);
19527     __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
19528     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 818, __pyx_L1_error)
19529     __Pyx_GOTREF(__pyx_t_1);
19530     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
19531     __Pyx_XDECREF_SET(__pyx_v_src_sig, __pyx_t_1);
19532     __pyx_t_1 = 0;
19533     __pyx_t_15 = PyList_GET_SIZE(__pyx_v_dest_sig); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(1, 818, __pyx_L1_error)
19534     __pyx_t_16 = __pyx_t_15;
19535     for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
19536       __pyx_v_i = __pyx_t_17;
19537       __pyx_t_1 = PyList_GET_ITEM(__pyx_v_dest_sig, __pyx_v_i);
19538       __Pyx_INCREF(__pyx_t_1);
19539       __Pyx_XDECREF_SET(__pyx_v_dst_type, __pyx_t_1);
19540       __pyx_t_1 = 0;
19541       __pyx_t_3 = (__pyx_v_dst_type != Py_None);
19542       __pyx_t_2 = (__pyx_t_3 != 0);
19543       if (__pyx_t_2) {
19544         __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_src_sig, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 818, __pyx_L1_error)
19545         __Pyx_GOTREF(__pyx_t_1);
19546         __pyx_t_13 = PyObject_RichCompare(__pyx_t_1, __pyx_v_dst_type, Py_EQ); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 818, __pyx_L1_error)
19547         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19548         __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 818, __pyx_L1_error)
19549         __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
19550         if (__pyx_t_2) {
19551           __pyx_v_match_found = 1;
19552           goto __pyx_L34;
19553         }
19554         /*else*/ {
19555           __pyx_v_match_found = 0;
19556           goto __pyx_L32_break;
19557         }
19558         __pyx_L34:;
19559       }
19560     }
19561     __pyx_L32_break:;
19562     __pyx_t_2 = (__pyx_v_match_found != 0);
19563     if (__pyx_t_2) {
19564       __pyx_t_18 = __Pyx_PyList_Append(__pyx_v_candidates, __pyx_v_sig); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(1, 818, __pyx_L1_error)
19565     }
19566   }
19567   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
19568   __pyx_t_2 = (PyList_GET_SIZE(__pyx_v_candidates) != 0);
19569   __pyx_t_3 = ((!__pyx_t_2) != 0);
19570   if (__pyx_t_3) {
19571     __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 818, __pyx_L1_error)
19572     __Pyx_GOTREF(__pyx_t_6);
19573     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
19574     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
19575     __PYX_ERR(1, 818, __pyx_L1_error)
19576   }
19577   __pyx_t_9 = PyList_GET_SIZE(__pyx_v_candidates); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 818, __pyx_L1_error)
19578   __pyx_t_3 = ((__pyx_t_9 > 1) != 0);
19579   if (__pyx_t_3) {
19580     __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 818, __pyx_L1_error)
19581     __Pyx_GOTREF(__pyx_t_6);
19582     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
19583     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
19584     __PYX_ERR(1, 818, __pyx_L1_error)
19585   }
19586   /*else*/ {
19587     __Pyx_XDECREF(__pyx_r);
19588     if (unlikely(__pyx_v_signatures == Py_None)) {
19589       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
19590       __PYX_ERR(1, 818, __pyx_L1_error)
19591     }
19592     __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_signatures), PyList_GET_ITEM(__pyx_v_candidates, 0)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 818, __pyx_L1_error)
19593     __Pyx_GOTREF(__pyx_t_6);
19594     __pyx_r = __pyx_t_6;
19595     __pyx_t_6 = 0;
19596     goto __pyx_L0;
19597   }
19598 
19599   /* function exit code */
19600   __pyx_L1_error:;
19601   __Pyx_XDECREF(__pyx_t_1);
19602   __Pyx_XDECREF(__pyx_t_6);
19603   __Pyx_XDECREF(__pyx_t_12);
19604   __Pyx_XDECREF(__pyx_t_13);
19605   __Pyx_XDECREF(__pyx_t_14);
19606   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename);
19607   __pyx_r = NULL;
19608   __pyx_L0:;
19609   __Pyx_XDECREF(__pyx_v_dest_sig);
19610   __Pyx_XDECREF(__pyx_v_ndarray);
19611   __Pyx_XDECREF(__pyx_v_arg);
19612   __Pyx_XDECREF(__pyx_v_dtype);
19613   __Pyx_XDECREF(__pyx_v_arg_base);
19614   __Pyx_XDECREF(__pyx_v_candidates);
19615   __Pyx_XDECREF(__pyx_v_sig);
19616   __Pyx_XDECREF(__pyx_v_src_sig);
19617   __Pyx_XDECREF(__pyx_v_dst_type);
19618   __Pyx_XDECREF(__pyx_v_kwargs);
19619   __Pyx_XGIVEREF(__pyx_r);
19620   __Pyx_RefNannyFinishContext();
19621   return __pyx_r;
19622 }
19623 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_132__defaults__(CYTHON_UNUSED PyObject * __pyx_self)19624 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_132__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
19625   PyObject *__pyx_r = NULL;
19626   __Pyx_RefNannyDeclarations
19627   PyObject *__pyx_t_1 = NULL;
19628   PyObject *__pyx_t_2 = NULL;
19629   __Pyx_RefNannySetupContext("__defaults__", 0);
19630   __Pyx_XDECREF(__pyx_r);
19631   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 818, __pyx_L1_error)
19632   __Pyx_GOTREF(__pyx_t_1);
19633   __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults10, __pyx_self)->__pyx_arg_use_loop);
19634   __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults10, __pyx_self)->__pyx_arg_use_loop);
19635   PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults10, __pyx_self)->__pyx_arg_use_loop);
19636   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 818, __pyx_L1_error)
19637   __Pyx_GOTREF(__pyx_t_2);
19638   __Pyx_GIVEREF(__pyx_t_1);
19639   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
19640   __Pyx_INCREF(Py_None);
19641   __Pyx_GIVEREF(Py_None);
19642   PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
19643   __pyx_t_1 = 0;
19644   __pyx_r = __pyx_t_2;
19645   __pyx_t_2 = 0;
19646   goto __pyx_L0;
19647 
19648   /* function exit code */
19649   __pyx_L1_error:;
19650   __Pyx_XDECREF(__pyx_t_1);
19651   __Pyx_XDECREF(__pyx_t_2);
19652   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
19653   __pyx_r = NULL;
19654   __pyx_L0:;
19655   __Pyx_XGIVEREF(__pyx_r);
19656   __Pyx_RefNannyFinishContext();
19657   return __pyx_r;
19658 }
19659 
19660 /* Python wrapper */
19661 static PyObject *__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_89morton_qsort_iterative(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
19662 static PyMethodDef __pyx_fuse_0__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_89morton_qsort_iterative = {"__pyx_fuse_0morton_qsort_iterative", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_89morton_qsort_iterative, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_89morton_qsort_iterative(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)19663 static PyObject *__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_89morton_qsort_iterative(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
19664   PyArrayObject *__pyx_v_pos = 0;
19665   __pyx_t_5numpy_int64_t __pyx_v_l;
19666   __pyx_t_5numpy_int64_t __pyx_v_h;
19667   PyArrayObject *__pyx_v_ind = 0;
19668   PyObject *__pyx_v_use_loop = 0;
19669   PyObject *__pyx_r = 0;
19670   __Pyx_RefNannyDeclarations
19671   __Pyx_RefNannySetupContext("morton_qsort_iterative (wrapper)", 0);
19672   {
19673     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_l,&__pyx_n_s_h,&__pyx_n_s_ind,&__pyx_n_s_use_loop,0};
19674     PyObject* values[5] = {0,0,0,0,0};
19675     __pyx_defaults10 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults10, __pyx_self);
19676     values[4] = __pyx_dynamic_args->__pyx_arg_use_loop;
19677     if (unlikely(__pyx_kwds)) {
19678       Py_ssize_t kw_args;
19679       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19680       switch (pos_args) {
19681         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19682         CYTHON_FALLTHROUGH;
19683         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19684         CYTHON_FALLTHROUGH;
19685         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19686         CYTHON_FALLTHROUGH;
19687         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19688         CYTHON_FALLTHROUGH;
19689         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19690         CYTHON_FALLTHROUGH;
19691         case  0: break;
19692         default: goto __pyx_L5_argtuple_error;
19693       }
19694       kw_args = PyDict_Size(__pyx_kwds);
19695       switch (pos_args) {
19696         case  0:
19697         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
19698         else goto __pyx_L5_argtuple_error;
19699         CYTHON_FALLTHROUGH;
19700         case  1:
19701         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_l)) != 0)) kw_args--;
19702         else {
19703           __Pyx_RaiseArgtupleInvalid("morton_qsort_iterative", 0, 4, 5, 1); __PYX_ERR(1, 818, __pyx_L3_error)
19704         }
19705         CYTHON_FALLTHROUGH;
19706         case  2:
19707         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
19708         else {
19709           __Pyx_RaiseArgtupleInvalid("morton_qsort_iterative", 0, 4, 5, 2); __PYX_ERR(1, 818, __pyx_L3_error)
19710         }
19711         CYTHON_FALLTHROUGH;
19712         case  3:
19713         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind)) != 0)) kw_args--;
19714         else {
19715           __Pyx_RaiseArgtupleInvalid("morton_qsort_iterative", 0, 4, 5, 3); __PYX_ERR(1, 818, __pyx_L3_error)
19716         }
19717         CYTHON_FALLTHROUGH;
19718         case  4:
19719         if (kw_args > 0) {
19720           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_loop);
19721           if (value) { values[4] = value; kw_args--; }
19722         }
19723       }
19724       if (unlikely(kw_args > 0)) {
19725         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "morton_qsort_iterative") < 0)) __PYX_ERR(1, 818, __pyx_L3_error)
19726       }
19727     } else {
19728       switch (PyTuple_GET_SIZE(__pyx_args)) {
19729         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19730         CYTHON_FALLTHROUGH;
19731         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19732         values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19733         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19734         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19735         break;
19736         default: goto __pyx_L5_argtuple_error;
19737       }
19738     }
19739     __pyx_v_pos = ((PyArrayObject *)values[0]);
19740     __pyx_v_l = __Pyx_PyInt_As_npy_int64(values[1]); if (unlikely((__pyx_v_l == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 819, __pyx_L3_error)
19741     __pyx_v_h = __Pyx_PyInt_As_npy_int64(values[2]); if (unlikely((__pyx_v_h == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 819, __pyx_L3_error)
19742     __pyx_v_ind = ((PyArrayObject *)values[3]);
19743     __pyx_v_use_loop = values[4];
19744   }
19745   goto __pyx_L4_argument_unpacking_done;
19746   __pyx_L5_argtuple_error:;
19747   __Pyx_RaiseArgtupleInvalid("morton_qsort_iterative", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 818, __pyx_L3_error)
19748   __pyx_L3_error:;
19749   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_qsort_iterative", __pyx_clineno, __pyx_lineno, __pyx_filename);
19750   __Pyx_RefNannyFinishContext();
19751   return NULL;
19752   __pyx_L4_argument_unpacking_done:;
19753   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 1, "pos", 0))) __PYX_ERR(1, 818, __pyx_L1_error)
19754   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ind), __pyx_ptype_5numpy_ndarray, 1, "ind", 0))) __PYX_ERR(1, 820, __pyx_L1_error)
19755   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_88morton_qsort_iterative(__pyx_self, __pyx_v_pos, __pyx_v_l, __pyx_v_h, __pyx_v_ind, __pyx_v_use_loop);
19756 
19757   /* function exit code */
19758   goto __pyx_L0;
19759   __pyx_L1_error:;
19760   __pyx_r = NULL;
19761   __pyx_L0:;
19762   __Pyx_RefNannyFinishContext();
19763   return __pyx_r;
19764 }
19765 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_88morton_qsort_iterative(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_pos,__pyx_t_5numpy_int64_t __pyx_v_l,__pyx_t_5numpy_int64_t __pyx_v_h,PyArrayObject * __pyx_v_ind,PyObject * __pyx_v_use_loop)19766 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_88morton_qsort_iterative(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_int64_t __pyx_v_l, __pyx_t_5numpy_int64_t __pyx_v_h, PyArrayObject *__pyx_v_ind, PyObject *__pyx_v_use_loop) {
19767   PyArrayObject *__pyx_v_stack = 0;
19768   __pyx_t_5numpy_int64_t __pyx_v_top;
19769   __pyx_t_5numpy_int64_t __pyx_v_p;
19770   __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
19771   __Pyx_Buffer __pyx_pybuffer_ind;
19772   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos;
19773   __Pyx_Buffer __pyx_pybuffer_pos;
19774   __Pyx_LocalBuf_ND __pyx_pybuffernd_stack;
19775   __Pyx_Buffer __pyx_pybuffer_stack;
19776   PyObject *__pyx_r = NULL;
19777   __Pyx_RefNannyDeclarations
19778   PyObject *__pyx_t_1 = NULL;
19779   PyObject *__pyx_t_2 = NULL;
19780   PyObject *__pyx_t_3 = NULL;
19781   PyObject *__pyx_t_4 = NULL;
19782   PyObject *__pyx_t_5 = NULL;
19783   PyArrayObject *__pyx_t_6 = NULL;
19784   __pyx_t_5numpy_int64_t __pyx_t_7;
19785   __pyx_t_5numpy_int64_t __pyx_t_8;
19786   int __pyx_t_9;
19787   __pyx_t_5numpy_int64_t __pyx_t_10;
19788   __pyx_t_5numpy_int64_t __pyx_t_11;
19789   __pyx_t_5numpy_int64_t __pyx_t_12;
19790   __pyx_t_5numpy_int64_t __pyx_t_13;
19791   __pyx_t_5numpy_int64_t __pyx_t_14;
19792   __pyx_t_5numpy_int64_t __pyx_t_15;
19793   __Pyx_RefNannySetupContext("__pyx_fuse_0morton_qsort_iterative", 0);
19794   __pyx_pybuffer_stack.pybuffer.buf = NULL;
19795   __pyx_pybuffer_stack.refcount = 0;
19796   __pyx_pybuffernd_stack.data = NULL;
19797   __pyx_pybuffernd_stack.rcbuffer = &__pyx_pybuffer_stack;
19798   __pyx_pybuffer_pos.pybuffer.buf = NULL;
19799   __pyx_pybuffer_pos.refcount = 0;
19800   __pyx_pybuffernd_pos.data = NULL;
19801   __pyx_pybuffernd_pos.rcbuffer = &__pyx_pybuffer_pos;
19802   __pyx_pybuffer_ind.pybuffer.buf = NULL;
19803   __pyx_pybuffer_ind.refcount = 0;
19804   __pyx_pybuffernd_ind.data = NULL;
19805   __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;
19806   {
19807     __Pyx_BufFmt_StackElem __pyx_stack[1];
19808     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_float, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(1, 818, __pyx_L1_error)
19809   }
19810   __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1];
19811   {
19812     __Pyx_BufFmt_StackElem __pyx_stack[1];
19813     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 818, __pyx_L1_error)
19814   }
19815   __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
19816 
19817   /* "yt/utilities/lib/geometry_utils.pyx":824
19818  *     # http://www.geeksforgeeks.org/iterative-quick-sort/
19819  *     # Auxillary stack
19820  *     cdef np.ndarray[np.int64_t, ndim=1] stack = np.zeros(h-l+1, dtype=np.int64)             # <<<<<<<<<<<<<<
19821  *     cdef np.int64_t top = -1
19822  *     cdef np.int64_t p
19823  */
19824   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 824, __pyx_L1_error)
19825   __Pyx_GOTREF(__pyx_t_1);
19826   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 824, __pyx_L1_error)
19827   __Pyx_GOTREF(__pyx_t_2);
19828   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19829   __pyx_t_1 = __Pyx_PyInt_From_npy_int64(((__pyx_v_h - __pyx_v_l) + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 824, __pyx_L1_error)
19830   __Pyx_GOTREF(__pyx_t_1);
19831   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 824, __pyx_L1_error)
19832   __Pyx_GOTREF(__pyx_t_3);
19833   __Pyx_GIVEREF(__pyx_t_1);
19834   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
19835   __pyx_t_1 = 0;
19836   __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 824, __pyx_L1_error)
19837   __Pyx_GOTREF(__pyx_t_1);
19838   __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 824, __pyx_L1_error)
19839   __Pyx_GOTREF(__pyx_t_4);
19840   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int64); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 824, __pyx_L1_error)
19841   __Pyx_GOTREF(__pyx_t_5);
19842   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19843   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(1, 824, __pyx_L1_error)
19844   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
19845   __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 824, __pyx_L1_error)
19846   __Pyx_GOTREF(__pyx_t_5);
19847   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19848   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19849   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19850   if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 824, __pyx_L1_error)
19851   __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
19852   {
19853     __Pyx_BufFmt_StackElem __pyx_stack[1];
19854     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_stack.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
19855       __pyx_v_stack = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_stack.rcbuffer->pybuffer.buf = NULL;
19856       __PYX_ERR(1, 824, __pyx_L1_error)
19857     } else {__pyx_pybuffernd_stack.diminfo[0].strides = __pyx_pybuffernd_stack.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_stack.diminfo[0].shape = __pyx_pybuffernd_stack.rcbuffer->pybuffer.shape[0];
19858     }
19859   }
19860   __pyx_t_6 = 0;
19861   __pyx_v_stack = ((PyArrayObject *)__pyx_t_5);
19862   __pyx_t_5 = 0;
19863 
19864   /* "yt/utilities/lib/geometry_utils.pyx":825
19865  *     # Auxillary stack
19866  *     cdef np.ndarray[np.int64_t, ndim=1] stack = np.zeros(h-l+1, dtype=np.int64)
19867  *     cdef np.int64_t top = -1             # <<<<<<<<<<<<<<
19868  *     cdef np.int64_t p
19869  *     top+=1
19870  */
19871   __pyx_v_top = -1LL;
19872 
19873   /* "yt/utilities/lib/geometry_utils.pyx":827
19874  *     cdef np.int64_t top = -1
19875  *     cdef np.int64_t p
19876  *     top+=1             # <<<<<<<<<<<<<<
19877  *     stack[top] = l
19878  *     top+=1
19879  */
19880   __pyx_v_top = (__pyx_v_top + 1);
19881 
19882   /* "yt/utilities/lib/geometry_utils.pyx":828
19883  *     cdef np.int64_t p
19884  *     top+=1
19885  *     stack[top] = l             # <<<<<<<<<<<<<<
19886  *     top+=1
19887  *     stack[top] = h
19888  */
19889   __pyx_t_7 = __pyx_v_top;
19890   *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_stack.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_stack.diminfo[0].strides) = __pyx_v_l;
19891 
19892   /* "yt/utilities/lib/geometry_utils.pyx":829
19893  *     top+=1
19894  *     stack[top] = l
19895  *     top+=1             # <<<<<<<<<<<<<<
19896  *     stack[top] = h
19897  *     # Pop from stack until it's empty
19898  */
19899   __pyx_v_top = (__pyx_v_top + 1);
19900 
19901   /* "yt/utilities/lib/geometry_utils.pyx":830
19902  *     stack[top] = l
19903  *     top+=1
19904  *     stack[top] = h             # <<<<<<<<<<<<<<
19905  *     # Pop from stack until it's empty
19906  *     while (top >= 0):
19907  */
19908   __pyx_t_8 = __pyx_v_top;
19909   *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_stack.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_stack.diminfo[0].strides) = __pyx_v_h;
19910 
19911   /* "yt/utilities/lib/geometry_utils.pyx":832
19912  *     stack[top] = h
19913  *     # Pop from stack until it's empty
19914  *     while (top >= 0):             # <<<<<<<<<<<<<<
19915  *         # Get next set
19916  *         h = stack[top]
19917  */
19918   while (1) {
19919     __pyx_t_9 = ((__pyx_v_top >= 0) != 0);
19920     if (!__pyx_t_9) break;
19921 
19922     /* "yt/utilities/lib/geometry_utils.pyx":834
19923  *     while (top >= 0):
19924  *         # Get next set
19925  *         h = stack[top]             # <<<<<<<<<<<<<<
19926  *         top-=1
19927  *         l = stack[top]
19928  */
19929     __pyx_t_10 = __pyx_v_top;
19930     __pyx_v_h = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_stack.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_stack.diminfo[0].strides));
19931 
19932     /* "yt/utilities/lib/geometry_utils.pyx":835
19933  *         # Get next set
19934  *         h = stack[top]
19935  *         top-=1             # <<<<<<<<<<<<<<
19936  *         l = stack[top]
19937  *         top-=1
19938  */
19939     __pyx_v_top = (__pyx_v_top - 1);
19940 
19941     /* "yt/utilities/lib/geometry_utils.pyx":836
19942  *         h = stack[top]
19943  *         top-=1
19944  *         l = stack[top]             # <<<<<<<<<<<<<<
19945  *         top-=1
19946  *         # Partition
19947  */
19948     __pyx_t_11 = __pyx_v_top;
19949     __pyx_v_l = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_stack.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_stack.diminfo[0].strides));
19950 
19951     /* "yt/utilities/lib/geometry_utils.pyx":837
19952  *         top-=1
19953  *         l = stack[top]
19954  *         top-=1             # <<<<<<<<<<<<<<
19955  *         # Partition
19956  *         p = morton_qsort_partition(pos, l, h, ind, use_loop=use_loop)
19957  */
19958     __pyx_v_top = (__pyx_v_top - 1);
19959 
19960     /* "yt/utilities/lib/geometry_utils.pyx":839
19961  *         top-=1
19962  *         # Partition
19963  *         p = morton_qsort_partition(pos, l, h, ind, use_loop=use_loop)             # <<<<<<<<<<<<<<
19964  *         # Add left partition to the stack
19965  *         if (p-1) > l:
19966  */
19967     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_morton_qsort_partition); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 839, __pyx_L1_error)
19968     __Pyx_GOTREF(__pyx_t_5);
19969     __pyx_t_1 = __Pyx_PyInt_From_npy_int64(__pyx_v_l); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 839, __pyx_L1_error)
19970     __Pyx_GOTREF(__pyx_t_1);
19971     __pyx_t_3 = __Pyx_PyInt_From_npy_int64(__pyx_v_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 839, __pyx_L1_error)
19972     __Pyx_GOTREF(__pyx_t_3);
19973     __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 839, __pyx_L1_error)
19974     __Pyx_GOTREF(__pyx_t_2);
19975     __Pyx_INCREF(((PyObject *)__pyx_v_pos));
19976     __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
19977     PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_pos));
19978     __Pyx_GIVEREF(__pyx_t_1);
19979     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
19980     __Pyx_GIVEREF(__pyx_t_3);
19981     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_3);
19982     __Pyx_INCREF(((PyObject *)__pyx_v_ind));
19983     __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
19984     PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_v_ind));
19985     __pyx_t_1 = 0;
19986     __pyx_t_3 = 0;
19987     __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 839, __pyx_L1_error)
19988     __Pyx_GOTREF(__pyx_t_3);
19989     if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_use_loop, __pyx_v_use_loop) < 0) __PYX_ERR(1, 839, __pyx_L1_error)
19990     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 839, __pyx_L1_error)
19991     __Pyx_GOTREF(__pyx_t_1);
19992     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
19993     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19994     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19995     __pyx_t_12 = __Pyx_PyInt_As_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_12 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 839, __pyx_L1_error)
19996     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19997     __pyx_v_p = __pyx_t_12;
19998 
19999     /* "yt/utilities/lib/geometry_utils.pyx":841
20000  *         p = morton_qsort_partition(pos, l, h, ind, use_loop=use_loop)
20001  *         # Add left partition to the stack
20002  *         if (p-1) > l:             # <<<<<<<<<<<<<<
20003  *             top+=1
20004  *             stack[top] = l
20005  */
20006     __pyx_t_9 = (((__pyx_v_p - 1) > __pyx_v_l) != 0);
20007     if (__pyx_t_9) {
20008 
20009       /* "yt/utilities/lib/geometry_utils.pyx":842
20010  *         # Add left partition to the stack
20011  *         if (p-1) > l:
20012  *             top+=1             # <<<<<<<<<<<<<<
20013  *             stack[top] = l
20014  *             top+=1
20015  */
20016       __pyx_v_top = (__pyx_v_top + 1);
20017 
20018       /* "yt/utilities/lib/geometry_utils.pyx":843
20019  *         if (p-1) > l:
20020  *             top+=1
20021  *             stack[top] = l             # <<<<<<<<<<<<<<
20022  *             top+=1
20023  *             stack[top] = p - 1
20024  */
20025       __pyx_t_12 = __pyx_v_top;
20026       *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_stack.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_stack.diminfo[0].strides) = __pyx_v_l;
20027 
20028       /* "yt/utilities/lib/geometry_utils.pyx":844
20029  *             top+=1
20030  *             stack[top] = l
20031  *             top+=1             # <<<<<<<<<<<<<<
20032  *             stack[top] = p - 1
20033  *         # Add right partition to the stack
20034  */
20035       __pyx_v_top = (__pyx_v_top + 1);
20036 
20037       /* "yt/utilities/lib/geometry_utils.pyx":845
20038  *             stack[top] = l
20039  *             top+=1
20040  *             stack[top] = p - 1             # <<<<<<<<<<<<<<
20041  *         # Add right partition to the stack
20042  *         if (p+1) < h:
20043  */
20044       __pyx_t_13 = __pyx_v_top;
20045       *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_stack.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_stack.diminfo[0].strides) = (__pyx_v_p - 1);
20046 
20047       /* "yt/utilities/lib/geometry_utils.pyx":841
20048  *         p = morton_qsort_partition(pos, l, h, ind, use_loop=use_loop)
20049  *         # Add left partition to the stack
20050  *         if (p-1) > l:             # <<<<<<<<<<<<<<
20051  *             top+=1
20052  *             stack[top] = l
20053  */
20054     }
20055 
20056     /* "yt/utilities/lib/geometry_utils.pyx":847
20057  *             stack[top] = p - 1
20058  *         # Add right partition to the stack
20059  *         if (p+1) < h:             # <<<<<<<<<<<<<<
20060  *             top+=1
20061  *             stack[top] = p + 1
20062  */
20063     __pyx_t_9 = (((__pyx_v_p + 1) < __pyx_v_h) != 0);
20064     if (__pyx_t_9) {
20065 
20066       /* "yt/utilities/lib/geometry_utils.pyx":848
20067  *         # Add right partition to the stack
20068  *         if (p+1) < h:
20069  *             top+=1             # <<<<<<<<<<<<<<
20070  *             stack[top] = p + 1
20071  *             top+=1
20072  */
20073       __pyx_v_top = (__pyx_v_top + 1);
20074 
20075       /* "yt/utilities/lib/geometry_utils.pyx":849
20076  *         if (p+1) < h:
20077  *             top+=1
20078  *             stack[top] = p + 1             # <<<<<<<<<<<<<<
20079  *             top+=1
20080  *             stack[top] = h
20081  */
20082       __pyx_t_14 = __pyx_v_top;
20083       *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_stack.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_stack.diminfo[0].strides) = (__pyx_v_p + 1);
20084 
20085       /* "yt/utilities/lib/geometry_utils.pyx":850
20086  *             top+=1
20087  *             stack[top] = p + 1
20088  *             top+=1             # <<<<<<<<<<<<<<
20089  *             stack[top] = h
20090  *
20091  */
20092       __pyx_v_top = (__pyx_v_top + 1);
20093 
20094       /* "yt/utilities/lib/geometry_utils.pyx":851
20095  *             stack[top] = p + 1
20096  *             top+=1
20097  *             stack[top] = h             # <<<<<<<<<<<<<<
20098  *
20099  * @cython.cdivision(True)
20100  */
20101       __pyx_t_15 = __pyx_v_top;
20102       *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_stack.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_stack.diminfo[0].strides) = __pyx_v_h;
20103 
20104       /* "yt/utilities/lib/geometry_utils.pyx":847
20105  *             stack[top] = p - 1
20106  *         # Add right partition to the stack
20107  *         if (p+1) < h:             # <<<<<<<<<<<<<<
20108  *             top+=1
20109  *             stack[top] = p + 1
20110  */
20111     }
20112   }
20113 
20114   /* "yt/utilities/lib/geometry_utils.pyx":818
20115  * @cython.boundscheck(False)
20116  * @cython.wraparound(False)
20117  * def morton_qsort_iterative(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
20118  *                            np.int64_t l, np.int64_t h,
20119  *                            np.ndarray[np.uint64_t, ndim=1] ind,
20120  */
20121 
20122   /* function exit code */
20123   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20124   goto __pyx_L0;
20125   __pyx_L1_error:;
20126   __Pyx_XDECREF(__pyx_t_1);
20127   __Pyx_XDECREF(__pyx_t_2);
20128   __Pyx_XDECREF(__pyx_t_3);
20129   __Pyx_XDECREF(__pyx_t_4);
20130   __Pyx_XDECREF(__pyx_t_5);
20131   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
20132     __Pyx_PyThreadState_declare
20133     __Pyx_PyThreadState_assign
20134     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
20135     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
20136     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
20137     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_stack.rcbuffer->pybuffer);
20138   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
20139   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_qsort_iterative", __pyx_clineno, __pyx_lineno, __pyx_filename);
20140   __pyx_r = NULL;
20141   goto __pyx_L2;
20142   __pyx_L0:;
20143   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
20144   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
20145   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_stack.rcbuffer->pybuffer);
20146   __pyx_L2:;
20147   __Pyx_XDECREF((PyObject *)__pyx_v_stack);
20148   __Pyx_XGIVEREF(__pyx_r);
20149   __Pyx_RefNannyFinishContext();
20150   return __pyx_r;
20151 }
20152 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_134__defaults__(CYTHON_UNUSED PyObject * __pyx_self)20153 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_134__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
20154   PyObject *__pyx_r = NULL;
20155   __Pyx_RefNannyDeclarations
20156   PyObject *__pyx_t_1 = NULL;
20157   PyObject *__pyx_t_2 = NULL;
20158   __Pyx_RefNannySetupContext("__defaults__", 0);
20159   __Pyx_XDECREF(__pyx_r);
20160   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 818, __pyx_L1_error)
20161   __Pyx_GOTREF(__pyx_t_1);
20162   __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults11, __pyx_self)->__pyx_arg_use_loop);
20163   __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults11, __pyx_self)->__pyx_arg_use_loop);
20164   PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults11, __pyx_self)->__pyx_arg_use_loop);
20165   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 818, __pyx_L1_error)
20166   __Pyx_GOTREF(__pyx_t_2);
20167   __Pyx_GIVEREF(__pyx_t_1);
20168   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
20169   __Pyx_INCREF(Py_None);
20170   __Pyx_GIVEREF(Py_None);
20171   PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
20172   __pyx_t_1 = 0;
20173   __pyx_r = __pyx_t_2;
20174   __pyx_t_2 = 0;
20175   goto __pyx_L0;
20176 
20177   /* function exit code */
20178   __pyx_L1_error:;
20179   __Pyx_XDECREF(__pyx_t_1);
20180   __Pyx_XDECREF(__pyx_t_2);
20181   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
20182   __pyx_r = NULL;
20183   __pyx_L0:;
20184   __Pyx_XGIVEREF(__pyx_r);
20185   __Pyx_RefNannyFinishContext();
20186   return __pyx_r;
20187 }
20188 
20189 /* Python wrapper */
20190 static PyObject *__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_91morton_qsort_iterative(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
20191 static PyMethodDef __pyx_fuse_1__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_91morton_qsort_iterative = {"__pyx_fuse_1morton_qsort_iterative", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_91morton_qsort_iterative, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_91morton_qsort_iterative(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)20192 static PyObject *__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_91morton_qsort_iterative(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
20193   PyArrayObject *__pyx_v_pos = 0;
20194   __pyx_t_5numpy_int64_t __pyx_v_l;
20195   __pyx_t_5numpy_int64_t __pyx_v_h;
20196   PyArrayObject *__pyx_v_ind = 0;
20197   PyObject *__pyx_v_use_loop = 0;
20198   PyObject *__pyx_r = 0;
20199   __Pyx_RefNannyDeclarations
20200   __Pyx_RefNannySetupContext("morton_qsort_iterative (wrapper)", 0);
20201   {
20202     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_l,&__pyx_n_s_h,&__pyx_n_s_ind,&__pyx_n_s_use_loop,0};
20203     PyObject* values[5] = {0,0,0,0,0};
20204     __pyx_defaults11 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults11, __pyx_self);
20205     values[4] = __pyx_dynamic_args->__pyx_arg_use_loop;
20206     if (unlikely(__pyx_kwds)) {
20207       Py_ssize_t kw_args;
20208       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
20209       switch (pos_args) {
20210         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
20211         CYTHON_FALLTHROUGH;
20212         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
20213         CYTHON_FALLTHROUGH;
20214         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20215         CYTHON_FALLTHROUGH;
20216         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20217         CYTHON_FALLTHROUGH;
20218         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20219         CYTHON_FALLTHROUGH;
20220         case  0: break;
20221         default: goto __pyx_L5_argtuple_error;
20222       }
20223       kw_args = PyDict_Size(__pyx_kwds);
20224       switch (pos_args) {
20225         case  0:
20226         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
20227         else goto __pyx_L5_argtuple_error;
20228         CYTHON_FALLTHROUGH;
20229         case  1:
20230         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_l)) != 0)) kw_args--;
20231         else {
20232           __Pyx_RaiseArgtupleInvalid("morton_qsort_iterative", 0, 4, 5, 1); __PYX_ERR(1, 818, __pyx_L3_error)
20233         }
20234         CYTHON_FALLTHROUGH;
20235         case  2:
20236         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
20237         else {
20238           __Pyx_RaiseArgtupleInvalid("morton_qsort_iterative", 0, 4, 5, 2); __PYX_ERR(1, 818, __pyx_L3_error)
20239         }
20240         CYTHON_FALLTHROUGH;
20241         case  3:
20242         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind)) != 0)) kw_args--;
20243         else {
20244           __Pyx_RaiseArgtupleInvalid("morton_qsort_iterative", 0, 4, 5, 3); __PYX_ERR(1, 818, __pyx_L3_error)
20245         }
20246         CYTHON_FALLTHROUGH;
20247         case  4:
20248         if (kw_args > 0) {
20249           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_loop);
20250           if (value) { values[4] = value; kw_args--; }
20251         }
20252       }
20253       if (unlikely(kw_args > 0)) {
20254         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "morton_qsort_iterative") < 0)) __PYX_ERR(1, 818, __pyx_L3_error)
20255       }
20256     } else {
20257       switch (PyTuple_GET_SIZE(__pyx_args)) {
20258         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
20259         CYTHON_FALLTHROUGH;
20260         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
20261         values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20262         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20263         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20264         break;
20265         default: goto __pyx_L5_argtuple_error;
20266       }
20267     }
20268     __pyx_v_pos = ((PyArrayObject *)values[0]);
20269     __pyx_v_l = __Pyx_PyInt_As_npy_int64(values[1]); if (unlikely((__pyx_v_l == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 819, __pyx_L3_error)
20270     __pyx_v_h = __Pyx_PyInt_As_npy_int64(values[2]); if (unlikely((__pyx_v_h == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 819, __pyx_L3_error)
20271     __pyx_v_ind = ((PyArrayObject *)values[3]);
20272     __pyx_v_use_loop = values[4];
20273   }
20274   goto __pyx_L4_argument_unpacking_done;
20275   __pyx_L5_argtuple_error:;
20276   __Pyx_RaiseArgtupleInvalid("morton_qsort_iterative", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 818, __pyx_L3_error)
20277   __pyx_L3_error:;
20278   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_qsort_iterative", __pyx_clineno, __pyx_lineno, __pyx_filename);
20279   __Pyx_RefNannyFinishContext();
20280   return NULL;
20281   __pyx_L4_argument_unpacking_done:;
20282   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 1, "pos", 0))) __PYX_ERR(1, 818, __pyx_L1_error)
20283   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ind), __pyx_ptype_5numpy_ndarray, 1, "ind", 0))) __PYX_ERR(1, 820, __pyx_L1_error)
20284   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_90morton_qsort_iterative(__pyx_self, __pyx_v_pos, __pyx_v_l, __pyx_v_h, __pyx_v_ind, __pyx_v_use_loop);
20285 
20286   /* function exit code */
20287   goto __pyx_L0;
20288   __pyx_L1_error:;
20289   __pyx_r = NULL;
20290   __pyx_L0:;
20291   __Pyx_RefNannyFinishContext();
20292   return __pyx_r;
20293 }
20294 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_90morton_qsort_iterative(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_pos,__pyx_t_5numpy_int64_t __pyx_v_l,__pyx_t_5numpy_int64_t __pyx_v_h,PyArrayObject * __pyx_v_ind,PyObject * __pyx_v_use_loop)20295 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_90morton_qsort_iterative(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_int64_t __pyx_v_l, __pyx_t_5numpy_int64_t __pyx_v_h, PyArrayObject *__pyx_v_ind, PyObject *__pyx_v_use_loop) {
20296   PyArrayObject *__pyx_v_stack = 0;
20297   __pyx_t_5numpy_int64_t __pyx_v_top;
20298   __pyx_t_5numpy_int64_t __pyx_v_p;
20299   __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
20300   __Pyx_Buffer __pyx_pybuffer_ind;
20301   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos;
20302   __Pyx_Buffer __pyx_pybuffer_pos;
20303   __Pyx_LocalBuf_ND __pyx_pybuffernd_stack;
20304   __Pyx_Buffer __pyx_pybuffer_stack;
20305   PyObject *__pyx_r = NULL;
20306   __Pyx_RefNannyDeclarations
20307   PyObject *__pyx_t_1 = NULL;
20308   PyObject *__pyx_t_2 = NULL;
20309   PyObject *__pyx_t_3 = NULL;
20310   PyObject *__pyx_t_4 = NULL;
20311   PyObject *__pyx_t_5 = NULL;
20312   PyArrayObject *__pyx_t_6 = NULL;
20313   __pyx_t_5numpy_int64_t __pyx_t_7;
20314   __pyx_t_5numpy_int64_t __pyx_t_8;
20315   int __pyx_t_9;
20316   __pyx_t_5numpy_int64_t __pyx_t_10;
20317   __pyx_t_5numpy_int64_t __pyx_t_11;
20318   __pyx_t_5numpy_int64_t __pyx_t_12;
20319   __pyx_t_5numpy_int64_t __pyx_t_13;
20320   __pyx_t_5numpy_int64_t __pyx_t_14;
20321   __pyx_t_5numpy_int64_t __pyx_t_15;
20322   __Pyx_RefNannySetupContext("__pyx_fuse_1morton_qsort_iterative", 0);
20323   __pyx_pybuffer_stack.pybuffer.buf = NULL;
20324   __pyx_pybuffer_stack.refcount = 0;
20325   __pyx_pybuffernd_stack.data = NULL;
20326   __pyx_pybuffernd_stack.rcbuffer = &__pyx_pybuffer_stack;
20327   __pyx_pybuffer_pos.pybuffer.buf = NULL;
20328   __pyx_pybuffer_pos.refcount = 0;
20329   __pyx_pybuffernd_pos.data = NULL;
20330   __pyx_pybuffernd_pos.rcbuffer = &__pyx_pybuffer_pos;
20331   __pyx_pybuffer_ind.pybuffer.buf = NULL;
20332   __pyx_pybuffer_ind.refcount = 0;
20333   __pyx_pybuffernd_ind.data = NULL;
20334   __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;
20335   {
20336     __Pyx_BufFmt_StackElem __pyx_stack[1];
20337     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(1, 818, __pyx_L1_error)
20338   }
20339   __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1];
20340   {
20341     __Pyx_BufFmt_StackElem __pyx_stack[1];
20342     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 818, __pyx_L1_error)
20343   }
20344   __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
20345 
20346   /* "yt/utilities/lib/geometry_utils.pyx":824
20347  *     # http://www.geeksforgeeks.org/iterative-quick-sort/
20348  *     # Auxillary stack
20349  *     cdef np.ndarray[np.int64_t, ndim=1] stack = np.zeros(h-l+1, dtype=np.int64)             # <<<<<<<<<<<<<<
20350  *     cdef np.int64_t top = -1
20351  *     cdef np.int64_t p
20352  */
20353   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 824, __pyx_L1_error)
20354   __Pyx_GOTREF(__pyx_t_1);
20355   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 824, __pyx_L1_error)
20356   __Pyx_GOTREF(__pyx_t_2);
20357   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20358   __pyx_t_1 = __Pyx_PyInt_From_npy_int64(((__pyx_v_h - __pyx_v_l) + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 824, __pyx_L1_error)
20359   __Pyx_GOTREF(__pyx_t_1);
20360   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 824, __pyx_L1_error)
20361   __Pyx_GOTREF(__pyx_t_3);
20362   __Pyx_GIVEREF(__pyx_t_1);
20363   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
20364   __pyx_t_1 = 0;
20365   __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 824, __pyx_L1_error)
20366   __Pyx_GOTREF(__pyx_t_1);
20367   __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 824, __pyx_L1_error)
20368   __Pyx_GOTREF(__pyx_t_4);
20369   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int64); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 824, __pyx_L1_error)
20370   __Pyx_GOTREF(__pyx_t_5);
20371   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20372   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(1, 824, __pyx_L1_error)
20373   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
20374   __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 824, __pyx_L1_error)
20375   __Pyx_GOTREF(__pyx_t_5);
20376   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20377   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20378   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20379   if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 824, __pyx_L1_error)
20380   __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
20381   {
20382     __Pyx_BufFmt_StackElem __pyx_stack[1];
20383     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_stack.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
20384       __pyx_v_stack = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_stack.rcbuffer->pybuffer.buf = NULL;
20385       __PYX_ERR(1, 824, __pyx_L1_error)
20386     } else {__pyx_pybuffernd_stack.diminfo[0].strides = __pyx_pybuffernd_stack.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_stack.diminfo[0].shape = __pyx_pybuffernd_stack.rcbuffer->pybuffer.shape[0];
20387     }
20388   }
20389   __pyx_t_6 = 0;
20390   __pyx_v_stack = ((PyArrayObject *)__pyx_t_5);
20391   __pyx_t_5 = 0;
20392 
20393   /* "yt/utilities/lib/geometry_utils.pyx":825
20394  *     # Auxillary stack
20395  *     cdef np.ndarray[np.int64_t, ndim=1] stack = np.zeros(h-l+1, dtype=np.int64)
20396  *     cdef np.int64_t top = -1             # <<<<<<<<<<<<<<
20397  *     cdef np.int64_t p
20398  *     top+=1
20399  */
20400   __pyx_v_top = -1LL;
20401 
20402   /* "yt/utilities/lib/geometry_utils.pyx":827
20403  *     cdef np.int64_t top = -1
20404  *     cdef np.int64_t p
20405  *     top+=1             # <<<<<<<<<<<<<<
20406  *     stack[top] = l
20407  *     top+=1
20408  */
20409   __pyx_v_top = (__pyx_v_top + 1);
20410 
20411   /* "yt/utilities/lib/geometry_utils.pyx":828
20412  *     cdef np.int64_t p
20413  *     top+=1
20414  *     stack[top] = l             # <<<<<<<<<<<<<<
20415  *     top+=1
20416  *     stack[top] = h
20417  */
20418   __pyx_t_7 = __pyx_v_top;
20419   *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_stack.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_stack.diminfo[0].strides) = __pyx_v_l;
20420 
20421   /* "yt/utilities/lib/geometry_utils.pyx":829
20422  *     top+=1
20423  *     stack[top] = l
20424  *     top+=1             # <<<<<<<<<<<<<<
20425  *     stack[top] = h
20426  *     # Pop from stack until it's empty
20427  */
20428   __pyx_v_top = (__pyx_v_top + 1);
20429 
20430   /* "yt/utilities/lib/geometry_utils.pyx":830
20431  *     stack[top] = l
20432  *     top+=1
20433  *     stack[top] = h             # <<<<<<<<<<<<<<
20434  *     # Pop from stack until it's empty
20435  *     while (top >= 0):
20436  */
20437   __pyx_t_8 = __pyx_v_top;
20438   *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_stack.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_stack.diminfo[0].strides) = __pyx_v_h;
20439 
20440   /* "yt/utilities/lib/geometry_utils.pyx":832
20441  *     stack[top] = h
20442  *     # Pop from stack until it's empty
20443  *     while (top >= 0):             # <<<<<<<<<<<<<<
20444  *         # Get next set
20445  *         h = stack[top]
20446  */
20447   while (1) {
20448     __pyx_t_9 = ((__pyx_v_top >= 0) != 0);
20449     if (!__pyx_t_9) break;
20450 
20451     /* "yt/utilities/lib/geometry_utils.pyx":834
20452  *     while (top >= 0):
20453  *         # Get next set
20454  *         h = stack[top]             # <<<<<<<<<<<<<<
20455  *         top-=1
20456  *         l = stack[top]
20457  */
20458     __pyx_t_10 = __pyx_v_top;
20459     __pyx_v_h = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_stack.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_stack.diminfo[0].strides));
20460 
20461     /* "yt/utilities/lib/geometry_utils.pyx":835
20462  *         # Get next set
20463  *         h = stack[top]
20464  *         top-=1             # <<<<<<<<<<<<<<
20465  *         l = stack[top]
20466  *         top-=1
20467  */
20468     __pyx_v_top = (__pyx_v_top - 1);
20469 
20470     /* "yt/utilities/lib/geometry_utils.pyx":836
20471  *         h = stack[top]
20472  *         top-=1
20473  *         l = stack[top]             # <<<<<<<<<<<<<<
20474  *         top-=1
20475  *         # Partition
20476  */
20477     __pyx_t_11 = __pyx_v_top;
20478     __pyx_v_l = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_stack.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_stack.diminfo[0].strides));
20479 
20480     /* "yt/utilities/lib/geometry_utils.pyx":837
20481  *         top-=1
20482  *         l = stack[top]
20483  *         top-=1             # <<<<<<<<<<<<<<
20484  *         # Partition
20485  *         p = morton_qsort_partition(pos, l, h, ind, use_loop=use_loop)
20486  */
20487     __pyx_v_top = (__pyx_v_top - 1);
20488 
20489     /* "yt/utilities/lib/geometry_utils.pyx":839
20490  *         top-=1
20491  *         # Partition
20492  *         p = morton_qsort_partition(pos, l, h, ind, use_loop=use_loop)             # <<<<<<<<<<<<<<
20493  *         # Add left partition to the stack
20494  *         if (p-1) > l:
20495  */
20496     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_morton_qsort_partition); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 839, __pyx_L1_error)
20497     __Pyx_GOTREF(__pyx_t_5);
20498     __pyx_t_1 = __Pyx_PyInt_From_npy_int64(__pyx_v_l); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 839, __pyx_L1_error)
20499     __Pyx_GOTREF(__pyx_t_1);
20500     __pyx_t_3 = __Pyx_PyInt_From_npy_int64(__pyx_v_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 839, __pyx_L1_error)
20501     __Pyx_GOTREF(__pyx_t_3);
20502     __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 839, __pyx_L1_error)
20503     __Pyx_GOTREF(__pyx_t_2);
20504     __Pyx_INCREF(((PyObject *)__pyx_v_pos));
20505     __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
20506     PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_pos));
20507     __Pyx_GIVEREF(__pyx_t_1);
20508     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
20509     __Pyx_GIVEREF(__pyx_t_3);
20510     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_3);
20511     __Pyx_INCREF(((PyObject *)__pyx_v_ind));
20512     __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
20513     PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_v_ind));
20514     __pyx_t_1 = 0;
20515     __pyx_t_3 = 0;
20516     __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 839, __pyx_L1_error)
20517     __Pyx_GOTREF(__pyx_t_3);
20518     if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_use_loop, __pyx_v_use_loop) < 0) __PYX_ERR(1, 839, __pyx_L1_error)
20519     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 839, __pyx_L1_error)
20520     __Pyx_GOTREF(__pyx_t_1);
20521     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
20522     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20523     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20524     __pyx_t_12 = __Pyx_PyInt_As_npy_int64(__pyx_t_1); if (unlikely((__pyx_t_12 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 839, __pyx_L1_error)
20525     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20526     __pyx_v_p = __pyx_t_12;
20527 
20528     /* "yt/utilities/lib/geometry_utils.pyx":841
20529  *         p = morton_qsort_partition(pos, l, h, ind, use_loop=use_loop)
20530  *         # Add left partition to the stack
20531  *         if (p-1) > l:             # <<<<<<<<<<<<<<
20532  *             top+=1
20533  *             stack[top] = l
20534  */
20535     __pyx_t_9 = (((__pyx_v_p - 1) > __pyx_v_l) != 0);
20536     if (__pyx_t_9) {
20537 
20538       /* "yt/utilities/lib/geometry_utils.pyx":842
20539  *         # Add left partition to the stack
20540  *         if (p-1) > l:
20541  *             top+=1             # <<<<<<<<<<<<<<
20542  *             stack[top] = l
20543  *             top+=1
20544  */
20545       __pyx_v_top = (__pyx_v_top + 1);
20546 
20547       /* "yt/utilities/lib/geometry_utils.pyx":843
20548  *         if (p-1) > l:
20549  *             top+=1
20550  *             stack[top] = l             # <<<<<<<<<<<<<<
20551  *             top+=1
20552  *             stack[top] = p - 1
20553  */
20554       __pyx_t_12 = __pyx_v_top;
20555       *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_stack.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_stack.diminfo[0].strides) = __pyx_v_l;
20556 
20557       /* "yt/utilities/lib/geometry_utils.pyx":844
20558  *             top+=1
20559  *             stack[top] = l
20560  *             top+=1             # <<<<<<<<<<<<<<
20561  *             stack[top] = p - 1
20562  *         # Add right partition to the stack
20563  */
20564       __pyx_v_top = (__pyx_v_top + 1);
20565 
20566       /* "yt/utilities/lib/geometry_utils.pyx":845
20567  *             stack[top] = l
20568  *             top+=1
20569  *             stack[top] = p - 1             # <<<<<<<<<<<<<<
20570  *         # Add right partition to the stack
20571  *         if (p+1) < h:
20572  */
20573       __pyx_t_13 = __pyx_v_top;
20574       *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_stack.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_stack.diminfo[0].strides) = (__pyx_v_p - 1);
20575 
20576       /* "yt/utilities/lib/geometry_utils.pyx":841
20577  *         p = morton_qsort_partition(pos, l, h, ind, use_loop=use_loop)
20578  *         # Add left partition to the stack
20579  *         if (p-1) > l:             # <<<<<<<<<<<<<<
20580  *             top+=1
20581  *             stack[top] = l
20582  */
20583     }
20584 
20585     /* "yt/utilities/lib/geometry_utils.pyx":847
20586  *             stack[top] = p - 1
20587  *         # Add right partition to the stack
20588  *         if (p+1) < h:             # <<<<<<<<<<<<<<
20589  *             top+=1
20590  *             stack[top] = p + 1
20591  */
20592     __pyx_t_9 = (((__pyx_v_p + 1) < __pyx_v_h) != 0);
20593     if (__pyx_t_9) {
20594 
20595       /* "yt/utilities/lib/geometry_utils.pyx":848
20596  *         # Add right partition to the stack
20597  *         if (p+1) < h:
20598  *             top+=1             # <<<<<<<<<<<<<<
20599  *             stack[top] = p + 1
20600  *             top+=1
20601  */
20602       __pyx_v_top = (__pyx_v_top + 1);
20603 
20604       /* "yt/utilities/lib/geometry_utils.pyx":849
20605  *         if (p+1) < h:
20606  *             top+=1
20607  *             stack[top] = p + 1             # <<<<<<<<<<<<<<
20608  *             top+=1
20609  *             stack[top] = h
20610  */
20611       __pyx_t_14 = __pyx_v_top;
20612       *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_stack.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_stack.diminfo[0].strides) = (__pyx_v_p + 1);
20613 
20614       /* "yt/utilities/lib/geometry_utils.pyx":850
20615  *             top+=1
20616  *             stack[top] = p + 1
20617  *             top+=1             # <<<<<<<<<<<<<<
20618  *             stack[top] = h
20619  *
20620  */
20621       __pyx_v_top = (__pyx_v_top + 1);
20622 
20623       /* "yt/utilities/lib/geometry_utils.pyx":851
20624  *             stack[top] = p + 1
20625  *             top+=1
20626  *             stack[top] = h             # <<<<<<<<<<<<<<
20627  *
20628  * @cython.cdivision(True)
20629  */
20630       __pyx_t_15 = __pyx_v_top;
20631       *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_stack.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_stack.diminfo[0].strides) = __pyx_v_h;
20632 
20633       /* "yt/utilities/lib/geometry_utils.pyx":847
20634  *             stack[top] = p - 1
20635  *         # Add right partition to the stack
20636  *         if (p+1) < h:             # <<<<<<<<<<<<<<
20637  *             top+=1
20638  *             stack[top] = p + 1
20639  */
20640     }
20641   }
20642 
20643   /* "yt/utilities/lib/geometry_utils.pyx":818
20644  * @cython.boundscheck(False)
20645  * @cython.wraparound(False)
20646  * def morton_qsort_iterative(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
20647  *                            np.int64_t l, np.int64_t h,
20648  *                            np.ndarray[np.uint64_t, ndim=1] ind,
20649  */
20650 
20651   /* function exit code */
20652   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20653   goto __pyx_L0;
20654   __pyx_L1_error:;
20655   __Pyx_XDECREF(__pyx_t_1);
20656   __Pyx_XDECREF(__pyx_t_2);
20657   __Pyx_XDECREF(__pyx_t_3);
20658   __Pyx_XDECREF(__pyx_t_4);
20659   __Pyx_XDECREF(__pyx_t_5);
20660   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
20661     __Pyx_PyThreadState_declare
20662     __Pyx_PyThreadState_assign
20663     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
20664     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
20665     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
20666     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_stack.rcbuffer->pybuffer);
20667   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
20668   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_qsort_iterative", __pyx_clineno, __pyx_lineno, __pyx_filename);
20669   __pyx_r = NULL;
20670   goto __pyx_L2;
20671   __pyx_L0:;
20672   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
20673   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
20674   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_stack.rcbuffer->pybuffer);
20675   __pyx_L2:;
20676   __Pyx_XDECREF((PyObject *)__pyx_v_stack);
20677   __Pyx_XGIVEREF(__pyx_r);
20678   __Pyx_RefNannyFinishContext();
20679   return __pyx_r;
20680 }
20681 
20682 /* "yt/utilities/lib/geometry_utils.pyx":856
20683  * @cython.boundscheck(False)
20684  * @cython.wraparound(False)
20685  * def morton_qsort(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
20686  *                  np.int64_t l, np.int64_t h,
20687  *                  np.ndarray[np.uint64_t, ndim=1] ind,
20688  */
20689 
20690 /* Python wrapper */
20691 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_53morton_qsort(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
20692 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_53morton_qsort = {"morton_qsort", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_53morton_qsort, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_53morton_qsort(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)20693 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_53morton_qsort(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
20694   PyObject *__pyx_v_signatures = 0;
20695   PyObject *__pyx_v_args = 0;
20696   PyObject *__pyx_v_kwargs = 0;
20697   CYTHON_UNUSED PyObject *__pyx_v_defaults = 0;
20698   PyObject *__pyx_r = 0;
20699   __Pyx_RefNannyDeclarations
20700   __Pyx_RefNannySetupContext("__pyx_fused_cpdef (wrapper)", 0);
20701   {
20702     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_signatures,&__pyx_n_s_args,&__pyx_n_s_kwargs,&__pyx_n_s_defaults,0};
20703     PyObject* values[4] = {0,0,0,0};
20704     if (unlikely(__pyx_kwds)) {
20705       Py_ssize_t kw_args;
20706       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
20707       switch (pos_args) {
20708         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
20709         CYTHON_FALLTHROUGH;
20710         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20711         CYTHON_FALLTHROUGH;
20712         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20713         CYTHON_FALLTHROUGH;
20714         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20715         CYTHON_FALLTHROUGH;
20716         case  0: break;
20717         default: goto __pyx_L5_argtuple_error;
20718       }
20719       kw_args = PyDict_Size(__pyx_kwds);
20720       switch (pos_args) {
20721         case  0:
20722         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_signatures)) != 0)) kw_args--;
20723         else goto __pyx_L5_argtuple_error;
20724         CYTHON_FALLTHROUGH;
20725         case  1:
20726         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--;
20727         else {
20728           __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 1); __PYX_ERR(1, 856, __pyx_L3_error)
20729         }
20730         CYTHON_FALLTHROUGH;
20731         case  2:
20732         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--;
20733         else {
20734           __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 2); __PYX_ERR(1, 856, __pyx_L3_error)
20735         }
20736         CYTHON_FALLTHROUGH;
20737         case  3:
20738         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_defaults)) != 0)) kw_args--;
20739         else {
20740           __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 3); __PYX_ERR(1, 856, __pyx_L3_error)
20741         }
20742       }
20743       if (unlikely(kw_args > 0)) {
20744         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fused_cpdef") < 0)) __PYX_ERR(1, 856, __pyx_L3_error)
20745       }
20746     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
20747       goto __pyx_L5_argtuple_error;
20748     } else {
20749       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20750       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20751       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20752       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
20753     }
20754     __pyx_v_signatures = values[0];
20755     __pyx_v_args = values[1];
20756     __pyx_v_kwargs = values[2];
20757     __pyx_v_defaults = values[3];
20758   }
20759   goto __pyx_L4_argument_unpacking_done;
20760   __pyx_L5_argtuple_error:;
20761   __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 856, __pyx_L3_error)
20762   __pyx_L3_error:;
20763   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename);
20764   __Pyx_RefNannyFinishContext();
20765   return NULL;
20766   __pyx_L4_argument_unpacking_done:;
20767   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_52morton_qsort(__pyx_self, __pyx_v_signatures, __pyx_v_args, __pyx_v_kwargs, __pyx_v_defaults);
20768 
20769   /* function exit code */
20770   __Pyx_RefNannyFinishContext();
20771   return __pyx_r;
20772 }
20773 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_52morton_qsort(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_signatures,PyObject * __pyx_v_args,PyObject * __pyx_v_kwargs,CYTHON_UNUSED PyObject * __pyx_v_defaults)20774 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_52morton_qsort(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults) {
20775   PyObject *__pyx_v_dest_sig = NULL;
20776   Py_ssize_t __pyx_v_i;
20777   PyTypeObject *__pyx_v_ndarray = 0;
20778   __Pyx_memviewslice __pyx_v_memslice;
20779   Py_ssize_t __pyx_v_itemsize;
20780   CYTHON_UNUSED int __pyx_v_dtype_signed;
20781   char __pyx_v_kind;
20782   PyObject *__pyx_v_arg = NULL;
20783   PyObject *__pyx_v_dtype = NULL;
20784   PyObject *__pyx_v_arg_base = NULL;
20785   PyObject *__pyx_v_candidates = NULL;
20786   PyObject *__pyx_v_sig = NULL;
20787   int __pyx_v_match_found;
20788   PyObject *__pyx_v_src_sig = NULL;
20789   PyObject *__pyx_v_dst_type = NULL;
20790   PyObject *__pyx_r = NULL;
20791   __Pyx_RefNannyDeclarations
20792   PyObject *__pyx_t_1 = NULL;
20793   int __pyx_t_2;
20794   int __pyx_t_3;
20795   int __pyx_t_4;
20796   Py_ssize_t __pyx_t_5;
20797   PyObject *__pyx_t_6 = NULL;
20798   long __pyx_t_7;
20799   __Pyx_memviewslice __pyx_t_8;
20800   Py_ssize_t __pyx_t_9;
20801   int __pyx_t_10;
20802   int __pyx_t_11;
20803   PyObject *__pyx_t_12 = NULL;
20804   PyObject *__pyx_t_13 = NULL;
20805   PyObject *__pyx_t_14 = NULL;
20806   Py_ssize_t __pyx_t_15;
20807   Py_ssize_t __pyx_t_16;
20808   Py_ssize_t __pyx_t_17;
20809   int __pyx_t_18;
20810   __Pyx_RefNannySetupContext("morton_qsort", 0);
20811   __Pyx_INCREF(__pyx_v_kwargs);
20812   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 856, __pyx_L1_error)
20813   __Pyx_GOTREF(__pyx_t_1);
20814   __Pyx_INCREF(Py_None);
20815   __Pyx_GIVEREF(Py_None);
20816   PyList_SET_ITEM(__pyx_t_1, 0, Py_None);
20817   __pyx_v_dest_sig = ((PyObject*)__pyx_t_1);
20818   __pyx_t_1 = 0;
20819   __pyx_t_3 = (__pyx_v_kwargs != Py_None);
20820   __pyx_t_4 = (__pyx_t_3 != 0);
20821   if (__pyx_t_4) {
20822   } else {
20823     __pyx_t_2 = __pyx_t_4;
20824     goto __pyx_L4_bool_binop_done;
20825   }
20826   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_kwargs); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 856, __pyx_L1_error)
20827   __pyx_t_3 = ((!__pyx_t_4) != 0);
20828   __pyx_t_2 = __pyx_t_3;
20829   __pyx_L4_bool_binop_done:;
20830   if (__pyx_t_2) {
20831     __Pyx_INCREF(Py_None);
20832     __Pyx_DECREF_SET(__pyx_v_kwargs, Py_None);
20833   }
20834   __pyx_t_1 = ((PyObject *)__Pyx_ImportNumPyArrayTypeIfAvailable()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 856, __pyx_L1_error)
20835   __Pyx_GOTREF(__pyx_t_1);
20836   __pyx_v_ndarray = ((PyTypeObject*)__pyx_t_1);
20837   __pyx_t_1 = 0;
20838   __pyx_v_itemsize = -1L;
20839   if (unlikely(__pyx_v_args == Py_None)) {
20840     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
20841     __PYX_ERR(1, 856, __pyx_L1_error)
20842   }
20843   __pyx_t_5 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 856, __pyx_L1_error)
20844   __pyx_t_2 = ((0 < __pyx_t_5) != 0);
20845   if (__pyx_t_2) {
20846     if (unlikely(__pyx_v_args == Py_None)) {
20847       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
20848       __PYX_ERR(1, 856, __pyx_L1_error)
20849     }
20850     __pyx_t_1 = PyTuple_GET_ITEM(((PyObject*)__pyx_v_args), 0);
20851     __Pyx_INCREF(__pyx_t_1);
20852     __pyx_v_arg = __pyx_t_1;
20853     __pyx_t_1 = 0;
20854     goto __pyx_L6;
20855   }
20856   __pyx_t_3 = (__pyx_v_kwargs != Py_None);
20857   __pyx_t_4 = (__pyx_t_3 != 0);
20858   if (__pyx_t_4) {
20859   } else {
20860     __pyx_t_2 = __pyx_t_4;
20861     goto __pyx_L7_bool_binop_done;
20862   }
20863   if (unlikely(__pyx_v_kwargs == Py_None)) {
20864     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
20865     __PYX_ERR(1, 856, __pyx_L1_error)
20866   }
20867   __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_pos, ((PyObject*)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 856, __pyx_L1_error)
20868   __pyx_t_3 = (__pyx_t_4 != 0);
20869   __pyx_t_2 = __pyx_t_3;
20870   __pyx_L7_bool_binop_done:;
20871   if (__pyx_t_2) {
20872     if (unlikely(__pyx_v_kwargs == Py_None)) {
20873       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
20874       __PYX_ERR(1, 856, __pyx_L1_error)
20875     }
20876     __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_kwargs), __pyx_n_s_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 856, __pyx_L1_error)
20877     __Pyx_GOTREF(__pyx_t_1);
20878     __pyx_v_arg = __pyx_t_1;
20879     __pyx_t_1 = 0;
20880     goto __pyx_L6;
20881   }
20882   /*else*/ {
20883     if (unlikely(__pyx_v_args == Py_None)) {
20884       PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
20885       __PYX_ERR(1, 856, __pyx_L1_error)
20886     }
20887     __pyx_t_5 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 856, __pyx_L1_error)
20888     __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 856, __pyx_L1_error)
20889     __Pyx_GOTREF(__pyx_t_1);
20890     __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 856, __pyx_L1_error)
20891     __Pyx_GOTREF(__pyx_t_6);
20892     __Pyx_INCREF(__pyx_int_4);
20893     __Pyx_GIVEREF(__pyx_int_4);
20894     PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_4);
20895     __Pyx_INCREF(__pyx_n_s_s);
20896     __Pyx_GIVEREF(__pyx_n_s_s);
20897     PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_n_s_s);
20898     __Pyx_GIVEREF(__pyx_t_1);
20899     PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1);
20900     __pyx_t_1 = 0;
20901     __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Expected_at_least_d_argument_s_g, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 856, __pyx_L1_error)
20902     __Pyx_GOTREF(__pyx_t_1);
20903     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20904     __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 856, __pyx_L1_error)
20905     __Pyx_GOTREF(__pyx_t_6);
20906     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20907     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
20908     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20909     __PYX_ERR(1, 856, __pyx_L1_error)
20910   }
20911   __pyx_L6:;
20912   while (1) {
20913     __pyx_t_2 = (__pyx_v_ndarray != ((PyTypeObject*)Py_None));
20914     __pyx_t_3 = (__pyx_t_2 != 0);
20915     if (__pyx_t_3) {
20916       __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_arg, __pyx_v_ndarray);
20917       __pyx_t_2 = (__pyx_t_3 != 0);
20918       if (__pyx_t_2) {
20919         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 856, __pyx_L1_error)
20920         __Pyx_GOTREF(__pyx_t_6);
20921         __pyx_v_dtype = __pyx_t_6;
20922         __pyx_t_6 = 0;
20923         goto __pyx_L12;
20924       }
20925       __pyx_t_2 = __pyx_memoryview_check(__pyx_v_arg);
20926       __pyx_t_3 = (__pyx_t_2 != 0);
20927       if (__pyx_t_3) {
20928         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_base); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 856, __pyx_L1_error)
20929         __Pyx_GOTREF(__pyx_t_6);
20930         __pyx_v_arg_base = __pyx_t_6;
20931         __pyx_t_6 = 0;
20932         __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_arg_base, __pyx_v_ndarray);
20933         __pyx_t_2 = (__pyx_t_3 != 0);
20934         if (__pyx_t_2) {
20935           __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg_base, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 856, __pyx_L1_error)
20936           __Pyx_GOTREF(__pyx_t_6);
20937           __pyx_v_dtype = __pyx_t_6;
20938           __pyx_t_6 = 0;
20939           goto __pyx_L13;
20940         }
20941         /*else*/ {
20942           __Pyx_INCREF(Py_None);
20943           __pyx_v_dtype = Py_None;
20944         }
20945         __pyx_L13:;
20946         goto __pyx_L12;
20947       }
20948       /*else*/ {
20949         __Pyx_INCREF(Py_None);
20950         __pyx_v_dtype = Py_None;
20951       }
20952       __pyx_L12:;
20953       __pyx_v_itemsize = -1L;
20954       __pyx_t_2 = (__pyx_v_dtype != Py_None);
20955       __pyx_t_3 = (__pyx_t_2 != 0);
20956       if (__pyx_t_3) {
20957         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 856, __pyx_L1_error)
20958         __Pyx_GOTREF(__pyx_t_6);
20959         __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 856, __pyx_L1_error)
20960         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20961         __pyx_v_itemsize = __pyx_t_5;
20962         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 856, __pyx_L1_error)
20963         __Pyx_GOTREF(__pyx_t_6);
20964         __pyx_t_7 = __Pyx_PyObject_Ord(__pyx_t_6); if (unlikely(__pyx_t_7 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(1, 856, __pyx_L1_error)
20965         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20966         __pyx_v_kind = __pyx_t_7;
20967         __pyx_v_dtype_signed = (__pyx_v_kind == 'i');
20968         switch (__pyx_v_kind) {
20969           case 'i':
20970           case 'u':
20971           break;
20972           case 'f':
20973           __pyx_t_2 = (((sizeof(float)) == __pyx_v_itemsize) != 0);
20974           if (__pyx_t_2) {
20975           } else {
20976             __pyx_t_3 = __pyx_t_2;
20977             goto __pyx_L16_bool_binop_done;
20978           }
20979           __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 856, __pyx_L1_error)
20980           __Pyx_GOTREF(__pyx_t_6);
20981           __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 856, __pyx_L1_error)
20982           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20983           __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
20984           __pyx_t_3 = __pyx_t_2;
20985           __pyx_L16_bool_binop_done:;
20986           if (__pyx_t_3) {
20987             if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(1, 856, __pyx_L1_error)
20988             goto __pyx_L10_break;
20989           }
20990           __pyx_t_2 = (((sizeof(double)) == __pyx_v_itemsize) != 0);
20991           if (__pyx_t_2) {
20992           } else {
20993             __pyx_t_3 = __pyx_t_2;
20994             goto __pyx_L19_bool_binop_done;
20995           }
20996           __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 856, __pyx_L1_error)
20997           __Pyx_GOTREF(__pyx_t_6);
20998           __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 856, __pyx_L1_error)
20999           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
21000           __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
21001           __pyx_t_3 = __pyx_t_2;
21002           __pyx_L19_bool_binop_done:;
21003           if (__pyx_t_3) {
21004             if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_double, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(1, 856, __pyx_L1_error)
21005             goto __pyx_L10_break;
21006           }
21007           break;
21008           case 'c':
21009           break;
21010           case 'O':
21011           break;
21012           default: break;
21013         }
21014       }
21015     }
21016     __pyx_t_2 = ((__pyx_v_itemsize == -1L) != 0);
21017     if (!__pyx_t_2) {
21018     } else {
21019       __pyx_t_3 = __pyx_t_2;
21020       goto __pyx_L22_bool_binop_done;
21021     }
21022     __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(float))) != 0);
21023     __pyx_t_3 = __pyx_t_2;
21024     __pyx_L22_bool_binop_done:;
21025     if (__pyx_t_3) {
21026       __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_v_arg, 0);
21027       __pyx_v_memslice = __pyx_t_8;
21028       __pyx_t_3 = (__pyx_v_memslice.memview != 0);
21029       if (__pyx_t_3) {
21030         __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1);
21031         if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(1, 856, __pyx_L1_error)
21032         goto __pyx_L10_break;
21033       }
21034       /*else*/ {
21035         PyErr_Clear();
21036       }
21037     }
21038     __pyx_t_2 = ((__pyx_v_itemsize == -1L) != 0);
21039     if (!__pyx_t_2) {
21040     } else {
21041       __pyx_t_3 = __pyx_t_2;
21042       goto __pyx_L26_bool_binop_done;
21043     }
21044     __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(double))) != 0);
21045     __pyx_t_3 = __pyx_t_2;
21046     __pyx_L26_bool_binop_done:;
21047     if (__pyx_t_3) {
21048       __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_v_arg, 0);
21049       __pyx_v_memslice = __pyx_t_8;
21050       __pyx_t_3 = (__pyx_v_memslice.memview != 0);
21051       if (__pyx_t_3) {
21052         __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1);
21053         if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_double, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(1, 856, __pyx_L1_error)
21054         goto __pyx_L10_break;
21055       }
21056       /*else*/ {
21057         PyErr_Clear();
21058       }
21059     }
21060     if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, Py_None, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(1, 856, __pyx_L1_error)
21061     goto __pyx_L10_break;
21062   }
21063   __pyx_L10_break:;
21064   __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 856, __pyx_L1_error)
21065   __Pyx_GOTREF(__pyx_t_6);
21066   __pyx_v_candidates = ((PyObject*)__pyx_t_6);
21067   __pyx_t_6 = 0;
21068   __pyx_t_5 = 0;
21069   if (unlikely(__pyx_v_signatures == Py_None)) {
21070     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
21071     __PYX_ERR(1, 856, __pyx_L1_error)
21072   }
21073   __pyx_t_1 = __Pyx_dict_iterator(((PyObject*)__pyx_v_signatures), 1, ((PyObject *)NULL), (&__pyx_t_9), (&__pyx_t_10)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 856, __pyx_L1_error)
21074   __Pyx_GOTREF(__pyx_t_1);
21075   __Pyx_XDECREF(__pyx_t_6);
21076   __pyx_t_6 = __pyx_t_1;
21077   __pyx_t_1 = 0;
21078   while (1) {
21079     __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_9, &__pyx_t_5, &__pyx_t_1, NULL, NULL, __pyx_t_10);
21080     if (unlikely(__pyx_t_11 == 0)) break;
21081     if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(1, 856, __pyx_L1_error)
21082     __Pyx_GOTREF(__pyx_t_1);
21083     __Pyx_XDECREF_SET(__pyx_v_sig, __pyx_t_1);
21084     __pyx_t_1 = 0;
21085     __pyx_v_match_found = 0;
21086     __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_sig, __pyx_n_s_strip); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 856, __pyx_L1_error)
21087     __Pyx_GOTREF(__pyx_t_13);
21088     __pyx_t_14 = NULL;
21089     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
21090       __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_13);
21091       if (likely(__pyx_t_14)) {
21092         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
21093         __Pyx_INCREF(__pyx_t_14);
21094         __Pyx_INCREF(function);
21095         __Pyx_DECREF_SET(__pyx_t_13, function);
21096       }
21097     }
21098     __pyx_t_12 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_14, __pyx_kp_s__5) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_kp_s__5);
21099     __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
21100     if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 856, __pyx_L1_error)
21101     __Pyx_GOTREF(__pyx_t_12);
21102     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
21103     __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_split); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 856, __pyx_L1_error)
21104     __Pyx_GOTREF(__pyx_t_13);
21105     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
21106     __pyx_t_12 = NULL;
21107     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
21108       __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13);
21109       if (likely(__pyx_t_12)) {
21110         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
21111         __Pyx_INCREF(__pyx_t_12);
21112         __Pyx_INCREF(function);
21113         __Pyx_DECREF_SET(__pyx_t_13, function);
21114       }
21115     }
21116     __pyx_t_1 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_12, __pyx_kp_s__6) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_kp_s__6);
21117     __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
21118     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 856, __pyx_L1_error)
21119     __Pyx_GOTREF(__pyx_t_1);
21120     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
21121     __Pyx_XDECREF_SET(__pyx_v_src_sig, __pyx_t_1);
21122     __pyx_t_1 = 0;
21123     __pyx_t_15 = PyList_GET_SIZE(__pyx_v_dest_sig); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(1, 856, __pyx_L1_error)
21124     __pyx_t_16 = __pyx_t_15;
21125     for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
21126       __pyx_v_i = __pyx_t_17;
21127       __pyx_t_1 = PyList_GET_ITEM(__pyx_v_dest_sig, __pyx_v_i);
21128       __Pyx_INCREF(__pyx_t_1);
21129       __Pyx_XDECREF_SET(__pyx_v_dst_type, __pyx_t_1);
21130       __pyx_t_1 = 0;
21131       __pyx_t_3 = (__pyx_v_dst_type != Py_None);
21132       __pyx_t_2 = (__pyx_t_3 != 0);
21133       if (__pyx_t_2) {
21134         __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_src_sig, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 856, __pyx_L1_error)
21135         __Pyx_GOTREF(__pyx_t_1);
21136         __pyx_t_13 = PyObject_RichCompare(__pyx_t_1, __pyx_v_dst_type, Py_EQ); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 856, __pyx_L1_error)
21137         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21138         __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 856, __pyx_L1_error)
21139         __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
21140         if (__pyx_t_2) {
21141           __pyx_v_match_found = 1;
21142           goto __pyx_L34;
21143         }
21144         /*else*/ {
21145           __pyx_v_match_found = 0;
21146           goto __pyx_L32_break;
21147         }
21148         __pyx_L34:;
21149       }
21150     }
21151     __pyx_L32_break:;
21152     __pyx_t_2 = (__pyx_v_match_found != 0);
21153     if (__pyx_t_2) {
21154       __pyx_t_18 = __Pyx_PyList_Append(__pyx_v_candidates, __pyx_v_sig); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(1, 856, __pyx_L1_error)
21155     }
21156   }
21157   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
21158   __pyx_t_2 = (PyList_GET_SIZE(__pyx_v_candidates) != 0);
21159   __pyx_t_3 = ((!__pyx_t_2) != 0);
21160   if (__pyx_t_3) {
21161     __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 856, __pyx_L1_error)
21162     __Pyx_GOTREF(__pyx_t_6);
21163     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
21164     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
21165     __PYX_ERR(1, 856, __pyx_L1_error)
21166   }
21167   __pyx_t_9 = PyList_GET_SIZE(__pyx_v_candidates); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 856, __pyx_L1_error)
21168   __pyx_t_3 = ((__pyx_t_9 > 1) != 0);
21169   if (__pyx_t_3) {
21170     __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 856, __pyx_L1_error)
21171     __Pyx_GOTREF(__pyx_t_6);
21172     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
21173     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
21174     __PYX_ERR(1, 856, __pyx_L1_error)
21175   }
21176   /*else*/ {
21177     __Pyx_XDECREF(__pyx_r);
21178     if (unlikely(__pyx_v_signatures == Py_None)) {
21179       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
21180       __PYX_ERR(1, 856, __pyx_L1_error)
21181     }
21182     __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_signatures), PyList_GET_ITEM(__pyx_v_candidates, 0)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 856, __pyx_L1_error)
21183     __Pyx_GOTREF(__pyx_t_6);
21184     __pyx_r = __pyx_t_6;
21185     __pyx_t_6 = 0;
21186     goto __pyx_L0;
21187   }
21188 
21189   /* function exit code */
21190   __pyx_L1_error:;
21191   __Pyx_XDECREF(__pyx_t_1);
21192   __Pyx_XDECREF(__pyx_t_6);
21193   __Pyx_XDECREF(__pyx_t_12);
21194   __Pyx_XDECREF(__pyx_t_13);
21195   __Pyx_XDECREF(__pyx_t_14);
21196   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename);
21197   __pyx_r = NULL;
21198   __pyx_L0:;
21199   __Pyx_XDECREF(__pyx_v_dest_sig);
21200   __Pyx_XDECREF(__pyx_v_ndarray);
21201   __Pyx_XDECREF(__pyx_v_arg);
21202   __Pyx_XDECREF(__pyx_v_dtype);
21203   __Pyx_XDECREF(__pyx_v_arg_base);
21204   __Pyx_XDECREF(__pyx_v_candidates);
21205   __Pyx_XDECREF(__pyx_v_sig);
21206   __Pyx_XDECREF(__pyx_v_src_sig);
21207   __Pyx_XDECREF(__pyx_v_dst_type);
21208   __Pyx_XDECREF(__pyx_v_kwargs);
21209   __Pyx_XGIVEREF(__pyx_r);
21210   __Pyx_RefNannyFinishContext();
21211   return __pyx_r;
21212 }
21213 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_140__defaults__(CYTHON_UNUSED PyObject * __pyx_self)21214 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_140__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
21215   PyObject *__pyx_r = NULL;
21216   __Pyx_RefNannyDeclarations
21217   PyObject *__pyx_t_1 = NULL;
21218   PyObject *__pyx_t_2 = NULL;
21219   __Pyx_RefNannySetupContext("__defaults__", 0);
21220   __Pyx_XDECREF(__pyx_r);
21221   __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 856, __pyx_L1_error)
21222   __Pyx_GOTREF(__pyx_t_1);
21223   __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults14, __pyx_self)->__pyx_arg_recursive);
21224   __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults14, __pyx_self)->__pyx_arg_recursive);
21225   PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults14, __pyx_self)->__pyx_arg_recursive);
21226   __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults14, __pyx_self)->__pyx_arg_use_loop);
21227   __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults14, __pyx_self)->__pyx_arg_use_loop);
21228   PyTuple_SET_ITEM(__pyx_t_1, 1, __Pyx_CyFunction_Defaults(__pyx_defaults14, __pyx_self)->__pyx_arg_use_loop);
21229   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 856, __pyx_L1_error)
21230   __Pyx_GOTREF(__pyx_t_2);
21231   __Pyx_GIVEREF(__pyx_t_1);
21232   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
21233   __Pyx_INCREF(Py_None);
21234   __Pyx_GIVEREF(Py_None);
21235   PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
21236   __pyx_t_1 = 0;
21237   __pyx_r = __pyx_t_2;
21238   __pyx_t_2 = 0;
21239   goto __pyx_L0;
21240 
21241   /* function exit code */
21242   __pyx_L1_error:;
21243   __Pyx_XDECREF(__pyx_t_1);
21244   __Pyx_XDECREF(__pyx_t_2);
21245   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
21246   __pyx_r = NULL;
21247   __pyx_L0:;
21248   __Pyx_XGIVEREF(__pyx_r);
21249   __Pyx_RefNannyFinishContext();
21250   return __pyx_r;
21251 }
21252 
21253 /* Python wrapper */
21254 static PyObject *__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_95morton_qsort(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
21255 static PyMethodDef __pyx_fuse_0__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_95morton_qsort = {"__pyx_fuse_0morton_qsort", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_95morton_qsort, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_95morton_qsort(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)21256 static PyObject *__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_95morton_qsort(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
21257   PyArrayObject *__pyx_v_pos = 0;
21258   __pyx_t_5numpy_int64_t __pyx_v_l;
21259   __pyx_t_5numpy_int64_t __pyx_v_h;
21260   PyArrayObject *__pyx_v_ind = 0;
21261   PyObject *__pyx_v_recursive = 0;
21262   PyObject *__pyx_v_use_loop = 0;
21263   PyObject *__pyx_r = 0;
21264   __Pyx_RefNannyDeclarations
21265   __Pyx_RefNannySetupContext("morton_qsort (wrapper)", 0);
21266   {
21267     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_l,&__pyx_n_s_h,&__pyx_n_s_ind,&__pyx_n_s_recursive,&__pyx_n_s_use_loop,0};
21268     PyObject* values[6] = {0,0,0,0,0,0};
21269     __pyx_defaults14 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults14, __pyx_self);
21270     values[4] = __pyx_dynamic_args->__pyx_arg_recursive;
21271     values[5] = __pyx_dynamic_args->__pyx_arg_use_loop;
21272     if (unlikely(__pyx_kwds)) {
21273       Py_ssize_t kw_args;
21274       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
21275       switch (pos_args) {
21276         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
21277         CYTHON_FALLTHROUGH;
21278         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
21279         CYTHON_FALLTHROUGH;
21280         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
21281         CYTHON_FALLTHROUGH;
21282         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
21283         CYTHON_FALLTHROUGH;
21284         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
21285         CYTHON_FALLTHROUGH;
21286         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
21287         CYTHON_FALLTHROUGH;
21288         case  0: break;
21289         default: goto __pyx_L5_argtuple_error;
21290       }
21291       kw_args = PyDict_Size(__pyx_kwds);
21292       switch (pos_args) {
21293         case  0:
21294         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
21295         else goto __pyx_L5_argtuple_error;
21296         CYTHON_FALLTHROUGH;
21297         case  1:
21298         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_l)) != 0)) kw_args--;
21299         else {
21300           __Pyx_RaiseArgtupleInvalid("morton_qsort", 0, 4, 6, 1); __PYX_ERR(1, 856, __pyx_L3_error)
21301         }
21302         CYTHON_FALLTHROUGH;
21303         case  2:
21304         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
21305         else {
21306           __Pyx_RaiseArgtupleInvalid("morton_qsort", 0, 4, 6, 2); __PYX_ERR(1, 856, __pyx_L3_error)
21307         }
21308         CYTHON_FALLTHROUGH;
21309         case  3:
21310         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind)) != 0)) kw_args--;
21311         else {
21312           __Pyx_RaiseArgtupleInvalid("morton_qsort", 0, 4, 6, 3); __PYX_ERR(1, 856, __pyx_L3_error)
21313         }
21314         CYTHON_FALLTHROUGH;
21315         case  4:
21316         if (kw_args > 0) {
21317           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_recursive);
21318           if (value) { values[4] = value; kw_args--; }
21319         }
21320         CYTHON_FALLTHROUGH;
21321         case  5:
21322         if (kw_args > 0) {
21323           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_loop);
21324           if (value) { values[5] = value; kw_args--; }
21325         }
21326       }
21327       if (unlikely(kw_args > 0)) {
21328         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "morton_qsort") < 0)) __PYX_ERR(1, 856, __pyx_L3_error)
21329       }
21330     } else {
21331       switch (PyTuple_GET_SIZE(__pyx_args)) {
21332         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
21333         CYTHON_FALLTHROUGH;
21334         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
21335         CYTHON_FALLTHROUGH;
21336         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
21337         values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
21338         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
21339         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
21340         break;
21341         default: goto __pyx_L5_argtuple_error;
21342       }
21343     }
21344     __pyx_v_pos = ((PyArrayObject *)values[0]);
21345     __pyx_v_l = __Pyx_PyInt_As_npy_int64(values[1]); if (unlikely((__pyx_v_l == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 857, __pyx_L3_error)
21346     __pyx_v_h = __Pyx_PyInt_As_npy_int64(values[2]); if (unlikely((__pyx_v_h == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 857, __pyx_L3_error)
21347     __pyx_v_ind = ((PyArrayObject *)values[3]);
21348     __pyx_v_recursive = values[4];
21349     __pyx_v_use_loop = values[5];
21350   }
21351   goto __pyx_L4_argument_unpacking_done;
21352   __pyx_L5_argtuple_error:;
21353   __Pyx_RaiseArgtupleInvalid("morton_qsort", 0, 4, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 856, __pyx_L3_error)
21354   __pyx_L3_error:;
21355   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_qsort", __pyx_clineno, __pyx_lineno, __pyx_filename);
21356   __Pyx_RefNannyFinishContext();
21357   return NULL;
21358   __pyx_L4_argument_unpacking_done:;
21359   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 1, "pos", 0))) __PYX_ERR(1, 856, __pyx_L1_error)
21360   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ind), __pyx_ptype_5numpy_ndarray, 1, "ind", 0))) __PYX_ERR(1, 858, __pyx_L1_error)
21361   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_94morton_qsort(__pyx_self, __pyx_v_pos, __pyx_v_l, __pyx_v_h, __pyx_v_ind, __pyx_v_recursive, __pyx_v_use_loop);
21362 
21363   /* function exit code */
21364   goto __pyx_L0;
21365   __pyx_L1_error:;
21366   __pyx_r = NULL;
21367   __pyx_L0:;
21368   __Pyx_RefNannyFinishContext();
21369   return __pyx_r;
21370 }
21371 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_94morton_qsort(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_pos,__pyx_t_5numpy_int64_t __pyx_v_l,__pyx_t_5numpy_int64_t __pyx_v_h,PyArrayObject * __pyx_v_ind,PyObject * __pyx_v_recursive,PyObject * __pyx_v_use_loop)21372 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_94morton_qsort(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_int64_t __pyx_v_l, __pyx_t_5numpy_int64_t __pyx_v_h, PyArrayObject *__pyx_v_ind, PyObject *__pyx_v_recursive, PyObject *__pyx_v_use_loop) {
21373   __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
21374   __Pyx_Buffer __pyx_pybuffer_ind;
21375   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos;
21376   __Pyx_Buffer __pyx_pybuffer_pos;
21377   PyObject *__pyx_r = NULL;
21378   __Pyx_RefNannyDeclarations
21379   int __pyx_t_1;
21380   PyObject *__pyx_t_2 = NULL;
21381   PyObject *__pyx_t_3 = NULL;
21382   PyObject *__pyx_t_4 = NULL;
21383   PyObject *__pyx_t_5 = NULL;
21384   __Pyx_RefNannySetupContext("__pyx_fuse_0morton_qsort", 0);
21385   __pyx_pybuffer_pos.pybuffer.buf = NULL;
21386   __pyx_pybuffer_pos.refcount = 0;
21387   __pyx_pybuffernd_pos.data = NULL;
21388   __pyx_pybuffernd_pos.rcbuffer = &__pyx_pybuffer_pos;
21389   __pyx_pybuffer_ind.pybuffer.buf = NULL;
21390   __pyx_pybuffer_ind.refcount = 0;
21391   __pyx_pybuffernd_ind.data = NULL;
21392   __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;
21393   {
21394     __Pyx_BufFmt_StackElem __pyx_stack[1];
21395     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_float, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(1, 856, __pyx_L1_error)
21396   }
21397   __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1];
21398   {
21399     __Pyx_BufFmt_StackElem __pyx_stack[1];
21400     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 856, __pyx_L1_error)
21401   }
21402   __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
21403 
21404   /* "yt/utilities/lib/geometry_utils.pyx":862
21405  *                  use_loop = False):
21406  *     #get_morton_argsort1(pos,l,h,ind)
21407  *     if recursive:             # <<<<<<<<<<<<<<
21408  *         morton_qsort_recursive(pos,l,h,ind,use_loop=use_loop)
21409  *     else:
21410  */
21411   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_recursive); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 862, __pyx_L1_error)
21412   if (__pyx_t_1) {
21413 
21414     /* "yt/utilities/lib/geometry_utils.pyx":863
21415  *     #get_morton_argsort1(pos,l,h,ind)
21416  *     if recursive:
21417  *         morton_qsort_recursive(pos,l,h,ind,use_loop=use_loop)             # <<<<<<<<<<<<<<
21418  *     else:
21419  *         morton_qsort_iterative(pos,l,h,ind,use_loop=use_loop)
21420  */
21421     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_morton_qsort_recursive); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 863, __pyx_L1_error)
21422     __Pyx_GOTREF(__pyx_t_2);
21423     __pyx_t_3 = __Pyx_PyInt_From_npy_int64(__pyx_v_l); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 863, __pyx_L1_error)
21424     __Pyx_GOTREF(__pyx_t_3);
21425     __pyx_t_4 = __Pyx_PyInt_From_npy_int64(__pyx_v_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 863, __pyx_L1_error)
21426     __Pyx_GOTREF(__pyx_t_4);
21427     __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 863, __pyx_L1_error)
21428     __Pyx_GOTREF(__pyx_t_5);
21429     __Pyx_INCREF(((PyObject *)__pyx_v_pos));
21430     __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
21431     PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_pos));
21432     __Pyx_GIVEREF(__pyx_t_3);
21433     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
21434     __Pyx_GIVEREF(__pyx_t_4);
21435     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
21436     __Pyx_INCREF(((PyObject *)__pyx_v_ind));
21437     __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
21438     PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_v_ind));
21439     __pyx_t_3 = 0;
21440     __pyx_t_4 = 0;
21441     __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 863, __pyx_L1_error)
21442     __Pyx_GOTREF(__pyx_t_4);
21443     if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_use_loop, __pyx_v_use_loop) < 0) __PYX_ERR(1, 863, __pyx_L1_error)
21444     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 863, __pyx_L1_error)
21445     __Pyx_GOTREF(__pyx_t_3);
21446     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21447     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
21448     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21449     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21450 
21451     /* "yt/utilities/lib/geometry_utils.pyx":862
21452  *                  use_loop = False):
21453  *     #get_morton_argsort1(pos,l,h,ind)
21454  *     if recursive:             # <<<<<<<<<<<<<<
21455  *         morton_qsort_recursive(pos,l,h,ind,use_loop=use_loop)
21456  *     else:
21457  */
21458     goto __pyx_L3;
21459   }
21460 
21461   /* "yt/utilities/lib/geometry_utils.pyx":865
21462  *         morton_qsort_recursive(pos,l,h,ind,use_loop=use_loop)
21463  *     else:
21464  *         morton_qsort_iterative(pos,l,h,ind,use_loop=use_loop)             # <<<<<<<<<<<<<<
21465  *
21466  * @cython.cdivision(True)
21467  */
21468   /*else*/ {
21469     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_morton_qsort_iterative); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 865, __pyx_L1_error)
21470     __Pyx_GOTREF(__pyx_t_3);
21471     __pyx_t_4 = __Pyx_PyInt_From_npy_int64(__pyx_v_l); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 865, __pyx_L1_error)
21472     __Pyx_GOTREF(__pyx_t_4);
21473     __pyx_t_5 = __Pyx_PyInt_From_npy_int64(__pyx_v_h); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 865, __pyx_L1_error)
21474     __Pyx_GOTREF(__pyx_t_5);
21475     __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 865, __pyx_L1_error)
21476     __Pyx_GOTREF(__pyx_t_2);
21477     __Pyx_INCREF(((PyObject *)__pyx_v_pos));
21478     __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
21479     PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_pos));
21480     __Pyx_GIVEREF(__pyx_t_4);
21481     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
21482     __Pyx_GIVEREF(__pyx_t_5);
21483     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
21484     __Pyx_INCREF(((PyObject *)__pyx_v_ind));
21485     __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
21486     PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_v_ind));
21487     __pyx_t_4 = 0;
21488     __pyx_t_5 = 0;
21489     __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 865, __pyx_L1_error)
21490     __Pyx_GOTREF(__pyx_t_5);
21491     if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_use_loop, __pyx_v_use_loop) < 0) __PYX_ERR(1, 865, __pyx_L1_error)
21492     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 865, __pyx_L1_error)
21493     __Pyx_GOTREF(__pyx_t_4);
21494     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21495     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21496     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
21497     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21498   }
21499   __pyx_L3:;
21500 
21501   /* "yt/utilities/lib/geometry_utils.pyx":856
21502  * @cython.boundscheck(False)
21503  * @cython.wraparound(False)
21504  * def morton_qsort(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
21505  *                  np.int64_t l, np.int64_t h,
21506  *                  np.ndarray[np.uint64_t, ndim=1] ind,
21507  */
21508 
21509   /* function exit code */
21510   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21511   goto __pyx_L0;
21512   __pyx_L1_error:;
21513   __Pyx_XDECREF(__pyx_t_2);
21514   __Pyx_XDECREF(__pyx_t_3);
21515   __Pyx_XDECREF(__pyx_t_4);
21516   __Pyx_XDECREF(__pyx_t_5);
21517   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
21518     __Pyx_PyThreadState_declare
21519     __Pyx_PyThreadState_assign
21520     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
21521     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
21522     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
21523   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
21524   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_qsort", __pyx_clineno, __pyx_lineno, __pyx_filename);
21525   __pyx_r = NULL;
21526   goto __pyx_L2;
21527   __pyx_L0:;
21528   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
21529   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
21530   __pyx_L2:;
21531   __Pyx_XGIVEREF(__pyx_r);
21532   __Pyx_RefNannyFinishContext();
21533   return __pyx_r;
21534 }
21535 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_142__defaults__(CYTHON_UNUSED PyObject * __pyx_self)21536 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_142__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
21537   PyObject *__pyx_r = NULL;
21538   __Pyx_RefNannyDeclarations
21539   PyObject *__pyx_t_1 = NULL;
21540   PyObject *__pyx_t_2 = NULL;
21541   __Pyx_RefNannySetupContext("__defaults__", 0);
21542   __Pyx_XDECREF(__pyx_r);
21543   __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 856, __pyx_L1_error)
21544   __Pyx_GOTREF(__pyx_t_1);
21545   __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults15, __pyx_self)->__pyx_arg_recursive);
21546   __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults15, __pyx_self)->__pyx_arg_recursive);
21547   PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults15, __pyx_self)->__pyx_arg_recursive);
21548   __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults15, __pyx_self)->__pyx_arg_use_loop);
21549   __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults15, __pyx_self)->__pyx_arg_use_loop);
21550   PyTuple_SET_ITEM(__pyx_t_1, 1, __Pyx_CyFunction_Defaults(__pyx_defaults15, __pyx_self)->__pyx_arg_use_loop);
21551   __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 856, __pyx_L1_error)
21552   __Pyx_GOTREF(__pyx_t_2);
21553   __Pyx_GIVEREF(__pyx_t_1);
21554   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
21555   __Pyx_INCREF(Py_None);
21556   __Pyx_GIVEREF(Py_None);
21557   PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
21558   __pyx_t_1 = 0;
21559   __pyx_r = __pyx_t_2;
21560   __pyx_t_2 = 0;
21561   goto __pyx_L0;
21562 
21563   /* function exit code */
21564   __pyx_L1_error:;
21565   __Pyx_XDECREF(__pyx_t_1);
21566   __Pyx_XDECREF(__pyx_t_2);
21567   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
21568   __pyx_r = NULL;
21569   __pyx_L0:;
21570   __Pyx_XGIVEREF(__pyx_r);
21571   __Pyx_RefNannyFinishContext();
21572   return __pyx_r;
21573 }
21574 
21575 /* Python wrapper */
21576 static PyObject *__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_97morton_qsort(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
21577 static PyMethodDef __pyx_fuse_1__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_97morton_qsort = {"__pyx_fuse_1morton_qsort", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_97morton_qsort, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_97morton_qsort(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)21578 static PyObject *__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_97morton_qsort(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
21579   PyArrayObject *__pyx_v_pos = 0;
21580   __pyx_t_5numpy_int64_t __pyx_v_l;
21581   __pyx_t_5numpy_int64_t __pyx_v_h;
21582   PyArrayObject *__pyx_v_ind = 0;
21583   PyObject *__pyx_v_recursive = 0;
21584   PyObject *__pyx_v_use_loop = 0;
21585   PyObject *__pyx_r = 0;
21586   __Pyx_RefNannyDeclarations
21587   __Pyx_RefNannySetupContext("morton_qsort (wrapper)", 0);
21588   {
21589     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_l,&__pyx_n_s_h,&__pyx_n_s_ind,&__pyx_n_s_recursive,&__pyx_n_s_use_loop,0};
21590     PyObject* values[6] = {0,0,0,0,0,0};
21591     __pyx_defaults15 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults15, __pyx_self);
21592     values[4] = __pyx_dynamic_args->__pyx_arg_recursive;
21593     values[5] = __pyx_dynamic_args->__pyx_arg_use_loop;
21594     if (unlikely(__pyx_kwds)) {
21595       Py_ssize_t kw_args;
21596       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
21597       switch (pos_args) {
21598         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
21599         CYTHON_FALLTHROUGH;
21600         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
21601         CYTHON_FALLTHROUGH;
21602         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
21603         CYTHON_FALLTHROUGH;
21604         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
21605         CYTHON_FALLTHROUGH;
21606         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
21607         CYTHON_FALLTHROUGH;
21608         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
21609         CYTHON_FALLTHROUGH;
21610         case  0: break;
21611         default: goto __pyx_L5_argtuple_error;
21612       }
21613       kw_args = PyDict_Size(__pyx_kwds);
21614       switch (pos_args) {
21615         case  0:
21616         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
21617         else goto __pyx_L5_argtuple_error;
21618         CYTHON_FALLTHROUGH;
21619         case  1:
21620         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_l)) != 0)) kw_args--;
21621         else {
21622           __Pyx_RaiseArgtupleInvalid("morton_qsort", 0, 4, 6, 1); __PYX_ERR(1, 856, __pyx_L3_error)
21623         }
21624         CYTHON_FALLTHROUGH;
21625         case  2:
21626         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
21627         else {
21628           __Pyx_RaiseArgtupleInvalid("morton_qsort", 0, 4, 6, 2); __PYX_ERR(1, 856, __pyx_L3_error)
21629         }
21630         CYTHON_FALLTHROUGH;
21631         case  3:
21632         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind)) != 0)) kw_args--;
21633         else {
21634           __Pyx_RaiseArgtupleInvalid("morton_qsort", 0, 4, 6, 3); __PYX_ERR(1, 856, __pyx_L3_error)
21635         }
21636         CYTHON_FALLTHROUGH;
21637         case  4:
21638         if (kw_args > 0) {
21639           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_recursive);
21640           if (value) { values[4] = value; kw_args--; }
21641         }
21642         CYTHON_FALLTHROUGH;
21643         case  5:
21644         if (kw_args > 0) {
21645           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_use_loop);
21646           if (value) { values[5] = value; kw_args--; }
21647         }
21648       }
21649       if (unlikely(kw_args > 0)) {
21650         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "morton_qsort") < 0)) __PYX_ERR(1, 856, __pyx_L3_error)
21651       }
21652     } else {
21653       switch (PyTuple_GET_SIZE(__pyx_args)) {
21654         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
21655         CYTHON_FALLTHROUGH;
21656         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
21657         CYTHON_FALLTHROUGH;
21658         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
21659         values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
21660         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
21661         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
21662         break;
21663         default: goto __pyx_L5_argtuple_error;
21664       }
21665     }
21666     __pyx_v_pos = ((PyArrayObject *)values[0]);
21667     __pyx_v_l = __Pyx_PyInt_As_npy_int64(values[1]); if (unlikely((__pyx_v_l == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 857, __pyx_L3_error)
21668     __pyx_v_h = __Pyx_PyInt_As_npy_int64(values[2]); if (unlikely((__pyx_v_h == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 857, __pyx_L3_error)
21669     __pyx_v_ind = ((PyArrayObject *)values[3]);
21670     __pyx_v_recursive = values[4];
21671     __pyx_v_use_loop = values[5];
21672   }
21673   goto __pyx_L4_argument_unpacking_done;
21674   __pyx_L5_argtuple_error:;
21675   __Pyx_RaiseArgtupleInvalid("morton_qsort", 0, 4, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 856, __pyx_L3_error)
21676   __pyx_L3_error:;
21677   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_qsort", __pyx_clineno, __pyx_lineno, __pyx_filename);
21678   __Pyx_RefNannyFinishContext();
21679   return NULL;
21680   __pyx_L4_argument_unpacking_done:;
21681   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 1, "pos", 0))) __PYX_ERR(1, 856, __pyx_L1_error)
21682   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ind), __pyx_ptype_5numpy_ndarray, 1, "ind", 0))) __PYX_ERR(1, 858, __pyx_L1_error)
21683   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_96morton_qsort(__pyx_self, __pyx_v_pos, __pyx_v_l, __pyx_v_h, __pyx_v_ind, __pyx_v_recursive, __pyx_v_use_loop);
21684 
21685   /* function exit code */
21686   goto __pyx_L0;
21687   __pyx_L1_error:;
21688   __pyx_r = NULL;
21689   __pyx_L0:;
21690   __Pyx_RefNannyFinishContext();
21691   return __pyx_r;
21692 }
21693 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_96morton_qsort(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_pos,__pyx_t_5numpy_int64_t __pyx_v_l,__pyx_t_5numpy_int64_t __pyx_v_h,PyArrayObject * __pyx_v_ind,PyObject * __pyx_v_recursive,PyObject * __pyx_v_use_loop)21694 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_96morton_qsort(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_int64_t __pyx_v_l, __pyx_t_5numpy_int64_t __pyx_v_h, PyArrayObject *__pyx_v_ind, PyObject *__pyx_v_recursive, PyObject *__pyx_v_use_loop) {
21695   __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
21696   __Pyx_Buffer __pyx_pybuffer_ind;
21697   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos;
21698   __Pyx_Buffer __pyx_pybuffer_pos;
21699   PyObject *__pyx_r = NULL;
21700   __Pyx_RefNannyDeclarations
21701   int __pyx_t_1;
21702   PyObject *__pyx_t_2 = NULL;
21703   PyObject *__pyx_t_3 = NULL;
21704   PyObject *__pyx_t_4 = NULL;
21705   PyObject *__pyx_t_5 = NULL;
21706   __Pyx_RefNannySetupContext("__pyx_fuse_1morton_qsort", 0);
21707   __pyx_pybuffer_pos.pybuffer.buf = NULL;
21708   __pyx_pybuffer_pos.refcount = 0;
21709   __pyx_pybuffernd_pos.data = NULL;
21710   __pyx_pybuffernd_pos.rcbuffer = &__pyx_pybuffer_pos;
21711   __pyx_pybuffer_ind.pybuffer.buf = NULL;
21712   __pyx_pybuffer_ind.refcount = 0;
21713   __pyx_pybuffernd_ind.data = NULL;
21714   __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;
21715   {
21716     __Pyx_BufFmt_StackElem __pyx_stack[1];
21717     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(1, 856, __pyx_L1_error)
21718   }
21719   __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1];
21720   {
21721     __Pyx_BufFmt_StackElem __pyx_stack[1];
21722     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 856, __pyx_L1_error)
21723   }
21724   __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
21725 
21726   /* "yt/utilities/lib/geometry_utils.pyx":862
21727  *                  use_loop = False):
21728  *     #get_morton_argsort1(pos,l,h,ind)
21729  *     if recursive:             # <<<<<<<<<<<<<<
21730  *         morton_qsort_recursive(pos,l,h,ind,use_loop=use_loop)
21731  *     else:
21732  */
21733   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_recursive); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 862, __pyx_L1_error)
21734   if (__pyx_t_1) {
21735 
21736     /* "yt/utilities/lib/geometry_utils.pyx":863
21737  *     #get_morton_argsort1(pos,l,h,ind)
21738  *     if recursive:
21739  *         morton_qsort_recursive(pos,l,h,ind,use_loop=use_loop)             # <<<<<<<<<<<<<<
21740  *     else:
21741  *         morton_qsort_iterative(pos,l,h,ind,use_loop=use_loop)
21742  */
21743     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_morton_qsort_recursive); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 863, __pyx_L1_error)
21744     __Pyx_GOTREF(__pyx_t_2);
21745     __pyx_t_3 = __Pyx_PyInt_From_npy_int64(__pyx_v_l); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 863, __pyx_L1_error)
21746     __Pyx_GOTREF(__pyx_t_3);
21747     __pyx_t_4 = __Pyx_PyInt_From_npy_int64(__pyx_v_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 863, __pyx_L1_error)
21748     __Pyx_GOTREF(__pyx_t_4);
21749     __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 863, __pyx_L1_error)
21750     __Pyx_GOTREF(__pyx_t_5);
21751     __Pyx_INCREF(((PyObject *)__pyx_v_pos));
21752     __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
21753     PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_pos));
21754     __Pyx_GIVEREF(__pyx_t_3);
21755     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
21756     __Pyx_GIVEREF(__pyx_t_4);
21757     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
21758     __Pyx_INCREF(((PyObject *)__pyx_v_ind));
21759     __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
21760     PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_v_ind));
21761     __pyx_t_3 = 0;
21762     __pyx_t_4 = 0;
21763     __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 863, __pyx_L1_error)
21764     __Pyx_GOTREF(__pyx_t_4);
21765     if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_use_loop, __pyx_v_use_loop) < 0) __PYX_ERR(1, 863, __pyx_L1_error)
21766     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 863, __pyx_L1_error)
21767     __Pyx_GOTREF(__pyx_t_3);
21768     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21769     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
21770     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21771     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21772 
21773     /* "yt/utilities/lib/geometry_utils.pyx":862
21774  *                  use_loop = False):
21775  *     #get_morton_argsort1(pos,l,h,ind)
21776  *     if recursive:             # <<<<<<<<<<<<<<
21777  *         morton_qsort_recursive(pos,l,h,ind,use_loop=use_loop)
21778  *     else:
21779  */
21780     goto __pyx_L3;
21781   }
21782 
21783   /* "yt/utilities/lib/geometry_utils.pyx":865
21784  *         morton_qsort_recursive(pos,l,h,ind,use_loop=use_loop)
21785  *     else:
21786  *         morton_qsort_iterative(pos,l,h,ind,use_loop=use_loop)             # <<<<<<<<<<<<<<
21787  *
21788  * @cython.cdivision(True)
21789  */
21790   /*else*/ {
21791     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_morton_qsort_iterative); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 865, __pyx_L1_error)
21792     __Pyx_GOTREF(__pyx_t_3);
21793     __pyx_t_4 = __Pyx_PyInt_From_npy_int64(__pyx_v_l); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 865, __pyx_L1_error)
21794     __Pyx_GOTREF(__pyx_t_4);
21795     __pyx_t_5 = __Pyx_PyInt_From_npy_int64(__pyx_v_h); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 865, __pyx_L1_error)
21796     __Pyx_GOTREF(__pyx_t_5);
21797     __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 865, __pyx_L1_error)
21798     __Pyx_GOTREF(__pyx_t_2);
21799     __Pyx_INCREF(((PyObject *)__pyx_v_pos));
21800     __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
21801     PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_pos));
21802     __Pyx_GIVEREF(__pyx_t_4);
21803     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
21804     __Pyx_GIVEREF(__pyx_t_5);
21805     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
21806     __Pyx_INCREF(((PyObject *)__pyx_v_ind));
21807     __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
21808     PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_v_ind));
21809     __pyx_t_4 = 0;
21810     __pyx_t_5 = 0;
21811     __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 865, __pyx_L1_error)
21812     __Pyx_GOTREF(__pyx_t_5);
21813     if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_use_loop, __pyx_v_use_loop) < 0) __PYX_ERR(1, 865, __pyx_L1_error)
21814     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 865, __pyx_L1_error)
21815     __Pyx_GOTREF(__pyx_t_4);
21816     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21817     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21818     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
21819     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21820   }
21821   __pyx_L3:;
21822 
21823   /* "yt/utilities/lib/geometry_utils.pyx":856
21824  * @cython.boundscheck(False)
21825  * @cython.wraparound(False)
21826  * def morton_qsort(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
21827  *                  np.int64_t l, np.int64_t h,
21828  *                  np.ndarray[np.uint64_t, ndim=1] ind,
21829  */
21830 
21831   /* function exit code */
21832   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21833   goto __pyx_L0;
21834   __pyx_L1_error:;
21835   __Pyx_XDECREF(__pyx_t_2);
21836   __Pyx_XDECREF(__pyx_t_3);
21837   __Pyx_XDECREF(__pyx_t_4);
21838   __Pyx_XDECREF(__pyx_t_5);
21839   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
21840     __Pyx_PyThreadState_declare
21841     __Pyx_PyThreadState_assign
21842     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
21843     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
21844     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
21845   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
21846   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.morton_qsort", __pyx_clineno, __pyx_lineno, __pyx_filename);
21847   __pyx_r = NULL;
21848   goto __pyx_L2;
21849   __pyx_L0:;
21850   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
21851   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
21852   __pyx_L2:;
21853   __Pyx_XGIVEREF(__pyx_r);
21854   __Pyx_RefNannyFinishContext();
21855   return __pyx_r;
21856 }
21857 
21858 /* "yt/utilities/lib/geometry_utils.pyx":870
21859  * @cython.boundscheck(False)
21860  * @cython.wraparound(False)
21861  * def get_morton_argsort1(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
21862  *                         np.int64_t start, np.int64_t end,
21863  *                         np.ndarray[np.uint64_t, ndim=1] ind):
21864  */
21865 
21866 /* Python wrapper */
21867 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_55get_morton_argsort1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
21868 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_55get_morton_argsort1 = {"get_morton_argsort1", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_55get_morton_argsort1, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_55get_morton_argsort1(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)21869 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_55get_morton_argsort1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
21870   PyObject *__pyx_v_signatures = 0;
21871   PyObject *__pyx_v_args = 0;
21872   PyObject *__pyx_v_kwargs = 0;
21873   CYTHON_UNUSED PyObject *__pyx_v_defaults = 0;
21874   PyObject *__pyx_r = 0;
21875   __Pyx_RefNannyDeclarations
21876   __Pyx_RefNannySetupContext("__pyx_fused_cpdef (wrapper)", 0);
21877   {
21878     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_signatures,&__pyx_n_s_args,&__pyx_n_s_kwargs,&__pyx_n_s_defaults,0};
21879     PyObject* values[4] = {0,0,0,0};
21880     if (unlikely(__pyx_kwds)) {
21881       Py_ssize_t kw_args;
21882       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
21883       switch (pos_args) {
21884         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
21885         CYTHON_FALLTHROUGH;
21886         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
21887         CYTHON_FALLTHROUGH;
21888         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
21889         CYTHON_FALLTHROUGH;
21890         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
21891         CYTHON_FALLTHROUGH;
21892         case  0: break;
21893         default: goto __pyx_L5_argtuple_error;
21894       }
21895       kw_args = PyDict_Size(__pyx_kwds);
21896       switch (pos_args) {
21897         case  0:
21898         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_signatures)) != 0)) kw_args--;
21899         else goto __pyx_L5_argtuple_error;
21900         CYTHON_FALLTHROUGH;
21901         case  1:
21902         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--;
21903         else {
21904           __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 1); __PYX_ERR(1, 870, __pyx_L3_error)
21905         }
21906         CYTHON_FALLTHROUGH;
21907         case  2:
21908         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--;
21909         else {
21910           __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 2); __PYX_ERR(1, 870, __pyx_L3_error)
21911         }
21912         CYTHON_FALLTHROUGH;
21913         case  3:
21914         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_defaults)) != 0)) kw_args--;
21915         else {
21916           __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 3); __PYX_ERR(1, 870, __pyx_L3_error)
21917         }
21918       }
21919       if (unlikely(kw_args > 0)) {
21920         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fused_cpdef") < 0)) __PYX_ERR(1, 870, __pyx_L3_error)
21921       }
21922     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
21923       goto __pyx_L5_argtuple_error;
21924     } else {
21925       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
21926       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
21927       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
21928       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
21929     }
21930     __pyx_v_signatures = values[0];
21931     __pyx_v_args = values[1];
21932     __pyx_v_kwargs = values[2];
21933     __pyx_v_defaults = values[3];
21934   }
21935   goto __pyx_L4_argument_unpacking_done;
21936   __pyx_L5_argtuple_error:;
21937   __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 870, __pyx_L3_error)
21938   __pyx_L3_error:;
21939   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename);
21940   __Pyx_RefNannyFinishContext();
21941   return NULL;
21942   __pyx_L4_argument_unpacking_done:;
21943   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_54get_morton_argsort1(__pyx_self, __pyx_v_signatures, __pyx_v_args, __pyx_v_kwargs, __pyx_v_defaults);
21944 
21945   /* function exit code */
21946   __Pyx_RefNannyFinishContext();
21947   return __pyx_r;
21948 }
21949 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_54get_morton_argsort1(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_signatures,PyObject * __pyx_v_args,PyObject * __pyx_v_kwargs,CYTHON_UNUSED PyObject * __pyx_v_defaults)21950 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_54get_morton_argsort1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults) {
21951   PyObject *__pyx_v_dest_sig = NULL;
21952   Py_ssize_t __pyx_v_i;
21953   PyTypeObject *__pyx_v_ndarray = 0;
21954   __Pyx_memviewslice __pyx_v_memslice;
21955   Py_ssize_t __pyx_v_itemsize;
21956   CYTHON_UNUSED int __pyx_v_dtype_signed;
21957   char __pyx_v_kind;
21958   PyObject *__pyx_v_arg = NULL;
21959   PyObject *__pyx_v_dtype = NULL;
21960   PyObject *__pyx_v_arg_base = NULL;
21961   PyObject *__pyx_v_candidates = NULL;
21962   PyObject *__pyx_v_sig = NULL;
21963   int __pyx_v_match_found;
21964   PyObject *__pyx_v_src_sig = NULL;
21965   PyObject *__pyx_v_dst_type = NULL;
21966   PyObject *__pyx_r = NULL;
21967   __Pyx_RefNannyDeclarations
21968   PyObject *__pyx_t_1 = NULL;
21969   int __pyx_t_2;
21970   int __pyx_t_3;
21971   int __pyx_t_4;
21972   Py_ssize_t __pyx_t_5;
21973   PyObject *__pyx_t_6 = NULL;
21974   long __pyx_t_7;
21975   __Pyx_memviewslice __pyx_t_8;
21976   Py_ssize_t __pyx_t_9;
21977   int __pyx_t_10;
21978   int __pyx_t_11;
21979   PyObject *__pyx_t_12 = NULL;
21980   PyObject *__pyx_t_13 = NULL;
21981   PyObject *__pyx_t_14 = NULL;
21982   Py_ssize_t __pyx_t_15;
21983   Py_ssize_t __pyx_t_16;
21984   Py_ssize_t __pyx_t_17;
21985   int __pyx_t_18;
21986   __Pyx_RefNannySetupContext("get_morton_argsort1", 0);
21987   __Pyx_INCREF(__pyx_v_kwargs);
21988   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 870, __pyx_L1_error)
21989   __Pyx_GOTREF(__pyx_t_1);
21990   __Pyx_INCREF(Py_None);
21991   __Pyx_GIVEREF(Py_None);
21992   PyList_SET_ITEM(__pyx_t_1, 0, Py_None);
21993   __pyx_v_dest_sig = ((PyObject*)__pyx_t_1);
21994   __pyx_t_1 = 0;
21995   __pyx_t_3 = (__pyx_v_kwargs != Py_None);
21996   __pyx_t_4 = (__pyx_t_3 != 0);
21997   if (__pyx_t_4) {
21998   } else {
21999     __pyx_t_2 = __pyx_t_4;
22000     goto __pyx_L4_bool_binop_done;
22001   }
22002   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_kwargs); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 870, __pyx_L1_error)
22003   __pyx_t_3 = ((!__pyx_t_4) != 0);
22004   __pyx_t_2 = __pyx_t_3;
22005   __pyx_L4_bool_binop_done:;
22006   if (__pyx_t_2) {
22007     __Pyx_INCREF(Py_None);
22008     __Pyx_DECREF_SET(__pyx_v_kwargs, Py_None);
22009   }
22010   __pyx_t_1 = ((PyObject *)__Pyx_ImportNumPyArrayTypeIfAvailable()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 870, __pyx_L1_error)
22011   __Pyx_GOTREF(__pyx_t_1);
22012   __pyx_v_ndarray = ((PyTypeObject*)__pyx_t_1);
22013   __pyx_t_1 = 0;
22014   __pyx_v_itemsize = -1L;
22015   if (unlikely(__pyx_v_args == Py_None)) {
22016     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
22017     __PYX_ERR(1, 870, __pyx_L1_error)
22018   }
22019   __pyx_t_5 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 870, __pyx_L1_error)
22020   __pyx_t_2 = ((0 < __pyx_t_5) != 0);
22021   if (__pyx_t_2) {
22022     if (unlikely(__pyx_v_args == Py_None)) {
22023       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
22024       __PYX_ERR(1, 870, __pyx_L1_error)
22025     }
22026     __pyx_t_1 = PyTuple_GET_ITEM(((PyObject*)__pyx_v_args), 0);
22027     __Pyx_INCREF(__pyx_t_1);
22028     __pyx_v_arg = __pyx_t_1;
22029     __pyx_t_1 = 0;
22030     goto __pyx_L6;
22031   }
22032   __pyx_t_3 = (__pyx_v_kwargs != Py_None);
22033   __pyx_t_4 = (__pyx_t_3 != 0);
22034   if (__pyx_t_4) {
22035   } else {
22036     __pyx_t_2 = __pyx_t_4;
22037     goto __pyx_L7_bool_binop_done;
22038   }
22039   if (unlikely(__pyx_v_kwargs == Py_None)) {
22040     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
22041     __PYX_ERR(1, 870, __pyx_L1_error)
22042   }
22043   __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_pos, ((PyObject*)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 870, __pyx_L1_error)
22044   __pyx_t_3 = (__pyx_t_4 != 0);
22045   __pyx_t_2 = __pyx_t_3;
22046   __pyx_L7_bool_binop_done:;
22047   if (__pyx_t_2) {
22048     if (unlikely(__pyx_v_kwargs == Py_None)) {
22049       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
22050       __PYX_ERR(1, 870, __pyx_L1_error)
22051     }
22052     __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_kwargs), __pyx_n_s_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 870, __pyx_L1_error)
22053     __Pyx_GOTREF(__pyx_t_1);
22054     __pyx_v_arg = __pyx_t_1;
22055     __pyx_t_1 = 0;
22056     goto __pyx_L6;
22057   }
22058   /*else*/ {
22059     if (unlikely(__pyx_v_args == Py_None)) {
22060       PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
22061       __PYX_ERR(1, 870, __pyx_L1_error)
22062     }
22063     __pyx_t_5 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 870, __pyx_L1_error)
22064     __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 870, __pyx_L1_error)
22065     __Pyx_GOTREF(__pyx_t_1);
22066     __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 870, __pyx_L1_error)
22067     __Pyx_GOTREF(__pyx_t_6);
22068     __Pyx_INCREF(__pyx_int_4);
22069     __Pyx_GIVEREF(__pyx_int_4);
22070     PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_4);
22071     __Pyx_INCREF(__pyx_n_s_s);
22072     __Pyx_GIVEREF(__pyx_n_s_s);
22073     PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_n_s_s);
22074     __Pyx_GIVEREF(__pyx_t_1);
22075     PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1);
22076     __pyx_t_1 = 0;
22077     __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Expected_at_least_d_argument_s_g, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 870, __pyx_L1_error)
22078     __Pyx_GOTREF(__pyx_t_1);
22079     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22080     __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 870, __pyx_L1_error)
22081     __Pyx_GOTREF(__pyx_t_6);
22082     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22083     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
22084     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22085     __PYX_ERR(1, 870, __pyx_L1_error)
22086   }
22087   __pyx_L6:;
22088   while (1) {
22089     __pyx_t_2 = (__pyx_v_ndarray != ((PyTypeObject*)Py_None));
22090     __pyx_t_3 = (__pyx_t_2 != 0);
22091     if (__pyx_t_3) {
22092       __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_arg, __pyx_v_ndarray);
22093       __pyx_t_2 = (__pyx_t_3 != 0);
22094       if (__pyx_t_2) {
22095         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 870, __pyx_L1_error)
22096         __Pyx_GOTREF(__pyx_t_6);
22097         __pyx_v_dtype = __pyx_t_6;
22098         __pyx_t_6 = 0;
22099         goto __pyx_L12;
22100       }
22101       __pyx_t_2 = __pyx_memoryview_check(__pyx_v_arg);
22102       __pyx_t_3 = (__pyx_t_2 != 0);
22103       if (__pyx_t_3) {
22104         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_base); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 870, __pyx_L1_error)
22105         __Pyx_GOTREF(__pyx_t_6);
22106         __pyx_v_arg_base = __pyx_t_6;
22107         __pyx_t_6 = 0;
22108         __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_arg_base, __pyx_v_ndarray);
22109         __pyx_t_2 = (__pyx_t_3 != 0);
22110         if (__pyx_t_2) {
22111           __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg_base, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 870, __pyx_L1_error)
22112           __Pyx_GOTREF(__pyx_t_6);
22113           __pyx_v_dtype = __pyx_t_6;
22114           __pyx_t_6 = 0;
22115           goto __pyx_L13;
22116         }
22117         /*else*/ {
22118           __Pyx_INCREF(Py_None);
22119           __pyx_v_dtype = Py_None;
22120         }
22121         __pyx_L13:;
22122         goto __pyx_L12;
22123       }
22124       /*else*/ {
22125         __Pyx_INCREF(Py_None);
22126         __pyx_v_dtype = Py_None;
22127       }
22128       __pyx_L12:;
22129       __pyx_v_itemsize = -1L;
22130       __pyx_t_2 = (__pyx_v_dtype != Py_None);
22131       __pyx_t_3 = (__pyx_t_2 != 0);
22132       if (__pyx_t_3) {
22133         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 870, __pyx_L1_error)
22134         __Pyx_GOTREF(__pyx_t_6);
22135         __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 870, __pyx_L1_error)
22136         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22137         __pyx_v_itemsize = __pyx_t_5;
22138         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 870, __pyx_L1_error)
22139         __Pyx_GOTREF(__pyx_t_6);
22140         __pyx_t_7 = __Pyx_PyObject_Ord(__pyx_t_6); if (unlikely(__pyx_t_7 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(1, 870, __pyx_L1_error)
22141         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22142         __pyx_v_kind = __pyx_t_7;
22143         __pyx_v_dtype_signed = (__pyx_v_kind == 'i');
22144         switch (__pyx_v_kind) {
22145           case 'i':
22146           case 'u':
22147           break;
22148           case 'f':
22149           __pyx_t_2 = (((sizeof(float)) == __pyx_v_itemsize) != 0);
22150           if (__pyx_t_2) {
22151           } else {
22152             __pyx_t_3 = __pyx_t_2;
22153             goto __pyx_L16_bool_binop_done;
22154           }
22155           __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 870, __pyx_L1_error)
22156           __Pyx_GOTREF(__pyx_t_6);
22157           __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 870, __pyx_L1_error)
22158           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22159           __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
22160           __pyx_t_3 = __pyx_t_2;
22161           __pyx_L16_bool_binop_done:;
22162           if (__pyx_t_3) {
22163             if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(1, 870, __pyx_L1_error)
22164             goto __pyx_L10_break;
22165           }
22166           __pyx_t_2 = (((sizeof(double)) == __pyx_v_itemsize) != 0);
22167           if (__pyx_t_2) {
22168           } else {
22169             __pyx_t_3 = __pyx_t_2;
22170             goto __pyx_L19_bool_binop_done;
22171           }
22172           __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 870, __pyx_L1_error)
22173           __Pyx_GOTREF(__pyx_t_6);
22174           __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 870, __pyx_L1_error)
22175           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22176           __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 2) != 0);
22177           __pyx_t_3 = __pyx_t_2;
22178           __pyx_L19_bool_binop_done:;
22179           if (__pyx_t_3) {
22180             if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_double, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(1, 870, __pyx_L1_error)
22181             goto __pyx_L10_break;
22182           }
22183           break;
22184           case 'c':
22185           break;
22186           case 'O':
22187           break;
22188           default: break;
22189         }
22190       }
22191     }
22192     __pyx_t_2 = ((__pyx_v_itemsize == -1L) != 0);
22193     if (!__pyx_t_2) {
22194     } else {
22195       __pyx_t_3 = __pyx_t_2;
22196       goto __pyx_L22_bool_binop_done;
22197     }
22198     __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(float))) != 0);
22199     __pyx_t_3 = __pyx_t_2;
22200     __pyx_L22_bool_binop_done:;
22201     if (__pyx_t_3) {
22202       __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_v_arg, 0);
22203       __pyx_v_memslice = __pyx_t_8;
22204       __pyx_t_3 = (__pyx_v_memslice.memview != 0);
22205       if (__pyx_t_3) {
22206         __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1);
22207         if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(1, 870, __pyx_L1_error)
22208         goto __pyx_L10_break;
22209       }
22210       /*else*/ {
22211         PyErr_Clear();
22212       }
22213     }
22214     __pyx_t_2 = ((__pyx_v_itemsize == -1L) != 0);
22215     if (!__pyx_t_2) {
22216     } else {
22217       __pyx_t_3 = __pyx_t_2;
22218       goto __pyx_L26_bool_binop_done;
22219     }
22220     __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(double))) != 0);
22221     __pyx_t_3 = __pyx_t_2;
22222     __pyx_L26_bool_binop_done:;
22223     if (__pyx_t_3) {
22224       __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_v_arg, 0);
22225       __pyx_v_memslice = __pyx_t_8;
22226       __pyx_t_3 = (__pyx_v_memslice.memview != 0);
22227       if (__pyx_t_3) {
22228         __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1);
22229         if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_double, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(1, 870, __pyx_L1_error)
22230         goto __pyx_L10_break;
22231       }
22232       /*else*/ {
22233         PyErr_Clear();
22234       }
22235     }
22236     if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, Py_None, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(1, 870, __pyx_L1_error)
22237     goto __pyx_L10_break;
22238   }
22239   __pyx_L10_break:;
22240   __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 870, __pyx_L1_error)
22241   __Pyx_GOTREF(__pyx_t_6);
22242   __pyx_v_candidates = ((PyObject*)__pyx_t_6);
22243   __pyx_t_6 = 0;
22244   __pyx_t_5 = 0;
22245   if (unlikely(__pyx_v_signatures == Py_None)) {
22246     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
22247     __PYX_ERR(1, 870, __pyx_L1_error)
22248   }
22249   __pyx_t_1 = __Pyx_dict_iterator(((PyObject*)__pyx_v_signatures), 1, ((PyObject *)NULL), (&__pyx_t_9), (&__pyx_t_10)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 870, __pyx_L1_error)
22250   __Pyx_GOTREF(__pyx_t_1);
22251   __Pyx_XDECREF(__pyx_t_6);
22252   __pyx_t_6 = __pyx_t_1;
22253   __pyx_t_1 = 0;
22254   while (1) {
22255     __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_9, &__pyx_t_5, &__pyx_t_1, NULL, NULL, __pyx_t_10);
22256     if (unlikely(__pyx_t_11 == 0)) break;
22257     if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(1, 870, __pyx_L1_error)
22258     __Pyx_GOTREF(__pyx_t_1);
22259     __Pyx_XDECREF_SET(__pyx_v_sig, __pyx_t_1);
22260     __pyx_t_1 = 0;
22261     __pyx_v_match_found = 0;
22262     __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_sig, __pyx_n_s_strip); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 870, __pyx_L1_error)
22263     __Pyx_GOTREF(__pyx_t_13);
22264     __pyx_t_14 = NULL;
22265     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
22266       __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_13);
22267       if (likely(__pyx_t_14)) {
22268         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
22269         __Pyx_INCREF(__pyx_t_14);
22270         __Pyx_INCREF(function);
22271         __Pyx_DECREF_SET(__pyx_t_13, function);
22272       }
22273     }
22274     __pyx_t_12 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_14, __pyx_kp_s__5) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_kp_s__5);
22275     __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
22276     if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 870, __pyx_L1_error)
22277     __Pyx_GOTREF(__pyx_t_12);
22278     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
22279     __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_split); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 870, __pyx_L1_error)
22280     __Pyx_GOTREF(__pyx_t_13);
22281     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
22282     __pyx_t_12 = NULL;
22283     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
22284       __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13);
22285       if (likely(__pyx_t_12)) {
22286         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
22287         __Pyx_INCREF(__pyx_t_12);
22288         __Pyx_INCREF(function);
22289         __Pyx_DECREF_SET(__pyx_t_13, function);
22290       }
22291     }
22292     __pyx_t_1 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_12, __pyx_kp_s__6) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_kp_s__6);
22293     __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
22294     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 870, __pyx_L1_error)
22295     __Pyx_GOTREF(__pyx_t_1);
22296     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
22297     __Pyx_XDECREF_SET(__pyx_v_src_sig, __pyx_t_1);
22298     __pyx_t_1 = 0;
22299     __pyx_t_15 = PyList_GET_SIZE(__pyx_v_dest_sig); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(1, 870, __pyx_L1_error)
22300     __pyx_t_16 = __pyx_t_15;
22301     for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
22302       __pyx_v_i = __pyx_t_17;
22303       __pyx_t_1 = PyList_GET_ITEM(__pyx_v_dest_sig, __pyx_v_i);
22304       __Pyx_INCREF(__pyx_t_1);
22305       __Pyx_XDECREF_SET(__pyx_v_dst_type, __pyx_t_1);
22306       __pyx_t_1 = 0;
22307       __pyx_t_3 = (__pyx_v_dst_type != Py_None);
22308       __pyx_t_2 = (__pyx_t_3 != 0);
22309       if (__pyx_t_2) {
22310         __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_src_sig, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 870, __pyx_L1_error)
22311         __Pyx_GOTREF(__pyx_t_1);
22312         __pyx_t_13 = PyObject_RichCompare(__pyx_t_1, __pyx_v_dst_type, Py_EQ); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 870, __pyx_L1_error)
22313         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22314         __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 870, __pyx_L1_error)
22315         __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
22316         if (__pyx_t_2) {
22317           __pyx_v_match_found = 1;
22318           goto __pyx_L34;
22319         }
22320         /*else*/ {
22321           __pyx_v_match_found = 0;
22322           goto __pyx_L32_break;
22323         }
22324         __pyx_L34:;
22325       }
22326     }
22327     __pyx_L32_break:;
22328     __pyx_t_2 = (__pyx_v_match_found != 0);
22329     if (__pyx_t_2) {
22330       __pyx_t_18 = __Pyx_PyList_Append(__pyx_v_candidates, __pyx_v_sig); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(1, 870, __pyx_L1_error)
22331     }
22332   }
22333   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22334   __pyx_t_2 = (PyList_GET_SIZE(__pyx_v_candidates) != 0);
22335   __pyx_t_3 = ((!__pyx_t_2) != 0);
22336   if (__pyx_t_3) {
22337     __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 870, __pyx_L1_error)
22338     __Pyx_GOTREF(__pyx_t_6);
22339     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
22340     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22341     __PYX_ERR(1, 870, __pyx_L1_error)
22342   }
22343   __pyx_t_9 = PyList_GET_SIZE(__pyx_v_candidates); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 870, __pyx_L1_error)
22344   __pyx_t_3 = ((__pyx_t_9 > 1) != 0);
22345   if (__pyx_t_3) {
22346     __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 870, __pyx_L1_error)
22347     __Pyx_GOTREF(__pyx_t_6);
22348     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
22349     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22350     __PYX_ERR(1, 870, __pyx_L1_error)
22351   }
22352   /*else*/ {
22353     __Pyx_XDECREF(__pyx_r);
22354     if (unlikely(__pyx_v_signatures == Py_None)) {
22355       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
22356       __PYX_ERR(1, 870, __pyx_L1_error)
22357     }
22358     __pyx_t_6 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_signatures), PyList_GET_ITEM(__pyx_v_candidates, 0)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 870, __pyx_L1_error)
22359     __Pyx_GOTREF(__pyx_t_6);
22360     __pyx_r = __pyx_t_6;
22361     __pyx_t_6 = 0;
22362     goto __pyx_L0;
22363   }
22364 
22365   /* function exit code */
22366   __pyx_L1_error:;
22367   __Pyx_XDECREF(__pyx_t_1);
22368   __Pyx_XDECREF(__pyx_t_6);
22369   __Pyx_XDECREF(__pyx_t_12);
22370   __Pyx_XDECREF(__pyx_t_13);
22371   __Pyx_XDECREF(__pyx_t_14);
22372   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename);
22373   __pyx_r = NULL;
22374   __pyx_L0:;
22375   __Pyx_XDECREF(__pyx_v_dest_sig);
22376   __Pyx_XDECREF(__pyx_v_ndarray);
22377   __Pyx_XDECREF(__pyx_v_arg);
22378   __Pyx_XDECREF(__pyx_v_dtype);
22379   __Pyx_XDECREF(__pyx_v_arg_base);
22380   __Pyx_XDECREF(__pyx_v_candidates);
22381   __Pyx_XDECREF(__pyx_v_sig);
22382   __Pyx_XDECREF(__pyx_v_src_sig);
22383   __Pyx_XDECREF(__pyx_v_dst_type);
22384   __Pyx_XDECREF(__pyx_v_kwargs);
22385   __Pyx_XGIVEREF(__pyx_r);
22386   __Pyx_RefNannyFinishContext();
22387   return __pyx_r;
22388 }
22389 
22390 /* Python wrapper */
22391 static PyObject *__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_101get_morton_argsort1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
22392 static PyMethodDef __pyx_fuse_0__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_101get_morton_argsort1 = {"__pyx_fuse_0get_morton_argsort1", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_101get_morton_argsort1, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_101get_morton_argsort1(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)22393 static PyObject *__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_101get_morton_argsort1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
22394   PyArrayObject *__pyx_v_pos = 0;
22395   __pyx_t_5numpy_int64_t __pyx_v_start;
22396   __pyx_t_5numpy_int64_t __pyx_v_end;
22397   PyArrayObject *__pyx_v_ind = 0;
22398   PyObject *__pyx_r = 0;
22399   __Pyx_RefNannyDeclarations
22400   __Pyx_RefNannySetupContext("get_morton_argsort1 (wrapper)", 0);
22401   {
22402     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_start,&__pyx_n_s_end,&__pyx_n_s_ind,0};
22403     PyObject* values[4] = {0,0,0,0};
22404     if (unlikely(__pyx_kwds)) {
22405       Py_ssize_t kw_args;
22406       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
22407       switch (pos_args) {
22408         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
22409         CYTHON_FALLTHROUGH;
22410         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
22411         CYTHON_FALLTHROUGH;
22412         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
22413         CYTHON_FALLTHROUGH;
22414         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
22415         CYTHON_FALLTHROUGH;
22416         case  0: break;
22417         default: goto __pyx_L5_argtuple_error;
22418       }
22419       kw_args = PyDict_Size(__pyx_kwds);
22420       switch (pos_args) {
22421         case  0:
22422         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
22423         else goto __pyx_L5_argtuple_error;
22424         CYTHON_FALLTHROUGH;
22425         case  1:
22426         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--;
22427         else {
22428           __Pyx_RaiseArgtupleInvalid("get_morton_argsort1", 1, 4, 4, 1); __PYX_ERR(1, 870, __pyx_L3_error)
22429         }
22430         CYTHON_FALLTHROUGH;
22431         case  2:
22432         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
22433         else {
22434           __Pyx_RaiseArgtupleInvalid("get_morton_argsort1", 1, 4, 4, 2); __PYX_ERR(1, 870, __pyx_L3_error)
22435         }
22436         CYTHON_FALLTHROUGH;
22437         case  3:
22438         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind)) != 0)) kw_args--;
22439         else {
22440           __Pyx_RaiseArgtupleInvalid("get_morton_argsort1", 1, 4, 4, 3); __PYX_ERR(1, 870, __pyx_L3_error)
22441         }
22442       }
22443       if (unlikely(kw_args > 0)) {
22444         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_morton_argsort1") < 0)) __PYX_ERR(1, 870, __pyx_L3_error)
22445       }
22446     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
22447       goto __pyx_L5_argtuple_error;
22448     } else {
22449       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
22450       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
22451       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
22452       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
22453     }
22454     __pyx_v_pos = ((PyArrayObject *)values[0]);
22455     __pyx_v_start = __Pyx_PyInt_As_npy_int64(values[1]); if (unlikely((__pyx_v_start == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 871, __pyx_L3_error)
22456     __pyx_v_end = __Pyx_PyInt_As_npy_int64(values[2]); if (unlikely((__pyx_v_end == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 871, __pyx_L3_error)
22457     __pyx_v_ind = ((PyArrayObject *)values[3]);
22458   }
22459   goto __pyx_L4_argument_unpacking_done;
22460   __pyx_L5_argtuple_error:;
22461   __Pyx_RaiseArgtupleInvalid("get_morton_argsort1", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 870, __pyx_L3_error)
22462   __pyx_L3_error:;
22463   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.get_morton_argsort1", __pyx_clineno, __pyx_lineno, __pyx_filename);
22464   __Pyx_RefNannyFinishContext();
22465   return NULL;
22466   __pyx_L4_argument_unpacking_done:;
22467   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 1, "pos", 0))) __PYX_ERR(1, 870, __pyx_L1_error)
22468   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ind), __pyx_ptype_5numpy_ndarray, 1, "ind", 0))) __PYX_ERR(1, 872, __pyx_L1_error)
22469   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_100get_morton_argsort1(__pyx_self, __pyx_v_pos, __pyx_v_start, __pyx_v_end, __pyx_v_ind);
22470 
22471   /* function exit code */
22472   goto __pyx_L0;
22473   __pyx_L1_error:;
22474   __pyx_r = NULL;
22475   __pyx_L0:;
22476   __Pyx_RefNannyFinishContext();
22477   return __pyx_r;
22478 }
22479 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_100get_morton_argsort1(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_pos,__pyx_t_5numpy_int64_t __pyx_v_start,__pyx_t_5numpy_int64_t __pyx_v_end,PyArrayObject * __pyx_v_ind)22480 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_100get_morton_argsort1(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_int64_t __pyx_v_start, __pyx_t_5numpy_int64_t __pyx_v_end, PyArrayObject *__pyx_v_ind) {
22481   __pyx_t_5numpy_int64_t __pyx_v_top;
22482   __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
22483   __Pyx_Buffer __pyx_pybuffer_ind;
22484   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos;
22485   __Pyx_Buffer __pyx_pybuffer_pos;
22486   PyObject *__pyx_r = NULL;
22487   __Pyx_RefNannyDeclarations
22488   int __pyx_t_1;
22489   PyObject *__pyx_t_2 = NULL;
22490   PyObject *__pyx_t_3 = NULL;
22491   PyObject *__pyx_t_4 = NULL;
22492   PyObject *__pyx_t_5 = NULL;
22493   PyObject *__pyx_t_6 = NULL;
22494   int __pyx_t_7;
22495   PyObject *__pyx_t_8 = NULL;
22496   __pyx_t_5numpy_int64_t __pyx_t_9;
22497   __Pyx_RefNannySetupContext("__pyx_fuse_0get_morton_argsort1", 0);
22498   __pyx_pybuffer_pos.pybuffer.buf = NULL;
22499   __pyx_pybuffer_pos.refcount = 0;
22500   __pyx_pybuffernd_pos.data = NULL;
22501   __pyx_pybuffernd_pos.rcbuffer = &__pyx_pybuffer_pos;
22502   __pyx_pybuffer_ind.pybuffer.buf = NULL;
22503   __pyx_pybuffer_ind.refcount = 0;
22504   __pyx_pybuffernd_ind.data = NULL;
22505   __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;
22506   {
22507     __Pyx_BufFmt_StackElem __pyx_stack[1];
22508     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_float, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(1, 870, __pyx_L1_error)
22509   }
22510   __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1];
22511   {
22512     __Pyx_BufFmt_StackElem __pyx_stack[1];
22513     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 870, __pyx_L1_error)
22514   }
22515   __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
22516 
22517   /* "yt/utilities/lib/geometry_utils.pyx":874
22518  *                         np.ndarray[np.uint64_t, ndim=1] ind):
22519  *     # Return if only one position selected
22520  *     if start >= end: return             # <<<<<<<<<<<<<<
22521  *     # Initialize
22522  *     cdef np.int64_t top
22523  */
22524   __pyx_t_1 = ((__pyx_v_start >= __pyx_v_end) != 0);
22525   if (__pyx_t_1) {
22526     __Pyx_XDECREF(__pyx_r);
22527     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
22528     goto __pyx_L0;
22529   }
22530 
22531   /* "yt/utilities/lib/geometry_utils.pyx":877
22532  *     # Initialize
22533  *     cdef np.int64_t top
22534  *     top = morton_qsort_partition(pos,start,end,ind)             # <<<<<<<<<<<<<<
22535  *     # Do remaining parts on either side of pivot, sort side first
22536  *     if (top-1-start < end-(top+1)):
22537  */
22538   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_morton_qsort_partition); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 877, __pyx_L1_error)
22539   __Pyx_GOTREF(__pyx_t_3);
22540   __pyx_t_4 = __Pyx_PyInt_From_npy_int64(__pyx_v_start); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 877, __pyx_L1_error)
22541   __Pyx_GOTREF(__pyx_t_4);
22542   __pyx_t_5 = __Pyx_PyInt_From_npy_int64(__pyx_v_end); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 877, __pyx_L1_error)
22543   __Pyx_GOTREF(__pyx_t_5);
22544   __pyx_t_6 = NULL;
22545   __pyx_t_7 = 0;
22546   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
22547     __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
22548     if (likely(__pyx_t_6)) {
22549       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
22550       __Pyx_INCREF(__pyx_t_6);
22551       __Pyx_INCREF(function);
22552       __Pyx_DECREF_SET(__pyx_t_3, function);
22553       __pyx_t_7 = 1;
22554     }
22555   }
22556   #if CYTHON_FAST_PYCALL
22557   if (PyFunction_Check(__pyx_t_3)) {
22558     PyObject *__pyx_temp[5] = {__pyx_t_6, ((PyObject *)__pyx_v_pos), __pyx_t_4, __pyx_t_5, ((PyObject *)__pyx_v_ind)};
22559     __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 877, __pyx_L1_error)
22560     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
22561     __Pyx_GOTREF(__pyx_t_2);
22562     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22563     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
22564   } else
22565   #endif
22566   #if CYTHON_FAST_PYCCALL
22567   if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
22568     PyObject *__pyx_temp[5] = {__pyx_t_6, ((PyObject *)__pyx_v_pos), __pyx_t_4, __pyx_t_5, ((PyObject *)__pyx_v_ind)};
22569     __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 877, __pyx_L1_error)
22570     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
22571     __Pyx_GOTREF(__pyx_t_2);
22572     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22573     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
22574   } else
22575   #endif
22576   {
22577     __pyx_t_8 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 877, __pyx_L1_error)
22578     __Pyx_GOTREF(__pyx_t_8);
22579     if (__pyx_t_6) {
22580       __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
22581     }
22582     __Pyx_INCREF(((PyObject *)__pyx_v_pos));
22583     __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
22584     PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, ((PyObject *)__pyx_v_pos));
22585     __Pyx_GIVEREF(__pyx_t_4);
22586     PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
22587     __Pyx_GIVEREF(__pyx_t_5);
22588     PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5);
22589     __Pyx_INCREF(((PyObject *)__pyx_v_ind));
22590     __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
22591     PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, ((PyObject *)__pyx_v_ind));
22592     __pyx_t_4 = 0;
22593     __pyx_t_5 = 0;
22594     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 877, __pyx_L1_error)
22595     __Pyx_GOTREF(__pyx_t_2);
22596     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
22597   }
22598   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22599   __pyx_t_9 = __Pyx_PyInt_As_npy_int64(__pyx_t_2); if (unlikely((__pyx_t_9 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 877, __pyx_L1_error)
22600   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22601   __pyx_v_top = __pyx_t_9;
22602 
22603   /* "yt/utilities/lib/geometry_utils.pyx":879
22604  *     top = morton_qsort_partition(pos,start,end,ind)
22605  *     # Do remaining parts on either side of pivot, sort side first
22606  *     if (top-1-start < end-(top+1)):             # <<<<<<<<<<<<<<
22607  *         get_morton_argsort1(pos,start,top-1,ind)
22608  *         get_morton_argsort1(pos,top+1,end,ind)
22609  */
22610   __pyx_t_1 = ((((__pyx_v_top - 1) - __pyx_v_start) < (__pyx_v_end - (__pyx_v_top + 1))) != 0);
22611   if (__pyx_t_1) {
22612 
22613     /* "yt/utilities/lib/geometry_utils.pyx":880
22614  *     # Do remaining parts on either side of pivot, sort side first
22615  *     if (top-1-start < end-(top+1)):
22616  *         get_morton_argsort1(pos,start,top-1,ind)             # <<<<<<<<<<<<<<
22617  *         get_morton_argsort1(pos,top+1,end,ind)
22618  *     else:
22619  */
22620     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_morton_argsort1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 880, __pyx_L1_error)
22621     __Pyx_GOTREF(__pyx_t_3);
22622     __pyx_t_8 = __Pyx_PyInt_From_npy_int64(__pyx_v_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 880, __pyx_L1_error)
22623     __Pyx_GOTREF(__pyx_t_8);
22624     __pyx_t_5 = __Pyx_PyInt_From_npy_int64((__pyx_v_top - 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 880, __pyx_L1_error)
22625     __Pyx_GOTREF(__pyx_t_5);
22626     __pyx_t_4 = NULL;
22627     __pyx_t_7 = 0;
22628     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
22629       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
22630       if (likely(__pyx_t_4)) {
22631         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
22632         __Pyx_INCREF(__pyx_t_4);
22633         __Pyx_INCREF(function);
22634         __Pyx_DECREF_SET(__pyx_t_3, function);
22635         __pyx_t_7 = 1;
22636       }
22637     }
22638     #if CYTHON_FAST_PYCALL
22639     if (PyFunction_Check(__pyx_t_3)) {
22640       PyObject *__pyx_temp[5] = {__pyx_t_4, ((PyObject *)__pyx_v_pos), __pyx_t_8, __pyx_t_5, ((PyObject *)__pyx_v_ind)};
22641       __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 880, __pyx_L1_error)
22642       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
22643       __Pyx_GOTREF(__pyx_t_2);
22644       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
22645       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
22646     } else
22647     #endif
22648     #if CYTHON_FAST_PYCCALL
22649     if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
22650       PyObject *__pyx_temp[5] = {__pyx_t_4, ((PyObject *)__pyx_v_pos), __pyx_t_8, __pyx_t_5, ((PyObject *)__pyx_v_ind)};
22651       __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 880, __pyx_L1_error)
22652       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
22653       __Pyx_GOTREF(__pyx_t_2);
22654       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
22655       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
22656     } else
22657     #endif
22658     {
22659       __pyx_t_6 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 880, __pyx_L1_error)
22660       __Pyx_GOTREF(__pyx_t_6);
22661       if (__pyx_t_4) {
22662         __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
22663       }
22664       __Pyx_INCREF(((PyObject *)__pyx_v_pos));
22665       __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
22666       PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, ((PyObject *)__pyx_v_pos));
22667       __Pyx_GIVEREF(__pyx_t_8);
22668       PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_8);
22669       __Pyx_GIVEREF(__pyx_t_5);
22670       PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_t_5);
22671       __Pyx_INCREF(((PyObject *)__pyx_v_ind));
22672       __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
22673       PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, ((PyObject *)__pyx_v_ind));
22674       __pyx_t_8 = 0;
22675       __pyx_t_5 = 0;
22676       __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 880, __pyx_L1_error)
22677       __Pyx_GOTREF(__pyx_t_2);
22678       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22679     }
22680     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22681     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22682 
22683     /* "yt/utilities/lib/geometry_utils.pyx":881
22684  *     if (top-1-start < end-(top+1)):
22685  *         get_morton_argsort1(pos,start,top-1,ind)
22686  *         get_morton_argsort1(pos,top+1,end,ind)             # <<<<<<<<<<<<<<
22687  *     else:
22688  *         get_morton_argsort1(pos,top+1,end,ind)
22689  */
22690     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_morton_argsort1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 881, __pyx_L1_error)
22691     __Pyx_GOTREF(__pyx_t_3);
22692     __pyx_t_6 = __Pyx_PyInt_From_npy_int64((__pyx_v_top + 1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 881, __pyx_L1_error)
22693     __Pyx_GOTREF(__pyx_t_6);
22694     __pyx_t_5 = __Pyx_PyInt_From_npy_int64(__pyx_v_end); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 881, __pyx_L1_error)
22695     __Pyx_GOTREF(__pyx_t_5);
22696     __pyx_t_8 = NULL;
22697     __pyx_t_7 = 0;
22698     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
22699       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
22700       if (likely(__pyx_t_8)) {
22701         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
22702         __Pyx_INCREF(__pyx_t_8);
22703         __Pyx_INCREF(function);
22704         __Pyx_DECREF_SET(__pyx_t_3, function);
22705         __pyx_t_7 = 1;
22706       }
22707     }
22708     #if CYTHON_FAST_PYCALL
22709     if (PyFunction_Check(__pyx_t_3)) {
22710       PyObject *__pyx_temp[5] = {__pyx_t_8, ((PyObject *)__pyx_v_pos), __pyx_t_6, __pyx_t_5, ((PyObject *)__pyx_v_ind)};
22711       __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 881, __pyx_L1_error)
22712       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
22713       __Pyx_GOTREF(__pyx_t_2);
22714       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22715       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
22716     } else
22717     #endif
22718     #if CYTHON_FAST_PYCCALL
22719     if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
22720       PyObject *__pyx_temp[5] = {__pyx_t_8, ((PyObject *)__pyx_v_pos), __pyx_t_6, __pyx_t_5, ((PyObject *)__pyx_v_ind)};
22721       __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 881, __pyx_L1_error)
22722       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
22723       __Pyx_GOTREF(__pyx_t_2);
22724       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22725       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
22726     } else
22727     #endif
22728     {
22729       __pyx_t_4 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 881, __pyx_L1_error)
22730       __Pyx_GOTREF(__pyx_t_4);
22731       if (__pyx_t_8) {
22732         __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8); __pyx_t_8 = NULL;
22733       }
22734       __Pyx_INCREF(((PyObject *)__pyx_v_pos));
22735       __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
22736       PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_7, ((PyObject *)__pyx_v_pos));
22737       __Pyx_GIVEREF(__pyx_t_6);
22738       PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_7, __pyx_t_6);
22739       __Pyx_GIVEREF(__pyx_t_5);
22740       PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_7, __pyx_t_5);
22741       __Pyx_INCREF(((PyObject *)__pyx_v_ind));
22742       __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
22743       PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_7, ((PyObject *)__pyx_v_ind));
22744       __pyx_t_6 = 0;
22745       __pyx_t_5 = 0;
22746       __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 881, __pyx_L1_error)
22747       __Pyx_GOTREF(__pyx_t_2);
22748       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22749     }
22750     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22751     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22752 
22753     /* "yt/utilities/lib/geometry_utils.pyx":879
22754  *     top = morton_qsort_partition(pos,start,end,ind)
22755  *     # Do remaining parts on either side of pivot, sort side first
22756  *     if (top-1-start < end-(top+1)):             # <<<<<<<<<<<<<<
22757  *         get_morton_argsort1(pos,start,top-1,ind)
22758  *         get_morton_argsort1(pos,top+1,end,ind)
22759  */
22760     goto __pyx_L4;
22761   }
22762 
22763   /* "yt/utilities/lib/geometry_utils.pyx":883
22764  *         get_morton_argsort1(pos,top+1,end,ind)
22765  *     else:
22766  *         get_morton_argsort1(pos,top+1,end,ind)             # <<<<<<<<<<<<<<
22767  *         get_morton_argsort1(pos,start,top-1,ind)
22768  *     return
22769  */
22770   /*else*/ {
22771     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_morton_argsort1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 883, __pyx_L1_error)
22772     __Pyx_GOTREF(__pyx_t_3);
22773     __pyx_t_4 = __Pyx_PyInt_From_npy_int64((__pyx_v_top + 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 883, __pyx_L1_error)
22774     __Pyx_GOTREF(__pyx_t_4);
22775     __pyx_t_5 = __Pyx_PyInt_From_npy_int64(__pyx_v_end); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 883, __pyx_L1_error)
22776     __Pyx_GOTREF(__pyx_t_5);
22777     __pyx_t_6 = NULL;
22778     __pyx_t_7 = 0;
22779     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
22780       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
22781       if (likely(__pyx_t_6)) {
22782         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
22783         __Pyx_INCREF(__pyx_t_6);
22784         __Pyx_INCREF(function);
22785         __Pyx_DECREF_SET(__pyx_t_3, function);
22786         __pyx_t_7 = 1;
22787       }
22788     }
22789     #if CYTHON_FAST_PYCALL
22790     if (PyFunction_Check(__pyx_t_3)) {
22791       PyObject *__pyx_temp[5] = {__pyx_t_6, ((PyObject *)__pyx_v_pos), __pyx_t_4, __pyx_t_5, ((PyObject *)__pyx_v_ind)};
22792       __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 883, __pyx_L1_error)
22793       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
22794       __Pyx_GOTREF(__pyx_t_2);
22795       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22796       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
22797     } else
22798     #endif
22799     #if CYTHON_FAST_PYCCALL
22800     if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
22801       PyObject *__pyx_temp[5] = {__pyx_t_6, ((PyObject *)__pyx_v_pos), __pyx_t_4, __pyx_t_5, ((PyObject *)__pyx_v_ind)};
22802       __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 883, __pyx_L1_error)
22803       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
22804       __Pyx_GOTREF(__pyx_t_2);
22805       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22806       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
22807     } else
22808     #endif
22809     {
22810       __pyx_t_8 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 883, __pyx_L1_error)
22811       __Pyx_GOTREF(__pyx_t_8);
22812       if (__pyx_t_6) {
22813         __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
22814       }
22815       __Pyx_INCREF(((PyObject *)__pyx_v_pos));
22816       __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
22817       PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, ((PyObject *)__pyx_v_pos));
22818       __Pyx_GIVEREF(__pyx_t_4);
22819       PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
22820       __Pyx_GIVEREF(__pyx_t_5);
22821       PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5);
22822       __Pyx_INCREF(((PyObject *)__pyx_v_ind));
22823       __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
22824       PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, ((PyObject *)__pyx_v_ind));
22825       __pyx_t_4 = 0;
22826       __pyx_t_5 = 0;
22827       __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 883, __pyx_L1_error)
22828       __Pyx_GOTREF(__pyx_t_2);
22829       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
22830     }
22831     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22832     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22833 
22834     /* "yt/utilities/lib/geometry_utils.pyx":884
22835  *     else:
22836  *         get_morton_argsort1(pos,top+1,end,ind)
22837  *         get_morton_argsort1(pos,start,top-1,ind)             # <<<<<<<<<<<<<<
22838  *     return
22839  *
22840  */
22841     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_morton_argsort1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 884, __pyx_L1_error)
22842     __Pyx_GOTREF(__pyx_t_3);
22843     __pyx_t_8 = __Pyx_PyInt_From_npy_int64(__pyx_v_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 884, __pyx_L1_error)
22844     __Pyx_GOTREF(__pyx_t_8);
22845     __pyx_t_5 = __Pyx_PyInt_From_npy_int64((__pyx_v_top - 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 884, __pyx_L1_error)
22846     __Pyx_GOTREF(__pyx_t_5);
22847     __pyx_t_4 = NULL;
22848     __pyx_t_7 = 0;
22849     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
22850       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
22851       if (likely(__pyx_t_4)) {
22852         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
22853         __Pyx_INCREF(__pyx_t_4);
22854         __Pyx_INCREF(function);
22855         __Pyx_DECREF_SET(__pyx_t_3, function);
22856         __pyx_t_7 = 1;
22857       }
22858     }
22859     #if CYTHON_FAST_PYCALL
22860     if (PyFunction_Check(__pyx_t_3)) {
22861       PyObject *__pyx_temp[5] = {__pyx_t_4, ((PyObject *)__pyx_v_pos), __pyx_t_8, __pyx_t_5, ((PyObject *)__pyx_v_ind)};
22862       __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 884, __pyx_L1_error)
22863       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
22864       __Pyx_GOTREF(__pyx_t_2);
22865       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
22866       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
22867     } else
22868     #endif
22869     #if CYTHON_FAST_PYCCALL
22870     if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
22871       PyObject *__pyx_temp[5] = {__pyx_t_4, ((PyObject *)__pyx_v_pos), __pyx_t_8, __pyx_t_5, ((PyObject *)__pyx_v_ind)};
22872       __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 884, __pyx_L1_error)
22873       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
22874       __Pyx_GOTREF(__pyx_t_2);
22875       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
22876       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
22877     } else
22878     #endif
22879     {
22880       __pyx_t_6 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 884, __pyx_L1_error)
22881       __Pyx_GOTREF(__pyx_t_6);
22882       if (__pyx_t_4) {
22883         __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
22884       }
22885       __Pyx_INCREF(((PyObject *)__pyx_v_pos));
22886       __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
22887       PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, ((PyObject *)__pyx_v_pos));
22888       __Pyx_GIVEREF(__pyx_t_8);
22889       PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_8);
22890       __Pyx_GIVEREF(__pyx_t_5);
22891       PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_t_5);
22892       __Pyx_INCREF(((PyObject *)__pyx_v_ind));
22893       __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
22894       PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, ((PyObject *)__pyx_v_ind));
22895       __pyx_t_8 = 0;
22896       __pyx_t_5 = 0;
22897       __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 884, __pyx_L1_error)
22898       __Pyx_GOTREF(__pyx_t_2);
22899       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22900     }
22901     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22902     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22903   }
22904   __pyx_L4:;
22905 
22906   /* "yt/utilities/lib/geometry_utils.pyx":885
22907  *         get_morton_argsort1(pos,top+1,end,ind)
22908  *         get_morton_argsort1(pos,start,top-1,ind)
22909  *     return             # <<<<<<<<<<<<<<
22910  *
22911  * def compare_morton(np.ndarray[floating, ndim=1] p0, np.ndarray[floating, ndim=1] q0):
22912  */
22913   __Pyx_XDECREF(__pyx_r);
22914   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
22915   goto __pyx_L0;
22916 
22917   /* "yt/utilities/lib/geometry_utils.pyx":870
22918  * @cython.boundscheck(False)
22919  * @cython.wraparound(False)
22920  * def get_morton_argsort1(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
22921  *                         np.int64_t start, np.int64_t end,
22922  *                         np.ndarray[np.uint64_t, ndim=1] ind):
22923  */
22924 
22925   /* function exit code */
22926   __pyx_L1_error:;
22927   __Pyx_XDECREF(__pyx_t_2);
22928   __Pyx_XDECREF(__pyx_t_3);
22929   __Pyx_XDECREF(__pyx_t_4);
22930   __Pyx_XDECREF(__pyx_t_5);
22931   __Pyx_XDECREF(__pyx_t_6);
22932   __Pyx_XDECREF(__pyx_t_8);
22933   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
22934     __Pyx_PyThreadState_declare
22935     __Pyx_PyThreadState_assign
22936     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
22937     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
22938     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
22939   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
22940   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.get_morton_argsort1", __pyx_clineno, __pyx_lineno, __pyx_filename);
22941   __pyx_r = NULL;
22942   goto __pyx_L2;
22943   __pyx_L0:;
22944   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
22945   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
22946   __pyx_L2:;
22947   __Pyx_XGIVEREF(__pyx_r);
22948   __Pyx_RefNannyFinishContext();
22949   return __pyx_r;
22950 }
22951 
22952 /* Python wrapper */
22953 static PyObject *__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_103get_morton_argsort1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
22954 static PyMethodDef __pyx_fuse_1__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_103get_morton_argsort1 = {"__pyx_fuse_1get_morton_argsort1", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_103get_morton_argsort1, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_103get_morton_argsort1(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)22955 static PyObject *__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_103get_morton_argsort1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
22956   PyArrayObject *__pyx_v_pos = 0;
22957   __pyx_t_5numpy_int64_t __pyx_v_start;
22958   __pyx_t_5numpy_int64_t __pyx_v_end;
22959   PyArrayObject *__pyx_v_ind = 0;
22960   PyObject *__pyx_r = 0;
22961   __Pyx_RefNannyDeclarations
22962   __Pyx_RefNannySetupContext("get_morton_argsort1 (wrapper)", 0);
22963   {
22964     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos,&__pyx_n_s_start,&__pyx_n_s_end,&__pyx_n_s_ind,0};
22965     PyObject* values[4] = {0,0,0,0};
22966     if (unlikely(__pyx_kwds)) {
22967       Py_ssize_t kw_args;
22968       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
22969       switch (pos_args) {
22970         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
22971         CYTHON_FALLTHROUGH;
22972         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
22973         CYTHON_FALLTHROUGH;
22974         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
22975         CYTHON_FALLTHROUGH;
22976         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
22977         CYTHON_FALLTHROUGH;
22978         case  0: break;
22979         default: goto __pyx_L5_argtuple_error;
22980       }
22981       kw_args = PyDict_Size(__pyx_kwds);
22982       switch (pos_args) {
22983         case  0:
22984         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
22985         else goto __pyx_L5_argtuple_error;
22986         CYTHON_FALLTHROUGH;
22987         case  1:
22988         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--;
22989         else {
22990           __Pyx_RaiseArgtupleInvalid("get_morton_argsort1", 1, 4, 4, 1); __PYX_ERR(1, 870, __pyx_L3_error)
22991         }
22992         CYTHON_FALLTHROUGH;
22993         case  2:
22994         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_end)) != 0)) kw_args--;
22995         else {
22996           __Pyx_RaiseArgtupleInvalid("get_morton_argsort1", 1, 4, 4, 2); __PYX_ERR(1, 870, __pyx_L3_error)
22997         }
22998         CYTHON_FALLTHROUGH;
22999         case  3:
23000         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ind)) != 0)) kw_args--;
23001         else {
23002           __Pyx_RaiseArgtupleInvalid("get_morton_argsort1", 1, 4, 4, 3); __PYX_ERR(1, 870, __pyx_L3_error)
23003         }
23004       }
23005       if (unlikely(kw_args > 0)) {
23006         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_morton_argsort1") < 0)) __PYX_ERR(1, 870, __pyx_L3_error)
23007       }
23008     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
23009       goto __pyx_L5_argtuple_error;
23010     } else {
23011       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
23012       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
23013       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
23014       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
23015     }
23016     __pyx_v_pos = ((PyArrayObject *)values[0]);
23017     __pyx_v_start = __Pyx_PyInt_As_npy_int64(values[1]); if (unlikely((__pyx_v_start == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 871, __pyx_L3_error)
23018     __pyx_v_end = __Pyx_PyInt_As_npy_int64(values[2]); if (unlikely((__pyx_v_end == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 871, __pyx_L3_error)
23019     __pyx_v_ind = ((PyArrayObject *)values[3]);
23020   }
23021   goto __pyx_L4_argument_unpacking_done;
23022   __pyx_L5_argtuple_error:;
23023   __Pyx_RaiseArgtupleInvalid("get_morton_argsort1", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 870, __pyx_L3_error)
23024   __pyx_L3_error:;
23025   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.get_morton_argsort1", __pyx_clineno, __pyx_lineno, __pyx_filename);
23026   __Pyx_RefNannyFinishContext();
23027   return NULL;
23028   __pyx_L4_argument_unpacking_done:;
23029   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), __pyx_ptype_5numpy_ndarray, 1, "pos", 0))) __PYX_ERR(1, 870, __pyx_L1_error)
23030   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ind), __pyx_ptype_5numpy_ndarray, 1, "ind", 0))) __PYX_ERR(1, 872, __pyx_L1_error)
23031   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_102get_morton_argsort1(__pyx_self, __pyx_v_pos, __pyx_v_start, __pyx_v_end, __pyx_v_ind);
23032 
23033   /* function exit code */
23034   goto __pyx_L0;
23035   __pyx_L1_error:;
23036   __pyx_r = NULL;
23037   __pyx_L0:;
23038   __Pyx_RefNannyFinishContext();
23039   return __pyx_r;
23040 }
23041 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_102get_morton_argsort1(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_pos,__pyx_t_5numpy_int64_t __pyx_v_start,__pyx_t_5numpy_int64_t __pyx_v_end,PyArrayObject * __pyx_v_ind)23042 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_102get_morton_argsort1(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos, __pyx_t_5numpy_int64_t __pyx_v_start, __pyx_t_5numpy_int64_t __pyx_v_end, PyArrayObject *__pyx_v_ind) {
23043   __pyx_t_5numpy_int64_t __pyx_v_top;
23044   __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
23045   __Pyx_Buffer __pyx_pybuffer_ind;
23046   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos;
23047   __Pyx_Buffer __pyx_pybuffer_pos;
23048   PyObject *__pyx_r = NULL;
23049   __Pyx_RefNannyDeclarations
23050   int __pyx_t_1;
23051   PyObject *__pyx_t_2 = NULL;
23052   PyObject *__pyx_t_3 = NULL;
23053   PyObject *__pyx_t_4 = NULL;
23054   PyObject *__pyx_t_5 = NULL;
23055   PyObject *__pyx_t_6 = NULL;
23056   int __pyx_t_7;
23057   PyObject *__pyx_t_8 = NULL;
23058   __pyx_t_5numpy_int64_t __pyx_t_9;
23059   __Pyx_RefNannySetupContext("__pyx_fuse_1get_morton_argsort1", 0);
23060   __pyx_pybuffer_pos.pybuffer.buf = NULL;
23061   __pyx_pybuffer_pos.refcount = 0;
23062   __pyx_pybuffernd_pos.data = NULL;
23063   __pyx_pybuffernd_pos.rcbuffer = &__pyx_pybuffer_pos;
23064   __pyx_pybuffer_ind.pybuffer.buf = NULL;
23065   __pyx_pybuffer_ind.refcount = 0;
23066   __pyx_pybuffernd_ind.data = NULL;
23067   __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;
23068   {
23069     __Pyx_BufFmt_StackElem __pyx_stack[1];
23070     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(1, 870, __pyx_L1_error)
23071   }
23072   __pyx_pybuffernd_pos.diminfo[0].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos.diminfo[0].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pos.diminfo[1].strides = __pyx_pybuffernd_pos.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pos.diminfo[1].shape = __pyx_pybuffernd_pos.rcbuffer->pybuffer.shape[1];
23073   {
23074     __Pyx_BufFmt_StackElem __pyx_stack[1];
23075     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 870, __pyx_L1_error)
23076   }
23077   __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
23078 
23079   /* "yt/utilities/lib/geometry_utils.pyx":874
23080  *                         np.ndarray[np.uint64_t, ndim=1] ind):
23081  *     # Return if only one position selected
23082  *     if start >= end: return             # <<<<<<<<<<<<<<
23083  *     # Initialize
23084  *     cdef np.int64_t top
23085  */
23086   __pyx_t_1 = ((__pyx_v_start >= __pyx_v_end) != 0);
23087   if (__pyx_t_1) {
23088     __Pyx_XDECREF(__pyx_r);
23089     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
23090     goto __pyx_L0;
23091   }
23092 
23093   /* "yt/utilities/lib/geometry_utils.pyx":877
23094  *     # Initialize
23095  *     cdef np.int64_t top
23096  *     top = morton_qsort_partition(pos,start,end,ind)             # <<<<<<<<<<<<<<
23097  *     # Do remaining parts on either side of pivot, sort side first
23098  *     if (top-1-start < end-(top+1)):
23099  */
23100   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_morton_qsort_partition); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 877, __pyx_L1_error)
23101   __Pyx_GOTREF(__pyx_t_3);
23102   __pyx_t_4 = __Pyx_PyInt_From_npy_int64(__pyx_v_start); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 877, __pyx_L1_error)
23103   __Pyx_GOTREF(__pyx_t_4);
23104   __pyx_t_5 = __Pyx_PyInt_From_npy_int64(__pyx_v_end); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 877, __pyx_L1_error)
23105   __Pyx_GOTREF(__pyx_t_5);
23106   __pyx_t_6 = NULL;
23107   __pyx_t_7 = 0;
23108   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
23109     __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
23110     if (likely(__pyx_t_6)) {
23111       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
23112       __Pyx_INCREF(__pyx_t_6);
23113       __Pyx_INCREF(function);
23114       __Pyx_DECREF_SET(__pyx_t_3, function);
23115       __pyx_t_7 = 1;
23116     }
23117   }
23118   #if CYTHON_FAST_PYCALL
23119   if (PyFunction_Check(__pyx_t_3)) {
23120     PyObject *__pyx_temp[5] = {__pyx_t_6, ((PyObject *)__pyx_v_pos), __pyx_t_4, __pyx_t_5, ((PyObject *)__pyx_v_ind)};
23121     __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 877, __pyx_L1_error)
23122     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
23123     __Pyx_GOTREF(__pyx_t_2);
23124     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23125     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
23126   } else
23127   #endif
23128   #if CYTHON_FAST_PYCCALL
23129   if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
23130     PyObject *__pyx_temp[5] = {__pyx_t_6, ((PyObject *)__pyx_v_pos), __pyx_t_4, __pyx_t_5, ((PyObject *)__pyx_v_ind)};
23131     __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 877, __pyx_L1_error)
23132     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
23133     __Pyx_GOTREF(__pyx_t_2);
23134     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23135     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
23136   } else
23137   #endif
23138   {
23139     __pyx_t_8 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 877, __pyx_L1_error)
23140     __Pyx_GOTREF(__pyx_t_8);
23141     if (__pyx_t_6) {
23142       __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
23143     }
23144     __Pyx_INCREF(((PyObject *)__pyx_v_pos));
23145     __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
23146     PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, ((PyObject *)__pyx_v_pos));
23147     __Pyx_GIVEREF(__pyx_t_4);
23148     PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
23149     __Pyx_GIVEREF(__pyx_t_5);
23150     PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5);
23151     __Pyx_INCREF(((PyObject *)__pyx_v_ind));
23152     __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
23153     PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, ((PyObject *)__pyx_v_ind));
23154     __pyx_t_4 = 0;
23155     __pyx_t_5 = 0;
23156     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 877, __pyx_L1_error)
23157     __Pyx_GOTREF(__pyx_t_2);
23158     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
23159   }
23160   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23161   __pyx_t_9 = __Pyx_PyInt_As_npy_int64(__pyx_t_2); if (unlikely((__pyx_t_9 == ((npy_int64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 877, __pyx_L1_error)
23162   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
23163   __pyx_v_top = __pyx_t_9;
23164 
23165   /* "yt/utilities/lib/geometry_utils.pyx":879
23166  *     top = morton_qsort_partition(pos,start,end,ind)
23167  *     # Do remaining parts on either side of pivot, sort side first
23168  *     if (top-1-start < end-(top+1)):             # <<<<<<<<<<<<<<
23169  *         get_morton_argsort1(pos,start,top-1,ind)
23170  *         get_morton_argsort1(pos,top+1,end,ind)
23171  */
23172   __pyx_t_1 = ((((__pyx_v_top - 1) - __pyx_v_start) < (__pyx_v_end - (__pyx_v_top + 1))) != 0);
23173   if (__pyx_t_1) {
23174 
23175     /* "yt/utilities/lib/geometry_utils.pyx":880
23176  *     # Do remaining parts on either side of pivot, sort side first
23177  *     if (top-1-start < end-(top+1)):
23178  *         get_morton_argsort1(pos,start,top-1,ind)             # <<<<<<<<<<<<<<
23179  *         get_morton_argsort1(pos,top+1,end,ind)
23180  *     else:
23181  */
23182     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_morton_argsort1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 880, __pyx_L1_error)
23183     __Pyx_GOTREF(__pyx_t_3);
23184     __pyx_t_8 = __Pyx_PyInt_From_npy_int64(__pyx_v_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 880, __pyx_L1_error)
23185     __Pyx_GOTREF(__pyx_t_8);
23186     __pyx_t_5 = __Pyx_PyInt_From_npy_int64((__pyx_v_top - 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 880, __pyx_L1_error)
23187     __Pyx_GOTREF(__pyx_t_5);
23188     __pyx_t_4 = NULL;
23189     __pyx_t_7 = 0;
23190     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
23191       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
23192       if (likely(__pyx_t_4)) {
23193         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
23194         __Pyx_INCREF(__pyx_t_4);
23195         __Pyx_INCREF(function);
23196         __Pyx_DECREF_SET(__pyx_t_3, function);
23197         __pyx_t_7 = 1;
23198       }
23199     }
23200     #if CYTHON_FAST_PYCALL
23201     if (PyFunction_Check(__pyx_t_3)) {
23202       PyObject *__pyx_temp[5] = {__pyx_t_4, ((PyObject *)__pyx_v_pos), __pyx_t_8, __pyx_t_5, ((PyObject *)__pyx_v_ind)};
23203       __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 880, __pyx_L1_error)
23204       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
23205       __Pyx_GOTREF(__pyx_t_2);
23206       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
23207       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
23208     } else
23209     #endif
23210     #if CYTHON_FAST_PYCCALL
23211     if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
23212       PyObject *__pyx_temp[5] = {__pyx_t_4, ((PyObject *)__pyx_v_pos), __pyx_t_8, __pyx_t_5, ((PyObject *)__pyx_v_ind)};
23213       __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 880, __pyx_L1_error)
23214       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
23215       __Pyx_GOTREF(__pyx_t_2);
23216       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
23217       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
23218     } else
23219     #endif
23220     {
23221       __pyx_t_6 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 880, __pyx_L1_error)
23222       __Pyx_GOTREF(__pyx_t_6);
23223       if (__pyx_t_4) {
23224         __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
23225       }
23226       __Pyx_INCREF(((PyObject *)__pyx_v_pos));
23227       __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
23228       PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, ((PyObject *)__pyx_v_pos));
23229       __Pyx_GIVEREF(__pyx_t_8);
23230       PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_8);
23231       __Pyx_GIVEREF(__pyx_t_5);
23232       PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_t_5);
23233       __Pyx_INCREF(((PyObject *)__pyx_v_ind));
23234       __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
23235       PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, ((PyObject *)__pyx_v_ind));
23236       __pyx_t_8 = 0;
23237       __pyx_t_5 = 0;
23238       __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 880, __pyx_L1_error)
23239       __Pyx_GOTREF(__pyx_t_2);
23240       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
23241     }
23242     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23243     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
23244 
23245     /* "yt/utilities/lib/geometry_utils.pyx":881
23246  *     if (top-1-start < end-(top+1)):
23247  *         get_morton_argsort1(pos,start,top-1,ind)
23248  *         get_morton_argsort1(pos,top+1,end,ind)             # <<<<<<<<<<<<<<
23249  *     else:
23250  *         get_morton_argsort1(pos,top+1,end,ind)
23251  */
23252     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_morton_argsort1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 881, __pyx_L1_error)
23253     __Pyx_GOTREF(__pyx_t_3);
23254     __pyx_t_6 = __Pyx_PyInt_From_npy_int64((__pyx_v_top + 1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 881, __pyx_L1_error)
23255     __Pyx_GOTREF(__pyx_t_6);
23256     __pyx_t_5 = __Pyx_PyInt_From_npy_int64(__pyx_v_end); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 881, __pyx_L1_error)
23257     __Pyx_GOTREF(__pyx_t_5);
23258     __pyx_t_8 = NULL;
23259     __pyx_t_7 = 0;
23260     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
23261       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
23262       if (likely(__pyx_t_8)) {
23263         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
23264         __Pyx_INCREF(__pyx_t_8);
23265         __Pyx_INCREF(function);
23266         __Pyx_DECREF_SET(__pyx_t_3, function);
23267         __pyx_t_7 = 1;
23268       }
23269     }
23270     #if CYTHON_FAST_PYCALL
23271     if (PyFunction_Check(__pyx_t_3)) {
23272       PyObject *__pyx_temp[5] = {__pyx_t_8, ((PyObject *)__pyx_v_pos), __pyx_t_6, __pyx_t_5, ((PyObject *)__pyx_v_ind)};
23273       __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 881, __pyx_L1_error)
23274       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
23275       __Pyx_GOTREF(__pyx_t_2);
23276       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
23277       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
23278     } else
23279     #endif
23280     #if CYTHON_FAST_PYCCALL
23281     if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
23282       PyObject *__pyx_temp[5] = {__pyx_t_8, ((PyObject *)__pyx_v_pos), __pyx_t_6, __pyx_t_5, ((PyObject *)__pyx_v_ind)};
23283       __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 881, __pyx_L1_error)
23284       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
23285       __Pyx_GOTREF(__pyx_t_2);
23286       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
23287       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
23288     } else
23289     #endif
23290     {
23291       __pyx_t_4 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 881, __pyx_L1_error)
23292       __Pyx_GOTREF(__pyx_t_4);
23293       if (__pyx_t_8) {
23294         __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8); __pyx_t_8 = NULL;
23295       }
23296       __Pyx_INCREF(((PyObject *)__pyx_v_pos));
23297       __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
23298       PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_7, ((PyObject *)__pyx_v_pos));
23299       __Pyx_GIVEREF(__pyx_t_6);
23300       PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_7, __pyx_t_6);
23301       __Pyx_GIVEREF(__pyx_t_5);
23302       PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_7, __pyx_t_5);
23303       __Pyx_INCREF(((PyObject *)__pyx_v_ind));
23304       __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
23305       PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_7, ((PyObject *)__pyx_v_ind));
23306       __pyx_t_6 = 0;
23307       __pyx_t_5 = 0;
23308       __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 881, __pyx_L1_error)
23309       __Pyx_GOTREF(__pyx_t_2);
23310       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23311     }
23312     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23313     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
23314 
23315     /* "yt/utilities/lib/geometry_utils.pyx":879
23316  *     top = morton_qsort_partition(pos,start,end,ind)
23317  *     # Do remaining parts on either side of pivot, sort side first
23318  *     if (top-1-start < end-(top+1)):             # <<<<<<<<<<<<<<
23319  *         get_morton_argsort1(pos,start,top-1,ind)
23320  *         get_morton_argsort1(pos,top+1,end,ind)
23321  */
23322     goto __pyx_L4;
23323   }
23324 
23325   /* "yt/utilities/lib/geometry_utils.pyx":883
23326  *         get_morton_argsort1(pos,top+1,end,ind)
23327  *     else:
23328  *         get_morton_argsort1(pos,top+1,end,ind)             # <<<<<<<<<<<<<<
23329  *         get_morton_argsort1(pos,start,top-1,ind)
23330  *     return
23331  */
23332   /*else*/ {
23333     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_morton_argsort1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 883, __pyx_L1_error)
23334     __Pyx_GOTREF(__pyx_t_3);
23335     __pyx_t_4 = __Pyx_PyInt_From_npy_int64((__pyx_v_top + 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 883, __pyx_L1_error)
23336     __Pyx_GOTREF(__pyx_t_4);
23337     __pyx_t_5 = __Pyx_PyInt_From_npy_int64(__pyx_v_end); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 883, __pyx_L1_error)
23338     __Pyx_GOTREF(__pyx_t_5);
23339     __pyx_t_6 = NULL;
23340     __pyx_t_7 = 0;
23341     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
23342       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
23343       if (likely(__pyx_t_6)) {
23344         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
23345         __Pyx_INCREF(__pyx_t_6);
23346         __Pyx_INCREF(function);
23347         __Pyx_DECREF_SET(__pyx_t_3, function);
23348         __pyx_t_7 = 1;
23349       }
23350     }
23351     #if CYTHON_FAST_PYCALL
23352     if (PyFunction_Check(__pyx_t_3)) {
23353       PyObject *__pyx_temp[5] = {__pyx_t_6, ((PyObject *)__pyx_v_pos), __pyx_t_4, __pyx_t_5, ((PyObject *)__pyx_v_ind)};
23354       __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 883, __pyx_L1_error)
23355       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
23356       __Pyx_GOTREF(__pyx_t_2);
23357       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23358       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
23359     } else
23360     #endif
23361     #if CYTHON_FAST_PYCCALL
23362     if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
23363       PyObject *__pyx_temp[5] = {__pyx_t_6, ((PyObject *)__pyx_v_pos), __pyx_t_4, __pyx_t_5, ((PyObject *)__pyx_v_ind)};
23364       __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 883, __pyx_L1_error)
23365       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
23366       __Pyx_GOTREF(__pyx_t_2);
23367       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23368       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
23369     } else
23370     #endif
23371     {
23372       __pyx_t_8 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 883, __pyx_L1_error)
23373       __Pyx_GOTREF(__pyx_t_8);
23374       if (__pyx_t_6) {
23375         __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
23376       }
23377       __Pyx_INCREF(((PyObject *)__pyx_v_pos));
23378       __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
23379       PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, ((PyObject *)__pyx_v_pos));
23380       __Pyx_GIVEREF(__pyx_t_4);
23381       PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
23382       __Pyx_GIVEREF(__pyx_t_5);
23383       PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5);
23384       __Pyx_INCREF(((PyObject *)__pyx_v_ind));
23385       __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
23386       PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, ((PyObject *)__pyx_v_ind));
23387       __pyx_t_4 = 0;
23388       __pyx_t_5 = 0;
23389       __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 883, __pyx_L1_error)
23390       __Pyx_GOTREF(__pyx_t_2);
23391       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
23392     }
23393     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23394     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
23395 
23396     /* "yt/utilities/lib/geometry_utils.pyx":884
23397  *     else:
23398  *         get_morton_argsort1(pos,top+1,end,ind)
23399  *         get_morton_argsort1(pos,start,top-1,ind)             # <<<<<<<<<<<<<<
23400  *     return
23401  *
23402  */
23403     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_morton_argsort1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 884, __pyx_L1_error)
23404     __Pyx_GOTREF(__pyx_t_3);
23405     __pyx_t_8 = __Pyx_PyInt_From_npy_int64(__pyx_v_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 884, __pyx_L1_error)
23406     __Pyx_GOTREF(__pyx_t_8);
23407     __pyx_t_5 = __Pyx_PyInt_From_npy_int64((__pyx_v_top - 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 884, __pyx_L1_error)
23408     __Pyx_GOTREF(__pyx_t_5);
23409     __pyx_t_4 = NULL;
23410     __pyx_t_7 = 0;
23411     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
23412       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
23413       if (likely(__pyx_t_4)) {
23414         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
23415         __Pyx_INCREF(__pyx_t_4);
23416         __Pyx_INCREF(function);
23417         __Pyx_DECREF_SET(__pyx_t_3, function);
23418         __pyx_t_7 = 1;
23419       }
23420     }
23421     #if CYTHON_FAST_PYCALL
23422     if (PyFunction_Check(__pyx_t_3)) {
23423       PyObject *__pyx_temp[5] = {__pyx_t_4, ((PyObject *)__pyx_v_pos), __pyx_t_8, __pyx_t_5, ((PyObject *)__pyx_v_ind)};
23424       __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 884, __pyx_L1_error)
23425       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
23426       __Pyx_GOTREF(__pyx_t_2);
23427       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
23428       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
23429     } else
23430     #endif
23431     #if CYTHON_FAST_PYCCALL
23432     if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
23433       PyObject *__pyx_temp[5] = {__pyx_t_4, ((PyObject *)__pyx_v_pos), __pyx_t_8, __pyx_t_5, ((PyObject *)__pyx_v_ind)};
23434       __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 884, __pyx_L1_error)
23435       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
23436       __Pyx_GOTREF(__pyx_t_2);
23437       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
23438       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
23439     } else
23440     #endif
23441     {
23442       __pyx_t_6 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 884, __pyx_L1_error)
23443       __Pyx_GOTREF(__pyx_t_6);
23444       if (__pyx_t_4) {
23445         __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
23446       }
23447       __Pyx_INCREF(((PyObject *)__pyx_v_pos));
23448       __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
23449       PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, ((PyObject *)__pyx_v_pos));
23450       __Pyx_GIVEREF(__pyx_t_8);
23451       PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_8);
23452       __Pyx_GIVEREF(__pyx_t_5);
23453       PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_t_5);
23454       __Pyx_INCREF(((PyObject *)__pyx_v_ind));
23455       __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
23456       PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, ((PyObject *)__pyx_v_ind));
23457       __pyx_t_8 = 0;
23458       __pyx_t_5 = 0;
23459       __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 884, __pyx_L1_error)
23460       __Pyx_GOTREF(__pyx_t_2);
23461       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
23462     }
23463     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23464     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
23465   }
23466   __pyx_L4:;
23467 
23468   /* "yt/utilities/lib/geometry_utils.pyx":885
23469  *         get_morton_argsort1(pos,top+1,end,ind)
23470  *         get_morton_argsort1(pos,start,top-1,ind)
23471  *     return             # <<<<<<<<<<<<<<
23472  *
23473  * def compare_morton(np.ndarray[floating, ndim=1] p0, np.ndarray[floating, ndim=1] q0):
23474  */
23475   __Pyx_XDECREF(__pyx_r);
23476   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
23477   goto __pyx_L0;
23478 
23479   /* "yt/utilities/lib/geometry_utils.pyx":870
23480  * @cython.boundscheck(False)
23481  * @cython.wraparound(False)
23482  * def get_morton_argsort1(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
23483  *                         np.int64_t start, np.int64_t end,
23484  *                         np.ndarray[np.uint64_t, ndim=1] ind):
23485  */
23486 
23487   /* function exit code */
23488   __pyx_L1_error:;
23489   __Pyx_XDECREF(__pyx_t_2);
23490   __Pyx_XDECREF(__pyx_t_3);
23491   __Pyx_XDECREF(__pyx_t_4);
23492   __Pyx_XDECREF(__pyx_t_5);
23493   __Pyx_XDECREF(__pyx_t_6);
23494   __Pyx_XDECREF(__pyx_t_8);
23495   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
23496     __Pyx_PyThreadState_declare
23497     __Pyx_PyThreadState_assign
23498     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
23499     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
23500     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
23501   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
23502   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.get_morton_argsort1", __pyx_clineno, __pyx_lineno, __pyx_filename);
23503   __pyx_r = NULL;
23504   goto __pyx_L2;
23505   __pyx_L0:;
23506   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
23507   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos.rcbuffer->pybuffer);
23508   __pyx_L2:;
23509   __Pyx_XGIVEREF(__pyx_r);
23510   __Pyx_RefNannyFinishContext();
23511   return __pyx_r;
23512 }
23513 
23514 /* "yt/utilities/lib/geometry_utils.pyx":887
23515  *     return
23516  *
23517  * def compare_morton(np.ndarray[floating, ndim=1] p0, np.ndarray[floating, ndim=1] q0):             # <<<<<<<<<<<<<<
23518  *     cdef np.float64_t p[3]
23519  *     cdef np.float64_t q[3]
23520  */
23521 
23522 /* Python wrapper */
23523 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_57compare_morton(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
23524 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_57compare_morton = {"compare_morton", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_57compare_morton, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_57compare_morton(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)23525 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_57compare_morton(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
23526   PyObject *__pyx_v_signatures = 0;
23527   PyObject *__pyx_v_args = 0;
23528   PyObject *__pyx_v_kwargs = 0;
23529   CYTHON_UNUSED PyObject *__pyx_v_defaults = 0;
23530   PyObject *__pyx_r = 0;
23531   __Pyx_RefNannyDeclarations
23532   __Pyx_RefNannySetupContext("__pyx_fused_cpdef (wrapper)", 0);
23533   {
23534     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_signatures,&__pyx_n_s_args,&__pyx_n_s_kwargs,&__pyx_n_s_defaults,0};
23535     PyObject* values[4] = {0,0,0,0};
23536     if (unlikely(__pyx_kwds)) {
23537       Py_ssize_t kw_args;
23538       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
23539       switch (pos_args) {
23540         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
23541         CYTHON_FALLTHROUGH;
23542         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
23543         CYTHON_FALLTHROUGH;
23544         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
23545         CYTHON_FALLTHROUGH;
23546         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
23547         CYTHON_FALLTHROUGH;
23548         case  0: break;
23549         default: goto __pyx_L5_argtuple_error;
23550       }
23551       kw_args = PyDict_Size(__pyx_kwds);
23552       switch (pos_args) {
23553         case  0:
23554         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_signatures)) != 0)) kw_args--;
23555         else goto __pyx_L5_argtuple_error;
23556         CYTHON_FALLTHROUGH;
23557         case  1:
23558         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--;
23559         else {
23560           __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 1); __PYX_ERR(1, 887, __pyx_L3_error)
23561         }
23562         CYTHON_FALLTHROUGH;
23563         case  2:
23564         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--;
23565         else {
23566           __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 2); __PYX_ERR(1, 887, __pyx_L3_error)
23567         }
23568         CYTHON_FALLTHROUGH;
23569         case  3:
23570         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_defaults)) != 0)) kw_args--;
23571         else {
23572           __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 3); __PYX_ERR(1, 887, __pyx_L3_error)
23573         }
23574       }
23575       if (unlikely(kw_args > 0)) {
23576         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fused_cpdef") < 0)) __PYX_ERR(1, 887, __pyx_L3_error)
23577       }
23578     } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
23579       goto __pyx_L5_argtuple_error;
23580     } else {
23581       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
23582       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
23583       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
23584       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
23585     }
23586     __pyx_v_signatures = values[0];
23587     __pyx_v_args = values[1];
23588     __pyx_v_kwargs = values[2];
23589     __pyx_v_defaults = values[3];
23590   }
23591   goto __pyx_L4_argument_unpacking_done;
23592   __pyx_L5_argtuple_error:;
23593   __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 887, __pyx_L3_error)
23594   __pyx_L3_error:;
23595   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename);
23596   __Pyx_RefNannyFinishContext();
23597   return NULL;
23598   __pyx_L4_argument_unpacking_done:;
23599   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_56compare_morton(__pyx_self, __pyx_v_signatures, __pyx_v_args, __pyx_v_kwargs, __pyx_v_defaults);
23600 
23601   /* function exit code */
23602   __Pyx_RefNannyFinishContext();
23603   return __pyx_r;
23604 }
23605 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_56compare_morton(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_signatures,PyObject * __pyx_v_args,PyObject * __pyx_v_kwargs,CYTHON_UNUSED PyObject * __pyx_v_defaults)23606 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_56compare_morton(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults) {
23607   PyObject *__pyx_v_dest_sig = NULL;
23608   Py_ssize_t __pyx_v_i;
23609   PyTypeObject *__pyx_v_ndarray = 0;
23610   __Pyx_memviewslice __pyx_v_memslice;
23611   Py_ssize_t __pyx_v_itemsize;
23612   CYTHON_UNUSED int __pyx_v_dtype_signed;
23613   char __pyx_v_kind;
23614   PyObject *__pyx_v_arg = NULL;
23615   PyObject *__pyx_v_dtype = NULL;
23616   PyObject *__pyx_v_arg_base = NULL;
23617   PyObject *__pyx_v_candidates = NULL;
23618   PyObject *__pyx_v_sig = NULL;
23619   int __pyx_v_match_found;
23620   PyObject *__pyx_v_src_sig = NULL;
23621   PyObject *__pyx_v_dst_type = NULL;
23622   PyObject *__pyx_r = NULL;
23623   __Pyx_RefNannyDeclarations
23624   PyObject *__pyx_t_1 = NULL;
23625   int __pyx_t_2;
23626   int __pyx_t_3;
23627   int __pyx_t_4;
23628   Py_ssize_t __pyx_t_5;
23629   PyObject *__pyx_t_6 = NULL;
23630   long __pyx_t_7;
23631   __Pyx_memviewslice __pyx_t_8;
23632   Py_ssize_t __pyx_t_9;
23633   int __pyx_t_10;
23634   int __pyx_t_11;
23635   PyObject *__pyx_t_12 = NULL;
23636   PyObject *__pyx_t_13 = NULL;
23637   PyObject *__pyx_t_14 = NULL;
23638   Py_ssize_t __pyx_t_15;
23639   Py_ssize_t __pyx_t_16;
23640   Py_ssize_t __pyx_t_17;
23641   int __pyx_t_18;
23642   __Pyx_RefNannySetupContext("compare_morton", 0);
23643   __Pyx_INCREF(__pyx_v_kwargs);
23644   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 887, __pyx_L1_error)
23645   __Pyx_GOTREF(__pyx_t_1);
23646   __Pyx_INCREF(Py_None);
23647   __Pyx_GIVEREF(Py_None);
23648   PyList_SET_ITEM(__pyx_t_1, 0, Py_None);
23649   __pyx_v_dest_sig = ((PyObject*)__pyx_t_1);
23650   __pyx_t_1 = 0;
23651   __pyx_t_3 = (__pyx_v_kwargs != Py_None);
23652   __pyx_t_4 = (__pyx_t_3 != 0);
23653   if (__pyx_t_4) {
23654   } else {
23655     __pyx_t_2 = __pyx_t_4;
23656     goto __pyx_L4_bool_binop_done;
23657   }
23658   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_kwargs); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 887, __pyx_L1_error)
23659   __pyx_t_3 = ((!__pyx_t_4) != 0);
23660   __pyx_t_2 = __pyx_t_3;
23661   __pyx_L4_bool_binop_done:;
23662   if (__pyx_t_2) {
23663     __Pyx_INCREF(Py_None);
23664     __Pyx_DECREF_SET(__pyx_v_kwargs, Py_None);
23665   }
23666   __pyx_t_1 = ((PyObject *)__Pyx_ImportNumPyArrayTypeIfAvailable()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 887, __pyx_L1_error)
23667   __Pyx_GOTREF(__pyx_t_1);
23668   __pyx_v_ndarray = ((PyTypeObject*)__pyx_t_1);
23669   __pyx_t_1 = 0;
23670   __pyx_v_itemsize = -1L;
23671   if (unlikely(__pyx_v_args == Py_None)) {
23672     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
23673     __PYX_ERR(1, 887, __pyx_L1_error)
23674   }
23675   __pyx_t_5 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 887, __pyx_L1_error)
23676   __pyx_t_2 = ((0 < __pyx_t_5) != 0);
23677   if (__pyx_t_2) {
23678     if (unlikely(__pyx_v_args == Py_None)) {
23679       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
23680       __PYX_ERR(1, 887, __pyx_L1_error)
23681     }
23682     __pyx_t_1 = __Pyx_GetItemInt_Tuple(((PyObject*)__pyx_v_args), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 887, __pyx_L1_error)
23683     __Pyx_GOTREF(__pyx_t_1);
23684     __pyx_v_arg = __pyx_t_1;
23685     __pyx_t_1 = 0;
23686     goto __pyx_L6;
23687   }
23688   __pyx_t_3 = (__pyx_v_kwargs != Py_None);
23689   __pyx_t_4 = (__pyx_t_3 != 0);
23690   if (__pyx_t_4) {
23691   } else {
23692     __pyx_t_2 = __pyx_t_4;
23693     goto __pyx_L7_bool_binop_done;
23694   }
23695   if (unlikely(__pyx_v_kwargs == Py_None)) {
23696     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
23697     __PYX_ERR(1, 887, __pyx_L1_error)
23698   }
23699   __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_p0, ((PyObject*)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 887, __pyx_L1_error)
23700   __pyx_t_3 = (__pyx_t_4 != 0);
23701   __pyx_t_2 = __pyx_t_3;
23702   __pyx_L7_bool_binop_done:;
23703   if (__pyx_t_2) {
23704     if (unlikely(__pyx_v_kwargs == Py_None)) {
23705       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
23706       __PYX_ERR(1, 887, __pyx_L1_error)
23707     }
23708     __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_kwargs), __pyx_n_s_p0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 887, __pyx_L1_error)
23709     __Pyx_GOTREF(__pyx_t_1);
23710     __pyx_v_arg = __pyx_t_1;
23711     __pyx_t_1 = 0;
23712     goto __pyx_L6;
23713   }
23714   /*else*/ {
23715     if (unlikely(__pyx_v_args == Py_None)) {
23716       PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
23717       __PYX_ERR(1, 887, __pyx_L1_error)
23718     }
23719     __pyx_t_5 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 887, __pyx_L1_error)
23720     __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 887, __pyx_L1_error)
23721     __Pyx_GOTREF(__pyx_t_1);
23722     __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 887, __pyx_L1_error)
23723     __Pyx_GOTREF(__pyx_t_6);
23724     __Pyx_INCREF(__pyx_int_2);
23725     __Pyx_GIVEREF(__pyx_int_2);
23726     PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_2);
23727     __Pyx_INCREF(__pyx_n_s_s);
23728     __Pyx_GIVEREF(__pyx_n_s_s);
23729     PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_n_s_s);
23730     __Pyx_GIVEREF(__pyx_t_1);
23731     PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1);
23732     __pyx_t_1 = 0;
23733     __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Expected_at_least_d_argument_s_g, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 887, __pyx_L1_error)
23734     __Pyx_GOTREF(__pyx_t_1);
23735     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
23736     __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 887, __pyx_L1_error)
23737     __Pyx_GOTREF(__pyx_t_6);
23738     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23739     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
23740     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
23741     __PYX_ERR(1, 887, __pyx_L1_error)
23742   }
23743   __pyx_L6:;
23744   while (1) {
23745     __pyx_t_2 = (__pyx_v_ndarray != ((PyTypeObject*)Py_None));
23746     __pyx_t_3 = (__pyx_t_2 != 0);
23747     if (__pyx_t_3) {
23748       __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_arg, __pyx_v_ndarray);
23749       __pyx_t_2 = (__pyx_t_3 != 0);
23750       if (__pyx_t_2) {
23751         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 887, __pyx_L1_error)
23752         __Pyx_GOTREF(__pyx_t_6);
23753         __pyx_v_dtype = __pyx_t_6;
23754         __pyx_t_6 = 0;
23755         goto __pyx_L12;
23756       }
23757       __pyx_t_2 = __pyx_memoryview_check(__pyx_v_arg);
23758       __pyx_t_3 = (__pyx_t_2 != 0);
23759       if (__pyx_t_3) {
23760         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_base); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 887, __pyx_L1_error)
23761         __Pyx_GOTREF(__pyx_t_6);
23762         __pyx_v_arg_base = __pyx_t_6;
23763         __pyx_t_6 = 0;
23764         __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_arg_base, __pyx_v_ndarray);
23765         __pyx_t_2 = (__pyx_t_3 != 0);
23766         if (__pyx_t_2) {
23767           __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg_base, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 887, __pyx_L1_error)
23768           __Pyx_GOTREF(__pyx_t_6);
23769           __pyx_v_dtype = __pyx_t_6;
23770           __pyx_t_6 = 0;
23771           goto __pyx_L13;
23772         }
23773         /*else*/ {
23774           __Pyx_INCREF(Py_None);
23775           __pyx_v_dtype = Py_None;
23776         }
23777         __pyx_L13:;
23778         goto __pyx_L12;
23779       }
23780       /*else*/ {
23781         __Pyx_INCREF(Py_None);
23782         __pyx_v_dtype = Py_None;
23783       }
23784       __pyx_L12:;
23785       __pyx_v_itemsize = -1L;
23786       __pyx_t_2 = (__pyx_v_dtype != Py_None);
23787       __pyx_t_3 = (__pyx_t_2 != 0);
23788       if (__pyx_t_3) {
23789         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_itemsize); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 887, __pyx_L1_error)
23790         __Pyx_GOTREF(__pyx_t_6);
23791         __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 887, __pyx_L1_error)
23792         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
23793         __pyx_v_itemsize = __pyx_t_5;
23794         __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dtype, __pyx_n_s_kind); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 887, __pyx_L1_error)
23795         __Pyx_GOTREF(__pyx_t_6);
23796         __pyx_t_7 = __Pyx_PyObject_Ord(__pyx_t_6); if (unlikely(__pyx_t_7 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(1, 887, __pyx_L1_error)
23797         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
23798         __pyx_v_kind = __pyx_t_7;
23799         __pyx_v_dtype_signed = (__pyx_v_kind == 'i');
23800         switch (__pyx_v_kind) {
23801           case 'i':
23802           case 'u':
23803           break;
23804           case 'f':
23805           __pyx_t_2 = (((sizeof(float)) == __pyx_v_itemsize) != 0);
23806           if (__pyx_t_2) {
23807           } else {
23808             __pyx_t_3 = __pyx_t_2;
23809             goto __pyx_L16_bool_binop_done;
23810           }
23811           __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 887, __pyx_L1_error)
23812           __Pyx_GOTREF(__pyx_t_6);
23813           __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 887, __pyx_L1_error)
23814           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
23815           __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 1) != 0);
23816           __pyx_t_3 = __pyx_t_2;
23817           __pyx_L16_bool_binop_done:;
23818           if (__pyx_t_3) {
23819             if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(1, 887, __pyx_L1_error)
23820             goto __pyx_L10_break;
23821           }
23822           __pyx_t_2 = (((sizeof(double)) == __pyx_v_itemsize) != 0);
23823           if (__pyx_t_2) {
23824           } else {
23825             __pyx_t_3 = __pyx_t_2;
23826             goto __pyx_L19_bool_binop_done;
23827           }
23828           __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 887, __pyx_L1_error)
23829           __Pyx_GOTREF(__pyx_t_6);
23830           __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 887, __pyx_L1_error)
23831           __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
23832           __pyx_t_2 = ((((Py_ssize_t)__pyx_t_5) == 1) != 0);
23833           __pyx_t_3 = __pyx_t_2;
23834           __pyx_L19_bool_binop_done:;
23835           if (__pyx_t_3) {
23836             if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_double, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(1, 887, __pyx_L1_error)
23837             goto __pyx_L10_break;
23838           }
23839           break;
23840           case 'c':
23841           break;
23842           case 'O':
23843           break;
23844           default: break;
23845         }
23846       }
23847     }
23848     __pyx_t_2 = ((__pyx_v_itemsize == -1L) != 0);
23849     if (!__pyx_t_2) {
23850     } else {
23851       __pyx_t_3 = __pyx_t_2;
23852       goto __pyx_L22_bool_binop_done;
23853     }
23854     __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(float))) != 0);
23855     __pyx_t_3 = __pyx_t_2;
23856     __pyx_L22_bool_binop_done:;
23857     if (__pyx_t_3) {
23858       __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_v_arg, 0);
23859       __pyx_v_memslice = __pyx_t_8;
23860       __pyx_t_3 = (__pyx_v_memslice.memview != 0);
23861       if (__pyx_t_3) {
23862         __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1);
23863         if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_float, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(1, 887, __pyx_L1_error)
23864         goto __pyx_L10_break;
23865       }
23866       /*else*/ {
23867         PyErr_Clear();
23868       }
23869     }
23870     __pyx_t_2 = ((__pyx_v_itemsize == -1L) != 0);
23871     if (!__pyx_t_2) {
23872     } else {
23873       __pyx_t_3 = __pyx_t_2;
23874       goto __pyx_L26_bool_binop_done;
23875     }
23876     __pyx_t_2 = ((__pyx_v_itemsize == (sizeof(double))) != 0);
23877     __pyx_t_3 = __pyx_t_2;
23878     __pyx_L26_bool_binop_done:;
23879     if (__pyx_t_3) {
23880       __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_arg, 0);
23881       __pyx_v_memslice = __pyx_t_8;
23882       __pyx_t_3 = (__pyx_v_memslice.memview != 0);
23883       if (__pyx_t_3) {
23884         __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1);
23885         if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_double, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(1, 887, __pyx_L1_error)
23886         goto __pyx_L10_break;
23887       }
23888       /*else*/ {
23889         PyErr_Clear();
23890       }
23891     }
23892     if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, Py_None, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(1, 887, __pyx_L1_error)
23893     goto __pyx_L10_break;
23894   }
23895   __pyx_L10_break:;
23896   __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 887, __pyx_L1_error)
23897   __Pyx_GOTREF(__pyx_t_6);
23898   __pyx_v_candidates = ((PyObject*)__pyx_t_6);
23899   __pyx_t_6 = 0;
23900   __pyx_t_5 = 0;
23901   if (unlikely(__pyx_v_signatures == Py_None)) {
23902     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
23903     __PYX_ERR(1, 887, __pyx_L1_error)
23904   }
23905   __pyx_t_1 = __Pyx_dict_iterator(((PyObject*)__pyx_v_signatures), 1, ((PyObject *)NULL), (&__pyx_t_9), (&__pyx_t_10)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 887, __pyx_L1_error)
23906   __Pyx_GOTREF(__pyx_t_1);
23907   __Pyx_XDECREF(__pyx_t_6);
23908   __pyx_t_6 = __pyx_t_1;
23909   __pyx_t_1 = 0;
23910   while (1) {
23911     __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_9, &__pyx_t_5, &__pyx_t_1, NULL, NULL, __pyx_t_10);
23912     if (unlikely(__pyx_t_11 == 0)) break;
23913     if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(1, 887, __pyx_L1_error)
23914     __Pyx_GOTREF(__pyx_t_1);
23915     __Pyx_XDECREF_SET(__pyx_v_sig, __pyx_t_1);
23916     __pyx_t_1 = 0;
23917     __pyx_v_match_found = 0;
23918     __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_sig, __pyx_n_s_strip); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 887, __pyx_L1_error)
23919     __Pyx_GOTREF(__pyx_t_13);
23920     __pyx_t_14 = NULL;
23921     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
23922       __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_13);
23923       if (likely(__pyx_t_14)) {
23924         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
23925         __Pyx_INCREF(__pyx_t_14);
23926         __Pyx_INCREF(function);
23927         __Pyx_DECREF_SET(__pyx_t_13, function);
23928       }
23929     }
23930     __pyx_t_12 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_14, __pyx_kp_s__5) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_kp_s__5);
23931     __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
23932     if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 887, __pyx_L1_error)
23933     __Pyx_GOTREF(__pyx_t_12);
23934     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
23935     __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_split); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 887, __pyx_L1_error)
23936     __Pyx_GOTREF(__pyx_t_13);
23937     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
23938     __pyx_t_12 = NULL;
23939     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
23940       __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13);
23941       if (likely(__pyx_t_12)) {
23942         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
23943         __Pyx_INCREF(__pyx_t_12);
23944         __Pyx_INCREF(function);
23945         __Pyx_DECREF_SET(__pyx_t_13, function);
23946       }
23947     }
23948     __pyx_t_1 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_12, __pyx_kp_s__6) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_kp_s__6);
23949     __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
23950     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 887, __pyx_L1_error)
23951     __Pyx_GOTREF(__pyx_t_1);
23952     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
23953     __Pyx_XDECREF_SET(__pyx_v_src_sig, __pyx_t_1);
23954     __pyx_t_1 = 0;
23955     __pyx_t_15 = PyList_GET_SIZE(__pyx_v_dest_sig); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(1, 887, __pyx_L1_error)
23956     __pyx_t_16 = __pyx_t_15;
23957     for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
23958       __pyx_v_i = __pyx_t_17;
23959       __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_dest_sig, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 887, __pyx_L1_error)
23960       __Pyx_GOTREF(__pyx_t_1);
23961       __Pyx_XDECREF_SET(__pyx_v_dst_type, __pyx_t_1);
23962       __pyx_t_1 = 0;
23963       __pyx_t_3 = (__pyx_v_dst_type != Py_None);
23964       __pyx_t_2 = (__pyx_t_3 != 0);
23965       if (__pyx_t_2) {
23966         __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_src_sig, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 887, __pyx_L1_error)
23967         __Pyx_GOTREF(__pyx_t_1);
23968         __pyx_t_13 = PyObject_RichCompare(__pyx_t_1, __pyx_v_dst_type, Py_EQ); __Pyx_XGOTREF(__pyx_t_13); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 887, __pyx_L1_error)
23969         __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23970         __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_13); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 887, __pyx_L1_error)
23971         __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
23972         if (__pyx_t_2) {
23973           __pyx_v_match_found = 1;
23974           goto __pyx_L34;
23975         }
23976         /*else*/ {
23977           __pyx_v_match_found = 0;
23978           goto __pyx_L32_break;
23979         }
23980         __pyx_L34:;
23981       }
23982     }
23983     __pyx_L32_break:;
23984     __pyx_t_2 = (__pyx_v_match_found != 0);
23985     if (__pyx_t_2) {
23986       __pyx_t_18 = __Pyx_PyList_Append(__pyx_v_candidates, __pyx_v_sig); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(1, 887, __pyx_L1_error)
23987     }
23988   }
23989   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
23990   __pyx_t_2 = (PyList_GET_SIZE(__pyx_v_candidates) != 0);
23991   __pyx_t_3 = ((!__pyx_t_2) != 0);
23992   if (__pyx_t_3) {
23993     __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 887, __pyx_L1_error)
23994     __Pyx_GOTREF(__pyx_t_6);
23995     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
23996     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
23997     __PYX_ERR(1, 887, __pyx_L1_error)
23998   }
23999   __pyx_t_9 = PyList_GET_SIZE(__pyx_v_candidates); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(1, 887, __pyx_L1_error)
24000   __pyx_t_3 = ((__pyx_t_9 > 1) != 0);
24001   if (__pyx_t_3) {
24002     __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 887, __pyx_L1_error)
24003     __Pyx_GOTREF(__pyx_t_6);
24004     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
24005     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
24006     __PYX_ERR(1, 887, __pyx_L1_error)
24007   }
24008   /*else*/ {
24009     __Pyx_XDECREF(__pyx_r);
24010     if (unlikely(__pyx_v_signatures == Py_None)) {
24011       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
24012       __PYX_ERR(1, 887, __pyx_L1_error)
24013     }
24014     __pyx_t_6 = __Pyx_GetItemInt_List(__pyx_v_candidates, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 887, __pyx_L1_error)
24015     __Pyx_GOTREF(__pyx_t_6);
24016     __pyx_t_13 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_signatures), __pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 887, __pyx_L1_error)
24017     __Pyx_GOTREF(__pyx_t_13);
24018     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
24019     __pyx_r = __pyx_t_13;
24020     __pyx_t_13 = 0;
24021     goto __pyx_L0;
24022   }
24023 
24024   /* function exit code */
24025   __pyx_L1_error:;
24026   __Pyx_XDECREF(__pyx_t_1);
24027   __Pyx_XDECREF(__pyx_t_6);
24028   __Pyx_XDECREF(__pyx_t_12);
24029   __Pyx_XDECREF(__pyx_t_13);
24030   __Pyx_XDECREF(__pyx_t_14);
24031   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename);
24032   __pyx_r = NULL;
24033   __pyx_L0:;
24034   __Pyx_XDECREF(__pyx_v_dest_sig);
24035   __Pyx_XDECREF(__pyx_v_ndarray);
24036   __Pyx_XDECREF(__pyx_v_arg);
24037   __Pyx_XDECREF(__pyx_v_dtype);
24038   __Pyx_XDECREF(__pyx_v_arg_base);
24039   __Pyx_XDECREF(__pyx_v_candidates);
24040   __Pyx_XDECREF(__pyx_v_sig);
24041   __Pyx_XDECREF(__pyx_v_src_sig);
24042   __Pyx_XDECREF(__pyx_v_dst_type);
24043   __Pyx_XDECREF(__pyx_v_kwargs);
24044   __Pyx_XGIVEREF(__pyx_r);
24045   __Pyx_RefNannyFinishContext();
24046   return __pyx_r;
24047 }
24048 
24049 /* Python wrapper */
24050 static PyObject *__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_107compare_morton(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
24051 static PyMethodDef __pyx_fuse_0__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_107compare_morton = {"__pyx_fuse_0compare_morton", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_107compare_morton, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_107compare_morton(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)24052 static PyObject *__pyx_fuse_0__pyx_pw_2yt_9utilities_3lib_14geometry_utils_107compare_morton(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
24053   PyArrayObject *__pyx_v_p0 = 0;
24054   PyArrayObject *__pyx_v_q0 = 0;
24055   PyObject *__pyx_r = 0;
24056   __Pyx_RefNannyDeclarations
24057   __Pyx_RefNannySetupContext("compare_morton (wrapper)", 0);
24058   {
24059     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p0,&__pyx_n_s_q0,0};
24060     PyObject* values[2] = {0,0};
24061     if (unlikely(__pyx_kwds)) {
24062       Py_ssize_t kw_args;
24063       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
24064       switch (pos_args) {
24065         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
24066         CYTHON_FALLTHROUGH;
24067         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
24068         CYTHON_FALLTHROUGH;
24069         case  0: break;
24070         default: goto __pyx_L5_argtuple_error;
24071       }
24072       kw_args = PyDict_Size(__pyx_kwds);
24073       switch (pos_args) {
24074         case  0:
24075         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p0)) != 0)) kw_args--;
24076         else goto __pyx_L5_argtuple_error;
24077         CYTHON_FALLTHROUGH;
24078         case  1:
24079         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q0)) != 0)) kw_args--;
24080         else {
24081           __Pyx_RaiseArgtupleInvalid("compare_morton", 1, 2, 2, 1); __PYX_ERR(1, 887, __pyx_L3_error)
24082         }
24083       }
24084       if (unlikely(kw_args > 0)) {
24085         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compare_morton") < 0)) __PYX_ERR(1, 887, __pyx_L3_error)
24086       }
24087     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
24088       goto __pyx_L5_argtuple_error;
24089     } else {
24090       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
24091       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
24092     }
24093     __pyx_v_p0 = ((PyArrayObject *)values[0]);
24094     __pyx_v_q0 = ((PyArrayObject *)values[1]);
24095   }
24096   goto __pyx_L4_argument_unpacking_done;
24097   __pyx_L5_argtuple_error:;
24098   __Pyx_RaiseArgtupleInvalid("compare_morton", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 887, __pyx_L3_error)
24099   __pyx_L3_error:;
24100   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.compare_morton", __pyx_clineno, __pyx_lineno, __pyx_filename);
24101   __Pyx_RefNannyFinishContext();
24102   return NULL;
24103   __pyx_L4_argument_unpacking_done:;
24104   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p0), __pyx_ptype_5numpy_ndarray, 1, "p0", 0))) __PYX_ERR(1, 887, __pyx_L1_error)
24105   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q0), __pyx_ptype_5numpy_ndarray, 1, "q0", 0))) __PYX_ERR(1, 887, __pyx_L1_error)
24106   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_106compare_morton(__pyx_self, __pyx_v_p0, __pyx_v_q0);
24107 
24108   /* function exit code */
24109   goto __pyx_L0;
24110   __pyx_L1_error:;
24111   __pyx_r = NULL;
24112   __pyx_L0:;
24113   __Pyx_RefNannyFinishContext();
24114   return __pyx_r;
24115 }
24116 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_106compare_morton(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_p0,PyArrayObject * __pyx_v_q0)24117 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_106compare_morton(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_p0, PyArrayObject *__pyx_v_q0) {
24118   __pyx_t_5numpy_float64_t __pyx_v_p[3];
24119   __pyx_t_5numpy_float64_t __pyx_v_q[3];
24120   int __pyx_v_j;
24121   __Pyx_LocalBuf_ND __pyx_pybuffernd_p0;
24122   __Pyx_Buffer __pyx_pybuffer_p0;
24123   __Pyx_LocalBuf_ND __pyx_pybuffernd_q0;
24124   __Pyx_Buffer __pyx_pybuffer_q0;
24125   PyObject *__pyx_r = NULL;
24126   __Pyx_RefNannyDeclarations
24127   int __pyx_t_1;
24128   Py_ssize_t __pyx_t_2;
24129   int __pyx_t_3;
24130   Py_ssize_t __pyx_t_4;
24131   PyObject *__pyx_t_5 = NULL;
24132   __Pyx_RefNannySetupContext("__pyx_fuse_0compare_morton", 0);
24133   __pyx_pybuffer_p0.pybuffer.buf = NULL;
24134   __pyx_pybuffer_p0.refcount = 0;
24135   __pyx_pybuffernd_p0.data = NULL;
24136   __pyx_pybuffernd_p0.rcbuffer = &__pyx_pybuffer_p0;
24137   __pyx_pybuffer_q0.pybuffer.buf = NULL;
24138   __pyx_pybuffer_q0.refcount = 0;
24139   __pyx_pybuffernd_q0.data = NULL;
24140   __pyx_pybuffernd_q0.rcbuffer = &__pyx_pybuffer_q0;
24141   {
24142     __Pyx_BufFmt_StackElem __pyx_stack[1];
24143     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_p0.rcbuffer->pybuffer, (PyObject*)__pyx_v_p0, &__Pyx_TypeInfo_float, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 887, __pyx_L1_error)
24144   }
24145   __pyx_pybuffernd_p0.diminfo[0].strides = __pyx_pybuffernd_p0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_p0.diminfo[0].shape = __pyx_pybuffernd_p0.rcbuffer->pybuffer.shape[0];
24146   {
24147     __Pyx_BufFmt_StackElem __pyx_stack[1];
24148     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q0.rcbuffer->pybuffer, (PyObject*)__pyx_v_q0, &__Pyx_TypeInfo_float, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 887, __pyx_L1_error)
24149   }
24150   __pyx_pybuffernd_q0.diminfo[0].strides = __pyx_pybuffernd_q0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q0.diminfo[0].shape = __pyx_pybuffernd_q0.rcbuffer->pybuffer.shape[0];
24151 
24152   /* "yt/utilities/lib/geometry_utils.pyx":892
24153  *     # cdef np.int64_t iep,ieq,imp,imq
24154  *     cdef int j
24155  *     for j in range(3):             # <<<<<<<<<<<<<<
24156  *         p[j] = p0[j]
24157  *         q[j] = q0[j]
24158  */
24159   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
24160     __pyx_v_j = __pyx_t_1;
24161 
24162     /* "yt/utilities/lib/geometry_utils.pyx":893
24163  *     cdef int j
24164  *     for j in range(3):
24165  *         p[j] = p0[j]             # <<<<<<<<<<<<<<
24166  *         q[j] = q0[j]
24167  *         # imp = ifrexp(p[j],&iep)
24168  */
24169     __pyx_t_2 = __pyx_v_j;
24170     __pyx_t_3 = -1;
24171     if (__pyx_t_2 < 0) {
24172       __pyx_t_2 += __pyx_pybuffernd_p0.diminfo[0].shape;
24173       if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 0;
24174     } else if (unlikely(__pyx_t_2 >= __pyx_pybuffernd_p0.diminfo[0].shape)) __pyx_t_3 = 0;
24175     if (unlikely(__pyx_t_3 != -1)) {
24176       __Pyx_RaiseBufferIndexError(__pyx_t_3);
24177       __PYX_ERR(1, 893, __pyx_L1_error)
24178     }
24179     (__pyx_v_p[__pyx_v_j]) = (*__Pyx_BufPtrStrided1d(float *, __pyx_pybuffernd_p0.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_p0.diminfo[0].strides));
24180 
24181     /* "yt/utilities/lib/geometry_utils.pyx":894
24182  *     for j in range(3):
24183  *         p[j] = p0[j]
24184  *         q[j] = q0[j]             # <<<<<<<<<<<<<<
24185  *         # imp = ifrexp(p[j],&iep)
24186  *         # imq = ifrexp(q[j],&ieq)
24187  */
24188     __pyx_t_4 = __pyx_v_j;
24189     __pyx_t_3 = -1;
24190     if (__pyx_t_4 < 0) {
24191       __pyx_t_4 += __pyx_pybuffernd_q0.diminfo[0].shape;
24192       if (unlikely(__pyx_t_4 < 0)) __pyx_t_3 = 0;
24193     } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_q0.diminfo[0].shape)) __pyx_t_3 = 0;
24194     if (unlikely(__pyx_t_3 != -1)) {
24195       __Pyx_RaiseBufferIndexError(__pyx_t_3);
24196       __PYX_ERR(1, 894, __pyx_L1_error)
24197     }
24198     (__pyx_v_q[__pyx_v_j]) = (*__Pyx_BufPtrStrided1d(float *, __pyx_pybuffernd_q0.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_q0.diminfo[0].strides));
24199   }
24200 
24201   /* "yt/utilities/lib/geometry_utils.pyx":898
24202  *         # imq = ifrexp(q[j],&ieq)
24203  *         # print(j,p[j],q[j],xor_msb(p[j],q[j]),'m=',imp,imq,'e=',iep,ieq)
24204  *     return compare_floats_morton(p,q)             # <<<<<<<<<<<<<<
24205  *
24206  * @cython.cdivision(True)
24207  */
24208   __Pyx_XDECREF(__pyx_r);
24209   __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_f_2yt_9utilities_3lib_14geometry_utils_compare_floats_morton(__pyx_v_p, __pyx_v_q)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 898, __pyx_L1_error)
24210   __Pyx_GOTREF(__pyx_t_5);
24211   __pyx_r = __pyx_t_5;
24212   __pyx_t_5 = 0;
24213   goto __pyx_L0;
24214 
24215   /* "yt/utilities/lib/geometry_utils.pyx":887
24216  *     return
24217  *
24218  * def compare_morton(np.ndarray[floating, ndim=1] p0, np.ndarray[floating, ndim=1] q0):             # <<<<<<<<<<<<<<
24219  *     cdef np.float64_t p[3]
24220  *     cdef np.float64_t q[3]
24221  */
24222 
24223   /* function exit code */
24224   __pyx_L1_error:;
24225   __Pyx_XDECREF(__pyx_t_5);
24226   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
24227     __Pyx_PyThreadState_declare
24228     __Pyx_PyThreadState_assign
24229     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
24230     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_p0.rcbuffer->pybuffer);
24231     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q0.rcbuffer->pybuffer);
24232   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
24233   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.compare_morton", __pyx_clineno, __pyx_lineno, __pyx_filename);
24234   __pyx_r = NULL;
24235   goto __pyx_L2;
24236   __pyx_L0:;
24237   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_p0.rcbuffer->pybuffer);
24238   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q0.rcbuffer->pybuffer);
24239   __pyx_L2:;
24240   __Pyx_XGIVEREF(__pyx_r);
24241   __Pyx_RefNannyFinishContext();
24242   return __pyx_r;
24243 }
24244 
24245 /* Python wrapper */
24246 static PyObject *__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_109compare_morton(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
24247 static PyMethodDef __pyx_fuse_1__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_109compare_morton = {"__pyx_fuse_1compare_morton", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_109compare_morton, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_109compare_morton(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)24248 static PyObject *__pyx_fuse_1__pyx_pw_2yt_9utilities_3lib_14geometry_utils_109compare_morton(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
24249   PyArrayObject *__pyx_v_p0 = 0;
24250   PyArrayObject *__pyx_v_q0 = 0;
24251   PyObject *__pyx_r = 0;
24252   __Pyx_RefNannyDeclarations
24253   __Pyx_RefNannySetupContext("compare_morton (wrapper)", 0);
24254   {
24255     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p0,&__pyx_n_s_q0,0};
24256     PyObject* values[2] = {0,0};
24257     if (unlikely(__pyx_kwds)) {
24258       Py_ssize_t kw_args;
24259       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
24260       switch (pos_args) {
24261         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
24262         CYTHON_FALLTHROUGH;
24263         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
24264         CYTHON_FALLTHROUGH;
24265         case  0: break;
24266         default: goto __pyx_L5_argtuple_error;
24267       }
24268       kw_args = PyDict_Size(__pyx_kwds);
24269       switch (pos_args) {
24270         case  0:
24271         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p0)) != 0)) kw_args--;
24272         else goto __pyx_L5_argtuple_error;
24273         CYTHON_FALLTHROUGH;
24274         case  1:
24275         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q0)) != 0)) kw_args--;
24276         else {
24277           __Pyx_RaiseArgtupleInvalid("compare_morton", 1, 2, 2, 1); __PYX_ERR(1, 887, __pyx_L3_error)
24278         }
24279       }
24280       if (unlikely(kw_args > 0)) {
24281         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compare_morton") < 0)) __PYX_ERR(1, 887, __pyx_L3_error)
24282       }
24283     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
24284       goto __pyx_L5_argtuple_error;
24285     } else {
24286       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
24287       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
24288     }
24289     __pyx_v_p0 = ((PyArrayObject *)values[0]);
24290     __pyx_v_q0 = ((PyArrayObject *)values[1]);
24291   }
24292   goto __pyx_L4_argument_unpacking_done;
24293   __pyx_L5_argtuple_error:;
24294   __Pyx_RaiseArgtupleInvalid("compare_morton", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 887, __pyx_L3_error)
24295   __pyx_L3_error:;
24296   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.compare_morton", __pyx_clineno, __pyx_lineno, __pyx_filename);
24297   __Pyx_RefNannyFinishContext();
24298   return NULL;
24299   __pyx_L4_argument_unpacking_done:;
24300   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p0), __pyx_ptype_5numpy_ndarray, 1, "p0", 0))) __PYX_ERR(1, 887, __pyx_L1_error)
24301   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q0), __pyx_ptype_5numpy_ndarray, 1, "q0", 0))) __PYX_ERR(1, 887, __pyx_L1_error)
24302   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_108compare_morton(__pyx_self, __pyx_v_p0, __pyx_v_q0);
24303 
24304   /* function exit code */
24305   goto __pyx_L0;
24306   __pyx_L1_error:;
24307   __pyx_r = NULL;
24308   __pyx_L0:;
24309   __Pyx_RefNannyFinishContext();
24310   return __pyx_r;
24311 }
24312 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_108compare_morton(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_p0,PyArrayObject * __pyx_v_q0)24313 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_108compare_morton(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_p0, PyArrayObject *__pyx_v_q0) {
24314   __pyx_t_5numpy_float64_t __pyx_v_p[3];
24315   __pyx_t_5numpy_float64_t __pyx_v_q[3];
24316   int __pyx_v_j;
24317   __Pyx_LocalBuf_ND __pyx_pybuffernd_p0;
24318   __Pyx_Buffer __pyx_pybuffer_p0;
24319   __Pyx_LocalBuf_ND __pyx_pybuffernd_q0;
24320   __Pyx_Buffer __pyx_pybuffer_q0;
24321   PyObject *__pyx_r = NULL;
24322   __Pyx_RefNannyDeclarations
24323   int __pyx_t_1;
24324   Py_ssize_t __pyx_t_2;
24325   int __pyx_t_3;
24326   Py_ssize_t __pyx_t_4;
24327   PyObject *__pyx_t_5 = NULL;
24328   __Pyx_RefNannySetupContext("__pyx_fuse_1compare_morton", 0);
24329   __pyx_pybuffer_p0.pybuffer.buf = NULL;
24330   __pyx_pybuffer_p0.refcount = 0;
24331   __pyx_pybuffernd_p0.data = NULL;
24332   __pyx_pybuffernd_p0.rcbuffer = &__pyx_pybuffer_p0;
24333   __pyx_pybuffer_q0.pybuffer.buf = NULL;
24334   __pyx_pybuffer_q0.refcount = 0;
24335   __pyx_pybuffernd_q0.data = NULL;
24336   __pyx_pybuffernd_q0.rcbuffer = &__pyx_pybuffer_q0;
24337   {
24338     __Pyx_BufFmt_StackElem __pyx_stack[1];
24339     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_p0.rcbuffer->pybuffer, (PyObject*)__pyx_v_p0, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 887, __pyx_L1_error)
24340   }
24341   __pyx_pybuffernd_p0.diminfo[0].strides = __pyx_pybuffernd_p0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_p0.diminfo[0].shape = __pyx_pybuffernd_p0.rcbuffer->pybuffer.shape[0];
24342   {
24343     __Pyx_BufFmt_StackElem __pyx_stack[1];
24344     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q0.rcbuffer->pybuffer, (PyObject*)__pyx_v_q0, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 887, __pyx_L1_error)
24345   }
24346   __pyx_pybuffernd_q0.diminfo[0].strides = __pyx_pybuffernd_q0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q0.diminfo[0].shape = __pyx_pybuffernd_q0.rcbuffer->pybuffer.shape[0];
24347 
24348   /* "yt/utilities/lib/geometry_utils.pyx":892
24349  *     # cdef np.int64_t iep,ieq,imp,imq
24350  *     cdef int j
24351  *     for j in range(3):             # <<<<<<<<<<<<<<
24352  *         p[j] = p0[j]
24353  *         q[j] = q0[j]
24354  */
24355   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
24356     __pyx_v_j = __pyx_t_1;
24357 
24358     /* "yt/utilities/lib/geometry_utils.pyx":893
24359  *     cdef int j
24360  *     for j in range(3):
24361  *         p[j] = p0[j]             # <<<<<<<<<<<<<<
24362  *         q[j] = q0[j]
24363  *         # imp = ifrexp(p[j],&iep)
24364  */
24365     __pyx_t_2 = __pyx_v_j;
24366     __pyx_t_3 = -1;
24367     if (__pyx_t_2 < 0) {
24368       __pyx_t_2 += __pyx_pybuffernd_p0.diminfo[0].shape;
24369       if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 0;
24370     } else if (unlikely(__pyx_t_2 >= __pyx_pybuffernd_p0.diminfo[0].shape)) __pyx_t_3 = 0;
24371     if (unlikely(__pyx_t_3 != -1)) {
24372       __Pyx_RaiseBufferIndexError(__pyx_t_3);
24373       __PYX_ERR(1, 893, __pyx_L1_error)
24374     }
24375     (__pyx_v_p[__pyx_v_j]) = (*__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_p0.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_p0.diminfo[0].strides));
24376 
24377     /* "yt/utilities/lib/geometry_utils.pyx":894
24378  *     for j in range(3):
24379  *         p[j] = p0[j]
24380  *         q[j] = q0[j]             # <<<<<<<<<<<<<<
24381  *         # imp = ifrexp(p[j],&iep)
24382  *         # imq = ifrexp(q[j],&ieq)
24383  */
24384     __pyx_t_4 = __pyx_v_j;
24385     __pyx_t_3 = -1;
24386     if (__pyx_t_4 < 0) {
24387       __pyx_t_4 += __pyx_pybuffernd_q0.diminfo[0].shape;
24388       if (unlikely(__pyx_t_4 < 0)) __pyx_t_3 = 0;
24389     } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_q0.diminfo[0].shape)) __pyx_t_3 = 0;
24390     if (unlikely(__pyx_t_3 != -1)) {
24391       __Pyx_RaiseBufferIndexError(__pyx_t_3);
24392       __PYX_ERR(1, 894, __pyx_L1_error)
24393     }
24394     (__pyx_v_q[__pyx_v_j]) = (*__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_q0.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_q0.diminfo[0].strides));
24395   }
24396 
24397   /* "yt/utilities/lib/geometry_utils.pyx":898
24398  *         # imq = ifrexp(q[j],&ieq)
24399  *         # print(j,p[j],q[j],xor_msb(p[j],q[j]),'m=',imp,imq,'e=',iep,ieq)
24400  *     return compare_floats_morton(p,q)             # <<<<<<<<<<<<<<
24401  *
24402  * @cython.cdivision(True)
24403  */
24404   __Pyx_XDECREF(__pyx_r);
24405   __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_f_2yt_9utilities_3lib_14geometry_utils_compare_floats_morton(__pyx_v_p, __pyx_v_q)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 898, __pyx_L1_error)
24406   __Pyx_GOTREF(__pyx_t_5);
24407   __pyx_r = __pyx_t_5;
24408   __pyx_t_5 = 0;
24409   goto __pyx_L0;
24410 
24411   /* "yt/utilities/lib/geometry_utils.pyx":887
24412  *     return
24413  *
24414  * def compare_morton(np.ndarray[floating, ndim=1] p0, np.ndarray[floating, ndim=1] q0):             # <<<<<<<<<<<<<<
24415  *     cdef np.float64_t p[3]
24416  *     cdef np.float64_t q[3]
24417  */
24418 
24419   /* function exit code */
24420   __pyx_L1_error:;
24421   __Pyx_XDECREF(__pyx_t_5);
24422   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
24423     __Pyx_PyThreadState_declare
24424     __Pyx_PyThreadState_assign
24425     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
24426     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_p0.rcbuffer->pybuffer);
24427     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q0.rcbuffer->pybuffer);
24428   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
24429   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.compare_morton", __pyx_clineno, __pyx_lineno, __pyx_filename);
24430   __pyx_r = NULL;
24431   goto __pyx_L2;
24432   __pyx_L0:;
24433   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_p0.rcbuffer->pybuffer);
24434   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q0.rcbuffer->pybuffer);
24435   __pyx_L2:;
24436   __Pyx_XGIVEREF(__pyx_r);
24437   __Pyx_RefNannyFinishContext();
24438   return __pyx_r;
24439 }
24440 
24441 /* "yt/utilities/lib/geometry_utils.pyx":903
24442  * @cython.boundscheck(False)
24443  * @cython.wraparound(False)
24444  * cdef np.int64_t position_to_morton(np.ndarray[floating, ndim=1] pos_x,             # <<<<<<<<<<<<<<
24445  *                         np.ndarray[floating, ndim=1] pos_y,
24446  *                         np.ndarray[floating, ndim=1] pos_z,
24447  */
24448 
__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_14geometry_utils_position_to_morton(PyArrayObject * __pyx_v_pos_x,PyArrayObject * __pyx_v_pos_y,PyArrayObject * __pyx_v_pos_z,__pyx_t_5numpy_float64_t * __pyx_v_dds,__pyx_t_5numpy_float64_t * __pyx_v_DLE,__pyx_t_5numpy_float64_t * __pyx_v_DRE,PyArrayObject * __pyx_v_ind,int __pyx_v_filter)24449 static __pyx_t_5numpy_int64_t __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_14geometry_utils_position_to_morton(PyArrayObject *__pyx_v_pos_x, PyArrayObject *__pyx_v_pos_y, PyArrayObject *__pyx_v_pos_z, __pyx_t_5numpy_float64_t *__pyx_v_dds, __pyx_t_5numpy_float64_t *__pyx_v_DLE, __pyx_t_5numpy_float64_t *__pyx_v_DRE, PyArrayObject *__pyx_v_ind, int __pyx_v_filter) {
24450   __pyx_t_5numpy_uint64_t __pyx_v_ii[3];
24451   __pyx_t_5numpy_float64_t __pyx_v_p[3];
24452   __pyx_t_5numpy_int64_t __pyx_v_i;
24453   __pyx_t_5numpy_int64_t __pyx_v_j;
24454   __pyx_t_5numpy_int64_t __pyx_v_use;
24455   __pyx_t_5numpy_uint64_t __pyx_v_DD[3];
24456   __pyx_t_5numpy_uint64_t __pyx_v_FLAG;
24457   __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
24458   __Pyx_Buffer __pyx_pybuffer_ind;
24459   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos_x;
24460   __Pyx_Buffer __pyx_pybuffer_pos_x;
24461   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos_y;
24462   __Pyx_Buffer __pyx_pybuffer_pos_y;
24463   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos_z;
24464   __Pyx_Buffer __pyx_pybuffer_pos_z;
24465   __pyx_t_5numpy_int64_t __pyx_r;
24466   __Pyx_RefNannyDeclarations
24467   __pyx_t_5numpy_int64_t __pyx_t_1;
24468   npy_intp __pyx_t_2;
24469   npy_intp __pyx_t_3;
24470   __pyx_t_5numpy_int64_t __pyx_t_4;
24471   __pyx_t_5numpy_int64_t __pyx_t_5;
24472   __pyx_t_5numpy_int64_t __pyx_t_6;
24473   __pyx_t_5numpy_int64_t __pyx_t_7;
24474   int __pyx_t_8;
24475   int __pyx_t_9;
24476   __pyx_t_5numpy_int64_t __pyx_t_10;
24477   __Pyx_RefNannySetupContext("__pyx_fuse_0position_to_morton", 0);
24478   __pyx_pybuffer_pos_x.pybuffer.buf = NULL;
24479   __pyx_pybuffer_pos_x.refcount = 0;
24480   __pyx_pybuffernd_pos_x.data = NULL;
24481   __pyx_pybuffernd_pos_x.rcbuffer = &__pyx_pybuffer_pos_x;
24482   __pyx_pybuffer_pos_y.pybuffer.buf = NULL;
24483   __pyx_pybuffer_pos_y.refcount = 0;
24484   __pyx_pybuffernd_pos_y.data = NULL;
24485   __pyx_pybuffernd_pos_y.rcbuffer = &__pyx_pybuffer_pos_y;
24486   __pyx_pybuffer_pos_z.pybuffer.buf = NULL;
24487   __pyx_pybuffer_pos_z.refcount = 0;
24488   __pyx_pybuffernd_pos_z.data = NULL;
24489   __pyx_pybuffernd_pos_z.rcbuffer = &__pyx_pybuffer_pos_z;
24490   __pyx_pybuffer_ind.pybuffer.buf = NULL;
24491   __pyx_pybuffer_ind.refcount = 0;
24492   __pyx_pybuffernd_ind.data = NULL;
24493   __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;
24494   {
24495     __Pyx_BufFmt_StackElem __pyx_stack[1];
24496     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos_x, &__Pyx_TypeInfo_float, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 903, __pyx_L1_error)
24497   }
24498   __pyx_pybuffernd_pos_x.diminfo[0].strides = __pyx_pybuffernd_pos_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos_x.diminfo[0].shape = __pyx_pybuffernd_pos_x.rcbuffer->pybuffer.shape[0];
24499   {
24500     __Pyx_BufFmt_StackElem __pyx_stack[1];
24501     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos_y, &__Pyx_TypeInfo_float, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 903, __pyx_L1_error)
24502   }
24503   __pyx_pybuffernd_pos_y.diminfo[0].strides = __pyx_pybuffernd_pos_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos_y.diminfo[0].shape = __pyx_pybuffernd_pos_y.rcbuffer->pybuffer.shape[0];
24504   {
24505     __Pyx_BufFmt_StackElem __pyx_stack[1];
24506     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos_z.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos_z, &__Pyx_TypeInfo_float, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 903, __pyx_L1_error)
24507   }
24508   __pyx_pybuffernd_pos_z.diminfo[0].strides = __pyx_pybuffernd_pos_z.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos_z.diminfo[0].shape = __pyx_pybuffernd_pos_z.rcbuffer->pybuffer.shape[0];
24509   {
24510     __Pyx_BufFmt_StackElem __pyx_stack[1];
24511     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 903, __pyx_L1_error)
24512   }
24513   __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
24514 
24515   /* "yt/utilities/lib/geometry_utils.pyx":915
24516  *     cdef np.int64_t i, j, use
24517  *     cdef np.uint64_t DD[3]
24518  *     cdef np.uint64_t FLAG = ~(<np.uint64_t>0)             # <<<<<<<<<<<<<<
24519  *     for i in range(3):
24520  *         DD[i] = <np.uint64_t> ((DRE[i] - DLE[i]) / dds[i])
24521  */
24522   __pyx_v_FLAG = (~((__pyx_t_5numpy_uint64_t)0));
24523 
24524   /* "yt/utilities/lib/geometry_utils.pyx":916
24525  *     cdef np.uint64_t DD[3]
24526  *     cdef np.uint64_t FLAG = ~(<np.uint64_t>0)
24527  *     for i in range(3):             # <<<<<<<<<<<<<<
24528  *         DD[i] = <np.uint64_t> ((DRE[i] - DLE[i]) / dds[i])
24529  *     for i in range(pos_x.shape[0]):
24530  */
24531   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
24532     __pyx_v_i = __pyx_t_1;
24533 
24534     /* "yt/utilities/lib/geometry_utils.pyx":917
24535  *     cdef np.uint64_t FLAG = ~(<np.uint64_t>0)
24536  *     for i in range(3):
24537  *         DD[i] = <np.uint64_t> ((DRE[i] - DLE[i]) / dds[i])             # <<<<<<<<<<<<<<
24538  *     for i in range(pos_x.shape[0]):
24539  *         use = 1
24540  */
24541     (__pyx_v_DD[__pyx_v_i]) = ((__pyx_t_5numpy_uint64_t)(((__pyx_v_DRE[__pyx_v_i]) - (__pyx_v_DLE[__pyx_v_i])) / (__pyx_v_dds[__pyx_v_i])));
24542   }
24543 
24544   /* "yt/utilities/lib/geometry_utils.pyx":918
24545  *     for i in range(3):
24546  *         DD[i] = <np.uint64_t> ((DRE[i] - DLE[i]) / dds[i])
24547  *     for i in range(pos_x.shape[0]):             # <<<<<<<<<<<<<<
24548  *         use = 1
24549  *         p[0] = <np.float64_t> pos_x[i]
24550  */
24551   __pyx_t_2 = (__pyx_v_pos_x->dimensions[0]);
24552   __pyx_t_3 = __pyx_t_2;
24553   for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_3; __pyx_t_1+=1) {
24554     __pyx_v_i = __pyx_t_1;
24555 
24556     /* "yt/utilities/lib/geometry_utils.pyx":919
24557  *         DD[i] = <np.uint64_t> ((DRE[i] - DLE[i]) / dds[i])
24558  *     for i in range(pos_x.shape[0]):
24559  *         use = 1             # <<<<<<<<<<<<<<
24560  *         p[0] = <np.float64_t> pos_x[i]
24561  *         p[1] = <np.float64_t> pos_y[i]
24562  */
24563     __pyx_v_use = 1;
24564 
24565     /* "yt/utilities/lib/geometry_utils.pyx":920
24566  *     for i in range(pos_x.shape[0]):
24567  *         use = 1
24568  *         p[0] = <np.float64_t> pos_x[i]             # <<<<<<<<<<<<<<
24569  *         p[1] = <np.float64_t> pos_y[i]
24570  *         p[2] = <np.float64_t> pos_z[i]
24571  */
24572     __pyx_t_4 = __pyx_v_i;
24573     (__pyx_v_p[0]) = ((__pyx_t_5numpy_float64_t)(*__Pyx_BufPtrStrided1d(float *, __pyx_pybuffernd_pos_x.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_pos_x.diminfo[0].strides)));
24574 
24575     /* "yt/utilities/lib/geometry_utils.pyx":921
24576  *         use = 1
24577  *         p[0] = <np.float64_t> pos_x[i]
24578  *         p[1] = <np.float64_t> pos_y[i]             # <<<<<<<<<<<<<<
24579  *         p[2] = <np.float64_t> pos_z[i]
24580  *         for j in range(3):
24581  */
24582     __pyx_t_5 = __pyx_v_i;
24583     (__pyx_v_p[1]) = ((__pyx_t_5numpy_float64_t)(*__Pyx_BufPtrStrided1d(float *, __pyx_pybuffernd_pos_y.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_pos_y.diminfo[0].strides)));
24584 
24585     /* "yt/utilities/lib/geometry_utils.pyx":922
24586  *         p[0] = <np.float64_t> pos_x[i]
24587  *         p[1] = <np.float64_t> pos_y[i]
24588  *         p[2] = <np.float64_t> pos_z[i]             # <<<<<<<<<<<<<<
24589  *         for j in range(3):
24590  *             if p[j] < DLE[j] or p[j] > DRE[j]:
24591  */
24592     __pyx_t_6 = __pyx_v_i;
24593     (__pyx_v_p[2]) = ((__pyx_t_5numpy_float64_t)(*__Pyx_BufPtrStrided1d(float *, __pyx_pybuffernd_pos_z.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_pos_z.diminfo[0].strides)));
24594 
24595     /* "yt/utilities/lib/geometry_utils.pyx":923
24596  *         p[1] = <np.float64_t> pos_y[i]
24597  *         p[2] = <np.float64_t> pos_z[i]
24598  *         for j in range(3):             # <<<<<<<<<<<<<<
24599  *             if p[j] < DLE[j] or p[j] > DRE[j]:
24600  *                 if filter == 1:
24601  */
24602     for (__pyx_t_7 = 0; __pyx_t_7 < 3; __pyx_t_7+=1) {
24603       __pyx_v_j = __pyx_t_7;
24604 
24605       /* "yt/utilities/lib/geometry_utils.pyx":924
24606  *         p[2] = <np.float64_t> pos_z[i]
24607  *         for j in range(3):
24608  *             if p[j] < DLE[j] or p[j] > DRE[j]:             # <<<<<<<<<<<<<<
24609  *                 if filter == 1:
24610  *                     # We only allow 20 levels, so this is inaccessible
24611  */
24612       __pyx_t_9 = (((__pyx_v_p[__pyx_v_j]) < (__pyx_v_DLE[__pyx_v_j])) != 0);
24613       if (!__pyx_t_9) {
24614       } else {
24615         __pyx_t_8 = __pyx_t_9;
24616         goto __pyx_L10_bool_binop_done;
24617       }
24618       __pyx_t_9 = (((__pyx_v_p[__pyx_v_j]) > (__pyx_v_DRE[__pyx_v_j])) != 0);
24619       __pyx_t_8 = __pyx_t_9;
24620       __pyx_L10_bool_binop_done:;
24621       if (__pyx_t_8) {
24622 
24623         /* "yt/utilities/lib/geometry_utils.pyx":925
24624  *         for j in range(3):
24625  *             if p[j] < DLE[j] or p[j] > DRE[j]:
24626  *                 if filter == 1:             # <<<<<<<<<<<<<<
24627  *                     # We only allow 20 levels, so this is inaccessible
24628  *                     use = 0
24629  */
24630         __pyx_t_8 = ((__pyx_v_filter == 1) != 0);
24631         if (__pyx_t_8) {
24632 
24633           /* "yt/utilities/lib/geometry_utils.pyx":927
24634  *                 if filter == 1:
24635  *                     # We only allow 20 levels, so this is inaccessible
24636  *                     use = 0             # <<<<<<<<<<<<<<
24637  *                     break
24638  *                 return i
24639  */
24640           __pyx_v_use = 0;
24641 
24642           /* "yt/utilities/lib/geometry_utils.pyx":928
24643  *                     # We only allow 20 levels, so this is inaccessible
24644  *                     use = 0
24645  *                     break             # <<<<<<<<<<<<<<
24646  *                 return i
24647  *             ii[j] = <np.uint64_t> ((p[j] - DLE[j])/dds[j])
24648  */
24649           goto __pyx_L8_break;
24650 
24651           /* "yt/utilities/lib/geometry_utils.pyx":925
24652  *         for j in range(3):
24653  *             if p[j] < DLE[j] or p[j] > DRE[j]:
24654  *                 if filter == 1:             # <<<<<<<<<<<<<<
24655  *                     # We only allow 20 levels, so this is inaccessible
24656  *                     use = 0
24657  */
24658         }
24659 
24660         /* "yt/utilities/lib/geometry_utils.pyx":929
24661  *                     use = 0
24662  *                     break
24663  *                 return i             # <<<<<<<<<<<<<<
24664  *             ii[j] = <np.uint64_t> ((p[j] - DLE[j])/dds[j])
24665  *             ii[j] = i64clip(ii[j], 0, DD[j] - 1)
24666  */
24667         __pyx_r = __pyx_v_i;
24668         goto __pyx_L0;
24669 
24670         /* "yt/utilities/lib/geometry_utils.pyx":924
24671  *         p[2] = <np.float64_t> pos_z[i]
24672  *         for j in range(3):
24673  *             if p[j] < DLE[j] or p[j] > DRE[j]:             # <<<<<<<<<<<<<<
24674  *                 if filter == 1:
24675  *                     # We only allow 20 levels, so this is inaccessible
24676  */
24677       }
24678 
24679       /* "yt/utilities/lib/geometry_utils.pyx":930
24680  *                     break
24681  *                 return i
24682  *             ii[j] = <np.uint64_t> ((p[j] - DLE[j])/dds[j])             # <<<<<<<<<<<<<<
24683  *             ii[j] = i64clip(ii[j], 0, DD[j] - 1)
24684  *         if use == 0:
24685  */
24686       (__pyx_v_ii[__pyx_v_j]) = ((__pyx_t_5numpy_uint64_t)(((__pyx_v_p[__pyx_v_j]) - (__pyx_v_DLE[__pyx_v_j])) / (__pyx_v_dds[__pyx_v_j])));
24687 
24688       /* "yt/utilities/lib/geometry_utils.pyx":931
24689  *                 return i
24690  *             ii[j] = <np.uint64_t> ((p[j] - DLE[j])/dds[j])
24691  *             ii[j] = i64clip(ii[j], 0, DD[j] - 1)             # <<<<<<<<<<<<<<
24692  *         if use == 0:
24693  *             ind[i] = FLAG
24694  */
24695       (__pyx_v_ii[__pyx_v_j]) = __pyx_f_2yt_9utilities_3lib_8fp_utils_i64clip((__pyx_v_ii[__pyx_v_j]), 0, ((__pyx_v_DD[__pyx_v_j]) - 1));
24696     }
24697     __pyx_L8_break:;
24698 
24699     /* "yt/utilities/lib/geometry_utils.pyx":932
24700  *             ii[j] = <np.uint64_t> ((p[j] - DLE[j])/dds[j])
24701  *             ii[j] = i64clip(ii[j], 0, DD[j] - 1)
24702  *         if use == 0:             # <<<<<<<<<<<<<<
24703  *             ind[i] = FLAG
24704  *             continue
24705  */
24706     __pyx_t_8 = ((__pyx_v_use == 0) != 0);
24707     if (__pyx_t_8) {
24708 
24709       /* "yt/utilities/lib/geometry_utils.pyx":933
24710  *             ii[j] = i64clip(ii[j], 0, DD[j] - 1)
24711  *         if use == 0:
24712  *             ind[i] = FLAG             # <<<<<<<<<<<<<<
24713  *             continue
24714  *         ind[i] = encode_morton_64bit(ii[0],ii[1],ii[2])
24715  */
24716       __pyx_t_7 = __pyx_v_i;
24717       *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_ind.diminfo[0].strides) = __pyx_v_FLAG;
24718 
24719       /* "yt/utilities/lib/geometry_utils.pyx":934
24720  *         if use == 0:
24721  *             ind[i] = FLAG
24722  *             continue             # <<<<<<<<<<<<<<
24723  *         ind[i] = encode_morton_64bit(ii[0],ii[1],ii[2])
24724  *     return pos_x.shape[0]
24725  */
24726       goto __pyx_L5_continue;
24727 
24728       /* "yt/utilities/lib/geometry_utils.pyx":932
24729  *             ii[j] = <np.uint64_t> ((p[j] - DLE[j])/dds[j])
24730  *             ii[j] = i64clip(ii[j], 0, DD[j] - 1)
24731  *         if use == 0:             # <<<<<<<<<<<<<<
24732  *             ind[i] = FLAG
24733  *             continue
24734  */
24735     }
24736 
24737     /* "yt/utilities/lib/geometry_utils.pyx":935
24738  *             ind[i] = FLAG
24739  *             continue
24740  *         ind[i] = encode_morton_64bit(ii[0],ii[1],ii[2])             # <<<<<<<<<<<<<<
24741  *     return pos_x.shape[0]
24742  *
24743  */
24744     __pyx_t_10 = __pyx_v_i;
24745     *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_ind.diminfo[0].strides) = __pyx_f_2yt_9utilities_3lib_14geometry_utils_encode_morton_64bit((__pyx_v_ii[0]), (__pyx_v_ii[1]), (__pyx_v_ii[2]));
24746     __pyx_L5_continue:;
24747   }
24748 
24749   /* "yt/utilities/lib/geometry_utils.pyx":936
24750  *             continue
24751  *         ind[i] = encode_morton_64bit(ii[0],ii[1],ii[2])
24752  *     return pos_x.shape[0]             # <<<<<<<<<<<<<<
24753  *
24754  * def compute_morton(np.ndarray pos_x, np.ndarray pos_y, np.ndarray pos_z,
24755  */
24756   __pyx_r = (__pyx_v_pos_x->dimensions[0]);
24757   goto __pyx_L0;
24758 
24759   /* "yt/utilities/lib/geometry_utils.pyx":903
24760  * @cython.boundscheck(False)
24761  * @cython.wraparound(False)
24762  * cdef np.int64_t position_to_morton(np.ndarray[floating, ndim=1] pos_x,             # <<<<<<<<<<<<<<
24763  *                         np.ndarray[floating, ndim=1] pos_y,
24764  *                         np.ndarray[floating, ndim=1] pos_z,
24765  */
24766 
24767   /* function exit code */
24768   __pyx_L1_error:;
24769   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
24770     __Pyx_PyThreadState_declare
24771     __Pyx_PyThreadState_assign
24772     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
24773     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
24774     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos_x.rcbuffer->pybuffer);
24775     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos_y.rcbuffer->pybuffer);
24776     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos_z.rcbuffer->pybuffer);
24777   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
24778   __Pyx_WriteUnraisable("yt.utilities.lib.geometry_utils.position_to_morton", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
24779   __pyx_r = 0;
24780   goto __pyx_L2;
24781   __pyx_L0:;
24782   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
24783   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos_x.rcbuffer->pybuffer);
24784   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos_y.rcbuffer->pybuffer);
24785   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos_z.rcbuffer->pybuffer);
24786   __pyx_L2:;
24787   __Pyx_RefNannyFinishContext();
24788   return __pyx_r;
24789 }
24790 
__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_14geometry_utils_position_to_morton(PyArrayObject * __pyx_v_pos_x,PyArrayObject * __pyx_v_pos_y,PyArrayObject * __pyx_v_pos_z,__pyx_t_5numpy_float64_t * __pyx_v_dds,__pyx_t_5numpy_float64_t * __pyx_v_DLE,__pyx_t_5numpy_float64_t * __pyx_v_DRE,PyArrayObject * __pyx_v_ind,int __pyx_v_filter)24791 static __pyx_t_5numpy_int64_t __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_14geometry_utils_position_to_morton(PyArrayObject *__pyx_v_pos_x, PyArrayObject *__pyx_v_pos_y, PyArrayObject *__pyx_v_pos_z, __pyx_t_5numpy_float64_t *__pyx_v_dds, __pyx_t_5numpy_float64_t *__pyx_v_DLE, __pyx_t_5numpy_float64_t *__pyx_v_DRE, PyArrayObject *__pyx_v_ind, int __pyx_v_filter) {
24792   __pyx_t_5numpy_uint64_t __pyx_v_ii[3];
24793   __pyx_t_5numpy_float64_t __pyx_v_p[3];
24794   __pyx_t_5numpy_int64_t __pyx_v_i;
24795   __pyx_t_5numpy_int64_t __pyx_v_j;
24796   __pyx_t_5numpy_int64_t __pyx_v_use;
24797   __pyx_t_5numpy_uint64_t __pyx_v_DD[3];
24798   __pyx_t_5numpy_uint64_t __pyx_v_FLAG;
24799   __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
24800   __Pyx_Buffer __pyx_pybuffer_ind;
24801   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos_x;
24802   __Pyx_Buffer __pyx_pybuffer_pos_x;
24803   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos_y;
24804   __Pyx_Buffer __pyx_pybuffer_pos_y;
24805   __Pyx_LocalBuf_ND __pyx_pybuffernd_pos_z;
24806   __Pyx_Buffer __pyx_pybuffer_pos_z;
24807   __pyx_t_5numpy_int64_t __pyx_r;
24808   __Pyx_RefNannyDeclarations
24809   __pyx_t_5numpy_int64_t __pyx_t_1;
24810   npy_intp __pyx_t_2;
24811   npy_intp __pyx_t_3;
24812   __pyx_t_5numpy_int64_t __pyx_t_4;
24813   __pyx_t_5numpy_int64_t __pyx_t_5;
24814   __pyx_t_5numpy_int64_t __pyx_t_6;
24815   __pyx_t_5numpy_int64_t __pyx_t_7;
24816   int __pyx_t_8;
24817   int __pyx_t_9;
24818   __pyx_t_5numpy_int64_t __pyx_t_10;
24819   __Pyx_RefNannySetupContext("__pyx_fuse_1position_to_morton", 0);
24820   __pyx_pybuffer_pos_x.pybuffer.buf = NULL;
24821   __pyx_pybuffer_pos_x.refcount = 0;
24822   __pyx_pybuffernd_pos_x.data = NULL;
24823   __pyx_pybuffernd_pos_x.rcbuffer = &__pyx_pybuffer_pos_x;
24824   __pyx_pybuffer_pos_y.pybuffer.buf = NULL;
24825   __pyx_pybuffer_pos_y.refcount = 0;
24826   __pyx_pybuffernd_pos_y.data = NULL;
24827   __pyx_pybuffernd_pos_y.rcbuffer = &__pyx_pybuffer_pos_y;
24828   __pyx_pybuffer_pos_z.pybuffer.buf = NULL;
24829   __pyx_pybuffer_pos_z.refcount = 0;
24830   __pyx_pybuffernd_pos_z.data = NULL;
24831   __pyx_pybuffernd_pos_z.rcbuffer = &__pyx_pybuffer_pos_z;
24832   __pyx_pybuffer_ind.pybuffer.buf = NULL;
24833   __pyx_pybuffer_ind.refcount = 0;
24834   __pyx_pybuffernd_ind.data = NULL;
24835   __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;
24836   {
24837     __Pyx_BufFmt_StackElem __pyx_stack[1];
24838     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos_x, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 903, __pyx_L1_error)
24839   }
24840   __pyx_pybuffernd_pos_x.diminfo[0].strides = __pyx_pybuffernd_pos_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos_x.diminfo[0].shape = __pyx_pybuffernd_pos_x.rcbuffer->pybuffer.shape[0];
24841   {
24842     __Pyx_BufFmt_StackElem __pyx_stack[1];
24843     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos_y, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 903, __pyx_L1_error)
24844   }
24845   __pyx_pybuffernd_pos_y.diminfo[0].strides = __pyx_pybuffernd_pos_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos_y.diminfo[0].shape = __pyx_pybuffernd_pos_y.rcbuffer->pybuffer.shape[0];
24846   {
24847     __Pyx_BufFmt_StackElem __pyx_stack[1];
24848     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pos_z.rcbuffer->pybuffer, (PyObject*)__pyx_v_pos_z, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 903, __pyx_L1_error)
24849   }
24850   __pyx_pybuffernd_pos_z.diminfo[0].strides = __pyx_pybuffernd_pos_z.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pos_z.diminfo[0].shape = __pyx_pybuffernd_pos_z.rcbuffer->pybuffer.shape[0];
24851   {
24852     __Pyx_BufFmt_StackElem __pyx_stack[1];
24853     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 903, __pyx_L1_error)
24854   }
24855   __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
24856 
24857   /* "yt/utilities/lib/geometry_utils.pyx":915
24858  *     cdef np.int64_t i, j, use
24859  *     cdef np.uint64_t DD[3]
24860  *     cdef np.uint64_t FLAG = ~(<np.uint64_t>0)             # <<<<<<<<<<<<<<
24861  *     for i in range(3):
24862  *         DD[i] = <np.uint64_t> ((DRE[i] - DLE[i]) / dds[i])
24863  */
24864   __pyx_v_FLAG = (~((__pyx_t_5numpy_uint64_t)0));
24865 
24866   /* "yt/utilities/lib/geometry_utils.pyx":916
24867  *     cdef np.uint64_t DD[3]
24868  *     cdef np.uint64_t FLAG = ~(<np.uint64_t>0)
24869  *     for i in range(3):             # <<<<<<<<<<<<<<
24870  *         DD[i] = <np.uint64_t> ((DRE[i] - DLE[i]) / dds[i])
24871  *     for i in range(pos_x.shape[0]):
24872  */
24873   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
24874     __pyx_v_i = __pyx_t_1;
24875 
24876     /* "yt/utilities/lib/geometry_utils.pyx":917
24877  *     cdef np.uint64_t FLAG = ~(<np.uint64_t>0)
24878  *     for i in range(3):
24879  *         DD[i] = <np.uint64_t> ((DRE[i] - DLE[i]) / dds[i])             # <<<<<<<<<<<<<<
24880  *     for i in range(pos_x.shape[0]):
24881  *         use = 1
24882  */
24883     (__pyx_v_DD[__pyx_v_i]) = ((__pyx_t_5numpy_uint64_t)(((__pyx_v_DRE[__pyx_v_i]) - (__pyx_v_DLE[__pyx_v_i])) / (__pyx_v_dds[__pyx_v_i])));
24884   }
24885 
24886   /* "yt/utilities/lib/geometry_utils.pyx":918
24887  *     for i in range(3):
24888  *         DD[i] = <np.uint64_t> ((DRE[i] - DLE[i]) / dds[i])
24889  *     for i in range(pos_x.shape[0]):             # <<<<<<<<<<<<<<
24890  *         use = 1
24891  *         p[0] = <np.float64_t> pos_x[i]
24892  */
24893   __pyx_t_2 = (__pyx_v_pos_x->dimensions[0]);
24894   __pyx_t_3 = __pyx_t_2;
24895   for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_3; __pyx_t_1+=1) {
24896     __pyx_v_i = __pyx_t_1;
24897 
24898     /* "yt/utilities/lib/geometry_utils.pyx":919
24899  *         DD[i] = <np.uint64_t> ((DRE[i] - DLE[i]) / dds[i])
24900  *     for i in range(pos_x.shape[0]):
24901  *         use = 1             # <<<<<<<<<<<<<<
24902  *         p[0] = <np.float64_t> pos_x[i]
24903  *         p[1] = <np.float64_t> pos_y[i]
24904  */
24905     __pyx_v_use = 1;
24906 
24907     /* "yt/utilities/lib/geometry_utils.pyx":920
24908  *     for i in range(pos_x.shape[0]):
24909  *         use = 1
24910  *         p[0] = <np.float64_t> pos_x[i]             # <<<<<<<<<<<<<<
24911  *         p[1] = <np.float64_t> pos_y[i]
24912  *         p[2] = <np.float64_t> pos_z[i]
24913  */
24914     __pyx_t_4 = __pyx_v_i;
24915     (__pyx_v_p[0]) = ((__pyx_t_5numpy_float64_t)(*__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_pos_x.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_pos_x.diminfo[0].strides)));
24916 
24917     /* "yt/utilities/lib/geometry_utils.pyx":921
24918  *         use = 1
24919  *         p[0] = <np.float64_t> pos_x[i]
24920  *         p[1] = <np.float64_t> pos_y[i]             # <<<<<<<<<<<<<<
24921  *         p[2] = <np.float64_t> pos_z[i]
24922  *         for j in range(3):
24923  */
24924     __pyx_t_5 = __pyx_v_i;
24925     (__pyx_v_p[1]) = ((__pyx_t_5numpy_float64_t)(*__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_pos_y.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_pos_y.diminfo[0].strides)));
24926 
24927     /* "yt/utilities/lib/geometry_utils.pyx":922
24928  *         p[0] = <np.float64_t> pos_x[i]
24929  *         p[1] = <np.float64_t> pos_y[i]
24930  *         p[2] = <np.float64_t> pos_z[i]             # <<<<<<<<<<<<<<
24931  *         for j in range(3):
24932  *             if p[j] < DLE[j] or p[j] > DRE[j]:
24933  */
24934     __pyx_t_6 = __pyx_v_i;
24935     (__pyx_v_p[2]) = ((__pyx_t_5numpy_float64_t)(*__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_pos_z.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_pos_z.diminfo[0].strides)));
24936 
24937     /* "yt/utilities/lib/geometry_utils.pyx":923
24938  *         p[1] = <np.float64_t> pos_y[i]
24939  *         p[2] = <np.float64_t> pos_z[i]
24940  *         for j in range(3):             # <<<<<<<<<<<<<<
24941  *             if p[j] < DLE[j] or p[j] > DRE[j]:
24942  *                 if filter == 1:
24943  */
24944     for (__pyx_t_7 = 0; __pyx_t_7 < 3; __pyx_t_7+=1) {
24945       __pyx_v_j = __pyx_t_7;
24946 
24947       /* "yt/utilities/lib/geometry_utils.pyx":924
24948  *         p[2] = <np.float64_t> pos_z[i]
24949  *         for j in range(3):
24950  *             if p[j] < DLE[j] or p[j] > DRE[j]:             # <<<<<<<<<<<<<<
24951  *                 if filter == 1:
24952  *                     # We only allow 20 levels, so this is inaccessible
24953  */
24954       __pyx_t_9 = (((__pyx_v_p[__pyx_v_j]) < (__pyx_v_DLE[__pyx_v_j])) != 0);
24955       if (!__pyx_t_9) {
24956       } else {
24957         __pyx_t_8 = __pyx_t_9;
24958         goto __pyx_L10_bool_binop_done;
24959       }
24960       __pyx_t_9 = (((__pyx_v_p[__pyx_v_j]) > (__pyx_v_DRE[__pyx_v_j])) != 0);
24961       __pyx_t_8 = __pyx_t_9;
24962       __pyx_L10_bool_binop_done:;
24963       if (__pyx_t_8) {
24964 
24965         /* "yt/utilities/lib/geometry_utils.pyx":925
24966  *         for j in range(3):
24967  *             if p[j] < DLE[j] or p[j] > DRE[j]:
24968  *                 if filter == 1:             # <<<<<<<<<<<<<<
24969  *                     # We only allow 20 levels, so this is inaccessible
24970  *                     use = 0
24971  */
24972         __pyx_t_8 = ((__pyx_v_filter == 1) != 0);
24973         if (__pyx_t_8) {
24974 
24975           /* "yt/utilities/lib/geometry_utils.pyx":927
24976  *                 if filter == 1:
24977  *                     # We only allow 20 levels, so this is inaccessible
24978  *                     use = 0             # <<<<<<<<<<<<<<
24979  *                     break
24980  *                 return i
24981  */
24982           __pyx_v_use = 0;
24983 
24984           /* "yt/utilities/lib/geometry_utils.pyx":928
24985  *                     # We only allow 20 levels, so this is inaccessible
24986  *                     use = 0
24987  *                     break             # <<<<<<<<<<<<<<
24988  *                 return i
24989  *             ii[j] = <np.uint64_t> ((p[j] - DLE[j])/dds[j])
24990  */
24991           goto __pyx_L8_break;
24992 
24993           /* "yt/utilities/lib/geometry_utils.pyx":925
24994  *         for j in range(3):
24995  *             if p[j] < DLE[j] or p[j] > DRE[j]:
24996  *                 if filter == 1:             # <<<<<<<<<<<<<<
24997  *                     # We only allow 20 levels, so this is inaccessible
24998  *                     use = 0
24999  */
25000         }
25001 
25002         /* "yt/utilities/lib/geometry_utils.pyx":929
25003  *                     use = 0
25004  *                     break
25005  *                 return i             # <<<<<<<<<<<<<<
25006  *             ii[j] = <np.uint64_t> ((p[j] - DLE[j])/dds[j])
25007  *             ii[j] = i64clip(ii[j], 0, DD[j] - 1)
25008  */
25009         __pyx_r = __pyx_v_i;
25010         goto __pyx_L0;
25011 
25012         /* "yt/utilities/lib/geometry_utils.pyx":924
25013  *         p[2] = <np.float64_t> pos_z[i]
25014  *         for j in range(3):
25015  *             if p[j] < DLE[j] or p[j] > DRE[j]:             # <<<<<<<<<<<<<<
25016  *                 if filter == 1:
25017  *                     # We only allow 20 levels, so this is inaccessible
25018  */
25019       }
25020 
25021       /* "yt/utilities/lib/geometry_utils.pyx":930
25022  *                     break
25023  *                 return i
25024  *             ii[j] = <np.uint64_t> ((p[j] - DLE[j])/dds[j])             # <<<<<<<<<<<<<<
25025  *             ii[j] = i64clip(ii[j], 0, DD[j] - 1)
25026  *         if use == 0:
25027  */
25028       (__pyx_v_ii[__pyx_v_j]) = ((__pyx_t_5numpy_uint64_t)(((__pyx_v_p[__pyx_v_j]) - (__pyx_v_DLE[__pyx_v_j])) / (__pyx_v_dds[__pyx_v_j])));
25029 
25030       /* "yt/utilities/lib/geometry_utils.pyx":931
25031  *                 return i
25032  *             ii[j] = <np.uint64_t> ((p[j] - DLE[j])/dds[j])
25033  *             ii[j] = i64clip(ii[j], 0, DD[j] - 1)             # <<<<<<<<<<<<<<
25034  *         if use == 0:
25035  *             ind[i] = FLAG
25036  */
25037       (__pyx_v_ii[__pyx_v_j]) = __pyx_f_2yt_9utilities_3lib_8fp_utils_i64clip((__pyx_v_ii[__pyx_v_j]), 0, ((__pyx_v_DD[__pyx_v_j]) - 1));
25038     }
25039     __pyx_L8_break:;
25040 
25041     /* "yt/utilities/lib/geometry_utils.pyx":932
25042  *             ii[j] = <np.uint64_t> ((p[j] - DLE[j])/dds[j])
25043  *             ii[j] = i64clip(ii[j], 0, DD[j] - 1)
25044  *         if use == 0:             # <<<<<<<<<<<<<<
25045  *             ind[i] = FLAG
25046  *             continue
25047  */
25048     __pyx_t_8 = ((__pyx_v_use == 0) != 0);
25049     if (__pyx_t_8) {
25050 
25051       /* "yt/utilities/lib/geometry_utils.pyx":933
25052  *             ii[j] = i64clip(ii[j], 0, DD[j] - 1)
25053  *         if use == 0:
25054  *             ind[i] = FLAG             # <<<<<<<<<<<<<<
25055  *             continue
25056  *         ind[i] = encode_morton_64bit(ii[0],ii[1],ii[2])
25057  */
25058       __pyx_t_7 = __pyx_v_i;
25059       *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_ind.diminfo[0].strides) = __pyx_v_FLAG;
25060 
25061       /* "yt/utilities/lib/geometry_utils.pyx":934
25062  *         if use == 0:
25063  *             ind[i] = FLAG
25064  *             continue             # <<<<<<<<<<<<<<
25065  *         ind[i] = encode_morton_64bit(ii[0],ii[1],ii[2])
25066  *     return pos_x.shape[0]
25067  */
25068       goto __pyx_L5_continue;
25069 
25070       /* "yt/utilities/lib/geometry_utils.pyx":932
25071  *             ii[j] = <np.uint64_t> ((p[j] - DLE[j])/dds[j])
25072  *             ii[j] = i64clip(ii[j], 0, DD[j] - 1)
25073  *         if use == 0:             # <<<<<<<<<<<<<<
25074  *             ind[i] = FLAG
25075  *             continue
25076  */
25077     }
25078 
25079     /* "yt/utilities/lib/geometry_utils.pyx":935
25080  *             ind[i] = FLAG
25081  *             continue
25082  *         ind[i] = encode_morton_64bit(ii[0],ii[1],ii[2])             # <<<<<<<<<<<<<<
25083  *     return pos_x.shape[0]
25084  *
25085  */
25086     __pyx_t_10 = __pyx_v_i;
25087     *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_ind.diminfo[0].strides) = __pyx_f_2yt_9utilities_3lib_14geometry_utils_encode_morton_64bit((__pyx_v_ii[0]), (__pyx_v_ii[1]), (__pyx_v_ii[2]));
25088     __pyx_L5_continue:;
25089   }
25090 
25091   /* "yt/utilities/lib/geometry_utils.pyx":936
25092  *             continue
25093  *         ind[i] = encode_morton_64bit(ii[0],ii[1],ii[2])
25094  *     return pos_x.shape[0]             # <<<<<<<<<<<<<<
25095  *
25096  * def compute_morton(np.ndarray pos_x, np.ndarray pos_y, np.ndarray pos_z,
25097  */
25098   __pyx_r = (__pyx_v_pos_x->dimensions[0]);
25099   goto __pyx_L0;
25100 
25101   /* "yt/utilities/lib/geometry_utils.pyx":903
25102  * @cython.boundscheck(False)
25103  * @cython.wraparound(False)
25104  * cdef np.int64_t position_to_morton(np.ndarray[floating, ndim=1] pos_x,             # <<<<<<<<<<<<<<
25105  *                         np.ndarray[floating, ndim=1] pos_y,
25106  *                         np.ndarray[floating, ndim=1] pos_z,
25107  */
25108 
25109   /* function exit code */
25110   __pyx_L1_error:;
25111   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
25112     __Pyx_PyThreadState_declare
25113     __Pyx_PyThreadState_assign
25114     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
25115     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
25116     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos_x.rcbuffer->pybuffer);
25117     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos_y.rcbuffer->pybuffer);
25118     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos_z.rcbuffer->pybuffer);
25119   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
25120   __Pyx_WriteUnraisable("yt.utilities.lib.geometry_utils.position_to_morton", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
25121   __pyx_r = 0;
25122   goto __pyx_L2;
25123   __pyx_L0:;
25124   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
25125   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos_x.rcbuffer->pybuffer);
25126   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos_y.rcbuffer->pybuffer);
25127   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pos_z.rcbuffer->pybuffer);
25128   __pyx_L2:;
25129   __Pyx_RefNannyFinishContext();
25130   return __pyx_r;
25131 }
25132 
25133 /* "yt/utilities/lib/geometry_utils.pyx":938
25134  *     return pos_x.shape[0]
25135  *
25136  * def compute_morton(np.ndarray pos_x, np.ndarray pos_y, np.ndarray pos_z,             # <<<<<<<<<<<<<<
25137  *                    domain_left_edge, domain_right_edge, filter_bbox = False,
25138  *                    order = ORDER_MAX):
25139  */
25140 
25141 /* Python wrapper */
25142 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_59compute_morton(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
25143 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_59compute_morton = {"compute_morton", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_59compute_morton, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_59compute_morton(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)25144 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_59compute_morton(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
25145   PyArrayObject *__pyx_v_pos_x = 0;
25146   PyArrayObject *__pyx_v_pos_y = 0;
25147   PyArrayObject *__pyx_v_pos_z = 0;
25148   PyObject *__pyx_v_domain_left_edge = 0;
25149   PyObject *__pyx_v_domain_right_edge = 0;
25150   PyObject *__pyx_v_filter_bbox = 0;
25151   PyObject *__pyx_v_order = 0;
25152   PyObject *__pyx_r = 0;
25153   __Pyx_RefNannyDeclarations
25154   __Pyx_RefNannySetupContext("compute_morton (wrapper)", 0);
25155   {
25156     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pos_x,&__pyx_n_s_pos_y,&__pyx_n_s_pos_z,&__pyx_n_s_domain_left_edge,&__pyx_n_s_domain_right_edge,&__pyx_n_s_filter_bbox,&__pyx_n_s_order,0};
25157     PyObject* values[7] = {0,0,0,0,0,0,0};
25158 
25159     /* "yt/utilities/lib/geometry_utils.pyx":939
25160  *
25161  * def compute_morton(np.ndarray pos_x, np.ndarray pos_y, np.ndarray pos_z,
25162  *                    domain_left_edge, domain_right_edge, filter_bbox = False,             # <<<<<<<<<<<<<<
25163  *                    order = ORDER_MAX):
25164  *     cdef int i
25165  */
25166     values[5] = ((PyObject *)Py_False);
25167     values[6] = ((PyObject *)__pyx_int_20);
25168     if (unlikely(__pyx_kwds)) {
25169       Py_ssize_t kw_args;
25170       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
25171       switch (pos_args) {
25172         case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
25173         CYTHON_FALLTHROUGH;
25174         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
25175         CYTHON_FALLTHROUGH;
25176         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
25177         CYTHON_FALLTHROUGH;
25178         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
25179         CYTHON_FALLTHROUGH;
25180         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
25181         CYTHON_FALLTHROUGH;
25182         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
25183         CYTHON_FALLTHROUGH;
25184         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
25185         CYTHON_FALLTHROUGH;
25186         case  0: break;
25187         default: goto __pyx_L5_argtuple_error;
25188       }
25189       kw_args = PyDict_Size(__pyx_kwds);
25190       switch (pos_args) {
25191         case  0:
25192         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos_x)) != 0)) kw_args--;
25193         else goto __pyx_L5_argtuple_error;
25194         CYTHON_FALLTHROUGH;
25195         case  1:
25196         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos_y)) != 0)) kw_args--;
25197         else {
25198           __Pyx_RaiseArgtupleInvalid("compute_morton", 0, 5, 7, 1); __PYX_ERR(1, 938, __pyx_L3_error)
25199         }
25200         CYTHON_FALLTHROUGH;
25201         case  2:
25202         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos_z)) != 0)) kw_args--;
25203         else {
25204           __Pyx_RaiseArgtupleInvalid("compute_morton", 0, 5, 7, 2); __PYX_ERR(1, 938, __pyx_L3_error)
25205         }
25206         CYTHON_FALLTHROUGH;
25207         case  3:
25208         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_domain_left_edge)) != 0)) kw_args--;
25209         else {
25210           __Pyx_RaiseArgtupleInvalid("compute_morton", 0, 5, 7, 3); __PYX_ERR(1, 938, __pyx_L3_error)
25211         }
25212         CYTHON_FALLTHROUGH;
25213         case  4:
25214         if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_domain_right_edge)) != 0)) kw_args--;
25215         else {
25216           __Pyx_RaiseArgtupleInvalid("compute_morton", 0, 5, 7, 4); __PYX_ERR(1, 938, __pyx_L3_error)
25217         }
25218         CYTHON_FALLTHROUGH;
25219         case  5:
25220         if (kw_args > 0) {
25221           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filter_bbox);
25222           if (value) { values[5] = value; kw_args--; }
25223         }
25224         CYTHON_FALLTHROUGH;
25225         case  6:
25226         if (kw_args > 0) {
25227           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_order);
25228           if (value) { values[6] = value; kw_args--; }
25229         }
25230       }
25231       if (unlikely(kw_args > 0)) {
25232         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compute_morton") < 0)) __PYX_ERR(1, 938, __pyx_L3_error)
25233       }
25234     } else {
25235       switch (PyTuple_GET_SIZE(__pyx_args)) {
25236         case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
25237         CYTHON_FALLTHROUGH;
25238         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
25239         CYTHON_FALLTHROUGH;
25240         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
25241         values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
25242         values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
25243         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
25244         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
25245         break;
25246         default: goto __pyx_L5_argtuple_error;
25247       }
25248     }
25249     __pyx_v_pos_x = ((PyArrayObject *)values[0]);
25250     __pyx_v_pos_y = ((PyArrayObject *)values[1]);
25251     __pyx_v_pos_z = ((PyArrayObject *)values[2]);
25252     __pyx_v_domain_left_edge = values[3];
25253     __pyx_v_domain_right_edge = values[4];
25254     __pyx_v_filter_bbox = values[5];
25255     __pyx_v_order = values[6];
25256   }
25257   goto __pyx_L4_argument_unpacking_done;
25258   __pyx_L5_argtuple_error:;
25259   __Pyx_RaiseArgtupleInvalid("compute_morton", 0, 5, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 938, __pyx_L3_error)
25260   __pyx_L3_error:;
25261   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.compute_morton", __pyx_clineno, __pyx_lineno, __pyx_filename);
25262   __Pyx_RefNannyFinishContext();
25263   return NULL;
25264   __pyx_L4_argument_unpacking_done:;
25265   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos_x), __pyx_ptype_5numpy_ndarray, 1, "pos_x", 0))) __PYX_ERR(1, 938, __pyx_L1_error)
25266   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos_y), __pyx_ptype_5numpy_ndarray, 1, "pos_y", 0))) __PYX_ERR(1, 938, __pyx_L1_error)
25267   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos_z), __pyx_ptype_5numpy_ndarray, 1, "pos_z", 0))) __PYX_ERR(1, 938, __pyx_L1_error)
25268   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_58compute_morton(__pyx_self, __pyx_v_pos_x, __pyx_v_pos_y, __pyx_v_pos_z, __pyx_v_domain_left_edge, __pyx_v_domain_right_edge, __pyx_v_filter_bbox, __pyx_v_order);
25269 
25270   /* "yt/utilities/lib/geometry_utils.pyx":938
25271  *     return pos_x.shape[0]
25272  *
25273  * def compute_morton(np.ndarray pos_x, np.ndarray pos_y, np.ndarray pos_z,             # <<<<<<<<<<<<<<
25274  *                    domain_left_edge, domain_right_edge, filter_bbox = False,
25275  *                    order = ORDER_MAX):
25276  */
25277 
25278   /* function exit code */
25279   goto __pyx_L0;
25280   __pyx_L1_error:;
25281   __pyx_r = NULL;
25282   __pyx_L0:;
25283   __Pyx_RefNannyFinishContext();
25284   return __pyx_r;
25285 }
25286 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_58compute_morton(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_pos_x,PyArrayObject * __pyx_v_pos_y,PyArrayObject * __pyx_v_pos_z,PyObject * __pyx_v_domain_left_edge,PyObject * __pyx_v_domain_right_edge,PyObject * __pyx_v_filter_bbox,PyObject * __pyx_v_order)25287 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_58compute_morton(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_pos_x, PyArrayObject *__pyx_v_pos_y, PyArrayObject *__pyx_v_pos_z, PyObject *__pyx_v_domain_left_edge, PyObject *__pyx_v_domain_right_edge, PyObject *__pyx_v_filter_bbox, PyObject *__pyx_v_order) {
25288   int __pyx_v_i;
25289   int __pyx_v_filter;
25290   __pyx_t_5numpy_float64_t __pyx_v_dds[3];
25291   __pyx_t_5numpy_float64_t __pyx_v_DLE[3];
25292   __pyx_t_5numpy_float64_t __pyx_v_DRE[3];
25293   PyArrayObject *__pyx_v_ind = 0;
25294   __pyx_t_5numpy_int64_t __pyx_v_rv;
25295   PyObject *__pyx_v_mis = NULL;
25296   PyObject *__pyx_v_mas = NULL;
25297   __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
25298   __Pyx_Buffer __pyx_pybuffer_ind;
25299   PyObject *__pyx_r = NULL;
25300   __Pyx_RefNannyDeclarations
25301   int __pyx_t_1;
25302   int __pyx_t_2;
25303   PyObject *__pyx_t_3 = NULL;
25304   __pyx_t_5numpy_float64_t __pyx_t_4;
25305   PyObject *__pyx_t_5 = NULL;
25306   PyObject *__pyx_t_6 = NULL;
25307   PyObject *__pyx_t_7 = NULL;
25308   PyArrayObject *__pyx_t_8 = NULL;
25309   PyObject *__pyx_t_9 = NULL;
25310   PyObject *__pyx_t_10 = NULL;
25311   PyObject *__pyx_t_11 = NULL;
25312   PyObject *__pyx_t_12 = NULL;
25313   __Pyx_RefNannySetupContext("compute_morton", 0);
25314   __pyx_pybuffer_ind.pybuffer.buf = NULL;
25315   __pyx_pybuffer_ind.refcount = 0;
25316   __pyx_pybuffernd_ind.data = NULL;
25317   __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;
25318 
25319   /* "yt/utilities/lib/geometry_utils.pyx":943
25320  *     cdef int i
25321  *     cdef int filter
25322  *     if filter_bbox:             # <<<<<<<<<<<<<<
25323  *         filter = 1
25324  *     else:
25325  */
25326   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_filter_bbox); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 943, __pyx_L1_error)
25327   if (__pyx_t_1) {
25328 
25329     /* "yt/utilities/lib/geometry_utils.pyx":944
25330  *     cdef int filter
25331  *     if filter_bbox:
25332  *         filter = 1             # <<<<<<<<<<<<<<
25333  *     else:
25334  *         filter = 0
25335  */
25336     __pyx_v_filter = 1;
25337 
25338     /* "yt/utilities/lib/geometry_utils.pyx":943
25339  *     cdef int i
25340  *     cdef int filter
25341  *     if filter_bbox:             # <<<<<<<<<<<<<<
25342  *         filter = 1
25343  *     else:
25344  */
25345     goto __pyx_L3;
25346   }
25347 
25348   /* "yt/utilities/lib/geometry_utils.pyx":946
25349  *         filter = 1
25350  *     else:
25351  *         filter = 0             # <<<<<<<<<<<<<<
25352  *     cdef np.float64_t dds[3]
25353  *     cdef np.float64_t DLE[3]
25354  */
25355   /*else*/ {
25356     __pyx_v_filter = 0;
25357   }
25358   __pyx_L3:;
25359 
25360   /* "yt/utilities/lib/geometry_utils.pyx":950
25361  *     cdef np.float64_t DLE[3]
25362  *     cdef np.float64_t DRE[3]
25363  *     for i in range(3):             # <<<<<<<<<<<<<<
25364  *         DLE[i] = domain_left_edge[i]
25365  *         DRE[i] = domain_right_edge[i]
25366  */
25367   for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) {
25368     __pyx_v_i = __pyx_t_2;
25369 
25370     /* "yt/utilities/lib/geometry_utils.pyx":951
25371  *     cdef np.float64_t DRE[3]
25372  *     for i in range(3):
25373  *         DLE[i] = domain_left_edge[i]             # <<<<<<<<<<<<<<
25374  *         DRE[i] = domain_right_edge[i]
25375  *         dds[i] = (DRE[i] - DLE[i]) / (1 << order)
25376  */
25377     __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_domain_left_edge, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 951, __pyx_L1_error)
25378     __Pyx_GOTREF(__pyx_t_3);
25379     __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 951, __pyx_L1_error)
25380     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25381     (__pyx_v_DLE[__pyx_v_i]) = __pyx_t_4;
25382 
25383     /* "yt/utilities/lib/geometry_utils.pyx":952
25384  *     for i in range(3):
25385  *         DLE[i] = domain_left_edge[i]
25386  *         DRE[i] = domain_right_edge[i]             # <<<<<<<<<<<<<<
25387  *         dds[i] = (DRE[i] - DLE[i]) / (1 << order)
25388  *     cdef np.ndarray[np.uint64_t, ndim=1] ind
25389  */
25390     __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_domain_right_edge, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 952, __pyx_L1_error)
25391     __Pyx_GOTREF(__pyx_t_3);
25392     __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 952, __pyx_L1_error)
25393     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25394     (__pyx_v_DRE[__pyx_v_i]) = __pyx_t_4;
25395 
25396     /* "yt/utilities/lib/geometry_utils.pyx":953
25397  *         DLE[i] = domain_left_edge[i]
25398  *         DRE[i] = domain_right_edge[i]
25399  *         dds[i] = (DRE[i] - DLE[i]) / (1 << order)             # <<<<<<<<<<<<<<
25400  *     cdef np.ndarray[np.uint64_t, ndim=1] ind
25401  *     ind = np.zeros(pos_x.shape[0], dtype="uint64")
25402  */
25403     __pyx_t_3 = PyFloat_FromDouble(((__pyx_v_DRE[__pyx_v_i]) - (__pyx_v_DLE[__pyx_v_i]))); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 953, __pyx_L1_error)
25404     __Pyx_GOTREF(__pyx_t_3);
25405     __pyx_t_5 = PyNumber_Lshift(__pyx_int_1, __pyx_v_order); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 953, __pyx_L1_error)
25406     __Pyx_GOTREF(__pyx_t_5);
25407     __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 953, __pyx_L1_error)
25408     __Pyx_GOTREF(__pyx_t_6);
25409     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25410     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
25411     __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_4 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 953, __pyx_L1_error)
25412     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
25413     (__pyx_v_dds[__pyx_v_i]) = __pyx_t_4;
25414   }
25415 
25416   /* "yt/utilities/lib/geometry_utils.pyx":955
25417  *         dds[i] = (DRE[i] - DLE[i]) / (1 << order)
25418  *     cdef np.ndarray[np.uint64_t, ndim=1] ind
25419  *     ind = np.zeros(pos_x.shape[0], dtype="uint64")             # <<<<<<<<<<<<<<
25420  *     cdef np.int64_t rv
25421  *     if pos_x.dtype == np.float32:
25422  */
25423   __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 955, __pyx_L1_error)
25424   __Pyx_GOTREF(__pyx_t_6);
25425   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 955, __pyx_L1_error)
25426   __Pyx_GOTREF(__pyx_t_5);
25427   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
25428   __pyx_t_6 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_pos_x->dimensions[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 955, __pyx_L1_error)
25429   __Pyx_GOTREF(__pyx_t_6);
25430   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 955, __pyx_L1_error)
25431   __Pyx_GOTREF(__pyx_t_3);
25432   __Pyx_GIVEREF(__pyx_t_6);
25433   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
25434   __pyx_t_6 = 0;
25435   __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 955, __pyx_L1_error)
25436   __Pyx_GOTREF(__pyx_t_6);
25437   if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_n_s_uint64) < 0) __PYX_ERR(1, 955, __pyx_L1_error)
25438   __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 955, __pyx_L1_error)
25439   __Pyx_GOTREF(__pyx_t_7);
25440   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
25441   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25442   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
25443   if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 955, __pyx_L1_error)
25444   __pyx_t_8 = ((PyArrayObject *)__pyx_t_7);
25445   {
25446     __Pyx_BufFmt_StackElem __pyx_stack[1];
25447     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
25448     __pyx_t_2 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
25449     if (unlikely(__pyx_t_2 < 0)) {
25450       PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
25451       if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
25452         Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11);
25453         __Pyx_RaiseBufferFallbackError();
25454       } else {
25455         PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11);
25456       }
25457       __pyx_t_9 = __pyx_t_10 = __pyx_t_11 = 0;
25458     }
25459     __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
25460     if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 955, __pyx_L1_error)
25461   }
25462   __pyx_t_8 = 0;
25463   __pyx_v_ind = ((PyArrayObject *)__pyx_t_7);
25464   __pyx_t_7 = 0;
25465 
25466   /* "yt/utilities/lib/geometry_utils.pyx":957
25467  *     ind = np.zeros(pos_x.shape[0], dtype="uint64")
25468  *     cdef np.int64_t rv
25469  *     if pos_x.dtype == np.float32:             # <<<<<<<<<<<<<<
25470  *         rv = position_to_morton[np.float32_t](
25471  *                 pos_x, pos_y, pos_z, dds, DLE, DRE, ind,
25472  */
25473   __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos_x), __pyx_n_s_dtype); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 957, __pyx_L1_error)
25474   __Pyx_GOTREF(__pyx_t_7);
25475   __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 957, __pyx_L1_error)
25476   __Pyx_GOTREF(__pyx_t_6);
25477   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_float32); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 957, __pyx_L1_error)
25478   __Pyx_GOTREF(__pyx_t_3);
25479   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
25480   __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 957, __pyx_L1_error)
25481   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
25482   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25483   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 957, __pyx_L1_error)
25484   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
25485   if (__pyx_t_1) {
25486 
25487     /* "yt/utilities/lib/geometry_utils.pyx":958
25488  *     cdef np.int64_t rv
25489  *     if pos_x.dtype == np.float32:
25490  *         rv = position_to_morton[np.float32_t](             # <<<<<<<<<<<<<<
25491  *                 pos_x, pos_y, pos_z, dds, DLE, DRE, ind,
25492  *                 filter)
25493  */
25494     __pyx_v_rv = __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_14geometry_utils_position_to_morton(((PyArrayObject *)__pyx_v_pos_x), ((PyArrayObject *)__pyx_v_pos_y), ((PyArrayObject *)__pyx_v_pos_z), __pyx_v_dds, __pyx_v_DLE, __pyx_v_DRE, ((PyArrayObject *)__pyx_v_ind), __pyx_v_filter);
25495 
25496     /* "yt/utilities/lib/geometry_utils.pyx":957
25497  *     ind = np.zeros(pos_x.shape[0], dtype="uint64")
25498  *     cdef np.int64_t rv
25499  *     if pos_x.dtype == np.float32:             # <<<<<<<<<<<<<<
25500  *         rv = position_to_morton[np.float32_t](
25501  *                 pos_x, pos_y, pos_z, dds, DLE, DRE, ind,
25502  */
25503     goto __pyx_L6;
25504   }
25505 
25506   /* "yt/utilities/lib/geometry_utils.pyx":961
25507  *                 pos_x, pos_y, pos_z, dds, DLE, DRE, ind,
25508  *                 filter)
25509  *     elif pos_x.dtype == np.float64:             # <<<<<<<<<<<<<<
25510  *         rv = position_to_morton[np.float64_t](
25511  *                 pos_x, pos_y, pos_z, dds, DLE, DRE, ind,
25512  */
25513   __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos_x), __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 961, __pyx_L1_error)
25514   __Pyx_GOTREF(__pyx_t_6);
25515   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 961, __pyx_L1_error)
25516   __Pyx_GOTREF(__pyx_t_3);
25517   __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 961, __pyx_L1_error)
25518   __Pyx_GOTREF(__pyx_t_7);
25519   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25520   __pyx_t_3 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 961, __pyx_L1_error)
25521   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
25522   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
25523   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 961, __pyx_L1_error)
25524   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25525   if (__pyx_t_1) {
25526 
25527     /* "yt/utilities/lib/geometry_utils.pyx":962
25528  *                 filter)
25529  *     elif pos_x.dtype == np.float64:
25530  *         rv = position_to_morton[np.float64_t](             # <<<<<<<<<<<<<<
25531  *                 pos_x, pos_y, pos_z, dds, DLE, DRE, ind,
25532  *                 filter)
25533  */
25534     __pyx_v_rv = __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_14geometry_utils_position_to_morton(((PyArrayObject *)__pyx_v_pos_x), ((PyArrayObject *)__pyx_v_pos_y), ((PyArrayObject *)__pyx_v_pos_z), __pyx_v_dds, __pyx_v_DLE, __pyx_v_DRE, ((PyArrayObject *)__pyx_v_ind), __pyx_v_filter);
25535 
25536     /* "yt/utilities/lib/geometry_utils.pyx":961
25537  *                 pos_x, pos_y, pos_z, dds, DLE, DRE, ind,
25538  *                 filter)
25539  *     elif pos_x.dtype == np.float64:             # <<<<<<<<<<<<<<
25540  *         rv = position_to_morton[np.float64_t](
25541  *                 pos_x, pos_y, pos_z, dds, DLE, DRE, ind,
25542  */
25543     goto __pyx_L6;
25544   }
25545 
25546   /* "yt/utilities/lib/geometry_utils.pyx":966
25547  *                 filter)
25548  *     else:
25549  *         print("Could not identify dtype.", pos_x.dtype)             # <<<<<<<<<<<<<<
25550  *         raise NotImplementedError
25551  *     if rv < pos_x.shape[0]:
25552  */
25553   /*else*/ {
25554     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos_x), __pyx_n_s_dtype); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 966, __pyx_L1_error)
25555     __Pyx_GOTREF(__pyx_t_3);
25556     __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 966, __pyx_L1_error)
25557     __Pyx_GOTREF(__pyx_t_7);
25558     __Pyx_INCREF(__pyx_kp_s_Could_not_identify_dtype);
25559     __Pyx_GIVEREF(__pyx_kp_s_Could_not_identify_dtype);
25560     PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_s_Could_not_identify_dtype);
25561     __Pyx_GIVEREF(__pyx_t_3);
25562     PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_3);
25563     __pyx_t_3 = 0;
25564     if (__Pyx_PrintOne(0, __pyx_t_7) < 0) __PYX_ERR(1, 966, __pyx_L1_error)
25565     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
25566 
25567     /* "yt/utilities/lib/geometry_utils.pyx":967
25568  *     else:
25569  *         print("Could not identify dtype.", pos_x.dtype)
25570  *         raise NotImplementedError             # <<<<<<<<<<<<<<
25571  *     if rv < pos_x.shape[0]:
25572  *         mis = (pos_x.min(), pos_y.min(), pos_z.min())
25573  */
25574     __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
25575     __PYX_ERR(1, 967, __pyx_L1_error)
25576   }
25577   __pyx_L6:;
25578 
25579   /* "yt/utilities/lib/geometry_utils.pyx":968
25580  *         print("Could not identify dtype.", pos_x.dtype)
25581  *         raise NotImplementedError
25582  *     if rv < pos_x.shape[0]:             # <<<<<<<<<<<<<<
25583  *         mis = (pos_x.min(), pos_y.min(), pos_z.min())
25584  *         mas = (pos_x.max(), pos_y.max(), pos_z.max())
25585  */
25586   __pyx_t_1 = ((__pyx_v_rv < (__pyx_v_pos_x->dimensions[0])) != 0);
25587   if (unlikely(__pyx_t_1)) {
25588 
25589     /* "yt/utilities/lib/geometry_utils.pyx":969
25590  *         raise NotImplementedError
25591  *     if rv < pos_x.shape[0]:
25592  *         mis = (pos_x.min(), pos_y.min(), pos_z.min())             # <<<<<<<<<<<<<<
25593  *         mas = (pos_x.max(), pos_y.max(), pos_z.max())
25594  *         raise YTDomainOverflow(mis, mas,
25595  */
25596     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos_x), __pyx_n_s_min); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 969, __pyx_L1_error)
25597     __Pyx_GOTREF(__pyx_t_3);
25598     __pyx_t_6 = NULL;
25599     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
25600       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
25601       if (likely(__pyx_t_6)) {
25602         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
25603         __Pyx_INCREF(__pyx_t_6);
25604         __Pyx_INCREF(function);
25605         __Pyx_DECREF_SET(__pyx_t_3, function);
25606       }
25607     }
25608     __pyx_t_7 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
25609     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
25610     if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 969, __pyx_L1_error)
25611     __Pyx_GOTREF(__pyx_t_7);
25612     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25613     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos_y), __pyx_n_s_min); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 969, __pyx_L1_error)
25614     __Pyx_GOTREF(__pyx_t_6);
25615     __pyx_t_5 = NULL;
25616     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
25617       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
25618       if (likely(__pyx_t_5)) {
25619         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
25620         __Pyx_INCREF(__pyx_t_5);
25621         __Pyx_INCREF(function);
25622         __Pyx_DECREF_SET(__pyx_t_6, function);
25623       }
25624     }
25625     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
25626     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
25627     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 969, __pyx_L1_error)
25628     __Pyx_GOTREF(__pyx_t_3);
25629     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
25630     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos_z), __pyx_n_s_min); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 969, __pyx_L1_error)
25631     __Pyx_GOTREF(__pyx_t_5);
25632     __pyx_t_12 = NULL;
25633     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
25634       __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_5);
25635       if (likely(__pyx_t_12)) {
25636         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
25637         __Pyx_INCREF(__pyx_t_12);
25638         __Pyx_INCREF(function);
25639         __Pyx_DECREF_SET(__pyx_t_5, function);
25640       }
25641     }
25642     __pyx_t_6 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
25643     __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
25644     if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 969, __pyx_L1_error)
25645     __Pyx_GOTREF(__pyx_t_6);
25646     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
25647     __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 969, __pyx_L1_error)
25648     __Pyx_GOTREF(__pyx_t_5);
25649     __Pyx_GIVEREF(__pyx_t_7);
25650     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7);
25651     __Pyx_GIVEREF(__pyx_t_3);
25652     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
25653     __Pyx_GIVEREF(__pyx_t_6);
25654     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_6);
25655     __pyx_t_7 = 0;
25656     __pyx_t_3 = 0;
25657     __pyx_t_6 = 0;
25658     __pyx_v_mis = ((PyObject*)__pyx_t_5);
25659     __pyx_t_5 = 0;
25660 
25661     /* "yt/utilities/lib/geometry_utils.pyx":970
25662  *     if rv < pos_x.shape[0]:
25663  *         mis = (pos_x.min(), pos_y.min(), pos_z.min())
25664  *         mas = (pos_x.max(), pos_y.max(), pos_z.max())             # <<<<<<<<<<<<<<
25665  *         raise YTDomainOverflow(mis, mas,
25666  *                                domain_left_edge, domain_right_edge)
25667  */
25668     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos_x), __pyx_n_s_max); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 970, __pyx_L1_error)
25669     __Pyx_GOTREF(__pyx_t_6);
25670     __pyx_t_3 = NULL;
25671     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
25672       __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
25673       if (likely(__pyx_t_3)) {
25674         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
25675         __Pyx_INCREF(__pyx_t_3);
25676         __Pyx_INCREF(function);
25677         __Pyx_DECREF_SET(__pyx_t_6, function);
25678       }
25679     }
25680     __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
25681     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
25682     if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 970, __pyx_L1_error)
25683     __Pyx_GOTREF(__pyx_t_5);
25684     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
25685     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos_y), __pyx_n_s_max); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 970, __pyx_L1_error)
25686     __Pyx_GOTREF(__pyx_t_3);
25687     __pyx_t_7 = NULL;
25688     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
25689       __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
25690       if (likely(__pyx_t_7)) {
25691         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
25692         __Pyx_INCREF(__pyx_t_7);
25693         __Pyx_INCREF(function);
25694         __Pyx_DECREF_SET(__pyx_t_3, function);
25695       }
25696     }
25697     __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
25698     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
25699     if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 970, __pyx_L1_error)
25700     __Pyx_GOTREF(__pyx_t_6);
25701     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25702     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pos_z), __pyx_n_s_max); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 970, __pyx_L1_error)
25703     __Pyx_GOTREF(__pyx_t_7);
25704     __pyx_t_12 = NULL;
25705     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
25706       __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_7);
25707       if (likely(__pyx_t_12)) {
25708         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
25709         __Pyx_INCREF(__pyx_t_12);
25710         __Pyx_INCREF(function);
25711         __Pyx_DECREF_SET(__pyx_t_7, function);
25712       }
25713     }
25714     __pyx_t_3 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
25715     __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
25716     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 970, __pyx_L1_error)
25717     __Pyx_GOTREF(__pyx_t_3);
25718     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
25719     __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 970, __pyx_L1_error)
25720     __Pyx_GOTREF(__pyx_t_7);
25721     __Pyx_GIVEREF(__pyx_t_5);
25722     PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
25723     __Pyx_GIVEREF(__pyx_t_6);
25724     PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
25725     __Pyx_GIVEREF(__pyx_t_3);
25726     PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3);
25727     __pyx_t_5 = 0;
25728     __pyx_t_6 = 0;
25729     __pyx_t_3 = 0;
25730     __pyx_v_mas = ((PyObject*)__pyx_t_7);
25731     __pyx_t_7 = 0;
25732 
25733     /* "yt/utilities/lib/geometry_utils.pyx":971
25734  *         mis = (pos_x.min(), pos_y.min(), pos_z.min())
25735  *         mas = (pos_x.max(), pos_y.max(), pos_z.max())
25736  *         raise YTDomainOverflow(mis, mas,             # <<<<<<<<<<<<<<
25737  *                                domain_left_edge, domain_right_edge)
25738  *     return ind
25739  */
25740     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_YTDomainOverflow); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 971, __pyx_L1_error)
25741     __Pyx_GOTREF(__pyx_t_3);
25742 
25743     /* "yt/utilities/lib/geometry_utils.pyx":972
25744  *         mas = (pos_x.max(), pos_y.max(), pos_z.max())
25745  *         raise YTDomainOverflow(mis, mas,
25746  *                                domain_left_edge, domain_right_edge)             # <<<<<<<<<<<<<<
25747  *     return ind
25748  *
25749  */
25750     __pyx_t_6 = NULL;
25751     __pyx_t_2 = 0;
25752     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
25753       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
25754       if (likely(__pyx_t_6)) {
25755         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
25756         __Pyx_INCREF(__pyx_t_6);
25757         __Pyx_INCREF(function);
25758         __Pyx_DECREF_SET(__pyx_t_3, function);
25759         __pyx_t_2 = 1;
25760       }
25761     }
25762     #if CYTHON_FAST_PYCALL
25763     if (PyFunction_Check(__pyx_t_3)) {
25764       PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_v_mis, __pyx_v_mas, __pyx_v_domain_left_edge, __pyx_v_domain_right_edge};
25765       __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_2, 4+__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 971, __pyx_L1_error)
25766       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
25767       __Pyx_GOTREF(__pyx_t_7);
25768     } else
25769     #endif
25770     #if CYTHON_FAST_PYCCALL
25771     if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
25772       PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_v_mis, __pyx_v_mas, __pyx_v_domain_left_edge, __pyx_v_domain_right_edge};
25773       __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_2, 4+__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 971, __pyx_L1_error)
25774       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
25775       __Pyx_GOTREF(__pyx_t_7);
25776     } else
25777     #endif
25778     {
25779       __pyx_t_5 = PyTuple_New(4+__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 971, __pyx_L1_error)
25780       __Pyx_GOTREF(__pyx_t_5);
25781       if (__pyx_t_6) {
25782         __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
25783       }
25784       __Pyx_INCREF(__pyx_v_mis);
25785       __Pyx_GIVEREF(__pyx_v_mis);
25786       PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_2, __pyx_v_mis);
25787       __Pyx_INCREF(__pyx_v_mas);
25788       __Pyx_GIVEREF(__pyx_v_mas);
25789       PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_2, __pyx_v_mas);
25790       __Pyx_INCREF(__pyx_v_domain_left_edge);
25791       __Pyx_GIVEREF(__pyx_v_domain_left_edge);
25792       PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_2, __pyx_v_domain_left_edge);
25793       __Pyx_INCREF(__pyx_v_domain_right_edge);
25794       __Pyx_GIVEREF(__pyx_v_domain_right_edge);
25795       PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_2, __pyx_v_domain_right_edge);
25796       __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 971, __pyx_L1_error)
25797       __Pyx_GOTREF(__pyx_t_7);
25798       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
25799     }
25800     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25801     __Pyx_Raise(__pyx_t_7, 0, 0, 0);
25802     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
25803     __PYX_ERR(1, 971, __pyx_L1_error)
25804 
25805     /* "yt/utilities/lib/geometry_utils.pyx":968
25806  *         print("Could not identify dtype.", pos_x.dtype)
25807  *         raise NotImplementedError
25808  *     if rv < pos_x.shape[0]:             # <<<<<<<<<<<<<<
25809  *         mis = (pos_x.min(), pos_y.min(), pos_z.min())
25810  *         mas = (pos_x.max(), pos_y.max(), pos_z.max())
25811  */
25812   }
25813 
25814   /* "yt/utilities/lib/geometry_utils.pyx":973
25815  *         raise YTDomainOverflow(mis, mas,
25816  *                                domain_left_edge, domain_right_edge)
25817  *     return ind             # <<<<<<<<<<<<<<
25818  *
25819  * @cython.cdivision(True)
25820  */
25821   __Pyx_XDECREF(__pyx_r);
25822   __Pyx_INCREF(((PyObject *)__pyx_v_ind));
25823   __pyx_r = ((PyObject *)__pyx_v_ind);
25824   goto __pyx_L0;
25825 
25826   /* "yt/utilities/lib/geometry_utils.pyx":938
25827  *     return pos_x.shape[0]
25828  *
25829  * def compute_morton(np.ndarray pos_x, np.ndarray pos_y, np.ndarray pos_z,             # <<<<<<<<<<<<<<
25830  *                    domain_left_edge, domain_right_edge, filter_bbox = False,
25831  *                    order = ORDER_MAX):
25832  */
25833 
25834   /* function exit code */
25835   __pyx_L1_error:;
25836   __Pyx_XDECREF(__pyx_t_3);
25837   __Pyx_XDECREF(__pyx_t_5);
25838   __Pyx_XDECREF(__pyx_t_6);
25839   __Pyx_XDECREF(__pyx_t_7);
25840   __Pyx_XDECREF(__pyx_t_12);
25841   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
25842     __Pyx_PyThreadState_declare
25843     __Pyx_PyThreadState_assign
25844     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
25845     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
25846   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
25847   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.compute_morton", __pyx_clineno, __pyx_lineno, __pyx_filename);
25848   __pyx_r = NULL;
25849   goto __pyx_L2;
25850   __pyx_L0:;
25851   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
25852   __pyx_L2:;
25853   __Pyx_XDECREF((PyObject *)__pyx_v_ind);
25854   __Pyx_XDECREF(__pyx_v_mis);
25855   __Pyx_XDECREF(__pyx_v_mas);
25856   __Pyx_XGIVEREF(__pyx_r);
25857   __Pyx_RefNannyFinishContext();
25858   return __pyx_r;
25859 }
25860 
25861 /* "yt/utilities/lib/geometry_utils.pyx":978
25862  * @cython.boundscheck(False)
25863  * @cython.wraparound(False)
25864  * def dist(np.ndarray[np.float64_t, ndim=1] p0, np.ndarray[np.float64_t, ndim=1] q0):             # <<<<<<<<<<<<<<
25865  *     cdef int j
25866  *     cdef np.float64_t p[3]
25867  */
25868 
25869 /* Python wrapper */
25870 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_61dist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
25871 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_61dist = {"dist", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_61dist, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_61dist(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)25872 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_61dist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
25873   PyArrayObject *__pyx_v_p0 = 0;
25874   PyArrayObject *__pyx_v_q0 = 0;
25875   PyObject *__pyx_r = 0;
25876   __Pyx_RefNannyDeclarations
25877   __Pyx_RefNannySetupContext("dist (wrapper)", 0);
25878   {
25879     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p0,&__pyx_n_s_q0,0};
25880     PyObject* values[2] = {0,0};
25881     if (unlikely(__pyx_kwds)) {
25882       Py_ssize_t kw_args;
25883       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
25884       switch (pos_args) {
25885         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
25886         CYTHON_FALLTHROUGH;
25887         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
25888         CYTHON_FALLTHROUGH;
25889         case  0: break;
25890         default: goto __pyx_L5_argtuple_error;
25891       }
25892       kw_args = PyDict_Size(__pyx_kwds);
25893       switch (pos_args) {
25894         case  0:
25895         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p0)) != 0)) kw_args--;
25896         else goto __pyx_L5_argtuple_error;
25897         CYTHON_FALLTHROUGH;
25898         case  1:
25899         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q0)) != 0)) kw_args--;
25900         else {
25901           __Pyx_RaiseArgtupleInvalid("dist", 1, 2, 2, 1); __PYX_ERR(1, 978, __pyx_L3_error)
25902         }
25903       }
25904       if (unlikely(kw_args > 0)) {
25905         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dist") < 0)) __PYX_ERR(1, 978, __pyx_L3_error)
25906       }
25907     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
25908       goto __pyx_L5_argtuple_error;
25909     } else {
25910       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
25911       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
25912     }
25913     __pyx_v_p0 = ((PyArrayObject *)values[0]);
25914     __pyx_v_q0 = ((PyArrayObject *)values[1]);
25915   }
25916   goto __pyx_L4_argument_unpacking_done;
25917   __pyx_L5_argtuple_error:;
25918   __Pyx_RaiseArgtupleInvalid("dist", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 978, __pyx_L3_error)
25919   __pyx_L3_error:;
25920   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.dist", __pyx_clineno, __pyx_lineno, __pyx_filename);
25921   __Pyx_RefNannyFinishContext();
25922   return NULL;
25923   __pyx_L4_argument_unpacking_done:;
25924   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p0), __pyx_ptype_5numpy_ndarray, 1, "p0", 0))) __PYX_ERR(1, 978, __pyx_L1_error)
25925   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q0), __pyx_ptype_5numpy_ndarray, 1, "q0", 0))) __PYX_ERR(1, 978, __pyx_L1_error)
25926   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_60dist(__pyx_self, __pyx_v_p0, __pyx_v_q0);
25927 
25928   /* function exit code */
25929   goto __pyx_L0;
25930   __pyx_L1_error:;
25931   __pyx_r = NULL;
25932   __pyx_L0:;
25933   __Pyx_RefNannyFinishContext();
25934   return __pyx_r;
25935 }
25936 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_60dist(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_p0,PyArrayObject * __pyx_v_q0)25937 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_60dist(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_p0, PyArrayObject *__pyx_v_q0) {
25938   int __pyx_v_j;
25939   __pyx_t_5numpy_float64_t __pyx_v_p[3];
25940   __pyx_t_5numpy_float64_t __pyx_v_q[3];
25941   __Pyx_LocalBuf_ND __pyx_pybuffernd_p0;
25942   __Pyx_Buffer __pyx_pybuffer_p0;
25943   __Pyx_LocalBuf_ND __pyx_pybuffernd_q0;
25944   __Pyx_Buffer __pyx_pybuffer_q0;
25945   PyObject *__pyx_r = NULL;
25946   __Pyx_RefNannyDeclarations
25947   int __pyx_t_1;
25948   Py_ssize_t __pyx_t_2;
25949   Py_ssize_t __pyx_t_3;
25950   struct __pyx_array_obj *__pyx_t_4 = NULL;
25951   PyObject *__pyx_t_5 = NULL;
25952   PyObject *__pyx_t_6 = NULL;
25953   __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
25954   __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
25955   __Pyx_RefNannySetupContext("dist", 0);
25956   __pyx_pybuffer_p0.pybuffer.buf = NULL;
25957   __pyx_pybuffer_p0.refcount = 0;
25958   __pyx_pybuffernd_p0.data = NULL;
25959   __pyx_pybuffernd_p0.rcbuffer = &__pyx_pybuffer_p0;
25960   __pyx_pybuffer_q0.pybuffer.buf = NULL;
25961   __pyx_pybuffer_q0.refcount = 0;
25962   __pyx_pybuffernd_q0.data = NULL;
25963   __pyx_pybuffernd_q0.rcbuffer = &__pyx_pybuffer_q0;
25964   {
25965     __Pyx_BufFmt_StackElem __pyx_stack[1];
25966     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_p0.rcbuffer->pybuffer, (PyObject*)__pyx_v_p0, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 978, __pyx_L1_error)
25967   }
25968   __pyx_pybuffernd_p0.diminfo[0].strides = __pyx_pybuffernd_p0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_p0.diminfo[0].shape = __pyx_pybuffernd_p0.rcbuffer->pybuffer.shape[0];
25969   {
25970     __Pyx_BufFmt_StackElem __pyx_stack[1];
25971     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q0.rcbuffer->pybuffer, (PyObject*)__pyx_v_q0, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 978, __pyx_L1_error)
25972   }
25973   __pyx_pybuffernd_q0.diminfo[0].strides = __pyx_pybuffernd_q0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q0.diminfo[0].shape = __pyx_pybuffernd_q0.rcbuffer->pybuffer.shape[0];
25974 
25975   /* "yt/utilities/lib/geometry_utils.pyx":982
25976  *     cdef np.float64_t p[3]
25977  *     cdef np.float64_t q[3]
25978  *     for j in range(3):             # <<<<<<<<<<<<<<
25979  *         p[j] = p0[j]
25980  *         q[j] = q0[j]
25981  */
25982   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
25983     __pyx_v_j = __pyx_t_1;
25984 
25985     /* "yt/utilities/lib/geometry_utils.pyx":983
25986  *     cdef np.float64_t q[3]
25987  *     for j in range(3):
25988  *         p[j] = p0[j]             # <<<<<<<<<<<<<<
25989  *         q[j] = q0[j]
25990  *     return euclidean_distance(p,q)
25991  */
25992     __pyx_t_2 = __pyx_v_j;
25993     (__pyx_v_p[__pyx_v_j]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_p0.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_p0.diminfo[0].strides));
25994 
25995     /* "yt/utilities/lib/geometry_utils.pyx":984
25996  *     for j in range(3):
25997  *         p[j] = p0[j]
25998  *         q[j] = q0[j]             # <<<<<<<<<<<<<<
25999  *     return euclidean_distance(p,q)
26000  *
26001  */
26002     __pyx_t_3 = __pyx_v_j;
26003     (__pyx_v_q[__pyx_v_j]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_q0.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_q0.diminfo[0].strides));
26004   }
26005 
26006   /* "yt/utilities/lib/geometry_utils.pyx":985
26007  *         p[j] = p0[j]
26008  *         q[j] = q0[j]
26009  *     return euclidean_distance(p,q)             # <<<<<<<<<<<<<<
26010  *
26011  * @cython.cdivision(True)
26012  */
26013   __Pyx_XDECREF(__pyx_r);
26014   __pyx_t_6 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t);
26015   __pyx_t_5 = Py_BuildValue((char*) "("  __PYX_BUILD_PY_SSIZE_T  ")", ((Py_ssize_t)3));
26016   if (unlikely(!__pyx_t_6 || !__pyx_t_5 || !PyBytes_AsString(__pyx_t_6))) __PYX_ERR(1, 985, __pyx_L1_error)
26017   __Pyx_GOTREF(__pyx_t_6);
26018   __Pyx_GOTREF(__pyx_t_5);
26019   __pyx_t_4 = __pyx_array_new(__pyx_t_5, sizeof(__pyx_t_5numpy_float64_t), PyBytes_AS_STRING(__pyx_t_6), (char *) "fortran", (char *) __pyx_v_p);
26020   if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 985, __pyx_L1_error)
26021   __Pyx_GOTREF(__pyx_t_4);
26022   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
26023   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
26024   __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(((PyObject *)__pyx_t_4), PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 985, __pyx_L1_error)
26025   __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
26026   __pyx_t_5 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t);
26027   __pyx_t_6 = Py_BuildValue((char*) "("  __PYX_BUILD_PY_SSIZE_T  ")", ((Py_ssize_t)3));
26028   if (unlikely(!__pyx_t_5 || !__pyx_t_6 || !PyBytes_AsString(__pyx_t_5))) __PYX_ERR(1, 985, __pyx_L1_error)
26029   __Pyx_GOTREF(__pyx_t_5);
26030   __Pyx_GOTREF(__pyx_t_6);
26031   __pyx_t_4 = __pyx_array_new(__pyx_t_6, sizeof(__pyx_t_5numpy_float64_t), PyBytes_AS_STRING(__pyx_t_5), (char *) "fortran", (char *) __pyx_v_q);
26032   if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 985, __pyx_L1_error)
26033   __Pyx_GOTREF(__pyx_t_4);
26034   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
26035   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
26036   __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(((PyObject *)__pyx_t_4), PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 985, __pyx_L1_error)
26037   __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
26038   __pyx_t_5 = PyFloat_FromDouble(__pyx_f_2yt_9utilities_3lib_14geometry_utils_euclidean_distance(__pyx_t_7, __pyx_t_8)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 985, __pyx_L1_error)
26039   __Pyx_GOTREF(__pyx_t_5);
26040   __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
26041   __pyx_t_7.memview = NULL;
26042   __pyx_t_7.data = NULL;
26043   __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
26044   __pyx_t_8.memview = NULL;
26045   __pyx_t_8.data = NULL;
26046   __pyx_r = __pyx_t_5;
26047   __pyx_t_5 = 0;
26048   goto __pyx_L0;
26049 
26050   /* "yt/utilities/lib/geometry_utils.pyx":978
26051  * @cython.boundscheck(False)
26052  * @cython.wraparound(False)
26053  * def dist(np.ndarray[np.float64_t, ndim=1] p0, np.ndarray[np.float64_t, ndim=1] q0):             # <<<<<<<<<<<<<<
26054  *     cdef int j
26055  *     cdef np.float64_t p[3]
26056  */
26057 
26058   /* function exit code */
26059   __pyx_L1_error:;
26060   __Pyx_XDECREF(((PyObject *)__pyx_t_4));
26061   __Pyx_XDECREF(__pyx_t_5);
26062   __Pyx_XDECREF(__pyx_t_6);
26063   __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
26064   __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
26065   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
26066     __Pyx_PyThreadState_declare
26067     __Pyx_PyThreadState_assign
26068     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
26069     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_p0.rcbuffer->pybuffer);
26070     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q0.rcbuffer->pybuffer);
26071   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
26072   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.dist", __pyx_clineno, __pyx_lineno, __pyx_filename);
26073   __pyx_r = NULL;
26074   goto __pyx_L2;
26075   __pyx_L0:;
26076   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_p0.rcbuffer->pybuffer);
26077   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q0.rcbuffer->pybuffer);
26078   __pyx_L2:;
26079   __Pyx_XGIVEREF(__pyx_r);
26080   __Pyx_RefNannyFinishContext();
26081   return __pyx_r;
26082 }
26083 
26084 /* "yt/utilities/lib/geometry_utils.pyx":990
26085  * @cython.boundscheck(False)
26086  * @cython.wraparound(False)
26087  * def dist_to_box(np.ndarray[np.float64_t, ndim=1] p,             # <<<<<<<<<<<<<<
26088  *                 np.ndarray[np.float64_t, ndim=1] cbox,
26089  *                 np.float64_t rbox):
26090  */
26091 
26092 /* Python wrapper */
26093 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_63dist_to_box(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
26094 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_63dist_to_box = {"dist_to_box", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_63dist_to_box, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_63dist_to_box(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)26095 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_63dist_to_box(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
26096   PyArrayObject *__pyx_v_p = 0;
26097   PyArrayObject *__pyx_v_cbox = 0;
26098   __pyx_t_5numpy_float64_t __pyx_v_rbox;
26099   PyObject *__pyx_r = 0;
26100   __Pyx_RefNannyDeclarations
26101   __Pyx_RefNannySetupContext("dist_to_box (wrapper)", 0);
26102   {
26103     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_cbox,&__pyx_n_s_rbox,0};
26104     PyObject* values[3] = {0,0,0};
26105     if (unlikely(__pyx_kwds)) {
26106       Py_ssize_t kw_args;
26107       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
26108       switch (pos_args) {
26109         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
26110         CYTHON_FALLTHROUGH;
26111         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
26112         CYTHON_FALLTHROUGH;
26113         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
26114         CYTHON_FALLTHROUGH;
26115         case  0: break;
26116         default: goto __pyx_L5_argtuple_error;
26117       }
26118       kw_args = PyDict_Size(__pyx_kwds);
26119       switch (pos_args) {
26120         case  0:
26121         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
26122         else goto __pyx_L5_argtuple_error;
26123         CYTHON_FALLTHROUGH;
26124         case  1:
26125         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cbox)) != 0)) kw_args--;
26126         else {
26127           __Pyx_RaiseArgtupleInvalid("dist_to_box", 1, 3, 3, 1); __PYX_ERR(1, 990, __pyx_L3_error)
26128         }
26129         CYTHON_FALLTHROUGH;
26130         case  2:
26131         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rbox)) != 0)) kw_args--;
26132         else {
26133           __Pyx_RaiseArgtupleInvalid("dist_to_box", 1, 3, 3, 2); __PYX_ERR(1, 990, __pyx_L3_error)
26134         }
26135       }
26136       if (unlikely(kw_args > 0)) {
26137         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dist_to_box") < 0)) __PYX_ERR(1, 990, __pyx_L3_error)
26138       }
26139     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
26140       goto __pyx_L5_argtuple_error;
26141     } else {
26142       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
26143       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
26144       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
26145     }
26146     __pyx_v_p = ((PyArrayObject *)values[0]);
26147     __pyx_v_cbox = ((PyArrayObject *)values[1]);
26148     __pyx_v_rbox = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_rbox == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 992, __pyx_L3_error)
26149   }
26150   goto __pyx_L4_argument_unpacking_done;
26151   __pyx_L5_argtuple_error:;
26152   __Pyx_RaiseArgtupleInvalid("dist_to_box", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 990, __pyx_L3_error)
26153   __pyx_L3_error:;
26154   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.dist_to_box", __pyx_clineno, __pyx_lineno, __pyx_filename);
26155   __Pyx_RefNannyFinishContext();
26156   return NULL;
26157   __pyx_L4_argument_unpacking_done:;
26158   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5numpy_ndarray, 1, "p", 0))) __PYX_ERR(1, 990, __pyx_L1_error)
26159   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_cbox), __pyx_ptype_5numpy_ndarray, 1, "cbox", 0))) __PYX_ERR(1, 991, __pyx_L1_error)
26160   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_62dist_to_box(__pyx_self, __pyx_v_p, __pyx_v_cbox, __pyx_v_rbox);
26161 
26162   /* function exit code */
26163   goto __pyx_L0;
26164   __pyx_L1_error:;
26165   __pyx_r = NULL;
26166   __pyx_L0:;
26167   __Pyx_RefNannyFinishContext();
26168   return __pyx_r;
26169 }
26170 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_62dist_to_box(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_p,PyArrayObject * __pyx_v_cbox,__pyx_t_5numpy_float64_t __pyx_v_rbox)26171 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_62dist_to_box(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_p, PyArrayObject *__pyx_v_cbox, __pyx_t_5numpy_float64_t __pyx_v_rbox) {
26172   int __pyx_v_j;
26173   __pyx_t_5numpy_float64_t __pyx_v_d;
26174   __Pyx_LocalBuf_ND __pyx_pybuffernd_cbox;
26175   __Pyx_Buffer __pyx_pybuffer_cbox;
26176   __Pyx_LocalBuf_ND __pyx_pybuffernd_p;
26177   __Pyx_Buffer __pyx_pybuffer_p;
26178   PyObject *__pyx_r = NULL;
26179   __Pyx_RefNannyDeclarations
26180   int __pyx_t_1;
26181   double __pyx_t_2;
26182   Py_ssize_t __pyx_t_3;
26183   Py_ssize_t __pyx_t_4;
26184   __pyx_t_5numpy_float64_t __pyx_t_5;
26185   Py_ssize_t __pyx_t_6;
26186   Py_ssize_t __pyx_t_7;
26187   __pyx_t_5numpy_float64_t __pyx_t_8;
26188   __pyx_t_5numpy_float64_t __pyx_t_9;
26189   PyObject *__pyx_t_10 = NULL;
26190   PyObject *__pyx_t_11 = NULL;
26191   PyObject *__pyx_t_12 = NULL;
26192   PyObject *__pyx_t_13 = NULL;
26193   __Pyx_RefNannySetupContext("dist_to_box", 0);
26194   __pyx_pybuffer_p.pybuffer.buf = NULL;
26195   __pyx_pybuffer_p.refcount = 0;
26196   __pyx_pybuffernd_p.data = NULL;
26197   __pyx_pybuffernd_p.rcbuffer = &__pyx_pybuffer_p;
26198   __pyx_pybuffer_cbox.pybuffer.buf = NULL;
26199   __pyx_pybuffer_cbox.refcount = 0;
26200   __pyx_pybuffernd_cbox.data = NULL;
26201   __pyx_pybuffernd_cbox.rcbuffer = &__pyx_pybuffer_cbox;
26202   {
26203     __Pyx_BufFmt_StackElem __pyx_stack[1];
26204     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_p.rcbuffer->pybuffer, (PyObject*)__pyx_v_p, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 990, __pyx_L1_error)
26205   }
26206   __pyx_pybuffernd_p.diminfo[0].strides = __pyx_pybuffernd_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_p.diminfo[0].shape = __pyx_pybuffernd_p.rcbuffer->pybuffer.shape[0];
26207   {
26208     __Pyx_BufFmt_StackElem __pyx_stack[1];
26209     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cbox.rcbuffer->pybuffer, (PyObject*)__pyx_v_cbox, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 990, __pyx_L1_error)
26210   }
26211   __pyx_pybuffernd_cbox.diminfo[0].strides = __pyx_pybuffernd_cbox.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cbox.diminfo[0].shape = __pyx_pybuffernd_cbox.rcbuffer->pybuffer.shape[0];
26212 
26213   /* "yt/utilities/lib/geometry_utils.pyx":994
26214  *                 np.float64_t rbox):
26215  *     cdef int j
26216  *     cdef np.float64_t d = 0.0             # <<<<<<<<<<<<<<
26217  *     for j in range(3):
26218  *         d+= max((cbox[j]-rbox)-p[j],0.0,p[j]-(cbox[j]+rbox))**2
26219  */
26220   __pyx_v_d = 0.0;
26221 
26222   /* "yt/utilities/lib/geometry_utils.pyx":995
26223  *     cdef int j
26224  *     cdef np.float64_t d = 0.0
26225  *     for j in range(3):             # <<<<<<<<<<<<<<
26226  *         d+= max((cbox[j]-rbox)-p[j],0.0,p[j]-(cbox[j]+rbox))**2
26227  *     return np.sqrt(d)
26228  */
26229   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
26230     __pyx_v_j = __pyx_t_1;
26231 
26232     /* "yt/utilities/lib/geometry_utils.pyx":996
26233  *     cdef np.float64_t d = 0.0
26234  *     for j in range(3):
26235  *         d+= max((cbox[j]-rbox)-p[j],0.0,p[j]-(cbox[j]+rbox))**2             # <<<<<<<<<<<<<<
26236  *     return np.sqrt(d)
26237  *
26238  */
26239     __pyx_t_2 = 0.0;
26240     __pyx_t_3 = __pyx_v_j;
26241     __pyx_t_4 = __pyx_v_j;
26242     __pyx_t_5 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_p.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_p.diminfo[0].strides)) - ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_cbox.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_cbox.diminfo[0].strides)) + __pyx_v_rbox));
26243     __pyx_t_6 = __pyx_v_j;
26244     __pyx_t_7 = __pyx_v_j;
26245     __pyx_t_8 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_cbox.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_cbox.diminfo[0].strides)) - __pyx_v_rbox) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_p.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_p.diminfo[0].strides)));
26246     if (((__pyx_t_2 > __pyx_t_8) != 0)) {
26247       __pyx_t_9 = __pyx_t_2;
26248     } else {
26249       __pyx_t_9 = __pyx_t_8;
26250     }
26251     __pyx_t_8 = __pyx_t_9;
26252     if (((__pyx_t_5 > __pyx_t_8) != 0)) {
26253       __pyx_t_9 = __pyx_t_5;
26254     } else {
26255       __pyx_t_9 = __pyx_t_8;
26256     }
26257     __pyx_v_d = (__pyx_v_d + pow(__pyx_t_9, 2.0));
26258   }
26259 
26260   /* "yt/utilities/lib/geometry_utils.pyx":997
26261  *     for j in range(3):
26262  *         d+= max((cbox[j]-rbox)-p[j],0.0,p[j]-(cbox[j]+rbox))**2
26263  *     return np.sqrt(d)             # <<<<<<<<<<<<<<
26264  *
26265  *
26266  */
26267   __Pyx_XDECREF(__pyx_r);
26268   __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 997, __pyx_L1_error)
26269   __Pyx_GOTREF(__pyx_t_11);
26270   __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 997, __pyx_L1_error)
26271   __Pyx_GOTREF(__pyx_t_12);
26272   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
26273   __pyx_t_11 = PyFloat_FromDouble(__pyx_v_d); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 997, __pyx_L1_error)
26274   __Pyx_GOTREF(__pyx_t_11);
26275   __pyx_t_13 = NULL;
26276   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
26277     __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12);
26278     if (likely(__pyx_t_13)) {
26279       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
26280       __Pyx_INCREF(__pyx_t_13);
26281       __Pyx_INCREF(function);
26282       __Pyx_DECREF_SET(__pyx_t_12, function);
26283     }
26284   }
26285   __pyx_t_10 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_13, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11);
26286   __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
26287   __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
26288   if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 997, __pyx_L1_error)
26289   __Pyx_GOTREF(__pyx_t_10);
26290   __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
26291   __pyx_r = __pyx_t_10;
26292   __pyx_t_10 = 0;
26293   goto __pyx_L0;
26294 
26295   /* "yt/utilities/lib/geometry_utils.pyx":990
26296  * @cython.boundscheck(False)
26297  * @cython.wraparound(False)
26298  * def dist_to_box(np.ndarray[np.float64_t, ndim=1] p,             # <<<<<<<<<<<<<<
26299  *                 np.ndarray[np.float64_t, ndim=1] cbox,
26300  *                 np.float64_t rbox):
26301  */
26302 
26303   /* function exit code */
26304   __pyx_L1_error:;
26305   __Pyx_XDECREF(__pyx_t_10);
26306   __Pyx_XDECREF(__pyx_t_11);
26307   __Pyx_XDECREF(__pyx_t_12);
26308   __Pyx_XDECREF(__pyx_t_13);
26309   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
26310     __Pyx_PyThreadState_declare
26311     __Pyx_PyThreadState_assign
26312     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
26313     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cbox.rcbuffer->pybuffer);
26314     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_p.rcbuffer->pybuffer);
26315   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
26316   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.dist_to_box", __pyx_clineno, __pyx_lineno, __pyx_filename);
26317   __pyx_r = NULL;
26318   goto __pyx_L2;
26319   __pyx_L0:;
26320   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cbox.rcbuffer->pybuffer);
26321   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_p.rcbuffer->pybuffer);
26322   __pyx_L2:;
26323   __Pyx_XGIVEREF(__pyx_r);
26324   __Pyx_RefNannyFinishContext();
26325   return __pyx_r;
26326 }
26327 
26328 /* "yt/utilities/lib/geometry_utils.pyx":1003
26329  * @cython.boundscheck(False)
26330  * @cython.wraparound(False)
26331  * def solution_radius(np.ndarray[np.float64_t, ndim=2] P, int k, np.uint64_t i,             # <<<<<<<<<<<<<<
26332  *                     np.ndarray[np.uint64_t, ndim=1] idx, int order,
26333  *                     np.ndarray[np.float64_t, ndim=1] DLE,
26334  */
26335 
26336 /* Python wrapper */
26337 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_65solution_radius(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
26338 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_65solution_radius = {"solution_radius", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_65solution_radius, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_65solution_radius(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)26339 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_65solution_radius(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
26340   PyArrayObject *__pyx_v_P = 0;
26341   int __pyx_v_k;
26342   __pyx_t_5numpy_uint64_t __pyx_v_i;
26343   PyArrayObject *__pyx_v_idx = 0;
26344   int __pyx_v_order;
26345   PyArrayObject *__pyx_v_DLE = 0;
26346   PyArrayObject *__pyx_v_DRE = 0;
26347   PyObject *__pyx_r = 0;
26348   __Pyx_RefNannyDeclarations
26349   __Pyx_RefNannySetupContext("solution_radius (wrapper)", 0);
26350   {
26351     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_P,&__pyx_n_s_k,&__pyx_n_s_i,&__pyx_n_s_idx,&__pyx_n_s_order,&__pyx_n_s_DLE,&__pyx_n_s_DRE,0};
26352     PyObject* values[7] = {0,0,0,0,0,0,0};
26353     if (unlikely(__pyx_kwds)) {
26354       Py_ssize_t kw_args;
26355       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
26356       switch (pos_args) {
26357         case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
26358         CYTHON_FALLTHROUGH;
26359         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
26360         CYTHON_FALLTHROUGH;
26361         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
26362         CYTHON_FALLTHROUGH;
26363         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
26364         CYTHON_FALLTHROUGH;
26365         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
26366         CYTHON_FALLTHROUGH;
26367         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
26368         CYTHON_FALLTHROUGH;
26369         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
26370         CYTHON_FALLTHROUGH;
26371         case  0: break;
26372         default: goto __pyx_L5_argtuple_error;
26373       }
26374       kw_args = PyDict_Size(__pyx_kwds);
26375       switch (pos_args) {
26376         case  0:
26377         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_P)) != 0)) kw_args--;
26378         else goto __pyx_L5_argtuple_error;
26379         CYTHON_FALLTHROUGH;
26380         case  1:
26381         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k)) != 0)) kw_args--;
26382         else {
26383           __Pyx_RaiseArgtupleInvalid("solution_radius", 1, 7, 7, 1); __PYX_ERR(1, 1003, __pyx_L3_error)
26384         }
26385         CYTHON_FALLTHROUGH;
26386         case  2:
26387         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_i)) != 0)) kw_args--;
26388         else {
26389           __Pyx_RaiseArgtupleInvalid("solution_radius", 1, 7, 7, 2); __PYX_ERR(1, 1003, __pyx_L3_error)
26390         }
26391         CYTHON_FALLTHROUGH;
26392         case  3:
26393         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_idx)) != 0)) kw_args--;
26394         else {
26395           __Pyx_RaiseArgtupleInvalid("solution_radius", 1, 7, 7, 3); __PYX_ERR(1, 1003, __pyx_L3_error)
26396         }
26397         CYTHON_FALLTHROUGH;
26398         case  4:
26399         if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_order)) != 0)) kw_args--;
26400         else {
26401           __Pyx_RaiseArgtupleInvalid("solution_radius", 1, 7, 7, 4); __PYX_ERR(1, 1003, __pyx_L3_error)
26402         }
26403         CYTHON_FALLTHROUGH;
26404         case  5:
26405         if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_DLE)) != 0)) kw_args--;
26406         else {
26407           __Pyx_RaiseArgtupleInvalid("solution_radius", 1, 7, 7, 5); __PYX_ERR(1, 1003, __pyx_L3_error)
26408         }
26409         CYTHON_FALLTHROUGH;
26410         case  6:
26411         if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_DRE)) != 0)) kw_args--;
26412         else {
26413           __Pyx_RaiseArgtupleInvalid("solution_radius", 1, 7, 7, 6); __PYX_ERR(1, 1003, __pyx_L3_error)
26414         }
26415       }
26416       if (unlikely(kw_args > 0)) {
26417         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "solution_radius") < 0)) __PYX_ERR(1, 1003, __pyx_L3_error)
26418       }
26419     } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
26420       goto __pyx_L5_argtuple_error;
26421     } else {
26422       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
26423       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
26424       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
26425       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
26426       values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
26427       values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
26428       values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
26429     }
26430     __pyx_v_P = ((PyArrayObject *)values[0]);
26431     __pyx_v_k = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1003, __pyx_L3_error)
26432     __pyx_v_i = __Pyx_PyInt_As_npy_uint64(values[2]); if (unlikely((__pyx_v_i == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 1003, __pyx_L3_error)
26433     __pyx_v_idx = ((PyArrayObject *)values[3]);
26434     __pyx_v_order = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1004, __pyx_L3_error)
26435     __pyx_v_DLE = ((PyArrayObject *)values[5]);
26436     __pyx_v_DRE = ((PyArrayObject *)values[6]);
26437   }
26438   goto __pyx_L4_argument_unpacking_done;
26439   __pyx_L5_argtuple_error:;
26440   __Pyx_RaiseArgtupleInvalid("solution_radius", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1003, __pyx_L3_error)
26441   __pyx_L3_error:;
26442   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.solution_radius", __pyx_clineno, __pyx_lineno, __pyx_filename);
26443   __Pyx_RefNannyFinishContext();
26444   return NULL;
26445   __pyx_L4_argument_unpacking_done:;
26446   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_P), __pyx_ptype_5numpy_ndarray, 1, "P", 0))) __PYX_ERR(1, 1003, __pyx_L1_error)
26447   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idx), __pyx_ptype_5numpy_ndarray, 1, "idx", 0))) __PYX_ERR(1, 1004, __pyx_L1_error)
26448   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_DLE), __pyx_ptype_5numpy_ndarray, 1, "DLE", 0))) __PYX_ERR(1, 1005, __pyx_L1_error)
26449   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_DRE), __pyx_ptype_5numpy_ndarray, 1, "DRE", 0))) __PYX_ERR(1, 1006, __pyx_L1_error)
26450   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_64solution_radius(__pyx_self, __pyx_v_P, __pyx_v_k, __pyx_v_i, __pyx_v_idx, __pyx_v_order, __pyx_v_DLE, __pyx_v_DRE);
26451 
26452   /* function exit code */
26453   goto __pyx_L0;
26454   __pyx_L1_error:;
26455   __pyx_r = NULL;
26456   __pyx_L0:;
26457   __Pyx_RefNannyFinishContext();
26458   return __pyx_r;
26459 }
26460 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_64solution_radius(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_P,int __pyx_v_k,__pyx_t_5numpy_uint64_t __pyx_v_i,PyArrayObject * __pyx_v_idx,int __pyx_v_order,PyArrayObject * __pyx_v_DLE,PyArrayObject * __pyx_v_DRE)26461 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_64solution_radius(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_P, int __pyx_v_k, __pyx_t_5numpy_uint64_t __pyx_v_i, PyArrayObject *__pyx_v_idx, int __pyx_v_order, PyArrayObject *__pyx_v_DLE, PyArrayObject *__pyx_v_DRE) {
26462   PyObject *__pyx_v_c = NULL;
26463   __Pyx_LocalBuf_ND __pyx_pybuffernd_DLE;
26464   __Pyx_Buffer __pyx_pybuffer_DLE;
26465   __Pyx_LocalBuf_ND __pyx_pybuffernd_DRE;
26466   __Pyx_Buffer __pyx_pybuffer_DRE;
26467   __Pyx_LocalBuf_ND __pyx_pybuffernd_P;
26468   __Pyx_Buffer __pyx_pybuffer_P;
26469   __Pyx_LocalBuf_ND __pyx_pybuffernd_idx;
26470   __Pyx_Buffer __pyx_pybuffer_idx;
26471   PyObject *__pyx_r = NULL;
26472   __Pyx_RefNannyDeclarations
26473   PyObject *__pyx_t_1 = NULL;
26474   PyObject *__pyx_t_2 = NULL;
26475   PyObject *__pyx_t_3 = NULL;
26476   PyObject *__pyx_t_4 = NULL;
26477   Py_ssize_t __pyx_t_5;
26478   PyObject *__pyx_t_6 = NULL;
26479   PyObject *__pyx_t_7 = NULL;
26480   int __pyx_t_8;
26481   PyObject *__pyx_t_9 = NULL;
26482   __Pyx_RefNannySetupContext("solution_radius", 0);
26483   __pyx_pybuffer_P.pybuffer.buf = NULL;
26484   __pyx_pybuffer_P.refcount = 0;
26485   __pyx_pybuffernd_P.data = NULL;
26486   __pyx_pybuffernd_P.rcbuffer = &__pyx_pybuffer_P;
26487   __pyx_pybuffer_idx.pybuffer.buf = NULL;
26488   __pyx_pybuffer_idx.refcount = 0;
26489   __pyx_pybuffernd_idx.data = NULL;
26490   __pyx_pybuffernd_idx.rcbuffer = &__pyx_pybuffer_idx;
26491   __pyx_pybuffer_DLE.pybuffer.buf = NULL;
26492   __pyx_pybuffer_DLE.refcount = 0;
26493   __pyx_pybuffernd_DLE.data = NULL;
26494   __pyx_pybuffernd_DLE.rcbuffer = &__pyx_pybuffer_DLE;
26495   __pyx_pybuffer_DRE.pybuffer.buf = NULL;
26496   __pyx_pybuffer_DRE.refcount = 0;
26497   __pyx_pybuffernd_DRE.data = NULL;
26498   __pyx_pybuffernd_DRE.rcbuffer = &__pyx_pybuffer_DRE;
26499   {
26500     __Pyx_BufFmt_StackElem __pyx_stack[1];
26501     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_P.rcbuffer->pybuffer, (PyObject*)__pyx_v_P, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(1, 1003, __pyx_L1_error)
26502   }
26503   __pyx_pybuffernd_P.diminfo[0].strides = __pyx_pybuffernd_P.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_P.diminfo[0].shape = __pyx_pybuffernd_P.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_P.diminfo[1].strides = __pyx_pybuffernd_P.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_P.diminfo[1].shape = __pyx_pybuffernd_P.rcbuffer->pybuffer.shape[1];
26504   {
26505     __Pyx_BufFmt_StackElem __pyx_stack[1];
26506     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_idx.rcbuffer->pybuffer, (PyObject*)__pyx_v_idx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 1003, __pyx_L1_error)
26507   }
26508   __pyx_pybuffernd_idx.diminfo[0].strides = __pyx_pybuffernd_idx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_idx.diminfo[0].shape = __pyx_pybuffernd_idx.rcbuffer->pybuffer.shape[0];
26509   {
26510     __Pyx_BufFmt_StackElem __pyx_stack[1];
26511     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_DLE.rcbuffer->pybuffer, (PyObject*)__pyx_v_DLE, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 1003, __pyx_L1_error)
26512   }
26513   __pyx_pybuffernd_DLE.diminfo[0].strides = __pyx_pybuffernd_DLE.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_DLE.diminfo[0].shape = __pyx_pybuffernd_DLE.rcbuffer->pybuffer.shape[0];
26514   {
26515     __Pyx_BufFmt_StackElem __pyx_stack[1];
26516     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_DRE.rcbuffer->pybuffer, (PyObject*)__pyx_v_DRE, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 1003, __pyx_L1_error)
26517   }
26518   __pyx_pybuffernd_DRE.diminfo[0].strides = __pyx_pybuffernd_DRE.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_DRE.diminfo[0].shape = __pyx_pybuffernd_DRE.rcbuffer->pybuffer.shape[0];
26519 
26520   /* "yt/utilities/lib/geometry_utils.pyx":1007
26521  *                     np.ndarray[np.float64_t, ndim=1] DLE,
26522  *                     np.ndarray[np.float64_t, ndim=1] DRE):
26523  *     c = np.zeros(3, dtype=np.float64)             # <<<<<<<<<<<<<<
26524  *     return quadtree_box(P[i,:],P[idx[k-1],:],order,DLE,DRE,c)
26525  *
26526  */
26527   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1007, __pyx_L1_error)
26528   __Pyx_GOTREF(__pyx_t_1);
26529   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1007, __pyx_L1_error)
26530   __Pyx_GOTREF(__pyx_t_2);
26531   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26532   __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1007, __pyx_L1_error)
26533   __Pyx_GOTREF(__pyx_t_1);
26534   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1007, __pyx_L1_error)
26535   __Pyx_GOTREF(__pyx_t_3);
26536   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1007, __pyx_L1_error)
26537   __Pyx_GOTREF(__pyx_t_4);
26538   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26539   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(1, 1007, __pyx_L1_error)
26540   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26541   __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__9, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1007, __pyx_L1_error)
26542   __Pyx_GOTREF(__pyx_t_4);
26543   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
26544   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26545   __pyx_v_c = __pyx_t_4;
26546   __pyx_t_4 = 0;
26547 
26548   /* "yt/utilities/lib/geometry_utils.pyx":1008
26549  *                     np.ndarray[np.float64_t, ndim=1] DRE):
26550  *     c = np.zeros(3, dtype=np.float64)
26551  *     return quadtree_box(P[i,:],P[idx[k-1],:],order,DLE,DRE,c)             # <<<<<<<<<<<<<<
26552  *
26553  * @cython.cdivision(True)
26554  */
26555   __Pyx_XDECREF(__pyx_r);
26556   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_quadtree_box); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1008, __pyx_L1_error)
26557   __Pyx_GOTREF(__pyx_t_1);
26558   __pyx_t_2 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1008, __pyx_L1_error)
26559   __Pyx_GOTREF(__pyx_t_2);
26560   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1008, __pyx_L1_error)
26561   __Pyx_GOTREF(__pyx_t_3);
26562   __Pyx_GIVEREF(__pyx_t_2);
26563   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
26564   __Pyx_INCREF(__pyx_slice__4);
26565   __Pyx_GIVEREF(__pyx_slice__4);
26566   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_slice__4);
26567   __pyx_t_2 = 0;
26568   __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1008, __pyx_L1_error)
26569   __Pyx_GOTREF(__pyx_t_2);
26570   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26571   __pyx_t_5 = (__pyx_v_k - 1);
26572   __pyx_t_3 = __Pyx_PyInt_From_npy_uint64((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_idx.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_idx.diminfo[0].strides))); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1008, __pyx_L1_error)
26573   __Pyx_GOTREF(__pyx_t_3);
26574   __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1008, __pyx_L1_error)
26575   __Pyx_GOTREF(__pyx_t_6);
26576   __Pyx_GIVEREF(__pyx_t_3);
26577   PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
26578   __Pyx_INCREF(__pyx_slice__4);
26579   __Pyx_GIVEREF(__pyx_slice__4);
26580   PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_slice__4);
26581   __pyx_t_3 = 0;
26582   __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1008, __pyx_L1_error)
26583   __Pyx_GOTREF(__pyx_t_3);
26584   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
26585   __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_order); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1008, __pyx_L1_error)
26586   __Pyx_GOTREF(__pyx_t_6);
26587   __pyx_t_7 = NULL;
26588   __pyx_t_8 = 0;
26589   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
26590     __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
26591     if (likely(__pyx_t_7)) {
26592       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
26593       __Pyx_INCREF(__pyx_t_7);
26594       __Pyx_INCREF(function);
26595       __Pyx_DECREF_SET(__pyx_t_1, function);
26596       __pyx_t_8 = 1;
26597     }
26598   }
26599   #if CYTHON_FAST_PYCALL
26600   if (PyFunction_Check(__pyx_t_1)) {
26601     PyObject *__pyx_temp[7] = {__pyx_t_7, __pyx_t_2, __pyx_t_3, __pyx_t_6, ((PyObject *)__pyx_v_DLE), ((PyObject *)__pyx_v_DRE), __pyx_v_c};
26602     __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 6+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1008, __pyx_L1_error)
26603     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
26604     __Pyx_GOTREF(__pyx_t_4);
26605     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
26606     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26607     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
26608   } else
26609   #endif
26610   #if CYTHON_FAST_PYCCALL
26611   if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
26612     PyObject *__pyx_temp[7] = {__pyx_t_7, __pyx_t_2, __pyx_t_3, __pyx_t_6, ((PyObject *)__pyx_v_DLE), ((PyObject *)__pyx_v_DRE), __pyx_v_c};
26613     __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 6+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1008, __pyx_L1_error)
26614     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
26615     __Pyx_GOTREF(__pyx_t_4);
26616     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
26617     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26618     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
26619   } else
26620   #endif
26621   {
26622     __pyx_t_9 = PyTuple_New(6+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1008, __pyx_L1_error)
26623     __Pyx_GOTREF(__pyx_t_9);
26624     if (__pyx_t_7) {
26625       __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
26626     }
26627     __Pyx_GIVEREF(__pyx_t_2);
26628     PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_2);
26629     __Pyx_GIVEREF(__pyx_t_3);
26630     PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_3);
26631     __Pyx_GIVEREF(__pyx_t_6);
26632     PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_6);
26633     __Pyx_INCREF(((PyObject *)__pyx_v_DLE));
26634     __Pyx_GIVEREF(((PyObject *)__pyx_v_DLE));
26635     PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, ((PyObject *)__pyx_v_DLE));
26636     __Pyx_INCREF(((PyObject *)__pyx_v_DRE));
26637     __Pyx_GIVEREF(((PyObject *)__pyx_v_DRE));
26638     PyTuple_SET_ITEM(__pyx_t_9, 4+__pyx_t_8, ((PyObject *)__pyx_v_DRE));
26639     __Pyx_INCREF(__pyx_v_c);
26640     __Pyx_GIVEREF(__pyx_v_c);
26641     PyTuple_SET_ITEM(__pyx_t_9, 5+__pyx_t_8, __pyx_v_c);
26642     __pyx_t_2 = 0;
26643     __pyx_t_3 = 0;
26644     __pyx_t_6 = 0;
26645     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1008, __pyx_L1_error)
26646     __Pyx_GOTREF(__pyx_t_4);
26647     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
26648   }
26649   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26650   __pyx_r = __pyx_t_4;
26651   __pyx_t_4 = 0;
26652   goto __pyx_L0;
26653 
26654   /* "yt/utilities/lib/geometry_utils.pyx":1003
26655  * @cython.boundscheck(False)
26656  * @cython.wraparound(False)
26657  * def solution_radius(np.ndarray[np.float64_t, ndim=2] P, int k, np.uint64_t i,             # <<<<<<<<<<<<<<
26658  *                     np.ndarray[np.uint64_t, ndim=1] idx, int order,
26659  *                     np.ndarray[np.float64_t, ndim=1] DLE,
26660  */
26661 
26662   /* function exit code */
26663   __pyx_L1_error:;
26664   __Pyx_XDECREF(__pyx_t_1);
26665   __Pyx_XDECREF(__pyx_t_2);
26666   __Pyx_XDECREF(__pyx_t_3);
26667   __Pyx_XDECREF(__pyx_t_4);
26668   __Pyx_XDECREF(__pyx_t_6);
26669   __Pyx_XDECREF(__pyx_t_7);
26670   __Pyx_XDECREF(__pyx_t_9);
26671   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
26672     __Pyx_PyThreadState_declare
26673     __Pyx_PyThreadState_assign
26674     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
26675     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_DLE.rcbuffer->pybuffer);
26676     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_DRE.rcbuffer->pybuffer);
26677     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_P.rcbuffer->pybuffer);
26678     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx.rcbuffer->pybuffer);
26679   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
26680   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.solution_radius", __pyx_clineno, __pyx_lineno, __pyx_filename);
26681   __pyx_r = NULL;
26682   goto __pyx_L2;
26683   __pyx_L0:;
26684   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_DLE.rcbuffer->pybuffer);
26685   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_DRE.rcbuffer->pybuffer);
26686   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_P.rcbuffer->pybuffer);
26687   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx.rcbuffer->pybuffer);
26688   __pyx_L2:;
26689   __Pyx_XDECREF(__pyx_v_c);
26690   __Pyx_XGIVEREF(__pyx_r);
26691   __Pyx_RefNannyFinishContext();
26692   return __pyx_r;
26693 }
26694 
26695 /* "yt/utilities/lib/geometry_utils.pyx":1013
26696  * @cython.boundscheck(False)
26697  * @cython.wraparound(False)
26698  * def knn_direct(np.ndarray[np.float64_t, ndim=2] P, np.uint64_t k, np.uint64_t i,             # <<<<<<<<<<<<<<
26699  *                np.ndarray[np.uint64_t, ndim=1] idx, return_dist = False,
26700  *                return_rad = False):
26701  */
26702 
26703 /* Python wrapper */
26704 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_67knn_direct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
26705 static char __pyx_doc_2yt_9utilities_3lib_14geometry_utils_66knn_direct[] = "Directly compute the k nearest neighbors by sorting on distance.\n\n    Args:\n        P (np.ndarray): (N,d) array of points to search sorted by Morton order.\n        k (int): number of nearest neighbors to find.\n        i (int): index of point that nearest neighbors should be found for.\n        idx (np.ndarray): indicies of points from P to be considered.\n        return_dist (Optional[bool]): If True, distances to the k nearest\n            neighbors are also returned (in order of proximity).\n            (default = False)\n        return_rad (Optional[bool]): If True, distance to farthest nearest\n            neighbor is also returned. This is set to False if return_dist is\n            True. (default = False)\n\n    Returns:\n        np.ndarray: Indicies of k nearest neighbors to point i.\n\n    ";
26706 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_67knn_direct = {"knn_direct", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_67knn_direct, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2yt_9utilities_3lib_14geometry_utils_66knn_direct};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_67knn_direct(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)26707 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_67knn_direct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
26708   PyArrayObject *__pyx_v_P = 0;
26709   __pyx_t_5numpy_uint64_t __pyx_v_k;
26710   __pyx_t_5numpy_uint64_t __pyx_v_i;
26711   PyArrayObject *__pyx_v_idx = 0;
26712   PyObject *__pyx_v_return_dist = 0;
26713   PyObject *__pyx_v_return_rad = 0;
26714   PyObject *__pyx_r = 0;
26715   __Pyx_RefNannyDeclarations
26716   __Pyx_RefNannySetupContext("knn_direct (wrapper)", 0);
26717   {
26718     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_P,&__pyx_n_s_k,&__pyx_n_s_i,&__pyx_n_s_idx,&__pyx_n_s_return_dist,&__pyx_n_s_return_rad,0};
26719     PyObject* values[6] = {0,0,0,0,0,0};
26720 
26721     /* "yt/utilities/lib/geometry_utils.pyx":1014
26722  * @cython.wraparound(False)
26723  * def knn_direct(np.ndarray[np.float64_t, ndim=2] P, np.uint64_t k, np.uint64_t i,
26724  *                np.ndarray[np.uint64_t, ndim=1] idx, return_dist = False,             # <<<<<<<<<<<<<<
26725  *                return_rad = False):
26726  *     """Directly compute the k nearest neighbors by sorting on distance.
26727  */
26728     values[4] = ((PyObject *)Py_False);
26729 
26730     /* "yt/utilities/lib/geometry_utils.pyx":1015
26731  * def knn_direct(np.ndarray[np.float64_t, ndim=2] P, np.uint64_t k, np.uint64_t i,
26732  *                np.ndarray[np.uint64_t, ndim=1] idx, return_dist = False,
26733  *                return_rad = False):             # <<<<<<<<<<<<<<
26734  *     """Directly compute the k nearest neighbors by sorting on distance.
26735  *
26736  */
26737     values[5] = ((PyObject *)Py_False);
26738     if (unlikely(__pyx_kwds)) {
26739       Py_ssize_t kw_args;
26740       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
26741       switch (pos_args) {
26742         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
26743         CYTHON_FALLTHROUGH;
26744         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
26745         CYTHON_FALLTHROUGH;
26746         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
26747         CYTHON_FALLTHROUGH;
26748         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
26749         CYTHON_FALLTHROUGH;
26750         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
26751         CYTHON_FALLTHROUGH;
26752         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
26753         CYTHON_FALLTHROUGH;
26754         case  0: break;
26755         default: goto __pyx_L5_argtuple_error;
26756       }
26757       kw_args = PyDict_Size(__pyx_kwds);
26758       switch (pos_args) {
26759         case  0:
26760         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_P)) != 0)) kw_args--;
26761         else goto __pyx_L5_argtuple_error;
26762         CYTHON_FALLTHROUGH;
26763         case  1:
26764         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k)) != 0)) kw_args--;
26765         else {
26766           __Pyx_RaiseArgtupleInvalid("knn_direct", 0, 4, 6, 1); __PYX_ERR(1, 1013, __pyx_L3_error)
26767         }
26768         CYTHON_FALLTHROUGH;
26769         case  2:
26770         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_i)) != 0)) kw_args--;
26771         else {
26772           __Pyx_RaiseArgtupleInvalid("knn_direct", 0, 4, 6, 2); __PYX_ERR(1, 1013, __pyx_L3_error)
26773         }
26774         CYTHON_FALLTHROUGH;
26775         case  3:
26776         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_idx)) != 0)) kw_args--;
26777         else {
26778           __Pyx_RaiseArgtupleInvalid("knn_direct", 0, 4, 6, 3); __PYX_ERR(1, 1013, __pyx_L3_error)
26779         }
26780         CYTHON_FALLTHROUGH;
26781         case  4:
26782         if (kw_args > 0) {
26783           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_return_dist);
26784           if (value) { values[4] = value; kw_args--; }
26785         }
26786         CYTHON_FALLTHROUGH;
26787         case  5:
26788         if (kw_args > 0) {
26789           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_return_rad);
26790           if (value) { values[5] = value; kw_args--; }
26791         }
26792       }
26793       if (unlikely(kw_args > 0)) {
26794         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "knn_direct") < 0)) __PYX_ERR(1, 1013, __pyx_L3_error)
26795       }
26796     } else {
26797       switch (PyTuple_GET_SIZE(__pyx_args)) {
26798         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
26799         CYTHON_FALLTHROUGH;
26800         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
26801         CYTHON_FALLTHROUGH;
26802         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
26803         values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
26804         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
26805         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
26806         break;
26807         default: goto __pyx_L5_argtuple_error;
26808       }
26809     }
26810     __pyx_v_P = ((PyArrayObject *)values[0]);
26811     __pyx_v_k = __Pyx_PyInt_As_npy_uint64(values[1]); if (unlikely((__pyx_v_k == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 1013, __pyx_L3_error)
26812     __pyx_v_i = __Pyx_PyInt_As_npy_uint64(values[2]); if (unlikely((__pyx_v_i == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 1013, __pyx_L3_error)
26813     __pyx_v_idx = ((PyArrayObject *)values[3]);
26814     __pyx_v_return_dist = values[4];
26815     __pyx_v_return_rad = values[5];
26816   }
26817   goto __pyx_L4_argument_unpacking_done;
26818   __pyx_L5_argtuple_error:;
26819   __Pyx_RaiseArgtupleInvalid("knn_direct", 0, 4, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1013, __pyx_L3_error)
26820   __pyx_L3_error:;
26821   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.knn_direct", __pyx_clineno, __pyx_lineno, __pyx_filename);
26822   __Pyx_RefNannyFinishContext();
26823   return NULL;
26824   __pyx_L4_argument_unpacking_done:;
26825   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_P), __pyx_ptype_5numpy_ndarray, 1, "P", 0))) __PYX_ERR(1, 1013, __pyx_L1_error)
26826   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idx), __pyx_ptype_5numpy_ndarray, 1, "idx", 0))) __PYX_ERR(1, 1014, __pyx_L1_error)
26827   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_66knn_direct(__pyx_self, __pyx_v_P, __pyx_v_k, __pyx_v_i, __pyx_v_idx, __pyx_v_return_dist, __pyx_v_return_rad);
26828 
26829   /* "yt/utilities/lib/geometry_utils.pyx":1013
26830  * @cython.boundscheck(False)
26831  * @cython.wraparound(False)
26832  * def knn_direct(np.ndarray[np.float64_t, ndim=2] P, np.uint64_t k, np.uint64_t i,             # <<<<<<<<<<<<<<
26833  *                np.ndarray[np.uint64_t, ndim=1] idx, return_dist = False,
26834  *                return_rad = False):
26835  */
26836 
26837   /* function exit code */
26838   goto __pyx_L0;
26839   __pyx_L1_error:;
26840   __pyx_r = NULL;
26841   __pyx_L0:;
26842   __Pyx_RefNannyFinishContext();
26843   return __pyx_r;
26844 }
26845 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_66knn_direct(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_P,__pyx_t_5numpy_uint64_t __pyx_v_k,__pyx_t_5numpy_uint64_t __pyx_v_i,PyArrayObject * __pyx_v_idx,PyObject * __pyx_v_return_dist,PyObject * __pyx_v_return_rad)26846 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_66knn_direct(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_P, __pyx_t_5numpy_uint64_t __pyx_v_k, __pyx_t_5numpy_uint64_t __pyx_v_i, PyArrayObject *__pyx_v_idx, PyObject *__pyx_v_return_dist, PyObject *__pyx_v_return_rad) {
26847   int __pyx_v_j;
26848   int __pyx_v_m;
26849   __Pyx_memviewslice __pyx_v_sort_fwd = { 0, 0, { 0 }, { 0 }, { 0 } };
26850   __Pyx_memviewslice __pyx_v_ipos = { 0, 0, { 0 }, { 0 }, { 0 } };
26851   __Pyx_memviewslice __pyx_v_jpos = { 0, 0, { 0 }, { 0 }, { 0 } };
26852   __Pyx_memviewslice __pyx_v_dist = { 0, 0, { 0 }, { 0 }, { 0 } };
26853   __Pyx_LocalBuf_ND __pyx_pybuffernd_P;
26854   __Pyx_Buffer __pyx_pybuffer_P;
26855   __Pyx_LocalBuf_ND __pyx_pybuffernd_idx;
26856   __Pyx_Buffer __pyx_pybuffer_idx;
26857   PyObject *__pyx_r = NULL;
26858   __Pyx_RefNannyDeclarations
26859   PyObject *__pyx_t_1 = NULL;
26860   PyObject *__pyx_t_2 = NULL;
26861   Py_ssize_t __pyx_t_3;
26862   PyObject *__pyx_t_4 = NULL;
26863   PyObject *__pyx_t_5 = NULL;
26864   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
26865   int __pyx_t_7;
26866   __pyx_t_5numpy_uint64_t __pyx_t_8;
26867   Py_ssize_t __pyx_t_9;
26868   Py_ssize_t __pyx_t_10;
26869   Py_ssize_t __pyx_t_11;
26870   int __pyx_t_12;
26871   Py_ssize_t __pyx_t_13;
26872   __pyx_t_5numpy_uint64_t __pyx_t_14;
26873   Py_ssize_t __pyx_t_15;
26874   Py_ssize_t __pyx_t_16;
26875   Py_ssize_t __pyx_t_17;
26876   __Pyx_memviewslice __pyx_t_18 = { 0, 0, { 0 }, { 0 }, { 0 } };
26877   int __pyx_t_19;
26878   PyObject *__pyx_t_20 = NULL;
26879   __pyx_t_5numpy_uint64_t __pyx_t_21;
26880   __Pyx_RefNannySetupContext("knn_direct", 0);
26881   __pyx_pybuffer_P.pybuffer.buf = NULL;
26882   __pyx_pybuffer_P.refcount = 0;
26883   __pyx_pybuffernd_P.data = NULL;
26884   __pyx_pybuffernd_P.rcbuffer = &__pyx_pybuffer_P;
26885   __pyx_pybuffer_idx.pybuffer.buf = NULL;
26886   __pyx_pybuffer_idx.refcount = 0;
26887   __pyx_pybuffernd_idx.data = NULL;
26888   __pyx_pybuffernd_idx.rcbuffer = &__pyx_pybuffer_idx;
26889   {
26890     __Pyx_BufFmt_StackElem __pyx_stack[1];
26891     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_P.rcbuffer->pybuffer, (PyObject*)__pyx_v_P, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(1, 1013, __pyx_L1_error)
26892   }
26893   __pyx_pybuffernd_P.diminfo[0].strides = __pyx_pybuffernd_P.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_P.diminfo[0].shape = __pyx_pybuffernd_P.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_P.diminfo[1].strides = __pyx_pybuffernd_P.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_P.diminfo[1].shape = __pyx_pybuffernd_P.rcbuffer->pybuffer.shape[1];
26894   {
26895     __Pyx_BufFmt_StackElem __pyx_stack[1];
26896     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_idx.rcbuffer->pybuffer, (PyObject*)__pyx_v_idx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 1013, __pyx_L1_error)
26897   }
26898   __pyx_pybuffernd_idx.diminfo[0].strides = __pyx_pybuffernd_idx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_idx.diminfo[0].shape = __pyx_pybuffernd_idx.rcbuffer->pybuffer.shape[0];
26899 
26900   /* "yt/utilities/lib/geometry_utils.pyx":1038
26901  *     cdef np.float64_t[:] ipos
26902  *     cdef np.float64_t[:] jpos
26903  *     cdef np.float64_t[:] dist = np.zeros(len(idx), dtype='float64')             # <<<<<<<<<<<<<<
26904  *     ipos = np.zeros(3)
26905  *     jpos = np.zeros(3)
26906  */
26907   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1038, __pyx_L1_error)
26908   __Pyx_GOTREF(__pyx_t_1);
26909   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1038, __pyx_L1_error)
26910   __Pyx_GOTREF(__pyx_t_2);
26911   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26912   __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_idx)); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 1038, __pyx_L1_error)
26913   __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1038, __pyx_L1_error)
26914   __Pyx_GOTREF(__pyx_t_1);
26915   __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1038, __pyx_L1_error)
26916   __Pyx_GOTREF(__pyx_t_4);
26917   __Pyx_GIVEREF(__pyx_t_1);
26918   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
26919   __pyx_t_1 = 0;
26920   __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1038, __pyx_L1_error)
26921   __Pyx_GOTREF(__pyx_t_1);
26922   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(1, 1038, __pyx_L1_error)
26923   __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1038, __pyx_L1_error)
26924   __Pyx_GOTREF(__pyx_t_5);
26925   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
26926   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26927   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26928   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(1, 1038, __pyx_L1_error)
26929   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
26930   __pyx_v_dist = __pyx_t_6;
26931   __pyx_t_6.memview = NULL;
26932   __pyx_t_6.data = NULL;
26933 
26934   /* "yt/utilities/lib/geometry_utils.pyx":1039
26935  *     cdef np.float64_t[:] jpos
26936  *     cdef np.float64_t[:] dist = np.zeros(len(idx), dtype='float64')
26937  *     ipos = np.zeros(3)             # <<<<<<<<<<<<<<
26938  *     jpos = np.zeros(3)
26939  *     for m in range(3):
26940  */
26941   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1039, __pyx_L1_error)
26942   __Pyx_GOTREF(__pyx_t_1);
26943   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1039, __pyx_L1_error)
26944   __Pyx_GOTREF(__pyx_t_4);
26945   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26946   __pyx_t_1 = NULL;
26947   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
26948     __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
26949     if (likely(__pyx_t_1)) {
26950       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
26951       __Pyx_INCREF(__pyx_t_1);
26952       __Pyx_INCREF(function);
26953       __Pyx_DECREF_SET(__pyx_t_4, function);
26954     }
26955   }
26956   __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_int_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_int_3);
26957   __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
26958   if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1039, __pyx_L1_error)
26959   __Pyx_GOTREF(__pyx_t_5);
26960   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26961   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(1, 1039, __pyx_L1_error)
26962   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
26963   __pyx_v_ipos = __pyx_t_6;
26964   __pyx_t_6.memview = NULL;
26965   __pyx_t_6.data = NULL;
26966 
26967   /* "yt/utilities/lib/geometry_utils.pyx":1040
26968  *     cdef np.float64_t[:] dist = np.zeros(len(idx), dtype='float64')
26969  *     ipos = np.zeros(3)
26970  *     jpos = np.zeros(3)             # <<<<<<<<<<<<<<
26971  *     for m in range(3):
26972  *         ipos[m] = P[i,m]
26973  */
26974   __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1040, __pyx_L1_error)
26975   __Pyx_GOTREF(__pyx_t_4);
26976   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1040, __pyx_L1_error)
26977   __Pyx_GOTREF(__pyx_t_1);
26978   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
26979   __pyx_t_4 = NULL;
26980   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
26981     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
26982     if (likely(__pyx_t_4)) {
26983       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
26984       __Pyx_INCREF(__pyx_t_4);
26985       __Pyx_INCREF(function);
26986       __Pyx_DECREF_SET(__pyx_t_1, function);
26987     }
26988   }
26989   __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_int_3) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_int_3);
26990   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
26991   if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1040, __pyx_L1_error)
26992   __Pyx_GOTREF(__pyx_t_5);
26993   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26994   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(1, 1040, __pyx_L1_error)
26995   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
26996   __pyx_v_jpos = __pyx_t_6;
26997   __pyx_t_6.memview = NULL;
26998   __pyx_t_6.data = NULL;
26999 
27000   /* "yt/utilities/lib/geometry_utils.pyx":1041
27001  *     ipos = np.zeros(3)
27002  *     jpos = np.zeros(3)
27003  *     for m in range(3):             # <<<<<<<<<<<<<<
27004  *         ipos[m] = P[i,m]
27005  *     for j in range(len(idx)):
27006  */
27007   for (__pyx_t_7 = 0; __pyx_t_7 < 3; __pyx_t_7+=1) {
27008     __pyx_v_m = __pyx_t_7;
27009 
27010     /* "yt/utilities/lib/geometry_utils.pyx":1042
27011  *     jpos = np.zeros(3)
27012  *     for m in range(3):
27013  *         ipos[m] = P[i,m]             # <<<<<<<<<<<<<<
27014  *     for j in range(len(idx)):
27015  *         for m in range(3):
27016  */
27017     __pyx_t_8 = __pyx_v_i;
27018     __pyx_t_9 = __pyx_v_m;
27019     __pyx_t_10 = __pyx_v_m;
27020     *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_ipos.data + __pyx_t_10 * __pyx_v_ipos.strides[0]) )) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_P.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_P.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_P.diminfo[1].strides));
27021   }
27022 
27023   /* "yt/utilities/lib/geometry_utils.pyx":1043
27024  *     for m in range(3):
27025  *         ipos[m] = P[i,m]
27026  *     for j in range(len(idx)):             # <<<<<<<<<<<<<<
27027  *         for m in range(3):
27028  *             jpos[m] = P[idx[j],m]
27029  */
27030   __pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_idx)); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 1043, __pyx_L1_error)
27031   __pyx_t_11 = __pyx_t_3;
27032   for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_11; __pyx_t_7+=1) {
27033     __pyx_v_j = __pyx_t_7;
27034 
27035     /* "yt/utilities/lib/geometry_utils.pyx":1044
27036  *         ipos[m] = P[i,m]
27037  *     for j in range(len(idx)):
27038  *         for m in range(3):             # <<<<<<<<<<<<<<
27039  *             jpos[m] = P[idx[j],m]
27040  *         dist[j] = euclidean_distance(ipos, jpos)
27041  */
27042     for (__pyx_t_12 = 0; __pyx_t_12 < 3; __pyx_t_12+=1) {
27043       __pyx_v_m = __pyx_t_12;
27044 
27045       /* "yt/utilities/lib/geometry_utils.pyx":1045
27046  *     for j in range(len(idx)):
27047  *         for m in range(3):
27048  *             jpos[m] = P[idx[j],m]             # <<<<<<<<<<<<<<
27049  *         dist[j] = euclidean_distance(ipos, jpos)
27050  *     sort_fwd = np.argsort(dist, kind='mergesort')[:k]
27051  */
27052       __pyx_t_13 = __pyx_v_j;
27053       __pyx_t_14 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_idx.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_idx.diminfo[0].strides));
27054       __pyx_t_15 = __pyx_v_m;
27055       __pyx_t_16 = __pyx_v_m;
27056       *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_jpos.data + __pyx_t_16 * __pyx_v_jpos.strides[0]) )) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_P.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_P.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_P.diminfo[1].strides));
27057     }
27058 
27059     /* "yt/utilities/lib/geometry_utils.pyx":1046
27060  *         for m in range(3):
27061  *             jpos[m] = P[idx[j],m]
27062  *         dist[j] = euclidean_distance(ipos, jpos)             # <<<<<<<<<<<<<<
27063  *     sort_fwd = np.argsort(dist, kind='mergesort')[:k]
27064  *     if return_dist:
27065  */
27066     __pyx_t_17 = __pyx_v_j;
27067     *((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_dist.data + __pyx_t_17 * __pyx_v_dist.strides[0]) )) = __pyx_f_2yt_9utilities_3lib_14geometry_utils_euclidean_distance(__pyx_v_ipos, __pyx_v_jpos);
27068   }
27069 
27070   /* "yt/utilities/lib/geometry_utils.pyx":1047
27071  *             jpos[m] = P[idx[j],m]
27072  *         dist[j] = euclidean_distance(ipos, jpos)
27073  *     sort_fwd = np.argsort(dist, kind='mergesort')[:k]             # <<<<<<<<<<<<<<
27074  *     if return_dist:
27075  *         return np.array(idx)[sort_fwd], np.array(dist)[sort_fwd]
27076  */
27077   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1047, __pyx_L1_error)
27078   __Pyx_GOTREF(__pyx_t_5);
27079   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_argsort); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1047, __pyx_L1_error)
27080   __Pyx_GOTREF(__pyx_t_1);
27081   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
27082   __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_dist, 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_5)) __PYX_ERR(1, 1047, __pyx_L1_error)
27083   __Pyx_GOTREF(__pyx_t_5);
27084   __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1047, __pyx_L1_error)
27085   __Pyx_GOTREF(__pyx_t_4);
27086   __Pyx_GIVEREF(__pyx_t_5);
27087   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
27088   __pyx_t_5 = 0;
27089   __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1047, __pyx_L1_error)
27090   __Pyx_GOTREF(__pyx_t_5);
27091   if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_kind, __pyx_n_s_mergesort) < 0) __PYX_ERR(1, 1047, __pyx_L1_error)
27092   __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1047, __pyx_L1_error)
27093   __Pyx_GOTREF(__pyx_t_2);
27094   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27095   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
27096   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
27097   __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, __pyx_v_k, NULL, NULL, NULL, 0, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1047, __pyx_L1_error)
27098   __Pyx_GOTREF(__pyx_t_5);
27099   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
27100   __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int64_t(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(1, 1047, __pyx_L1_error)
27101   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
27102   __pyx_v_sort_fwd = __pyx_t_18;
27103   __pyx_t_18.memview = NULL;
27104   __pyx_t_18.data = NULL;
27105 
27106   /* "yt/utilities/lib/geometry_utils.pyx":1048
27107  *         dist[j] = euclidean_distance(ipos, jpos)
27108  *     sort_fwd = np.argsort(dist, kind='mergesort')[:k]
27109  *     if return_dist:             # <<<<<<<<<<<<<<
27110  *         return np.array(idx)[sort_fwd], np.array(dist)[sort_fwd]
27111  *     elif return_rad:
27112  */
27113   __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_v_return_dist); if (unlikely(__pyx_t_19 < 0)) __PYX_ERR(1, 1048, __pyx_L1_error)
27114   if (__pyx_t_19) {
27115 
27116     /* "yt/utilities/lib/geometry_utils.pyx":1049
27117  *     sort_fwd = np.argsort(dist, kind='mergesort')[:k]
27118  *     if return_dist:
27119  *         return np.array(idx)[sort_fwd], np.array(dist)[sort_fwd]             # <<<<<<<<<<<<<<
27120  *     elif return_rad:
27121  *         return np.array(idx)[sort_fwd], np.array(dist)[sort_fwd][k-1]
27122  */
27123     __Pyx_XDECREF(__pyx_r);
27124     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1049, __pyx_L1_error)
27125     __Pyx_GOTREF(__pyx_t_2);
27126     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1049, __pyx_L1_error)
27127     __Pyx_GOTREF(__pyx_t_4);
27128     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
27129     __pyx_t_2 = NULL;
27130     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
27131       __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
27132       if (likely(__pyx_t_2)) {
27133         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
27134         __Pyx_INCREF(__pyx_t_2);
27135         __Pyx_INCREF(function);
27136         __Pyx_DECREF_SET(__pyx_t_4, function);
27137       }
27138     }
27139     __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, ((PyObject *)__pyx_v_idx)) : __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_v_idx));
27140     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
27141     if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1049, __pyx_L1_error)
27142     __Pyx_GOTREF(__pyx_t_5);
27143     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
27144     __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_sort_fwd, 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_4)) __PYX_ERR(1, 1049, __pyx_L1_error)
27145     __Pyx_GOTREF(__pyx_t_4);
27146     __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1049, __pyx_L1_error)
27147     __Pyx_GOTREF(__pyx_t_2);
27148     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
27149     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
27150     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1049, __pyx_L1_error)
27151     __Pyx_GOTREF(__pyx_t_5);
27152     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1049, __pyx_L1_error)
27153     __Pyx_GOTREF(__pyx_t_1);
27154     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
27155     __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_dist, 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_5)) __PYX_ERR(1, 1049, __pyx_L1_error)
27156     __Pyx_GOTREF(__pyx_t_5);
27157     __pyx_t_20 = NULL;
27158     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
27159       __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_1);
27160       if (likely(__pyx_t_20)) {
27161         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
27162         __Pyx_INCREF(__pyx_t_20);
27163         __Pyx_INCREF(function);
27164         __Pyx_DECREF_SET(__pyx_t_1, function);
27165       }
27166     }
27167     __pyx_t_4 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_20, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5);
27168     __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
27169     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
27170     if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1049, __pyx_L1_error)
27171     __Pyx_GOTREF(__pyx_t_4);
27172     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27173     __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_sort_fwd, 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_1)) __PYX_ERR(1, 1049, __pyx_L1_error)
27174     __Pyx_GOTREF(__pyx_t_1);
27175     __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1049, __pyx_L1_error)
27176     __Pyx_GOTREF(__pyx_t_5);
27177     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
27178     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27179     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1049, __pyx_L1_error)
27180     __Pyx_GOTREF(__pyx_t_1);
27181     __Pyx_GIVEREF(__pyx_t_2);
27182     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
27183     __Pyx_GIVEREF(__pyx_t_5);
27184     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
27185     __pyx_t_2 = 0;
27186     __pyx_t_5 = 0;
27187     __pyx_r = __pyx_t_1;
27188     __pyx_t_1 = 0;
27189     goto __pyx_L0;
27190 
27191     /* "yt/utilities/lib/geometry_utils.pyx":1048
27192  *         dist[j] = euclidean_distance(ipos, jpos)
27193  *     sort_fwd = np.argsort(dist, kind='mergesort')[:k]
27194  *     if return_dist:             # <<<<<<<<<<<<<<
27195  *         return np.array(idx)[sort_fwd], np.array(dist)[sort_fwd]
27196  *     elif return_rad:
27197  */
27198   }
27199 
27200   /* "yt/utilities/lib/geometry_utils.pyx":1050
27201  *     if return_dist:
27202  *         return np.array(idx)[sort_fwd], np.array(dist)[sort_fwd]
27203  *     elif return_rad:             # <<<<<<<<<<<<<<
27204  *         return np.array(idx)[sort_fwd], np.array(dist)[sort_fwd][k-1]
27205  *     else:
27206  */
27207   __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_v_return_rad); if (unlikely(__pyx_t_19 < 0)) __PYX_ERR(1, 1050, __pyx_L1_error)
27208   if (__pyx_t_19) {
27209 
27210     /* "yt/utilities/lib/geometry_utils.pyx":1051
27211  *         return np.array(idx)[sort_fwd], np.array(dist)[sort_fwd]
27212  *     elif return_rad:
27213  *         return np.array(idx)[sort_fwd], np.array(dist)[sort_fwd][k-1]             # <<<<<<<<<<<<<<
27214  *     else:
27215  *         return np.array(idx)[sort_fwd]
27216  */
27217     __Pyx_XDECREF(__pyx_r);
27218     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1051, __pyx_L1_error)
27219     __Pyx_GOTREF(__pyx_t_5);
27220     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1051, __pyx_L1_error)
27221     __Pyx_GOTREF(__pyx_t_2);
27222     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
27223     __pyx_t_5 = NULL;
27224     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
27225       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
27226       if (likely(__pyx_t_5)) {
27227         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
27228         __Pyx_INCREF(__pyx_t_5);
27229         __Pyx_INCREF(function);
27230         __Pyx_DECREF_SET(__pyx_t_2, function);
27231       }
27232     }
27233     __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, ((PyObject *)__pyx_v_idx)) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_idx));
27234     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
27235     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1051, __pyx_L1_error)
27236     __Pyx_GOTREF(__pyx_t_1);
27237     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
27238     __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_sort_fwd, 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_2)) __PYX_ERR(1, 1051, __pyx_L1_error)
27239     __Pyx_GOTREF(__pyx_t_2);
27240     __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1051, __pyx_L1_error)
27241     __Pyx_GOTREF(__pyx_t_5);
27242     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27243     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
27244     __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1051, __pyx_L1_error)
27245     __Pyx_GOTREF(__pyx_t_1);
27246     __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1051, __pyx_L1_error)
27247     __Pyx_GOTREF(__pyx_t_4);
27248     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27249     __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_dist, 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_1)) __PYX_ERR(1, 1051, __pyx_L1_error)
27250     __Pyx_GOTREF(__pyx_t_1);
27251     __pyx_t_20 = NULL;
27252     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
27253       __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_4);
27254       if (likely(__pyx_t_20)) {
27255         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
27256         __Pyx_INCREF(__pyx_t_20);
27257         __Pyx_INCREF(function);
27258         __Pyx_DECREF_SET(__pyx_t_4, function);
27259       }
27260     }
27261     __pyx_t_2 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_20, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1);
27262     __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
27263     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27264     if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1051, __pyx_L1_error)
27265     __Pyx_GOTREF(__pyx_t_2);
27266     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
27267     __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_sort_fwd, 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_4)) __PYX_ERR(1, 1051, __pyx_L1_error)
27268     __Pyx_GOTREF(__pyx_t_4);
27269     __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1051, __pyx_L1_error)
27270     __Pyx_GOTREF(__pyx_t_1);
27271     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
27272     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
27273     __pyx_t_21 = (__pyx_v_k - 1);
27274     __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, __pyx_t_21, __pyx_t_5numpy_uint64_t, 0, __Pyx_PyInt_From_npy_uint64, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1051, __pyx_L1_error)
27275     __Pyx_GOTREF(__pyx_t_4);
27276     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27277     __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1051, __pyx_L1_error)
27278     __Pyx_GOTREF(__pyx_t_1);
27279     __Pyx_GIVEREF(__pyx_t_5);
27280     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
27281     __Pyx_GIVEREF(__pyx_t_4);
27282     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
27283     __pyx_t_5 = 0;
27284     __pyx_t_4 = 0;
27285     __pyx_r = __pyx_t_1;
27286     __pyx_t_1 = 0;
27287     goto __pyx_L0;
27288 
27289     /* "yt/utilities/lib/geometry_utils.pyx":1050
27290  *     if return_dist:
27291  *         return np.array(idx)[sort_fwd], np.array(dist)[sort_fwd]
27292  *     elif return_rad:             # <<<<<<<<<<<<<<
27293  *         return np.array(idx)[sort_fwd], np.array(dist)[sort_fwd][k-1]
27294  *     else:
27295  */
27296   }
27297 
27298   /* "yt/utilities/lib/geometry_utils.pyx":1053
27299  *         return np.array(idx)[sort_fwd], np.array(dist)[sort_fwd][k-1]
27300  *     else:
27301  *         return np.array(idx)[sort_fwd]             # <<<<<<<<<<<<<<
27302  *
27303  * @cython.boundscheck(False)
27304  */
27305   /*else*/ {
27306     __Pyx_XDECREF(__pyx_r);
27307     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1053, __pyx_L1_error)
27308     __Pyx_GOTREF(__pyx_t_4);
27309     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1053, __pyx_L1_error)
27310     __Pyx_GOTREF(__pyx_t_5);
27311     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
27312     __pyx_t_4 = NULL;
27313     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
27314       __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
27315       if (likely(__pyx_t_4)) {
27316         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
27317         __Pyx_INCREF(__pyx_t_4);
27318         __Pyx_INCREF(function);
27319         __Pyx_DECREF_SET(__pyx_t_5, function);
27320       }
27321     }
27322     __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, ((PyObject *)__pyx_v_idx)) : __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_idx));
27323     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
27324     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1053, __pyx_L1_error)
27325     __Pyx_GOTREF(__pyx_t_1);
27326     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
27327     __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_sort_fwd, 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_5)) __PYX_ERR(1, 1053, __pyx_L1_error)
27328     __Pyx_GOTREF(__pyx_t_5);
27329     __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1053, __pyx_L1_error)
27330     __Pyx_GOTREF(__pyx_t_4);
27331     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27332     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
27333     __pyx_r = __pyx_t_4;
27334     __pyx_t_4 = 0;
27335     goto __pyx_L0;
27336   }
27337 
27338   /* "yt/utilities/lib/geometry_utils.pyx":1013
27339  * @cython.boundscheck(False)
27340  * @cython.wraparound(False)
27341  * def knn_direct(np.ndarray[np.float64_t, ndim=2] P, np.uint64_t k, np.uint64_t i,             # <<<<<<<<<<<<<<
27342  *                np.ndarray[np.uint64_t, ndim=1] idx, return_dist = False,
27343  *                return_rad = False):
27344  */
27345 
27346   /* function exit code */
27347   __pyx_L1_error:;
27348   __Pyx_XDECREF(__pyx_t_1);
27349   __Pyx_XDECREF(__pyx_t_2);
27350   __Pyx_XDECREF(__pyx_t_4);
27351   __Pyx_XDECREF(__pyx_t_5);
27352   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
27353   __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
27354   __Pyx_XDECREF(__pyx_t_20);
27355   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
27356     __Pyx_PyThreadState_declare
27357     __Pyx_PyThreadState_assign
27358     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
27359     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_P.rcbuffer->pybuffer);
27360     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx.rcbuffer->pybuffer);
27361   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
27362   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.knn_direct", __pyx_clineno, __pyx_lineno, __pyx_filename);
27363   __pyx_r = NULL;
27364   goto __pyx_L2;
27365   __pyx_L0:;
27366   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_P.rcbuffer->pybuffer);
27367   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx.rcbuffer->pybuffer);
27368   __pyx_L2:;
27369   __PYX_XDEC_MEMVIEW(&__pyx_v_sort_fwd, 1);
27370   __PYX_XDEC_MEMVIEW(&__pyx_v_ipos, 1);
27371   __PYX_XDEC_MEMVIEW(&__pyx_v_jpos, 1);
27372   __PYX_XDEC_MEMVIEW(&__pyx_v_dist, 1);
27373   __Pyx_XGIVEREF(__pyx_r);
27374   __Pyx_RefNannyFinishContext();
27375   return __pyx_r;
27376 }
27377 
27378 /* "yt/utilities/lib/geometry_utils.pyx":1058
27379  * @cython.wraparound(False)
27380  * @cython.cdivision(True)
27381  * def quadtree_box(np.ndarray[np.float64_t, ndim=1] p,             # <<<<<<<<<<<<<<
27382  *                  np.ndarray[np.float64_t, ndim=1] q, int order,
27383  *                  np.ndarray[np.float64_t, ndim=1] DLE,
27384  */
27385 
27386 /* Python wrapper */
27387 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_69quadtree_box(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
27388 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_69quadtree_box = {"quadtree_box", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_69quadtree_box, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_69quadtree_box(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)27389 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_69quadtree_box(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
27390   PyArrayObject *__pyx_v_p = 0;
27391   PyArrayObject *__pyx_v_q = 0;
27392   int __pyx_v_order;
27393   PyArrayObject *__pyx_v_DLE = 0;
27394   PyArrayObject *__pyx_v_DRE = 0;
27395   PyArrayObject *__pyx_v_c = 0;
27396   PyObject *__pyx_r = 0;
27397   __Pyx_RefNannyDeclarations
27398   __Pyx_RefNannySetupContext("quadtree_box (wrapper)", 0);
27399   {
27400     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_q,&__pyx_n_s_order,&__pyx_n_s_DLE,&__pyx_n_s_DRE,&__pyx_n_s_c,0};
27401     PyObject* values[6] = {0,0,0,0,0,0};
27402     if (unlikely(__pyx_kwds)) {
27403       Py_ssize_t kw_args;
27404       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
27405       switch (pos_args) {
27406         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
27407         CYTHON_FALLTHROUGH;
27408         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
27409         CYTHON_FALLTHROUGH;
27410         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
27411         CYTHON_FALLTHROUGH;
27412         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
27413         CYTHON_FALLTHROUGH;
27414         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
27415         CYTHON_FALLTHROUGH;
27416         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
27417         CYTHON_FALLTHROUGH;
27418         case  0: break;
27419         default: goto __pyx_L5_argtuple_error;
27420       }
27421       kw_args = PyDict_Size(__pyx_kwds);
27422       switch (pos_args) {
27423         case  0:
27424         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
27425         else goto __pyx_L5_argtuple_error;
27426         CYTHON_FALLTHROUGH;
27427         case  1:
27428         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q)) != 0)) kw_args--;
27429         else {
27430           __Pyx_RaiseArgtupleInvalid("quadtree_box", 1, 6, 6, 1); __PYX_ERR(1, 1058, __pyx_L3_error)
27431         }
27432         CYTHON_FALLTHROUGH;
27433         case  2:
27434         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_order)) != 0)) kw_args--;
27435         else {
27436           __Pyx_RaiseArgtupleInvalid("quadtree_box", 1, 6, 6, 2); __PYX_ERR(1, 1058, __pyx_L3_error)
27437         }
27438         CYTHON_FALLTHROUGH;
27439         case  3:
27440         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_DLE)) != 0)) kw_args--;
27441         else {
27442           __Pyx_RaiseArgtupleInvalid("quadtree_box", 1, 6, 6, 3); __PYX_ERR(1, 1058, __pyx_L3_error)
27443         }
27444         CYTHON_FALLTHROUGH;
27445         case  4:
27446         if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_DRE)) != 0)) kw_args--;
27447         else {
27448           __Pyx_RaiseArgtupleInvalid("quadtree_box", 1, 6, 6, 4); __PYX_ERR(1, 1058, __pyx_L3_error)
27449         }
27450         CYTHON_FALLTHROUGH;
27451         case  5:
27452         if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_c)) != 0)) kw_args--;
27453         else {
27454           __Pyx_RaiseArgtupleInvalid("quadtree_box", 1, 6, 6, 5); __PYX_ERR(1, 1058, __pyx_L3_error)
27455         }
27456       }
27457       if (unlikely(kw_args > 0)) {
27458         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "quadtree_box") < 0)) __PYX_ERR(1, 1058, __pyx_L3_error)
27459       }
27460     } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
27461       goto __pyx_L5_argtuple_error;
27462     } else {
27463       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
27464       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
27465       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
27466       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
27467       values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
27468       values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
27469     }
27470     __pyx_v_p = ((PyArrayObject *)values[0]);
27471     __pyx_v_q = ((PyArrayObject *)values[1]);
27472     __pyx_v_order = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1059, __pyx_L3_error)
27473     __pyx_v_DLE = ((PyArrayObject *)values[3]);
27474     __pyx_v_DRE = ((PyArrayObject *)values[4]);
27475     __pyx_v_c = ((PyArrayObject *)values[5]);
27476   }
27477   goto __pyx_L4_argument_unpacking_done;
27478   __pyx_L5_argtuple_error:;
27479   __Pyx_RaiseArgtupleInvalid("quadtree_box", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1058, __pyx_L3_error)
27480   __pyx_L3_error:;
27481   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.quadtree_box", __pyx_clineno, __pyx_lineno, __pyx_filename);
27482   __Pyx_RefNannyFinishContext();
27483   return NULL;
27484   __pyx_L4_argument_unpacking_done:;
27485   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_p), __pyx_ptype_5numpy_ndarray, 1, "p", 0))) __PYX_ERR(1, 1058, __pyx_L1_error)
27486   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q), __pyx_ptype_5numpy_ndarray, 1, "q", 0))) __PYX_ERR(1, 1059, __pyx_L1_error)
27487   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_DLE), __pyx_ptype_5numpy_ndarray, 1, "DLE", 0))) __PYX_ERR(1, 1060, __pyx_L1_error)
27488   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_DRE), __pyx_ptype_5numpy_ndarray, 1, "DRE", 0))) __PYX_ERR(1, 1061, __pyx_L1_error)
27489   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_c), __pyx_ptype_5numpy_ndarray, 1, "c", 0))) __PYX_ERR(1, 1062, __pyx_L1_error)
27490   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_68quadtree_box(__pyx_self, __pyx_v_p, __pyx_v_q, __pyx_v_order, __pyx_v_DLE, __pyx_v_DRE, __pyx_v_c);
27491 
27492   /* function exit code */
27493   goto __pyx_L0;
27494   __pyx_L1_error:;
27495   __pyx_r = NULL;
27496   __pyx_L0:;
27497   __Pyx_RefNannyFinishContext();
27498   return __pyx_r;
27499 }
27500 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_68quadtree_box(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_p,PyArrayObject * __pyx_v_q,int __pyx_v_order,PyArrayObject * __pyx_v_DLE,PyArrayObject * __pyx_v_DRE,PyArrayObject * __pyx_v_c)27501 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_68quadtree_box(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_p, PyArrayObject *__pyx_v_q, int __pyx_v_order, PyArrayObject *__pyx_v_DLE, PyArrayObject *__pyx_v_DRE, PyArrayObject *__pyx_v_c) {
27502   int __pyx_v_j;
27503   __pyx_t_5numpy_float64_t __pyx_v_ppos[3];
27504   __pyx_t_5numpy_float64_t __pyx_v_qpos[3];
27505   __pyx_t_5numpy_float64_t __pyx_v_rbox;
27506   __pyx_t_5numpy_float64_t __pyx_v_cbox[3];
27507   __pyx_t_5numpy_float64_t __pyx_v_DLE1[3];
27508   __pyx_t_5numpy_float64_t __pyx_v_DRE1[3];
27509   __Pyx_LocalBuf_ND __pyx_pybuffernd_DLE;
27510   __Pyx_Buffer __pyx_pybuffer_DLE;
27511   __Pyx_LocalBuf_ND __pyx_pybuffernd_DRE;
27512   __Pyx_Buffer __pyx_pybuffer_DRE;
27513   __Pyx_LocalBuf_ND __pyx_pybuffernd_c;
27514   __Pyx_Buffer __pyx_pybuffer_c;
27515   __Pyx_LocalBuf_ND __pyx_pybuffernd_p;
27516   __Pyx_Buffer __pyx_pybuffer_p;
27517   __Pyx_LocalBuf_ND __pyx_pybuffernd_q;
27518   __Pyx_Buffer __pyx_pybuffer_q;
27519   PyObject *__pyx_r = NULL;
27520   __Pyx_RefNannyDeclarations
27521   int __pyx_t_1;
27522   Py_ssize_t __pyx_t_2;
27523   Py_ssize_t __pyx_t_3;
27524   Py_ssize_t __pyx_t_4;
27525   Py_ssize_t __pyx_t_5;
27526   Py_ssize_t __pyx_t_6;
27527   PyObject *__pyx_t_7 = NULL;
27528   __Pyx_RefNannySetupContext("quadtree_box", 0);
27529   __pyx_pybuffer_p.pybuffer.buf = NULL;
27530   __pyx_pybuffer_p.refcount = 0;
27531   __pyx_pybuffernd_p.data = NULL;
27532   __pyx_pybuffernd_p.rcbuffer = &__pyx_pybuffer_p;
27533   __pyx_pybuffer_q.pybuffer.buf = NULL;
27534   __pyx_pybuffer_q.refcount = 0;
27535   __pyx_pybuffernd_q.data = NULL;
27536   __pyx_pybuffernd_q.rcbuffer = &__pyx_pybuffer_q;
27537   __pyx_pybuffer_DLE.pybuffer.buf = NULL;
27538   __pyx_pybuffer_DLE.refcount = 0;
27539   __pyx_pybuffernd_DLE.data = NULL;
27540   __pyx_pybuffernd_DLE.rcbuffer = &__pyx_pybuffer_DLE;
27541   __pyx_pybuffer_DRE.pybuffer.buf = NULL;
27542   __pyx_pybuffer_DRE.refcount = 0;
27543   __pyx_pybuffernd_DRE.data = NULL;
27544   __pyx_pybuffernd_DRE.rcbuffer = &__pyx_pybuffer_DRE;
27545   __pyx_pybuffer_c.pybuffer.buf = NULL;
27546   __pyx_pybuffer_c.refcount = 0;
27547   __pyx_pybuffernd_c.data = NULL;
27548   __pyx_pybuffernd_c.rcbuffer = &__pyx_pybuffer_c;
27549   {
27550     __Pyx_BufFmt_StackElem __pyx_stack[1];
27551     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_p.rcbuffer->pybuffer, (PyObject*)__pyx_v_p, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 1058, __pyx_L1_error)
27552   }
27553   __pyx_pybuffernd_p.diminfo[0].strides = __pyx_pybuffernd_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_p.diminfo[0].shape = __pyx_pybuffernd_p.rcbuffer->pybuffer.shape[0];
27554   {
27555     __Pyx_BufFmt_StackElem __pyx_stack[1];
27556     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q.rcbuffer->pybuffer, (PyObject*)__pyx_v_q, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 1058, __pyx_L1_error)
27557   }
27558   __pyx_pybuffernd_q.diminfo[0].strides = __pyx_pybuffernd_q.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q.diminfo[0].shape = __pyx_pybuffernd_q.rcbuffer->pybuffer.shape[0];
27559   {
27560     __Pyx_BufFmt_StackElem __pyx_stack[1];
27561     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_DLE.rcbuffer->pybuffer, (PyObject*)__pyx_v_DLE, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 1058, __pyx_L1_error)
27562   }
27563   __pyx_pybuffernd_DLE.diminfo[0].strides = __pyx_pybuffernd_DLE.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_DLE.diminfo[0].shape = __pyx_pybuffernd_DLE.rcbuffer->pybuffer.shape[0];
27564   {
27565     __Pyx_BufFmt_StackElem __pyx_stack[1];
27566     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_DRE.rcbuffer->pybuffer, (PyObject*)__pyx_v_DRE, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 1058, __pyx_L1_error)
27567   }
27568   __pyx_pybuffernd_DRE.diminfo[0].strides = __pyx_pybuffernd_DRE.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_DRE.diminfo[0].shape = __pyx_pybuffernd_DRE.rcbuffer->pybuffer.shape[0];
27569   {
27570     __Pyx_BufFmt_StackElem __pyx_stack[1];
27571     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_c.rcbuffer->pybuffer, (PyObject*)__pyx_v_c, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 1058, __pyx_L1_error)
27572   }
27573   __pyx_pybuffernd_c.diminfo[0].strides = __pyx_pybuffernd_c.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_c.diminfo[0].shape = __pyx_pybuffernd_c.rcbuffer->pybuffer.shape[0];
27574 
27575   /* "yt/utilities/lib/geometry_utils.pyx":1071
27576  *     cdef np.float64_t DLE1[3]
27577  *     cdef np.float64_t DRE1[3]
27578  *     for j in range(3):             # <<<<<<<<<<<<<<
27579  *         ppos[j] = p[j]
27580  *         qpos[j] = q[j]
27581  */
27582   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
27583     __pyx_v_j = __pyx_t_1;
27584 
27585     /* "yt/utilities/lib/geometry_utils.pyx":1072
27586  *     cdef np.float64_t DRE1[3]
27587  *     for j in range(3):
27588  *         ppos[j] = p[j]             # <<<<<<<<<<<<<<
27589  *         qpos[j] = q[j]
27590  *         DLE1[j] = DLE[j]
27591  */
27592     __pyx_t_2 = __pyx_v_j;
27593     (__pyx_v_ppos[__pyx_v_j]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_p.rcbuffer->pybuffer.buf, __pyx_t_2, __pyx_pybuffernd_p.diminfo[0].strides));
27594 
27595     /* "yt/utilities/lib/geometry_utils.pyx":1073
27596  *     for j in range(3):
27597  *         ppos[j] = p[j]
27598  *         qpos[j] = q[j]             # <<<<<<<<<<<<<<
27599  *         DLE1[j] = DLE[j]
27600  *         DRE1[j] = DRE[j]
27601  */
27602     __pyx_t_3 = __pyx_v_j;
27603     (__pyx_v_qpos[__pyx_v_j]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_q.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_q.diminfo[0].strides));
27604 
27605     /* "yt/utilities/lib/geometry_utils.pyx":1074
27606  *         ppos[j] = p[j]
27607  *         qpos[j] = q[j]
27608  *         DLE1[j] = DLE[j]             # <<<<<<<<<<<<<<
27609  *         DRE1[j] = DRE[j]
27610  *     # Get smallest box containing p & q
27611  */
27612     __pyx_t_4 = __pyx_v_j;
27613     (__pyx_v_DLE1[__pyx_v_j]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_DLE.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_DLE.diminfo[0].strides));
27614 
27615     /* "yt/utilities/lib/geometry_utils.pyx":1075
27616  *         qpos[j] = q[j]
27617  *         DLE1[j] = DLE[j]
27618  *         DRE1[j] = DRE[j]             # <<<<<<<<<<<<<<
27619  *     # Get smallest box containing p & q
27620  *     rbox = smallest_quadtree_box(ppos,qpos,order,DLE1,DRE1,
27621  */
27622     __pyx_t_5 = __pyx_v_j;
27623     (__pyx_v_DRE1[__pyx_v_j]) = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_DRE.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_DRE.diminfo[0].strides));
27624   }
27625 
27626   /* "yt/utilities/lib/geometry_utils.pyx":1077
27627  *         DRE1[j] = DRE[j]
27628  *     # Get smallest box containing p & q
27629  *     rbox = smallest_quadtree_box(ppos,qpos,order,DLE1,DRE1,             # <<<<<<<<<<<<<<
27630  *                                  &cbox[0],&cbox[1],&cbox[2])
27631  *     # Transfer values to python array
27632  */
27633   __pyx_v_rbox = __pyx_f_2yt_9utilities_3lib_14geometry_utils_smallest_quadtree_box(__pyx_v_ppos, __pyx_v_qpos, __pyx_v_order, __pyx_v_DLE1, __pyx_v_DRE1, (&(__pyx_v_cbox[0])), (&(__pyx_v_cbox[1])), (&(__pyx_v_cbox[2])));
27634 
27635   /* "yt/utilities/lib/geometry_utils.pyx":1080
27636  *                                  &cbox[0],&cbox[1],&cbox[2])
27637  *     # Transfer values to python array
27638  *     for j in range(3):             # <<<<<<<<<<<<<<
27639  *         c[j] = cbox[j]
27640  *     return rbox
27641  */
27642   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
27643     __pyx_v_j = __pyx_t_1;
27644 
27645     /* "yt/utilities/lib/geometry_utils.pyx":1081
27646  *     # Transfer values to python array
27647  *     for j in range(3):
27648  *         c[j] = cbox[j]             # <<<<<<<<<<<<<<
27649  *     return rbox
27650  *
27651  */
27652     __pyx_t_6 = __pyx_v_j;
27653     *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_c.diminfo[0].strides) = (__pyx_v_cbox[__pyx_v_j]);
27654   }
27655 
27656   /* "yt/utilities/lib/geometry_utils.pyx":1082
27657  *     for j in range(3):
27658  *         c[j] = cbox[j]
27659  *     return rbox             # <<<<<<<<<<<<<<
27660  *
27661  *
27662  */
27663   __Pyx_XDECREF(__pyx_r);
27664   __pyx_t_7 = PyFloat_FromDouble(__pyx_v_rbox); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1082, __pyx_L1_error)
27665   __Pyx_GOTREF(__pyx_t_7);
27666   __pyx_r = __pyx_t_7;
27667   __pyx_t_7 = 0;
27668   goto __pyx_L0;
27669 
27670   /* "yt/utilities/lib/geometry_utils.pyx":1058
27671  * @cython.wraparound(False)
27672  * @cython.cdivision(True)
27673  * def quadtree_box(np.ndarray[np.float64_t, ndim=1] p,             # <<<<<<<<<<<<<<
27674  *                  np.ndarray[np.float64_t, ndim=1] q, int order,
27675  *                  np.ndarray[np.float64_t, ndim=1] DLE,
27676  */
27677 
27678   /* function exit code */
27679   __pyx_L1_error:;
27680   __Pyx_XDECREF(__pyx_t_7);
27681   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
27682     __Pyx_PyThreadState_declare
27683     __Pyx_PyThreadState_assign
27684     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
27685     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_DLE.rcbuffer->pybuffer);
27686     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_DRE.rcbuffer->pybuffer);
27687     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_c.rcbuffer->pybuffer);
27688     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_p.rcbuffer->pybuffer);
27689     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q.rcbuffer->pybuffer);
27690   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
27691   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.quadtree_box", __pyx_clineno, __pyx_lineno, __pyx_filename);
27692   __pyx_r = NULL;
27693   goto __pyx_L2;
27694   __pyx_L0:;
27695   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_DLE.rcbuffer->pybuffer);
27696   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_DRE.rcbuffer->pybuffer);
27697   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_c.rcbuffer->pybuffer);
27698   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_p.rcbuffer->pybuffer);
27699   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q.rcbuffer->pybuffer);
27700   __pyx_L2:;
27701   __Pyx_XGIVEREF(__pyx_r);
27702   __Pyx_RefNannyFinishContext();
27703   return __pyx_r;
27704 }
27705 
27706 /* "yt/utilities/lib/geometry_utils.pyx":1088
27707  * @cython.wraparound(False)
27708  * @cython.cdivision(True)
27709  * def csearch_morton(np.ndarray[np.float64_t, ndim=2] P, int k, np.uint64_t i,             # <<<<<<<<<<<<<<
27710  *                    np.ndarray[np.uint64_t, ndim=1] Ai,
27711  *                    np.uint64_t l, np.uint64_t h, int order,
27712  */
27713 
27714 /* Python wrapper */
27715 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_71csearch_morton(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
27716 static char __pyx_doc_2yt_9utilities_3lib_14geometry_utils_70csearch_morton[] = "Expand search concentrically to determine set of k nearest neighbors for\n    point i.\n\n    Args:\n        P (np.ndarray): (N,d) array of points to search sorted by Morton order.\n        k (int): number of nearest neighbors to find.\n        i (int): index of point that nearest neighbors should be found for.\n        Ai (np.ndarray): (N,k) array of partial nearest neighbor indices.\n        l (int): index of lowest point to consider in addition to Ai.\n        h (int): index of highest point to consider in addition to Ai.\n        order (int): Maximum depth that Morton order quadtree should reach.\n        DLE (np.float64[3]): 3 floats defining domain lower bounds in each dim.\n        DRE (np.float64[3]): 3 floats defining domain upper bounds in each dim.\n        nu (int): minimum number of points before a direct knn search is\n            performed. (default = 4)\n\n    Returns:\n        np.ndarray: (N,k) array of nearest neighbor indices.\n\n    Raises:\n        ValueError: If l<i<h. l and h must be on the same side of i.\n\n    ";
27717 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_71csearch_morton = {"csearch_morton", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_71csearch_morton, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2yt_9utilities_3lib_14geometry_utils_70csearch_morton};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_71csearch_morton(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)27718 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_71csearch_morton(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
27719   PyArrayObject *__pyx_v_P = 0;
27720   int __pyx_v_k;
27721   __pyx_t_5numpy_uint64_t __pyx_v_i;
27722   PyArrayObject *__pyx_v_Ai = 0;
27723   __pyx_t_5numpy_uint64_t __pyx_v_l;
27724   __pyx_t_5numpy_uint64_t __pyx_v_h;
27725   int __pyx_v_order;
27726   PyArrayObject *__pyx_v_DLE = 0;
27727   PyArrayObject *__pyx_v_DRE = 0;
27728   int __pyx_v_nu;
27729   PyObject *__pyx_r = 0;
27730   __Pyx_RefNannyDeclarations
27731   __Pyx_RefNannySetupContext("csearch_morton (wrapper)", 0);
27732   {
27733     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_P,&__pyx_n_s_k,&__pyx_n_s_i,&__pyx_n_s_Ai,&__pyx_n_s_l,&__pyx_n_s_h,&__pyx_n_s_order,&__pyx_n_s_DLE,&__pyx_n_s_DRE,&__pyx_n_s_nu,0};
27734     PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
27735     if (unlikely(__pyx_kwds)) {
27736       Py_ssize_t kw_args;
27737       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
27738       switch (pos_args) {
27739         case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
27740         CYTHON_FALLTHROUGH;
27741         case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
27742         CYTHON_FALLTHROUGH;
27743         case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
27744         CYTHON_FALLTHROUGH;
27745         case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
27746         CYTHON_FALLTHROUGH;
27747         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
27748         CYTHON_FALLTHROUGH;
27749         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
27750         CYTHON_FALLTHROUGH;
27751         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
27752         CYTHON_FALLTHROUGH;
27753         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
27754         CYTHON_FALLTHROUGH;
27755         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
27756         CYTHON_FALLTHROUGH;
27757         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
27758         CYTHON_FALLTHROUGH;
27759         case  0: break;
27760         default: goto __pyx_L5_argtuple_error;
27761       }
27762       kw_args = PyDict_Size(__pyx_kwds);
27763       switch (pos_args) {
27764         case  0:
27765         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_P)) != 0)) kw_args--;
27766         else goto __pyx_L5_argtuple_error;
27767         CYTHON_FALLTHROUGH;
27768         case  1:
27769         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k)) != 0)) kw_args--;
27770         else {
27771           __Pyx_RaiseArgtupleInvalid("csearch_morton", 0, 9, 10, 1); __PYX_ERR(1, 1088, __pyx_L3_error)
27772         }
27773         CYTHON_FALLTHROUGH;
27774         case  2:
27775         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_i)) != 0)) kw_args--;
27776         else {
27777           __Pyx_RaiseArgtupleInvalid("csearch_morton", 0, 9, 10, 2); __PYX_ERR(1, 1088, __pyx_L3_error)
27778         }
27779         CYTHON_FALLTHROUGH;
27780         case  3:
27781         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Ai)) != 0)) kw_args--;
27782         else {
27783           __Pyx_RaiseArgtupleInvalid("csearch_morton", 0, 9, 10, 3); __PYX_ERR(1, 1088, __pyx_L3_error)
27784         }
27785         CYTHON_FALLTHROUGH;
27786         case  4:
27787         if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_l)) != 0)) kw_args--;
27788         else {
27789           __Pyx_RaiseArgtupleInvalid("csearch_morton", 0, 9, 10, 4); __PYX_ERR(1, 1088, __pyx_L3_error)
27790         }
27791         CYTHON_FALLTHROUGH;
27792         case  5:
27793         if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
27794         else {
27795           __Pyx_RaiseArgtupleInvalid("csearch_morton", 0, 9, 10, 5); __PYX_ERR(1, 1088, __pyx_L3_error)
27796         }
27797         CYTHON_FALLTHROUGH;
27798         case  6:
27799         if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_order)) != 0)) kw_args--;
27800         else {
27801           __Pyx_RaiseArgtupleInvalid("csearch_morton", 0, 9, 10, 6); __PYX_ERR(1, 1088, __pyx_L3_error)
27802         }
27803         CYTHON_FALLTHROUGH;
27804         case  7:
27805         if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_DLE)) != 0)) kw_args--;
27806         else {
27807           __Pyx_RaiseArgtupleInvalid("csearch_morton", 0, 9, 10, 7); __PYX_ERR(1, 1088, __pyx_L3_error)
27808         }
27809         CYTHON_FALLTHROUGH;
27810         case  8:
27811         if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_DRE)) != 0)) kw_args--;
27812         else {
27813           __Pyx_RaiseArgtupleInvalid("csearch_morton", 0, 9, 10, 8); __PYX_ERR(1, 1088, __pyx_L3_error)
27814         }
27815         CYTHON_FALLTHROUGH;
27816         case  9:
27817         if (kw_args > 0) {
27818           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nu);
27819           if (value) { values[9] = value; kw_args--; }
27820         }
27821       }
27822       if (unlikely(kw_args > 0)) {
27823         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "csearch_morton") < 0)) __PYX_ERR(1, 1088, __pyx_L3_error)
27824       }
27825     } else {
27826       switch (PyTuple_GET_SIZE(__pyx_args)) {
27827         case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
27828         CYTHON_FALLTHROUGH;
27829         case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
27830         values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
27831         values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
27832         values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
27833         values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
27834         values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
27835         values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
27836         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
27837         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
27838         break;
27839         default: goto __pyx_L5_argtuple_error;
27840       }
27841     }
27842     __pyx_v_P = ((PyArrayObject *)values[0]);
27843     __pyx_v_k = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1088, __pyx_L3_error)
27844     __pyx_v_i = __Pyx_PyInt_As_npy_uint64(values[2]); if (unlikely((__pyx_v_i == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 1088, __pyx_L3_error)
27845     __pyx_v_Ai = ((PyArrayObject *)values[3]);
27846     __pyx_v_l = __Pyx_PyInt_As_npy_uint64(values[4]); if (unlikely((__pyx_v_l == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 1090, __pyx_L3_error)
27847     __pyx_v_h = __Pyx_PyInt_As_npy_uint64(values[5]); if (unlikely((__pyx_v_h == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 1090, __pyx_L3_error)
27848     __pyx_v_order = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1090, __pyx_L3_error)
27849     __pyx_v_DLE = ((PyArrayObject *)values[7]);
27850     __pyx_v_DRE = ((PyArrayObject *)values[8]);
27851     if (values[9]) {
27852       __pyx_v_nu = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_nu == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1092, __pyx_L3_error)
27853     } else {
27854       __pyx_v_nu = ((int)4);
27855     }
27856   }
27857   goto __pyx_L4_argument_unpacking_done;
27858   __pyx_L5_argtuple_error:;
27859   __Pyx_RaiseArgtupleInvalid("csearch_morton", 0, 9, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1088, __pyx_L3_error)
27860   __pyx_L3_error:;
27861   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.csearch_morton", __pyx_clineno, __pyx_lineno, __pyx_filename);
27862   __Pyx_RefNannyFinishContext();
27863   return NULL;
27864   __pyx_L4_argument_unpacking_done:;
27865   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_P), __pyx_ptype_5numpy_ndarray, 1, "P", 0))) __PYX_ERR(1, 1088, __pyx_L1_error)
27866   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Ai), __pyx_ptype_5numpy_ndarray, 1, "Ai", 0))) __PYX_ERR(1, 1089, __pyx_L1_error)
27867   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_DLE), __pyx_ptype_5numpy_ndarray, 1, "DLE", 0))) __PYX_ERR(1, 1091, __pyx_L1_error)
27868   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_DRE), __pyx_ptype_5numpy_ndarray, 1, "DRE", 0))) __PYX_ERR(1, 1092, __pyx_L1_error)
27869   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_70csearch_morton(__pyx_self, __pyx_v_P, __pyx_v_k, __pyx_v_i, __pyx_v_Ai, __pyx_v_l, __pyx_v_h, __pyx_v_order, __pyx_v_DLE, __pyx_v_DRE, __pyx_v_nu);
27870 
27871   /* function exit code */
27872   goto __pyx_L0;
27873   __pyx_L1_error:;
27874   __pyx_r = NULL;
27875   __pyx_L0:;
27876   __Pyx_RefNannyFinishContext();
27877   return __pyx_r;
27878 }
27879 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_70csearch_morton(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_P,int __pyx_v_k,__pyx_t_5numpy_uint64_t __pyx_v_i,PyArrayObject * __pyx_v_Ai,__pyx_t_5numpy_uint64_t __pyx_v_l,__pyx_t_5numpy_uint64_t __pyx_v_h,int __pyx_v_order,PyArrayObject * __pyx_v_DLE,PyArrayObject * __pyx_v_DRE,int __pyx_v_nu)27880 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_70csearch_morton(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_P, int __pyx_v_k, __pyx_t_5numpy_uint64_t __pyx_v_i, PyArrayObject *__pyx_v_Ai, __pyx_t_5numpy_uint64_t __pyx_v_l, __pyx_t_5numpy_uint64_t __pyx_v_h, int __pyx_v_order, PyArrayObject *__pyx_v_DLE, PyArrayObject *__pyx_v_DRE, int __pyx_v_nu) {
27881   __pyx_t_5numpy_uint64_t __pyx_v_m;
27882   PyObject *__pyx_v_rad_Ai = NULL;
27883   PyObject *__pyx_v_cbox_sol = NULL;
27884   PyObject *__pyx_v_rbox_sol = NULL;
27885   PyObject *__pyx_v_cbox_hl = NULL;
27886   PyObject *__pyx_v_rbox_hl = NULL;
27887   __Pyx_LocalBuf_ND __pyx_pybuffernd_Ai;
27888   __Pyx_Buffer __pyx_pybuffer_Ai;
27889   __Pyx_LocalBuf_ND __pyx_pybuffernd_DLE;
27890   __Pyx_Buffer __pyx_pybuffer_DLE;
27891   __Pyx_LocalBuf_ND __pyx_pybuffernd_DRE;
27892   __Pyx_Buffer __pyx_pybuffer_DRE;
27893   __Pyx_LocalBuf_ND __pyx_pybuffernd_P;
27894   __Pyx_Buffer __pyx_pybuffer_P;
27895   PyObject *__pyx_r = NULL;
27896   __Pyx_RefNannyDeclarations
27897   int __pyx_t_1;
27898   int __pyx_t_2;
27899   PyObject *__pyx_t_3 = NULL;
27900   PyObject *__pyx_t_4 = NULL;
27901   PyObject *__pyx_t_5 = NULL;
27902   PyObject *__pyx_t_6 = NULL;
27903   __pyx_t_5numpy_uint64_t __pyx_t_7;
27904   PyObject *__pyx_t_8 = NULL;
27905   PyObject *__pyx_t_9 = NULL;
27906   PyObject *__pyx_t_10 = NULL;
27907   PyObject *__pyx_t_11 = NULL;
27908   PyObject *__pyx_t_12 = NULL;
27909   PyObject *__pyx_t_13 = NULL;
27910   PyObject *__pyx_t_14 = NULL;
27911   int __pyx_t_15;
27912   PyObject *(*__pyx_t_16)(PyObject *);
27913   PyArrayObject *__pyx_t_17 = NULL;
27914   PyObject *__pyx_t_18 = NULL;
27915   PyObject *__pyx_t_19 = NULL;
27916   PyObject *__pyx_t_20 = NULL;
27917   Py_ssize_t __pyx_t_21;
27918   Py_ssize_t __pyx_t_22;
27919   Py_ssize_t __pyx_t_23;
27920   __Pyx_RefNannySetupContext("csearch_morton", 0);
27921   __Pyx_INCREF((PyObject *)__pyx_v_Ai);
27922   __pyx_pybuffer_P.pybuffer.buf = NULL;
27923   __pyx_pybuffer_P.refcount = 0;
27924   __pyx_pybuffernd_P.data = NULL;
27925   __pyx_pybuffernd_P.rcbuffer = &__pyx_pybuffer_P;
27926   __pyx_pybuffer_Ai.pybuffer.buf = NULL;
27927   __pyx_pybuffer_Ai.refcount = 0;
27928   __pyx_pybuffernd_Ai.data = NULL;
27929   __pyx_pybuffernd_Ai.rcbuffer = &__pyx_pybuffer_Ai;
27930   __pyx_pybuffer_DLE.pybuffer.buf = NULL;
27931   __pyx_pybuffer_DLE.refcount = 0;
27932   __pyx_pybuffernd_DLE.data = NULL;
27933   __pyx_pybuffernd_DLE.rcbuffer = &__pyx_pybuffer_DLE;
27934   __pyx_pybuffer_DRE.pybuffer.buf = NULL;
27935   __pyx_pybuffer_DRE.refcount = 0;
27936   __pyx_pybuffernd_DRE.data = NULL;
27937   __pyx_pybuffernd_DRE.rcbuffer = &__pyx_pybuffer_DRE;
27938   {
27939     __Pyx_BufFmt_StackElem __pyx_stack[1];
27940     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_P.rcbuffer->pybuffer, (PyObject*)__pyx_v_P, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(1, 1088, __pyx_L1_error)
27941   }
27942   __pyx_pybuffernd_P.diminfo[0].strides = __pyx_pybuffernd_P.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_P.diminfo[0].shape = __pyx_pybuffernd_P.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_P.diminfo[1].strides = __pyx_pybuffernd_P.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_P.diminfo[1].shape = __pyx_pybuffernd_P.rcbuffer->pybuffer.shape[1];
27943   {
27944     __Pyx_BufFmt_StackElem __pyx_stack[1];
27945     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer, (PyObject*)__pyx_v_Ai, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 1088, __pyx_L1_error)
27946   }
27947   __pyx_pybuffernd_Ai.diminfo[0].strides = __pyx_pybuffernd_Ai.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Ai.diminfo[0].shape = __pyx_pybuffernd_Ai.rcbuffer->pybuffer.shape[0];
27948   {
27949     __Pyx_BufFmt_StackElem __pyx_stack[1];
27950     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_DLE.rcbuffer->pybuffer, (PyObject*)__pyx_v_DLE, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 1088, __pyx_L1_error)
27951   }
27952   __pyx_pybuffernd_DLE.diminfo[0].strides = __pyx_pybuffernd_DLE.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_DLE.diminfo[0].shape = __pyx_pybuffernd_DLE.rcbuffer->pybuffer.shape[0];
27953   {
27954     __Pyx_BufFmt_StackElem __pyx_stack[1];
27955     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_DRE.rcbuffer->pybuffer, (PyObject*)__pyx_v_DRE, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 1088, __pyx_L1_error)
27956   }
27957   __pyx_pybuffernd_DRE.diminfo[0].strides = __pyx_pybuffernd_DRE.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_DRE.diminfo[0].shape = __pyx_pybuffernd_DRE.rcbuffer->pybuffer.shape[0];
27958 
27959   /* "yt/utilities/lib/geometry_utils.pyx":1119
27960  *     cdef np.uint64_t m
27961  *     # Make sure that h and l are both larger/smaller than i
27962  *     if (l < i) and (h > i):             # <<<<<<<<<<<<<<
27963  *         raise ValueError("Both l and h must be on the same side of i.")
27964  *     m = np.uint64((h + l)/2)
27965  */
27966   __pyx_t_2 = ((__pyx_v_l < __pyx_v_i) != 0);
27967   if (__pyx_t_2) {
27968   } else {
27969     __pyx_t_1 = __pyx_t_2;
27970     goto __pyx_L4_bool_binop_done;
27971   }
27972   __pyx_t_2 = ((__pyx_v_h > __pyx_v_i) != 0);
27973   __pyx_t_1 = __pyx_t_2;
27974   __pyx_L4_bool_binop_done:;
27975   if (unlikely(__pyx_t_1)) {
27976 
27977     /* "yt/utilities/lib/geometry_utils.pyx":1120
27978  *     # Make sure that h and l are both larger/smaller than i
27979  *     if (l < i) and (h > i):
27980  *         raise ValueError("Both l and h must be on the same side of i.")             # <<<<<<<<<<<<<<
27981  *     m = np.uint64((h + l)/2)
27982  *     # New range is small enough to consider directly
27983  */
27984     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1120, __pyx_L1_error)
27985     __Pyx_GOTREF(__pyx_t_3);
27986     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
27987     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
27988     __PYX_ERR(1, 1120, __pyx_L1_error)
27989 
27990     /* "yt/utilities/lib/geometry_utils.pyx":1119
27991  *     cdef np.uint64_t m
27992  *     # Make sure that h and l are both larger/smaller than i
27993  *     if (l < i) and (h > i):             # <<<<<<<<<<<<<<
27994  *         raise ValueError("Both l and h must be on the same side of i.")
27995  *     m = np.uint64((h + l)/2)
27996  */
27997   }
27998 
27999   /* "yt/utilities/lib/geometry_utils.pyx":1121
28000  *     if (l < i) and (h > i):
28001  *         raise ValueError("Both l and h must be on the same side of i.")
28002  *     m = np.uint64((h + l)/2)             # <<<<<<<<<<<<<<
28003  *     # New range is small enough to consider directly
28004  *     if (h-l) < nu:
28005  */
28006   __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1121, __pyx_L1_error)
28007   __Pyx_GOTREF(__pyx_t_4);
28008   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint64); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1121, __pyx_L1_error)
28009   __Pyx_GOTREF(__pyx_t_5);
28010   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
28011   __pyx_t_4 = __Pyx_PyInt_From_npy_uint64(((__pyx_v_h + __pyx_v_l) / 2)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1121, __pyx_L1_error)
28012   __Pyx_GOTREF(__pyx_t_4);
28013   __pyx_t_6 = NULL;
28014   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
28015     __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
28016     if (likely(__pyx_t_6)) {
28017       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
28018       __Pyx_INCREF(__pyx_t_6);
28019       __Pyx_INCREF(function);
28020       __Pyx_DECREF_SET(__pyx_t_5, function);
28021     }
28022   }
28023   __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4);
28024   __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
28025   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
28026   if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1121, __pyx_L1_error)
28027   __Pyx_GOTREF(__pyx_t_3);
28028   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
28029   __pyx_t_7 = __Pyx_PyInt_As_npy_uint64(__pyx_t_3); if (unlikely((__pyx_t_7 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 1121, __pyx_L1_error)
28030   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
28031   __pyx_v_m = __pyx_t_7;
28032 
28033   /* "yt/utilities/lib/geometry_utils.pyx":1123
28034  *     m = np.uint64((h + l)/2)
28035  *     # New range is small enough to consider directly
28036  *     if (h-l) < nu:             # <<<<<<<<<<<<<<
28037  *         if m > i:
28038  *             return knn_direct(P,k,i,np.hstack((Ai,np.arange(l,h+1,dtype=np.uint64))))
28039  */
28040   __pyx_t_1 = (((__pyx_v_h - __pyx_v_l) < __pyx_v_nu) != 0);
28041   if (__pyx_t_1) {
28042 
28043     /* "yt/utilities/lib/geometry_utils.pyx":1124
28044  *     # New range is small enough to consider directly
28045  *     if (h-l) < nu:
28046  *         if m > i:             # <<<<<<<<<<<<<<
28047  *             return knn_direct(P,k,i,np.hstack((Ai,np.arange(l,h+1,dtype=np.uint64))))
28048  *         else:
28049  */
28050     __pyx_t_1 = ((__pyx_v_m > __pyx_v_i) != 0);
28051     if (__pyx_t_1) {
28052 
28053       /* "yt/utilities/lib/geometry_utils.pyx":1125
28054  *     if (h-l) < nu:
28055  *         if m > i:
28056  *             return knn_direct(P,k,i,np.hstack((Ai,np.arange(l,h+1,dtype=np.uint64))))             # <<<<<<<<<<<<<<
28057  *         else:
28058  *             return knn_direct(P,k,i,np.hstack((np.arange(l,h+1,dtype=np.uint64),Ai)))
28059  */
28060       __Pyx_XDECREF(__pyx_r);
28061       __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_knn_direct); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1125, __pyx_L1_error)
28062       __Pyx_GOTREF(__pyx_t_5);
28063       __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1125, __pyx_L1_error)
28064       __Pyx_GOTREF(__pyx_t_4);
28065       __pyx_t_6 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1125, __pyx_L1_error)
28066       __Pyx_GOTREF(__pyx_t_6);
28067       __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1125, __pyx_L1_error)
28068       __Pyx_GOTREF(__pyx_t_9);
28069       __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_hstack); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1125, __pyx_L1_error)
28070       __Pyx_GOTREF(__pyx_t_10);
28071       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
28072       __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1125, __pyx_L1_error)
28073       __Pyx_GOTREF(__pyx_t_9);
28074       __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_arange); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 1125, __pyx_L1_error)
28075       __Pyx_GOTREF(__pyx_t_11);
28076       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
28077       __pyx_t_9 = __Pyx_PyInt_From_npy_uint64(__pyx_v_l); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1125, __pyx_L1_error)
28078       __Pyx_GOTREF(__pyx_t_9);
28079       __pyx_t_12 = __Pyx_PyInt_From_npy_uint64((__pyx_v_h + 1)); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1125, __pyx_L1_error)
28080       __Pyx_GOTREF(__pyx_t_12);
28081       __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1125, __pyx_L1_error)
28082       __Pyx_GOTREF(__pyx_t_13);
28083       __Pyx_GIVEREF(__pyx_t_9);
28084       PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_9);
28085       __Pyx_GIVEREF(__pyx_t_12);
28086       PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_12);
28087       __pyx_t_9 = 0;
28088       __pyx_t_12 = 0;
28089       __pyx_t_12 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1125, __pyx_L1_error)
28090       __Pyx_GOTREF(__pyx_t_12);
28091       __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1125, __pyx_L1_error)
28092       __Pyx_GOTREF(__pyx_t_9);
28093       __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_uint64); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 1125, __pyx_L1_error)
28094       __Pyx_GOTREF(__pyx_t_14);
28095       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
28096       if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_dtype, __pyx_t_14) < 0) __PYX_ERR(1, 1125, __pyx_L1_error)
28097       __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
28098       __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_13, __pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 1125, __pyx_L1_error)
28099       __Pyx_GOTREF(__pyx_t_14);
28100       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
28101       __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
28102       __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
28103       __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1125, __pyx_L1_error)
28104       __Pyx_GOTREF(__pyx_t_12);
28105       __Pyx_INCREF(((PyObject *)__pyx_v_Ai));
28106       __Pyx_GIVEREF(((PyObject *)__pyx_v_Ai));
28107       PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_v_Ai));
28108       __Pyx_GIVEREF(__pyx_t_14);
28109       PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_14);
28110       __pyx_t_14 = 0;
28111       __pyx_t_14 = NULL;
28112       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
28113         __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_10);
28114         if (likely(__pyx_t_14)) {
28115           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
28116           __Pyx_INCREF(__pyx_t_14);
28117           __Pyx_INCREF(function);
28118           __Pyx_DECREF_SET(__pyx_t_10, function);
28119         }
28120       }
28121       __pyx_t_8 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_14, __pyx_t_12) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_12);
28122       __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
28123       __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
28124       if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1125, __pyx_L1_error)
28125       __Pyx_GOTREF(__pyx_t_8);
28126       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
28127       __pyx_t_10 = NULL;
28128       __pyx_t_15 = 0;
28129       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
28130         __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
28131         if (likely(__pyx_t_10)) {
28132           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
28133           __Pyx_INCREF(__pyx_t_10);
28134           __Pyx_INCREF(function);
28135           __Pyx_DECREF_SET(__pyx_t_5, function);
28136           __pyx_t_15 = 1;
28137         }
28138       }
28139       #if CYTHON_FAST_PYCALL
28140       if (PyFunction_Check(__pyx_t_5)) {
28141         PyObject *__pyx_temp[5] = {__pyx_t_10, ((PyObject *)__pyx_v_P), __pyx_t_4, __pyx_t_6, __pyx_t_8};
28142         __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_15, 4+__pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1125, __pyx_L1_error)
28143         __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
28144         __Pyx_GOTREF(__pyx_t_3);
28145         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
28146         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
28147         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
28148       } else
28149       #endif
28150       #if CYTHON_FAST_PYCCALL
28151       if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
28152         PyObject *__pyx_temp[5] = {__pyx_t_10, ((PyObject *)__pyx_v_P), __pyx_t_4, __pyx_t_6, __pyx_t_8};
28153         __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_15, 4+__pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1125, __pyx_L1_error)
28154         __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
28155         __Pyx_GOTREF(__pyx_t_3);
28156         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
28157         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
28158         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
28159       } else
28160       #endif
28161       {
28162         __pyx_t_12 = PyTuple_New(4+__pyx_t_15); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1125, __pyx_L1_error)
28163         __Pyx_GOTREF(__pyx_t_12);
28164         if (__pyx_t_10) {
28165           __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL;
28166         }
28167         __Pyx_INCREF(((PyObject *)__pyx_v_P));
28168         __Pyx_GIVEREF(((PyObject *)__pyx_v_P));
28169         PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_15, ((PyObject *)__pyx_v_P));
28170         __Pyx_GIVEREF(__pyx_t_4);
28171         PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_15, __pyx_t_4);
28172         __Pyx_GIVEREF(__pyx_t_6);
28173         PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_15, __pyx_t_6);
28174         __Pyx_GIVEREF(__pyx_t_8);
28175         PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_15, __pyx_t_8);
28176         __pyx_t_4 = 0;
28177         __pyx_t_6 = 0;
28178         __pyx_t_8 = 0;
28179         __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1125, __pyx_L1_error)
28180         __Pyx_GOTREF(__pyx_t_3);
28181         __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
28182       }
28183       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
28184       __pyx_r = __pyx_t_3;
28185       __pyx_t_3 = 0;
28186       goto __pyx_L0;
28187 
28188       /* "yt/utilities/lib/geometry_utils.pyx":1124
28189  *     # New range is small enough to consider directly
28190  *     if (h-l) < nu:
28191  *         if m > i:             # <<<<<<<<<<<<<<
28192  *             return knn_direct(P,k,i,np.hstack((Ai,np.arange(l,h+1,dtype=np.uint64))))
28193  *         else:
28194  */
28195     }
28196 
28197     /* "yt/utilities/lib/geometry_utils.pyx":1127
28198  *             return knn_direct(P,k,i,np.hstack((Ai,np.arange(l,h+1,dtype=np.uint64))))
28199  *         else:
28200  *             return knn_direct(P,k,i,np.hstack((np.arange(l,h+1,dtype=np.uint64),Ai)))             # <<<<<<<<<<<<<<
28201  *     # Add middle point
28202  *     if m > i:
28203  */
28204     /*else*/ {
28205       __Pyx_XDECREF(__pyx_r);
28206       __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_knn_direct); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1127, __pyx_L1_error)
28207       __Pyx_GOTREF(__pyx_t_5);
28208       __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1127, __pyx_L1_error)
28209       __Pyx_GOTREF(__pyx_t_12);
28210       __pyx_t_8 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1127, __pyx_L1_error)
28211       __Pyx_GOTREF(__pyx_t_8);
28212       __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1127, __pyx_L1_error)
28213       __Pyx_GOTREF(__pyx_t_4);
28214       __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_hstack); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1127, __pyx_L1_error)
28215       __Pyx_GOTREF(__pyx_t_10);
28216       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
28217       __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1127, __pyx_L1_error)
28218       __Pyx_GOTREF(__pyx_t_4);
28219       __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_arange); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 1127, __pyx_L1_error)
28220       __Pyx_GOTREF(__pyx_t_14);
28221       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
28222       __pyx_t_4 = __Pyx_PyInt_From_npy_uint64(__pyx_v_l); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1127, __pyx_L1_error)
28223       __Pyx_GOTREF(__pyx_t_4);
28224       __pyx_t_13 = __Pyx_PyInt_From_npy_uint64((__pyx_v_h + 1)); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1127, __pyx_L1_error)
28225       __Pyx_GOTREF(__pyx_t_13);
28226       __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 1127, __pyx_L1_error)
28227       __Pyx_GOTREF(__pyx_t_11);
28228       __Pyx_GIVEREF(__pyx_t_4);
28229       PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_4);
28230       __Pyx_GIVEREF(__pyx_t_13);
28231       PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_13);
28232       __pyx_t_4 = 0;
28233       __pyx_t_13 = 0;
28234       __pyx_t_13 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1127, __pyx_L1_error)
28235       __Pyx_GOTREF(__pyx_t_13);
28236       __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1127, __pyx_L1_error)
28237       __Pyx_GOTREF(__pyx_t_4);
28238       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint64); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1127, __pyx_L1_error)
28239       __Pyx_GOTREF(__pyx_t_9);
28240       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
28241       if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(1, 1127, __pyx_L1_error)
28242       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
28243       __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_11, __pyx_t_13); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1127, __pyx_L1_error)
28244       __Pyx_GOTREF(__pyx_t_9);
28245       __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
28246       __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
28247       __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
28248       __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1127, __pyx_L1_error)
28249       __Pyx_GOTREF(__pyx_t_13);
28250       __Pyx_GIVEREF(__pyx_t_9);
28251       PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_9);
28252       __Pyx_INCREF(((PyObject *)__pyx_v_Ai));
28253       __Pyx_GIVEREF(((PyObject *)__pyx_v_Ai));
28254       PyTuple_SET_ITEM(__pyx_t_13, 1, ((PyObject *)__pyx_v_Ai));
28255       __pyx_t_9 = 0;
28256       __pyx_t_9 = NULL;
28257       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
28258         __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
28259         if (likely(__pyx_t_9)) {
28260           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
28261           __Pyx_INCREF(__pyx_t_9);
28262           __Pyx_INCREF(function);
28263           __Pyx_DECREF_SET(__pyx_t_10, function);
28264         }
28265       }
28266       __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_9, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_13);
28267       __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
28268       __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
28269       if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1127, __pyx_L1_error)
28270       __Pyx_GOTREF(__pyx_t_6);
28271       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
28272       __pyx_t_10 = NULL;
28273       __pyx_t_15 = 0;
28274       if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
28275         __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
28276         if (likely(__pyx_t_10)) {
28277           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
28278           __Pyx_INCREF(__pyx_t_10);
28279           __Pyx_INCREF(function);
28280           __Pyx_DECREF_SET(__pyx_t_5, function);
28281           __pyx_t_15 = 1;
28282         }
28283       }
28284       #if CYTHON_FAST_PYCALL
28285       if (PyFunction_Check(__pyx_t_5)) {
28286         PyObject *__pyx_temp[5] = {__pyx_t_10, ((PyObject *)__pyx_v_P), __pyx_t_12, __pyx_t_8, __pyx_t_6};
28287         __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_15, 4+__pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1127, __pyx_L1_error)
28288         __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
28289         __Pyx_GOTREF(__pyx_t_3);
28290         __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
28291         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
28292         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
28293       } else
28294       #endif
28295       #if CYTHON_FAST_PYCCALL
28296       if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
28297         PyObject *__pyx_temp[5] = {__pyx_t_10, ((PyObject *)__pyx_v_P), __pyx_t_12, __pyx_t_8, __pyx_t_6};
28298         __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_15, 4+__pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1127, __pyx_L1_error)
28299         __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
28300         __Pyx_GOTREF(__pyx_t_3);
28301         __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
28302         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
28303         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
28304       } else
28305       #endif
28306       {
28307         __pyx_t_13 = PyTuple_New(4+__pyx_t_15); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1127, __pyx_L1_error)
28308         __Pyx_GOTREF(__pyx_t_13);
28309         if (__pyx_t_10) {
28310           __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_10); __pyx_t_10 = NULL;
28311         }
28312         __Pyx_INCREF(((PyObject *)__pyx_v_P));
28313         __Pyx_GIVEREF(((PyObject *)__pyx_v_P));
28314         PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_15, ((PyObject *)__pyx_v_P));
28315         __Pyx_GIVEREF(__pyx_t_12);
28316         PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_15, __pyx_t_12);
28317         __Pyx_GIVEREF(__pyx_t_8);
28318         PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_15, __pyx_t_8);
28319         __Pyx_GIVEREF(__pyx_t_6);
28320         PyTuple_SET_ITEM(__pyx_t_13, 3+__pyx_t_15, __pyx_t_6);
28321         __pyx_t_12 = 0;
28322         __pyx_t_8 = 0;
28323         __pyx_t_6 = 0;
28324         __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1127, __pyx_L1_error)
28325         __Pyx_GOTREF(__pyx_t_3);
28326         __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
28327       }
28328       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
28329       __pyx_r = __pyx_t_3;
28330       __pyx_t_3 = 0;
28331       goto __pyx_L0;
28332     }
28333 
28334     /* "yt/utilities/lib/geometry_utils.pyx":1123
28335  *     m = np.uint64((h + l)/2)
28336  *     # New range is small enough to consider directly
28337  *     if (h-l) < nu:             # <<<<<<<<<<<<<<
28338  *         if m > i:
28339  *             return knn_direct(P,k,i,np.hstack((Ai,np.arange(l,h+1,dtype=np.uint64))))
28340  */
28341   }
28342 
28343   /* "yt/utilities/lib/geometry_utils.pyx":1129
28344  *             return knn_direct(P,k,i,np.hstack((np.arange(l,h+1,dtype=np.uint64),Ai)))
28345  *     # Add middle point
28346  *     if m > i:             # <<<<<<<<<<<<<<
28347  *         Ai,rad_Ai = knn_direct(P,k,i,np.hstack((Ai,m)).astype(np.uint64),return_rad=True)
28348  *     else:
28349  */
28350   __pyx_t_1 = ((__pyx_v_m > __pyx_v_i) != 0);
28351   if (__pyx_t_1) {
28352 
28353     /* "yt/utilities/lib/geometry_utils.pyx":1130
28354  *     # Add middle point
28355  *     if m > i:
28356  *         Ai,rad_Ai = knn_direct(P,k,i,np.hstack((Ai,m)).astype(np.uint64),return_rad=True)             # <<<<<<<<<<<<<<
28357  *     else:
28358  *         Ai,rad_Ai = knn_direct(P,k,i,np.hstack((m,Ai)).astype(np.uint64),return_rad=True)
28359  */
28360     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_knn_direct); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1130, __pyx_L1_error)
28361     __Pyx_GOTREF(__pyx_t_3);
28362     __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1130, __pyx_L1_error)
28363     __Pyx_GOTREF(__pyx_t_5);
28364     __pyx_t_13 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1130, __pyx_L1_error)
28365     __Pyx_GOTREF(__pyx_t_13);
28366     __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1130, __pyx_L1_error)
28367     __Pyx_GOTREF(__pyx_t_12);
28368     __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_hstack); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1130, __pyx_L1_error)
28369     __Pyx_GOTREF(__pyx_t_10);
28370     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
28371     __pyx_t_12 = __Pyx_PyInt_From_npy_uint64(__pyx_v_m); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1130, __pyx_L1_error)
28372     __Pyx_GOTREF(__pyx_t_12);
28373     __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1130, __pyx_L1_error)
28374     __Pyx_GOTREF(__pyx_t_9);
28375     __Pyx_INCREF(((PyObject *)__pyx_v_Ai));
28376     __Pyx_GIVEREF(((PyObject *)__pyx_v_Ai));
28377     PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_Ai));
28378     __Pyx_GIVEREF(__pyx_t_12);
28379     PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_12);
28380     __pyx_t_12 = 0;
28381     __pyx_t_12 = NULL;
28382     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
28383       __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_10);
28384       if (likely(__pyx_t_12)) {
28385         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
28386         __Pyx_INCREF(__pyx_t_12);
28387         __Pyx_INCREF(function);
28388         __Pyx_DECREF_SET(__pyx_t_10, function);
28389       }
28390     }
28391     __pyx_t_8 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_12, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_9);
28392     __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
28393     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
28394     if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1130, __pyx_L1_error)
28395     __Pyx_GOTREF(__pyx_t_8);
28396     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
28397     __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_astype); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1130, __pyx_L1_error)
28398     __Pyx_GOTREF(__pyx_t_10);
28399     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
28400     __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1130, __pyx_L1_error)
28401     __Pyx_GOTREF(__pyx_t_8);
28402     __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_uint64); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1130, __pyx_L1_error)
28403     __Pyx_GOTREF(__pyx_t_9);
28404     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
28405     __pyx_t_8 = NULL;
28406     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
28407       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
28408       if (likely(__pyx_t_8)) {
28409         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
28410         __Pyx_INCREF(__pyx_t_8);
28411         __Pyx_INCREF(function);
28412         __Pyx_DECREF_SET(__pyx_t_10, function);
28413       }
28414     }
28415     __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_8, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_9);
28416     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
28417     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
28418     if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1130, __pyx_L1_error)
28419     __Pyx_GOTREF(__pyx_t_6);
28420     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
28421     __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1130, __pyx_L1_error)
28422     __Pyx_GOTREF(__pyx_t_10);
28423     __Pyx_INCREF(((PyObject *)__pyx_v_P));
28424     __Pyx_GIVEREF(((PyObject *)__pyx_v_P));
28425     PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_P));
28426     __Pyx_GIVEREF(__pyx_t_5);
28427     PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
28428     __Pyx_GIVEREF(__pyx_t_13);
28429     PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_13);
28430     __Pyx_GIVEREF(__pyx_t_6);
28431     PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_6);
28432     __pyx_t_5 = 0;
28433     __pyx_t_13 = 0;
28434     __pyx_t_6 = 0;
28435     __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1130, __pyx_L1_error)
28436     __Pyx_GOTREF(__pyx_t_6);
28437     if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_return_rad, Py_True) < 0) __PYX_ERR(1, 1130, __pyx_L1_error)
28438     __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, __pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1130, __pyx_L1_error)
28439     __Pyx_GOTREF(__pyx_t_13);
28440     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
28441     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
28442     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
28443     if ((likely(PyTuple_CheckExact(__pyx_t_13))) || (PyList_CheckExact(__pyx_t_13))) {
28444       PyObject* sequence = __pyx_t_13;
28445       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
28446       if (unlikely(size != 2)) {
28447         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
28448         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
28449         __PYX_ERR(1, 1130, __pyx_L1_error)
28450       }
28451       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
28452       if (likely(PyTuple_CheckExact(sequence))) {
28453         __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
28454         __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1);
28455       } else {
28456         __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
28457         __pyx_t_10 = PyList_GET_ITEM(sequence, 1);
28458       }
28459       __Pyx_INCREF(__pyx_t_6);
28460       __Pyx_INCREF(__pyx_t_10);
28461       #else
28462       __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1130, __pyx_L1_error)
28463       __Pyx_GOTREF(__pyx_t_6);
28464       __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1130, __pyx_L1_error)
28465       __Pyx_GOTREF(__pyx_t_10);
28466       #endif
28467       __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
28468     } else {
28469       Py_ssize_t index = -1;
28470       __pyx_t_3 = PyObject_GetIter(__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1130, __pyx_L1_error)
28471       __Pyx_GOTREF(__pyx_t_3);
28472       __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
28473       __pyx_t_16 = Py_TYPE(__pyx_t_3)->tp_iternext;
28474       index = 0; __pyx_t_6 = __pyx_t_16(__pyx_t_3); if (unlikely(!__pyx_t_6)) goto __pyx_L9_unpacking_failed;
28475       __Pyx_GOTREF(__pyx_t_6);
28476       index = 1; __pyx_t_10 = __pyx_t_16(__pyx_t_3); if (unlikely(!__pyx_t_10)) goto __pyx_L9_unpacking_failed;
28477       __Pyx_GOTREF(__pyx_t_10);
28478       if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_3), 2) < 0) __PYX_ERR(1, 1130, __pyx_L1_error)
28479       __pyx_t_16 = NULL;
28480       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
28481       goto __pyx_L10_unpacking_done;
28482       __pyx_L9_unpacking_failed:;
28483       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
28484       __pyx_t_16 = NULL;
28485       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
28486       __PYX_ERR(1, 1130, __pyx_L1_error)
28487       __pyx_L10_unpacking_done:;
28488     }
28489     if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 1130, __pyx_L1_error)
28490     __pyx_t_17 = ((PyArrayObject *)__pyx_t_6);
28491     {
28492       __Pyx_BufFmt_StackElem __pyx_stack[1];
28493       __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer);
28494       __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
28495       if (unlikely(__pyx_t_15 < 0)) {
28496         PyErr_Fetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
28497         if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer, (PyObject*)__pyx_v_Ai, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
28498           Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20);
28499           __Pyx_RaiseBufferFallbackError();
28500         } else {
28501           PyErr_Restore(__pyx_t_18, __pyx_t_19, __pyx_t_20);
28502         }
28503         __pyx_t_18 = __pyx_t_19 = __pyx_t_20 = 0;
28504       }
28505       __pyx_pybuffernd_Ai.diminfo[0].strides = __pyx_pybuffernd_Ai.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Ai.diminfo[0].shape = __pyx_pybuffernd_Ai.rcbuffer->pybuffer.shape[0];
28506       if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(1, 1130, __pyx_L1_error)
28507     }
28508     __pyx_t_17 = 0;
28509     __Pyx_DECREF_SET(__pyx_v_Ai, ((PyArrayObject *)__pyx_t_6));
28510     __pyx_t_6 = 0;
28511     __pyx_v_rad_Ai = __pyx_t_10;
28512     __pyx_t_10 = 0;
28513 
28514     /* "yt/utilities/lib/geometry_utils.pyx":1129
28515  *             return knn_direct(P,k,i,np.hstack((np.arange(l,h+1,dtype=np.uint64),Ai)))
28516  *     # Add middle point
28517  *     if m > i:             # <<<<<<<<<<<<<<
28518  *         Ai,rad_Ai = knn_direct(P,k,i,np.hstack((Ai,m)).astype(np.uint64),return_rad=True)
28519  *     else:
28520  */
28521     goto __pyx_L8;
28522   }
28523 
28524   /* "yt/utilities/lib/geometry_utils.pyx":1132
28525  *         Ai,rad_Ai = knn_direct(P,k,i,np.hstack((Ai,m)).astype(np.uint64),return_rad=True)
28526  *     else:
28527  *         Ai,rad_Ai = knn_direct(P,k,i,np.hstack((m,Ai)).astype(np.uint64),return_rad=True)             # <<<<<<<<<<<<<<
28528  *     cbox_sol = np.zeros(3,dtype=np.float64)
28529  *     rbox_sol = quadtree_box(P[i,:],P[Ai[k-1],:],order,DLE,DRE,cbox_sol)
28530  */
28531   /*else*/ {
28532     __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_knn_direct); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1132, __pyx_L1_error)
28533     __Pyx_GOTREF(__pyx_t_13);
28534     __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1132, __pyx_L1_error)
28535     __Pyx_GOTREF(__pyx_t_10);
28536     __pyx_t_6 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1132, __pyx_L1_error)
28537     __Pyx_GOTREF(__pyx_t_6);
28538     __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1132, __pyx_L1_error)
28539     __Pyx_GOTREF(__pyx_t_9);
28540     __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_hstack); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1132, __pyx_L1_error)
28541     __Pyx_GOTREF(__pyx_t_8);
28542     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
28543     __pyx_t_9 = __Pyx_PyInt_From_npy_uint64(__pyx_v_m); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1132, __pyx_L1_error)
28544     __Pyx_GOTREF(__pyx_t_9);
28545     __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1132, __pyx_L1_error)
28546     __Pyx_GOTREF(__pyx_t_12);
28547     __Pyx_GIVEREF(__pyx_t_9);
28548     PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9);
28549     __Pyx_INCREF(((PyObject *)__pyx_v_Ai));
28550     __Pyx_GIVEREF(((PyObject *)__pyx_v_Ai));
28551     PyTuple_SET_ITEM(__pyx_t_12, 1, ((PyObject *)__pyx_v_Ai));
28552     __pyx_t_9 = 0;
28553     __pyx_t_9 = NULL;
28554     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
28555       __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
28556       if (likely(__pyx_t_9)) {
28557         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
28558         __Pyx_INCREF(__pyx_t_9);
28559         __Pyx_INCREF(function);
28560         __Pyx_DECREF_SET(__pyx_t_8, function);
28561       }
28562     }
28563     __pyx_t_5 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_12) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_12);
28564     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
28565     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
28566     if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1132, __pyx_L1_error)
28567     __Pyx_GOTREF(__pyx_t_5);
28568     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
28569     __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_astype); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1132, __pyx_L1_error)
28570     __Pyx_GOTREF(__pyx_t_8);
28571     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
28572     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1132, __pyx_L1_error)
28573     __Pyx_GOTREF(__pyx_t_5);
28574     __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_uint64); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1132, __pyx_L1_error)
28575     __Pyx_GOTREF(__pyx_t_12);
28576     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
28577     __pyx_t_5 = NULL;
28578     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
28579       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
28580       if (likely(__pyx_t_5)) {
28581         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
28582         __Pyx_INCREF(__pyx_t_5);
28583         __Pyx_INCREF(function);
28584         __Pyx_DECREF_SET(__pyx_t_8, function);
28585       }
28586     }
28587     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_5, __pyx_t_12) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_12);
28588     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
28589     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
28590     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1132, __pyx_L1_error)
28591     __Pyx_GOTREF(__pyx_t_3);
28592     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
28593     __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1132, __pyx_L1_error)
28594     __Pyx_GOTREF(__pyx_t_8);
28595     __Pyx_INCREF(((PyObject *)__pyx_v_P));
28596     __Pyx_GIVEREF(((PyObject *)__pyx_v_P));
28597     PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_P));
28598     __Pyx_GIVEREF(__pyx_t_10);
28599     PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_10);
28600     __Pyx_GIVEREF(__pyx_t_6);
28601     PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_6);
28602     __Pyx_GIVEREF(__pyx_t_3);
28603     PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_3);
28604     __pyx_t_10 = 0;
28605     __pyx_t_6 = 0;
28606     __pyx_t_3 = 0;
28607     __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1132, __pyx_L1_error)
28608     __Pyx_GOTREF(__pyx_t_3);
28609     if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return_rad, Py_True) < 0) __PYX_ERR(1, 1132, __pyx_L1_error)
28610     __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_8, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1132, __pyx_L1_error)
28611     __Pyx_GOTREF(__pyx_t_6);
28612     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
28613     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
28614     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
28615     if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
28616       PyObject* sequence = __pyx_t_6;
28617       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
28618       if (unlikely(size != 2)) {
28619         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
28620         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
28621         __PYX_ERR(1, 1132, __pyx_L1_error)
28622       }
28623       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
28624       if (likely(PyTuple_CheckExact(sequence))) {
28625         __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
28626         __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
28627       } else {
28628         __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
28629         __pyx_t_8 = PyList_GET_ITEM(sequence, 1);
28630       }
28631       __Pyx_INCREF(__pyx_t_3);
28632       __Pyx_INCREF(__pyx_t_8);
28633       #else
28634       __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1132, __pyx_L1_error)
28635       __Pyx_GOTREF(__pyx_t_3);
28636       __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1132, __pyx_L1_error)
28637       __Pyx_GOTREF(__pyx_t_8);
28638       #endif
28639       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
28640     } else {
28641       Py_ssize_t index = -1;
28642       __pyx_t_13 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1132, __pyx_L1_error)
28643       __Pyx_GOTREF(__pyx_t_13);
28644       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
28645       __pyx_t_16 = Py_TYPE(__pyx_t_13)->tp_iternext;
28646       index = 0; __pyx_t_3 = __pyx_t_16(__pyx_t_13); if (unlikely(!__pyx_t_3)) goto __pyx_L11_unpacking_failed;
28647       __Pyx_GOTREF(__pyx_t_3);
28648       index = 1; __pyx_t_8 = __pyx_t_16(__pyx_t_13); if (unlikely(!__pyx_t_8)) goto __pyx_L11_unpacking_failed;
28649       __Pyx_GOTREF(__pyx_t_8);
28650       if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_13), 2) < 0) __PYX_ERR(1, 1132, __pyx_L1_error)
28651       __pyx_t_16 = NULL;
28652       __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
28653       goto __pyx_L12_unpacking_done;
28654       __pyx_L11_unpacking_failed:;
28655       __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
28656       __pyx_t_16 = NULL;
28657       if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
28658       __PYX_ERR(1, 1132, __pyx_L1_error)
28659       __pyx_L12_unpacking_done:;
28660     }
28661     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 1132, __pyx_L1_error)
28662     __pyx_t_17 = ((PyArrayObject *)__pyx_t_3);
28663     {
28664       __Pyx_BufFmt_StackElem __pyx_stack[1];
28665       __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer);
28666       __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
28667       if (unlikely(__pyx_t_15 < 0)) {
28668         PyErr_Fetch(&__pyx_t_20, &__pyx_t_19, &__pyx_t_18);
28669         if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer, (PyObject*)__pyx_v_Ai, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
28670           Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_18);
28671           __Pyx_RaiseBufferFallbackError();
28672         } else {
28673           PyErr_Restore(__pyx_t_20, __pyx_t_19, __pyx_t_18);
28674         }
28675         __pyx_t_20 = __pyx_t_19 = __pyx_t_18 = 0;
28676       }
28677       __pyx_pybuffernd_Ai.diminfo[0].strides = __pyx_pybuffernd_Ai.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Ai.diminfo[0].shape = __pyx_pybuffernd_Ai.rcbuffer->pybuffer.shape[0];
28678       if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(1, 1132, __pyx_L1_error)
28679     }
28680     __pyx_t_17 = 0;
28681     __Pyx_DECREF_SET(__pyx_v_Ai, ((PyArrayObject *)__pyx_t_3));
28682     __pyx_t_3 = 0;
28683     __pyx_v_rad_Ai = __pyx_t_8;
28684     __pyx_t_8 = 0;
28685   }
28686   __pyx_L8:;
28687 
28688   /* "yt/utilities/lib/geometry_utils.pyx":1133
28689  *     else:
28690  *         Ai,rad_Ai = knn_direct(P,k,i,np.hstack((m,Ai)).astype(np.uint64),return_rad=True)
28691  *     cbox_sol = np.zeros(3,dtype=np.float64)             # <<<<<<<<<<<<<<
28692  *     rbox_sol = quadtree_box(P[i,:],P[Ai[k-1],:],order,DLE,DRE,cbox_sol)
28693  *     # Return current solution if hl box is outside current solution's box
28694  */
28695   __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1133, __pyx_L1_error)
28696   __Pyx_GOTREF(__pyx_t_6);
28697   __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1133, __pyx_L1_error)
28698   __Pyx_GOTREF(__pyx_t_8);
28699   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
28700   __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1133, __pyx_L1_error)
28701   __Pyx_GOTREF(__pyx_t_6);
28702   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1133, __pyx_L1_error)
28703   __Pyx_GOTREF(__pyx_t_3);
28704   __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1133, __pyx_L1_error)
28705   __Pyx_GOTREF(__pyx_t_13);
28706   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
28707   if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_13) < 0) __PYX_ERR(1, 1133, __pyx_L1_error)
28708   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
28709   __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__9, __pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1133, __pyx_L1_error)
28710   __Pyx_GOTREF(__pyx_t_13);
28711   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
28712   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
28713   __pyx_v_cbox_sol = __pyx_t_13;
28714   __pyx_t_13 = 0;
28715 
28716   /* "yt/utilities/lib/geometry_utils.pyx":1134
28717  *         Ai,rad_Ai = knn_direct(P,k,i,np.hstack((m,Ai)).astype(np.uint64),return_rad=True)
28718  *     cbox_sol = np.zeros(3,dtype=np.float64)
28719  *     rbox_sol = quadtree_box(P[i,:],P[Ai[k-1],:],order,DLE,DRE,cbox_sol)             # <<<<<<<<<<<<<<
28720  *     # Return current solution if hl box is outside current solution's box
28721  *     # Uses actual box
28722  */
28723   __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_quadtree_box); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1134, __pyx_L1_error)
28724   __Pyx_GOTREF(__pyx_t_6);
28725   __pyx_t_8 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1134, __pyx_L1_error)
28726   __Pyx_GOTREF(__pyx_t_8);
28727   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1134, __pyx_L1_error)
28728   __Pyx_GOTREF(__pyx_t_3);
28729   __Pyx_GIVEREF(__pyx_t_8);
28730   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8);
28731   __Pyx_INCREF(__pyx_slice__4);
28732   __Pyx_GIVEREF(__pyx_slice__4);
28733   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_slice__4);
28734   __pyx_t_8 = 0;
28735   __pyx_t_8 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1134, __pyx_L1_error)
28736   __Pyx_GOTREF(__pyx_t_8);
28737   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
28738   __pyx_t_21 = (__pyx_v_k - 1);
28739   __pyx_t_3 = __Pyx_PyInt_From_npy_uint64((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_Ai.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_Ai.diminfo[0].strides))); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1134, __pyx_L1_error)
28740   __Pyx_GOTREF(__pyx_t_3);
28741   __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1134, __pyx_L1_error)
28742   __Pyx_GOTREF(__pyx_t_10);
28743   __Pyx_GIVEREF(__pyx_t_3);
28744   PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3);
28745   __Pyx_INCREF(__pyx_slice__4);
28746   __Pyx_GIVEREF(__pyx_slice__4);
28747   PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_slice__4);
28748   __pyx_t_3 = 0;
28749   __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1134, __pyx_L1_error)
28750   __Pyx_GOTREF(__pyx_t_3);
28751   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
28752   __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_order); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1134, __pyx_L1_error)
28753   __Pyx_GOTREF(__pyx_t_10);
28754   __pyx_t_12 = NULL;
28755   __pyx_t_15 = 0;
28756   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
28757     __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_6);
28758     if (likely(__pyx_t_12)) {
28759       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
28760       __Pyx_INCREF(__pyx_t_12);
28761       __Pyx_INCREF(function);
28762       __Pyx_DECREF_SET(__pyx_t_6, function);
28763       __pyx_t_15 = 1;
28764     }
28765   }
28766   #if CYTHON_FAST_PYCALL
28767   if (PyFunction_Check(__pyx_t_6)) {
28768     PyObject *__pyx_temp[7] = {__pyx_t_12, __pyx_t_8, __pyx_t_3, __pyx_t_10, ((PyObject *)__pyx_v_DLE), ((PyObject *)__pyx_v_DRE), __pyx_v_cbox_sol};
28769     __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_15, 6+__pyx_t_15); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1134, __pyx_L1_error)
28770     __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
28771     __Pyx_GOTREF(__pyx_t_13);
28772     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
28773     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
28774     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
28775   } else
28776   #endif
28777   #if CYTHON_FAST_PYCCALL
28778   if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
28779     PyObject *__pyx_temp[7] = {__pyx_t_12, __pyx_t_8, __pyx_t_3, __pyx_t_10, ((PyObject *)__pyx_v_DLE), ((PyObject *)__pyx_v_DRE), __pyx_v_cbox_sol};
28780     __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_15, 6+__pyx_t_15); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1134, __pyx_L1_error)
28781     __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
28782     __Pyx_GOTREF(__pyx_t_13);
28783     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
28784     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
28785     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
28786   } else
28787   #endif
28788   {
28789     __pyx_t_5 = PyTuple_New(6+__pyx_t_15); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1134, __pyx_L1_error)
28790     __Pyx_GOTREF(__pyx_t_5);
28791     if (__pyx_t_12) {
28792       __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_12); __pyx_t_12 = NULL;
28793     }
28794     __Pyx_GIVEREF(__pyx_t_8);
28795     PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_15, __pyx_t_8);
28796     __Pyx_GIVEREF(__pyx_t_3);
28797     PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_15, __pyx_t_3);
28798     __Pyx_GIVEREF(__pyx_t_10);
28799     PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_15, __pyx_t_10);
28800     __Pyx_INCREF(((PyObject *)__pyx_v_DLE));
28801     __Pyx_GIVEREF(((PyObject *)__pyx_v_DLE));
28802     PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_15, ((PyObject *)__pyx_v_DLE));
28803     __Pyx_INCREF(((PyObject *)__pyx_v_DRE));
28804     __Pyx_GIVEREF(((PyObject *)__pyx_v_DRE));
28805     PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_15, ((PyObject *)__pyx_v_DRE));
28806     __Pyx_INCREF(__pyx_v_cbox_sol);
28807     __Pyx_GIVEREF(__pyx_v_cbox_sol);
28808     PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_15, __pyx_v_cbox_sol);
28809     __pyx_t_8 = 0;
28810     __pyx_t_3 = 0;
28811     __pyx_t_10 = 0;
28812     __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1134, __pyx_L1_error)
28813     __Pyx_GOTREF(__pyx_t_13);
28814     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
28815   }
28816   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
28817   __pyx_v_rbox_sol = __pyx_t_13;
28818   __pyx_t_13 = 0;
28819 
28820   /* "yt/utilities/lib/geometry_utils.pyx":1137
28821  *     # Return current solution if hl box is outside current solution's box
28822  *     # Uses actual box
28823  *     cbox_hl = np.zeros(3,dtype=np.float64)             # <<<<<<<<<<<<<<
28824  *     rbox_hl = quadtree_box(P[l,:],P[h,:],order,DLE,DRE,cbox_hl)
28825  *     if dist_to_box(cbox_sol,cbox_hl,rbox_hl) >= 1.5*rbox_sol:
28826  */
28827   __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1137, __pyx_L1_error)
28828   __Pyx_GOTREF(__pyx_t_13);
28829   __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1137, __pyx_L1_error)
28830   __Pyx_GOTREF(__pyx_t_6);
28831   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
28832   __pyx_t_13 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1137, __pyx_L1_error)
28833   __Pyx_GOTREF(__pyx_t_13);
28834   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1137, __pyx_L1_error)
28835   __Pyx_GOTREF(__pyx_t_5);
28836   __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1137, __pyx_L1_error)
28837   __Pyx_GOTREF(__pyx_t_10);
28838   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
28839   if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(1, 1137, __pyx_L1_error)
28840   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
28841   __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__9, __pyx_t_13); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1137, __pyx_L1_error)
28842   __Pyx_GOTREF(__pyx_t_10);
28843   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
28844   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
28845   __pyx_v_cbox_hl = __pyx_t_10;
28846   __pyx_t_10 = 0;
28847 
28848   /* "yt/utilities/lib/geometry_utils.pyx":1138
28849  *     # Uses actual box
28850  *     cbox_hl = np.zeros(3,dtype=np.float64)
28851  *     rbox_hl = quadtree_box(P[l,:],P[h,:],order,DLE,DRE,cbox_hl)             # <<<<<<<<<<<<<<
28852  *     if dist_to_box(cbox_sol,cbox_hl,rbox_hl) >= 1.5*rbox_sol:
28853  *         print('{} outside: rad = {}, rbox = {}, dist = {}'.format(m,rad_Ai,rbox_sol,dist_to_box(P[i,:],cbox_hl,rbox_hl)))
28854  */
28855   __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_quadtree_box); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1138, __pyx_L1_error)
28856   __Pyx_GOTREF(__pyx_t_13);
28857   __pyx_t_6 = __Pyx_PyInt_From_npy_uint64(__pyx_v_l); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1138, __pyx_L1_error)
28858   __Pyx_GOTREF(__pyx_t_6);
28859   __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1138, __pyx_L1_error)
28860   __Pyx_GOTREF(__pyx_t_5);
28861   __Pyx_GIVEREF(__pyx_t_6);
28862   PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
28863   __Pyx_INCREF(__pyx_slice__4);
28864   __Pyx_GIVEREF(__pyx_slice__4);
28865   PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_slice__4);
28866   __pyx_t_6 = 0;
28867   __pyx_t_6 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1138, __pyx_L1_error)
28868   __Pyx_GOTREF(__pyx_t_6);
28869   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
28870   __pyx_t_5 = __Pyx_PyInt_From_npy_uint64(__pyx_v_h); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1138, __pyx_L1_error)
28871   __Pyx_GOTREF(__pyx_t_5);
28872   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1138, __pyx_L1_error)
28873   __Pyx_GOTREF(__pyx_t_3);
28874   __Pyx_GIVEREF(__pyx_t_5);
28875   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
28876   __Pyx_INCREF(__pyx_slice__4);
28877   __Pyx_GIVEREF(__pyx_slice__4);
28878   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_slice__4);
28879   __pyx_t_5 = 0;
28880   __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1138, __pyx_L1_error)
28881   __Pyx_GOTREF(__pyx_t_5);
28882   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
28883   __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_order); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1138, __pyx_L1_error)
28884   __Pyx_GOTREF(__pyx_t_3);
28885   __pyx_t_8 = NULL;
28886   __pyx_t_15 = 0;
28887   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
28888     __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_13);
28889     if (likely(__pyx_t_8)) {
28890       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
28891       __Pyx_INCREF(__pyx_t_8);
28892       __Pyx_INCREF(function);
28893       __Pyx_DECREF_SET(__pyx_t_13, function);
28894       __pyx_t_15 = 1;
28895     }
28896   }
28897   #if CYTHON_FAST_PYCALL
28898   if (PyFunction_Check(__pyx_t_13)) {
28899     PyObject *__pyx_temp[7] = {__pyx_t_8, __pyx_t_6, __pyx_t_5, __pyx_t_3, ((PyObject *)__pyx_v_DLE), ((PyObject *)__pyx_v_DRE), __pyx_v_cbox_hl};
28900     __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_15, 6+__pyx_t_15); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1138, __pyx_L1_error)
28901     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
28902     __Pyx_GOTREF(__pyx_t_10);
28903     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
28904     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
28905     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
28906   } else
28907   #endif
28908   #if CYTHON_FAST_PYCCALL
28909   if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
28910     PyObject *__pyx_temp[7] = {__pyx_t_8, __pyx_t_6, __pyx_t_5, __pyx_t_3, ((PyObject *)__pyx_v_DLE), ((PyObject *)__pyx_v_DRE), __pyx_v_cbox_hl};
28911     __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_15, 6+__pyx_t_15); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1138, __pyx_L1_error)
28912     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
28913     __Pyx_GOTREF(__pyx_t_10);
28914     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
28915     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
28916     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
28917   } else
28918   #endif
28919   {
28920     __pyx_t_12 = PyTuple_New(6+__pyx_t_15); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1138, __pyx_L1_error)
28921     __Pyx_GOTREF(__pyx_t_12);
28922     if (__pyx_t_8) {
28923       __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_8); __pyx_t_8 = NULL;
28924     }
28925     __Pyx_GIVEREF(__pyx_t_6);
28926     PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_15, __pyx_t_6);
28927     __Pyx_GIVEREF(__pyx_t_5);
28928     PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_15, __pyx_t_5);
28929     __Pyx_GIVEREF(__pyx_t_3);
28930     PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_15, __pyx_t_3);
28931     __Pyx_INCREF(((PyObject *)__pyx_v_DLE));
28932     __Pyx_GIVEREF(((PyObject *)__pyx_v_DLE));
28933     PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_15, ((PyObject *)__pyx_v_DLE));
28934     __Pyx_INCREF(((PyObject *)__pyx_v_DRE));
28935     __Pyx_GIVEREF(((PyObject *)__pyx_v_DRE));
28936     PyTuple_SET_ITEM(__pyx_t_12, 4+__pyx_t_15, ((PyObject *)__pyx_v_DRE));
28937     __Pyx_INCREF(__pyx_v_cbox_hl);
28938     __Pyx_GIVEREF(__pyx_v_cbox_hl);
28939     PyTuple_SET_ITEM(__pyx_t_12, 5+__pyx_t_15, __pyx_v_cbox_hl);
28940     __pyx_t_6 = 0;
28941     __pyx_t_5 = 0;
28942     __pyx_t_3 = 0;
28943     __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_12, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1138, __pyx_L1_error)
28944     __Pyx_GOTREF(__pyx_t_10);
28945     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
28946   }
28947   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
28948   __pyx_v_rbox_hl = __pyx_t_10;
28949   __pyx_t_10 = 0;
28950 
28951   /* "yt/utilities/lib/geometry_utils.pyx":1139
28952  *     cbox_hl = np.zeros(3,dtype=np.float64)
28953  *     rbox_hl = quadtree_box(P[l,:],P[h,:],order,DLE,DRE,cbox_hl)
28954  *     if dist_to_box(cbox_sol,cbox_hl,rbox_hl) >= 1.5*rbox_sol:             # <<<<<<<<<<<<<<
28955  *         print('{} outside: rad = {}, rbox = {}, dist = {}'.format(m,rad_Ai,rbox_sol,dist_to_box(P[i,:],cbox_hl,rbox_hl)))
28956  *         return Ai
28957  */
28958   __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_dist_to_box); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1139, __pyx_L1_error)
28959   __Pyx_GOTREF(__pyx_t_13);
28960   __pyx_t_12 = NULL;
28961   __pyx_t_15 = 0;
28962   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
28963     __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13);
28964     if (likely(__pyx_t_12)) {
28965       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
28966       __Pyx_INCREF(__pyx_t_12);
28967       __Pyx_INCREF(function);
28968       __Pyx_DECREF_SET(__pyx_t_13, function);
28969       __pyx_t_15 = 1;
28970     }
28971   }
28972   #if CYTHON_FAST_PYCALL
28973   if (PyFunction_Check(__pyx_t_13)) {
28974     PyObject *__pyx_temp[4] = {__pyx_t_12, __pyx_v_cbox_sol, __pyx_v_cbox_hl, __pyx_v_rbox_hl};
28975     __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_15, 3+__pyx_t_15); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1139, __pyx_L1_error)
28976     __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
28977     __Pyx_GOTREF(__pyx_t_10);
28978   } else
28979   #endif
28980   #if CYTHON_FAST_PYCCALL
28981   if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
28982     PyObject *__pyx_temp[4] = {__pyx_t_12, __pyx_v_cbox_sol, __pyx_v_cbox_hl, __pyx_v_rbox_hl};
28983     __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_15, 3+__pyx_t_15); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1139, __pyx_L1_error)
28984     __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
28985     __Pyx_GOTREF(__pyx_t_10);
28986   } else
28987   #endif
28988   {
28989     __pyx_t_3 = PyTuple_New(3+__pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1139, __pyx_L1_error)
28990     __Pyx_GOTREF(__pyx_t_3);
28991     if (__pyx_t_12) {
28992       __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); __pyx_t_12 = NULL;
28993     }
28994     __Pyx_INCREF(__pyx_v_cbox_sol);
28995     __Pyx_GIVEREF(__pyx_v_cbox_sol);
28996     PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_15, __pyx_v_cbox_sol);
28997     __Pyx_INCREF(__pyx_v_cbox_hl);
28998     __Pyx_GIVEREF(__pyx_v_cbox_hl);
28999     PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_15, __pyx_v_cbox_hl);
29000     __Pyx_INCREF(__pyx_v_rbox_hl);
29001     __Pyx_GIVEREF(__pyx_v_rbox_hl);
29002     PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_15, __pyx_v_rbox_hl);
29003     __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_3, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1139, __pyx_L1_error)
29004     __Pyx_GOTREF(__pyx_t_10);
29005     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29006   }
29007   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
29008   __pyx_t_13 = PyNumber_Multiply(__pyx_float_1_5, __pyx_v_rbox_sol); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1139, __pyx_L1_error)
29009   __Pyx_GOTREF(__pyx_t_13);
29010   __pyx_t_3 = PyObject_RichCompare(__pyx_t_10, __pyx_t_13, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1139, __pyx_L1_error)
29011   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
29012   __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
29013   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 1139, __pyx_L1_error)
29014   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29015   if (__pyx_t_1) {
29016 
29017     /* "yt/utilities/lib/geometry_utils.pyx":1140
29018  *     rbox_hl = quadtree_box(P[l,:],P[h,:],order,DLE,DRE,cbox_hl)
29019  *     if dist_to_box(cbox_sol,cbox_hl,rbox_hl) >= 1.5*rbox_sol:
29020  *         print('{} outside: rad = {}, rbox = {}, dist = {}'.format(m,rad_Ai,rbox_sol,dist_to_box(P[i,:],cbox_hl,rbox_hl)))             # <<<<<<<<<<<<<<
29021  *         return Ai
29022  *     # Expand search to lower/higher indicies as needed
29023  */
29024     __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_outside_rad_rbox_dist, __pyx_n_s_format); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1140, __pyx_L1_error)
29025     __Pyx_GOTREF(__pyx_t_13);
29026     __pyx_t_10 = __Pyx_PyInt_From_npy_uint64(__pyx_v_m); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1140, __pyx_L1_error)
29027     __Pyx_GOTREF(__pyx_t_10);
29028     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_dist_to_box); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1140, __pyx_L1_error)
29029     __Pyx_GOTREF(__pyx_t_5);
29030     __pyx_t_6 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1140, __pyx_L1_error)
29031     __Pyx_GOTREF(__pyx_t_6);
29032     __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1140, __pyx_L1_error)
29033     __Pyx_GOTREF(__pyx_t_8);
29034     __Pyx_GIVEREF(__pyx_t_6);
29035     PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
29036     __Pyx_INCREF(__pyx_slice__4);
29037     __Pyx_GIVEREF(__pyx_slice__4);
29038     PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_slice__4);
29039     __pyx_t_6 = 0;
29040     __pyx_t_6 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1140, __pyx_L1_error)
29041     __Pyx_GOTREF(__pyx_t_6);
29042     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
29043     __pyx_t_8 = NULL;
29044     __pyx_t_15 = 0;
29045     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
29046       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
29047       if (likely(__pyx_t_8)) {
29048         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
29049         __Pyx_INCREF(__pyx_t_8);
29050         __Pyx_INCREF(function);
29051         __Pyx_DECREF_SET(__pyx_t_5, function);
29052         __pyx_t_15 = 1;
29053       }
29054     }
29055     #if CYTHON_FAST_PYCALL
29056     if (PyFunction_Check(__pyx_t_5)) {
29057       PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_6, __pyx_v_cbox_hl, __pyx_v_rbox_hl};
29058       __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_15, 3+__pyx_t_15); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1140, __pyx_L1_error)
29059       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
29060       __Pyx_GOTREF(__pyx_t_12);
29061       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29062     } else
29063     #endif
29064     #if CYTHON_FAST_PYCCALL
29065     if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
29066       PyObject *__pyx_temp[4] = {__pyx_t_8, __pyx_t_6, __pyx_v_cbox_hl, __pyx_v_rbox_hl};
29067       __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_15, 3+__pyx_t_15); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1140, __pyx_L1_error)
29068       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
29069       __Pyx_GOTREF(__pyx_t_12);
29070       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29071     } else
29072     #endif
29073     {
29074       __pyx_t_9 = PyTuple_New(3+__pyx_t_15); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1140, __pyx_L1_error)
29075       __Pyx_GOTREF(__pyx_t_9);
29076       if (__pyx_t_8) {
29077         __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
29078       }
29079       __Pyx_GIVEREF(__pyx_t_6);
29080       PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_15, __pyx_t_6);
29081       __Pyx_INCREF(__pyx_v_cbox_hl);
29082       __Pyx_GIVEREF(__pyx_v_cbox_hl);
29083       PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_15, __pyx_v_cbox_hl);
29084       __Pyx_INCREF(__pyx_v_rbox_hl);
29085       __Pyx_GIVEREF(__pyx_v_rbox_hl);
29086       PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_15, __pyx_v_rbox_hl);
29087       __pyx_t_6 = 0;
29088       __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1140, __pyx_L1_error)
29089       __Pyx_GOTREF(__pyx_t_12);
29090       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
29091     }
29092     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
29093     __pyx_t_5 = NULL;
29094     __pyx_t_15 = 0;
29095     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
29096       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_13);
29097       if (likely(__pyx_t_5)) {
29098         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
29099         __Pyx_INCREF(__pyx_t_5);
29100         __Pyx_INCREF(function);
29101         __Pyx_DECREF_SET(__pyx_t_13, function);
29102         __pyx_t_15 = 1;
29103       }
29104     }
29105     #if CYTHON_FAST_PYCALL
29106     if (PyFunction_Check(__pyx_t_13)) {
29107       PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_t_10, __pyx_v_rad_Ai, __pyx_v_rbox_sol, __pyx_t_12};
29108       __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_15, 4+__pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1140, __pyx_L1_error)
29109       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
29110       __Pyx_GOTREF(__pyx_t_3);
29111       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
29112       __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
29113     } else
29114     #endif
29115     #if CYTHON_FAST_PYCCALL
29116     if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
29117       PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_t_10, __pyx_v_rad_Ai, __pyx_v_rbox_sol, __pyx_t_12};
29118       __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_15, 4+__pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1140, __pyx_L1_error)
29119       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
29120       __Pyx_GOTREF(__pyx_t_3);
29121       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
29122       __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
29123     } else
29124     #endif
29125     {
29126       __pyx_t_9 = PyTuple_New(4+__pyx_t_15); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1140, __pyx_L1_error)
29127       __Pyx_GOTREF(__pyx_t_9);
29128       if (__pyx_t_5) {
29129         __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __pyx_t_5 = NULL;
29130       }
29131       __Pyx_GIVEREF(__pyx_t_10);
29132       PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_15, __pyx_t_10);
29133       __Pyx_INCREF(__pyx_v_rad_Ai);
29134       __Pyx_GIVEREF(__pyx_v_rad_Ai);
29135       PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_15, __pyx_v_rad_Ai);
29136       __Pyx_INCREF(__pyx_v_rbox_sol);
29137       __Pyx_GIVEREF(__pyx_v_rbox_sol);
29138       PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_15, __pyx_v_rbox_sol);
29139       __Pyx_GIVEREF(__pyx_t_12);
29140       PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_15, __pyx_t_12);
29141       __pyx_t_10 = 0;
29142       __pyx_t_12 = 0;
29143       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1140, __pyx_L1_error)
29144       __Pyx_GOTREF(__pyx_t_3);
29145       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
29146     }
29147     __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
29148     if (__Pyx_PrintOne(0, __pyx_t_3) < 0) __PYX_ERR(1, 1140, __pyx_L1_error)
29149     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29150 
29151     /* "yt/utilities/lib/geometry_utils.pyx":1141
29152  *     if dist_to_box(cbox_sol,cbox_hl,rbox_hl) >= 1.5*rbox_sol:
29153  *         print('{} outside: rad = {}, rbox = {}, dist = {}'.format(m,rad_Ai,rbox_sol,dist_to_box(P[i,:],cbox_hl,rbox_hl)))
29154  *         return Ai             # <<<<<<<<<<<<<<
29155  *     # Expand search to lower/higher indicies as needed
29156  *     if i < m: # They are already sorted...
29157  */
29158     __Pyx_XDECREF(__pyx_r);
29159     __Pyx_INCREF(((PyObject *)__pyx_v_Ai));
29160     __pyx_r = ((PyObject *)__pyx_v_Ai);
29161     goto __pyx_L0;
29162 
29163     /* "yt/utilities/lib/geometry_utils.pyx":1139
29164  *     cbox_hl = np.zeros(3,dtype=np.float64)
29165  *     rbox_hl = quadtree_box(P[l,:],P[h,:],order,DLE,DRE,cbox_hl)
29166  *     if dist_to_box(cbox_sol,cbox_hl,rbox_hl) >= 1.5*rbox_sol:             # <<<<<<<<<<<<<<
29167  *         print('{} outside: rad = {}, rbox = {}, dist = {}'.format(m,rad_Ai,rbox_sol,dist_to_box(P[i,:],cbox_hl,rbox_hl)))
29168  *         return Ai
29169  */
29170   }
29171 
29172   /* "yt/utilities/lib/geometry_utils.pyx":1143
29173  *         return Ai
29174  *     # Expand search to lower/higher indicies as needed
29175  *     if i < m: # They are already sorted...             # <<<<<<<<<<<<<<
29176  *         Ai = csearch_morton(P,k,i,Ai,l,m-1,order,DLE,DRE,nu=nu)
29177  *         if compare_morton(P[m,:],P[i,:]+dist(P[i,:],P[Ai[k-1],:])):
29178  */
29179   __pyx_t_1 = ((__pyx_v_i < __pyx_v_m) != 0);
29180   if (__pyx_t_1) {
29181 
29182     /* "yt/utilities/lib/geometry_utils.pyx":1144
29183  *     # Expand search to lower/higher indicies as needed
29184  *     if i < m: # They are already sorted...
29185  *         Ai = csearch_morton(P,k,i,Ai,l,m-1,order,DLE,DRE,nu=nu)             # <<<<<<<<<<<<<<
29186  *         if compare_morton(P[m,:],P[i,:]+dist(P[i,:],P[Ai[k-1],:])):
29187  *             Ai = csearch_morton(P,k,i,Ai,m+1,h,order,DLE,DRE,nu=nu)
29188  */
29189     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_csearch_morton); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1144, __pyx_L1_error)
29190     __Pyx_GOTREF(__pyx_t_3);
29191     __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1144, __pyx_L1_error)
29192     __Pyx_GOTREF(__pyx_t_13);
29193     __pyx_t_9 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1144, __pyx_L1_error)
29194     __Pyx_GOTREF(__pyx_t_9);
29195     __pyx_t_12 = __Pyx_PyInt_From_npy_uint64(__pyx_v_l); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1144, __pyx_L1_error)
29196     __Pyx_GOTREF(__pyx_t_12);
29197     __pyx_t_10 = __Pyx_PyInt_From_npy_uint64((__pyx_v_m - 1)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1144, __pyx_L1_error)
29198     __Pyx_GOTREF(__pyx_t_10);
29199     __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_order); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1144, __pyx_L1_error)
29200     __Pyx_GOTREF(__pyx_t_5);
29201     __pyx_t_6 = PyTuple_New(9); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1144, __pyx_L1_error)
29202     __Pyx_GOTREF(__pyx_t_6);
29203     __Pyx_INCREF(((PyObject *)__pyx_v_P));
29204     __Pyx_GIVEREF(((PyObject *)__pyx_v_P));
29205     PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_P));
29206     __Pyx_GIVEREF(__pyx_t_13);
29207     PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_13);
29208     __Pyx_GIVEREF(__pyx_t_9);
29209     PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_9);
29210     __Pyx_INCREF(((PyObject *)__pyx_v_Ai));
29211     __Pyx_GIVEREF(((PyObject *)__pyx_v_Ai));
29212     PyTuple_SET_ITEM(__pyx_t_6, 3, ((PyObject *)__pyx_v_Ai));
29213     __Pyx_GIVEREF(__pyx_t_12);
29214     PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_12);
29215     __Pyx_GIVEREF(__pyx_t_10);
29216     PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_t_10);
29217     __Pyx_GIVEREF(__pyx_t_5);
29218     PyTuple_SET_ITEM(__pyx_t_6, 6, __pyx_t_5);
29219     __Pyx_INCREF(((PyObject *)__pyx_v_DLE));
29220     __Pyx_GIVEREF(((PyObject *)__pyx_v_DLE));
29221     PyTuple_SET_ITEM(__pyx_t_6, 7, ((PyObject *)__pyx_v_DLE));
29222     __Pyx_INCREF(((PyObject *)__pyx_v_DRE));
29223     __Pyx_GIVEREF(((PyObject *)__pyx_v_DRE));
29224     PyTuple_SET_ITEM(__pyx_t_6, 8, ((PyObject *)__pyx_v_DRE));
29225     __pyx_t_13 = 0;
29226     __pyx_t_9 = 0;
29227     __pyx_t_12 = 0;
29228     __pyx_t_10 = 0;
29229     __pyx_t_5 = 0;
29230     __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1144, __pyx_L1_error)
29231     __Pyx_GOTREF(__pyx_t_5);
29232     __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_nu); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1144, __pyx_L1_error)
29233     __Pyx_GOTREF(__pyx_t_10);
29234     if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_nu, __pyx_t_10) < 0) __PYX_ERR(1, 1144, __pyx_L1_error)
29235     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
29236     __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1144, __pyx_L1_error)
29237     __Pyx_GOTREF(__pyx_t_10);
29238     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29239     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29240     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
29241     if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 1144, __pyx_L1_error)
29242     __pyx_t_17 = ((PyArrayObject *)__pyx_t_10);
29243     {
29244       __Pyx_BufFmt_StackElem __pyx_stack[1];
29245       __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer);
29246       __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
29247       if (unlikely(__pyx_t_15 < 0)) {
29248         PyErr_Fetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
29249         if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer, (PyObject*)__pyx_v_Ai, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
29250           Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20);
29251           __Pyx_RaiseBufferFallbackError();
29252         } else {
29253           PyErr_Restore(__pyx_t_18, __pyx_t_19, __pyx_t_20);
29254         }
29255         __pyx_t_18 = __pyx_t_19 = __pyx_t_20 = 0;
29256       }
29257       __pyx_pybuffernd_Ai.diminfo[0].strides = __pyx_pybuffernd_Ai.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Ai.diminfo[0].shape = __pyx_pybuffernd_Ai.rcbuffer->pybuffer.shape[0];
29258       if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(1, 1144, __pyx_L1_error)
29259     }
29260     __pyx_t_17 = 0;
29261     __Pyx_DECREF_SET(__pyx_v_Ai, ((PyArrayObject *)__pyx_t_10));
29262     __pyx_t_10 = 0;
29263 
29264     /* "yt/utilities/lib/geometry_utils.pyx":1145
29265  *     if i < m: # They are already sorted...
29266  *         Ai = csearch_morton(P,k,i,Ai,l,m-1,order,DLE,DRE,nu=nu)
29267  *         if compare_morton(P[m,:],P[i,:]+dist(P[i,:],P[Ai[k-1],:])):             # <<<<<<<<<<<<<<
29268  *             Ai = csearch_morton(P,k,i,Ai,m+1,h,order,DLE,DRE,nu=nu)
29269  *     else:
29270  */
29271     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_compare_morton); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1145, __pyx_L1_error)
29272     __Pyx_GOTREF(__pyx_t_5);
29273     __pyx_t_6 = __Pyx_PyInt_From_npy_uint64(__pyx_v_m); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1145, __pyx_L1_error)
29274     __Pyx_GOTREF(__pyx_t_6);
29275     __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1145, __pyx_L1_error)
29276     __Pyx_GOTREF(__pyx_t_3);
29277     __Pyx_GIVEREF(__pyx_t_6);
29278     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
29279     __Pyx_INCREF(__pyx_slice__4);
29280     __Pyx_GIVEREF(__pyx_slice__4);
29281     PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_slice__4);
29282     __pyx_t_6 = 0;
29283     __pyx_t_6 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1145, __pyx_L1_error)
29284     __Pyx_GOTREF(__pyx_t_6);
29285     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29286     __pyx_t_3 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1145, __pyx_L1_error)
29287     __Pyx_GOTREF(__pyx_t_3);
29288     __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1145, __pyx_L1_error)
29289     __Pyx_GOTREF(__pyx_t_12);
29290     __Pyx_GIVEREF(__pyx_t_3);
29291     PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_3);
29292     __Pyx_INCREF(__pyx_slice__4);
29293     __Pyx_GIVEREF(__pyx_slice__4);
29294     PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_slice__4);
29295     __pyx_t_3 = 0;
29296     __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1145, __pyx_L1_error)
29297     __Pyx_GOTREF(__pyx_t_3);
29298     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
29299     __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_dist); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1145, __pyx_L1_error)
29300     __Pyx_GOTREF(__pyx_t_9);
29301     __pyx_t_13 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1145, __pyx_L1_error)
29302     __Pyx_GOTREF(__pyx_t_13);
29303     __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1145, __pyx_L1_error)
29304     __Pyx_GOTREF(__pyx_t_8);
29305     __Pyx_GIVEREF(__pyx_t_13);
29306     PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_13);
29307     __Pyx_INCREF(__pyx_slice__4);
29308     __Pyx_GIVEREF(__pyx_slice__4);
29309     PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_slice__4);
29310     __pyx_t_13 = 0;
29311     __pyx_t_13 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_8); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1145, __pyx_L1_error)
29312     __Pyx_GOTREF(__pyx_t_13);
29313     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
29314     __pyx_t_22 = (__pyx_v_k - 1);
29315     __pyx_t_8 = __Pyx_PyInt_From_npy_uint64((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_Ai.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_Ai.diminfo[0].strides))); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1145, __pyx_L1_error)
29316     __Pyx_GOTREF(__pyx_t_8);
29317     __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 1145, __pyx_L1_error)
29318     __Pyx_GOTREF(__pyx_t_11);
29319     __Pyx_GIVEREF(__pyx_t_8);
29320     PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_8);
29321     __Pyx_INCREF(__pyx_slice__4);
29322     __Pyx_GIVEREF(__pyx_slice__4);
29323     PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_slice__4);
29324     __pyx_t_8 = 0;
29325     __pyx_t_8 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1145, __pyx_L1_error)
29326     __Pyx_GOTREF(__pyx_t_8);
29327     __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
29328     __pyx_t_11 = NULL;
29329     __pyx_t_15 = 0;
29330     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
29331       __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9);
29332       if (likely(__pyx_t_11)) {
29333         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
29334         __Pyx_INCREF(__pyx_t_11);
29335         __Pyx_INCREF(function);
29336         __Pyx_DECREF_SET(__pyx_t_9, function);
29337         __pyx_t_15 = 1;
29338       }
29339     }
29340     #if CYTHON_FAST_PYCALL
29341     if (PyFunction_Check(__pyx_t_9)) {
29342       PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_13, __pyx_t_8};
29343       __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1145, __pyx_L1_error)
29344       __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
29345       __Pyx_GOTREF(__pyx_t_12);
29346       __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
29347       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
29348     } else
29349     #endif
29350     #if CYTHON_FAST_PYCCALL
29351     if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
29352       PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_13, __pyx_t_8};
29353       __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1145, __pyx_L1_error)
29354       __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
29355       __Pyx_GOTREF(__pyx_t_12);
29356       __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
29357       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
29358     } else
29359     #endif
29360     {
29361       __pyx_t_14 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 1145, __pyx_L1_error)
29362       __Pyx_GOTREF(__pyx_t_14);
29363       if (__pyx_t_11) {
29364         __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_11); __pyx_t_11 = NULL;
29365       }
29366       __Pyx_GIVEREF(__pyx_t_13);
29367       PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_15, __pyx_t_13);
29368       __Pyx_GIVEREF(__pyx_t_8);
29369       PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_15, __pyx_t_8);
29370       __pyx_t_13 = 0;
29371       __pyx_t_8 = 0;
29372       __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_14, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1145, __pyx_L1_error)
29373       __Pyx_GOTREF(__pyx_t_12);
29374       __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
29375     }
29376     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
29377     __pyx_t_9 = PyNumber_Add(__pyx_t_3, __pyx_t_12); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1145, __pyx_L1_error)
29378     __Pyx_GOTREF(__pyx_t_9);
29379     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29380     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
29381     __pyx_t_12 = NULL;
29382     __pyx_t_15 = 0;
29383     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
29384       __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_5);
29385       if (likely(__pyx_t_12)) {
29386         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
29387         __Pyx_INCREF(__pyx_t_12);
29388         __Pyx_INCREF(function);
29389         __Pyx_DECREF_SET(__pyx_t_5, function);
29390         __pyx_t_15 = 1;
29391       }
29392     }
29393     #if CYTHON_FAST_PYCALL
29394     if (PyFunction_Check(__pyx_t_5)) {
29395       PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_6, __pyx_t_9};
29396       __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1145, __pyx_L1_error)
29397       __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
29398       __Pyx_GOTREF(__pyx_t_10);
29399       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29400       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
29401     } else
29402     #endif
29403     #if CYTHON_FAST_PYCCALL
29404     if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
29405       PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_6, __pyx_t_9};
29406       __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1145, __pyx_L1_error)
29407       __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
29408       __Pyx_GOTREF(__pyx_t_10);
29409       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29410       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
29411     } else
29412     #endif
29413     {
29414       __pyx_t_3 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1145, __pyx_L1_error)
29415       __Pyx_GOTREF(__pyx_t_3);
29416       if (__pyx_t_12) {
29417         __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); __pyx_t_12 = NULL;
29418       }
29419       __Pyx_GIVEREF(__pyx_t_6);
29420       PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_15, __pyx_t_6);
29421       __Pyx_GIVEREF(__pyx_t_9);
29422       PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_15, __pyx_t_9);
29423       __pyx_t_6 = 0;
29424       __pyx_t_9 = 0;
29425       __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1145, __pyx_L1_error)
29426       __Pyx_GOTREF(__pyx_t_10);
29427       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29428     }
29429     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
29430     __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 1145, __pyx_L1_error)
29431     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
29432     if (__pyx_t_1) {
29433 
29434       /* "yt/utilities/lib/geometry_utils.pyx":1146
29435  *         Ai = csearch_morton(P,k,i,Ai,l,m-1,order,DLE,DRE,nu=nu)
29436  *         if compare_morton(P[m,:],P[i,:]+dist(P[i,:],P[Ai[k-1],:])):
29437  *             Ai = csearch_morton(P,k,i,Ai,m+1,h,order,DLE,DRE,nu=nu)             # <<<<<<<<<<<<<<
29438  *     else:
29439  *         Ai = csearch_morton(P,k,i,Ai,m+1,h,order,DLE,DRE,nu=nu)
29440  */
29441       __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_csearch_morton); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1146, __pyx_L1_error)
29442       __Pyx_GOTREF(__pyx_t_10);
29443       __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1146, __pyx_L1_error)
29444       __Pyx_GOTREF(__pyx_t_5);
29445       __pyx_t_3 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1146, __pyx_L1_error)
29446       __Pyx_GOTREF(__pyx_t_3);
29447       __pyx_t_9 = __Pyx_PyInt_From_npy_uint64((__pyx_v_m + 1)); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1146, __pyx_L1_error)
29448       __Pyx_GOTREF(__pyx_t_9);
29449       __pyx_t_6 = __Pyx_PyInt_From_npy_uint64(__pyx_v_h); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1146, __pyx_L1_error)
29450       __Pyx_GOTREF(__pyx_t_6);
29451       __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_order); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1146, __pyx_L1_error)
29452       __Pyx_GOTREF(__pyx_t_12);
29453       __pyx_t_14 = PyTuple_New(9); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 1146, __pyx_L1_error)
29454       __Pyx_GOTREF(__pyx_t_14);
29455       __Pyx_INCREF(((PyObject *)__pyx_v_P));
29456       __Pyx_GIVEREF(((PyObject *)__pyx_v_P));
29457       PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_P));
29458       __Pyx_GIVEREF(__pyx_t_5);
29459       PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_5);
29460       __Pyx_GIVEREF(__pyx_t_3);
29461       PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_3);
29462       __Pyx_INCREF(((PyObject *)__pyx_v_Ai));
29463       __Pyx_GIVEREF(((PyObject *)__pyx_v_Ai));
29464       PyTuple_SET_ITEM(__pyx_t_14, 3, ((PyObject *)__pyx_v_Ai));
29465       __Pyx_GIVEREF(__pyx_t_9);
29466       PyTuple_SET_ITEM(__pyx_t_14, 4, __pyx_t_9);
29467       __Pyx_GIVEREF(__pyx_t_6);
29468       PyTuple_SET_ITEM(__pyx_t_14, 5, __pyx_t_6);
29469       __Pyx_GIVEREF(__pyx_t_12);
29470       PyTuple_SET_ITEM(__pyx_t_14, 6, __pyx_t_12);
29471       __Pyx_INCREF(((PyObject *)__pyx_v_DLE));
29472       __Pyx_GIVEREF(((PyObject *)__pyx_v_DLE));
29473       PyTuple_SET_ITEM(__pyx_t_14, 7, ((PyObject *)__pyx_v_DLE));
29474       __Pyx_INCREF(((PyObject *)__pyx_v_DRE));
29475       __Pyx_GIVEREF(((PyObject *)__pyx_v_DRE));
29476       PyTuple_SET_ITEM(__pyx_t_14, 8, ((PyObject *)__pyx_v_DRE));
29477       __pyx_t_5 = 0;
29478       __pyx_t_3 = 0;
29479       __pyx_t_9 = 0;
29480       __pyx_t_6 = 0;
29481       __pyx_t_12 = 0;
29482       __pyx_t_12 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1146, __pyx_L1_error)
29483       __Pyx_GOTREF(__pyx_t_12);
29484       __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_nu); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1146, __pyx_L1_error)
29485       __Pyx_GOTREF(__pyx_t_6);
29486       if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_nu, __pyx_t_6) < 0) __PYX_ERR(1, 1146, __pyx_L1_error)
29487       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29488       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, __pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1146, __pyx_L1_error)
29489       __Pyx_GOTREF(__pyx_t_6);
29490       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
29491       __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
29492       __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
29493       if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 1146, __pyx_L1_error)
29494       __pyx_t_17 = ((PyArrayObject *)__pyx_t_6);
29495       {
29496         __Pyx_BufFmt_StackElem __pyx_stack[1];
29497         __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer);
29498         __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
29499         if (unlikely(__pyx_t_15 < 0)) {
29500           PyErr_Fetch(&__pyx_t_20, &__pyx_t_19, &__pyx_t_18);
29501           if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer, (PyObject*)__pyx_v_Ai, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
29502             Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_18);
29503             __Pyx_RaiseBufferFallbackError();
29504           } else {
29505             PyErr_Restore(__pyx_t_20, __pyx_t_19, __pyx_t_18);
29506           }
29507           __pyx_t_20 = __pyx_t_19 = __pyx_t_18 = 0;
29508         }
29509         __pyx_pybuffernd_Ai.diminfo[0].strides = __pyx_pybuffernd_Ai.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Ai.diminfo[0].shape = __pyx_pybuffernd_Ai.rcbuffer->pybuffer.shape[0];
29510         if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(1, 1146, __pyx_L1_error)
29511       }
29512       __pyx_t_17 = 0;
29513       __Pyx_DECREF_SET(__pyx_v_Ai, ((PyArrayObject *)__pyx_t_6));
29514       __pyx_t_6 = 0;
29515 
29516       /* "yt/utilities/lib/geometry_utils.pyx":1145
29517  *     if i < m: # They are already sorted...
29518  *         Ai = csearch_morton(P,k,i,Ai,l,m-1,order,DLE,DRE,nu=nu)
29519  *         if compare_morton(P[m,:],P[i,:]+dist(P[i,:],P[Ai[k-1],:])):             # <<<<<<<<<<<<<<
29520  *             Ai = csearch_morton(P,k,i,Ai,m+1,h,order,DLE,DRE,nu=nu)
29521  *     else:
29522  */
29523     }
29524 
29525     /* "yt/utilities/lib/geometry_utils.pyx":1143
29526  *         return Ai
29527  *     # Expand search to lower/higher indicies as needed
29528  *     if i < m: # They are already sorted...             # <<<<<<<<<<<<<<
29529  *         Ai = csearch_morton(P,k,i,Ai,l,m-1,order,DLE,DRE,nu=nu)
29530  *         if compare_morton(P[m,:],P[i,:]+dist(P[i,:],P[Ai[k-1],:])):
29531  */
29532     goto __pyx_L14;
29533   }
29534 
29535   /* "yt/utilities/lib/geometry_utils.pyx":1148
29536  *             Ai = csearch_morton(P,k,i,Ai,m+1,h,order,DLE,DRE,nu=nu)
29537  *     else:
29538  *         Ai = csearch_morton(P,k,i,Ai,m+1,h,order,DLE,DRE,nu=nu)             # <<<<<<<<<<<<<<
29539  *         if compare_morton(P[i,:]-dist(P[i,:],P[Ai[k-1],:]),P[m,:]):
29540  *             Ai = csearch_morton(P,k,i,Ai,l,m-1,order,DLE,DRE,nu=nu)
29541  */
29542   /*else*/ {
29543     __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_csearch_morton); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1148, __pyx_L1_error)
29544     __Pyx_GOTREF(__pyx_t_6);
29545     __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1148, __pyx_L1_error)
29546     __Pyx_GOTREF(__pyx_t_12);
29547     __pyx_t_14 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 1148, __pyx_L1_error)
29548     __Pyx_GOTREF(__pyx_t_14);
29549     __pyx_t_10 = __Pyx_PyInt_From_npy_uint64((__pyx_v_m + 1)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1148, __pyx_L1_error)
29550     __Pyx_GOTREF(__pyx_t_10);
29551     __pyx_t_9 = __Pyx_PyInt_From_npy_uint64(__pyx_v_h); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1148, __pyx_L1_error)
29552     __Pyx_GOTREF(__pyx_t_9);
29553     __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_order); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1148, __pyx_L1_error)
29554     __Pyx_GOTREF(__pyx_t_3);
29555     __pyx_t_5 = PyTuple_New(9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1148, __pyx_L1_error)
29556     __Pyx_GOTREF(__pyx_t_5);
29557     __Pyx_INCREF(((PyObject *)__pyx_v_P));
29558     __Pyx_GIVEREF(((PyObject *)__pyx_v_P));
29559     PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_P));
29560     __Pyx_GIVEREF(__pyx_t_12);
29561     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_12);
29562     __Pyx_GIVEREF(__pyx_t_14);
29563     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_14);
29564     __Pyx_INCREF(((PyObject *)__pyx_v_Ai));
29565     __Pyx_GIVEREF(((PyObject *)__pyx_v_Ai));
29566     PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_v_Ai));
29567     __Pyx_GIVEREF(__pyx_t_10);
29568     PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_t_10);
29569     __Pyx_GIVEREF(__pyx_t_9);
29570     PyTuple_SET_ITEM(__pyx_t_5, 5, __pyx_t_9);
29571     __Pyx_GIVEREF(__pyx_t_3);
29572     PyTuple_SET_ITEM(__pyx_t_5, 6, __pyx_t_3);
29573     __Pyx_INCREF(((PyObject *)__pyx_v_DLE));
29574     __Pyx_GIVEREF(((PyObject *)__pyx_v_DLE));
29575     PyTuple_SET_ITEM(__pyx_t_5, 7, ((PyObject *)__pyx_v_DLE));
29576     __Pyx_INCREF(((PyObject *)__pyx_v_DRE));
29577     __Pyx_GIVEREF(((PyObject *)__pyx_v_DRE));
29578     PyTuple_SET_ITEM(__pyx_t_5, 8, ((PyObject *)__pyx_v_DRE));
29579     __pyx_t_12 = 0;
29580     __pyx_t_14 = 0;
29581     __pyx_t_10 = 0;
29582     __pyx_t_9 = 0;
29583     __pyx_t_3 = 0;
29584     __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1148, __pyx_L1_error)
29585     __Pyx_GOTREF(__pyx_t_3);
29586     __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_nu); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1148, __pyx_L1_error)
29587     __Pyx_GOTREF(__pyx_t_9);
29588     if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_nu, __pyx_t_9) < 0) __PYX_ERR(1, 1148, __pyx_L1_error)
29589     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
29590     __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1148, __pyx_L1_error)
29591     __Pyx_GOTREF(__pyx_t_9);
29592     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29593     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
29594     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29595     if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 1148, __pyx_L1_error)
29596     __pyx_t_17 = ((PyArrayObject *)__pyx_t_9);
29597     {
29598       __Pyx_BufFmt_StackElem __pyx_stack[1];
29599       __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer);
29600       __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
29601       if (unlikely(__pyx_t_15 < 0)) {
29602         PyErr_Fetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
29603         if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer, (PyObject*)__pyx_v_Ai, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
29604           Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20);
29605           __Pyx_RaiseBufferFallbackError();
29606         } else {
29607           PyErr_Restore(__pyx_t_18, __pyx_t_19, __pyx_t_20);
29608         }
29609         __pyx_t_18 = __pyx_t_19 = __pyx_t_20 = 0;
29610       }
29611       __pyx_pybuffernd_Ai.diminfo[0].strides = __pyx_pybuffernd_Ai.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Ai.diminfo[0].shape = __pyx_pybuffernd_Ai.rcbuffer->pybuffer.shape[0];
29612       if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(1, 1148, __pyx_L1_error)
29613     }
29614     __pyx_t_17 = 0;
29615     __Pyx_DECREF_SET(__pyx_v_Ai, ((PyArrayObject *)__pyx_t_9));
29616     __pyx_t_9 = 0;
29617 
29618     /* "yt/utilities/lib/geometry_utils.pyx":1149
29619  *     else:
29620  *         Ai = csearch_morton(P,k,i,Ai,m+1,h,order,DLE,DRE,nu=nu)
29621  *         if compare_morton(P[i,:]-dist(P[i,:],P[Ai[k-1],:]),P[m,:]):             # <<<<<<<<<<<<<<
29622  *             Ai = csearch_morton(P,k,i,Ai,l,m-1,order,DLE,DRE,nu=nu)
29623  *     return Ai
29624  */
29625     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_compare_morton); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1149, __pyx_L1_error)
29626     __Pyx_GOTREF(__pyx_t_3);
29627     __pyx_t_5 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1149, __pyx_L1_error)
29628     __Pyx_GOTREF(__pyx_t_5);
29629     __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1149, __pyx_L1_error)
29630     __Pyx_GOTREF(__pyx_t_6);
29631     __Pyx_GIVEREF(__pyx_t_5);
29632     PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
29633     __Pyx_INCREF(__pyx_slice__4);
29634     __Pyx_GIVEREF(__pyx_slice__4);
29635     PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_slice__4);
29636     __pyx_t_5 = 0;
29637     __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1149, __pyx_L1_error)
29638     __Pyx_GOTREF(__pyx_t_5);
29639     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29640     __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_dist); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1149, __pyx_L1_error)
29641     __Pyx_GOTREF(__pyx_t_10);
29642     __pyx_t_14 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 1149, __pyx_L1_error)
29643     __Pyx_GOTREF(__pyx_t_14);
29644     __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1149, __pyx_L1_error)
29645     __Pyx_GOTREF(__pyx_t_12);
29646     __Pyx_GIVEREF(__pyx_t_14);
29647     PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_14);
29648     __Pyx_INCREF(__pyx_slice__4);
29649     __Pyx_GIVEREF(__pyx_slice__4);
29650     PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_slice__4);
29651     __pyx_t_14 = 0;
29652     __pyx_t_14 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 1149, __pyx_L1_error)
29653     __Pyx_GOTREF(__pyx_t_14);
29654     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
29655     __pyx_t_23 = (__pyx_v_k - 1);
29656     __pyx_t_12 = __Pyx_PyInt_From_npy_uint64((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_Ai.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_Ai.diminfo[0].strides))); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1149, __pyx_L1_error)
29657     __Pyx_GOTREF(__pyx_t_12);
29658     __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1149, __pyx_L1_error)
29659     __Pyx_GOTREF(__pyx_t_8);
29660     __Pyx_GIVEREF(__pyx_t_12);
29661     PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_12);
29662     __Pyx_INCREF(__pyx_slice__4);
29663     __Pyx_GIVEREF(__pyx_slice__4);
29664     PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_slice__4);
29665     __pyx_t_12 = 0;
29666     __pyx_t_12 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_8); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1149, __pyx_L1_error)
29667     __Pyx_GOTREF(__pyx_t_12);
29668     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
29669     __pyx_t_8 = NULL;
29670     __pyx_t_15 = 0;
29671     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
29672       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_10);
29673       if (likely(__pyx_t_8)) {
29674         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
29675         __Pyx_INCREF(__pyx_t_8);
29676         __Pyx_INCREF(function);
29677         __Pyx_DECREF_SET(__pyx_t_10, function);
29678         __pyx_t_15 = 1;
29679       }
29680     }
29681     #if CYTHON_FAST_PYCALL
29682     if (PyFunction_Check(__pyx_t_10)) {
29683       PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_14, __pyx_t_12};
29684       __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1149, __pyx_L1_error)
29685       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
29686       __Pyx_GOTREF(__pyx_t_6);
29687       __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
29688       __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
29689     } else
29690     #endif
29691     #if CYTHON_FAST_PYCCALL
29692     if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
29693       PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_14, __pyx_t_12};
29694       __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1149, __pyx_L1_error)
29695       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
29696       __Pyx_GOTREF(__pyx_t_6);
29697       __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
29698       __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
29699     } else
29700     #endif
29701     {
29702       __pyx_t_13 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1149, __pyx_L1_error)
29703       __Pyx_GOTREF(__pyx_t_13);
29704       if (__pyx_t_8) {
29705         __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_8); __pyx_t_8 = NULL;
29706       }
29707       __Pyx_GIVEREF(__pyx_t_14);
29708       PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_15, __pyx_t_14);
29709       __Pyx_GIVEREF(__pyx_t_12);
29710       PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_15, __pyx_t_12);
29711       __pyx_t_14 = 0;
29712       __pyx_t_12 = 0;
29713       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_13, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1149, __pyx_L1_error)
29714       __Pyx_GOTREF(__pyx_t_6);
29715       __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
29716     }
29717     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
29718     __pyx_t_10 = PyNumber_Subtract(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1149, __pyx_L1_error)
29719     __Pyx_GOTREF(__pyx_t_10);
29720     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
29721     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29722     __pyx_t_6 = __Pyx_PyInt_From_npy_uint64(__pyx_v_m); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1149, __pyx_L1_error)
29723     __Pyx_GOTREF(__pyx_t_6);
29724     __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1149, __pyx_L1_error)
29725     __Pyx_GOTREF(__pyx_t_5);
29726     __Pyx_GIVEREF(__pyx_t_6);
29727     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
29728     __Pyx_INCREF(__pyx_slice__4);
29729     __Pyx_GIVEREF(__pyx_slice__4);
29730     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_slice__4);
29731     __pyx_t_6 = 0;
29732     __pyx_t_6 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1149, __pyx_L1_error)
29733     __Pyx_GOTREF(__pyx_t_6);
29734     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
29735     __pyx_t_5 = NULL;
29736     __pyx_t_15 = 0;
29737     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
29738       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
29739       if (likely(__pyx_t_5)) {
29740         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
29741         __Pyx_INCREF(__pyx_t_5);
29742         __Pyx_INCREF(function);
29743         __Pyx_DECREF_SET(__pyx_t_3, function);
29744         __pyx_t_15 = 1;
29745       }
29746     }
29747     #if CYTHON_FAST_PYCALL
29748     if (PyFunction_Check(__pyx_t_3)) {
29749       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_10, __pyx_t_6};
29750       __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1149, __pyx_L1_error)
29751       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
29752       __Pyx_GOTREF(__pyx_t_9);
29753       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
29754       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29755     } else
29756     #endif
29757     #if CYTHON_FAST_PYCCALL
29758     if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
29759       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_10, __pyx_t_6};
29760       __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1149, __pyx_L1_error)
29761       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
29762       __Pyx_GOTREF(__pyx_t_9);
29763       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
29764       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29765     } else
29766     #endif
29767     {
29768       __pyx_t_13 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1149, __pyx_L1_error)
29769       __Pyx_GOTREF(__pyx_t_13);
29770       if (__pyx_t_5) {
29771         __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_5); __pyx_t_5 = NULL;
29772       }
29773       __Pyx_GIVEREF(__pyx_t_10);
29774       PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_15, __pyx_t_10);
29775       __Pyx_GIVEREF(__pyx_t_6);
29776       PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_15, __pyx_t_6);
29777       __pyx_t_10 = 0;
29778       __pyx_t_6 = 0;
29779       __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_13, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1149, __pyx_L1_error)
29780       __Pyx_GOTREF(__pyx_t_9);
29781       __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
29782     }
29783     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29784     __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 1149, __pyx_L1_error)
29785     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
29786     if (__pyx_t_1) {
29787 
29788       /* "yt/utilities/lib/geometry_utils.pyx":1150
29789  *         Ai = csearch_morton(P,k,i,Ai,m+1,h,order,DLE,DRE,nu=nu)
29790  *         if compare_morton(P[i,:]-dist(P[i,:],P[Ai[k-1],:]),P[m,:]):
29791  *             Ai = csearch_morton(P,k,i,Ai,l,m-1,order,DLE,DRE,nu=nu)             # <<<<<<<<<<<<<<
29792  *     return Ai
29793  *
29794  */
29795       __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_csearch_morton); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1150, __pyx_L1_error)
29796       __Pyx_GOTREF(__pyx_t_9);
29797       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1150, __pyx_L1_error)
29798       __Pyx_GOTREF(__pyx_t_3);
29799       __pyx_t_13 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1150, __pyx_L1_error)
29800       __Pyx_GOTREF(__pyx_t_13);
29801       __pyx_t_6 = __Pyx_PyInt_From_npy_uint64(__pyx_v_l); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1150, __pyx_L1_error)
29802       __Pyx_GOTREF(__pyx_t_6);
29803       __pyx_t_10 = __Pyx_PyInt_From_npy_uint64((__pyx_v_m - 1)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1150, __pyx_L1_error)
29804       __Pyx_GOTREF(__pyx_t_10);
29805       __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_order); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1150, __pyx_L1_error)
29806       __Pyx_GOTREF(__pyx_t_5);
29807       __pyx_t_12 = PyTuple_New(9); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1150, __pyx_L1_error)
29808       __Pyx_GOTREF(__pyx_t_12);
29809       __Pyx_INCREF(((PyObject *)__pyx_v_P));
29810       __Pyx_GIVEREF(((PyObject *)__pyx_v_P));
29811       PyTuple_SET_ITEM(__pyx_t_12, 0, ((PyObject *)__pyx_v_P));
29812       __Pyx_GIVEREF(__pyx_t_3);
29813       PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_3);
29814       __Pyx_GIVEREF(__pyx_t_13);
29815       PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_13);
29816       __Pyx_INCREF(((PyObject *)__pyx_v_Ai));
29817       __Pyx_GIVEREF(((PyObject *)__pyx_v_Ai));
29818       PyTuple_SET_ITEM(__pyx_t_12, 3, ((PyObject *)__pyx_v_Ai));
29819       __Pyx_GIVEREF(__pyx_t_6);
29820       PyTuple_SET_ITEM(__pyx_t_12, 4, __pyx_t_6);
29821       __Pyx_GIVEREF(__pyx_t_10);
29822       PyTuple_SET_ITEM(__pyx_t_12, 5, __pyx_t_10);
29823       __Pyx_GIVEREF(__pyx_t_5);
29824       PyTuple_SET_ITEM(__pyx_t_12, 6, __pyx_t_5);
29825       __Pyx_INCREF(((PyObject *)__pyx_v_DLE));
29826       __Pyx_GIVEREF(((PyObject *)__pyx_v_DLE));
29827       PyTuple_SET_ITEM(__pyx_t_12, 7, ((PyObject *)__pyx_v_DLE));
29828       __Pyx_INCREF(((PyObject *)__pyx_v_DRE));
29829       __Pyx_GIVEREF(((PyObject *)__pyx_v_DRE));
29830       PyTuple_SET_ITEM(__pyx_t_12, 8, ((PyObject *)__pyx_v_DRE));
29831       __pyx_t_3 = 0;
29832       __pyx_t_13 = 0;
29833       __pyx_t_6 = 0;
29834       __pyx_t_10 = 0;
29835       __pyx_t_5 = 0;
29836       __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1150, __pyx_L1_error)
29837       __Pyx_GOTREF(__pyx_t_5);
29838       __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_nu); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1150, __pyx_L1_error)
29839       __Pyx_GOTREF(__pyx_t_10);
29840       if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_nu, __pyx_t_10) < 0) __PYX_ERR(1, 1150, __pyx_L1_error)
29841       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
29842       __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, __pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1150, __pyx_L1_error)
29843       __Pyx_GOTREF(__pyx_t_10);
29844       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
29845       __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
29846       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
29847       if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 1150, __pyx_L1_error)
29848       __pyx_t_17 = ((PyArrayObject *)__pyx_t_10);
29849       {
29850         __Pyx_BufFmt_StackElem __pyx_stack[1];
29851         __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer);
29852         __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
29853         if (unlikely(__pyx_t_15 < 0)) {
29854           PyErr_Fetch(&__pyx_t_20, &__pyx_t_19, &__pyx_t_18);
29855           if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer, (PyObject*)__pyx_v_Ai, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
29856             Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_18);
29857             __Pyx_RaiseBufferFallbackError();
29858           } else {
29859             PyErr_Restore(__pyx_t_20, __pyx_t_19, __pyx_t_18);
29860           }
29861           __pyx_t_20 = __pyx_t_19 = __pyx_t_18 = 0;
29862         }
29863         __pyx_pybuffernd_Ai.diminfo[0].strides = __pyx_pybuffernd_Ai.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Ai.diminfo[0].shape = __pyx_pybuffernd_Ai.rcbuffer->pybuffer.shape[0];
29864         if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(1, 1150, __pyx_L1_error)
29865       }
29866       __pyx_t_17 = 0;
29867       __Pyx_DECREF_SET(__pyx_v_Ai, ((PyArrayObject *)__pyx_t_10));
29868       __pyx_t_10 = 0;
29869 
29870       /* "yt/utilities/lib/geometry_utils.pyx":1149
29871  *     else:
29872  *         Ai = csearch_morton(P,k,i,Ai,m+1,h,order,DLE,DRE,nu=nu)
29873  *         if compare_morton(P[i,:]-dist(P[i,:],P[Ai[k-1],:]),P[m,:]):             # <<<<<<<<<<<<<<
29874  *             Ai = csearch_morton(P,k,i,Ai,l,m-1,order,DLE,DRE,nu=nu)
29875  *     return Ai
29876  */
29877     }
29878   }
29879   __pyx_L14:;
29880 
29881   /* "yt/utilities/lib/geometry_utils.pyx":1151
29882  *         if compare_morton(P[i,:]-dist(P[i,:],P[Ai[k-1],:]),P[m,:]):
29883  *             Ai = csearch_morton(P,k,i,Ai,l,m-1,order,DLE,DRE,nu=nu)
29884  *     return Ai             # <<<<<<<<<<<<<<
29885  *
29886  *
29887  */
29888   __Pyx_XDECREF(__pyx_r);
29889   __Pyx_INCREF(((PyObject *)__pyx_v_Ai));
29890   __pyx_r = ((PyObject *)__pyx_v_Ai);
29891   goto __pyx_L0;
29892 
29893   /* "yt/utilities/lib/geometry_utils.pyx":1088
29894  * @cython.wraparound(False)
29895  * @cython.cdivision(True)
29896  * def csearch_morton(np.ndarray[np.float64_t, ndim=2] P, int k, np.uint64_t i,             # <<<<<<<<<<<<<<
29897  *                    np.ndarray[np.uint64_t, ndim=1] Ai,
29898  *                    np.uint64_t l, np.uint64_t h, int order,
29899  */
29900 
29901   /* function exit code */
29902   __pyx_L1_error:;
29903   __Pyx_XDECREF(__pyx_t_3);
29904   __Pyx_XDECREF(__pyx_t_4);
29905   __Pyx_XDECREF(__pyx_t_5);
29906   __Pyx_XDECREF(__pyx_t_6);
29907   __Pyx_XDECREF(__pyx_t_8);
29908   __Pyx_XDECREF(__pyx_t_9);
29909   __Pyx_XDECREF(__pyx_t_10);
29910   __Pyx_XDECREF(__pyx_t_11);
29911   __Pyx_XDECREF(__pyx_t_12);
29912   __Pyx_XDECREF(__pyx_t_13);
29913   __Pyx_XDECREF(__pyx_t_14);
29914   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
29915     __Pyx_PyThreadState_declare
29916     __Pyx_PyThreadState_assign
29917     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
29918     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer);
29919     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_DLE.rcbuffer->pybuffer);
29920     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_DRE.rcbuffer->pybuffer);
29921     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_P.rcbuffer->pybuffer);
29922   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
29923   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.csearch_morton", __pyx_clineno, __pyx_lineno, __pyx_filename);
29924   __pyx_r = NULL;
29925   goto __pyx_L2;
29926   __pyx_L0:;
29927   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer);
29928   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_DLE.rcbuffer->pybuffer);
29929   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_DRE.rcbuffer->pybuffer);
29930   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_P.rcbuffer->pybuffer);
29931   __pyx_L2:;
29932   __Pyx_XDECREF(__pyx_v_rad_Ai);
29933   __Pyx_XDECREF(__pyx_v_cbox_sol);
29934   __Pyx_XDECREF(__pyx_v_rbox_sol);
29935   __Pyx_XDECREF(__pyx_v_cbox_hl);
29936   __Pyx_XDECREF(__pyx_v_rbox_hl);
29937   __Pyx_XDECREF((PyObject *)__pyx_v_Ai);
29938   __Pyx_XGIVEREF(__pyx_r);
29939   __Pyx_RefNannyFinishContext();
29940   return __pyx_r;
29941 }
29942 
29943 /* "yt/utilities/lib/geometry_utils.pyx":1157
29944  * @cython.wraparound(False)
29945  * @cython.cdivision(True)
29946  * def knn_morton(np.ndarray[np.float64_t, ndim=2] P0, int k, np.uint64_t i0,             # <<<<<<<<<<<<<<
29947  *                float c = 1.0, int nu = 4, issorted = False, int order = ORDER_MAX,
29948  *                np.ndarray[np.float64_t, ndim=1] DLE = np.zeros(3,dtype=np.float64),
29949  */
29950 
29951 /* Python wrapper */
29952 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_73knn_morton(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
29953 static char __pyx_doc_2yt_9utilities_3lib_14geometry_utils_72knn_morton[] = "Get the indicies of the k nearest neighbors to point i.\n\n    Args:\n        P (np.ndarray): (N,d) array of points to search.\n        k (int): number of nearest neighbors to find for each point in P.\n        i (np.uint64): index of point to find neighbors for.\n        c (float): factor determining how many indicies before/after i are used\n            in the initial search (i-c*k to i+c*k, default = 1.0)\n        nu (int): minimum number of points before a direct knn search is\n            performed. (default = 4)\n        issorted (Optional[bool]): if True, P is assumed to be sorted already\n            according to Morton order.\n        order (int): Maximum depth that Morton order quadtree should reach.\n            If not provided, ORDER_MAX is used.\n        DLE (np.ndarray): (d,) array of domain lower bounds in each dimension.\n            If not provided, this is determined from the points.\n        DRE (np.ndarray): (d,) array of domain upper bounds in each dimension.\n            If not provided, this is determined from the points.\n\n    Returns:\n        np.ndarray: (N,k) indicies of k nearest neighbors for each point in P.\n";
29954 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_73knn_morton = {"knn_morton", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_73knn_morton, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2yt_9utilities_3lib_14geometry_utils_72knn_morton};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_73knn_morton(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)29955 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_73knn_morton(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
29956   PyArrayObject *__pyx_v_P0 = 0;
29957   int __pyx_v_k;
29958   __pyx_t_5numpy_uint64_t __pyx_v_i0;
29959   float __pyx_v_c;
29960   int __pyx_v_nu;
29961   PyObject *__pyx_v_issorted = 0;
29962   int __pyx_v_order;
29963   PyArrayObject *__pyx_v_DLE = 0;
29964   PyArrayObject *__pyx_v_DRE = 0;
29965   PyObject *__pyx_r = 0;
29966   __Pyx_RefNannyDeclarations
29967   __Pyx_RefNannySetupContext("knn_morton (wrapper)", 0);
29968   {
29969     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_P0,&__pyx_n_s_k,&__pyx_n_s_i0,&__pyx_n_s_c,&__pyx_n_s_nu,&__pyx_n_s_issorted,&__pyx_n_s_order,&__pyx_n_s_DLE,&__pyx_n_s_DRE,0};
29970     PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
29971 
29972     /* "yt/utilities/lib/geometry_utils.pyx":1158
29973  * @cython.cdivision(True)
29974  * def knn_morton(np.ndarray[np.float64_t, ndim=2] P0, int k, np.uint64_t i0,
29975  *                float c = 1.0, int nu = 4, issorted = False, int order = ORDER_MAX,             # <<<<<<<<<<<<<<
29976  *                np.ndarray[np.float64_t, ndim=1] DLE = np.zeros(3,dtype=np.float64),
29977  *                np.ndarray[np.float64_t, ndim=1] DRE = np.zeros(3,dtype=np.float64)):
29978  */
29979     values[5] = ((PyObject *)Py_False);
29980     values[7] = (PyObject *)__pyx_k__11;
29981     values[8] = (PyObject *)__pyx_k__12;
29982     if (unlikely(__pyx_kwds)) {
29983       Py_ssize_t kw_args;
29984       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
29985       switch (pos_args) {
29986         case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
29987         CYTHON_FALLTHROUGH;
29988         case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
29989         CYTHON_FALLTHROUGH;
29990         case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
29991         CYTHON_FALLTHROUGH;
29992         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
29993         CYTHON_FALLTHROUGH;
29994         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
29995         CYTHON_FALLTHROUGH;
29996         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
29997         CYTHON_FALLTHROUGH;
29998         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
29999         CYTHON_FALLTHROUGH;
30000         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
30001         CYTHON_FALLTHROUGH;
30002         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
30003         CYTHON_FALLTHROUGH;
30004         case  0: break;
30005         default: goto __pyx_L5_argtuple_error;
30006       }
30007       kw_args = PyDict_Size(__pyx_kwds);
30008       switch (pos_args) {
30009         case  0:
30010         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_P0)) != 0)) kw_args--;
30011         else goto __pyx_L5_argtuple_error;
30012         CYTHON_FALLTHROUGH;
30013         case  1:
30014         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k)) != 0)) kw_args--;
30015         else {
30016           __Pyx_RaiseArgtupleInvalid("knn_morton", 0, 3, 9, 1); __PYX_ERR(1, 1157, __pyx_L3_error)
30017         }
30018         CYTHON_FALLTHROUGH;
30019         case  2:
30020         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_i0)) != 0)) kw_args--;
30021         else {
30022           __Pyx_RaiseArgtupleInvalid("knn_morton", 0, 3, 9, 2); __PYX_ERR(1, 1157, __pyx_L3_error)
30023         }
30024         CYTHON_FALLTHROUGH;
30025         case  3:
30026         if (kw_args > 0) {
30027           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_c);
30028           if (value) { values[3] = value; kw_args--; }
30029         }
30030         CYTHON_FALLTHROUGH;
30031         case  4:
30032         if (kw_args > 0) {
30033           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nu);
30034           if (value) { values[4] = value; kw_args--; }
30035         }
30036         CYTHON_FALLTHROUGH;
30037         case  5:
30038         if (kw_args > 0) {
30039           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_issorted);
30040           if (value) { values[5] = value; kw_args--; }
30041         }
30042         CYTHON_FALLTHROUGH;
30043         case  6:
30044         if (kw_args > 0) {
30045           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_order);
30046           if (value) { values[6] = value; kw_args--; }
30047         }
30048         CYTHON_FALLTHROUGH;
30049         case  7:
30050         if (kw_args > 0) {
30051           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_DLE);
30052           if (value) { values[7] = value; kw_args--; }
30053         }
30054         CYTHON_FALLTHROUGH;
30055         case  8:
30056         if (kw_args > 0) {
30057           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_DRE);
30058           if (value) { values[8] = value; kw_args--; }
30059         }
30060       }
30061       if (unlikely(kw_args > 0)) {
30062         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "knn_morton") < 0)) __PYX_ERR(1, 1157, __pyx_L3_error)
30063       }
30064     } else {
30065       switch (PyTuple_GET_SIZE(__pyx_args)) {
30066         case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
30067         CYTHON_FALLTHROUGH;
30068         case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
30069         CYTHON_FALLTHROUGH;
30070         case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
30071         CYTHON_FALLTHROUGH;
30072         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
30073         CYTHON_FALLTHROUGH;
30074         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
30075         CYTHON_FALLTHROUGH;
30076         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
30077         CYTHON_FALLTHROUGH;
30078         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
30079         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
30080         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
30081         break;
30082         default: goto __pyx_L5_argtuple_error;
30083       }
30084     }
30085     __pyx_v_P0 = ((PyArrayObject *)values[0]);
30086     __pyx_v_k = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1157, __pyx_L3_error)
30087     __pyx_v_i0 = __Pyx_PyInt_As_npy_uint64(values[2]); if (unlikely((__pyx_v_i0 == ((npy_uint64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 1157, __pyx_L3_error)
30088     if (values[3]) {
30089       __pyx_v_c = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_c == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1158, __pyx_L3_error)
30090     } else {
30091       __pyx_v_c = ((float)1.0);
30092     }
30093     if (values[4]) {
30094       __pyx_v_nu = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nu == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1158, __pyx_L3_error)
30095     } else {
30096       __pyx_v_nu = ((int)4);
30097     }
30098     __pyx_v_issorted = values[5];
30099     if (values[6]) {
30100       __pyx_v_order = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1158, __pyx_L3_error)
30101     } else {
30102       __pyx_v_order = ((int)20);
30103     }
30104     __pyx_v_DLE = ((PyArrayObject *)values[7]);
30105     __pyx_v_DRE = ((PyArrayObject *)values[8]);
30106   }
30107   goto __pyx_L4_argument_unpacking_done;
30108   __pyx_L5_argtuple_error:;
30109   __Pyx_RaiseArgtupleInvalid("knn_morton", 0, 3, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1157, __pyx_L3_error)
30110   __pyx_L3_error:;
30111   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.knn_morton", __pyx_clineno, __pyx_lineno, __pyx_filename);
30112   __Pyx_RefNannyFinishContext();
30113   return NULL;
30114   __pyx_L4_argument_unpacking_done:;
30115   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_P0), __pyx_ptype_5numpy_ndarray, 1, "P0", 0))) __PYX_ERR(1, 1157, __pyx_L1_error)
30116   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_DLE), __pyx_ptype_5numpy_ndarray, 1, "DLE", 0))) __PYX_ERR(1, 1159, __pyx_L1_error)
30117   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_DRE), __pyx_ptype_5numpy_ndarray, 1, "DRE", 0))) __PYX_ERR(1, 1160, __pyx_L1_error)
30118   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_72knn_morton(__pyx_self, __pyx_v_P0, __pyx_v_k, __pyx_v_i0, __pyx_v_c, __pyx_v_nu, __pyx_v_issorted, __pyx_v_order, __pyx_v_DLE, __pyx_v_DRE);
30119 
30120   /* "yt/utilities/lib/geometry_utils.pyx":1157
30121  * @cython.wraparound(False)
30122  * @cython.cdivision(True)
30123  * def knn_morton(np.ndarray[np.float64_t, ndim=2] P0, int k, np.uint64_t i0,             # <<<<<<<<<<<<<<
30124  *                float c = 1.0, int nu = 4, issorted = False, int order = ORDER_MAX,
30125  *                np.ndarray[np.float64_t, ndim=1] DLE = np.zeros(3,dtype=np.float64),
30126  */
30127 
30128   /* function exit code */
30129   goto __pyx_L0;
30130   __pyx_L1_error:;
30131   __pyx_r = NULL;
30132   __pyx_L0:;
30133   __Pyx_RefNannyFinishContext();
30134   return __pyx_r;
30135 }
30136 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_72knn_morton(CYTHON_UNUSED PyObject * __pyx_self,PyArrayObject * __pyx_v_P0,int __pyx_v_k,__pyx_t_5numpy_uint64_t __pyx_v_i0,float __pyx_v_c,int __pyx_v_nu,PyObject * __pyx_v_issorted,int __pyx_v_order,PyArrayObject * __pyx_v_DLE,PyArrayObject * __pyx_v_DRE)30137 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_72knn_morton(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_P0, int __pyx_v_k, __pyx_t_5numpy_uint64_t __pyx_v_i0, float __pyx_v_c, int __pyx_v_nu, PyObject *__pyx_v_issorted, int __pyx_v_order, PyArrayObject *__pyx_v_DLE, PyArrayObject *__pyx_v_DRE) {
30138   int __pyx_v_j;
30139   __pyx_t_5numpy_uint64_t __pyx_v_i;
30140   __pyx_t_5numpy_int64_t __pyx_v_N;
30141   PyArrayObject *__pyx_v_P = 0;
30142   PyArrayObject *__pyx_v_sort_fwd = 0;
30143   PyArrayObject *__pyx_v_sort_rev = 0;
30144   PyArrayObject *__pyx_v_Ai = 0;
30145   __pyx_t_5numpy_int64_t __pyx_v_idxmin;
30146   __pyx_t_5numpy_int64_t __pyx_v_idxmax;
30147   __pyx_t_5numpy_int64_t __pyx_v_u;
30148   __pyx_t_5numpy_int64_t __pyx_v_l;
30149   __pyx_t_5numpy_int64_t __pyx_v_I;
30150   PyObject *__pyx_v_rad_Ai = NULL;
30151   PyObject *__pyx_v_cbox_Ai = NULL;
30152   PyObject *__pyx_v_rbox_Ai = NULL;
30153   __Pyx_LocalBuf_ND __pyx_pybuffernd_Ai;
30154   __Pyx_Buffer __pyx_pybuffer_Ai;
30155   __Pyx_LocalBuf_ND __pyx_pybuffernd_DLE;
30156   __Pyx_Buffer __pyx_pybuffer_DLE;
30157   __Pyx_LocalBuf_ND __pyx_pybuffernd_DRE;
30158   __Pyx_Buffer __pyx_pybuffer_DRE;
30159   __Pyx_LocalBuf_ND __pyx_pybuffernd_P;
30160   __Pyx_Buffer __pyx_pybuffer_P;
30161   __Pyx_LocalBuf_ND __pyx_pybuffernd_P0;
30162   __Pyx_Buffer __pyx_pybuffer_P0;
30163   __Pyx_LocalBuf_ND __pyx_pybuffernd_sort_fwd;
30164   __Pyx_Buffer __pyx_pybuffer_sort_fwd;
30165   __Pyx_LocalBuf_ND __pyx_pybuffernd_sort_rev;
30166   __Pyx_Buffer __pyx_pybuffer_sort_rev;
30167   PyObject *__pyx_r = NULL;
30168   __Pyx_RefNannyDeclarations
30169   PyObject *__pyx_t_1 = NULL;
30170   PyObject *__pyx_t_2 = NULL;
30171   PyObject *__pyx_t_3 = NULL;
30172   PyObject *__pyx_t_4 = NULL;
30173   PyObject *__pyx_t_5 = NULL;
30174   PyArrayObject *__pyx_t_6 = NULL;
30175   PyArrayObject *__pyx_t_7 = NULL;
30176   int __pyx_t_8;
30177   int __pyx_t_9;
30178   PyObject *__pyx_t_10 = NULL;
30179   PyObject *__pyx_t_11 = NULL;
30180   PyObject *__pyx_t_12 = NULL;
30181   PyArrayObject *__pyx_t_13 = NULL;
30182   __pyx_t_5numpy_uint64_t __pyx_t_14;
30183   Py_ssize_t __pyx_t_15;
30184   Py_ssize_t __pyx_t_16;
30185   __pyx_t_5numpy_float64_t __pyx_t_17;
30186   Py_ssize_t __pyx_t_18;
30187   Py_ssize_t __pyx_t_19;
30188   long __pyx_t_20;
30189   float __pyx_t_21;
30190   float __pyx_t_22;
30191   __pyx_t_5numpy_int64_t __pyx_t_23;
30192   PyObject *__pyx_t_24 = NULL;
30193   PyObject *__pyx_t_25 = NULL;
30194   PyObject *__pyx_t_26 = NULL;
30195   PyArrayObject *__pyx_t_27 = NULL;
30196   PyObject *(*__pyx_t_28)(PyObject *);
30197   Py_ssize_t __pyx_t_29;
30198   int __pyx_t_30;
30199   __pyx_t_5numpy_int64_t __pyx_t_31;
30200   __pyx_t_5numpy_int64_t __pyx_t_32;
30201   __Pyx_RefNannySetupContext("knn_morton", 0);
30202   __pyx_pybuffer_P.pybuffer.buf = NULL;
30203   __pyx_pybuffer_P.refcount = 0;
30204   __pyx_pybuffernd_P.data = NULL;
30205   __pyx_pybuffernd_P.rcbuffer = &__pyx_pybuffer_P;
30206   __pyx_pybuffer_sort_fwd.pybuffer.buf = NULL;
30207   __pyx_pybuffer_sort_fwd.refcount = 0;
30208   __pyx_pybuffernd_sort_fwd.data = NULL;
30209   __pyx_pybuffernd_sort_fwd.rcbuffer = &__pyx_pybuffer_sort_fwd;
30210   __pyx_pybuffer_sort_rev.pybuffer.buf = NULL;
30211   __pyx_pybuffer_sort_rev.refcount = 0;
30212   __pyx_pybuffernd_sort_rev.data = NULL;
30213   __pyx_pybuffernd_sort_rev.rcbuffer = &__pyx_pybuffer_sort_rev;
30214   __pyx_pybuffer_Ai.pybuffer.buf = NULL;
30215   __pyx_pybuffer_Ai.refcount = 0;
30216   __pyx_pybuffernd_Ai.data = NULL;
30217   __pyx_pybuffernd_Ai.rcbuffer = &__pyx_pybuffer_Ai;
30218   __pyx_pybuffer_P0.pybuffer.buf = NULL;
30219   __pyx_pybuffer_P0.refcount = 0;
30220   __pyx_pybuffernd_P0.data = NULL;
30221   __pyx_pybuffernd_P0.rcbuffer = &__pyx_pybuffer_P0;
30222   __pyx_pybuffer_DLE.pybuffer.buf = NULL;
30223   __pyx_pybuffer_DLE.refcount = 0;
30224   __pyx_pybuffernd_DLE.data = NULL;
30225   __pyx_pybuffernd_DLE.rcbuffer = &__pyx_pybuffer_DLE;
30226   __pyx_pybuffer_DRE.pybuffer.buf = NULL;
30227   __pyx_pybuffer_DRE.refcount = 0;
30228   __pyx_pybuffernd_DRE.data = NULL;
30229   __pyx_pybuffernd_DRE.rcbuffer = &__pyx_pybuffer_DRE;
30230   {
30231     __Pyx_BufFmt_StackElem __pyx_stack[1];
30232     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_P0.rcbuffer->pybuffer, (PyObject*)__pyx_v_P0, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(1, 1157, __pyx_L1_error)
30233   }
30234   __pyx_pybuffernd_P0.diminfo[0].strides = __pyx_pybuffernd_P0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_P0.diminfo[0].shape = __pyx_pybuffernd_P0.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_P0.diminfo[1].strides = __pyx_pybuffernd_P0.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_P0.diminfo[1].shape = __pyx_pybuffernd_P0.rcbuffer->pybuffer.shape[1];
30235   {
30236     __Pyx_BufFmt_StackElem __pyx_stack[1];
30237     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_DLE.rcbuffer->pybuffer, (PyObject*)__pyx_v_DLE, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 1157, __pyx_L1_error)
30238   }
30239   __pyx_pybuffernd_DLE.diminfo[0].strides = __pyx_pybuffernd_DLE.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_DLE.diminfo[0].shape = __pyx_pybuffernd_DLE.rcbuffer->pybuffer.shape[0];
30240   {
30241     __Pyx_BufFmt_StackElem __pyx_stack[1];
30242     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_DRE.rcbuffer->pybuffer, (PyObject*)__pyx_v_DRE, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(1, 1157, __pyx_L1_error)
30243   }
30244   __pyx_pybuffernd_DRE.diminfo[0].strides = __pyx_pybuffernd_DRE.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_DRE.diminfo[0].shape = __pyx_pybuffernd_DRE.rcbuffer->pybuffer.shape[0];
30245 
30246   /* "yt/utilities/lib/geometry_utils.pyx":1185
30247  *     cdef int j
30248  *     cdef np.uint64_t i
30249  *     cdef np.int64_t N = P0.shape[0]             # <<<<<<<<<<<<<<
30250  *     cdef np.ndarray[np.float64_t, ndim=2] P
30251  *     cdef np.ndarray[np.uint64_t, ndim=1] sort_fwd = np.arange(N,dtype=np.uint64)
30252  */
30253   __pyx_v_N = (__pyx_v_P0->dimensions[0]);
30254 
30255   /* "yt/utilities/lib/geometry_utils.pyx":1187
30256  *     cdef np.int64_t N = P0.shape[0]
30257  *     cdef np.ndarray[np.float64_t, ndim=2] P
30258  *     cdef np.ndarray[np.uint64_t, ndim=1] sort_fwd = np.arange(N,dtype=np.uint64)             # <<<<<<<<<<<<<<
30259  *     cdef np.ndarray[np.uint64_t, ndim=1] sort_rev = np.arange(N,dtype=np.uint64)
30260  *     cdef np.ndarray[np.uint64_t, ndim=1] Ai
30261  */
30262   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1187, __pyx_L1_error)
30263   __Pyx_GOTREF(__pyx_t_1);
30264   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_arange); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1187, __pyx_L1_error)
30265   __Pyx_GOTREF(__pyx_t_2);
30266   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30267   __pyx_t_1 = __Pyx_PyInt_From_npy_int64(__pyx_v_N); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1187, __pyx_L1_error)
30268   __Pyx_GOTREF(__pyx_t_1);
30269   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1187, __pyx_L1_error)
30270   __Pyx_GOTREF(__pyx_t_3);
30271   __Pyx_GIVEREF(__pyx_t_1);
30272   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
30273   __pyx_t_1 = 0;
30274   __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1187, __pyx_L1_error)
30275   __Pyx_GOTREF(__pyx_t_1);
30276   __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1187, __pyx_L1_error)
30277   __Pyx_GOTREF(__pyx_t_4);
30278   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint64); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1187, __pyx_L1_error)
30279   __Pyx_GOTREF(__pyx_t_5);
30280   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
30281   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(1, 1187, __pyx_L1_error)
30282   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
30283   __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1187, __pyx_L1_error)
30284   __Pyx_GOTREF(__pyx_t_5);
30285   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
30286   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
30287   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30288   if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 1187, __pyx_L1_error)
30289   __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
30290   {
30291     __Pyx_BufFmt_StackElem __pyx_stack[1];
30292     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sort_fwd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
30293       __pyx_v_sort_fwd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_sort_fwd.rcbuffer->pybuffer.buf = NULL;
30294       __PYX_ERR(1, 1187, __pyx_L1_error)
30295     } else {__pyx_pybuffernd_sort_fwd.diminfo[0].strides = __pyx_pybuffernd_sort_fwd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sort_fwd.diminfo[0].shape = __pyx_pybuffernd_sort_fwd.rcbuffer->pybuffer.shape[0];
30296     }
30297   }
30298   __pyx_t_6 = 0;
30299   __pyx_v_sort_fwd = ((PyArrayObject *)__pyx_t_5);
30300   __pyx_t_5 = 0;
30301 
30302   /* "yt/utilities/lib/geometry_utils.pyx":1188
30303  *     cdef np.ndarray[np.float64_t, ndim=2] P
30304  *     cdef np.ndarray[np.uint64_t, ndim=1] sort_fwd = np.arange(N,dtype=np.uint64)
30305  *     cdef np.ndarray[np.uint64_t, ndim=1] sort_rev = np.arange(N,dtype=np.uint64)             # <<<<<<<<<<<<<<
30306  *     cdef np.ndarray[np.uint64_t, ndim=1] Ai
30307  *     cdef np.int64_t idxmin, idxmax, u, l, I
30308  */
30309   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1188, __pyx_L1_error)
30310   __Pyx_GOTREF(__pyx_t_5);
30311   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_arange); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1188, __pyx_L1_error)
30312   __Pyx_GOTREF(__pyx_t_1);
30313   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
30314   __pyx_t_5 = __Pyx_PyInt_From_npy_int64(__pyx_v_N); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1188, __pyx_L1_error)
30315   __Pyx_GOTREF(__pyx_t_5);
30316   __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1188, __pyx_L1_error)
30317   __Pyx_GOTREF(__pyx_t_3);
30318   __Pyx_GIVEREF(__pyx_t_5);
30319   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
30320   __pyx_t_5 = 0;
30321   __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1188, __pyx_L1_error)
30322   __Pyx_GOTREF(__pyx_t_5);
30323   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1188, __pyx_L1_error)
30324   __Pyx_GOTREF(__pyx_t_2);
30325   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_uint64); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1188, __pyx_L1_error)
30326   __Pyx_GOTREF(__pyx_t_4);
30327   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
30328   if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(1, 1188, __pyx_L1_error)
30329   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
30330   __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1188, __pyx_L1_error)
30331   __Pyx_GOTREF(__pyx_t_4);
30332   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30333   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
30334   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
30335   if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 1188, __pyx_L1_error)
30336   __pyx_t_7 = ((PyArrayObject *)__pyx_t_4);
30337   {
30338     __Pyx_BufFmt_StackElem __pyx_stack[1];
30339     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sort_rev.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
30340       __pyx_v_sort_rev = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_sort_rev.rcbuffer->pybuffer.buf = NULL;
30341       __PYX_ERR(1, 1188, __pyx_L1_error)
30342     } else {__pyx_pybuffernd_sort_rev.diminfo[0].strides = __pyx_pybuffernd_sort_rev.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sort_rev.diminfo[0].shape = __pyx_pybuffernd_sort_rev.rcbuffer->pybuffer.shape[0];
30343     }
30344   }
30345   __pyx_t_7 = 0;
30346   __pyx_v_sort_rev = ((PyArrayObject *)__pyx_t_4);
30347   __pyx_t_4 = 0;
30348 
30349   /* "yt/utilities/lib/geometry_utils.pyx":1192
30350  *     cdef np.int64_t idxmin, idxmax, u, l, I
30351  *     # Sort if necessary
30352  *     if issorted:             # <<<<<<<<<<<<<<
30353  *         P = P0
30354  *         i = i0
30355  */
30356   __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_issorted); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(1, 1192, __pyx_L1_error)
30357   if (__pyx_t_8) {
30358 
30359     /* "yt/utilities/lib/geometry_utils.pyx":1193
30360  *     # Sort if necessary
30361  *     if issorted:
30362  *         P = P0             # <<<<<<<<<<<<<<
30363  *         i = i0
30364  *     else:
30365  */
30366     {
30367       __Pyx_BufFmt_StackElem __pyx_stack[1];
30368       __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_P.rcbuffer->pybuffer);
30369       __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_P.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_v_P0), &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
30370       if (unlikely(__pyx_t_9 < 0)) {
30371         PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
30372         if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_P.rcbuffer->pybuffer, (PyObject*)__pyx_v_P, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
30373           Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
30374           __Pyx_RaiseBufferFallbackError();
30375         } else {
30376           PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
30377         }
30378         __pyx_t_10 = __pyx_t_11 = __pyx_t_12 = 0;
30379       }
30380       __pyx_pybuffernd_P.diminfo[0].strides = __pyx_pybuffernd_P.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_P.diminfo[0].shape = __pyx_pybuffernd_P.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_P.diminfo[1].strides = __pyx_pybuffernd_P.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_P.diminfo[1].shape = __pyx_pybuffernd_P.rcbuffer->pybuffer.shape[1];
30381       if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(1, 1193, __pyx_L1_error)
30382     }
30383     __Pyx_INCREF(((PyObject *)__pyx_v_P0));
30384     __pyx_v_P = ((PyArrayObject *)__pyx_v_P0);
30385 
30386     /* "yt/utilities/lib/geometry_utils.pyx":1194
30387  *     if issorted:
30388  *         P = P0
30389  *         i = i0             # <<<<<<<<<<<<<<
30390  *     else:
30391  *         morton_qsort(P0,0,N-1,sort_fwd)
30392  */
30393     __pyx_v_i = __pyx_v_i0;
30394 
30395     /* "yt/utilities/lib/geometry_utils.pyx":1192
30396  *     cdef np.int64_t idxmin, idxmax, u, l, I
30397  *     # Sort if necessary
30398  *     if issorted:             # <<<<<<<<<<<<<<
30399  *         P = P0
30400  *         i = i0
30401  */
30402     goto __pyx_L3;
30403   }
30404 
30405   /* "yt/utilities/lib/geometry_utils.pyx":1196
30406  *         i = i0
30407  *     else:
30408  *         morton_qsort(P0,0,N-1,sort_fwd)             # <<<<<<<<<<<<<<
30409  *         sort_rev = np.argsort(sort_fwd).astype(np.uint64)
30410  *         P = P0[sort_fwd,:]
30411  */
30412   /*else*/ {
30413     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_morton_qsort); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1196, __pyx_L1_error)
30414     __Pyx_GOTREF(__pyx_t_5);
30415     __pyx_t_3 = __Pyx_PyInt_From_npy_int64((__pyx_v_N - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1196, __pyx_L1_error)
30416     __Pyx_GOTREF(__pyx_t_3);
30417     __pyx_t_1 = NULL;
30418     __pyx_t_9 = 0;
30419     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
30420       __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
30421       if (likely(__pyx_t_1)) {
30422         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
30423         __Pyx_INCREF(__pyx_t_1);
30424         __Pyx_INCREF(function);
30425         __Pyx_DECREF_SET(__pyx_t_5, function);
30426         __pyx_t_9 = 1;
30427       }
30428     }
30429     #if CYTHON_FAST_PYCALL
30430     if (PyFunction_Check(__pyx_t_5)) {
30431       PyObject *__pyx_temp[5] = {__pyx_t_1, ((PyObject *)__pyx_v_P0), __pyx_int_0, __pyx_t_3, ((PyObject *)__pyx_v_sort_fwd)};
30432       __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 4+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1196, __pyx_L1_error)
30433       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
30434       __Pyx_GOTREF(__pyx_t_4);
30435       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
30436     } else
30437     #endif
30438     #if CYTHON_FAST_PYCCALL
30439     if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
30440       PyObject *__pyx_temp[5] = {__pyx_t_1, ((PyObject *)__pyx_v_P0), __pyx_int_0, __pyx_t_3, ((PyObject *)__pyx_v_sort_fwd)};
30441       __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 4+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1196, __pyx_L1_error)
30442       __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
30443       __Pyx_GOTREF(__pyx_t_4);
30444       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
30445     } else
30446     #endif
30447     {
30448       __pyx_t_2 = PyTuple_New(4+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1196, __pyx_L1_error)
30449       __Pyx_GOTREF(__pyx_t_2);
30450       if (__pyx_t_1) {
30451         __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL;
30452       }
30453       __Pyx_INCREF(((PyObject *)__pyx_v_P0));
30454       __Pyx_GIVEREF(((PyObject *)__pyx_v_P0));
30455       PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_9, ((PyObject *)__pyx_v_P0));
30456       __Pyx_INCREF(__pyx_int_0);
30457       __Pyx_GIVEREF(__pyx_int_0);
30458       PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_9, __pyx_int_0);
30459       __Pyx_GIVEREF(__pyx_t_3);
30460       PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_9, __pyx_t_3);
30461       __Pyx_INCREF(((PyObject *)__pyx_v_sort_fwd));
30462       __Pyx_GIVEREF(((PyObject *)__pyx_v_sort_fwd));
30463       PyTuple_SET_ITEM(__pyx_t_2, 3+__pyx_t_9, ((PyObject *)__pyx_v_sort_fwd));
30464       __pyx_t_3 = 0;
30465       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1196, __pyx_L1_error)
30466       __Pyx_GOTREF(__pyx_t_4);
30467       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
30468     }
30469     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
30470     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
30471 
30472     /* "yt/utilities/lib/geometry_utils.pyx":1197
30473  *     else:
30474  *         morton_qsort(P0,0,N-1,sort_fwd)
30475  *         sort_rev = np.argsort(sort_fwd).astype(np.uint64)             # <<<<<<<<<<<<<<
30476  *         P = P0[sort_fwd,:]
30477  *         i = sort_rev[i0]
30478  */
30479     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1197, __pyx_L1_error)
30480     __Pyx_GOTREF(__pyx_t_2);
30481     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_argsort); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1197, __pyx_L1_error)
30482     __Pyx_GOTREF(__pyx_t_3);
30483     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
30484     __pyx_t_2 = NULL;
30485     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
30486       __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
30487       if (likely(__pyx_t_2)) {
30488         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
30489         __Pyx_INCREF(__pyx_t_2);
30490         __Pyx_INCREF(function);
30491         __Pyx_DECREF_SET(__pyx_t_3, function);
30492       }
30493     }
30494     __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, ((PyObject *)__pyx_v_sort_fwd)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_sort_fwd));
30495     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
30496     if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1197, __pyx_L1_error)
30497     __Pyx_GOTREF(__pyx_t_5);
30498     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
30499     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_astype); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1197, __pyx_L1_error)
30500     __Pyx_GOTREF(__pyx_t_3);
30501     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
30502     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1197, __pyx_L1_error)
30503     __Pyx_GOTREF(__pyx_t_5);
30504     __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_uint64); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1197, __pyx_L1_error)
30505     __Pyx_GOTREF(__pyx_t_2);
30506     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
30507     __pyx_t_5 = NULL;
30508     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
30509       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
30510       if (likely(__pyx_t_5)) {
30511         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
30512         __Pyx_INCREF(__pyx_t_5);
30513         __Pyx_INCREF(function);
30514         __Pyx_DECREF_SET(__pyx_t_3, function);
30515       }
30516     }
30517     __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
30518     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
30519     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
30520     if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1197, __pyx_L1_error)
30521     __Pyx_GOTREF(__pyx_t_4);
30522     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
30523     if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 1197, __pyx_L1_error)
30524     __pyx_t_7 = ((PyArrayObject *)__pyx_t_4);
30525     {
30526       __Pyx_BufFmt_StackElem __pyx_stack[1];
30527       __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sort_rev.rcbuffer->pybuffer);
30528       __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sort_rev.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
30529       if (unlikely(__pyx_t_9 < 0)) {
30530         PyErr_Fetch(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
30531         if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sort_rev.rcbuffer->pybuffer, (PyObject*)__pyx_v_sort_rev, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
30532           Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10);
30533           __Pyx_RaiseBufferFallbackError();
30534         } else {
30535           PyErr_Restore(__pyx_t_12, __pyx_t_11, __pyx_t_10);
30536         }
30537         __pyx_t_12 = __pyx_t_11 = __pyx_t_10 = 0;
30538       }
30539       __pyx_pybuffernd_sort_rev.diminfo[0].strides = __pyx_pybuffernd_sort_rev.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sort_rev.diminfo[0].shape = __pyx_pybuffernd_sort_rev.rcbuffer->pybuffer.shape[0];
30540       if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(1, 1197, __pyx_L1_error)
30541     }
30542     __pyx_t_7 = 0;
30543     __Pyx_DECREF_SET(__pyx_v_sort_rev, ((PyArrayObject *)__pyx_t_4));
30544     __pyx_t_4 = 0;
30545 
30546     /* "yt/utilities/lib/geometry_utils.pyx":1198
30547  *         morton_qsort(P0,0,N-1,sort_fwd)
30548  *         sort_rev = np.argsort(sort_fwd).astype(np.uint64)
30549  *         P = P0[sort_fwd,:]             # <<<<<<<<<<<<<<
30550  *         i = sort_rev[i0]
30551  *     # Check domain and set if singular
30552  */
30553     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1198, __pyx_L1_error)
30554     __Pyx_GOTREF(__pyx_t_4);
30555     __Pyx_INCREF(((PyObject *)__pyx_v_sort_fwd));
30556     __Pyx_GIVEREF(((PyObject *)__pyx_v_sort_fwd));
30557     PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_sort_fwd));
30558     __Pyx_INCREF(__pyx_slice__4);
30559     __Pyx_GIVEREF(__pyx_slice__4);
30560     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_slice__4);
30561     __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P0), __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1198, __pyx_L1_error)
30562     __Pyx_GOTREF(__pyx_t_3);
30563     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
30564     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 1198, __pyx_L1_error)
30565     __pyx_t_13 = ((PyArrayObject *)__pyx_t_3);
30566     {
30567       __Pyx_BufFmt_StackElem __pyx_stack[1];
30568       __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_P.rcbuffer->pybuffer);
30569       __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_P.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
30570       if (unlikely(__pyx_t_9 < 0)) {
30571         PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
30572         if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_P.rcbuffer->pybuffer, (PyObject*)__pyx_v_P, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
30573           Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
30574           __Pyx_RaiseBufferFallbackError();
30575         } else {
30576           PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
30577         }
30578         __pyx_t_10 = __pyx_t_11 = __pyx_t_12 = 0;
30579       }
30580       __pyx_pybuffernd_P.diminfo[0].strides = __pyx_pybuffernd_P.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_P.diminfo[0].shape = __pyx_pybuffernd_P.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_P.diminfo[1].strides = __pyx_pybuffernd_P.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_P.diminfo[1].shape = __pyx_pybuffernd_P.rcbuffer->pybuffer.shape[1];
30581       if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(1, 1198, __pyx_L1_error)
30582     }
30583     __pyx_t_13 = 0;
30584     __pyx_v_P = ((PyArrayObject *)__pyx_t_3);
30585     __pyx_t_3 = 0;
30586 
30587     /* "yt/utilities/lib/geometry_utils.pyx":1199
30588  *         sort_rev = np.argsort(sort_fwd).astype(np.uint64)
30589  *         P = P0[sort_fwd,:]
30590  *         i = sort_rev[i0]             # <<<<<<<<<<<<<<
30591  *     # Check domain and set if singular
30592  *     for j in range(3):
30593  */
30594     __pyx_t_14 = __pyx_v_i0;
30595     __pyx_v_i = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_sort_rev.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_sort_rev.diminfo[0].strides));
30596   }
30597   __pyx_L3:;
30598 
30599   /* "yt/utilities/lib/geometry_utils.pyx":1201
30600  *         i = sort_rev[i0]
30601  *     # Check domain and set if singular
30602  *     for j in range(3):             # <<<<<<<<<<<<<<
30603  *         if DLE[j] == DRE[j]:
30604  *             DLE[j] = min(P[:,j])
30605  */
30606   for (__pyx_t_9 = 0; __pyx_t_9 < 3; __pyx_t_9+=1) {
30607     __pyx_v_j = __pyx_t_9;
30608 
30609     /* "yt/utilities/lib/geometry_utils.pyx":1202
30610  *     # Check domain and set if singular
30611  *     for j in range(3):
30612  *         if DLE[j] == DRE[j]:             # <<<<<<<<<<<<<<
30613  *             DLE[j] = min(P[:,j])
30614  *             DRE[j] = max(P[:,j])
30615  */
30616     __pyx_t_15 = __pyx_v_j;
30617     __pyx_t_16 = __pyx_v_j;
30618     __pyx_t_8 = (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_DLE.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_DLE.diminfo[0].strides)) == (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_DRE.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_DRE.diminfo[0].strides))) != 0);
30619     if (__pyx_t_8) {
30620 
30621       /* "yt/utilities/lib/geometry_utils.pyx":1203
30622  *     for j in range(3):
30623  *         if DLE[j] == DRE[j]:
30624  *             DLE[j] = min(P[:,j])             # <<<<<<<<<<<<<<
30625  *             DRE[j] = max(P[:,j])
30626  *     # Get initial guess bassed on position in z-order
30627  */
30628       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1203, __pyx_L1_error)
30629       __Pyx_GOTREF(__pyx_t_3);
30630       __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1203, __pyx_L1_error)
30631       __Pyx_GOTREF(__pyx_t_4);
30632       __Pyx_INCREF(__pyx_slice__4);
30633       __Pyx_GIVEREF(__pyx_slice__4);
30634       PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_slice__4);
30635       __Pyx_GIVEREF(__pyx_t_3);
30636       PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
30637       __pyx_t_3 = 0;
30638       __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1203, __pyx_L1_error)
30639       __Pyx_GOTREF(__pyx_t_3);
30640       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
30641       __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_min, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1203, __pyx_L1_error)
30642       __Pyx_GOTREF(__pyx_t_4);
30643       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
30644       __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_17 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 1203, __pyx_L1_error)
30645       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
30646       __pyx_t_18 = __pyx_v_j;
30647       *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_DLE.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_DLE.diminfo[0].strides) = __pyx_t_17;
30648 
30649       /* "yt/utilities/lib/geometry_utils.pyx":1204
30650  *         if DLE[j] == DRE[j]:
30651  *             DLE[j] = min(P[:,j])
30652  *             DRE[j] = max(P[:,j])             # <<<<<<<<<<<<<<
30653  *     # Get initial guess bassed on position in z-order
30654  *     idxmin = <np.int64_t>max(i-c*k, 0)
30655  */
30656       __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1204, __pyx_L1_error)
30657       __Pyx_GOTREF(__pyx_t_4);
30658       __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1204, __pyx_L1_error)
30659       __Pyx_GOTREF(__pyx_t_3);
30660       __Pyx_INCREF(__pyx_slice__4);
30661       __Pyx_GIVEREF(__pyx_slice__4);
30662       PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_slice__4);
30663       __Pyx_GIVEREF(__pyx_t_4);
30664       PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
30665       __pyx_t_4 = 0;
30666       __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1204, __pyx_L1_error)
30667       __Pyx_GOTREF(__pyx_t_4);
30668       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
30669       __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1204, __pyx_L1_error)
30670       __Pyx_GOTREF(__pyx_t_3);
30671       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
30672       __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_17 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 1204, __pyx_L1_error)
30673       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
30674       __pyx_t_19 = __pyx_v_j;
30675       *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_DRE.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_DRE.diminfo[0].strides) = __pyx_t_17;
30676 
30677       /* "yt/utilities/lib/geometry_utils.pyx":1202
30678  *     # Check domain and set if singular
30679  *     for j in range(3):
30680  *         if DLE[j] == DRE[j]:             # <<<<<<<<<<<<<<
30681  *             DLE[j] = min(P[:,j])
30682  *             DRE[j] = max(P[:,j])
30683  */
30684     }
30685   }
30686 
30687   /* "yt/utilities/lib/geometry_utils.pyx":1206
30688  *             DRE[j] = max(P[:,j])
30689  *     # Get initial guess bassed on position in z-order
30690  *     idxmin = <np.int64_t>max(i-c*k, 0)             # <<<<<<<<<<<<<<
30691  *     idxmax = <np.int64_t>min(i+c*k, N-1)
30692  *     Ai = np.hstack((np.arange(idxmin,i,dtype=np.uint64),
30693  */
30694   __pyx_t_20 = 0;
30695   __pyx_t_21 = (__pyx_v_i - (__pyx_v_c * __pyx_v_k));
30696   if (((__pyx_t_20 > __pyx_t_21) != 0)) {
30697     __pyx_t_22 = __pyx_t_20;
30698   } else {
30699     __pyx_t_22 = __pyx_t_21;
30700   }
30701   __pyx_v_idxmin = ((__pyx_t_5numpy_int64_t)__pyx_t_22);
30702 
30703   /* "yt/utilities/lib/geometry_utils.pyx":1207
30704  *     # Get initial guess bassed on position in z-order
30705  *     idxmin = <np.int64_t>max(i-c*k, 0)
30706  *     idxmax = <np.int64_t>min(i+c*k, N-1)             # <<<<<<<<<<<<<<
30707  *     Ai = np.hstack((np.arange(idxmin,i,dtype=np.uint64),
30708  *                     np.arange(i+1,idxmax+1,dtype=np.uint64)))
30709  */
30710   __pyx_t_23 = (__pyx_v_N - 1);
30711   __pyx_t_22 = (__pyx_v_i + (__pyx_v_c * __pyx_v_k));
30712   if (((__pyx_t_23 < __pyx_t_22) != 0)) {
30713     __pyx_t_21 = __pyx_t_23;
30714   } else {
30715     __pyx_t_21 = __pyx_t_22;
30716   }
30717   __pyx_v_idxmax = ((__pyx_t_5numpy_int64_t)__pyx_t_21);
30718 
30719   /* "yt/utilities/lib/geometry_utils.pyx":1208
30720  *     idxmin = <np.int64_t>max(i-c*k, 0)
30721  *     idxmax = <np.int64_t>min(i+c*k, N-1)
30722  *     Ai = np.hstack((np.arange(idxmin,i,dtype=np.uint64),             # <<<<<<<<<<<<<<
30723  *                     np.arange(i+1,idxmax+1,dtype=np.uint64)))
30724  *     Ai,rad_Ai = knn_direct(P,k,i,Ai,return_rad=True)
30725  */
30726   __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1208, __pyx_L1_error)
30727   __Pyx_GOTREF(__pyx_t_4);
30728   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_hstack); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1208, __pyx_L1_error)
30729   __Pyx_GOTREF(__pyx_t_2);
30730   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
30731   __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1208, __pyx_L1_error)
30732   __Pyx_GOTREF(__pyx_t_4);
30733   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_arange); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1208, __pyx_L1_error)
30734   __Pyx_GOTREF(__pyx_t_5);
30735   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
30736   __pyx_t_4 = __Pyx_PyInt_From_npy_int64(__pyx_v_idxmin); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1208, __pyx_L1_error)
30737   __Pyx_GOTREF(__pyx_t_4);
30738   __pyx_t_1 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1208, __pyx_L1_error)
30739   __Pyx_GOTREF(__pyx_t_1);
30740   __pyx_t_24 = PyTuple_New(2); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 1208, __pyx_L1_error)
30741   __Pyx_GOTREF(__pyx_t_24);
30742   __Pyx_GIVEREF(__pyx_t_4);
30743   PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_4);
30744   __Pyx_GIVEREF(__pyx_t_1);
30745   PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_1);
30746   __pyx_t_4 = 0;
30747   __pyx_t_1 = 0;
30748   __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1208, __pyx_L1_error)
30749   __Pyx_GOTREF(__pyx_t_1);
30750   __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1208, __pyx_L1_error)
30751   __Pyx_GOTREF(__pyx_t_4);
30752   __pyx_t_25 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint64); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 1208, __pyx_L1_error)
30753   __Pyx_GOTREF(__pyx_t_25);
30754   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
30755   if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_25) < 0) __PYX_ERR(1, 1208, __pyx_L1_error)
30756   __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
30757   __pyx_t_25 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_24, __pyx_t_1); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 1208, __pyx_L1_error)
30758   __Pyx_GOTREF(__pyx_t_25);
30759   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
30760   __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
30761   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30762 
30763   /* "yt/utilities/lib/geometry_utils.pyx":1209
30764  *     idxmax = <np.int64_t>min(i+c*k, N-1)
30765  *     Ai = np.hstack((np.arange(idxmin,i,dtype=np.uint64),
30766  *                     np.arange(i+1,idxmax+1,dtype=np.uint64)))             # <<<<<<<<<<<<<<
30767  *     Ai,rad_Ai = knn_direct(P,k,i,Ai,return_rad=True)
30768  *     # Get radius of solution
30769  */
30770   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1209, __pyx_L1_error)
30771   __Pyx_GOTREF(__pyx_t_1);
30772   __pyx_t_24 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_arange); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 1209, __pyx_L1_error)
30773   __Pyx_GOTREF(__pyx_t_24);
30774   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30775   __pyx_t_1 = __Pyx_PyInt_From_npy_uint64((__pyx_v_i + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1209, __pyx_L1_error)
30776   __Pyx_GOTREF(__pyx_t_1);
30777   __pyx_t_5 = __Pyx_PyInt_From_npy_int64((__pyx_v_idxmax + 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1209, __pyx_L1_error)
30778   __Pyx_GOTREF(__pyx_t_5);
30779   __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1209, __pyx_L1_error)
30780   __Pyx_GOTREF(__pyx_t_4);
30781   __Pyx_GIVEREF(__pyx_t_1);
30782   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
30783   __Pyx_GIVEREF(__pyx_t_5);
30784   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
30785   __pyx_t_1 = 0;
30786   __pyx_t_5 = 0;
30787   __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1209, __pyx_L1_error)
30788   __Pyx_GOTREF(__pyx_t_5);
30789   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1209, __pyx_L1_error)
30790   __Pyx_GOTREF(__pyx_t_1);
30791   __pyx_t_26 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_uint64); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 1209, __pyx_L1_error)
30792   __Pyx_GOTREF(__pyx_t_26);
30793   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30794   if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_26) < 0) __PYX_ERR(1, 1209, __pyx_L1_error)
30795   __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
30796   __pyx_t_26 = __Pyx_PyObject_Call(__pyx_t_24, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 1209, __pyx_L1_error)
30797   __Pyx_GOTREF(__pyx_t_26);
30798   __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
30799   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
30800   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
30801 
30802   /* "yt/utilities/lib/geometry_utils.pyx":1208
30803  *     idxmin = <np.int64_t>max(i-c*k, 0)
30804  *     idxmax = <np.int64_t>min(i+c*k, N-1)
30805  *     Ai = np.hstack((np.arange(idxmin,i,dtype=np.uint64),             # <<<<<<<<<<<<<<
30806  *                     np.arange(i+1,idxmax+1,dtype=np.uint64)))
30807  *     Ai,rad_Ai = knn_direct(P,k,i,Ai,return_rad=True)
30808  */
30809   __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1208, __pyx_L1_error)
30810   __Pyx_GOTREF(__pyx_t_5);
30811   __Pyx_GIVEREF(__pyx_t_25);
30812   PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_25);
30813   __Pyx_GIVEREF(__pyx_t_26);
30814   PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_26);
30815   __pyx_t_25 = 0;
30816   __pyx_t_26 = 0;
30817   __pyx_t_26 = NULL;
30818   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
30819     __pyx_t_26 = PyMethod_GET_SELF(__pyx_t_2);
30820     if (likely(__pyx_t_26)) {
30821       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
30822       __Pyx_INCREF(__pyx_t_26);
30823       __Pyx_INCREF(function);
30824       __Pyx_DECREF_SET(__pyx_t_2, function);
30825     }
30826   }
30827   __pyx_t_3 = (__pyx_t_26) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_26, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
30828   __Pyx_XDECREF(__pyx_t_26); __pyx_t_26 = 0;
30829   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
30830   if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1208, __pyx_L1_error)
30831   __Pyx_GOTREF(__pyx_t_3);
30832   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
30833   if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 1208, __pyx_L1_error)
30834   __pyx_t_27 = ((PyArrayObject *)__pyx_t_3);
30835   {
30836     __Pyx_BufFmt_StackElem __pyx_stack[1];
30837     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer);
30838     __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer, (PyObject*)__pyx_t_27, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
30839     if (unlikely(__pyx_t_9 < 0)) {
30840       PyErr_Fetch(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
30841       if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer, (PyObject*)__pyx_v_Ai, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
30842         Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10);
30843         __Pyx_RaiseBufferFallbackError();
30844       } else {
30845         PyErr_Restore(__pyx_t_12, __pyx_t_11, __pyx_t_10);
30846       }
30847       __pyx_t_12 = __pyx_t_11 = __pyx_t_10 = 0;
30848     }
30849     __pyx_pybuffernd_Ai.diminfo[0].strides = __pyx_pybuffernd_Ai.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Ai.diminfo[0].shape = __pyx_pybuffernd_Ai.rcbuffer->pybuffer.shape[0];
30850     if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(1, 1208, __pyx_L1_error)
30851   }
30852   __pyx_t_27 = 0;
30853   __pyx_v_Ai = ((PyArrayObject *)__pyx_t_3);
30854   __pyx_t_3 = 0;
30855 
30856   /* "yt/utilities/lib/geometry_utils.pyx":1210
30857  *     Ai = np.hstack((np.arange(idxmin,i,dtype=np.uint64),
30858  *                     np.arange(i+1,idxmax+1,dtype=np.uint64)))
30859  *     Ai,rad_Ai = knn_direct(P,k,i,Ai,return_rad=True)             # <<<<<<<<<<<<<<
30860  *     # Get radius of solution
30861  *     cbox_Ai = np.zeros(3,dtype=np.float64)
30862  */
30863   __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_knn_direct); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1210, __pyx_L1_error)
30864   __Pyx_GOTREF(__pyx_t_3);
30865   __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1210, __pyx_L1_error)
30866   __Pyx_GOTREF(__pyx_t_2);
30867   __pyx_t_5 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1210, __pyx_L1_error)
30868   __Pyx_GOTREF(__pyx_t_5);
30869   __pyx_t_26 = PyTuple_New(4); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 1210, __pyx_L1_error)
30870   __Pyx_GOTREF(__pyx_t_26);
30871   __Pyx_INCREF(((PyObject *)__pyx_v_P));
30872   __Pyx_GIVEREF(((PyObject *)__pyx_v_P));
30873   PyTuple_SET_ITEM(__pyx_t_26, 0, ((PyObject *)__pyx_v_P));
30874   __Pyx_GIVEREF(__pyx_t_2);
30875   PyTuple_SET_ITEM(__pyx_t_26, 1, __pyx_t_2);
30876   __Pyx_GIVEREF(__pyx_t_5);
30877   PyTuple_SET_ITEM(__pyx_t_26, 2, __pyx_t_5);
30878   __Pyx_INCREF(((PyObject *)__pyx_v_Ai));
30879   __Pyx_GIVEREF(((PyObject *)__pyx_v_Ai));
30880   PyTuple_SET_ITEM(__pyx_t_26, 3, ((PyObject *)__pyx_v_Ai));
30881   __pyx_t_2 = 0;
30882   __pyx_t_5 = 0;
30883   __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1210, __pyx_L1_error)
30884   __Pyx_GOTREF(__pyx_t_5);
30885   if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return_rad, Py_True) < 0) __PYX_ERR(1, 1210, __pyx_L1_error)
30886   __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_26, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1210, __pyx_L1_error)
30887   __Pyx_GOTREF(__pyx_t_2);
30888   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
30889   __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
30890   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
30891   if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
30892     PyObject* sequence = __pyx_t_2;
30893     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
30894     if (unlikely(size != 2)) {
30895       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
30896       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
30897       __PYX_ERR(1, 1210, __pyx_L1_error)
30898     }
30899     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
30900     if (likely(PyTuple_CheckExact(sequence))) {
30901       __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
30902       __pyx_t_26 = PyTuple_GET_ITEM(sequence, 1);
30903     } else {
30904       __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
30905       __pyx_t_26 = PyList_GET_ITEM(sequence, 1);
30906     }
30907     __Pyx_INCREF(__pyx_t_5);
30908     __Pyx_INCREF(__pyx_t_26);
30909     #else
30910     __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1210, __pyx_L1_error)
30911     __Pyx_GOTREF(__pyx_t_5);
30912     __pyx_t_26 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 1210, __pyx_L1_error)
30913     __Pyx_GOTREF(__pyx_t_26);
30914     #endif
30915     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
30916   } else {
30917     Py_ssize_t index = -1;
30918     __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1210, __pyx_L1_error)
30919     __Pyx_GOTREF(__pyx_t_3);
30920     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
30921     __pyx_t_28 = Py_TYPE(__pyx_t_3)->tp_iternext;
30922     index = 0; __pyx_t_5 = __pyx_t_28(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L7_unpacking_failed;
30923     __Pyx_GOTREF(__pyx_t_5);
30924     index = 1; __pyx_t_26 = __pyx_t_28(__pyx_t_3); if (unlikely(!__pyx_t_26)) goto __pyx_L7_unpacking_failed;
30925     __Pyx_GOTREF(__pyx_t_26);
30926     if (__Pyx_IternextUnpackEndCheck(__pyx_t_28(__pyx_t_3), 2) < 0) __PYX_ERR(1, 1210, __pyx_L1_error)
30927     __pyx_t_28 = NULL;
30928     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
30929     goto __pyx_L8_unpacking_done;
30930     __pyx_L7_unpacking_failed:;
30931     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
30932     __pyx_t_28 = NULL;
30933     if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
30934     __PYX_ERR(1, 1210, __pyx_L1_error)
30935     __pyx_L8_unpacking_done:;
30936   }
30937   if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 1210, __pyx_L1_error)
30938   __pyx_t_27 = ((PyArrayObject *)__pyx_t_5);
30939   {
30940     __Pyx_BufFmt_StackElem __pyx_stack[1];
30941     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer);
30942     __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer, (PyObject*)__pyx_t_27, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
30943     if (unlikely(__pyx_t_9 < 0)) {
30944       PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
30945       if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer, (PyObject*)__pyx_v_Ai, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
30946         Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
30947         __Pyx_RaiseBufferFallbackError();
30948       } else {
30949         PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
30950       }
30951       __pyx_t_10 = __pyx_t_11 = __pyx_t_12 = 0;
30952     }
30953     __pyx_pybuffernd_Ai.diminfo[0].strides = __pyx_pybuffernd_Ai.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Ai.diminfo[0].shape = __pyx_pybuffernd_Ai.rcbuffer->pybuffer.shape[0];
30954     if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(1, 1210, __pyx_L1_error)
30955   }
30956   __pyx_t_27 = 0;
30957   __Pyx_DECREF_SET(__pyx_v_Ai, ((PyArrayObject *)__pyx_t_5));
30958   __pyx_t_5 = 0;
30959   __pyx_v_rad_Ai = __pyx_t_26;
30960   __pyx_t_26 = 0;
30961 
30962   /* "yt/utilities/lib/geometry_utils.pyx":1212
30963  *     Ai,rad_Ai = knn_direct(P,k,i,Ai,return_rad=True)
30964  *     # Get radius of solution
30965  *     cbox_Ai = np.zeros(3,dtype=np.float64)             # <<<<<<<<<<<<<<
30966  *     rbox_Ai = quadtree_box(P[i,:],P[Ai[k-1],:],order,DLE,DRE,cbox_Ai)
30967  *     rad_Ai = rbox_Ai
30968  */
30969   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1212, __pyx_L1_error)
30970   __Pyx_GOTREF(__pyx_t_2);
30971   __pyx_t_26 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 1212, __pyx_L1_error)
30972   __Pyx_GOTREF(__pyx_t_26);
30973   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
30974   __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1212, __pyx_L1_error)
30975   __Pyx_GOTREF(__pyx_t_2);
30976   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1212, __pyx_L1_error)
30977   __Pyx_GOTREF(__pyx_t_5);
30978   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1212, __pyx_L1_error)
30979   __Pyx_GOTREF(__pyx_t_3);
30980   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
30981   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(1, 1212, __pyx_L1_error)
30982   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
30983   __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_26, __pyx_tuple__9, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1212, __pyx_L1_error)
30984   __Pyx_GOTREF(__pyx_t_3);
30985   __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
30986   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
30987   __pyx_v_cbox_Ai = __pyx_t_3;
30988   __pyx_t_3 = 0;
30989 
30990   /* "yt/utilities/lib/geometry_utils.pyx":1213
30991  *     # Get radius of solution
30992  *     cbox_Ai = np.zeros(3,dtype=np.float64)
30993  *     rbox_Ai = quadtree_box(P[i,:],P[Ai[k-1],:],order,DLE,DRE,cbox_Ai)             # <<<<<<<<<<<<<<
30994  *     rad_Ai = rbox_Ai
30995  *     # Extend upper bound to match lower bound
30996  */
30997   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_quadtree_box); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1213, __pyx_L1_error)
30998   __Pyx_GOTREF(__pyx_t_2);
30999   __pyx_t_26 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 1213, __pyx_L1_error)
31000   __Pyx_GOTREF(__pyx_t_26);
31001   __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1213, __pyx_L1_error)
31002   __Pyx_GOTREF(__pyx_t_5);
31003   __Pyx_GIVEREF(__pyx_t_26);
31004   PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_26);
31005   __Pyx_INCREF(__pyx_slice__4);
31006   __Pyx_GIVEREF(__pyx_slice__4);
31007   PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_slice__4);
31008   __pyx_t_26 = 0;
31009   __pyx_t_26 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_5); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 1213, __pyx_L1_error)
31010   __Pyx_GOTREF(__pyx_t_26);
31011   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
31012   __pyx_t_29 = (__pyx_v_k - 1);
31013   __pyx_t_5 = __Pyx_PyInt_From_npy_uint64((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint64_t *, __pyx_pybuffernd_Ai.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_Ai.diminfo[0].strides))); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1213, __pyx_L1_error)
31014   __Pyx_GOTREF(__pyx_t_5);
31015   __pyx_t_25 = PyTuple_New(2); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 1213, __pyx_L1_error)
31016   __Pyx_GOTREF(__pyx_t_25);
31017   __Pyx_GIVEREF(__pyx_t_5);
31018   PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_5);
31019   __Pyx_INCREF(__pyx_slice__4);
31020   __Pyx_GIVEREF(__pyx_slice__4);
31021   PyTuple_SET_ITEM(__pyx_t_25, 1, __pyx_slice__4);
31022   __pyx_t_5 = 0;
31023   __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_25); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1213, __pyx_L1_error)
31024   __Pyx_GOTREF(__pyx_t_5);
31025   __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
31026   __pyx_t_25 = __Pyx_PyInt_From_int(__pyx_v_order); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 1213, __pyx_L1_error)
31027   __Pyx_GOTREF(__pyx_t_25);
31028   __pyx_t_4 = NULL;
31029   __pyx_t_9 = 0;
31030   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
31031     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
31032     if (likely(__pyx_t_4)) {
31033       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
31034       __Pyx_INCREF(__pyx_t_4);
31035       __Pyx_INCREF(function);
31036       __Pyx_DECREF_SET(__pyx_t_2, function);
31037       __pyx_t_9 = 1;
31038     }
31039   }
31040   #if CYTHON_FAST_PYCALL
31041   if (PyFunction_Check(__pyx_t_2)) {
31042     PyObject *__pyx_temp[7] = {__pyx_t_4, __pyx_t_26, __pyx_t_5, __pyx_t_25, ((PyObject *)__pyx_v_DLE), ((PyObject *)__pyx_v_DRE), __pyx_v_cbox_Ai};
31043     __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 6+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1213, __pyx_L1_error)
31044     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
31045     __Pyx_GOTREF(__pyx_t_3);
31046     __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
31047     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
31048     __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
31049   } else
31050   #endif
31051   #if CYTHON_FAST_PYCCALL
31052   if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
31053     PyObject *__pyx_temp[7] = {__pyx_t_4, __pyx_t_26, __pyx_t_5, __pyx_t_25, ((PyObject *)__pyx_v_DLE), ((PyObject *)__pyx_v_DRE), __pyx_v_cbox_Ai};
31054     __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 6+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1213, __pyx_L1_error)
31055     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
31056     __Pyx_GOTREF(__pyx_t_3);
31057     __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
31058     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
31059     __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
31060   } else
31061   #endif
31062   {
31063     __pyx_t_24 = PyTuple_New(6+__pyx_t_9); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 1213, __pyx_L1_error)
31064     __Pyx_GOTREF(__pyx_t_24);
31065     if (__pyx_t_4) {
31066       __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_4); __pyx_t_4 = NULL;
31067     }
31068     __Pyx_GIVEREF(__pyx_t_26);
31069     PyTuple_SET_ITEM(__pyx_t_24, 0+__pyx_t_9, __pyx_t_26);
31070     __Pyx_GIVEREF(__pyx_t_5);
31071     PyTuple_SET_ITEM(__pyx_t_24, 1+__pyx_t_9, __pyx_t_5);
31072     __Pyx_GIVEREF(__pyx_t_25);
31073     PyTuple_SET_ITEM(__pyx_t_24, 2+__pyx_t_9, __pyx_t_25);
31074     __Pyx_INCREF(((PyObject *)__pyx_v_DLE));
31075     __Pyx_GIVEREF(((PyObject *)__pyx_v_DLE));
31076     PyTuple_SET_ITEM(__pyx_t_24, 3+__pyx_t_9, ((PyObject *)__pyx_v_DLE));
31077     __Pyx_INCREF(((PyObject *)__pyx_v_DRE));
31078     __Pyx_GIVEREF(((PyObject *)__pyx_v_DRE));
31079     PyTuple_SET_ITEM(__pyx_t_24, 4+__pyx_t_9, ((PyObject *)__pyx_v_DRE));
31080     __Pyx_INCREF(__pyx_v_cbox_Ai);
31081     __Pyx_GIVEREF(__pyx_v_cbox_Ai);
31082     PyTuple_SET_ITEM(__pyx_t_24, 5+__pyx_t_9, __pyx_v_cbox_Ai);
31083     __pyx_t_26 = 0;
31084     __pyx_t_5 = 0;
31085     __pyx_t_25 = 0;
31086     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_24, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1213, __pyx_L1_error)
31087     __Pyx_GOTREF(__pyx_t_3);
31088     __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
31089   }
31090   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31091   __pyx_v_rbox_Ai = __pyx_t_3;
31092   __pyx_t_3 = 0;
31093 
31094   /* "yt/utilities/lib/geometry_utils.pyx":1214
31095  *     cbox_Ai = np.zeros(3,dtype=np.float64)
31096  *     rbox_Ai = quadtree_box(P[i,:],P[Ai[k-1],:],order,DLE,DRE,cbox_Ai)
31097  *     rad_Ai = rbox_Ai             # <<<<<<<<<<<<<<
31098  *     # Extend upper bound to match lower bound
31099  *     if idxmax < (N-1):
31100  */
31101   __Pyx_INCREF(__pyx_v_rbox_Ai);
31102   __Pyx_DECREF_SET(__pyx_v_rad_Ai, __pyx_v_rbox_Ai);
31103 
31104   /* "yt/utilities/lib/geometry_utils.pyx":1216
31105  *     rad_Ai = rbox_Ai
31106  *     # Extend upper bound to match lower bound
31107  *     if idxmax < (N-1):             # <<<<<<<<<<<<<<
31108  *         if compare_morton(P[i,:]+rad_Ai,P[idxmax,:]):
31109  *             u = i
31110  */
31111   __pyx_t_8 = ((__pyx_v_idxmax < (__pyx_v_N - 1)) != 0);
31112   if (__pyx_t_8) {
31113 
31114     /* "yt/utilities/lib/geometry_utils.pyx":1217
31115  *     # Extend upper bound to match lower bound
31116  *     if idxmax < (N-1):
31117  *         if compare_morton(P[i,:]+rad_Ai,P[idxmax,:]):             # <<<<<<<<<<<<<<
31118  *             u = i
31119  *         else:
31120  */
31121     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_compare_morton); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1217, __pyx_L1_error)
31122     __Pyx_GOTREF(__pyx_t_2);
31123     __pyx_t_24 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 1217, __pyx_L1_error)
31124     __Pyx_GOTREF(__pyx_t_24);
31125     __pyx_t_25 = PyTuple_New(2); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 1217, __pyx_L1_error)
31126     __Pyx_GOTREF(__pyx_t_25);
31127     __Pyx_GIVEREF(__pyx_t_24);
31128     PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_24);
31129     __Pyx_INCREF(__pyx_slice__4);
31130     __Pyx_GIVEREF(__pyx_slice__4);
31131     PyTuple_SET_ITEM(__pyx_t_25, 1, __pyx_slice__4);
31132     __pyx_t_24 = 0;
31133     __pyx_t_24 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_25); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 1217, __pyx_L1_error)
31134     __Pyx_GOTREF(__pyx_t_24);
31135     __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
31136     __pyx_t_25 = PyNumber_Add(__pyx_t_24, __pyx_v_rad_Ai); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 1217, __pyx_L1_error)
31137     __Pyx_GOTREF(__pyx_t_25);
31138     __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
31139     __pyx_t_24 = __Pyx_PyInt_From_npy_int64(__pyx_v_idxmax); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 1217, __pyx_L1_error)
31140     __Pyx_GOTREF(__pyx_t_24);
31141     __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1217, __pyx_L1_error)
31142     __Pyx_GOTREF(__pyx_t_5);
31143     __Pyx_GIVEREF(__pyx_t_24);
31144     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_24);
31145     __Pyx_INCREF(__pyx_slice__4);
31146     __Pyx_GIVEREF(__pyx_slice__4);
31147     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_slice__4);
31148     __pyx_t_24 = 0;
31149     __pyx_t_24 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_5); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 1217, __pyx_L1_error)
31150     __Pyx_GOTREF(__pyx_t_24);
31151     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
31152     __pyx_t_5 = NULL;
31153     __pyx_t_9 = 0;
31154     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
31155       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
31156       if (likely(__pyx_t_5)) {
31157         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
31158         __Pyx_INCREF(__pyx_t_5);
31159         __Pyx_INCREF(function);
31160         __Pyx_DECREF_SET(__pyx_t_2, function);
31161         __pyx_t_9 = 1;
31162       }
31163     }
31164     #if CYTHON_FAST_PYCALL
31165     if (PyFunction_Check(__pyx_t_2)) {
31166       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_25, __pyx_t_24};
31167       __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1217, __pyx_L1_error)
31168       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
31169       __Pyx_GOTREF(__pyx_t_3);
31170       __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
31171       __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
31172     } else
31173     #endif
31174     #if CYTHON_FAST_PYCCALL
31175     if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
31176       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_25, __pyx_t_24};
31177       __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1217, __pyx_L1_error)
31178       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
31179       __Pyx_GOTREF(__pyx_t_3);
31180       __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
31181       __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
31182     } else
31183     #endif
31184     {
31185       __pyx_t_26 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 1217, __pyx_L1_error)
31186       __Pyx_GOTREF(__pyx_t_26);
31187       if (__pyx_t_5) {
31188         __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_t_5); __pyx_t_5 = NULL;
31189       }
31190       __Pyx_GIVEREF(__pyx_t_25);
31191       PyTuple_SET_ITEM(__pyx_t_26, 0+__pyx_t_9, __pyx_t_25);
31192       __Pyx_GIVEREF(__pyx_t_24);
31193       PyTuple_SET_ITEM(__pyx_t_26, 1+__pyx_t_9, __pyx_t_24);
31194       __pyx_t_25 = 0;
31195       __pyx_t_24 = 0;
31196       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_26, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1217, __pyx_L1_error)
31197       __Pyx_GOTREF(__pyx_t_3);
31198       __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
31199     }
31200     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31201     __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(1, 1217, __pyx_L1_error)
31202     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
31203     if (__pyx_t_8) {
31204 
31205       /* "yt/utilities/lib/geometry_utils.pyx":1218
31206  *     if idxmax < (N-1):
31207  *         if compare_morton(P[i,:]+rad_Ai,P[idxmax,:]):
31208  *             u = i             # <<<<<<<<<<<<<<
31209  *         else:
31210  *             I = 1
31211  */
31212       __pyx_v_u = __pyx_v_i;
31213 
31214       /* "yt/utilities/lib/geometry_utils.pyx":1217
31215  *     # Extend upper bound to match lower bound
31216  *     if idxmax < (N-1):
31217  *         if compare_morton(P[i,:]+rad_Ai,P[idxmax,:]):             # <<<<<<<<<<<<<<
31218  *             u = i
31219  *         else:
31220  */
31221       goto __pyx_L10;
31222     }
31223 
31224     /* "yt/utilities/lib/geometry_utils.pyx":1220
31225  *             u = i
31226  *         else:
31227  *             I = 1             # <<<<<<<<<<<<<<
31228  *             while (idxmax+(2**I) < N) and compare_morton(P[idxmax+(2**I),:],P[i,:]+rad_Ai):
31229  *                 I+=1
31230  */
31231     /*else*/ {
31232       __pyx_v_I = 1;
31233 
31234       /* "yt/utilities/lib/geometry_utils.pyx":1221
31235  *         else:
31236  *             I = 1
31237  *             while (idxmax+(2**I) < N) and compare_morton(P[idxmax+(2**I),:],P[i,:]+rad_Ai):             # <<<<<<<<<<<<<<
31238  *                 I+=1
31239  *             u = min(idxmax+(2**I),N-1)
31240  */
31241       while (1) {
31242         __pyx_t_30 = (((__pyx_v_idxmax + __Pyx_pow___pyx_t_5numpy_int64_t(2, __pyx_v_I)) < __pyx_v_N) != 0);
31243         if (__pyx_t_30) {
31244         } else {
31245           __pyx_t_8 = __pyx_t_30;
31246           goto __pyx_L13_bool_binop_done;
31247         }
31248         __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_compare_morton); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1221, __pyx_L1_error)
31249         __Pyx_GOTREF(__pyx_t_2);
31250         __pyx_t_26 = __Pyx_PyInt_From_npy_int64((__pyx_v_idxmax + __Pyx_pow___pyx_t_5numpy_int64_t(2, __pyx_v_I))); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 1221, __pyx_L1_error)
31251         __Pyx_GOTREF(__pyx_t_26);
31252         __pyx_t_24 = PyTuple_New(2); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 1221, __pyx_L1_error)
31253         __Pyx_GOTREF(__pyx_t_24);
31254         __Pyx_GIVEREF(__pyx_t_26);
31255         PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_26);
31256         __Pyx_INCREF(__pyx_slice__4);
31257         __Pyx_GIVEREF(__pyx_slice__4);
31258         PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_slice__4);
31259         __pyx_t_26 = 0;
31260         __pyx_t_26 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_24); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 1221, __pyx_L1_error)
31261         __Pyx_GOTREF(__pyx_t_26);
31262         __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
31263         __pyx_t_24 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 1221, __pyx_L1_error)
31264         __Pyx_GOTREF(__pyx_t_24);
31265         __pyx_t_25 = PyTuple_New(2); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 1221, __pyx_L1_error)
31266         __Pyx_GOTREF(__pyx_t_25);
31267         __Pyx_GIVEREF(__pyx_t_24);
31268         PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_24);
31269         __Pyx_INCREF(__pyx_slice__4);
31270         __Pyx_GIVEREF(__pyx_slice__4);
31271         PyTuple_SET_ITEM(__pyx_t_25, 1, __pyx_slice__4);
31272         __pyx_t_24 = 0;
31273         __pyx_t_24 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_25); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 1221, __pyx_L1_error)
31274         __Pyx_GOTREF(__pyx_t_24);
31275         __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
31276         __pyx_t_25 = PyNumber_Add(__pyx_t_24, __pyx_v_rad_Ai); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 1221, __pyx_L1_error)
31277         __Pyx_GOTREF(__pyx_t_25);
31278         __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
31279         __pyx_t_24 = NULL;
31280         __pyx_t_9 = 0;
31281         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
31282           __pyx_t_24 = PyMethod_GET_SELF(__pyx_t_2);
31283           if (likely(__pyx_t_24)) {
31284             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
31285             __Pyx_INCREF(__pyx_t_24);
31286             __Pyx_INCREF(function);
31287             __Pyx_DECREF_SET(__pyx_t_2, function);
31288             __pyx_t_9 = 1;
31289           }
31290         }
31291         #if CYTHON_FAST_PYCALL
31292         if (PyFunction_Check(__pyx_t_2)) {
31293           PyObject *__pyx_temp[3] = {__pyx_t_24, __pyx_t_26, __pyx_t_25};
31294           __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1221, __pyx_L1_error)
31295           __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
31296           __Pyx_GOTREF(__pyx_t_3);
31297           __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
31298           __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
31299         } else
31300         #endif
31301         #if CYTHON_FAST_PYCCALL
31302         if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
31303           PyObject *__pyx_temp[3] = {__pyx_t_24, __pyx_t_26, __pyx_t_25};
31304           __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1221, __pyx_L1_error)
31305           __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
31306           __Pyx_GOTREF(__pyx_t_3);
31307           __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
31308           __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
31309         } else
31310         #endif
31311         {
31312           __pyx_t_5 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1221, __pyx_L1_error)
31313           __Pyx_GOTREF(__pyx_t_5);
31314           if (__pyx_t_24) {
31315             __Pyx_GIVEREF(__pyx_t_24); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_24); __pyx_t_24 = NULL;
31316           }
31317           __Pyx_GIVEREF(__pyx_t_26);
31318           PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_9, __pyx_t_26);
31319           __Pyx_GIVEREF(__pyx_t_25);
31320           PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_9, __pyx_t_25);
31321           __pyx_t_26 = 0;
31322           __pyx_t_25 = 0;
31323           __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1221, __pyx_L1_error)
31324           __Pyx_GOTREF(__pyx_t_3);
31325           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
31326         }
31327         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31328         __pyx_t_30 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_30 < 0)) __PYX_ERR(1, 1221, __pyx_L1_error)
31329         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
31330         __pyx_t_8 = __pyx_t_30;
31331         __pyx_L13_bool_binop_done:;
31332         if (!__pyx_t_8) break;
31333 
31334         /* "yt/utilities/lib/geometry_utils.pyx":1222
31335  *             I = 1
31336  *             while (idxmax+(2**I) < N) and compare_morton(P[idxmax+(2**I),:],P[i,:]+rad_Ai):
31337  *                 I+=1             # <<<<<<<<<<<<<<
31338  *             u = min(idxmax+(2**I),N-1)
31339  *             Ai = csearch_morton(P,k,i,Ai,min(idxmax+1,N-1),u,order,DLE,DRE,nu=nu)
31340  */
31341         __pyx_v_I = (__pyx_v_I + 1);
31342       }
31343 
31344       /* "yt/utilities/lib/geometry_utils.pyx":1223
31345  *             while (idxmax+(2**I) < N) and compare_morton(P[idxmax+(2**I),:],P[i,:]+rad_Ai):
31346  *                 I+=1
31347  *             u = min(idxmax+(2**I),N-1)             # <<<<<<<<<<<<<<
31348  *             Ai = csearch_morton(P,k,i,Ai,min(idxmax+1,N-1),u,order,DLE,DRE,nu=nu)
31349  *     else:
31350  */
31351       __pyx_t_23 = (__pyx_v_N - 1);
31352       __pyx_t_31 = (__pyx_v_idxmax + __Pyx_pow___pyx_t_5numpy_int64_t(2, __pyx_v_I));
31353       if (((__pyx_t_23 < __pyx_t_31) != 0)) {
31354         __pyx_t_32 = __pyx_t_23;
31355       } else {
31356         __pyx_t_32 = __pyx_t_31;
31357       }
31358       __pyx_v_u = __pyx_t_32;
31359 
31360       /* "yt/utilities/lib/geometry_utils.pyx":1224
31361  *                 I+=1
31362  *             u = min(idxmax+(2**I),N-1)
31363  *             Ai = csearch_morton(P,k,i,Ai,min(idxmax+1,N-1),u,order,DLE,DRE,nu=nu)             # <<<<<<<<<<<<<<
31364  *     else:
31365  *         u = idxmax
31366  */
31367       __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_csearch_morton); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1224, __pyx_L1_error)
31368       __Pyx_GOTREF(__pyx_t_3);
31369       __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1224, __pyx_L1_error)
31370       __Pyx_GOTREF(__pyx_t_2);
31371       __pyx_t_5 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1224, __pyx_L1_error)
31372       __Pyx_GOTREF(__pyx_t_5);
31373       __pyx_t_32 = (__pyx_v_N - 1);
31374       __pyx_t_23 = (__pyx_v_idxmax + 1);
31375       if (((__pyx_t_32 < __pyx_t_23) != 0)) {
31376         __pyx_t_31 = __pyx_t_32;
31377       } else {
31378         __pyx_t_31 = __pyx_t_23;
31379       }
31380       __pyx_t_25 = __Pyx_PyInt_From_npy_int64(__pyx_t_31); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 1224, __pyx_L1_error)
31381       __Pyx_GOTREF(__pyx_t_25);
31382       __pyx_t_26 = __Pyx_PyInt_From_npy_int64(__pyx_v_u); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 1224, __pyx_L1_error)
31383       __Pyx_GOTREF(__pyx_t_26);
31384       __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_order); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 1224, __pyx_L1_error)
31385       __Pyx_GOTREF(__pyx_t_24);
31386       __pyx_t_4 = PyTuple_New(9); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1224, __pyx_L1_error)
31387       __Pyx_GOTREF(__pyx_t_4);
31388       __Pyx_INCREF(((PyObject *)__pyx_v_P));
31389       __Pyx_GIVEREF(((PyObject *)__pyx_v_P));
31390       PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_P));
31391       __Pyx_GIVEREF(__pyx_t_2);
31392       PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
31393       __Pyx_GIVEREF(__pyx_t_5);
31394       PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_5);
31395       __Pyx_INCREF(((PyObject *)__pyx_v_Ai));
31396       __Pyx_GIVEREF(((PyObject *)__pyx_v_Ai));
31397       PyTuple_SET_ITEM(__pyx_t_4, 3, ((PyObject *)__pyx_v_Ai));
31398       __Pyx_GIVEREF(__pyx_t_25);
31399       PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_25);
31400       __Pyx_GIVEREF(__pyx_t_26);
31401       PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_t_26);
31402       __Pyx_GIVEREF(__pyx_t_24);
31403       PyTuple_SET_ITEM(__pyx_t_4, 6, __pyx_t_24);
31404       __Pyx_INCREF(((PyObject *)__pyx_v_DLE));
31405       __Pyx_GIVEREF(((PyObject *)__pyx_v_DLE));
31406       PyTuple_SET_ITEM(__pyx_t_4, 7, ((PyObject *)__pyx_v_DLE));
31407       __Pyx_INCREF(((PyObject *)__pyx_v_DRE));
31408       __Pyx_GIVEREF(((PyObject *)__pyx_v_DRE));
31409       PyTuple_SET_ITEM(__pyx_t_4, 8, ((PyObject *)__pyx_v_DRE));
31410       __pyx_t_2 = 0;
31411       __pyx_t_5 = 0;
31412       __pyx_t_25 = 0;
31413       __pyx_t_26 = 0;
31414       __pyx_t_24 = 0;
31415       __pyx_t_24 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 1224, __pyx_L1_error)
31416       __Pyx_GOTREF(__pyx_t_24);
31417       __pyx_t_26 = __Pyx_PyInt_From_int(__pyx_v_nu); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 1224, __pyx_L1_error)
31418       __Pyx_GOTREF(__pyx_t_26);
31419       if (PyDict_SetItem(__pyx_t_24, __pyx_n_s_nu, __pyx_t_26) < 0) __PYX_ERR(1, 1224, __pyx_L1_error)
31420       __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
31421       __pyx_t_26 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_24); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 1224, __pyx_L1_error)
31422       __Pyx_GOTREF(__pyx_t_26);
31423       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
31424       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
31425       __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
31426       if (!(likely(((__pyx_t_26) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_26, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 1224, __pyx_L1_error)
31427       __pyx_t_27 = ((PyArrayObject *)__pyx_t_26);
31428       {
31429         __Pyx_BufFmt_StackElem __pyx_stack[1];
31430         __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer);
31431         __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer, (PyObject*)__pyx_t_27, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
31432         if (unlikely(__pyx_t_9 < 0)) {
31433           PyErr_Fetch(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
31434           if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer, (PyObject*)__pyx_v_Ai, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
31435             Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10);
31436             __Pyx_RaiseBufferFallbackError();
31437           } else {
31438             PyErr_Restore(__pyx_t_12, __pyx_t_11, __pyx_t_10);
31439           }
31440           __pyx_t_12 = __pyx_t_11 = __pyx_t_10 = 0;
31441         }
31442         __pyx_pybuffernd_Ai.diminfo[0].strides = __pyx_pybuffernd_Ai.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Ai.diminfo[0].shape = __pyx_pybuffernd_Ai.rcbuffer->pybuffer.shape[0];
31443         if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(1, 1224, __pyx_L1_error)
31444       }
31445       __pyx_t_27 = 0;
31446       __Pyx_DECREF_SET(__pyx_v_Ai, ((PyArrayObject *)__pyx_t_26));
31447       __pyx_t_26 = 0;
31448     }
31449     __pyx_L10:;
31450 
31451     /* "yt/utilities/lib/geometry_utils.pyx":1216
31452  *     rad_Ai = rbox_Ai
31453  *     # Extend upper bound to match lower bound
31454  *     if idxmax < (N-1):             # <<<<<<<<<<<<<<
31455  *         if compare_morton(P[i,:]+rad_Ai,P[idxmax,:]):
31456  *             u = i
31457  */
31458     goto __pyx_L9;
31459   }
31460 
31461   /* "yt/utilities/lib/geometry_utils.pyx":1226
31462  *             Ai = csearch_morton(P,k,i,Ai,min(idxmax+1,N-1),u,order,DLE,DRE,nu=nu)
31463  *     else:
31464  *         u = idxmax             # <<<<<<<<<<<<<<
31465  *     # Extend lower bound to match upper bound
31466  *     if idxmin > 0:
31467  */
31468   /*else*/ {
31469     __pyx_v_u = __pyx_v_idxmax;
31470   }
31471   __pyx_L9:;
31472 
31473   /* "yt/utilities/lib/geometry_utils.pyx":1228
31474  *         u = idxmax
31475  *     # Extend lower bound to match upper bound
31476  *     if idxmin > 0:             # <<<<<<<<<<<<<<
31477  *         if compare_morton(P[idxmin,:],P[i,:]-rad_Ai):
31478  *             l = i
31479  */
31480   __pyx_t_8 = ((__pyx_v_idxmin > 0) != 0);
31481   if (__pyx_t_8) {
31482 
31483     /* "yt/utilities/lib/geometry_utils.pyx":1229
31484  *     # Extend lower bound to match upper bound
31485  *     if idxmin > 0:
31486  *         if compare_morton(P[idxmin,:],P[i,:]-rad_Ai):             # <<<<<<<<<<<<<<
31487  *             l = i
31488  *         else:
31489  */
31490     __Pyx_GetModuleGlobalName(__pyx_t_24, __pyx_n_s_compare_morton); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 1229, __pyx_L1_error)
31491     __Pyx_GOTREF(__pyx_t_24);
31492     __pyx_t_4 = __Pyx_PyInt_From_npy_int64(__pyx_v_idxmin); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1229, __pyx_L1_error)
31493     __Pyx_GOTREF(__pyx_t_4);
31494     __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1229, __pyx_L1_error)
31495     __Pyx_GOTREF(__pyx_t_3);
31496     __Pyx_GIVEREF(__pyx_t_4);
31497     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
31498     __Pyx_INCREF(__pyx_slice__4);
31499     __Pyx_GIVEREF(__pyx_slice__4);
31500     PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_slice__4);
31501     __pyx_t_4 = 0;
31502     __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1229, __pyx_L1_error)
31503     __Pyx_GOTREF(__pyx_t_4);
31504     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
31505     __pyx_t_3 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1229, __pyx_L1_error)
31506     __Pyx_GOTREF(__pyx_t_3);
31507     __pyx_t_25 = PyTuple_New(2); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 1229, __pyx_L1_error)
31508     __Pyx_GOTREF(__pyx_t_25);
31509     __Pyx_GIVEREF(__pyx_t_3);
31510     PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_3);
31511     __Pyx_INCREF(__pyx_slice__4);
31512     __Pyx_GIVEREF(__pyx_slice__4);
31513     PyTuple_SET_ITEM(__pyx_t_25, 1, __pyx_slice__4);
31514     __pyx_t_3 = 0;
31515     __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_25); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1229, __pyx_L1_error)
31516     __Pyx_GOTREF(__pyx_t_3);
31517     __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
31518     __pyx_t_25 = PyNumber_Subtract(__pyx_t_3, __pyx_v_rad_Ai); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 1229, __pyx_L1_error)
31519     __Pyx_GOTREF(__pyx_t_25);
31520     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
31521     __pyx_t_3 = NULL;
31522     __pyx_t_9 = 0;
31523     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_24))) {
31524       __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_24);
31525       if (likely(__pyx_t_3)) {
31526         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_24);
31527         __Pyx_INCREF(__pyx_t_3);
31528         __Pyx_INCREF(function);
31529         __Pyx_DECREF_SET(__pyx_t_24, function);
31530         __pyx_t_9 = 1;
31531       }
31532     }
31533     #if CYTHON_FAST_PYCALL
31534     if (PyFunction_Check(__pyx_t_24)) {
31535       PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_4, __pyx_t_25};
31536       __pyx_t_26 = __Pyx_PyFunction_FastCall(__pyx_t_24, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 1229, __pyx_L1_error)
31537       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
31538       __Pyx_GOTREF(__pyx_t_26);
31539       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
31540       __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
31541     } else
31542     #endif
31543     #if CYTHON_FAST_PYCCALL
31544     if (__Pyx_PyFastCFunction_Check(__pyx_t_24)) {
31545       PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_4, __pyx_t_25};
31546       __pyx_t_26 = __Pyx_PyCFunction_FastCall(__pyx_t_24, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 1229, __pyx_L1_error)
31547       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
31548       __Pyx_GOTREF(__pyx_t_26);
31549       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
31550       __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
31551     } else
31552     #endif
31553     {
31554       __pyx_t_5 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1229, __pyx_L1_error)
31555       __Pyx_GOTREF(__pyx_t_5);
31556       if (__pyx_t_3) {
31557         __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
31558       }
31559       __Pyx_GIVEREF(__pyx_t_4);
31560       PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_9, __pyx_t_4);
31561       __Pyx_GIVEREF(__pyx_t_25);
31562       PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_9, __pyx_t_25);
31563       __pyx_t_4 = 0;
31564       __pyx_t_25 = 0;
31565       __pyx_t_26 = __Pyx_PyObject_Call(__pyx_t_24, __pyx_t_5, NULL); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 1229, __pyx_L1_error)
31566       __Pyx_GOTREF(__pyx_t_26);
31567       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
31568     }
31569     __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
31570     __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_26); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(1, 1229, __pyx_L1_error)
31571     __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
31572     if (__pyx_t_8) {
31573 
31574       /* "yt/utilities/lib/geometry_utils.pyx":1230
31575  *     if idxmin > 0:
31576  *         if compare_morton(P[idxmin,:],P[i,:]-rad_Ai):
31577  *             l = i             # <<<<<<<<<<<<<<
31578  *         else:
31579  *             I = 1
31580  */
31581       __pyx_v_l = __pyx_v_i;
31582 
31583       /* "yt/utilities/lib/geometry_utils.pyx":1229
31584  *     # Extend lower bound to match upper bound
31585  *     if idxmin > 0:
31586  *         if compare_morton(P[idxmin,:],P[i,:]-rad_Ai):             # <<<<<<<<<<<<<<
31587  *             l = i
31588  *         else:
31589  */
31590       goto __pyx_L16;
31591     }
31592 
31593     /* "yt/utilities/lib/geometry_utils.pyx":1232
31594  *             l = i
31595  *         else:
31596  *             I = 1             # <<<<<<<<<<<<<<
31597  *             while (idxmin-(2**I) >= 0) and compare_morton(P[i,:]-rad_Ai,P[idxmin-(2**I),:]):
31598  *                 I+=1
31599  */
31600     /*else*/ {
31601       __pyx_v_I = 1;
31602 
31603       /* "yt/utilities/lib/geometry_utils.pyx":1233
31604  *         else:
31605  *             I = 1
31606  *             while (idxmin-(2**I) >= 0) and compare_morton(P[i,:]-rad_Ai,P[idxmin-(2**I),:]):             # <<<<<<<<<<<<<<
31607  *                 I+=1
31608  *             l = max(idxmin-(2**I),0)
31609  */
31610       while (1) {
31611         __pyx_t_30 = (((__pyx_v_idxmin - __Pyx_pow___pyx_t_5numpy_int64_t(2, __pyx_v_I)) >= 0) != 0);
31612         if (__pyx_t_30) {
31613         } else {
31614           __pyx_t_8 = __pyx_t_30;
31615           goto __pyx_L19_bool_binop_done;
31616         }
31617         __Pyx_GetModuleGlobalName(__pyx_t_24, __pyx_n_s_compare_morton); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 1233, __pyx_L1_error)
31618         __Pyx_GOTREF(__pyx_t_24);
31619         __pyx_t_5 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1233, __pyx_L1_error)
31620         __Pyx_GOTREF(__pyx_t_5);
31621         __pyx_t_25 = PyTuple_New(2); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 1233, __pyx_L1_error)
31622         __Pyx_GOTREF(__pyx_t_25);
31623         __Pyx_GIVEREF(__pyx_t_5);
31624         PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_5);
31625         __Pyx_INCREF(__pyx_slice__4);
31626         __Pyx_GIVEREF(__pyx_slice__4);
31627         PyTuple_SET_ITEM(__pyx_t_25, 1, __pyx_slice__4);
31628         __pyx_t_5 = 0;
31629         __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_25); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1233, __pyx_L1_error)
31630         __Pyx_GOTREF(__pyx_t_5);
31631         __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
31632         __pyx_t_25 = PyNumber_Subtract(__pyx_t_5, __pyx_v_rad_Ai); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 1233, __pyx_L1_error)
31633         __Pyx_GOTREF(__pyx_t_25);
31634         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
31635         __pyx_t_5 = __Pyx_PyInt_From_npy_int64((__pyx_v_idxmin - __Pyx_pow___pyx_t_5numpy_int64_t(2, __pyx_v_I))); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1233, __pyx_L1_error)
31636         __Pyx_GOTREF(__pyx_t_5);
31637         __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1233, __pyx_L1_error)
31638         __Pyx_GOTREF(__pyx_t_4);
31639         __Pyx_GIVEREF(__pyx_t_5);
31640         PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
31641         __Pyx_INCREF(__pyx_slice__4);
31642         __Pyx_GIVEREF(__pyx_slice__4);
31643         PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_slice__4);
31644         __pyx_t_5 = 0;
31645         __pyx_t_5 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_P), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1233, __pyx_L1_error)
31646         __Pyx_GOTREF(__pyx_t_5);
31647         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
31648         __pyx_t_4 = NULL;
31649         __pyx_t_9 = 0;
31650         if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_24))) {
31651           __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_24);
31652           if (likely(__pyx_t_4)) {
31653             PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_24);
31654             __Pyx_INCREF(__pyx_t_4);
31655             __Pyx_INCREF(function);
31656             __Pyx_DECREF_SET(__pyx_t_24, function);
31657             __pyx_t_9 = 1;
31658           }
31659         }
31660         #if CYTHON_FAST_PYCALL
31661         if (PyFunction_Check(__pyx_t_24)) {
31662           PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_25, __pyx_t_5};
31663           __pyx_t_26 = __Pyx_PyFunction_FastCall(__pyx_t_24, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 1233, __pyx_L1_error)
31664           __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
31665           __Pyx_GOTREF(__pyx_t_26);
31666           __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
31667           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
31668         } else
31669         #endif
31670         #if CYTHON_FAST_PYCCALL
31671         if (__Pyx_PyFastCFunction_Check(__pyx_t_24)) {
31672           PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_25, __pyx_t_5};
31673           __pyx_t_26 = __Pyx_PyCFunction_FastCall(__pyx_t_24, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 1233, __pyx_L1_error)
31674           __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
31675           __Pyx_GOTREF(__pyx_t_26);
31676           __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
31677           __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
31678         } else
31679         #endif
31680         {
31681           __pyx_t_3 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1233, __pyx_L1_error)
31682           __Pyx_GOTREF(__pyx_t_3);
31683           if (__pyx_t_4) {
31684             __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
31685           }
31686           __Pyx_GIVEREF(__pyx_t_25);
31687           PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_9, __pyx_t_25);
31688           __Pyx_GIVEREF(__pyx_t_5);
31689           PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_9, __pyx_t_5);
31690           __pyx_t_25 = 0;
31691           __pyx_t_5 = 0;
31692           __pyx_t_26 = __Pyx_PyObject_Call(__pyx_t_24, __pyx_t_3, NULL); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 1233, __pyx_L1_error)
31693           __Pyx_GOTREF(__pyx_t_26);
31694           __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
31695         }
31696         __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
31697         __pyx_t_30 = __Pyx_PyObject_IsTrue(__pyx_t_26); if (unlikely(__pyx_t_30 < 0)) __PYX_ERR(1, 1233, __pyx_L1_error)
31698         __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
31699         __pyx_t_8 = __pyx_t_30;
31700         __pyx_L19_bool_binop_done:;
31701         if (!__pyx_t_8) break;
31702 
31703         /* "yt/utilities/lib/geometry_utils.pyx":1234
31704  *             I = 1
31705  *             while (idxmin-(2**I) >= 0) and compare_morton(P[i,:]-rad_Ai,P[idxmin-(2**I),:]):
31706  *                 I+=1             # <<<<<<<<<<<<<<
31707  *             l = max(idxmin-(2**I),0)
31708  *             Ai = csearch_morton(P,k,i,Ai,l,max(idxmin-1,0),order,DLE,DRE,nu=nu)
31709  */
31710         __pyx_v_I = (__pyx_v_I + 1);
31711       }
31712 
31713       /* "yt/utilities/lib/geometry_utils.pyx":1235
31714  *             while (idxmin-(2**I) >= 0) and compare_morton(P[i,:]-rad_Ai,P[idxmin-(2**I),:]):
31715  *                 I+=1
31716  *             l = max(idxmin-(2**I),0)             # <<<<<<<<<<<<<<
31717  *             Ai = csearch_morton(P,k,i,Ai,l,max(idxmin-1,0),order,DLE,DRE,nu=nu)
31718  *     else:
31719  */
31720       __pyx_t_20 = 0;
31721       __pyx_t_31 = (__pyx_v_idxmin - __Pyx_pow___pyx_t_5numpy_int64_t(2, __pyx_v_I));
31722       if (((__pyx_t_20 > __pyx_t_31) != 0)) {
31723         __pyx_t_32 = __pyx_t_20;
31724       } else {
31725         __pyx_t_32 = __pyx_t_31;
31726       }
31727       __pyx_v_l = __pyx_t_32;
31728 
31729       /* "yt/utilities/lib/geometry_utils.pyx":1236
31730  *                 I+=1
31731  *             l = max(idxmin-(2**I),0)
31732  *             Ai = csearch_morton(P,k,i,Ai,l,max(idxmin-1,0),order,DLE,DRE,nu=nu)             # <<<<<<<<<<<<<<
31733  *     else:
31734  *         l = idxmin
31735  */
31736       __Pyx_GetModuleGlobalName(__pyx_t_26, __pyx_n_s_csearch_morton); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 1236, __pyx_L1_error)
31737       __Pyx_GOTREF(__pyx_t_26);
31738       __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 1236, __pyx_L1_error)
31739       __Pyx_GOTREF(__pyx_t_24);
31740       __pyx_t_3 = __Pyx_PyInt_From_npy_uint64(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1236, __pyx_L1_error)
31741       __Pyx_GOTREF(__pyx_t_3);
31742       __pyx_t_5 = __Pyx_PyInt_From_npy_int64(__pyx_v_l); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1236, __pyx_L1_error)
31743       __Pyx_GOTREF(__pyx_t_5);
31744       __pyx_t_20 = 0;
31745       __pyx_t_32 = (__pyx_v_idxmin - 1);
31746       if (((__pyx_t_20 > __pyx_t_32) != 0)) {
31747         __pyx_t_31 = __pyx_t_20;
31748       } else {
31749         __pyx_t_31 = __pyx_t_32;
31750       }
31751       __pyx_t_25 = __Pyx_PyInt_From_npy_int64(__pyx_t_31); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 1236, __pyx_L1_error)
31752       __Pyx_GOTREF(__pyx_t_25);
31753       __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_order); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1236, __pyx_L1_error)
31754       __Pyx_GOTREF(__pyx_t_4);
31755       __pyx_t_2 = PyTuple_New(9); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1236, __pyx_L1_error)
31756       __Pyx_GOTREF(__pyx_t_2);
31757       __Pyx_INCREF(((PyObject *)__pyx_v_P));
31758       __Pyx_GIVEREF(((PyObject *)__pyx_v_P));
31759       PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_P));
31760       __Pyx_GIVEREF(__pyx_t_24);
31761       PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_24);
31762       __Pyx_GIVEREF(__pyx_t_3);
31763       PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_3);
31764       __Pyx_INCREF(((PyObject *)__pyx_v_Ai));
31765       __Pyx_GIVEREF(((PyObject *)__pyx_v_Ai));
31766       PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_v_Ai));
31767       __Pyx_GIVEREF(__pyx_t_5);
31768       PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_t_5);
31769       __Pyx_GIVEREF(__pyx_t_25);
31770       PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_t_25);
31771       __Pyx_GIVEREF(__pyx_t_4);
31772       PyTuple_SET_ITEM(__pyx_t_2, 6, __pyx_t_4);
31773       __Pyx_INCREF(((PyObject *)__pyx_v_DLE));
31774       __Pyx_GIVEREF(((PyObject *)__pyx_v_DLE));
31775       PyTuple_SET_ITEM(__pyx_t_2, 7, ((PyObject *)__pyx_v_DLE));
31776       __Pyx_INCREF(((PyObject *)__pyx_v_DRE));
31777       __Pyx_GIVEREF(((PyObject *)__pyx_v_DRE));
31778       PyTuple_SET_ITEM(__pyx_t_2, 8, ((PyObject *)__pyx_v_DRE));
31779       __pyx_t_24 = 0;
31780       __pyx_t_3 = 0;
31781       __pyx_t_5 = 0;
31782       __pyx_t_25 = 0;
31783       __pyx_t_4 = 0;
31784       __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1236, __pyx_L1_error)
31785       __Pyx_GOTREF(__pyx_t_4);
31786       __pyx_t_25 = __Pyx_PyInt_From_int(__pyx_v_nu); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 1236, __pyx_L1_error)
31787       __Pyx_GOTREF(__pyx_t_25);
31788       if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_nu, __pyx_t_25) < 0) __PYX_ERR(1, 1236, __pyx_L1_error)
31789       __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
31790       __pyx_t_25 = __Pyx_PyObject_Call(__pyx_t_26, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 1236, __pyx_L1_error)
31791       __Pyx_GOTREF(__pyx_t_25);
31792       __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
31793       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31794       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
31795       if (!(likely(((__pyx_t_25) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_25, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 1236, __pyx_L1_error)
31796       __pyx_t_27 = ((PyArrayObject *)__pyx_t_25);
31797       {
31798         __Pyx_BufFmt_StackElem __pyx_stack[1];
31799         __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer);
31800         __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer, (PyObject*)__pyx_t_27, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
31801         if (unlikely(__pyx_t_9 < 0)) {
31802           PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
31803           if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer, (PyObject*)__pyx_v_Ai, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
31804             Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
31805             __Pyx_RaiseBufferFallbackError();
31806           } else {
31807             PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
31808           }
31809           __pyx_t_10 = __pyx_t_11 = __pyx_t_12 = 0;
31810         }
31811         __pyx_pybuffernd_Ai.diminfo[0].strides = __pyx_pybuffernd_Ai.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Ai.diminfo[0].shape = __pyx_pybuffernd_Ai.rcbuffer->pybuffer.shape[0];
31812         if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(1, 1236, __pyx_L1_error)
31813       }
31814       __pyx_t_27 = 0;
31815       __Pyx_DECREF_SET(__pyx_v_Ai, ((PyArrayObject *)__pyx_t_25));
31816       __pyx_t_25 = 0;
31817     }
31818     __pyx_L16:;
31819 
31820     /* "yt/utilities/lib/geometry_utils.pyx":1228
31821  *         u = idxmax
31822  *     # Extend lower bound to match upper bound
31823  *     if idxmin > 0:             # <<<<<<<<<<<<<<
31824  *         if compare_morton(P[idxmin,:],P[i,:]-rad_Ai):
31825  *             l = i
31826  */
31827     goto __pyx_L15;
31828   }
31829 
31830   /* "yt/utilities/lib/geometry_utils.pyx":1238
31831  *             Ai = csearch_morton(P,k,i,Ai,l,max(idxmin-1,0),order,DLE,DRE,nu=nu)
31832  *     else:
31833  *         l = idxmin             # <<<<<<<<<<<<<<
31834  *     # Return indices of neighbors in the correct order
31835  *     if issorted:
31836  */
31837   /*else*/ {
31838     __pyx_v_l = __pyx_v_idxmin;
31839   }
31840   __pyx_L15:;
31841 
31842   /* "yt/utilities/lib/geometry_utils.pyx":1240
31843  *         l = idxmin
31844  *     # Return indices of neighbors in the correct order
31845  *     if issorted:             # <<<<<<<<<<<<<<
31846  *         return Ai
31847  *     else:
31848  */
31849   __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_issorted); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(1, 1240, __pyx_L1_error)
31850   if (__pyx_t_8) {
31851 
31852     /* "yt/utilities/lib/geometry_utils.pyx":1241
31853  *     # Return indices of neighbors in the correct order
31854  *     if issorted:
31855  *         return Ai             # <<<<<<<<<<<<<<
31856  *     else:
31857  *         return sort_fwd[Ai]
31858  */
31859     __Pyx_XDECREF(__pyx_r);
31860     __Pyx_INCREF(((PyObject *)__pyx_v_Ai));
31861     __pyx_r = ((PyObject *)__pyx_v_Ai);
31862     goto __pyx_L0;
31863 
31864     /* "yt/utilities/lib/geometry_utils.pyx":1240
31865  *         l = idxmin
31866  *     # Return indices of neighbors in the correct order
31867  *     if issorted:             # <<<<<<<<<<<<<<
31868  *         return Ai
31869  *     else:
31870  */
31871   }
31872 
31873   /* "yt/utilities/lib/geometry_utils.pyx":1243
31874  *         return Ai
31875  *     else:
31876  *         return sort_fwd[Ai]             # <<<<<<<<<<<<<<
31877  *
31878  * cdef struct PointSet
31879  */
31880   /*else*/ {
31881     __Pyx_XDECREF(__pyx_r);
31882     __pyx_t_25 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_sort_fwd), ((PyObject *)__pyx_v_Ai)); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 1243, __pyx_L1_error)
31883     __Pyx_GOTREF(__pyx_t_25);
31884     __pyx_r = __pyx_t_25;
31885     __pyx_t_25 = 0;
31886     goto __pyx_L0;
31887   }
31888 
31889   /* "yt/utilities/lib/geometry_utils.pyx":1157
31890  * @cython.wraparound(False)
31891  * @cython.cdivision(True)
31892  * def knn_morton(np.ndarray[np.float64_t, ndim=2] P0, int k, np.uint64_t i0,             # <<<<<<<<<<<<<<
31893  *                float c = 1.0, int nu = 4, issorted = False, int order = ORDER_MAX,
31894  *                np.ndarray[np.float64_t, ndim=1] DLE = np.zeros(3,dtype=np.float64),
31895  */
31896 
31897   /* function exit code */
31898   __pyx_L1_error:;
31899   __Pyx_XDECREF(__pyx_t_1);
31900   __Pyx_XDECREF(__pyx_t_2);
31901   __Pyx_XDECREF(__pyx_t_3);
31902   __Pyx_XDECREF(__pyx_t_4);
31903   __Pyx_XDECREF(__pyx_t_5);
31904   __Pyx_XDECREF(__pyx_t_24);
31905   __Pyx_XDECREF(__pyx_t_25);
31906   __Pyx_XDECREF(__pyx_t_26);
31907   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
31908     __Pyx_PyThreadState_declare
31909     __Pyx_PyThreadState_assign
31910     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
31911     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer);
31912     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_DLE.rcbuffer->pybuffer);
31913     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_DRE.rcbuffer->pybuffer);
31914     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_P.rcbuffer->pybuffer);
31915     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_P0.rcbuffer->pybuffer);
31916     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sort_fwd.rcbuffer->pybuffer);
31917     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sort_rev.rcbuffer->pybuffer);
31918   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
31919   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.knn_morton", __pyx_clineno, __pyx_lineno, __pyx_filename);
31920   __pyx_r = NULL;
31921   goto __pyx_L2;
31922   __pyx_L0:;
31923   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ai.rcbuffer->pybuffer);
31924   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_DLE.rcbuffer->pybuffer);
31925   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_DRE.rcbuffer->pybuffer);
31926   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_P.rcbuffer->pybuffer);
31927   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_P0.rcbuffer->pybuffer);
31928   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sort_fwd.rcbuffer->pybuffer);
31929   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sort_rev.rcbuffer->pybuffer);
31930   __pyx_L2:;
31931   __Pyx_XDECREF((PyObject *)__pyx_v_P);
31932   __Pyx_XDECREF((PyObject *)__pyx_v_sort_fwd);
31933   __Pyx_XDECREF((PyObject *)__pyx_v_sort_rev);
31934   __Pyx_XDECREF((PyObject *)__pyx_v_Ai);
31935   __Pyx_XDECREF(__pyx_v_rad_Ai);
31936   __Pyx_XDECREF(__pyx_v_cbox_Ai);
31937   __Pyx_XDECREF(__pyx_v_rbox_Ai);
31938   __Pyx_XGIVEREF(__pyx_r);
31939   __Pyx_RefNannyFinishContext();
31940   return __pyx_r;
31941 }
31942 
31943 /* "yt/utilities/lib/geometry_utils.pyx":1252
31944  *     PointSet *next
31945  *
31946  * cdef inline void get_intersection(np.float64_t p0[3], np.float64_t p1[3],             # <<<<<<<<<<<<<<
31947  *                                   int ax, np.float64_t coord, PointSet *p):
31948  *     cdef np.float64_t vec[3]
31949  */
31950 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_get_intersection(__pyx_t_5numpy_float64_t * __pyx_v_p0,__pyx_t_5numpy_float64_t * __pyx_v_p1,int __pyx_v_ax,__pyx_t_5numpy_float64_t __pyx_v_coord,struct __pyx_t_2yt_9utilities_3lib_14geometry_utils_PointSet * __pyx_v_p)31951 static CYTHON_INLINE void __pyx_f_2yt_9utilities_3lib_14geometry_utils_get_intersection(__pyx_t_5numpy_float64_t *__pyx_v_p0, __pyx_t_5numpy_float64_t *__pyx_v_p1, int __pyx_v_ax, __pyx_t_5numpy_float64_t __pyx_v_coord, struct __pyx_t_2yt_9utilities_3lib_14geometry_utils_PointSet *__pyx_v_p) {
31952   __pyx_t_5numpy_float64_t __pyx_v_vec[3];
31953   __pyx_t_5numpy_float64_t __pyx_v_t;
31954   long __pyx_v_j;
31955   __Pyx_RefNannyDeclarations
31956   long __pyx_t_1;
31957   int __pyx_t_2;
31958   __pyx_t_5numpy_float64_t __pyx_t_3;
31959   __Pyx_RefNannySetupContext("get_intersection", 0);
31960 
31961   /* "yt/utilities/lib/geometry_utils.pyx":1256
31962  *     cdef np.float64_t vec[3]
31963  *     cdef np.float64_t t
31964  *     for j in range(3):             # <<<<<<<<<<<<<<
31965  *         vec[j] = p1[j] - p0[j]
31966  *     if vec[ax] == 0.0:
31967  */
31968   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
31969     __pyx_v_j = __pyx_t_1;
31970 
31971     /* "yt/utilities/lib/geometry_utils.pyx":1257
31972  *     cdef np.float64_t t
31973  *     for j in range(3):
31974  *         vec[j] = p1[j] - p0[j]             # <<<<<<<<<<<<<<
31975  *     if vec[ax] == 0.0:
31976  *         return  # bail if the line is in the plane
31977  */
31978     (__pyx_v_vec[__pyx_v_j]) = ((__pyx_v_p1[__pyx_v_j]) - (__pyx_v_p0[__pyx_v_j]));
31979   }
31980 
31981   /* "yt/utilities/lib/geometry_utils.pyx":1258
31982  *     for j in range(3):
31983  *         vec[j] = p1[j] - p0[j]
31984  *     if vec[ax] == 0.0:             # <<<<<<<<<<<<<<
31985  *         return  # bail if the line is in the plane
31986  *     t = (coord - p0[ax])/vec[ax]
31987  */
31988   __pyx_t_2 = (((__pyx_v_vec[__pyx_v_ax]) == 0.0) != 0);
31989   if (__pyx_t_2) {
31990 
31991     /* "yt/utilities/lib/geometry_utils.pyx":1259
31992  *         vec[j] = p1[j] - p0[j]
31993  *     if vec[ax] == 0.0:
31994  *         return  # bail if the line is in the plane             # <<<<<<<<<<<<<<
31995  *     t = (coord - p0[ax])/vec[ax]
31996  *     # We know that if they're on opposite sides, it has to intersect.  And we
31997  */
31998     goto __pyx_L0;
31999 
32000     /* "yt/utilities/lib/geometry_utils.pyx":1258
32001  *     for j in range(3):
32002  *         vec[j] = p1[j] - p0[j]
32003  *     if vec[ax] == 0.0:             # <<<<<<<<<<<<<<
32004  *         return  # bail if the line is in the plane
32005  *     t = (coord - p0[ax])/vec[ax]
32006  */
32007   }
32008 
32009   /* "yt/utilities/lib/geometry_utils.pyx":1260
32010  *     if vec[ax] == 0.0:
32011  *         return  # bail if the line is in the plane
32012  *     t = (coord - p0[ax])/vec[ax]             # <<<<<<<<<<<<<<
32013  *     # We know that if they're on opposite sides, it has to intersect.  And we
32014  *     # won't get called otherwise.
32015  */
32016   __pyx_t_3 = (__pyx_v_coord - (__pyx_v_p0[__pyx_v_ax]));
32017   if (unlikely((__pyx_v_vec[__pyx_v_ax]) == 0)) {
32018     PyErr_SetString(PyExc_ZeroDivisionError, "float division");
32019     __PYX_ERR(1, 1260, __pyx_L1_error)
32020   }
32021   __pyx_v_t = (__pyx_t_3 / (__pyx_v_vec[__pyx_v_ax]));
32022 
32023   /* "yt/utilities/lib/geometry_utils.pyx":1263
32024  *     # We know that if they're on opposite sides, it has to intersect.  And we
32025  *     # won't get called otherwise.
32026  *     for j in range(3):             # <<<<<<<<<<<<<<
32027  *         p.points[p.count][j] = p0[j] + vec[j] * t
32028  *     p.count += 1
32029  */
32030   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
32031     __pyx_v_j = __pyx_t_1;
32032 
32033     /* "yt/utilities/lib/geometry_utils.pyx":1264
32034  *     # won't get called otherwise.
32035  *     for j in range(3):
32036  *         p.points[p.count][j] = p0[j] + vec[j] * t             # <<<<<<<<<<<<<<
32037  *     p.count += 1
32038  *
32039  */
32040     ((__pyx_v_p->points[__pyx_v_p->count])[__pyx_v_j]) = ((__pyx_v_p0[__pyx_v_j]) + ((__pyx_v_vec[__pyx_v_j]) * __pyx_v_t));
32041   }
32042 
32043   /* "yt/utilities/lib/geometry_utils.pyx":1265
32044  *     for j in range(3):
32045  *         p.points[p.count][j] = p0[j] + vec[j] * t
32046  *     p.count += 1             # <<<<<<<<<<<<<<
32047  *
32048  * @cython.cdivision(True)
32049  */
32050   __pyx_v_p->count = (__pyx_v_p->count + 1);
32051 
32052   /* "yt/utilities/lib/geometry_utils.pyx":1252
32053  *     PointSet *next
32054  *
32055  * cdef inline void get_intersection(np.float64_t p0[3], np.float64_t p1[3],             # <<<<<<<<<<<<<<
32056  *                                   int ax, np.float64_t coord, PointSet *p):
32057  *     cdef np.float64_t vec[3]
32058  */
32059 
32060   /* function exit code */
32061   goto __pyx_L0;
32062   __pyx_L1_error:;
32063   __Pyx_WriteUnraisable("yt.utilities.lib.geometry_utils.get_intersection", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
32064   __pyx_L0:;
32065   __Pyx_RefNannyFinishContext();
32066 }
32067 
32068 /* "yt/utilities/lib/geometry_utils.pyx":1268
32069  *
32070  * @cython.cdivision(True)
32071  * def triangle_plane_intersect(int ax, np.float64_t coord,             # <<<<<<<<<<<<<<
32072  *                              np.ndarray[np.float64_t, ndim=3] triangles):
32073  *     cdef np.float64_t p0[3]
32074  */
32075 
32076 /* Python wrapper */
32077 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_75triangle_plane_intersect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
32078 static PyMethodDef __pyx_mdef_2yt_9utilities_3lib_14geometry_utils_75triangle_plane_intersect = {"triangle_plane_intersect", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2yt_9utilities_3lib_14geometry_utils_75triangle_plane_intersect, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_2yt_9utilities_3lib_14geometry_utils_75triangle_plane_intersect(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)32079 static PyObject *__pyx_pw_2yt_9utilities_3lib_14geometry_utils_75triangle_plane_intersect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
32080   int __pyx_v_ax;
32081   __pyx_t_5numpy_float64_t __pyx_v_coord;
32082   PyArrayObject *__pyx_v_triangles = 0;
32083   PyObject *__pyx_r = 0;
32084   __Pyx_RefNannyDeclarations
32085   __Pyx_RefNannySetupContext("triangle_plane_intersect (wrapper)", 0);
32086   {
32087     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ax,&__pyx_n_s_coord,&__pyx_n_s_triangles,0};
32088     PyObject* values[3] = {0,0,0};
32089     if (unlikely(__pyx_kwds)) {
32090       Py_ssize_t kw_args;
32091       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
32092       switch (pos_args) {
32093         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
32094         CYTHON_FALLTHROUGH;
32095         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
32096         CYTHON_FALLTHROUGH;
32097         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
32098         CYTHON_FALLTHROUGH;
32099         case  0: break;
32100         default: goto __pyx_L5_argtuple_error;
32101       }
32102       kw_args = PyDict_Size(__pyx_kwds);
32103       switch (pos_args) {
32104         case  0:
32105         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ax)) != 0)) kw_args--;
32106         else goto __pyx_L5_argtuple_error;
32107         CYTHON_FALLTHROUGH;
32108         case  1:
32109         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coord)) != 0)) kw_args--;
32110         else {
32111           __Pyx_RaiseArgtupleInvalid("triangle_plane_intersect", 1, 3, 3, 1); __PYX_ERR(1, 1268, __pyx_L3_error)
32112         }
32113         CYTHON_FALLTHROUGH;
32114         case  2:
32115         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_triangles)) != 0)) kw_args--;
32116         else {
32117           __Pyx_RaiseArgtupleInvalid("triangle_plane_intersect", 1, 3, 3, 2); __PYX_ERR(1, 1268, __pyx_L3_error)
32118         }
32119       }
32120       if (unlikely(kw_args > 0)) {
32121         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "triangle_plane_intersect") < 0)) __PYX_ERR(1, 1268, __pyx_L3_error)
32122       }
32123     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
32124       goto __pyx_L5_argtuple_error;
32125     } else {
32126       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
32127       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
32128       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
32129     }
32130     __pyx_v_ax = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_ax == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1268, __pyx_L3_error)
32131     __pyx_v_coord = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_coord == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(1, 1268, __pyx_L3_error)
32132     __pyx_v_triangles = ((PyArrayObject *)values[2]);
32133   }
32134   goto __pyx_L4_argument_unpacking_done;
32135   __pyx_L5_argtuple_error:;
32136   __Pyx_RaiseArgtupleInvalid("triangle_plane_intersect", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1268, __pyx_L3_error)
32137   __pyx_L3_error:;
32138   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.triangle_plane_intersect", __pyx_clineno, __pyx_lineno, __pyx_filename);
32139   __Pyx_RefNannyFinishContext();
32140   return NULL;
32141   __pyx_L4_argument_unpacking_done:;
32142   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_triangles), __pyx_ptype_5numpy_ndarray, 1, "triangles", 0))) __PYX_ERR(1, 1269, __pyx_L1_error)
32143   __pyx_r = __pyx_pf_2yt_9utilities_3lib_14geometry_utils_74triangle_plane_intersect(__pyx_self, __pyx_v_ax, __pyx_v_coord, __pyx_v_triangles);
32144 
32145   /* function exit code */
32146   goto __pyx_L0;
32147   __pyx_L1_error:;
32148   __pyx_r = NULL;
32149   __pyx_L0:;
32150   __Pyx_RefNannyFinishContext();
32151   return __pyx_r;
32152 }
32153 
__pyx_pf_2yt_9utilities_3lib_14geometry_utils_74triangle_plane_intersect(CYTHON_UNUSED PyObject * __pyx_self,int __pyx_v_ax,__pyx_t_5numpy_float64_t __pyx_v_coord,PyArrayObject * __pyx_v_triangles)32154 static PyObject *__pyx_pf_2yt_9utilities_3lib_14geometry_utils_74triangle_plane_intersect(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_ax, __pyx_t_5numpy_float64_t __pyx_v_coord, PyArrayObject *__pyx_v_triangles) {
32155   __pyx_t_5numpy_float64_t __pyx_v_p0[3];
32156   __pyx_t_5numpy_float64_t __pyx_v_p1[3];
32157   __pyx_t_5numpy_float64_t __pyx_v_p2[3];
32158   __pyx_t_5numpy_float64_t __pyx_v_E0[3];
32159   __pyx_t_5numpy_float64_t __pyx_v_E1[3];
32160   __pyx_t_5numpy_float64_t __pyx_v_tri_norm[3];
32161   __pyx_t_5numpy_float64_t __pyx_v_plane_norm[3];
32162   __pyx_t_5numpy_float64_t __pyx_v_dp;
32163   int __pyx_v_i;
32164   int __pyx_v_j;
32165   int __pyx_v_k;
32166   int __pyx_v_count;
32167   int __pyx_v_ntri;
32168   int __pyx_v_nlines;
32169   struct __pyx_t_2yt_9utilities_3lib_14geometry_utils_PointSet *__pyx_v_first;
32170   struct __pyx_t_2yt_9utilities_3lib_14geometry_utils_PointSet *__pyx_v_last;
32171   struct __pyx_t_2yt_9utilities_3lib_14geometry_utils_PointSet *__pyx_v_points;
32172   PyArrayObject *__pyx_v_line_segments = 0;
32173   __Pyx_LocalBuf_ND __pyx_pybuffernd_line_segments;
32174   __Pyx_Buffer __pyx_pybuffer_line_segments;
32175   __Pyx_LocalBuf_ND __pyx_pybuffernd_triangles;
32176   __Pyx_Buffer __pyx_pybuffer_triangles;
32177   PyObject *__pyx_r = NULL;
32178   __Pyx_RefNannyDeclarations
32179   int __pyx_t_1;
32180   int __pyx_t_2;
32181   int __pyx_t_3;
32182   int __pyx_t_4;
32183   Py_ssize_t __pyx_t_5;
32184   Py_ssize_t __pyx_t_6;
32185   Py_ssize_t __pyx_t_7;
32186   int __pyx_t_8;
32187   Py_ssize_t __pyx_t_9;
32188   Py_ssize_t __pyx_t_10;
32189   Py_ssize_t __pyx_t_11;
32190   Py_ssize_t __pyx_t_12;
32191   Py_ssize_t __pyx_t_13;
32192   Py_ssize_t __pyx_t_14;
32193   int __pyx_t_15;
32194   Py_ssize_t __pyx_t_16;
32195   Py_ssize_t __pyx_t_17;
32196   Py_ssize_t __pyx_t_18;
32197   PyObject *__pyx_t_19 = NULL;
32198   Py_ssize_t __pyx_t_20;
32199   Py_ssize_t __pyx_t_21;
32200   Py_ssize_t __pyx_t_22;
32201   Py_ssize_t __pyx_t_23;
32202   Py_ssize_t __pyx_t_24;
32203   Py_ssize_t __pyx_t_25;
32204   Py_ssize_t __pyx_t_26;
32205   Py_ssize_t __pyx_t_27;
32206   Py_ssize_t __pyx_t_28;
32207   Py_ssize_t __pyx_t_29;
32208   Py_ssize_t __pyx_t_30;
32209   Py_ssize_t __pyx_t_31;
32210   Py_ssize_t __pyx_t_32;
32211   Py_ssize_t __pyx_t_33;
32212   Py_ssize_t __pyx_t_34;
32213   Py_ssize_t __pyx_t_35;
32214   Py_ssize_t __pyx_t_36;
32215   Py_ssize_t __pyx_t_37;
32216   PyObject *__pyx_t_38 = NULL;
32217   PyObject *__pyx_t_39 = NULL;
32218   PyObject *__pyx_t_40 = NULL;
32219   PyArrayObject *__pyx_t_41 = NULL;
32220   PyObject *__pyx_t_42 = NULL;
32221   PyObject *__pyx_t_43 = NULL;
32222   PyObject *__pyx_t_44 = NULL;
32223   Py_ssize_t __pyx_t_45;
32224   Py_ssize_t __pyx_t_46;
32225   Py_ssize_t __pyx_t_47;
32226   Py_ssize_t __pyx_t_48;
32227   Py_ssize_t __pyx_t_49;
32228   Py_ssize_t __pyx_t_50;
32229   struct __pyx_t_2yt_9utilities_3lib_14geometry_utils_PointSet *__pyx_t_51;
32230   __Pyx_RefNannySetupContext("triangle_plane_intersect", 0);
32231   __pyx_pybuffer_line_segments.pybuffer.buf = NULL;
32232   __pyx_pybuffer_line_segments.refcount = 0;
32233   __pyx_pybuffernd_line_segments.data = NULL;
32234   __pyx_pybuffernd_line_segments.rcbuffer = &__pyx_pybuffer_line_segments;
32235   __pyx_pybuffer_triangles.pybuffer.buf = NULL;
32236   __pyx_pybuffer_triangles.refcount = 0;
32237   __pyx_pybuffernd_triangles.data = NULL;
32238   __pyx_pybuffernd_triangles.rcbuffer = &__pyx_pybuffer_triangles;
32239   {
32240     __Pyx_BufFmt_StackElem __pyx_stack[1];
32241     if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_triangles.rcbuffer->pybuffer, (PyObject*)__pyx_v_triangles, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(1, 1268, __pyx_L1_error)
32242   }
32243   __pyx_pybuffernd_triangles.diminfo[0].strides = __pyx_pybuffernd_triangles.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_triangles.diminfo[0].shape = __pyx_pybuffernd_triangles.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_triangles.diminfo[1].strides = __pyx_pybuffernd_triangles.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_triangles.diminfo[1].shape = __pyx_pybuffernd_triangles.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_triangles.diminfo[2].strides = __pyx_pybuffernd_triangles.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_triangles.diminfo[2].shape = __pyx_pybuffernd_triangles.rcbuffer->pybuffer.shape[2];
32244 
32245   /* "yt/utilities/lib/geometry_utils.pyx":1279
32246  *     cdef np.float64_t dp
32247  *     cdef int i, j, k, count, ntri, nlines
32248  *     nlines = 0             # <<<<<<<<<<<<<<
32249  *     ntri = triangles.shape[0]
32250  *     cdef PointSet *first
32251  */
32252   __pyx_v_nlines = 0;
32253 
32254   /* "yt/utilities/lib/geometry_utils.pyx":1280
32255  *     cdef int i, j, k, count, ntri, nlines
32256  *     nlines = 0
32257  *     ntri = triangles.shape[0]             # <<<<<<<<<<<<<<
32258  *     cdef PointSet *first
32259  *     cdef PointSet *last
32260  */
32261   __pyx_v_ntri = (__pyx_v_triangles->dimensions[0]);
32262 
32263   /* "yt/utilities/lib/geometry_utils.pyx":1284
32264  *     cdef PointSet *last
32265  *     cdef PointSet *points
32266  *     first = last = points = NULL             # <<<<<<<<<<<<<<
32267  *     for i in range(ntri):
32268  *         count = 0
32269  */
32270   __pyx_v_first = NULL;
32271   __pyx_v_last = NULL;
32272   __pyx_v_points = NULL;
32273 
32274   /* "yt/utilities/lib/geometry_utils.pyx":1285
32275  *     cdef PointSet *points
32276  *     first = last = points = NULL
32277  *     for i in range(ntri):             # <<<<<<<<<<<<<<
32278  *         count = 0
32279  *
32280  */
32281   __pyx_t_1 = __pyx_v_ntri;
32282   __pyx_t_2 = __pyx_t_1;
32283   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
32284     __pyx_v_i = __pyx_t_3;
32285 
32286     /* "yt/utilities/lib/geometry_utils.pyx":1286
32287  *     first = last = points = NULL
32288  *     for i in range(ntri):
32289  *         count = 0             # <<<<<<<<<<<<<<
32290  *
32291  *         # Here p0 holds the triangle's zeroth node coordinates,
32292  */
32293     __pyx_v_count = 0;
32294 
32295     /* "yt/utilities/lib/geometry_utils.pyx":1291
32296  *         # p1 holds the first node's coordinates, and
32297  *         # p2 holds the second node's coordinates
32298  *         for j in range(3):             # <<<<<<<<<<<<<<
32299  *             p0[j] = triangles[i, 0, j]
32300  *             p1[j] = triangles[i, 1, j]
32301  */
32302     for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) {
32303       __pyx_v_j = __pyx_t_4;
32304 
32305       /* "yt/utilities/lib/geometry_utils.pyx":1292
32306  *         # p2 holds the second node's coordinates
32307  *         for j in range(3):
32308  *             p0[j] = triangles[i, 0, j]             # <<<<<<<<<<<<<<
32309  *             p1[j] = triangles[i, 1, j]
32310  *             p2[j] = triangles[i, 2, j]
32311  */
32312       __pyx_t_5 = __pyx_v_i;
32313       __pyx_t_6 = 0;
32314       __pyx_t_7 = __pyx_v_j;
32315       __pyx_t_8 = -1;
32316       if (__pyx_t_5 < 0) {
32317         __pyx_t_5 += __pyx_pybuffernd_triangles.diminfo[0].shape;
32318         if (unlikely(__pyx_t_5 < 0)) __pyx_t_8 = 0;
32319       } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_triangles.diminfo[0].shape)) __pyx_t_8 = 0;
32320       if (__pyx_t_6 < 0) {
32321         __pyx_t_6 += __pyx_pybuffernd_triangles.diminfo[1].shape;
32322         if (unlikely(__pyx_t_6 < 0)) __pyx_t_8 = 1;
32323       } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_triangles.diminfo[1].shape)) __pyx_t_8 = 1;
32324       if (__pyx_t_7 < 0) {
32325         __pyx_t_7 += __pyx_pybuffernd_triangles.diminfo[2].shape;
32326         if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 2;
32327       } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_triangles.diminfo[2].shape)) __pyx_t_8 = 2;
32328       if (unlikely(__pyx_t_8 != -1)) {
32329         __Pyx_RaiseBufferIndexError(__pyx_t_8);
32330         __PYX_ERR(1, 1292, __pyx_L1_error)
32331       }
32332       (__pyx_v_p0[__pyx_v_j]) = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_triangles.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_triangles.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_triangles.diminfo[1].strides, __pyx_t_7, __pyx_pybuffernd_triangles.diminfo[2].strides));
32333 
32334       /* "yt/utilities/lib/geometry_utils.pyx":1293
32335  *         for j in range(3):
32336  *             p0[j] = triangles[i, 0, j]
32337  *             p1[j] = triangles[i, 1, j]             # <<<<<<<<<<<<<<
32338  *             p2[j] = triangles[i, 2, j]
32339  *             plane_norm[j] = 0.0
32340  */
32341       __pyx_t_9 = __pyx_v_i;
32342       __pyx_t_10 = 1;
32343       __pyx_t_11 = __pyx_v_j;
32344       __pyx_t_8 = -1;
32345       if (__pyx_t_9 < 0) {
32346         __pyx_t_9 += __pyx_pybuffernd_triangles.diminfo[0].shape;
32347         if (unlikely(__pyx_t_9 < 0)) __pyx_t_8 = 0;
32348       } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_triangles.diminfo[0].shape)) __pyx_t_8 = 0;
32349       if (__pyx_t_10 < 0) {
32350         __pyx_t_10 += __pyx_pybuffernd_triangles.diminfo[1].shape;
32351         if (unlikely(__pyx_t_10 < 0)) __pyx_t_8 = 1;
32352       } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_triangles.diminfo[1].shape)) __pyx_t_8 = 1;
32353       if (__pyx_t_11 < 0) {
32354         __pyx_t_11 += __pyx_pybuffernd_triangles.diminfo[2].shape;
32355         if (unlikely(__pyx_t_11 < 0)) __pyx_t_8 = 2;
32356       } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_triangles.diminfo[2].shape)) __pyx_t_8 = 2;
32357       if (unlikely(__pyx_t_8 != -1)) {
32358         __Pyx_RaiseBufferIndexError(__pyx_t_8);
32359         __PYX_ERR(1, 1293, __pyx_L1_error)
32360       }
32361       (__pyx_v_p1[__pyx_v_j]) = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_triangles.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_triangles.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_triangles.diminfo[1].strides, __pyx_t_11, __pyx_pybuffernd_triangles.diminfo[2].strides));
32362 
32363       /* "yt/utilities/lib/geometry_utils.pyx":1294
32364  *             p0[j] = triangles[i, 0, j]
32365  *             p1[j] = triangles[i, 1, j]
32366  *             p2[j] = triangles[i, 2, j]             # <<<<<<<<<<<<<<
32367  *             plane_norm[j] = 0.0
32368  *         plane_norm[ax] = 1.0
32369  */
32370       __pyx_t_12 = __pyx_v_i;
32371       __pyx_t_13 = 2;
32372       __pyx_t_14 = __pyx_v_j;
32373       __pyx_t_8 = -1;
32374       if (__pyx_t_12 < 0) {
32375         __pyx_t_12 += __pyx_pybuffernd_triangles.diminfo[0].shape;
32376         if (unlikely(__pyx_t_12 < 0)) __pyx_t_8 = 0;
32377       } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_triangles.diminfo[0].shape)) __pyx_t_8 = 0;
32378       if (__pyx_t_13 < 0) {
32379         __pyx_t_13 += __pyx_pybuffernd_triangles.diminfo[1].shape;
32380         if (unlikely(__pyx_t_13 < 0)) __pyx_t_8 = 1;
32381       } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_triangles.diminfo[1].shape)) __pyx_t_8 = 1;
32382       if (__pyx_t_14 < 0) {
32383         __pyx_t_14 += __pyx_pybuffernd_triangles.diminfo[2].shape;
32384         if (unlikely(__pyx_t_14 < 0)) __pyx_t_8 = 2;
32385       } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_triangles.diminfo[2].shape)) __pyx_t_8 = 2;
32386       if (unlikely(__pyx_t_8 != -1)) {
32387         __Pyx_RaiseBufferIndexError(__pyx_t_8);
32388         __PYX_ERR(1, 1294, __pyx_L1_error)
32389       }
32390       (__pyx_v_p2[__pyx_v_j]) = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_triangles.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_triangles.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_triangles.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_triangles.diminfo[2].strides));
32391 
32392       /* "yt/utilities/lib/geometry_utils.pyx":1295
32393  *             p1[j] = triangles[i, 1, j]
32394  *             p2[j] = triangles[i, 2, j]
32395  *             plane_norm[j] = 0.0             # <<<<<<<<<<<<<<
32396  *         plane_norm[ax] = 1.0
32397  *         subtract(p1, p0, E0)
32398  */
32399       (__pyx_v_plane_norm[__pyx_v_j]) = 0.0;
32400     }
32401 
32402     /* "yt/utilities/lib/geometry_utils.pyx":1296
32403  *             p2[j] = triangles[i, 2, j]
32404  *             plane_norm[j] = 0.0
32405  *         plane_norm[ax] = 1.0             # <<<<<<<<<<<<<<
32406  *         subtract(p1, p0, E0)
32407  *         subtract(p2, p0, E1)
32408  */
32409     (__pyx_v_plane_norm[__pyx_v_ax]) = 1.0;
32410 
32411     /* "yt/utilities/lib/geometry_utils.pyx":1297
32412  *             plane_norm[j] = 0.0
32413  *         plane_norm[ax] = 1.0
32414  *         subtract(p1, p0, E0)             # <<<<<<<<<<<<<<
32415  *         subtract(p2, p0, E1)
32416  *         cross(E0, E1, tri_norm)
32417  */
32418     __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_subtract(__pyx_v_p1, __pyx_v_p0, __pyx_v_E0);
32419 
32420     /* "yt/utilities/lib/geometry_utils.pyx":1298
32421  *         plane_norm[ax] = 1.0
32422  *         subtract(p1, p0, E0)
32423  *         subtract(p2, p0, E1)             # <<<<<<<<<<<<<<
32424  *         cross(E0, E1, tri_norm)
32425  *         dp = dot(tri_norm, plane_norm)
32426  */
32427     __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_subtract(__pyx_v_p2, __pyx_v_p0, __pyx_v_E1);
32428 
32429     /* "yt/utilities/lib/geometry_utils.pyx":1299
32430  *         subtract(p1, p0, E0)
32431  *         subtract(p2, p0, E1)
32432  *         cross(E0, E1, tri_norm)             # <<<<<<<<<<<<<<
32433  *         dp = dot(tri_norm, plane_norm)
32434  *         dp /= L2_norm(tri_norm)
32435  */
32436     __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_cross(__pyx_v_E0, __pyx_v_E1, __pyx_v_tri_norm);
32437 
32438     /* "yt/utilities/lib/geometry_utils.pyx":1300
32439  *         subtract(p2, p0, E1)
32440  *         cross(E0, E1, tri_norm)
32441  *         dp = dot(tri_norm, plane_norm)             # <<<<<<<<<<<<<<
32442  *         dp /= L2_norm(tri_norm)
32443  *         # Skip if triangle is close to being parallel to plane.
32444  */
32445     __pyx_v_dp = __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_tri_norm, __pyx_v_plane_norm);
32446 
32447     /* "yt/utilities/lib/geometry_utils.pyx":1301
32448  *         cross(E0, E1, tri_norm)
32449  *         dp = dot(tri_norm, plane_norm)
32450  *         dp /= L2_norm(tri_norm)             # <<<<<<<<<<<<<<
32451  *         # Skip if triangle is close to being parallel to plane.
32452  *         if (fabs(dp) > 0.995):
32453  */
32454     __pyx_v_dp = (__pyx_v_dp / __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_L2_norm(__pyx_v_tri_norm));
32455 
32456     /* "yt/utilities/lib/geometry_utils.pyx":1303
32457  *         dp /= L2_norm(tri_norm)
32458  *         # Skip if triangle is close to being parallel to plane.
32459  *         if (fabs(dp) > 0.995):             # <<<<<<<<<<<<<<
32460  *             continue
32461  *
32462  */
32463     __pyx_t_15 = ((fabs(__pyx_v_dp) > 0.995) != 0);
32464     if (__pyx_t_15) {
32465 
32466       /* "yt/utilities/lib/geometry_utils.pyx":1304
32467  *         # Skip if triangle is close to being parallel to plane.
32468  *         if (fabs(dp) > 0.995):
32469  *             continue             # <<<<<<<<<<<<<<
32470  *
32471  *         # Now for each line segment (01, 12, 20) we check to see how many cross
32472  */
32473       goto __pyx_L3_continue;
32474 
32475       /* "yt/utilities/lib/geometry_utils.pyx":1303
32476  *         dp /= L2_norm(tri_norm)
32477  *         # Skip if triangle is close to being parallel to plane.
32478  *         if (fabs(dp) > 0.995):             # <<<<<<<<<<<<<<
32479  *             continue
32480  *
32481  */
32482     }
32483 
32484     /* "yt/utilities/lib/geometry_utils.pyx":1311
32485  *         # node's coordinate corresponding to the slice axis is greater than the
32486  *         # coordinate of the slice. p2[0] -> node 0; p2[1] -> node 1; p2[2] -> node2
32487  *         for j in range(3):             # <<<<<<<<<<<<<<
32488  *             # Add 0 so that any -0s become +0s. Necessary for consistent determination
32489  *             # of plane intersection
32490  */
32491     for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) {
32492       __pyx_v_j = __pyx_t_4;
32493 
32494       /* "yt/utilities/lib/geometry_utils.pyx":1314
32495  *             # Add 0 so that any -0s become +0s. Necessary for consistent determination
32496  *             # of plane intersection
32497  *             p2[j] = copysign(1.0, triangles[i, j, ax] - coord + 0)             # <<<<<<<<<<<<<<
32498  *         if p2[0] * p2[1] < 0: count += 1
32499  *         if p2[1] * p2[2] < 0: count += 1
32500  */
32501       __pyx_t_16 = __pyx_v_i;
32502       __pyx_t_17 = __pyx_v_j;
32503       __pyx_t_18 = __pyx_v_ax;
32504       __pyx_t_8 = -1;
32505       if (__pyx_t_16 < 0) {
32506         __pyx_t_16 += __pyx_pybuffernd_triangles.diminfo[0].shape;
32507         if (unlikely(__pyx_t_16 < 0)) __pyx_t_8 = 0;
32508       } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_triangles.diminfo[0].shape)) __pyx_t_8 = 0;
32509       if (__pyx_t_17 < 0) {
32510         __pyx_t_17 += __pyx_pybuffernd_triangles.diminfo[1].shape;
32511         if (unlikely(__pyx_t_17 < 0)) __pyx_t_8 = 1;
32512       } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_triangles.diminfo[1].shape)) __pyx_t_8 = 1;
32513       if (__pyx_t_18 < 0) {
32514         __pyx_t_18 += __pyx_pybuffernd_triangles.diminfo[2].shape;
32515         if (unlikely(__pyx_t_18 < 0)) __pyx_t_8 = 2;
32516       } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_triangles.diminfo[2].shape)) __pyx_t_8 = 2;
32517       if (unlikely(__pyx_t_8 != -1)) {
32518         __Pyx_RaiseBufferIndexError(__pyx_t_8);
32519         __PYX_ERR(1, 1314, __pyx_L1_error)
32520       }
32521       (__pyx_v_p2[__pyx_v_j]) = copysign(1.0, (((*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_triangles.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_triangles.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_triangles.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_triangles.diminfo[2].strides)) - __pyx_v_coord) + 0.0));
32522     }
32523 
32524     /* "yt/utilities/lib/geometry_utils.pyx":1315
32525  *             # of plane intersection
32526  *             p2[j] = copysign(1.0, triangles[i, j, ax] - coord + 0)
32527  *         if p2[0] * p2[1] < 0: count += 1             # <<<<<<<<<<<<<<
32528  *         if p2[1] * p2[2] < 0: count += 1
32529  *         if p2[2] * p2[0] < 0: count += 1
32530  */
32531     __pyx_t_15 = ((((__pyx_v_p2[0]) * (__pyx_v_p2[1])) < 0.0) != 0);
32532     if (__pyx_t_15) {
32533       __pyx_v_count = (__pyx_v_count + 1);
32534     }
32535 
32536     /* "yt/utilities/lib/geometry_utils.pyx":1316
32537  *             p2[j] = copysign(1.0, triangles[i, j, ax] - coord + 0)
32538  *         if p2[0] * p2[1] < 0: count += 1
32539  *         if p2[1] * p2[2] < 0: count += 1             # <<<<<<<<<<<<<<
32540  *         if p2[2] * p2[0] < 0: count += 1
32541  *         if count == 2:
32542  */
32543     __pyx_t_15 = ((((__pyx_v_p2[1]) * (__pyx_v_p2[2])) < 0.0) != 0);
32544     if (__pyx_t_15) {
32545       __pyx_v_count = (__pyx_v_count + 1);
32546     }
32547 
32548     /* "yt/utilities/lib/geometry_utils.pyx":1317
32549  *         if p2[0] * p2[1] < 0: count += 1
32550  *         if p2[1] * p2[2] < 0: count += 1
32551  *         if p2[2] * p2[0] < 0: count += 1             # <<<<<<<<<<<<<<
32552  *         if count == 2:
32553  *             nlines += 1
32554  */
32555     __pyx_t_15 = ((((__pyx_v_p2[2]) * (__pyx_v_p2[0])) < 0.0) != 0);
32556     if (__pyx_t_15) {
32557       __pyx_v_count = (__pyx_v_count + 1);
32558     }
32559 
32560     /* "yt/utilities/lib/geometry_utils.pyx":1318
32561  *         if p2[1] * p2[2] < 0: count += 1
32562  *         if p2[2] * p2[0] < 0: count += 1
32563  *         if count == 2:             # <<<<<<<<<<<<<<
32564  *             nlines += 1
32565  *         elif count == 3:
32566  */
32567     switch (__pyx_v_count) {
32568       case 2:
32569 
32570       /* "yt/utilities/lib/geometry_utils.pyx":1319
32571  *         if p2[2] * p2[0] < 0: count += 1
32572  *         if count == 2:
32573  *             nlines += 1             # <<<<<<<<<<<<<<
32574  *         elif count == 3:
32575  *             raise RuntimeError("It should be geometrically impossible for a plane to"
32576  */
32577       __pyx_v_nlines = (__pyx_v_nlines + 1);
32578 
32579       /* "yt/utilities/lib/geometry_utils.pyx":1318
32580  *         if p2[1] * p2[2] < 0: count += 1
32581  *         if p2[2] * p2[0] < 0: count += 1
32582  *         if count == 2:             # <<<<<<<<<<<<<<
32583  *             nlines += 1
32584  *         elif count == 3:
32585  */
32586       break;
32587       case 3:
32588 
32589       /* "yt/utilities/lib/geometry_utils.pyx":1321
32590  *             nlines += 1
32591  *         elif count == 3:
32592  *             raise RuntimeError("It should be geometrically impossible for a plane to"             # <<<<<<<<<<<<<<
32593  *                                "to intersect all three legs of a triangle. Please contact"
32594  *                                "yt developers with your mesh")
32595  */
32596       __pyx_t_19 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 1321, __pyx_L1_error)
32597       __Pyx_GOTREF(__pyx_t_19);
32598       __Pyx_Raise(__pyx_t_19, 0, 0, 0);
32599       __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
32600       __PYX_ERR(1, 1321, __pyx_L1_error)
32601 
32602       /* "yt/utilities/lib/geometry_utils.pyx":1320
32603  *         if count == 2:
32604  *             nlines += 1
32605  *         elif count == 3:             # <<<<<<<<<<<<<<
32606  *             raise RuntimeError("It should be geometrically impossible for a plane to"
32607  *                                "to intersect all three legs of a triangle. Please contact"
32608  */
32609       break;
32610       default:
32611 
32612       /* "yt/utilities/lib/geometry_utils.pyx":1325
32613  *                                "yt developers with your mesh")
32614  *         else:
32615  *             continue             # <<<<<<<<<<<<<<
32616  *         points = <PointSet *> malloc(sizeof(PointSet))
32617  *         points.count = 0
32618  */
32619       goto __pyx_L3_continue;
32620       break;
32621     }
32622 
32623     /* "yt/utilities/lib/geometry_utils.pyx":1326
32624  *         else:
32625  *             continue
32626  *         points = <PointSet *> malloc(sizeof(PointSet))             # <<<<<<<<<<<<<<
32627  *         points.count = 0
32628  *         points.next = NULL
32629  */
32630     __pyx_v_points = ((struct __pyx_t_2yt_9utilities_3lib_14geometry_utils_PointSet *)malloc((sizeof(struct __pyx_t_2yt_9utilities_3lib_14geometry_utils_PointSet))));
32631 
32632     /* "yt/utilities/lib/geometry_utils.pyx":1327
32633  *             continue
32634  *         points = <PointSet *> malloc(sizeof(PointSet))
32635  *         points.count = 0             # <<<<<<<<<<<<<<
32636  *         points.next = NULL
32637  *
32638  */
32639     __pyx_v_points->count = 0;
32640 
32641     /* "yt/utilities/lib/geometry_utils.pyx":1328
32642  *         points = <PointSet *> malloc(sizeof(PointSet))
32643  *         points.count = 0
32644  *         points.next = NULL             # <<<<<<<<<<<<<<
32645  *
32646  *         # Here p0 and p1 again hold node coordinates
32647  */
32648     __pyx_v_points->next = NULL;
32649 
32650     /* "yt/utilities/lib/geometry_utils.pyx":1331
32651  *
32652  *         # Here p0 and p1 again hold node coordinates
32653  *         if p2[0] * p2[1] < 0:             # <<<<<<<<<<<<<<
32654  *             # intersection of 01 triangle segment with plane
32655  *             for j in range(3):
32656  */
32657     __pyx_t_15 = ((((__pyx_v_p2[0]) * (__pyx_v_p2[1])) < 0.0) != 0);
32658     if (__pyx_t_15) {
32659 
32660       /* "yt/utilities/lib/geometry_utils.pyx":1333
32661  *         if p2[0] * p2[1] < 0:
32662  *             # intersection of 01 triangle segment with plane
32663  *             for j in range(3):             # <<<<<<<<<<<<<<
32664  *                 p0[j] = triangles[i, 0, j]
32665  *                 p1[j] = triangles[i, 1, j]
32666  */
32667       for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) {
32668         __pyx_v_j = __pyx_t_4;
32669 
32670         /* "yt/utilities/lib/geometry_utils.pyx":1334
32671  *             # intersection of 01 triangle segment with plane
32672  *             for j in range(3):
32673  *                 p0[j] = triangles[i, 0, j]             # <<<<<<<<<<<<<<
32674  *                 p1[j] = triangles[i, 1, j]
32675  *             get_intersection(p0, p1, ax, coord, points)
32676  */
32677         __pyx_t_20 = __pyx_v_i;
32678         __pyx_t_21 = 0;
32679         __pyx_t_22 = __pyx_v_j;
32680         __pyx_t_8 = -1;
32681         if (__pyx_t_20 < 0) {
32682           __pyx_t_20 += __pyx_pybuffernd_triangles.diminfo[0].shape;
32683           if (unlikely(__pyx_t_20 < 0)) __pyx_t_8 = 0;
32684         } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_triangles.diminfo[0].shape)) __pyx_t_8 = 0;
32685         if (__pyx_t_21 < 0) {
32686           __pyx_t_21 += __pyx_pybuffernd_triangles.diminfo[1].shape;
32687           if (unlikely(__pyx_t_21 < 0)) __pyx_t_8 = 1;
32688         } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_triangles.diminfo[1].shape)) __pyx_t_8 = 1;
32689         if (__pyx_t_22 < 0) {
32690           __pyx_t_22 += __pyx_pybuffernd_triangles.diminfo[2].shape;
32691           if (unlikely(__pyx_t_22 < 0)) __pyx_t_8 = 2;
32692         } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_triangles.diminfo[2].shape)) __pyx_t_8 = 2;
32693         if (unlikely(__pyx_t_8 != -1)) {
32694           __Pyx_RaiseBufferIndexError(__pyx_t_8);
32695           __PYX_ERR(1, 1334, __pyx_L1_error)
32696         }
32697         (__pyx_v_p0[__pyx_v_j]) = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_triangles.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_triangles.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_triangles.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_triangles.diminfo[2].strides));
32698 
32699         /* "yt/utilities/lib/geometry_utils.pyx":1335
32700  *             for j in range(3):
32701  *                 p0[j] = triangles[i, 0, j]
32702  *                 p1[j] = triangles[i, 1, j]             # <<<<<<<<<<<<<<
32703  *             get_intersection(p0, p1, ax, coord, points)
32704  *         if p2[1] * p2[2] < 0:
32705  */
32706         __pyx_t_23 = __pyx_v_i;
32707         __pyx_t_24 = 1;
32708         __pyx_t_25 = __pyx_v_j;
32709         __pyx_t_8 = -1;
32710         if (__pyx_t_23 < 0) {
32711           __pyx_t_23 += __pyx_pybuffernd_triangles.diminfo[0].shape;
32712           if (unlikely(__pyx_t_23 < 0)) __pyx_t_8 = 0;
32713         } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_triangles.diminfo[0].shape)) __pyx_t_8 = 0;
32714         if (__pyx_t_24 < 0) {
32715           __pyx_t_24 += __pyx_pybuffernd_triangles.diminfo[1].shape;
32716           if (unlikely(__pyx_t_24 < 0)) __pyx_t_8 = 1;
32717         } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_triangles.diminfo[1].shape)) __pyx_t_8 = 1;
32718         if (__pyx_t_25 < 0) {
32719           __pyx_t_25 += __pyx_pybuffernd_triangles.diminfo[2].shape;
32720           if (unlikely(__pyx_t_25 < 0)) __pyx_t_8 = 2;
32721         } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_triangles.diminfo[2].shape)) __pyx_t_8 = 2;
32722         if (unlikely(__pyx_t_8 != -1)) {
32723           __Pyx_RaiseBufferIndexError(__pyx_t_8);
32724           __PYX_ERR(1, 1335, __pyx_L1_error)
32725         }
32726         (__pyx_v_p1[__pyx_v_j]) = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_triangles.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_triangles.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_triangles.diminfo[1].strides, __pyx_t_25, __pyx_pybuffernd_triangles.diminfo[2].strides));
32727       }
32728 
32729       /* "yt/utilities/lib/geometry_utils.pyx":1336
32730  *                 p0[j] = triangles[i, 0, j]
32731  *                 p1[j] = triangles[i, 1, j]
32732  *             get_intersection(p0, p1, ax, coord, points)             # <<<<<<<<<<<<<<
32733  *         if p2[1] * p2[2] < 0:
32734  *             # intersection of 12 triangle segment with plane
32735  */
32736       __pyx_f_2yt_9utilities_3lib_14geometry_utils_get_intersection(__pyx_v_p0, __pyx_v_p1, __pyx_v_ax, __pyx_v_coord, __pyx_v_points);
32737 
32738       /* "yt/utilities/lib/geometry_utils.pyx":1331
32739  *
32740  *         # Here p0 and p1 again hold node coordinates
32741  *         if p2[0] * p2[1] < 0:             # <<<<<<<<<<<<<<
32742  *             # intersection of 01 triangle segment with plane
32743  *             for j in range(3):
32744  */
32745     }
32746 
32747     /* "yt/utilities/lib/geometry_utils.pyx":1337
32748  *                 p1[j] = triangles[i, 1, j]
32749  *             get_intersection(p0, p1, ax, coord, points)
32750  *         if p2[1] * p2[2] < 0:             # <<<<<<<<<<<<<<
32751  *             # intersection of 12 triangle segment with plane
32752  *             for j in range(3):
32753  */
32754     __pyx_t_15 = ((((__pyx_v_p2[1]) * (__pyx_v_p2[2])) < 0.0) != 0);
32755     if (__pyx_t_15) {
32756 
32757       /* "yt/utilities/lib/geometry_utils.pyx":1339
32758  *         if p2[1] * p2[2] < 0:
32759  *             # intersection of 12 triangle segment with plane
32760  *             for j in range(3):             # <<<<<<<<<<<<<<
32761  *                 p0[j] = triangles[i, 1, j]
32762  *                 p1[j] = triangles[i, 2, j]
32763  */
32764       for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) {
32765         __pyx_v_j = __pyx_t_4;
32766 
32767         /* "yt/utilities/lib/geometry_utils.pyx":1340
32768  *             # intersection of 12 triangle segment with plane
32769  *             for j in range(3):
32770  *                 p0[j] = triangles[i, 1, j]             # <<<<<<<<<<<<<<
32771  *                 p1[j] = triangles[i, 2, j]
32772  *             get_intersection(p0, p1, ax, coord, points)
32773  */
32774         __pyx_t_26 = __pyx_v_i;
32775         __pyx_t_27 = 1;
32776         __pyx_t_28 = __pyx_v_j;
32777         __pyx_t_8 = -1;
32778         if (__pyx_t_26 < 0) {
32779           __pyx_t_26 += __pyx_pybuffernd_triangles.diminfo[0].shape;
32780           if (unlikely(__pyx_t_26 < 0)) __pyx_t_8 = 0;
32781         } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_triangles.diminfo[0].shape)) __pyx_t_8 = 0;
32782         if (__pyx_t_27 < 0) {
32783           __pyx_t_27 += __pyx_pybuffernd_triangles.diminfo[1].shape;
32784           if (unlikely(__pyx_t_27 < 0)) __pyx_t_8 = 1;
32785         } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_triangles.diminfo[1].shape)) __pyx_t_8 = 1;
32786         if (__pyx_t_28 < 0) {
32787           __pyx_t_28 += __pyx_pybuffernd_triangles.diminfo[2].shape;
32788           if (unlikely(__pyx_t_28 < 0)) __pyx_t_8 = 2;
32789         } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_triangles.diminfo[2].shape)) __pyx_t_8 = 2;
32790         if (unlikely(__pyx_t_8 != -1)) {
32791           __Pyx_RaiseBufferIndexError(__pyx_t_8);
32792           __PYX_ERR(1, 1340, __pyx_L1_error)
32793         }
32794         (__pyx_v_p0[__pyx_v_j]) = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_triangles.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_triangles.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_triangles.diminfo[1].strides, __pyx_t_28, __pyx_pybuffernd_triangles.diminfo[2].strides));
32795 
32796         /* "yt/utilities/lib/geometry_utils.pyx":1341
32797  *             for j in range(3):
32798  *                 p0[j] = triangles[i, 1, j]
32799  *                 p1[j] = triangles[i, 2, j]             # <<<<<<<<<<<<<<
32800  *             get_intersection(p0, p1, ax, coord, points)
32801  *         if p2[2] * p2[0] < 0:
32802  */
32803         __pyx_t_29 = __pyx_v_i;
32804         __pyx_t_30 = 2;
32805         __pyx_t_31 = __pyx_v_j;
32806         __pyx_t_8 = -1;
32807         if (__pyx_t_29 < 0) {
32808           __pyx_t_29 += __pyx_pybuffernd_triangles.diminfo[0].shape;
32809           if (unlikely(__pyx_t_29 < 0)) __pyx_t_8 = 0;
32810         } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_triangles.diminfo[0].shape)) __pyx_t_8 = 0;
32811         if (__pyx_t_30 < 0) {
32812           __pyx_t_30 += __pyx_pybuffernd_triangles.diminfo[1].shape;
32813           if (unlikely(__pyx_t_30 < 0)) __pyx_t_8 = 1;
32814         } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_triangles.diminfo[1].shape)) __pyx_t_8 = 1;
32815         if (__pyx_t_31 < 0) {
32816           __pyx_t_31 += __pyx_pybuffernd_triangles.diminfo[2].shape;
32817           if (unlikely(__pyx_t_31 < 0)) __pyx_t_8 = 2;
32818         } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_triangles.diminfo[2].shape)) __pyx_t_8 = 2;
32819         if (unlikely(__pyx_t_8 != -1)) {
32820           __Pyx_RaiseBufferIndexError(__pyx_t_8);
32821           __PYX_ERR(1, 1341, __pyx_L1_error)
32822         }
32823         (__pyx_v_p1[__pyx_v_j]) = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_triangles.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_triangles.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_triangles.diminfo[1].strides, __pyx_t_31, __pyx_pybuffernd_triangles.diminfo[2].strides));
32824       }
32825 
32826       /* "yt/utilities/lib/geometry_utils.pyx":1342
32827  *                 p0[j] = triangles[i, 1, j]
32828  *                 p1[j] = triangles[i, 2, j]
32829  *             get_intersection(p0, p1, ax, coord, points)             # <<<<<<<<<<<<<<
32830  *         if p2[2] * p2[0] < 0:
32831  *             # intersection of 20 triangle segment with plane
32832  */
32833       __pyx_f_2yt_9utilities_3lib_14geometry_utils_get_intersection(__pyx_v_p0, __pyx_v_p1, __pyx_v_ax, __pyx_v_coord, __pyx_v_points);
32834 
32835       /* "yt/utilities/lib/geometry_utils.pyx":1337
32836  *                 p1[j] = triangles[i, 1, j]
32837  *             get_intersection(p0, p1, ax, coord, points)
32838  *         if p2[1] * p2[2] < 0:             # <<<<<<<<<<<<<<
32839  *             # intersection of 12 triangle segment with plane
32840  *             for j in range(3):
32841  */
32842     }
32843 
32844     /* "yt/utilities/lib/geometry_utils.pyx":1343
32845  *                 p1[j] = triangles[i, 2, j]
32846  *             get_intersection(p0, p1, ax, coord, points)
32847  *         if p2[2] * p2[0] < 0:             # <<<<<<<<<<<<<<
32848  *             # intersection of 20 triangle segment with plane
32849  *             for j in range(3):
32850  */
32851     __pyx_t_15 = ((((__pyx_v_p2[2]) * (__pyx_v_p2[0])) < 0.0) != 0);
32852     if (__pyx_t_15) {
32853 
32854       /* "yt/utilities/lib/geometry_utils.pyx":1345
32855  *         if p2[2] * p2[0] < 0:
32856  *             # intersection of 20 triangle segment with plane
32857  *             for j in range(3):             # <<<<<<<<<<<<<<
32858  *                 p0[j] = triangles[i, 2, j]
32859  *                 p1[j] = triangles[i, 0, j]
32860  */
32861       for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) {
32862         __pyx_v_j = __pyx_t_4;
32863 
32864         /* "yt/utilities/lib/geometry_utils.pyx":1346
32865  *             # intersection of 20 triangle segment with plane
32866  *             for j in range(3):
32867  *                 p0[j] = triangles[i, 2, j]             # <<<<<<<<<<<<<<
32868  *                 p1[j] = triangles[i, 0, j]
32869  *             get_intersection(p0, p1, ax, coord, points)
32870  */
32871         __pyx_t_32 = __pyx_v_i;
32872         __pyx_t_33 = 2;
32873         __pyx_t_34 = __pyx_v_j;
32874         __pyx_t_8 = -1;
32875         if (__pyx_t_32 < 0) {
32876           __pyx_t_32 += __pyx_pybuffernd_triangles.diminfo[0].shape;
32877           if (unlikely(__pyx_t_32 < 0)) __pyx_t_8 = 0;
32878         } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_triangles.diminfo[0].shape)) __pyx_t_8 = 0;
32879         if (__pyx_t_33 < 0) {
32880           __pyx_t_33 += __pyx_pybuffernd_triangles.diminfo[1].shape;
32881           if (unlikely(__pyx_t_33 < 0)) __pyx_t_8 = 1;
32882         } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_triangles.diminfo[1].shape)) __pyx_t_8 = 1;
32883         if (__pyx_t_34 < 0) {
32884           __pyx_t_34 += __pyx_pybuffernd_triangles.diminfo[2].shape;
32885           if (unlikely(__pyx_t_34 < 0)) __pyx_t_8 = 2;
32886         } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_triangles.diminfo[2].shape)) __pyx_t_8 = 2;
32887         if (unlikely(__pyx_t_8 != -1)) {
32888           __Pyx_RaiseBufferIndexError(__pyx_t_8);
32889           __PYX_ERR(1, 1346, __pyx_L1_error)
32890         }
32891         (__pyx_v_p0[__pyx_v_j]) = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_triangles.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_triangles.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_triangles.diminfo[1].strides, __pyx_t_34, __pyx_pybuffernd_triangles.diminfo[2].strides));
32892 
32893         /* "yt/utilities/lib/geometry_utils.pyx":1347
32894  *             for j in range(3):
32895  *                 p0[j] = triangles[i, 2, j]
32896  *                 p1[j] = triangles[i, 0, j]             # <<<<<<<<<<<<<<
32897  *             get_intersection(p0, p1, ax, coord, points)
32898  *         if last != NULL:
32899  */
32900         __pyx_t_35 = __pyx_v_i;
32901         __pyx_t_36 = 0;
32902         __pyx_t_37 = __pyx_v_j;
32903         __pyx_t_8 = -1;
32904         if (__pyx_t_35 < 0) {
32905           __pyx_t_35 += __pyx_pybuffernd_triangles.diminfo[0].shape;
32906           if (unlikely(__pyx_t_35 < 0)) __pyx_t_8 = 0;
32907         } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_triangles.diminfo[0].shape)) __pyx_t_8 = 0;
32908         if (__pyx_t_36 < 0) {
32909           __pyx_t_36 += __pyx_pybuffernd_triangles.diminfo[1].shape;
32910           if (unlikely(__pyx_t_36 < 0)) __pyx_t_8 = 1;
32911         } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_triangles.diminfo[1].shape)) __pyx_t_8 = 1;
32912         if (__pyx_t_37 < 0) {
32913           __pyx_t_37 += __pyx_pybuffernd_triangles.diminfo[2].shape;
32914           if (unlikely(__pyx_t_37 < 0)) __pyx_t_8 = 2;
32915         } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_triangles.diminfo[2].shape)) __pyx_t_8 = 2;
32916         if (unlikely(__pyx_t_8 != -1)) {
32917           __Pyx_RaiseBufferIndexError(__pyx_t_8);
32918           __PYX_ERR(1, 1347, __pyx_L1_error)
32919         }
32920         (__pyx_v_p1[__pyx_v_j]) = (*__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_triangles.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_triangles.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_triangles.diminfo[1].strides, __pyx_t_37, __pyx_pybuffernd_triangles.diminfo[2].strides));
32921       }
32922 
32923       /* "yt/utilities/lib/geometry_utils.pyx":1348
32924  *                 p0[j] = triangles[i, 2, j]
32925  *                 p1[j] = triangles[i, 0, j]
32926  *             get_intersection(p0, p1, ax, coord, points)             # <<<<<<<<<<<<<<
32927  *         if last != NULL:
32928  *             last.next = points
32929  */
32930       __pyx_f_2yt_9utilities_3lib_14geometry_utils_get_intersection(__pyx_v_p0, __pyx_v_p1, __pyx_v_ax, __pyx_v_coord, __pyx_v_points);
32931 
32932       /* "yt/utilities/lib/geometry_utils.pyx":1343
32933  *                 p1[j] = triangles[i, 2, j]
32934  *             get_intersection(p0, p1, ax, coord, points)
32935  *         if p2[2] * p2[0] < 0:             # <<<<<<<<<<<<<<
32936  *             # intersection of 20 triangle segment with plane
32937  *             for j in range(3):
32938  */
32939     }
32940 
32941     /* "yt/utilities/lib/geometry_utils.pyx":1349
32942  *                 p1[j] = triangles[i, 0, j]
32943  *             get_intersection(p0, p1, ax, coord, points)
32944  *         if last != NULL:             # <<<<<<<<<<<<<<
32945  *             last.next = points
32946  *         if first == NULL:
32947  */
32948     __pyx_t_15 = ((__pyx_v_last != NULL) != 0);
32949     if (__pyx_t_15) {
32950 
32951       /* "yt/utilities/lib/geometry_utils.pyx":1350
32952  *             get_intersection(p0, p1, ax, coord, points)
32953  *         if last != NULL:
32954  *             last.next = points             # <<<<<<<<<<<<<<
32955  *         if first == NULL:
32956  *             first = points
32957  */
32958       __pyx_v_last->next = __pyx_v_points;
32959 
32960       /* "yt/utilities/lib/geometry_utils.pyx":1349
32961  *                 p1[j] = triangles[i, 0, j]
32962  *             get_intersection(p0, p1, ax, coord, points)
32963  *         if last != NULL:             # <<<<<<<<<<<<<<
32964  *             last.next = points
32965  *         if first == NULL:
32966  */
32967     }
32968 
32969     /* "yt/utilities/lib/geometry_utils.pyx":1351
32970  *         if last != NULL:
32971  *             last.next = points
32972  *         if first == NULL:             # <<<<<<<<<<<<<<
32973  *             first = points
32974  *         last = points
32975  */
32976     __pyx_t_15 = ((__pyx_v_first == NULL) != 0);
32977     if (__pyx_t_15) {
32978 
32979       /* "yt/utilities/lib/geometry_utils.pyx":1352
32980  *             last.next = points
32981  *         if first == NULL:
32982  *             first = points             # <<<<<<<<<<<<<<
32983  *         last = points
32984  *
32985  */
32986       __pyx_v_first = __pyx_v_points;
32987 
32988       /* "yt/utilities/lib/geometry_utils.pyx":1351
32989  *         if last != NULL:
32990  *             last.next = points
32991  *         if first == NULL:             # <<<<<<<<<<<<<<
32992  *             first = points
32993  *         last = points
32994  */
32995     }
32996 
32997     /* "yt/utilities/lib/geometry_utils.pyx":1353
32998  *         if first == NULL:
32999  *             first = points
33000  *         last = points             # <<<<<<<<<<<<<<
33001  *
33002  *     points = first
33003  */
33004     __pyx_v_last = __pyx_v_points;
33005     __pyx_L3_continue:;
33006   }
33007 
33008   /* "yt/utilities/lib/geometry_utils.pyx":1355
33009  *         last = points
33010  *
33011  *     points = first             # <<<<<<<<<<<<<<
33012  *     cdef np.ndarray[np.float64_t, ndim=3] line_segments
33013  *     line_segments = np.empty((nlines, 2, 3), dtype="float64")
33014  */
33015   __pyx_v_points = __pyx_v_first;
33016 
33017   /* "yt/utilities/lib/geometry_utils.pyx":1357
33018  *     points = first
33019  *     cdef np.ndarray[np.float64_t, ndim=3] line_segments
33020  *     line_segments = np.empty((nlines, 2, 3), dtype="float64")             # <<<<<<<<<<<<<<
33021  *     k = 0
33022  *     while points != NULL:
33023  */
33024   __Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_n_s_np); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 1357, __pyx_L1_error)
33025   __Pyx_GOTREF(__pyx_t_19);
33026   __pyx_t_38 = __Pyx_PyObject_GetAttrStr(__pyx_t_19, __pyx_n_s_empty); if (unlikely(!__pyx_t_38)) __PYX_ERR(1, 1357, __pyx_L1_error)
33027   __Pyx_GOTREF(__pyx_t_38);
33028   __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
33029   __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_nlines); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 1357, __pyx_L1_error)
33030   __Pyx_GOTREF(__pyx_t_19);
33031   __pyx_t_39 = PyTuple_New(3); if (unlikely(!__pyx_t_39)) __PYX_ERR(1, 1357, __pyx_L1_error)
33032   __Pyx_GOTREF(__pyx_t_39);
33033   __Pyx_GIVEREF(__pyx_t_19);
33034   PyTuple_SET_ITEM(__pyx_t_39, 0, __pyx_t_19);
33035   __Pyx_INCREF(__pyx_int_2);
33036   __Pyx_GIVEREF(__pyx_int_2);
33037   PyTuple_SET_ITEM(__pyx_t_39, 1, __pyx_int_2);
33038   __Pyx_INCREF(__pyx_int_3);
33039   __Pyx_GIVEREF(__pyx_int_3);
33040   PyTuple_SET_ITEM(__pyx_t_39, 2, __pyx_int_3);
33041   __pyx_t_19 = 0;
33042   __pyx_t_19 = PyTuple_New(1); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 1357, __pyx_L1_error)
33043   __Pyx_GOTREF(__pyx_t_19);
33044   __Pyx_GIVEREF(__pyx_t_39);
33045   PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_39);
33046   __pyx_t_39 = 0;
33047   __pyx_t_39 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_39)) __PYX_ERR(1, 1357, __pyx_L1_error)
33048   __Pyx_GOTREF(__pyx_t_39);
33049   if (PyDict_SetItem(__pyx_t_39, __pyx_n_s_dtype, __pyx_n_s_float64) < 0) __PYX_ERR(1, 1357, __pyx_L1_error)
33050   __pyx_t_40 = __Pyx_PyObject_Call(__pyx_t_38, __pyx_t_19, __pyx_t_39); if (unlikely(!__pyx_t_40)) __PYX_ERR(1, 1357, __pyx_L1_error)
33051   __Pyx_GOTREF(__pyx_t_40);
33052   __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0;
33053   __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
33054   __Pyx_DECREF(__pyx_t_39); __pyx_t_39 = 0;
33055   if (!(likely(((__pyx_t_40) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_40, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 1357, __pyx_L1_error)
33056   __pyx_t_41 = ((PyArrayObject *)__pyx_t_40);
33057   {
33058     __Pyx_BufFmt_StackElem __pyx_stack[1];
33059     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_line_segments.rcbuffer->pybuffer);
33060     __pyx_t_1 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_line_segments.rcbuffer->pybuffer, (PyObject*)__pyx_t_41, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack);
33061     if (unlikely(__pyx_t_1 < 0)) {
33062       PyErr_Fetch(&__pyx_t_42, &__pyx_t_43, &__pyx_t_44);
33063       if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_line_segments.rcbuffer->pybuffer, (PyObject*)__pyx_v_line_segments, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {
33064         Py_XDECREF(__pyx_t_42); Py_XDECREF(__pyx_t_43); Py_XDECREF(__pyx_t_44);
33065         __Pyx_RaiseBufferFallbackError();
33066       } else {
33067         PyErr_Restore(__pyx_t_42, __pyx_t_43, __pyx_t_44);
33068       }
33069       __pyx_t_42 = __pyx_t_43 = __pyx_t_44 = 0;
33070     }
33071     __pyx_pybuffernd_line_segments.diminfo[0].strides = __pyx_pybuffernd_line_segments.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_line_segments.diminfo[0].shape = __pyx_pybuffernd_line_segments.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_line_segments.diminfo[1].strides = __pyx_pybuffernd_line_segments.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_line_segments.diminfo[1].shape = __pyx_pybuffernd_line_segments.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_line_segments.diminfo[2].strides = __pyx_pybuffernd_line_segments.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_line_segments.diminfo[2].shape = __pyx_pybuffernd_line_segments.rcbuffer->pybuffer.shape[2];
33072     if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 1357, __pyx_L1_error)
33073   }
33074   __pyx_t_41 = 0;
33075   __pyx_v_line_segments = ((PyArrayObject *)__pyx_t_40);
33076   __pyx_t_40 = 0;
33077 
33078   /* "yt/utilities/lib/geometry_utils.pyx":1358
33079  *     cdef np.ndarray[np.float64_t, ndim=3] line_segments
33080  *     line_segments = np.empty((nlines, 2, 3), dtype="float64")
33081  *     k = 0             # <<<<<<<<<<<<<<
33082  *     while points != NULL:
33083  *         for j in range(3):
33084  */
33085   __pyx_v_k = 0;
33086 
33087   /* "yt/utilities/lib/geometry_utils.pyx":1359
33088  *     line_segments = np.empty((nlines, 2, 3), dtype="float64")
33089  *     k = 0
33090  *     while points != NULL:             # <<<<<<<<<<<<<<
33091  *         for j in range(3):
33092  *             line_segments[k, 0, j] = points.points[0][j]
33093  */
33094   while (1) {
33095     __pyx_t_15 = ((__pyx_v_points != NULL) != 0);
33096     if (!__pyx_t_15) break;
33097 
33098     /* "yt/utilities/lib/geometry_utils.pyx":1360
33099  *     k = 0
33100  *     while points != NULL:
33101  *         for j in range(3):             # <<<<<<<<<<<<<<
33102  *             line_segments[k, 0, j] = points.points[0][j]
33103  *             line_segments[k, 1, j] = points.points[1][j]
33104  */
33105     for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
33106       __pyx_v_j = __pyx_t_1;
33107 
33108       /* "yt/utilities/lib/geometry_utils.pyx":1361
33109  *     while points != NULL:
33110  *         for j in range(3):
33111  *             line_segments[k, 0, j] = points.points[0][j]             # <<<<<<<<<<<<<<
33112  *             line_segments[k, 1, j] = points.points[1][j]
33113  *         k += 1
33114  */
33115       __pyx_t_45 = __pyx_v_k;
33116       __pyx_t_46 = 0;
33117       __pyx_t_47 = __pyx_v_j;
33118       __pyx_t_2 = -1;
33119       if (__pyx_t_45 < 0) {
33120         __pyx_t_45 += __pyx_pybuffernd_line_segments.diminfo[0].shape;
33121         if (unlikely(__pyx_t_45 < 0)) __pyx_t_2 = 0;
33122       } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_line_segments.diminfo[0].shape)) __pyx_t_2 = 0;
33123       if (__pyx_t_46 < 0) {
33124         __pyx_t_46 += __pyx_pybuffernd_line_segments.diminfo[1].shape;
33125         if (unlikely(__pyx_t_46 < 0)) __pyx_t_2 = 1;
33126       } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_line_segments.diminfo[1].shape)) __pyx_t_2 = 1;
33127       if (__pyx_t_47 < 0) {
33128         __pyx_t_47 += __pyx_pybuffernd_line_segments.diminfo[2].shape;
33129         if (unlikely(__pyx_t_47 < 0)) __pyx_t_2 = 2;
33130       } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_line_segments.diminfo[2].shape)) __pyx_t_2 = 2;
33131       if (unlikely(__pyx_t_2 != -1)) {
33132         __Pyx_RaiseBufferIndexError(__pyx_t_2);
33133         __PYX_ERR(1, 1361, __pyx_L1_error)
33134       }
33135       *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_line_segments.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_line_segments.diminfo[0].strides, __pyx_t_46, __pyx_pybuffernd_line_segments.diminfo[1].strides, __pyx_t_47, __pyx_pybuffernd_line_segments.diminfo[2].strides) = ((__pyx_v_points->points[0])[__pyx_v_j]);
33136 
33137       /* "yt/utilities/lib/geometry_utils.pyx":1362
33138  *         for j in range(3):
33139  *             line_segments[k, 0, j] = points.points[0][j]
33140  *             line_segments[k, 1, j] = points.points[1][j]             # <<<<<<<<<<<<<<
33141  *         k += 1
33142  *         last = points
33143  */
33144       __pyx_t_48 = __pyx_v_k;
33145       __pyx_t_49 = 1;
33146       __pyx_t_50 = __pyx_v_j;
33147       __pyx_t_2 = -1;
33148       if (__pyx_t_48 < 0) {
33149         __pyx_t_48 += __pyx_pybuffernd_line_segments.diminfo[0].shape;
33150         if (unlikely(__pyx_t_48 < 0)) __pyx_t_2 = 0;
33151       } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_line_segments.diminfo[0].shape)) __pyx_t_2 = 0;
33152       if (__pyx_t_49 < 0) {
33153         __pyx_t_49 += __pyx_pybuffernd_line_segments.diminfo[1].shape;
33154         if (unlikely(__pyx_t_49 < 0)) __pyx_t_2 = 1;
33155       } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_line_segments.diminfo[1].shape)) __pyx_t_2 = 1;
33156       if (__pyx_t_50 < 0) {
33157         __pyx_t_50 += __pyx_pybuffernd_line_segments.diminfo[2].shape;
33158         if (unlikely(__pyx_t_50 < 0)) __pyx_t_2 = 2;
33159       } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_line_segments.diminfo[2].shape)) __pyx_t_2 = 2;
33160       if (unlikely(__pyx_t_2 != -1)) {
33161         __Pyx_RaiseBufferIndexError(__pyx_t_2);
33162         __PYX_ERR(1, 1362, __pyx_L1_error)
33163       }
33164       *__Pyx_BufPtrStrided3d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_line_segments.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_line_segments.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_line_segments.diminfo[1].strides, __pyx_t_50, __pyx_pybuffernd_line_segments.diminfo[2].strides) = ((__pyx_v_points->points[1])[__pyx_v_j]);
33165     }
33166 
33167     /* "yt/utilities/lib/geometry_utils.pyx":1363
33168  *             line_segments[k, 0, j] = points.points[0][j]
33169  *             line_segments[k, 1, j] = points.points[1][j]
33170  *         k += 1             # <<<<<<<<<<<<<<
33171  *         last = points
33172  *         points = points.next
33173  */
33174     __pyx_v_k = (__pyx_v_k + 1);
33175 
33176     /* "yt/utilities/lib/geometry_utils.pyx":1364
33177  *             line_segments[k, 1, j] = points.points[1][j]
33178  *         k += 1
33179  *         last = points             # <<<<<<<<<<<<<<
33180  *         points = points.next
33181  *         free(last)
33182  */
33183     __pyx_v_last = __pyx_v_points;
33184 
33185     /* "yt/utilities/lib/geometry_utils.pyx":1365
33186  *         k += 1
33187  *         last = points
33188  *         points = points.next             # <<<<<<<<<<<<<<
33189  *         free(last)
33190  *     return line_segments
33191  */
33192     __pyx_t_51 = __pyx_v_points->next;
33193     __pyx_v_points = __pyx_t_51;
33194 
33195     /* "yt/utilities/lib/geometry_utils.pyx":1366
33196  *         last = points
33197  *         points = points.next
33198  *         free(last)             # <<<<<<<<<<<<<<
33199  *     return line_segments
33200  */
33201     free(__pyx_v_last);
33202   }
33203 
33204   /* "yt/utilities/lib/geometry_utils.pyx":1367
33205  *         points = points.next
33206  *         free(last)
33207  *     return line_segments             # <<<<<<<<<<<<<<
33208  */
33209   __Pyx_XDECREF(__pyx_r);
33210   __Pyx_INCREF(((PyObject *)__pyx_v_line_segments));
33211   __pyx_r = ((PyObject *)__pyx_v_line_segments);
33212   goto __pyx_L0;
33213 
33214   /* "yt/utilities/lib/geometry_utils.pyx":1268
33215  *
33216  * @cython.cdivision(True)
33217  * def triangle_plane_intersect(int ax, np.float64_t coord,             # <<<<<<<<<<<<<<
33218  *                              np.ndarray[np.float64_t, ndim=3] triangles):
33219  *     cdef np.float64_t p0[3]
33220  */
33221 
33222   /* function exit code */
33223   __pyx_L1_error:;
33224   __Pyx_XDECREF(__pyx_t_19);
33225   __Pyx_XDECREF(__pyx_t_38);
33226   __Pyx_XDECREF(__pyx_t_39);
33227   __Pyx_XDECREF(__pyx_t_40);
33228   { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
33229     __Pyx_PyThreadState_declare
33230     __Pyx_PyThreadState_assign
33231     __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
33232     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_line_segments.rcbuffer->pybuffer);
33233     __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_triangles.rcbuffer->pybuffer);
33234   __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
33235   __Pyx_AddTraceback("yt.utilities.lib.geometry_utils.triangle_plane_intersect", __pyx_clineno, __pyx_lineno, __pyx_filename);
33236   __pyx_r = NULL;
33237   goto __pyx_L2;
33238   __pyx_L0:;
33239   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_line_segments.rcbuffer->pybuffer);
33240   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_triangles.rcbuffer->pybuffer);
33241   __pyx_L2:;
33242   __Pyx_XDECREF((PyObject *)__pyx_v_line_segments);
33243   __Pyx_XGIVEREF(__pyx_r);
33244   __Pyx_RefNannyFinishContext();
33245   return __pyx_r;
33246 }
33247 
33248 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":258
33249  *         # experimental exception made for __getbuffer__ and __releasebuffer__
33250  *         # -- the details of this may change.
33251  *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
33252  *             # This implementation of getbuffer is geared towards Cython
33253  *             # requirements, and does not yet fulfill the PEP.
33254  */
33255 
33256 /* Python wrapper */
33257 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
__pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)33258 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
33259   int __pyx_r;
33260   __Pyx_RefNannyDeclarations
33261   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
33262   __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
33263 
33264   /* function exit code */
33265   __Pyx_RefNannyFinishContext();
33266   return __pyx_r;
33267 }
33268 
__pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)33269 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
33270   int __pyx_v_i;
33271   int __pyx_v_ndim;
33272   int __pyx_v_endian_detector;
33273   int __pyx_v_little_endian;
33274   int __pyx_v_t;
33275   char *__pyx_v_f;
33276   PyArray_Descr *__pyx_v_descr = 0;
33277   int __pyx_v_offset;
33278   int __pyx_r;
33279   __Pyx_RefNannyDeclarations
33280   int __pyx_t_1;
33281   int __pyx_t_2;
33282   PyObject *__pyx_t_3 = NULL;
33283   int __pyx_t_4;
33284   int __pyx_t_5;
33285   int __pyx_t_6;
33286   PyArray_Descr *__pyx_t_7;
33287   PyObject *__pyx_t_8 = NULL;
33288   char *__pyx_t_9;
33289   if (__pyx_v_info == NULL) {
33290     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
33291     return -1;
33292   }
33293   __Pyx_RefNannySetupContext("__getbuffer__", 0);
33294   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
33295   __Pyx_GIVEREF(__pyx_v_info->obj);
33296 
33297   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":265
33298  *
33299  *             cdef int i, ndim
33300  *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
33301  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
33302  *
33303  */
33304   __pyx_v_endian_detector = 1;
33305 
33306   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":266
33307  *             cdef int i, ndim
33308  *             cdef int endian_detector = 1
33309  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
33310  *
33311  *             ndim = PyArray_NDIM(self)
33312  */
33313   __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
33314 
33315   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":268
33316  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
33317  *
33318  *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
33319  *
33320  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
33321  */
33322   __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
33323 
33324   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
33325  *             ndim = PyArray_NDIM(self)
33326  *
33327  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
33328  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
33329  *                 raise ValueError(u"ndarray is not C contiguous")
33330  */
33331   __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
33332   if (__pyx_t_2) {
33333   } else {
33334     __pyx_t_1 = __pyx_t_2;
33335     goto __pyx_L4_bool_binop_done;
33336   }
33337 
33338   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":271
33339  *
33340  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
33341  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
33342  *                 raise ValueError(u"ndarray is not C contiguous")
33343  *
33344  */
33345   __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0);
33346   __pyx_t_1 = __pyx_t_2;
33347   __pyx_L4_bool_binop_done:;
33348 
33349   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
33350  *             ndim = PyArray_NDIM(self)
33351  *
33352  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
33353  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
33354  *                 raise ValueError(u"ndarray is not C contiguous")
33355  */
33356   if (unlikely(__pyx_t_1)) {
33357 
33358     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272
33359  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
33360  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
33361  *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
33362  *
33363  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
33364  */
33365     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 272, __pyx_L1_error)
33366     __Pyx_GOTREF(__pyx_t_3);
33367     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
33368     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33369     __PYX_ERR(2, 272, __pyx_L1_error)
33370 
33371     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
33372  *             ndim = PyArray_NDIM(self)
33373  *
33374  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
33375  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
33376  *                 raise ValueError(u"ndarray is not C contiguous")
33377  */
33378   }
33379 
33380   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
33381  *                 raise ValueError(u"ndarray is not C contiguous")
33382  *
33383  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
33384  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
33385  *                 raise ValueError(u"ndarray is not Fortran contiguous")
33386  */
33387   __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
33388   if (__pyx_t_2) {
33389   } else {
33390     __pyx_t_1 = __pyx_t_2;
33391     goto __pyx_L7_bool_binop_done;
33392   }
33393 
33394   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":275
33395  *
33396  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
33397  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
33398  *                 raise ValueError(u"ndarray is not Fortran contiguous")
33399  *
33400  */
33401   __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0);
33402   __pyx_t_1 = __pyx_t_2;
33403   __pyx_L7_bool_binop_done:;
33404 
33405   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
33406  *                 raise ValueError(u"ndarray is not C contiguous")
33407  *
33408  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
33409  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
33410  *                 raise ValueError(u"ndarray is not Fortran contiguous")
33411  */
33412   if (unlikely(__pyx_t_1)) {
33413 
33414     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276
33415  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
33416  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
33417  *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
33418  *
33419  *             info.buf = PyArray_DATA(self)
33420  */
33421     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 276, __pyx_L1_error)
33422     __Pyx_GOTREF(__pyx_t_3);
33423     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
33424     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33425     __PYX_ERR(2, 276, __pyx_L1_error)
33426 
33427     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
33428  *                 raise ValueError(u"ndarray is not C contiguous")
33429  *
33430  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
33431  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
33432  *                 raise ValueError(u"ndarray is not Fortran contiguous")
33433  */
33434   }
33435 
33436   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":278
33437  *                 raise ValueError(u"ndarray is not Fortran contiguous")
33438  *
33439  *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
33440  *             info.ndim = ndim
33441  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
33442  */
33443   __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
33444 
33445   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":279
33446  *
33447  *             info.buf = PyArray_DATA(self)
33448  *             info.ndim = ndim             # <<<<<<<<<<<<<<
33449  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
33450  *                 # Allocate new buffer for strides and shape info.
33451  */
33452   __pyx_v_info->ndim = __pyx_v_ndim;
33453 
33454   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280
33455  *             info.buf = PyArray_DATA(self)
33456  *             info.ndim = ndim
33457  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
33458  *                 # Allocate new buffer for strides and shape info.
33459  *                 # This is allocated as one block, strides first.
33460  */
33461   __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
33462   if (__pyx_t_1) {
33463 
33464     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":283
33465  *                 # Allocate new buffer for strides and shape info.
33466  *                 # This is allocated as one block, strides first.
33467  *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)             # <<<<<<<<<<<<<<
33468  *                 info.shape = info.strides + ndim
33469  *                 for i in range(ndim):
33470  */
33471     __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim))));
33472 
33473     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":284
33474  *                 # This is allocated as one block, strides first.
33475  *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
33476  *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
33477  *                 for i in range(ndim):
33478  *                     info.strides[i] = PyArray_STRIDES(self)[i]
33479  */
33480     __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
33481 
33482     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":285
33483  *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
33484  *                 info.shape = info.strides + ndim
33485  *                 for i in range(ndim):             # <<<<<<<<<<<<<<
33486  *                     info.strides[i] = PyArray_STRIDES(self)[i]
33487  *                     info.shape[i] = PyArray_DIMS(self)[i]
33488  */
33489     __pyx_t_4 = __pyx_v_ndim;
33490     __pyx_t_5 = __pyx_t_4;
33491     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
33492       __pyx_v_i = __pyx_t_6;
33493 
33494       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":286
33495  *                 info.shape = info.strides + ndim
33496  *                 for i in range(ndim):
33497  *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
33498  *                     info.shape[i] = PyArray_DIMS(self)[i]
33499  *             else:
33500  */
33501       (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
33502 
33503       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":287
33504  *                 for i in range(ndim):
33505  *                     info.strides[i] = PyArray_STRIDES(self)[i]
33506  *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
33507  *             else:
33508  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
33509  */
33510       (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
33511     }
33512 
33513     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280
33514  *             info.buf = PyArray_DATA(self)
33515  *             info.ndim = ndim
33516  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
33517  *                 # Allocate new buffer for strides and shape info.
33518  *                 # This is allocated as one block, strides first.
33519  */
33520     goto __pyx_L9;
33521   }
33522 
33523   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":289
33524  *                     info.shape[i] = PyArray_DIMS(self)[i]
33525  *             else:
33526  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
33527  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
33528  *             info.suboffsets = NULL
33529  */
33530   /*else*/ {
33531     __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
33532 
33533     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":290
33534  *             else:
33535  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
33536  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)             # <<<<<<<<<<<<<<
33537  *             info.suboffsets = NULL
33538  *             info.itemsize = PyArray_ITEMSIZE(self)
33539  */
33540     __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
33541   }
33542   __pyx_L9:;
33543 
33544   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":291
33545  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
33546  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
33547  *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
33548  *             info.itemsize = PyArray_ITEMSIZE(self)
33549  *             info.readonly = not PyArray_ISWRITEABLE(self)
33550  */
33551   __pyx_v_info->suboffsets = NULL;
33552 
33553   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":292
33554  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
33555  *             info.suboffsets = NULL
33556  *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
33557  *             info.readonly = not PyArray_ISWRITEABLE(self)
33558  *
33559  */
33560   __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
33561 
33562   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":293
33563  *             info.suboffsets = NULL
33564  *             info.itemsize = PyArray_ITEMSIZE(self)
33565  *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
33566  *
33567  *             cdef int t
33568  */
33569   __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
33570 
33571   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":296
33572  *
33573  *             cdef int t
33574  *             cdef char* f = NULL             # <<<<<<<<<<<<<<
33575  *             cdef dtype descr = <dtype>PyArray_DESCR(self)
33576  *             cdef int offset
33577  */
33578   __pyx_v_f = NULL;
33579 
33580   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":297
33581  *             cdef int t
33582  *             cdef char* f = NULL
33583  *             cdef dtype descr = <dtype>PyArray_DESCR(self)             # <<<<<<<<<<<<<<
33584  *             cdef int offset
33585  *
33586  */
33587   __pyx_t_7 = PyArray_DESCR(__pyx_v_self);
33588   __pyx_t_3 = ((PyObject *)__pyx_t_7);
33589   __Pyx_INCREF(__pyx_t_3);
33590   __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
33591   __pyx_t_3 = 0;
33592 
33593   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":300
33594  *             cdef int offset
33595  *
33596  *             info.obj = self             # <<<<<<<<<<<<<<
33597  *
33598  *             if not PyDataType_HASFIELDS(descr):
33599  */
33600   __Pyx_INCREF(((PyObject *)__pyx_v_self));
33601   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
33602   __Pyx_GOTREF(__pyx_v_info->obj);
33603   __Pyx_DECREF(__pyx_v_info->obj);
33604   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
33605 
33606   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302
33607  *             info.obj = self
33608  *
33609  *             if not PyDataType_HASFIELDS(descr):             # <<<<<<<<<<<<<<
33610  *                 t = descr.type_num
33611  *                 if ((descr.byteorder == c'>' and little_endian) or
33612  */
33613   __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0);
33614   if (__pyx_t_1) {
33615 
33616     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":303
33617  *
33618  *             if not PyDataType_HASFIELDS(descr):
33619  *                 t = descr.type_num             # <<<<<<<<<<<<<<
33620  *                 if ((descr.byteorder == c'>' and little_endian) or
33621  *                     (descr.byteorder == c'<' and not little_endian)):
33622  */
33623     __pyx_t_4 = __pyx_v_descr->type_num;
33624     __pyx_v_t = __pyx_t_4;
33625 
33626     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
33627  *             if not PyDataType_HASFIELDS(descr):
33628  *                 t = descr.type_num
33629  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
33630  *                     (descr.byteorder == c'<' and not little_endian)):
33631  *                     raise ValueError(u"Non-native byte order not supported")
33632  */
33633     __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
33634     if (!__pyx_t_2) {
33635       goto __pyx_L15_next_or;
33636     } else {
33637     }
33638     __pyx_t_2 = (__pyx_v_little_endian != 0);
33639     if (!__pyx_t_2) {
33640     } else {
33641       __pyx_t_1 = __pyx_t_2;
33642       goto __pyx_L14_bool_binop_done;
33643     }
33644     __pyx_L15_next_or:;
33645 
33646     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":305
33647  *                 t = descr.type_num
33648  *                 if ((descr.byteorder == c'>' and little_endian) or
33649  *                     (descr.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
33650  *                     raise ValueError(u"Non-native byte order not supported")
33651  *                 if   t == NPY_BYTE:        f = "b"
33652  */
33653     __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
33654     if (__pyx_t_2) {
33655     } else {
33656       __pyx_t_1 = __pyx_t_2;
33657       goto __pyx_L14_bool_binop_done;
33658     }
33659     __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
33660     __pyx_t_1 = __pyx_t_2;
33661     __pyx_L14_bool_binop_done:;
33662 
33663     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
33664  *             if not PyDataType_HASFIELDS(descr):
33665  *                 t = descr.type_num
33666  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
33667  *                     (descr.byteorder == c'<' and not little_endian)):
33668  *                     raise ValueError(u"Non-native byte order not supported")
33669  */
33670     if (unlikely(__pyx_t_1)) {
33671 
33672       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":306
33673  *                 if ((descr.byteorder == c'>' and little_endian) or
33674  *                     (descr.byteorder == c'<' and not little_endian)):
33675  *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
33676  *                 if   t == NPY_BYTE:        f = "b"
33677  *                 elif t == NPY_UBYTE:       f = "B"
33678  */
33679       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 306, __pyx_L1_error)
33680       __Pyx_GOTREF(__pyx_t_3);
33681       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
33682       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33683       __PYX_ERR(2, 306, __pyx_L1_error)
33684 
33685       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
33686  *             if not PyDataType_HASFIELDS(descr):
33687  *                 t = descr.type_num
33688  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
33689  *                     (descr.byteorder == c'<' and not little_endian)):
33690  *                     raise ValueError(u"Non-native byte order not supported")
33691  */
33692     }
33693 
33694     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":307
33695  *                     (descr.byteorder == c'<' and not little_endian)):
33696  *                     raise ValueError(u"Non-native byte order not supported")
33697  *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
33698  *                 elif t == NPY_UBYTE:       f = "B"
33699  *                 elif t == NPY_SHORT:       f = "h"
33700  */
33701     switch (__pyx_v_t) {
33702       case NPY_BYTE:
33703       __pyx_v_f = ((char *)"b");
33704       break;
33705       case NPY_UBYTE:
33706 
33707       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":308
33708  *                     raise ValueError(u"Non-native byte order not supported")
33709  *                 if   t == NPY_BYTE:        f = "b"
33710  *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
33711  *                 elif t == NPY_SHORT:       f = "h"
33712  *                 elif t == NPY_USHORT:      f = "H"
33713  */
33714       __pyx_v_f = ((char *)"B");
33715       break;
33716       case NPY_SHORT:
33717 
33718       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":309
33719  *                 if   t == NPY_BYTE:        f = "b"
33720  *                 elif t == NPY_UBYTE:       f = "B"
33721  *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
33722  *                 elif t == NPY_USHORT:      f = "H"
33723  *                 elif t == NPY_INT:         f = "i"
33724  */
33725       __pyx_v_f = ((char *)"h");
33726       break;
33727       case NPY_USHORT:
33728 
33729       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":310
33730  *                 elif t == NPY_UBYTE:       f = "B"
33731  *                 elif t == NPY_SHORT:       f = "h"
33732  *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
33733  *                 elif t == NPY_INT:         f = "i"
33734  *                 elif t == NPY_UINT:        f = "I"
33735  */
33736       __pyx_v_f = ((char *)"H");
33737       break;
33738       case NPY_INT:
33739 
33740       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":311
33741  *                 elif t == NPY_SHORT:       f = "h"
33742  *                 elif t == NPY_USHORT:      f = "H"
33743  *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
33744  *                 elif t == NPY_UINT:        f = "I"
33745  *                 elif t == NPY_LONG:        f = "l"
33746  */
33747       __pyx_v_f = ((char *)"i");
33748       break;
33749       case NPY_UINT:
33750 
33751       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":312
33752  *                 elif t == NPY_USHORT:      f = "H"
33753  *                 elif t == NPY_INT:         f = "i"
33754  *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
33755  *                 elif t == NPY_LONG:        f = "l"
33756  *                 elif t == NPY_ULONG:       f = "L"
33757  */
33758       __pyx_v_f = ((char *)"I");
33759       break;
33760       case NPY_LONG:
33761 
33762       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":313
33763  *                 elif t == NPY_INT:         f = "i"
33764  *                 elif t == NPY_UINT:        f = "I"
33765  *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
33766  *                 elif t == NPY_ULONG:       f = "L"
33767  *                 elif t == NPY_LONGLONG:    f = "q"
33768  */
33769       __pyx_v_f = ((char *)"l");
33770       break;
33771       case NPY_ULONG:
33772 
33773       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":314
33774  *                 elif t == NPY_UINT:        f = "I"
33775  *                 elif t == NPY_LONG:        f = "l"
33776  *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
33777  *                 elif t == NPY_LONGLONG:    f = "q"
33778  *                 elif t == NPY_ULONGLONG:   f = "Q"
33779  */
33780       __pyx_v_f = ((char *)"L");
33781       break;
33782       case NPY_LONGLONG:
33783 
33784       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":315
33785  *                 elif t == NPY_LONG:        f = "l"
33786  *                 elif t == NPY_ULONG:       f = "L"
33787  *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
33788  *                 elif t == NPY_ULONGLONG:   f = "Q"
33789  *                 elif t == NPY_FLOAT:       f = "f"
33790  */
33791       __pyx_v_f = ((char *)"q");
33792       break;
33793       case NPY_ULONGLONG:
33794 
33795       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":316
33796  *                 elif t == NPY_ULONG:       f = "L"
33797  *                 elif t == NPY_LONGLONG:    f = "q"
33798  *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
33799  *                 elif t == NPY_FLOAT:       f = "f"
33800  *                 elif t == NPY_DOUBLE:      f = "d"
33801  */
33802       __pyx_v_f = ((char *)"Q");
33803       break;
33804       case NPY_FLOAT:
33805 
33806       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":317
33807  *                 elif t == NPY_LONGLONG:    f = "q"
33808  *                 elif t == NPY_ULONGLONG:   f = "Q"
33809  *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
33810  *                 elif t == NPY_DOUBLE:      f = "d"
33811  *                 elif t == NPY_LONGDOUBLE:  f = "g"
33812  */
33813       __pyx_v_f = ((char *)"f");
33814       break;
33815       case NPY_DOUBLE:
33816 
33817       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":318
33818  *                 elif t == NPY_ULONGLONG:   f = "Q"
33819  *                 elif t == NPY_FLOAT:       f = "f"
33820  *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
33821  *                 elif t == NPY_LONGDOUBLE:  f = "g"
33822  *                 elif t == NPY_CFLOAT:      f = "Zf"
33823  */
33824       __pyx_v_f = ((char *)"d");
33825       break;
33826       case NPY_LONGDOUBLE:
33827 
33828       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":319
33829  *                 elif t == NPY_FLOAT:       f = "f"
33830  *                 elif t == NPY_DOUBLE:      f = "d"
33831  *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
33832  *                 elif t == NPY_CFLOAT:      f = "Zf"
33833  *                 elif t == NPY_CDOUBLE:     f = "Zd"
33834  */
33835       __pyx_v_f = ((char *)"g");
33836       break;
33837       case NPY_CFLOAT:
33838 
33839       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":320
33840  *                 elif t == NPY_DOUBLE:      f = "d"
33841  *                 elif t == NPY_LONGDOUBLE:  f = "g"
33842  *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
33843  *                 elif t == NPY_CDOUBLE:     f = "Zd"
33844  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
33845  */
33846       __pyx_v_f = ((char *)"Zf");
33847       break;
33848       case NPY_CDOUBLE:
33849 
33850       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":321
33851  *                 elif t == NPY_LONGDOUBLE:  f = "g"
33852  *                 elif t == NPY_CFLOAT:      f = "Zf"
33853  *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
33854  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
33855  *                 elif t == NPY_OBJECT:      f = "O"
33856  */
33857       __pyx_v_f = ((char *)"Zd");
33858       break;
33859       case NPY_CLONGDOUBLE:
33860 
33861       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":322
33862  *                 elif t == NPY_CFLOAT:      f = "Zf"
33863  *                 elif t == NPY_CDOUBLE:     f = "Zd"
33864  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
33865  *                 elif t == NPY_OBJECT:      f = "O"
33866  *                 else:
33867  */
33868       __pyx_v_f = ((char *)"Zg");
33869       break;
33870       case NPY_OBJECT:
33871 
33872       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":323
33873  *                 elif t == NPY_CDOUBLE:     f = "Zd"
33874  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
33875  *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
33876  *                 else:
33877  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
33878  */
33879       __pyx_v_f = ((char *)"O");
33880       break;
33881       default:
33882 
33883       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":325
33884  *                 elif t == NPY_OBJECT:      f = "O"
33885  *                 else:
33886  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
33887  *                 info.format = f
33888  *                 return
33889  */
33890       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 325, __pyx_L1_error)
33891       __Pyx_GOTREF(__pyx_t_3);
33892       __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 325, __pyx_L1_error)
33893       __Pyx_GOTREF(__pyx_t_8);
33894       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33895       __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 325, __pyx_L1_error)
33896       __Pyx_GOTREF(__pyx_t_3);
33897       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
33898       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
33899       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33900       __PYX_ERR(2, 325, __pyx_L1_error)
33901       break;
33902     }
33903 
33904     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":326
33905  *                 else:
33906  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
33907  *                 info.format = f             # <<<<<<<<<<<<<<
33908  *                 return
33909  *             else:
33910  */
33911     __pyx_v_info->format = __pyx_v_f;
33912 
33913     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":327
33914  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
33915  *                 info.format = f
33916  *                 return             # <<<<<<<<<<<<<<
33917  *             else:
33918  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
33919  */
33920     __pyx_r = 0;
33921     goto __pyx_L0;
33922 
33923     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302
33924  *             info.obj = self
33925  *
33926  *             if not PyDataType_HASFIELDS(descr):             # <<<<<<<<<<<<<<
33927  *                 t = descr.type_num
33928  *                 if ((descr.byteorder == c'>' and little_endian) or
33929  */
33930   }
33931 
33932   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":329
33933  *                 return
33934  *             else:
33935  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
33936  *                 info.format[0] = c'^' # Native data types, manual alignment
33937  *                 offset = 0
33938  */
33939   /*else*/ {
33940     __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF));
33941 
33942     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":330
33943  *             else:
33944  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
33945  *                 info.format[0] = c'^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
33946  *                 offset = 0
33947  *                 f = _util_dtypestring(descr, info.format + 1,
33948  */
33949     (__pyx_v_info->format[0]) = '^';
33950 
33951     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":331
33952  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
33953  *                 info.format[0] = c'^' # Native data types, manual alignment
33954  *                 offset = 0             # <<<<<<<<<<<<<<
33955  *                 f = _util_dtypestring(descr, info.format + 1,
33956  *                                       info.format + _buffer_format_string_len,
33957  */
33958     __pyx_v_offset = 0;
33959 
33960     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":332
33961  *                 info.format[0] = c'^' # Native data types, manual alignment
33962  *                 offset = 0
33963  *                 f = _util_dtypestring(descr, info.format + 1,             # <<<<<<<<<<<<<<
33964  *                                       info.format + _buffer_format_string_len,
33965  *                                       &offset)
33966  */
33967     __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(2, 332, __pyx_L1_error)
33968     __pyx_v_f = __pyx_t_9;
33969 
33970     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":335
33971  *                                       info.format + _buffer_format_string_len,
33972  *                                       &offset)
33973  *                 f[0] = c'\0' # Terminate format string             # <<<<<<<<<<<<<<
33974  *
33975  *         def __releasebuffer__(ndarray self, Py_buffer* info):
33976  */
33977     (__pyx_v_f[0]) = '\x00';
33978   }
33979 
33980   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":258
33981  *         # experimental exception made for __getbuffer__ and __releasebuffer__
33982  *         # -- the details of this may change.
33983  *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
33984  *             # This implementation of getbuffer is geared towards Cython
33985  *             # requirements, and does not yet fulfill the PEP.
33986  */
33987 
33988   /* function exit code */
33989   __pyx_r = 0;
33990   goto __pyx_L0;
33991   __pyx_L1_error:;
33992   __Pyx_XDECREF(__pyx_t_3);
33993   __Pyx_XDECREF(__pyx_t_8);
33994   __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
33995   __pyx_r = -1;
33996   if (__pyx_v_info->obj != NULL) {
33997     __Pyx_GOTREF(__pyx_v_info->obj);
33998     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
33999   }
34000   goto __pyx_L2;
34001   __pyx_L0:;
34002   if (__pyx_v_info->obj == Py_None) {
34003     __Pyx_GOTREF(__pyx_v_info->obj);
34004     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
34005   }
34006   __pyx_L2:;
34007   __Pyx_XDECREF((PyObject *)__pyx_v_descr);
34008   __Pyx_RefNannyFinishContext();
34009   return __pyx_r;
34010 }
34011 
34012 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":337
34013  *                 f[0] = c'\0' # Terminate format string
34014  *
34015  *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
34016  *             if PyArray_HASFIELDS(self):
34017  *                 PyObject_Free(info.format)
34018  */
34019 
34020 /* Python wrapper */
34021 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
__pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject * __pyx_v_self,Py_buffer * __pyx_v_info)34022 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
34023   __Pyx_RefNannyDeclarations
34024   __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
34025   __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
34026 
34027   /* function exit code */
34028   __Pyx_RefNannyFinishContext();
34029 }
34030 
__pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject * __pyx_v_self,Py_buffer * __pyx_v_info)34031 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
34032   __Pyx_RefNannyDeclarations
34033   int __pyx_t_1;
34034   __Pyx_RefNannySetupContext("__releasebuffer__", 0);
34035 
34036   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":338
34037  *
34038  *         def __releasebuffer__(ndarray self, Py_buffer* info):
34039  *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
34040  *                 PyObject_Free(info.format)
34041  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
34042  */
34043   __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
34044   if (__pyx_t_1) {
34045 
34046     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":339
34047  *         def __releasebuffer__(ndarray self, Py_buffer* info):
34048  *             if PyArray_HASFIELDS(self):
34049  *                 PyObject_Free(info.format)             # <<<<<<<<<<<<<<
34050  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
34051  *                 PyObject_Free(info.strides)
34052  */
34053     PyObject_Free(__pyx_v_info->format);
34054 
34055     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":338
34056  *
34057  *         def __releasebuffer__(ndarray self, Py_buffer* info):
34058  *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
34059  *                 PyObject_Free(info.format)
34060  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
34061  */
34062   }
34063 
34064   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":340
34065  *             if PyArray_HASFIELDS(self):
34066  *                 PyObject_Free(info.format)
34067  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
34068  *                 PyObject_Free(info.strides)
34069  *                 # info.shape was stored after info.strides in the same block
34070  */
34071   __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
34072   if (__pyx_t_1) {
34073 
34074     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":341
34075  *                 PyObject_Free(info.format)
34076  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
34077  *                 PyObject_Free(info.strides)             # <<<<<<<<<<<<<<
34078  *                 # info.shape was stored after info.strides in the same block
34079  *
34080  */
34081     PyObject_Free(__pyx_v_info->strides);
34082 
34083     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":340
34084  *             if PyArray_HASFIELDS(self):
34085  *                 PyObject_Free(info.format)
34086  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
34087  *                 PyObject_Free(info.strides)
34088  *                 # info.shape was stored after info.strides in the same block
34089  */
34090   }
34091 
34092   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":337
34093  *                 f[0] = c'\0' # Terminate format string
34094  *
34095  *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
34096  *             if PyArray_HASFIELDS(self):
34097  *                 PyObject_Free(info.format)
34098  */
34099 
34100   /* function exit code */
34101   __Pyx_RefNannyFinishContext();
34102 }
34103 
34104 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":821
34105  * ctypedef npy_cdouble     complex_t
34106  *
34107  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
34108  *     return PyArray_MultiIterNew(1, <void*>a)
34109  *
34110  */
34111 
__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject * __pyx_v_a)34112 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
34113   PyObject *__pyx_r = NULL;
34114   __Pyx_RefNannyDeclarations
34115   PyObject *__pyx_t_1 = NULL;
34116   __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
34117 
34118   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":822
34119  *
34120  * cdef inline object PyArray_MultiIterNew1(a):
34121  *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
34122  *
34123  * cdef inline object PyArray_MultiIterNew2(a, b):
34124  */
34125   __Pyx_XDECREF(__pyx_r);
34126   __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 822, __pyx_L1_error)
34127   __Pyx_GOTREF(__pyx_t_1);
34128   __pyx_r = __pyx_t_1;
34129   __pyx_t_1 = 0;
34130   goto __pyx_L0;
34131 
34132   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":821
34133  * ctypedef npy_cdouble     complex_t
34134  *
34135  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
34136  *     return PyArray_MultiIterNew(1, <void*>a)
34137  *
34138  */
34139 
34140   /* function exit code */
34141   __pyx_L1_error:;
34142   __Pyx_XDECREF(__pyx_t_1);
34143   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
34144   __pyx_r = 0;
34145   __pyx_L0:;
34146   __Pyx_XGIVEREF(__pyx_r);
34147   __Pyx_RefNannyFinishContext();
34148   return __pyx_r;
34149 }
34150 
34151 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":824
34152  *     return PyArray_MultiIterNew(1, <void*>a)
34153  *
34154  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
34155  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
34156  *
34157  */
34158 
__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject * __pyx_v_a,PyObject * __pyx_v_b)34159 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
34160   PyObject *__pyx_r = NULL;
34161   __Pyx_RefNannyDeclarations
34162   PyObject *__pyx_t_1 = NULL;
34163   __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
34164 
34165   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":825
34166  *
34167  * cdef inline object PyArray_MultiIterNew2(a, b):
34168  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
34169  *
34170  * cdef inline object PyArray_MultiIterNew3(a, b, c):
34171  */
34172   __Pyx_XDECREF(__pyx_r);
34173   __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 825, __pyx_L1_error)
34174   __Pyx_GOTREF(__pyx_t_1);
34175   __pyx_r = __pyx_t_1;
34176   __pyx_t_1 = 0;
34177   goto __pyx_L0;
34178 
34179   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":824
34180  *     return PyArray_MultiIterNew(1, <void*>a)
34181  *
34182  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
34183  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
34184  *
34185  */
34186 
34187   /* function exit code */
34188   __pyx_L1_error:;
34189   __Pyx_XDECREF(__pyx_t_1);
34190   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
34191   __pyx_r = 0;
34192   __pyx_L0:;
34193   __Pyx_XGIVEREF(__pyx_r);
34194   __Pyx_RefNannyFinishContext();
34195   return __pyx_r;
34196 }
34197 
34198 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827
34199  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
34200  *
34201  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
34202  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
34203  *
34204  */
34205 
__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c)34206 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
34207   PyObject *__pyx_r = NULL;
34208   __Pyx_RefNannyDeclarations
34209   PyObject *__pyx_t_1 = NULL;
34210   __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
34211 
34212   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":828
34213  *
34214  * cdef inline object PyArray_MultiIterNew3(a, b, c):
34215  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
34216  *
34217  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
34218  */
34219   __Pyx_XDECREF(__pyx_r);
34220   __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 828, __pyx_L1_error)
34221   __Pyx_GOTREF(__pyx_t_1);
34222   __pyx_r = __pyx_t_1;
34223   __pyx_t_1 = 0;
34224   goto __pyx_L0;
34225 
34226   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827
34227  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
34228  *
34229  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
34230  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
34231  *
34232  */
34233 
34234   /* function exit code */
34235   __pyx_L1_error:;
34236   __Pyx_XDECREF(__pyx_t_1);
34237   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
34238   __pyx_r = 0;
34239   __pyx_L0:;
34240   __Pyx_XGIVEREF(__pyx_r);
34241   __Pyx_RefNannyFinishContext();
34242   return __pyx_r;
34243 }
34244 
34245 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":830
34246  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
34247  *
34248  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
34249  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
34250  *
34251  */
34252 
__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c,PyObject * __pyx_v_d)34253 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) {
34254   PyObject *__pyx_r = NULL;
34255   __Pyx_RefNannyDeclarations
34256   PyObject *__pyx_t_1 = NULL;
34257   __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
34258 
34259   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":831
34260  *
34261  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
34262  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
34263  *
34264  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
34265  */
34266   __Pyx_XDECREF(__pyx_r);
34267   __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 831, __pyx_L1_error)
34268   __Pyx_GOTREF(__pyx_t_1);
34269   __pyx_r = __pyx_t_1;
34270   __pyx_t_1 = 0;
34271   goto __pyx_L0;
34272 
34273   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":830
34274  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
34275  *
34276  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
34277  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
34278  *
34279  */
34280 
34281   /* function exit code */
34282   __pyx_L1_error:;
34283   __Pyx_XDECREF(__pyx_t_1);
34284   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
34285   __pyx_r = 0;
34286   __pyx_L0:;
34287   __Pyx_XGIVEREF(__pyx_r);
34288   __Pyx_RefNannyFinishContext();
34289   return __pyx_r;
34290 }
34291 
34292 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":833
34293  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
34294  *
34295  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
34296  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
34297  *
34298  */
34299 
__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)34300 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) {
34301   PyObject *__pyx_r = NULL;
34302   __Pyx_RefNannyDeclarations
34303   PyObject *__pyx_t_1 = NULL;
34304   __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
34305 
34306   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":834
34307  *
34308  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
34309  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
34310  *
34311  * cdef inline tuple PyDataType_SHAPE(dtype d):
34312  */
34313   __Pyx_XDECREF(__pyx_r);
34314   __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 834, __pyx_L1_error)
34315   __Pyx_GOTREF(__pyx_t_1);
34316   __pyx_r = __pyx_t_1;
34317   __pyx_t_1 = 0;
34318   goto __pyx_L0;
34319 
34320   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":833
34321  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
34322  *
34323  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
34324  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
34325  *
34326  */
34327 
34328   /* function exit code */
34329   __pyx_L1_error:;
34330   __Pyx_XDECREF(__pyx_t_1);
34331   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
34332   __pyx_r = 0;
34333   __pyx_L0:;
34334   __Pyx_XGIVEREF(__pyx_r);
34335   __Pyx_RefNannyFinishContext();
34336   return __pyx_r;
34337 }
34338 
34339 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":836
34340  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
34341  *
34342  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
34343  *     if PyDataType_HASSUBARRAY(d):
34344  *         return <tuple>d.subarray.shape
34345  */
34346 
__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr * __pyx_v_d)34347 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
34348   PyObject *__pyx_r = NULL;
34349   __Pyx_RefNannyDeclarations
34350   int __pyx_t_1;
34351   __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
34352 
34353   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837
34354  *
34355  * cdef inline tuple PyDataType_SHAPE(dtype d):
34356  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
34357  *         return <tuple>d.subarray.shape
34358  *     else:
34359  */
34360   __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
34361   if (__pyx_t_1) {
34362 
34363     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":838
34364  * cdef inline tuple PyDataType_SHAPE(dtype d):
34365  *     if PyDataType_HASSUBARRAY(d):
34366  *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
34367  *     else:
34368  *         return ()
34369  */
34370     __Pyx_XDECREF(__pyx_r);
34371     __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
34372     __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
34373     goto __pyx_L0;
34374 
34375     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837
34376  *
34377  * cdef inline tuple PyDataType_SHAPE(dtype d):
34378  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
34379  *         return <tuple>d.subarray.shape
34380  *     else:
34381  */
34382   }
34383 
34384   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":840
34385  *         return <tuple>d.subarray.shape
34386  *     else:
34387  *         return ()             # <<<<<<<<<<<<<<
34388  *
34389  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
34390  */
34391   /*else*/ {
34392     __Pyx_XDECREF(__pyx_r);
34393     __Pyx_INCREF(__pyx_empty_tuple);
34394     __pyx_r = __pyx_empty_tuple;
34395     goto __pyx_L0;
34396   }
34397 
34398   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":836
34399  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
34400  *
34401  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
34402  *     if PyDataType_HASSUBARRAY(d):
34403  *         return <tuple>d.subarray.shape
34404  */
34405 
34406   /* function exit code */
34407   __pyx_L0:;
34408   __Pyx_XGIVEREF(__pyx_r);
34409   __Pyx_RefNannyFinishContext();
34410   return __pyx_r;
34411 }
34412 
34413 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842
34414  *         return ()
34415  *
34416  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
34417  *     # Recursive utility function used in __getbuffer__ to get format
34418  *     # string. The new location in the format string is returned.
34419  */
34420 
__pyx_f_5numpy__util_dtypestring(PyArray_Descr * __pyx_v_descr,char * __pyx_v_f,char * __pyx_v_end,int * __pyx_v_offset)34421 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) {
34422   PyArray_Descr *__pyx_v_child = 0;
34423   int __pyx_v_endian_detector;
34424   int __pyx_v_little_endian;
34425   PyObject *__pyx_v_fields = 0;
34426   PyObject *__pyx_v_childname = NULL;
34427   PyObject *__pyx_v_new_offset = NULL;
34428   PyObject *__pyx_v_t = NULL;
34429   char *__pyx_r;
34430   __Pyx_RefNannyDeclarations
34431   PyObject *__pyx_t_1 = NULL;
34432   Py_ssize_t __pyx_t_2;
34433   PyObject *__pyx_t_3 = NULL;
34434   PyObject *__pyx_t_4 = NULL;
34435   int __pyx_t_5;
34436   int __pyx_t_6;
34437   int __pyx_t_7;
34438   long __pyx_t_8;
34439   char *__pyx_t_9;
34440   __Pyx_RefNannySetupContext("_util_dtypestring", 0);
34441 
34442   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":847
34443  *
34444  *     cdef dtype child
34445  *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
34446  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
34447  *     cdef tuple fields
34448  */
34449   __pyx_v_endian_detector = 1;
34450 
34451   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":848
34452  *     cdef dtype child
34453  *     cdef int endian_detector = 1
34454  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
34455  *     cdef tuple fields
34456  *
34457  */
34458   __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
34459 
34460   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851
34461  *     cdef tuple fields
34462  *
34463  *     for childname in descr.names:             # <<<<<<<<<<<<<<
34464  *         fields = descr.fields[childname]
34465  *         child, new_offset = fields
34466  */
34467   if (unlikely(__pyx_v_descr->names == Py_None)) {
34468     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
34469     __PYX_ERR(2, 851, __pyx_L1_error)
34470   }
34471   __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
34472   for (;;) {
34473     if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
34474     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
34475     __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(2, 851, __pyx_L1_error)
34476     #else
34477     __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 851, __pyx_L1_error)
34478     __Pyx_GOTREF(__pyx_t_3);
34479     #endif
34480     __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
34481     __pyx_t_3 = 0;
34482 
34483     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":852
34484  *
34485  *     for childname in descr.names:
34486  *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
34487  *         child, new_offset = fields
34488  *
34489  */
34490     if (unlikely(__pyx_v_descr->fields == Py_None)) {
34491       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
34492       __PYX_ERR(2, 852, __pyx_L1_error)
34493     }
34494     __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 852, __pyx_L1_error)
34495     __Pyx_GOTREF(__pyx_t_3);
34496     if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(2, 852, __pyx_L1_error)
34497     __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
34498     __pyx_t_3 = 0;
34499 
34500     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":853
34501  *     for childname in descr.names:
34502  *         fields = descr.fields[childname]
34503  *         child, new_offset = fields             # <<<<<<<<<<<<<<
34504  *
34505  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
34506  */
34507     if (likely(__pyx_v_fields != Py_None)) {
34508       PyObject* sequence = __pyx_v_fields;
34509       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
34510       if (unlikely(size != 2)) {
34511         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
34512         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
34513         __PYX_ERR(2, 853, __pyx_L1_error)
34514       }
34515       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
34516       __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
34517       __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
34518       __Pyx_INCREF(__pyx_t_3);
34519       __Pyx_INCREF(__pyx_t_4);
34520       #else
34521       __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 853, __pyx_L1_error)
34522       __Pyx_GOTREF(__pyx_t_3);
34523       __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 853, __pyx_L1_error)
34524       __Pyx_GOTREF(__pyx_t_4);
34525       #endif
34526     } else {
34527       __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 853, __pyx_L1_error)
34528     }
34529     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(2, 853, __pyx_L1_error)
34530     __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
34531     __pyx_t_3 = 0;
34532     __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
34533     __pyx_t_4 = 0;
34534 
34535     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855
34536  *         child, new_offset = fields
34537  *
34538  *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
34539  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
34540  *
34541  */
34542     __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 855, __pyx_L1_error)
34543     __Pyx_GOTREF(__pyx_t_4);
34544     __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 855, __pyx_L1_error)
34545     __Pyx_GOTREF(__pyx_t_3);
34546     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34547     __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 855, __pyx_L1_error)
34548     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34549     __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
34550     if (unlikely(__pyx_t_6)) {
34551 
34552       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856
34553  *
34554  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
34555  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
34556  *
34557  *         if ((child.byteorder == c'>' and little_endian) or
34558  */
34559       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 856, __pyx_L1_error)
34560       __Pyx_GOTREF(__pyx_t_3);
34561       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
34562       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34563       __PYX_ERR(2, 856, __pyx_L1_error)
34564 
34565       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855
34566  *         child, new_offset = fields
34567  *
34568  *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
34569  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
34570  *
34571  */
34572     }
34573 
34574     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
34575  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
34576  *
34577  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
34578  *             (child.byteorder == c'<' and not little_endian)):
34579  *             raise ValueError(u"Non-native byte order not supported")
34580  */
34581     __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
34582     if (!__pyx_t_7) {
34583       goto __pyx_L8_next_or;
34584     } else {
34585     }
34586     __pyx_t_7 = (__pyx_v_little_endian != 0);
34587     if (!__pyx_t_7) {
34588     } else {
34589       __pyx_t_6 = __pyx_t_7;
34590       goto __pyx_L7_bool_binop_done;
34591     }
34592     __pyx_L8_next_or:;
34593 
34594     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":859
34595  *
34596  *         if ((child.byteorder == c'>' and little_endian) or
34597  *             (child.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
34598  *             raise ValueError(u"Non-native byte order not supported")
34599  *             # One could encode it in the format string and have Cython
34600  */
34601     __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
34602     if (__pyx_t_7) {
34603     } else {
34604       __pyx_t_6 = __pyx_t_7;
34605       goto __pyx_L7_bool_binop_done;
34606     }
34607     __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
34608     __pyx_t_6 = __pyx_t_7;
34609     __pyx_L7_bool_binop_done:;
34610 
34611     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
34612  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
34613  *
34614  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
34615  *             (child.byteorder == c'<' and not little_endian)):
34616  *             raise ValueError(u"Non-native byte order not supported")
34617  */
34618     if (unlikely(__pyx_t_6)) {
34619 
34620       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":860
34621  *         if ((child.byteorder == c'>' and little_endian) or
34622  *             (child.byteorder == c'<' and not little_endian)):
34623  *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
34624  *             # One could encode it in the format string and have Cython
34625  *             # complain instead, BUT: < and > in format strings also imply
34626  */
34627       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 860, __pyx_L1_error)
34628       __Pyx_GOTREF(__pyx_t_3);
34629       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
34630       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34631       __PYX_ERR(2, 860, __pyx_L1_error)
34632 
34633       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
34634  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
34635  *
34636  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
34637  *             (child.byteorder == c'<' and not little_endian)):
34638  *             raise ValueError(u"Non-native byte order not supported")
34639  */
34640     }
34641 
34642     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":870
34643  *
34644  *         # Output padding bytes
34645  *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
34646  *             f[0] = 120 # "x"; pad byte
34647  *             f += 1
34648  */
34649     while (1) {
34650       __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 870, __pyx_L1_error)
34651       __Pyx_GOTREF(__pyx_t_3);
34652       __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 870, __pyx_L1_error)
34653       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34654       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 870, __pyx_L1_error)
34655       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34656       if (!__pyx_t_6) break;
34657 
34658       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":871
34659  *         # Output padding bytes
34660  *         while offset[0] < new_offset:
34661  *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
34662  *             f += 1
34663  *             offset[0] += 1
34664  */
34665       (__pyx_v_f[0]) = 0x78;
34666 
34667       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":872
34668  *         while offset[0] < new_offset:
34669  *             f[0] = 120 # "x"; pad byte
34670  *             f += 1             # <<<<<<<<<<<<<<
34671  *             offset[0] += 1
34672  *
34673  */
34674       __pyx_v_f = (__pyx_v_f + 1);
34675 
34676       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":873
34677  *             f[0] = 120 # "x"; pad byte
34678  *             f += 1
34679  *             offset[0] += 1             # <<<<<<<<<<<<<<
34680  *
34681  *         offset[0] += child.itemsize
34682  */
34683       __pyx_t_8 = 0;
34684       (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
34685     }
34686 
34687     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":875
34688  *             offset[0] += 1
34689  *
34690  *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
34691  *
34692  *         if not PyDataType_HASFIELDS(child):
34693  */
34694     __pyx_t_8 = 0;
34695     (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
34696 
34697     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":877
34698  *         offset[0] += child.itemsize
34699  *
34700  *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
34701  *             t = child.type_num
34702  *             if end - f < 5:
34703  */
34704     __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
34705     if (__pyx_t_6) {
34706 
34707       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":878
34708  *
34709  *         if not PyDataType_HASFIELDS(child):
34710  *             t = child.type_num             # <<<<<<<<<<<<<<
34711  *             if end - f < 5:
34712  *                 raise RuntimeError(u"Format string allocated too short.")
34713  */
34714       __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 878, __pyx_L1_error)
34715       __Pyx_GOTREF(__pyx_t_4);
34716       __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
34717       __pyx_t_4 = 0;
34718 
34719       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":879
34720  *         if not PyDataType_HASFIELDS(child):
34721  *             t = child.type_num
34722  *             if end - f < 5:             # <<<<<<<<<<<<<<
34723  *                 raise RuntimeError(u"Format string allocated too short.")
34724  *
34725  */
34726       __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
34727       if (unlikely(__pyx_t_6)) {
34728 
34729         /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":880
34730  *             t = child.type_num
34731  *             if end - f < 5:
34732  *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
34733  *
34734  *             # Until ticket #99 is fixed, use integers to avoid warnings
34735  */
34736         __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 880, __pyx_L1_error)
34737         __Pyx_GOTREF(__pyx_t_4);
34738         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
34739         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34740         __PYX_ERR(2, 880, __pyx_L1_error)
34741 
34742         /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":879
34743  *         if not PyDataType_HASFIELDS(child):
34744  *             t = child.type_num
34745  *             if end - f < 5:             # <<<<<<<<<<<<<<
34746  *                 raise RuntimeError(u"Format string allocated too short.")
34747  *
34748  */
34749       }
34750 
34751       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":883
34752  *
34753  *             # Until ticket #99 is fixed, use integers to avoid warnings
34754  *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
34755  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
34756  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
34757  */
34758       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 883, __pyx_L1_error)
34759       __Pyx_GOTREF(__pyx_t_4);
34760       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 883, __pyx_L1_error)
34761       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34762       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 883, __pyx_L1_error)
34763       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34764       if (__pyx_t_6) {
34765         (__pyx_v_f[0]) = 98;
34766         goto __pyx_L15;
34767       }
34768 
34769       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":884
34770  *             # Until ticket #99 is fixed, use integers to avoid warnings
34771  *             if   t == NPY_BYTE:        f[0] =  98 #"b"
34772  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
34773  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
34774  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
34775  */
34776       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 884, __pyx_L1_error)
34777       __Pyx_GOTREF(__pyx_t_3);
34778       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 884, __pyx_L1_error)
34779       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34780       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 884, __pyx_L1_error)
34781       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34782       if (__pyx_t_6) {
34783         (__pyx_v_f[0]) = 66;
34784         goto __pyx_L15;
34785       }
34786 
34787       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":885
34788  *             if   t == NPY_BYTE:        f[0] =  98 #"b"
34789  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
34790  *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
34791  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
34792  *             elif t == NPY_INT:         f[0] = 105 #"i"
34793  */
34794       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 885, __pyx_L1_error)
34795       __Pyx_GOTREF(__pyx_t_4);
34796       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 885, __pyx_L1_error)
34797       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34798       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 885, __pyx_L1_error)
34799       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34800       if (__pyx_t_6) {
34801         (__pyx_v_f[0]) = 0x68;
34802         goto __pyx_L15;
34803       }
34804 
34805       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":886
34806  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
34807  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
34808  *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
34809  *             elif t == NPY_INT:         f[0] = 105 #"i"
34810  *             elif t == NPY_UINT:        f[0] =  73 #"I"
34811  */
34812       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 886, __pyx_L1_error)
34813       __Pyx_GOTREF(__pyx_t_3);
34814       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 886, __pyx_L1_error)
34815       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34816       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 886, __pyx_L1_error)
34817       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34818       if (__pyx_t_6) {
34819         (__pyx_v_f[0]) = 72;
34820         goto __pyx_L15;
34821       }
34822 
34823       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":887
34824  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
34825  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
34826  *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
34827  *             elif t == NPY_UINT:        f[0] =  73 #"I"
34828  *             elif t == NPY_LONG:        f[0] = 108 #"l"
34829  */
34830       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 887, __pyx_L1_error)
34831       __Pyx_GOTREF(__pyx_t_4);
34832       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 887, __pyx_L1_error)
34833       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34834       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 887, __pyx_L1_error)
34835       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34836       if (__pyx_t_6) {
34837         (__pyx_v_f[0]) = 0x69;
34838         goto __pyx_L15;
34839       }
34840 
34841       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":888
34842  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
34843  *             elif t == NPY_INT:         f[0] = 105 #"i"
34844  *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
34845  *             elif t == NPY_LONG:        f[0] = 108 #"l"
34846  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
34847  */
34848       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 888, __pyx_L1_error)
34849       __Pyx_GOTREF(__pyx_t_3);
34850       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 888, __pyx_L1_error)
34851       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34852       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 888, __pyx_L1_error)
34853       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34854       if (__pyx_t_6) {
34855         (__pyx_v_f[0]) = 73;
34856         goto __pyx_L15;
34857       }
34858 
34859       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":889
34860  *             elif t == NPY_INT:         f[0] = 105 #"i"
34861  *             elif t == NPY_UINT:        f[0] =  73 #"I"
34862  *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
34863  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
34864  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
34865  */
34866       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 889, __pyx_L1_error)
34867       __Pyx_GOTREF(__pyx_t_4);
34868       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 889, __pyx_L1_error)
34869       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34870       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 889, __pyx_L1_error)
34871       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34872       if (__pyx_t_6) {
34873         (__pyx_v_f[0]) = 0x6C;
34874         goto __pyx_L15;
34875       }
34876 
34877       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":890
34878  *             elif t == NPY_UINT:        f[0] =  73 #"I"
34879  *             elif t == NPY_LONG:        f[0] = 108 #"l"
34880  *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
34881  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
34882  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
34883  */
34884       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 890, __pyx_L1_error)
34885       __Pyx_GOTREF(__pyx_t_3);
34886       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 890, __pyx_L1_error)
34887       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34888       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 890, __pyx_L1_error)
34889       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34890       if (__pyx_t_6) {
34891         (__pyx_v_f[0]) = 76;
34892         goto __pyx_L15;
34893       }
34894 
34895       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":891
34896  *             elif t == NPY_LONG:        f[0] = 108 #"l"
34897  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
34898  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
34899  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
34900  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
34901  */
34902       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 891, __pyx_L1_error)
34903       __Pyx_GOTREF(__pyx_t_4);
34904       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 891, __pyx_L1_error)
34905       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34906       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 891, __pyx_L1_error)
34907       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34908       if (__pyx_t_6) {
34909         (__pyx_v_f[0]) = 0x71;
34910         goto __pyx_L15;
34911       }
34912 
34913       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":892
34914  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
34915  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
34916  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
34917  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
34918  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
34919  */
34920       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 892, __pyx_L1_error)
34921       __Pyx_GOTREF(__pyx_t_3);
34922       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 892, __pyx_L1_error)
34923       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34924       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 892, __pyx_L1_error)
34925       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34926       if (__pyx_t_6) {
34927         (__pyx_v_f[0]) = 81;
34928         goto __pyx_L15;
34929       }
34930 
34931       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":893
34932  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
34933  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
34934  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
34935  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
34936  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
34937  */
34938       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 893, __pyx_L1_error)
34939       __Pyx_GOTREF(__pyx_t_4);
34940       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 893, __pyx_L1_error)
34941       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34942       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 893, __pyx_L1_error)
34943       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34944       if (__pyx_t_6) {
34945         (__pyx_v_f[0]) = 0x66;
34946         goto __pyx_L15;
34947       }
34948 
34949       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":894
34950  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
34951  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
34952  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
34953  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
34954  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
34955  */
34956       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 894, __pyx_L1_error)
34957       __Pyx_GOTREF(__pyx_t_3);
34958       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 894, __pyx_L1_error)
34959       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34960       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 894, __pyx_L1_error)
34961       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34962       if (__pyx_t_6) {
34963         (__pyx_v_f[0]) = 0x64;
34964         goto __pyx_L15;
34965       }
34966 
34967       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":895
34968  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
34969  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
34970  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
34971  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
34972  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
34973  */
34974       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 895, __pyx_L1_error)
34975       __Pyx_GOTREF(__pyx_t_4);
34976       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 895, __pyx_L1_error)
34977       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34978       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 895, __pyx_L1_error)
34979       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34980       if (__pyx_t_6) {
34981         (__pyx_v_f[0]) = 0x67;
34982         goto __pyx_L15;
34983       }
34984 
34985       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":896
34986  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
34987  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
34988  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
34989  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
34990  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
34991  */
34992       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 896, __pyx_L1_error)
34993       __Pyx_GOTREF(__pyx_t_3);
34994       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 896, __pyx_L1_error)
34995       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34996       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 896, __pyx_L1_error)
34997       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34998       if (__pyx_t_6) {
34999         (__pyx_v_f[0]) = 90;
35000         (__pyx_v_f[1]) = 0x66;
35001         __pyx_v_f = (__pyx_v_f + 1);
35002         goto __pyx_L15;
35003       }
35004 
35005       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":897
35006  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
35007  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
35008  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
35009  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
35010  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
35011  */
35012       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 897, __pyx_L1_error)
35013       __Pyx_GOTREF(__pyx_t_4);
35014       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 897, __pyx_L1_error)
35015       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
35016       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 897, __pyx_L1_error)
35017       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
35018       if (__pyx_t_6) {
35019         (__pyx_v_f[0]) = 90;
35020         (__pyx_v_f[1]) = 0x64;
35021         __pyx_v_f = (__pyx_v_f + 1);
35022         goto __pyx_L15;
35023       }
35024 
35025       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":898
35026  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
35027  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
35028  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
35029  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
35030  *             else:
35031  */
35032       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 898, __pyx_L1_error)
35033       __Pyx_GOTREF(__pyx_t_3);
35034       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 898, __pyx_L1_error)
35035       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
35036       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 898, __pyx_L1_error)
35037       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
35038       if (__pyx_t_6) {
35039         (__pyx_v_f[0]) = 90;
35040         (__pyx_v_f[1]) = 0x67;
35041         __pyx_v_f = (__pyx_v_f + 1);
35042         goto __pyx_L15;
35043       }
35044 
35045       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":899
35046  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
35047  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
35048  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
35049  *             else:
35050  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
35051  */
35052       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 899, __pyx_L1_error)
35053       __Pyx_GOTREF(__pyx_t_4);
35054       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 899, __pyx_L1_error)
35055       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
35056       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 899, __pyx_L1_error)
35057       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
35058       if (likely(__pyx_t_6)) {
35059         (__pyx_v_f[0]) = 79;
35060         goto __pyx_L15;
35061       }
35062 
35063       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":901
35064  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
35065  *             else:
35066  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
35067  *             f += 1
35068  *         else:
35069  */
35070       /*else*/ {
35071         __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 901, __pyx_L1_error)
35072         __Pyx_GOTREF(__pyx_t_3);
35073         __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 901, __pyx_L1_error)
35074         __Pyx_GOTREF(__pyx_t_4);
35075         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
35076         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
35077         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
35078         __PYX_ERR(2, 901, __pyx_L1_error)
35079       }
35080       __pyx_L15:;
35081 
35082       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":902
35083  *             else:
35084  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
35085  *             f += 1             # <<<<<<<<<<<<<<
35086  *         else:
35087  *             # Cython ignores struct boundary information ("T{...}"),
35088  */
35089       __pyx_v_f = (__pyx_v_f + 1);
35090 
35091       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":877
35092  *         offset[0] += child.itemsize
35093  *
35094  *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
35095  *             t = child.type_num
35096  *             if end - f < 5:
35097  */
35098       goto __pyx_L13;
35099     }
35100 
35101     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":906
35102  *             # Cython ignores struct boundary information ("T{...}"),
35103  *             # so don't output it
35104  *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
35105  *     return f
35106  *
35107  */
35108     /*else*/ {
35109       __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(2, 906, __pyx_L1_error)
35110       __pyx_v_f = __pyx_t_9;
35111     }
35112     __pyx_L13:;
35113 
35114     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851
35115  *     cdef tuple fields
35116  *
35117  *     for childname in descr.names:             # <<<<<<<<<<<<<<
35118  *         fields = descr.fields[childname]
35119  *         child, new_offset = fields
35120  */
35121   }
35122   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
35123 
35124   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":907
35125  *             # so don't output it
35126  *             f = _util_dtypestring(child, f, end, offset)
35127  *     return f             # <<<<<<<<<<<<<<
35128  *
35129  *
35130  */
35131   __pyx_r = __pyx_v_f;
35132   goto __pyx_L0;
35133 
35134   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842
35135  *         return ()
35136  *
35137  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
35138  *     # Recursive utility function used in __getbuffer__ to get format
35139  *     # string. The new location in the format string is returned.
35140  */
35141 
35142   /* function exit code */
35143   __pyx_L1_error:;
35144   __Pyx_XDECREF(__pyx_t_1);
35145   __Pyx_XDECREF(__pyx_t_3);
35146   __Pyx_XDECREF(__pyx_t_4);
35147   __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
35148   __pyx_r = NULL;
35149   __pyx_L0:;
35150   __Pyx_XDECREF((PyObject *)__pyx_v_child);
35151   __Pyx_XDECREF(__pyx_v_fields);
35152   __Pyx_XDECREF(__pyx_v_childname);
35153   __Pyx_XDECREF(__pyx_v_new_offset);
35154   __Pyx_XDECREF(__pyx_v_t);
35155   __Pyx_RefNannyFinishContext();
35156   return __pyx_r;
35157 }
35158 
35159 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022
35160  *     int _import_umath() except -1
35161  *
35162  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
35163  *     Py_INCREF(base) # important to do this before stealing the reference below!
35164  *     PyArray_SetBaseObject(arr, base)
35165  */
35166 
__pyx_f_5numpy_set_array_base(PyArrayObject * __pyx_v_arr,PyObject * __pyx_v_base)35167 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
35168   __Pyx_RefNannyDeclarations
35169   __Pyx_RefNannySetupContext("set_array_base", 0);
35170 
35171   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1023
35172  *
35173  * cdef inline void set_array_base(ndarray arr, object base):
35174  *     Py_INCREF(base) # important to do this before stealing the reference below!             # <<<<<<<<<<<<<<
35175  *     PyArray_SetBaseObject(arr, base)
35176  *
35177  */
35178   Py_INCREF(__pyx_v_base);
35179 
35180   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1024
35181  * cdef inline void set_array_base(ndarray arr, object base):
35182  *     Py_INCREF(base) # important to do this before stealing the reference below!
35183  *     PyArray_SetBaseObject(arr, base)             # <<<<<<<<<<<<<<
35184  *
35185  * cdef inline object get_array_base(ndarray arr):
35186  */
35187   (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
35188 
35189   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022
35190  *     int _import_umath() except -1
35191  *
35192  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
35193  *     Py_INCREF(base) # important to do this before stealing the reference below!
35194  *     PyArray_SetBaseObject(arr, base)
35195  */
35196 
35197   /* function exit code */
35198   __Pyx_RefNannyFinishContext();
35199 }
35200 
35201 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1026
35202  *     PyArray_SetBaseObject(arr, base)
35203  *
35204  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
35205  *     base = PyArray_BASE(arr)
35206  *     if base is NULL:
35207  */
35208 
__pyx_f_5numpy_get_array_base(PyArrayObject * __pyx_v_arr)35209 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
35210   PyObject *__pyx_v_base;
35211   PyObject *__pyx_r = NULL;
35212   __Pyx_RefNannyDeclarations
35213   int __pyx_t_1;
35214   __Pyx_RefNannySetupContext("get_array_base", 0);
35215 
35216   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1027
35217  *
35218  * cdef inline object get_array_base(ndarray arr):
35219  *     base = PyArray_BASE(arr)             # <<<<<<<<<<<<<<
35220  *     if base is NULL:
35221  *         return None
35222  */
35223   __pyx_v_base = PyArray_BASE(__pyx_v_arr);
35224 
35225   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1028
35226  * cdef inline object get_array_base(ndarray arr):
35227  *     base = PyArray_BASE(arr)
35228  *     if base is NULL:             # <<<<<<<<<<<<<<
35229  *         return None
35230  *     return <object>base
35231  */
35232   __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
35233   if (__pyx_t_1) {
35234 
35235     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1029
35236  *     base = PyArray_BASE(arr)
35237  *     if base is NULL:
35238  *         return None             # <<<<<<<<<<<<<<
35239  *     return <object>base
35240  *
35241  */
35242     __Pyx_XDECREF(__pyx_r);
35243     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
35244     goto __pyx_L0;
35245 
35246     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1028
35247  * cdef inline object get_array_base(ndarray arr):
35248  *     base = PyArray_BASE(arr)
35249  *     if base is NULL:             # <<<<<<<<<<<<<<
35250  *         return None
35251  *     return <object>base
35252  */
35253   }
35254 
35255   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1030
35256  *     if base is NULL:
35257  *         return None
35258  *     return <object>base             # <<<<<<<<<<<<<<
35259  *
35260  * # Versions of the import_* functions which are more suitable for
35261  */
35262   __Pyx_XDECREF(__pyx_r);
35263   __Pyx_INCREF(((PyObject *)__pyx_v_base));
35264   __pyx_r = ((PyObject *)__pyx_v_base);
35265   goto __pyx_L0;
35266 
35267   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1026
35268  *     PyArray_SetBaseObject(arr, base)
35269  *
35270  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
35271  *     base = PyArray_BASE(arr)
35272  *     if base is NULL:
35273  */
35274 
35275   /* function exit code */
35276   __pyx_L0:;
35277   __Pyx_XGIVEREF(__pyx_r);
35278   __Pyx_RefNannyFinishContext();
35279   return __pyx_r;
35280 }
35281 
35282 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1034
35283  * # Versions of the import_* functions which are more suitable for
35284  * # Cython code.
35285  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
35286  *     try:
35287  *         _import_array()
35288  */
35289 
__pyx_f_5numpy_import_array(void)35290 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
35291   int __pyx_r;
35292   __Pyx_RefNannyDeclarations
35293   PyObject *__pyx_t_1 = NULL;
35294   PyObject *__pyx_t_2 = NULL;
35295   PyObject *__pyx_t_3 = NULL;
35296   int __pyx_t_4;
35297   PyObject *__pyx_t_5 = NULL;
35298   PyObject *__pyx_t_6 = NULL;
35299   PyObject *__pyx_t_7 = NULL;
35300   PyObject *__pyx_t_8 = NULL;
35301   __Pyx_RefNannySetupContext("import_array", 0);
35302 
35303   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
35304  * # Cython code.
35305  * cdef inline int import_array() except -1:
35306  *     try:             # <<<<<<<<<<<<<<
35307  *         _import_array()
35308  *     except Exception:
35309  */
35310   {
35311     __Pyx_PyThreadState_declare
35312     __Pyx_PyThreadState_assign
35313     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
35314     __Pyx_XGOTREF(__pyx_t_1);
35315     __Pyx_XGOTREF(__pyx_t_2);
35316     __Pyx_XGOTREF(__pyx_t_3);
35317     /*try:*/ {
35318 
35319       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1036
35320  * cdef inline int import_array() except -1:
35321  *     try:
35322  *         _import_array()             # <<<<<<<<<<<<<<
35323  *     except Exception:
35324  *         raise ImportError("numpy.core.multiarray failed to import")
35325  */
35326       __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1036, __pyx_L3_error)
35327 
35328       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
35329  * # Cython code.
35330  * cdef inline int import_array() except -1:
35331  *     try:             # <<<<<<<<<<<<<<
35332  *         _import_array()
35333  *     except Exception:
35334  */
35335     }
35336     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
35337     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
35338     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
35339     goto __pyx_L8_try_end;
35340     __pyx_L3_error:;
35341 
35342     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1037
35343  *     try:
35344  *         _import_array()
35345  *     except Exception:             # <<<<<<<<<<<<<<
35346  *         raise ImportError("numpy.core.multiarray failed to import")
35347  *
35348  */
35349     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
35350     if (__pyx_t_4) {
35351       __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
35352       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1037, __pyx_L5_except_error)
35353       __Pyx_GOTREF(__pyx_t_5);
35354       __Pyx_GOTREF(__pyx_t_6);
35355       __Pyx_GOTREF(__pyx_t_7);
35356 
35357       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1038
35358  *         _import_array()
35359  *     except Exception:
35360  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
35361  *
35362  * cdef inline int import_umath() except -1:
35363  */
35364       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1038, __pyx_L5_except_error)
35365       __Pyx_GOTREF(__pyx_t_8);
35366       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
35367       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
35368       __PYX_ERR(2, 1038, __pyx_L5_except_error)
35369     }
35370     goto __pyx_L5_except_error;
35371     __pyx_L5_except_error:;
35372 
35373     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
35374  * # Cython code.
35375  * cdef inline int import_array() except -1:
35376  *     try:             # <<<<<<<<<<<<<<
35377  *         _import_array()
35378  *     except Exception:
35379  */
35380     __Pyx_XGIVEREF(__pyx_t_1);
35381     __Pyx_XGIVEREF(__pyx_t_2);
35382     __Pyx_XGIVEREF(__pyx_t_3);
35383     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
35384     goto __pyx_L1_error;
35385     __pyx_L8_try_end:;
35386   }
35387 
35388   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1034
35389  * # Versions of the import_* functions which are more suitable for
35390  * # Cython code.
35391  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
35392  *     try:
35393  *         _import_array()
35394  */
35395 
35396   /* function exit code */
35397   __pyx_r = 0;
35398   goto __pyx_L0;
35399   __pyx_L1_error:;
35400   __Pyx_XDECREF(__pyx_t_5);
35401   __Pyx_XDECREF(__pyx_t_6);
35402   __Pyx_XDECREF(__pyx_t_7);
35403   __Pyx_XDECREF(__pyx_t_8);
35404   __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
35405   __pyx_r = -1;
35406   __pyx_L0:;
35407   __Pyx_RefNannyFinishContext();
35408   return __pyx_r;
35409 }
35410 
35411 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1040
35412  *         raise ImportError("numpy.core.multiarray failed to import")
35413  *
35414  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
35415  *     try:
35416  *         _import_umath()
35417  */
35418 
__pyx_f_5numpy_import_umath(void)35419 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
35420   int __pyx_r;
35421   __Pyx_RefNannyDeclarations
35422   PyObject *__pyx_t_1 = NULL;
35423   PyObject *__pyx_t_2 = NULL;
35424   PyObject *__pyx_t_3 = NULL;
35425   int __pyx_t_4;
35426   PyObject *__pyx_t_5 = NULL;
35427   PyObject *__pyx_t_6 = NULL;
35428   PyObject *__pyx_t_7 = NULL;
35429   PyObject *__pyx_t_8 = NULL;
35430   __Pyx_RefNannySetupContext("import_umath", 0);
35431 
35432   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
35433  *
35434  * cdef inline int import_umath() except -1:
35435  *     try:             # <<<<<<<<<<<<<<
35436  *         _import_umath()
35437  *     except Exception:
35438  */
35439   {
35440     __Pyx_PyThreadState_declare
35441     __Pyx_PyThreadState_assign
35442     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
35443     __Pyx_XGOTREF(__pyx_t_1);
35444     __Pyx_XGOTREF(__pyx_t_2);
35445     __Pyx_XGOTREF(__pyx_t_3);
35446     /*try:*/ {
35447 
35448       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1042
35449  * cdef inline int import_umath() except -1:
35450  *     try:
35451  *         _import_umath()             # <<<<<<<<<<<<<<
35452  *     except Exception:
35453  *         raise ImportError("numpy.core.umath failed to import")
35454  */
35455       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1042, __pyx_L3_error)
35456 
35457       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
35458  *
35459  * cdef inline int import_umath() except -1:
35460  *     try:             # <<<<<<<<<<<<<<
35461  *         _import_umath()
35462  *     except Exception:
35463  */
35464     }
35465     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
35466     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
35467     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
35468     goto __pyx_L8_try_end;
35469     __pyx_L3_error:;
35470 
35471     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1043
35472  *     try:
35473  *         _import_umath()
35474  *     except Exception:             # <<<<<<<<<<<<<<
35475  *         raise ImportError("numpy.core.umath failed to import")
35476  *
35477  */
35478     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
35479     if (__pyx_t_4) {
35480       __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
35481       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1043, __pyx_L5_except_error)
35482       __Pyx_GOTREF(__pyx_t_5);
35483       __Pyx_GOTREF(__pyx_t_6);
35484       __Pyx_GOTREF(__pyx_t_7);
35485 
35486       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1044
35487  *         _import_umath()
35488  *     except Exception:
35489  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
35490  *
35491  * cdef inline int import_ufunc() except -1:
35492  */
35493       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1044, __pyx_L5_except_error)
35494       __Pyx_GOTREF(__pyx_t_8);
35495       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
35496       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
35497       __PYX_ERR(2, 1044, __pyx_L5_except_error)
35498     }
35499     goto __pyx_L5_except_error;
35500     __pyx_L5_except_error:;
35501 
35502     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
35503  *
35504  * cdef inline int import_umath() except -1:
35505  *     try:             # <<<<<<<<<<<<<<
35506  *         _import_umath()
35507  *     except Exception:
35508  */
35509     __Pyx_XGIVEREF(__pyx_t_1);
35510     __Pyx_XGIVEREF(__pyx_t_2);
35511     __Pyx_XGIVEREF(__pyx_t_3);
35512     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
35513     goto __pyx_L1_error;
35514     __pyx_L8_try_end:;
35515   }
35516 
35517   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1040
35518  *         raise ImportError("numpy.core.multiarray failed to import")
35519  *
35520  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
35521  *     try:
35522  *         _import_umath()
35523  */
35524 
35525   /* function exit code */
35526   __pyx_r = 0;
35527   goto __pyx_L0;
35528   __pyx_L1_error:;
35529   __Pyx_XDECREF(__pyx_t_5);
35530   __Pyx_XDECREF(__pyx_t_6);
35531   __Pyx_XDECREF(__pyx_t_7);
35532   __Pyx_XDECREF(__pyx_t_8);
35533   __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
35534   __pyx_r = -1;
35535   __pyx_L0:;
35536   __Pyx_RefNannyFinishContext();
35537   return __pyx_r;
35538 }
35539 
35540 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046
35541  *         raise ImportError("numpy.core.umath failed to import")
35542  *
35543  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
35544  *     try:
35545  *         _import_umath()
35546  */
35547 
__pyx_f_5numpy_import_ufunc(void)35548 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
35549   int __pyx_r;
35550   __Pyx_RefNannyDeclarations
35551   PyObject *__pyx_t_1 = NULL;
35552   PyObject *__pyx_t_2 = NULL;
35553   PyObject *__pyx_t_3 = NULL;
35554   int __pyx_t_4;
35555   PyObject *__pyx_t_5 = NULL;
35556   PyObject *__pyx_t_6 = NULL;
35557   PyObject *__pyx_t_7 = NULL;
35558   PyObject *__pyx_t_8 = NULL;
35559   __Pyx_RefNannySetupContext("import_ufunc", 0);
35560 
35561   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
35562  *
35563  * cdef inline int import_ufunc() except -1:
35564  *     try:             # <<<<<<<<<<<<<<
35565  *         _import_umath()
35566  *     except Exception:
35567  */
35568   {
35569     __Pyx_PyThreadState_declare
35570     __Pyx_PyThreadState_assign
35571     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
35572     __Pyx_XGOTREF(__pyx_t_1);
35573     __Pyx_XGOTREF(__pyx_t_2);
35574     __Pyx_XGOTREF(__pyx_t_3);
35575     /*try:*/ {
35576 
35577       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1048
35578  * cdef inline int import_ufunc() except -1:
35579  *     try:
35580  *         _import_umath()             # <<<<<<<<<<<<<<
35581  *     except Exception:
35582  *         raise ImportError("numpy.core.umath failed to import")
35583  */
35584       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1048, __pyx_L3_error)
35585 
35586       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
35587  *
35588  * cdef inline int import_ufunc() except -1:
35589  *     try:             # <<<<<<<<<<<<<<
35590  *         _import_umath()
35591  *     except Exception:
35592  */
35593     }
35594     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
35595     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
35596     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
35597     goto __pyx_L8_try_end;
35598     __pyx_L3_error:;
35599 
35600     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1049
35601  *     try:
35602  *         _import_umath()
35603  *     except Exception:             # <<<<<<<<<<<<<<
35604  *         raise ImportError("numpy.core.umath failed to import")
35605  */
35606     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
35607     if (__pyx_t_4) {
35608       __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
35609       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 1049, __pyx_L5_except_error)
35610       __Pyx_GOTREF(__pyx_t_5);
35611       __Pyx_GOTREF(__pyx_t_6);
35612       __Pyx_GOTREF(__pyx_t_7);
35613 
35614       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1050
35615  *         _import_umath()
35616  *     except Exception:
35617  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
35618  */
35619       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 1050, __pyx_L5_except_error)
35620       __Pyx_GOTREF(__pyx_t_8);
35621       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
35622       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
35623       __PYX_ERR(2, 1050, __pyx_L5_except_error)
35624     }
35625     goto __pyx_L5_except_error;
35626     __pyx_L5_except_error:;
35627 
35628     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
35629  *
35630  * cdef inline int import_ufunc() except -1:
35631  *     try:             # <<<<<<<<<<<<<<
35632  *         _import_umath()
35633  *     except Exception:
35634  */
35635     __Pyx_XGIVEREF(__pyx_t_1);
35636     __Pyx_XGIVEREF(__pyx_t_2);
35637     __Pyx_XGIVEREF(__pyx_t_3);
35638     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
35639     goto __pyx_L1_error;
35640     __pyx_L8_try_end:;
35641   }
35642 
35643   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046
35644  *         raise ImportError("numpy.core.umath failed to import")
35645  *
35646  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
35647  *     try:
35648  *         _import_umath()
35649  */
35650 
35651   /* function exit code */
35652   __pyx_r = 0;
35653   goto __pyx_L0;
35654   __pyx_L1_error:;
35655   __Pyx_XDECREF(__pyx_t_5);
35656   __Pyx_XDECREF(__pyx_t_6);
35657   __Pyx_XDECREF(__pyx_t_7);
35658   __Pyx_XDECREF(__pyx_t_8);
35659   __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
35660   __pyx_r = -1;
35661   __pyx_L0:;
35662   __Pyx_RefNannyFinishContext();
35663   return __pyx_r;
35664 }
35665 
35666 /* "yt/utilities/lib/geometry_utils.pxd":24
35667  * @cython.boundscheck(False)
35668  * @cython.wraparound(False)
35669  * cdef inline np.int64_t ifrexp(np.float64_t x, np.int64_t *e):             # <<<<<<<<<<<<<<
35670  *     cdef np.float64_t m
35671  *     cdef int e0 = 0
35672  */
35673 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_ifrexp(__pyx_t_5numpy_float64_t __pyx_v_x,__pyx_t_5numpy_int64_t * __pyx_v_e)35674 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_ifrexp(__pyx_t_5numpy_float64_t __pyx_v_x, __pyx_t_5numpy_int64_t *__pyx_v_e) {
35675   __pyx_t_5numpy_float64_t __pyx_v_m;
35676   int __pyx_v_e0;
35677   __pyx_t_5numpy_int64_t __pyx_r;
35678   __Pyx_RefNannyDeclarations
35679   __Pyx_RefNannySetupContext("ifrexp", 0);
35680 
35681   /* "yt/utilities/lib/geometry_utils.pxd":26
35682  * cdef inline np.int64_t ifrexp(np.float64_t x, np.int64_t *e):
35683  *     cdef np.float64_t m
35684  *     cdef int e0 = 0             # <<<<<<<<<<<<<<
35685  *     m = frexp(x,&e0)
35686  *     e[0] = <np.int64_t>e0
35687  */
35688   __pyx_v_e0 = 0;
35689 
35690   /* "yt/utilities/lib/geometry_utils.pxd":27
35691  *     cdef np.float64_t m
35692  *     cdef int e0 = 0
35693  *     m = frexp(x,&e0)             # <<<<<<<<<<<<<<
35694  *     e[0] = <np.int64_t>e0
35695  *     return <np.int64_t>ldexp(m,<int>DBL_MANT_DIG)
35696  */
35697   __pyx_v_m = frexp(__pyx_v_x, (&__pyx_v_e0));
35698 
35699   /* "yt/utilities/lib/geometry_utils.pxd":28
35700  *     cdef int e0 = 0
35701  *     m = frexp(x,&e0)
35702  *     e[0] = <np.int64_t>e0             # <<<<<<<<<<<<<<
35703  *     return <np.int64_t>ldexp(m,<int>DBL_MANT_DIG)
35704  *
35705  */
35706   (__pyx_v_e[0]) = ((__pyx_t_5numpy_int64_t)__pyx_v_e0);
35707 
35708   /* "yt/utilities/lib/geometry_utils.pxd":29
35709  *     m = frexp(x,&e0)
35710  *     e[0] = <np.int64_t>e0
35711  *     return <np.int64_t>ldexp(m,<int>DBL_MANT_DIG)             # <<<<<<<<<<<<<<
35712  *
35713  * @cython.cdivision(True)
35714  */
35715   __pyx_r = ((__pyx_t_5numpy_int64_t)ldexp(__pyx_v_m, ((int)DBL_MANT_DIG)));
35716   goto __pyx_L0;
35717 
35718   /* "yt/utilities/lib/geometry_utils.pxd":24
35719  * @cython.boundscheck(False)
35720  * @cython.wraparound(False)
35721  * cdef inline np.int64_t ifrexp(np.float64_t x, np.int64_t *e):             # <<<<<<<<<<<<<<
35722  *     cdef np.float64_t m
35723  *     cdef int e0 = 0
35724  */
35725 
35726   /* function exit code */
35727   __pyx_L0:;
35728   __Pyx_RefNannyFinishContext();
35729   return __pyx_r;
35730 }
35731 
35732 /* "yt/utilities/lib/geometry_utils.pxd":34
35733  * @cython.boundscheck(False)
35734  * @cython.wraparound(False)
35735  * cdef inline np.int64_t msdb(np.int64_t a, np.int64_t b):             # <<<<<<<<<<<<<<
35736  *     """Get the most significant differing bit between a and b."""
35737  *     cdef np.int64_t c, ndx
35738  */
35739 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_msdb(__pyx_t_5numpy_int64_t __pyx_v_a,__pyx_t_5numpy_int64_t __pyx_v_b)35740 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_msdb(__pyx_t_5numpy_int64_t __pyx_v_a, __pyx_t_5numpy_int64_t __pyx_v_b) {
35741   __pyx_t_5numpy_int64_t __pyx_v_c;
35742   __pyx_t_5numpy_int64_t __pyx_v_ndx;
35743   __pyx_t_5numpy_int64_t __pyx_r;
35744   __Pyx_RefNannyDeclarations
35745   int __pyx_t_1;
35746   __Pyx_RefNannySetupContext("msdb", 0);
35747 
35748   /* "yt/utilities/lib/geometry_utils.pxd":37
35749  *     """Get the most significant differing bit between a and b."""
35750  *     cdef np.int64_t c, ndx
35751  *     c = a ^ b             # <<<<<<<<<<<<<<
35752  *     ndx = 0
35753  *     while (0 < c):
35754  */
35755   __pyx_v_c = (__pyx_v_a ^ __pyx_v_b);
35756 
35757   /* "yt/utilities/lib/geometry_utils.pxd":38
35758  *     cdef np.int64_t c, ndx
35759  *     c = a ^ b
35760  *     ndx = 0             # <<<<<<<<<<<<<<
35761  *     while (0 < c):
35762  *         c = (c >> 1)
35763  */
35764   __pyx_v_ndx = 0;
35765 
35766   /* "yt/utilities/lib/geometry_utils.pxd":39
35767  *     c = a ^ b
35768  *     ndx = 0
35769  *     while (0 < c):             # <<<<<<<<<<<<<<
35770  *         c = (c >> 1)
35771  *         ndx+=1
35772  */
35773   while (1) {
35774     __pyx_t_1 = ((0 < __pyx_v_c) != 0);
35775     if (!__pyx_t_1) break;
35776 
35777     /* "yt/utilities/lib/geometry_utils.pxd":40
35778  *     ndx = 0
35779  *     while (0 < c):
35780  *         c = (c >> 1)             # <<<<<<<<<<<<<<
35781  *         ndx+=1
35782  *     return ndx
35783  */
35784     __pyx_v_c = (__pyx_v_c >> 1);
35785 
35786     /* "yt/utilities/lib/geometry_utils.pxd":41
35787  *     while (0 < c):
35788  *         c = (c >> 1)
35789  *         ndx+=1             # <<<<<<<<<<<<<<
35790  *     return ndx
35791  *
35792  */
35793     __pyx_v_ndx = (__pyx_v_ndx + 1);
35794   }
35795 
35796   /* "yt/utilities/lib/geometry_utils.pxd":42
35797  *         c = (c >> 1)
35798  *         ndx+=1
35799  *     return ndx             # <<<<<<<<<<<<<<
35800  *
35801  * @cython.cdivision(True)
35802  */
35803   __pyx_r = __pyx_v_ndx;
35804   goto __pyx_L0;
35805 
35806   /* "yt/utilities/lib/geometry_utils.pxd":34
35807  * @cython.boundscheck(False)
35808  * @cython.wraparound(False)
35809  * cdef inline np.int64_t msdb(np.int64_t a, np.int64_t b):             # <<<<<<<<<<<<<<
35810  *     """Get the most significant differing bit between a and b."""
35811  *     cdef np.int64_t c, ndx
35812  */
35813 
35814   /* function exit code */
35815   __pyx_L0:;
35816   __Pyx_RefNannyFinishContext();
35817   return __pyx_r;
35818 }
35819 
35820 /* "yt/utilities/lib/geometry_utils.pxd":47
35821  * @cython.boundscheck(False)
35822  * @cython.wraparound(False)
35823  * cdef inline np.int64_t xor_msb(np.float64_t a, np.float64_t b):             # <<<<<<<<<<<<<<
35824  *     """Get the exponent of the highest differing bit between a and b"""
35825  *     # Get mantissa and exponents for each number
35826  */
35827 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_xor_msb(__pyx_t_5numpy_float64_t __pyx_v_a,__pyx_t_5numpy_float64_t __pyx_v_b)35828 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_xor_msb(__pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) {
35829   __pyx_t_5numpy_int64_t __pyx_v_a_m;
35830   __pyx_t_5numpy_int64_t __pyx_v_a_e;
35831   __pyx_t_5numpy_int64_t __pyx_v_b_m;
35832   __pyx_t_5numpy_int64_t __pyx_v_b_e;
35833   __pyx_t_5numpy_int64_t __pyx_v_x;
35834   __pyx_t_5numpy_int64_t __pyx_v_y;
35835   __pyx_t_5numpy_int64_t __pyx_v_z;
35836   __pyx_t_5numpy_int64_t __pyx_r;
35837   __Pyx_RefNannyDeclarations
35838   int __pyx_t_1;
35839   __Pyx_RefNannySetupContext("xor_msb", 0);
35840 
35841   /* "yt/utilities/lib/geometry_utils.pxd":51
35842  *     # Get mantissa and exponents for each number
35843  *     cdef np.int64_t a_m, a_e, b_m, b_e, x, y, z
35844  *     b_e = 0             # <<<<<<<<<<<<<<
35845  *     a_e = 0
35846  *     a_m = ifrexp(a,&a_e)
35847  */
35848   __pyx_v_b_e = 0;
35849 
35850   /* "yt/utilities/lib/geometry_utils.pxd":52
35851  *     cdef np.int64_t a_m, a_e, b_m, b_e, x, y, z
35852  *     b_e = 0
35853  *     a_e = 0             # <<<<<<<<<<<<<<
35854  *     a_m = ifrexp(a,&a_e)
35855  *     b_m = ifrexp(b,&b_e)
35856  */
35857   __pyx_v_a_e = 0;
35858 
35859   /* "yt/utilities/lib/geometry_utils.pxd":53
35860  *     b_e = 0
35861  *     a_e = 0
35862  *     a_m = ifrexp(a,&a_e)             # <<<<<<<<<<<<<<
35863  *     b_m = ifrexp(b,&b_e)
35864  *     x = <np.int64_t> ((a_e+1)*DBL_MANT_DIG)
35865  */
35866   __pyx_v_a_m = __pyx_f_2yt_9utilities_3lib_14geometry_utils_ifrexp(__pyx_v_a, (&__pyx_v_a_e));
35867 
35868   /* "yt/utilities/lib/geometry_utils.pxd":54
35869  *     a_e = 0
35870  *     a_m = ifrexp(a,&a_e)
35871  *     b_m = ifrexp(b,&b_e)             # <<<<<<<<<<<<<<
35872  *     x = <np.int64_t> ((a_e+1)*DBL_MANT_DIG)
35873  *     y = <np.int64_t> ((b_e+1)*DBL_MANT_DIG)
35874  */
35875   __pyx_v_b_m = __pyx_f_2yt_9utilities_3lib_14geometry_utils_ifrexp(__pyx_v_b, (&__pyx_v_b_e));
35876 
35877   /* "yt/utilities/lib/geometry_utils.pxd":55
35878  *     a_m = ifrexp(a,&a_e)
35879  *     b_m = ifrexp(b,&b_e)
35880  *     x = <np.int64_t> ((a_e+1)*DBL_MANT_DIG)             # <<<<<<<<<<<<<<
35881  *     y = <np.int64_t> ((b_e+1)*DBL_MANT_DIG)
35882  *     # Compare mantissa if exponents equal
35883  */
35884   __pyx_v_x = ((__pyx_t_5numpy_int64_t)((__pyx_v_a_e + 1) * DBL_MANT_DIG));
35885 
35886   /* "yt/utilities/lib/geometry_utils.pxd":56
35887  *     b_m = ifrexp(b,&b_e)
35888  *     x = <np.int64_t> ((a_e+1)*DBL_MANT_DIG)
35889  *     y = <np.int64_t> ((b_e+1)*DBL_MANT_DIG)             # <<<<<<<<<<<<<<
35890  *     # Compare mantissa if exponents equal
35891  *     if x == y:
35892  */
35893   __pyx_v_y = ((__pyx_t_5numpy_int64_t)((__pyx_v_b_e + 1) * DBL_MANT_DIG));
35894 
35895   /* "yt/utilities/lib/geometry_utils.pxd":58
35896  *     y = <np.int64_t> ((b_e+1)*DBL_MANT_DIG)
35897  *     # Compare mantissa if exponents equal
35898  *     if x == y:             # <<<<<<<<<<<<<<
35899  *         if a_m == b_m: return 0
35900  *         z = msdb(a_m,b_m)
35901  */
35902   __pyx_t_1 = ((__pyx_v_x == __pyx_v_y) != 0);
35903   if (__pyx_t_1) {
35904 
35905     /* "yt/utilities/lib/geometry_utils.pxd":59
35906  *     # Compare mantissa if exponents equal
35907  *     if x == y:
35908  *         if a_m == b_m: return 0             # <<<<<<<<<<<<<<
35909  *         z = msdb(a_m,b_m)
35910  *         #if 1: return z
35911  */
35912     __pyx_t_1 = ((__pyx_v_a_m == __pyx_v_b_m) != 0);
35913     if (__pyx_t_1) {
35914       __pyx_r = 0;
35915       goto __pyx_L0;
35916     }
35917 
35918     /* "yt/utilities/lib/geometry_utils.pxd":60
35919  *     if x == y:
35920  *         if a_m == b_m: return 0
35921  *         z = msdb(a_m,b_m)             # <<<<<<<<<<<<<<
35922  *         #if 1: return z
35923  *         x = x - z
35924  */
35925     __pyx_v_z = __pyx_f_2yt_9utilities_3lib_14geometry_utils_msdb(__pyx_v_a_m, __pyx_v_b_m);
35926 
35927     /* "yt/utilities/lib/geometry_utils.pxd":62
35928  *         z = msdb(a_m,b_m)
35929  *         #if 1: return z
35930  *         x = x - z             # <<<<<<<<<<<<<<
35931  *         return x-1 # required so that xor_msb(0.0,1.0)!=xor_msb(1.0,1.0)
35932  *     # Otherwise return largest exponent
35933  */
35934     __pyx_v_x = (__pyx_v_x - __pyx_v_z);
35935 
35936     /* "yt/utilities/lib/geometry_utils.pxd":63
35937  *         #if 1: return z
35938  *         x = x - z
35939  *         return x-1 # required so that xor_msb(0.0,1.0)!=xor_msb(1.0,1.0)             # <<<<<<<<<<<<<<
35940  *     # Otherwise return largest exponent
35941  *     if y < x:
35942  */
35943     __pyx_r = (__pyx_v_x - 1);
35944     goto __pyx_L0;
35945 
35946     /* "yt/utilities/lib/geometry_utils.pxd":58
35947  *     y = <np.int64_t> ((b_e+1)*DBL_MANT_DIG)
35948  *     # Compare mantissa if exponents equal
35949  *     if x == y:             # <<<<<<<<<<<<<<
35950  *         if a_m == b_m: return 0
35951  *         z = msdb(a_m,b_m)
35952  */
35953   }
35954 
35955   /* "yt/utilities/lib/geometry_utils.pxd":65
35956  *         return x-1 # required so that xor_msb(0.0,1.0)!=xor_msb(1.0,1.0)
35957  *     # Otherwise return largest exponent
35958  *     if y < x:             # <<<<<<<<<<<<<<
35959  *         return x
35960  *     else:
35961  */
35962   __pyx_t_1 = ((__pyx_v_y < __pyx_v_x) != 0);
35963   if (__pyx_t_1) {
35964 
35965     /* "yt/utilities/lib/geometry_utils.pxd":66
35966  *     # Otherwise return largest exponent
35967  *     if y < x:
35968  *         return x             # <<<<<<<<<<<<<<
35969  *     else:
35970  *         return y
35971  */
35972     __pyx_r = __pyx_v_x;
35973     goto __pyx_L0;
35974 
35975     /* "yt/utilities/lib/geometry_utils.pxd":65
35976  *         return x-1 # required so that xor_msb(0.0,1.0)!=xor_msb(1.0,1.0)
35977  *     # Otherwise return largest exponent
35978  *     if y < x:             # <<<<<<<<<<<<<<
35979  *         return x
35980  *     else:
35981  */
35982   }
35983 
35984   /* "yt/utilities/lib/geometry_utils.pxd":68
35985  *         return x
35986  *     else:
35987  *         return y             # <<<<<<<<<<<<<<
35988  *
35989  * @cython.cdivision(True)
35990  */
35991   /*else*/ {
35992     __pyx_r = __pyx_v_y;
35993     goto __pyx_L0;
35994   }
35995 
35996   /* "yt/utilities/lib/geometry_utils.pxd":47
35997  * @cython.boundscheck(False)
35998  * @cython.wraparound(False)
35999  * cdef inline np.int64_t xor_msb(np.float64_t a, np.float64_t b):             # <<<<<<<<<<<<<<
36000  *     """Get the exponent of the highest differing bit between a and b"""
36001  *     # Get mantissa and exponents for each number
36002  */
36003 
36004   /* function exit code */
36005   __pyx_L0:;
36006   __Pyx_RefNannyFinishContext();
36007   return __pyx_r;
36008 }
36009 
36010 /* "yt/utilities/lib/geometry_utils.pxd":73
36011  * @cython.boundscheck(False)
36012  * @cython.wraparound(False)
36013  * cdef inline int compare_floats_morton(np.float64_t p[3], np.float64_t q[3]):             # <<<<<<<<<<<<<<
36014  *     cdef int j, out, dim
36015  *     cdef np.int64_t x, y
36016  */
36017 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_compare_floats_morton(__pyx_t_5numpy_float64_t * __pyx_v_p,__pyx_t_5numpy_float64_t * __pyx_v_q)36018 static CYTHON_INLINE int __pyx_f_2yt_9utilities_3lib_14geometry_utils_compare_floats_morton(__pyx_t_5numpy_float64_t *__pyx_v_p, __pyx_t_5numpy_float64_t *__pyx_v_q) {
36019   int __pyx_v_j;
36020   int __pyx_v_out;
36021   int __pyx_v_dim;
36022   __pyx_t_5numpy_int64_t __pyx_v_x;
36023   __pyx_t_5numpy_int64_t __pyx_v_y;
36024   int __pyx_r;
36025   __Pyx_RefNannyDeclarations
36026   int __pyx_t_1;
36027   int __pyx_t_2;
36028   __Pyx_RefNannySetupContext("compare_floats_morton", 0);
36029 
36030   /* "yt/utilities/lib/geometry_utils.pxd":76
36031  *     cdef int j, out, dim
36032  *     cdef np.int64_t x, y
36033  *     x = -9999999999             # <<<<<<<<<<<<<<
36034  *     y = 0
36035  *     dim = 0
36036  */
36037   __pyx_v_x = -9999999999LL;
36038 
36039   /* "yt/utilities/lib/geometry_utils.pxd":77
36040  *     cdef np.int64_t x, y
36041  *     x = -9999999999
36042  *     y = 0             # <<<<<<<<<<<<<<
36043  *     dim = 0
36044  *     for j in range(3):#[::-1]:
36045  */
36046   __pyx_v_y = 0;
36047 
36048   /* "yt/utilities/lib/geometry_utils.pxd":78
36049  *     x = -9999999999
36050  *     y = 0
36051  *     dim = 0             # <<<<<<<<<<<<<<
36052  *     for j in range(3):#[::-1]:
36053  *         y = xor_msb(p[j],q[j])
36054  */
36055   __pyx_v_dim = 0;
36056 
36057   /* "yt/utilities/lib/geometry_utils.pxd":79
36058  *     y = 0
36059  *     dim = 0
36060  *     for j in range(3):#[::-1]:             # <<<<<<<<<<<<<<
36061  *         y = xor_msb(p[j],q[j])
36062  *         if x < y:
36063  */
36064   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
36065     __pyx_v_j = __pyx_t_1;
36066 
36067     /* "yt/utilities/lib/geometry_utils.pxd":80
36068  *     dim = 0
36069  *     for j in range(3):#[::-1]:
36070  *         y = xor_msb(p[j],q[j])             # <<<<<<<<<<<<<<
36071  *         if x < y:
36072  *            x = y
36073  */
36074     __pyx_v_y = __pyx_f_2yt_9utilities_3lib_14geometry_utils_xor_msb((__pyx_v_p[__pyx_v_j]), (__pyx_v_q[__pyx_v_j]));
36075 
36076     /* "yt/utilities/lib/geometry_utils.pxd":81
36077  *     for j in range(3):#[::-1]:
36078  *         y = xor_msb(p[j],q[j])
36079  *         if x < y:             # <<<<<<<<<<<<<<
36080  *            x = y
36081  *            dim = j
36082  */
36083     __pyx_t_2 = ((__pyx_v_x < __pyx_v_y) != 0);
36084     if (__pyx_t_2) {
36085 
36086       /* "yt/utilities/lib/geometry_utils.pxd":82
36087  *         y = xor_msb(p[j],q[j])
36088  *         if x < y:
36089  *            x = y             # <<<<<<<<<<<<<<
36090  *            dim = j
36091  *     if p[dim] < q[dim]:
36092  */
36093       __pyx_v_x = __pyx_v_y;
36094 
36095       /* "yt/utilities/lib/geometry_utils.pxd":83
36096  *         if x < y:
36097  *            x = y
36098  *            dim = j             # <<<<<<<<<<<<<<
36099  *     if p[dim] < q[dim]:
36100  *         out = 1
36101  */
36102       __pyx_v_dim = __pyx_v_j;
36103 
36104       /* "yt/utilities/lib/geometry_utils.pxd":81
36105  *     for j in range(3):#[::-1]:
36106  *         y = xor_msb(p[j],q[j])
36107  *         if x < y:             # <<<<<<<<<<<<<<
36108  *            x = y
36109  *            dim = j
36110  */
36111     }
36112   }
36113 
36114   /* "yt/utilities/lib/geometry_utils.pxd":84
36115  *            x = y
36116  *            dim = j
36117  *     if p[dim] < q[dim]:             # <<<<<<<<<<<<<<
36118  *         out = 1
36119  *     else:
36120  */
36121   __pyx_t_2 = (((__pyx_v_p[__pyx_v_dim]) < (__pyx_v_q[__pyx_v_dim])) != 0);
36122   if (__pyx_t_2) {
36123 
36124     /* "yt/utilities/lib/geometry_utils.pxd":85
36125  *            dim = j
36126  *     if p[dim] < q[dim]:
36127  *         out = 1             # <<<<<<<<<<<<<<
36128  *     else:
36129  *         out = 0
36130  */
36131     __pyx_v_out = 1;
36132 
36133     /* "yt/utilities/lib/geometry_utils.pxd":84
36134  *            x = y
36135  *            dim = j
36136  *     if p[dim] < q[dim]:             # <<<<<<<<<<<<<<
36137  *         out = 1
36138  *     else:
36139  */
36140     goto __pyx_L6;
36141   }
36142 
36143   /* "yt/utilities/lib/geometry_utils.pxd":87
36144  *         out = 1
36145  *     else:
36146  *         out = 0             # <<<<<<<<<<<<<<
36147  *     return out
36148  *
36149  */
36150   /*else*/ {
36151     __pyx_v_out = 0;
36152   }
36153   __pyx_L6:;
36154 
36155   /* "yt/utilities/lib/geometry_utils.pxd":88
36156  *     else:
36157  *         out = 0
36158  *     return out             # <<<<<<<<<<<<<<
36159  *
36160  * @cython.cdivision(True)
36161  */
36162   __pyx_r = __pyx_v_out;
36163   goto __pyx_L0;
36164 
36165   /* "yt/utilities/lib/geometry_utils.pxd":73
36166  * @cython.boundscheck(False)
36167  * @cython.wraparound(False)
36168  * cdef inline int compare_floats_morton(np.float64_t p[3], np.float64_t q[3]):             # <<<<<<<<<<<<<<
36169  *     cdef int j, out, dim
36170  *     cdef np.int64_t x, y
36171  */
36172 
36173   /* function exit code */
36174   __pyx_L0:;
36175   __Pyx_RefNannyFinishContext();
36176   return __pyx_r;
36177 }
36178 
36179 /* "yt/utilities/lib/geometry_utils.pxd":93
36180  * @cython.boundscheck(False)
36181  * @cython.wraparound(False)
36182  * cdef inline np.float64_t euclidean_distance(np.float64_t[:] p, np.float64_t[:] q):             # <<<<<<<<<<<<<<
36183  *     cdef int j
36184  *     cdef np.float64_t d
36185  */
36186 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_euclidean_distance(__Pyx_memviewslice __pyx_v_p,__Pyx_memviewslice __pyx_v_q)36187 static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_euclidean_distance(__Pyx_memviewslice __pyx_v_p, __Pyx_memviewslice __pyx_v_q) {
36188   int __pyx_v_j;
36189   __pyx_t_5numpy_float64_t __pyx_v_d;
36190   __pyx_t_5numpy_float64_t __pyx_r;
36191   __Pyx_RefNannyDeclarations
36192   int __pyx_t_1;
36193   Py_ssize_t __pyx_t_2;
36194   int __pyx_t_3;
36195   Py_ssize_t __pyx_t_4;
36196   __Pyx_RefNannySetupContext("euclidean_distance", 0);
36197 
36198   /* "yt/utilities/lib/geometry_utils.pxd":96
36199  *     cdef int j
36200  *     cdef np.float64_t d
36201  *     d = 0.0             # <<<<<<<<<<<<<<
36202  *     for j in range(3):
36203  *         d+=(p[j]-q[j])**2
36204  */
36205   __pyx_v_d = 0.0;
36206 
36207   /* "yt/utilities/lib/geometry_utils.pxd":97
36208  *     cdef np.float64_t d
36209  *     d = 0.0
36210  *     for j in range(3):             # <<<<<<<<<<<<<<
36211  *         d+=(p[j]-q[j])**2
36212  *     return sqrt(d)
36213  */
36214   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
36215     __pyx_v_j = __pyx_t_1;
36216 
36217     /* "yt/utilities/lib/geometry_utils.pxd":98
36218  *     d = 0.0
36219  *     for j in range(3):
36220  *         d+=(p[j]-q[j])**2             # <<<<<<<<<<<<<<
36221  *     return sqrt(d)
36222  *
36223  */
36224     __pyx_t_2 = __pyx_v_j;
36225     __pyx_t_3 = -1;
36226     if (__pyx_t_2 < 0) {
36227       __pyx_t_2 += __pyx_v_p.shape[0];
36228       if (unlikely(__pyx_t_2 < 0)) __pyx_t_3 = 0;
36229     } else if (unlikely(__pyx_t_2 >= __pyx_v_p.shape[0])) __pyx_t_3 = 0;
36230     if (unlikely(__pyx_t_3 != -1)) {
36231       __Pyx_RaiseBufferIndexError(__pyx_t_3);
36232       __PYX_ERR(0, 98, __pyx_L1_error)
36233     }
36234     __pyx_t_4 = __pyx_v_j;
36235     __pyx_t_3 = -1;
36236     if (__pyx_t_4 < 0) {
36237       __pyx_t_4 += __pyx_v_q.shape[0];
36238       if (unlikely(__pyx_t_4 < 0)) __pyx_t_3 = 0;
36239     } else if (unlikely(__pyx_t_4 >= __pyx_v_q.shape[0])) __pyx_t_3 = 0;
36240     if (unlikely(__pyx_t_3 != -1)) {
36241       __Pyx_RaiseBufferIndexError(__pyx_t_3);
36242       __PYX_ERR(0, 98, __pyx_L1_error)
36243     }
36244     __pyx_v_d = (__pyx_v_d + pow(((*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_p.data + __pyx_t_2 * __pyx_v_p.strides[0]) ))) - (*((__pyx_t_5numpy_float64_t *) ( /* dim=0 */ (__pyx_v_q.data + __pyx_t_4 * __pyx_v_q.strides[0]) )))), 2.0));
36245   }
36246 
36247   /* "yt/utilities/lib/geometry_utils.pxd":99
36248  *     for j in range(3):
36249  *         d+=(p[j]-q[j])**2
36250  *     return sqrt(d)             # <<<<<<<<<<<<<<
36251  *
36252  * # Todo: allow radius reported independently in each dimension for rectangular domain
36253  */
36254   __pyx_r = sqrt(__pyx_v_d);
36255   goto __pyx_L0;
36256 
36257   /* "yt/utilities/lib/geometry_utils.pxd":93
36258  * @cython.boundscheck(False)
36259  * @cython.wraparound(False)
36260  * cdef inline np.float64_t euclidean_distance(np.float64_t[:] p, np.float64_t[:] q):             # <<<<<<<<<<<<<<
36261  *     cdef int j
36262  *     cdef np.float64_t d
36263  */
36264 
36265   /* function exit code */
36266   __pyx_L1_error:;
36267   __Pyx_WriteUnraisable("yt.utilities.lib.geometry_utils.euclidean_distance", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
36268   __pyx_r = 0;
36269   __pyx_L0:;
36270   __Pyx_RefNannyFinishContext();
36271   return __pyx_r;
36272 }
36273 
36274 /* "yt/utilities/lib/geometry_utils.pxd":105
36275  * @cython.boundscheck(False)
36276  * @cython.wraparound(False)
36277  * cdef inline np.float64_t smallest_quadtree_box(np.float64_t p[3], np.float64_t q[3], np.int32_t order,             # <<<<<<<<<<<<<<
36278  *                                                np.float64_t DLE[3], np.float64_t DRE[3],
36279  *                                                np.float64_t *cx, np.float64_t *cy, np.float64_t *cz):
36280  */
36281 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_smallest_quadtree_box(__pyx_t_5numpy_float64_t * __pyx_v_p,__pyx_t_5numpy_float64_t * __pyx_v_q,__pyx_t_5numpy_int32_t __pyx_v_order,__pyx_t_5numpy_float64_t * __pyx_v_DLE,__pyx_t_5numpy_float64_t * __pyx_v_DRE,__pyx_t_5numpy_float64_t * __pyx_v_cx,__pyx_t_5numpy_float64_t * __pyx_v_cy,__pyx_t_5numpy_float64_t * __pyx_v_cz)36282 static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_smallest_quadtree_box(__pyx_t_5numpy_float64_t *__pyx_v_p, __pyx_t_5numpy_float64_t *__pyx_v_q, __pyx_t_5numpy_int32_t __pyx_v_order, __pyx_t_5numpy_float64_t *__pyx_v_DLE, __pyx_t_5numpy_float64_t *__pyx_v_DRE, __pyx_t_5numpy_float64_t *__pyx_v_cx, __pyx_t_5numpy_float64_t *__pyx_v_cy, __pyx_t_5numpy_float64_t *__pyx_v_cz) {
36283   int __pyx_v_j;
36284   __pyx_t_5numpy_float64_t __pyx_v_c[3];
36285   __pyx_t_5numpy_uint64_t __pyx_v_pidx[3];
36286   __pyx_t_5numpy_uint64_t __pyx_v_pidx_next[3];
36287   __pyx_t_5numpy_uint64_t __pyx_v_qidx_next[3];
36288   __pyx_t_5numpy_float64_t __pyx_v_dds[3];
36289   __pyx_t_5numpy_float64_t __pyx_v_rad;
36290   int __pyx_v_lvl;
36291   int __pyx_v_done;
36292   __pyx_t_5numpy_float64_t __pyx_r;
36293   __Pyx_RefNannyDeclarations
36294   int __pyx_t_1;
36295   int __pyx_t_2;
36296   __Pyx_RefNannySetupContext("smallest_quadtree_box", 0);
36297 
36298   /* "yt/utilities/lib/geometry_utils.pxd":112
36299  *     cdef np.uint64_t pidx[3]
36300  *     # cdef np.uint64_t qidx[3]
36301  *     for j in range(3):             # <<<<<<<<<<<<<<
36302  *         pidx[j] = 0
36303  *         # qidx[j] = 0
36304  */
36305   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
36306     __pyx_v_j = __pyx_t_1;
36307 
36308     /* "yt/utilities/lib/geometry_utils.pxd":113
36309  *     # cdef np.uint64_t qidx[3]
36310  *     for j in range(3):
36311  *         pidx[j] = 0             # <<<<<<<<<<<<<<
36312  *         # qidx[j] = 0
36313  *     cdef np.uint64_t pidx_next[3]
36314  */
36315     (__pyx_v_pidx[__pyx_v_j]) = 0;
36316   }
36317 
36318   /* "yt/utilities/lib/geometry_utils.pxd":119
36319  *     cdef np.float64_t dds[3]
36320  *     cdef np.float64_t rad
36321  *     cdef int lvl = 0             # <<<<<<<<<<<<<<
36322  *     cdef int done = 0
36323  *     while not done:
36324  */
36325   __pyx_v_lvl = 0;
36326 
36327   /* "yt/utilities/lib/geometry_utils.pxd":120
36328  *     cdef np.float64_t rad
36329  *     cdef int lvl = 0
36330  *     cdef int done = 0             # <<<<<<<<<<<<<<
36331  *     while not done:
36332  *         if (lvl+1 >= order):
36333  */
36334   __pyx_v_done = 0;
36335 
36336   /* "yt/utilities/lib/geometry_utils.pxd":121
36337  *     cdef int lvl = 0
36338  *     cdef int done = 0
36339  *     while not done:             # <<<<<<<<<<<<<<
36340  *         if (lvl+1 >= order):
36341  *             done = 1
36342  */
36343   while (1) {
36344     __pyx_t_2 = ((!(__pyx_v_done != 0)) != 0);
36345     if (!__pyx_t_2) break;
36346 
36347     /* "yt/utilities/lib/geometry_utils.pxd":122
36348  *     cdef int done = 0
36349  *     while not done:
36350  *         if (lvl+1 >= order):             # <<<<<<<<<<<<<<
36351  *             done = 1
36352  *         for j in range(3):
36353  */
36354     __pyx_t_2 = (((__pyx_v_lvl + 1) >= __pyx_v_order) != 0);
36355     if (__pyx_t_2) {
36356 
36357       /* "yt/utilities/lib/geometry_utils.pxd":123
36358  *     while not done:
36359  *         if (lvl+1 >= order):
36360  *             done = 1             # <<<<<<<<<<<<<<
36361  *         for j in range(3):
36362  *             dds[j] = (DRE[j] - DLE[j])/(1 << (<int> lvl+1))
36363  */
36364       __pyx_v_done = 1;
36365 
36366       /* "yt/utilities/lib/geometry_utils.pxd":122
36367  *     cdef int done = 0
36368  *     while not done:
36369  *         if (lvl+1 >= order):             # <<<<<<<<<<<<<<
36370  *             done = 1
36371  *         for j in range(3):
36372  */
36373     }
36374 
36375     /* "yt/utilities/lib/geometry_utils.pxd":124
36376  *         if (lvl+1 >= order):
36377  *             done = 1
36378  *         for j in range(3):             # <<<<<<<<<<<<<<
36379  *             dds[j] = (DRE[j] - DLE[j])/(1 << (<int> lvl+1))
36380  *             pidx_next[j] = <np.uint64_t>((p[j] - DLE[j])/dds[j])
36381  */
36382     for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
36383       __pyx_v_j = __pyx_t_1;
36384 
36385       /* "yt/utilities/lib/geometry_utils.pxd":125
36386  *             done = 1
36387  *         for j in range(3):
36388  *             dds[j] = (DRE[j] - DLE[j])/(1 << (<int> lvl+1))             # <<<<<<<<<<<<<<
36389  *             pidx_next[j] = <np.uint64_t>((p[j] - DLE[j])/dds[j])
36390  *             qidx_next[j] = <np.uint64_t>((q[j] - DLE[j])/dds[j])
36391  */
36392       (__pyx_v_dds[__pyx_v_j]) = (((__pyx_v_DRE[__pyx_v_j]) - (__pyx_v_DLE[__pyx_v_j])) / (1 << (((int)__pyx_v_lvl) + 1)));
36393 
36394       /* "yt/utilities/lib/geometry_utils.pxd":126
36395  *         for j in range(3):
36396  *             dds[j] = (DRE[j] - DLE[j])/(1 << (<int> lvl+1))
36397  *             pidx_next[j] = <np.uint64_t>((p[j] - DLE[j])/dds[j])             # <<<<<<<<<<<<<<
36398  *             qidx_next[j] = <np.uint64_t>((q[j] - DLE[j])/dds[j])
36399  *         for j in range(3):
36400  */
36401       (__pyx_v_pidx_next[__pyx_v_j]) = ((__pyx_t_5numpy_uint64_t)(((__pyx_v_p[__pyx_v_j]) - (__pyx_v_DLE[__pyx_v_j])) / (__pyx_v_dds[__pyx_v_j])));
36402 
36403       /* "yt/utilities/lib/geometry_utils.pxd":127
36404  *             dds[j] = (DRE[j] - DLE[j])/(1 << (<int> lvl+1))
36405  *             pidx_next[j] = <np.uint64_t>((p[j] - DLE[j])/dds[j])
36406  *             qidx_next[j] = <np.uint64_t>((q[j] - DLE[j])/dds[j])             # <<<<<<<<<<<<<<
36407  *         for j in range(3):
36408  *             if pidx_next[j]!=qidx_next[j]:
36409  */
36410       (__pyx_v_qidx_next[__pyx_v_j]) = ((__pyx_t_5numpy_uint64_t)(((__pyx_v_q[__pyx_v_j]) - (__pyx_v_DLE[__pyx_v_j])) / (__pyx_v_dds[__pyx_v_j])));
36411     }
36412 
36413     /* "yt/utilities/lib/geometry_utils.pxd":128
36414  *             pidx_next[j] = <np.uint64_t>((p[j] - DLE[j])/dds[j])
36415  *             qidx_next[j] = <np.uint64_t>((q[j] - DLE[j])/dds[j])
36416  *         for j in range(3):             # <<<<<<<<<<<<<<
36417  *             if pidx_next[j]!=qidx_next[j]:
36418  *                 done = 1
36419  */
36420     for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
36421       __pyx_v_j = __pyx_t_1;
36422 
36423       /* "yt/utilities/lib/geometry_utils.pxd":129
36424  *             qidx_next[j] = <np.uint64_t>((q[j] - DLE[j])/dds[j])
36425  *         for j in range(3):
36426  *             if pidx_next[j]!=qidx_next[j]:             # <<<<<<<<<<<<<<
36427  *                 done = 1
36428  *                 break
36429  */
36430       __pyx_t_2 = (((__pyx_v_pidx_next[__pyx_v_j]) != (__pyx_v_qidx_next[__pyx_v_j])) != 0);
36431       if (__pyx_t_2) {
36432 
36433         /* "yt/utilities/lib/geometry_utils.pxd":130
36434  *         for j in range(3):
36435  *             if pidx_next[j]!=qidx_next[j]:
36436  *                 done = 1             # <<<<<<<<<<<<<<
36437  *                 break
36438  *         if not done:
36439  */
36440         __pyx_v_done = 1;
36441 
36442         /* "yt/utilities/lib/geometry_utils.pxd":131
36443  *             if pidx_next[j]!=qidx_next[j]:
36444  *                 done = 1
36445  *                 break             # <<<<<<<<<<<<<<
36446  *         if not done:
36447  *             for j in range(3):
36448  */
36449         goto __pyx_L11_break;
36450 
36451         /* "yt/utilities/lib/geometry_utils.pxd":129
36452  *             qidx_next[j] = <np.uint64_t>((q[j] - DLE[j])/dds[j])
36453  *         for j in range(3):
36454  *             if pidx_next[j]!=qidx_next[j]:             # <<<<<<<<<<<<<<
36455  *                 done = 1
36456  *                 break
36457  */
36458       }
36459     }
36460     __pyx_L11_break:;
36461 
36462     /* "yt/utilities/lib/geometry_utils.pxd":132
36463  *                 done = 1
36464  *                 break
36465  *         if not done:             # <<<<<<<<<<<<<<
36466  *             for j in range(3):
36467  *                 pidx[j] = pidx_next[j]
36468  */
36469     __pyx_t_2 = ((!(__pyx_v_done != 0)) != 0);
36470     if (__pyx_t_2) {
36471 
36472       /* "yt/utilities/lib/geometry_utils.pxd":133
36473  *                 break
36474  *         if not done:
36475  *             for j in range(3):             # <<<<<<<<<<<<<<
36476  *                 pidx[j] = pidx_next[j]
36477  *                 # qidx[j] = qidx_next[j]
36478  */
36479       for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
36480         __pyx_v_j = __pyx_t_1;
36481 
36482         /* "yt/utilities/lib/geometry_utils.pxd":134
36483  *         if not done:
36484  *             for j in range(3):
36485  *                 pidx[j] = pidx_next[j]             # <<<<<<<<<<<<<<
36486  *                 # qidx[j] = qidx_next[j]
36487  *             lvl+=1
36488  */
36489         (__pyx_v_pidx[__pyx_v_j]) = (__pyx_v_pidx_next[__pyx_v_j]);
36490       }
36491 
36492       /* "yt/utilities/lib/geometry_utils.pxd":136
36493  *                 pidx[j] = pidx_next[j]
36494  *                 # qidx[j] = qidx_next[j]
36495  *             lvl+=1             # <<<<<<<<<<<<<<
36496  *     rad = 0.0
36497  *     for j in range(3):
36498  */
36499       __pyx_v_lvl = (__pyx_v_lvl + 1);
36500 
36501       /* "yt/utilities/lib/geometry_utils.pxd":132
36502  *                 done = 1
36503  *                 break
36504  *         if not done:             # <<<<<<<<<<<<<<
36505  *             for j in range(3):
36506  *                 pidx[j] = pidx_next[j]
36507  */
36508     }
36509   }
36510 
36511   /* "yt/utilities/lib/geometry_utils.pxd":137
36512  *                 # qidx[j] = qidx_next[j]
36513  *             lvl+=1
36514  *     rad = 0.0             # <<<<<<<<<<<<<<
36515  *     for j in range(3):
36516  *         dds[j] = (DRE[j] - DLE[j])/(1 << lvl)
36517  */
36518   __pyx_v_rad = 0.0;
36519 
36520   /* "yt/utilities/lib/geometry_utils.pxd":138
36521  *             lvl+=1
36522  *     rad = 0.0
36523  *     for j in range(3):             # <<<<<<<<<<<<<<
36524  *         dds[j] = (DRE[j] - DLE[j])/(1 << lvl)
36525  *         c[j] = dds[j]*(<np.float64_t>pidx[j]+0.5)
36526  */
36527   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
36528     __pyx_v_j = __pyx_t_1;
36529 
36530     /* "yt/utilities/lib/geometry_utils.pxd":139
36531  *     rad = 0.0
36532  *     for j in range(3):
36533  *         dds[j] = (DRE[j] - DLE[j])/(1 << lvl)             # <<<<<<<<<<<<<<
36534  *         c[j] = dds[j]*(<np.float64_t>pidx[j]+0.5)
36535  *         rad+=((dds[j]/2.0)**2)
36536  */
36537     (__pyx_v_dds[__pyx_v_j]) = (((__pyx_v_DRE[__pyx_v_j]) - (__pyx_v_DLE[__pyx_v_j])) / (1 << __pyx_v_lvl));
36538 
36539     /* "yt/utilities/lib/geometry_utils.pxd":140
36540  *     for j in range(3):
36541  *         dds[j] = (DRE[j] - DLE[j])/(1 << lvl)
36542  *         c[j] = dds[j]*(<np.float64_t>pidx[j]+0.5)             # <<<<<<<<<<<<<<
36543  *         rad+=((dds[j]/2.0)**2)
36544  *     cx[0] = c[0]
36545  */
36546     (__pyx_v_c[__pyx_v_j]) = ((__pyx_v_dds[__pyx_v_j]) * (((__pyx_t_5numpy_float64_t)(__pyx_v_pidx[__pyx_v_j])) + 0.5));
36547 
36548     /* "yt/utilities/lib/geometry_utils.pxd":141
36549  *         dds[j] = (DRE[j] - DLE[j])/(1 << lvl)
36550  *         c[j] = dds[j]*(<np.float64_t>pidx[j]+0.5)
36551  *         rad+=((dds[j]/2.0)**2)             # <<<<<<<<<<<<<<
36552  *     cx[0] = c[0]
36553  *     cy[0] = c[1]
36554  */
36555     __pyx_v_rad = (__pyx_v_rad + pow(((__pyx_v_dds[__pyx_v_j]) / 2.0), 2.0));
36556   }
36557 
36558   /* "yt/utilities/lib/geometry_utils.pxd":142
36559  *         c[j] = dds[j]*(<np.float64_t>pidx[j]+0.5)
36560  *         rad+=((dds[j]/2.0)**2)
36561  *     cx[0] = c[0]             # <<<<<<<<<<<<<<
36562  *     cy[0] = c[1]
36563  *     cz[0] = c[2]
36564  */
36565   (__pyx_v_cx[0]) = (__pyx_v_c[0]);
36566 
36567   /* "yt/utilities/lib/geometry_utils.pxd":143
36568  *         rad+=((dds[j]/2.0)**2)
36569  *     cx[0] = c[0]
36570  *     cy[0] = c[1]             # <<<<<<<<<<<<<<
36571  *     cz[0] = c[2]
36572  *     return sqrt(rad)
36573  */
36574   (__pyx_v_cy[0]) = (__pyx_v_c[1]);
36575 
36576   /* "yt/utilities/lib/geometry_utils.pxd":144
36577  *     cx[0] = c[0]
36578  *     cy[0] = c[1]
36579  *     cz[0] = c[2]             # <<<<<<<<<<<<<<
36580  *     return sqrt(rad)
36581  *
36582  */
36583   (__pyx_v_cz[0]) = (__pyx_v_c[2]);
36584 
36585   /* "yt/utilities/lib/geometry_utils.pxd":145
36586  *     cy[0] = c[1]
36587  *     cz[0] = c[2]
36588  *     return sqrt(rad)             # <<<<<<<<<<<<<<
36589  *
36590  * #-----------------------------------------------------------------------------
36591  */
36592   __pyx_r = sqrt(__pyx_v_rad);
36593   goto __pyx_L0;
36594 
36595   /* "yt/utilities/lib/geometry_utils.pxd":105
36596  * @cython.boundscheck(False)
36597  * @cython.wraparound(False)
36598  * cdef inline np.float64_t smallest_quadtree_box(np.float64_t p[3], np.float64_t q[3], np.int32_t order,             # <<<<<<<<<<<<<<
36599  *                                                np.float64_t DLE[3], np.float64_t DRE[3],
36600  *                                                np.float64_t *cx, np.float64_t *cy, np.float64_t *cz):
36601  */
36602 
36603   /* function exit code */
36604   __pyx_L0:;
36605   __Pyx_RefNannyFinishContext();
36606   return __pyx_r;
36607 }
36608 
36609 /* "yt/utilities/lib/geometry_utils.pxd":152
36610  * @cython.boundscheck(False)
36611  * @cython.wraparound(False)
36612  * cdef inline np.uint64_t spread_64bits_by3(np.uint64_t x):             # <<<<<<<<<<<<<<
36613  *     x=(x&(<np.uint64_t>0x00000000001FFFFF))
36614  *     x=(x|(x<<20))*(<np.uint64_t>0x000001FFC00003FF)
36615  */
36616 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_spread_64bits_by3(__pyx_t_5numpy_uint64_t __pyx_v_x)36617 static CYTHON_INLINE __pyx_t_5numpy_uint64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_spread_64bits_by3(__pyx_t_5numpy_uint64_t __pyx_v_x) {
36618   __pyx_t_5numpy_uint64_t __pyx_r;
36619   __Pyx_RefNannyDeclarations
36620   __Pyx_RefNannySetupContext("spread_64bits_by3", 0);
36621 
36622   /* "yt/utilities/lib/geometry_utils.pxd":153
36623  * @cython.wraparound(False)
36624  * cdef inline np.uint64_t spread_64bits_by3(np.uint64_t x):
36625  *     x=(x&(<np.uint64_t>0x00000000001FFFFF))             # <<<<<<<<<<<<<<
36626  *     x=(x|(x<<20))*(<np.uint64_t>0x000001FFC00003FF)
36627  *
36628  */
36629   __pyx_v_x = (__pyx_v_x & ((__pyx_t_5numpy_uint64_t)0x00000000001FFFFF));
36630 
36631   /* "yt/utilities/lib/geometry_utils.pxd":154
36632  * cdef inline np.uint64_t spread_64bits_by3(np.uint64_t x):
36633  *     x=(x&(<np.uint64_t>0x00000000001FFFFF))
36634  *     x=(x|(x<<20))*(<np.uint64_t>0x000001FFC00003FF)             # <<<<<<<<<<<<<<
36635  *
36636  * #-----------------------------------------------------------------------------
36637  */
36638   __pyx_v_x = ((__pyx_v_x | (__pyx_v_x << 20)) * ((__pyx_t_5numpy_uint64_t)0x000001FFC00003FF));
36639 
36640   /* "yt/utilities/lib/geometry_utils.pxd":152
36641  * @cython.boundscheck(False)
36642  * @cython.wraparound(False)
36643  * cdef inline np.uint64_t spread_64bits_by3(np.uint64_t x):             # <<<<<<<<<<<<<<
36644  *     x=(x&(<np.uint64_t>0x00000000001FFFFF))
36645  *     x=(x|(x<<20))*(<np.uint64_t>0x000001FFC00003FF)
36646  */
36647 
36648   /* function exit code */
36649   __pyx_r = 0;
36650   __Pyx_RefNannyFinishContext();
36651   return __pyx_r;
36652 }
36653 
36654 /* "yt/utilities/lib/geometry_utils.pxd":161
36655  * @cython.boundscheck(False)
36656  * @cython.wraparound(False)
36657  * cdef inline np.uint64_t spread_64bits_by2(np.uint64_t x):             # <<<<<<<<<<<<<<
36658  *     # This magic comes from http://stackoverflow.com/questions/1024754/how-to-compute-a-3d-morton-number-interleave-the-bits-of-3-ints
36659  *     # Only reversible up to 2097151
36660  */
36661 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_spread_64bits_by2(__pyx_t_5numpy_uint64_t __pyx_v_x)36662 static CYTHON_INLINE __pyx_t_5numpy_uint64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_spread_64bits_by2(__pyx_t_5numpy_uint64_t __pyx_v_x) {
36663   __pyx_t_5numpy_uint64_t __pyx_r;
36664   __Pyx_RefNannyDeclarations
36665   __Pyx_RefNannySetupContext("spread_64bits_by2", 0);
36666 
36667   /* "yt/utilities/lib/geometry_utils.pxd":166
36668  *     # Select highest 21 bits (Required to be reversible to 21st bit)
36669  *     # x = ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---k jihg fedc ba98 7654 3210
36670  *     x=(x&(<np.uint64_t>0x00000000001FFFFF))             # <<<<<<<<<<<<<<
36671  *     # x = ---- ---- ---- ---- ---- ---k jihg fedc ba-- ---- ---- ---- ---- --98 7654 3210
36672  *     x=(x|(x<<20))&(<np.uint64_t>0x000001FFC00003FF)
36673  */
36674   __pyx_v_x = (__pyx_v_x & ((__pyx_t_5numpy_uint64_t)0x00000000001FFFFF));
36675 
36676   /* "yt/utilities/lib/geometry_utils.pxd":168
36677  *     x=(x&(<np.uint64_t>0x00000000001FFFFF))
36678  *     # x = ---- ---- ---- ---- ---- ---k jihg fedc ba-- ---- ---- ---- ---- --98 7654 3210
36679  *     x=(x|(x<<20))&(<np.uint64_t>0x000001FFC00003FF)             # <<<<<<<<<<<<<<
36680  *     # x = ---- ---- ---- -kji hgf- ---- ---- -edc ba-- ---- ---- 9876 5--- ---- ---4 3210
36681  *     x=(x|(x<<10))&(<np.uint64_t>0x0007E007C00F801F)
36682  */
36683   __pyx_v_x = ((__pyx_v_x | (__pyx_v_x << 20)) & ((__pyx_t_5numpy_uint64_t)0x000001FFC00003FF));
36684 
36685   /* "yt/utilities/lib/geometry_utils.pxd":170
36686  *     x=(x|(x<<20))&(<np.uint64_t>0x000001FFC00003FF)
36687  *     # x = ---- ---- ---- -kji hgf- ---- ---- -edc ba-- ---- ---- 9876 5--- ---- ---4 3210
36688  *     x=(x|(x<<10))&(<np.uint64_t>0x0007E007C00F801F)             # <<<<<<<<<<<<<<
36689  *     # x = ---- ---- -kji h--- -gf- ---- -edc ---- ba-- ---- 987- ---6 5--- ---4 32-- --10
36690  *     x=(x|(x<<4))&(<np.uint64_t>0x00786070C0E181C3)
36691  */
36692   __pyx_v_x = ((__pyx_v_x | (__pyx_v_x << 10)) & ((__pyx_t_5numpy_uint64_t)0x0007E007C00F801F));
36693 
36694   /* "yt/utilities/lib/geometry_utils.pxd":172
36695  *     x=(x|(x<<10))&(<np.uint64_t>0x0007E007C00F801F)
36696  *     # x = ---- ---- -kji h--- -gf- ---- -edc ---- ba-- ---- 987- ---6 5--- ---4 32-- --10
36697  *     x=(x|(x<<4))&(<np.uint64_t>0x00786070C0E181C3)             # <<<<<<<<<<<<<<
36698  *     # x = ---- ---k ji-- h--g --f- ---e d--c --b- -a-- --98 --7- -6-- 5--- -43- -2-- 1--0
36699  *     x=(x|(x<<2))&(<np.uint64_t>0x0199219243248649)
36700  */
36701   __pyx_v_x = ((__pyx_v_x | (__pyx_v_x << 4)) & ((__pyx_t_5numpy_uint64_t)0x00786070C0E181C3));
36702 
36703   /* "yt/utilities/lib/geometry_utils.pxd":174
36704  *     x=(x|(x<<4))&(<np.uint64_t>0x00786070C0E181C3)
36705  *     # x = ---- ---k ji-- h--g --f- ---e d--c --b- -a-- --98 --7- -6-- 5--- -43- -2-- 1--0
36706  *     x=(x|(x<<2))&(<np.uint64_t>0x0199219243248649)             # <<<<<<<<<<<<<<
36707  *     # x = ---- -kj- -i-- h--g --f- -e-- d--c --b- -a-- 9--8 --7- -6-- 5--4 --3- -2-- 1--0
36708  *     x=(x|(x<<2))&(<np.uint64_t>0x0649249249249249)
36709  */
36710   __pyx_v_x = ((__pyx_v_x | (__pyx_v_x << 2)) & ((__pyx_t_5numpy_uint64_t)0x0199219243248649));
36711 
36712   /* "yt/utilities/lib/geometry_utils.pxd":176
36713  *     x=(x|(x<<2))&(<np.uint64_t>0x0199219243248649)
36714  *     # x = ---- -kj- -i-- h--g --f- -e-- d--c --b- -a-- 9--8 --7- -6-- 5--4 --3- -2-- 1--0
36715  *     x=(x|(x<<2))&(<np.uint64_t>0x0649249249249249)             # <<<<<<<<<<<<<<
36716  *     # x = ---k --j- -i-- h--g --f- -e-- d--c --b- -a-- 9--8 --7- -6-- 5--4 --3- -2-- 1--0
36717  *     x=(x|(x<<2))&(<np.uint64_t>0x1249249249249249)
36718  */
36719   __pyx_v_x = ((__pyx_v_x | (__pyx_v_x << 2)) & ((__pyx_t_5numpy_uint64_t)0x0649249249249249));
36720 
36721   /* "yt/utilities/lib/geometry_utils.pxd":178
36722  *     x=(x|(x<<2))&(<np.uint64_t>0x0649249249249249)
36723  *     # x = ---k --j- -i-- h--g --f- -e-- d--c --b- -a-- 9--8 --7- -6-- 5--4 --3- -2-- 1--0
36724  *     x=(x|(x<<2))&(<np.uint64_t>0x1249249249249249)             # <<<<<<<<<<<<<<
36725  *     return x
36726  *
36727  */
36728   __pyx_v_x = ((__pyx_v_x | (__pyx_v_x << 2)) & ((__pyx_t_5numpy_uint64_t)0x1249249249249249));
36729 
36730   /* "yt/utilities/lib/geometry_utils.pxd":179
36731  *     # x = ---k --j- -i-- h--g --f- -e-- d--c --b- -a-- 9--8 --7- -6-- 5--4 --3- -2-- 1--0
36732  *     x=(x|(x<<2))&(<np.uint64_t>0x1249249249249249)
36733  *     return x             # <<<<<<<<<<<<<<
36734  *
36735  * @cython.cdivision(True)
36736  */
36737   __pyx_r = __pyx_v_x;
36738   goto __pyx_L0;
36739 
36740   /* "yt/utilities/lib/geometry_utils.pxd":161
36741  * @cython.boundscheck(False)
36742  * @cython.wraparound(False)
36743  * cdef inline np.uint64_t spread_64bits_by2(np.uint64_t x):             # <<<<<<<<<<<<<<
36744  *     # This magic comes from http://stackoverflow.com/questions/1024754/how-to-compute-a-3d-morton-number-interleave-the-bits-of-3-ints
36745  *     # Only reversible up to 2097151
36746  */
36747 
36748   /* function exit code */
36749   __pyx_L0:;
36750   __Pyx_RefNannyFinishContext();
36751   return __pyx_r;
36752 }
36753 
36754 /* "yt/utilities/lib/geometry_utils.pxd":184
36755  * @cython.boundscheck(False)
36756  * @cython.wraparound(False)
36757  * cdef inline np.uint64_t compact_64bits_by2(np.uint64_t x):             # <<<<<<<<<<<<<<
36758  *     # Reversed magic
36759  *     x=x&(<np.uint64_t>0x1249249249249249)
36760  */
36761 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_compact_64bits_by2(__pyx_t_5numpy_uint64_t __pyx_v_x)36762 static CYTHON_INLINE __pyx_t_5numpy_uint64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_compact_64bits_by2(__pyx_t_5numpy_uint64_t __pyx_v_x) {
36763   __pyx_t_5numpy_uint64_t __pyx_r;
36764   __Pyx_RefNannyDeclarations
36765   __Pyx_RefNannySetupContext("compact_64bits_by2", 0);
36766 
36767   /* "yt/utilities/lib/geometry_utils.pxd":186
36768  * cdef inline np.uint64_t compact_64bits_by2(np.uint64_t x):
36769  *     # Reversed magic
36770  *     x=x&(<np.uint64_t>0x1249249249249249)             # <<<<<<<<<<<<<<
36771  *     x=(x|(x>>2))&(<np.uint64_t>0x0649249249249249)
36772  *     x=(x|(x>>2))&(<np.uint64_t>0x0199219243248649)
36773  */
36774   __pyx_v_x = (__pyx_v_x & ((__pyx_t_5numpy_uint64_t)0x1249249249249249));
36775 
36776   /* "yt/utilities/lib/geometry_utils.pxd":187
36777  *     # Reversed magic
36778  *     x=x&(<np.uint64_t>0x1249249249249249)
36779  *     x=(x|(x>>2))&(<np.uint64_t>0x0649249249249249)             # <<<<<<<<<<<<<<
36780  *     x=(x|(x>>2))&(<np.uint64_t>0x0199219243248649)
36781  *     x=(x|(x>>2))&(<np.uint64_t>0x00786070C0E181C3)
36782  */
36783   __pyx_v_x = ((__pyx_v_x | (__pyx_v_x >> 2)) & ((__pyx_t_5numpy_uint64_t)0x0649249249249249));
36784 
36785   /* "yt/utilities/lib/geometry_utils.pxd":188
36786  *     x=x&(<np.uint64_t>0x1249249249249249)
36787  *     x=(x|(x>>2))&(<np.uint64_t>0x0649249249249249)
36788  *     x=(x|(x>>2))&(<np.uint64_t>0x0199219243248649)             # <<<<<<<<<<<<<<
36789  *     x=(x|(x>>2))&(<np.uint64_t>0x00786070C0E181C3)
36790  *     x=(x|(x>>4))&(<np.uint64_t>0x0007E007C00F801F)
36791  */
36792   __pyx_v_x = ((__pyx_v_x | (__pyx_v_x >> 2)) & ((__pyx_t_5numpy_uint64_t)0x0199219243248649));
36793 
36794   /* "yt/utilities/lib/geometry_utils.pxd":189
36795  *     x=(x|(x>>2))&(<np.uint64_t>0x0649249249249249)
36796  *     x=(x|(x>>2))&(<np.uint64_t>0x0199219243248649)
36797  *     x=(x|(x>>2))&(<np.uint64_t>0x00786070C0E181C3)             # <<<<<<<<<<<<<<
36798  *     x=(x|(x>>4))&(<np.uint64_t>0x0007E007C00F801F)
36799  *     x=(x|(x>>10))&(<np.uint64_t>0x000001FFC00003FF)
36800  */
36801   __pyx_v_x = ((__pyx_v_x | (__pyx_v_x >> 2)) & ((__pyx_t_5numpy_uint64_t)0x00786070C0E181C3));
36802 
36803   /* "yt/utilities/lib/geometry_utils.pxd":190
36804  *     x=(x|(x>>2))&(<np.uint64_t>0x0199219243248649)
36805  *     x=(x|(x>>2))&(<np.uint64_t>0x00786070C0E181C3)
36806  *     x=(x|(x>>4))&(<np.uint64_t>0x0007E007C00F801F)             # <<<<<<<<<<<<<<
36807  *     x=(x|(x>>10))&(<np.uint64_t>0x000001FFC00003FF)
36808  *     x=(x|(x>>20))&(<np.uint64_t>0x00000000001FFFFF)
36809  */
36810   __pyx_v_x = ((__pyx_v_x | (__pyx_v_x >> 4)) & ((__pyx_t_5numpy_uint64_t)0x0007E007C00F801F));
36811 
36812   /* "yt/utilities/lib/geometry_utils.pxd":191
36813  *     x=(x|(x>>2))&(<np.uint64_t>0x00786070C0E181C3)
36814  *     x=(x|(x>>4))&(<np.uint64_t>0x0007E007C00F801F)
36815  *     x=(x|(x>>10))&(<np.uint64_t>0x000001FFC00003FF)             # <<<<<<<<<<<<<<
36816  *     x=(x|(x>>20))&(<np.uint64_t>0x00000000001FFFFF)
36817  *     return x
36818  */
36819   __pyx_v_x = ((__pyx_v_x | (__pyx_v_x >> 10)) & ((__pyx_t_5numpy_uint64_t)0x000001FFC00003FF));
36820 
36821   /* "yt/utilities/lib/geometry_utils.pxd":192
36822  *     x=(x|(x>>4))&(<np.uint64_t>0x0007E007C00F801F)
36823  *     x=(x|(x>>10))&(<np.uint64_t>0x000001FFC00003FF)
36824  *     x=(x|(x>>20))&(<np.uint64_t>0x00000000001FFFFF)             # <<<<<<<<<<<<<<
36825  *     return x
36826  *
36827  */
36828   __pyx_v_x = ((__pyx_v_x | (__pyx_v_x >> 20)) & ((__pyx_t_5numpy_uint64_t)0x00000000001FFFFF));
36829 
36830   /* "yt/utilities/lib/geometry_utils.pxd":193
36831  *     x=(x|(x>>10))&(<np.uint64_t>0x000001FFC00003FF)
36832  *     x=(x|(x>>20))&(<np.uint64_t>0x00000000001FFFFF)
36833  *     return x             # <<<<<<<<<<<<<<
36834  *
36835  * #-----------------------------------------------------------------------------
36836  */
36837   __pyx_r = __pyx_v_x;
36838   goto __pyx_L0;
36839 
36840   /* "yt/utilities/lib/geometry_utils.pxd":184
36841  * @cython.boundscheck(False)
36842  * @cython.wraparound(False)
36843  * cdef inline np.uint64_t compact_64bits_by2(np.uint64_t x):             # <<<<<<<<<<<<<<
36844  *     # Reversed magic
36845  *     x=x&(<np.uint64_t>0x1249249249249249)
36846  */
36847 
36848   /* function exit code */
36849   __pyx_L0:;
36850   __Pyx_RefNannyFinishContext();
36851   return __pyx_r;
36852 }
36853 
36854 /* "yt/utilities/lib/geometry_utils.pxd":200
36855  * @cython.boundscheck(False)
36856  * @cython.wraparound(False)
36857  * cdef inline np.uint32_t spread_32bits_by2(np.uint32_t x):             # <<<<<<<<<<<<<<
36858  *     # Only reversible up to 1023
36859  *     # Select highest 10 bits (Required to be reversible to 10st bit)
36860  */
36861 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_spread_32bits_by2(__pyx_t_5numpy_uint32_t __pyx_v_x)36862 static CYTHON_INLINE __pyx_t_5numpy_uint32_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_spread_32bits_by2(__pyx_t_5numpy_uint32_t __pyx_v_x) {
36863   __pyx_t_5numpy_uint32_t __pyx_r;
36864   __Pyx_RefNannyDeclarations
36865   __Pyx_RefNannySetupContext("spread_32bits_by2", 0);
36866 
36867   /* "yt/utilities/lib/geometry_utils.pxd":204
36868  *     # Select highest 10 bits (Required to be reversible to 10st bit)
36869  *     # x = ---- ---- ---- ---- ---- --98 7654 3210
36870  *     x=(x&(<np.uint32_t>0x000003FF))             # <<<<<<<<<<<<<<
36871  *     # x = ---- --98 ---- ---- ---- ---- 7654 3210
36872  *     x=(x|(x<<16))&(<np.uint32_t>0xFF0000FF)
36873  */
36874   __pyx_v_x = (__pyx_v_x & ((__pyx_t_5numpy_uint32_t)0x000003FF));
36875 
36876   /* "yt/utilities/lib/geometry_utils.pxd":206
36877  *     x=(x&(<np.uint32_t>0x000003FF))
36878  *     # x = ---- --98 ---- ---- ---- ---- 7654 3210
36879  *     x=(x|(x<<16))&(<np.uint32_t>0xFF0000FF)             # <<<<<<<<<<<<<<
36880  *     # x = ---- --98 ---- ---- 7654 ---- ---- 3210
36881  *     x=(x|(x<<8))&(<np.uint32_t>0x0300F00F)
36882  */
36883   __pyx_v_x = ((__pyx_v_x | (__pyx_v_x << 16)) & ((__pyx_t_5numpy_uint32_t)0xFF0000FF));
36884 
36885   /* "yt/utilities/lib/geometry_utils.pxd":208
36886  *     x=(x|(x<<16))&(<np.uint32_t>0xFF0000FF)
36887  *     # x = ---- --98 ---- ---- 7654 ---- ---- 3210
36888  *     x=(x|(x<<8))&(<np.uint32_t>0x0300F00F)             # <<<<<<<<<<<<<<
36889  *     # x = ---- --98 ---- 76-- --54 ---- 32-- --10
36890  *     x=(x|(x<<4))&(<np.uint32_t>0x030C30C3)
36891  */
36892   __pyx_v_x = ((__pyx_v_x | (__pyx_v_x << 8)) & ((__pyx_t_5numpy_uint32_t)0x0300F00F));
36893 
36894   /* "yt/utilities/lib/geometry_utils.pxd":210
36895  *     x=(x|(x<<8))&(<np.uint32_t>0x0300F00F)
36896  *     # x = ---- --98 ---- 76-- --54 ---- 32-- --10
36897  *     x=(x|(x<<4))&(<np.uint32_t>0x030C30C3)             # <<<<<<<<<<<<<<
36898  *     # x = ---- 9--8 --7- -6-- 5--4 --3- -2-- 1--0
36899  *     x=(x|(x<<2))&(<np.uint32_t>0x09249249)
36900  */
36901   __pyx_v_x = ((__pyx_v_x | (__pyx_v_x << 4)) & ((__pyx_t_5numpy_uint32_t)0x030C30C3));
36902 
36903   /* "yt/utilities/lib/geometry_utils.pxd":212
36904  *     x=(x|(x<<4))&(<np.uint32_t>0x030C30C3)
36905  *     # x = ---- 9--8 --7- -6-- 5--4 --3- -2-- 1--0
36906  *     x=(x|(x<<2))&(<np.uint32_t>0x09249249)             # <<<<<<<<<<<<<<
36907  *     return x
36908  *
36909  */
36910   __pyx_v_x = ((__pyx_v_x | (__pyx_v_x << 2)) & ((__pyx_t_5numpy_uint32_t)0x09249249));
36911 
36912   /* "yt/utilities/lib/geometry_utils.pxd":213
36913  *     # x = ---- 9--8 --7- -6-- 5--4 --3- -2-- 1--0
36914  *     x=(x|(x<<2))&(<np.uint32_t>0x09249249)
36915  *     return x             # <<<<<<<<<<<<<<
36916  *
36917  * @cython.cdivision(True)
36918  */
36919   __pyx_r = __pyx_v_x;
36920   goto __pyx_L0;
36921 
36922   /* "yt/utilities/lib/geometry_utils.pxd":200
36923  * @cython.boundscheck(False)
36924  * @cython.wraparound(False)
36925  * cdef inline np.uint32_t spread_32bits_by2(np.uint32_t x):             # <<<<<<<<<<<<<<
36926  *     # Only reversible up to 1023
36927  *     # Select highest 10 bits (Required to be reversible to 10st bit)
36928  */
36929 
36930   /* function exit code */
36931   __pyx_L0:;
36932   __Pyx_RefNannyFinishContext();
36933   return __pyx_r;
36934 }
36935 
36936 /* "yt/utilities/lib/geometry_utils.pxd":218
36937  * @cython.boundscheck(False)
36938  * @cython.wraparound(False)
36939  * cdef inline np.uint32_t compact_32bits_by2(np.uint32_t x):             # <<<<<<<<<<<<<<
36940  *     # Reversed magic
36941  *     x=x&(<np.uint32_t>0x09249249)
36942  */
36943 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_compact_32bits_by2(__pyx_t_5numpy_uint32_t __pyx_v_x)36944 static CYTHON_INLINE __pyx_t_5numpy_uint32_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_compact_32bits_by2(__pyx_t_5numpy_uint32_t __pyx_v_x) {
36945   __pyx_t_5numpy_uint32_t __pyx_r;
36946   __Pyx_RefNannyDeclarations
36947   __Pyx_RefNannySetupContext("compact_32bits_by2", 0);
36948 
36949   /* "yt/utilities/lib/geometry_utils.pxd":220
36950  * cdef inline np.uint32_t compact_32bits_by2(np.uint32_t x):
36951  *     # Reversed magic
36952  *     x=x&(<np.uint32_t>0x09249249)             # <<<<<<<<<<<<<<
36953  *     x=(x|(x>>2))&(<np.uint32_t>0x030C30C3)
36954  *     x=(x|(x>>4))&(<np.uint32_t>0x0300F00F)
36955  */
36956   __pyx_v_x = (__pyx_v_x & ((__pyx_t_5numpy_uint32_t)0x09249249));
36957 
36958   /* "yt/utilities/lib/geometry_utils.pxd":221
36959  *     # Reversed magic
36960  *     x=x&(<np.uint32_t>0x09249249)
36961  *     x=(x|(x>>2))&(<np.uint32_t>0x030C30C3)             # <<<<<<<<<<<<<<
36962  *     x=(x|(x>>4))&(<np.uint32_t>0x0300F00F)
36963  *     x=(x|(x>>8))&(<np.uint32_t>0xFF0000FF)
36964  */
36965   __pyx_v_x = ((__pyx_v_x | (__pyx_v_x >> 2)) & ((__pyx_t_5numpy_uint32_t)0x030C30C3));
36966 
36967   /* "yt/utilities/lib/geometry_utils.pxd":222
36968  *     x=x&(<np.uint32_t>0x09249249)
36969  *     x=(x|(x>>2))&(<np.uint32_t>0x030C30C3)
36970  *     x=(x|(x>>4))&(<np.uint32_t>0x0300F00F)             # <<<<<<<<<<<<<<
36971  *     x=(x|(x>>8))&(<np.uint32_t>0xFF0000FF)
36972  *     x=(x|(x>>16))&(<np.uint32_t>0x000003FF)
36973  */
36974   __pyx_v_x = ((__pyx_v_x | (__pyx_v_x >> 4)) & ((__pyx_t_5numpy_uint32_t)0x0300F00F));
36975 
36976   /* "yt/utilities/lib/geometry_utils.pxd":223
36977  *     x=(x|(x>>2))&(<np.uint32_t>0x030C30C3)
36978  *     x=(x|(x>>4))&(<np.uint32_t>0x0300F00F)
36979  *     x=(x|(x>>8))&(<np.uint32_t>0xFF0000FF)             # <<<<<<<<<<<<<<
36980  *     x=(x|(x>>16))&(<np.uint32_t>0x000003FF)
36981  *     return x
36982  */
36983   __pyx_v_x = ((__pyx_v_x | (__pyx_v_x >> 8)) & ((__pyx_t_5numpy_uint32_t)0xFF0000FF));
36984 
36985   /* "yt/utilities/lib/geometry_utils.pxd":224
36986  *     x=(x|(x>>4))&(<np.uint32_t>0x0300F00F)
36987  *     x=(x|(x>>8))&(<np.uint32_t>0xFF0000FF)
36988  *     x=(x|(x>>16))&(<np.uint32_t>0x000003FF)             # <<<<<<<<<<<<<<
36989  *     return x
36990  *
36991  */
36992   __pyx_v_x = ((__pyx_v_x | (__pyx_v_x >> 16)) & ((__pyx_t_5numpy_uint32_t)0x000003FF));
36993 
36994   /* "yt/utilities/lib/geometry_utils.pxd":225
36995  *     x=(x|(x>>8))&(<np.uint32_t>0xFF0000FF)
36996  *     x=(x|(x>>16))&(<np.uint32_t>0x000003FF)
36997  *     return x             # <<<<<<<<<<<<<<
36998  *
36999  * @cython.cdivision(True)
37000  */
37001   __pyx_r = __pyx_v_x;
37002   goto __pyx_L0;
37003 
37004   /* "yt/utilities/lib/geometry_utils.pxd":218
37005  * @cython.boundscheck(False)
37006  * @cython.wraparound(False)
37007  * cdef inline np.uint32_t compact_32bits_by2(np.uint32_t x):             # <<<<<<<<<<<<<<
37008  *     # Reversed magic
37009  *     x=x&(<np.uint32_t>0x09249249)
37010  */
37011 
37012   /* function exit code */
37013   __pyx_L0:;
37014   __Pyx_RefNannyFinishContext();
37015   return __pyx_r;
37016 }
37017 
37018 /* "yt/utilities/lib/geometry_utils.pxd":230
37019  * @cython.boundscheck(False)
37020  * @cython.wraparound(False)
37021  * cdef inline np.uint64_t masked_merge_64bit(np.uint64_t a, np.uint64_t b, np.uint64_t mask):             # <<<<<<<<<<<<<<
37022  *     # https://graphics.stanford.edu/~seander/bithacks.html#MaskedMerge
37023  *     return a ^ ((a ^ b) & mask)
37024  */
37025 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_masked_merge_64bit(__pyx_t_5numpy_uint64_t __pyx_v_a,__pyx_t_5numpy_uint64_t __pyx_v_b,__pyx_t_5numpy_uint64_t __pyx_v_mask)37026 static CYTHON_INLINE __pyx_t_5numpy_uint64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_masked_merge_64bit(__pyx_t_5numpy_uint64_t __pyx_v_a, __pyx_t_5numpy_uint64_t __pyx_v_b, __pyx_t_5numpy_uint64_t __pyx_v_mask) {
37027   __pyx_t_5numpy_uint64_t __pyx_r;
37028   __Pyx_RefNannyDeclarations
37029   __Pyx_RefNannySetupContext("masked_merge_64bit", 0);
37030 
37031   /* "yt/utilities/lib/geometry_utils.pxd":232
37032  * cdef inline np.uint64_t masked_merge_64bit(np.uint64_t a, np.uint64_t b, np.uint64_t mask):
37033  *     # https://graphics.stanford.edu/~seander/bithacks.html#MaskedMerge
37034  *     return a ^ ((a ^ b) & mask)             # <<<<<<<<<<<<<<
37035  *
37036  * @cython.cdivision(True)
37037  */
37038   __pyx_r = (__pyx_v_a ^ ((__pyx_v_a ^ __pyx_v_b) & __pyx_v_mask));
37039   goto __pyx_L0;
37040 
37041   /* "yt/utilities/lib/geometry_utils.pxd":230
37042  * @cython.boundscheck(False)
37043  * @cython.wraparound(False)
37044  * cdef inline np.uint64_t masked_merge_64bit(np.uint64_t a, np.uint64_t b, np.uint64_t mask):             # <<<<<<<<<<<<<<
37045  *     # https://graphics.stanford.edu/~seander/bithacks.html#MaskedMerge
37046  *     return a ^ ((a ^ b) & mask)
37047  */
37048 
37049   /* function exit code */
37050   __pyx_L0:;
37051   __Pyx_RefNannyFinishContext();
37052   return __pyx_r;
37053 }
37054 
37055 /* "yt/utilities/lib/geometry_utils.pxd":235
37056  *
37057  * @cython.cdivision(True)
37058  * cdef inline np.uint64_t encode_morton_64bit(np.uint64_t x_ind, np.uint64_t y_ind, np.uint64_t z_ind):             # <<<<<<<<<<<<<<
37059  *     cdef np.uint64_t mi
37060  *     mi = 0
37061  */
37062 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_encode_morton_64bit(__pyx_t_5numpy_uint64_t __pyx_v_x_ind,__pyx_t_5numpy_uint64_t __pyx_v_y_ind,__pyx_t_5numpy_uint64_t __pyx_v_z_ind)37063 static CYTHON_INLINE __pyx_t_5numpy_uint64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_encode_morton_64bit(__pyx_t_5numpy_uint64_t __pyx_v_x_ind, __pyx_t_5numpy_uint64_t __pyx_v_y_ind, __pyx_t_5numpy_uint64_t __pyx_v_z_ind) {
37064   __pyx_t_5numpy_uint64_t __pyx_v_mi;
37065   __pyx_t_5numpy_uint64_t __pyx_r;
37066   __Pyx_RefNannyDeclarations
37067   __Pyx_RefNannySetupContext("encode_morton_64bit", 0);
37068 
37069   /* "yt/utilities/lib/geometry_utils.pxd":237
37070  * cdef inline np.uint64_t encode_morton_64bit(np.uint64_t x_ind, np.uint64_t y_ind, np.uint64_t z_ind):
37071  *     cdef np.uint64_t mi
37072  *     mi = 0             # <<<<<<<<<<<<<<
37073  *     mi |= spread_64bits_by2(z_ind)<<ZSHIFT
37074  *     mi |= spread_64bits_by2(y_ind)<<YSHIFT
37075  */
37076   __pyx_v_mi = 0;
37077 
37078   /* "yt/utilities/lib/geometry_utils.pxd":238
37079  *     cdef np.uint64_t mi
37080  *     mi = 0
37081  *     mi |= spread_64bits_by2(z_ind)<<ZSHIFT             # <<<<<<<<<<<<<<
37082  *     mi |= spread_64bits_by2(y_ind)<<YSHIFT
37083  *     mi |= spread_64bits_by2(x_ind)<<XSHIFT
37084  */
37085   __pyx_v_mi = (__pyx_v_mi | (__pyx_f_2yt_9utilities_3lib_14geometry_utils_spread_64bits_by2(__pyx_v_z_ind) << 0));
37086 
37087   /* "yt/utilities/lib/geometry_utils.pxd":239
37088  *     mi = 0
37089  *     mi |= spread_64bits_by2(z_ind)<<ZSHIFT
37090  *     mi |= spread_64bits_by2(y_ind)<<YSHIFT             # <<<<<<<<<<<<<<
37091  *     mi |= spread_64bits_by2(x_ind)<<XSHIFT
37092  *     return mi
37093  */
37094   __pyx_v_mi = (__pyx_v_mi | (__pyx_f_2yt_9utilities_3lib_14geometry_utils_spread_64bits_by2(__pyx_v_y_ind) << 1));
37095 
37096   /* "yt/utilities/lib/geometry_utils.pxd":240
37097  *     mi |= spread_64bits_by2(z_ind)<<ZSHIFT
37098  *     mi |= spread_64bits_by2(y_ind)<<YSHIFT
37099  *     mi |= spread_64bits_by2(x_ind)<<XSHIFT             # <<<<<<<<<<<<<<
37100  *     return mi
37101  *
37102  */
37103   __pyx_v_mi = (__pyx_v_mi | (__pyx_f_2yt_9utilities_3lib_14geometry_utils_spread_64bits_by2(__pyx_v_x_ind) << 2));
37104 
37105   /* "yt/utilities/lib/geometry_utils.pxd":241
37106  *     mi |= spread_64bits_by2(y_ind)<<YSHIFT
37107  *     mi |= spread_64bits_by2(x_ind)<<XSHIFT
37108  *     return mi             # <<<<<<<<<<<<<<
37109  *
37110  * @cython.cdivision(True)
37111  */
37112   __pyx_r = __pyx_v_mi;
37113   goto __pyx_L0;
37114 
37115   /* "yt/utilities/lib/geometry_utils.pxd":235
37116  *
37117  * @cython.cdivision(True)
37118  * cdef inline np.uint64_t encode_morton_64bit(np.uint64_t x_ind, np.uint64_t y_ind, np.uint64_t z_ind):             # <<<<<<<<<<<<<<
37119  *     cdef np.uint64_t mi
37120  *     mi = 0
37121  */
37122 
37123   /* function exit code */
37124   __pyx_L0:;
37125   __Pyx_RefNannyFinishContext();
37126   return __pyx_r;
37127 }
37128 
37129 /* "yt/utilities/lib/geometry_utils.pxd":244
37130  *
37131  * @cython.cdivision(True)
37132  * cdef inline void decode_morton_64bit(np.uint64_t mi, np.uint64_t *p):             # <<<<<<<<<<<<<<
37133  *     p[0] = compact_64bits_by2(mi>>XSHIFT)
37134  *     p[1] = compact_64bits_by2(mi>>YSHIFT)
37135  */
37136 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_decode_morton_64bit(__pyx_t_5numpy_uint64_t __pyx_v_mi,__pyx_t_5numpy_uint64_t * __pyx_v_p)37137 static CYTHON_INLINE void __pyx_f_2yt_9utilities_3lib_14geometry_utils_decode_morton_64bit(__pyx_t_5numpy_uint64_t __pyx_v_mi, __pyx_t_5numpy_uint64_t *__pyx_v_p) {
37138   __Pyx_RefNannyDeclarations
37139   __Pyx_RefNannySetupContext("decode_morton_64bit", 0);
37140 
37141   /* "yt/utilities/lib/geometry_utils.pxd":245
37142  * @cython.cdivision(True)
37143  * cdef inline void decode_morton_64bit(np.uint64_t mi, np.uint64_t *p):
37144  *     p[0] = compact_64bits_by2(mi>>XSHIFT)             # <<<<<<<<<<<<<<
37145  *     p[1] = compact_64bits_by2(mi>>YSHIFT)
37146  *     p[2] = compact_64bits_by2(mi>>ZSHIFT)
37147  */
37148   (__pyx_v_p[0]) = __pyx_f_2yt_9utilities_3lib_14geometry_utils_compact_64bits_by2((__pyx_v_mi >> 2));
37149 
37150   /* "yt/utilities/lib/geometry_utils.pxd":246
37151  * cdef inline void decode_morton_64bit(np.uint64_t mi, np.uint64_t *p):
37152  *     p[0] = compact_64bits_by2(mi>>XSHIFT)
37153  *     p[1] = compact_64bits_by2(mi>>YSHIFT)             # <<<<<<<<<<<<<<
37154  *     p[2] = compact_64bits_by2(mi>>ZSHIFT)
37155  *
37156  */
37157   (__pyx_v_p[1]) = __pyx_f_2yt_9utilities_3lib_14geometry_utils_compact_64bits_by2((__pyx_v_mi >> 1));
37158 
37159   /* "yt/utilities/lib/geometry_utils.pxd":247
37160  *     p[0] = compact_64bits_by2(mi>>XSHIFT)
37161  *     p[1] = compact_64bits_by2(mi>>YSHIFT)
37162  *     p[2] = compact_64bits_by2(mi>>ZSHIFT)             # <<<<<<<<<<<<<<
37163  *
37164  * @cython.cdivision(True)
37165  */
37166   (__pyx_v_p[2]) = __pyx_f_2yt_9utilities_3lib_14geometry_utils_compact_64bits_by2((__pyx_v_mi >> 0));
37167 
37168   /* "yt/utilities/lib/geometry_utils.pxd":244
37169  *
37170  * @cython.cdivision(True)
37171  * cdef inline void decode_morton_64bit(np.uint64_t mi, np.uint64_t *p):             # <<<<<<<<<<<<<<
37172  *     p[0] = compact_64bits_by2(mi>>XSHIFT)
37173  *     p[1] = compact_64bits_by2(mi>>YSHIFT)
37174  */
37175 
37176   /* function exit code */
37177   __Pyx_RefNannyFinishContext();
37178 }
37179 
37180 /* "yt/utilities/lib/geometry_utils.pxd":250
37181  *
37182  * @cython.cdivision(True)
37183  * cdef inline np.uint64_t bounded_morton(np.float64_t x, np.float64_t y, np.float64_t z,             # <<<<<<<<<<<<<<
37184  *                                np.float64_t *DLE, np.float64_t *DRE, np.int32_t order):
37185  *     cdef int i
37186  */
37187 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_bounded_morton(__pyx_t_5numpy_float64_t __pyx_v_x,__pyx_t_5numpy_float64_t __pyx_v_y,__pyx_t_5numpy_float64_t __pyx_v_z,__pyx_t_5numpy_float64_t * __pyx_v_DLE,__pyx_t_5numpy_float64_t * __pyx_v_DRE,__pyx_t_5numpy_int32_t __pyx_v_order)37188 static CYTHON_INLINE __pyx_t_5numpy_uint64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_bounded_morton(__pyx_t_5numpy_float64_t __pyx_v_x, __pyx_t_5numpy_float64_t __pyx_v_y, __pyx_t_5numpy_float64_t __pyx_v_z, __pyx_t_5numpy_float64_t *__pyx_v_DLE, __pyx_t_5numpy_float64_t *__pyx_v_DRE, __pyx_t_5numpy_int32_t __pyx_v_order) {
37189   int __pyx_v_i;
37190   __pyx_t_5numpy_float64_t __pyx_v_dds[3];
37191   __pyx_t_5numpy_uint64_t __pyx_v_x_ind;
37192   __pyx_t_5numpy_uint64_t __pyx_v_y_ind;
37193   __pyx_t_5numpy_uint64_t __pyx_v_z_ind;
37194   __pyx_t_5numpy_uint64_t __pyx_v_mi;
37195   __pyx_t_5numpy_uint64_t __pyx_r;
37196   __Pyx_RefNannyDeclarations
37197   int __pyx_t_1;
37198   __Pyx_RefNannySetupContext("bounded_morton", 0);
37199 
37200   /* "yt/utilities/lib/geometry_utils.pxd":256
37201  *     cdef np.uint64_t x_ind, y_ind, z_ind
37202  *     cdef np.uint64_t mi
37203  *     for i in range(3):             # <<<<<<<<<<<<<<
37204  *         dds[i] = (DRE[i] - DLE[i]) / (1 << order)
37205  *     x_ind = <np.uint64_t> ((x - DLE[0])/dds[0])
37206  */
37207   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
37208     __pyx_v_i = __pyx_t_1;
37209 
37210     /* "yt/utilities/lib/geometry_utils.pxd":257
37211  *     cdef np.uint64_t mi
37212  *     for i in range(3):
37213  *         dds[i] = (DRE[i] - DLE[i]) / (1 << order)             # <<<<<<<<<<<<<<
37214  *     x_ind = <np.uint64_t> ((x - DLE[0])/dds[0])
37215  *     y_ind = <np.uint64_t> ((y - DLE[1])/dds[1])
37216  */
37217     (__pyx_v_dds[__pyx_v_i]) = (((__pyx_v_DRE[__pyx_v_i]) - (__pyx_v_DLE[__pyx_v_i])) / (1 << __pyx_v_order));
37218   }
37219 
37220   /* "yt/utilities/lib/geometry_utils.pxd":258
37221  *     for i in range(3):
37222  *         dds[i] = (DRE[i] - DLE[i]) / (1 << order)
37223  *     x_ind = <np.uint64_t> ((x - DLE[0])/dds[0])             # <<<<<<<<<<<<<<
37224  *     y_ind = <np.uint64_t> ((y - DLE[1])/dds[1])
37225  *     z_ind = <np.uint64_t> ((z - DLE[2])/dds[2])
37226  */
37227   __pyx_v_x_ind = ((__pyx_t_5numpy_uint64_t)((__pyx_v_x - (__pyx_v_DLE[0])) / (__pyx_v_dds[0])));
37228 
37229   /* "yt/utilities/lib/geometry_utils.pxd":259
37230  *         dds[i] = (DRE[i] - DLE[i]) / (1 << order)
37231  *     x_ind = <np.uint64_t> ((x - DLE[0])/dds[0])
37232  *     y_ind = <np.uint64_t> ((y - DLE[1])/dds[1])             # <<<<<<<<<<<<<<
37233  *     z_ind = <np.uint64_t> ((z - DLE[2])/dds[2])
37234  *     mi = encode_morton_64bit(x_ind,y_ind,z_ind)
37235  */
37236   __pyx_v_y_ind = ((__pyx_t_5numpy_uint64_t)((__pyx_v_y - (__pyx_v_DLE[1])) / (__pyx_v_dds[1])));
37237 
37238   /* "yt/utilities/lib/geometry_utils.pxd":260
37239  *     x_ind = <np.uint64_t> ((x - DLE[0])/dds[0])
37240  *     y_ind = <np.uint64_t> ((y - DLE[1])/dds[1])
37241  *     z_ind = <np.uint64_t> ((z - DLE[2])/dds[2])             # <<<<<<<<<<<<<<
37242  *     mi = encode_morton_64bit(x_ind,y_ind,z_ind)
37243  *     return mi
37244  */
37245   __pyx_v_z_ind = ((__pyx_t_5numpy_uint64_t)((__pyx_v_z - (__pyx_v_DLE[2])) / (__pyx_v_dds[2])));
37246 
37247   /* "yt/utilities/lib/geometry_utils.pxd":261
37248  *     y_ind = <np.uint64_t> ((y - DLE[1])/dds[1])
37249  *     z_ind = <np.uint64_t> ((z - DLE[2])/dds[2])
37250  *     mi = encode_morton_64bit(x_ind,y_ind,z_ind)             # <<<<<<<<<<<<<<
37251  *     return mi
37252  *
37253  */
37254   __pyx_v_mi = __pyx_f_2yt_9utilities_3lib_14geometry_utils_encode_morton_64bit(__pyx_v_x_ind, __pyx_v_y_ind, __pyx_v_z_ind);
37255 
37256   /* "yt/utilities/lib/geometry_utils.pxd":262
37257  *     z_ind = <np.uint64_t> ((z - DLE[2])/dds[2])
37258  *     mi = encode_morton_64bit(x_ind,y_ind,z_ind)
37259  *     return mi             # <<<<<<<<<<<<<<
37260  *
37261  * @cython.cdivision(True)
37262  */
37263   __pyx_r = __pyx_v_mi;
37264   goto __pyx_L0;
37265 
37266   /* "yt/utilities/lib/geometry_utils.pxd":250
37267  *
37268  * @cython.cdivision(True)
37269  * cdef inline np.uint64_t bounded_morton(np.float64_t x, np.float64_t y, np.float64_t z,             # <<<<<<<<<<<<<<
37270  *                                np.float64_t *DLE, np.float64_t *DRE, np.int32_t order):
37271  *     cdef int i
37272  */
37273 
37274   /* function exit code */
37275   __pyx_L0:;
37276   __Pyx_RefNannyFinishContext();
37277   return __pyx_r;
37278 }
37279 
37280 /* "yt/utilities/lib/geometry_utils.pxd":265
37281  *
37282  * @cython.cdivision(True)
37283  * cdef inline np.uint64_t bounded_morton_relative(np.float64_t x, np.float64_t y, np.float64_t z,             # <<<<<<<<<<<<<<
37284  *                                np.float64_t *DLE, np.float64_t *DRE,
37285  *                                np.int32_t order1, np.int32_t order2):
37286  */
37287 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_bounded_morton_relative(__pyx_t_5numpy_float64_t __pyx_v_x,__pyx_t_5numpy_float64_t __pyx_v_y,__pyx_t_5numpy_float64_t __pyx_v_z,__pyx_t_5numpy_float64_t * __pyx_v_DLE,__pyx_t_5numpy_float64_t * __pyx_v_DRE,__pyx_t_5numpy_int32_t __pyx_v_order1,__pyx_t_5numpy_int32_t __pyx_v_order2)37288 static CYTHON_INLINE __pyx_t_5numpy_uint64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_bounded_morton_relative(__pyx_t_5numpy_float64_t __pyx_v_x, __pyx_t_5numpy_float64_t __pyx_v_y, __pyx_t_5numpy_float64_t __pyx_v_z, __pyx_t_5numpy_float64_t *__pyx_v_DLE, __pyx_t_5numpy_float64_t *__pyx_v_DRE, __pyx_t_5numpy_int32_t __pyx_v_order1, __pyx_t_5numpy_int32_t __pyx_v_order2) {
37289   int __pyx_v_i;
37290   __pyx_t_5numpy_float64_t __pyx_v_dds1[3];
37291   __pyx_t_5numpy_float64_t __pyx_v_dds2[3];
37292   __pyx_t_5numpy_float64_t __pyx_v_DLE2[3];
37293   __pyx_t_5numpy_uint64_t __pyx_v_x_ind;
37294   __pyx_t_5numpy_uint64_t __pyx_v_y_ind;
37295   __pyx_t_5numpy_uint64_t __pyx_v_z_ind;
37296   __pyx_t_5numpy_uint64_t __pyx_v_mi2;
37297   __pyx_t_5numpy_uint64_t __pyx_r;
37298   __Pyx_RefNannyDeclarations
37299   int __pyx_t_1;
37300   __Pyx_RefNannySetupContext("bounded_morton_relative", 0);
37301 
37302   /* "yt/utilities/lib/geometry_utils.pxd":274
37303  *     cdef np.uint64_t x_ind, y_ind, z_ind
37304  *     cdef np.uint64_t mi2
37305  *     for i in range(3):             # <<<<<<<<<<<<<<
37306  *         dds1[i] = (DRE[i] - DLE[i]) / (1 << order1)
37307  *         dds2[i] = dds1[i] / (1 << order2)
37308  */
37309   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
37310     __pyx_v_i = __pyx_t_1;
37311 
37312     /* "yt/utilities/lib/geometry_utils.pxd":275
37313  *     cdef np.uint64_t mi2
37314  *     for i in range(3):
37315  *         dds1[i] = (DRE[i] - DLE[i]) / (1 << order1)             # <<<<<<<<<<<<<<
37316  *         dds2[i] = dds1[i] / (1 << order2)
37317  *     DLE2[0] = <np.float64_t> (<np.uint64_t> ((x - DLE[0])/dds1[0])) * dds1[0]
37318  */
37319     (__pyx_v_dds1[__pyx_v_i]) = (((__pyx_v_DRE[__pyx_v_i]) - (__pyx_v_DLE[__pyx_v_i])) / (1 << __pyx_v_order1));
37320 
37321     /* "yt/utilities/lib/geometry_utils.pxd":276
37322  *     for i in range(3):
37323  *         dds1[i] = (DRE[i] - DLE[i]) / (1 << order1)
37324  *         dds2[i] = dds1[i] / (1 << order2)             # <<<<<<<<<<<<<<
37325  *     DLE2[0] = <np.float64_t> (<np.uint64_t> ((x - DLE[0])/dds1[0])) * dds1[0]
37326  *     DLE2[1] = <np.float64_t> (<np.uint64_t> ((y - DLE[1])/dds1[1])) * dds1[1]
37327  */
37328     (__pyx_v_dds2[__pyx_v_i]) = ((__pyx_v_dds1[__pyx_v_i]) / (1 << __pyx_v_order2));
37329   }
37330 
37331   /* "yt/utilities/lib/geometry_utils.pxd":277
37332  *         dds1[i] = (DRE[i] - DLE[i]) / (1 << order1)
37333  *         dds2[i] = dds1[i] / (1 << order2)
37334  *     DLE2[0] = <np.float64_t> (<np.uint64_t> ((x - DLE[0])/dds1[0])) * dds1[0]             # <<<<<<<<<<<<<<
37335  *     DLE2[1] = <np.float64_t> (<np.uint64_t> ((y - DLE[1])/dds1[1])) * dds1[1]
37336  *     DLE2[2] = <np.float64_t> (<np.uint64_t> ((z - DLE[2])/dds1[2])) * dds1[2]
37337  */
37338   (__pyx_v_DLE2[0]) = (((__pyx_t_5numpy_float64_t)((__pyx_t_5numpy_uint64_t)((__pyx_v_x - (__pyx_v_DLE[0])) / (__pyx_v_dds1[0])))) * (__pyx_v_dds1[0]));
37339 
37340   /* "yt/utilities/lib/geometry_utils.pxd":278
37341  *         dds2[i] = dds1[i] / (1 << order2)
37342  *     DLE2[0] = <np.float64_t> (<np.uint64_t> ((x - DLE[0])/dds1[0])) * dds1[0]
37343  *     DLE2[1] = <np.float64_t> (<np.uint64_t> ((y - DLE[1])/dds1[1])) * dds1[1]             # <<<<<<<<<<<<<<
37344  *     DLE2[2] = <np.float64_t> (<np.uint64_t> ((z - DLE[2])/dds1[2])) * dds1[2]
37345  *     x_ind = <np.uint64_t> ((x - DLE2[0])/dds2[0])
37346  */
37347   (__pyx_v_DLE2[1]) = (((__pyx_t_5numpy_float64_t)((__pyx_t_5numpy_uint64_t)((__pyx_v_y - (__pyx_v_DLE[1])) / (__pyx_v_dds1[1])))) * (__pyx_v_dds1[1]));
37348 
37349   /* "yt/utilities/lib/geometry_utils.pxd":279
37350  *     DLE2[0] = <np.float64_t> (<np.uint64_t> ((x - DLE[0])/dds1[0])) * dds1[0]
37351  *     DLE2[1] = <np.float64_t> (<np.uint64_t> ((y - DLE[1])/dds1[1])) * dds1[1]
37352  *     DLE2[2] = <np.float64_t> (<np.uint64_t> ((z - DLE[2])/dds1[2])) * dds1[2]             # <<<<<<<<<<<<<<
37353  *     x_ind = <np.uint64_t> ((x - DLE2[0])/dds2[0])
37354  *     y_ind = <np.uint64_t> ((y - DLE2[1])/dds2[1])
37355  */
37356   (__pyx_v_DLE2[2]) = (((__pyx_t_5numpy_float64_t)((__pyx_t_5numpy_uint64_t)((__pyx_v_z - (__pyx_v_DLE[2])) / (__pyx_v_dds1[2])))) * (__pyx_v_dds1[2]));
37357 
37358   /* "yt/utilities/lib/geometry_utils.pxd":280
37359  *     DLE2[1] = <np.float64_t> (<np.uint64_t> ((y - DLE[1])/dds1[1])) * dds1[1]
37360  *     DLE2[2] = <np.float64_t> (<np.uint64_t> ((z - DLE[2])/dds1[2])) * dds1[2]
37361  *     x_ind = <np.uint64_t> ((x - DLE2[0])/dds2[0])             # <<<<<<<<<<<<<<
37362  *     y_ind = <np.uint64_t> ((y - DLE2[1])/dds2[1])
37363  *     z_ind = <np.uint64_t> ((z - DLE2[2])/dds2[2])
37364  */
37365   __pyx_v_x_ind = ((__pyx_t_5numpy_uint64_t)((__pyx_v_x - (__pyx_v_DLE2[0])) / (__pyx_v_dds2[0])));
37366 
37367   /* "yt/utilities/lib/geometry_utils.pxd":281
37368  *     DLE2[2] = <np.float64_t> (<np.uint64_t> ((z - DLE[2])/dds1[2])) * dds1[2]
37369  *     x_ind = <np.uint64_t> ((x - DLE2[0])/dds2[0])
37370  *     y_ind = <np.uint64_t> ((y - DLE2[1])/dds2[1])             # <<<<<<<<<<<<<<
37371  *     z_ind = <np.uint64_t> ((z - DLE2[2])/dds2[2])
37372  *     mi2 = encode_morton_64bit(x_ind,y_ind,z_ind)
37373  */
37374   __pyx_v_y_ind = ((__pyx_t_5numpy_uint64_t)((__pyx_v_y - (__pyx_v_DLE2[1])) / (__pyx_v_dds2[1])));
37375 
37376   /* "yt/utilities/lib/geometry_utils.pxd":282
37377  *     x_ind = <np.uint64_t> ((x - DLE2[0])/dds2[0])
37378  *     y_ind = <np.uint64_t> ((y - DLE2[1])/dds2[1])
37379  *     z_ind = <np.uint64_t> ((z - DLE2[2])/dds2[2])             # <<<<<<<<<<<<<<
37380  *     mi2 = encode_morton_64bit(x_ind,y_ind,z_ind)
37381  *     return mi2
37382  */
37383   __pyx_v_z_ind = ((__pyx_t_5numpy_uint64_t)((__pyx_v_z - (__pyx_v_DLE2[2])) / (__pyx_v_dds2[2])));
37384 
37385   /* "yt/utilities/lib/geometry_utils.pxd":283
37386  *     y_ind = <np.uint64_t> ((y - DLE2[1])/dds2[1])
37387  *     z_ind = <np.uint64_t> ((z - DLE2[2])/dds2[2])
37388  *     mi2 = encode_morton_64bit(x_ind,y_ind,z_ind)             # <<<<<<<<<<<<<<
37389  *     return mi2
37390  *
37391  */
37392   __pyx_v_mi2 = __pyx_f_2yt_9utilities_3lib_14geometry_utils_encode_morton_64bit(__pyx_v_x_ind, __pyx_v_y_ind, __pyx_v_z_ind);
37393 
37394   /* "yt/utilities/lib/geometry_utils.pxd":284
37395  *     z_ind = <np.uint64_t> ((z - DLE2[2])/dds2[2])
37396  *     mi2 = encode_morton_64bit(x_ind,y_ind,z_ind)
37397  *     return mi2             # <<<<<<<<<<<<<<
37398  *
37399  *
37400  */
37401   __pyx_r = __pyx_v_mi2;
37402   goto __pyx_L0;
37403 
37404   /* "yt/utilities/lib/geometry_utils.pxd":265
37405  *
37406  * @cython.cdivision(True)
37407  * cdef inline np.uint64_t bounded_morton_relative(np.float64_t x, np.float64_t y, np.float64_t z,             # <<<<<<<<<<<<<<
37408  *                                np.float64_t *DLE, np.float64_t *DRE,
37409  *                                np.int32_t order1, np.int32_t order2):
37410  */
37411 
37412   /* function exit code */
37413   __pyx_L0:;
37414   __Pyx_RefNannyFinishContext();
37415   return __pyx_r;
37416 }
37417 
37418 /* "yt/utilities/lib/geometry_utils.pxd":289
37419  * # This dosn't seem to be much, if at all, faster...
37420  * @cython.cdivision(True)
37421  * cdef inline np.uint64_t bounded_morton_dds(np.float64_t x, np.float64_t y, np.float64_t z,             # <<<<<<<<<<<<<<
37422  *                                np.float64_t *DLE, np.float64_t *dds):
37423  *     cdef np.uint64_t x_ind, y_ind, z_ind
37424  */
37425 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_bounded_morton_dds(__pyx_t_5numpy_float64_t __pyx_v_x,__pyx_t_5numpy_float64_t __pyx_v_y,__pyx_t_5numpy_float64_t __pyx_v_z,__pyx_t_5numpy_float64_t * __pyx_v_DLE,__pyx_t_5numpy_float64_t * __pyx_v_dds)37426 static CYTHON_INLINE __pyx_t_5numpy_uint64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_bounded_morton_dds(__pyx_t_5numpy_float64_t __pyx_v_x, __pyx_t_5numpy_float64_t __pyx_v_y, __pyx_t_5numpy_float64_t __pyx_v_z, __pyx_t_5numpy_float64_t *__pyx_v_DLE, __pyx_t_5numpy_float64_t *__pyx_v_dds) {
37427   __pyx_t_5numpy_uint64_t __pyx_v_x_ind;
37428   __pyx_t_5numpy_uint64_t __pyx_v_y_ind;
37429   __pyx_t_5numpy_uint64_t __pyx_v_z_ind;
37430   __pyx_t_5numpy_uint64_t __pyx_v_mi;
37431   __pyx_t_5numpy_uint64_t __pyx_r;
37432   __Pyx_RefNannyDeclarations
37433   __Pyx_RefNannySetupContext("bounded_morton_dds", 0);
37434 
37435   /* "yt/utilities/lib/geometry_utils.pxd":293
37436  *     cdef np.uint64_t x_ind, y_ind, z_ind
37437  *     cdef np.uint64_t mi
37438  *     x_ind = <np.uint64_t> ((x - DLE[0])/dds[0])             # <<<<<<<<<<<<<<
37439  *     y_ind = <np.uint64_t> ((y - DLE[1])/dds[1])
37440  *     z_ind = <np.uint64_t> ((z - DLE[2])/dds[2])
37441  */
37442   __pyx_v_x_ind = ((__pyx_t_5numpy_uint64_t)((__pyx_v_x - (__pyx_v_DLE[0])) / (__pyx_v_dds[0])));
37443 
37444   /* "yt/utilities/lib/geometry_utils.pxd":294
37445  *     cdef np.uint64_t mi
37446  *     x_ind = <np.uint64_t> ((x - DLE[0])/dds[0])
37447  *     y_ind = <np.uint64_t> ((y - DLE[1])/dds[1])             # <<<<<<<<<<<<<<
37448  *     z_ind = <np.uint64_t> ((z - DLE[2])/dds[2])
37449  *     mi = encode_morton_64bit(x_ind,y_ind,z_ind)
37450  */
37451   __pyx_v_y_ind = ((__pyx_t_5numpy_uint64_t)((__pyx_v_y - (__pyx_v_DLE[1])) / (__pyx_v_dds[1])));
37452 
37453   /* "yt/utilities/lib/geometry_utils.pxd":295
37454  *     x_ind = <np.uint64_t> ((x - DLE[0])/dds[0])
37455  *     y_ind = <np.uint64_t> ((y - DLE[1])/dds[1])
37456  *     z_ind = <np.uint64_t> ((z - DLE[2])/dds[2])             # <<<<<<<<<<<<<<
37457  *     mi = encode_morton_64bit(x_ind,y_ind,z_ind)
37458  *     return mi
37459  */
37460   __pyx_v_z_ind = ((__pyx_t_5numpy_uint64_t)((__pyx_v_z - (__pyx_v_DLE[2])) / (__pyx_v_dds[2])));
37461 
37462   /* "yt/utilities/lib/geometry_utils.pxd":296
37463  *     y_ind = <np.uint64_t> ((y - DLE[1])/dds[1])
37464  *     z_ind = <np.uint64_t> ((z - DLE[2])/dds[2])
37465  *     mi = encode_morton_64bit(x_ind,y_ind,z_ind)             # <<<<<<<<<<<<<<
37466  *     return mi
37467  *
37468  */
37469   __pyx_v_mi = __pyx_f_2yt_9utilities_3lib_14geometry_utils_encode_morton_64bit(__pyx_v_x_ind, __pyx_v_y_ind, __pyx_v_z_ind);
37470 
37471   /* "yt/utilities/lib/geometry_utils.pxd":297
37472  *     z_ind = <np.uint64_t> ((z - DLE[2])/dds[2])
37473  *     mi = encode_morton_64bit(x_ind,y_ind,z_ind)
37474  *     return mi             # <<<<<<<<<<<<<<
37475  *
37476  * @cython.cdivision(True)
37477  */
37478   __pyx_r = __pyx_v_mi;
37479   goto __pyx_L0;
37480 
37481   /* "yt/utilities/lib/geometry_utils.pxd":289
37482  * # This dosn't seem to be much, if at all, faster...
37483  * @cython.cdivision(True)
37484  * cdef inline np.uint64_t bounded_morton_dds(np.float64_t x, np.float64_t y, np.float64_t z,             # <<<<<<<<<<<<<<
37485  *                                np.float64_t *DLE, np.float64_t *dds):
37486  *     cdef np.uint64_t x_ind, y_ind, z_ind
37487  */
37488 
37489   /* function exit code */
37490   __pyx_L0:;
37491   __Pyx_RefNannyFinishContext();
37492   return __pyx_r;
37493 }
37494 
37495 /* "yt/utilities/lib/geometry_utils.pxd":300
37496  *
37497  * @cython.cdivision(True)
37498  * cdef inline np.uint64_t bounded_morton_relative_dds(np.float64_t x, np.float64_t y, np.float64_t z,             # <<<<<<<<<<<<<<
37499  *                                np.float64_t *DLE, np.float64_t *dds1, np.float64_t *dds2):
37500  *     cdef np.float64_t DLE2[3]
37501  */
37502 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_bounded_morton_relative_dds(__pyx_t_5numpy_float64_t __pyx_v_x,__pyx_t_5numpy_float64_t __pyx_v_y,__pyx_t_5numpy_float64_t __pyx_v_z,__pyx_t_5numpy_float64_t * __pyx_v_DLE,__pyx_t_5numpy_float64_t * __pyx_v_dds1,__pyx_t_5numpy_float64_t * __pyx_v_dds2)37503 static CYTHON_INLINE __pyx_t_5numpy_uint64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_bounded_morton_relative_dds(__pyx_t_5numpy_float64_t __pyx_v_x, __pyx_t_5numpy_float64_t __pyx_v_y, __pyx_t_5numpy_float64_t __pyx_v_z, __pyx_t_5numpy_float64_t *__pyx_v_DLE, __pyx_t_5numpy_float64_t *__pyx_v_dds1, __pyx_t_5numpy_float64_t *__pyx_v_dds2) {
37504   __pyx_t_5numpy_float64_t __pyx_v_DLE2[3];
37505   __pyx_t_5numpy_uint64_t __pyx_v_x_ind;
37506   __pyx_t_5numpy_uint64_t __pyx_v_y_ind;
37507   __pyx_t_5numpy_uint64_t __pyx_v_z_ind;
37508   __pyx_t_5numpy_uint64_t __pyx_v_mi2;
37509   __pyx_t_5numpy_uint64_t __pyx_r;
37510   __Pyx_RefNannyDeclarations
37511   __Pyx_RefNannySetupContext("bounded_morton_relative_dds", 0);
37512 
37513   /* "yt/utilities/lib/geometry_utils.pxd":305
37514  *     cdef np.uint64_t x_ind, y_ind, z_ind
37515  *     cdef np.uint64_t mi2
37516  *     DLE2[0] = <np.float64_t> (<np.uint64_t> ((x - DLE[0])/dds1[0])) * dds1[0]             # <<<<<<<<<<<<<<
37517  *     DLE2[1] = <np.float64_t> (<np.uint64_t> ((y - DLE[1])/dds1[1])) * dds1[1]
37518  *     DLE2[2] = <np.float64_t> (<np.uint64_t> ((z - DLE[2])/dds1[2])) * dds1[2]
37519  */
37520   (__pyx_v_DLE2[0]) = (((__pyx_t_5numpy_float64_t)((__pyx_t_5numpy_uint64_t)((__pyx_v_x - (__pyx_v_DLE[0])) / (__pyx_v_dds1[0])))) * (__pyx_v_dds1[0]));
37521 
37522   /* "yt/utilities/lib/geometry_utils.pxd":306
37523  *     cdef np.uint64_t mi2
37524  *     DLE2[0] = <np.float64_t> (<np.uint64_t> ((x - DLE[0])/dds1[0])) * dds1[0]
37525  *     DLE2[1] = <np.float64_t> (<np.uint64_t> ((y - DLE[1])/dds1[1])) * dds1[1]             # <<<<<<<<<<<<<<
37526  *     DLE2[2] = <np.float64_t> (<np.uint64_t> ((z - DLE[2])/dds1[2])) * dds1[2]
37527  *     x_ind = <np.uint64_t> ((x - DLE2[0])/dds2[0])
37528  */
37529   (__pyx_v_DLE2[1]) = (((__pyx_t_5numpy_float64_t)((__pyx_t_5numpy_uint64_t)((__pyx_v_y - (__pyx_v_DLE[1])) / (__pyx_v_dds1[1])))) * (__pyx_v_dds1[1]));
37530 
37531   /* "yt/utilities/lib/geometry_utils.pxd":307
37532  *     DLE2[0] = <np.float64_t> (<np.uint64_t> ((x - DLE[0])/dds1[0])) * dds1[0]
37533  *     DLE2[1] = <np.float64_t> (<np.uint64_t> ((y - DLE[1])/dds1[1])) * dds1[1]
37534  *     DLE2[2] = <np.float64_t> (<np.uint64_t> ((z - DLE[2])/dds1[2])) * dds1[2]             # <<<<<<<<<<<<<<
37535  *     x_ind = <np.uint64_t> ((x - DLE2[0])/dds2[0])
37536  *     y_ind = <np.uint64_t> ((y - DLE2[1])/dds2[1])
37537  */
37538   (__pyx_v_DLE2[2]) = (((__pyx_t_5numpy_float64_t)((__pyx_t_5numpy_uint64_t)((__pyx_v_z - (__pyx_v_DLE[2])) / (__pyx_v_dds1[2])))) * (__pyx_v_dds1[2]));
37539 
37540   /* "yt/utilities/lib/geometry_utils.pxd":308
37541  *     DLE2[1] = <np.float64_t> (<np.uint64_t> ((y - DLE[1])/dds1[1])) * dds1[1]
37542  *     DLE2[2] = <np.float64_t> (<np.uint64_t> ((z - DLE[2])/dds1[2])) * dds1[2]
37543  *     x_ind = <np.uint64_t> ((x - DLE2[0])/dds2[0])             # <<<<<<<<<<<<<<
37544  *     y_ind = <np.uint64_t> ((y - DLE2[1])/dds2[1])
37545  *     z_ind = <np.uint64_t> ((z - DLE2[2])/dds2[2])
37546  */
37547   __pyx_v_x_ind = ((__pyx_t_5numpy_uint64_t)((__pyx_v_x - (__pyx_v_DLE2[0])) / (__pyx_v_dds2[0])));
37548 
37549   /* "yt/utilities/lib/geometry_utils.pxd":309
37550  *     DLE2[2] = <np.float64_t> (<np.uint64_t> ((z - DLE[2])/dds1[2])) * dds1[2]
37551  *     x_ind = <np.uint64_t> ((x - DLE2[0])/dds2[0])
37552  *     y_ind = <np.uint64_t> ((y - DLE2[1])/dds2[1])             # <<<<<<<<<<<<<<
37553  *     z_ind = <np.uint64_t> ((z - DLE2[2])/dds2[2])
37554  *     mi2 = encode_morton_64bit(x_ind,y_ind,z_ind)
37555  */
37556   __pyx_v_y_ind = ((__pyx_t_5numpy_uint64_t)((__pyx_v_y - (__pyx_v_DLE2[1])) / (__pyx_v_dds2[1])));
37557 
37558   /* "yt/utilities/lib/geometry_utils.pxd":310
37559  *     x_ind = <np.uint64_t> ((x - DLE2[0])/dds2[0])
37560  *     y_ind = <np.uint64_t> ((y - DLE2[1])/dds2[1])
37561  *     z_ind = <np.uint64_t> ((z - DLE2[2])/dds2[2])             # <<<<<<<<<<<<<<
37562  *     mi2 = encode_morton_64bit(x_ind,y_ind,z_ind)
37563  *     return mi2
37564  */
37565   __pyx_v_z_ind = ((__pyx_t_5numpy_uint64_t)((__pyx_v_z - (__pyx_v_DLE2[2])) / (__pyx_v_dds2[2])));
37566 
37567   /* "yt/utilities/lib/geometry_utils.pxd":311
37568  *     y_ind = <np.uint64_t> ((y - DLE2[1])/dds2[1])
37569  *     z_ind = <np.uint64_t> ((z - DLE2[2])/dds2[2])
37570  *     mi2 = encode_morton_64bit(x_ind,y_ind,z_ind)             # <<<<<<<<<<<<<<
37571  *     return mi2
37572  *
37573  */
37574   __pyx_v_mi2 = __pyx_f_2yt_9utilities_3lib_14geometry_utils_encode_morton_64bit(__pyx_v_x_ind, __pyx_v_y_ind, __pyx_v_z_ind);
37575 
37576   /* "yt/utilities/lib/geometry_utils.pxd":312
37577  *     z_ind = <np.uint64_t> ((z - DLE2[2])/dds2[2])
37578  *     mi2 = encode_morton_64bit(x_ind,y_ind,z_ind)
37579  *     return mi2             # <<<<<<<<<<<<<<
37580  *
37581  *
37582  */
37583   __pyx_r = __pyx_v_mi2;
37584   goto __pyx_L0;
37585 
37586   /* "yt/utilities/lib/geometry_utils.pxd":300
37587  *
37588  * @cython.cdivision(True)
37589  * cdef inline np.uint64_t bounded_morton_relative_dds(np.float64_t x, np.float64_t y, np.float64_t z,             # <<<<<<<<<<<<<<
37590  *                                np.float64_t *DLE, np.float64_t *dds1, np.float64_t *dds2):
37591  *     cdef np.float64_t DLE2[3]
37592  */
37593 
37594   /* function exit code */
37595   __pyx_L0:;
37596   __Pyx_RefNannyFinishContext();
37597   return __pyx_r;
37598 }
37599 
37600 /* "yt/utilities/lib/geometry_utils.pxd":316
37601  *
37602  * @cython.cdivision(True)
37603  * cdef inline np.uint64_t bounded_morton_split_dds(np.float64_t x, np.float64_t y, np.float64_t z,             # <<<<<<<<<<<<<<
37604  *                                np.float64_t *DLE, np.float64_t *dds, np.uint64_t *p):
37605  *     cdef np.uint64_t mi
37606  */
37607 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_bounded_morton_split_dds(__pyx_t_5numpy_float64_t __pyx_v_x,__pyx_t_5numpy_float64_t __pyx_v_y,__pyx_t_5numpy_float64_t __pyx_v_z,__pyx_t_5numpy_float64_t * __pyx_v_DLE,__pyx_t_5numpy_float64_t * __pyx_v_dds,__pyx_t_5numpy_uint64_t * __pyx_v_p)37608 static CYTHON_INLINE __pyx_t_5numpy_uint64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_bounded_morton_split_dds(__pyx_t_5numpy_float64_t __pyx_v_x, __pyx_t_5numpy_float64_t __pyx_v_y, __pyx_t_5numpy_float64_t __pyx_v_z, __pyx_t_5numpy_float64_t *__pyx_v_DLE, __pyx_t_5numpy_float64_t *__pyx_v_dds, __pyx_t_5numpy_uint64_t *__pyx_v_p) {
37609   __pyx_t_5numpy_uint64_t __pyx_v_mi;
37610   __pyx_t_5numpy_uint64_t __pyx_r;
37611   __Pyx_RefNannyDeclarations
37612   __Pyx_RefNannySetupContext("bounded_morton_split_dds", 0);
37613 
37614   /* "yt/utilities/lib/geometry_utils.pxd":319
37615  *                                np.float64_t *DLE, np.float64_t *dds, np.uint64_t *p):
37616  *     cdef np.uint64_t mi
37617  *     p[0] = <np.uint64_t> ((x - DLE[0])/dds[0])             # <<<<<<<<<<<<<<
37618  *     p[1] = <np.uint64_t> ((y - DLE[1])/dds[1])
37619  *     p[2] = <np.uint64_t> ((z - DLE[2])/dds[2])
37620  */
37621   (__pyx_v_p[0]) = ((__pyx_t_5numpy_uint64_t)((__pyx_v_x - (__pyx_v_DLE[0])) / (__pyx_v_dds[0])));
37622 
37623   /* "yt/utilities/lib/geometry_utils.pxd":320
37624  *     cdef np.uint64_t mi
37625  *     p[0] = <np.uint64_t> ((x - DLE[0])/dds[0])
37626  *     p[1] = <np.uint64_t> ((y - DLE[1])/dds[1])             # <<<<<<<<<<<<<<
37627  *     p[2] = <np.uint64_t> ((z - DLE[2])/dds[2])
37628  *     mi = encode_morton_64bit(p[0], p[1], p[2])
37629  */
37630   (__pyx_v_p[1]) = ((__pyx_t_5numpy_uint64_t)((__pyx_v_y - (__pyx_v_DLE[1])) / (__pyx_v_dds[1])));
37631 
37632   /* "yt/utilities/lib/geometry_utils.pxd":321
37633  *     p[0] = <np.uint64_t> ((x - DLE[0])/dds[0])
37634  *     p[1] = <np.uint64_t> ((y - DLE[1])/dds[1])
37635  *     p[2] = <np.uint64_t> ((z - DLE[2])/dds[2])             # <<<<<<<<<<<<<<
37636  *     mi = encode_morton_64bit(p[0], p[1], p[2])
37637  *     return mi
37638  */
37639   (__pyx_v_p[2]) = ((__pyx_t_5numpy_uint64_t)((__pyx_v_z - (__pyx_v_DLE[2])) / (__pyx_v_dds[2])));
37640 
37641   /* "yt/utilities/lib/geometry_utils.pxd":322
37642  *     p[1] = <np.uint64_t> ((y - DLE[1])/dds[1])
37643  *     p[2] = <np.uint64_t> ((z - DLE[2])/dds[2])
37644  *     mi = encode_morton_64bit(p[0], p[1], p[2])             # <<<<<<<<<<<<<<
37645  *     return mi
37646  *
37647  */
37648   __pyx_v_mi = __pyx_f_2yt_9utilities_3lib_14geometry_utils_encode_morton_64bit((__pyx_v_p[0]), (__pyx_v_p[1]), (__pyx_v_p[2]));
37649 
37650   /* "yt/utilities/lib/geometry_utils.pxd":323
37651  *     p[2] = <np.uint64_t> ((z - DLE[2])/dds[2])
37652  *     mi = encode_morton_64bit(p[0], p[1], p[2])
37653  *     return mi             # <<<<<<<<<<<<<<
37654  *
37655  * @cython.cdivision(True)
37656  */
37657   __pyx_r = __pyx_v_mi;
37658   goto __pyx_L0;
37659 
37660   /* "yt/utilities/lib/geometry_utils.pxd":316
37661  *
37662  * @cython.cdivision(True)
37663  * cdef inline np.uint64_t bounded_morton_split_dds(np.float64_t x, np.float64_t y, np.float64_t z,             # <<<<<<<<<<<<<<
37664  *                                np.float64_t *DLE, np.float64_t *dds, np.uint64_t *p):
37665  *     cdef np.uint64_t mi
37666  */
37667 
37668   /* function exit code */
37669   __pyx_L0:;
37670   __Pyx_RefNannyFinishContext();
37671   return __pyx_r;
37672 }
37673 
37674 /* "yt/utilities/lib/geometry_utils.pxd":326
37675  *
37676  * @cython.cdivision(True)
37677  * cdef inline np.uint64_t bounded_morton_split_relative_dds(np.float64_t x, np.float64_t y, np.float64_t z,             # <<<<<<<<<<<<<<
37678  *                                np.float64_t *DLE, np.float64_t *dds1, np.float64_t *dds2,
37679  *                                np.uint64_t *p2):
37680  */
37681 
__pyx_f_2yt_9utilities_3lib_14geometry_utils_bounded_morton_split_relative_dds(__pyx_t_5numpy_float64_t __pyx_v_x,__pyx_t_5numpy_float64_t __pyx_v_y,__pyx_t_5numpy_float64_t __pyx_v_z,__pyx_t_5numpy_float64_t * __pyx_v_DLE,__pyx_t_5numpy_float64_t * __pyx_v_dds1,__pyx_t_5numpy_float64_t * __pyx_v_dds2,__pyx_t_5numpy_uint64_t * __pyx_v_p2)37682 static CYTHON_INLINE __pyx_t_5numpy_uint64_t __pyx_f_2yt_9utilities_3lib_14geometry_utils_bounded_morton_split_relative_dds(__pyx_t_5numpy_float64_t __pyx_v_x, __pyx_t_5numpy_float64_t __pyx_v_y, __pyx_t_5numpy_float64_t __pyx_v_z, __pyx_t_5numpy_float64_t *__pyx_v_DLE, __pyx_t_5numpy_float64_t *__pyx_v_dds1, __pyx_t_5numpy_float64_t *__pyx_v_dds2, __pyx_t_5numpy_uint64_t *__pyx_v_p2) {
37683   __pyx_t_5numpy_float64_t __pyx_v_DLE2[3];
37684   __pyx_t_5numpy_uint64_t __pyx_v_mi2;
37685   __pyx_t_5numpy_uint64_t __pyx_r;
37686   __Pyx_RefNannyDeclarations
37687   __Pyx_RefNannySetupContext("bounded_morton_split_relative_dds", 0);
37688 
37689   /* "yt/utilities/lib/geometry_utils.pxd":331
37690  *     cdef np.float64_t DLE2[3]
37691  *     cdef np.uint64_t mi2
37692  *     DLE2[0] = DLE[0] + <np.float64_t> (<np.uint64_t> ((x - DLE[0])/dds1[0])) * dds1[0]             # <<<<<<<<<<<<<<
37693  *     DLE2[1] = DLE[1] + <np.float64_t> (<np.uint64_t> ((y - DLE[1])/dds1[1])) * dds1[1]
37694  *     DLE2[2] = DLE[2] + <np.float64_t> (<np.uint64_t> ((z - DLE[2])/dds1[2])) * dds1[2]
37695  */
37696   (__pyx_v_DLE2[0]) = ((__pyx_v_DLE[0]) + (((__pyx_t_5numpy_float64_t)((__pyx_t_5numpy_uint64_t)((__pyx_v_x - (__pyx_v_DLE[0])) / (__pyx_v_dds1[0])))) * (__pyx_v_dds1[0])));
37697 
37698   /* "yt/utilities/lib/geometry_utils.pxd":332
37699  *     cdef np.uint64_t mi2
37700  *     DLE2[0] = DLE[0] + <np.float64_t> (<np.uint64_t> ((x - DLE[0])/dds1[0])) * dds1[0]
37701  *     DLE2[1] = DLE[1] + <np.float64_t> (<np.uint64_t> ((y - DLE[1])/dds1[1])) * dds1[1]             # <<<<<<<<<<<<<<
37702  *     DLE2[2] = DLE[2] + <np.float64_t> (<np.uint64_t> ((z - DLE[2])/dds1[2])) * dds1[2]
37703  *     p2[0] = <np.uint64_t> ((x - DLE2[0])/dds2[0])
37704  */
37705   (__pyx_v_DLE2[1]) = ((__pyx_v_DLE[1]) + (((__pyx_t_5numpy_float64_t)((__pyx_t_5numpy_uint64_t)((__pyx_v_y - (__pyx_v_DLE[1])) / (__pyx_v_dds1[1])))) * (__pyx_v_dds1[1])));
37706 
37707   /* "yt/utilities/lib/geometry_utils.pxd":333
37708  *     DLE2[0] = DLE[0] + <np.float64_t> (<np.uint64_t> ((x - DLE[0])/dds1[0])) * dds1[0]
37709  *     DLE2[1] = DLE[1] + <np.float64_t> (<np.uint64_t> ((y - DLE[1])/dds1[1])) * dds1[1]
37710  *     DLE2[2] = DLE[2] + <np.float64_t> (<np.uint64_t> ((z - DLE[2])/dds1[2])) * dds1[2]             # <<<<<<<<<<<<<<
37711  *     p2[0] = <np.uint64_t> ((x - DLE2[0])/dds2[0])
37712  *     p2[1] = <np.uint64_t> ((y - DLE2[1])/dds2[1])
37713  */
37714   (__pyx_v_DLE2[2]) = ((__pyx_v_DLE[2]) + (((__pyx_t_5numpy_float64_t)((__pyx_t_5numpy_uint64_t)((__pyx_v_z - (__pyx_v_DLE[2])) / (__pyx_v_dds1[2])))) * (__pyx_v_dds1[2])));
37715 
37716   /* "yt/utilities/lib/geometry_utils.pxd":334
37717  *     DLE2[1] = DLE[1] + <np.float64_t> (<np.uint64_t> ((y - DLE[1])/dds1[1])) * dds1[1]
37718  *     DLE2[2] = DLE[2] + <np.float64_t> (<np.uint64_t> ((z - DLE[2])/dds1[2])) * dds1[2]
37719  *     p2[0] = <np.uint64_t> ((x - DLE2[0])/dds2[0])             # <<<<<<<<<<<<<<
37720  *     p2[1] = <np.uint64_t> ((y - DLE2[1])/dds2[1])
37721  *     p2[2] = <np.uint64_t> ((z - DLE2[2])/dds2[2])
37722  */
37723   (__pyx_v_p2[0]) = ((__pyx_t_5numpy_uint64_t)((__pyx_v_x - (__pyx_v_DLE2[0])) / (__pyx_v_dds2[0])));
37724 
37725   /* "yt/utilities/lib/geometry_utils.pxd":335
37726  *     DLE2[2] = DLE[2] + <np.float64_t> (<np.uint64_t> ((z - DLE[2])/dds1[2])) * dds1[2]
37727  *     p2[0] = <np.uint64_t> ((x - DLE2[0])/dds2[0])
37728  *     p2[1] = <np.uint64_t> ((y - DLE2[1])/dds2[1])             # <<<<<<<<<<<<<<
37729  *     p2[2] = <np.uint64_t> ((z - DLE2[2])/dds2[2])
37730  *     mi2 = encode_morton_64bit(p2[0], p2[1], p2[2])
37731  */
37732   (__pyx_v_p2[1]) = ((__pyx_t_5numpy_uint64_t)((__pyx_v_y - (__pyx_v_DLE2[1])) / (__pyx_v_dds2[1])));
37733 
37734   /* "yt/utilities/lib/geometry_utils.pxd":336
37735  *     p2[0] = <np.uint64_t> ((x - DLE2[0])/dds2[0])
37736  *     p2[1] = <np.uint64_t> ((y - DLE2[1])/dds2[1])
37737  *     p2[2] = <np.uint64_t> ((z - DLE2[2])/dds2[2])             # <<<<<<<<<<<<<<
37738  *     mi2 = encode_morton_64bit(p2[0], p2[1], p2[2])
37739  *     return mi2
37740  */
37741   (__pyx_v_p2[2]) = ((__pyx_t_5numpy_uint64_t)((__pyx_v_z - (__pyx_v_DLE2[2])) / (__pyx_v_dds2[2])));
37742 
37743   /* "yt/utilities/lib/geometry_utils.pxd":337
37744  *     p2[1] = <np.uint64_t> ((y - DLE2[1])/dds2[1])
37745  *     p2[2] = <np.uint64_t> ((z - DLE2[2])/dds2[2])
37746  *     mi2 = encode_morton_64bit(p2[0], p2[1], p2[2])             # <<<<<<<<<<<<<<
37747  *     return mi2
37748  *
37749  */
37750   __pyx_v_mi2 = __pyx_f_2yt_9utilities_3lib_14geometry_utils_encode_morton_64bit((__pyx_v_p2[0]), (__pyx_v_p2[1]), (__pyx_v_p2[2]));
37751 
37752   /* "yt/utilities/lib/geometry_utils.pxd":338
37753  *     p2[2] = <np.uint64_t> ((z - DLE2[2])/dds2[2])
37754  *     mi2 = encode_morton_64bit(p2[0], p2[1], p2[2])
37755  *     return mi2             # <<<<<<<<<<<<<<
37756  *
37757  *
37758  */
37759   __pyx_r = __pyx_v_mi2;
37760   goto __pyx_L0;
37761 
37762   /* "yt/utilities/lib/geometry_utils.pxd":326
37763  *
37764  * @cython.cdivision(True)
37765  * cdef inline np.uint64_t bounded_morton_split_relative_dds(np.float64_t x, np.float64_t y, np.float64_t z,             # <<<<<<<<<<<<<<
37766  *                                np.float64_t *DLE, np.float64_t *dds1, np.float64_t *dds2,
37767  *                                np.uint64_t *p2):
37768  */
37769 
37770   /* function exit code */
37771   __pyx_L0:;
37772   __Pyx_RefNannyFinishContext();
37773   return __pyx_r;
37774 }
37775 
37776 /* "yt/utilities/lib/fp_utils.pxd":13
37777  *
37778  *
37779  * cdef inline np.int64_t imax(np.int64_t i0, np.int64_t i1) nogil:             # <<<<<<<<<<<<<<
37780  *     if i0 > i1: return i0
37781  *     return i1
37782  */
37783 
__pyx_f_2yt_9utilities_3lib_8fp_utils_imax(__pyx_t_5numpy_int64_t __pyx_v_i0,__pyx_t_5numpy_int64_t __pyx_v_i1)37784 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_imax(__pyx_t_5numpy_int64_t __pyx_v_i0, __pyx_t_5numpy_int64_t __pyx_v_i1) {
37785   __pyx_t_5numpy_int64_t __pyx_r;
37786   int __pyx_t_1;
37787 
37788   /* "yt/utilities/lib/fp_utils.pxd":14
37789  *
37790  * cdef inline np.int64_t imax(np.int64_t i0, np.int64_t i1) nogil:
37791  *     if i0 > i1: return i0             # <<<<<<<<<<<<<<
37792  *     return i1
37793  *
37794  */
37795   __pyx_t_1 = ((__pyx_v_i0 > __pyx_v_i1) != 0);
37796   if (__pyx_t_1) {
37797     __pyx_r = __pyx_v_i0;
37798     goto __pyx_L0;
37799   }
37800 
37801   /* "yt/utilities/lib/fp_utils.pxd":15
37802  * cdef inline np.int64_t imax(np.int64_t i0, np.int64_t i1) nogil:
37803  *     if i0 > i1: return i0
37804  *     return i1             # <<<<<<<<<<<<<<
37805  *
37806  * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1) nogil:
37807  */
37808   __pyx_r = __pyx_v_i1;
37809   goto __pyx_L0;
37810 
37811   /* "yt/utilities/lib/fp_utils.pxd":13
37812  *
37813  *
37814  * cdef inline np.int64_t imax(np.int64_t i0, np.int64_t i1) nogil:             # <<<<<<<<<<<<<<
37815  *     if i0 > i1: return i0
37816  *     return i1
37817  */
37818 
37819   /* function exit code */
37820   __pyx_L0:;
37821   return __pyx_r;
37822 }
37823 
37824 /* "yt/utilities/lib/fp_utils.pxd":17
37825  *     return i1
37826  *
37827  * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1) nogil:             # <<<<<<<<<<<<<<
37828  *     if f0 > f1: return f0
37829  *     return f1
37830  */
37831 
__pyx_f_2yt_9utilities_3lib_8fp_utils_fmax(__pyx_t_5numpy_float64_t __pyx_v_f0,__pyx_t_5numpy_float64_t __pyx_v_f1)37832 static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fmax(__pyx_t_5numpy_float64_t __pyx_v_f0, __pyx_t_5numpy_float64_t __pyx_v_f1) {
37833   __pyx_t_5numpy_float64_t __pyx_r;
37834   int __pyx_t_1;
37835 
37836   /* "yt/utilities/lib/fp_utils.pxd":18
37837  *
37838  * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1) nogil:
37839  *     if f0 > f1: return f0             # <<<<<<<<<<<<<<
37840  *     return f1
37841  *
37842  */
37843   __pyx_t_1 = ((__pyx_v_f0 > __pyx_v_f1) != 0);
37844   if (__pyx_t_1) {
37845     __pyx_r = __pyx_v_f0;
37846     goto __pyx_L0;
37847   }
37848 
37849   /* "yt/utilities/lib/fp_utils.pxd":19
37850  * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1) nogil:
37851  *     if f0 > f1: return f0
37852  *     return f1             # <<<<<<<<<<<<<<
37853  *
37854  * cdef inline np.int64_t imin(np.int64_t i0, np.int64_t i1) nogil:
37855  */
37856   __pyx_r = __pyx_v_f1;
37857   goto __pyx_L0;
37858 
37859   /* "yt/utilities/lib/fp_utils.pxd":17
37860  *     return i1
37861  *
37862  * cdef inline np.float64_t fmax(np.float64_t f0, np.float64_t f1) nogil:             # <<<<<<<<<<<<<<
37863  *     if f0 > f1: return f0
37864  *     return f1
37865  */
37866 
37867   /* function exit code */
37868   __pyx_L0:;
37869   return __pyx_r;
37870 }
37871 
37872 /* "yt/utilities/lib/fp_utils.pxd":21
37873  *     return f1
37874  *
37875  * cdef inline np.int64_t imin(np.int64_t i0, np.int64_t i1) nogil:             # <<<<<<<<<<<<<<
37876  *     if i0 < i1: return i0
37877  *     return i1
37878  */
37879 
__pyx_f_2yt_9utilities_3lib_8fp_utils_imin(__pyx_t_5numpy_int64_t __pyx_v_i0,__pyx_t_5numpy_int64_t __pyx_v_i1)37880 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_imin(__pyx_t_5numpy_int64_t __pyx_v_i0, __pyx_t_5numpy_int64_t __pyx_v_i1) {
37881   __pyx_t_5numpy_int64_t __pyx_r;
37882   int __pyx_t_1;
37883 
37884   /* "yt/utilities/lib/fp_utils.pxd":22
37885  *
37886  * cdef inline np.int64_t imin(np.int64_t i0, np.int64_t i1) nogil:
37887  *     if i0 < i1: return i0             # <<<<<<<<<<<<<<
37888  *     return i1
37889  *
37890  */
37891   __pyx_t_1 = ((__pyx_v_i0 < __pyx_v_i1) != 0);
37892   if (__pyx_t_1) {
37893     __pyx_r = __pyx_v_i0;
37894     goto __pyx_L0;
37895   }
37896 
37897   /* "yt/utilities/lib/fp_utils.pxd":23
37898  * cdef inline np.int64_t imin(np.int64_t i0, np.int64_t i1) nogil:
37899  *     if i0 < i1: return i0
37900  *     return i1             # <<<<<<<<<<<<<<
37901  *
37902  * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1) nogil:
37903  */
37904   __pyx_r = __pyx_v_i1;
37905   goto __pyx_L0;
37906 
37907   /* "yt/utilities/lib/fp_utils.pxd":21
37908  *     return f1
37909  *
37910  * cdef inline np.int64_t imin(np.int64_t i0, np.int64_t i1) nogil:             # <<<<<<<<<<<<<<
37911  *     if i0 < i1: return i0
37912  *     return i1
37913  */
37914 
37915   /* function exit code */
37916   __pyx_L0:;
37917   return __pyx_r;
37918 }
37919 
37920 /* "yt/utilities/lib/fp_utils.pxd":25
37921  *     return i1
37922  *
37923  * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1) nogil:             # <<<<<<<<<<<<<<
37924  *     if f0 < f1: return f0
37925  *     return f1
37926  */
37927 
__pyx_f_2yt_9utilities_3lib_8fp_utils_fmin(__pyx_t_5numpy_float64_t __pyx_v_f0,__pyx_t_5numpy_float64_t __pyx_v_f1)37928 static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fmin(__pyx_t_5numpy_float64_t __pyx_v_f0, __pyx_t_5numpy_float64_t __pyx_v_f1) {
37929   __pyx_t_5numpy_float64_t __pyx_r;
37930   int __pyx_t_1;
37931 
37932   /* "yt/utilities/lib/fp_utils.pxd":26
37933  *
37934  * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1) nogil:
37935  *     if f0 < f1: return f0             # <<<<<<<<<<<<<<
37936  *     return f1
37937  *
37938  */
37939   __pyx_t_1 = ((__pyx_v_f0 < __pyx_v_f1) != 0);
37940   if (__pyx_t_1) {
37941     __pyx_r = __pyx_v_f0;
37942     goto __pyx_L0;
37943   }
37944 
37945   /* "yt/utilities/lib/fp_utils.pxd":27
37946  * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1) nogil:
37947  *     if f0 < f1: return f0
37948  *     return f1             # <<<<<<<<<<<<<<
37949  *
37950  * cdef inline np.float64_t fabs(np.float64_t f0) nogil:
37951  */
37952   __pyx_r = __pyx_v_f1;
37953   goto __pyx_L0;
37954 
37955   /* "yt/utilities/lib/fp_utils.pxd":25
37956  *     return i1
37957  *
37958  * cdef inline np.float64_t fmin(np.float64_t f0, np.float64_t f1) nogil:             # <<<<<<<<<<<<<<
37959  *     if f0 < f1: return f0
37960  *     return f1
37961  */
37962 
37963   /* function exit code */
37964   __pyx_L0:;
37965   return __pyx_r;
37966 }
37967 
37968 /* "yt/utilities/lib/fp_utils.pxd":29
37969  *     return f1
37970  *
37971  * cdef inline np.float64_t fabs(np.float64_t f0) nogil:             # <<<<<<<<<<<<<<
37972  *     if f0 < 0.0: return -f0
37973  *     return f0
37974  */
37975 
__pyx_f_2yt_9utilities_3lib_8fp_utils_fabs(__pyx_t_5numpy_float64_t __pyx_v_f0)37976 static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fabs(__pyx_t_5numpy_float64_t __pyx_v_f0) {
37977   __pyx_t_5numpy_float64_t __pyx_r;
37978   int __pyx_t_1;
37979 
37980   /* "yt/utilities/lib/fp_utils.pxd":30
37981  *
37982  * cdef inline np.float64_t fabs(np.float64_t f0) nogil:
37983  *     if f0 < 0.0: return -f0             # <<<<<<<<<<<<<<
37984  *     return f0
37985  *
37986  */
37987   __pyx_t_1 = ((__pyx_v_f0 < 0.0) != 0);
37988   if (__pyx_t_1) {
37989     __pyx_r = (-__pyx_v_f0);
37990     goto __pyx_L0;
37991   }
37992 
37993   /* "yt/utilities/lib/fp_utils.pxd":31
37994  * cdef inline np.float64_t fabs(np.float64_t f0) nogil:
37995  *     if f0 < 0.0: return -f0
37996  *     return f0             # <<<<<<<<<<<<<<
37997  *
37998  * cdef inline np.int64_t iclip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:
37999  */
38000   __pyx_r = __pyx_v_f0;
38001   goto __pyx_L0;
38002 
38003   /* "yt/utilities/lib/fp_utils.pxd":29
38004  *     return f1
38005  *
38006  * cdef inline np.float64_t fabs(np.float64_t f0) nogil:             # <<<<<<<<<<<<<<
38007  *     if f0 < 0.0: return -f0
38008  *     return f0
38009  */
38010 
38011   /* function exit code */
38012   __pyx_L0:;
38013   return __pyx_r;
38014 }
38015 
38016 /* "yt/utilities/lib/fp_utils.pxd":33
38017  *     return f0
38018  *
38019  * cdef inline np.int64_t iclip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:             # <<<<<<<<<<<<<<
38020  *     if i < a: return a
38021  *     if i > b: return b
38022  */
38023 
__pyx_f_2yt_9utilities_3lib_8fp_utils_iclip(__pyx_t_5numpy_int64_t __pyx_v_i,__pyx_t_5numpy_int64_t __pyx_v_a,__pyx_t_5numpy_int64_t __pyx_v_b)38024 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_iclip(__pyx_t_5numpy_int64_t __pyx_v_i, __pyx_t_5numpy_int64_t __pyx_v_a, __pyx_t_5numpy_int64_t __pyx_v_b) {
38025   __pyx_t_5numpy_int64_t __pyx_r;
38026   int __pyx_t_1;
38027 
38028   /* "yt/utilities/lib/fp_utils.pxd":34
38029  *
38030  * cdef inline np.int64_t iclip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:
38031  *     if i < a: return a             # <<<<<<<<<<<<<<
38032  *     if i > b: return b
38033  *     return i
38034  */
38035   __pyx_t_1 = ((__pyx_v_i < __pyx_v_a) != 0);
38036   if (__pyx_t_1) {
38037     __pyx_r = __pyx_v_a;
38038     goto __pyx_L0;
38039   }
38040 
38041   /* "yt/utilities/lib/fp_utils.pxd":35
38042  * cdef inline np.int64_t iclip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:
38043  *     if i < a: return a
38044  *     if i > b: return b             # <<<<<<<<<<<<<<
38045  *     return i
38046  *
38047  */
38048   __pyx_t_1 = ((__pyx_v_i > __pyx_v_b) != 0);
38049   if (__pyx_t_1) {
38050     __pyx_r = __pyx_v_b;
38051     goto __pyx_L0;
38052   }
38053 
38054   /* "yt/utilities/lib/fp_utils.pxd":36
38055  *     if i < a: return a
38056  *     if i > b: return b
38057  *     return i             # <<<<<<<<<<<<<<
38058  *
38059  * cdef inline np.int64_t i64clip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:
38060  */
38061   __pyx_r = __pyx_v_i;
38062   goto __pyx_L0;
38063 
38064   /* "yt/utilities/lib/fp_utils.pxd":33
38065  *     return f0
38066  *
38067  * cdef inline np.int64_t iclip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:             # <<<<<<<<<<<<<<
38068  *     if i < a: return a
38069  *     if i > b: return b
38070  */
38071 
38072   /* function exit code */
38073   __pyx_L0:;
38074   return __pyx_r;
38075 }
38076 
38077 /* "yt/utilities/lib/fp_utils.pxd":38
38078  *     return i
38079  *
38080  * cdef inline np.int64_t i64clip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:             # <<<<<<<<<<<<<<
38081  *     if i < a: return a
38082  *     if i > b: return b
38083  */
38084 
__pyx_f_2yt_9utilities_3lib_8fp_utils_i64clip(__pyx_t_5numpy_int64_t __pyx_v_i,__pyx_t_5numpy_int64_t __pyx_v_a,__pyx_t_5numpy_int64_t __pyx_v_b)38085 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_i64clip(__pyx_t_5numpy_int64_t __pyx_v_i, __pyx_t_5numpy_int64_t __pyx_v_a, __pyx_t_5numpy_int64_t __pyx_v_b) {
38086   __pyx_t_5numpy_int64_t __pyx_r;
38087   int __pyx_t_1;
38088 
38089   /* "yt/utilities/lib/fp_utils.pxd":39
38090  *
38091  * cdef inline np.int64_t i64clip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:
38092  *     if i < a: return a             # <<<<<<<<<<<<<<
38093  *     if i > b: return b
38094  *     return i
38095  */
38096   __pyx_t_1 = ((__pyx_v_i < __pyx_v_a) != 0);
38097   if (__pyx_t_1) {
38098     __pyx_r = __pyx_v_a;
38099     goto __pyx_L0;
38100   }
38101 
38102   /* "yt/utilities/lib/fp_utils.pxd":40
38103  * cdef inline np.int64_t i64clip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:
38104  *     if i < a: return a
38105  *     if i > b: return b             # <<<<<<<<<<<<<<
38106  *     return i
38107  *
38108  */
38109   __pyx_t_1 = ((__pyx_v_i > __pyx_v_b) != 0);
38110   if (__pyx_t_1) {
38111     __pyx_r = __pyx_v_b;
38112     goto __pyx_L0;
38113   }
38114 
38115   /* "yt/utilities/lib/fp_utils.pxd":41
38116  *     if i < a: return a
38117  *     if i > b: return b
38118  *     return i             # <<<<<<<<<<<<<<
38119  *
38120  * cdef inline np.float64_t fclip(np.float64_t f,
38121  */
38122   __pyx_r = __pyx_v_i;
38123   goto __pyx_L0;
38124 
38125   /* "yt/utilities/lib/fp_utils.pxd":38
38126  *     return i
38127  *
38128  * cdef inline np.int64_t i64clip(np.int64_t i, np.int64_t a, np.int64_t b) nogil:             # <<<<<<<<<<<<<<
38129  *     if i < a: return a
38130  *     if i > b: return b
38131  */
38132 
38133   /* function exit code */
38134   __pyx_L0:;
38135   return __pyx_r;
38136 }
38137 
38138 /* "yt/utilities/lib/fp_utils.pxd":43
38139  *     return i
38140  *
38141  * cdef inline np.float64_t fclip(np.float64_t f,             # <<<<<<<<<<<<<<
38142  *                       np.float64_t a, np.float64_t b) nogil:
38143  *     return fmin(fmax(f, a), b)
38144  */
38145 
__pyx_f_2yt_9utilities_3lib_8fp_utils_fclip(__pyx_t_5numpy_float64_t __pyx_v_f,__pyx_t_5numpy_float64_t __pyx_v_a,__pyx_t_5numpy_float64_t __pyx_v_b)38146 static CYTHON_INLINE __pyx_t_5numpy_float64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_fclip(__pyx_t_5numpy_float64_t __pyx_v_f, __pyx_t_5numpy_float64_t __pyx_v_a, __pyx_t_5numpy_float64_t __pyx_v_b) {
38147   __pyx_t_5numpy_float64_t __pyx_r;
38148 
38149   /* "yt/utilities/lib/fp_utils.pxd":45
38150  * cdef inline np.float64_t fclip(np.float64_t f,
38151  *                       np.float64_t a, np.float64_t b) nogil:
38152  *     return fmin(fmax(f, a), b)             # <<<<<<<<<<<<<<
38153  *
38154  * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1) nogil:
38155  */
38156   __pyx_r = __pyx_f_2yt_9utilities_3lib_8fp_utils_fmin(__pyx_f_2yt_9utilities_3lib_8fp_utils_fmax(__pyx_v_f, __pyx_v_a), __pyx_v_b);
38157   goto __pyx_L0;
38158 
38159   /* "yt/utilities/lib/fp_utils.pxd":43
38160  *     return i
38161  *
38162  * cdef inline np.float64_t fclip(np.float64_t f,             # <<<<<<<<<<<<<<
38163  *                       np.float64_t a, np.float64_t b) nogil:
38164  *     return fmin(fmax(f, a), b)
38165  */
38166 
38167   /* function exit code */
38168   __pyx_L0:;
38169   return __pyx_r;
38170 }
38171 
38172 /* "yt/utilities/lib/fp_utils.pxd":47
38173  *     return fmin(fmax(f, a), b)
38174  *
38175  * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1) nogil:             # <<<<<<<<<<<<<<
38176  *     if i0 > i1: return i0
38177  *     return i1
38178  */
38179 
__pyx_f_2yt_9utilities_3lib_8fp_utils_i64max(__pyx_t_5numpy_int64_t __pyx_v_i0,__pyx_t_5numpy_int64_t __pyx_v_i1)38180 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_i64max(__pyx_t_5numpy_int64_t __pyx_v_i0, __pyx_t_5numpy_int64_t __pyx_v_i1) {
38181   __pyx_t_5numpy_int64_t __pyx_r;
38182   int __pyx_t_1;
38183 
38184   /* "yt/utilities/lib/fp_utils.pxd":48
38185  *
38186  * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1) nogil:
38187  *     if i0 > i1: return i0             # <<<<<<<<<<<<<<
38188  *     return i1
38189  *
38190  */
38191   __pyx_t_1 = ((__pyx_v_i0 > __pyx_v_i1) != 0);
38192   if (__pyx_t_1) {
38193     __pyx_r = __pyx_v_i0;
38194     goto __pyx_L0;
38195   }
38196 
38197   /* "yt/utilities/lib/fp_utils.pxd":49
38198  * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1) nogil:
38199  *     if i0 > i1: return i0
38200  *     return i1             # <<<<<<<<<<<<<<
38201  *
38202  * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1) nogil:
38203  */
38204   __pyx_r = __pyx_v_i1;
38205   goto __pyx_L0;
38206 
38207   /* "yt/utilities/lib/fp_utils.pxd":47
38208  *     return fmin(fmax(f, a), b)
38209  *
38210  * cdef inline np.int64_t i64max(np.int64_t i0, np.int64_t i1) nogil:             # <<<<<<<<<<<<<<
38211  *     if i0 > i1: return i0
38212  *     return i1
38213  */
38214 
38215   /* function exit code */
38216   __pyx_L0:;
38217   return __pyx_r;
38218 }
38219 
38220 /* "yt/utilities/lib/fp_utils.pxd":51
38221  *     return i1
38222  *
38223  * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1) nogil:             # <<<<<<<<<<<<<<
38224  *     if i0 < i1: return i0
38225  *     return i1
38226  */
38227 
__pyx_f_2yt_9utilities_3lib_8fp_utils_i64min(__pyx_t_5numpy_int64_t __pyx_v_i0,__pyx_t_5numpy_int64_t __pyx_v_i1)38228 static CYTHON_INLINE __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_8fp_utils_i64min(__pyx_t_5numpy_int64_t __pyx_v_i0, __pyx_t_5numpy_int64_t __pyx_v_i1) {
38229   __pyx_t_5numpy_int64_t __pyx_r;
38230   int __pyx_t_1;
38231 
38232   /* "yt/utilities/lib/fp_utils.pxd":52
38233  *
38234  * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1) nogil:
38235  *     if i0 < i1: return i0             # <<<<<<<<<<<<<<
38236  *     return i1
38237  *
38238  */
38239   __pyx_t_1 = ((__pyx_v_i0 < __pyx_v_i1) != 0);
38240   if (__pyx_t_1) {
38241     __pyx_r = __pyx_v_i0;
38242     goto __pyx_L0;
38243   }
38244 
38245   /* "yt/utilities/lib/fp_utils.pxd":53
38246  * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1) nogil:
38247  *     if i0 < i1: return i0
38248  *     return i1             # <<<<<<<<<<<<<<
38249  *
38250  * cdef inline _ensure_code(arr):
38251  */
38252   __pyx_r = __pyx_v_i1;
38253   goto __pyx_L0;
38254 
38255   /* "yt/utilities/lib/fp_utils.pxd":51
38256  *     return i1
38257  *
38258  * cdef inline np.int64_t i64min(np.int64_t i0, np.int64_t i1) nogil:             # <<<<<<<<<<<<<<
38259  *     if i0 < i1: return i0
38260  *     return i1
38261  */
38262 
38263   /* function exit code */
38264   __pyx_L0:;
38265   return __pyx_r;
38266 }
38267 
38268 /* "yt/utilities/lib/fp_utils.pxd":55
38269  *     return i1
38270  *
38271  * cdef inline _ensure_code(arr):             # <<<<<<<<<<<<<<
38272  *     if hasattr(arr, "units"):
38273  *         if "code_length" == str(arr.units):
38274  */
38275 
__pyx_f_2yt_9utilities_3lib_8fp_utils__ensure_code(PyObject * __pyx_v_arr)38276 static CYTHON_INLINE PyObject *__pyx_f_2yt_9utilities_3lib_8fp_utils__ensure_code(PyObject *__pyx_v_arr) {
38277   PyObject *__pyx_r = NULL;
38278   __Pyx_RefNannyDeclarations
38279   int __pyx_t_1;
38280   int __pyx_t_2;
38281   PyObject *__pyx_t_3 = NULL;
38282   PyObject *__pyx_t_4 = NULL;
38283   PyObject *__pyx_t_5 = NULL;
38284   __Pyx_RefNannySetupContext("_ensure_code", 0);
38285 
38286   /* "yt/utilities/lib/fp_utils.pxd":56
38287  *
38288  * cdef inline _ensure_code(arr):
38289  *     if hasattr(arr, "units"):             # <<<<<<<<<<<<<<
38290  *         if "code_length" == str(arr.units):
38291  *             return arr
38292  */
38293   __pyx_t_1 = __Pyx_HasAttr(__pyx_v_arr, __pyx_n_s_units); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(3, 56, __pyx_L1_error)
38294   __pyx_t_2 = (__pyx_t_1 != 0);
38295   if (__pyx_t_2) {
38296 
38297     /* "yt/utilities/lib/fp_utils.pxd":57
38298  * cdef inline _ensure_code(arr):
38299  *     if hasattr(arr, "units"):
38300  *         if "code_length" == str(arr.units):             # <<<<<<<<<<<<<<
38301  *             return arr
38302  *         arr.convert_to_units("code_length")
38303  */
38304     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr, __pyx_n_s_units); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 57, __pyx_L1_error)
38305     __Pyx_GOTREF(__pyx_t_3);
38306     __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 57, __pyx_L1_error)
38307     __Pyx_GOTREF(__pyx_t_4);
38308     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
38309     __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_n_s_code_length, __pyx_t_4, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(3, 57, __pyx_L1_error)
38310     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
38311     if (__pyx_t_2) {
38312 
38313       /* "yt/utilities/lib/fp_utils.pxd":58
38314  *     if hasattr(arr, "units"):
38315  *         if "code_length" == str(arr.units):
38316  *             return arr             # <<<<<<<<<<<<<<
38317  *         arr.convert_to_units("code_length")
38318  *     return arr
38319  */
38320       __Pyx_XDECREF(__pyx_r);
38321       __Pyx_INCREF(__pyx_v_arr);
38322       __pyx_r = __pyx_v_arr;
38323       goto __pyx_L0;
38324 
38325       /* "yt/utilities/lib/fp_utils.pxd":57
38326  * cdef inline _ensure_code(arr):
38327  *     if hasattr(arr, "units"):
38328  *         if "code_length" == str(arr.units):             # <<<<<<<<<<<<<<
38329  *             return arr
38330  *         arr.convert_to_units("code_length")
38331  */
38332     }
38333 
38334     /* "yt/utilities/lib/fp_utils.pxd":59
38335  *         if "code_length" == str(arr.units):
38336  *             return arr
38337  *         arr.convert_to_units("code_length")             # <<<<<<<<<<<<<<
38338  *     return arr
38339  */
38340     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr, __pyx_n_s_convert_to_units); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 59, __pyx_L1_error)
38341     __Pyx_GOTREF(__pyx_t_3);
38342     __pyx_t_5 = NULL;
38343     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
38344       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
38345       if (likely(__pyx_t_5)) {
38346         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
38347         __Pyx_INCREF(__pyx_t_5);
38348         __Pyx_INCREF(function);
38349         __Pyx_DECREF_SET(__pyx_t_3, function);
38350       }
38351     }
38352     __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_n_s_code_length) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_s_code_length);
38353     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
38354     if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 59, __pyx_L1_error)
38355     __Pyx_GOTREF(__pyx_t_4);
38356     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
38357     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
38358 
38359     /* "yt/utilities/lib/fp_utils.pxd":56
38360  *
38361  * cdef inline _ensure_code(arr):
38362  *     if hasattr(arr, "units"):             # <<<<<<<<<<<<<<
38363  *         if "code_length" == str(arr.units):
38364  *             return arr
38365  */
38366   }
38367 
38368   /* "yt/utilities/lib/fp_utils.pxd":60
38369  *             return arr
38370  *         arr.convert_to_units("code_length")
38371  *     return arr             # <<<<<<<<<<<<<<
38372  */
38373   __Pyx_XDECREF(__pyx_r);
38374   __Pyx_INCREF(__pyx_v_arr);
38375   __pyx_r = __pyx_v_arr;
38376   goto __pyx_L0;
38377 
38378   /* "yt/utilities/lib/fp_utils.pxd":55
38379  *     return i1
38380  *
38381  * cdef inline _ensure_code(arr):             # <<<<<<<<<<<<<<
38382  *     if hasattr(arr, "units"):
38383  *         if "code_length" == str(arr.units):
38384  */
38385 
38386   /* function exit code */
38387   __pyx_L1_error:;
38388   __Pyx_XDECREF(__pyx_t_3);
38389   __Pyx_XDECREF(__pyx_t_4);
38390   __Pyx_XDECREF(__pyx_t_5);
38391   __Pyx_AddTraceback("yt.utilities.lib.fp_utils._ensure_code", __pyx_clineno, __pyx_lineno, __pyx_filename);
38392   __pyx_r = 0;
38393   __pyx_L0:;
38394   __Pyx_XGIVEREF(__pyx_r);
38395   __Pyx_RefNannyFinishContext();
38396   return __pyx_r;
38397 }
38398 
38399 /* "yt/utilities/lib/vec3_ops.pxd":9
38400  * @cython.wraparound(False)
38401  * @cython.cdivision(True)
38402  * cdef inline cython.floating dot(const cython.floating[3] a,             # <<<<<<<<<<<<<<
38403  *                                 const cython.floating[3] b) nogil:
38404  *     return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]
38405  */
38406 
__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(float * __pyx_v_a,float * __pyx_v_b)38407 static CYTHON_INLINE float __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(float *__pyx_v_a, float *__pyx_v_b) {
38408   float __pyx_r;
38409 
38410   /* "yt/utilities/lib/vec3_ops.pxd":11
38411  * cdef inline cython.floating dot(const cython.floating[3] a,
38412  *                                 const cython.floating[3] b) nogil:
38413  *     return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]             # <<<<<<<<<<<<<<
38414  *
38415  *
38416  */
38417   __pyx_r = ((((__pyx_v_a[0]) * (__pyx_v_b[0])) + ((__pyx_v_a[1]) * (__pyx_v_b[1]))) + ((__pyx_v_a[2]) * (__pyx_v_b[2])));
38418   goto __pyx_L0;
38419 
38420   /* "yt/utilities/lib/vec3_ops.pxd":9
38421  * @cython.wraparound(False)
38422  * @cython.cdivision(True)
38423  * cdef inline cython.floating dot(const cython.floating[3] a,             # <<<<<<<<<<<<<<
38424  *                                 const cython.floating[3] b) nogil:
38425  *     return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]
38426  */
38427 
38428   /* function exit code */
38429   __pyx_L0:;
38430   return __pyx_r;
38431 }
38432 
__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(double * __pyx_v_a,double * __pyx_v_b)38433 static CYTHON_INLINE double __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(double *__pyx_v_a, double *__pyx_v_b) {
38434   double __pyx_r;
38435 
38436   /* "yt/utilities/lib/vec3_ops.pxd":11
38437  * cdef inline cython.floating dot(const cython.floating[3] a,
38438  *                                 const cython.floating[3] b) nogil:
38439  *     return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]             # <<<<<<<<<<<<<<
38440  *
38441  *
38442  */
38443   __pyx_r = ((((__pyx_v_a[0]) * (__pyx_v_b[0])) + ((__pyx_v_a[1]) * (__pyx_v_b[1]))) + ((__pyx_v_a[2]) * (__pyx_v_b[2])));
38444   goto __pyx_L0;
38445 
38446   /* "yt/utilities/lib/vec3_ops.pxd":9
38447  * @cython.wraparound(False)
38448  * @cython.cdivision(True)
38449  * cdef inline cython.floating dot(const cython.floating[3] a,             # <<<<<<<<<<<<<<
38450  *                                 const cython.floating[3] b) nogil:
38451  *     return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]
38452  */
38453 
38454   /* function exit code */
38455   __pyx_L0:;
38456   return __pyx_r;
38457 }
38458 
38459 /* "yt/utilities/lib/vec3_ops.pxd":17
38460  * @cython.wraparound(False)
38461  * @cython.cdivision(True)
38462  * cdef inline void cross(const cython.floating[3] a,             # <<<<<<<<<<<<<<
38463  *                        const cython.floating[3] b,
38464  *                        cython.floating c[3]) nogil:
38465  */
38466 
__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_cross(float * __pyx_v_a,float * __pyx_v_b,float * __pyx_v_c)38467 static CYTHON_INLINE void __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_cross(float *__pyx_v_a, float *__pyx_v_b, float *__pyx_v_c) {
38468 
38469   /* "yt/utilities/lib/vec3_ops.pxd":20
38470  *                        const cython.floating[3] b,
38471  *                        cython.floating c[3]) nogil:
38472  *     c[0] = a[1]*b[2] - a[2]*b[1]             # <<<<<<<<<<<<<<
38473  *     c[1] = a[2]*b[0] - a[0]*b[2]
38474  *     c[2] = a[0]*b[1] - a[1]*b[0]
38475  */
38476   (__pyx_v_c[0]) = (((__pyx_v_a[1]) * (__pyx_v_b[2])) - ((__pyx_v_a[2]) * (__pyx_v_b[1])));
38477 
38478   /* "yt/utilities/lib/vec3_ops.pxd":21
38479  *                        cython.floating c[3]) nogil:
38480  *     c[0] = a[1]*b[2] - a[2]*b[1]
38481  *     c[1] = a[2]*b[0] - a[0]*b[2]             # <<<<<<<<<<<<<<
38482  *     c[2] = a[0]*b[1] - a[1]*b[0]
38483  *
38484  */
38485   (__pyx_v_c[1]) = (((__pyx_v_a[2]) * (__pyx_v_b[0])) - ((__pyx_v_a[0]) * (__pyx_v_b[2])));
38486 
38487   /* "yt/utilities/lib/vec3_ops.pxd":22
38488  *     c[0] = a[1]*b[2] - a[2]*b[1]
38489  *     c[1] = a[2]*b[0] - a[0]*b[2]
38490  *     c[2] = a[0]*b[1] - a[1]*b[0]             # <<<<<<<<<<<<<<
38491  *
38492  *
38493  */
38494   (__pyx_v_c[2]) = (((__pyx_v_a[0]) * (__pyx_v_b[1])) - ((__pyx_v_a[1]) * (__pyx_v_b[0])));
38495 
38496   /* "yt/utilities/lib/vec3_ops.pxd":17
38497  * @cython.wraparound(False)
38498  * @cython.cdivision(True)
38499  * cdef inline void cross(const cython.floating[3] a,             # <<<<<<<<<<<<<<
38500  *                        const cython.floating[3] b,
38501  *                        cython.floating c[3]) nogil:
38502  */
38503 
38504   /* function exit code */
38505 }
38506 
__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_cross(double * __pyx_v_a,double * __pyx_v_b,double * __pyx_v_c)38507 static CYTHON_INLINE void __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_cross(double *__pyx_v_a, double *__pyx_v_b, double *__pyx_v_c) {
38508 
38509   /* "yt/utilities/lib/vec3_ops.pxd":20
38510  *                        const cython.floating[3] b,
38511  *                        cython.floating c[3]) nogil:
38512  *     c[0] = a[1]*b[2] - a[2]*b[1]             # <<<<<<<<<<<<<<
38513  *     c[1] = a[2]*b[0] - a[0]*b[2]
38514  *     c[2] = a[0]*b[1] - a[1]*b[0]
38515  */
38516   (__pyx_v_c[0]) = (((__pyx_v_a[1]) * (__pyx_v_b[2])) - ((__pyx_v_a[2]) * (__pyx_v_b[1])));
38517 
38518   /* "yt/utilities/lib/vec3_ops.pxd":21
38519  *                        cython.floating c[3]) nogil:
38520  *     c[0] = a[1]*b[2] - a[2]*b[1]
38521  *     c[1] = a[2]*b[0] - a[0]*b[2]             # <<<<<<<<<<<<<<
38522  *     c[2] = a[0]*b[1] - a[1]*b[0]
38523  *
38524  */
38525   (__pyx_v_c[1]) = (((__pyx_v_a[2]) * (__pyx_v_b[0])) - ((__pyx_v_a[0]) * (__pyx_v_b[2])));
38526 
38527   /* "yt/utilities/lib/vec3_ops.pxd":22
38528  *     c[0] = a[1]*b[2] - a[2]*b[1]
38529  *     c[1] = a[2]*b[0] - a[0]*b[2]
38530  *     c[2] = a[0]*b[1] - a[1]*b[0]             # <<<<<<<<<<<<<<
38531  *
38532  *
38533  */
38534   (__pyx_v_c[2]) = (((__pyx_v_a[0]) * (__pyx_v_b[1])) - ((__pyx_v_a[1]) * (__pyx_v_b[0])));
38535 
38536   /* "yt/utilities/lib/vec3_ops.pxd":17
38537  * @cython.wraparound(False)
38538  * @cython.cdivision(True)
38539  * cdef inline void cross(const cython.floating[3] a,             # <<<<<<<<<<<<<<
38540  *                        const cython.floating[3] b,
38541  *                        cython.floating c[3]) nogil:
38542  */
38543 
38544   /* function exit code */
38545 }
38546 
38547 /* "yt/utilities/lib/vec3_ops.pxd":28
38548  * @cython.wraparound(False)
38549  * @cython.cdivision(True)
38550  * cdef inline void subtract(const cython.floating[3] a,             # <<<<<<<<<<<<<<
38551  *                           const cython.floating[3] b,
38552  *                           cython.floating c[3]) nogil:
38553  */
38554 
__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_subtract(float * __pyx_v_a,float * __pyx_v_b,float * __pyx_v_c)38555 static CYTHON_INLINE void __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_subtract(float *__pyx_v_a, float *__pyx_v_b, float *__pyx_v_c) {
38556 
38557   /* "yt/utilities/lib/vec3_ops.pxd":31
38558  *                           const cython.floating[3] b,
38559  *                           cython.floating c[3]) nogil:
38560  *     c[0] = a[0] - b[0]             # <<<<<<<<<<<<<<
38561  *     c[1] = a[1] - b[1]
38562  *     c[2] = a[2] - b[2]
38563  */
38564   (__pyx_v_c[0]) = ((__pyx_v_a[0]) - (__pyx_v_b[0]));
38565 
38566   /* "yt/utilities/lib/vec3_ops.pxd":32
38567  *                           cython.floating c[3]) nogil:
38568  *     c[0] = a[0] - b[0]
38569  *     c[1] = a[1] - b[1]             # <<<<<<<<<<<<<<
38570  *     c[2] = a[2] - b[2]
38571  *
38572  */
38573   (__pyx_v_c[1]) = ((__pyx_v_a[1]) - (__pyx_v_b[1]));
38574 
38575   /* "yt/utilities/lib/vec3_ops.pxd":33
38576  *     c[0] = a[0] - b[0]
38577  *     c[1] = a[1] - b[1]
38578  *     c[2] = a[2] - b[2]             # <<<<<<<<<<<<<<
38579  *
38580  *
38581  */
38582   (__pyx_v_c[2]) = ((__pyx_v_a[2]) - (__pyx_v_b[2]));
38583 
38584   /* "yt/utilities/lib/vec3_ops.pxd":28
38585  * @cython.wraparound(False)
38586  * @cython.cdivision(True)
38587  * cdef inline void subtract(const cython.floating[3] a,             # <<<<<<<<<<<<<<
38588  *                           const cython.floating[3] b,
38589  *                           cython.floating c[3]) nogil:
38590  */
38591 
38592   /* function exit code */
38593 }
38594 
__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_subtract(double * __pyx_v_a,double * __pyx_v_b,double * __pyx_v_c)38595 static CYTHON_INLINE void __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_subtract(double *__pyx_v_a, double *__pyx_v_b, double *__pyx_v_c) {
38596 
38597   /* "yt/utilities/lib/vec3_ops.pxd":31
38598  *                           const cython.floating[3] b,
38599  *                           cython.floating c[3]) nogil:
38600  *     c[0] = a[0] - b[0]             # <<<<<<<<<<<<<<
38601  *     c[1] = a[1] - b[1]
38602  *     c[2] = a[2] - b[2]
38603  */
38604   (__pyx_v_c[0]) = ((__pyx_v_a[0]) - (__pyx_v_b[0]));
38605 
38606   /* "yt/utilities/lib/vec3_ops.pxd":32
38607  *                           cython.floating c[3]) nogil:
38608  *     c[0] = a[0] - b[0]
38609  *     c[1] = a[1] - b[1]             # <<<<<<<<<<<<<<
38610  *     c[2] = a[2] - b[2]
38611  *
38612  */
38613   (__pyx_v_c[1]) = ((__pyx_v_a[1]) - (__pyx_v_b[1]));
38614 
38615   /* "yt/utilities/lib/vec3_ops.pxd":33
38616  *     c[0] = a[0] - b[0]
38617  *     c[1] = a[1] - b[1]
38618  *     c[2] = a[2] - b[2]             # <<<<<<<<<<<<<<
38619  *
38620  *
38621  */
38622   (__pyx_v_c[2]) = ((__pyx_v_a[2]) - (__pyx_v_b[2]));
38623 
38624   /* "yt/utilities/lib/vec3_ops.pxd":28
38625  * @cython.wraparound(False)
38626  * @cython.cdivision(True)
38627  * cdef inline void subtract(const cython.floating[3] a,             # <<<<<<<<<<<<<<
38628  *                           const cython.floating[3] b,
38629  *                           cython.floating c[3]) nogil:
38630  */
38631 
38632   /* function exit code */
38633 }
38634 
38635 /* "yt/utilities/lib/vec3_ops.pxd":39
38636  * @cython.wraparound(False)
38637  * @cython.cdivision(True)
38638  * cdef inline cython.floating distance(const cython.floating[3] a,             # <<<<<<<<<<<<<<
38639  *                                      const cython.floating[3] b) nogil:
38640  *     return sqrt((a[0] - b[0])**2 + (a[1] - b[1])**2 +(a[2] - b[2])**2)
38641  */
38642 
__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_distance(float * __pyx_v_a,float * __pyx_v_b)38643 static CYTHON_INLINE float __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_distance(float *__pyx_v_a, float *__pyx_v_b) {
38644   float __pyx_r;
38645 
38646   /* "yt/utilities/lib/vec3_ops.pxd":41
38647  * cdef inline cython.floating distance(const cython.floating[3] a,
38648  *                                      const cython.floating[3] b) nogil:
38649  *     return sqrt((a[0] - b[0])**2 + (a[1] - b[1])**2 +(a[2] - b[2])**2)             # <<<<<<<<<<<<<<
38650  *
38651  *
38652  */
38653   __pyx_r = sqrt(((powf(((__pyx_v_a[0]) - (__pyx_v_b[0])), 2.0) + powf(((__pyx_v_a[1]) - (__pyx_v_b[1])), 2.0)) + powf(((__pyx_v_a[2]) - (__pyx_v_b[2])), 2.0)));
38654   goto __pyx_L0;
38655 
38656   /* "yt/utilities/lib/vec3_ops.pxd":39
38657  * @cython.wraparound(False)
38658  * @cython.cdivision(True)
38659  * cdef inline cython.floating distance(const cython.floating[3] a,             # <<<<<<<<<<<<<<
38660  *                                      const cython.floating[3] b) nogil:
38661  *     return sqrt((a[0] - b[0])**2 + (a[1] - b[1])**2 +(a[2] - b[2])**2)
38662  */
38663 
38664   /* function exit code */
38665   __pyx_L0:;
38666   return __pyx_r;
38667 }
38668 
__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_distance(double * __pyx_v_a,double * __pyx_v_b)38669 static CYTHON_INLINE double __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_distance(double *__pyx_v_a, double *__pyx_v_b) {
38670   double __pyx_r;
38671 
38672   /* "yt/utilities/lib/vec3_ops.pxd":41
38673  * cdef inline cython.floating distance(const cython.floating[3] a,
38674  *                                      const cython.floating[3] b) nogil:
38675  *     return sqrt((a[0] - b[0])**2 + (a[1] - b[1])**2 +(a[2] - b[2])**2)             # <<<<<<<<<<<<<<
38676  *
38677  *
38678  */
38679   __pyx_r = sqrt(((pow(((__pyx_v_a[0]) - (__pyx_v_b[0])), 2.0) + pow(((__pyx_v_a[1]) - (__pyx_v_b[1])), 2.0)) + pow(((__pyx_v_a[2]) - (__pyx_v_b[2])), 2.0)));
38680   goto __pyx_L0;
38681 
38682   /* "yt/utilities/lib/vec3_ops.pxd":39
38683  * @cython.wraparound(False)
38684  * @cython.cdivision(True)
38685  * cdef inline cython.floating distance(const cython.floating[3] a,             # <<<<<<<<<<<<<<
38686  *                                      const cython.floating[3] b) nogil:
38687  *     return sqrt((a[0] - b[0])**2 + (a[1] - b[1])**2 +(a[2] - b[2])**2)
38688  */
38689 
38690   /* function exit code */
38691   __pyx_L0:;
38692   return __pyx_r;
38693 }
38694 
38695 /* "yt/utilities/lib/vec3_ops.pxd":47
38696  * @cython.wraparound(False)
38697  * @cython.cdivision(True)
38698  * cdef inline void fma(const cython.floating f,             # <<<<<<<<<<<<<<
38699  *                      const cython.floating[3] a,
38700  *                      const cython.floating[3] b,
38701  */
38702 
__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_fma(float const __pyx_v_f,float * __pyx_v_a,float * __pyx_v_b,float * __pyx_v_c)38703 static CYTHON_INLINE void __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_fma(float const __pyx_v_f, float *__pyx_v_a, float *__pyx_v_b, float *__pyx_v_c) {
38704 
38705   /* "yt/utilities/lib/vec3_ops.pxd":51
38706  *                      const cython.floating[3] b,
38707  *                      cython.floating[3] c) nogil:
38708  *     c[0] = f * a[0] + b[0]             # <<<<<<<<<<<<<<
38709  *     c[1] = f * a[1] + b[1]
38710  *     c[2] = f * a[2] + b[2]
38711  */
38712   (__pyx_v_c[0]) = ((__pyx_v_f * (__pyx_v_a[0])) + (__pyx_v_b[0]));
38713 
38714   /* "yt/utilities/lib/vec3_ops.pxd":52
38715  *                      cython.floating[3] c) nogil:
38716  *     c[0] = f * a[0] + b[0]
38717  *     c[1] = f * a[1] + b[1]             # <<<<<<<<<<<<<<
38718  *     c[2] = f * a[2] + b[2]
38719  *
38720  */
38721   (__pyx_v_c[1]) = ((__pyx_v_f * (__pyx_v_a[1])) + (__pyx_v_b[1]));
38722 
38723   /* "yt/utilities/lib/vec3_ops.pxd":53
38724  *     c[0] = f * a[0] + b[0]
38725  *     c[1] = f * a[1] + b[1]
38726  *     c[2] = f * a[2] + b[2]             # <<<<<<<<<<<<<<
38727  *
38728  *
38729  */
38730   (__pyx_v_c[2]) = ((__pyx_v_f * (__pyx_v_a[2])) + (__pyx_v_b[2]));
38731 
38732   /* "yt/utilities/lib/vec3_ops.pxd":47
38733  * @cython.wraparound(False)
38734  * @cython.cdivision(True)
38735  * cdef inline void fma(const cython.floating f,             # <<<<<<<<<<<<<<
38736  *                      const cython.floating[3] a,
38737  *                      const cython.floating[3] b,
38738  */
38739 
38740   /* function exit code */
38741 }
38742 
__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_fma(double const __pyx_v_f,double * __pyx_v_a,double * __pyx_v_b,double * __pyx_v_c)38743 static CYTHON_INLINE void __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_fma(double const __pyx_v_f, double *__pyx_v_a, double *__pyx_v_b, double *__pyx_v_c) {
38744 
38745   /* "yt/utilities/lib/vec3_ops.pxd":51
38746  *                      const cython.floating[3] b,
38747  *                      cython.floating[3] c) nogil:
38748  *     c[0] = f * a[0] + b[0]             # <<<<<<<<<<<<<<
38749  *     c[1] = f * a[1] + b[1]
38750  *     c[2] = f * a[2] + b[2]
38751  */
38752   (__pyx_v_c[0]) = ((__pyx_v_f * (__pyx_v_a[0])) + (__pyx_v_b[0]));
38753 
38754   /* "yt/utilities/lib/vec3_ops.pxd":52
38755  *                      cython.floating[3] c) nogil:
38756  *     c[0] = f * a[0] + b[0]
38757  *     c[1] = f * a[1] + b[1]             # <<<<<<<<<<<<<<
38758  *     c[2] = f * a[2] + b[2]
38759  *
38760  */
38761   (__pyx_v_c[1]) = ((__pyx_v_f * (__pyx_v_a[1])) + (__pyx_v_b[1]));
38762 
38763   /* "yt/utilities/lib/vec3_ops.pxd":53
38764  *     c[0] = f * a[0] + b[0]
38765  *     c[1] = f * a[1] + b[1]
38766  *     c[2] = f * a[2] + b[2]             # <<<<<<<<<<<<<<
38767  *
38768  *
38769  */
38770   (__pyx_v_c[2]) = ((__pyx_v_f * (__pyx_v_a[2])) + (__pyx_v_b[2]));
38771 
38772   /* "yt/utilities/lib/vec3_ops.pxd":47
38773  * @cython.wraparound(False)
38774  * @cython.cdivision(True)
38775  * cdef inline void fma(const cython.floating f,             # <<<<<<<<<<<<<<
38776  *                      const cython.floating[3] a,
38777  *                      const cython.floating[3] b,
38778  */
38779 
38780   /* function exit code */
38781 }
38782 
38783 /* "yt/utilities/lib/vec3_ops.pxd":59
38784  * @cython.wraparound(False)
38785  * @cython.cdivision(True)
38786  * cdef inline cython.floating L2_norm(const cython.floating[3] a) nogil:             # <<<<<<<<<<<<<<
38787  *     return sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2])
38788  */
38789 
__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_L2_norm(float * __pyx_v_a)38790 static CYTHON_INLINE float __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_L2_norm(float *__pyx_v_a) {
38791   float __pyx_r;
38792 
38793   /* "yt/utilities/lib/vec3_ops.pxd":60
38794  * @cython.cdivision(True)
38795  * cdef inline cython.floating L2_norm(const cython.floating[3] a) nogil:
38796  *     return sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2])             # <<<<<<<<<<<<<<
38797  */
38798   __pyx_r = sqrt(((((__pyx_v_a[0]) * (__pyx_v_a[0])) + ((__pyx_v_a[1]) * (__pyx_v_a[1]))) + ((__pyx_v_a[2]) * (__pyx_v_a[2]))));
38799   goto __pyx_L0;
38800 
38801   /* "yt/utilities/lib/vec3_ops.pxd":59
38802  * @cython.wraparound(False)
38803  * @cython.cdivision(True)
38804  * cdef inline cython.floating L2_norm(const cython.floating[3] a) nogil:             # <<<<<<<<<<<<<<
38805  *     return sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2])
38806  */
38807 
38808   /* function exit code */
38809   __pyx_L0:;
38810   return __pyx_r;
38811 }
38812 
__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_L2_norm(double * __pyx_v_a)38813 static CYTHON_INLINE double __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_L2_norm(double *__pyx_v_a) {
38814   double __pyx_r;
38815 
38816   /* "yt/utilities/lib/vec3_ops.pxd":60
38817  * @cython.cdivision(True)
38818  * cdef inline cython.floating L2_norm(const cython.floating[3] a) nogil:
38819  *     return sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2])             # <<<<<<<<<<<<<<
38820  */
38821   __pyx_r = sqrt(((((__pyx_v_a[0]) * (__pyx_v_a[0])) + ((__pyx_v_a[1]) * (__pyx_v_a[1]))) + ((__pyx_v_a[2]) * (__pyx_v_a[2]))));
38822   goto __pyx_L0;
38823 
38824   /* "yt/utilities/lib/vec3_ops.pxd":59
38825  * @cython.wraparound(False)
38826  * @cython.cdivision(True)
38827  * cdef inline cython.floating L2_norm(const cython.floating[3] a) nogil:             # <<<<<<<<<<<<<<
38828  *     return sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2])
38829  */
38830 
38831   /* function exit code */
38832   __pyx_L0:;
38833   return __pyx_r;
38834 }
38835 
38836 /* "View.MemoryView":122
38837  *         cdef bint dtype_is_object
38838  *
38839  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
38840  *                   mode="c", bint allocate_buffer=True):
38841  *
38842  */
38843 
38844 /* Python wrapper */
38845 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_array___cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)38846 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
38847   PyObject *__pyx_v_shape = 0;
38848   Py_ssize_t __pyx_v_itemsize;
38849   PyObject *__pyx_v_format = 0;
38850   PyObject *__pyx_v_mode = 0;
38851   int __pyx_v_allocate_buffer;
38852   int __pyx_r;
38853   __Pyx_RefNannyDeclarations
38854   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
38855   {
38856     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};
38857     PyObject* values[5] = {0,0,0,0,0};
38858     values[3] = ((PyObject *)__pyx_n_s_c);
38859     if (unlikely(__pyx_kwds)) {
38860       Py_ssize_t kw_args;
38861       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
38862       switch (pos_args) {
38863         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
38864         CYTHON_FALLTHROUGH;
38865         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
38866         CYTHON_FALLTHROUGH;
38867         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
38868         CYTHON_FALLTHROUGH;
38869         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
38870         CYTHON_FALLTHROUGH;
38871         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
38872         CYTHON_FALLTHROUGH;
38873         case  0: break;
38874         default: goto __pyx_L5_argtuple_error;
38875       }
38876       kw_args = PyDict_Size(__pyx_kwds);
38877       switch (pos_args) {
38878         case  0:
38879         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
38880         else goto __pyx_L5_argtuple_error;
38881         CYTHON_FALLTHROUGH;
38882         case  1:
38883         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
38884         else {
38885           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(4, 122, __pyx_L3_error)
38886         }
38887         CYTHON_FALLTHROUGH;
38888         case  2:
38889         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
38890         else {
38891           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(4, 122, __pyx_L3_error)
38892         }
38893         CYTHON_FALLTHROUGH;
38894         case  3:
38895         if (kw_args > 0) {
38896           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
38897           if (value) { values[3] = value; kw_args--; }
38898         }
38899         CYTHON_FALLTHROUGH;
38900         case  4:
38901         if (kw_args > 0) {
38902           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
38903           if (value) { values[4] = value; kw_args--; }
38904         }
38905       }
38906       if (unlikely(kw_args > 0)) {
38907         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(4, 122, __pyx_L3_error)
38908       }
38909     } else {
38910       switch (PyTuple_GET_SIZE(__pyx_args)) {
38911         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
38912         CYTHON_FALLTHROUGH;
38913         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
38914         CYTHON_FALLTHROUGH;
38915         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
38916         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
38917         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
38918         break;
38919         default: goto __pyx_L5_argtuple_error;
38920       }
38921     }
38922     __pyx_v_shape = ((PyObject*)values[0]);
38923     __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(4, 122, __pyx_L3_error)
38924     __pyx_v_format = values[2];
38925     __pyx_v_mode = values[3];
38926     if (values[4]) {
38927       __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(4, 123, __pyx_L3_error)
38928     } else {
38929 
38930       /* "View.MemoryView":123
38931  *
38932  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
38933  *                   mode="c", bint allocate_buffer=True):             # <<<<<<<<<<<<<<
38934  *
38935  *         cdef int idx
38936  */
38937       __pyx_v_allocate_buffer = ((int)1);
38938     }
38939   }
38940   goto __pyx_L4_argument_unpacking_done;
38941   __pyx_L5_argtuple_error:;
38942   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 122, __pyx_L3_error)
38943   __pyx_L3_error:;
38944   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
38945   __Pyx_RefNannyFinishContext();
38946   return -1;
38947   __pyx_L4_argument_unpacking_done:;
38948   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(4, 122, __pyx_L1_error)
38949   if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
38950     PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(4, 122, __pyx_L1_error)
38951   }
38952   __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);
38953 
38954   /* "View.MemoryView":122
38955  *         cdef bint dtype_is_object
38956  *
38957  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
38958  *                   mode="c", bint allocate_buffer=True):
38959  *
38960  */
38961 
38962   /* function exit code */
38963   goto __pyx_L0;
38964   __pyx_L1_error:;
38965   __pyx_r = -1;
38966   __pyx_L0:;
38967   __Pyx_RefNannyFinishContext();
38968   return __pyx_r;
38969 }
38970 
__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)38971 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) {
38972   int __pyx_v_idx;
38973   Py_ssize_t __pyx_v_i;
38974   Py_ssize_t __pyx_v_dim;
38975   PyObject **__pyx_v_p;
38976   char __pyx_v_order;
38977   int __pyx_r;
38978   __Pyx_RefNannyDeclarations
38979   Py_ssize_t __pyx_t_1;
38980   int __pyx_t_2;
38981   PyObject *__pyx_t_3 = NULL;
38982   int __pyx_t_4;
38983   PyObject *__pyx_t_5 = NULL;
38984   PyObject *__pyx_t_6 = NULL;
38985   char *__pyx_t_7;
38986   int __pyx_t_8;
38987   Py_ssize_t __pyx_t_9;
38988   PyObject *__pyx_t_10 = NULL;
38989   Py_ssize_t __pyx_t_11;
38990   __Pyx_RefNannySetupContext("__cinit__", 0);
38991   __Pyx_INCREF(__pyx_v_format);
38992 
38993   /* "View.MemoryView":129
38994  *         cdef PyObject **p
38995  *
38996  *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
38997  *         self.itemsize = itemsize
38998  *
38999  */
39000   if (unlikely(__pyx_v_shape == Py_None)) {
39001     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
39002     __PYX_ERR(4, 129, __pyx_L1_error)
39003   }
39004   __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(4, 129, __pyx_L1_error)
39005   __pyx_v_self->ndim = ((int)__pyx_t_1);
39006 
39007   /* "View.MemoryView":130
39008  *
39009  *         self.ndim = <int> len(shape)
39010  *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
39011  *
39012  *         if not self.ndim:
39013  */
39014   __pyx_v_self->itemsize = __pyx_v_itemsize;
39015 
39016   /* "View.MemoryView":132
39017  *         self.itemsize = itemsize
39018  *
39019  *         if not self.ndim:             # <<<<<<<<<<<<<<
39020  *             raise ValueError("Empty shape tuple for cython.array")
39021  *
39022  */
39023   __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
39024   if (unlikely(__pyx_t_2)) {
39025 
39026     /* "View.MemoryView":133
39027  *
39028  *         if not self.ndim:
39029  *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
39030  *
39031  *         if itemsize <= 0:
39032  */
39033     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 133, __pyx_L1_error)
39034     __Pyx_GOTREF(__pyx_t_3);
39035     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
39036     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
39037     __PYX_ERR(4, 133, __pyx_L1_error)
39038 
39039     /* "View.MemoryView":132
39040  *         self.itemsize = itemsize
39041  *
39042  *         if not self.ndim:             # <<<<<<<<<<<<<<
39043  *             raise ValueError("Empty shape tuple for cython.array")
39044  *
39045  */
39046   }
39047 
39048   /* "View.MemoryView":135
39049  *             raise ValueError("Empty shape tuple for cython.array")
39050  *
39051  *         if itemsize <= 0:             # <<<<<<<<<<<<<<
39052  *             raise ValueError("itemsize <= 0 for cython.array")
39053  *
39054  */
39055   __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
39056   if (unlikely(__pyx_t_2)) {
39057 
39058     /* "View.MemoryView":136
39059  *
39060  *         if itemsize <= 0:
39061  *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
39062  *
39063  *         if not isinstance(format, bytes):
39064  */
39065     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 136, __pyx_L1_error)
39066     __Pyx_GOTREF(__pyx_t_3);
39067     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
39068     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
39069     __PYX_ERR(4, 136, __pyx_L1_error)
39070 
39071     /* "View.MemoryView":135
39072  *             raise ValueError("Empty shape tuple for cython.array")
39073  *
39074  *         if itemsize <= 0:             # <<<<<<<<<<<<<<
39075  *             raise ValueError("itemsize <= 0 for cython.array")
39076  *
39077  */
39078   }
39079 
39080   /* "View.MemoryView":138
39081  *             raise ValueError("itemsize <= 0 for cython.array")
39082  *
39083  *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
39084  *             format = format.encode('ASCII')
39085  *         self._format = format  # keep a reference to the byte string
39086  */
39087   __pyx_t_2 = PyBytes_Check(__pyx_v_format);
39088   __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
39089   if (__pyx_t_4) {
39090 
39091     /* "View.MemoryView":139
39092  *
39093  *         if not isinstance(format, bytes):
39094  *             format = format.encode('ASCII')             # <<<<<<<<<<<<<<
39095  *         self._format = format  # keep a reference to the byte string
39096  *         self.format = self._format
39097  */
39098     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 139, __pyx_L1_error)
39099     __Pyx_GOTREF(__pyx_t_5);
39100     __pyx_t_6 = NULL;
39101     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
39102       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
39103       if (likely(__pyx_t_6)) {
39104         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
39105         __Pyx_INCREF(__pyx_t_6);
39106         __Pyx_INCREF(function);
39107         __Pyx_DECREF_SET(__pyx_t_5, function);
39108       }
39109     }
39110     __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);
39111     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
39112     if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 139, __pyx_L1_error)
39113     __Pyx_GOTREF(__pyx_t_3);
39114     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
39115     __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
39116     __pyx_t_3 = 0;
39117 
39118     /* "View.MemoryView":138
39119  *             raise ValueError("itemsize <= 0 for cython.array")
39120  *
39121  *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
39122  *             format = format.encode('ASCII')
39123  *         self._format = format  # keep a reference to the byte string
39124  */
39125   }
39126 
39127   /* "View.MemoryView":140
39128  *         if not isinstance(format, bytes):
39129  *             format = format.encode('ASCII')
39130  *         self._format = format  # keep a reference to the byte string             # <<<<<<<<<<<<<<
39131  *         self.format = self._format
39132  *
39133  */
39134   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(4, 140, __pyx_L1_error)
39135   __pyx_t_3 = __pyx_v_format;
39136   __Pyx_INCREF(__pyx_t_3);
39137   __Pyx_GIVEREF(__pyx_t_3);
39138   __Pyx_GOTREF(__pyx_v_self->_format);
39139   __Pyx_DECREF(__pyx_v_self->_format);
39140   __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
39141   __pyx_t_3 = 0;
39142 
39143   /* "View.MemoryView":141
39144  *             format = format.encode('ASCII')
39145  *         self._format = format  # keep a reference to the byte string
39146  *         self.format = self._format             # <<<<<<<<<<<<<<
39147  *
39148  *
39149  */
39150   if (unlikely(__pyx_v_self->_format == Py_None)) {
39151     PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
39152     __PYX_ERR(4, 141, __pyx_L1_error)
39153   }
39154   __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(4, 141, __pyx_L1_error)
39155   __pyx_v_self->format = __pyx_t_7;
39156 
39157   /* "View.MemoryView":144
39158  *
39159  *
39160  *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)             # <<<<<<<<<<<<<<
39161  *         self._strides = self._shape + self.ndim
39162  *
39163  */
39164   __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
39165 
39166   /* "View.MemoryView":145
39167  *
39168  *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
39169  *         self._strides = self._shape + self.ndim             # <<<<<<<<<<<<<<
39170  *
39171  *         if not self._shape:
39172  */
39173   __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
39174 
39175   /* "View.MemoryView":147
39176  *         self._strides = self._shape + self.ndim
39177  *
39178  *         if not self._shape:             # <<<<<<<<<<<<<<
39179  *             raise MemoryError("unable to allocate shape and strides.")
39180  *
39181  */
39182   __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
39183   if (unlikely(__pyx_t_4)) {
39184 
39185     /* "View.MemoryView":148
39186  *
39187  *         if not self._shape:
39188  *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
39189  *
39190  *
39191  */
39192     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 148, __pyx_L1_error)
39193     __Pyx_GOTREF(__pyx_t_3);
39194     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
39195     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
39196     __PYX_ERR(4, 148, __pyx_L1_error)
39197 
39198     /* "View.MemoryView":147
39199  *         self._strides = self._shape + self.ndim
39200  *
39201  *         if not self._shape:             # <<<<<<<<<<<<<<
39202  *             raise MemoryError("unable to allocate shape and strides.")
39203  *
39204  */
39205   }
39206 
39207   /* "View.MemoryView":151
39208  *
39209  *
39210  *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
39211  *             if dim <= 0:
39212  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
39213  */
39214   __pyx_t_8 = 0;
39215   __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
39216   for (;;) {
39217     if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
39218     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
39219     __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(4, 151, __pyx_L1_error)
39220     #else
39221     __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 151, __pyx_L1_error)
39222     __Pyx_GOTREF(__pyx_t_5);
39223     #endif
39224     __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(4, 151, __pyx_L1_error)
39225     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
39226     __pyx_v_dim = __pyx_t_9;
39227     __pyx_v_idx = __pyx_t_8;
39228     __pyx_t_8 = (__pyx_t_8 + 1);
39229 
39230     /* "View.MemoryView":152
39231  *
39232  *         for idx, dim in enumerate(shape):
39233  *             if dim <= 0:             # <<<<<<<<<<<<<<
39234  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
39235  *             self._shape[idx] = dim
39236  */
39237     __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
39238     if (unlikely(__pyx_t_4)) {
39239 
39240       /* "View.MemoryView":153
39241  *         for idx, dim in enumerate(shape):
39242  *             if dim <= 0:
39243  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))             # <<<<<<<<<<<<<<
39244  *             self._shape[idx] = dim
39245  *
39246  */
39247       __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 153, __pyx_L1_error)
39248       __Pyx_GOTREF(__pyx_t_5);
39249       __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 153, __pyx_L1_error)
39250       __Pyx_GOTREF(__pyx_t_6);
39251       __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 153, __pyx_L1_error)
39252       __Pyx_GOTREF(__pyx_t_10);
39253       __Pyx_GIVEREF(__pyx_t_5);
39254       PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
39255       __Pyx_GIVEREF(__pyx_t_6);
39256       PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
39257       __pyx_t_5 = 0;
39258       __pyx_t_6 = 0;
39259       __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(4, 153, __pyx_L1_error)
39260       __Pyx_GOTREF(__pyx_t_6);
39261       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
39262       __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 153, __pyx_L1_error)
39263       __Pyx_GOTREF(__pyx_t_10);
39264       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
39265       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
39266       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
39267       __PYX_ERR(4, 153, __pyx_L1_error)
39268 
39269       /* "View.MemoryView":152
39270  *
39271  *         for idx, dim in enumerate(shape):
39272  *             if dim <= 0:             # <<<<<<<<<<<<<<
39273  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
39274  *             self._shape[idx] = dim
39275  */
39276     }
39277 
39278     /* "View.MemoryView":154
39279  *             if dim <= 0:
39280  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
39281  *             self._shape[idx] = dim             # <<<<<<<<<<<<<<
39282  *
39283  *         cdef char order
39284  */
39285     (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
39286 
39287     /* "View.MemoryView":151
39288  *
39289  *
39290  *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
39291  *             if dim <= 0:
39292  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
39293  */
39294   }
39295   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
39296 
39297   /* "View.MemoryView":157
39298  *
39299  *         cdef char order
39300  *         if mode == 'fortran':             # <<<<<<<<<<<<<<
39301  *             order = b'F'
39302  *             self.mode = u'fortran'
39303  */
39304   __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(4, 157, __pyx_L1_error)
39305   if (__pyx_t_4) {
39306 
39307     /* "View.MemoryView":158
39308  *         cdef char order
39309  *         if mode == 'fortran':
39310  *             order = b'F'             # <<<<<<<<<<<<<<
39311  *             self.mode = u'fortran'
39312  *         elif mode == 'c':
39313  */
39314     __pyx_v_order = 'F';
39315 
39316     /* "View.MemoryView":159
39317  *         if mode == 'fortran':
39318  *             order = b'F'
39319  *             self.mode = u'fortran'             # <<<<<<<<<<<<<<
39320  *         elif mode == 'c':
39321  *             order = b'C'
39322  */
39323     __Pyx_INCREF(__pyx_n_u_fortran);
39324     __Pyx_GIVEREF(__pyx_n_u_fortran);
39325     __Pyx_GOTREF(__pyx_v_self->mode);
39326     __Pyx_DECREF(__pyx_v_self->mode);
39327     __pyx_v_self->mode = __pyx_n_u_fortran;
39328 
39329     /* "View.MemoryView":157
39330  *
39331  *         cdef char order
39332  *         if mode == 'fortran':             # <<<<<<<<<<<<<<
39333  *             order = b'F'
39334  *             self.mode = u'fortran'
39335  */
39336     goto __pyx_L10;
39337   }
39338 
39339   /* "View.MemoryView":160
39340  *             order = b'F'
39341  *             self.mode = u'fortran'
39342  *         elif mode == 'c':             # <<<<<<<<<<<<<<
39343  *             order = b'C'
39344  *             self.mode = u'c'
39345  */
39346   __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(4, 160, __pyx_L1_error)
39347   if (likely(__pyx_t_4)) {
39348 
39349     /* "View.MemoryView":161
39350  *             self.mode = u'fortran'
39351  *         elif mode == 'c':
39352  *             order = b'C'             # <<<<<<<<<<<<<<
39353  *             self.mode = u'c'
39354  *         else:
39355  */
39356     __pyx_v_order = 'C';
39357 
39358     /* "View.MemoryView":162
39359  *         elif mode == 'c':
39360  *             order = b'C'
39361  *             self.mode = u'c'             # <<<<<<<<<<<<<<
39362  *         else:
39363  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
39364  */
39365     __Pyx_INCREF(__pyx_n_u_c);
39366     __Pyx_GIVEREF(__pyx_n_u_c);
39367     __Pyx_GOTREF(__pyx_v_self->mode);
39368     __Pyx_DECREF(__pyx_v_self->mode);
39369     __pyx_v_self->mode = __pyx_n_u_c;
39370 
39371     /* "View.MemoryView":160
39372  *             order = b'F'
39373  *             self.mode = u'fortran'
39374  *         elif mode == 'c':             # <<<<<<<<<<<<<<
39375  *             order = b'C'
39376  *             self.mode = u'c'
39377  */
39378     goto __pyx_L10;
39379   }
39380 
39381   /* "View.MemoryView":164
39382  *             self.mode = u'c'
39383  *         else:
39384  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)             # <<<<<<<<<<<<<<
39385  *
39386  *         self.len = fill_contig_strides_array(self._shape, self._strides,
39387  */
39388   /*else*/ {
39389     __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(4, 164, __pyx_L1_error)
39390     __Pyx_GOTREF(__pyx_t_3);
39391     __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 164, __pyx_L1_error)
39392     __Pyx_GOTREF(__pyx_t_10);
39393     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
39394     __Pyx_Raise(__pyx_t_10, 0, 0, 0);
39395     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
39396     __PYX_ERR(4, 164, __pyx_L1_error)
39397   }
39398   __pyx_L10:;
39399 
39400   /* "View.MemoryView":166
39401  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
39402  *
39403  *         self.len = fill_contig_strides_array(self._shape, self._strides,             # <<<<<<<<<<<<<<
39404  *                                              itemsize, self.ndim, order)
39405  *
39406  */
39407   __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);
39408 
39409   /* "View.MemoryView":169
39410  *                                              itemsize, self.ndim, order)
39411  *
39412  *         self.free_data = allocate_buffer             # <<<<<<<<<<<<<<
39413  *         self.dtype_is_object = format == b'O'
39414  *         if allocate_buffer:
39415  */
39416   __pyx_v_self->free_data = __pyx_v_allocate_buffer;
39417 
39418   /* "View.MemoryView":170
39419  *
39420  *         self.free_data = allocate_buffer
39421  *         self.dtype_is_object = format == b'O'             # <<<<<<<<<<<<<<
39422  *         if allocate_buffer:
39423  *
39424  */
39425   __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(4, 170, __pyx_L1_error)
39426   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(4, 170, __pyx_L1_error)
39427   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
39428   __pyx_v_self->dtype_is_object = __pyx_t_4;
39429 
39430   /* "View.MemoryView":171
39431  *         self.free_data = allocate_buffer
39432  *         self.dtype_is_object = format == b'O'
39433  *         if allocate_buffer:             # <<<<<<<<<<<<<<
39434  *
39435  *
39436  */
39437   __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
39438   if (__pyx_t_4) {
39439 
39440     /* "View.MemoryView":174
39441  *
39442  *
39443  *             self.data = <char *>malloc(self.len)             # <<<<<<<<<<<<<<
39444  *             if not self.data:
39445  *                 raise MemoryError("unable to allocate array data.")
39446  */
39447     __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
39448 
39449     /* "View.MemoryView":175
39450  *
39451  *             self.data = <char *>malloc(self.len)
39452  *             if not self.data:             # <<<<<<<<<<<<<<
39453  *                 raise MemoryError("unable to allocate array data.")
39454  *
39455  */
39456     __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
39457     if (unlikely(__pyx_t_4)) {
39458 
39459       /* "View.MemoryView":176
39460  *             self.data = <char *>malloc(self.len)
39461  *             if not self.data:
39462  *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
39463  *
39464  *             if self.dtype_is_object:
39465  */
39466       __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(4, 176, __pyx_L1_error)
39467       __Pyx_GOTREF(__pyx_t_10);
39468       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
39469       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
39470       __PYX_ERR(4, 176, __pyx_L1_error)
39471 
39472       /* "View.MemoryView":175
39473  *
39474  *             self.data = <char *>malloc(self.len)
39475  *             if not self.data:             # <<<<<<<<<<<<<<
39476  *                 raise MemoryError("unable to allocate array data.")
39477  *
39478  */
39479     }
39480 
39481     /* "View.MemoryView":178
39482  *                 raise MemoryError("unable to allocate array data.")
39483  *
39484  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
39485  *                 p = <PyObject **> self.data
39486  *                 for i in range(self.len / itemsize):
39487  */
39488     __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
39489     if (__pyx_t_4) {
39490 
39491       /* "View.MemoryView":179
39492  *
39493  *             if self.dtype_is_object:
39494  *                 p = <PyObject **> self.data             # <<<<<<<<<<<<<<
39495  *                 for i in range(self.len / itemsize):
39496  *                     p[i] = Py_None
39497  */
39498       __pyx_v_p = ((PyObject **)__pyx_v_self->data);
39499 
39500       /* "View.MemoryView":180
39501  *             if self.dtype_is_object:
39502  *                 p = <PyObject **> self.data
39503  *                 for i in range(self.len / itemsize):             # <<<<<<<<<<<<<<
39504  *                     p[i] = Py_None
39505  *                     Py_INCREF(Py_None)
39506  */
39507       if (unlikely(__pyx_v_itemsize == 0)) {
39508         PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
39509         __PYX_ERR(4, 180, __pyx_L1_error)
39510       }
39511       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))) {
39512         PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
39513         __PYX_ERR(4, 180, __pyx_L1_error)
39514       }
39515       __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
39516       __pyx_t_9 = __pyx_t_1;
39517       for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
39518         __pyx_v_i = __pyx_t_11;
39519 
39520         /* "View.MemoryView":181
39521  *                 p = <PyObject **> self.data
39522  *                 for i in range(self.len / itemsize):
39523  *                     p[i] = Py_None             # <<<<<<<<<<<<<<
39524  *                     Py_INCREF(Py_None)
39525  *
39526  */
39527         (__pyx_v_p[__pyx_v_i]) = Py_None;
39528 
39529         /* "View.MemoryView":182
39530  *                 for i in range(self.len / itemsize):
39531  *                     p[i] = Py_None
39532  *                     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
39533  *
39534  *     @cname('getbuffer')
39535  */
39536         Py_INCREF(Py_None);
39537       }
39538 
39539       /* "View.MemoryView":178
39540  *                 raise MemoryError("unable to allocate array data.")
39541  *
39542  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
39543  *                 p = <PyObject **> self.data
39544  *                 for i in range(self.len / itemsize):
39545  */
39546     }
39547 
39548     /* "View.MemoryView":171
39549  *         self.free_data = allocate_buffer
39550  *         self.dtype_is_object = format == b'O'
39551  *         if allocate_buffer:             # <<<<<<<<<<<<<<
39552  *
39553  *
39554  */
39555   }
39556 
39557   /* "View.MemoryView":122
39558  *         cdef bint dtype_is_object
39559  *
39560  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
39561  *                   mode="c", bint allocate_buffer=True):
39562  *
39563  */
39564 
39565   /* function exit code */
39566   __pyx_r = 0;
39567   goto __pyx_L0;
39568   __pyx_L1_error:;
39569   __Pyx_XDECREF(__pyx_t_3);
39570   __Pyx_XDECREF(__pyx_t_5);
39571   __Pyx_XDECREF(__pyx_t_6);
39572   __Pyx_XDECREF(__pyx_t_10);
39573   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
39574   __pyx_r = -1;
39575   __pyx_L0:;
39576   __Pyx_XDECREF(__pyx_v_format);
39577   __Pyx_RefNannyFinishContext();
39578   return __pyx_r;
39579 }
39580 
39581 /* "View.MemoryView":185
39582  *
39583  *     @cname('getbuffer')
39584  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
39585  *         cdef int bufmode = -1
39586  *         if self.mode == u"c":
39587  */
39588 
39589 /* Python wrapper */
39590 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
__pyx_array_getbuffer(PyObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)39591 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
39592   int __pyx_r;
39593   __Pyx_RefNannyDeclarations
39594   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
39595   __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));
39596 
39597   /* function exit code */
39598   __Pyx_RefNannyFinishContext();
39599   return __pyx_r;
39600 }
39601 
__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)39602 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) {
39603   int __pyx_v_bufmode;
39604   int __pyx_r;
39605   __Pyx_RefNannyDeclarations
39606   int __pyx_t_1;
39607   int __pyx_t_2;
39608   PyObject *__pyx_t_3 = NULL;
39609   char *__pyx_t_4;
39610   Py_ssize_t __pyx_t_5;
39611   int __pyx_t_6;
39612   Py_ssize_t *__pyx_t_7;
39613   if (__pyx_v_info == NULL) {
39614     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
39615     return -1;
39616   }
39617   __Pyx_RefNannySetupContext("__getbuffer__", 0);
39618   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
39619   __Pyx_GIVEREF(__pyx_v_info->obj);
39620 
39621   /* "View.MemoryView":186
39622  *     @cname('getbuffer')
39623  *     def __getbuffer__(self, Py_buffer *info, int flags):
39624  *         cdef int bufmode = -1             # <<<<<<<<<<<<<<
39625  *         if self.mode == u"c":
39626  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
39627  */
39628   __pyx_v_bufmode = -1;
39629 
39630   /* "View.MemoryView":187
39631  *     def __getbuffer__(self, Py_buffer *info, int flags):
39632  *         cdef int bufmode = -1
39633  *         if self.mode == u"c":             # <<<<<<<<<<<<<<
39634  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
39635  *         elif self.mode == u"fortran":
39636  */
39637   __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(4, 187, __pyx_L1_error)
39638   __pyx_t_2 = (__pyx_t_1 != 0);
39639   if (__pyx_t_2) {
39640 
39641     /* "View.MemoryView":188
39642  *         cdef int bufmode = -1
39643  *         if self.mode == u"c":
39644  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
39645  *         elif self.mode == u"fortran":
39646  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
39647  */
39648     __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
39649 
39650     /* "View.MemoryView":187
39651  *     def __getbuffer__(self, Py_buffer *info, int flags):
39652  *         cdef int bufmode = -1
39653  *         if self.mode == u"c":             # <<<<<<<<<<<<<<
39654  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
39655  *         elif self.mode == u"fortran":
39656  */
39657     goto __pyx_L3;
39658   }
39659 
39660   /* "View.MemoryView":189
39661  *         if self.mode == u"c":
39662  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
39663  *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
39664  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
39665  *         if not (flags & bufmode):
39666  */
39667   __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(4, 189, __pyx_L1_error)
39668   __pyx_t_1 = (__pyx_t_2 != 0);
39669   if (__pyx_t_1) {
39670 
39671     /* "View.MemoryView":190
39672  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
39673  *         elif self.mode == u"fortran":
39674  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
39675  *         if not (flags & bufmode):
39676  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
39677  */
39678     __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
39679 
39680     /* "View.MemoryView":189
39681  *         if self.mode == u"c":
39682  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
39683  *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
39684  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
39685  *         if not (flags & bufmode):
39686  */
39687   }
39688   __pyx_L3:;
39689 
39690   /* "View.MemoryView":191
39691  *         elif self.mode == u"fortran":
39692  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
39693  *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
39694  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
39695  *         info.buf = self.data
39696  */
39697   __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
39698   if (unlikely(__pyx_t_1)) {
39699 
39700     /* "View.MemoryView":192
39701  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
39702  *         if not (flags & bufmode):
39703  *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
39704  *         info.buf = self.data
39705  *         info.len = self.len
39706  */
39707     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 192, __pyx_L1_error)
39708     __Pyx_GOTREF(__pyx_t_3);
39709     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
39710     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
39711     __PYX_ERR(4, 192, __pyx_L1_error)
39712 
39713     /* "View.MemoryView":191
39714  *         elif self.mode == u"fortran":
39715  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
39716  *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
39717  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
39718  *         info.buf = self.data
39719  */
39720   }
39721 
39722   /* "View.MemoryView":193
39723  *         if not (flags & bufmode):
39724  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
39725  *         info.buf = self.data             # <<<<<<<<<<<<<<
39726  *         info.len = self.len
39727  *         info.ndim = self.ndim
39728  */
39729   __pyx_t_4 = __pyx_v_self->data;
39730   __pyx_v_info->buf = __pyx_t_4;
39731 
39732   /* "View.MemoryView":194
39733  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
39734  *         info.buf = self.data
39735  *         info.len = self.len             # <<<<<<<<<<<<<<
39736  *         info.ndim = self.ndim
39737  *         info.shape = self._shape
39738  */
39739   __pyx_t_5 = __pyx_v_self->len;
39740   __pyx_v_info->len = __pyx_t_5;
39741 
39742   /* "View.MemoryView":195
39743  *         info.buf = self.data
39744  *         info.len = self.len
39745  *         info.ndim = self.ndim             # <<<<<<<<<<<<<<
39746  *         info.shape = self._shape
39747  *         info.strides = self._strides
39748  */
39749   __pyx_t_6 = __pyx_v_self->ndim;
39750   __pyx_v_info->ndim = __pyx_t_6;
39751 
39752   /* "View.MemoryView":196
39753  *         info.len = self.len
39754  *         info.ndim = self.ndim
39755  *         info.shape = self._shape             # <<<<<<<<<<<<<<
39756  *         info.strides = self._strides
39757  *         info.suboffsets = NULL
39758  */
39759   __pyx_t_7 = __pyx_v_self->_shape;
39760   __pyx_v_info->shape = __pyx_t_7;
39761 
39762   /* "View.MemoryView":197
39763  *         info.ndim = self.ndim
39764  *         info.shape = self._shape
39765  *         info.strides = self._strides             # <<<<<<<<<<<<<<
39766  *         info.suboffsets = NULL
39767  *         info.itemsize = self.itemsize
39768  */
39769   __pyx_t_7 = __pyx_v_self->_strides;
39770   __pyx_v_info->strides = __pyx_t_7;
39771 
39772   /* "View.MemoryView":198
39773  *         info.shape = self._shape
39774  *         info.strides = self._strides
39775  *         info.suboffsets = NULL             # <<<<<<<<<<<<<<
39776  *         info.itemsize = self.itemsize
39777  *         info.readonly = 0
39778  */
39779   __pyx_v_info->suboffsets = NULL;
39780 
39781   /* "View.MemoryView":199
39782  *         info.strides = self._strides
39783  *         info.suboffsets = NULL
39784  *         info.itemsize = self.itemsize             # <<<<<<<<<<<<<<
39785  *         info.readonly = 0
39786  *
39787  */
39788   __pyx_t_5 = __pyx_v_self->itemsize;
39789   __pyx_v_info->itemsize = __pyx_t_5;
39790 
39791   /* "View.MemoryView":200
39792  *         info.suboffsets = NULL
39793  *         info.itemsize = self.itemsize
39794  *         info.readonly = 0             # <<<<<<<<<<<<<<
39795  *
39796  *         if flags & PyBUF_FORMAT:
39797  */
39798   __pyx_v_info->readonly = 0;
39799 
39800   /* "View.MemoryView":202
39801  *         info.readonly = 0
39802  *
39803  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
39804  *             info.format = self.format
39805  *         else:
39806  */
39807   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
39808   if (__pyx_t_1) {
39809 
39810     /* "View.MemoryView":203
39811  *
39812  *         if flags & PyBUF_FORMAT:
39813  *             info.format = self.format             # <<<<<<<<<<<<<<
39814  *         else:
39815  *             info.format = NULL
39816  */
39817     __pyx_t_4 = __pyx_v_self->format;
39818     __pyx_v_info->format = __pyx_t_4;
39819 
39820     /* "View.MemoryView":202
39821  *         info.readonly = 0
39822  *
39823  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
39824  *             info.format = self.format
39825  *         else:
39826  */
39827     goto __pyx_L5;
39828   }
39829 
39830   /* "View.MemoryView":205
39831  *             info.format = self.format
39832  *         else:
39833  *             info.format = NULL             # <<<<<<<<<<<<<<
39834  *
39835  *         info.obj = self
39836  */
39837   /*else*/ {
39838     __pyx_v_info->format = NULL;
39839   }
39840   __pyx_L5:;
39841 
39842   /* "View.MemoryView":207
39843  *             info.format = NULL
39844  *
39845  *         info.obj = self             # <<<<<<<<<<<<<<
39846  *
39847  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
39848  */
39849   __Pyx_INCREF(((PyObject *)__pyx_v_self));
39850   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
39851   __Pyx_GOTREF(__pyx_v_info->obj);
39852   __Pyx_DECREF(__pyx_v_info->obj);
39853   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
39854 
39855   /* "View.MemoryView":185
39856  *
39857  *     @cname('getbuffer')
39858  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
39859  *         cdef int bufmode = -1
39860  *         if self.mode == u"c":
39861  */
39862 
39863   /* function exit code */
39864   __pyx_r = 0;
39865   goto __pyx_L0;
39866   __pyx_L1_error:;
39867   __Pyx_XDECREF(__pyx_t_3);
39868   __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
39869   __pyx_r = -1;
39870   if (__pyx_v_info->obj != NULL) {
39871     __Pyx_GOTREF(__pyx_v_info->obj);
39872     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
39873   }
39874   goto __pyx_L2;
39875   __pyx_L0:;
39876   if (__pyx_v_info->obj == Py_None) {
39877     __Pyx_GOTREF(__pyx_v_info->obj);
39878     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
39879   }
39880   __pyx_L2:;
39881   __Pyx_RefNannyFinishContext();
39882   return __pyx_r;
39883 }
39884 
39885 /* "View.MemoryView":211
39886  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
39887  *
39888  *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
39889  *         if self.callback_free_data != NULL:
39890  *             self.callback_free_data(self.data)
39891  */
39892 
39893 /* Python wrapper */
39894 static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_array___dealloc__(PyObject * __pyx_v_self)39895 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
39896   __Pyx_RefNannyDeclarations
39897   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
39898   __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));
39899 
39900   /* function exit code */
39901   __Pyx_RefNannyFinishContext();
39902 }
39903 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj * __pyx_v_self)39904 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
39905   __Pyx_RefNannyDeclarations
39906   int __pyx_t_1;
39907   __Pyx_RefNannySetupContext("__dealloc__", 0);
39908 
39909   /* "View.MemoryView":212
39910  *
39911  *     def __dealloc__(array self):
39912  *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
39913  *             self.callback_free_data(self.data)
39914  *         elif self.free_data:
39915  */
39916   __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
39917   if (__pyx_t_1) {
39918 
39919     /* "View.MemoryView":213
39920  *     def __dealloc__(array self):
39921  *         if self.callback_free_data != NULL:
39922  *             self.callback_free_data(self.data)             # <<<<<<<<<<<<<<
39923  *         elif self.free_data:
39924  *             if self.dtype_is_object:
39925  */
39926     __pyx_v_self->callback_free_data(__pyx_v_self->data);
39927 
39928     /* "View.MemoryView":212
39929  *
39930  *     def __dealloc__(array self):
39931  *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
39932  *             self.callback_free_data(self.data)
39933  *         elif self.free_data:
39934  */
39935     goto __pyx_L3;
39936   }
39937 
39938   /* "View.MemoryView":214
39939  *         if self.callback_free_data != NULL:
39940  *             self.callback_free_data(self.data)
39941  *         elif self.free_data:             # <<<<<<<<<<<<<<
39942  *             if self.dtype_is_object:
39943  *                 refcount_objects_in_slice(self.data, self._shape,
39944  */
39945   __pyx_t_1 = (__pyx_v_self->free_data != 0);
39946   if (__pyx_t_1) {
39947 
39948     /* "View.MemoryView":215
39949  *             self.callback_free_data(self.data)
39950  *         elif self.free_data:
39951  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
39952  *                 refcount_objects_in_slice(self.data, self._shape,
39953  *                                           self._strides, self.ndim, False)
39954  */
39955     __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
39956     if (__pyx_t_1) {
39957 
39958       /* "View.MemoryView":216
39959  *         elif self.free_data:
39960  *             if self.dtype_is_object:
39961  *                 refcount_objects_in_slice(self.data, self._shape,             # <<<<<<<<<<<<<<
39962  *                                           self._strides, self.ndim, False)
39963  *             free(self.data)
39964  */
39965       __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
39966 
39967       /* "View.MemoryView":215
39968  *             self.callback_free_data(self.data)
39969  *         elif self.free_data:
39970  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
39971  *                 refcount_objects_in_slice(self.data, self._shape,
39972  *                                           self._strides, self.ndim, False)
39973  */
39974     }
39975 
39976     /* "View.MemoryView":218
39977  *                 refcount_objects_in_slice(self.data, self._shape,
39978  *                                           self._strides, self.ndim, False)
39979  *             free(self.data)             # <<<<<<<<<<<<<<
39980  *         PyObject_Free(self._shape)
39981  *
39982  */
39983     free(__pyx_v_self->data);
39984 
39985     /* "View.MemoryView":214
39986  *         if self.callback_free_data != NULL:
39987  *             self.callback_free_data(self.data)
39988  *         elif self.free_data:             # <<<<<<<<<<<<<<
39989  *             if self.dtype_is_object:
39990  *                 refcount_objects_in_slice(self.data, self._shape,
39991  */
39992   }
39993   __pyx_L3:;
39994 
39995   /* "View.MemoryView":219
39996  *                                           self._strides, self.ndim, False)
39997  *             free(self.data)
39998  *         PyObject_Free(self._shape)             # <<<<<<<<<<<<<<
39999  *
40000  *     @property
40001  */
40002   PyObject_Free(__pyx_v_self->_shape);
40003 
40004   /* "View.MemoryView":211
40005  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
40006  *
40007  *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
40008  *         if self.callback_free_data != NULL:
40009  *             self.callback_free_data(self.data)
40010  */
40011 
40012   /* function exit code */
40013   __Pyx_RefNannyFinishContext();
40014 }
40015 
40016 /* "View.MemoryView":222
40017  *
40018  *     @property
40019  *     def memview(self):             # <<<<<<<<<<<<<<
40020  *         return self.get_memview()
40021  *
40022  */
40023 
40024 /* Python wrapper */
40025 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject * __pyx_v_self)40026 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
40027   PyObject *__pyx_r = 0;
40028   __Pyx_RefNannyDeclarations
40029   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
40030   __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));
40031 
40032   /* function exit code */
40033   __Pyx_RefNannyFinishContext();
40034   return __pyx_r;
40035 }
40036 
__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj * __pyx_v_self)40037 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
40038   PyObject *__pyx_r = NULL;
40039   __Pyx_RefNannyDeclarations
40040   PyObject *__pyx_t_1 = NULL;
40041   __Pyx_RefNannySetupContext("__get__", 0);
40042 
40043   /* "View.MemoryView":223
40044  *     @property
40045  *     def memview(self):
40046  *         return self.get_memview()             # <<<<<<<<<<<<<<
40047  *
40048  *     @cname('get_memview')
40049  */
40050   __Pyx_XDECREF(__pyx_r);
40051   __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 223, __pyx_L1_error)
40052   __Pyx_GOTREF(__pyx_t_1);
40053   __pyx_r = __pyx_t_1;
40054   __pyx_t_1 = 0;
40055   goto __pyx_L0;
40056 
40057   /* "View.MemoryView":222
40058  *
40059  *     @property
40060  *     def memview(self):             # <<<<<<<<<<<<<<
40061  *         return self.get_memview()
40062  *
40063  */
40064 
40065   /* function exit code */
40066   __pyx_L1_error:;
40067   __Pyx_XDECREF(__pyx_t_1);
40068   __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
40069   __pyx_r = NULL;
40070   __pyx_L0:;
40071   __Pyx_XGIVEREF(__pyx_r);
40072   __Pyx_RefNannyFinishContext();
40073   return __pyx_r;
40074 }
40075 
40076 /* "View.MemoryView":226
40077  *
40078  *     @cname('get_memview')
40079  *     cdef get_memview(self):             # <<<<<<<<<<<<<<
40080  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
40081  *         return  memoryview(self, flags, self.dtype_is_object)
40082  */
40083 
__pyx_array_get_memview(struct __pyx_array_obj * __pyx_v_self)40084 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
40085   int __pyx_v_flags;
40086   PyObject *__pyx_r = NULL;
40087   __Pyx_RefNannyDeclarations
40088   PyObject *__pyx_t_1 = NULL;
40089   PyObject *__pyx_t_2 = NULL;
40090   PyObject *__pyx_t_3 = NULL;
40091   __Pyx_RefNannySetupContext("get_memview", 0);
40092 
40093   /* "View.MemoryView":227
40094  *     @cname('get_memview')
40095  *     cdef get_memview(self):
40096  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE             # <<<<<<<<<<<<<<
40097  *         return  memoryview(self, flags, self.dtype_is_object)
40098  *
40099  */
40100   __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
40101 
40102   /* "View.MemoryView":228
40103  *     cdef get_memview(self):
40104  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
40105  *         return  memoryview(self, flags, self.dtype_is_object)             # <<<<<<<<<<<<<<
40106  *
40107  *     def __len__(self):
40108  */
40109   __Pyx_XDECREF(__pyx_r);
40110   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 228, __pyx_L1_error)
40111   __Pyx_GOTREF(__pyx_t_1);
40112   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 228, __pyx_L1_error)
40113   __Pyx_GOTREF(__pyx_t_2);
40114   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 228, __pyx_L1_error)
40115   __Pyx_GOTREF(__pyx_t_3);
40116   __Pyx_INCREF(((PyObject *)__pyx_v_self));
40117   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
40118   PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
40119   __Pyx_GIVEREF(__pyx_t_1);
40120   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
40121   __Pyx_GIVEREF(__pyx_t_2);
40122   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
40123   __pyx_t_1 = 0;
40124   __pyx_t_2 = 0;
40125   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 228, __pyx_L1_error)
40126   __Pyx_GOTREF(__pyx_t_2);
40127   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
40128   __pyx_r = __pyx_t_2;
40129   __pyx_t_2 = 0;
40130   goto __pyx_L0;
40131 
40132   /* "View.MemoryView":226
40133  *
40134  *     @cname('get_memview')
40135  *     cdef get_memview(self):             # <<<<<<<<<<<<<<
40136  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
40137  *         return  memoryview(self, flags, self.dtype_is_object)
40138  */
40139 
40140   /* function exit code */
40141   __pyx_L1_error:;
40142   __Pyx_XDECREF(__pyx_t_1);
40143   __Pyx_XDECREF(__pyx_t_2);
40144   __Pyx_XDECREF(__pyx_t_3);
40145   __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
40146   __pyx_r = 0;
40147   __pyx_L0:;
40148   __Pyx_XGIVEREF(__pyx_r);
40149   __Pyx_RefNannyFinishContext();
40150   return __pyx_r;
40151 }
40152 
40153 /* "View.MemoryView":230
40154  *         return  memoryview(self, flags, self.dtype_is_object)
40155  *
40156  *     def __len__(self):             # <<<<<<<<<<<<<<
40157  *         return self._shape[0]
40158  *
40159  */
40160 
40161 /* Python wrapper */
40162 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
__pyx_array___len__(PyObject * __pyx_v_self)40163 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
40164   Py_ssize_t __pyx_r;
40165   __Pyx_RefNannyDeclarations
40166   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
40167   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));
40168 
40169   /* function exit code */
40170   __Pyx_RefNannyFinishContext();
40171   return __pyx_r;
40172 }
40173 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj * __pyx_v_self)40174 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
40175   Py_ssize_t __pyx_r;
40176   __Pyx_RefNannyDeclarations
40177   __Pyx_RefNannySetupContext("__len__", 0);
40178 
40179   /* "View.MemoryView":231
40180  *
40181  *     def __len__(self):
40182  *         return self._shape[0]             # <<<<<<<<<<<<<<
40183  *
40184  *     def __getattr__(self, attr):
40185  */
40186   __pyx_r = (__pyx_v_self->_shape[0]);
40187   goto __pyx_L0;
40188 
40189   /* "View.MemoryView":230
40190  *         return  memoryview(self, flags, self.dtype_is_object)
40191  *
40192  *     def __len__(self):             # <<<<<<<<<<<<<<
40193  *         return self._shape[0]
40194  *
40195  */
40196 
40197   /* function exit code */
40198   __pyx_L0:;
40199   __Pyx_RefNannyFinishContext();
40200   return __pyx_r;
40201 }
40202 
40203 /* "View.MemoryView":233
40204  *         return self._shape[0]
40205  *
40206  *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
40207  *         return getattr(self.memview, attr)
40208  *
40209  */
40210 
40211 /* Python wrapper */
40212 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
__pyx_array___getattr__(PyObject * __pyx_v_self,PyObject * __pyx_v_attr)40213 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
40214   PyObject *__pyx_r = 0;
40215   __Pyx_RefNannyDeclarations
40216   __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
40217   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
40218 
40219   /* function exit code */
40220   __Pyx_RefNannyFinishContext();
40221   return __pyx_r;
40222 }
40223 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_attr)40224 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
40225   PyObject *__pyx_r = NULL;
40226   __Pyx_RefNannyDeclarations
40227   PyObject *__pyx_t_1 = NULL;
40228   PyObject *__pyx_t_2 = NULL;
40229   __Pyx_RefNannySetupContext("__getattr__", 0);
40230 
40231   /* "View.MemoryView":234
40232  *
40233  *     def __getattr__(self, attr):
40234  *         return getattr(self.memview, attr)             # <<<<<<<<<<<<<<
40235  *
40236  *     def __getitem__(self, item):
40237  */
40238   __Pyx_XDECREF(__pyx_r);
40239   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 234, __pyx_L1_error)
40240   __Pyx_GOTREF(__pyx_t_1);
40241   __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 234, __pyx_L1_error)
40242   __Pyx_GOTREF(__pyx_t_2);
40243   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
40244   __pyx_r = __pyx_t_2;
40245   __pyx_t_2 = 0;
40246   goto __pyx_L0;
40247 
40248   /* "View.MemoryView":233
40249  *         return self._shape[0]
40250  *
40251  *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
40252  *         return getattr(self.memview, attr)
40253  *
40254  */
40255 
40256   /* function exit code */
40257   __pyx_L1_error:;
40258   __Pyx_XDECREF(__pyx_t_1);
40259   __Pyx_XDECREF(__pyx_t_2);
40260   __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
40261   __pyx_r = NULL;
40262   __pyx_L0:;
40263   __Pyx_XGIVEREF(__pyx_r);
40264   __Pyx_RefNannyFinishContext();
40265   return __pyx_r;
40266 }
40267 
40268 /* "View.MemoryView":236
40269  *         return getattr(self.memview, attr)
40270  *
40271  *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
40272  *         return self.memview[item]
40273  *
40274  */
40275 
40276 /* Python wrapper */
40277 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
__pyx_array___getitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_item)40278 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
40279   PyObject *__pyx_r = 0;
40280   __Pyx_RefNannyDeclarations
40281   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
40282   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
40283 
40284   /* function exit code */
40285   __Pyx_RefNannyFinishContext();
40286   return __pyx_r;
40287 }
40288 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_item)40289 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
40290   PyObject *__pyx_r = NULL;
40291   __Pyx_RefNannyDeclarations
40292   PyObject *__pyx_t_1 = NULL;
40293   PyObject *__pyx_t_2 = NULL;
40294   __Pyx_RefNannySetupContext("__getitem__", 0);
40295 
40296   /* "View.MemoryView":237
40297  *
40298  *     def __getitem__(self, item):
40299  *         return self.memview[item]             # <<<<<<<<<<<<<<
40300  *
40301  *     def __setitem__(self, item, value):
40302  */
40303   __Pyx_XDECREF(__pyx_r);
40304   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 237, __pyx_L1_error)
40305   __Pyx_GOTREF(__pyx_t_1);
40306   __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 237, __pyx_L1_error)
40307   __Pyx_GOTREF(__pyx_t_2);
40308   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
40309   __pyx_r = __pyx_t_2;
40310   __pyx_t_2 = 0;
40311   goto __pyx_L0;
40312 
40313   /* "View.MemoryView":236
40314  *         return getattr(self.memview, attr)
40315  *
40316  *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
40317  *         return self.memview[item]
40318  *
40319  */
40320 
40321   /* function exit code */
40322   __pyx_L1_error:;
40323   __Pyx_XDECREF(__pyx_t_1);
40324   __Pyx_XDECREF(__pyx_t_2);
40325   __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
40326   __pyx_r = NULL;
40327   __pyx_L0:;
40328   __Pyx_XGIVEREF(__pyx_r);
40329   __Pyx_RefNannyFinishContext();
40330   return __pyx_r;
40331 }
40332 
40333 /* "View.MemoryView":239
40334  *         return self.memview[item]
40335  *
40336  *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
40337  *         self.memview[item] = value
40338  *
40339  */
40340 
40341 /* Python wrapper */
40342 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
__pyx_array___setitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_item,PyObject * __pyx_v_value)40343 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
40344   int __pyx_r;
40345   __Pyx_RefNannyDeclarations
40346   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
40347   __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));
40348 
40349   /* function exit code */
40350   __Pyx_RefNannyFinishContext();
40351   return __pyx_r;
40352 }
40353 
__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)40354 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) {
40355   int __pyx_r;
40356   __Pyx_RefNannyDeclarations
40357   PyObject *__pyx_t_1 = NULL;
40358   __Pyx_RefNannySetupContext("__setitem__", 0);
40359 
40360   /* "View.MemoryView":240
40361  *
40362  *     def __setitem__(self, item, value):
40363  *         self.memview[item] = value             # <<<<<<<<<<<<<<
40364  *
40365  *
40366  */
40367   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 240, __pyx_L1_error)
40368   __Pyx_GOTREF(__pyx_t_1);
40369   if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(4, 240, __pyx_L1_error)
40370   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
40371 
40372   /* "View.MemoryView":239
40373  *         return self.memview[item]
40374  *
40375  *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
40376  *         self.memview[item] = value
40377  *
40378  */
40379 
40380   /* function exit code */
40381   __pyx_r = 0;
40382   goto __pyx_L0;
40383   __pyx_L1_error:;
40384   __Pyx_XDECREF(__pyx_t_1);
40385   __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
40386   __pyx_r = -1;
40387   __pyx_L0:;
40388   __Pyx_RefNannyFinishContext();
40389   return __pyx_r;
40390 }
40391 
40392 /* "(tree fragment)":1
40393  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
40394  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
40395  * def __setstate_cython__(self, __pyx_state):
40396  */
40397 
40398 /* Python wrapper */
40399 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_array_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)40400 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
40401   PyObject *__pyx_r = 0;
40402   __Pyx_RefNannyDeclarations
40403   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
40404   __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));
40405 
40406   /* function exit code */
40407   __Pyx_RefNannyFinishContext();
40408   return __pyx_r;
40409 }
40410 
__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj * __pyx_v_self)40411 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
40412   PyObject *__pyx_r = NULL;
40413   __Pyx_RefNannyDeclarations
40414   PyObject *__pyx_t_1 = NULL;
40415   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
40416 
40417   /* "(tree fragment)":2
40418  * def __reduce_cython__(self):
40419  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
40420  * def __setstate_cython__(self, __pyx_state):
40421  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
40422  */
40423   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2, __pyx_L1_error)
40424   __Pyx_GOTREF(__pyx_t_1);
40425   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
40426   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
40427   __PYX_ERR(4, 2, __pyx_L1_error)
40428 
40429   /* "(tree fragment)":1
40430  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
40431  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
40432  * def __setstate_cython__(self, __pyx_state):
40433  */
40434 
40435   /* function exit code */
40436   __pyx_L1_error:;
40437   __Pyx_XDECREF(__pyx_t_1);
40438   __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
40439   __pyx_r = NULL;
40440   __Pyx_XGIVEREF(__pyx_r);
40441   __Pyx_RefNannyFinishContext();
40442   return __pyx_r;
40443 }
40444 
40445 /* "(tree fragment)":3
40446  * def __reduce_cython__(self):
40447  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
40448  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
40449  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
40450  */
40451 
40452 /* Python wrapper */
40453 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_array_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)40454 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
40455   PyObject *__pyx_r = 0;
40456   __Pyx_RefNannyDeclarations
40457   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
40458   __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
40459 
40460   /* function exit code */
40461   __Pyx_RefNannyFinishContext();
40462   return __pyx_r;
40463 }
40464 
__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)40465 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) {
40466   PyObject *__pyx_r = NULL;
40467   __Pyx_RefNannyDeclarations
40468   PyObject *__pyx_t_1 = NULL;
40469   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
40470 
40471   /* "(tree fragment)":4
40472  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
40473  * def __setstate_cython__(self, __pyx_state):
40474  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
40475  */
40476   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4, __pyx_L1_error)
40477   __Pyx_GOTREF(__pyx_t_1);
40478   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
40479   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
40480   __PYX_ERR(4, 4, __pyx_L1_error)
40481 
40482   /* "(tree fragment)":3
40483  * def __reduce_cython__(self):
40484  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
40485  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
40486  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
40487  */
40488 
40489   /* function exit code */
40490   __pyx_L1_error:;
40491   __Pyx_XDECREF(__pyx_t_1);
40492   __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
40493   __pyx_r = NULL;
40494   __Pyx_XGIVEREF(__pyx_r);
40495   __Pyx_RefNannyFinishContext();
40496   return __pyx_r;
40497 }
40498 
40499 /* "View.MemoryView":244
40500  *
40501  * @cname("__pyx_array_new")
40502  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
40503  *                           char *mode, char *buf):
40504  *     cdef array result
40505  */
40506 
__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)40507 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) {
40508   struct __pyx_array_obj *__pyx_v_result = 0;
40509   struct __pyx_array_obj *__pyx_r = NULL;
40510   __Pyx_RefNannyDeclarations
40511   int __pyx_t_1;
40512   PyObject *__pyx_t_2 = NULL;
40513   PyObject *__pyx_t_3 = NULL;
40514   PyObject *__pyx_t_4 = NULL;
40515   PyObject *__pyx_t_5 = NULL;
40516   __Pyx_RefNannySetupContext("array_cwrapper", 0);
40517 
40518   /* "View.MemoryView":248
40519  *     cdef array result
40520  *
40521  *     if buf == NULL:             # <<<<<<<<<<<<<<
40522  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
40523  *     else:
40524  */
40525   __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
40526   if (__pyx_t_1) {
40527 
40528     /* "View.MemoryView":249
40529  *
40530  *     if buf == NULL:
40531  *         result = array(shape, itemsize, format, mode.decode('ASCII'))             # <<<<<<<<<<<<<<
40532  *     else:
40533  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
40534  */
40535     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 249, __pyx_L1_error)
40536     __Pyx_GOTREF(__pyx_t_2);
40537     __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 249, __pyx_L1_error)
40538     __Pyx_GOTREF(__pyx_t_3);
40539     __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(4, 249, __pyx_L1_error)
40540     __Pyx_GOTREF(__pyx_t_4);
40541     __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 249, __pyx_L1_error)
40542     __Pyx_GOTREF(__pyx_t_5);
40543     __Pyx_INCREF(__pyx_v_shape);
40544     __Pyx_GIVEREF(__pyx_v_shape);
40545     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
40546     __Pyx_GIVEREF(__pyx_t_2);
40547     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
40548     __Pyx_GIVEREF(__pyx_t_3);
40549     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
40550     __Pyx_GIVEREF(__pyx_t_4);
40551     PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
40552     __pyx_t_2 = 0;
40553     __pyx_t_3 = 0;
40554     __pyx_t_4 = 0;
40555     __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 249, __pyx_L1_error)
40556     __Pyx_GOTREF(__pyx_t_4);
40557     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
40558     __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
40559     __pyx_t_4 = 0;
40560 
40561     /* "View.MemoryView":248
40562  *     cdef array result
40563  *
40564  *     if buf == NULL:             # <<<<<<<<<<<<<<
40565  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
40566  *     else:
40567  */
40568     goto __pyx_L3;
40569   }
40570 
40571   /* "View.MemoryView":251
40572  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
40573  *     else:
40574  *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
40575  *                        allocate_buffer=False)
40576  *         result.data = buf
40577  */
40578   /*else*/ {
40579     __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 251, __pyx_L1_error)
40580     __Pyx_GOTREF(__pyx_t_4);
40581     __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 251, __pyx_L1_error)
40582     __Pyx_GOTREF(__pyx_t_5);
40583     __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(4, 251, __pyx_L1_error)
40584     __Pyx_GOTREF(__pyx_t_3);
40585     __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 251, __pyx_L1_error)
40586     __Pyx_GOTREF(__pyx_t_2);
40587     __Pyx_INCREF(__pyx_v_shape);
40588     __Pyx_GIVEREF(__pyx_v_shape);
40589     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
40590     __Pyx_GIVEREF(__pyx_t_4);
40591     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
40592     __Pyx_GIVEREF(__pyx_t_5);
40593     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
40594     __Pyx_GIVEREF(__pyx_t_3);
40595     PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
40596     __pyx_t_4 = 0;
40597     __pyx_t_5 = 0;
40598     __pyx_t_3 = 0;
40599 
40600     /* "View.MemoryView":252
40601  *     else:
40602  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
40603  *                        allocate_buffer=False)             # <<<<<<<<<<<<<<
40604  *         result.data = buf
40605  *
40606  */
40607     __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 252, __pyx_L1_error)
40608     __Pyx_GOTREF(__pyx_t_3);
40609     if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(4, 252, __pyx_L1_error)
40610 
40611     /* "View.MemoryView":251
40612  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
40613  *     else:
40614  *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
40615  *                        allocate_buffer=False)
40616  *         result.data = buf
40617  */
40618     __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 251, __pyx_L1_error)
40619     __Pyx_GOTREF(__pyx_t_5);
40620     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
40621     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
40622     __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
40623     __pyx_t_5 = 0;
40624 
40625     /* "View.MemoryView":253
40626  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
40627  *                        allocate_buffer=False)
40628  *         result.data = buf             # <<<<<<<<<<<<<<
40629  *
40630  *     return result
40631  */
40632     __pyx_v_result->data = __pyx_v_buf;
40633   }
40634   __pyx_L3:;
40635 
40636   /* "View.MemoryView":255
40637  *         result.data = buf
40638  *
40639  *     return result             # <<<<<<<<<<<<<<
40640  *
40641  *
40642  */
40643   __Pyx_XDECREF(((PyObject *)__pyx_r));
40644   __Pyx_INCREF(((PyObject *)__pyx_v_result));
40645   __pyx_r = __pyx_v_result;
40646   goto __pyx_L0;
40647 
40648   /* "View.MemoryView":244
40649  *
40650  * @cname("__pyx_array_new")
40651  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
40652  *                           char *mode, char *buf):
40653  *     cdef array result
40654  */
40655 
40656   /* function exit code */
40657   __pyx_L1_error:;
40658   __Pyx_XDECREF(__pyx_t_2);
40659   __Pyx_XDECREF(__pyx_t_3);
40660   __Pyx_XDECREF(__pyx_t_4);
40661   __Pyx_XDECREF(__pyx_t_5);
40662   __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
40663   __pyx_r = 0;
40664   __pyx_L0:;
40665   __Pyx_XDECREF((PyObject *)__pyx_v_result);
40666   __Pyx_XGIVEREF((PyObject *)__pyx_r);
40667   __Pyx_RefNannyFinishContext();
40668   return __pyx_r;
40669 }
40670 
40671 /* "View.MemoryView":281
40672  * cdef class Enum(object):
40673  *     cdef object name
40674  *     def __init__(self, name):             # <<<<<<<<<<<<<<
40675  *         self.name = name
40676  *     def __repr__(self):
40677  */
40678 
40679 /* Python wrapper */
40680 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_MemviewEnum___init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)40681 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
40682   PyObject *__pyx_v_name = 0;
40683   int __pyx_r;
40684   __Pyx_RefNannyDeclarations
40685   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
40686   {
40687     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
40688     PyObject* values[1] = {0};
40689     if (unlikely(__pyx_kwds)) {
40690       Py_ssize_t kw_args;
40691       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
40692       switch (pos_args) {
40693         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
40694         CYTHON_FALLTHROUGH;
40695         case  0: break;
40696         default: goto __pyx_L5_argtuple_error;
40697       }
40698       kw_args = PyDict_Size(__pyx_kwds);
40699       switch (pos_args) {
40700         case  0:
40701         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
40702         else goto __pyx_L5_argtuple_error;
40703       }
40704       if (unlikely(kw_args > 0)) {
40705         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(4, 281, __pyx_L3_error)
40706       }
40707     } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
40708       goto __pyx_L5_argtuple_error;
40709     } else {
40710       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
40711     }
40712     __pyx_v_name = values[0];
40713   }
40714   goto __pyx_L4_argument_unpacking_done;
40715   __pyx_L5_argtuple_error:;
40716   __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 281, __pyx_L3_error)
40717   __pyx_L3_error:;
40718   __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
40719   __Pyx_RefNannyFinishContext();
40720   return -1;
40721   __pyx_L4_argument_unpacking_done:;
40722   __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
40723 
40724   /* function exit code */
40725   __Pyx_RefNannyFinishContext();
40726   return __pyx_r;
40727 }
40728 
__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj * __pyx_v_self,PyObject * __pyx_v_name)40729 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
40730   int __pyx_r;
40731   __Pyx_RefNannyDeclarations
40732   __Pyx_RefNannySetupContext("__init__", 0);
40733 
40734   /* "View.MemoryView":282
40735  *     cdef object name
40736  *     def __init__(self, name):
40737  *         self.name = name             # <<<<<<<<<<<<<<
40738  *     def __repr__(self):
40739  *         return self.name
40740  */
40741   __Pyx_INCREF(__pyx_v_name);
40742   __Pyx_GIVEREF(__pyx_v_name);
40743   __Pyx_GOTREF(__pyx_v_self->name);
40744   __Pyx_DECREF(__pyx_v_self->name);
40745   __pyx_v_self->name = __pyx_v_name;
40746 
40747   /* "View.MemoryView":281
40748  * cdef class Enum(object):
40749  *     cdef object name
40750  *     def __init__(self, name):             # <<<<<<<<<<<<<<
40751  *         self.name = name
40752  *     def __repr__(self):
40753  */
40754 
40755   /* function exit code */
40756   __pyx_r = 0;
40757   __Pyx_RefNannyFinishContext();
40758   return __pyx_r;
40759 }
40760 
40761 /* "View.MemoryView":283
40762  *     def __init__(self, name):
40763  *         self.name = name
40764  *     def __repr__(self):             # <<<<<<<<<<<<<<
40765  *         return self.name
40766  *
40767  */
40768 
40769 /* Python wrapper */
40770 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_MemviewEnum___repr__(PyObject * __pyx_v_self)40771 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
40772   PyObject *__pyx_r = 0;
40773   __Pyx_RefNannyDeclarations
40774   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
40775   __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
40776 
40777   /* function exit code */
40778   __Pyx_RefNannyFinishContext();
40779   return __pyx_r;
40780 }
40781 
__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj * __pyx_v_self)40782 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
40783   PyObject *__pyx_r = NULL;
40784   __Pyx_RefNannyDeclarations
40785   __Pyx_RefNannySetupContext("__repr__", 0);
40786 
40787   /* "View.MemoryView":284
40788  *         self.name = name
40789  *     def __repr__(self):
40790  *         return self.name             # <<<<<<<<<<<<<<
40791  *
40792  * cdef generic = Enum("<strided and direct or indirect>")
40793  */
40794   __Pyx_XDECREF(__pyx_r);
40795   __Pyx_INCREF(__pyx_v_self->name);
40796   __pyx_r = __pyx_v_self->name;
40797   goto __pyx_L0;
40798 
40799   /* "View.MemoryView":283
40800  *     def __init__(self, name):
40801  *         self.name = name
40802  *     def __repr__(self):             # <<<<<<<<<<<<<<
40803  *         return self.name
40804  *
40805  */
40806 
40807   /* function exit code */
40808   __pyx_L0:;
40809   __Pyx_XGIVEREF(__pyx_r);
40810   __Pyx_RefNannyFinishContext();
40811   return __pyx_r;
40812 }
40813 
40814 /* "(tree fragment)":1
40815  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
40816  *     cdef tuple state
40817  *     cdef object _dict
40818  */
40819 
40820 /* Python wrapper */
40821 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)40822 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
40823   PyObject *__pyx_r = 0;
40824   __Pyx_RefNannyDeclarations
40825   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
40826   __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
40827 
40828   /* function exit code */
40829   __Pyx_RefNannyFinishContext();
40830   return __pyx_r;
40831 }
40832 
__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj * __pyx_v_self)40833 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
40834   PyObject *__pyx_v_state = 0;
40835   PyObject *__pyx_v__dict = 0;
40836   int __pyx_v_use_setstate;
40837   PyObject *__pyx_r = NULL;
40838   __Pyx_RefNannyDeclarations
40839   PyObject *__pyx_t_1 = NULL;
40840   int __pyx_t_2;
40841   int __pyx_t_3;
40842   PyObject *__pyx_t_4 = NULL;
40843   PyObject *__pyx_t_5 = NULL;
40844   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
40845 
40846   /* "(tree fragment)":5
40847  *     cdef object _dict
40848  *     cdef bint use_setstate
40849  *     state = (self.name,)             # <<<<<<<<<<<<<<
40850  *     _dict = getattr(self, '__dict__', None)
40851  *     if _dict is not None:
40852  */
40853   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
40854   __Pyx_GOTREF(__pyx_t_1);
40855   __Pyx_INCREF(__pyx_v_self->name);
40856   __Pyx_GIVEREF(__pyx_v_self->name);
40857   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
40858   __pyx_v_state = ((PyObject*)__pyx_t_1);
40859   __pyx_t_1 = 0;
40860 
40861   /* "(tree fragment)":6
40862  *     cdef bint use_setstate
40863  *     state = (self.name,)
40864  *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
40865  *     if _dict is not None:
40866  *         state += (_dict,)
40867  */
40868   __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6, __pyx_L1_error)
40869   __Pyx_GOTREF(__pyx_t_1);
40870   __pyx_v__dict = __pyx_t_1;
40871   __pyx_t_1 = 0;
40872 
40873   /* "(tree fragment)":7
40874  *     state = (self.name,)
40875  *     _dict = getattr(self, '__dict__', None)
40876  *     if _dict is not None:             # <<<<<<<<<<<<<<
40877  *         state += (_dict,)
40878  *         use_setstate = True
40879  */
40880   __pyx_t_2 = (__pyx_v__dict != Py_None);
40881   __pyx_t_3 = (__pyx_t_2 != 0);
40882   if (__pyx_t_3) {
40883 
40884     /* "(tree fragment)":8
40885  *     _dict = getattr(self, '__dict__', None)
40886  *     if _dict is not None:
40887  *         state += (_dict,)             # <<<<<<<<<<<<<<
40888  *         use_setstate = True
40889  *     else:
40890  */
40891     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8, __pyx_L1_error)
40892     __Pyx_GOTREF(__pyx_t_1);
40893     __Pyx_INCREF(__pyx_v__dict);
40894     __Pyx_GIVEREF(__pyx_v__dict);
40895     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
40896     __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 8, __pyx_L1_error)
40897     __Pyx_GOTREF(__pyx_t_4);
40898     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
40899     __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
40900     __pyx_t_4 = 0;
40901 
40902     /* "(tree fragment)":9
40903  *     if _dict is not None:
40904  *         state += (_dict,)
40905  *         use_setstate = True             # <<<<<<<<<<<<<<
40906  *     else:
40907  *         use_setstate = self.name is not None
40908  */
40909     __pyx_v_use_setstate = 1;
40910 
40911     /* "(tree fragment)":7
40912  *     state = (self.name,)
40913  *     _dict = getattr(self, '__dict__', None)
40914  *     if _dict is not None:             # <<<<<<<<<<<<<<
40915  *         state += (_dict,)
40916  *         use_setstate = True
40917  */
40918     goto __pyx_L3;
40919   }
40920 
40921   /* "(tree fragment)":11
40922  *         use_setstate = True
40923  *     else:
40924  *         use_setstate = self.name is not None             # <<<<<<<<<<<<<<
40925  *     if use_setstate:
40926  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
40927  */
40928   /*else*/ {
40929     __pyx_t_3 = (__pyx_v_self->name != Py_None);
40930     __pyx_v_use_setstate = __pyx_t_3;
40931   }
40932   __pyx_L3:;
40933 
40934   /* "(tree fragment)":12
40935  *     else:
40936  *         use_setstate = self.name is not None
40937  *     if use_setstate:             # <<<<<<<<<<<<<<
40938  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
40939  *     else:
40940  */
40941   __pyx_t_3 = (__pyx_v_use_setstate != 0);
40942   if (__pyx_t_3) {
40943 
40944     /* "(tree fragment)":13
40945  *         use_setstate = self.name is not None
40946  *     if use_setstate:
40947  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state             # <<<<<<<<<<<<<<
40948  *     else:
40949  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
40950  */
40951     __Pyx_XDECREF(__pyx_r);
40952     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 13, __pyx_L1_error)
40953     __Pyx_GOTREF(__pyx_t_4);
40954     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13, __pyx_L1_error)
40955     __Pyx_GOTREF(__pyx_t_1);
40956     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
40957     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
40958     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
40959     __Pyx_INCREF(__pyx_int_184977713);
40960     __Pyx_GIVEREF(__pyx_int_184977713);
40961     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
40962     __Pyx_INCREF(Py_None);
40963     __Pyx_GIVEREF(Py_None);
40964     PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
40965     __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 13, __pyx_L1_error)
40966     __Pyx_GOTREF(__pyx_t_5);
40967     __Pyx_GIVEREF(__pyx_t_4);
40968     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
40969     __Pyx_GIVEREF(__pyx_t_1);
40970     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
40971     __Pyx_INCREF(__pyx_v_state);
40972     __Pyx_GIVEREF(__pyx_v_state);
40973     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
40974     __pyx_t_4 = 0;
40975     __pyx_t_1 = 0;
40976     __pyx_r = __pyx_t_5;
40977     __pyx_t_5 = 0;
40978     goto __pyx_L0;
40979 
40980     /* "(tree fragment)":12
40981  *     else:
40982  *         use_setstate = self.name is not None
40983  *     if use_setstate:             # <<<<<<<<<<<<<<
40984  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
40985  *     else:
40986  */
40987   }
40988 
40989   /* "(tree fragment)":15
40990  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
40991  *     else:
40992  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)             # <<<<<<<<<<<<<<
40993  * def __setstate_cython__(self, __pyx_state):
40994  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
40995  */
40996   /*else*/ {
40997     __Pyx_XDECREF(__pyx_r);
40998     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 15, __pyx_L1_error)
40999     __Pyx_GOTREF(__pyx_t_5);
41000     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error)
41001     __Pyx_GOTREF(__pyx_t_1);
41002     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
41003     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
41004     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
41005     __Pyx_INCREF(__pyx_int_184977713);
41006     __Pyx_GIVEREF(__pyx_int_184977713);
41007     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
41008     __Pyx_INCREF(__pyx_v_state);
41009     __Pyx_GIVEREF(__pyx_v_state);
41010     PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
41011     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 15, __pyx_L1_error)
41012     __Pyx_GOTREF(__pyx_t_4);
41013     __Pyx_GIVEREF(__pyx_t_5);
41014     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
41015     __Pyx_GIVEREF(__pyx_t_1);
41016     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
41017     __pyx_t_5 = 0;
41018     __pyx_t_1 = 0;
41019     __pyx_r = __pyx_t_4;
41020     __pyx_t_4 = 0;
41021     goto __pyx_L0;
41022   }
41023 
41024   /* "(tree fragment)":1
41025  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
41026  *     cdef tuple state
41027  *     cdef object _dict
41028  */
41029 
41030   /* function exit code */
41031   __pyx_L1_error:;
41032   __Pyx_XDECREF(__pyx_t_1);
41033   __Pyx_XDECREF(__pyx_t_4);
41034   __Pyx_XDECREF(__pyx_t_5);
41035   __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
41036   __pyx_r = NULL;
41037   __pyx_L0:;
41038   __Pyx_XDECREF(__pyx_v_state);
41039   __Pyx_XDECREF(__pyx_v__dict);
41040   __Pyx_XGIVEREF(__pyx_r);
41041   __Pyx_RefNannyFinishContext();
41042   return __pyx_r;
41043 }
41044 
41045 /* "(tree fragment)":16
41046  *     else:
41047  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
41048  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
41049  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
41050  */
41051 
41052 /* Python wrapper */
41053 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)41054 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
41055   PyObject *__pyx_r = 0;
41056   __Pyx_RefNannyDeclarations
41057   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
41058   __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
41059 
41060   /* function exit code */
41061   __Pyx_RefNannyFinishContext();
41062   return __pyx_r;
41063 }
41064 
__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj * __pyx_v_self,PyObject * __pyx_v___pyx_state)41065 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
41066   PyObject *__pyx_r = NULL;
41067   __Pyx_RefNannyDeclarations
41068   PyObject *__pyx_t_1 = NULL;
41069   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
41070 
41071   /* "(tree fragment)":17
41072  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
41073  * def __setstate_cython__(self, __pyx_state):
41074  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
41075  */
41076   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(4, 17, __pyx_L1_error)
41077   __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17, __pyx_L1_error)
41078   __Pyx_GOTREF(__pyx_t_1);
41079   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41080 
41081   /* "(tree fragment)":16
41082  *     else:
41083  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
41084  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
41085  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
41086  */
41087 
41088   /* function exit code */
41089   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
41090   goto __pyx_L0;
41091   __pyx_L1_error:;
41092   __Pyx_XDECREF(__pyx_t_1);
41093   __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
41094   __pyx_r = NULL;
41095   __pyx_L0:;
41096   __Pyx_XGIVEREF(__pyx_r);
41097   __Pyx_RefNannyFinishContext();
41098   return __pyx_r;
41099 }
41100 
41101 /* "View.MemoryView":298
41102  *
41103  * @cname('__pyx_align_pointer')
41104  * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
41105  *     "Align pointer memory on a given boundary"
41106  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
41107  */
41108 
__pyx_align_pointer(void * __pyx_v_memory,size_t __pyx_v_alignment)41109 static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
41110   Py_intptr_t __pyx_v_aligned_p;
41111   size_t __pyx_v_offset;
41112   void *__pyx_r;
41113   int __pyx_t_1;
41114 
41115   /* "View.MemoryView":300
41116  * cdef void *align_pointer(void *memory, size_t alignment) nogil:
41117  *     "Align pointer memory on a given boundary"
41118  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory             # <<<<<<<<<<<<<<
41119  *     cdef size_t offset
41120  *
41121  */
41122   __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
41123 
41124   /* "View.MemoryView":304
41125  *
41126  *     with cython.cdivision(True):
41127  *         offset = aligned_p % alignment             # <<<<<<<<<<<<<<
41128  *
41129  *     if offset > 0:
41130  */
41131   __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
41132 
41133   /* "View.MemoryView":306
41134  *         offset = aligned_p % alignment
41135  *
41136  *     if offset > 0:             # <<<<<<<<<<<<<<
41137  *         aligned_p += alignment - offset
41138  *
41139  */
41140   __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
41141   if (__pyx_t_1) {
41142 
41143     /* "View.MemoryView":307
41144  *
41145  *     if offset > 0:
41146  *         aligned_p += alignment - offset             # <<<<<<<<<<<<<<
41147  *
41148  *     return <void *> aligned_p
41149  */
41150     __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
41151 
41152     /* "View.MemoryView":306
41153  *         offset = aligned_p % alignment
41154  *
41155  *     if offset > 0:             # <<<<<<<<<<<<<<
41156  *         aligned_p += alignment - offset
41157  *
41158  */
41159   }
41160 
41161   /* "View.MemoryView":309
41162  *         aligned_p += alignment - offset
41163  *
41164  *     return <void *> aligned_p             # <<<<<<<<<<<<<<
41165  *
41166  *
41167  */
41168   __pyx_r = ((void *)__pyx_v_aligned_p);
41169   goto __pyx_L0;
41170 
41171   /* "View.MemoryView":298
41172  *
41173  * @cname('__pyx_align_pointer')
41174  * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
41175  *     "Align pointer memory on a given boundary"
41176  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
41177  */
41178 
41179   /* function exit code */
41180   __pyx_L0:;
41181   return __pyx_r;
41182 }
41183 
41184 /* "View.MemoryView":345
41185  *     cdef __Pyx_TypeInfo *typeinfo
41186  *
41187  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
41188  *         self.obj = obj
41189  *         self.flags = flags
41190  */
41191 
41192 /* Python wrapper */
41193 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_memoryview___cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)41194 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
41195   PyObject *__pyx_v_obj = 0;
41196   int __pyx_v_flags;
41197   int __pyx_v_dtype_is_object;
41198   int __pyx_r;
41199   __Pyx_RefNannyDeclarations
41200   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
41201   {
41202     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
41203     PyObject* values[3] = {0,0,0};
41204     if (unlikely(__pyx_kwds)) {
41205       Py_ssize_t kw_args;
41206       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
41207       switch (pos_args) {
41208         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
41209         CYTHON_FALLTHROUGH;
41210         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
41211         CYTHON_FALLTHROUGH;
41212         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
41213         CYTHON_FALLTHROUGH;
41214         case  0: break;
41215         default: goto __pyx_L5_argtuple_error;
41216       }
41217       kw_args = PyDict_Size(__pyx_kwds);
41218       switch (pos_args) {
41219         case  0:
41220         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
41221         else goto __pyx_L5_argtuple_error;
41222         CYTHON_FALLTHROUGH;
41223         case  1:
41224         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
41225         else {
41226           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(4, 345, __pyx_L3_error)
41227         }
41228         CYTHON_FALLTHROUGH;
41229         case  2:
41230         if (kw_args > 0) {
41231           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
41232           if (value) { values[2] = value; kw_args--; }
41233         }
41234       }
41235       if (unlikely(kw_args > 0)) {
41236         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(4, 345, __pyx_L3_error)
41237       }
41238     } else {
41239       switch (PyTuple_GET_SIZE(__pyx_args)) {
41240         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
41241         CYTHON_FALLTHROUGH;
41242         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
41243         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
41244         break;
41245         default: goto __pyx_L5_argtuple_error;
41246       }
41247     }
41248     __pyx_v_obj = values[0];
41249     __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(4, 345, __pyx_L3_error)
41250     if (values[2]) {
41251       __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(4, 345, __pyx_L3_error)
41252     } else {
41253       __pyx_v_dtype_is_object = ((int)0);
41254     }
41255   }
41256   goto __pyx_L4_argument_unpacking_done;
41257   __pyx_L5_argtuple_error:;
41258   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 345, __pyx_L3_error)
41259   __pyx_L3_error:;
41260   __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
41261   __Pyx_RefNannyFinishContext();
41262   return -1;
41263   __pyx_L4_argument_unpacking_done:;
41264   __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);
41265 
41266   /* function exit code */
41267   __Pyx_RefNannyFinishContext();
41268   return __pyx_r;
41269 }
41270 
__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)41271 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) {
41272   int __pyx_r;
41273   __Pyx_RefNannyDeclarations
41274   int __pyx_t_1;
41275   int __pyx_t_2;
41276   int __pyx_t_3;
41277   int __pyx_t_4;
41278   __Pyx_RefNannySetupContext("__cinit__", 0);
41279 
41280   /* "View.MemoryView":346
41281  *
41282  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
41283  *         self.obj = obj             # <<<<<<<<<<<<<<
41284  *         self.flags = flags
41285  *         if type(self) is memoryview or obj is not None:
41286  */
41287   __Pyx_INCREF(__pyx_v_obj);
41288   __Pyx_GIVEREF(__pyx_v_obj);
41289   __Pyx_GOTREF(__pyx_v_self->obj);
41290   __Pyx_DECREF(__pyx_v_self->obj);
41291   __pyx_v_self->obj = __pyx_v_obj;
41292 
41293   /* "View.MemoryView":347
41294  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
41295  *         self.obj = obj
41296  *         self.flags = flags             # <<<<<<<<<<<<<<
41297  *         if type(self) is memoryview or obj is not None:
41298  *             __Pyx_GetBuffer(obj, &self.view, flags)
41299  */
41300   __pyx_v_self->flags = __pyx_v_flags;
41301 
41302   /* "View.MemoryView":348
41303  *         self.obj = obj
41304  *         self.flags = flags
41305  *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
41306  *             __Pyx_GetBuffer(obj, &self.view, flags)
41307  *             if <PyObject *> self.view.obj == NULL:
41308  */
41309   __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
41310   __pyx_t_3 = (__pyx_t_2 != 0);
41311   if (!__pyx_t_3) {
41312   } else {
41313     __pyx_t_1 = __pyx_t_3;
41314     goto __pyx_L4_bool_binop_done;
41315   }
41316   __pyx_t_3 = (__pyx_v_obj != Py_None);
41317   __pyx_t_2 = (__pyx_t_3 != 0);
41318   __pyx_t_1 = __pyx_t_2;
41319   __pyx_L4_bool_binop_done:;
41320   if (__pyx_t_1) {
41321 
41322     /* "View.MemoryView":349
41323  *         self.flags = flags
41324  *         if type(self) is memoryview or obj is not None:
41325  *             __Pyx_GetBuffer(obj, &self.view, flags)             # <<<<<<<<<<<<<<
41326  *             if <PyObject *> self.view.obj == NULL:
41327  *                 (<__pyx_buffer *> &self.view).obj = Py_None
41328  */
41329     __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(4, 349, __pyx_L1_error)
41330 
41331     /* "View.MemoryView":350
41332  *         if type(self) is memoryview or obj is not None:
41333  *             __Pyx_GetBuffer(obj, &self.view, flags)
41334  *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
41335  *                 (<__pyx_buffer *> &self.view).obj = Py_None
41336  *                 Py_INCREF(Py_None)
41337  */
41338     __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
41339     if (__pyx_t_1) {
41340 
41341       /* "View.MemoryView":351
41342  *             __Pyx_GetBuffer(obj, &self.view, flags)
41343  *             if <PyObject *> self.view.obj == NULL:
41344  *                 (<__pyx_buffer *> &self.view).obj = Py_None             # <<<<<<<<<<<<<<
41345  *                 Py_INCREF(Py_None)
41346  *
41347  */
41348       ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
41349 
41350       /* "View.MemoryView":352
41351  *             if <PyObject *> self.view.obj == NULL:
41352  *                 (<__pyx_buffer *> &self.view).obj = Py_None
41353  *                 Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
41354  *
41355  *         global __pyx_memoryview_thread_locks_used
41356  */
41357       Py_INCREF(Py_None);
41358 
41359       /* "View.MemoryView":350
41360  *         if type(self) is memoryview or obj is not None:
41361  *             __Pyx_GetBuffer(obj, &self.view, flags)
41362  *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
41363  *                 (<__pyx_buffer *> &self.view).obj = Py_None
41364  *                 Py_INCREF(Py_None)
41365  */
41366     }
41367 
41368     /* "View.MemoryView":348
41369  *         self.obj = obj
41370  *         self.flags = flags
41371  *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
41372  *             __Pyx_GetBuffer(obj, &self.view, flags)
41373  *             if <PyObject *> self.view.obj == NULL:
41374  */
41375   }
41376 
41377   /* "View.MemoryView":355
41378  *
41379  *         global __pyx_memoryview_thread_locks_used
41380  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
41381  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
41382  *             __pyx_memoryview_thread_locks_used += 1
41383  */
41384   __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
41385   if (__pyx_t_1) {
41386 
41387     /* "View.MemoryView":356
41388  *         global __pyx_memoryview_thread_locks_used
41389  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
41390  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]             # <<<<<<<<<<<<<<
41391  *             __pyx_memoryview_thread_locks_used += 1
41392  *         if self.lock is NULL:
41393  */
41394     __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
41395 
41396     /* "View.MemoryView":357
41397  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
41398  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
41399  *             __pyx_memoryview_thread_locks_used += 1             # <<<<<<<<<<<<<<
41400  *         if self.lock is NULL:
41401  *             self.lock = PyThread_allocate_lock()
41402  */
41403     __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
41404 
41405     /* "View.MemoryView":355
41406  *
41407  *         global __pyx_memoryview_thread_locks_used
41408  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
41409  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
41410  *             __pyx_memoryview_thread_locks_used += 1
41411  */
41412   }
41413 
41414   /* "View.MemoryView":358
41415  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
41416  *             __pyx_memoryview_thread_locks_used += 1
41417  *         if self.lock is NULL:             # <<<<<<<<<<<<<<
41418  *             self.lock = PyThread_allocate_lock()
41419  *             if self.lock is NULL:
41420  */
41421   __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
41422   if (__pyx_t_1) {
41423 
41424     /* "View.MemoryView":359
41425  *             __pyx_memoryview_thread_locks_used += 1
41426  *         if self.lock is NULL:
41427  *             self.lock = PyThread_allocate_lock()             # <<<<<<<<<<<<<<
41428  *             if self.lock is NULL:
41429  *                 raise MemoryError
41430  */
41431     __pyx_v_self->lock = PyThread_allocate_lock();
41432 
41433     /* "View.MemoryView":360
41434  *         if self.lock is NULL:
41435  *             self.lock = PyThread_allocate_lock()
41436  *             if self.lock is NULL:             # <<<<<<<<<<<<<<
41437  *                 raise MemoryError
41438  *
41439  */
41440     __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
41441     if (unlikely(__pyx_t_1)) {
41442 
41443       /* "View.MemoryView":361
41444  *             self.lock = PyThread_allocate_lock()
41445  *             if self.lock is NULL:
41446  *                 raise MemoryError             # <<<<<<<<<<<<<<
41447  *
41448  *         if flags & PyBUF_FORMAT:
41449  */
41450       PyErr_NoMemory(); __PYX_ERR(4, 361, __pyx_L1_error)
41451 
41452       /* "View.MemoryView":360
41453  *         if self.lock is NULL:
41454  *             self.lock = PyThread_allocate_lock()
41455  *             if self.lock is NULL:             # <<<<<<<<<<<<<<
41456  *                 raise MemoryError
41457  *
41458  */
41459     }
41460 
41461     /* "View.MemoryView":358
41462  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
41463  *             __pyx_memoryview_thread_locks_used += 1
41464  *         if self.lock is NULL:             # <<<<<<<<<<<<<<
41465  *             self.lock = PyThread_allocate_lock()
41466  *             if self.lock is NULL:
41467  */
41468   }
41469 
41470   /* "View.MemoryView":363
41471  *                 raise MemoryError
41472  *
41473  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
41474  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
41475  *         else:
41476  */
41477   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
41478   if (__pyx_t_1) {
41479 
41480     /* "View.MemoryView":364
41481  *
41482  *         if flags & PyBUF_FORMAT:
41483  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')             # <<<<<<<<<<<<<<
41484  *         else:
41485  *             self.dtype_is_object = dtype_is_object
41486  */
41487     __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
41488     if (__pyx_t_2) {
41489     } else {
41490       __pyx_t_1 = __pyx_t_2;
41491       goto __pyx_L11_bool_binop_done;
41492     }
41493     __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
41494     __pyx_t_1 = __pyx_t_2;
41495     __pyx_L11_bool_binop_done:;
41496     __pyx_v_self->dtype_is_object = __pyx_t_1;
41497 
41498     /* "View.MemoryView":363
41499  *                 raise MemoryError
41500  *
41501  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
41502  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
41503  *         else:
41504  */
41505     goto __pyx_L10;
41506   }
41507 
41508   /* "View.MemoryView":366
41509  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
41510  *         else:
41511  *             self.dtype_is_object = dtype_is_object             # <<<<<<<<<<<<<<
41512  *
41513  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
41514  */
41515   /*else*/ {
41516     __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
41517   }
41518   __pyx_L10:;
41519 
41520   /* "View.MemoryView":368
41521  *             self.dtype_is_object = dtype_is_object
41522  *
41523  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(             # <<<<<<<<<<<<<<
41524  *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
41525  *         self.typeinfo = NULL
41526  */
41527   __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));
41528 
41529   /* "View.MemoryView":370
41530  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
41531  *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
41532  *         self.typeinfo = NULL             # <<<<<<<<<<<<<<
41533  *
41534  *     def __dealloc__(memoryview self):
41535  */
41536   __pyx_v_self->typeinfo = NULL;
41537 
41538   /* "View.MemoryView":345
41539  *     cdef __Pyx_TypeInfo *typeinfo
41540  *
41541  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
41542  *         self.obj = obj
41543  *         self.flags = flags
41544  */
41545 
41546   /* function exit code */
41547   __pyx_r = 0;
41548   goto __pyx_L0;
41549   __pyx_L1_error:;
41550   __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
41551   __pyx_r = -1;
41552   __pyx_L0:;
41553   __Pyx_RefNannyFinishContext();
41554   return __pyx_r;
41555 }
41556 
41557 /* "View.MemoryView":372
41558  *         self.typeinfo = NULL
41559  *
41560  *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
41561  *         if self.obj is not None:
41562  *             __Pyx_ReleaseBuffer(&self.view)
41563  */
41564 
41565 /* Python wrapper */
41566 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___dealloc__(PyObject * __pyx_v_self)41567 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
41568   __Pyx_RefNannyDeclarations
41569   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
41570   __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));
41571 
41572   /* function exit code */
41573   __Pyx_RefNannyFinishContext();
41574 }
41575 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj * __pyx_v_self)41576 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
41577   int __pyx_v_i;
41578   __Pyx_RefNannyDeclarations
41579   int __pyx_t_1;
41580   int __pyx_t_2;
41581   int __pyx_t_3;
41582   int __pyx_t_4;
41583   int __pyx_t_5;
41584   PyThread_type_lock __pyx_t_6;
41585   PyThread_type_lock __pyx_t_7;
41586   __Pyx_RefNannySetupContext("__dealloc__", 0);
41587 
41588   /* "View.MemoryView":373
41589  *
41590  *     def __dealloc__(memoryview self):
41591  *         if self.obj is not None:             # <<<<<<<<<<<<<<
41592  *             __Pyx_ReleaseBuffer(&self.view)
41593  *
41594  */
41595   __pyx_t_1 = (__pyx_v_self->obj != Py_None);
41596   __pyx_t_2 = (__pyx_t_1 != 0);
41597   if (__pyx_t_2) {
41598 
41599     /* "View.MemoryView":374
41600  *     def __dealloc__(memoryview self):
41601  *         if self.obj is not None:
41602  *             __Pyx_ReleaseBuffer(&self.view)             # <<<<<<<<<<<<<<
41603  *
41604  *         cdef int i
41605  */
41606     __Pyx_ReleaseBuffer((&__pyx_v_self->view));
41607 
41608     /* "View.MemoryView":373
41609  *
41610  *     def __dealloc__(memoryview self):
41611  *         if self.obj is not None:             # <<<<<<<<<<<<<<
41612  *             __Pyx_ReleaseBuffer(&self.view)
41613  *
41614  */
41615   }
41616 
41617   /* "View.MemoryView":378
41618  *         cdef int i
41619  *         global __pyx_memoryview_thread_locks_used
41620  *         if self.lock != NULL:             # <<<<<<<<<<<<<<
41621  *             for i in range(__pyx_memoryview_thread_locks_used):
41622  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
41623  */
41624   __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
41625   if (__pyx_t_2) {
41626 
41627     /* "View.MemoryView":379
41628  *         global __pyx_memoryview_thread_locks_used
41629  *         if self.lock != NULL:
41630  *             for i in range(__pyx_memoryview_thread_locks_used):             # <<<<<<<<<<<<<<
41631  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
41632  *                     __pyx_memoryview_thread_locks_used -= 1
41633  */
41634     __pyx_t_3 = __pyx_memoryview_thread_locks_used;
41635     __pyx_t_4 = __pyx_t_3;
41636     for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
41637       __pyx_v_i = __pyx_t_5;
41638 
41639       /* "View.MemoryView":380
41640  *         if self.lock != NULL:
41641  *             for i in range(__pyx_memoryview_thread_locks_used):
41642  *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
41643  *                     __pyx_memoryview_thread_locks_used -= 1
41644  *                     if i != __pyx_memoryview_thread_locks_used:
41645  */
41646       __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
41647       if (__pyx_t_2) {
41648 
41649         /* "View.MemoryView":381
41650  *             for i in range(__pyx_memoryview_thread_locks_used):
41651  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
41652  *                     __pyx_memoryview_thread_locks_used -= 1             # <<<<<<<<<<<<<<
41653  *                     if i != __pyx_memoryview_thread_locks_used:
41654  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
41655  */
41656         __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
41657 
41658         /* "View.MemoryView":382
41659  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
41660  *                     __pyx_memoryview_thread_locks_used -= 1
41661  *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
41662  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
41663  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
41664  */
41665         __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
41666         if (__pyx_t_2) {
41667 
41668           /* "View.MemoryView":384
41669  *                     if i != __pyx_memoryview_thread_locks_used:
41670  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
41671  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])             # <<<<<<<<<<<<<<
41672  *                     break
41673  *             else:
41674  */
41675           __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
41676           __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
41677 
41678           /* "View.MemoryView":383
41679  *                     __pyx_memoryview_thread_locks_used -= 1
41680  *                     if i != __pyx_memoryview_thread_locks_used:
41681  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (             # <<<<<<<<<<<<<<
41682  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
41683  *                     break
41684  */
41685           (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
41686           (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
41687 
41688           /* "View.MemoryView":382
41689  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
41690  *                     __pyx_memoryview_thread_locks_used -= 1
41691  *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
41692  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
41693  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
41694  */
41695         }
41696 
41697         /* "View.MemoryView":385
41698  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
41699  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
41700  *                     break             # <<<<<<<<<<<<<<
41701  *             else:
41702  *                 PyThread_free_lock(self.lock)
41703  */
41704         goto __pyx_L6_break;
41705 
41706         /* "View.MemoryView":380
41707  *         if self.lock != NULL:
41708  *             for i in range(__pyx_memoryview_thread_locks_used):
41709  *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
41710  *                     __pyx_memoryview_thread_locks_used -= 1
41711  *                     if i != __pyx_memoryview_thread_locks_used:
41712  */
41713       }
41714     }
41715     /*else*/ {
41716 
41717       /* "View.MemoryView":387
41718  *                     break
41719  *             else:
41720  *                 PyThread_free_lock(self.lock)             # <<<<<<<<<<<<<<
41721  *
41722  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
41723  */
41724       PyThread_free_lock(__pyx_v_self->lock);
41725     }
41726     __pyx_L6_break:;
41727 
41728     /* "View.MemoryView":378
41729  *         cdef int i
41730  *         global __pyx_memoryview_thread_locks_used
41731  *         if self.lock != NULL:             # <<<<<<<<<<<<<<
41732  *             for i in range(__pyx_memoryview_thread_locks_used):
41733  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
41734  */
41735   }
41736 
41737   /* "View.MemoryView":372
41738  *         self.typeinfo = NULL
41739  *
41740  *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
41741  *         if self.obj is not None:
41742  *             __Pyx_ReleaseBuffer(&self.view)
41743  */
41744 
41745   /* function exit code */
41746   __Pyx_RefNannyFinishContext();
41747 }
41748 
41749 /* "View.MemoryView":389
41750  *                 PyThread_free_lock(self.lock)
41751  *
41752  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
41753  *         cdef Py_ssize_t dim
41754  *         cdef char *itemp = <char *> self.view.buf
41755  */
41756 
__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index)41757 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
41758   Py_ssize_t __pyx_v_dim;
41759   char *__pyx_v_itemp;
41760   PyObject *__pyx_v_idx = NULL;
41761   char *__pyx_r;
41762   __Pyx_RefNannyDeclarations
41763   Py_ssize_t __pyx_t_1;
41764   PyObject *__pyx_t_2 = NULL;
41765   Py_ssize_t __pyx_t_3;
41766   PyObject *(*__pyx_t_4)(PyObject *);
41767   PyObject *__pyx_t_5 = NULL;
41768   Py_ssize_t __pyx_t_6;
41769   char *__pyx_t_7;
41770   __Pyx_RefNannySetupContext("get_item_pointer", 0);
41771 
41772   /* "View.MemoryView":391
41773  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
41774  *         cdef Py_ssize_t dim
41775  *         cdef char *itemp = <char *> self.view.buf             # <<<<<<<<<<<<<<
41776  *
41777  *         for dim, idx in enumerate(index):
41778  */
41779   __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
41780 
41781   /* "View.MemoryView":393
41782  *         cdef char *itemp = <char *> self.view.buf
41783  *
41784  *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
41785  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
41786  *
41787  */
41788   __pyx_t_1 = 0;
41789   if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
41790     __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
41791     __pyx_t_4 = NULL;
41792   } else {
41793     __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 393, __pyx_L1_error)
41794     __Pyx_GOTREF(__pyx_t_2);
41795     __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 393, __pyx_L1_error)
41796   }
41797   for (;;) {
41798     if (likely(!__pyx_t_4)) {
41799       if (likely(PyList_CheckExact(__pyx_t_2))) {
41800         if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
41801         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
41802         __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(4, 393, __pyx_L1_error)
41803         #else
41804         __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 393, __pyx_L1_error)
41805         __Pyx_GOTREF(__pyx_t_5);
41806         #endif
41807       } else {
41808         if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
41809         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
41810         __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(4, 393, __pyx_L1_error)
41811         #else
41812         __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 393, __pyx_L1_error)
41813         __Pyx_GOTREF(__pyx_t_5);
41814         #endif
41815       }
41816     } else {
41817       __pyx_t_5 = __pyx_t_4(__pyx_t_2);
41818       if (unlikely(!__pyx_t_5)) {
41819         PyObject* exc_type = PyErr_Occurred();
41820         if (exc_type) {
41821           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
41822           else __PYX_ERR(4, 393, __pyx_L1_error)
41823         }
41824         break;
41825       }
41826       __Pyx_GOTREF(__pyx_t_5);
41827     }
41828     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
41829     __pyx_t_5 = 0;
41830     __pyx_v_dim = __pyx_t_1;
41831     __pyx_t_1 = (__pyx_t_1 + 1);
41832 
41833     /* "View.MemoryView":394
41834  *
41835  *         for dim, idx in enumerate(index):
41836  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)             # <<<<<<<<<<<<<<
41837  *
41838  *         return itemp
41839  */
41840     __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(4, 394, __pyx_L1_error)
41841     __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(4, 394, __pyx_L1_error)
41842     __pyx_v_itemp = __pyx_t_7;
41843 
41844     /* "View.MemoryView":393
41845  *         cdef char *itemp = <char *> self.view.buf
41846  *
41847  *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
41848  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
41849  *
41850  */
41851   }
41852   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
41853 
41854   /* "View.MemoryView":396
41855  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
41856  *
41857  *         return itemp             # <<<<<<<<<<<<<<
41858  *
41859  *
41860  */
41861   __pyx_r = __pyx_v_itemp;
41862   goto __pyx_L0;
41863 
41864   /* "View.MemoryView":389
41865  *                 PyThread_free_lock(self.lock)
41866  *
41867  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
41868  *         cdef Py_ssize_t dim
41869  *         cdef char *itemp = <char *> self.view.buf
41870  */
41871 
41872   /* function exit code */
41873   __pyx_L1_error:;
41874   __Pyx_XDECREF(__pyx_t_2);
41875   __Pyx_XDECREF(__pyx_t_5);
41876   __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
41877   __pyx_r = NULL;
41878   __pyx_L0:;
41879   __Pyx_XDECREF(__pyx_v_idx);
41880   __Pyx_RefNannyFinishContext();
41881   return __pyx_r;
41882 }
41883 
41884 /* "View.MemoryView":399
41885  *
41886  *
41887  *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
41888  *         if index is Ellipsis:
41889  *             return self
41890  */
41891 
41892 /* Python wrapper */
41893 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
__pyx_memoryview___getitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_index)41894 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
41895   PyObject *__pyx_r = 0;
41896   __Pyx_RefNannyDeclarations
41897   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
41898   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
41899 
41900   /* function exit code */
41901   __Pyx_RefNannyFinishContext();
41902   return __pyx_r;
41903 }
41904 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index)41905 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
41906   PyObject *__pyx_v_have_slices = NULL;
41907   PyObject *__pyx_v_indices = NULL;
41908   char *__pyx_v_itemp;
41909   PyObject *__pyx_r = NULL;
41910   __Pyx_RefNannyDeclarations
41911   int __pyx_t_1;
41912   int __pyx_t_2;
41913   PyObject *__pyx_t_3 = NULL;
41914   PyObject *__pyx_t_4 = NULL;
41915   PyObject *__pyx_t_5 = NULL;
41916   char *__pyx_t_6;
41917   __Pyx_RefNannySetupContext("__getitem__", 0);
41918 
41919   /* "View.MemoryView":400
41920  *
41921  *     def __getitem__(memoryview self, object index):
41922  *         if index is Ellipsis:             # <<<<<<<<<<<<<<
41923  *             return self
41924  *
41925  */
41926   __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
41927   __pyx_t_2 = (__pyx_t_1 != 0);
41928   if (__pyx_t_2) {
41929 
41930     /* "View.MemoryView":401
41931  *     def __getitem__(memoryview self, object index):
41932  *         if index is Ellipsis:
41933  *             return self             # <<<<<<<<<<<<<<
41934  *
41935  *         have_slices, indices = _unellipsify(index, self.view.ndim)
41936  */
41937     __Pyx_XDECREF(__pyx_r);
41938     __Pyx_INCREF(((PyObject *)__pyx_v_self));
41939     __pyx_r = ((PyObject *)__pyx_v_self);
41940     goto __pyx_L0;
41941 
41942     /* "View.MemoryView":400
41943  *
41944  *     def __getitem__(memoryview self, object index):
41945  *         if index is Ellipsis:             # <<<<<<<<<<<<<<
41946  *             return self
41947  *
41948  */
41949   }
41950 
41951   /* "View.MemoryView":403
41952  *             return self
41953  *
41954  *         have_slices, indices = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
41955  *
41956  *         cdef char *itemp
41957  */
41958   __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 403, __pyx_L1_error)
41959   __Pyx_GOTREF(__pyx_t_3);
41960   if (likely(__pyx_t_3 != Py_None)) {
41961     PyObject* sequence = __pyx_t_3;
41962     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
41963     if (unlikely(size != 2)) {
41964       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
41965       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
41966       __PYX_ERR(4, 403, __pyx_L1_error)
41967     }
41968     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
41969     __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
41970     __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
41971     __Pyx_INCREF(__pyx_t_4);
41972     __Pyx_INCREF(__pyx_t_5);
41973     #else
41974     __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 403, __pyx_L1_error)
41975     __Pyx_GOTREF(__pyx_t_4);
41976     __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 403, __pyx_L1_error)
41977     __Pyx_GOTREF(__pyx_t_5);
41978     #endif
41979     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
41980   } else {
41981     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(4, 403, __pyx_L1_error)
41982   }
41983   __pyx_v_have_slices = __pyx_t_4;
41984   __pyx_t_4 = 0;
41985   __pyx_v_indices = __pyx_t_5;
41986   __pyx_t_5 = 0;
41987 
41988   /* "View.MemoryView":406
41989  *
41990  *         cdef char *itemp
41991  *         if have_slices:             # <<<<<<<<<<<<<<
41992  *             return memview_slice(self, indices)
41993  *         else:
41994  */
41995   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(4, 406, __pyx_L1_error)
41996   if (__pyx_t_2) {
41997 
41998     /* "View.MemoryView":407
41999  *         cdef char *itemp
42000  *         if have_slices:
42001  *             return memview_slice(self, indices)             # <<<<<<<<<<<<<<
42002  *         else:
42003  *             itemp = self.get_item_pointer(indices)
42004  */
42005     __Pyx_XDECREF(__pyx_r);
42006     __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 407, __pyx_L1_error)
42007     __Pyx_GOTREF(__pyx_t_3);
42008     __pyx_r = __pyx_t_3;
42009     __pyx_t_3 = 0;
42010     goto __pyx_L0;
42011 
42012     /* "View.MemoryView":406
42013  *
42014  *         cdef char *itemp
42015  *         if have_slices:             # <<<<<<<<<<<<<<
42016  *             return memview_slice(self, indices)
42017  *         else:
42018  */
42019   }
42020 
42021   /* "View.MemoryView":409
42022  *             return memview_slice(self, indices)
42023  *         else:
42024  *             itemp = self.get_item_pointer(indices)             # <<<<<<<<<<<<<<
42025  *             return self.convert_item_to_object(itemp)
42026  *
42027  */
42028   /*else*/ {
42029     __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(4, 409, __pyx_L1_error)
42030     __pyx_v_itemp = __pyx_t_6;
42031 
42032     /* "View.MemoryView":410
42033  *         else:
42034  *             itemp = self.get_item_pointer(indices)
42035  *             return self.convert_item_to_object(itemp)             # <<<<<<<<<<<<<<
42036  *
42037  *     def __setitem__(memoryview self, object index, object value):
42038  */
42039     __Pyx_XDECREF(__pyx_r);
42040     __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(4, 410, __pyx_L1_error)
42041     __Pyx_GOTREF(__pyx_t_3);
42042     __pyx_r = __pyx_t_3;
42043     __pyx_t_3 = 0;
42044     goto __pyx_L0;
42045   }
42046 
42047   /* "View.MemoryView":399
42048  *
42049  *
42050  *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
42051  *         if index is Ellipsis:
42052  *             return self
42053  */
42054 
42055   /* function exit code */
42056   __pyx_L1_error:;
42057   __Pyx_XDECREF(__pyx_t_3);
42058   __Pyx_XDECREF(__pyx_t_4);
42059   __Pyx_XDECREF(__pyx_t_5);
42060   __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
42061   __pyx_r = NULL;
42062   __pyx_L0:;
42063   __Pyx_XDECREF(__pyx_v_have_slices);
42064   __Pyx_XDECREF(__pyx_v_indices);
42065   __Pyx_XGIVEREF(__pyx_r);
42066   __Pyx_RefNannyFinishContext();
42067   return __pyx_r;
42068 }
42069 
42070 /* "View.MemoryView":412
42071  *             return self.convert_item_to_object(itemp)
42072  *
42073  *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
42074  *         if self.view.readonly:
42075  *             raise TypeError("Cannot assign to read-only memoryview")
42076  */
42077 
42078 /* Python wrapper */
42079 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
__pyx_memoryview___setitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_index,PyObject * __pyx_v_value)42080 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
42081   int __pyx_r;
42082   __Pyx_RefNannyDeclarations
42083   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
42084   __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));
42085 
42086   /* function exit code */
42087   __Pyx_RefNannyFinishContext();
42088   return __pyx_r;
42089 }
42090 
__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)42091 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) {
42092   PyObject *__pyx_v_have_slices = NULL;
42093   PyObject *__pyx_v_obj = NULL;
42094   int __pyx_r;
42095   __Pyx_RefNannyDeclarations
42096   int __pyx_t_1;
42097   PyObject *__pyx_t_2 = NULL;
42098   PyObject *__pyx_t_3 = NULL;
42099   PyObject *__pyx_t_4 = NULL;
42100   __Pyx_RefNannySetupContext("__setitem__", 0);
42101   __Pyx_INCREF(__pyx_v_index);
42102 
42103   /* "View.MemoryView":413
42104  *
42105  *     def __setitem__(memoryview self, object index, object value):
42106  *         if self.view.readonly:             # <<<<<<<<<<<<<<
42107  *             raise TypeError("Cannot assign to read-only memoryview")
42108  *
42109  */
42110   __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
42111   if (unlikely(__pyx_t_1)) {
42112 
42113     /* "View.MemoryView":414
42114  *     def __setitem__(memoryview self, object index, object value):
42115  *         if self.view.readonly:
42116  *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
42117  *
42118  *         have_slices, index = _unellipsify(index, self.view.ndim)
42119  */
42120     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 414, __pyx_L1_error)
42121     __Pyx_GOTREF(__pyx_t_2);
42122     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
42123     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
42124     __PYX_ERR(4, 414, __pyx_L1_error)
42125 
42126     /* "View.MemoryView":413
42127  *
42128  *     def __setitem__(memoryview self, object index, object value):
42129  *         if self.view.readonly:             # <<<<<<<<<<<<<<
42130  *             raise TypeError("Cannot assign to read-only memoryview")
42131  *
42132  */
42133   }
42134 
42135   /* "View.MemoryView":416
42136  *             raise TypeError("Cannot assign to read-only memoryview")
42137  *
42138  *         have_slices, index = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
42139  *
42140  *         if have_slices:
42141  */
42142   __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 416, __pyx_L1_error)
42143   __Pyx_GOTREF(__pyx_t_2);
42144   if (likely(__pyx_t_2 != Py_None)) {
42145     PyObject* sequence = __pyx_t_2;
42146     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
42147     if (unlikely(size != 2)) {
42148       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
42149       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
42150       __PYX_ERR(4, 416, __pyx_L1_error)
42151     }
42152     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
42153     __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
42154     __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
42155     __Pyx_INCREF(__pyx_t_3);
42156     __Pyx_INCREF(__pyx_t_4);
42157     #else
42158     __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 416, __pyx_L1_error)
42159     __Pyx_GOTREF(__pyx_t_3);
42160     __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 416, __pyx_L1_error)
42161     __Pyx_GOTREF(__pyx_t_4);
42162     #endif
42163     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
42164   } else {
42165     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(4, 416, __pyx_L1_error)
42166   }
42167   __pyx_v_have_slices = __pyx_t_3;
42168   __pyx_t_3 = 0;
42169   __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
42170   __pyx_t_4 = 0;
42171 
42172   /* "View.MemoryView":418
42173  *         have_slices, index = _unellipsify(index, self.view.ndim)
42174  *
42175  *         if have_slices:             # <<<<<<<<<<<<<<
42176  *             obj = self.is_slice(value)
42177  *             if obj:
42178  */
42179   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(4, 418, __pyx_L1_error)
42180   if (__pyx_t_1) {
42181 
42182     /* "View.MemoryView":419
42183  *
42184  *         if have_slices:
42185  *             obj = self.is_slice(value)             # <<<<<<<<<<<<<<
42186  *             if obj:
42187  *                 self.setitem_slice_assignment(self[index], obj)
42188  */
42189     __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(4, 419, __pyx_L1_error)
42190     __Pyx_GOTREF(__pyx_t_2);
42191     __pyx_v_obj = __pyx_t_2;
42192     __pyx_t_2 = 0;
42193 
42194     /* "View.MemoryView":420
42195  *         if have_slices:
42196  *             obj = self.is_slice(value)
42197  *             if obj:             # <<<<<<<<<<<<<<
42198  *                 self.setitem_slice_assignment(self[index], obj)
42199  *             else:
42200  */
42201     __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(4, 420, __pyx_L1_error)
42202     if (__pyx_t_1) {
42203 
42204       /* "View.MemoryView":421
42205  *             obj = self.is_slice(value)
42206  *             if obj:
42207  *                 self.setitem_slice_assignment(self[index], obj)             # <<<<<<<<<<<<<<
42208  *             else:
42209  *                 self.setitem_slice_assign_scalar(self[index], value)
42210  */
42211       __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 421, __pyx_L1_error)
42212       __Pyx_GOTREF(__pyx_t_2);
42213       __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(4, 421, __pyx_L1_error)
42214       __Pyx_GOTREF(__pyx_t_4);
42215       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
42216       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
42217 
42218       /* "View.MemoryView":420
42219  *         if have_slices:
42220  *             obj = self.is_slice(value)
42221  *             if obj:             # <<<<<<<<<<<<<<
42222  *                 self.setitem_slice_assignment(self[index], obj)
42223  *             else:
42224  */
42225       goto __pyx_L5;
42226     }
42227 
42228     /* "View.MemoryView":423
42229  *                 self.setitem_slice_assignment(self[index], obj)
42230  *             else:
42231  *                 self.setitem_slice_assign_scalar(self[index], value)             # <<<<<<<<<<<<<<
42232  *         else:
42233  *             self.setitem_indexed(index, value)
42234  */
42235     /*else*/ {
42236       __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 423, __pyx_L1_error)
42237       __Pyx_GOTREF(__pyx_t_4);
42238       if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(4, 423, __pyx_L1_error)
42239       __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(4, 423, __pyx_L1_error)
42240       __Pyx_GOTREF(__pyx_t_2);
42241       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
42242       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
42243     }
42244     __pyx_L5:;
42245 
42246     /* "View.MemoryView":418
42247  *         have_slices, index = _unellipsify(index, self.view.ndim)
42248  *
42249  *         if have_slices:             # <<<<<<<<<<<<<<
42250  *             obj = self.is_slice(value)
42251  *             if obj:
42252  */
42253     goto __pyx_L4;
42254   }
42255 
42256   /* "View.MemoryView":425
42257  *                 self.setitem_slice_assign_scalar(self[index], value)
42258  *         else:
42259  *             self.setitem_indexed(index, value)             # <<<<<<<<<<<<<<
42260  *
42261  *     cdef is_slice(self, obj):
42262  */
42263   /*else*/ {
42264     __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(4, 425, __pyx_L1_error)
42265     __Pyx_GOTREF(__pyx_t_2);
42266     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
42267   }
42268   __pyx_L4:;
42269 
42270   /* "View.MemoryView":412
42271  *             return self.convert_item_to_object(itemp)
42272  *
42273  *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
42274  *         if self.view.readonly:
42275  *             raise TypeError("Cannot assign to read-only memoryview")
42276  */
42277 
42278   /* function exit code */
42279   __pyx_r = 0;
42280   goto __pyx_L0;
42281   __pyx_L1_error:;
42282   __Pyx_XDECREF(__pyx_t_2);
42283   __Pyx_XDECREF(__pyx_t_3);
42284   __Pyx_XDECREF(__pyx_t_4);
42285   __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
42286   __pyx_r = -1;
42287   __pyx_L0:;
42288   __Pyx_XDECREF(__pyx_v_have_slices);
42289   __Pyx_XDECREF(__pyx_v_obj);
42290   __Pyx_XDECREF(__pyx_v_index);
42291   __Pyx_RefNannyFinishContext();
42292   return __pyx_r;
42293 }
42294 
42295 /* "View.MemoryView":427
42296  *             self.setitem_indexed(index, value)
42297  *
42298  *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
42299  *         if not isinstance(obj, memoryview):
42300  *             try:
42301  */
42302 
__pyx_memoryview_is_slice(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_obj)42303 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
42304   PyObject *__pyx_r = NULL;
42305   __Pyx_RefNannyDeclarations
42306   int __pyx_t_1;
42307   int __pyx_t_2;
42308   PyObject *__pyx_t_3 = NULL;
42309   PyObject *__pyx_t_4 = NULL;
42310   PyObject *__pyx_t_5 = NULL;
42311   PyObject *__pyx_t_6 = NULL;
42312   PyObject *__pyx_t_7 = NULL;
42313   PyObject *__pyx_t_8 = NULL;
42314   int __pyx_t_9;
42315   __Pyx_RefNannySetupContext("is_slice", 0);
42316   __Pyx_INCREF(__pyx_v_obj);
42317 
42318   /* "View.MemoryView":428
42319  *
42320  *     cdef is_slice(self, obj):
42321  *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
42322  *             try:
42323  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
42324  */
42325   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
42326   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
42327   if (__pyx_t_2) {
42328 
42329     /* "View.MemoryView":429
42330  *     cdef is_slice(self, obj):
42331  *         if not isinstance(obj, memoryview):
42332  *             try:             # <<<<<<<<<<<<<<
42333  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
42334  *                                  self.dtype_is_object)
42335  */
42336     {
42337       __Pyx_PyThreadState_declare
42338       __Pyx_PyThreadState_assign
42339       __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
42340       __Pyx_XGOTREF(__pyx_t_3);
42341       __Pyx_XGOTREF(__pyx_t_4);
42342       __Pyx_XGOTREF(__pyx_t_5);
42343       /*try:*/ {
42344 
42345         /* "View.MemoryView":430
42346  *         if not isinstance(obj, memoryview):
42347  *             try:
42348  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
42349  *                                  self.dtype_is_object)
42350  *             except TypeError:
42351  */
42352         __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 430, __pyx_L4_error)
42353         __Pyx_GOTREF(__pyx_t_6);
42354 
42355         /* "View.MemoryView":431
42356  *             try:
42357  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
42358  *                                  self.dtype_is_object)             # <<<<<<<<<<<<<<
42359  *             except TypeError:
42360  *                 return None
42361  */
42362         __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 431, __pyx_L4_error)
42363         __Pyx_GOTREF(__pyx_t_7);
42364 
42365         /* "View.MemoryView":430
42366  *         if not isinstance(obj, memoryview):
42367  *             try:
42368  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
42369  *                                  self.dtype_is_object)
42370  *             except TypeError:
42371  */
42372         __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 430, __pyx_L4_error)
42373         __Pyx_GOTREF(__pyx_t_8);
42374         __Pyx_INCREF(__pyx_v_obj);
42375         __Pyx_GIVEREF(__pyx_v_obj);
42376         PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
42377         __Pyx_GIVEREF(__pyx_t_6);
42378         PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
42379         __Pyx_GIVEREF(__pyx_t_7);
42380         PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
42381         __pyx_t_6 = 0;
42382         __pyx_t_7 = 0;
42383         __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 430, __pyx_L4_error)
42384         __Pyx_GOTREF(__pyx_t_7);
42385         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
42386         __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
42387         __pyx_t_7 = 0;
42388 
42389         /* "View.MemoryView":429
42390  *     cdef is_slice(self, obj):
42391  *         if not isinstance(obj, memoryview):
42392  *             try:             # <<<<<<<<<<<<<<
42393  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
42394  *                                  self.dtype_is_object)
42395  */
42396       }
42397       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
42398       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
42399       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
42400       goto __pyx_L9_try_end;
42401       __pyx_L4_error:;
42402       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
42403       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
42404       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
42405 
42406       /* "View.MemoryView":432
42407  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
42408  *                                  self.dtype_is_object)
42409  *             except TypeError:             # <<<<<<<<<<<<<<
42410  *                 return None
42411  *
42412  */
42413       __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
42414       if (__pyx_t_9) {
42415         __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
42416         if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(4, 432, __pyx_L6_except_error)
42417         __Pyx_GOTREF(__pyx_t_7);
42418         __Pyx_GOTREF(__pyx_t_8);
42419         __Pyx_GOTREF(__pyx_t_6);
42420 
42421         /* "View.MemoryView":433
42422  *                                  self.dtype_is_object)
42423  *             except TypeError:
42424  *                 return None             # <<<<<<<<<<<<<<
42425  *
42426  *         return obj
42427  */
42428         __Pyx_XDECREF(__pyx_r);
42429         __pyx_r = Py_None; __Pyx_INCREF(Py_None);
42430         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
42431         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
42432         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
42433         goto __pyx_L7_except_return;
42434       }
42435       goto __pyx_L6_except_error;
42436       __pyx_L6_except_error:;
42437 
42438       /* "View.MemoryView":429
42439  *     cdef is_slice(self, obj):
42440  *         if not isinstance(obj, memoryview):
42441  *             try:             # <<<<<<<<<<<<<<
42442  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
42443  *                                  self.dtype_is_object)
42444  */
42445       __Pyx_XGIVEREF(__pyx_t_3);
42446       __Pyx_XGIVEREF(__pyx_t_4);
42447       __Pyx_XGIVEREF(__pyx_t_5);
42448       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
42449       goto __pyx_L1_error;
42450       __pyx_L7_except_return:;
42451       __Pyx_XGIVEREF(__pyx_t_3);
42452       __Pyx_XGIVEREF(__pyx_t_4);
42453       __Pyx_XGIVEREF(__pyx_t_5);
42454       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
42455       goto __pyx_L0;
42456       __pyx_L9_try_end:;
42457     }
42458 
42459     /* "View.MemoryView":428
42460  *
42461  *     cdef is_slice(self, obj):
42462  *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
42463  *             try:
42464  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
42465  */
42466   }
42467 
42468   /* "View.MemoryView":435
42469  *                 return None
42470  *
42471  *         return obj             # <<<<<<<<<<<<<<
42472  *
42473  *     cdef setitem_slice_assignment(self, dst, src):
42474  */
42475   __Pyx_XDECREF(__pyx_r);
42476   __Pyx_INCREF(__pyx_v_obj);
42477   __pyx_r = __pyx_v_obj;
42478   goto __pyx_L0;
42479 
42480   /* "View.MemoryView":427
42481  *             self.setitem_indexed(index, value)
42482  *
42483  *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
42484  *         if not isinstance(obj, memoryview):
42485  *             try:
42486  */
42487 
42488   /* function exit code */
42489   __pyx_L1_error:;
42490   __Pyx_XDECREF(__pyx_t_6);
42491   __Pyx_XDECREF(__pyx_t_7);
42492   __Pyx_XDECREF(__pyx_t_8);
42493   __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
42494   __pyx_r = 0;
42495   __pyx_L0:;
42496   __Pyx_XDECREF(__pyx_v_obj);
42497   __Pyx_XGIVEREF(__pyx_r);
42498   __Pyx_RefNannyFinishContext();
42499   return __pyx_r;
42500 }
42501 
42502 /* "View.MemoryView":437
42503  *         return obj
42504  *
42505  *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
42506  *         cdef __Pyx_memviewslice dst_slice
42507  *         cdef __Pyx_memviewslice src_slice
42508  */
42509 
__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_dst,PyObject * __pyx_v_src)42510 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
42511   __Pyx_memviewslice __pyx_v_dst_slice;
42512   __Pyx_memviewslice __pyx_v_src_slice;
42513   PyObject *__pyx_r = NULL;
42514   __Pyx_RefNannyDeclarations
42515   PyObject *__pyx_t_1 = NULL;
42516   int __pyx_t_2;
42517   int __pyx_t_3;
42518   int __pyx_t_4;
42519   __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
42520 
42521   /* "View.MemoryView":441
42522  *         cdef __Pyx_memviewslice src_slice
42523  *
42524  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
42525  *                                  get_slice_from_memview(dst, &dst_slice)[0],
42526  *                                  src.ndim, dst.ndim, self.dtype_is_object)
42527  */
42528   if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(4, 441, __pyx_L1_error)
42529 
42530   /* "View.MemoryView":442
42531  *
42532  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
42533  *                                  get_slice_from_memview(dst, &dst_slice)[0],             # <<<<<<<<<<<<<<
42534  *                                  src.ndim, dst.ndim, self.dtype_is_object)
42535  *
42536  */
42537   if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(4, 442, __pyx_L1_error)
42538 
42539   /* "View.MemoryView":443
42540  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
42541  *                                  get_slice_from_memview(dst, &dst_slice)[0],
42542  *                                  src.ndim, dst.ndim, self.dtype_is_object)             # <<<<<<<<<<<<<<
42543  *
42544  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
42545  */
42546   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 443, __pyx_L1_error)
42547   __Pyx_GOTREF(__pyx_t_1);
42548   __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(4, 443, __pyx_L1_error)
42549   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
42550   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 443, __pyx_L1_error)
42551   __Pyx_GOTREF(__pyx_t_1);
42552   __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(4, 443, __pyx_L1_error)
42553   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
42554 
42555   /* "View.MemoryView":441
42556  *         cdef __Pyx_memviewslice src_slice
42557  *
42558  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
42559  *                                  get_slice_from_memview(dst, &dst_slice)[0],
42560  *                                  src.ndim, dst.ndim, self.dtype_is_object)
42561  */
42562   __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(4, 441, __pyx_L1_error)
42563 
42564   /* "View.MemoryView":437
42565  *         return obj
42566  *
42567  *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
42568  *         cdef __Pyx_memviewslice dst_slice
42569  *         cdef __Pyx_memviewslice src_slice
42570  */
42571 
42572   /* function exit code */
42573   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
42574   goto __pyx_L0;
42575   __pyx_L1_error:;
42576   __Pyx_XDECREF(__pyx_t_1);
42577   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
42578   __pyx_r = 0;
42579   __pyx_L0:;
42580   __Pyx_XGIVEREF(__pyx_r);
42581   __Pyx_RefNannyFinishContext();
42582   return __pyx_r;
42583 }
42584 
42585 /* "View.MemoryView":445
42586  *                                  src.ndim, dst.ndim, self.dtype_is_object)
42587  *
42588  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
42589  *         cdef int array[128]
42590  *         cdef void *tmp = NULL
42591  */
42592 
__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj * __pyx_v_self,struct __pyx_memoryview_obj * __pyx_v_dst,PyObject * __pyx_v_value)42593 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) {
42594   int __pyx_v_array[0x80];
42595   void *__pyx_v_tmp;
42596   void *__pyx_v_item;
42597   __Pyx_memviewslice *__pyx_v_dst_slice;
42598   __Pyx_memviewslice __pyx_v_tmp_slice;
42599   PyObject *__pyx_r = NULL;
42600   __Pyx_RefNannyDeclarations
42601   int __pyx_t_1;
42602   PyObject *__pyx_t_2 = NULL;
42603   int __pyx_t_3;
42604   int __pyx_t_4;
42605   char const *__pyx_t_5;
42606   PyObject *__pyx_t_6 = NULL;
42607   PyObject *__pyx_t_7 = NULL;
42608   PyObject *__pyx_t_8 = NULL;
42609   PyObject *__pyx_t_9 = NULL;
42610   PyObject *__pyx_t_10 = NULL;
42611   PyObject *__pyx_t_11 = NULL;
42612   __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);
42613 
42614   /* "View.MemoryView":447
42615  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
42616  *         cdef int array[128]
42617  *         cdef void *tmp = NULL             # <<<<<<<<<<<<<<
42618  *         cdef void *item
42619  *
42620  */
42621   __pyx_v_tmp = NULL;
42622 
42623   /* "View.MemoryView":452
42624  *         cdef __Pyx_memviewslice *dst_slice
42625  *         cdef __Pyx_memviewslice tmp_slice
42626  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)             # <<<<<<<<<<<<<<
42627  *
42628  *         if <size_t>self.view.itemsize > sizeof(array):
42629  */
42630   __pyx_v_dst_slice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice));
42631 
42632   /* "View.MemoryView":454
42633  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
42634  *
42635  *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
42636  *             tmp = PyMem_Malloc(self.view.itemsize)
42637  *             if tmp == NULL:
42638  */
42639   __pyx_t_1 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
42640   if (__pyx_t_1) {
42641 
42642     /* "View.MemoryView":455
42643  *
42644  *         if <size_t>self.view.itemsize > sizeof(array):
42645  *             tmp = PyMem_Malloc(self.view.itemsize)             # <<<<<<<<<<<<<<
42646  *             if tmp == NULL:
42647  *                 raise MemoryError
42648  */
42649     __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
42650 
42651     /* "View.MemoryView":456
42652  *         if <size_t>self.view.itemsize > sizeof(array):
42653  *             tmp = PyMem_Malloc(self.view.itemsize)
42654  *             if tmp == NULL:             # <<<<<<<<<<<<<<
42655  *                 raise MemoryError
42656  *             item = tmp
42657  */
42658     __pyx_t_1 = ((__pyx_v_tmp == NULL) != 0);
42659     if (unlikely(__pyx_t_1)) {
42660 
42661       /* "View.MemoryView":457
42662  *             tmp = PyMem_Malloc(self.view.itemsize)
42663  *             if tmp == NULL:
42664  *                 raise MemoryError             # <<<<<<<<<<<<<<
42665  *             item = tmp
42666  *         else:
42667  */
42668       PyErr_NoMemory(); __PYX_ERR(4, 457, __pyx_L1_error)
42669 
42670       /* "View.MemoryView":456
42671  *         if <size_t>self.view.itemsize > sizeof(array):
42672  *             tmp = PyMem_Malloc(self.view.itemsize)
42673  *             if tmp == NULL:             # <<<<<<<<<<<<<<
42674  *                 raise MemoryError
42675  *             item = tmp
42676  */
42677     }
42678 
42679     /* "View.MemoryView":458
42680  *             if tmp == NULL:
42681  *                 raise MemoryError
42682  *             item = tmp             # <<<<<<<<<<<<<<
42683  *         else:
42684  *             item = <void *> array
42685  */
42686     __pyx_v_item = __pyx_v_tmp;
42687 
42688     /* "View.MemoryView":454
42689  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
42690  *
42691  *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
42692  *             tmp = PyMem_Malloc(self.view.itemsize)
42693  *             if tmp == NULL:
42694  */
42695     goto __pyx_L3;
42696   }
42697 
42698   /* "View.MemoryView":460
42699  *             item = tmp
42700  *         else:
42701  *             item = <void *> array             # <<<<<<<<<<<<<<
42702  *
42703  *         try:
42704  */
42705   /*else*/ {
42706     __pyx_v_item = ((void *)__pyx_v_array);
42707   }
42708   __pyx_L3:;
42709 
42710   /* "View.MemoryView":462
42711  *             item = <void *> array
42712  *
42713  *         try:             # <<<<<<<<<<<<<<
42714  *             if self.dtype_is_object:
42715  *                 (<PyObject **> item)[0] = <PyObject *> value
42716  */
42717   /*try:*/ {
42718 
42719     /* "View.MemoryView":463
42720  *
42721  *         try:
42722  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
42723  *                 (<PyObject **> item)[0] = <PyObject *> value
42724  *             else:
42725  */
42726     __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
42727     if (__pyx_t_1) {
42728 
42729       /* "View.MemoryView":464
42730  *         try:
42731  *             if self.dtype_is_object:
42732  *                 (<PyObject **> item)[0] = <PyObject *> value             # <<<<<<<<<<<<<<
42733  *             else:
42734  *                 self.assign_item_from_object(<char *> item, value)
42735  */
42736       (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
42737 
42738       /* "View.MemoryView":463
42739  *
42740  *         try:
42741  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
42742  *                 (<PyObject **> item)[0] = <PyObject *> value
42743  *             else:
42744  */
42745       goto __pyx_L8;
42746     }
42747 
42748     /* "View.MemoryView":466
42749  *                 (<PyObject **> item)[0] = <PyObject *> value
42750  *             else:
42751  *                 self.assign_item_from_object(<char *> item, value)             # <<<<<<<<<<<<<<
42752  *
42753  *
42754  */
42755     /*else*/ {
42756       __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(4, 466, __pyx_L6_error)
42757       __Pyx_GOTREF(__pyx_t_2);
42758       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
42759     }
42760     __pyx_L8:;
42761 
42762     /* "View.MemoryView":470
42763  *
42764  *
42765  *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
42766  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
42767  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
42768  */
42769     __pyx_t_1 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
42770     if (__pyx_t_1) {
42771 
42772       /* "View.MemoryView":471
42773  *
42774  *             if self.view.suboffsets != NULL:
42775  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)             # <<<<<<<<<<<<<<
42776  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
42777  *                                 item, self.dtype_is_object)
42778  */
42779       __pyx_t_2 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 471, __pyx_L6_error)
42780       __Pyx_GOTREF(__pyx_t_2);
42781       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
42782 
42783       /* "View.MemoryView":470
42784  *
42785  *
42786  *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
42787  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
42788  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
42789  */
42790     }
42791 
42792     /* "View.MemoryView":472
42793  *             if self.view.suboffsets != NULL:
42794  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
42795  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,             # <<<<<<<<<<<<<<
42796  *                                 item, self.dtype_is_object)
42797  *         finally:
42798  */
42799     __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);
42800   }
42801 
42802   /* "View.MemoryView":475
42803  *                                 item, self.dtype_is_object)
42804  *         finally:
42805  *             PyMem_Free(tmp)             # <<<<<<<<<<<<<<
42806  *
42807  *     cdef setitem_indexed(self, index, value):
42808  */
42809   /*finally:*/ {
42810     /*normal exit:*/{
42811       PyMem_Free(__pyx_v_tmp);
42812       goto __pyx_L7;
42813     }
42814     __pyx_L6_error:;
42815     /*exception exit:*/{
42816       __Pyx_PyThreadState_declare
42817       __Pyx_PyThreadState_assign
42818       __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
42819       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
42820       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
42821       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);
42822       __Pyx_XGOTREF(__pyx_t_6);
42823       __Pyx_XGOTREF(__pyx_t_7);
42824       __Pyx_XGOTREF(__pyx_t_8);
42825       __Pyx_XGOTREF(__pyx_t_9);
42826       __Pyx_XGOTREF(__pyx_t_10);
42827       __Pyx_XGOTREF(__pyx_t_11);
42828       __pyx_t_3 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename;
42829       {
42830         PyMem_Free(__pyx_v_tmp);
42831       }
42832       if (PY_MAJOR_VERSION >= 3) {
42833         __Pyx_XGIVEREF(__pyx_t_9);
42834         __Pyx_XGIVEREF(__pyx_t_10);
42835         __Pyx_XGIVEREF(__pyx_t_11);
42836         __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
42837       }
42838       __Pyx_XGIVEREF(__pyx_t_6);
42839       __Pyx_XGIVEREF(__pyx_t_7);
42840       __Pyx_XGIVEREF(__pyx_t_8);
42841       __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
42842       __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
42843       __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5;
42844       goto __pyx_L1_error;
42845     }
42846     __pyx_L7:;
42847   }
42848 
42849   /* "View.MemoryView":445
42850  *                                  src.ndim, dst.ndim, self.dtype_is_object)
42851  *
42852  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
42853  *         cdef int array[128]
42854  *         cdef void *tmp = NULL
42855  */
42856 
42857   /* function exit code */
42858   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
42859   goto __pyx_L0;
42860   __pyx_L1_error:;
42861   __Pyx_XDECREF(__pyx_t_2);
42862   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
42863   __pyx_r = 0;
42864   __pyx_L0:;
42865   __Pyx_XGIVEREF(__pyx_r);
42866   __Pyx_RefNannyFinishContext();
42867   return __pyx_r;
42868 }
42869 
42870 /* "View.MemoryView":477
42871  *             PyMem_Free(tmp)
42872  *
42873  *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
42874  *         cdef char *itemp = self.get_item_pointer(index)
42875  *         self.assign_item_from_object(itemp, value)
42876  */
42877 
__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index,PyObject * __pyx_v_value)42878 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
42879   char *__pyx_v_itemp;
42880   PyObject *__pyx_r = NULL;
42881   __Pyx_RefNannyDeclarations
42882   char *__pyx_t_1;
42883   PyObject *__pyx_t_2 = NULL;
42884   __Pyx_RefNannySetupContext("setitem_indexed", 0);
42885 
42886   /* "View.MemoryView":478
42887  *
42888  *     cdef setitem_indexed(self, index, value):
42889  *         cdef char *itemp = self.get_item_pointer(index)             # <<<<<<<<<<<<<<
42890  *         self.assign_item_from_object(itemp, value)
42891  *
42892  */
42893   __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(4, 478, __pyx_L1_error)
42894   __pyx_v_itemp = __pyx_t_1;
42895 
42896   /* "View.MemoryView":479
42897  *     cdef setitem_indexed(self, index, value):
42898  *         cdef char *itemp = self.get_item_pointer(index)
42899  *         self.assign_item_from_object(itemp, value)             # <<<<<<<<<<<<<<
42900  *
42901  *     cdef convert_item_to_object(self, char *itemp):
42902  */
42903   __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(4, 479, __pyx_L1_error)
42904   __Pyx_GOTREF(__pyx_t_2);
42905   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
42906 
42907   /* "View.MemoryView":477
42908  *             PyMem_Free(tmp)
42909  *
42910  *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
42911  *         cdef char *itemp = self.get_item_pointer(index)
42912  *         self.assign_item_from_object(itemp, value)
42913  */
42914 
42915   /* function exit code */
42916   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
42917   goto __pyx_L0;
42918   __pyx_L1_error:;
42919   __Pyx_XDECREF(__pyx_t_2);
42920   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
42921   __pyx_r = 0;
42922   __pyx_L0:;
42923   __Pyx_XGIVEREF(__pyx_r);
42924   __Pyx_RefNannyFinishContext();
42925   return __pyx_r;
42926 }
42927 
42928 /* "View.MemoryView":481
42929  *         self.assign_item_from_object(itemp, value)
42930  *
42931  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
42932  *         """Only used if instantiated manually by the user, or if Cython doesn't
42933  *         know how to convert the type"""
42934  */
42935 
__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj * __pyx_v_self,char * __pyx_v_itemp)42936 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
42937   PyObject *__pyx_v_struct = NULL;
42938   PyObject *__pyx_v_bytesitem = 0;
42939   PyObject *__pyx_v_result = NULL;
42940   PyObject *__pyx_r = NULL;
42941   __Pyx_RefNannyDeclarations
42942   PyObject *__pyx_t_1 = NULL;
42943   PyObject *__pyx_t_2 = NULL;
42944   PyObject *__pyx_t_3 = NULL;
42945   PyObject *__pyx_t_4 = NULL;
42946   PyObject *__pyx_t_5 = NULL;
42947   PyObject *__pyx_t_6 = NULL;
42948   PyObject *__pyx_t_7 = NULL;
42949   int __pyx_t_8;
42950   PyObject *__pyx_t_9 = NULL;
42951   size_t __pyx_t_10;
42952   int __pyx_t_11;
42953   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
42954 
42955   /* "View.MemoryView":484
42956  *         """Only used if instantiated manually by the user, or if Cython doesn't
42957  *         know how to convert the type"""
42958  *         import struct             # <<<<<<<<<<<<<<
42959  *         cdef bytes bytesitem
42960  *
42961  */
42962   __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 484, __pyx_L1_error)
42963   __Pyx_GOTREF(__pyx_t_1);
42964   __pyx_v_struct = __pyx_t_1;
42965   __pyx_t_1 = 0;
42966 
42967   /* "View.MemoryView":487
42968  *         cdef bytes bytesitem
42969  *
42970  *         bytesitem = itemp[:self.view.itemsize]             # <<<<<<<<<<<<<<
42971  *         try:
42972  *             result = struct.unpack(self.view.format, bytesitem)
42973  */
42974   __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 487, __pyx_L1_error)
42975   __Pyx_GOTREF(__pyx_t_1);
42976   __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
42977   __pyx_t_1 = 0;
42978 
42979   /* "View.MemoryView":488
42980  *
42981  *         bytesitem = itemp[:self.view.itemsize]
42982  *         try:             # <<<<<<<<<<<<<<
42983  *             result = struct.unpack(self.view.format, bytesitem)
42984  *         except struct.error:
42985  */
42986   {
42987     __Pyx_PyThreadState_declare
42988     __Pyx_PyThreadState_assign
42989     __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
42990     __Pyx_XGOTREF(__pyx_t_2);
42991     __Pyx_XGOTREF(__pyx_t_3);
42992     __Pyx_XGOTREF(__pyx_t_4);
42993     /*try:*/ {
42994 
42995       /* "View.MemoryView":489
42996  *         bytesitem = itemp[:self.view.itemsize]
42997  *         try:
42998  *             result = struct.unpack(self.view.format, bytesitem)             # <<<<<<<<<<<<<<
42999  *         except struct.error:
43000  *             raise ValueError("Unable to convert item to object")
43001  */
43002       __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 489, __pyx_L3_error)
43003       __Pyx_GOTREF(__pyx_t_5);
43004       __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 489, __pyx_L3_error)
43005       __Pyx_GOTREF(__pyx_t_6);
43006       __pyx_t_7 = NULL;
43007       __pyx_t_8 = 0;
43008       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
43009         __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
43010         if (likely(__pyx_t_7)) {
43011           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
43012           __Pyx_INCREF(__pyx_t_7);
43013           __Pyx_INCREF(function);
43014           __Pyx_DECREF_SET(__pyx_t_5, function);
43015           __pyx_t_8 = 1;
43016         }
43017       }
43018       #if CYTHON_FAST_PYCALL
43019       if (PyFunction_Check(__pyx_t_5)) {
43020         PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
43021         __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(4, 489, __pyx_L3_error)
43022         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
43023         __Pyx_GOTREF(__pyx_t_1);
43024         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
43025       } else
43026       #endif
43027       #if CYTHON_FAST_PYCCALL
43028       if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
43029         PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
43030         __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(4, 489, __pyx_L3_error)
43031         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
43032         __Pyx_GOTREF(__pyx_t_1);
43033         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
43034       } else
43035       #endif
43036       {
43037         __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 489, __pyx_L3_error)
43038         __Pyx_GOTREF(__pyx_t_9);
43039         if (__pyx_t_7) {
43040           __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
43041         }
43042         __Pyx_GIVEREF(__pyx_t_6);
43043         PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
43044         __Pyx_INCREF(__pyx_v_bytesitem);
43045         __Pyx_GIVEREF(__pyx_v_bytesitem);
43046         PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
43047         __pyx_t_6 = 0;
43048         __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 489, __pyx_L3_error)
43049         __Pyx_GOTREF(__pyx_t_1);
43050         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
43051       }
43052       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
43053       __pyx_v_result = __pyx_t_1;
43054       __pyx_t_1 = 0;
43055 
43056       /* "View.MemoryView":488
43057  *
43058  *         bytesitem = itemp[:self.view.itemsize]
43059  *         try:             # <<<<<<<<<<<<<<
43060  *             result = struct.unpack(self.view.format, bytesitem)
43061  *         except struct.error:
43062  */
43063     }
43064 
43065     /* "View.MemoryView":493
43066  *             raise ValueError("Unable to convert item to object")
43067  *         else:
43068  *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
43069  *                 return result[0]
43070  *             return result
43071  */
43072     /*else:*/ {
43073       __pyx_t_10 = strlen(__pyx_v_self->view.format);
43074       __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
43075       if (__pyx_t_11) {
43076 
43077         /* "View.MemoryView":494
43078  *         else:
43079  *             if len(self.view.format) == 1:
43080  *                 return result[0]             # <<<<<<<<<<<<<<
43081  *             return result
43082  *
43083  */
43084         __Pyx_XDECREF(__pyx_r);
43085         __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(4, 494, __pyx_L5_except_error)
43086         __Pyx_GOTREF(__pyx_t_1);
43087         __pyx_r = __pyx_t_1;
43088         __pyx_t_1 = 0;
43089         goto __pyx_L6_except_return;
43090 
43091         /* "View.MemoryView":493
43092  *             raise ValueError("Unable to convert item to object")
43093  *         else:
43094  *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
43095  *                 return result[0]
43096  *             return result
43097  */
43098       }
43099 
43100       /* "View.MemoryView":495
43101  *             if len(self.view.format) == 1:
43102  *                 return result[0]
43103  *             return result             # <<<<<<<<<<<<<<
43104  *
43105  *     cdef assign_item_from_object(self, char *itemp, object value):
43106  */
43107       __Pyx_XDECREF(__pyx_r);
43108       __Pyx_INCREF(__pyx_v_result);
43109       __pyx_r = __pyx_v_result;
43110       goto __pyx_L6_except_return;
43111     }
43112     __pyx_L3_error:;
43113     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
43114     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
43115     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
43116     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
43117     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
43118 
43119     /* "View.MemoryView":490
43120  *         try:
43121  *             result = struct.unpack(self.view.format, bytesitem)
43122  *         except struct.error:             # <<<<<<<<<<<<<<
43123  *             raise ValueError("Unable to convert item to object")
43124  *         else:
43125  */
43126     __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
43127     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 490, __pyx_L5_except_error)
43128     __Pyx_GOTREF(__pyx_t_6);
43129     __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
43130     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
43131     __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
43132     __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
43133     if (__pyx_t_8) {
43134       __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
43135       if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(4, 490, __pyx_L5_except_error)
43136       __Pyx_GOTREF(__pyx_t_9);
43137       __Pyx_GOTREF(__pyx_t_5);
43138       __Pyx_GOTREF(__pyx_t_1);
43139 
43140       /* "View.MemoryView":491
43141  *             result = struct.unpack(self.view.format, bytesitem)
43142  *         except struct.error:
43143  *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
43144  *         else:
43145  *             if len(self.view.format) == 1:
43146  */
43147       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 491, __pyx_L5_except_error)
43148       __Pyx_GOTREF(__pyx_t_6);
43149       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
43150       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
43151       __PYX_ERR(4, 491, __pyx_L5_except_error)
43152     }
43153     goto __pyx_L5_except_error;
43154     __pyx_L5_except_error:;
43155 
43156     /* "View.MemoryView":488
43157  *
43158  *         bytesitem = itemp[:self.view.itemsize]
43159  *         try:             # <<<<<<<<<<<<<<
43160  *             result = struct.unpack(self.view.format, bytesitem)
43161  *         except struct.error:
43162  */
43163     __Pyx_XGIVEREF(__pyx_t_2);
43164     __Pyx_XGIVEREF(__pyx_t_3);
43165     __Pyx_XGIVEREF(__pyx_t_4);
43166     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
43167     goto __pyx_L1_error;
43168     __pyx_L6_except_return:;
43169     __Pyx_XGIVEREF(__pyx_t_2);
43170     __Pyx_XGIVEREF(__pyx_t_3);
43171     __Pyx_XGIVEREF(__pyx_t_4);
43172     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
43173     goto __pyx_L0;
43174   }
43175 
43176   /* "View.MemoryView":481
43177  *         self.assign_item_from_object(itemp, value)
43178  *
43179  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
43180  *         """Only used if instantiated manually by the user, or if Cython doesn't
43181  *         know how to convert the type"""
43182  */
43183 
43184   /* function exit code */
43185   __pyx_L1_error:;
43186   __Pyx_XDECREF(__pyx_t_1);
43187   __Pyx_XDECREF(__pyx_t_5);
43188   __Pyx_XDECREF(__pyx_t_6);
43189   __Pyx_XDECREF(__pyx_t_7);
43190   __Pyx_XDECREF(__pyx_t_9);
43191   __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
43192   __pyx_r = 0;
43193   __pyx_L0:;
43194   __Pyx_XDECREF(__pyx_v_struct);
43195   __Pyx_XDECREF(__pyx_v_bytesitem);
43196   __Pyx_XDECREF(__pyx_v_result);
43197   __Pyx_XGIVEREF(__pyx_r);
43198   __Pyx_RefNannyFinishContext();
43199   return __pyx_r;
43200 }
43201 
43202 /* "View.MemoryView":497
43203  *             return result
43204  *
43205  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
43206  *         """Only used if instantiated manually by the user, or if Cython doesn't
43207  *         know how to convert the type"""
43208  */
43209 
__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj * __pyx_v_self,char * __pyx_v_itemp,PyObject * __pyx_v_value)43210 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
43211   PyObject *__pyx_v_struct = NULL;
43212   char __pyx_v_c;
43213   PyObject *__pyx_v_bytesvalue = 0;
43214   Py_ssize_t __pyx_v_i;
43215   PyObject *__pyx_r = NULL;
43216   __Pyx_RefNannyDeclarations
43217   PyObject *__pyx_t_1 = NULL;
43218   int __pyx_t_2;
43219   int __pyx_t_3;
43220   PyObject *__pyx_t_4 = NULL;
43221   PyObject *__pyx_t_5 = NULL;
43222   PyObject *__pyx_t_6 = NULL;
43223   int __pyx_t_7;
43224   PyObject *__pyx_t_8 = NULL;
43225   Py_ssize_t __pyx_t_9;
43226   PyObject *__pyx_t_10 = NULL;
43227   char *__pyx_t_11;
43228   char *__pyx_t_12;
43229   char *__pyx_t_13;
43230   char *__pyx_t_14;
43231   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
43232 
43233   /* "View.MemoryView":500
43234  *         """Only used if instantiated manually by the user, or if Cython doesn't
43235  *         know how to convert the type"""
43236  *         import struct             # <<<<<<<<<<<<<<
43237  *         cdef char c
43238  *         cdef bytes bytesvalue
43239  */
43240   __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 500, __pyx_L1_error)
43241   __Pyx_GOTREF(__pyx_t_1);
43242   __pyx_v_struct = __pyx_t_1;
43243   __pyx_t_1 = 0;
43244 
43245   /* "View.MemoryView":505
43246  *         cdef Py_ssize_t i
43247  *
43248  *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
43249  *             bytesvalue = struct.pack(self.view.format, *value)
43250  *         else:
43251  */
43252   __pyx_t_2 = PyTuple_Check(__pyx_v_value);
43253   __pyx_t_3 = (__pyx_t_2 != 0);
43254   if (__pyx_t_3) {
43255 
43256     /* "View.MemoryView":506
43257  *
43258  *         if isinstance(value, tuple):
43259  *             bytesvalue = struct.pack(self.view.format, *value)             # <<<<<<<<<<<<<<
43260  *         else:
43261  *             bytesvalue = struct.pack(self.view.format, value)
43262  */
43263     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 506, __pyx_L1_error)
43264     __Pyx_GOTREF(__pyx_t_1);
43265     __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 506, __pyx_L1_error)
43266     __Pyx_GOTREF(__pyx_t_4);
43267     __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 506, __pyx_L1_error)
43268     __Pyx_GOTREF(__pyx_t_5);
43269     __Pyx_GIVEREF(__pyx_t_4);
43270     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
43271     __pyx_t_4 = 0;
43272     __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 506, __pyx_L1_error)
43273     __Pyx_GOTREF(__pyx_t_4);
43274     __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 506, __pyx_L1_error)
43275     __Pyx_GOTREF(__pyx_t_6);
43276     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
43277     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
43278     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 506, __pyx_L1_error)
43279     __Pyx_GOTREF(__pyx_t_4);
43280     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43281     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
43282     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(4, 506, __pyx_L1_error)
43283     __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
43284     __pyx_t_4 = 0;
43285 
43286     /* "View.MemoryView":505
43287  *         cdef Py_ssize_t i
43288  *
43289  *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
43290  *             bytesvalue = struct.pack(self.view.format, *value)
43291  *         else:
43292  */
43293     goto __pyx_L3;
43294   }
43295 
43296   /* "View.MemoryView":508
43297  *             bytesvalue = struct.pack(self.view.format, *value)
43298  *         else:
43299  *             bytesvalue = struct.pack(self.view.format, value)             # <<<<<<<<<<<<<<
43300  *
43301  *         for i, c in enumerate(bytesvalue):
43302  */
43303   /*else*/ {
43304     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 508, __pyx_L1_error)
43305     __Pyx_GOTREF(__pyx_t_6);
43306     __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 508, __pyx_L1_error)
43307     __Pyx_GOTREF(__pyx_t_1);
43308     __pyx_t_5 = NULL;
43309     __pyx_t_7 = 0;
43310     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
43311       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
43312       if (likely(__pyx_t_5)) {
43313         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
43314         __Pyx_INCREF(__pyx_t_5);
43315         __Pyx_INCREF(function);
43316         __Pyx_DECREF_SET(__pyx_t_6, function);
43317         __pyx_t_7 = 1;
43318       }
43319     }
43320     #if CYTHON_FAST_PYCALL
43321     if (PyFunction_Check(__pyx_t_6)) {
43322       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
43323       __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(4, 508, __pyx_L1_error)
43324       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
43325       __Pyx_GOTREF(__pyx_t_4);
43326       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43327     } else
43328     #endif
43329     #if CYTHON_FAST_PYCCALL
43330     if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
43331       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
43332       __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(4, 508, __pyx_L1_error)
43333       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
43334       __Pyx_GOTREF(__pyx_t_4);
43335       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43336     } else
43337     #endif
43338     {
43339       __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 508, __pyx_L1_error)
43340       __Pyx_GOTREF(__pyx_t_8);
43341       if (__pyx_t_5) {
43342         __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
43343       }
43344       __Pyx_GIVEREF(__pyx_t_1);
43345       PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
43346       __Pyx_INCREF(__pyx_v_value);
43347       __Pyx_GIVEREF(__pyx_v_value);
43348       PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
43349       __pyx_t_1 = 0;
43350       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 508, __pyx_L1_error)
43351       __Pyx_GOTREF(__pyx_t_4);
43352       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
43353     }
43354     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
43355     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(4, 508, __pyx_L1_error)
43356     __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
43357     __pyx_t_4 = 0;
43358   }
43359   __pyx_L3:;
43360 
43361   /* "View.MemoryView":510
43362  *             bytesvalue = struct.pack(self.view.format, value)
43363  *
43364  *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
43365  *             itemp[i] = c
43366  *
43367  */
43368   __pyx_t_9 = 0;
43369   if (unlikely(__pyx_v_bytesvalue == Py_None)) {
43370     PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
43371     __PYX_ERR(4, 510, __pyx_L1_error)
43372   }
43373   __Pyx_INCREF(__pyx_v_bytesvalue);
43374   __pyx_t_10 = __pyx_v_bytesvalue;
43375   __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
43376   __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
43377   for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
43378     __pyx_t_11 = __pyx_t_14;
43379     __pyx_v_c = (__pyx_t_11[0]);
43380 
43381     /* "View.MemoryView":511
43382  *
43383  *         for i, c in enumerate(bytesvalue):
43384  *             itemp[i] = c             # <<<<<<<<<<<<<<
43385  *
43386  *     @cname('getbuffer')
43387  */
43388     __pyx_v_i = __pyx_t_9;
43389 
43390     /* "View.MemoryView":510
43391  *             bytesvalue = struct.pack(self.view.format, value)
43392  *
43393  *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
43394  *             itemp[i] = c
43395  *
43396  */
43397     __pyx_t_9 = (__pyx_t_9 + 1);
43398 
43399     /* "View.MemoryView":511
43400  *
43401  *         for i, c in enumerate(bytesvalue):
43402  *             itemp[i] = c             # <<<<<<<<<<<<<<
43403  *
43404  *     @cname('getbuffer')
43405  */
43406     (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
43407   }
43408   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
43409 
43410   /* "View.MemoryView":497
43411  *             return result
43412  *
43413  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
43414  *         """Only used if instantiated manually by the user, or if Cython doesn't
43415  *         know how to convert the type"""
43416  */
43417 
43418   /* function exit code */
43419   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
43420   goto __pyx_L0;
43421   __pyx_L1_error:;
43422   __Pyx_XDECREF(__pyx_t_1);
43423   __Pyx_XDECREF(__pyx_t_4);
43424   __Pyx_XDECREF(__pyx_t_5);
43425   __Pyx_XDECREF(__pyx_t_6);
43426   __Pyx_XDECREF(__pyx_t_8);
43427   __Pyx_XDECREF(__pyx_t_10);
43428   __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
43429   __pyx_r = 0;
43430   __pyx_L0:;
43431   __Pyx_XDECREF(__pyx_v_struct);
43432   __Pyx_XDECREF(__pyx_v_bytesvalue);
43433   __Pyx_XGIVEREF(__pyx_r);
43434   __Pyx_RefNannyFinishContext();
43435   return __pyx_r;
43436 }
43437 
43438 /* "View.MemoryView":514
43439  *
43440  *     @cname('getbuffer')
43441  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
43442  *         if flags & PyBUF_WRITABLE and self.view.readonly:
43443  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
43444  */
43445 
43446 /* Python wrapper */
43447 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
__pyx_memoryview_getbuffer(PyObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)43448 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
43449   int __pyx_r;
43450   __Pyx_RefNannyDeclarations
43451   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
43452   __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));
43453 
43454   /* function exit code */
43455   __Pyx_RefNannyFinishContext();
43456   return __pyx_r;
43457 }
43458 
__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)43459 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) {
43460   int __pyx_r;
43461   __Pyx_RefNannyDeclarations
43462   int __pyx_t_1;
43463   int __pyx_t_2;
43464   PyObject *__pyx_t_3 = NULL;
43465   Py_ssize_t *__pyx_t_4;
43466   char *__pyx_t_5;
43467   void *__pyx_t_6;
43468   int __pyx_t_7;
43469   Py_ssize_t __pyx_t_8;
43470   if (__pyx_v_info == NULL) {
43471     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
43472     return -1;
43473   }
43474   __Pyx_RefNannySetupContext("__getbuffer__", 0);
43475   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
43476   __Pyx_GIVEREF(__pyx_v_info->obj);
43477 
43478   /* "View.MemoryView":515
43479  *     @cname('getbuffer')
43480  *     def __getbuffer__(self, Py_buffer *info, int flags):
43481  *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
43482  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
43483  *
43484  */
43485   __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
43486   if (__pyx_t_2) {
43487   } else {
43488     __pyx_t_1 = __pyx_t_2;
43489     goto __pyx_L4_bool_binop_done;
43490   }
43491   __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
43492   __pyx_t_1 = __pyx_t_2;
43493   __pyx_L4_bool_binop_done:;
43494   if (unlikely(__pyx_t_1)) {
43495 
43496     /* "View.MemoryView":516
43497  *     def __getbuffer__(self, Py_buffer *info, int flags):
43498  *         if flags & PyBUF_WRITABLE and self.view.readonly:
43499  *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
43500  *
43501  *         if flags & PyBUF_ND:
43502  */
43503     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 516, __pyx_L1_error)
43504     __Pyx_GOTREF(__pyx_t_3);
43505     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
43506     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
43507     __PYX_ERR(4, 516, __pyx_L1_error)
43508 
43509     /* "View.MemoryView":515
43510  *     @cname('getbuffer')
43511  *     def __getbuffer__(self, Py_buffer *info, int flags):
43512  *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
43513  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
43514  *
43515  */
43516   }
43517 
43518   /* "View.MemoryView":518
43519  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
43520  *
43521  *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
43522  *             info.shape = self.view.shape
43523  *         else:
43524  */
43525   __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
43526   if (__pyx_t_1) {
43527 
43528     /* "View.MemoryView":519
43529  *
43530  *         if flags & PyBUF_ND:
43531  *             info.shape = self.view.shape             # <<<<<<<<<<<<<<
43532  *         else:
43533  *             info.shape = NULL
43534  */
43535     __pyx_t_4 = __pyx_v_self->view.shape;
43536     __pyx_v_info->shape = __pyx_t_4;
43537 
43538     /* "View.MemoryView":518
43539  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
43540  *
43541  *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
43542  *             info.shape = self.view.shape
43543  *         else:
43544  */
43545     goto __pyx_L6;
43546   }
43547 
43548   /* "View.MemoryView":521
43549  *             info.shape = self.view.shape
43550  *         else:
43551  *             info.shape = NULL             # <<<<<<<<<<<<<<
43552  *
43553  *         if flags & PyBUF_STRIDES:
43554  */
43555   /*else*/ {
43556     __pyx_v_info->shape = NULL;
43557   }
43558   __pyx_L6:;
43559 
43560   /* "View.MemoryView":523
43561  *             info.shape = NULL
43562  *
43563  *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
43564  *             info.strides = self.view.strides
43565  *         else:
43566  */
43567   __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
43568   if (__pyx_t_1) {
43569 
43570     /* "View.MemoryView":524
43571  *
43572  *         if flags & PyBUF_STRIDES:
43573  *             info.strides = self.view.strides             # <<<<<<<<<<<<<<
43574  *         else:
43575  *             info.strides = NULL
43576  */
43577     __pyx_t_4 = __pyx_v_self->view.strides;
43578     __pyx_v_info->strides = __pyx_t_4;
43579 
43580     /* "View.MemoryView":523
43581  *             info.shape = NULL
43582  *
43583  *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
43584  *             info.strides = self.view.strides
43585  *         else:
43586  */
43587     goto __pyx_L7;
43588   }
43589 
43590   /* "View.MemoryView":526
43591  *             info.strides = self.view.strides
43592  *         else:
43593  *             info.strides = NULL             # <<<<<<<<<<<<<<
43594  *
43595  *         if flags & PyBUF_INDIRECT:
43596  */
43597   /*else*/ {
43598     __pyx_v_info->strides = NULL;
43599   }
43600   __pyx_L7:;
43601 
43602   /* "View.MemoryView":528
43603  *             info.strides = NULL
43604  *
43605  *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
43606  *             info.suboffsets = self.view.suboffsets
43607  *         else:
43608  */
43609   __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
43610   if (__pyx_t_1) {
43611 
43612     /* "View.MemoryView":529
43613  *
43614  *         if flags & PyBUF_INDIRECT:
43615  *             info.suboffsets = self.view.suboffsets             # <<<<<<<<<<<<<<
43616  *         else:
43617  *             info.suboffsets = NULL
43618  */
43619     __pyx_t_4 = __pyx_v_self->view.suboffsets;
43620     __pyx_v_info->suboffsets = __pyx_t_4;
43621 
43622     /* "View.MemoryView":528
43623  *             info.strides = NULL
43624  *
43625  *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
43626  *             info.suboffsets = self.view.suboffsets
43627  *         else:
43628  */
43629     goto __pyx_L8;
43630   }
43631 
43632   /* "View.MemoryView":531
43633  *             info.suboffsets = self.view.suboffsets
43634  *         else:
43635  *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
43636  *
43637  *         if flags & PyBUF_FORMAT:
43638  */
43639   /*else*/ {
43640     __pyx_v_info->suboffsets = NULL;
43641   }
43642   __pyx_L8:;
43643 
43644   /* "View.MemoryView":533
43645  *             info.suboffsets = NULL
43646  *
43647  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
43648  *             info.format = self.view.format
43649  *         else:
43650  */
43651   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
43652   if (__pyx_t_1) {
43653 
43654     /* "View.MemoryView":534
43655  *
43656  *         if flags & PyBUF_FORMAT:
43657  *             info.format = self.view.format             # <<<<<<<<<<<<<<
43658  *         else:
43659  *             info.format = NULL
43660  */
43661     __pyx_t_5 = __pyx_v_self->view.format;
43662     __pyx_v_info->format = __pyx_t_5;
43663 
43664     /* "View.MemoryView":533
43665  *             info.suboffsets = NULL
43666  *
43667  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
43668  *             info.format = self.view.format
43669  *         else:
43670  */
43671     goto __pyx_L9;
43672   }
43673 
43674   /* "View.MemoryView":536
43675  *             info.format = self.view.format
43676  *         else:
43677  *             info.format = NULL             # <<<<<<<<<<<<<<
43678  *
43679  *         info.buf = self.view.buf
43680  */
43681   /*else*/ {
43682     __pyx_v_info->format = NULL;
43683   }
43684   __pyx_L9:;
43685 
43686   /* "View.MemoryView":538
43687  *             info.format = NULL
43688  *
43689  *         info.buf = self.view.buf             # <<<<<<<<<<<<<<
43690  *         info.ndim = self.view.ndim
43691  *         info.itemsize = self.view.itemsize
43692  */
43693   __pyx_t_6 = __pyx_v_self->view.buf;
43694   __pyx_v_info->buf = __pyx_t_6;
43695 
43696   /* "View.MemoryView":539
43697  *
43698  *         info.buf = self.view.buf
43699  *         info.ndim = self.view.ndim             # <<<<<<<<<<<<<<
43700  *         info.itemsize = self.view.itemsize
43701  *         info.len = self.view.len
43702  */
43703   __pyx_t_7 = __pyx_v_self->view.ndim;
43704   __pyx_v_info->ndim = __pyx_t_7;
43705 
43706   /* "View.MemoryView":540
43707  *         info.buf = self.view.buf
43708  *         info.ndim = self.view.ndim
43709  *         info.itemsize = self.view.itemsize             # <<<<<<<<<<<<<<
43710  *         info.len = self.view.len
43711  *         info.readonly = self.view.readonly
43712  */
43713   __pyx_t_8 = __pyx_v_self->view.itemsize;
43714   __pyx_v_info->itemsize = __pyx_t_8;
43715 
43716   /* "View.MemoryView":541
43717  *         info.ndim = self.view.ndim
43718  *         info.itemsize = self.view.itemsize
43719  *         info.len = self.view.len             # <<<<<<<<<<<<<<
43720  *         info.readonly = self.view.readonly
43721  *         info.obj = self
43722  */
43723   __pyx_t_8 = __pyx_v_self->view.len;
43724   __pyx_v_info->len = __pyx_t_8;
43725 
43726   /* "View.MemoryView":542
43727  *         info.itemsize = self.view.itemsize
43728  *         info.len = self.view.len
43729  *         info.readonly = self.view.readonly             # <<<<<<<<<<<<<<
43730  *         info.obj = self
43731  *
43732  */
43733   __pyx_t_1 = __pyx_v_self->view.readonly;
43734   __pyx_v_info->readonly = __pyx_t_1;
43735 
43736   /* "View.MemoryView":543
43737  *         info.len = self.view.len
43738  *         info.readonly = self.view.readonly
43739  *         info.obj = self             # <<<<<<<<<<<<<<
43740  *
43741  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
43742  */
43743   __Pyx_INCREF(((PyObject *)__pyx_v_self));
43744   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
43745   __Pyx_GOTREF(__pyx_v_info->obj);
43746   __Pyx_DECREF(__pyx_v_info->obj);
43747   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
43748 
43749   /* "View.MemoryView":514
43750  *
43751  *     @cname('getbuffer')
43752  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
43753  *         if flags & PyBUF_WRITABLE and self.view.readonly:
43754  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
43755  */
43756 
43757   /* function exit code */
43758   __pyx_r = 0;
43759   goto __pyx_L0;
43760   __pyx_L1_error:;
43761   __Pyx_XDECREF(__pyx_t_3);
43762   __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
43763   __pyx_r = -1;
43764   if (__pyx_v_info->obj != NULL) {
43765     __Pyx_GOTREF(__pyx_v_info->obj);
43766     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
43767   }
43768   goto __pyx_L2;
43769   __pyx_L0:;
43770   if (__pyx_v_info->obj == Py_None) {
43771     __Pyx_GOTREF(__pyx_v_info->obj);
43772     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
43773   }
43774   __pyx_L2:;
43775   __Pyx_RefNannyFinishContext();
43776   return __pyx_r;
43777 }
43778 
43779 /* "View.MemoryView":549
43780  *
43781  *     @property
43782  *     def T(self):             # <<<<<<<<<<<<<<
43783  *         cdef _memoryviewslice result = memoryview_copy(self)
43784  *         transpose_memslice(&result.from_slice)
43785  */
43786 
43787 /* Python wrapper */
43788 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject * __pyx_v_self)43789 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
43790   PyObject *__pyx_r = 0;
43791   __Pyx_RefNannyDeclarations
43792   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
43793   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
43794 
43795   /* function exit code */
43796   __Pyx_RefNannyFinishContext();
43797   return __pyx_r;
43798 }
43799 
__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj * __pyx_v_self)43800 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
43801   struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
43802   PyObject *__pyx_r = NULL;
43803   __Pyx_RefNannyDeclarations
43804   PyObject *__pyx_t_1 = NULL;
43805   int __pyx_t_2;
43806   __Pyx_RefNannySetupContext("__get__", 0);
43807 
43808   /* "View.MemoryView":550
43809  *     @property
43810  *     def T(self):
43811  *         cdef _memoryviewslice result = memoryview_copy(self)             # <<<<<<<<<<<<<<
43812  *         transpose_memslice(&result.from_slice)
43813  *         return result
43814  */
43815   __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 550, __pyx_L1_error)
43816   __Pyx_GOTREF(__pyx_t_1);
43817   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(4, 550, __pyx_L1_error)
43818   __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
43819   __pyx_t_1 = 0;
43820 
43821   /* "View.MemoryView":551
43822  *     def T(self):
43823  *         cdef _memoryviewslice result = memoryview_copy(self)
43824  *         transpose_memslice(&result.from_slice)             # <<<<<<<<<<<<<<
43825  *         return result
43826  *
43827  */
43828   __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 551, __pyx_L1_error)
43829 
43830   /* "View.MemoryView":552
43831  *         cdef _memoryviewslice result = memoryview_copy(self)
43832  *         transpose_memslice(&result.from_slice)
43833  *         return result             # <<<<<<<<<<<<<<
43834  *
43835  *     @property
43836  */
43837   __Pyx_XDECREF(__pyx_r);
43838   __Pyx_INCREF(((PyObject *)__pyx_v_result));
43839   __pyx_r = ((PyObject *)__pyx_v_result);
43840   goto __pyx_L0;
43841 
43842   /* "View.MemoryView":549
43843  *
43844  *     @property
43845  *     def T(self):             # <<<<<<<<<<<<<<
43846  *         cdef _memoryviewslice result = memoryview_copy(self)
43847  *         transpose_memslice(&result.from_slice)
43848  */
43849 
43850   /* function exit code */
43851   __pyx_L1_error:;
43852   __Pyx_XDECREF(__pyx_t_1);
43853   __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
43854   __pyx_r = NULL;
43855   __pyx_L0:;
43856   __Pyx_XDECREF((PyObject *)__pyx_v_result);
43857   __Pyx_XGIVEREF(__pyx_r);
43858   __Pyx_RefNannyFinishContext();
43859   return __pyx_r;
43860 }
43861 
43862 /* "View.MemoryView":555
43863  *
43864  *     @property
43865  *     def base(self):             # <<<<<<<<<<<<<<
43866  *         return self.obj
43867  *
43868  */
43869 
43870 /* Python wrapper */
43871 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject * __pyx_v_self)43872 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
43873   PyObject *__pyx_r = 0;
43874   __Pyx_RefNannyDeclarations
43875   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
43876   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
43877 
43878   /* function exit code */
43879   __Pyx_RefNannyFinishContext();
43880   return __pyx_r;
43881 }
43882 
__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj * __pyx_v_self)43883 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
43884   PyObject *__pyx_r = NULL;
43885   __Pyx_RefNannyDeclarations
43886   __Pyx_RefNannySetupContext("__get__", 0);
43887 
43888   /* "View.MemoryView":556
43889  *     @property
43890  *     def base(self):
43891  *         return self.obj             # <<<<<<<<<<<<<<
43892  *
43893  *     @property
43894  */
43895   __Pyx_XDECREF(__pyx_r);
43896   __Pyx_INCREF(__pyx_v_self->obj);
43897   __pyx_r = __pyx_v_self->obj;
43898   goto __pyx_L0;
43899 
43900   /* "View.MemoryView":555
43901  *
43902  *     @property
43903  *     def base(self):             # <<<<<<<<<<<<<<
43904  *         return self.obj
43905  *
43906  */
43907 
43908   /* function exit code */
43909   __pyx_L0:;
43910   __Pyx_XGIVEREF(__pyx_r);
43911   __Pyx_RefNannyFinishContext();
43912   return __pyx_r;
43913 }
43914 
43915 /* "View.MemoryView":559
43916  *
43917  *     @property
43918  *     def shape(self):             # <<<<<<<<<<<<<<
43919  *         return tuple([length for length in self.view.shape[:self.view.ndim]])
43920  *
43921  */
43922 
43923 /* Python wrapper */
43924 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject * __pyx_v_self)43925 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
43926   PyObject *__pyx_r = 0;
43927   __Pyx_RefNannyDeclarations
43928   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
43929   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
43930 
43931   /* function exit code */
43932   __Pyx_RefNannyFinishContext();
43933   return __pyx_r;
43934 }
43935 
__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj * __pyx_v_self)43936 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
43937   Py_ssize_t __pyx_v_length;
43938   PyObject *__pyx_r = NULL;
43939   __Pyx_RefNannyDeclarations
43940   PyObject *__pyx_t_1 = NULL;
43941   Py_ssize_t *__pyx_t_2;
43942   Py_ssize_t *__pyx_t_3;
43943   Py_ssize_t *__pyx_t_4;
43944   PyObject *__pyx_t_5 = NULL;
43945   __Pyx_RefNannySetupContext("__get__", 0);
43946 
43947   /* "View.MemoryView":560
43948  *     @property
43949  *     def shape(self):
43950  *         return tuple([length for length in self.view.shape[:self.view.ndim]])             # <<<<<<<<<<<<<<
43951  *
43952  *     @property
43953  */
43954   __Pyx_XDECREF(__pyx_r);
43955   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 560, __pyx_L1_error)
43956   __Pyx_GOTREF(__pyx_t_1);
43957   __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
43958   for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
43959     __pyx_t_2 = __pyx_t_4;
43960     __pyx_v_length = (__pyx_t_2[0]);
43961     __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 560, __pyx_L1_error)
43962     __Pyx_GOTREF(__pyx_t_5);
43963     if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(4, 560, __pyx_L1_error)
43964     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
43965   }
43966   __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 560, __pyx_L1_error)
43967   __Pyx_GOTREF(__pyx_t_5);
43968   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
43969   __pyx_r = __pyx_t_5;
43970   __pyx_t_5 = 0;
43971   goto __pyx_L0;
43972 
43973   /* "View.MemoryView":559
43974  *
43975  *     @property
43976  *     def shape(self):             # <<<<<<<<<<<<<<
43977  *         return tuple([length for length in self.view.shape[:self.view.ndim]])
43978  *
43979  */
43980 
43981   /* function exit code */
43982   __pyx_L1_error:;
43983   __Pyx_XDECREF(__pyx_t_1);
43984   __Pyx_XDECREF(__pyx_t_5);
43985   __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
43986   __pyx_r = NULL;
43987   __pyx_L0:;
43988   __Pyx_XGIVEREF(__pyx_r);
43989   __Pyx_RefNannyFinishContext();
43990   return __pyx_r;
43991 }
43992 
43993 /* "View.MemoryView":563
43994  *
43995  *     @property
43996  *     def strides(self):             # <<<<<<<<<<<<<<
43997  *         if self.view.strides == NULL:
43998  *
43999  */
44000 
44001 /* Python wrapper */
44002 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject * __pyx_v_self)44003 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
44004   PyObject *__pyx_r = 0;
44005   __Pyx_RefNannyDeclarations
44006   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
44007   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
44008 
44009   /* function exit code */
44010   __Pyx_RefNannyFinishContext();
44011   return __pyx_r;
44012 }
44013 
__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj * __pyx_v_self)44014 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
44015   Py_ssize_t __pyx_v_stride;
44016   PyObject *__pyx_r = NULL;
44017   __Pyx_RefNannyDeclarations
44018   int __pyx_t_1;
44019   PyObject *__pyx_t_2 = NULL;
44020   Py_ssize_t *__pyx_t_3;
44021   Py_ssize_t *__pyx_t_4;
44022   Py_ssize_t *__pyx_t_5;
44023   PyObject *__pyx_t_6 = NULL;
44024   __Pyx_RefNannySetupContext("__get__", 0);
44025 
44026   /* "View.MemoryView":564
44027  *     @property
44028  *     def strides(self):
44029  *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
44030  *
44031  *             raise ValueError("Buffer view does not expose strides")
44032  */
44033   __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
44034   if (unlikely(__pyx_t_1)) {
44035 
44036     /* "View.MemoryView":566
44037  *         if self.view.strides == NULL:
44038  *
44039  *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
44040  *
44041  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
44042  */
44043     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 566, __pyx_L1_error)
44044     __Pyx_GOTREF(__pyx_t_2);
44045     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
44046     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
44047     __PYX_ERR(4, 566, __pyx_L1_error)
44048 
44049     /* "View.MemoryView":564
44050  *     @property
44051  *     def strides(self):
44052  *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
44053  *
44054  *             raise ValueError("Buffer view does not expose strides")
44055  */
44056   }
44057 
44058   /* "View.MemoryView":568
44059  *             raise ValueError("Buffer view does not expose strides")
44060  *
44061  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])             # <<<<<<<<<<<<<<
44062  *
44063  *     @property
44064  */
44065   __Pyx_XDECREF(__pyx_r);
44066   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 568, __pyx_L1_error)
44067   __Pyx_GOTREF(__pyx_t_2);
44068   __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
44069   for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
44070     __pyx_t_3 = __pyx_t_5;
44071     __pyx_v_stride = (__pyx_t_3[0]);
44072     __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 568, __pyx_L1_error)
44073     __Pyx_GOTREF(__pyx_t_6);
44074     if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(4, 568, __pyx_L1_error)
44075     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
44076   }
44077   __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 568, __pyx_L1_error)
44078   __Pyx_GOTREF(__pyx_t_6);
44079   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
44080   __pyx_r = __pyx_t_6;
44081   __pyx_t_6 = 0;
44082   goto __pyx_L0;
44083 
44084   /* "View.MemoryView":563
44085  *
44086  *     @property
44087  *     def strides(self):             # <<<<<<<<<<<<<<
44088  *         if self.view.strides == NULL:
44089  *
44090  */
44091 
44092   /* function exit code */
44093   __pyx_L1_error:;
44094   __Pyx_XDECREF(__pyx_t_2);
44095   __Pyx_XDECREF(__pyx_t_6);
44096   __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
44097   __pyx_r = NULL;
44098   __pyx_L0:;
44099   __Pyx_XGIVEREF(__pyx_r);
44100   __Pyx_RefNannyFinishContext();
44101   return __pyx_r;
44102 }
44103 
44104 /* "View.MemoryView":571
44105  *
44106  *     @property
44107  *     def suboffsets(self):             # <<<<<<<<<<<<<<
44108  *         if self.view.suboffsets == NULL:
44109  *             return (-1,) * self.view.ndim
44110  */
44111 
44112 /* Python wrapper */
44113 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject * __pyx_v_self)44114 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
44115   PyObject *__pyx_r = 0;
44116   __Pyx_RefNannyDeclarations
44117   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
44118   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
44119 
44120   /* function exit code */
44121   __Pyx_RefNannyFinishContext();
44122   return __pyx_r;
44123 }
44124 
__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj * __pyx_v_self)44125 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
44126   Py_ssize_t __pyx_v_suboffset;
44127   PyObject *__pyx_r = NULL;
44128   __Pyx_RefNannyDeclarations
44129   int __pyx_t_1;
44130   PyObject *__pyx_t_2 = NULL;
44131   PyObject *__pyx_t_3 = NULL;
44132   Py_ssize_t *__pyx_t_4;
44133   Py_ssize_t *__pyx_t_5;
44134   Py_ssize_t *__pyx_t_6;
44135   __Pyx_RefNannySetupContext("__get__", 0);
44136 
44137   /* "View.MemoryView":572
44138  *     @property
44139  *     def suboffsets(self):
44140  *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
44141  *             return (-1,) * self.view.ndim
44142  *
44143  */
44144   __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
44145   if (__pyx_t_1) {
44146 
44147     /* "View.MemoryView":573
44148  *     def suboffsets(self):
44149  *         if self.view.suboffsets == NULL:
44150  *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
44151  *
44152  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
44153  */
44154     __Pyx_XDECREF(__pyx_r);
44155     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 573, __pyx_L1_error)
44156     __Pyx_GOTREF(__pyx_t_2);
44157     __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__32, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 573, __pyx_L1_error)
44158     __Pyx_GOTREF(__pyx_t_3);
44159     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
44160     __pyx_r = __pyx_t_3;
44161     __pyx_t_3 = 0;
44162     goto __pyx_L0;
44163 
44164     /* "View.MemoryView":572
44165  *     @property
44166  *     def suboffsets(self):
44167  *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
44168  *             return (-1,) * self.view.ndim
44169  *
44170  */
44171   }
44172 
44173   /* "View.MemoryView":575
44174  *             return (-1,) * self.view.ndim
44175  *
44176  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])             # <<<<<<<<<<<<<<
44177  *
44178  *     @property
44179  */
44180   __Pyx_XDECREF(__pyx_r);
44181   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 575, __pyx_L1_error)
44182   __Pyx_GOTREF(__pyx_t_3);
44183   __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
44184   for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
44185     __pyx_t_4 = __pyx_t_6;
44186     __pyx_v_suboffset = (__pyx_t_4[0]);
44187     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 575, __pyx_L1_error)
44188     __Pyx_GOTREF(__pyx_t_2);
44189     if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(4, 575, __pyx_L1_error)
44190     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
44191   }
44192   __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 575, __pyx_L1_error)
44193   __Pyx_GOTREF(__pyx_t_2);
44194   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
44195   __pyx_r = __pyx_t_2;
44196   __pyx_t_2 = 0;
44197   goto __pyx_L0;
44198 
44199   /* "View.MemoryView":571
44200  *
44201  *     @property
44202  *     def suboffsets(self):             # <<<<<<<<<<<<<<
44203  *         if self.view.suboffsets == NULL:
44204  *             return (-1,) * self.view.ndim
44205  */
44206 
44207   /* function exit code */
44208   __pyx_L1_error:;
44209   __Pyx_XDECREF(__pyx_t_2);
44210   __Pyx_XDECREF(__pyx_t_3);
44211   __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
44212   __pyx_r = NULL;
44213   __pyx_L0:;
44214   __Pyx_XGIVEREF(__pyx_r);
44215   __Pyx_RefNannyFinishContext();
44216   return __pyx_r;
44217 }
44218 
44219 /* "View.MemoryView":578
44220  *
44221  *     @property
44222  *     def ndim(self):             # <<<<<<<<<<<<<<
44223  *         return self.view.ndim
44224  *
44225  */
44226 
44227 /* Python wrapper */
44228 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject * __pyx_v_self)44229 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
44230   PyObject *__pyx_r = 0;
44231   __Pyx_RefNannyDeclarations
44232   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
44233   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
44234 
44235   /* function exit code */
44236   __Pyx_RefNannyFinishContext();
44237   return __pyx_r;
44238 }
44239 
__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj * __pyx_v_self)44240 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
44241   PyObject *__pyx_r = NULL;
44242   __Pyx_RefNannyDeclarations
44243   PyObject *__pyx_t_1 = NULL;
44244   __Pyx_RefNannySetupContext("__get__", 0);
44245 
44246   /* "View.MemoryView":579
44247  *     @property
44248  *     def ndim(self):
44249  *         return self.view.ndim             # <<<<<<<<<<<<<<
44250  *
44251  *     @property
44252  */
44253   __Pyx_XDECREF(__pyx_r);
44254   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 579, __pyx_L1_error)
44255   __Pyx_GOTREF(__pyx_t_1);
44256   __pyx_r = __pyx_t_1;
44257   __pyx_t_1 = 0;
44258   goto __pyx_L0;
44259 
44260   /* "View.MemoryView":578
44261  *
44262  *     @property
44263  *     def ndim(self):             # <<<<<<<<<<<<<<
44264  *         return self.view.ndim
44265  *
44266  */
44267 
44268   /* function exit code */
44269   __pyx_L1_error:;
44270   __Pyx_XDECREF(__pyx_t_1);
44271   __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
44272   __pyx_r = NULL;
44273   __pyx_L0:;
44274   __Pyx_XGIVEREF(__pyx_r);
44275   __Pyx_RefNannyFinishContext();
44276   return __pyx_r;
44277 }
44278 
44279 /* "View.MemoryView":582
44280  *
44281  *     @property
44282  *     def itemsize(self):             # <<<<<<<<<<<<<<
44283  *         return self.view.itemsize
44284  *
44285  */
44286 
44287 /* Python wrapper */
44288 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject * __pyx_v_self)44289 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
44290   PyObject *__pyx_r = 0;
44291   __Pyx_RefNannyDeclarations
44292   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
44293   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
44294 
44295   /* function exit code */
44296   __Pyx_RefNannyFinishContext();
44297   return __pyx_r;
44298 }
44299 
__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj * __pyx_v_self)44300 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
44301   PyObject *__pyx_r = NULL;
44302   __Pyx_RefNannyDeclarations
44303   PyObject *__pyx_t_1 = NULL;
44304   __Pyx_RefNannySetupContext("__get__", 0);
44305 
44306   /* "View.MemoryView":583
44307  *     @property
44308  *     def itemsize(self):
44309  *         return self.view.itemsize             # <<<<<<<<<<<<<<
44310  *
44311  *     @property
44312  */
44313   __Pyx_XDECREF(__pyx_r);
44314   __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 583, __pyx_L1_error)
44315   __Pyx_GOTREF(__pyx_t_1);
44316   __pyx_r = __pyx_t_1;
44317   __pyx_t_1 = 0;
44318   goto __pyx_L0;
44319 
44320   /* "View.MemoryView":582
44321  *
44322  *     @property
44323  *     def itemsize(self):             # <<<<<<<<<<<<<<
44324  *         return self.view.itemsize
44325  *
44326  */
44327 
44328   /* function exit code */
44329   __pyx_L1_error:;
44330   __Pyx_XDECREF(__pyx_t_1);
44331   __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
44332   __pyx_r = NULL;
44333   __pyx_L0:;
44334   __Pyx_XGIVEREF(__pyx_r);
44335   __Pyx_RefNannyFinishContext();
44336   return __pyx_r;
44337 }
44338 
44339 /* "View.MemoryView":586
44340  *
44341  *     @property
44342  *     def nbytes(self):             # <<<<<<<<<<<<<<
44343  *         return self.size * self.view.itemsize
44344  *
44345  */
44346 
44347 /* Python wrapper */
44348 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject * __pyx_v_self)44349 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
44350   PyObject *__pyx_r = 0;
44351   __Pyx_RefNannyDeclarations
44352   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
44353   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
44354 
44355   /* function exit code */
44356   __Pyx_RefNannyFinishContext();
44357   return __pyx_r;
44358 }
44359 
__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj * __pyx_v_self)44360 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
44361   PyObject *__pyx_r = NULL;
44362   __Pyx_RefNannyDeclarations
44363   PyObject *__pyx_t_1 = NULL;
44364   PyObject *__pyx_t_2 = NULL;
44365   PyObject *__pyx_t_3 = NULL;
44366   __Pyx_RefNannySetupContext("__get__", 0);
44367 
44368   /* "View.MemoryView":587
44369  *     @property
44370  *     def nbytes(self):
44371  *         return self.size * self.view.itemsize             # <<<<<<<<<<<<<<
44372  *
44373  *     @property
44374  */
44375   __Pyx_XDECREF(__pyx_r);
44376   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 587, __pyx_L1_error)
44377   __Pyx_GOTREF(__pyx_t_1);
44378   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 587, __pyx_L1_error)
44379   __Pyx_GOTREF(__pyx_t_2);
44380   __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 587, __pyx_L1_error)
44381   __Pyx_GOTREF(__pyx_t_3);
44382   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
44383   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
44384   __pyx_r = __pyx_t_3;
44385   __pyx_t_3 = 0;
44386   goto __pyx_L0;
44387 
44388   /* "View.MemoryView":586
44389  *
44390  *     @property
44391  *     def nbytes(self):             # <<<<<<<<<<<<<<
44392  *         return self.size * self.view.itemsize
44393  *
44394  */
44395 
44396   /* function exit code */
44397   __pyx_L1_error:;
44398   __Pyx_XDECREF(__pyx_t_1);
44399   __Pyx_XDECREF(__pyx_t_2);
44400   __Pyx_XDECREF(__pyx_t_3);
44401   __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
44402   __pyx_r = NULL;
44403   __pyx_L0:;
44404   __Pyx_XGIVEREF(__pyx_r);
44405   __Pyx_RefNannyFinishContext();
44406   return __pyx_r;
44407 }
44408 
44409 /* "View.MemoryView":590
44410  *
44411  *     @property
44412  *     def size(self):             # <<<<<<<<<<<<<<
44413  *         if self._size is None:
44414  *             result = 1
44415  */
44416 
44417 /* Python wrapper */
44418 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject * __pyx_v_self)44419 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
44420   PyObject *__pyx_r = 0;
44421   __Pyx_RefNannyDeclarations
44422   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
44423   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
44424 
44425   /* function exit code */
44426   __Pyx_RefNannyFinishContext();
44427   return __pyx_r;
44428 }
44429 
__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj * __pyx_v_self)44430 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
44431   PyObject *__pyx_v_result = NULL;
44432   PyObject *__pyx_v_length = NULL;
44433   PyObject *__pyx_r = NULL;
44434   __Pyx_RefNannyDeclarations
44435   int __pyx_t_1;
44436   int __pyx_t_2;
44437   Py_ssize_t *__pyx_t_3;
44438   Py_ssize_t *__pyx_t_4;
44439   Py_ssize_t *__pyx_t_5;
44440   PyObject *__pyx_t_6 = NULL;
44441   __Pyx_RefNannySetupContext("__get__", 0);
44442 
44443   /* "View.MemoryView":591
44444  *     @property
44445  *     def size(self):
44446  *         if self._size is None:             # <<<<<<<<<<<<<<
44447  *             result = 1
44448  *
44449  */
44450   __pyx_t_1 = (__pyx_v_self->_size == Py_None);
44451   __pyx_t_2 = (__pyx_t_1 != 0);
44452   if (__pyx_t_2) {
44453 
44454     /* "View.MemoryView":592
44455  *     def size(self):
44456  *         if self._size is None:
44457  *             result = 1             # <<<<<<<<<<<<<<
44458  *
44459  *             for length in self.view.shape[:self.view.ndim]:
44460  */
44461     __Pyx_INCREF(__pyx_int_1);
44462     __pyx_v_result = __pyx_int_1;
44463 
44464     /* "View.MemoryView":594
44465  *             result = 1
44466  *
44467  *             for length in self.view.shape[:self.view.ndim]:             # <<<<<<<<<<<<<<
44468  *                 result *= length
44469  *
44470  */
44471     __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
44472     for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
44473       __pyx_t_3 = __pyx_t_5;
44474       __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 594, __pyx_L1_error)
44475       __Pyx_GOTREF(__pyx_t_6);
44476       __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
44477       __pyx_t_6 = 0;
44478 
44479       /* "View.MemoryView":595
44480  *
44481  *             for length in self.view.shape[:self.view.ndim]:
44482  *                 result *= length             # <<<<<<<<<<<<<<
44483  *
44484  *             self._size = result
44485  */
44486       __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 595, __pyx_L1_error)
44487       __Pyx_GOTREF(__pyx_t_6);
44488       __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
44489       __pyx_t_6 = 0;
44490     }
44491 
44492     /* "View.MemoryView":597
44493  *                 result *= length
44494  *
44495  *             self._size = result             # <<<<<<<<<<<<<<
44496  *
44497  *         return self._size
44498  */
44499     __Pyx_INCREF(__pyx_v_result);
44500     __Pyx_GIVEREF(__pyx_v_result);
44501     __Pyx_GOTREF(__pyx_v_self->_size);
44502     __Pyx_DECREF(__pyx_v_self->_size);
44503     __pyx_v_self->_size = __pyx_v_result;
44504 
44505     /* "View.MemoryView":591
44506  *     @property
44507  *     def size(self):
44508  *         if self._size is None:             # <<<<<<<<<<<<<<
44509  *             result = 1
44510  *
44511  */
44512   }
44513 
44514   /* "View.MemoryView":599
44515  *             self._size = result
44516  *
44517  *         return self._size             # <<<<<<<<<<<<<<
44518  *
44519  *     def __len__(self):
44520  */
44521   __Pyx_XDECREF(__pyx_r);
44522   __Pyx_INCREF(__pyx_v_self->_size);
44523   __pyx_r = __pyx_v_self->_size;
44524   goto __pyx_L0;
44525 
44526   /* "View.MemoryView":590
44527  *
44528  *     @property
44529  *     def size(self):             # <<<<<<<<<<<<<<
44530  *         if self._size is None:
44531  *             result = 1
44532  */
44533 
44534   /* function exit code */
44535   __pyx_L1_error:;
44536   __Pyx_XDECREF(__pyx_t_6);
44537   __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
44538   __pyx_r = NULL;
44539   __pyx_L0:;
44540   __Pyx_XDECREF(__pyx_v_result);
44541   __Pyx_XDECREF(__pyx_v_length);
44542   __Pyx_XGIVEREF(__pyx_r);
44543   __Pyx_RefNannyFinishContext();
44544   return __pyx_r;
44545 }
44546 
44547 /* "View.MemoryView":601
44548  *         return self._size
44549  *
44550  *     def __len__(self):             # <<<<<<<<<<<<<<
44551  *         if self.view.ndim >= 1:
44552  *             return self.view.shape[0]
44553  */
44554 
44555 /* Python wrapper */
44556 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___len__(PyObject * __pyx_v_self)44557 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
44558   Py_ssize_t __pyx_r;
44559   __Pyx_RefNannyDeclarations
44560   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
44561   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));
44562 
44563   /* function exit code */
44564   __Pyx_RefNannyFinishContext();
44565   return __pyx_r;
44566 }
44567 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj * __pyx_v_self)44568 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
44569   Py_ssize_t __pyx_r;
44570   __Pyx_RefNannyDeclarations
44571   int __pyx_t_1;
44572   __Pyx_RefNannySetupContext("__len__", 0);
44573 
44574   /* "View.MemoryView":602
44575  *
44576  *     def __len__(self):
44577  *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
44578  *             return self.view.shape[0]
44579  *
44580  */
44581   __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
44582   if (__pyx_t_1) {
44583 
44584     /* "View.MemoryView":603
44585  *     def __len__(self):
44586  *         if self.view.ndim >= 1:
44587  *             return self.view.shape[0]             # <<<<<<<<<<<<<<
44588  *
44589  *         return 0
44590  */
44591     __pyx_r = (__pyx_v_self->view.shape[0]);
44592     goto __pyx_L0;
44593 
44594     /* "View.MemoryView":602
44595  *
44596  *     def __len__(self):
44597  *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
44598  *             return self.view.shape[0]
44599  *
44600  */
44601   }
44602 
44603   /* "View.MemoryView":605
44604  *             return self.view.shape[0]
44605  *
44606  *         return 0             # <<<<<<<<<<<<<<
44607  *
44608  *     def __repr__(self):
44609  */
44610   __pyx_r = 0;
44611   goto __pyx_L0;
44612 
44613   /* "View.MemoryView":601
44614  *         return self._size
44615  *
44616  *     def __len__(self):             # <<<<<<<<<<<<<<
44617  *         if self.view.ndim >= 1:
44618  *             return self.view.shape[0]
44619  */
44620 
44621   /* function exit code */
44622   __pyx_L0:;
44623   __Pyx_RefNannyFinishContext();
44624   return __pyx_r;
44625 }
44626 
44627 /* "View.MemoryView":607
44628  *         return 0
44629  *
44630  *     def __repr__(self):             # <<<<<<<<<<<<<<
44631  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
44632  *                                                id(self))
44633  */
44634 
44635 /* Python wrapper */
44636 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___repr__(PyObject * __pyx_v_self)44637 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
44638   PyObject *__pyx_r = 0;
44639   __Pyx_RefNannyDeclarations
44640   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
44641   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));
44642 
44643   /* function exit code */
44644   __Pyx_RefNannyFinishContext();
44645   return __pyx_r;
44646 }
44647 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj * __pyx_v_self)44648 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
44649   PyObject *__pyx_r = NULL;
44650   __Pyx_RefNannyDeclarations
44651   PyObject *__pyx_t_1 = NULL;
44652   PyObject *__pyx_t_2 = NULL;
44653   PyObject *__pyx_t_3 = NULL;
44654   __Pyx_RefNannySetupContext("__repr__", 0);
44655 
44656   /* "View.MemoryView":608
44657  *
44658  *     def __repr__(self):
44659  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
44660  *                                                id(self))
44661  *
44662  */
44663   __Pyx_XDECREF(__pyx_r);
44664   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 608, __pyx_L1_error)
44665   __Pyx_GOTREF(__pyx_t_1);
44666   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 608, __pyx_L1_error)
44667   __Pyx_GOTREF(__pyx_t_2);
44668   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
44669   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 608, __pyx_L1_error)
44670   __Pyx_GOTREF(__pyx_t_1);
44671   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
44672 
44673   /* "View.MemoryView":609
44674  *     def __repr__(self):
44675  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
44676  *                                                id(self))             # <<<<<<<<<<<<<<
44677  *
44678  *     def __str__(self):
44679  */
44680   __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 609, __pyx_L1_error)
44681   __Pyx_GOTREF(__pyx_t_2);
44682 
44683   /* "View.MemoryView":608
44684  *
44685  *     def __repr__(self):
44686  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
44687  *                                                id(self))
44688  *
44689  */
44690   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 608, __pyx_L1_error)
44691   __Pyx_GOTREF(__pyx_t_3);
44692   __Pyx_GIVEREF(__pyx_t_1);
44693   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
44694   __Pyx_GIVEREF(__pyx_t_2);
44695   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
44696   __pyx_t_1 = 0;
44697   __pyx_t_2 = 0;
44698   __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(4, 608, __pyx_L1_error)
44699   __Pyx_GOTREF(__pyx_t_2);
44700   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
44701   __pyx_r = __pyx_t_2;
44702   __pyx_t_2 = 0;
44703   goto __pyx_L0;
44704 
44705   /* "View.MemoryView":607
44706  *         return 0
44707  *
44708  *     def __repr__(self):             # <<<<<<<<<<<<<<
44709  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
44710  *                                                id(self))
44711  */
44712 
44713   /* function exit code */
44714   __pyx_L1_error:;
44715   __Pyx_XDECREF(__pyx_t_1);
44716   __Pyx_XDECREF(__pyx_t_2);
44717   __Pyx_XDECREF(__pyx_t_3);
44718   __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
44719   __pyx_r = NULL;
44720   __pyx_L0:;
44721   __Pyx_XGIVEREF(__pyx_r);
44722   __Pyx_RefNannyFinishContext();
44723   return __pyx_r;
44724 }
44725 
44726 /* "View.MemoryView":611
44727  *                                                id(self))
44728  *
44729  *     def __str__(self):             # <<<<<<<<<<<<<<
44730  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
44731  *
44732  */
44733 
44734 /* Python wrapper */
44735 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___str__(PyObject * __pyx_v_self)44736 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
44737   PyObject *__pyx_r = 0;
44738   __Pyx_RefNannyDeclarations
44739   __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
44740   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));
44741 
44742   /* function exit code */
44743   __Pyx_RefNannyFinishContext();
44744   return __pyx_r;
44745 }
44746 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj * __pyx_v_self)44747 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
44748   PyObject *__pyx_r = NULL;
44749   __Pyx_RefNannyDeclarations
44750   PyObject *__pyx_t_1 = NULL;
44751   PyObject *__pyx_t_2 = NULL;
44752   __Pyx_RefNannySetupContext("__str__", 0);
44753 
44754   /* "View.MemoryView":612
44755  *
44756  *     def __str__(self):
44757  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)             # <<<<<<<<<<<<<<
44758  *
44759  *
44760  */
44761   __Pyx_XDECREF(__pyx_r);
44762   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 612, __pyx_L1_error)
44763   __Pyx_GOTREF(__pyx_t_1);
44764   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 612, __pyx_L1_error)
44765   __Pyx_GOTREF(__pyx_t_2);
44766   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
44767   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 612, __pyx_L1_error)
44768   __Pyx_GOTREF(__pyx_t_1);
44769   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
44770   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 612, __pyx_L1_error)
44771   __Pyx_GOTREF(__pyx_t_2);
44772   __Pyx_GIVEREF(__pyx_t_1);
44773   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
44774   __pyx_t_1 = 0;
44775   __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 612, __pyx_L1_error)
44776   __Pyx_GOTREF(__pyx_t_1);
44777   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
44778   __pyx_r = __pyx_t_1;
44779   __pyx_t_1 = 0;
44780   goto __pyx_L0;
44781 
44782   /* "View.MemoryView":611
44783  *                                                id(self))
44784  *
44785  *     def __str__(self):             # <<<<<<<<<<<<<<
44786  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
44787  *
44788  */
44789 
44790   /* function exit code */
44791   __pyx_L1_error:;
44792   __Pyx_XDECREF(__pyx_t_1);
44793   __Pyx_XDECREF(__pyx_t_2);
44794   __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
44795   __pyx_r = NULL;
44796   __pyx_L0:;
44797   __Pyx_XGIVEREF(__pyx_r);
44798   __Pyx_RefNannyFinishContext();
44799   return __pyx_r;
44800 }
44801 
44802 /* "View.MemoryView":615
44803  *
44804  *
44805  *     def is_c_contig(self):             # <<<<<<<<<<<<<<
44806  *         cdef __Pyx_memviewslice *mslice
44807  *         cdef __Pyx_memviewslice tmp
44808  */
44809 
44810 /* Python wrapper */
44811 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_is_c_contig(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)44812 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
44813   PyObject *__pyx_r = 0;
44814   __Pyx_RefNannyDeclarations
44815   __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
44816   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
44817 
44818   /* function exit code */
44819   __Pyx_RefNannyFinishContext();
44820   return __pyx_r;
44821 }
44822 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj * __pyx_v_self)44823 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
44824   __Pyx_memviewslice *__pyx_v_mslice;
44825   __Pyx_memviewslice __pyx_v_tmp;
44826   PyObject *__pyx_r = NULL;
44827   __Pyx_RefNannyDeclarations
44828   PyObject *__pyx_t_1 = NULL;
44829   __Pyx_RefNannySetupContext("is_c_contig", 0);
44830 
44831   /* "View.MemoryView":618
44832  *         cdef __Pyx_memviewslice *mslice
44833  *         cdef __Pyx_memviewslice tmp
44834  *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
44835  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
44836  *
44837  */
44838   __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
44839 
44840   /* "View.MemoryView":619
44841  *         cdef __Pyx_memviewslice tmp
44842  *         mslice = get_slice_from_memview(self, &tmp)
44843  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)             # <<<<<<<<<<<<<<
44844  *
44845  *     def is_f_contig(self):
44846  */
44847   __Pyx_XDECREF(__pyx_r);
44848   __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(4, 619, __pyx_L1_error)
44849   __Pyx_GOTREF(__pyx_t_1);
44850   __pyx_r = __pyx_t_1;
44851   __pyx_t_1 = 0;
44852   goto __pyx_L0;
44853 
44854   /* "View.MemoryView":615
44855  *
44856  *
44857  *     def is_c_contig(self):             # <<<<<<<<<<<<<<
44858  *         cdef __Pyx_memviewslice *mslice
44859  *         cdef __Pyx_memviewslice tmp
44860  */
44861 
44862   /* function exit code */
44863   __pyx_L1_error:;
44864   __Pyx_XDECREF(__pyx_t_1);
44865   __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
44866   __pyx_r = NULL;
44867   __pyx_L0:;
44868   __Pyx_XGIVEREF(__pyx_r);
44869   __Pyx_RefNannyFinishContext();
44870   return __pyx_r;
44871 }
44872 
44873 /* "View.MemoryView":621
44874  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
44875  *
44876  *     def is_f_contig(self):             # <<<<<<<<<<<<<<
44877  *         cdef __Pyx_memviewslice *mslice
44878  *         cdef __Pyx_memviewslice tmp
44879  */
44880 
44881 /* Python wrapper */
44882 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_is_f_contig(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)44883 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
44884   PyObject *__pyx_r = 0;
44885   __Pyx_RefNannyDeclarations
44886   __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
44887   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
44888 
44889   /* function exit code */
44890   __Pyx_RefNannyFinishContext();
44891   return __pyx_r;
44892 }
44893 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj * __pyx_v_self)44894 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
44895   __Pyx_memviewslice *__pyx_v_mslice;
44896   __Pyx_memviewslice __pyx_v_tmp;
44897   PyObject *__pyx_r = NULL;
44898   __Pyx_RefNannyDeclarations
44899   PyObject *__pyx_t_1 = NULL;
44900   __Pyx_RefNannySetupContext("is_f_contig", 0);
44901 
44902   /* "View.MemoryView":624
44903  *         cdef __Pyx_memviewslice *mslice
44904  *         cdef __Pyx_memviewslice tmp
44905  *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
44906  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
44907  *
44908  */
44909   __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
44910 
44911   /* "View.MemoryView":625
44912  *         cdef __Pyx_memviewslice tmp
44913  *         mslice = get_slice_from_memview(self, &tmp)
44914  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)             # <<<<<<<<<<<<<<
44915  *
44916  *     def copy(self):
44917  */
44918   __Pyx_XDECREF(__pyx_r);
44919   __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(4, 625, __pyx_L1_error)
44920   __Pyx_GOTREF(__pyx_t_1);
44921   __pyx_r = __pyx_t_1;
44922   __pyx_t_1 = 0;
44923   goto __pyx_L0;
44924 
44925   /* "View.MemoryView":621
44926  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
44927  *
44928  *     def is_f_contig(self):             # <<<<<<<<<<<<<<
44929  *         cdef __Pyx_memviewslice *mslice
44930  *         cdef __Pyx_memviewslice tmp
44931  */
44932 
44933   /* function exit code */
44934   __pyx_L1_error:;
44935   __Pyx_XDECREF(__pyx_t_1);
44936   __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
44937   __pyx_r = NULL;
44938   __pyx_L0:;
44939   __Pyx_XGIVEREF(__pyx_r);
44940   __Pyx_RefNannyFinishContext();
44941   return __pyx_r;
44942 }
44943 
44944 /* "View.MemoryView":627
44945  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
44946  *
44947  *     def copy(self):             # <<<<<<<<<<<<<<
44948  *         cdef __Pyx_memviewslice mslice
44949  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
44950  */
44951 
44952 /* Python wrapper */
44953 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_copy(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)44954 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
44955   PyObject *__pyx_r = 0;
44956   __Pyx_RefNannyDeclarations
44957   __Pyx_RefNannySetupContext("copy (wrapper)", 0);
44958   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));
44959 
44960   /* function exit code */
44961   __Pyx_RefNannyFinishContext();
44962   return __pyx_r;
44963 }
44964 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj * __pyx_v_self)44965 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
44966   __Pyx_memviewslice __pyx_v_mslice;
44967   int __pyx_v_flags;
44968   PyObject *__pyx_r = NULL;
44969   __Pyx_RefNannyDeclarations
44970   __Pyx_memviewslice __pyx_t_1;
44971   PyObject *__pyx_t_2 = NULL;
44972   __Pyx_RefNannySetupContext("copy", 0);
44973 
44974   /* "View.MemoryView":629
44975  *     def copy(self):
44976  *         cdef __Pyx_memviewslice mslice
44977  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS             # <<<<<<<<<<<<<<
44978  *
44979  *         slice_copy(self, &mslice)
44980  */
44981   __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
44982 
44983   /* "View.MemoryView":631
44984  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
44985  *
44986  *         slice_copy(self, &mslice)             # <<<<<<<<<<<<<<
44987  *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
44988  *                                    self.view.itemsize,
44989  */
44990   __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
44991 
44992   /* "View.MemoryView":632
44993  *
44994  *         slice_copy(self, &mslice)
44995  *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,             # <<<<<<<<<<<<<<
44996  *                                    self.view.itemsize,
44997  *                                    flags|PyBUF_C_CONTIGUOUS,
44998  */
44999   __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(4, 632, __pyx_L1_error)
45000   __pyx_v_mslice = __pyx_t_1;
45001 
45002   /* "View.MemoryView":637
45003  *                                    self.dtype_is_object)
45004  *
45005  *         return memoryview_copy_from_slice(self, &mslice)             # <<<<<<<<<<<<<<
45006  *
45007  *     def copy_fortran(self):
45008  */
45009   __Pyx_XDECREF(__pyx_r);
45010   __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 637, __pyx_L1_error)
45011   __Pyx_GOTREF(__pyx_t_2);
45012   __pyx_r = __pyx_t_2;
45013   __pyx_t_2 = 0;
45014   goto __pyx_L0;
45015 
45016   /* "View.MemoryView":627
45017  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
45018  *
45019  *     def copy(self):             # <<<<<<<<<<<<<<
45020  *         cdef __Pyx_memviewslice mslice
45021  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
45022  */
45023 
45024   /* function exit code */
45025   __pyx_L1_error:;
45026   __Pyx_XDECREF(__pyx_t_2);
45027   __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
45028   __pyx_r = NULL;
45029   __pyx_L0:;
45030   __Pyx_XGIVEREF(__pyx_r);
45031   __Pyx_RefNannyFinishContext();
45032   return __pyx_r;
45033 }
45034 
45035 /* "View.MemoryView":639
45036  *         return memoryview_copy_from_slice(self, &mslice)
45037  *
45038  *     def copy_fortran(self):             # <<<<<<<<<<<<<<
45039  *         cdef __Pyx_memviewslice src, dst
45040  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
45041  */
45042 
45043 /* Python wrapper */
45044 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_copy_fortran(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)45045 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
45046   PyObject *__pyx_r = 0;
45047   __Pyx_RefNannyDeclarations
45048   __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
45049   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));
45050 
45051   /* function exit code */
45052   __Pyx_RefNannyFinishContext();
45053   return __pyx_r;
45054 }
45055 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj * __pyx_v_self)45056 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
45057   __Pyx_memviewslice __pyx_v_src;
45058   __Pyx_memviewslice __pyx_v_dst;
45059   int __pyx_v_flags;
45060   PyObject *__pyx_r = NULL;
45061   __Pyx_RefNannyDeclarations
45062   __Pyx_memviewslice __pyx_t_1;
45063   PyObject *__pyx_t_2 = NULL;
45064   __Pyx_RefNannySetupContext("copy_fortran", 0);
45065 
45066   /* "View.MemoryView":641
45067  *     def copy_fortran(self):
45068  *         cdef __Pyx_memviewslice src, dst
45069  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS             # <<<<<<<<<<<<<<
45070  *
45071  *         slice_copy(self, &src)
45072  */
45073   __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
45074 
45075   /* "View.MemoryView":643
45076  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
45077  *
45078  *         slice_copy(self, &src)             # <<<<<<<<<<<<<<
45079  *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,
45080  *                                 self.view.itemsize,
45081  */
45082   __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
45083 
45084   /* "View.MemoryView":644
45085  *
45086  *         slice_copy(self, &src)
45087  *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,             # <<<<<<<<<<<<<<
45088  *                                 self.view.itemsize,
45089  *                                 flags|PyBUF_F_CONTIGUOUS,
45090  */
45091   __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(4, 644, __pyx_L1_error)
45092   __pyx_v_dst = __pyx_t_1;
45093 
45094   /* "View.MemoryView":649
45095  *                                 self.dtype_is_object)
45096  *
45097  *         return memoryview_copy_from_slice(self, &dst)             # <<<<<<<<<<<<<<
45098  *
45099  *
45100  */
45101   __Pyx_XDECREF(__pyx_r);
45102   __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 649, __pyx_L1_error)
45103   __Pyx_GOTREF(__pyx_t_2);
45104   __pyx_r = __pyx_t_2;
45105   __pyx_t_2 = 0;
45106   goto __pyx_L0;
45107 
45108   /* "View.MemoryView":639
45109  *         return memoryview_copy_from_slice(self, &mslice)
45110  *
45111  *     def copy_fortran(self):             # <<<<<<<<<<<<<<
45112  *         cdef __Pyx_memviewslice src, dst
45113  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
45114  */
45115 
45116   /* function exit code */
45117   __pyx_L1_error:;
45118   __Pyx_XDECREF(__pyx_t_2);
45119   __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
45120   __pyx_r = NULL;
45121   __pyx_L0:;
45122   __Pyx_XGIVEREF(__pyx_r);
45123   __Pyx_RefNannyFinishContext();
45124   return __pyx_r;
45125 }
45126 
45127 /* "(tree fragment)":1
45128  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
45129  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
45130  * def __setstate_cython__(self, __pyx_state):
45131  */
45132 
45133 /* Python wrapper */
45134 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)45135 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
45136   PyObject *__pyx_r = 0;
45137   __Pyx_RefNannyDeclarations
45138   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
45139   __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));
45140 
45141   /* function exit code */
45142   __Pyx_RefNannyFinishContext();
45143   return __pyx_r;
45144 }
45145 
__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj * __pyx_v_self)45146 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
45147   PyObject *__pyx_r = NULL;
45148   __Pyx_RefNannyDeclarations
45149   PyObject *__pyx_t_1 = NULL;
45150   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
45151 
45152   /* "(tree fragment)":2
45153  * def __reduce_cython__(self):
45154  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
45155  * def __setstate_cython__(self, __pyx_state):
45156  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
45157  */
45158   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2, __pyx_L1_error)
45159   __Pyx_GOTREF(__pyx_t_1);
45160   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
45161   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
45162   __PYX_ERR(4, 2, __pyx_L1_error)
45163 
45164   /* "(tree fragment)":1
45165  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
45166  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
45167  * def __setstate_cython__(self, __pyx_state):
45168  */
45169 
45170   /* function exit code */
45171   __pyx_L1_error:;
45172   __Pyx_XDECREF(__pyx_t_1);
45173   __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
45174   __pyx_r = NULL;
45175   __Pyx_XGIVEREF(__pyx_r);
45176   __Pyx_RefNannyFinishContext();
45177   return __pyx_r;
45178 }
45179 
45180 /* "(tree fragment)":3
45181  * def __reduce_cython__(self):
45182  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
45183  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
45184  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
45185  */
45186 
45187 /* Python wrapper */
45188 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)45189 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
45190   PyObject *__pyx_r = 0;
45191   __Pyx_RefNannyDeclarations
45192   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
45193   __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
45194 
45195   /* function exit code */
45196   __Pyx_RefNannyFinishContext();
45197   return __pyx_r;
45198 }
45199 
__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)45200 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) {
45201   PyObject *__pyx_r = NULL;
45202   __Pyx_RefNannyDeclarations
45203   PyObject *__pyx_t_1 = NULL;
45204   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
45205 
45206   /* "(tree fragment)":4
45207  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
45208  * def __setstate_cython__(self, __pyx_state):
45209  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
45210  */
45211   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4, __pyx_L1_error)
45212   __Pyx_GOTREF(__pyx_t_1);
45213   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
45214   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
45215   __PYX_ERR(4, 4, __pyx_L1_error)
45216 
45217   /* "(tree fragment)":3
45218  * def __reduce_cython__(self):
45219  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
45220  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
45221  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
45222  */
45223 
45224   /* function exit code */
45225   __pyx_L1_error:;
45226   __Pyx_XDECREF(__pyx_t_1);
45227   __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
45228   __pyx_r = NULL;
45229   __Pyx_XGIVEREF(__pyx_r);
45230   __Pyx_RefNannyFinishContext();
45231   return __pyx_r;
45232 }
45233 
45234 /* "View.MemoryView":653
45235  *
45236  * @cname('__pyx_memoryview_new')
45237  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
45238  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
45239  *     result.typeinfo = typeinfo
45240  */
45241 
__pyx_memoryview_new(PyObject * __pyx_v_o,int __pyx_v_flags,int __pyx_v_dtype_is_object,__Pyx_TypeInfo * __pyx_v_typeinfo)45242 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
45243   struct __pyx_memoryview_obj *__pyx_v_result = 0;
45244   PyObject *__pyx_r = NULL;
45245   __Pyx_RefNannyDeclarations
45246   PyObject *__pyx_t_1 = NULL;
45247   PyObject *__pyx_t_2 = NULL;
45248   PyObject *__pyx_t_3 = NULL;
45249   __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);
45250 
45251   /* "View.MemoryView":654
45252  * @cname('__pyx_memoryview_new')
45253  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
45254  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)             # <<<<<<<<<<<<<<
45255  *     result.typeinfo = typeinfo
45256  *     return result
45257  */
45258   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 654, __pyx_L1_error)
45259   __Pyx_GOTREF(__pyx_t_1);
45260   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 654, __pyx_L1_error)
45261   __Pyx_GOTREF(__pyx_t_2);
45262   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 654, __pyx_L1_error)
45263   __Pyx_GOTREF(__pyx_t_3);
45264   __Pyx_INCREF(__pyx_v_o);
45265   __Pyx_GIVEREF(__pyx_v_o);
45266   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
45267   __Pyx_GIVEREF(__pyx_t_1);
45268   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
45269   __Pyx_GIVEREF(__pyx_t_2);
45270   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
45271   __pyx_t_1 = 0;
45272   __pyx_t_2 = 0;
45273   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 654, __pyx_L1_error)
45274   __Pyx_GOTREF(__pyx_t_2);
45275   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
45276   __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
45277   __pyx_t_2 = 0;
45278 
45279   /* "View.MemoryView":655
45280  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
45281  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
45282  *     result.typeinfo = typeinfo             # <<<<<<<<<<<<<<
45283  *     return result
45284  *
45285  */
45286   __pyx_v_result->typeinfo = __pyx_v_typeinfo;
45287 
45288   /* "View.MemoryView":656
45289  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
45290  *     result.typeinfo = typeinfo
45291  *     return result             # <<<<<<<<<<<<<<
45292  *
45293  * @cname('__pyx_memoryview_check')
45294  */
45295   __Pyx_XDECREF(__pyx_r);
45296   __Pyx_INCREF(((PyObject *)__pyx_v_result));
45297   __pyx_r = ((PyObject *)__pyx_v_result);
45298   goto __pyx_L0;
45299 
45300   /* "View.MemoryView":653
45301  *
45302  * @cname('__pyx_memoryview_new')
45303  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
45304  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
45305  *     result.typeinfo = typeinfo
45306  */
45307 
45308   /* function exit code */
45309   __pyx_L1_error:;
45310   __Pyx_XDECREF(__pyx_t_1);
45311   __Pyx_XDECREF(__pyx_t_2);
45312   __Pyx_XDECREF(__pyx_t_3);
45313   __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
45314   __pyx_r = 0;
45315   __pyx_L0:;
45316   __Pyx_XDECREF((PyObject *)__pyx_v_result);
45317   __Pyx_XGIVEREF(__pyx_r);
45318   __Pyx_RefNannyFinishContext();
45319   return __pyx_r;
45320 }
45321 
45322 /* "View.MemoryView":659
45323  *
45324  * @cname('__pyx_memoryview_check')
45325  * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
45326  *     return isinstance(o, memoryview)
45327  *
45328  */
45329 
__pyx_memoryview_check(PyObject * __pyx_v_o)45330 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
45331   int __pyx_r;
45332   __Pyx_RefNannyDeclarations
45333   int __pyx_t_1;
45334   __Pyx_RefNannySetupContext("memoryview_check", 0);
45335 
45336   /* "View.MemoryView":660
45337  * @cname('__pyx_memoryview_check')
45338  * cdef inline bint memoryview_check(object o):
45339  *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
45340  *
45341  * cdef tuple _unellipsify(object index, int ndim):
45342  */
45343   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
45344   __pyx_r = __pyx_t_1;
45345   goto __pyx_L0;
45346 
45347   /* "View.MemoryView":659
45348  *
45349  * @cname('__pyx_memoryview_check')
45350  * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
45351  *     return isinstance(o, memoryview)
45352  *
45353  */
45354 
45355   /* function exit code */
45356   __pyx_L0:;
45357   __Pyx_RefNannyFinishContext();
45358   return __pyx_r;
45359 }
45360 
45361 /* "View.MemoryView":662
45362  *     return isinstance(o, memoryview)
45363  *
45364  * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
45365  *     """
45366  *     Replace all ellipses with full slices and fill incomplete indices with
45367  */
45368 
_unellipsify(PyObject * __pyx_v_index,int __pyx_v_ndim)45369 static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
45370   PyObject *__pyx_v_tup = NULL;
45371   PyObject *__pyx_v_result = NULL;
45372   int __pyx_v_have_slices;
45373   int __pyx_v_seen_ellipsis;
45374   CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
45375   PyObject *__pyx_v_item = NULL;
45376   Py_ssize_t __pyx_v_nslices;
45377   PyObject *__pyx_r = NULL;
45378   __Pyx_RefNannyDeclarations
45379   int __pyx_t_1;
45380   int __pyx_t_2;
45381   PyObject *__pyx_t_3 = NULL;
45382   PyObject *__pyx_t_4 = NULL;
45383   Py_ssize_t __pyx_t_5;
45384   PyObject *(*__pyx_t_6)(PyObject *);
45385   PyObject *__pyx_t_7 = NULL;
45386   Py_ssize_t __pyx_t_8;
45387   int __pyx_t_9;
45388   int __pyx_t_10;
45389   PyObject *__pyx_t_11 = NULL;
45390   __Pyx_RefNannySetupContext("_unellipsify", 0);
45391 
45392   /* "View.MemoryView":667
45393  *     full slices.
45394  *     """
45395  *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
45396  *         tup = (index,)
45397  *     else:
45398  */
45399   __pyx_t_1 = PyTuple_Check(__pyx_v_index);
45400   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
45401   if (__pyx_t_2) {
45402 
45403     /* "View.MemoryView":668
45404  *     """
45405  *     if not isinstance(index, tuple):
45406  *         tup = (index,)             # <<<<<<<<<<<<<<
45407  *     else:
45408  *         tup = index
45409  */
45410     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 668, __pyx_L1_error)
45411     __Pyx_GOTREF(__pyx_t_3);
45412     __Pyx_INCREF(__pyx_v_index);
45413     __Pyx_GIVEREF(__pyx_v_index);
45414     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
45415     __pyx_v_tup = __pyx_t_3;
45416     __pyx_t_3 = 0;
45417 
45418     /* "View.MemoryView":667
45419  *     full slices.
45420  *     """
45421  *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
45422  *         tup = (index,)
45423  *     else:
45424  */
45425     goto __pyx_L3;
45426   }
45427 
45428   /* "View.MemoryView":670
45429  *         tup = (index,)
45430  *     else:
45431  *         tup = index             # <<<<<<<<<<<<<<
45432  *
45433  *     result = []
45434  */
45435   /*else*/ {
45436     __Pyx_INCREF(__pyx_v_index);
45437     __pyx_v_tup = __pyx_v_index;
45438   }
45439   __pyx_L3:;
45440 
45441   /* "View.MemoryView":672
45442  *         tup = index
45443  *
45444  *     result = []             # <<<<<<<<<<<<<<
45445  *     have_slices = False
45446  *     seen_ellipsis = False
45447  */
45448   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 672, __pyx_L1_error)
45449   __Pyx_GOTREF(__pyx_t_3);
45450   __pyx_v_result = ((PyObject*)__pyx_t_3);
45451   __pyx_t_3 = 0;
45452 
45453   /* "View.MemoryView":673
45454  *
45455  *     result = []
45456  *     have_slices = False             # <<<<<<<<<<<<<<
45457  *     seen_ellipsis = False
45458  *     for idx, item in enumerate(tup):
45459  */
45460   __pyx_v_have_slices = 0;
45461 
45462   /* "View.MemoryView":674
45463  *     result = []
45464  *     have_slices = False
45465  *     seen_ellipsis = False             # <<<<<<<<<<<<<<
45466  *     for idx, item in enumerate(tup):
45467  *         if item is Ellipsis:
45468  */
45469   __pyx_v_seen_ellipsis = 0;
45470 
45471   /* "View.MemoryView":675
45472  *     have_slices = False
45473  *     seen_ellipsis = False
45474  *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
45475  *         if item is Ellipsis:
45476  *             if not seen_ellipsis:
45477  */
45478   __Pyx_INCREF(__pyx_int_0);
45479   __pyx_t_3 = __pyx_int_0;
45480   if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
45481     __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
45482     __pyx_t_6 = NULL;
45483   } else {
45484     __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 675, __pyx_L1_error)
45485     __Pyx_GOTREF(__pyx_t_4);
45486     __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 675, __pyx_L1_error)
45487   }
45488   for (;;) {
45489     if (likely(!__pyx_t_6)) {
45490       if (likely(PyList_CheckExact(__pyx_t_4))) {
45491         if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
45492         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
45493         __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(4, 675, __pyx_L1_error)
45494         #else
45495         __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 675, __pyx_L1_error)
45496         __Pyx_GOTREF(__pyx_t_7);
45497         #endif
45498       } else {
45499         if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
45500         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
45501         __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(4, 675, __pyx_L1_error)
45502         #else
45503         __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 675, __pyx_L1_error)
45504         __Pyx_GOTREF(__pyx_t_7);
45505         #endif
45506       }
45507     } else {
45508       __pyx_t_7 = __pyx_t_6(__pyx_t_4);
45509       if (unlikely(!__pyx_t_7)) {
45510         PyObject* exc_type = PyErr_Occurred();
45511         if (exc_type) {
45512           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
45513           else __PYX_ERR(4, 675, __pyx_L1_error)
45514         }
45515         break;
45516       }
45517       __Pyx_GOTREF(__pyx_t_7);
45518     }
45519     __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
45520     __pyx_t_7 = 0;
45521     __Pyx_INCREF(__pyx_t_3);
45522     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
45523     __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 675, __pyx_L1_error)
45524     __Pyx_GOTREF(__pyx_t_7);
45525     __Pyx_DECREF(__pyx_t_3);
45526     __pyx_t_3 = __pyx_t_7;
45527     __pyx_t_7 = 0;
45528 
45529     /* "View.MemoryView":676
45530  *     seen_ellipsis = False
45531  *     for idx, item in enumerate(tup):
45532  *         if item is Ellipsis:             # <<<<<<<<<<<<<<
45533  *             if not seen_ellipsis:
45534  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
45535  */
45536     __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
45537     __pyx_t_1 = (__pyx_t_2 != 0);
45538     if (__pyx_t_1) {
45539 
45540       /* "View.MemoryView":677
45541  *     for idx, item in enumerate(tup):
45542  *         if item is Ellipsis:
45543  *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
45544  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
45545  *                 seen_ellipsis = True
45546  */
45547       __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
45548       if (__pyx_t_1) {
45549 
45550         /* "View.MemoryView":678
45551  *         if item is Ellipsis:
45552  *             if not seen_ellipsis:
45553  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
45554  *                 seen_ellipsis = True
45555  *             else:
45556  */
45557         __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(4, 678, __pyx_L1_error)
45558         __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(4, 678, __pyx_L1_error)
45559         __Pyx_GOTREF(__pyx_t_7);
45560         { Py_ssize_t __pyx_temp;
45561           for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
45562             __Pyx_INCREF(__pyx_slice__4);
45563             __Pyx_GIVEREF(__pyx_slice__4);
45564             PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__4);
45565           }
45566         }
45567         __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(4, 678, __pyx_L1_error)
45568         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
45569 
45570         /* "View.MemoryView":679
45571  *             if not seen_ellipsis:
45572  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
45573  *                 seen_ellipsis = True             # <<<<<<<<<<<<<<
45574  *             else:
45575  *                 result.append(slice(None))
45576  */
45577         __pyx_v_seen_ellipsis = 1;
45578 
45579         /* "View.MemoryView":677
45580  *     for idx, item in enumerate(tup):
45581  *         if item is Ellipsis:
45582  *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
45583  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
45584  *                 seen_ellipsis = True
45585  */
45586         goto __pyx_L7;
45587       }
45588 
45589       /* "View.MemoryView":681
45590  *                 seen_ellipsis = True
45591  *             else:
45592  *                 result.append(slice(None))             # <<<<<<<<<<<<<<
45593  *             have_slices = True
45594  *         else:
45595  */
45596       /*else*/ {
45597         __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__4); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(4, 681, __pyx_L1_error)
45598       }
45599       __pyx_L7:;
45600 
45601       /* "View.MemoryView":682
45602  *             else:
45603  *                 result.append(slice(None))
45604  *             have_slices = True             # <<<<<<<<<<<<<<
45605  *         else:
45606  *             if not isinstance(item, slice) and not PyIndex_Check(item):
45607  */
45608       __pyx_v_have_slices = 1;
45609 
45610       /* "View.MemoryView":676
45611  *     seen_ellipsis = False
45612  *     for idx, item in enumerate(tup):
45613  *         if item is Ellipsis:             # <<<<<<<<<<<<<<
45614  *             if not seen_ellipsis:
45615  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
45616  */
45617       goto __pyx_L6;
45618     }
45619 
45620     /* "View.MemoryView":684
45621  *             have_slices = True
45622  *         else:
45623  *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
45624  *                 raise TypeError("Cannot index with type '%s'" % type(item))
45625  *
45626  */
45627     /*else*/ {
45628       __pyx_t_2 = PySlice_Check(__pyx_v_item);
45629       __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
45630       if (__pyx_t_10) {
45631       } else {
45632         __pyx_t_1 = __pyx_t_10;
45633         goto __pyx_L9_bool_binop_done;
45634       }
45635       __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
45636       __pyx_t_1 = __pyx_t_10;
45637       __pyx_L9_bool_binop_done:;
45638       if (unlikely(__pyx_t_1)) {
45639 
45640         /* "View.MemoryView":685
45641  *         else:
45642  *             if not isinstance(item, slice) and not PyIndex_Check(item):
45643  *                 raise TypeError("Cannot index with type '%s'" % type(item))             # <<<<<<<<<<<<<<
45644  *
45645  *             have_slices = have_slices or isinstance(item, slice)
45646  */
45647         __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(4, 685, __pyx_L1_error)
45648         __Pyx_GOTREF(__pyx_t_7);
45649         __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 685, __pyx_L1_error)
45650         __Pyx_GOTREF(__pyx_t_11);
45651         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
45652         __Pyx_Raise(__pyx_t_11, 0, 0, 0);
45653         __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
45654         __PYX_ERR(4, 685, __pyx_L1_error)
45655 
45656         /* "View.MemoryView":684
45657  *             have_slices = True
45658  *         else:
45659  *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
45660  *                 raise TypeError("Cannot index with type '%s'" % type(item))
45661  *
45662  */
45663       }
45664 
45665       /* "View.MemoryView":687
45666  *                 raise TypeError("Cannot index with type '%s'" % type(item))
45667  *
45668  *             have_slices = have_slices or isinstance(item, slice)             # <<<<<<<<<<<<<<
45669  *             result.append(item)
45670  *
45671  */
45672       __pyx_t_10 = (__pyx_v_have_slices != 0);
45673       if (!__pyx_t_10) {
45674       } else {
45675         __pyx_t_1 = __pyx_t_10;
45676         goto __pyx_L11_bool_binop_done;
45677       }
45678       __pyx_t_10 = PySlice_Check(__pyx_v_item);
45679       __pyx_t_2 = (__pyx_t_10 != 0);
45680       __pyx_t_1 = __pyx_t_2;
45681       __pyx_L11_bool_binop_done:;
45682       __pyx_v_have_slices = __pyx_t_1;
45683 
45684       /* "View.MemoryView":688
45685  *
45686  *             have_slices = have_slices or isinstance(item, slice)
45687  *             result.append(item)             # <<<<<<<<<<<<<<
45688  *
45689  *     nslices = ndim - len(result)
45690  */
45691       __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(4, 688, __pyx_L1_error)
45692     }
45693     __pyx_L6:;
45694 
45695     /* "View.MemoryView":675
45696  *     have_slices = False
45697  *     seen_ellipsis = False
45698  *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
45699  *         if item is Ellipsis:
45700  *             if not seen_ellipsis:
45701  */
45702   }
45703   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
45704   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
45705 
45706   /* "View.MemoryView":690
45707  *             result.append(item)
45708  *
45709  *     nslices = ndim - len(result)             # <<<<<<<<<<<<<<
45710  *     if nslices:
45711  *         result.extend([slice(None)] * nslices)
45712  */
45713   __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(4, 690, __pyx_L1_error)
45714   __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
45715 
45716   /* "View.MemoryView":691
45717  *
45718  *     nslices = ndim - len(result)
45719  *     if nslices:             # <<<<<<<<<<<<<<
45720  *         result.extend([slice(None)] * nslices)
45721  *
45722  */
45723   __pyx_t_1 = (__pyx_v_nslices != 0);
45724   if (__pyx_t_1) {
45725 
45726     /* "View.MemoryView":692
45727  *     nslices = ndim - len(result)
45728  *     if nslices:
45729  *         result.extend([slice(None)] * nslices)             # <<<<<<<<<<<<<<
45730  *
45731  *     return have_slices or nslices, tuple(result)
45732  */
45733     __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 692, __pyx_L1_error)
45734     __Pyx_GOTREF(__pyx_t_3);
45735     { Py_ssize_t __pyx_temp;
45736       for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
45737         __Pyx_INCREF(__pyx_slice__4);
45738         __Pyx_GIVEREF(__pyx_slice__4);
45739         PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__4);
45740       }
45741     }
45742     __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(4, 692, __pyx_L1_error)
45743     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
45744 
45745     /* "View.MemoryView":691
45746  *
45747  *     nslices = ndim - len(result)
45748  *     if nslices:             # <<<<<<<<<<<<<<
45749  *         result.extend([slice(None)] * nslices)
45750  *
45751  */
45752   }
45753 
45754   /* "View.MemoryView":694
45755  *         result.extend([slice(None)] * nslices)
45756  *
45757  *     return have_slices or nslices, tuple(result)             # <<<<<<<<<<<<<<
45758  *
45759  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
45760  */
45761   __Pyx_XDECREF(__pyx_r);
45762   if (!__pyx_v_have_slices) {
45763   } else {
45764     __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 694, __pyx_L1_error)
45765     __Pyx_GOTREF(__pyx_t_4);
45766     __pyx_t_3 = __pyx_t_4;
45767     __pyx_t_4 = 0;
45768     goto __pyx_L14_bool_binop_done;
45769   }
45770   __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 694, __pyx_L1_error)
45771   __Pyx_GOTREF(__pyx_t_4);
45772   __pyx_t_3 = __pyx_t_4;
45773   __pyx_t_4 = 0;
45774   __pyx_L14_bool_binop_done:;
45775   __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 694, __pyx_L1_error)
45776   __Pyx_GOTREF(__pyx_t_4);
45777   __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(4, 694, __pyx_L1_error)
45778   __Pyx_GOTREF(__pyx_t_11);
45779   __Pyx_GIVEREF(__pyx_t_3);
45780   PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
45781   __Pyx_GIVEREF(__pyx_t_4);
45782   PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
45783   __pyx_t_3 = 0;
45784   __pyx_t_4 = 0;
45785   __pyx_r = ((PyObject*)__pyx_t_11);
45786   __pyx_t_11 = 0;
45787   goto __pyx_L0;
45788 
45789   /* "View.MemoryView":662
45790  *     return isinstance(o, memoryview)
45791  *
45792  * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
45793  *     """
45794  *     Replace all ellipses with full slices and fill incomplete indices with
45795  */
45796 
45797   /* function exit code */
45798   __pyx_L1_error:;
45799   __Pyx_XDECREF(__pyx_t_3);
45800   __Pyx_XDECREF(__pyx_t_4);
45801   __Pyx_XDECREF(__pyx_t_7);
45802   __Pyx_XDECREF(__pyx_t_11);
45803   __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
45804   __pyx_r = 0;
45805   __pyx_L0:;
45806   __Pyx_XDECREF(__pyx_v_tup);
45807   __Pyx_XDECREF(__pyx_v_result);
45808   __Pyx_XDECREF(__pyx_v_idx);
45809   __Pyx_XDECREF(__pyx_v_item);
45810   __Pyx_XGIVEREF(__pyx_r);
45811   __Pyx_RefNannyFinishContext();
45812   return __pyx_r;
45813 }
45814 
45815 /* "View.MemoryView":696
45816  *     return have_slices or nslices, tuple(result)
45817  *
45818  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
45819  *     for suboffset in suboffsets[:ndim]:
45820  *         if suboffset >= 0:
45821  */
45822 
assert_direct_dimensions(Py_ssize_t * __pyx_v_suboffsets,int __pyx_v_ndim)45823 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
45824   Py_ssize_t __pyx_v_suboffset;
45825   PyObject *__pyx_r = NULL;
45826   __Pyx_RefNannyDeclarations
45827   Py_ssize_t *__pyx_t_1;
45828   Py_ssize_t *__pyx_t_2;
45829   Py_ssize_t *__pyx_t_3;
45830   int __pyx_t_4;
45831   PyObject *__pyx_t_5 = NULL;
45832   __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);
45833 
45834   /* "View.MemoryView":697
45835  *
45836  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
45837  *     for suboffset in suboffsets[:ndim]:             # <<<<<<<<<<<<<<
45838  *         if suboffset >= 0:
45839  *             raise ValueError("Indirect dimensions not supported")
45840  */
45841   __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
45842   for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
45843     __pyx_t_1 = __pyx_t_3;
45844     __pyx_v_suboffset = (__pyx_t_1[0]);
45845 
45846     /* "View.MemoryView":698
45847  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
45848  *     for suboffset in suboffsets[:ndim]:
45849  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
45850  *             raise ValueError("Indirect dimensions not supported")
45851  *
45852  */
45853     __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
45854     if (unlikely(__pyx_t_4)) {
45855 
45856       /* "View.MemoryView":699
45857  *     for suboffset in suboffsets[:ndim]:
45858  *         if suboffset >= 0:
45859  *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
45860  *
45861  *
45862  */
45863       __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 699, __pyx_L1_error)
45864       __Pyx_GOTREF(__pyx_t_5);
45865       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
45866       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
45867       __PYX_ERR(4, 699, __pyx_L1_error)
45868 
45869       /* "View.MemoryView":698
45870  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
45871  *     for suboffset in suboffsets[:ndim]:
45872  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
45873  *             raise ValueError("Indirect dimensions not supported")
45874  *
45875  */
45876     }
45877   }
45878 
45879   /* "View.MemoryView":696
45880  *     return have_slices or nslices, tuple(result)
45881  *
45882  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
45883  *     for suboffset in suboffsets[:ndim]:
45884  *         if suboffset >= 0:
45885  */
45886 
45887   /* function exit code */
45888   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
45889   goto __pyx_L0;
45890   __pyx_L1_error:;
45891   __Pyx_XDECREF(__pyx_t_5);
45892   __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
45893   __pyx_r = 0;
45894   __pyx_L0:;
45895   __Pyx_XGIVEREF(__pyx_r);
45896   __Pyx_RefNannyFinishContext();
45897   return __pyx_r;
45898 }
45899 
45900 /* "View.MemoryView":706
45901  *
45902  * @cname('__pyx_memview_slice')
45903  * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
45904  *     cdef int new_ndim = 0, suboffset_dim = -1, dim
45905  *     cdef bint negative_step
45906  */
45907 
__pyx_memview_slice(struct __pyx_memoryview_obj * __pyx_v_memview,PyObject * __pyx_v_indices)45908 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
45909   int __pyx_v_new_ndim;
45910   int __pyx_v_suboffset_dim;
45911   int __pyx_v_dim;
45912   __Pyx_memviewslice __pyx_v_src;
45913   __Pyx_memviewslice __pyx_v_dst;
45914   __Pyx_memviewslice *__pyx_v_p_src;
45915   struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
45916   __Pyx_memviewslice *__pyx_v_p_dst;
45917   int *__pyx_v_p_suboffset_dim;
45918   Py_ssize_t __pyx_v_start;
45919   Py_ssize_t __pyx_v_stop;
45920   Py_ssize_t __pyx_v_step;
45921   int __pyx_v_have_start;
45922   int __pyx_v_have_stop;
45923   int __pyx_v_have_step;
45924   PyObject *__pyx_v_index = NULL;
45925   struct __pyx_memoryview_obj *__pyx_r = NULL;
45926   __Pyx_RefNannyDeclarations
45927   int __pyx_t_1;
45928   int __pyx_t_2;
45929   PyObject *__pyx_t_3 = NULL;
45930   struct __pyx_memoryview_obj *__pyx_t_4;
45931   char *__pyx_t_5;
45932   int __pyx_t_6;
45933   Py_ssize_t __pyx_t_7;
45934   PyObject *(*__pyx_t_8)(PyObject *);
45935   PyObject *__pyx_t_9 = NULL;
45936   Py_ssize_t __pyx_t_10;
45937   int __pyx_t_11;
45938   Py_ssize_t __pyx_t_12;
45939   __Pyx_RefNannySetupContext("memview_slice", 0);
45940 
45941   /* "View.MemoryView":707
45942  * @cname('__pyx_memview_slice')
45943  * cdef memoryview memview_slice(memoryview memview, object indices):
45944  *     cdef int new_ndim = 0, suboffset_dim = -1, dim             # <<<<<<<<<<<<<<
45945  *     cdef bint negative_step
45946  *     cdef __Pyx_memviewslice src, dst
45947  */
45948   __pyx_v_new_ndim = 0;
45949   __pyx_v_suboffset_dim = -1;
45950 
45951   /* "View.MemoryView":714
45952  *
45953  *
45954  *     memset(&dst, 0, sizeof(dst))             # <<<<<<<<<<<<<<
45955  *
45956  *     cdef _memoryviewslice memviewsliceobj
45957  */
45958   (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));
45959 
45960   /* "View.MemoryView":718
45961  *     cdef _memoryviewslice memviewsliceobj
45962  *
45963  *     assert memview.view.ndim > 0             # <<<<<<<<<<<<<<
45964  *
45965  *     if isinstance(memview, _memoryviewslice):
45966  */
45967   #ifndef CYTHON_WITHOUT_ASSERTIONS
45968   if (unlikely(!Py_OptimizeFlag)) {
45969     if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
45970       PyErr_SetNone(PyExc_AssertionError);
45971       __PYX_ERR(4, 718, __pyx_L1_error)
45972     }
45973   }
45974   #endif
45975 
45976   /* "View.MemoryView":720
45977  *     assert memview.view.ndim > 0
45978  *
45979  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
45980  *         memviewsliceobj = memview
45981  *         p_src = &memviewsliceobj.from_slice
45982  */
45983   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
45984   __pyx_t_2 = (__pyx_t_1 != 0);
45985   if (__pyx_t_2) {
45986 
45987     /* "View.MemoryView":721
45988  *
45989  *     if isinstance(memview, _memoryviewslice):
45990  *         memviewsliceobj = memview             # <<<<<<<<<<<<<<
45991  *         p_src = &memviewsliceobj.from_slice
45992  *     else:
45993  */
45994     if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(4, 721, __pyx_L1_error)
45995     __pyx_t_3 = ((PyObject *)__pyx_v_memview);
45996     __Pyx_INCREF(__pyx_t_3);
45997     __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
45998     __pyx_t_3 = 0;
45999 
46000     /* "View.MemoryView":722
46001  *     if isinstance(memview, _memoryviewslice):
46002  *         memviewsliceobj = memview
46003  *         p_src = &memviewsliceobj.from_slice             # <<<<<<<<<<<<<<
46004  *     else:
46005  *         slice_copy(memview, &src)
46006  */
46007     __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
46008 
46009     /* "View.MemoryView":720
46010  *     assert memview.view.ndim > 0
46011  *
46012  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
46013  *         memviewsliceobj = memview
46014  *         p_src = &memviewsliceobj.from_slice
46015  */
46016     goto __pyx_L3;
46017   }
46018 
46019   /* "View.MemoryView":724
46020  *         p_src = &memviewsliceobj.from_slice
46021  *     else:
46022  *         slice_copy(memview, &src)             # <<<<<<<<<<<<<<
46023  *         p_src = &src
46024  *
46025  */
46026   /*else*/ {
46027     __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
46028 
46029     /* "View.MemoryView":725
46030  *     else:
46031  *         slice_copy(memview, &src)
46032  *         p_src = &src             # <<<<<<<<<<<<<<
46033  *
46034  *
46035  */
46036     __pyx_v_p_src = (&__pyx_v_src);
46037   }
46038   __pyx_L3:;
46039 
46040   /* "View.MemoryView":731
46041  *
46042  *
46043  *     dst.memview = p_src.memview             # <<<<<<<<<<<<<<
46044  *     dst.data = p_src.data
46045  *
46046  */
46047   __pyx_t_4 = __pyx_v_p_src->memview;
46048   __pyx_v_dst.memview = __pyx_t_4;
46049 
46050   /* "View.MemoryView":732
46051  *
46052  *     dst.memview = p_src.memview
46053  *     dst.data = p_src.data             # <<<<<<<<<<<<<<
46054  *
46055  *
46056  */
46057   __pyx_t_5 = __pyx_v_p_src->data;
46058   __pyx_v_dst.data = __pyx_t_5;
46059 
46060   /* "View.MemoryView":737
46061  *
46062  *
46063  *     cdef __Pyx_memviewslice *p_dst = &dst             # <<<<<<<<<<<<<<
46064  *     cdef int *p_suboffset_dim = &suboffset_dim
46065  *     cdef Py_ssize_t start, stop, step
46066  */
46067   __pyx_v_p_dst = (&__pyx_v_dst);
46068 
46069   /* "View.MemoryView":738
46070  *
46071  *     cdef __Pyx_memviewslice *p_dst = &dst
46072  *     cdef int *p_suboffset_dim = &suboffset_dim             # <<<<<<<<<<<<<<
46073  *     cdef Py_ssize_t start, stop, step
46074  *     cdef bint have_start, have_stop, have_step
46075  */
46076   __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
46077 
46078   /* "View.MemoryView":742
46079  *     cdef bint have_start, have_stop, have_step
46080  *
46081  *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
46082  *         if PyIndex_Check(index):
46083  *             slice_memviewslice(
46084  */
46085   __pyx_t_6 = 0;
46086   if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
46087     __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
46088     __pyx_t_8 = NULL;
46089   } else {
46090     __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 742, __pyx_L1_error)
46091     __Pyx_GOTREF(__pyx_t_3);
46092     __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 742, __pyx_L1_error)
46093   }
46094   for (;;) {
46095     if (likely(!__pyx_t_8)) {
46096       if (likely(PyList_CheckExact(__pyx_t_3))) {
46097         if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
46098         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
46099         __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(4, 742, __pyx_L1_error)
46100         #else
46101         __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 742, __pyx_L1_error)
46102         __Pyx_GOTREF(__pyx_t_9);
46103         #endif
46104       } else {
46105         if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
46106         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
46107         __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(4, 742, __pyx_L1_error)
46108         #else
46109         __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 742, __pyx_L1_error)
46110         __Pyx_GOTREF(__pyx_t_9);
46111         #endif
46112       }
46113     } else {
46114       __pyx_t_9 = __pyx_t_8(__pyx_t_3);
46115       if (unlikely(!__pyx_t_9)) {
46116         PyObject* exc_type = PyErr_Occurred();
46117         if (exc_type) {
46118           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
46119           else __PYX_ERR(4, 742, __pyx_L1_error)
46120         }
46121         break;
46122       }
46123       __Pyx_GOTREF(__pyx_t_9);
46124     }
46125     __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
46126     __pyx_t_9 = 0;
46127     __pyx_v_dim = __pyx_t_6;
46128     __pyx_t_6 = (__pyx_t_6 + 1);
46129 
46130     /* "View.MemoryView":743
46131  *
46132  *     for dim, index in enumerate(indices):
46133  *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
46134  *             slice_memviewslice(
46135  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
46136  */
46137     __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
46138     if (__pyx_t_2) {
46139 
46140       /* "View.MemoryView":747
46141  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
46142  *                 dim, new_ndim, p_suboffset_dim,
46143  *                 index, 0, 0, # start, stop, step             # <<<<<<<<<<<<<<
46144  *                 0, 0, 0, # have_{start,stop,step}
46145  *                 False)
46146  */
46147       __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(4, 747, __pyx_L1_error)
46148 
46149       /* "View.MemoryView":744
46150  *     for dim, index in enumerate(indices):
46151  *         if PyIndex_Check(index):
46152  *             slice_memviewslice(             # <<<<<<<<<<<<<<
46153  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
46154  *                 dim, new_ndim, p_suboffset_dim,
46155  */
46156       __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(4, 744, __pyx_L1_error)
46157 
46158       /* "View.MemoryView":743
46159  *
46160  *     for dim, index in enumerate(indices):
46161  *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
46162  *             slice_memviewslice(
46163  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
46164  */
46165       goto __pyx_L6;
46166     }
46167 
46168     /* "View.MemoryView":750
46169  *                 0, 0, 0, # have_{start,stop,step}
46170  *                 False)
46171  *         elif index is None:             # <<<<<<<<<<<<<<
46172  *             p_dst.shape[new_ndim] = 1
46173  *             p_dst.strides[new_ndim] = 0
46174  */
46175     __pyx_t_2 = (__pyx_v_index == Py_None);
46176     __pyx_t_1 = (__pyx_t_2 != 0);
46177     if (__pyx_t_1) {
46178 
46179       /* "View.MemoryView":751
46180  *                 False)
46181  *         elif index is None:
46182  *             p_dst.shape[new_ndim] = 1             # <<<<<<<<<<<<<<
46183  *             p_dst.strides[new_ndim] = 0
46184  *             p_dst.suboffsets[new_ndim] = -1
46185  */
46186       (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
46187 
46188       /* "View.MemoryView":752
46189  *         elif index is None:
46190  *             p_dst.shape[new_ndim] = 1
46191  *             p_dst.strides[new_ndim] = 0             # <<<<<<<<<<<<<<
46192  *             p_dst.suboffsets[new_ndim] = -1
46193  *             new_ndim += 1
46194  */
46195       (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
46196 
46197       /* "View.MemoryView":753
46198  *             p_dst.shape[new_ndim] = 1
46199  *             p_dst.strides[new_ndim] = 0
46200  *             p_dst.suboffsets[new_ndim] = -1             # <<<<<<<<<<<<<<
46201  *             new_ndim += 1
46202  *         else:
46203  */
46204       (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
46205 
46206       /* "View.MemoryView":754
46207  *             p_dst.strides[new_ndim] = 0
46208  *             p_dst.suboffsets[new_ndim] = -1
46209  *             new_ndim += 1             # <<<<<<<<<<<<<<
46210  *         else:
46211  *             start = index.start or 0
46212  */
46213       __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
46214 
46215       /* "View.MemoryView":750
46216  *                 0, 0, 0, # have_{start,stop,step}
46217  *                 False)
46218  *         elif index is None:             # <<<<<<<<<<<<<<
46219  *             p_dst.shape[new_ndim] = 1
46220  *             p_dst.strides[new_ndim] = 0
46221  */
46222       goto __pyx_L6;
46223     }
46224 
46225     /* "View.MemoryView":756
46226  *             new_ndim += 1
46227  *         else:
46228  *             start = index.start or 0             # <<<<<<<<<<<<<<
46229  *             stop = index.stop or 0
46230  *             step = index.step or 0
46231  */
46232     /*else*/ {
46233       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 756, __pyx_L1_error)
46234       __Pyx_GOTREF(__pyx_t_9);
46235       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(4, 756, __pyx_L1_error)
46236       if (!__pyx_t_1) {
46237         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
46238       } else {
46239         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(4, 756, __pyx_L1_error)
46240         __pyx_t_10 = __pyx_t_12;
46241         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
46242         goto __pyx_L7_bool_binop_done;
46243       }
46244       __pyx_t_10 = 0;
46245       __pyx_L7_bool_binop_done:;
46246       __pyx_v_start = __pyx_t_10;
46247 
46248       /* "View.MemoryView":757
46249  *         else:
46250  *             start = index.start or 0
46251  *             stop = index.stop or 0             # <<<<<<<<<<<<<<
46252  *             step = index.step or 0
46253  *
46254  */
46255       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 757, __pyx_L1_error)
46256       __Pyx_GOTREF(__pyx_t_9);
46257       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(4, 757, __pyx_L1_error)
46258       if (!__pyx_t_1) {
46259         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
46260       } else {
46261         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(4, 757, __pyx_L1_error)
46262         __pyx_t_10 = __pyx_t_12;
46263         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
46264         goto __pyx_L9_bool_binop_done;
46265       }
46266       __pyx_t_10 = 0;
46267       __pyx_L9_bool_binop_done:;
46268       __pyx_v_stop = __pyx_t_10;
46269 
46270       /* "View.MemoryView":758
46271  *             start = index.start or 0
46272  *             stop = index.stop or 0
46273  *             step = index.step or 0             # <<<<<<<<<<<<<<
46274  *
46275  *             have_start = index.start is not None
46276  */
46277       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 758, __pyx_L1_error)
46278       __Pyx_GOTREF(__pyx_t_9);
46279       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(4, 758, __pyx_L1_error)
46280       if (!__pyx_t_1) {
46281         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
46282       } else {
46283         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(4, 758, __pyx_L1_error)
46284         __pyx_t_10 = __pyx_t_12;
46285         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
46286         goto __pyx_L11_bool_binop_done;
46287       }
46288       __pyx_t_10 = 0;
46289       __pyx_L11_bool_binop_done:;
46290       __pyx_v_step = __pyx_t_10;
46291 
46292       /* "View.MemoryView":760
46293  *             step = index.step or 0
46294  *
46295  *             have_start = index.start is not None             # <<<<<<<<<<<<<<
46296  *             have_stop = index.stop is not None
46297  *             have_step = index.step is not None
46298  */
46299       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 760, __pyx_L1_error)
46300       __Pyx_GOTREF(__pyx_t_9);
46301       __pyx_t_1 = (__pyx_t_9 != Py_None);
46302       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
46303       __pyx_v_have_start = __pyx_t_1;
46304 
46305       /* "View.MemoryView":761
46306  *
46307  *             have_start = index.start is not None
46308  *             have_stop = index.stop is not None             # <<<<<<<<<<<<<<
46309  *             have_step = index.step is not None
46310  *
46311  */
46312       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 761, __pyx_L1_error)
46313       __Pyx_GOTREF(__pyx_t_9);
46314       __pyx_t_1 = (__pyx_t_9 != Py_None);
46315       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
46316       __pyx_v_have_stop = __pyx_t_1;
46317 
46318       /* "View.MemoryView":762
46319  *             have_start = index.start is not None
46320  *             have_stop = index.stop is not None
46321  *             have_step = index.step is not None             # <<<<<<<<<<<<<<
46322  *
46323  *             slice_memviewslice(
46324  */
46325       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(4, 762, __pyx_L1_error)
46326       __Pyx_GOTREF(__pyx_t_9);
46327       __pyx_t_1 = (__pyx_t_9 != Py_None);
46328       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
46329       __pyx_v_have_step = __pyx_t_1;
46330 
46331       /* "View.MemoryView":764
46332  *             have_step = index.step is not None
46333  *
46334  *             slice_memviewslice(             # <<<<<<<<<<<<<<
46335  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
46336  *                 dim, new_ndim, p_suboffset_dim,
46337  */
46338       __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(4, 764, __pyx_L1_error)
46339 
46340       /* "View.MemoryView":770
46341  *                 have_start, have_stop, have_step,
46342  *                 True)
46343  *             new_ndim += 1             # <<<<<<<<<<<<<<
46344  *
46345  *     if isinstance(memview, _memoryviewslice):
46346  */
46347       __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
46348     }
46349     __pyx_L6:;
46350 
46351     /* "View.MemoryView":742
46352  *     cdef bint have_start, have_stop, have_step
46353  *
46354  *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
46355  *         if PyIndex_Check(index):
46356  *             slice_memviewslice(
46357  */
46358   }
46359   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
46360 
46361   /* "View.MemoryView":772
46362  *             new_ndim += 1
46363  *
46364  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
46365  *         return memoryview_fromslice(dst, new_ndim,
46366  *                                     memviewsliceobj.to_object_func,
46367  */
46368   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
46369   __pyx_t_2 = (__pyx_t_1 != 0);
46370   if (__pyx_t_2) {
46371 
46372     /* "View.MemoryView":773
46373  *
46374  *     if isinstance(memview, _memoryviewslice):
46375  *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
46376  *                                     memviewsliceobj.to_object_func,
46377  *                                     memviewsliceobj.to_dtype_func,
46378  */
46379     __Pyx_XDECREF(((PyObject *)__pyx_r));
46380 
46381     /* "View.MemoryView":774
46382  *     if isinstance(memview, _memoryviewslice):
46383  *         return memoryview_fromslice(dst, new_ndim,
46384  *                                     memviewsliceobj.to_object_func,             # <<<<<<<<<<<<<<
46385  *                                     memviewsliceobj.to_dtype_func,
46386  *                                     memview.dtype_is_object)
46387  */
46388     if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(4, 774, __pyx_L1_error) }
46389 
46390     /* "View.MemoryView":775
46391  *         return memoryview_fromslice(dst, new_ndim,
46392  *                                     memviewsliceobj.to_object_func,
46393  *                                     memviewsliceobj.to_dtype_func,             # <<<<<<<<<<<<<<
46394  *                                     memview.dtype_is_object)
46395  *     else:
46396  */
46397     if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(4, 775, __pyx_L1_error) }
46398 
46399     /* "View.MemoryView":773
46400  *
46401  *     if isinstance(memview, _memoryviewslice):
46402  *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
46403  *                                     memviewsliceobj.to_object_func,
46404  *                                     memviewsliceobj.to_dtype_func,
46405  */
46406     __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(4, 773, __pyx_L1_error)
46407     __Pyx_GOTREF(__pyx_t_3);
46408     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(4, 773, __pyx_L1_error)
46409     __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
46410     __pyx_t_3 = 0;
46411     goto __pyx_L0;
46412 
46413     /* "View.MemoryView":772
46414  *             new_ndim += 1
46415  *
46416  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
46417  *         return memoryview_fromslice(dst, new_ndim,
46418  *                                     memviewsliceobj.to_object_func,
46419  */
46420   }
46421 
46422   /* "View.MemoryView":778
46423  *                                     memview.dtype_is_object)
46424  *     else:
46425  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
46426  *                                     memview.dtype_is_object)
46427  *
46428  */
46429   /*else*/ {
46430     __Pyx_XDECREF(((PyObject *)__pyx_r));
46431 
46432     /* "View.MemoryView":779
46433  *     else:
46434  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
46435  *                                     memview.dtype_is_object)             # <<<<<<<<<<<<<<
46436  *
46437  *
46438  */
46439     __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(4, 778, __pyx_L1_error)
46440     __Pyx_GOTREF(__pyx_t_3);
46441 
46442     /* "View.MemoryView":778
46443  *                                     memview.dtype_is_object)
46444  *     else:
46445  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
46446  *                                     memview.dtype_is_object)
46447  *
46448  */
46449     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(4, 778, __pyx_L1_error)
46450     __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
46451     __pyx_t_3 = 0;
46452     goto __pyx_L0;
46453   }
46454 
46455   /* "View.MemoryView":706
46456  *
46457  * @cname('__pyx_memview_slice')
46458  * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
46459  *     cdef int new_ndim = 0, suboffset_dim = -1, dim
46460  *     cdef bint negative_step
46461  */
46462 
46463   /* function exit code */
46464   __pyx_L1_error:;
46465   __Pyx_XDECREF(__pyx_t_3);
46466   __Pyx_XDECREF(__pyx_t_9);
46467   __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
46468   __pyx_r = 0;
46469   __pyx_L0:;
46470   __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
46471   __Pyx_XDECREF(__pyx_v_index);
46472   __Pyx_XGIVEREF((PyObject *)__pyx_r);
46473   __Pyx_RefNannyFinishContext();
46474   return __pyx_r;
46475 }
46476 
46477 /* "View.MemoryView":803
46478  *
46479  * @cname('__pyx_memoryview_slice_memviewslice')
46480  * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
46481  *         __Pyx_memviewslice *dst,
46482  *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
46483  */
46484 
__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)46485 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) {
46486   Py_ssize_t __pyx_v_new_shape;
46487   int __pyx_v_negative_step;
46488   int __pyx_r;
46489   int __pyx_t_1;
46490   int __pyx_t_2;
46491   int __pyx_t_3;
46492 
46493   /* "View.MemoryView":823
46494  *     cdef bint negative_step
46495  *
46496  *     if not is_slice:             # <<<<<<<<<<<<<<
46497  *
46498  *         if start < 0:
46499  */
46500   __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
46501   if (__pyx_t_1) {
46502 
46503     /* "View.MemoryView":825
46504  *     if not is_slice:
46505  *
46506  *         if start < 0:             # <<<<<<<<<<<<<<
46507  *             start += shape
46508  *         if not 0 <= start < shape:
46509  */
46510     __pyx_t_1 = ((__pyx_v_start < 0) != 0);
46511     if (__pyx_t_1) {
46512 
46513       /* "View.MemoryView":826
46514  *
46515  *         if start < 0:
46516  *             start += shape             # <<<<<<<<<<<<<<
46517  *         if not 0 <= start < shape:
46518  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
46519  */
46520       __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
46521 
46522       /* "View.MemoryView":825
46523  *     if not is_slice:
46524  *
46525  *         if start < 0:             # <<<<<<<<<<<<<<
46526  *             start += shape
46527  *         if not 0 <= start < shape:
46528  */
46529     }
46530 
46531     /* "View.MemoryView":827
46532  *         if start < 0:
46533  *             start += shape
46534  *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
46535  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
46536  *     else:
46537  */
46538     __pyx_t_1 = (0 <= __pyx_v_start);
46539     if (__pyx_t_1) {
46540       __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
46541     }
46542     __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
46543     if (__pyx_t_2) {
46544 
46545       /* "View.MemoryView":828
46546  *             start += shape
46547  *         if not 0 <= start < shape:
46548  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)             # <<<<<<<<<<<<<<
46549  *     else:
46550  *
46551  */
46552       __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(4, 828, __pyx_L1_error)
46553 
46554       /* "View.MemoryView":827
46555  *         if start < 0:
46556  *             start += shape
46557  *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
46558  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
46559  *     else:
46560  */
46561     }
46562 
46563     /* "View.MemoryView":823
46564  *     cdef bint negative_step
46565  *
46566  *     if not is_slice:             # <<<<<<<<<<<<<<
46567  *
46568  *         if start < 0:
46569  */
46570     goto __pyx_L3;
46571   }
46572 
46573   /* "View.MemoryView":831
46574  *     else:
46575  *
46576  *         negative_step = have_step != 0 and step < 0             # <<<<<<<<<<<<<<
46577  *
46578  *         if have_step and step == 0:
46579  */
46580   /*else*/ {
46581     __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
46582     if (__pyx_t_1) {
46583     } else {
46584       __pyx_t_2 = __pyx_t_1;
46585       goto __pyx_L6_bool_binop_done;
46586     }
46587     __pyx_t_1 = ((__pyx_v_step < 0) != 0);
46588     __pyx_t_2 = __pyx_t_1;
46589     __pyx_L6_bool_binop_done:;
46590     __pyx_v_negative_step = __pyx_t_2;
46591 
46592     /* "View.MemoryView":833
46593  *         negative_step = have_step != 0 and step < 0
46594  *
46595  *         if have_step and step == 0:             # <<<<<<<<<<<<<<
46596  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
46597  *
46598  */
46599     __pyx_t_1 = (__pyx_v_have_step != 0);
46600     if (__pyx_t_1) {
46601     } else {
46602       __pyx_t_2 = __pyx_t_1;
46603       goto __pyx_L9_bool_binop_done;
46604     }
46605     __pyx_t_1 = ((__pyx_v_step == 0) != 0);
46606     __pyx_t_2 = __pyx_t_1;
46607     __pyx_L9_bool_binop_done:;
46608     if (__pyx_t_2) {
46609 
46610       /* "View.MemoryView":834
46611  *
46612  *         if have_step and step == 0:
46613  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)             # <<<<<<<<<<<<<<
46614  *
46615  *
46616  */
46617       __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(4, 834, __pyx_L1_error)
46618 
46619       /* "View.MemoryView":833
46620  *         negative_step = have_step != 0 and step < 0
46621  *
46622  *         if have_step and step == 0:             # <<<<<<<<<<<<<<
46623  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
46624  *
46625  */
46626     }
46627 
46628     /* "View.MemoryView":837
46629  *
46630  *
46631  *         if have_start:             # <<<<<<<<<<<<<<
46632  *             if start < 0:
46633  *                 start += shape
46634  */
46635     __pyx_t_2 = (__pyx_v_have_start != 0);
46636     if (__pyx_t_2) {
46637 
46638       /* "View.MemoryView":838
46639  *
46640  *         if have_start:
46641  *             if start < 0:             # <<<<<<<<<<<<<<
46642  *                 start += shape
46643  *                 if start < 0:
46644  */
46645       __pyx_t_2 = ((__pyx_v_start < 0) != 0);
46646       if (__pyx_t_2) {
46647 
46648         /* "View.MemoryView":839
46649  *         if have_start:
46650  *             if start < 0:
46651  *                 start += shape             # <<<<<<<<<<<<<<
46652  *                 if start < 0:
46653  *                     start = 0
46654  */
46655         __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
46656 
46657         /* "View.MemoryView":840
46658  *             if start < 0:
46659  *                 start += shape
46660  *                 if start < 0:             # <<<<<<<<<<<<<<
46661  *                     start = 0
46662  *             elif start >= shape:
46663  */
46664         __pyx_t_2 = ((__pyx_v_start < 0) != 0);
46665         if (__pyx_t_2) {
46666 
46667           /* "View.MemoryView":841
46668  *                 start += shape
46669  *                 if start < 0:
46670  *                     start = 0             # <<<<<<<<<<<<<<
46671  *             elif start >= shape:
46672  *                 if negative_step:
46673  */
46674           __pyx_v_start = 0;
46675 
46676           /* "View.MemoryView":840
46677  *             if start < 0:
46678  *                 start += shape
46679  *                 if start < 0:             # <<<<<<<<<<<<<<
46680  *                     start = 0
46681  *             elif start >= shape:
46682  */
46683         }
46684 
46685         /* "View.MemoryView":838
46686  *
46687  *         if have_start:
46688  *             if start < 0:             # <<<<<<<<<<<<<<
46689  *                 start += shape
46690  *                 if start < 0:
46691  */
46692         goto __pyx_L12;
46693       }
46694 
46695       /* "View.MemoryView":842
46696  *                 if start < 0:
46697  *                     start = 0
46698  *             elif start >= shape:             # <<<<<<<<<<<<<<
46699  *                 if negative_step:
46700  *                     start = shape - 1
46701  */
46702       __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
46703       if (__pyx_t_2) {
46704 
46705         /* "View.MemoryView":843
46706  *                     start = 0
46707  *             elif start >= shape:
46708  *                 if negative_step:             # <<<<<<<<<<<<<<
46709  *                     start = shape - 1
46710  *                 else:
46711  */
46712         __pyx_t_2 = (__pyx_v_negative_step != 0);
46713         if (__pyx_t_2) {
46714 
46715           /* "View.MemoryView":844
46716  *             elif start >= shape:
46717  *                 if negative_step:
46718  *                     start = shape - 1             # <<<<<<<<<<<<<<
46719  *                 else:
46720  *                     start = shape
46721  */
46722           __pyx_v_start = (__pyx_v_shape - 1);
46723 
46724           /* "View.MemoryView":843
46725  *                     start = 0
46726  *             elif start >= shape:
46727  *                 if negative_step:             # <<<<<<<<<<<<<<
46728  *                     start = shape - 1
46729  *                 else:
46730  */
46731           goto __pyx_L14;
46732         }
46733 
46734         /* "View.MemoryView":846
46735  *                     start = shape - 1
46736  *                 else:
46737  *                     start = shape             # <<<<<<<<<<<<<<
46738  *         else:
46739  *             if negative_step:
46740  */
46741         /*else*/ {
46742           __pyx_v_start = __pyx_v_shape;
46743         }
46744         __pyx_L14:;
46745 
46746         /* "View.MemoryView":842
46747  *                 if start < 0:
46748  *                     start = 0
46749  *             elif start >= shape:             # <<<<<<<<<<<<<<
46750  *                 if negative_step:
46751  *                     start = shape - 1
46752  */
46753       }
46754       __pyx_L12:;
46755 
46756       /* "View.MemoryView":837
46757  *
46758  *
46759  *         if have_start:             # <<<<<<<<<<<<<<
46760  *             if start < 0:
46761  *                 start += shape
46762  */
46763       goto __pyx_L11;
46764     }
46765 
46766     /* "View.MemoryView":848
46767  *                     start = shape
46768  *         else:
46769  *             if negative_step:             # <<<<<<<<<<<<<<
46770  *                 start = shape - 1
46771  *             else:
46772  */
46773     /*else*/ {
46774       __pyx_t_2 = (__pyx_v_negative_step != 0);
46775       if (__pyx_t_2) {
46776 
46777         /* "View.MemoryView":849
46778  *         else:
46779  *             if negative_step:
46780  *                 start = shape - 1             # <<<<<<<<<<<<<<
46781  *             else:
46782  *                 start = 0
46783  */
46784         __pyx_v_start = (__pyx_v_shape - 1);
46785 
46786         /* "View.MemoryView":848
46787  *                     start = shape
46788  *         else:
46789  *             if negative_step:             # <<<<<<<<<<<<<<
46790  *                 start = shape - 1
46791  *             else:
46792  */
46793         goto __pyx_L15;
46794       }
46795 
46796       /* "View.MemoryView":851
46797  *                 start = shape - 1
46798  *             else:
46799  *                 start = 0             # <<<<<<<<<<<<<<
46800  *
46801  *         if have_stop:
46802  */
46803       /*else*/ {
46804         __pyx_v_start = 0;
46805       }
46806       __pyx_L15:;
46807     }
46808     __pyx_L11:;
46809 
46810     /* "View.MemoryView":853
46811  *                 start = 0
46812  *
46813  *         if have_stop:             # <<<<<<<<<<<<<<
46814  *             if stop < 0:
46815  *                 stop += shape
46816  */
46817     __pyx_t_2 = (__pyx_v_have_stop != 0);
46818     if (__pyx_t_2) {
46819 
46820       /* "View.MemoryView":854
46821  *
46822  *         if have_stop:
46823  *             if stop < 0:             # <<<<<<<<<<<<<<
46824  *                 stop += shape
46825  *                 if stop < 0:
46826  */
46827       __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
46828       if (__pyx_t_2) {
46829 
46830         /* "View.MemoryView":855
46831  *         if have_stop:
46832  *             if stop < 0:
46833  *                 stop += shape             # <<<<<<<<<<<<<<
46834  *                 if stop < 0:
46835  *                     stop = 0
46836  */
46837         __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
46838 
46839         /* "View.MemoryView":856
46840  *             if stop < 0:
46841  *                 stop += shape
46842  *                 if stop < 0:             # <<<<<<<<<<<<<<
46843  *                     stop = 0
46844  *             elif stop > shape:
46845  */
46846         __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
46847         if (__pyx_t_2) {
46848 
46849           /* "View.MemoryView":857
46850  *                 stop += shape
46851  *                 if stop < 0:
46852  *                     stop = 0             # <<<<<<<<<<<<<<
46853  *             elif stop > shape:
46854  *                 stop = shape
46855  */
46856           __pyx_v_stop = 0;
46857 
46858           /* "View.MemoryView":856
46859  *             if stop < 0:
46860  *                 stop += shape
46861  *                 if stop < 0:             # <<<<<<<<<<<<<<
46862  *                     stop = 0
46863  *             elif stop > shape:
46864  */
46865         }
46866 
46867         /* "View.MemoryView":854
46868  *
46869  *         if have_stop:
46870  *             if stop < 0:             # <<<<<<<<<<<<<<
46871  *                 stop += shape
46872  *                 if stop < 0:
46873  */
46874         goto __pyx_L17;
46875       }
46876 
46877       /* "View.MemoryView":858
46878  *                 if stop < 0:
46879  *                     stop = 0
46880  *             elif stop > shape:             # <<<<<<<<<<<<<<
46881  *                 stop = shape
46882  *         else:
46883  */
46884       __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
46885       if (__pyx_t_2) {
46886 
46887         /* "View.MemoryView":859
46888  *                     stop = 0
46889  *             elif stop > shape:
46890  *                 stop = shape             # <<<<<<<<<<<<<<
46891  *         else:
46892  *             if negative_step:
46893  */
46894         __pyx_v_stop = __pyx_v_shape;
46895 
46896         /* "View.MemoryView":858
46897  *                 if stop < 0:
46898  *                     stop = 0
46899  *             elif stop > shape:             # <<<<<<<<<<<<<<
46900  *                 stop = shape
46901  *         else:
46902  */
46903       }
46904       __pyx_L17:;
46905 
46906       /* "View.MemoryView":853
46907  *                 start = 0
46908  *
46909  *         if have_stop:             # <<<<<<<<<<<<<<
46910  *             if stop < 0:
46911  *                 stop += shape
46912  */
46913       goto __pyx_L16;
46914     }
46915 
46916     /* "View.MemoryView":861
46917  *                 stop = shape
46918  *         else:
46919  *             if negative_step:             # <<<<<<<<<<<<<<
46920  *                 stop = -1
46921  *             else:
46922  */
46923     /*else*/ {
46924       __pyx_t_2 = (__pyx_v_negative_step != 0);
46925       if (__pyx_t_2) {
46926 
46927         /* "View.MemoryView":862
46928  *         else:
46929  *             if negative_step:
46930  *                 stop = -1             # <<<<<<<<<<<<<<
46931  *             else:
46932  *                 stop = shape
46933  */
46934         __pyx_v_stop = -1L;
46935 
46936         /* "View.MemoryView":861
46937  *                 stop = shape
46938  *         else:
46939  *             if negative_step:             # <<<<<<<<<<<<<<
46940  *                 stop = -1
46941  *             else:
46942  */
46943         goto __pyx_L19;
46944       }
46945 
46946       /* "View.MemoryView":864
46947  *                 stop = -1
46948  *             else:
46949  *                 stop = shape             # <<<<<<<<<<<<<<
46950  *
46951  *         if not have_step:
46952  */
46953       /*else*/ {
46954         __pyx_v_stop = __pyx_v_shape;
46955       }
46956       __pyx_L19:;
46957     }
46958     __pyx_L16:;
46959 
46960     /* "View.MemoryView":866
46961  *                 stop = shape
46962  *
46963  *         if not have_step:             # <<<<<<<<<<<<<<
46964  *             step = 1
46965  *
46966  */
46967     __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
46968     if (__pyx_t_2) {
46969 
46970       /* "View.MemoryView":867
46971  *
46972  *         if not have_step:
46973  *             step = 1             # <<<<<<<<<<<<<<
46974  *
46975  *
46976  */
46977       __pyx_v_step = 1;
46978 
46979       /* "View.MemoryView":866
46980  *                 stop = shape
46981  *
46982  *         if not have_step:             # <<<<<<<<<<<<<<
46983  *             step = 1
46984  *
46985  */
46986     }
46987 
46988     /* "View.MemoryView":871
46989  *
46990  *         with cython.cdivision(True):
46991  *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
46992  *
46993  *             if (stop - start) - step * new_shape:
46994  */
46995     __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
46996 
46997     /* "View.MemoryView":873
46998  *             new_shape = (stop - start) // step
46999  *
47000  *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
47001  *                 new_shape += 1
47002  *
47003  */
47004     __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
47005     if (__pyx_t_2) {
47006 
47007       /* "View.MemoryView":874
47008  *
47009  *             if (stop - start) - step * new_shape:
47010  *                 new_shape += 1             # <<<<<<<<<<<<<<
47011  *
47012  *         if new_shape < 0:
47013  */
47014       __pyx_v_new_shape = (__pyx_v_new_shape + 1);
47015 
47016       /* "View.MemoryView":873
47017  *             new_shape = (stop - start) // step
47018  *
47019  *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
47020  *                 new_shape += 1
47021  *
47022  */
47023     }
47024 
47025     /* "View.MemoryView":876
47026  *                 new_shape += 1
47027  *
47028  *         if new_shape < 0:             # <<<<<<<<<<<<<<
47029  *             new_shape = 0
47030  *
47031  */
47032     __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
47033     if (__pyx_t_2) {
47034 
47035       /* "View.MemoryView":877
47036  *
47037  *         if new_shape < 0:
47038  *             new_shape = 0             # <<<<<<<<<<<<<<
47039  *
47040  *
47041  */
47042       __pyx_v_new_shape = 0;
47043 
47044       /* "View.MemoryView":876
47045  *                 new_shape += 1
47046  *
47047  *         if new_shape < 0:             # <<<<<<<<<<<<<<
47048  *             new_shape = 0
47049  *
47050  */
47051     }
47052 
47053     /* "View.MemoryView":880
47054  *
47055  *
47056  *         dst.strides[new_ndim] = stride * step             # <<<<<<<<<<<<<<
47057  *         dst.shape[new_ndim] = new_shape
47058  *         dst.suboffsets[new_ndim] = suboffset
47059  */
47060     (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
47061 
47062     /* "View.MemoryView":881
47063  *
47064  *         dst.strides[new_ndim] = stride * step
47065  *         dst.shape[new_ndim] = new_shape             # <<<<<<<<<<<<<<
47066  *         dst.suboffsets[new_ndim] = suboffset
47067  *
47068  */
47069     (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
47070 
47071     /* "View.MemoryView":882
47072  *         dst.strides[new_ndim] = stride * step
47073  *         dst.shape[new_ndim] = new_shape
47074  *         dst.suboffsets[new_ndim] = suboffset             # <<<<<<<<<<<<<<
47075  *
47076  *
47077  */
47078     (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
47079   }
47080   __pyx_L3:;
47081 
47082   /* "View.MemoryView":885
47083  *
47084  *
47085  *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
47086  *         dst.data += start * stride
47087  *     else:
47088  */
47089   __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
47090   if (__pyx_t_2) {
47091 
47092     /* "View.MemoryView":886
47093  *
47094  *     if suboffset_dim[0] < 0:
47095  *         dst.data += start * stride             # <<<<<<<<<<<<<<
47096  *     else:
47097  *         dst.suboffsets[suboffset_dim[0]] += start * stride
47098  */
47099     __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
47100 
47101     /* "View.MemoryView":885
47102  *
47103  *
47104  *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
47105  *         dst.data += start * stride
47106  *     else:
47107  */
47108     goto __pyx_L23;
47109   }
47110 
47111   /* "View.MemoryView":888
47112  *         dst.data += start * stride
47113  *     else:
47114  *         dst.suboffsets[suboffset_dim[0]] += start * stride             # <<<<<<<<<<<<<<
47115  *
47116  *     if suboffset >= 0:
47117  */
47118   /*else*/ {
47119     __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
47120     (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
47121   }
47122   __pyx_L23:;
47123 
47124   /* "View.MemoryView":890
47125  *         dst.suboffsets[suboffset_dim[0]] += start * stride
47126  *
47127  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
47128  *         if not is_slice:
47129  *             if new_ndim == 0:
47130  */
47131   __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
47132   if (__pyx_t_2) {
47133 
47134     /* "View.MemoryView":891
47135  *
47136  *     if suboffset >= 0:
47137  *         if not is_slice:             # <<<<<<<<<<<<<<
47138  *             if new_ndim == 0:
47139  *                 dst.data = (<char **> dst.data)[0] + suboffset
47140  */
47141     __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
47142     if (__pyx_t_2) {
47143 
47144       /* "View.MemoryView":892
47145  *     if suboffset >= 0:
47146  *         if not is_slice:
47147  *             if new_ndim == 0:             # <<<<<<<<<<<<<<
47148  *                 dst.data = (<char **> dst.data)[0] + suboffset
47149  *             else:
47150  */
47151       __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
47152       if (__pyx_t_2) {
47153 
47154         /* "View.MemoryView":893
47155  *         if not is_slice:
47156  *             if new_ndim == 0:
47157  *                 dst.data = (<char **> dst.data)[0] + suboffset             # <<<<<<<<<<<<<<
47158  *             else:
47159  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
47160  */
47161         __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
47162 
47163         /* "View.MemoryView":892
47164  *     if suboffset >= 0:
47165  *         if not is_slice:
47166  *             if new_ndim == 0:             # <<<<<<<<<<<<<<
47167  *                 dst.data = (<char **> dst.data)[0] + suboffset
47168  *             else:
47169  */
47170         goto __pyx_L26;
47171       }
47172 
47173       /* "View.MemoryView":895
47174  *                 dst.data = (<char **> dst.data)[0] + suboffset
47175  *             else:
47176  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "             # <<<<<<<<<<<<<<
47177  *                                      "must be indexed and not sliced", dim)
47178  *         else:
47179  */
47180       /*else*/ {
47181 
47182         /* "View.MemoryView":896
47183  *             else:
47184  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
47185  *                                      "must be indexed and not sliced", dim)             # <<<<<<<<<<<<<<
47186  *         else:
47187  *             suboffset_dim[0] = new_ndim
47188  */
47189         __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(4, 895, __pyx_L1_error)
47190       }
47191       __pyx_L26:;
47192 
47193       /* "View.MemoryView":891
47194  *
47195  *     if suboffset >= 0:
47196  *         if not is_slice:             # <<<<<<<<<<<<<<
47197  *             if new_ndim == 0:
47198  *                 dst.data = (<char **> dst.data)[0] + suboffset
47199  */
47200       goto __pyx_L25;
47201     }
47202 
47203     /* "View.MemoryView":898
47204  *                                      "must be indexed and not sliced", dim)
47205  *         else:
47206  *             suboffset_dim[0] = new_ndim             # <<<<<<<<<<<<<<
47207  *
47208  *     return 0
47209  */
47210     /*else*/ {
47211       (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
47212     }
47213     __pyx_L25:;
47214 
47215     /* "View.MemoryView":890
47216  *         dst.suboffsets[suboffset_dim[0]] += start * stride
47217  *
47218  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
47219  *         if not is_slice:
47220  *             if new_ndim == 0:
47221  */
47222   }
47223 
47224   /* "View.MemoryView":900
47225  *             suboffset_dim[0] = new_ndim
47226  *
47227  *     return 0             # <<<<<<<<<<<<<<
47228  *
47229  *
47230  */
47231   __pyx_r = 0;
47232   goto __pyx_L0;
47233 
47234   /* "View.MemoryView":803
47235  *
47236  * @cname('__pyx_memoryview_slice_memviewslice')
47237  * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
47238  *         __Pyx_memviewslice *dst,
47239  *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
47240  */
47241 
47242   /* function exit code */
47243   __pyx_L1_error:;
47244   {
47245     #ifdef WITH_THREAD
47246     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
47247     #endif
47248     __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
47249     #ifdef WITH_THREAD
47250     __Pyx_PyGILState_Release(__pyx_gilstate_save);
47251     #endif
47252   }
47253   __pyx_r = -1;
47254   __pyx_L0:;
47255   return __pyx_r;
47256 }
47257 
47258 /* "View.MemoryView":906
47259  *
47260  * @cname('__pyx_pybuffer_index')
47261  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
47262  *                           Py_ssize_t dim) except NULL:
47263  *     cdef Py_ssize_t shape, stride, suboffset = -1
47264  */
47265 
__pyx_pybuffer_index(Py_buffer * __pyx_v_view,char * __pyx_v_bufp,Py_ssize_t __pyx_v_index,Py_ssize_t __pyx_v_dim)47266 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) {
47267   Py_ssize_t __pyx_v_shape;
47268   Py_ssize_t __pyx_v_stride;
47269   Py_ssize_t __pyx_v_suboffset;
47270   Py_ssize_t __pyx_v_itemsize;
47271   char *__pyx_v_resultp;
47272   char *__pyx_r;
47273   __Pyx_RefNannyDeclarations
47274   Py_ssize_t __pyx_t_1;
47275   int __pyx_t_2;
47276   PyObject *__pyx_t_3 = NULL;
47277   PyObject *__pyx_t_4 = NULL;
47278   __Pyx_RefNannySetupContext("pybuffer_index", 0);
47279 
47280   /* "View.MemoryView":908
47281  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
47282  *                           Py_ssize_t dim) except NULL:
47283  *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
47284  *     cdef Py_ssize_t itemsize = view.itemsize
47285  *     cdef char *resultp
47286  */
47287   __pyx_v_suboffset = -1L;
47288 
47289   /* "View.MemoryView":909
47290  *                           Py_ssize_t dim) except NULL:
47291  *     cdef Py_ssize_t shape, stride, suboffset = -1
47292  *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
47293  *     cdef char *resultp
47294  *
47295  */
47296   __pyx_t_1 = __pyx_v_view->itemsize;
47297   __pyx_v_itemsize = __pyx_t_1;
47298 
47299   /* "View.MemoryView":912
47300  *     cdef char *resultp
47301  *
47302  *     if view.ndim == 0:             # <<<<<<<<<<<<<<
47303  *         shape = view.len / itemsize
47304  *         stride = itemsize
47305  */
47306   __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
47307   if (__pyx_t_2) {
47308 
47309     /* "View.MemoryView":913
47310  *
47311  *     if view.ndim == 0:
47312  *         shape = view.len / itemsize             # <<<<<<<<<<<<<<
47313  *         stride = itemsize
47314  *     else:
47315  */
47316     if (unlikely(__pyx_v_itemsize == 0)) {
47317       PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
47318       __PYX_ERR(4, 913, __pyx_L1_error)
47319     }
47320     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))) {
47321       PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
47322       __PYX_ERR(4, 913, __pyx_L1_error)
47323     }
47324     __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
47325 
47326     /* "View.MemoryView":914
47327  *     if view.ndim == 0:
47328  *         shape = view.len / itemsize
47329  *         stride = itemsize             # <<<<<<<<<<<<<<
47330  *     else:
47331  *         shape = view.shape[dim]
47332  */
47333     __pyx_v_stride = __pyx_v_itemsize;
47334 
47335     /* "View.MemoryView":912
47336  *     cdef char *resultp
47337  *
47338  *     if view.ndim == 0:             # <<<<<<<<<<<<<<
47339  *         shape = view.len / itemsize
47340  *         stride = itemsize
47341  */
47342     goto __pyx_L3;
47343   }
47344 
47345   /* "View.MemoryView":916
47346  *         stride = itemsize
47347  *     else:
47348  *         shape = view.shape[dim]             # <<<<<<<<<<<<<<
47349  *         stride = view.strides[dim]
47350  *         if view.suboffsets != NULL:
47351  */
47352   /*else*/ {
47353     __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
47354 
47355     /* "View.MemoryView":917
47356  *     else:
47357  *         shape = view.shape[dim]
47358  *         stride = view.strides[dim]             # <<<<<<<<<<<<<<
47359  *         if view.suboffsets != NULL:
47360  *             suboffset = view.suboffsets[dim]
47361  */
47362     __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
47363 
47364     /* "View.MemoryView":918
47365  *         shape = view.shape[dim]
47366  *         stride = view.strides[dim]
47367  *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
47368  *             suboffset = view.suboffsets[dim]
47369  *
47370  */
47371     __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
47372     if (__pyx_t_2) {
47373 
47374       /* "View.MemoryView":919
47375  *         stride = view.strides[dim]
47376  *         if view.suboffsets != NULL:
47377  *             suboffset = view.suboffsets[dim]             # <<<<<<<<<<<<<<
47378  *
47379  *     if index < 0:
47380  */
47381       __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
47382 
47383       /* "View.MemoryView":918
47384  *         shape = view.shape[dim]
47385  *         stride = view.strides[dim]
47386  *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
47387  *             suboffset = view.suboffsets[dim]
47388  *
47389  */
47390     }
47391   }
47392   __pyx_L3:;
47393 
47394   /* "View.MemoryView":921
47395  *             suboffset = view.suboffsets[dim]
47396  *
47397  *     if index < 0:             # <<<<<<<<<<<<<<
47398  *         index += view.shape[dim]
47399  *         if index < 0:
47400  */
47401   __pyx_t_2 = ((__pyx_v_index < 0) != 0);
47402   if (__pyx_t_2) {
47403 
47404     /* "View.MemoryView":922
47405  *
47406  *     if index < 0:
47407  *         index += view.shape[dim]             # <<<<<<<<<<<<<<
47408  *         if index < 0:
47409  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
47410  */
47411     __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
47412 
47413     /* "View.MemoryView":923
47414  *     if index < 0:
47415  *         index += view.shape[dim]
47416  *         if index < 0:             # <<<<<<<<<<<<<<
47417  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
47418  *
47419  */
47420     __pyx_t_2 = ((__pyx_v_index < 0) != 0);
47421     if (unlikely(__pyx_t_2)) {
47422 
47423       /* "View.MemoryView":924
47424  *         index += view.shape[dim]
47425  *         if index < 0:
47426  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
47427  *
47428  *     if index >= shape:
47429  */
47430       __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 924, __pyx_L1_error)
47431       __Pyx_GOTREF(__pyx_t_3);
47432       __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(4, 924, __pyx_L1_error)
47433       __Pyx_GOTREF(__pyx_t_4);
47434       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
47435       __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 924, __pyx_L1_error)
47436       __Pyx_GOTREF(__pyx_t_3);
47437       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
47438       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
47439       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
47440       __PYX_ERR(4, 924, __pyx_L1_error)
47441 
47442       /* "View.MemoryView":923
47443  *     if index < 0:
47444  *         index += view.shape[dim]
47445  *         if index < 0:             # <<<<<<<<<<<<<<
47446  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
47447  *
47448  */
47449     }
47450 
47451     /* "View.MemoryView":921
47452  *             suboffset = view.suboffsets[dim]
47453  *
47454  *     if index < 0:             # <<<<<<<<<<<<<<
47455  *         index += view.shape[dim]
47456  *         if index < 0:
47457  */
47458   }
47459 
47460   /* "View.MemoryView":926
47461  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
47462  *
47463  *     if index >= shape:             # <<<<<<<<<<<<<<
47464  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
47465  *
47466  */
47467   __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
47468   if (unlikely(__pyx_t_2)) {
47469 
47470     /* "View.MemoryView":927
47471  *
47472  *     if index >= shape:
47473  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
47474  *
47475  *     resultp = bufp + index * stride
47476  */
47477     __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 927, __pyx_L1_error)
47478     __Pyx_GOTREF(__pyx_t_3);
47479     __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(4, 927, __pyx_L1_error)
47480     __Pyx_GOTREF(__pyx_t_4);
47481     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
47482     __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 927, __pyx_L1_error)
47483     __Pyx_GOTREF(__pyx_t_3);
47484     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
47485     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
47486     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
47487     __PYX_ERR(4, 927, __pyx_L1_error)
47488 
47489     /* "View.MemoryView":926
47490  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
47491  *
47492  *     if index >= shape:             # <<<<<<<<<<<<<<
47493  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
47494  *
47495  */
47496   }
47497 
47498   /* "View.MemoryView":929
47499  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
47500  *
47501  *     resultp = bufp + index * stride             # <<<<<<<<<<<<<<
47502  *     if suboffset >= 0:
47503  *         resultp = (<char **> resultp)[0] + suboffset
47504  */
47505   __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
47506 
47507   /* "View.MemoryView":930
47508  *
47509  *     resultp = bufp + index * stride
47510  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
47511  *         resultp = (<char **> resultp)[0] + suboffset
47512  *
47513  */
47514   __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
47515   if (__pyx_t_2) {
47516 
47517     /* "View.MemoryView":931
47518  *     resultp = bufp + index * stride
47519  *     if suboffset >= 0:
47520  *         resultp = (<char **> resultp)[0] + suboffset             # <<<<<<<<<<<<<<
47521  *
47522  *     return resultp
47523  */
47524     __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
47525 
47526     /* "View.MemoryView":930
47527  *
47528  *     resultp = bufp + index * stride
47529  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
47530  *         resultp = (<char **> resultp)[0] + suboffset
47531  *
47532  */
47533   }
47534 
47535   /* "View.MemoryView":933
47536  *         resultp = (<char **> resultp)[0] + suboffset
47537  *
47538  *     return resultp             # <<<<<<<<<<<<<<
47539  *
47540  *
47541  */
47542   __pyx_r = __pyx_v_resultp;
47543   goto __pyx_L0;
47544 
47545   /* "View.MemoryView":906
47546  *
47547  * @cname('__pyx_pybuffer_index')
47548  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
47549  *                           Py_ssize_t dim) except NULL:
47550  *     cdef Py_ssize_t shape, stride, suboffset = -1
47551  */
47552 
47553   /* function exit code */
47554   __pyx_L1_error:;
47555   __Pyx_XDECREF(__pyx_t_3);
47556   __Pyx_XDECREF(__pyx_t_4);
47557   __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
47558   __pyx_r = NULL;
47559   __pyx_L0:;
47560   __Pyx_RefNannyFinishContext();
47561   return __pyx_r;
47562 }
47563 
47564 /* "View.MemoryView":939
47565  *
47566  * @cname('__pyx_memslice_transpose')
47567  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
47568  *     cdef int ndim = memslice.memview.view.ndim
47569  *
47570  */
47571 
__pyx_memslice_transpose(__Pyx_memviewslice * __pyx_v_memslice)47572 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
47573   int __pyx_v_ndim;
47574   Py_ssize_t *__pyx_v_shape;
47575   Py_ssize_t *__pyx_v_strides;
47576   int __pyx_v_i;
47577   int __pyx_v_j;
47578   int __pyx_r;
47579   int __pyx_t_1;
47580   Py_ssize_t *__pyx_t_2;
47581   long __pyx_t_3;
47582   long __pyx_t_4;
47583   Py_ssize_t __pyx_t_5;
47584   Py_ssize_t __pyx_t_6;
47585   int __pyx_t_7;
47586   int __pyx_t_8;
47587   int __pyx_t_9;
47588 
47589   /* "View.MemoryView":940
47590  * @cname('__pyx_memslice_transpose')
47591  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
47592  *     cdef int ndim = memslice.memview.view.ndim             # <<<<<<<<<<<<<<
47593  *
47594  *     cdef Py_ssize_t *shape = memslice.shape
47595  */
47596   __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
47597   __pyx_v_ndim = __pyx_t_1;
47598 
47599   /* "View.MemoryView":942
47600  *     cdef int ndim = memslice.memview.view.ndim
47601  *
47602  *     cdef Py_ssize_t *shape = memslice.shape             # <<<<<<<<<<<<<<
47603  *     cdef Py_ssize_t *strides = memslice.strides
47604  *
47605  */
47606   __pyx_t_2 = __pyx_v_memslice->shape;
47607   __pyx_v_shape = __pyx_t_2;
47608 
47609   /* "View.MemoryView":943
47610  *
47611  *     cdef Py_ssize_t *shape = memslice.shape
47612  *     cdef Py_ssize_t *strides = memslice.strides             # <<<<<<<<<<<<<<
47613  *
47614  *
47615  */
47616   __pyx_t_2 = __pyx_v_memslice->strides;
47617   __pyx_v_strides = __pyx_t_2;
47618 
47619   /* "View.MemoryView":947
47620  *
47621  *     cdef int i, j
47622  *     for i in range(ndim / 2):             # <<<<<<<<<<<<<<
47623  *         j = ndim - 1 - i
47624  *         strides[i], strides[j] = strides[j], strides[i]
47625  */
47626   __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
47627   __pyx_t_4 = __pyx_t_3;
47628   for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
47629     __pyx_v_i = __pyx_t_1;
47630 
47631     /* "View.MemoryView":948
47632  *     cdef int i, j
47633  *     for i in range(ndim / 2):
47634  *         j = ndim - 1 - i             # <<<<<<<<<<<<<<
47635  *         strides[i], strides[j] = strides[j], strides[i]
47636  *         shape[i], shape[j] = shape[j], shape[i]
47637  */
47638     __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
47639 
47640     /* "View.MemoryView":949
47641  *     for i in range(ndim / 2):
47642  *         j = ndim - 1 - i
47643  *         strides[i], strides[j] = strides[j], strides[i]             # <<<<<<<<<<<<<<
47644  *         shape[i], shape[j] = shape[j], shape[i]
47645  *
47646  */
47647     __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
47648     __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
47649     (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
47650     (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
47651 
47652     /* "View.MemoryView":950
47653  *         j = ndim - 1 - i
47654  *         strides[i], strides[j] = strides[j], strides[i]
47655  *         shape[i], shape[j] = shape[j], shape[i]             # <<<<<<<<<<<<<<
47656  *
47657  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
47658  */
47659     __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
47660     __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
47661     (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
47662     (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
47663 
47664     /* "View.MemoryView":952
47665  *         shape[i], shape[j] = shape[j], shape[i]
47666  *
47667  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
47668  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
47669  *
47670  */
47671     __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
47672     if (!__pyx_t_8) {
47673     } else {
47674       __pyx_t_7 = __pyx_t_8;
47675       goto __pyx_L6_bool_binop_done;
47676     }
47677     __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
47678     __pyx_t_7 = __pyx_t_8;
47679     __pyx_L6_bool_binop_done:;
47680     if (__pyx_t_7) {
47681 
47682       /* "View.MemoryView":953
47683  *
47684  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
47685  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")             # <<<<<<<<<<<<<<
47686  *
47687  *     return 1
47688  */
47689       __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(4, 953, __pyx_L1_error)
47690 
47691       /* "View.MemoryView":952
47692  *         shape[i], shape[j] = shape[j], shape[i]
47693  *
47694  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
47695  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
47696  *
47697  */
47698     }
47699   }
47700 
47701   /* "View.MemoryView":955
47702  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
47703  *
47704  *     return 1             # <<<<<<<<<<<<<<
47705  *
47706  *
47707  */
47708   __pyx_r = 1;
47709   goto __pyx_L0;
47710 
47711   /* "View.MemoryView":939
47712  *
47713  * @cname('__pyx_memslice_transpose')
47714  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
47715  *     cdef int ndim = memslice.memview.view.ndim
47716  *
47717  */
47718 
47719   /* function exit code */
47720   __pyx_L1_error:;
47721   {
47722     #ifdef WITH_THREAD
47723     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
47724     #endif
47725     __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
47726     #ifdef WITH_THREAD
47727     __Pyx_PyGILState_Release(__pyx_gilstate_save);
47728     #endif
47729   }
47730   __pyx_r = 0;
47731   __pyx_L0:;
47732   return __pyx_r;
47733 }
47734 
47735 /* "View.MemoryView":972
47736  *     cdef int (*to_dtype_func)(char *, object) except 0
47737  *
47738  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
47739  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
47740  *
47741  */
47742 
47743 /* Python wrapper */
47744 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryviewslice___dealloc__(PyObject * __pyx_v_self)47745 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
47746   __Pyx_RefNannyDeclarations
47747   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
47748   __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
47749 
47750   /* function exit code */
47751   __Pyx_RefNannyFinishContext();
47752 }
47753 
__pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj * __pyx_v_self)47754 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
47755   __Pyx_RefNannyDeclarations
47756   __Pyx_RefNannySetupContext("__dealloc__", 0);
47757 
47758   /* "View.MemoryView":973
47759  *
47760  *     def __dealloc__(self):
47761  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)             # <<<<<<<<<<<<<<
47762  *
47763  *     cdef convert_item_to_object(self, char *itemp):
47764  */
47765   __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
47766 
47767   /* "View.MemoryView":972
47768  *     cdef int (*to_dtype_func)(char *, object) except 0
47769  *
47770  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
47771  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
47772  *
47773  */
47774 
47775   /* function exit code */
47776   __Pyx_RefNannyFinishContext();
47777 }
47778 
47779 /* "View.MemoryView":975
47780  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
47781  *
47782  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
47783  *         if self.to_object_func != NULL:
47784  *             return self.to_object_func(itemp)
47785  */
47786 
__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj * __pyx_v_self,char * __pyx_v_itemp)47787 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
47788   PyObject *__pyx_r = NULL;
47789   __Pyx_RefNannyDeclarations
47790   int __pyx_t_1;
47791   PyObject *__pyx_t_2 = NULL;
47792   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
47793 
47794   /* "View.MemoryView":976
47795  *
47796  *     cdef convert_item_to_object(self, char *itemp):
47797  *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
47798  *             return self.to_object_func(itemp)
47799  *         else:
47800  */
47801   __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
47802   if (__pyx_t_1) {
47803 
47804     /* "View.MemoryView":977
47805  *     cdef convert_item_to_object(self, char *itemp):
47806  *         if self.to_object_func != NULL:
47807  *             return self.to_object_func(itemp)             # <<<<<<<<<<<<<<
47808  *         else:
47809  *             return memoryview.convert_item_to_object(self, itemp)
47810  */
47811     __Pyx_XDECREF(__pyx_r);
47812     __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 977, __pyx_L1_error)
47813     __Pyx_GOTREF(__pyx_t_2);
47814     __pyx_r = __pyx_t_2;
47815     __pyx_t_2 = 0;
47816     goto __pyx_L0;
47817 
47818     /* "View.MemoryView":976
47819  *
47820  *     cdef convert_item_to_object(self, char *itemp):
47821  *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
47822  *             return self.to_object_func(itemp)
47823  *         else:
47824  */
47825   }
47826 
47827   /* "View.MemoryView":979
47828  *             return self.to_object_func(itemp)
47829  *         else:
47830  *             return memoryview.convert_item_to_object(self, itemp)             # <<<<<<<<<<<<<<
47831  *
47832  *     cdef assign_item_from_object(self, char *itemp, object value):
47833  */
47834   /*else*/ {
47835     __Pyx_XDECREF(__pyx_r);
47836     __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(4, 979, __pyx_L1_error)
47837     __Pyx_GOTREF(__pyx_t_2);
47838     __pyx_r = __pyx_t_2;
47839     __pyx_t_2 = 0;
47840     goto __pyx_L0;
47841   }
47842 
47843   /* "View.MemoryView":975
47844  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
47845  *
47846  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
47847  *         if self.to_object_func != NULL:
47848  *             return self.to_object_func(itemp)
47849  */
47850 
47851   /* function exit code */
47852   __pyx_L1_error:;
47853   __Pyx_XDECREF(__pyx_t_2);
47854   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
47855   __pyx_r = 0;
47856   __pyx_L0:;
47857   __Pyx_XGIVEREF(__pyx_r);
47858   __Pyx_RefNannyFinishContext();
47859   return __pyx_r;
47860 }
47861 
47862 /* "View.MemoryView":981
47863  *             return memoryview.convert_item_to_object(self, itemp)
47864  *
47865  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
47866  *         if self.to_dtype_func != NULL:
47867  *             self.to_dtype_func(itemp, value)
47868  */
47869 
__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj * __pyx_v_self,char * __pyx_v_itemp,PyObject * __pyx_v_value)47870 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
47871   PyObject *__pyx_r = NULL;
47872   __Pyx_RefNannyDeclarations
47873   int __pyx_t_1;
47874   int __pyx_t_2;
47875   PyObject *__pyx_t_3 = NULL;
47876   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
47877 
47878   /* "View.MemoryView":982
47879  *
47880  *     cdef assign_item_from_object(self, char *itemp, object value):
47881  *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
47882  *             self.to_dtype_func(itemp, value)
47883  *         else:
47884  */
47885   __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
47886   if (__pyx_t_1) {
47887 
47888     /* "View.MemoryView":983
47889  *     cdef assign_item_from_object(self, char *itemp, object value):
47890  *         if self.to_dtype_func != NULL:
47891  *             self.to_dtype_func(itemp, value)             # <<<<<<<<<<<<<<
47892  *         else:
47893  *             memoryview.assign_item_from_object(self, itemp, value)
47894  */
47895     __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 983, __pyx_L1_error)
47896 
47897     /* "View.MemoryView":982
47898  *
47899  *     cdef assign_item_from_object(self, char *itemp, object value):
47900  *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
47901  *             self.to_dtype_func(itemp, value)
47902  *         else:
47903  */
47904     goto __pyx_L3;
47905   }
47906 
47907   /* "View.MemoryView":985
47908  *             self.to_dtype_func(itemp, value)
47909  *         else:
47910  *             memoryview.assign_item_from_object(self, itemp, value)             # <<<<<<<<<<<<<<
47911  *
47912  *     @property
47913  */
47914   /*else*/ {
47915     __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(4, 985, __pyx_L1_error)
47916     __Pyx_GOTREF(__pyx_t_3);
47917     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
47918   }
47919   __pyx_L3:;
47920 
47921   /* "View.MemoryView":981
47922  *             return memoryview.convert_item_to_object(self, itemp)
47923  *
47924  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
47925  *         if self.to_dtype_func != NULL:
47926  *             self.to_dtype_func(itemp, value)
47927  */
47928 
47929   /* function exit code */
47930   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
47931   goto __pyx_L0;
47932   __pyx_L1_error:;
47933   __Pyx_XDECREF(__pyx_t_3);
47934   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
47935   __pyx_r = 0;
47936   __pyx_L0:;
47937   __Pyx_XGIVEREF(__pyx_r);
47938   __Pyx_RefNannyFinishContext();
47939   return __pyx_r;
47940 }
47941 
47942 /* "View.MemoryView":988
47943  *
47944  *     @property
47945  *     def base(self):             # <<<<<<<<<<<<<<
47946  *         return self.from_object
47947  *
47948  */
47949 
47950 /* Python wrapper */
47951 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject * __pyx_v_self)47952 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
47953   PyObject *__pyx_r = 0;
47954   __Pyx_RefNannyDeclarations
47955   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
47956   __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
47957 
47958   /* function exit code */
47959   __Pyx_RefNannyFinishContext();
47960   return __pyx_r;
47961 }
47962 
__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj * __pyx_v_self)47963 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
47964   PyObject *__pyx_r = NULL;
47965   __Pyx_RefNannyDeclarations
47966   __Pyx_RefNannySetupContext("__get__", 0);
47967 
47968   /* "View.MemoryView":989
47969  *     @property
47970  *     def base(self):
47971  *         return self.from_object             # <<<<<<<<<<<<<<
47972  *
47973  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
47974  */
47975   __Pyx_XDECREF(__pyx_r);
47976   __Pyx_INCREF(__pyx_v_self->from_object);
47977   __pyx_r = __pyx_v_self->from_object;
47978   goto __pyx_L0;
47979 
47980   /* "View.MemoryView":988
47981  *
47982  *     @property
47983  *     def base(self):             # <<<<<<<<<<<<<<
47984  *         return self.from_object
47985  *
47986  */
47987 
47988   /* function exit code */
47989   __pyx_L0:;
47990   __Pyx_XGIVEREF(__pyx_r);
47991   __Pyx_RefNannyFinishContext();
47992   return __pyx_r;
47993 }
47994 
47995 /* "(tree fragment)":1
47996  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
47997  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
47998  * def __setstate_cython__(self, __pyx_state):
47999  */
48000 
48001 /* Python wrapper */
48002 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)48003 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
48004   PyObject *__pyx_r = 0;
48005   __Pyx_RefNannyDeclarations
48006   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
48007   __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
48008 
48009   /* function exit code */
48010   __Pyx_RefNannyFinishContext();
48011   return __pyx_r;
48012 }
48013 
__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj * __pyx_v_self)48014 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
48015   PyObject *__pyx_r = NULL;
48016   __Pyx_RefNannyDeclarations
48017   PyObject *__pyx_t_1 = NULL;
48018   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
48019 
48020   /* "(tree fragment)":2
48021  * def __reduce_cython__(self):
48022  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
48023  * def __setstate_cython__(self, __pyx_state):
48024  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
48025  */
48026   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2, __pyx_L1_error)
48027   __Pyx_GOTREF(__pyx_t_1);
48028   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
48029   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
48030   __PYX_ERR(4, 2, __pyx_L1_error)
48031 
48032   /* "(tree fragment)":1
48033  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
48034  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
48035  * def __setstate_cython__(self, __pyx_state):
48036  */
48037 
48038   /* function exit code */
48039   __pyx_L1_error:;
48040   __Pyx_XDECREF(__pyx_t_1);
48041   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
48042   __pyx_r = NULL;
48043   __Pyx_XGIVEREF(__pyx_r);
48044   __Pyx_RefNannyFinishContext();
48045   return __pyx_r;
48046 }
48047 
48048 /* "(tree fragment)":3
48049  * def __reduce_cython__(self):
48050  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
48051  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
48052  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
48053  */
48054 
48055 /* Python wrapper */
48056 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)48057 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
48058   PyObject *__pyx_r = 0;
48059   __Pyx_RefNannyDeclarations
48060   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
48061   __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
48062 
48063   /* function exit code */
48064   __Pyx_RefNannyFinishContext();
48065   return __pyx_r;
48066 }
48067 
__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)48068 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) {
48069   PyObject *__pyx_r = NULL;
48070   __Pyx_RefNannyDeclarations
48071   PyObject *__pyx_t_1 = NULL;
48072   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
48073 
48074   /* "(tree fragment)":4
48075  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
48076  * def __setstate_cython__(self, __pyx_state):
48077  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
48078  */
48079   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4, __pyx_L1_error)
48080   __Pyx_GOTREF(__pyx_t_1);
48081   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
48082   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
48083   __PYX_ERR(4, 4, __pyx_L1_error)
48084 
48085   /* "(tree fragment)":3
48086  * def __reduce_cython__(self):
48087  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
48088  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
48089  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
48090  */
48091 
48092   /* function exit code */
48093   __pyx_L1_error:;
48094   __Pyx_XDECREF(__pyx_t_1);
48095   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
48096   __pyx_r = NULL;
48097   __Pyx_XGIVEREF(__pyx_r);
48098   __Pyx_RefNannyFinishContext();
48099   return __pyx_r;
48100 }
48101 
48102 /* "View.MemoryView":995
48103  *
48104  * @cname('__pyx_memoryview_fromslice')
48105  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
48106  *                           int ndim,
48107  *                           object (*to_object_func)(char *),
48108  */
48109 
__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)48110 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) {
48111   struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
48112   Py_ssize_t __pyx_v_suboffset;
48113   PyObject *__pyx_v_length = NULL;
48114   PyObject *__pyx_r = NULL;
48115   __Pyx_RefNannyDeclarations
48116   int __pyx_t_1;
48117   PyObject *__pyx_t_2 = NULL;
48118   PyObject *__pyx_t_3 = NULL;
48119   __Pyx_TypeInfo *__pyx_t_4;
48120   Py_buffer __pyx_t_5;
48121   Py_ssize_t *__pyx_t_6;
48122   Py_ssize_t *__pyx_t_7;
48123   Py_ssize_t *__pyx_t_8;
48124   Py_ssize_t __pyx_t_9;
48125   __Pyx_RefNannySetupContext("memoryview_fromslice", 0);
48126 
48127   /* "View.MemoryView":1003
48128  *     cdef _memoryviewslice result
48129  *
48130  *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
48131  *         return None
48132  *
48133  */
48134   __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
48135   if (__pyx_t_1) {
48136 
48137     /* "View.MemoryView":1004
48138  *
48139  *     if <PyObject *> memviewslice.memview == Py_None:
48140  *         return None             # <<<<<<<<<<<<<<
48141  *
48142  *
48143  */
48144     __Pyx_XDECREF(__pyx_r);
48145     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
48146     goto __pyx_L0;
48147 
48148     /* "View.MemoryView":1003
48149  *     cdef _memoryviewslice result
48150  *
48151  *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
48152  *         return None
48153  *
48154  */
48155   }
48156 
48157   /* "View.MemoryView":1009
48158  *
48159  *
48160  *     result = _memoryviewslice(None, 0, dtype_is_object)             # <<<<<<<<<<<<<<
48161  *
48162  *     result.from_slice = memviewslice
48163  */
48164   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1009, __pyx_L1_error)
48165   __Pyx_GOTREF(__pyx_t_2);
48166   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1009, __pyx_L1_error)
48167   __Pyx_GOTREF(__pyx_t_3);
48168   __Pyx_INCREF(Py_None);
48169   __Pyx_GIVEREF(Py_None);
48170   PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
48171   __Pyx_INCREF(__pyx_int_0);
48172   __Pyx_GIVEREF(__pyx_int_0);
48173   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
48174   __Pyx_GIVEREF(__pyx_t_2);
48175   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
48176   __pyx_t_2 = 0;
48177   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1009, __pyx_L1_error)
48178   __Pyx_GOTREF(__pyx_t_2);
48179   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
48180   __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
48181   __pyx_t_2 = 0;
48182 
48183   /* "View.MemoryView":1011
48184  *     result = _memoryviewslice(None, 0, dtype_is_object)
48185  *
48186  *     result.from_slice = memviewslice             # <<<<<<<<<<<<<<
48187  *     __PYX_INC_MEMVIEW(&memviewslice, 1)
48188  *
48189  */
48190   __pyx_v_result->from_slice = __pyx_v_memviewslice;
48191 
48192   /* "View.MemoryView":1012
48193  *
48194  *     result.from_slice = memviewslice
48195  *     __PYX_INC_MEMVIEW(&memviewslice, 1)             # <<<<<<<<<<<<<<
48196  *
48197  *     result.from_object = (<memoryview> memviewslice.memview).base
48198  */
48199   __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
48200 
48201   /* "View.MemoryView":1014
48202  *     __PYX_INC_MEMVIEW(&memviewslice, 1)
48203  *
48204  *     result.from_object = (<memoryview> memviewslice.memview).base             # <<<<<<<<<<<<<<
48205  *     result.typeinfo = memviewslice.memview.typeinfo
48206  *
48207  */
48208   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1014, __pyx_L1_error)
48209   __Pyx_GOTREF(__pyx_t_2);
48210   __Pyx_GIVEREF(__pyx_t_2);
48211   __Pyx_GOTREF(__pyx_v_result->from_object);
48212   __Pyx_DECREF(__pyx_v_result->from_object);
48213   __pyx_v_result->from_object = __pyx_t_2;
48214   __pyx_t_2 = 0;
48215 
48216   /* "View.MemoryView":1015
48217  *
48218  *     result.from_object = (<memoryview> memviewslice.memview).base
48219  *     result.typeinfo = memviewslice.memview.typeinfo             # <<<<<<<<<<<<<<
48220  *
48221  *     result.view = memviewslice.memview.view
48222  */
48223   __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
48224   __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
48225 
48226   /* "View.MemoryView":1017
48227  *     result.typeinfo = memviewslice.memview.typeinfo
48228  *
48229  *     result.view = memviewslice.memview.view             # <<<<<<<<<<<<<<
48230  *     result.view.buf = <void *> memviewslice.data
48231  *     result.view.ndim = ndim
48232  */
48233   __pyx_t_5 = __pyx_v_memviewslice.memview->view;
48234   __pyx_v_result->__pyx_base.view = __pyx_t_5;
48235 
48236   /* "View.MemoryView":1018
48237  *
48238  *     result.view = memviewslice.memview.view
48239  *     result.view.buf = <void *> memviewslice.data             # <<<<<<<<<<<<<<
48240  *     result.view.ndim = ndim
48241  *     (<__pyx_buffer *> &result.view).obj = Py_None
48242  */
48243   __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
48244 
48245   /* "View.MemoryView":1019
48246  *     result.view = memviewslice.memview.view
48247  *     result.view.buf = <void *> memviewslice.data
48248  *     result.view.ndim = ndim             # <<<<<<<<<<<<<<
48249  *     (<__pyx_buffer *> &result.view).obj = Py_None
48250  *     Py_INCREF(Py_None)
48251  */
48252   __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
48253 
48254   /* "View.MemoryView":1020
48255  *     result.view.buf = <void *> memviewslice.data
48256  *     result.view.ndim = ndim
48257  *     (<__pyx_buffer *> &result.view).obj = Py_None             # <<<<<<<<<<<<<<
48258  *     Py_INCREF(Py_None)
48259  *
48260  */
48261   ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
48262 
48263   /* "View.MemoryView":1021
48264  *     result.view.ndim = ndim
48265  *     (<__pyx_buffer *> &result.view).obj = Py_None
48266  *     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
48267  *
48268  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
48269  */
48270   Py_INCREF(Py_None);
48271 
48272   /* "View.MemoryView":1023
48273  *     Py_INCREF(Py_None)
48274  *
48275  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
48276  *         result.flags = PyBUF_RECORDS
48277  *     else:
48278  */
48279   __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
48280   if (__pyx_t_1) {
48281 
48282     /* "View.MemoryView":1024
48283  *
48284  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
48285  *         result.flags = PyBUF_RECORDS             # <<<<<<<<<<<<<<
48286  *     else:
48287  *         result.flags = PyBUF_RECORDS_RO
48288  */
48289     __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
48290 
48291     /* "View.MemoryView":1023
48292  *     Py_INCREF(Py_None)
48293  *
48294  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
48295  *         result.flags = PyBUF_RECORDS
48296  *     else:
48297  */
48298     goto __pyx_L4;
48299   }
48300 
48301   /* "View.MemoryView":1026
48302  *         result.flags = PyBUF_RECORDS
48303  *     else:
48304  *         result.flags = PyBUF_RECORDS_RO             # <<<<<<<<<<<<<<
48305  *
48306  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
48307  */
48308   /*else*/ {
48309     __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
48310   }
48311   __pyx_L4:;
48312 
48313   /* "View.MemoryView":1028
48314  *         result.flags = PyBUF_RECORDS_RO
48315  *
48316  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape             # <<<<<<<<<<<<<<
48317  *     result.view.strides = <Py_ssize_t *> result.from_slice.strides
48318  *
48319  */
48320   __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
48321 
48322   /* "View.MemoryView":1029
48323  *
48324  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
48325  *     result.view.strides = <Py_ssize_t *> result.from_slice.strides             # <<<<<<<<<<<<<<
48326  *
48327  *
48328  */
48329   __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
48330 
48331   /* "View.MemoryView":1032
48332  *
48333  *
48334  *     result.view.suboffsets = NULL             # <<<<<<<<<<<<<<
48335  *     for suboffset in result.from_slice.suboffsets[:ndim]:
48336  *         if suboffset >= 0:
48337  */
48338   __pyx_v_result->__pyx_base.view.suboffsets = NULL;
48339 
48340   /* "View.MemoryView":1033
48341  *
48342  *     result.view.suboffsets = NULL
48343  *     for suboffset in result.from_slice.suboffsets[:ndim]:             # <<<<<<<<<<<<<<
48344  *         if suboffset >= 0:
48345  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
48346  */
48347   __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
48348   for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
48349     __pyx_t_6 = __pyx_t_8;
48350     __pyx_v_suboffset = (__pyx_t_6[0]);
48351 
48352     /* "View.MemoryView":1034
48353  *     result.view.suboffsets = NULL
48354  *     for suboffset in result.from_slice.suboffsets[:ndim]:
48355  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
48356  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
48357  *             break
48358  */
48359     __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
48360     if (__pyx_t_1) {
48361 
48362       /* "View.MemoryView":1035
48363  *     for suboffset in result.from_slice.suboffsets[:ndim]:
48364  *         if suboffset >= 0:
48365  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets             # <<<<<<<<<<<<<<
48366  *             break
48367  *
48368  */
48369       __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
48370 
48371       /* "View.MemoryView":1036
48372  *         if suboffset >= 0:
48373  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
48374  *             break             # <<<<<<<<<<<<<<
48375  *
48376  *     result.view.len = result.view.itemsize
48377  */
48378       goto __pyx_L6_break;
48379 
48380       /* "View.MemoryView":1034
48381  *     result.view.suboffsets = NULL
48382  *     for suboffset in result.from_slice.suboffsets[:ndim]:
48383  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
48384  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
48385  *             break
48386  */
48387     }
48388   }
48389   __pyx_L6_break:;
48390 
48391   /* "View.MemoryView":1038
48392  *             break
48393  *
48394  *     result.view.len = result.view.itemsize             # <<<<<<<<<<<<<<
48395  *     for length in result.view.shape[:ndim]:
48396  *         result.view.len *= length
48397  */
48398   __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
48399   __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
48400 
48401   /* "View.MemoryView":1039
48402  *
48403  *     result.view.len = result.view.itemsize
48404  *     for length in result.view.shape[:ndim]:             # <<<<<<<<<<<<<<
48405  *         result.view.len *= length
48406  *
48407  */
48408   __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
48409   for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
48410     __pyx_t_6 = __pyx_t_8;
48411     __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1039, __pyx_L1_error)
48412     __Pyx_GOTREF(__pyx_t_2);
48413     __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
48414     __pyx_t_2 = 0;
48415 
48416     /* "View.MemoryView":1040
48417  *     result.view.len = result.view.itemsize
48418  *     for length in result.view.shape[:ndim]:
48419  *         result.view.len *= length             # <<<<<<<<<<<<<<
48420  *
48421  *     result.to_object_func = to_object_func
48422  */
48423     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1040, __pyx_L1_error)
48424     __Pyx_GOTREF(__pyx_t_2);
48425     __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1040, __pyx_L1_error)
48426     __Pyx_GOTREF(__pyx_t_3);
48427     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
48428     __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(4, 1040, __pyx_L1_error)
48429     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
48430     __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
48431   }
48432 
48433   /* "View.MemoryView":1042
48434  *         result.view.len *= length
48435  *
48436  *     result.to_object_func = to_object_func             # <<<<<<<<<<<<<<
48437  *     result.to_dtype_func = to_dtype_func
48438  *
48439  */
48440   __pyx_v_result->to_object_func = __pyx_v_to_object_func;
48441 
48442   /* "View.MemoryView":1043
48443  *
48444  *     result.to_object_func = to_object_func
48445  *     result.to_dtype_func = to_dtype_func             # <<<<<<<<<<<<<<
48446  *
48447  *     return result
48448  */
48449   __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
48450 
48451   /* "View.MemoryView":1045
48452  *     result.to_dtype_func = to_dtype_func
48453  *
48454  *     return result             # <<<<<<<<<<<<<<
48455  *
48456  * @cname('__pyx_memoryview_get_slice_from_memoryview')
48457  */
48458   __Pyx_XDECREF(__pyx_r);
48459   __Pyx_INCREF(((PyObject *)__pyx_v_result));
48460   __pyx_r = ((PyObject *)__pyx_v_result);
48461   goto __pyx_L0;
48462 
48463   /* "View.MemoryView":995
48464  *
48465  * @cname('__pyx_memoryview_fromslice')
48466  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
48467  *                           int ndim,
48468  *                           object (*to_object_func)(char *),
48469  */
48470 
48471   /* function exit code */
48472   __pyx_L1_error:;
48473   __Pyx_XDECREF(__pyx_t_2);
48474   __Pyx_XDECREF(__pyx_t_3);
48475   __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
48476   __pyx_r = 0;
48477   __pyx_L0:;
48478   __Pyx_XDECREF((PyObject *)__pyx_v_result);
48479   __Pyx_XDECREF(__pyx_v_length);
48480   __Pyx_XGIVEREF(__pyx_r);
48481   __Pyx_RefNannyFinishContext();
48482   return __pyx_r;
48483 }
48484 
48485 /* "View.MemoryView":1048
48486  *
48487  * @cname('__pyx_memoryview_get_slice_from_memoryview')
48488  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
48489  *                                                    __Pyx_memviewslice *mslice):
48490  *     cdef _memoryviewslice obj
48491  */
48492 
__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_mslice)48493 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
48494   struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
48495   __Pyx_memviewslice *__pyx_r;
48496   __Pyx_RefNannyDeclarations
48497   int __pyx_t_1;
48498   int __pyx_t_2;
48499   PyObject *__pyx_t_3 = NULL;
48500   __Pyx_RefNannySetupContext("get_slice_from_memview", 0);
48501 
48502   /* "View.MemoryView":1051
48503  *                                                    __Pyx_memviewslice *mslice):
48504  *     cdef _memoryviewslice obj
48505  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
48506  *         obj = memview
48507  *         return &obj.from_slice
48508  */
48509   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
48510   __pyx_t_2 = (__pyx_t_1 != 0);
48511   if (__pyx_t_2) {
48512 
48513     /* "View.MemoryView":1052
48514  *     cdef _memoryviewslice obj
48515  *     if isinstance(memview, _memoryviewslice):
48516  *         obj = memview             # <<<<<<<<<<<<<<
48517  *         return &obj.from_slice
48518  *     else:
48519  */
48520     if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(4, 1052, __pyx_L1_error)
48521     __pyx_t_3 = ((PyObject *)__pyx_v_memview);
48522     __Pyx_INCREF(__pyx_t_3);
48523     __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
48524     __pyx_t_3 = 0;
48525 
48526     /* "View.MemoryView":1053
48527  *     if isinstance(memview, _memoryviewslice):
48528  *         obj = memview
48529  *         return &obj.from_slice             # <<<<<<<<<<<<<<
48530  *     else:
48531  *         slice_copy(memview, mslice)
48532  */
48533     __pyx_r = (&__pyx_v_obj->from_slice);
48534     goto __pyx_L0;
48535 
48536     /* "View.MemoryView":1051
48537  *                                                    __Pyx_memviewslice *mslice):
48538  *     cdef _memoryviewslice obj
48539  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
48540  *         obj = memview
48541  *         return &obj.from_slice
48542  */
48543   }
48544 
48545   /* "View.MemoryView":1055
48546  *         return &obj.from_slice
48547  *     else:
48548  *         slice_copy(memview, mslice)             # <<<<<<<<<<<<<<
48549  *         return mslice
48550  *
48551  */
48552   /*else*/ {
48553     __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
48554 
48555     /* "View.MemoryView":1056
48556  *     else:
48557  *         slice_copy(memview, mslice)
48558  *         return mslice             # <<<<<<<<<<<<<<
48559  *
48560  * @cname('__pyx_memoryview_slice_copy')
48561  */
48562     __pyx_r = __pyx_v_mslice;
48563     goto __pyx_L0;
48564   }
48565 
48566   /* "View.MemoryView":1048
48567  *
48568  * @cname('__pyx_memoryview_get_slice_from_memoryview')
48569  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
48570  *                                                    __Pyx_memviewslice *mslice):
48571  *     cdef _memoryviewslice obj
48572  */
48573 
48574   /* function exit code */
48575   __pyx_L1_error:;
48576   __Pyx_XDECREF(__pyx_t_3);
48577   __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
48578   __pyx_r = 0;
48579   __pyx_L0:;
48580   __Pyx_XDECREF((PyObject *)__pyx_v_obj);
48581   __Pyx_RefNannyFinishContext();
48582   return __pyx_r;
48583 }
48584 
48585 /* "View.MemoryView":1059
48586  *
48587  * @cname('__pyx_memoryview_slice_copy')
48588  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
48589  *     cdef int dim
48590  *     cdef (Py_ssize_t*) shape, strides, suboffsets
48591  */
48592 
__pyx_memoryview_slice_copy(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_dst)48593 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
48594   int __pyx_v_dim;
48595   Py_ssize_t *__pyx_v_shape;
48596   Py_ssize_t *__pyx_v_strides;
48597   Py_ssize_t *__pyx_v_suboffsets;
48598   __Pyx_RefNannyDeclarations
48599   Py_ssize_t *__pyx_t_1;
48600   int __pyx_t_2;
48601   int __pyx_t_3;
48602   int __pyx_t_4;
48603   Py_ssize_t __pyx_t_5;
48604   __Pyx_RefNannySetupContext("slice_copy", 0);
48605 
48606   /* "View.MemoryView":1063
48607  *     cdef (Py_ssize_t*) shape, strides, suboffsets
48608  *
48609  *     shape = memview.view.shape             # <<<<<<<<<<<<<<
48610  *     strides = memview.view.strides
48611  *     suboffsets = memview.view.suboffsets
48612  */
48613   __pyx_t_1 = __pyx_v_memview->view.shape;
48614   __pyx_v_shape = __pyx_t_1;
48615 
48616   /* "View.MemoryView":1064
48617  *
48618  *     shape = memview.view.shape
48619  *     strides = memview.view.strides             # <<<<<<<<<<<<<<
48620  *     suboffsets = memview.view.suboffsets
48621  *
48622  */
48623   __pyx_t_1 = __pyx_v_memview->view.strides;
48624   __pyx_v_strides = __pyx_t_1;
48625 
48626   /* "View.MemoryView":1065
48627  *     shape = memview.view.shape
48628  *     strides = memview.view.strides
48629  *     suboffsets = memview.view.suboffsets             # <<<<<<<<<<<<<<
48630  *
48631  *     dst.memview = <__pyx_memoryview *> memview
48632  */
48633   __pyx_t_1 = __pyx_v_memview->view.suboffsets;
48634   __pyx_v_suboffsets = __pyx_t_1;
48635 
48636   /* "View.MemoryView":1067
48637  *     suboffsets = memview.view.suboffsets
48638  *
48639  *     dst.memview = <__pyx_memoryview *> memview             # <<<<<<<<<<<<<<
48640  *     dst.data = <char *> memview.view.buf
48641  *
48642  */
48643   __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);
48644 
48645   /* "View.MemoryView":1068
48646  *
48647  *     dst.memview = <__pyx_memoryview *> memview
48648  *     dst.data = <char *> memview.view.buf             # <<<<<<<<<<<<<<
48649  *
48650  *     for dim in range(memview.view.ndim):
48651  */
48652   __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);
48653 
48654   /* "View.MemoryView":1070
48655  *     dst.data = <char *> memview.view.buf
48656  *
48657  *     for dim in range(memview.view.ndim):             # <<<<<<<<<<<<<<
48658  *         dst.shape[dim] = shape[dim]
48659  *         dst.strides[dim] = strides[dim]
48660  */
48661   __pyx_t_2 = __pyx_v_memview->view.ndim;
48662   __pyx_t_3 = __pyx_t_2;
48663   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
48664     __pyx_v_dim = __pyx_t_4;
48665 
48666     /* "View.MemoryView":1071
48667  *
48668  *     for dim in range(memview.view.ndim):
48669  *         dst.shape[dim] = shape[dim]             # <<<<<<<<<<<<<<
48670  *         dst.strides[dim] = strides[dim]
48671  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
48672  */
48673     (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
48674 
48675     /* "View.MemoryView":1072
48676  *     for dim in range(memview.view.ndim):
48677  *         dst.shape[dim] = shape[dim]
48678  *         dst.strides[dim] = strides[dim]             # <<<<<<<<<<<<<<
48679  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
48680  *
48681  */
48682     (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
48683 
48684     /* "View.MemoryView":1073
48685  *         dst.shape[dim] = shape[dim]
48686  *         dst.strides[dim] = strides[dim]
48687  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1             # <<<<<<<<<<<<<<
48688  *
48689  * @cname('__pyx_memoryview_copy_object')
48690  */
48691     if ((__pyx_v_suboffsets != 0)) {
48692       __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
48693     } else {
48694       __pyx_t_5 = -1L;
48695     }
48696     (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
48697   }
48698 
48699   /* "View.MemoryView":1059
48700  *
48701  * @cname('__pyx_memoryview_slice_copy')
48702  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
48703  *     cdef int dim
48704  *     cdef (Py_ssize_t*) shape, strides, suboffsets
48705  */
48706 
48707   /* function exit code */
48708   __Pyx_RefNannyFinishContext();
48709 }
48710 
48711 /* "View.MemoryView":1076
48712  *
48713  * @cname('__pyx_memoryview_copy_object')
48714  * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
48715  *     "Create a new memoryview object"
48716  *     cdef __Pyx_memviewslice memviewslice
48717  */
48718 
__pyx_memoryview_copy_object(struct __pyx_memoryview_obj * __pyx_v_memview)48719 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
48720   __Pyx_memviewslice __pyx_v_memviewslice;
48721   PyObject *__pyx_r = NULL;
48722   __Pyx_RefNannyDeclarations
48723   PyObject *__pyx_t_1 = NULL;
48724   __Pyx_RefNannySetupContext("memoryview_copy", 0);
48725 
48726   /* "View.MemoryView":1079
48727  *     "Create a new memoryview object"
48728  *     cdef __Pyx_memviewslice memviewslice
48729  *     slice_copy(memview, &memviewslice)             # <<<<<<<<<<<<<<
48730  *     return memoryview_copy_from_slice(memview, &memviewslice)
48731  *
48732  */
48733   __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
48734 
48735   /* "View.MemoryView":1080
48736  *     cdef __Pyx_memviewslice memviewslice
48737  *     slice_copy(memview, &memviewslice)
48738  *     return memoryview_copy_from_slice(memview, &memviewslice)             # <<<<<<<<<<<<<<
48739  *
48740  * @cname('__pyx_memoryview_copy_object_from_slice')
48741  */
48742   __Pyx_XDECREF(__pyx_r);
48743   __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1080, __pyx_L1_error)
48744   __Pyx_GOTREF(__pyx_t_1);
48745   __pyx_r = __pyx_t_1;
48746   __pyx_t_1 = 0;
48747   goto __pyx_L0;
48748 
48749   /* "View.MemoryView":1076
48750  *
48751  * @cname('__pyx_memoryview_copy_object')
48752  * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
48753  *     "Create a new memoryview object"
48754  *     cdef __Pyx_memviewslice memviewslice
48755  */
48756 
48757   /* function exit code */
48758   __pyx_L1_error:;
48759   __Pyx_XDECREF(__pyx_t_1);
48760   __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
48761   __pyx_r = 0;
48762   __pyx_L0:;
48763   __Pyx_XGIVEREF(__pyx_r);
48764   __Pyx_RefNannyFinishContext();
48765   return __pyx_r;
48766 }
48767 
48768 /* "View.MemoryView":1083
48769  *
48770  * @cname('__pyx_memoryview_copy_object_from_slice')
48771  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
48772  *     """
48773  *     Create a new memoryview object from a given memoryview object and slice.
48774  */
48775 
__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_memviewslice)48776 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
48777   PyObject *(*__pyx_v_to_object_func)(char *);
48778   int (*__pyx_v_to_dtype_func)(char *, PyObject *);
48779   PyObject *__pyx_r = NULL;
48780   __Pyx_RefNannyDeclarations
48781   int __pyx_t_1;
48782   int __pyx_t_2;
48783   PyObject *(*__pyx_t_3)(char *);
48784   int (*__pyx_t_4)(char *, PyObject *);
48785   PyObject *__pyx_t_5 = NULL;
48786   __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);
48787 
48788   /* "View.MemoryView":1090
48789  *     cdef int (*to_dtype_func)(char *, object) except 0
48790  *
48791  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
48792  *         to_object_func = (<_memoryviewslice> memview).to_object_func
48793  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
48794  */
48795   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
48796   __pyx_t_2 = (__pyx_t_1 != 0);
48797   if (__pyx_t_2) {
48798 
48799     /* "View.MemoryView":1091
48800  *
48801  *     if isinstance(memview, _memoryviewslice):
48802  *         to_object_func = (<_memoryviewslice> memview).to_object_func             # <<<<<<<<<<<<<<
48803  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
48804  *     else:
48805  */
48806     __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
48807     __pyx_v_to_object_func = __pyx_t_3;
48808 
48809     /* "View.MemoryView":1092
48810  *     if isinstance(memview, _memoryviewslice):
48811  *         to_object_func = (<_memoryviewslice> memview).to_object_func
48812  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func             # <<<<<<<<<<<<<<
48813  *     else:
48814  *         to_object_func = NULL
48815  */
48816     __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
48817     __pyx_v_to_dtype_func = __pyx_t_4;
48818 
48819     /* "View.MemoryView":1090
48820  *     cdef int (*to_dtype_func)(char *, object) except 0
48821  *
48822  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
48823  *         to_object_func = (<_memoryviewslice> memview).to_object_func
48824  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
48825  */
48826     goto __pyx_L3;
48827   }
48828 
48829   /* "View.MemoryView":1094
48830  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
48831  *     else:
48832  *         to_object_func = NULL             # <<<<<<<<<<<<<<
48833  *         to_dtype_func = NULL
48834  *
48835  */
48836   /*else*/ {
48837     __pyx_v_to_object_func = NULL;
48838 
48839     /* "View.MemoryView":1095
48840  *     else:
48841  *         to_object_func = NULL
48842  *         to_dtype_func = NULL             # <<<<<<<<<<<<<<
48843  *
48844  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
48845  */
48846     __pyx_v_to_dtype_func = NULL;
48847   }
48848   __pyx_L3:;
48849 
48850   /* "View.MemoryView":1097
48851  *         to_dtype_func = NULL
48852  *
48853  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,             # <<<<<<<<<<<<<<
48854  *                                 to_object_func, to_dtype_func,
48855  *                                 memview.dtype_is_object)
48856  */
48857   __Pyx_XDECREF(__pyx_r);
48858 
48859   /* "View.MemoryView":1099
48860  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
48861  *                                 to_object_func, to_dtype_func,
48862  *                                 memview.dtype_is_object)             # <<<<<<<<<<<<<<
48863  *
48864  *
48865  */
48866   __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(4, 1097, __pyx_L1_error)
48867   __Pyx_GOTREF(__pyx_t_5);
48868   __pyx_r = __pyx_t_5;
48869   __pyx_t_5 = 0;
48870   goto __pyx_L0;
48871 
48872   /* "View.MemoryView":1083
48873  *
48874  * @cname('__pyx_memoryview_copy_object_from_slice')
48875  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
48876  *     """
48877  *     Create a new memoryview object from a given memoryview object and slice.
48878  */
48879 
48880   /* function exit code */
48881   __pyx_L1_error:;
48882   __Pyx_XDECREF(__pyx_t_5);
48883   __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
48884   __pyx_r = 0;
48885   __pyx_L0:;
48886   __Pyx_XGIVEREF(__pyx_r);
48887   __Pyx_RefNannyFinishContext();
48888   return __pyx_r;
48889 }
48890 
48891 /* "View.MemoryView":1105
48892  *
48893  *
48894  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
48895  *     if arg < 0:
48896  *         return -arg
48897  */
48898 
abs_py_ssize_t(Py_ssize_t __pyx_v_arg)48899 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
48900   Py_ssize_t __pyx_r;
48901   int __pyx_t_1;
48902 
48903   /* "View.MemoryView":1106
48904  *
48905  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
48906  *     if arg < 0:             # <<<<<<<<<<<<<<
48907  *         return -arg
48908  *     else:
48909  */
48910   __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
48911   if (__pyx_t_1) {
48912 
48913     /* "View.MemoryView":1107
48914  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
48915  *     if arg < 0:
48916  *         return -arg             # <<<<<<<<<<<<<<
48917  *     else:
48918  *         return arg
48919  */
48920     __pyx_r = (-__pyx_v_arg);
48921     goto __pyx_L0;
48922 
48923     /* "View.MemoryView":1106
48924  *
48925  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
48926  *     if arg < 0:             # <<<<<<<<<<<<<<
48927  *         return -arg
48928  *     else:
48929  */
48930   }
48931 
48932   /* "View.MemoryView":1109
48933  *         return -arg
48934  *     else:
48935  *         return arg             # <<<<<<<<<<<<<<
48936  *
48937  * @cname('__pyx_get_best_slice_order')
48938  */
48939   /*else*/ {
48940     __pyx_r = __pyx_v_arg;
48941     goto __pyx_L0;
48942   }
48943 
48944   /* "View.MemoryView":1105
48945  *
48946  *
48947  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
48948  *     if arg < 0:
48949  *         return -arg
48950  */
48951 
48952   /* function exit code */
48953   __pyx_L0:;
48954   return __pyx_r;
48955 }
48956 
48957 /* "View.MemoryView":1112
48958  *
48959  * @cname('__pyx_get_best_slice_order')
48960  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
48961  *     """
48962  *     Figure out the best memory access order for a given slice.
48963  */
48964 
__pyx_get_best_slice_order(__Pyx_memviewslice * __pyx_v_mslice,int __pyx_v_ndim)48965 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
48966   int __pyx_v_i;
48967   Py_ssize_t __pyx_v_c_stride;
48968   Py_ssize_t __pyx_v_f_stride;
48969   char __pyx_r;
48970   int __pyx_t_1;
48971   int __pyx_t_2;
48972   int __pyx_t_3;
48973   int __pyx_t_4;
48974 
48975   /* "View.MemoryView":1117
48976  *     """
48977  *     cdef int i
48978  *     cdef Py_ssize_t c_stride = 0             # <<<<<<<<<<<<<<
48979  *     cdef Py_ssize_t f_stride = 0
48980  *
48981  */
48982   __pyx_v_c_stride = 0;
48983 
48984   /* "View.MemoryView":1118
48985  *     cdef int i
48986  *     cdef Py_ssize_t c_stride = 0
48987  *     cdef Py_ssize_t f_stride = 0             # <<<<<<<<<<<<<<
48988  *
48989  *     for i in range(ndim - 1, -1, -1):
48990  */
48991   __pyx_v_f_stride = 0;
48992 
48993   /* "View.MemoryView":1120
48994  *     cdef Py_ssize_t f_stride = 0
48995  *
48996  *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
48997  *         if mslice.shape[i] > 1:
48998  *             c_stride = mslice.strides[i]
48999  */
49000   for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
49001     __pyx_v_i = __pyx_t_1;
49002 
49003     /* "View.MemoryView":1121
49004  *
49005  *     for i in range(ndim - 1, -1, -1):
49006  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
49007  *             c_stride = mslice.strides[i]
49008  *             break
49009  */
49010     __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
49011     if (__pyx_t_2) {
49012 
49013       /* "View.MemoryView":1122
49014  *     for i in range(ndim - 1, -1, -1):
49015  *         if mslice.shape[i] > 1:
49016  *             c_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
49017  *             break
49018  *
49019  */
49020       __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
49021 
49022       /* "View.MemoryView":1123
49023  *         if mslice.shape[i] > 1:
49024  *             c_stride = mslice.strides[i]
49025  *             break             # <<<<<<<<<<<<<<
49026  *
49027  *     for i in range(ndim):
49028  */
49029       goto __pyx_L4_break;
49030 
49031       /* "View.MemoryView":1121
49032  *
49033  *     for i in range(ndim - 1, -1, -1):
49034  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
49035  *             c_stride = mslice.strides[i]
49036  *             break
49037  */
49038     }
49039   }
49040   __pyx_L4_break:;
49041 
49042   /* "View.MemoryView":1125
49043  *             break
49044  *
49045  *     for i in range(ndim):             # <<<<<<<<<<<<<<
49046  *         if mslice.shape[i] > 1:
49047  *             f_stride = mslice.strides[i]
49048  */
49049   __pyx_t_1 = __pyx_v_ndim;
49050   __pyx_t_3 = __pyx_t_1;
49051   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
49052     __pyx_v_i = __pyx_t_4;
49053 
49054     /* "View.MemoryView":1126
49055  *
49056  *     for i in range(ndim):
49057  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
49058  *             f_stride = mslice.strides[i]
49059  *             break
49060  */
49061     __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
49062     if (__pyx_t_2) {
49063 
49064       /* "View.MemoryView":1127
49065  *     for i in range(ndim):
49066  *         if mslice.shape[i] > 1:
49067  *             f_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
49068  *             break
49069  *
49070  */
49071       __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
49072 
49073       /* "View.MemoryView":1128
49074  *         if mslice.shape[i] > 1:
49075  *             f_stride = mslice.strides[i]
49076  *             break             # <<<<<<<<<<<<<<
49077  *
49078  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
49079  */
49080       goto __pyx_L7_break;
49081 
49082       /* "View.MemoryView":1126
49083  *
49084  *     for i in range(ndim):
49085  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
49086  *             f_stride = mslice.strides[i]
49087  *             break
49088  */
49089     }
49090   }
49091   __pyx_L7_break:;
49092 
49093   /* "View.MemoryView":1130
49094  *             break
49095  *
49096  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
49097  *         return 'C'
49098  *     else:
49099  */
49100   __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
49101   if (__pyx_t_2) {
49102 
49103     /* "View.MemoryView":1131
49104  *
49105  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
49106  *         return 'C'             # <<<<<<<<<<<<<<
49107  *     else:
49108  *         return 'F'
49109  */
49110     __pyx_r = 'C';
49111     goto __pyx_L0;
49112 
49113     /* "View.MemoryView":1130
49114  *             break
49115  *
49116  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
49117  *         return 'C'
49118  *     else:
49119  */
49120   }
49121 
49122   /* "View.MemoryView":1133
49123  *         return 'C'
49124  *     else:
49125  *         return 'F'             # <<<<<<<<<<<<<<
49126  *
49127  * @cython.cdivision(True)
49128  */
49129   /*else*/ {
49130     __pyx_r = 'F';
49131     goto __pyx_L0;
49132   }
49133 
49134   /* "View.MemoryView":1112
49135  *
49136  * @cname('__pyx_get_best_slice_order')
49137  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
49138  *     """
49139  *     Figure out the best memory access order for a given slice.
49140  */
49141 
49142   /* function exit code */
49143   __pyx_L0:;
49144   return __pyx_r;
49145 }
49146 
49147 /* "View.MemoryView":1136
49148  *
49149  * @cython.cdivision(True)
49150  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
49151  *                                    char *dst_data, Py_ssize_t *dst_strides,
49152  *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
49153  */
49154 
_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)49155 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) {
49156   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
49157   CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
49158   Py_ssize_t __pyx_v_dst_extent;
49159   Py_ssize_t __pyx_v_src_stride;
49160   Py_ssize_t __pyx_v_dst_stride;
49161   int __pyx_t_1;
49162   int __pyx_t_2;
49163   int __pyx_t_3;
49164   Py_ssize_t __pyx_t_4;
49165   Py_ssize_t __pyx_t_5;
49166   Py_ssize_t __pyx_t_6;
49167 
49168   /* "View.MemoryView":1143
49169  *
49170  *     cdef Py_ssize_t i
49171  *     cdef Py_ssize_t src_extent = src_shape[0]             # <<<<<<<<<<<<<<
49172  *     cdef Py_ssize_t dst_extent = dst_shape[0]
49173  *     cdef Py_ssize_t src_stride = src_strides[0]
49174  */
49175   __pyx_v_src_extent = (__pyx_v_src_shape[0]);
49176 
49177   /* "View.MemoryView":1144
49178  *     cdef Py_ssize_t i
49179  *     cdef Py_ssize_t src_extent = src_shape[0]
49180  *     cdef Py_ssize_t dst_extent = dst_shape[0]             # <<<<<<<<<<<<<<
49181  *     cdef Py_ssize_t src_stride = src_strides[0]
49182  *     cdef Py_ssize_t dst_stride = dst_strides[0]
49183  */
49184   __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
49185 
49186   /* "View.MemoryView":1145
49187  *     cdef Py_ssize_t src_extent = src_shape[0]
49188  *     cdef Py_ssize_t dst_extent = dst_shape[0]
49189  *     cdef Py_ssize_t src_stride = src_strides[0]             # <<<<<<<<<<<<<<
49190  *     cdef Py_ssize_t dst_stride = dst_strides[0]
49191  *
49192  */
49193   __pyx_v_src_stride = (__pyx_v_src_strides[0]);
49194 
49195   /* "View.MemoryView":1146
49196  *     cdef Py_ssize_t dst_extent = dst_shape[0]
49197  *     cdef Py_ssize_t src_stride = src_strides[0]
49198  *     cdef Py_ssize_t dst_stride = dst_strides[0]             # <<<<<<<<<<<<<<
49199  *
49200  *     if ndim == 1:
49201  */
49202   __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
49203 
49204   /* "View.MemoryView":1148
49205  *     cdef Py_ssize_t dst_stride = dst_strides[0]
49206  *
49207  *     if ndim == 1:             # <<<<<<<<<<<<<<
49208  *        if (src_stride > 0 and dst_stride > 0 and
49209  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
49210  */
49211   __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
49212   if (__pyx_t_1) {
49213 
49214     /* "View.MemoryView":1149
49215  *
49216  *     if ndim == 1:
49217  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
49218  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
49219  *            memcpy(dst_data, src_data, itemsize * dst_extent)
49220  */
49221     __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
49222     if (__pyx_t_2) {
49223     } else {
49224       __pyx_t_1 = __pyx_t_2;
49225       goto __pyx_L5_bool_binop_done;
49226     }
49227     __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
49228     if (__pyx_t_2) {
49229     } else {
49230       __pyx_t_1 = __pyx_t_2;
49231       goto __pyx_L5_bool_binop_done;
49232     }
49233 
49234     /* "View.MemoryView":1150
49235  *     if ndim == 1:
49236  *        if (src_stride > 0 and dst_stride > 0 and
49237  *            <size_t> src_stride == itemsize == <size_t> dst_stride):             # <<<<<<<<<<<<<<
49238  *            memcpy(dst_data, src_data, itemsize * dst_extent)
49239  *        else:
49240  */
49241     __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
49242     if (__pyx_t_2) {
49243       __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
49244     }
49245     __pyx_t_3 = (__pyx_t_2 != 0);
49246     __pyx_t_1 = __pyx_t_3;
49247     __pyx_L5_bool_binop_done:;
49248 
49249     /* "View.MemoryView":1149
49250  *
49251  *     if ndim == 1:
49252  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
49253  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
49254  *            memcpy(dst_data, src_data, itemsize * dst_extent)
49255  */
49256     if (__pyx_t_1) {
49257 
49258       /* "View.MemoryView":1151
49259  *        if (src_stride > 0 and dst_stride > 0 and
49260  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
49261  *            memcpy(dst_data, src_data, itemsize * dst_extent)             # <<<<<<<<<<<<<<
49262  *        else:
49263  *            for i in range(dst_extent):
49264  */
49265       (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
49266 
49267       /* "View.MemoryView":1149
49268  *
49269  *     if ndim == 1:
49270  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
49271  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
49272  *            memcpy(dst_data, src_data, itemsize * dst_extent)
49273  */
49274       goto __pyx_L4;
49275     }
49276 
49277     /* "View.MemoryView":1153
49278  *            memcpy(dst_data, src_data, itemsize * dst_extent)
49279  *        else:
49280  *            for i in range(dst_extent):             # <<<<<<<<<<<<<<
49281  *                memcpy(dst_data, src_data, itemsize)
49282  *                src_data += src_stride
49283  */
49284     /*else*/ {
49285       __pyx_t_4 = __pyx_v_dst_extent;
49286       __pyx_t_5 = __pyx_t_4;
49287       for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
49288         __pyx_v_i = __pyx_t_6;
49289 
49290         /* "View.MemoryView":1154
49291  *        else:
49292  *            for i in range(dst_extent):
49293  *                memcpy(dst_data, src_data, itemsize)             # <<<<<<<<<<<<<<
49294  *                src_data += src_stride
49295  *                dst_data += dst_stride
49296  */
49297         (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
49298 
49299         /* "View.MemoryView":1155
49300  *            for i in range(dst_extent):
49301  *                memcpy(dst_data, src_data, itemsize)
49302  *                src_data += src_stride             # <<<<<<<<<<<<<<
49303  *                dst_data += dst_stride
49304  *     else:
49305  */
49306         __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
49307 
49308         /* "View.MemoryView":1156
49309  *                memcpy(dst_data, src_data, itemsize)
49310  *                src_data += src_stride
49311  *                dst_data += dst_stride             # <<<<<<<<<<<<<<
49312  *     else:
49313  *         for i in range(dst_extent):
49314  */
49315         __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
49316       }
49317     }
49318     __pyx_L4:;
49319 
49320     /* "View.MemoryView":1148
49321  *     cdef Py_ssize_t dst_stride = dst_strides[0]
49322  *
49323  *     if ndim == 1:             # <<<<<<<<<<<<<<
49324  *        if (src_stride > 0 and dst_stride > 0 and
49325  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
49326  */
49327     goto __pyx_L3;
49328   }
49329 
49330   /* "View.MemoryView":1158
49331  *                dst_data += dst_stride
49332  *     else:
49333  *         for i in range(dst_extent):             # <<<<<<<<<<<<<<
49334  *             _copy_strided_to_strided(src_data, src_strides + 1,
49335  *                                      dst_data, dst_strides + 1,
49336  */
49337   /*else*/ {
49338     __pyx_t_4 = __pyx_v_dst_extent;
49339     __pyx_t_5 = __pyx_t_4;
49340     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
49341       __pyx_v_i = __pyx_t_6;
49342 
49343       /* "View.MemoryView":1159
49344  *     else:
49345  *         for i in range(dst_extent):
49346  *             _copy_strided_to_strided(src_data, src_strides + 1,             # <<<<<<<<<<<<<<
49347  *                                      dst_data, dst_strides + 1,
49348  *                                      src_shape + 1, dst_shape + 1,
49349  */
49350       _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);
49351 
49352       /* "View.MemoryView":1163
49353  *                                      src_shape + 1, dst_shape + 1,
49354  *                                      ndim - 1, itemsize)
49355  *             src_data += src_stride             # <<<<<<<<<<<<<<
49356  *             dst_data += dst_stride
49357  *
49358  */
49359       __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
49360 
49361       /* "View.MemoryView":1164
49362  *                                      ndim - 1, itemsize)
49363  *             src_data += src_stride
49364  *             dst_data += dst_stride             # <<<<<<<<<<<<<<
49365  *
49366  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
49367  */
49368       __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
49369     }
49370   }
49371   __pyx_L3:;
49372 
49373   /* "View.MemoryView":1136
49374  *
49375  * @cython.cdivision(True)
49376  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
49377  *                                    char *dst_data, Py_ssize_t *dst_strides,
49378  *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
49379  */
49380 
49381   /* function exit code */
49382 }
49383 
49384 /* "View.MemoryView":1166
49385  *             dst_data += dst_stride
49386  *
49387  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
49388  *                                   __Pyx_memviewslice *dst,
49389  *                                   int ndim, size_t itemsize) nogil:
49390  */
49391 
copy_strided_to_strided(__Pyx_memviewslice * __pyx_v_src,__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_ndim,size_t __pyx_v_itemsize)49392 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) {
49393 
49394   /* "View.MemoryView":1169
49395  *                                   __Pyx_memviewslice *dst,
49396  *                                   int ndim, size_t itemsize) nogil:
49397  *     _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides,             # <<<<<<<<<<<<<<
49398  *                              src.shape, dst.shape, ndim, itemsize)
49399  *
49400  */
49401   _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);
49402 
49403   /* "View.MemoryView":1166
49404  *             dst_data += dst_stride
49405  *
49406  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
49407  *                                   __Pyx_memviewslice *dst,
49408  *                                   int ndim, size_t itemsize) nogil:
49409  */
49410 
49411   /* function exit code */
49412 }
49413 
49414 /* "View.MemoryView":1173
49415  *
49416  * @cname('__pyx_memoryview_slice_get_size')
49417  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
49418  *     "Return the size of the memory occupied by the slice in number of bytes"
49419  *     cdef int i
49420  */
49421 
__pyx_memoryview_slice_get_size(__Pyx_memviewslice * __pyx_v_src,int __pyx_v_ndim)49422 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
49423   int __pyx_v_i;
49424   Py_ssize_t __pyx_v_size;
49425   Py_ssize_t __pyx_r;
49426   Py_ssize_t __pyx_t_1;
49427   int __pyx_t_2;
49428   int __pyx_t_3;
49429   int __pyx_t_4;
49430 
49431   /* "View.MemoryView":1176
49432  *     "Return the size of the memory occupied by the slice in number of bytes"
49433  *     cdef int i
49434  *     cdef Py_ssize_t size = src.memview.view.itemsize             # <<<<<<<<<<<<<<
49435  *
49436  *     for i in range(ndim):
49437  */
49438   __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
49439   __pyx_v_size = __pyx_t_1;
49440 
49441   /* "View.MemoryView":1178
49442  *     cdef Py_ssize_t size = src.memview.view.itemsize
49443  *
49444  *     for i in range(ndim):             # <<<<<<<<<<<<<<
49445  *         size *= src.shape[i]
49446  *
49447  */
49448   __pyx_t_2 = __pyx_v_ndim;
49449   __pyx_t_3 = __pyx_t_2;
49450   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
49451     __pyx_v_i = __pyx_t_4;
49452 
49453     /* "View.MemoryView":1179
49454  *
49455  *     for i in range(ndim):
49456  *         size *= src.shape[i]             # <<<<<<<<<<<<<<
49457  *
49458  *     return size
49459  */
49460     __pyx_v_size = (__pyx_v_size * (__pyx_v_src->shape[__pyx_v_i]));
49461   }
49462 
49463   /* "View.MemoryView":1181
49464  *         size *= src.shape[i]
49465  *
49466  *     return size             # <<<<<<<<<<<<<<
49467  *
49468  * @cname('__pyx_fill_contig_strides_array')
49469  */
49470   __pyx_r = __pyx_v_size;
49471   goto __pyx_L0;
49472 
49473   /* "View.MemoryView":1173
49474  *
49475  * @cname('__pyx_memoryview_slice_get_size')
49476  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
49477  *     "Return the size of the memory occupied by the slice in number of bytes"
49478  *     cdef int i
49479  */
49480 
49481   /* function exit code */
49482   __pyx_L0:;
49483   return __pyx_r;
49484 }
49485 
49486 /* "View.MemoryView":1184
49487  *
49488  * @cname('__pyx_fill_contig_strides_array')
49489  * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
49490  *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
49491  *                 int ndim, char order) nogil:
49492  */
49493 
__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)49494 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) {
49495   int __pyx_v_idx;
49496   Py_ssize_t __pyx_r;
49497   int __pyx_t_1;
49498   int __pyx_t_2;
49499   int __pyx_t_3;
49500   int __pyx_t_4;
49501 
49502   /* "View.MemoryView":1193
49503  *     cdef int idx
49504  *
49505  *     if order == 'F':             # <<<<<<<<<<<<<<
49506  *         for idx in range(ndim):
49507  *             strides[idx] = stride
49508  */
49509   __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
49510   if (__pyx_t_1) {
49511 
49512     /* "View.MemoryView":1194
49513  *
49514  *     if order == 'F':
49515  *         for idx in range(ndim):             # <<<<<<<<<<<<<<
49516  *             strides[idx] = stride
49517  *             stride = stride * shape[idx]
49518  */
49519     __pyx_t_2 = __pyx_v_ndim;
49520     __pyx_t_3 = __pyx_t_2;
49521     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
49522       __pyx_v_idx = __pyx_t_4;
49523 
49524       /* "View.MemoryView":1195
49525  *     if order == 'F':
49526  *         for idx in range(ndim):
49527  *             strides[idx] = stride             # <<<<<<<<<<<<<<
49528  *             stride = stride * shape[idx]
49529  *     else:
49530  */
49531       (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
49532 
49533       /* "View.MemoryView":1196
49534  *         for idx in range(ndim):
49535  *             strides[idx] = stride
49536  *             stride = stride * shape[idx]             # <<<<<<<<<<<<<<
49537  *     else:
49538  *         for idx in range(ndim - 1, -1, -1):
49539  */
49540       __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
49541     }
49542 
49543     /* "View.MemoryView":1193
49544  *     cdef int idx
49545  *
49546  *     if order == 'F':             # <<<<<<<<<<<<<<
49547  *         for idx in range(ndim):
49548  *             strides[idx] = stride
49549  */
49550     goto __pyx_L3;
49551   }
49552 
49553   /* "View.MemoryView":1198
49554  *             stride = stride * shape[idx]
49555  *     else:
49556  *         for idx in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
49557  *             strides[idx] = stride
49558  *             stride = stride * shape[idx]
49559  */
49560   /*else*/ {
49561     for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
49562       __pyx_v_idx = __pyx_t_2;
49563 
49564       /* "View.MemoryView":1199
49565  *     else:
49566  *         for idx in range(ndim - 1, -1, -1):
49567  *             strides[idx] = stride             # <<<<<<<<<<<<<<
49568  *             stride = stride * shape[idx]
49569  *
49570  */
49571       (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
49572 
49573       /* "View.MemoryView":1200
49574  *         for idx in range(ndim - 1, -1, -1):
49575  *             strides[idx] = stride
49576  *             stride = stride * shape[idx]             # <<<<<<<<<<<<<<
49577  *
49578  *     return stride
49579  */
49580       __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
49581     }
49582   }
49583   __pyx_L3:;
49584 
49585   /* "View.MemoryView":1202
49586  *             stride = stride * shape[idx]
49587  *
49588  *     return stride             # <<<<<<<<<<<<<<
49589  *
49590  * @cname('__pyx_memoryview_copy_data_to_temp')
49591  */
49592   __pyx_r = __pyx_v_stride;
49593   goto __pyx_L0;
49594 
49595   /* "View.MemoryView":1184
49596  *
49597  * @cname('__pyx_fill_contig_strides_array')
49598  * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
49599  *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
49600  *                 int ndim, char order) nogil:
49601  */
49602 
49603   /* function exit code */
49604   __pyx_L0:;
49605   return __pyx_r;
49606 }
49607 
49608 /* "View.MemoryView":1205
49609  *
49610  * @cname('__pyx_memoryview_copy_data_to_temp')
49611  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
49612  *                              __Pyx_memviewslice *tmpslice,
49613  *                              char order,
49614  */
49615 
__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice * __pyx_v_src,__Pyx_memviewslice * __pyx_v_tmpslice,char __pyx_v_order,int __pyx_v_ndim)49616 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) {
49617   int __pyx_v_i;
49618   void *__pyx_v_result;
49619   size_t __pyx_v_itemsize;
49620   size_t __pyx_v_size;
49621   void *__pyx_r;
49622   Py_ssize_t __pyx_t_1;
49623   int __pyx_t_2;
49624   int __pyx_t_3;
49625   struct __pyx_memoryview_obj *__pyx_t_4;
49626   int __pyx_t_5;
49627   int __pyx_t_6;
49628 
49629   /* "View.MemoryView":1216
49630  *     cdef void *result
49631  *
49632  *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
49633  *     cdef size_t size = slice_get_size(src, ndim)
49634  *
49635  */
49636   __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
49637   __pyx_v_itemsize = __pyx_t_1;
49638 
49639   /* "View.MemoryView":1217
49640  *
49641  *     cdef size_t itemsize = src.memview.view.itemsize
49642  *     cdef size_t size = slice_get_size(src, ndim)             # <<<<<<<<<<<<<<
49643  *
49644  *     result = malloc(size)
49645  */
49646   __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
49647 
49648   /* "View.MemoryView":1219
49649  *     cdef size_t size = slice_get_size(src, ndim)
49650  *
49651  *     result = malloc(size)             # <<<<<<<<<<<<<<
49652  *     if not result:
49653  *         _err(MemoryError, NULL)
49654  */
49655   __pyx_v_result = malloc(__pyx_v_size);
49656 
49657   /* "View.MemoryView":1220
49658  *
49659  *     result = malloc(size)
49660  *     if not result:             # <<<<<<<<<<<<<<
49661  *         _err(MemoryError, NULL)
49662  *
49663  */
49664   __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
49665   if (__pyx_t_2) {
49666 
49667     /* "View.MemoryView":1221
49668  *     result = malloc(size)
49669  *     if not result:
49670  *         _err(MemoryError, NULL)             # <<<<<<<<<<<<<<
49671  *
49672  *
49673  */
49674     __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(4, 1221, __pyx_L1_error)
49675 
49676     /* "View.MemoryView":1220
49677  *
49678  *     result = malloc(size)
49679  *     if not result:             # <<<<<<<<<<<<<<
49680  *         _err(MemoryError, NULL)
49681  *
49682  */
49683   }
49684 
49685   /* "View.MemoryView":1224
49686  *
49687  *
49688  *     tmpslice.data = <char *> result             # <<<<<<<<<<<<<<
49689  *     tmpslice.memview = src.memview
49690  *     for i in range(ndim):
49691  */
49692   __pyx_v_tmpslice->data = ((char *)__pyx_v_result);
49693 
49694   /* "View.MemoryView":1225
49695  *
49696  *     tmpslice.data = <char *> result
49697  *     tmpslice.memview = src.memview             # <<<<<<<<<<<<<<
49698  *     for i in range(ndim):
49699  *         tmpslice.shape[i] = src.shape[i]
49700  */
49701   __pyx_t_4 = __pyx_v_src->memview;
49702   __pyx_v_tmpslice->memview = __pyx_t_4;
49703 
49704   /* "View.MemoryView":1226
49705  *     tmpslice.data = <char *> result
49706  *     tmpslice.memview = src.memview
49707  *     for i in range(ndim):             # <<<<<<<<<<<<<<
49708  *         tmpslice.shape[i] = src.shape[i]
49709  *         tmpslice.suboffsets[i] = -1
49710  */
49711   __pyx_t_3 = __pyx_v_ndim;
49712   __pyx_t_5 = __pyx_t_3;
49713   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
49714     __pyx_v_i = __pyx_t_6;
49715 
49716     /* "View.MemoryView":1227
49717  *     tmpslice.memview = src.memview
49718  *     for i in range(ndim):
49719  *         tmpslice.shape[i] = src.shape[i]             # <<<<<<<<<<<<<<
49720  *         tmpslice.suboffsets[i] = -1
49721  *
49722  */
49723     (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
49724 
49725     /* "View.MemoryView":1228
49726  *     for i in range(ndim):
49727  *         tmpslice.shape[i] = src.shape[i]
49728  *         tmpslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
49729  *
49730  *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
49731  */
49732     (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
49733   }
49734 
49735   /* "View.MemoryView":1230
49736  *         tmpslice.suboffsets[i] = -1
49737  *
49738  *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,             # <<<<<<<<<<<<<<
49739  *                               ndim, order)
49740  *
49741  */
49742   (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));
49743 
49744   /* "View.MemoryView":1234
49745  *
49746  *
49747  *     for i in range(ndim):             # <<<<<<<<<<<<<<
49748  *         if tmpslice.shape[i] == 1:
49749  *             tmpslice.strides[i] = 0
49750  */
49751   __pyx_t_3 = __pyx_v_ndim;
49752   __pyx_t_5 = __pyx_t_3;
49753   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
49754     __pyx_v_i = __pyx_t_6;
49755 
49756     /* "View.MemoryView":1235
49757  *
49758  *     for i in range(ndim):
49759  *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
49760  *             tmpslice.strides[i] = 0
49761  *
49762  */
49763     __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
49764     if (__pyx_t_2) {
49765 
49766       /* "View.MemoryView":1236
49767  *     for i in range(ndim):
49768  *         if tmpslice.shape[i] == 1:
49769  *             tmpslice.strides[i] = 0             # <<<<<<<<<<<<<<
49770  *
49771  *     if slice_is_contig(src[0], order, ndim):
49772  */
49773       (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
49774 
49775       /* "View.MemoryView":1235
49776  *
49777  *     for i in range(ndim):
49778  *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
49779  *             tmpslice.strides[i] = 0
49780  *
49781  */
49782     }
49783   }
49784 
49785   /* "View.MemoryView":1238
49786  *             tmpslice.strides[i] = 0
49787  *
49788  *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
49789  *         memcpy(result, src.data, size)
49790  *     else:
49791  */
49792   __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
49793   if (__pyx_t_2) {
49794 
49795     /* "View.MemoryView":1239
49796  *
49797  *     if slice_is_contig(src[0], order, ndim):
49798  *         memcpy(result, src.data, size)             # <<<<<<<<<<<<<<
49799  *     else:
49800  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
49801  */
49802     (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
49803 
49804     /* "View.MemoryView":1238
49805  *             tmpslice.strides[i] = 0
49806  *
49807  *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
49808  *         memcpy(result, src.data, size)
49809  *     else:
49810  */
49811     goto __pyx_L9;
49812   }
49813 
49814   /* "View.MemoryView":1241
49815  *         memcpy(result, src.data, size)
49816  *     else:
49817  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)             # <<<<<<<<<<<<<<
49818  *
49819  *     return result
49820  */
49821   /*else*/ {
49822     copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
49823   }
49824   __pyx_L9:;
49825 
49826   /* "View.MemoryView":1243
49827  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
49828  *
49829  *     return result             # <<<<<<<<<<<<<<
49830  *
49831  *
49832  */
49833   __pyx_r = __pyx_v_result;
49834   goto __pyx_L0;
49835 
49836   /* "View.MemoryView":1205
49837  *
49838  * @cname('__pyx_memoryview_copy_data_to_temp')
49839  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
49840  *                              __Pyx_memviewslice *tmpslice,
49841  *                              char order,
49842  */
49843 
49844   /* function exit code */
49845   __pyx_L1_error:;
49846   {
49847     #ifdef WITH_THREAD
49848     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
49849     #endif
49850     __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
49851     #ifdef WITH_THREAD
49852     __Pyx_PyGILState_Release(__pyx_gilstate_save);
49853     #endif
49854   }
49855   __pyx_r = NULL;
49856   __pyx_L0:;
49857   return __pyx_r;
49858 }
49859 
49860 /* "View.MemoryView":1248
49861  *
49862  * @cname('__pyx_memoryview_err_extents')
49863  * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
49864  *                              Py_ssize_t extent2) except -1 with gil:
49865  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
49866  */
49867 
__pyx_memoryview_err_extents(int __pyx_v_i,Py_ssize_t __pyx_v_extent1,Py_ssize_t __pyx_v_extent2)49868 static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
49869   int __pyx_r;
49870   __Pyx_RefNannyDeclarations
49871   PyObject *__pyx_t_1 = NULL;
49872   PyObject *__pyx_t_2 = NULL;
49873   PyObject *__pyx_t_3 = NULL;
49874   PyObject *__pyx_t_4 = NULL;
49875   #ifdef WITH_THREAD
49876   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
49877   #endif
49878   __Pyx_RefNannySetupContext("_err_extents", 0);
49879 
49880   /* "View.MemoryView":1251
49881  *                              Py_ssize_t extent2) except -1 with gil:
49882  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
49883  *                                                         (i, extent1, extent2))             # <<<<<<<<<<<<<<
49884  *
49885  * @cname('__pyx_memoryview_err_dim')
49886  */
49887   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1251, __pyx_L1_error)
49888   __Pyx_GOTREF(__pyx_t_1);
49889   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1251, __pyx_L1_error)
49890   __Pyx_GOTREF(__pyx_t_2);
49891   __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1251, __pyx_L1_error)
49892   __Pyx_GOTREF(__pyx_t_3);
49893   __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1251, __pyx_L1_error)
49894   __Pyx_GOTREF(__pyx_t_4);
49895   __Pyx_GIVEREF(__pyx_t_1);
49896   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
49897   __Pyx_GIVEREF(__pyx_t_2);
49898   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
49899   __Pyx_GIVEREF(__pyx_t_3);
49900   PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
49901   __pyx_t_1 = 0;
49902   __pyx_t_2 = 0;
49903   __pyx_t_3 = 0;
49904 
49905   /* "View.MemoryView":1250
49906  * cdef int _err_extents(int i, Py_ssize_t extent1,
49907  *                              Py_ssize_t extent2) except -1 with gil:
49908  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %             # <<<<<<<<<<<<<<
49909  *                                                         (i, extent1, extent2))
49910  *
49911  */
49912   __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1250, __pyx_L1_error)
49913   __Pyx_GOTREF(__pyx_t_3);
49914   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
49915   __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1250, __pyx_L1_error)
49916   __Pyx_GOTREF(__pyx_t_4);
49917   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
49918   __Pyx_Raise(__pyx_t_4, 0, 0, 0);
49919   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
49920   __PYX_ERR(4, 1250, __pyx_L1_error)
49921 
49922   /* "View.MemoryView":1248
49923  *
49924  * @cname('__pyx_memoryview_err_extents')
49925  * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
49926  *                              Py_ssize_t extent2) except -1 with gil:
49927  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
49928  */
49929 
49930   /* function exit code */
49931   __pyx_L1_error:;
49932   __Pyx_XDECREF(__pyx_t_1);
49933   __Pyx_XDECREF(__pyx_t_2);
49934   __Pyx_XDECREF(__pyx_t_3);
49935   __Pyx_XDECREF(__pyx_t_4);
49936   __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
49937   __pyx_r = -1;
49938   __Pyx_RefNannyFinishContext();
49939   #ifdef WITH_THREAD
49940   __Pyx_PyGILState_Release(__pyx_gilstate_save);
49941   #endif
49942   return __pyx_r;
49943 }
49944 
49945 /* "View.MemoryView":1254
49946  *
49947  * @cname('__pyx_memoryview_err_dim')
49948  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
49949  *     raise error(msg.decode('ascii') % dim)
49950  *
49951  */
49952 
__pyx_memoryview_err_dim(PyObject * __pyx_v_error,char * __pyx_v_msg,int __pyx_v_dim)49953 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
49954   int __pyx_r;
49955   __Pyx_RefNannyDeclarations
49956   PyObject *__pyx_t_1 = NULL;
49957   PyObject *__pyx_t_2 = NULL;
49958   PyObject *__pyx_t_3 = NULL;
49959   PyObject *__pyx_t_4 = NULL;
49960   #ifdef WITH_THREAD
49961   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
49962   #endif
49963   __Pyx_RefNannySetupContext("_err_dim", 0);
49964   __Pyx_INCREF(__pyx_v_error);
49965 
49966   /* "View.MemoryView":1255
49967  * @cname('__pyx_memoryview_err_dim')
49968  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
49969  *     raise error(msg.decode('ascii') % dim)             # <<<<<<<<<<<<<<
49970  *
49971  * @cname('__pyx_memoryview_err')
49972  */
49973   __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(4, 1255, __pyx_L1_error)
49974   __Pyx_GOTREF(__pyx_t_2);
49975   __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1255, __pyx_L1_error)
49976   __Pyx_GOTREF(__pyx_t_3);
49977   __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1255, __pyx_L1_error)
49978   __Pyx_GOTREF(__pyx_t_4);
49979   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
49980   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
49981   __Pyx_INCREF(__pyx_v_error);
49982   __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
49983   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
49984     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
49985     if (likely(__pyx_t_2)) {
49986       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
49987       __Pyx_INCREF(__pyx_t_2);
49988       __Pyx_INCREF(function);
49989       __Pyx_DECREF_SET(__pyx_t_3, function);
49990     }
49991   }
49992   __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);
49993   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
49994   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
49995   if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1255, __pyx_L1_error)
49996   __Pyx_GOTREF(__pyx_t_1);
49997   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
49998   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
49999   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
50000   __PYX_ERR(4, 1255, __pyx_L1_error)
50001 
50002   /* "View.MemoryView":1254
50003  *
50004  * @cname('__pyx_memoryview_err_dim')
50005  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
50006  *     raise error(msg.decode('ascii') % dim)
50007  *
50008  */
50009 
50010   /* function exit code */
50011   __pyx_L1_error:;
50012   __Pyx_XDECREF(__pyx_t_1);
50013   __Pyx_XDECREF(__pyx_t_2);
50014   __Pyx_XDECREF(__pyx_t_3);
50015   __Pyx_XDECREF(__pyx_t_4);
50016   __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
50017   __pyx_r = -1;
50018   __Pyx_XDECREF(__pyx_v_error);
50019   __Pyx_RefNannyFinishContext();
50020   #ifdef WITH_THREAD
50021   __Pyx_PyGILState_Release(__pyx_gilstate_save);
50022   #endif
50023   return __pyx_r;
50024 }
50025 
50026 /* "View.MemoryView":1258
50027  *
50028  * @cname('__pyx_memoryview_err')
50029  * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
50030  *     if msg != NULL:
50031  *         raise error(msg.decode('ascii'))
50032  */
50033 
__pyx_memoryview_err(PyObject * __pyx_v_error,char * __pyx_v_msg)50034 static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
50035   int __pyx_r;
50036   __Pyx_RefNannyDeclarations
50037   int __pyx_t_1;
50038   PyObject *__pyx_t_2 = NULL;
50039   PyObject *__pyx_t_3 = NULL;
50040   PyObject *__pyx_t_4 = NULL;
50041   PyObject *__pyx_t_5 = NULL;
50042   #ifdef WITH_THREAD
50043   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
50044   #endif
50045   __Pyx_RefNannySetupContext("_err", 0);
50046   __Pyx_INCREF(__pyx_v_error);
50047 
50048   /* "View.MemoryView":1259
50049  * @cname('__pyx_memoryview_err')
50050  * cdef int _err(object error, char *msg) except -1 with gil:
50051  *     if msg != NULL:             # <<<<<<<<<<<<<<
50052  *         raise error(msg.decode('ascii'))
50053  *     else:
50054  */
50055   __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
50056   if (unlikely(__pyx_t_1)) {
50057 
50058     /* "View.MemoryView":1260
50059  * cdef int _err(object error, char *msg) except -1 with gil:
50060  *     if msg != NULL:
50061  *         raise error(msg.decode('ascii'))             # <<<<<<<<<<<<<<
50062  *     else:
50063  *         raise error
50064  */
50065     __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(4, 1260, __pyx_L1_error)
50066     __Pyx_GOTREF(__pyx_t_3);
50067     __Pyx_INCREF(__pyx_v_error);
50068     __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
50069     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
50070       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
50071       if (likely(__pyx_t_5)) {
50072         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
50073         __Pyx_INCREF(__pyx_t_5);
50074         __Pyx_INCREF(function);
50075         __Pyx_DECREF_SET(__pyx_t_4, function);
50076       }
50077     }
50078     __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);
50079     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
50080     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
50081     if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 1260, __pyx_L1_error)
50082     __Pyx_GOTREF(__pyx_t_2);
50083     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
50084     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
50085     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
50086     __PYX_ERR(4, 1260, __pyx_L1_error)
50087 
50088     /* "View.MemoryView":1259
50089  * @cname('__pyx_memoryview_err')
50090  * cdef int _err(object error, char *msg) except -1 with gil:
50091  *     if msg != NULL:             # <<<<<<<<<<<<<<
50092  *         raise error(msg.decode('ascii'))
50093  *     else:
50094  */
50095   }
50096 
50097   /* "View.MemoryView":1262
50098  *         raise error(msg.decode('ascii'))
50099  *     else:
50100  *         raise error             # <<<<<<<<<<<<<<
50101  *
50102  * @cname('__pyx_memoryview_copy_contents')
50103  */
50104   /*else*/ {
50105     __Pyx_Raise(__pyx_v_error, 0, 0, 0);
50106     __PYX_ERR(4, 1262, __pyx_L1_error)
50107   }
50108 
50109   /* "View.MemoryView":1258
50110  *
50111  * @cname('__pyx_memoryview_err')
50112  * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
50113  *     if msg != NULL:
50114  *         raise error(msg.decode('ascii'))
50115  */
50116 
50117   /* function exit code */
50118   __pyx_L1_error:;
50119   __Pyx_XDECREF(__pyx_t_2);
50120   __Pyx_XDECREF(__pyx_t_3);
50121   __Pyx_XDECREF(__pyx_t_4);
50122   __Pyx_XDECREF(__pyx_t_5);
50123   __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
50124   __pyx_r = -1;
50125   __Pyx_XDECREF(__pyx_v_error);
50126   __Pyx_RefNannyFinishContext();
50127   #ifdef WITH_THREAD
50128   __Pyx_PyGILState_Release(__pyx_gilstate_save);
50129   #endif
50130   return __pyx_r;
50131 }
50132 
50133 /* "View.MemoryView":1265
50134  *
50135  * @cname('__pyx_memoryview_copy_contents')
50136  * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
50137  *                                   __Pyx_memviewslice dst,
50138  *                                   int src_ndim, int dst_ndim,
50139  */
50140 
__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)50141 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) {
50142   void *__pyx_v_tmpdata;
50143   size_t __pyx_v_itemsize;
50144   int __pyx_v_i;
50145   char __pyx_v_order;
50146   int __pyx_v_broadcasting;
50147   int __pyx_v_direct_copy;
50148   __Pyx_memviewslice __pyx_v_tmp;
50149   int __pyx_v_ndim;
50150   int __pyx_r;
50151   Py_ssize_t __pyx_t_1;
50152   int __pyx_t_2;
50153   int __pyx_t_3;
50154   int __pyx_t_4;
50155   int __pyx_t_5;
50156   int __pyx_t_6;
50157   void *__pyx_t_7;
50158   int __pyx_t_8;
50159 
50160   /* "View.MemoryView":1273
50161  *     Check for overlapping memory and verify the shapes.
50162  *     """
50163  *     cdef void *tmpdata = NULL             # <<<<<<<<<<<<<<
50164  *     cdef size_t itemsize = src.memview.view.itemsize
50165  *     cdef int i
50166  */
50167   __pyx_v_tmpdata = NULL;
50168 
50169   /* "View.MemoryView":1274
50170  *     """
50171  *     cdef void *tmpdata = NULL
50172  *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
50173  *     cdef int i
50174  *     cdef char order = get_best_order(&src, src_ndim)
50175  */
50176   __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
50177   __pyx_v_itemsize = __pyx_t_1;
50178 
50179   /* "View.MemoryView":1276
50180  *     cdef size_t itemsize = src.memview.view.itemsize
50181  *     cdef int i
50182  *     cdef char order = get_best_order(&src, src_ndim)             # <<<<<<<<<<<<<<
50183  *     cdef bint broadcasting = False
50184  *     cdef bint direct_copy = False
50185  */
50186   __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
50187 
50188   /* "View.MemoryView":1277
50189  *     cdef int i
50190  *     cdef char order = get_best_order(&src, src_ndim)
50191  *     cdef bint broadcasting = False             # <<<<<<<<<<<<<<
50192  *     cdef bint direct_copy = False
50193  *     cdef __Pyx_memviewslice tmp
50194  */
50195   __pyx_v_broadcasting = 0;
50196 
50197   /* "View.MemoryView":1278
50198  *     cdef char order = get_best_order(&src, src_ndim)
50199  *     cdef bint broadcasting = False
50200  *     cdef bint direct_copy = False             # <<<<<<<<<<<<<<
50201  *     cdef __Pyx_memviewslice tmp
50202  *
50203  */
50204   __pyx_v_direct_copy = 0;
50205 
50206   /* "View.MemoryView":1281
50207  *     cdef __Pyx_memviewslice tmp
50208  *
50209  *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
50210  *         broadcast_leading(&src, src_ndim, dst_ndim)
50211  *     elif dst_ndim < src_ndim:
50212  */
50213   __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
50214   if (__pyx_t_2) {
50215 
50216     /* "View.MemoryView":1282
50217  *
50218  *     if src_ndim < dst_ndim:
50219  *         broadcast_leading(&src, src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
50220  *     elif dst_ndim < src_ndim:
50221  *         broadcast_leading(&dst, dst_ndim, src_ndim)
50222  */
50223     __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
50224 
50225     /* "View.MemoryView":1281
50226  *     cdef __Pyx_memviewslice tmp
50227  *
50228  *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
50229  *         broadcast_leading(&src, src_ndim, dst_ndim)
50230  *     elif dst_ndim < src_ndim:
50231  */
50232     goto __pyx_L3;
50233   }
50234 
50235   /* "View.MemoryView":1283
50236  *     if src_ndim < dst_ndim:
50237  *         broadcast_leading(&src, src_ndim, dst_ndim)
50238  *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
50239  *         broadcast_leading(&dst, dst_ndim, src_ndim)
50240  *
50241  */
50242   __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
50243   if (__pyx_t_2) {
50244 
50245     /* "View.MemoryView":1284
50246  *         broadcast_leading(&src, src_ndim, dst_ndim)
50247  *     elif dst_ndim < src_ndim:
50248  *         broadcast_leading(&dst, dst_ndim, src_ndim)             # <<<<<<<<<<<<<<
50249  *
50250  *     cdef int ndim = max(src_ndim, dst_ndim)
50251  */
50252     __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
50253 
50254     /* "View.MemoryView":1283
50255  *     if src_ndim < dst_ndim:
50256  *         broadcast_leading(&src, src_ndim, dst_ndim)
50257  *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
50258  *         broadcast_leading(&dst, dst_ndim, src_ndim)
50259  *
50260  */
50261   }
50262   __pyx_L3:;
50263 
50264   /* "View.MemoryView":1286
50265  *         broadcast_leading(&dst, dst_ndim, src_ndim)
50266  *
50267  *     cdef int ndim = max(src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
50268  *
50269  *     for i in range(ndim):
50270  */
50271   __pyx_t_3 = __pyx_v_dst_ndim;
50272   __pyx_t_4 = __pyx_v_src_ndim;
50273   if (((__pyx_t_3 > __pyx_t_4) != 0)) {
50274     __pyx_t_5 = __pyx_t_3;
50275   } else {
50276     __pyx_t_5 = __pyx_t_4;
50277   }
50278   __pyx_v_ndim = __pyx_t_5;
50279 
50280   /* "View.MemoryView":1288
50281  *     cdef int ndim = max(src_ndim, dst_ndim)
50282  *
50283  *     for i in range(ndim):             # <<<<<<<<<<<<<<
50284  *         if src.shape[i] != dst.shape[i]:
50285  *             if src.shape[i] == 1:
50286  */
50287   __pyx_t_5 = __pyx_v_ndim;
50288   __pyx_t_3 = __pyx_t_5;
50289   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
50290     __pyx_v_i = __pyx_t_4;
50291 
50292     /* "View.MemoryView":1289
50293  *
50294  *     for i in range(ndim):
50295  *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
50296  *             if src.shape[i] == 1:
50297  *                 broadcasting = True
50298  */
50299     __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
50300     if (__pyx_t_2) {
50301 
50302       /* "View.MemoryView":1290
50303  *     for i in range(ndim):
50304  *         if src.shape[i] != dst.shape[i]:
50305  *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
50306  *                 broadcasting = True
50307  *                 src.strides[i] = 0
50308  */
50309       __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
50310       if (__pyx_t_2) {
50311 
50312         /* "View.MemoryView":1291
50313  *         if src.shape[i] != dst.shape[i]:
50314  *             if src.shape[i] == 1:
50315  *                 broadcasting = True             # <<<<<<<<<<<<<<
50316  *                 src.strides[i] = 0
50317  *             else:
50318  */
50319         __pyx_v_broadcasting = 1;
50320 
50321         /* "View.MemoryView":1292
50322  *             if src.shape[i] == 1:
50323  *                 broadcasting = True
50324  *                 src.strides[i] = 0             # <<<<<<<<<<<<<<
50325  *             else:
50326  *                 _err_extents(i, dst.shape[i], src.shape[i])
50327  */
50328         (__pyx_v_src.strides[__pyx_v_i]) = 0;
50329 
50330         /* "View.MemoryView":1290
50331  *     for i in range(ndim):
50332  *         if src.shape[i] != dst.shape[i]:
50333  *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
50334  *                 broadcasting = True
50335  *                 src.strides[i] = 0
50336  */
50337         goto __pyx_L7;
50338       }
50339 
50340       /* "View.MemoryView":1294
50341  *                 src.strides[i] = 0
50342  *             else:
50343  *                 _err_extents(i, dst.shape[i], src.shape[i])             # <<<<<<<<<<<<<<
50344  *
50345  *         if src.suboffsets[i] >= 0:
50346  */
50347       /*else*/ {
50348         __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(4, 1294, __pyx_L1_error)
50349       }
50350       __pyx_L7:;
50351 
50352       /* "View.MemoryView":1289
50353  *
50354  *     for i in range(ndim):
50355  *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
50356  *             if src.shape[i] == 1:
50357  *                 broadcasting = True
50358  */
50359     }
50360 
50361     /* "View.MemoryView":1296
50362  *                 _err_extents(i, dst.shape[i], src.shape[i])
50363  *
50364  *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
50365  *             _err_dim(ValueError, "Dimension %d is not direct", i)
50366  *
50367  */
50368     __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
50369     if (__pyx_t_2) {
50370 
50371       /* "View.MemoryView":1297
50372  *
50373  *         if src.suboffsets[i] >= 0:
50374  *             _err_dim(ValueError, "Dimension %d is not direct", i)             # <<<<<<<<<<<<<<
50375  *
50376  *     if slices_overlap(&src, &dst, ndim, itemsize):
50377  */
50378       __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(4, 1297, __pyx_L1_error)
50379 
50380       /* "View.MemoryView":1296
50381  *                 _err_extents(i, dst.shape[i], src.shape[i])
50382  *
50383  *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
50384  *             _err_dim(ValueError, "Dimension %d is not direct", i)
50385  *
50386  */
50387     }
50388   }
50389 
50390   /* "View.MemoryView":1299
50391  *             _err_dim(ValueError, "Dimension %d is not direct", i)
50392  *
50393  *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
50394  *
50395  *         if not slice_is_contig(src, order, ndim):
50396  */
50397   __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
50398   if (__pyx_t_2) {
50399 
50400     /* "View.MemoryView":1301
50401  *     if slices_overlap(&src, &dst, ndim, itemsize):
50402  *
50403  *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
50404  *             order = get_best_order(&dst, ndim)
50405  *
50406  */
50407     __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
50408     if (__pyx_t_2) {
50409 
50410       /* "View.MemoryView":1302
50411  *
50412  *         if not slice_is_contig(src, order, ndim):
50413  *             order = get_best_order(&dst, ndim)             # <<<<<<<<<<<<<<
50414  *
50415  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
50416  */
50417       __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
50418 
50419       /* "View.MemoryView":1301
50420  *     if slices_overlap(&src, &dst, ndim, itemsize):
50421  *
50422  *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
50423  *             order = get_best_order(&dst, ndim)
50424  *
50425  */
50426     }
50427 
50428     /* "View.MemoryView":1304
50429  *             order = get_best_order(&dst, ndim)
50430  *
50431  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)             # <<<<<<<<<<<<<<
50432  *         src = tmp
50433  *
50434  */
50435     __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(4, 1304, __pyx_L1_error)
50436     __pyx_v_tmpdata = __pyx_t_7;
50437 
50438     /* "View.MemoryView":1305
50439  *
50440  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
50441  *         src = tmp             # <<<<<<<<<<<<<<
50442  *
50443  *     if not broadcasting:
50444  */
50445     __pyx_v_src = __pyx_v_tmp;
50446 
50447     /* "View.MemoryView":1299
50448  *             _err_dim(ValueError, "Dimension %d is not direct", i)
50449  *
50450  *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
50451  *
50452  *         if not slice_is_contig(src, order, ndim):
50453  */
50454   }
50455 
50456   /* "View.MemoryView":1307
50457  *         src = tmp
50458  *
50459  *     if not broadcasting:             # <<<<<<<<<<<<<<
50460  *
50461  *
50462  */
50463   __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
50464   if (__pyx_t_2) {
50465 
50466     /* "View.MemoryView":1310
50467  *
50468  *
50469  *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
50470  *             direct_copy = slice_is_contig(dst, 'C', ndim)
50471  *         elif slice_is_contig(src, 'F', ndim):
50472  */
50473     __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
50474     if (__pyx_t_2) {
50475 
50476       /* "View.MemoryView":1311
50477  *
50478  *         if slice_is_contig(src, 'C', ndim):
50479  *             direct_copy = slice_is_contig(dst, 'C', ndim)             # <<<<<<<<<<<<<<
50480  *         elif slice_is_contig(src, 'F', ndim):
50481  *             direct_copy = slice_is_contig(dst, 'F', ndim)
50482  */
50483       __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);
50484 
50485       /* "View.MemoryView":1310
50486  *
50487  *
50488  *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
50489  *             direct_copy = slice_is_contig(dst, 'C', ndim)
50490  *         elif slice_is_contig(src, 'F', ndim):
50491  */
50492       goto __pyx_L12;
50493     }
50494 
50495     /* "View.MemoryView":1312
50496  *         if slice_is_contig(src, 'C', ndim):
50497  *             direct_copy = slice_is_contig(dst, 'C', ndim)
50498  *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
50499  *             direct_copy = slice_is_contig(dst, 'F', ndim)
50500  *
50501  */
50502     __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
50503     if (__pyx_t_2) {
50504 
50505       /* "View.MemoryView":1313
50506  *             direct_copy = slice_is_contig(dst, 'C', ndim)
50507  *         elif slice_is_contig(src, 'F', ndim):
50508  *             direct_copy = slice_is_contig(dst, 'F', ndim)             # <<<<<<<<<<<<<<
50509  *
50510  *         if direct_copy:
50511  */
50512       __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);
50513 
50514       /* "View.MemoryView":1312
50515  *         if slice_is_contig(src, 'C', ndim):
50516  *             direct_copy = slice_is_contig(dst, 'C', ndim)
50517  *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
50518  *             direct_copy = slice_is_contig(dst, 'F', ndim)
50519  *
50520  */
50521     }
50522     __pyx_L12:;
50523 
50524     /* "View.MemoryView":1315
50525  *             direct_copy = slice_is_contig(dst, 'F', ndim)
50526  *
50527  *         if direct_copy:             # <<<<<<<<<<<<<<
50528  *
50529  *             refcount_copying(&dst, dtype_is_object, ndim, False)
50530  */
50531     __pyx_t_2 = (__pyx_v_direct_copy != 0);
50532     if (__pyx_t_2) {
50533 
50534       /* "View.MemoryView":1317
50535  *         if direct_copy:
50536  *
50537  *             refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
50538  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
50539  *             refcount_copying(&dst, dtype_is_object, ndim, True)
50540  */
50541       __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
50542 
50543       /* "View.MemoryView":1318
50544  *
50545  *             refcount_copying(&dst, dtype_is_object, ndim, False)
50546  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))             # <<<<<<<<<<<<<<
50547  *             refcount_copying(&dst, dtype_is_object, ndim, True)
50548  *             free(tmpdata)
50549  */
50550       (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
50551 
50552       /* "View.MemoryView":1319
50553  *             refcount_copying(&dst, dtype_is_object, ndim, False)
50554  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
50555  *             refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
50556  *             free(tmpdata)
50557  *             return 0
50558  */
50559       __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
50560 
50561       /* "View.MemoryView":1320
50562  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
50563  *             refcount_copying(&dst, dtype_is_object, ndim, True)
50564  *             free(tmpdata)             # <<<<<<<<<<<<<<
50565  *             return 0
50566  *
50567  */
50568       free(__pyx_v_tmpdata);
50569 
50570       /* "View.MemoryView":1321
50571  *             refcount_copying(&dst, dtype_is_object, ndim, True)
50572  *             free(tmpdata)
50573  *             return 0             # <<<<<<<<<<<<<<
50574  *
50575  *     if order == 'F' == get_best_order(&dst, ndim):
50576  */
50577       __pyx_r = 0;
50578       goto __pyx_L0;
50579 
50580       /* "View.MemoryView":1315
50581  *             direct_copy = slice_is_contig(dst, 'F', ndim)
50582  *
50583  *         if direct_copy:             # <<<<<<<<<<<<<<
50584  *
50585  *             refcount_copying(&dst, dtype_is_object, ndim, False)
50586  */
50587     }
50588 
50589     /* "View.MemoryView":1307
50590  *         src = tmp
50591  *
50592  *     if not broadcasting:             # <<<<<<<<<<<<<<
50593  *
50594  *
50595  */
50596   }
50597 
50598   /* "View.MemoryView":1323
50599  *             return 0
50600  *
50601  *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
50602  *
50603  *
50604  */
50605   __pyx_t_2 = (__pyx_v_order == 'F');
50606   if (__pyx_t_2) {
50607     __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
50608   }
50609   __pyx_t_8 = (__pyx_t_2 != 0);
50610   if (__pyx_t_8) {
50611 
50612     /* "View.MemoryView":1326
50613  *
50614  *
50615  *         transpose_memslice(&src)             # <<<<<<<<<<<<<<
50616  *         transpose_memslice(&dst)
50617  *
50618  */
50619     __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 1326, __pyx_L1_error)
50620 
50621     /* "View.MemoryView":1327
50622  *
50623  *         transpose_memslice(&src)
50624  *         transpose_memslice(&dst)             # <<<<<<<<<<<<<<
50625  *
50626  *     refcount_copying(&dst, dtype_is_object, ndim, False)
50627  */
50628     __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 1327, __pyx_L1_error)
50629 
50630     /* "View.MemoryView":1323
50631  *             return 0
50632  *
50633  *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
50634  *
50635  *
50636  */
50637   }
50638 
50639   /* "View.MemoryView":1329
50640  *         transpose_memslice(&dst)
50641  *
50642  *     refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
50643  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
50644  *     refcount_copying(&dst, dtype_is_object, ndim, True)
50645  */
50646   __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
50647 
50648   /* "View.MemoryView":1330
50649  *
50650  *     refcount_copying(&dst, dtype_is_object, ndim, False)
50651  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)             # <<<<<<<<<<<<<<
50652  *     refcount_copying(&dst, dtype_is_object, ndim, True)
50653  *
50654  */
50655   copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
50656 
50657   /* "View.MemoryView":1331
50658  *     refcount_copying(&dst, dtype_is_object, ndim, False)
50659  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
50660  *     refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
50661  *
50662  *     free(tmpdata)
50663  */
50664   __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
50665 
50666   /* "View.MemoryView":1333
50667  *     refcount_copying(&dst, dtype_is_object, ndim, True)
50668  *
50669  *     free(tmpdata)             # <<<<<<<<<<<<<<
50670  *     return 0
50671  *
50672  */
50673   free(__pyx_v_tmpdata);
50674 
50675   /* "View.MemoryView":1334
50676  *
50677  *     free(tmpdata)
50678  *     return 0             # <<<<<<<<<<<<<<
50679  *
50680  * @cname('__pyx_memoryview_broadcast_leading')
50681  */
50682   __pyx_r = 0;
50683   goto __pyx_L0;
50684 
50685   /* "View.MemoryView":1265
50686  *
50687  * @cname('__pyx_memoryview_copy_contents')
50688  * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
50689  *                                   __Pyx_memviewslice dst,
50690  *                                   int src_ndim, int dst_ndim,
50691  */
50692 
50693   /* function exit code */
50694   __pyx_L1_error:;
50695   {
50696     #ifdef WITH_THREAD
50697     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
50698     #endif
50699     __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
50700     #ifdef WITH_THREAD
50701     __Pyx_PyGILState_Release(__pyx_gilstate_save);
50702     #endif
50703   }
50704   __pyx_r = -1;
50705   __pyx_L0:;
50706   return __pyx_r;
50707 }
50708 
50709 /* "View.MemoryView":1337
50710  *
50711  * @cname('__pyx_memoryview_broadcast_leading')
50712  * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
50713  *                             int ndim,
50714  *                             int ndim_other) nogil:
50715  */
50716 
__pyx_memoryview_broadcast_leading(__Pyx_memviewslice * __pyx_v_mslice,int __pyx_v_ndim,int __pyx_v_ndim_other)50717 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
50718   int __pyx_v_i;
50719   int __pyx_v_offset;
50720   int __pyx_t_1;
50721   int __pyx_t_2;
50722   int __pyx_t_3;
50723 
50724   /* "View.MemoryView":1341
50725  *                             int ndim_other) nogil:
50726  *     cdef int i
50727  *     cdef int offset = ndim_other - ndim             # <<<<<<<<<<<<<<
50728  *
50729  *     for i in range(ndim - 1, -1, -1):
50730  */
50731   __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
50732 
50733   /* "View.MemoryView":1343
50734  *     cdef int offset = ndim_other - ndim
50735  *
50736  *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
50737  *         mslice.shape[i + offset] = mslice.shape[i]
50738  *         mslice.strides[i + offset] = mslice.strides[i]
50739  */
50740   for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
50741     __pyx_v_i = __pyx_t_1;
50742 
50743     /* "View.MemoryView":1344
50744  *
50745  *     for i in range(ndim - 1, -1, -1):
50746  *         mslice.shape[i + offset] = mslice.shape[i]             # <<<<<<<<<<<<<<
50747  *         mslice.strides[i + offset] = mslice.strides[i]
50748  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
50749  */
50750     (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
50751 
50752     /* "View.MemoryView":1345
50753  *     for i in range(ndim - 1, -1, -1):
50754  *         mslice.shape[i + offset] = mslice.shape[i]
50755  *         mslice.strides[i + offset] = mslice.strides[i]             # <<<<<<<<<<<<<<
50756  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
50757  *
50758  */
50759     (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
50760 
50761     /* "View.MemoryView":1346
50762  *         mslice.shape[i + offset] = mslice.shape[i]
50763  *         mslice.strides[i + offset] = mslice.strides[i]
50764  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]             # <<<<<<<<<<<<<<
50765  *
50766  *     for i in range(offset):
50767  */
50768     (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
50769   }
50770 
50771   /* "View.MemoryView":1348
50772  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
50773  *
50774  *     for i in range(offset):             # <<<<<<<<<<<<<<
50775  *         mslice.shape[i] = 1
50776  *         mslice.strides[i] = mslice.strides[0]
50777  */
50778   __pyx_t_1 = __pyx_v_offset;
50779   __pyx_t_2 = __pyx_t_1;
50780   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
50781     __pyx_v_i = __pyx_t_3;
50782 
50783     /* "View.MemoryView":1349
50784  *
50785  *     for i in range(offset):
50786  *         mslice.shape[i] = 1             # <<<<<<<<<<<<<<
50787  *         mslice.strides[i] = mslice.strides[0]
50788  *         mslice.suboffsets[i] = -1
50789  */
50790     (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
50791 
50792     /* "View.MemoryView":1350
50793  *     for i in range(offset):
50794  *         mslice.shape[i] = 1
50795  *         mslice.strides[i] = mslice.strides[0]             # <<<<<<<<<<<<<<
50796  *         mslice.suboffsets[i] = -1
50797  *
50798  */
50799     (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
50800 
50801     /* "View.MemoryView":1351
50802  *         mslice.shape[i] = 1
50803  *         mslice.strides[i] = mslice.strides[0]
50804  *         mslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
50805  *
50806  *
50807  */
50808     (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
50809   }
50810 
50811   /* "View.MemoryView":1337
50812  *
50813  * @cname('__pyx_memoryview_broadcast_leading')
50814  * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
50815  *                             int ndim,
50816  *                             int ndim_other) nogil:
50817  */
50818 
50819   /* function exit code */
50820 }
50821 
50822 /* "View.MemoryView":1359
50823  *
50824  * @cname('__pyx_memoryview_refcount_copying')
50825  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
50826  *                            int ndim, bint inc) nogil:
50827  *
50828  */
50829 
__pyx_memoryview_refcount_copying(__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_dtype_is_object,int __pyx_v_ndim,int __pyx_v_inc)50830 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) {
50831   int __pyx_t_1;
50832 
50833   /* "View.MemoryView":1363
50834  *
50835  *
50836  *     if dtype_is_object:             # <<<<<<<<<<<<<<
50837  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
50838  *                                            dst.strides, ndim, inc)
50839  */
50840   __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
50841   if (__pyx_t_1) {
50842 
50843     /* "View.MemoryView":1364
50844  *
50845  *     if dtype_is_object:
50846  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,             # <<<<<<<<<<<<<<
50847  *                                            dst.strides, ndim, inc)
50848  *
50849  */
50850     __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);
50851 
50852     /* "View.MemoryView":1363
50853  *
50854  *
50855  *     if dtype_is_object:             # <<<<<<<<<<<<<<
50856  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
50857  *                                            dst.strides, ndim, inc)
50858  */
50859   }
50860 
50861   /* "View.MemoryView":1359
50862  *
50863  * @cname('__pyx_memoryview_refcount_copying')
50864  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
50865  *                            int ndim, bint inc) nogil:
50866  *
50867  */
50868 
50869   /* function exit code */
50870 }
50871 
50872 /* "View.MemoryView":1368
50873  *
50874  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
50875  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
50876  *                                              Py_ssize_t *strides, int ndim,
50877  *                                              bint inc) with gil:
50878  */
50879 
__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)50880 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) {
50881   __Pyx_RefNannyDeclarations
50882   #ifdef WITH_THREAD
50883   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
50884   #endif
50885   __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);
50886 
50887   /* "View.MemoryView":1371
50888  *                                              Py_ssize_t *strides, int ndim,
50889  *                                              bint inc) with gil:
50890  *     refcount_objects_in_slice(data, shape, strides, ndim, inc)             # <<<<<<<<<<<<<<
50891  *
50892  * @cname('__pyx_memoryview_refcount_objects_in_slice')
50893  */
50894   __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
50895 
50896   /* "View.MemoryView":1368
50897  *
50898  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
50899  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
50900  *                                              Py_ssize_t *strides, int ndim,
50901  *                                              bint inc) with gil:
50902  */
50903 
50904   /* function exit code */
50905   __Pyx_RefNannyFinishContext();
50906   #ifdef WITH_THREAD
50907   __Pyx_PyGILState_Release(__pyx_gilstate_save);
50908   #endif
50909 }
50910 
50911 /* "View.MemoryView":1374
50912  *
50913  * @cname('__pyx_memoryview_refcount_objects_in_slice')
50914  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
50915  *                                     Py_ssize_t *strides, int ndim, bint inc):
50916  *     cdef Py_ssize_t i
50917  */
50918 
__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)50919 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) {
50920   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
50921   __Pyx_RefNannyDeclarations
50922   Py_ssize_t __pyx_t_1;
50923   Py_ssize_t __pyx_t_2;
50924   Py_ssize_t __pyx_t_3;
50925   int __pyx_t_4;
50926   __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);
50927 
50928   /* "View.MemoryView":1378
50929  *     cdef Py_ssize_t i
50930  *
50931  *     for i in range(shape[0]):             # <<<<<<<<<<<<<<
50932  *         if ndim == 1:
50933  *             if inc:
50934  */
50935   __pyx_t_1 = (__pyx_v_shape[0]);
50936   __pyx_t_2 = __pyx_t_1;
50937   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
50938     __pyx_v_i = __pyx_t_3;
50939 
50940     /* "View.MemoryView":1379
50941  *
50942  *     for i in range(shape[0]):
50943  *         if ndim == 1:             # <<<<<<<<<<<<<<
50944  *             if inc:
50945  *                 Py_INCREF((<PyObject **> data)[0])
50946  */
50947     __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
50948     if (__pyx_t_4) {
50949 
50950       /* "View.MemoryView":1380
50951  *     for i in range(shape[0]):
50952  *         if ndim == 1:
50953  *             if inc:             # <<<<<<<<<<<<<<
50954  *                 Py_INCREF((<PyObject **> data)[0])
50955  *             else:
50956  */
50957       __pyx_t_4 = (__pyx_v_inc != 0);
50958       if (__pyx_t_4) {
50959 
50960         /* "View.MemoryView":1381
50961  *         if ndim == 1:
50962  *             if inc:
50963  *                 Py_INCREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
50964  *             else:
50965  *                 Py_DECREF((<PyObject **> data)[0])
50966  */
50967         Py_INCREF((((PyObject **)__pyx_v_data)[0]));
50968 
50969         /* "View.MemoryView":1380
50970  *     for i in range(shape[0]):
50971  *         if ndim == 1:
50972  *             if inc:             # <<<<<<<<<<<<<<
50973  *                 Py_INCREF((<PyObject **> data)[0])
50974  *             else:
50975  */
50976         goto __pyx_L6;
50977       }
50978 
50979       /* "View.MemoryView":1383
50980  *                 Py_INCREF((<PyObject **> data)[0])
50981  *             else:
50982  *                 Py_DECREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
50983  *         else:
50984  *             refcount_objects_in_slice(data, shape + 1, strides + 1,
50985  */
50986       /*else*/ {
50987         Py_DECREF((((PyObject **)__pyx_v_data)[0]));
50988       }
50989       __pyx_L6:;
50990 
50991       /* "View.MemoryView":1379
50992  *
50993  *     for i in range(shape[0]):
50994  *         if ndim == 1:             # <<<<<<<<<<<<<<
50995  *             if inc:
50996  *                 Py_INCREF((<PyObject **> data)[0])
50997  */
50998       goto __pyx_L5;
50999     }
51000 
51001     /* "View.MemoryView":1385
51002  *                 Py_DECREF((<PyObject **> data)[0])
51003  *         else:
51004  *             refcount_objects_in_slice(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
51005  *                                       ndim - 1, inc)
51006  *
51007  */
51008     /*else*/ {
51009 
51010       /* "View.MemoryView":1386
51011  *         else:
51012  *             refcount_objects_in_slice(data, shape + 1, strides + 1,
51013  *                                       ndim - 1, inc)             # <<<<<<<<<<<<<<
51014  *
51015  *         data += strides[0]
51016  */
51017       __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
51018     }
51019     __pyx_L5:;
51020 
51021     /* "View.MemoryView":1388
51022  *                                       ndim - 1, inc)
51023  *
51024  *         data += strides[0]             # <<<<<<<<<<<<<<
51025  *
51026  *
51027  */
51028     __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
51029   }
51030 
51031   /* "View.MemoryView":1374
51032  *
51033  * @cname('__pyx_memoryview_refcount_objects_in_slice')
51034  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
51035  *                                     Py_ssize_t *strides, int ndim, bint inc):
51036  *     cdef Py_ssize_t i
51037  */
51038 
51039   /* function exit code */
51040   __Pyx_RefNannyFinishContext();
51041 }
51042 
51043 /* "View.MemoryView":1394
51044  *
51045  * @cname('__pyx_memoryview_slice_assign_scalar')
51046  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
51047  *                               size_t itemsize, void *item,
51048  *                               bint dtype_is_object) nogil:
51049  */
51050 
__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)51051 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) {
51052 
51053   /* "View.MemoryView":1397
51054  *                               size_t itemsize, void *item,
51055  *                               bint dtype_is_object) nogil:
51056  *     refcount_copying(dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
51057  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
51058  *                          itemsize, item)
51059  */
51060   __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
51061 
51062   /* "View.MemoryView":1398
51063  *                               bint dtype_is_object) nogil:
51064  *     refcount_copying(dst, dtype_is_object, ndim, False)
51065  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,             # <<<<<<<<<<<<<<
51066  *                          itemsize, item)
51067  *     refcount_copying(dst, dtype_is_object, ndim, True)
51068  */
51069   __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);
51070 
51071   /* "View.MemoryView":1400
51072  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
51073  *                          itemsize, item)
51074  *     refcount_copying(dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
51075  *
51076  *
51077  */
51078   __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
51079 
51080   /* "View.MemoryView":1394
51081  *
51082  * @cname('__pyx_memoryview_slice_assign_scalar')
51083  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
51084  *                               size_t itemsize, void *item,
51085  *                               bint dtype_is_object) nogil:
51086  */
51087 
51088   /* function exit code */
51089 }
51090 
51091 /* "View.MemoryView":1404
51092  *
51093  * @cname('__pyx_memoryview__slice_assign_scalar')
51094  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
51095  *                               Py_ssize_t *strides, int ndim,
51096  *                               size_t itemsize, void *item) nogil:
51097  */
51098 
__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)51099 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) {
51100   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
51101   Py_ssize_t __pyx_v_stride;
51102   Py_ssize_t __pyx_v_extent;
51103   int __pyx_t_1;
51104   Py_ssize_t __pyx_t_2;
51105   Py_ssize_t __pyx_t_3;
51106   Py_ssize_t __pyx_t_4;
51107 
51108   /* "View.MemoryView":1408
51109  *                               size_t itemsize, void *item) nogil:
51110  *     cdef Py_ssize_t i
51111  *     cdef Py_ssize_t stride = strides[0]             # <<<<<<<<<<<<<<
51112  *     cdef Py_ssize_t extent = shape[0]
51113  *
51114  */
51115   __pyx_v_stride = (__pyx_v_strides[0]);
51116 
51117   /* "View.MemoryView":1409
51118  *     cdef Py_ssize_t i
51119  *     cdef Py_ssize_t stride = strides[0]
51120  *     cdef Py_ssize_t extent = shape[0]             # <<<<<<<<<<<<<<
51121  *
51122  *     if ndim == 1:
51123  */
51124   __pyx_v_extent = (__pyx_v_shape[0]);
51125 
51126   /* "View.MemoryView":1411
51127  *     cdef Py_ssize_t extent = shape[0]
51128  *
51129  *     if ndim == 1:             # <<<<<<<<<<<<<<
51130  *         for i in range(extent):
51131  *             memcpy(data, item, itemsize)
51132  */
51133   __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
51134   if (__pyx_t_1) {
51135 
51136     /* "View.MemoryView":1412
51137  *
51138  *     if ndim == 1:
51139  *         for i in range(extent):             # <<<<<<<<<<<<<<
51140  *             memcpy(data, item, itemsize)
51141  *             data += stride
51142  */
51143     __pyx_t_2 = __pyx_v_extent;
51144     __pyx_t_3 = __pyx_t_2;
51145     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
51146       __pyx_v_i = __pyx_t_4;
51147 
51148       /* "View.MemoryView":1413
51149  *     if ndim == 1:
51150  *         for i in range(extent):
51151  *             memcpy(data, item, itemsize)             # <<<<<<<<<<<<<<
51152  *             data += stride
51153  *     else:
51154  */
51155       (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
51156 
51157       /* "View.MemoryView":1414
51158  *         for i in range(extent):
51159  *             memcpy(data, item, itemsize)
51160  *             data += stride             # <<<<<<<<<<<<<<
51161  *     else:
51162  *         for i in range(extent):
51163  */
51164       __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
51165     }
51166 
51167     /* "View.MemoryView":1411
51168  *     cdef Py_ssize_t extent = shape[0]
51169  *
51170  *     if ndim == 1:             # <<<<<<<<<<<<<<
51171  *         for i in range(extent):
51172  *             memcpy(data, item, itemsize)
51173  */
51174     goto __pyx_L3;
51175   }
51176 
51177   /* "View.MemoryView":1416
51178  *             data += stride
51179  *     else:
51180  *         for i in range(extent):             # <<<<<<<<<<<<<<
51181  *             _slice_assign_scalar(data, shape + 1, strides + 1,
51182  *                                 ndim - 1, itemsize, item)
51183  */
51184   /*else*/ {
51185     __pyx_t_2 = __pyx_v_extent;
51186     __pyx_t_3 = __pyx_t_2;
51187     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
51188       __pyx_v_i = __pyx_t_4;
51189 
51190       /* "View.MemoryView":1417
51191  *     else:
51192  *         for i in range(extent):
51193  *             _slice_assign_scalar(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
51194  *                                 ndim - 1, itemsize, item)
51195  *             data += stride
51196  */
51197       __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);
51198 
51199       /* "View.MemoryView":1419
51200  *             _slice_assign_scalar(data, shape + 1, strides + 1,
51201  *                                 ndim - 1, itemsize, item)
51202  *             data += stride             # <<<<<<<<<<<<<<
51203  *
51204  *
51205  */
51206       __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
51207     }
51208   }
51209   __pyx_L3:;
51210 
51211   /* "View.MemoryView":1404
51212  *
51213  * @cname('__pyx_memoryview__slice_assign_scalar')
51214  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
51215  *                               Py_ssize_t *strides, int ndim,
51216  *                               size_t itemsize, void *item) nogil:
51217  */
51218 
51219   /* function exit code */
51220 }
51221 
51222 /* "(tree fragment)":1
51223  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
51224  *     cdef object __pyx_PickleError
51225  *     cdef object __pyx_result
51226  */
51227 
51228 /* Python wrapper */
51229 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
51230 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)51231 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
51232   PyObject *__pyx_v___pyx_type = 0;
51233   long __pyx_v___pyx_checksum;
51234   PyObject *__pyx_v___pyx_state = 0;
51235   PyObject *__pyx_r = 0;
51236   __Pyx_RefNannyDeclarations
51237   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
51238   {
51239     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
51240     PyObject* values[3] = {0,0,0};
51241     if (unlikely(__pyx_kwds)) {
51242       Py_ssize_t kw_args;
51243       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
51244       switch (pos_args) {
51245         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
51246         CYTHON_FALLTHROUGH;
51247         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
51248         CYTHON_FALLTHROUGH;
51249         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
51250         CYTHON_FALLTHROUGH;
51251         case  0: break;
51252         default: goto __pyx_L5_argtuple_error;
51253       }
51254       kw_args = PyDict_Size(__pyx_kwds);
51255       switch (pos_args) {
51256         case  0:
51257         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
51258         else goto __pyx_L5_argtuple_error;
51259         CYTHON_FALLTHROUGH;
51260         case  1:
51261         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
51262         else {
51263           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(4, 1, __pyx_L3_error)
51264         }
51265         CYTHON_FALLTHROUGH;
51266         case  2:
51267         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
51268         else {
51269           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(4, 1, __pyx_L3_error)
51270         }
51271       }
51272       if (unlikely(kw_args > 0)) {
51273         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(4, 1, __pyx_L3_error)
51274       }
51275     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
51276       goto __pyx_L5_argtuple_error;
51277     } else {
51278       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
51279       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
51280       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
51281     }
51282     __pyx_v___pyx_type = values[0];
51283     __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 1, __pyx_L3_error)
51284     __pyx_v___pyx_state = values[2];
51285   }
51286   goto __pyx_L4_argument_unpacking_done;
51287   __pyx_L5_argtuple_error:;
51288   __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1, __pyx_L3_error)
51289   __pyx_L3_error:;
51290   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
51291   __Pyx_RefNannyFinishContext();
51292   return NULL;
51293   __pyx_L4_argument_unpacking_done:;
51294   __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
51295 
51296   /* function exit code */
51297   __Pyx_RefNannyFinishContext();
51298   return __pyx_r;
51299 }
51300 
__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)51301 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) {
51302   PyObject *__pyx_v___pyx_PickleError = 0;
51303   PyObject *__pyx_v___pyx_result = 0;
51304   PyObject *__pyx_r = NULL;
51305   __Pyx_RefNannyDeclarations
51306   int __pyx_t_1;
51307   PyObject *__pyx_t_2 = NULL;
51308   PyObject *__pyx_t_3 = NULL;
51309   PyObject *__pyx_t_4 = NULL;
51310   PyObject *__pyx_t_5 = NULL;
51311   int __pyx_t_6;
51312   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);
51313 
51314   /* "(tree fragment)":4
51315  *     cdef object __pyx_PickleError
51316  *     cdef object __pyx_result
51317  *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
51318  *         from pickle import PickleError as __pyx_PickleError
51319  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
51320  */
51321   __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
51322   if (__pyx_t_1) {
51323 
51324     /* "(tree fragment)":5
51325  *     cdef object __pyx_result
51326  *     if __pyx_checksum != 0xb068931:
51327  *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
51328  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
51329  *     __pyx_result = Enum.__new__(__pyx_type)
51330  */
51331     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 5, __pyx_L1_error)
51332     __Pyx_GOTREF(__pyx_t_2);
51333     __Pyx_INCREF(__pyx_n_s_PickleError);
51334     __Pyx_GIVEREF(__pyx_n_s_PickleError);
51335     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
51336     __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 5, __pyx_L1_error)
51337     __Pyx_GOTREF(__pyx_t_3);
51338     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
51339     __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 5, __pyx_L1_error)
51340     __Pyx_GOTREF(__pyx_t_2);
51341     __Pyx_INCREF(__pyx_t_2);
51342     __pyx_v___pyx_PickleError = __pyx_t_2;
51343     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
51344     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
51345 
51346     /* "(tree fragment)":6
51347  *     if __pyx_checksum != 0xb068931:
51348  *         from pickle import PickleError as __pyx_PickleError
51349  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)             # <<<<<<<<<<<<<<
51350  *     __pyx_result = Enum.__new__(__pyx_type)
51351  *     if __pyx_state is not None:
51352  */
51353     __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 6, __pyx_L1_error)
51354     __Pyx_GOTREF(__pyx_t_2);
51355     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 6, __pyx_L1_error)
51356     __Pyx_GOTREF(__pyx_t_4);
51357     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
51358     __Pyx_INCREF(__pyx_v___pyx_PickleError);
51359     __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
51360     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
51361       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
51362       if (likely(__pyx_t_5)) {
51363         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
51364         __Pyx_INCREF(__pyx_t_5);
51365         __Pyx_INCREF(function);
51366         __Pyx_DECREF_SET(__pyx_t_2, function);
51367       }
51368     }
51369     __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);
51370     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
51371     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
51372     if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 6, __pyx_L1_error)
51373     __Pyx_GOTREF(__pyx_t_3);
51374     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
51375     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
51376     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
51377     __PYX_ERR(4, 6, __pyx_L1_error)
51378 
51379     /* "(tree fragment)":4
51380  *     cdef object __pyx_PickleError
51381  *     cdef object __pyx_result
51382  *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
51383  *         from pickle import PickleError as __pyx_PickleError
51384  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
51385  */
51386   }
51387 
51388   /* "(tree fragment)":7
51389  *         from pickle import PickleError as __pyx_PickleError
51390  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
51391  *     __pyx_result = Enum.__new__(__pyx_type)             # <<<<<<<<<<<<<<
51392  *     if __pyx_state is not None:
51393  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
51394  */
51395   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 7, __pyx_L1_error)
51396   __Pyx_GOTREF(__pyx_t_2);
51397   __pyx_t_4 = NULL;
51398   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
51399     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
51400     if (likely(__pyx_t_4)) {
51401       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
51402       __Pyx_INCREF(__pyx_t_4);
51403       __Pyx_INCREF(function);
51404       __Pyx_DECREF_SET(__pyx_t_2, function);
51405     }
51406   }
51407   __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);
51408   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
51409   if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 7, __pyx_L1_error)
51410   __Pyx_GOTREF(__pyx_t_3);
51411   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
51412   __pyx_v___pyx_result = __pyx_t_3;
51413   __pyx_t_3 = 0;
51414 
51415   /* "(tree fragment)":8
51416  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
51417  *     __pyx_result = Enum.__new__(__pyx_type)
51418  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
51419  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
51420  *     return __pyx_result
51421  */
51422   __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
51423   __pyx_t_6 = (__pyx_t_1 != 0);
51424   if (__pyx_t_6) {
51425 
51426     /* "(tree fragment)":9
51427  *     __pyx_result = Enum.__new__(__pyx_type)
51428  *     if __pyx_state is not None:
51429  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
51430  *     return __pyx_result
51431  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
51432  */
51433     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(4, 9, __pyx_L1_error)
51434     __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(4, 9, __pyx_L1_error)
51435     __Pyx_GOTREF(__pyx_t_3);
51436     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
51437 
51438     /* "(tree fragment)":8
51439  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
51440  *     __pyx_result = Enum.__new__(__pyx_type)
51441  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
51442  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
51443  *     return __pyx_result
51444  */
51445   }
51446 
51447   /* "(tree fragment)":10
51448  *     if __pyx_state is not None:
51449  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
51450  *     return __pyx_result             # <<<<<<<<<<<<<<
51451  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
51452  *     __pyx_result.name = __pyx_state[0]
51453  */
51454   __Pyx_XDECREF(__pyx_r);
51455   __Pyx_INCREF(__pyx_v___pyx_result);
51456   __pyx_r = __pyx_v___pyx_result;
51457   goto __pyx_L0;
51458 
51459   /* "(tree fragment)":1
51460  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
51461  *     cdef object __pyx_PickleError
51462  *     cdef object __pyx_result
51463  */
51464 
51465   /* function exit code */
51466   __pyx_L1_error:;
51467   __Pyx_XDECREF(__pyx_t_2);
51468   __Pyx_XDECREF(__pyx_t_3);
51469   __Pyx_XDECREF(__pyx_t_4);
51470   __Pyx_XDECREF(__pyx_t_5);
51471   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
51472   __pyx_r = NULL;
51473   __pyx_L0:;
51474   __Pyx_XDECREF(__pyx_v___pyx_PickleError);
51475   __Pyx_XDECREF(__pyx_v___pyx_result);
51476   __Pyx_XGIVEREF(__pyx_r);
51477   __Pyx_RefNannyFinishContext();
51478   return __pyx_r;
51479 }
51480 
51481 /* "(tree fragment)":11
51482  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
51483  *     return __pyx_result
51484  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
51485  *     __pyx_result.name = __pyx_state[0]
51486  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
51487  */
51488 
__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)51489 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
51490   PyObject *__pyx_r = NULL;
51491   __Pyx_RefNannyDeclarations
51492   PyObject *__pyx_t_1 = NULL;
51493   int __pyx_t_2;
51494   Py_ssize_t __pyx_t_3;
51495   int __pyx_t_4;
51496   int __pyx_t_5;
51497   PyObject *__pyx_t_6 = NULL;
51498   PyObject *__pyx_t_7 = NULL;
51499   PyObject *__pyx_t_8 = NULL;
51500   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);
51501 
51502   /* "(tree fragment)":12
51503  *     return __pyx_result
51504  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
51505  *     __pyx_result.name = __pyx_state[0]             # <<<<<<<<<<<<<<
51506  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
51507  *         __pyx_result.__dict__.update(__pyx_state[1])
51508  */
51509   if (unlikely(__pyx_v___pyx_state == Py_None)) {
51510     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
51511     __PYX_ERR(4, 12, __pyx_L1_error)
51512   }
51513   __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(4, 12, __pyx_L1_error)
51514   __Pyx_GOTREF(__pyx_t_1);
51515   __Pyx_GIVEREF(__pyx_t_1);
51516   __Pyx_GOTREF(__pyx_v___pyx_result->name);
51517   __Pyx_DECREF(__pyx_v___pyx_result->name);
51518   __pyx_v___pyx_result->name = __pyx_t_1;
51519   __pyx_t_1 = 0;
51520 
51521   /* "(tree fragment)":13
51522  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
51523  *     __pyx_result.name = __pyx_state[0]
51524  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
51525  *         __pyx_result.__dict__.update(__pyx_state[1])
51526  */
51527   if (unlikely(__pyx_v___pyx_state == Py_None)) {
51528     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
51529     __PYX_ERR(4, 13, __pyx_L1_error)
51530   }
51531   __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
51532   __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
51533   if (__pyx_t_4) {
51534   } else {
51535     __pyx_t_2 = __pyx_t_4;
51536     goto __pyx_L4_bool_binop_done;
51537   }
51538   __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
51539   __pyx_t_5 = (__pyx_t_4 != 0);
51540   __pyx_t_2 = __pyx_t_5;
51541   __pyx_L4_bool_binop_done:;
51542   if (__pyx_t_2) {
51543 
51544     /* "(tree fragment)":14
51545  *     __pyx_result.name = __pyx_state[0]
51546  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
51547  *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
51548  */
51549     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
51550     __Pyx_GOTREF(__pyx_t_6);
51551     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 14, __pyx_L1_error)
51552     __Pyx_GOTREF(__pyx_t_7);
51553     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
51554     if (unlikely(__pyx_v___pyx_state == Py_None)) {
51555       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
51556       __PYX_ERR(4, 14, __pyx_L1_error)
51557     }
51558     __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(4, 14, __pyx_L1_error)
51559     __Pyx_GOTREF(__pyx_t_6);
51560     __pyx_t_8 = NULL;
51561     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
51562       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
51563       if (likely(__pyx_t_8)) {
51564         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
51565         __Pyx_INCREF(__pyx_t_8);
51566         __Pyx_INCREF(function);
51567         __Pyx_DECREF_SET(__pyx_t_7, function);
51568       }
51569     }
51570     __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);
51571     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
51572     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
51573     if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14, __pyx_L1_error)
51574     __Pyx_GOTREF(__pyx_t_1);
51575     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
51576     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
51577 
51578     /* "(tree fragment)":13
51579  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
51580  *     __pyx_result.name = __pyx_state[0]
51581  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
51582  *         __pyx_result.__dict__.update(__pyx_state[1])
51583  */
51584   }
51585 
51586   /* "(tree fragment)":11
51587  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
51588  *     return __pyx_result
51589  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
51590  *     __pyx_result.name = __pyx_state[0]
51591  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
51592  */
51593 
51594   /* function exit code */
51595   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
51596   goto __pyx_L0;
51597   __pyx_L1_error:;
51598   __Pyx_XDECREF(__pyx_t_1);
51599   __Pyx_XDECREF(__pyx_t_6);
51600   __Pyx_XDECREF(__pyx_t_7);
51601   __Pyx_XDECREF(__pyx_t_8);
51602   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
51603   __pyx_r = 0;
51604   __pyx_L0:;
51605   __Pyx_XGIVEREF(__pyx_r);
51606   __Pyx_RefNannyFinishContext();
51607   return __pyx_r;
51608 }
51609 
51610 /* "BufferFormatFromTypeInfo":1460
51611  *
51612  * @cname('__pyx_format_from_typeinfo')
51613  * cdef bytes format_from_typeinfo(__Pyx_TypeInfo *type):             # <<<<<<<<<<<<<<
51614  *     cdef __Pyx_StructField *field
51615  *     cdef __pyx_typeinfo_string fmt
51616  */
51617 
__pyx_format_from_typeinfo(__Pyx_TypeInfo * __pyx_v_type)51618 static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo *__pyx_v_type) {
51619   __Pyx_StructField *__pyx_v_field;
51620   struct __pyx_typeinfo_string __pyx_v_fmt;
51621   PyObject *__pyx_v_part = 0;
51622   PyObject *__pyx_v_result = 0;
51623   PyObject *__pyx_v_alignment = NULL;
51624   PyObject *__pyx_v_parts = NULL;
51625   PyObject *__pyx_v_extents = NULL;
51626   int __pyx_v_i;
51627   PyObject *__pyx_r = NULL;
51628   __Pyx_RefNannyDeclarations
51629   int __pyx_t_1;
51630   int __pyx_t_2;
51631   PyObject *__pyx_t_3 = NULL;
51632   __Pyx_StructField *__pyx_t_4;
51633   PyObject *__pyx_t_5 = NULL;
51634   PyObject *__pyx_t_6 = NULL;
51635   int __pyx_t_7;
51636   int __pyx_t_8;
51637   int __pyx_t_9;
51638   int __pyx_t_10;
51639   __Pyx_RefNannySetupContext("format_from_typeinfo", 0);
51640 
51641   /* "BufferFormatFromTypeInfo":1465
51642  *     cdef bytes part, result
51643  *
51644  *     if type.typegroup == 'S':             # <<<<<<<<<<<<<<
51645  *         assert type.fields != NULL and type.fields.type != NULL
51646  *
51647  */
51648   __pyx_t_1 = ((__pyx_v_type->typegroup == 'S') != 0);
51649   if (__pyx_t_1) {
51650 
51651     /* "BufferFormatFromTypeInfo":1466
51652  *
51653  *     if type.typegroup == 'S':
51654  *         assert type.fields != NULL and type.fields.type != NULL             # <<<<<<<<<<<<<<
51655  *
51656  *         if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT:
51657  */
51658     #ifndef CYTHON_WITHOUT_ASSERTIONS
51659     if (unlikely(!Py_OptimizeFlag)) {
51660       __pyx_t_2 = ((__pyx_v_type->fields != NULL) != 0);
51661       if (__pyx_t_2) {
51662       } else {
51663         __pyx_t_1 = __pyx_t_2;
51664         goto __pyx_L4_bool_binop_done;
51665       }
51666       __pyx_t_2 = ((__pyx_v_type->fields->type != NULL) != 0);
51667       __pyx_t_1 = __pyx_t_2;
51668       __pyx_L4_bool_binop_done:;
51669       if (unlikely(!__pyx_t_1)) {
51670         PyErr_SetNone(PyExc_AssertionError);
51671         __PYX_ERR(4, 1466, __pyx_L1_error)
51672       }
51673     }
51674     #endif
51675 
51676     /* "BufferFormatFromTypeInfo":1468
51677  *         assert type.fields != NULL and type.fields.type != NULL
51678  *
51679  *         if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT:             # <<<<<<<<<<<<<<
51680  *             alignment = b'^'
51681  *         else:
51682  */
51683     __pyx_t_1 = ((__pyx_v_type->flags & __PYX_BUF_FLAGS_PACKED_STRUCT) != 0);
51684     if (__pyx_t_1) {
51685 
51686       /* "BufferFormatFromTypeInfo":1469
51687  *
51688  *         if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT:
51689  *             alignment = b'^'             # <<<<<<<<<<<<<<
51690  *         else:
51691  *             alignment = b''
51692  */
51693       __Pyx_INCREF(__pyx_kp_b__38);
51694       __pyx_v_alignment = __pyx_kp_b__38;
51695 
51696       /* "BufferFormatFromTypeInfo":1468
51697  *         assert type.fields != NULL and type.fields.type != NULL
51698  *
51699  *         if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT:             # <<<<<<<<<<<<<<
51700  *             alignment = b'^'
51701  *         else:
51702  */
51703       goto __pyx_L6;
51704     }
51705 
51706     /* "BufferFormatFromTypeInfo":1471
51707  *             alignment = b'^'
51708  *         else:
51709  *             alignment = b''             # <<<<<<<<<<<<<<
51710  *
51711  *         parts = [b"T{"]
51712  */
51713     /*else*/ {
51714       __Pyx_INCREF(__pyx_kp_b_);
51715       __pyx_v_alignment = __pyx_kp_b_;
51716     }
51717     __pyx_L6:;
51718 
51719     /* "BufferFormatFromTypeInfo":1473
51720  *             alignment = b''
51721  *
51722  *         parts = [b"T{"]             # <<<<<<<<<<<<<<
51723  *         field = type.fields
51724  *
51725  */
51726     __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1473, __pyx_L1_error)
51727     __Pyx_GOTREF(__pyx_t_3);
51728     __Pyx_INCREF(__pyx_kp_b_T);
51729     __Pyx_GIVEREF(__pyx_kp_b_T);
51730     PyList_SET_ITEM(__pyx_t_3, 0, __pyx_kp_b_T);
51731     __pyx_v_parts = ((PyObject*)__pyx_t_3);
51732     __pyx_t_3 = 0;
51733 
51734     /* "BufferFormatFromTypeInfo":1474
51735  *
51736  *         parts = [b"T{"]
51737  *         field = type.fields             # <<<<<<<<<<<<<<
51738  *
51739  *         while field.type:
51740  */
51741     __pyx_t_4 = __pyx_v_type->fields;
51742     __pyx_v_field = __pyx_t_4;
51743 
51744     /* "BufferFormatFromTypeInfo":1476
51745  *         field = type.fields
51746  *
51747  *         while field.type:             # <<<<<<<<<<<<<<
51748  *             part = format_from_typeinfo(field.type)
51749  *             parts.append(part + b':' + field.name + b':')
51750  */
51751     while (1) {
51752       __pyx_t_1 = (__pyx_v_field->type != 0);
51753       if (!__pyx_t_1) break;
51754 
51755       /* "BufferFormatFromTypeInfo":1477
51756  *
51757  *         while field.type:
51758  *             part = format_from_typeinfo(field.type)             # <<<<<<<<<<<<<<
51759  *             parts.append(part + b':' + field.name + b':')
51760  *             field += 1
51761  */
51762       __pyx_t_3 = __pyx_format_from_typeinfo(__pyx_v_field->type); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1477, __pyx_L1_error)
51763       __Pyx_GOTREF(__pyx_t_3);
51764       __Pyx_XDECREF_SET(__pyx_v_part, ((PyObject*)__pyx_t_3));
51765       __pyx_t_3 = 0;
51766 
51767       /* "BufferFormatFromTypeInfo":1478
51768  *         while field.type:
51769  *             part = format_from_typeinfo(field.type)
51770  *             parts.append(part + b':' + field.name + b':')             # <<<<<<<<<<<<<<
51771  *             field += 1
51772  *
51773  */
51774       __pyx_t_3 = PyNumber_Add(__pyx_v_part, __pyx_kp_b__39); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1478, __pyx_L1_error)
51775       __Pyx_GOTREF(__pyx_t_3);
51776       __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_field->name); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 1478, __pyx_L1_error)
51777       __Pyx_GOTREF(__pyx_t_5);
51778       __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 1478, __pyx_L1_error)
51779       __Pyx_GOTREF(__pyx_t_6);
51780       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
51781       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
51782       __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_kp_b__39); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 1478, __pyx_L1_error)
51783       __Pyx_GOTREF(__pyx_t_5);
51784       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
51785       __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_parts, __pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(4, 1478, __pyx_L1_error)
51786       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
51787 
51788       /* "BufferFormatFromTypeInfo":1479
51789  *             part = format_from_typeinfo(field.type)
51790  *             parts.append(part + b':' + field.name + b':')
51791  *             field += 1             # <<<<<<<<<<<<<<
51792  *
51793  *         result = alignment.join(parts) + b'}'
51794  */
51795       __pyx_v_field = (__pyx_v_field + 1);
51796     }
51797 
51798     /* "BufferFormatFromTypeInfo":1481
51799  *             field += 1
51800  *
51801  *         result = alignment.join(parts) + b'}'             # <<<<<<<<<<<<<<
51802  *     else:
51803  *         fmt = __Pyx_TypeInfoToFormat(type)
51804  */
51805     __pyx_t_5 = __Pyx_PyBytes_Join(__pyx_v_alignment, __pyx_v_parts); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 1481, __pyx_L1_error)
51806     __Pyx_GOTREF(__pyx_t_5);
51807     __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_kp_b__40); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 1481, __pyx_L1_error)
51808     __Pyx_GOTREF(__pyx_t_6);
51809     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
51810     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(4, 1481, __pyx_L1_error)
51811     __pyx_v_result = ((PyObject*)__pyx_t_6);
51812     __pyx_t_6 = 0;
51813 
51814     /* "BufferFormatFromTypeInfo":1465
51815  *     cdef bytes part, result
51816  *
51817  *     if type.typegroup == 'S':             # <<<<<<<<<<<<<<
51818  *         assert type.fields != NULL and type.fields.type != NULL
51819  *
51820  */
51821     goto __pyx_L3;
51822   }
51823 
51824   /* "BufferFormatFromTypeInfo":1483
51825  *         result = alignment.join(parts) + b'}'
51826  *     else:
51827  *         fmt = __Pyx_TypeInfoToFormat(type)             # <<<<<<<<<<<<<<
51828  *         if type.arraysize[0]:
51829  *             extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]
51830  */
51831   /*else*/ {
51832     __pyx_v_fmt = __Pyx_TypeInfoToFormat(__pyx_v_type);
51833 
51834     /* "BufferFormatFromTypeInfo":1484
51835  *     else:
51836  *         fmt = __Pyx_TypeInfoToFormat(type)
51837  *         if type.arraysize[0]:             # <<<<<<<<<<<<<<
51838  *             extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]
51839  *             result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string
51840  */
51841     __pyx_t_1 = ((__pyx_v_type->arraysize[0]) != 0);
51842     if (__pyx_t_1) {
51843 
51844       /* "BufferFormatFromTypeInfo":1485
51845  *         fmt = __Pyx_TypeInfoToFormat(type)
51846  *         if type.arraysize[0]:
51847  *             extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]             # <<<<<<<<<<<<<<
51848  *             result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string
51849  *         else:
51850  */
51851       __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 1485, __pyx_L1_error)
51852       __Pyx_GOTREF(__pyx_t_6);
51853       __pyx_t_8 = __pyx_v_type->ndim;
51854       __pyx_t_9 = __pyx_t_8;
51855       for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
51856         __pyx_v_i = __pyx_t_10;
51857         __pyx_t_5 = __Pyx_PyInt_FromSize_t((__pyx_v_type->arraysize[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 1485, __pyx_L1_error)
51858         __Pyx_GOTREF(__pyx_t_5);
51859         __pyx_t_3 = __Pyx_PyObject_Unicode(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1485, __pyx_L1_error)
51860         __Pyx_GOTREF(__pyx_t_3);
51861         __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
51862         if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_3))) __PYX_ERR(4, 1485, __pyx_L1_error)
51863         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
51864       }
51865       __pyx_v_extents = ((PyObject*)__pyx_t_6);
51866       __pyx_t_6 = 0;
51867 
51868       /* "BufferFormatFromTypeInfo":1486
51869  *         if type.arraysize[0]:
51870  *             extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]
51871  *             result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string             # <<<<<<<<<<<<<<
51872  *         else:
51873  *             result = fmt.string
51874  */
51875       __pyx_t_6 = PyUnicode_Join(__pyx_kp_u__41, __pyx_v_extents); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 1486, __pyx_L1_error)
51876       __Pyx_GOTREF(__pyx_t_6);
51877       __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_s_2, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1486, __pyx_L1_error)
51878       __Pyx_GOTREF(__pyx_t_3);
51879       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
51880       __pyx_t_6 = PyUnicode_AsASCIIString(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 1486, __pyx_L1_error)
51881       __Pyx_GOTREF(__pyx_t_6);
51882       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
51883       __pyx_t_3 = __Pyx_PyObject_FromString(__pyx_v_fmt.string); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1486, __pyx_L1_error)
51884       __Pyx_GOTREF(__pyx_t_3);
51885       __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 1486, __pyx_L1_error)
51886       __Pyx_GOTREF(__pyx_t_5);
51887       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
51888       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
51889       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(4, 1486, __pyx_L1_error)
51890       __pyx_v_result = ((PyObject*)__pyx_t_5);
51891       __pyx_t_5 = 0;
51892 
51893       /* "BufferFormatFromTypeInfo":1484
51894  *     else:
51895  *         fmt = __Pyx_TypeInfoToFormat(type)
51896  *         if type.arraysize[0]:             # <<<<<<<<<<<<<<
51897  *             extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]
51898  *             result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string
51899  */
51900       goto __pyx_L9;
51901     }
51902 
51903     /* "BufferFormatFromTypeInfo":1488
51904  *             result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string
51905  *         else:
51906  *             result = fmt.string             # <<<<<<<<<<<<<<
51907  *
51908  *     return result
51909  */
51910     /*else*/ {
51911       __pyx_t_5 = __Pyx_PyObject_FromString(__pyx_v_fmt.string); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 1488, __pyx_L1_error)
51912       __Pyx_GOTREF(__pyx_t_5);
51913       __pyx_v_result = ((PyObject*)__pyx_t_5);
51914       __pyx_t_5 = 0;
51915     }
51916     __pyx_L9:;
51917   }
51918   __pyx_L3:;
51919 
51920   /* "BufferFormatFromTypeInfo":1490
51921  *             result = fmt.string
51922  *
51923  *     return result             # <<<<<<<<<<<<<<
51924  */
51925   __Pyx_XDECREF(__pyx_r);
51926   __Pyx_INCREF(__pyx_v_result);
51927   __pyx_r = __pyx_v_result;
51928   goto __pyx_L0;
51929 
51930   /* "BufferFormatFromTypeInfo":1460
51931  *
51932  * @cname('__pyx_format_from_typeinfo')
51933  * cdef bytes format_from_typeinfo(__Pyx_TypeInfo *type):             # <<<<<<<<<<<<<<
51934  *     cdef __Pyx_StructField *field
51935  *     cdef __pyx_typeinfo_string fmt
51936  */
51937 
51938   /* function exit code */
51939   __pyx_L1_error:;
51940   __Pyx_XDECREF(__pyx_t_3);
51941   __Pyx_XDECREF(__pyx_t_5);
51942   __Pyx_XDECREF(__pyx_t_6);
51943   __Pyx_AddTraceback("BufferFormatFromTypeInfo.format_from_typeinfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
51944   __pyx_r = 0;
51945   __pyx_L0:;
51946   __Pyx_XDECREF(__pyx_v_part);
51947   __Pyx_XDECREF(__pyx_v_result);
51948   __Pyx_XDECREF(__pyx_v_alignment);
51949   __Pyx_XDECREF(__pyx_v_parts);
51950   __Pyx_XDECREF(__pyx_v_extents);
51951   __Pyx_XGIVEREF(__pyx_r);
51952   __Pyx_RefNannyFinishContext();
51953   return __pyx_r;
51954 }
51955 static struct __pyx_vtabstruct_array __pyx_vtable_array;
51956 
__pyx_tp_new_array(PyTypeObject * t,PyObject * a,PyObject * k)51957 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
51958   struct __pyx_array_obj *p;
51959   PyObject *o;
51960   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
51961     o = (*t->tp_alloc)(t, 0);
51962   } else {
51963     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
51964   }
51965   if (unlikely(!o)) return 0;
51966   p = ((struct __pyx_array_obj *)o);
51967   p->__pyx_vtab = __pyx_vtabptr_array;
51968   p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
51969   p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
51970   if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
51971   return o;
51972   bad:
51973   Py_DECREF(o); o = 0;
51974   return NULL;
51975 }
51976 
__pyx_tp_dealloc_array(PyObject * o)51977 static void __pyx_tp_dealloc_array(PyObject *o) {
51978   struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
51979   #if CYTHON_USE_TP_FINALIZE
51980   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))) {
51981     if (PyObject_CallFinalizerFromDealloc(o)) return;
51982   }
51983   #endif
51984   {
51985     PyObject *etype, *eval, *etb;
51986     PyErr_Fetch(&etype, &eval, &etb);
51987     ++Py_REFCNT(o);
51988     __pyx_array___dealloc__(o);
51989     --Py_REFCNT(o);
51990     PyErr_Restore(etype, eval, etb);
51991   }
51992   Py_CLEAR(p->mode);
51993   Py_CLEAR(p->_format);
51994   (*Py_TYPE(o)->tp_free)(o);
51995 }
__pyx_sq_item_array(PyObject * o,Py_ssize_t i)51996 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
51997   PyObject *r;
51998   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
51999   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
52000   Py_DECREF(x);
52001   return r;
52002 }
52003 
__pyx_mp_ass_subscript_array(PyObject * o,PyObject * i,PyObject * v)52004 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
52005   if (v) {
52006     return __pyx_array___setitem__(o, i, v);
52007   }
52008   else {
52009     PyErr_Format(PyExc_NotImplementedError,
52010       "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
52011     return -1;
52012   }
52013 }
52014 
__pyx_tp_getattro_array(PyObject * o,PyObject * n)52015 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
52016   PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
52017   if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
52018     PyErr_Clear();
52019     v = __pyx_array___getattr__(o, n);
52020   }
52021   return v;
52022 }
52023 
__pyx_getprop___pyx_array_memview(PyObject * o,CYTHON_UNUSED void * x)52024 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
52025   return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
52026 }
52027 
52028 static PyMethodDef __pyx_methods_array[] = {
52029   {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
52030   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
52031   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
52032   {0, 0, 0, 0}
52033 };
52034 
52035 static struct PyGetSetDef __pyx_getsets_array[] = {
52036   {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
52037   {0, 0, 0, 0, 0}
52038 };
52039 
52040 static PySequenceMethods __pyx_tp_as_sequence_array = {
52041   __pyx_array___len__, /*sq_length*/
52042   0, /*sq_concat*/
52043   0, /*sq_repeat*/
52044   __pyx_sq_item_array, /*sq_item*/
52045   0, /*sq_slice*/
52046   0, /*sq_ass_item*/
52047   0, /*sq_ass_slice*/
52048   0, /*sq_contains*/
52049   0, /*sq_inplace_concat*/
52050   0, /*sq_inplace_repeat*/
52051 };
52052 
52053 static PyMappingMethods __pyx_tp_as_mapping_array = {
52054   __pyx_array___len__, /*mp_length*/
52055   __pyx_array___getitem__, /*mp_subscript*/
52056   __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
52057 };
52058 
52059 static PyBufferProcs __pyx_tp_as_buffer_array = {
52060   #if PY_MAJOR_VERSION < 3
52061   0, /*bf_getreadbuffer*/
52062   #endif
52063   #if PY_MAJOR_VERSION < 3
52064   0, /*bf_getwritebuffer*/
52065   #endif
52066   #if PY_MAJOR_VERSION < 3
52067   0, /*bf_getsegcount*/
52068   #endif
52069   #if PY_MAJOR_VERSION < 3
52070   0, /*bf_getcharbuffer*/
52071   #endif
52072   __pyx_array_getbuffer, /*bf_getbuffer*/
52073   0, /*bf_releasebuffer*/
52074 };
52075 
52076 static PyTypeObject __pyx_type___pyx_array = {
52077   PyVarObject_HEAD_INIT(0, 0)
52078   "yt.utilities.lib.geometry_utils.array", /*tp_name*/
52079   sizeof(struct __pyx_array_obj), /*tp_basicsize*/
52080   0, /*tp_itemsize*/
52081   __pyx_tp_dealloc_array, /*tp_dealloc*/
52082   0, /*tp_print*/
52083   0, /*tp_getattr*/
52084   0, /*tp_setattr*/
52085   #if PY_MAJOR_VERSION < 3
52086   0, /*tp_compare*/
52087   #endif
52088   #if PY_MAJOR_VERSION >= 3
52089   0, /*tp_as_async*/
52090   #endif
52091   0, /*tp_repr*/
52092   0, /*tp_as_number*/
52093   &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
52094   &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
52095   0, /*tp_hash*/
52096   0, /*tp_call*/
52097   0, /*tp_str*/
52098   __pyx_tp_getattro_array, /*tp_getattro*/
52099   0, /*tp_setattro*/
52100   &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
52101   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
52102   0, /*tp_doc*/
52103   0, /*tp_traverse*/
52104   0, /*tp_clear*/
52105   0, /*tp_richcompare*/
52106   0, /*tp_weaklistoffset*/
52107   0, /*tp_iter*/
52108   0, /*tp_iternext*/
52109   __pyx_methods_array, /*tp_methods*/
52110   0, /*tp_members*/
52111   __pyx_getsets_array, /*tp_getset*/
52112   0, /*tp_base*/
52113   0, /*tp_dict*/
52114   0, /*tp_descr_get*/
52115   0, /*tp_descr_set*/
52116   0, /*tp_dictoffset*/
52117   0, /*tp_init*/
52118   0, /*tp_alloc*/
52119   __pyx_tp_new_array, /*tp_new*/
52120   0, /*tp_free*/
52121   0, /*tp_is_gc*/
52122   0, /*tp_bases*/
52123   0, /*tp_mro*/
52124   0, /*tp_cache*/
52125   0, /*tp_subclasses*/
52126   0, /*tp_weaklist*/
52127   0, /*tp_del*/
52128   0, /*tp_version_tag*/
52129   #if PY_VERSION_HEX >= 0x030400a1
52130   0, /*tp_finalize*/
52131   #endif
52132   #if PY_VERSION_HEX >= 0x030800b1
52133   0, /*tp_vectorcall*/
52134   #endif
52135 };
52136 
__pyx_tp_new_Enum(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)52137 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
52138   struct __pyx_MemviewEnum_obj *p;
52139   PyObject *o;
52140   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
52141     o = (*t->tp_alloc)(t, 0);
52142   } else {
52143     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
52144   }
52145   if (unlikely(!o)) return 0;
52146   p = ((struct __pyx_MemviewEnum_obj *)o);
52147   p->name = Py_None; Py_INCREF(Py_None);
52148   return o;
52149 }
52150 
__pyx_tp_dealloc_Enum(PyObject * o)52151 static void __pyx_tp_dealloc_Enum(PyObject *o) {
52152   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
52153   #if CYTHON_USE_TP_FINALIZE
52154   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
52155     if (PyObject_CallFinalizerFromDealloc(o)) return;
52156   }
52157   #endif
52158   PyObject_GC_UnTrack(o);
52159   Py_CLEAR(p->name);
52160   (*Py_TYPE(o)->tp_free)(o);
52161 }
52162 
__pyx_tp_traverse_Enum(PyObject * o,visitproc v,void * a)52163 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
52164   int e;
52165   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
52166   if (p->name) {
52167     e = (*v)(p->name, a); if (e) return e;
52168   }
52169   return 0;
52170 }
52171 
__pyx_tp_clear_Enum(PyObject * o)52172 static int __pyx_tp_clear_Enum(PyObject *o) {
52173   PyObject* tmp;
52174   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
52175   tmp = ((PyObject*)p->name);
52176   p->name = Py_None; Py_INCREF(Py_None);
52177   Py_XDECREF(tmp);
52178   return 0;
52179 }
52180 
52181 static PyMethodDef __pyx_methods_Enum[] = {
52182   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
52183   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
52184   {0, 0, 0, 0}
52185 };
52186 
52187 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
52188   PyVarObject_HEAD_INIT(0, 0)
52189   "yt.utilities.lib.geometry_utils.Enum", /*tp_name*/
52190   sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
52191   0, /*tp_itemsize*/
52192   __pyx_tp_dealloc_Enum, /*tp_dealloc*/
52193   0, /*tp_print*/
52194   0, /*tp_getattr*/
52195   0, /*tp_setattr*/
52196   #if PY_MAJOR_VERSION < 3
52197   0, /*tp_compare*/
52198   #endif
52199   #if PY_MAJOR_VERSION >= 3
52200   0, /*tp_as_async*/
52201   #endif
52202   __pyx_MemviewEnum___repr__, /*tp_repr*/
52203   0, /*tp_as_number*/
52204   0, /*tp_as_sequence*/
52205   0, /*tp_as_mapping*/
52206   0, /*tp_hash*/
52207   0, /*tp_call*/
52208   0, /*tp_str*/
52209   0, /*tp_getattro*/
52210   0, /*tp_setattro*/
52211   0, /*tp_as_buffer*/
52212   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
52213   0, /*tp_doc*/
52214   __pyx_tp_traverse_Enum, /*tp_traverse*/
52215   __pyx_tp_clear_Enum, /*tp_clear*/
52216   0, /*tp_richcompare*/
52217   0, /*tp_weaklistoffset*/
52218   0, /*tp_iter*/
52219   0, /*tp_iternext*/
52220   __pyx_methods_Enum, /*tp_methods*/
52221   0, /*tp_members*/
52222   0, /*tp_getset*/
52223   0, /*tp_base*/
52224   0, /*tp_dict*/
52225   0, /*tp_descr_get*/
52226   0, /*tp_descr_set*/
52227   0, /*tp_dictoffset*/
52228   __pyx_MemviewEnum___init__, /*tp_init*/
52229   0, /*tp_alloc*/
52230   __pyx_tp_new_Enum, /*tp_new*/
52231   0, /*tp_free*/
52232   0, /*tp_is_gc*/
52233   0, /*tp_bases*/
52234   0, /*tp_mro*/
52235   0, /*tp_cache*/
52236   0, /*tp_subclasses*/
52237   0, /*tp_weaklist*/
52238   0, /*tp_del*/
52239   0, /*tp_version_tag*/
52240   #if PY_VERSION_HEX >= 0x030400a1
52241   0, /*tp_finalize*/
52242   #endif
52243   #if PY_VERSION_HEX >= 0x030800b1
52244   0, /*tp_vectorcall*/
52245   #endif
52246 };
52247 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
52248 
__pyx_tp_new_memoryview(PyTypeObject * t,PyObject * a,PyObject * k)52249 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
52250   struct __pyx_memoryview_obj *p;
52251   PyObject *o;
52252   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
52253     o = (*t->tp_alloc)(t, 0);
52254   } else {
52255     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
52256   }
52257   if (unlikely(!o)) return 0;
52258   p = ((struct __pyx_memoryview_obj *)o);
52259   p->__pyx_vtab = __pyx_vtabptr_memoryview;
52260   p->obj = Py_None; Py_INCREF(Py_None);
52261   p->_size = Py_None; Py_INCREF(Py_None);
52262   p->_array_interface = Py_None; Py_INCREF(Py_None);
52263   p->view.obj = NULL;
52264   if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
52265   return o;
52266   bad:
52267   Py_DECREF(o); o = 0;
52268   return NULL;
52269 }
52270 
__pyx_tp_dealloc_memoryview(PyObject * o)52271 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
52272   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
52273   #if CYTHON_USE_TP_FINALIZE
52274   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
52275     if (PyObject_CallFinalizerFromDealloc(o)) return;
52276   }
52277   #endif
52278   PyObject_GC_UnTrack(o);
52279   {
52280     PyObject *etype, *eval, *etb;
52281     PyErr_Fetch(&etype, &eval, &etb);
52282     ++Py_REFCNT(o);
52283     __pyx_memoryview___dealloc__(o);
52284     --Py_REFCNT(o);
52285     PyErr_Restore(etype, eval, etb);
52286   }
52287   Py_CLEAR(p->obj);
52288   Py_CLEAR(p->_size);
52289   Py_CLEAR(p->_array_interface);
52290   (*Py_TYPE(o)->tp_free)(o);
52291 }
52292 
__pyx_tp_traverse_memoryview(PyObject * o,visitproc v,void * a)52293 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
52294   int e;
52295   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
52296   if (p->obj) {
52297     e = (*v)(p->obj, a); if (e) return e;
52298   }
52299   if (p->_size) {
52300     e = (*v)(p->_size, a); if (e) return e;
52301   }
52302   if (p->_array_interface) {
52303     e = (*v)(p->_array_interface, a); if (e) return e;
52304   }
52305   if (p->view.obj) {
52306     e = (*v)(p->view.obj, a); if (e) return e;
52307   }
52308   return 0;
52309 }
52310 
__pyx_tp_clear_memoryview(PyObject * o)52311 static int __pyx_tp_clear_memoryview(PyObject *o) {
52312   PyObject* tmp;
52313   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
52314   tmp = ((PyObject*)p->obj);
52315   p->obj = Py_None; Py_INCREF(Py_None);
52316   Py_XDECREF(tmp);
52317   tmp = ((PyObject*)p->_size);
52318   p->_size = Py_None; Py_INCREF(Py_None);
52319   Py_XDECREF(tmp);
52320   tmp = ((PyObject*)p->_array_interface);
52321   p->_array_interface = Py_None; Py_INCREF(Py_None);
52322   Py_XDECREF(tmp);
52323   Py_CLEAR(p->view.obj);
52324   return 0;
52325 }
__pyx_sq_item_memoryview(PyObject * o,Py_ssize_t i)52326 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
52327   PyObject *r;
52328   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
52329   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
52330   Py_DECREF(x);
52331   return r;
52332 }
52333 
__pyx_mp_ass_subscript_memoryview(PyObject * o,PyObject * i,PyObject * v)52334 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
52335   if (v) {
52336     return __pyx_memoryview___setitem__(o, i, v);
52337   }
52338   else {
52339     PyErr_Format(PyExc_NotImplementedError,
52340       "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
52341     return -1;
52342   }
52343 }
52344 
__pyx_getprop___pyx_memoryview_T(PyObject * o,CYTHON_UNUSED void * x)52345 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
52346   return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
52347 }
52348 
__pyx_getprop___pyx_memoryview_base(PyObject * o,CYTHON_UNUSED void * x)52349 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
52350   return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
52351 }
52352 
__pyx_getprop___pyx_memoryview_shape(PyObject * o,CYTHON_UNUSED void * x)52353 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
52354   return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
52355 }
52356 
__pyx_getprop___pyx_memoryview_strides(PyObject * o,CYTHON_UNUSED void * x)52357 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
52358   return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
52359 }
52360 
__pyx_getprop___pyx_memoryview_suboffsets(PyObject * o,CYTHON_UNUSED void * x)52361 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
52362   return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
52363 }
52364 
__pyx_getprop___pyx_memoryview_ndim(PyObject * o,CYTHON_UNUSED void * x)52365 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
52366   return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
52367 }
52368 
__pyx_getprop___pyx_memoryview_itemsize(PyObject * o,CYTHON_UNUSED void * x)52369 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
52370   return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
52371 }
52372 
__pyx_getprop___pyx_memoryview_nbytes(PyObject * o,CYTHON_UNUSED void * x)52373 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
52374   return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
52375 }
52376 
__pyx_getprop___pyx_memoryview_size(PyObject * o,CYTHON_UNUSED void * x)52377 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
52378   return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
52379 }
52380 
52381 static PyMethodDef __pyx_methods_memoryview[] = {
52382   {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
52383   {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
52384   {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
52385   {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
52386   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
52387   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
52388   {0, 0, 0, 0}
52389 };
52390 
52391 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
52392   {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
52393   {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
52394   {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
52395   {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
52396   {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
52397   {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
52398   {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
52399   {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
52400   {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
52401   {0, 0, 0, 0, 0}
52402 };
52403 
52404 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
52405   __pyx_memoryview___len__, /*sq_length*/
52406   0, /*sq_concat*/
52407   0, /*sq_repeat*/
52408   __pyx_sq_item_memoryview, /*sq_item*/
52409   0, /*sq_slice*/
52410   0, /*sq_ass_item*/
52411   0, /*sq_ass_slice*/
52412   0, /*sq_contains*/
52413   0, /*sq_inplace_concat*/
52414   0, /*sq_inplace_repeat*/
52415 };
52416 
52417 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
52418   __pyx_memoryview___len__, /*mp_length*/
52419   __pyx_memoryview___getitem__, /*mp_subscript*/
52420   __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
52421 };
52422 
52423 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
52424   #if PY_MAJOR_VERSION < 3
52425   0, /*bf_getreadbuffer*/
52426   #endif
52427   #if PY_MAJOR_VERSION < 3
52428   0, /*bf_getwritebuffer*/
52429   #endif
52430   #if PY_MAJOR_VERSION < 3
52431   0, /*bf_getsegcount*/
52432   #endif
52433   #if PY_MAJOR_VERSION < 3
52434   0, /*bf_getcharbuffer*/
52435   #endif
52436   __pyx_memoryview_getbuffer, /*bf_getbuffer*/
52437   0, /*bf_releasebuffer*/
52438 };
52439 
52440 static PyTypeObject __pyx_type___pyx_memoryview = {
52441   PyVarObject_HEAD_INIT(0, 0)
52442   "yt.utilities.lib.geometry_utils.memoryview", /*tp_name*/
52443   sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
52444   0, /*tp_itemsize*/
52445   __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
52446   0, /*tp_print*/
52447   0, /*tp_getattr*/
52448   0, /*tp_setattr*/
52449   #if PY_MAJOR_VERSION < 3
52450   0, /*tp_compare*/
52451   #endif
52452   #if PY_MAJOR_VERSION >= 3
52453   0, /*tp_as_async*/
52454   #endif
52455   __pyx_memoryview___repr__, /*tp_repr*/
52456   0, /*tp_as_number*/
52457   &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
52458   &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
52459   0, /*tp_hash*/
52460   0, /*tp_call*/
52461   __pyx_memoryview___str__, /*tp_str*/
52462   0, /*tp_getattro*/
52463   0, /*tp_setattro*/
52464   &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
52465   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
52466   0, /*tp_doc*/
52467   __pyx_tp_traverse_memoryview, /*tp_traverse*/
52468   __pyx_tp_clear_memoryview, /*tp_clear*/
52469   0, /*tp_richcompare*/
52470   0, /*tp_weaklistoffset*/
52471   0, /*tp_iter*/
52472   0, /*tp_iternext*/
52473   __pyx_methods_memoryview, /*tp_methods*/
52474   0, /*tp_members*/
52475   __pyx_getsets_memoryview, /*tp_getset*/
52476   0, /*tp_base*/
52477   0, /*tp_dict*/
52478   0, /*tp_descr_get*/
52479   0, /*tp_descr_set*/
52480   0, /*tp_dictoffset*/
52481   0, /*tp_init*/
52482   0, /*tp_alloc*/
52483   __pyx_tp_new_memoryview, /*tp_new*/
52484   0, /*tp_free*/
52485   0, /*tp_is_gc*/
52486   0, /*tp_bases*/
52487   0, /*tp_mro*/
52488   0, /*tp_cache*/
52489   0, /*tp_subclasses*/
52490   0, /*tp_weaklist*/
52491   0, /*tp_del*/
52492   0, /*tp_version_tag*/
52493   #if PY_VERSION_HEX >= 0x030400a1
52494   0, /*tp_finalize*/
52495   #endif
52496   #if PY_VERSION_HEX >= 0x030800b1
52497   0, /*tp_vectorcall*/
52498   #endif
52499 };
52500 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
52501 
__pyx_tp_new__memoryviewslice(PyTypeObject * t,PyObject * a,PyObject * k)52502 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
52503   struct __pyx_memoryviewslice_obj *p;
52504   PyObject *o = __pyx_tp_new_memoryview(t, a, k);
52505   if (unlikely(!o)) return 0;
52506   p = ((struct __pyx_memoryviewslice_obj *)o);
52507   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
52508   p->from_object = Py_None; Py_INCREF(Py_None);
52509   p->from_slice.memview = NULL;
52510   return o;
52511 }
52512 
__pyx_tp_dealloc__memoryviewslice(PyObject * o)52513 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
52514   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
52515   #if CYTHON_USE_TP_FINALIZE
52516   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
52517     if (PyObject_CallFinalizerFromDealloc(o)) return;
52518   }
52519   #endif
52520   PyObject_GC_UnTrack(o);
52521   {
52522     PyObject *etype, *eval, *etb;
52523     PyErr_Fetch(&etype, &eval, &etb);
52524     ++Py_REFCNT(o);
52525     __pyx_memoryviewslice___dealloc__(o);
52526     --Py_REFCNT(o);
52527     PyErr_Restore(etype, eval, etb);
52528   }
52529   Py_CLEAR(p->from_object);
52530   PyObject_GC_Track(o);
52531   __pyx_tp_dealloc_memoryview(o);
52532 }
52533 
__pyx_tp_traverse__memoryviewslice(PyObject * o,visitproc v,void * a)52534 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
52535   int e;
52536   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
52537   e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
52538   if (p->from_object) {
52539     e = (*v)(p->from_object, a); if (e) return e;
52540   }
52541   return 0;
52542 }
52543 
__pyx_tp_clear__memoryviewslice(PyObject * o)52544 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
52545   PyObject* tmp;
52546   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
52547   __pyx_tp_clear_memoryview(o);
52548   tmp = ((PyObject*)p->from_object);
52549   p->from_object = Py_None; Py_INCREF(Py_None);
52550   Py_XDECREF(tmp);
52551   __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
52552   return 0;
52553 }
52554 
__pyx_getprop___pyx_memoryviewslice_base(PyObject * o,CYTHON_UNUSED void * x)52555 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
52556   return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
52557 }
52558 
52559 static PyMethodDef __pyx_methods__memoryviewslice[] = {
52560   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
52561   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
52562   {0, 0, 0, 0}
52563 };
52564 
52565 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
52566   {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
52567   {0, 0, 0, 0, 0}
52568 };
52569 
52570 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
52571   PyVarObject_HEAD_INIT(0, 0)
52572   "yt.utilities.lib.geometry_utils._memoryviewslice", /*tp_name*/
52573   sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
52574   0, /*tp_itemsize*/
52575   __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
52576   0, /*tp_print*/
52577   0, /*tp_getattr*/
52578   0, /*tp_setattr*/
52579   #if PY_MAJOR_VERSION < 3
52580   0, /*tp_compare*/
52581   #endif
52582   #if PY_MAJOR_VERSION >= 3
52583   0, /*tp_as_async*/
52584   #endif
52585   #if CYTHON_COMPILING_IN_PYPY
52586   __pyx_memoryview___repr__, /*tp_repr*/
52587   #else
52588   0, /*tp_repr*/
52589   #endif
52590   0, /*tp_as_number*/
52591   0, /*tp_as_sequence*/
52592   0, /*tp_as_mapping*/
52593   0, /*tp_hash*/
52594   0, /*tp_call*/
52595   #if CYTHON_COMPILING_IN_PYPY
52596   __pyx_memoryview___str__, /*tp_str*/
52597   #else
52598   0, /*tp_str*/
52599   #endif
52600   0, /*tp_getattro*/
52601   0, /*tp_setattro*/
52602   0, /*tp_as_buffer*/
52603   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
52604   "Internal class for passing memoryview slices to Python", /*tp_doc*/
52605   __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
52606   __pyx_tp_clear__memoryviewslice, /*tp_clear*/
52607   0, /*tp_richcompare*/
52608   0, /*tp_weaklistoffset*/
52609   0, /*tp_iter*/
52610   0, /*tp_iternext*/
52611   __pyx_methods__memoryviewslice, /*tp_methods*/
52612   0, /*tp_members*/
52613   __pyx_getsets__memoryviewslice, /*tp_getset*/
52614   0, /*tp_base*/
52615   0, /*tp_dict*/
52616   0, /*tp_descr_get*/
52617   0, /*tp_descr_set*/
52618   0, /*tp_dictoffset*/
52619   0, /*tp_init*/
52620   0, /*tp_alloc*/
52621   __pyx_tp_new__memoryviewslice, /*tp_new*/
52622   0, /*tp_free*/
52623   0, /*tp_is_gc*/
52624   0, /*tp_bases*/
52625   0, /*tp_mro*/
52626   0, /*tp_cache*/
52627   0, /*tp_subclasses*/
52628   0, /*tp_weaklist*/
52629   0, /*tp_del*/
52630   0, /*tp_version_tag*/
52631   #if PY_VERSION_HEX >= 0x030400a1
52632   0, /*tp_finalize*/
52633   #endif
52634   #if PY_VERSION_HEX >= 0x030800b1
52635   0, /*tp_vectorcall*/
52636   #endif
52637 };
52638 
52639 static PyMethodDef __pyx_methods[] = {
52640   {0, 0, 0, 0}
52641 };
52642 
52643 #if PY_MAJOR_VERSION >= 3
52644 #if CYTHON_PEP489_MULTI_PHASE_INIT
52645 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
52646 static int __pyx_pymod_exec_geometry_utils(PyObject* module); /*proto*/
52647 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
52648   {Py_mod_create, (void*)__pyx_pymod_create},
52649   {Py_mod_exec, (void*)__pyx_pymod_exec_geometry_utils},
52650   {0, NULL}
52651 };
52652 #endif
52653 
52654 static struct PyModuleDef __pyx_moduledef = {
52655     PyModuleDef_HEAD_INIT,
52656     "geometry_utils",
52657     __pyx_k_Simple_integrators_for_the_radi, /* m_doc */
52658   #if CYTHON_PEP489_MULTI_PHASE_INIT
52659     0, /* m_size */
52660   #else
52661     -1, /* m_size */
52662   #endif
52663     __pyx_methods /* m_methods */,
52664   #if CYTHON_PEP489_MULTI_PHASE_INIT
52665     __pyx_moduledef_slots, /* m_slots */
52666   #else
52667     NULL, /* m_reload */
52668   #endif
52669     NULL, /* m_traverse */
52670     NULL, /* m_clear */
52671     NULL /* m_free */
52672 };
52673 #endif
52674 #ifndef CYTHON_SMALL_CODE
52675 #if defined(__clang__)
52676     #define CYTHON_SMALL_CODE
52677 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
52678     #define CYTHON_SMALL_CODE __attribute__((cold))
52679 #else
52680     #define CYTHON_SMALL_CODE
52681 #endif
52682 #endif
52683 
52684 static __Pyx_StringTabEntry __pyx_string_tab[] = {
52685   {&__pyx_kp_b_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 0, 0},
52686   {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0},
52687   {&__pyx_kp_s_0, __pyx_k_0, sizeof(__pyx_k_0), 0, 0, 1, 0},
52688   {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
52689   {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
52690   {&__pyx_n_s_Ai, __pyx_k_Ai, sizeof(__pyx_k_Ai), 0, 0, 1, 1},
52691   {&__pyx_kp_s_Both_l_and_h_must_be_on_the_same, __pyx_k_Both_l_and_h_must_be_on_the_same, sizeof(__pyx_k_Both_l_and_h_must_be_on_the_same), 0, 0, 1, 0},
52692   {&__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},
52693   {&__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},
52694   {&__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},
52695   {&__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},
52696   {&__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},
52697   {&__pyx_kp_s_Could_not_identify_dtype, __pyx_k_Could_not_identify_dtype, sizeof(__pyx_k_Could_not_identify_dtype), 0, 0, 1, 0},
52698   {&__pyx_n_s_DLE, __pyx_k_DLE, sizeof(__pyx_k_DLE), 0, 0, 1, 1},
52699   {&__pyx_n_s_DLE1, __pyx_k_DLE1, sizeof(__pyx_k_DLE1), 0, 0, 1, 1},
52700   {&__pyx_n_s_DRE, __pyx_k_DRE, sizeof(__pyx_k_DRE), 0, 0, 1, 1},
52701   {&__pyx_n_s_DRE1, __pyx_k_DRE1, sizeof(__pyx_k_DRE1), 0, 0, 1, 1},
52702   {&__pyx_n_s_E0, __pyx_k_E0, sizeof(__pyx_k_E0), 0, 0, 1, 1},
52703   {&__pyx_n_s_E1, __pyx_k_E1, sizeof(__pyx_k_E1), 0, 0, 1, 1},
52704   {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
52705   {&__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},
52706   {&__pyx_kp_s_Expected_at_least_d_argument_s_g, __pyx_k_Expected_at_least_d_argument_s_g, sizeof(__pyx_k_Expected_at_least_d_argument_s_g), 0, 0, 1, 0},
52707   {&__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},
52708   {&__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},
52709   {&__pyx_kp_s_Function_call_with_ambiguous_arg, __pyx_k_Function_call_with_ambiguous_arg, sizeof(__pyx_k_Function_call_with_ambiguous_arg), 0, 0, 1, 0},
52710   {&__pyx_n_s_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 0, 1, 1},
52711   {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
52712   {&__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},
52713   {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
52714   {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
52715   {&__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},
52716   {&__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},
52717   {&__pyx_kp_s_It_should_be_geometrically_impos, __pyx_k_It_should_be_geometrically_impos, sizeof(__pyx_k_It_should_be_geometrically_impos), 0, 0, 1, 0},
52718   {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
52719   {&__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},
52720   {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
52721   {&__pyx_n_s_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 1, 1},
52722   {&__pyx_kp_s_No_matching_signature_found, __pyx_k_No_matching_signature_found, sizeof(__pyx_k_No_matching_signature_found), 0, 0, 1, 0},
52723   {&__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},
52724   {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
52725   {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
52726   {&__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},
52727   {&__pyx_n_s_P, __pyx_k_P, sizeof(__pyx_k_P), 0, 0, 1, 1},
52728   {&__pyx_n_s_P0, __pyx_k_P0, sizeof(__pyx_k_P0), 0, 0, 1, 1},
52729   {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
52730   {&__pyx_kp_s_Point_exceeds_max, __pyx_k_Point_exceeds_max, sizeof(__pyx_k_Point_exceeds_max), 0, 0, 1, 0},
52731   {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
52732   {&__pyx_kp_b_T, __pyx_k_T, sizeof(__pyx_k_T), 0, 0, 0, 0},
52733   {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
52734   {&__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},
52735   {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
52736   {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
52737   {&__pyx_n_s_YTDomainOverflow, __pyx_k_YTDomainOverflow, sizeof(__pyx_k_YTDomainOverflow), 0, 0, 1, 1},
52738   {&__pyx_kp_b__38, __pyx_k__38, sizeof(__pyx_k__38), 0, 0, 0, 0},
52739   {&__pyx_kp_b__39, __pyx_k__39, sizeof(__pyx_k__39), 0, 0, 0, 0},
52740   {&__pyx_kp_b__40, __pyx_k__40, sizeof(__pyx_k__40), 0, 0, 0, 0},
52741   {&__pyx_kp_u__41, __pyx_k__41, sizeof(__pyx_k__41), 0, 1, 0, 0},
52742   {&__pyx_kp_s__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 0, 1, 0},
52743   {&__pyx_kp_s__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 0, 1, 0},
52744   {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
52745   {&__pyx_n_s_abs, __pyx_k_abs, sizeof(__pyx_k_abs), 0, 0, 1, 1},
52746   {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
52747   {&__pyx_n_s_arange, __pyx_k_arange, sizeof(__pyx_k_arange), 0, 0, 1, 1},
52748   {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
52749   {&__pyx_n_s_argsort, __pyx_k_argsort, sizeof(__pyx_k_argsort), 0, 0, 1, 1},
52750   {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
52751   {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1},
52752   {&__pyx_n_s_ax, __pyx_k_ax, sizeof(__pyx_k_ax), 0, 0, 1, 1},
52753   {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1},
52754   {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
52755   {&__pyx_n_s_bitwise_addition, __pyx_k_bitwise_addition, sizeof(__pyx_k_bitwise_addition), 0, 0, 1, 1},
52756   {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
52757   {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
52758   {&__pyx_n_s_cbox, __pyx_k_cbox, sizeof(__pyx_k_cbox), 0, 0, 1, 1},
52759   {&__pyx_n_s_cbox_Ai, __pyx_k_cbox_Ai, sizeof(__pyx_k_cbox_Ai), 0, 0, 1, 1},
52760   {&__pyx_n_s_cbox_hl, __pyx_k_cbox_hl, sizeof(__pyx_k_cbox_hl), 0, 0, 1, 1},
52761   {&__pyx_n_s_cbox_sol, __pyx_k_cbox_sol, sizeof(__pyx_k_cbox_sol), 0, 0, 1, 1},
52762   {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
52763   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
52764   {&__pyx_n_s_code_length, __pyx_k_code_length, sizeof(__pyx_k_code_length), 0, 0, 1, 1},
52765   {&__pyx_n_s_compact_bits, __pyx_k_compact_bits, sizeof(__pyx_k_compact_bits), 0, 0, 1, 1},
52766   {&__pyx_n_s_compare_morton, __pyx_k_compare_morton, sizeof(__pyx_k_compare_morton), 0, 0, 1, 1},
52767   {&__pyx_n_s_compute_morton, __pyx_k_compute_morton, sizeof(__pyx_k_compute_morton), 0, 0, 1, 1},
52768   {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
52769   {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
52770   {&__pyx_n_s_convert_to_units, __pyx_k_convert_to_units, sizeof(__pyx_k_convert_to_units), 0, 0, 1, 1},
52771   {&__pyx_n_s_coord, __pyx_k_coord, sizeof(__pyx_k_coord), 0, 0, 1, 1},
52772   {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1},
52773   {&__pyx_n_s_csearch_morton, __pyx_k_csearch_morton, sizeof(__pyx_k_csearch_morton), 0, 0, 1, 1},
52774   {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
52775   {&__pyx_n_s_dds, __pyx_k_dds, sizeof(__pyx_k_dds), 0, 0, 1, 1},
52776   {&__pyx_n_s_defaults, __pyx_k_defaults, sizeof(__pyx_k_defaults), 0, 0, 1, 1},
52777   {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
52778   {&__pyx_n_s_dim, __pyx_k_dim, sizeof(__pyx_k_dim), 0, 0, 1, 1},
52779   {&__pyx_n_s_dim_list, __pyx_k_dim_list, sizeof(__pyx_k_dim_list), 0, 0, 1, 1},
52780   {&__pyx_n_s_dist, __pyx_k_dist, sizeof(__pyx_k_dist), 0, 0, 1, 1},
52781   {&__pyx_n_s_dist_to_box, __pyx_k_dist_to_box, sizeof(__pyx_k_dist_to_box), 0, 0, 1, 1},
52782   {&__pyx_n_s_domain_left_edge, __pyx_k_domain_left_edge, sizeof(__pyx_k_domain_left_edge), 0, 0, 1, 1},
52783   {&__pyx_n_s_domain_right_edge, __pyx_k_domain_right_edge, sizeof(__pyx_k_domain_right_edge), 0, 0, 1, 1},
52784   {&__pyx_n_s_done, __pyx_k_done, sizeof(__pyx_k_done), 0, 0, 1, 1},
52785   {&__pyx_n_s_double, __pyx_k_double, sizeof(__pyx_k_double), 0, 0, 1, 1},
52786   {&__pyx_n_s_dp, __pyx_k_dp, sizeof(__pyx_k_dp), 0, 0, 1, 1},
52787   {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
52788   {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
52789   {&__pyx_n_s_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 1, 1},
52790   {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1},
52791   {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
52792   {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
52793   {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
52794   {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
52795   {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
52796   {&__pyx_n_s_filter, __pyx_k_filter, sizeof(__pyx_k_filter), 0, 0, 1, 1},
52797   {&__pyx_n_s_filter_bbox, __pyx_k_filter_bbox, sizeof(__pyx_k_filter_bbox), 0, 0, 1, 1},
52798   {&__pyx_n_s_first, __pyx_k_first, sizeof(__pyx_k_first), 0, 0, 1, 1},
52799   {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
52800   {&__pyx_n_s_float, __pyx_k_float, sizeof(__pyx_k_float), 0, 0, 1, 1},
52801   {&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1},
52802   {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1},
52803   {&__pyx_n_s_fneighbor, __pyx_k_fneighbor, sizeof(__pyx_k_fneighbor), 0, 0, 1, 1},
52804   {&__pyx_kp_s_for_64_bit_interleave, __pyx_k_for_64_bit_interleave, sizeof(__pyx_k_for_64_bit_interleave), 0, 0, 1, 0},
52805   {&__pyx_kp_s_for_64bit_interleave, __pyx_k_for_64bit_interleave, sizeof(__pyx_k_for_64bit_interleave), 0, 0, 1, 0},
52806   {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
52807   {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
52808   {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
52809   {&__pyx_n_s_func_ls, __pyx_k_func_ls, sizeof(__pyx_k_func_ls), 0, 0, 1, 1},
52810   {&__pyx_n_s_get_hilbert_indices, __pyx_k_get_hilbert_indices, sizeof(__pyx_k_get_hilbert_indices), 0, 0, 1, 1},
52811   {&__pyx_n_s_get_hilbert_points, __pyx_k_get_hilbert_points, sizeof(__pyx_k_get_hilbert_points), 0, 0, 1, 1},
52812   {&__pyx_n_s_get_morton_argsort1, __pyx_k_get_morton_argsort1, sizeof(__pyx_k_get_morton_argsort1), 0, 0, 1, 1},
52813   {&__pyx_n_s_get_morton_index, __pyx_k_get_morton_index, sizeof(__pyx_k_get_morton_index), 0, 0, 1, 1},
52814   {&__pyx_n_s_get_morton_indices, __pyx_k_get_morton_indices, sizeof(__pyx_k_get_morton_indices), 0, 0, 1, 1},
52815   {&__pyx_n_s_get_morton_indices_unravel, __pyx_k_get_morton_indices_unravel, sizeof(__pyx_k_get_morton_indices_unravel), 0, 0, 1, 1},
52816   {&__pyx_n_s_get_morton_neighbors, __pyx_k_get_morton_neighbors, sizeof(__pyx_k_get_morton_neighbors), 0, 0, 1, 1},
52817   {&__pyx_n_s_get_morton_neighbors_coarse, __pyx_k_get_morton_neighbors_coarse, sizeof(__pyx_k_get_morton_neighbors_coarse), 0, 0, 1, 1},
52818   {&__pyx_n_s_get_morton_neighbors_refined, __pyx_k_get_morton_neighbors_refined, sizeof(__pyx_k_get_morton_neighbors_refined), 0, 0, 1, 1},
52819   {&__pyx_n_s_get_morton_point, __pyx_k_get_morton_point, sizeof(__pyx_k_get_morton_point), 0, 0, 1, 1},
52820   {&__pyx_n_s_get_morton_points, __pyx_k_get_morton_points, sizeof(__pyx_k_get_morton_points), 0, 0, 1, 1},
52821   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
52822   {&__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},
52823   {&__pyx_n_s_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 0, 1, 1},
52824   {&__pyx_n_s_hilbert_indices, __pyx_k_hilbert_indices, sizeof(__pyx_k_hilbert_indices), 0, 0, 1, 1},
52825   {&__pyx_n_s_hstack, __pyx_k_hstack, sizeof(__pyx_k_hstack), 0, 0, 1, 1},
52826   {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
52827   {&__pyx_n_s_i0, __pyx_k_i0, sizeof(__pyx_k_i0), 0, 0, 1, 1},
52828   {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
52829   {&__pyx_n_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 1},
52830   {&__pyx_n_s_idxmax, __pyx_k_idxmax, sizeof(__pyx_k_idxmax), 0, 0, 1, 1},
52831   {&__pyx_n_s_idxmin, __pyx_k_idxmin, sizeof(__pyx_k_idxmin), 0, 0, 1, 1},
52832   {&__pyx_n_s_ifrexp_cy, __pyx_k_ifrexp_cy, sizeof(__pyx_k_ifrexp_cy), 0, 0, 1, 1},
52833   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
52834   {&__pyx_n_s_ind, __pyx_k_ind, sizeof(__pyx_k_ind), 0, 0, 1, 1},
52835   {&__pyx_n_s_ind1_n, __pyx_k_ind1_n, sizeof(__pyx_k_ind1_n), 0, 0, 1, 1},
52836   {&__pyx_n_s_ind2_n, __pyx_k_ind2_n, sizeof(__pyx_k_ind2_n), 0, 0, 1, 1},
52837   {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
52838   {&__pyx_n_s_indices, __pyx_k_indices, sizeof(__pyx_k_indices), 0, 0, 1, 1},
52839   {&__pyx_n_s_int64, __pyx_k_int64, sizeof(__pyx_k_int64), 0, 0, 1, 1},
52840   {&__pyx_n_s_ipos, __pyx_k_ipos, sizeof(__pyx_k_ipos), 0, 0, 1, 1},
52841   {&__pyx_n_s_issorted, __pyx_k_issorted, sizeof(__pyx_k_issorted), 0, 0, 1, 1},
52842   {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
52843   {&__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},
52844   {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
52845   {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
52846   {&__pyx_n_s_jpos, __pyx_k_jpos, sizeof(__pyx_k_jpos), 0, 0, 1, 1},
52847   {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
52848   {&__pyx_n_s_kind, __pyx_k_kind, sizeof(__pyx_k_kind), 0, 0, 1, 1},
52849   {&__pyx_n_s_knn_direct, __pyx_k_knn_direct, sizeof(__pyx_k_knn_direct), 0, 0, 1, 1},
52850   {&__pyx_n_s_knn_morton, __pyx_k_knn_morton, sizeof(__pyx_k_knn_morton), 0, 0, 1, 1},
52851   {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1},
52852   {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1},
52853   {&__pyx_n_s_last, __pyx_k_last, sizeof(__pyx_k_last), 0, 0, 1, 1},
52854   {&__pyx_n_s_left_index, __pyx_k_left_index, sizeof(__pyx_k_left_index), 0, 0, 1, 1},
52855   {&__pyx_n_s_left_x, __pyx_k_left_x, sizeof(__pyx_k_left_x), 0, 0, 1, 1},
52856   {&__pyx_n_s_left_y, __pyx_k_left_y, sizeof(__pyx_k_left_y), 0, 0, 1, 1},
52857   {&__pyx_n_s_left_z, __pyx_k_left_z, sizeof(__pyx_k_left_z), 0, 0, 1, 1},
52858   {&__pyx_n_s_line_segments, __pyx_k_line_segments, sizeof(__pyx_k_line_segments), 0, 0, 1, 1},
52859   {&__pyx_n_s_lsb, __pyx_k_lsb, sizeof(__pyx_k_lsb), 0, 0, 1, 1},
52860   {&__pyx_n_s_lsz, __pyx_k_lsz, sizeof(__pyx_k_lsz), 0, 0, 1, 1},
52861   {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
52862   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
52863   {&__pyx_n_s_mas, __pyx_k_mas, sizeof(__pyx_k_mas), 0, 0, 1, 1},
52864   {&__pyx_n_s_max, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1},
52865   {&__pyx_n_s_max_index, __pyx_k_max_index, sizeof(__pyx_k_max_index), 0, 0, 1, 1},
52866   {&__pyx_n_s_max_index1, __pyx_k_max_index1, sizeof(__pyx_k_max_index1), 0, 0, 1, 1},
52867   {&__pyx_n_s_max_index2, __pyx_k_max_index2, sizeof(__pyx_k_max_index2), 0, 0, 1, 1},
52868   {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
52869   {&__pyx_n_s_mergesort, __pyx_k_mergesort, sizeof(__pyx_k_mergesort), 0, 0, 1, 1},
52870   {&__pyx_n_s_mi, __pyx_k_mi, sizeof(__pyx_k_mi), 0, 0, 1, 1},
52871   {&__pyx_n_s_mi1, __pyx_k_mi1, sizeof(__pyx_k_mi1), 0, 0, 1, 1},
52872   {&__pyx_n_s_mi2, __pyx_k_mi2, sizeof(__pyx_k_mi2), 0, 0, 1, 1},
52873   {&__pyx_n_s_mi_neighbors, __pyx_k_mi_neighbors, sizeof(__pyx_k_mi_neighbors), 0, 0, 1, 1},
52874   {&__pyx_n_s_min, __pyx_k_min, sizeof(__pyx_k_min), 0, 0, 1, 1},
52875   {&__pyx_n_s_mis, __pyx_k_mis, sizeof(__pyx_k_mis), 0, 0, 1, 1},
52876   {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
52877   {&__pyx_n_s_morton_index, __pyx_k_morton_index, sizeof(__pyx_k_morton_index), 0, 0, 1, 1},
52878   {&__pyx_n_s_morton_indices, __pyx_k_morton_indices, sizeof(__pyx_k_morton_indices), 0, 0, 1, 1},
52879   {&__pyx_n_s_morton_neighbor, __pyx_k_morton_neighbor, sizeof(__pyx_k_morton_neighbor), 0, 0, 1, 1},
52880   {&__pyx_n_s_morton_neighbor_bounded, __pyx_k_morton_neighbor_bounded, sizeof(__pyx_k_morton_neighbor_bounded), 0, 0, 1, 1},
52881   {&__pyx_n_s_morton_neighbor_periodic, __pyx_k_morton_neighbor_periodic, sizeof(__pyx_k_morton_neighbor_periodic), 0, 0, 1, 1},
52882   {&__pyx_n_s_morton_qsort, __pyx_k_morton_qsort, sizeof(__pyx_k_morton_qsort), 0, 0, 1, 1},
52883   {&__pyx_n_s_morton_qsort_iterative, __pyx_k_morton_qsort_iterative, sizeof(__pyx_k_morton_qsort_iterative), 0, 0, 1, 1},
52884   {&__pyx_n_s_morton_qsort_partition, __pyx_k_morton_qsort_partition, sizeof(__pyx_k_morton_qsort_partition), 0, 0, 1, 1},
52885   {&__pyx_n_s_morton_qsort_recursive, __pyx_k_morton_qsort_recursive, sizeof(__pyx_k_morton_qsort_recursive), 0, 0, 1, 1},
52886   {&__pyx_n_s_morton_qsort_swap, __pyx_k_morton_qsort_swap, sizeof(__pyx_k_morton_qsort_swap), 0, 0, 1, 1},
52887   {&__pyx_n_s_msdb_cy, __pyx_k_msdb_cy, sizeof(__pyx_k_msdb_cy), 0, 0, 1, 1},
52888   {&__pyx_n_s_mstr, __pyx_k_mstr, sizeof(__pyx_k_mstr), 0, 0, 1, 1},
52889   {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
52890   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
52891   {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
52892   {&__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},
52893   {&__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},
52894   {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
52895   {&__pyx_n_s_neighbors, __pyx_k_neighbors, sizeof(__pyx_k_neighbors), 0, 0, 1, 1},
52896   {&__pyx_n_s_neighbors1, __pyx_k_neighbors1, sizeof(__pyx_k_neighbors1), 0, 0, 1, 1},
52897   {&__pyx_n_s_neighbors2, __pyx_k_neighbors2, sizeof(__pyx_k_neighbors2), 0, 0, 1, 1},
52898   {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
52899   {&__pyx_n_s_nlines, __pyx_k_nlines, sizeof(__pyx_k_nlines), 0, 0, 1, 1},
52900   {&__pyx_n_s_nmi, __pyx_k_nmi, sizeof(__pyx_k_nmi), 0, 0, 1, 1},
52901   {&__pyx_n_s_nn, __pyx_k_nn, sizeof(__pyx_k_nn), 0, 0, 1, 1},
52902   {&__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},
52903   {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
52904   {&__pyx_n_s_ntot, __pyx_k_ntot, sizeof(__pyx_k_ntot), 0, 0, 1, 1},
52905   {&__pyx_n_s_ntri, __pyx_k_ntri, sizeof(__pyx_k_ntri), 0, 0, 1, 1},
52906   {&__pyx_n_s_nu, __pyx_k_nu, sizeof(__pyx_k_nu), 0, 0, 1, 1},
52907   {&__pyx_n_s_num, __pyx_k_num, sizeof(__pyx_k_num), 0, 0, 1, 1},
52908   {&__pyx_n_s_num_list, __pyx_k_num_list, sizeof(__pyx_k_num_list), 0, 0, 1, 1},
52909   {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
52910   {&__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},
52911   {&__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},
52912   {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
52913   {&__pyx_n_s_order, __pyx_k_order, sizeof(__pyx_k_order), 0, 0, 1, 1},
52914   {&__pyx_n_s_out, __pyx_k_out, sizeof(__pyx_k_out), 0, 0, 1, 1},
52915   {&__pyx_kp_s_outside_rad_rbox_dist, __pyx_k_outside_rad_rbox_dist, sizeof(__pyx_k_outside_rad_rbox_dist), 0, 0, 1, 0},
52916   {&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1},
52917   {&__pyx_n_s_p0, __pyx_k_p0, sizeof(__pyx_k_p0), 0, 0, 1, 1},
52918   {&__pyx_n_s_p1, __pyx_k_p1, sizeof(__pyx_k_p1), 0, 0, 1, 1},
52919   {&__pyx_n_s_p2, __pyx_k_p2, sizeof(__pyx_k_p2), 0, 0, 1, 1},
52920   {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
52921   {&__pyx_n_s_periodic, __pyx_k_periodic, sizeof(__pyx_k_periodic), 0, 0, 1, 1},
52922   {&__pyx_n_s_periodicity, __pyx_k_periodicity, sizeof(__pyx_k_periodicity), 0, 0, 1, 1},
52923   {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
52924   {&__pyx_n_s_pivot, __pyx_k_pivot, sizeof(__pyx_k_pivot), 0, 0, 1, 1},
52925   {&__pyx_n_s_plane_norm, __pyx_k_plane_norm, sizeof(__pyx_k_plane_norm), 0, 0, 1, 1},
52926   {&__pyx_n_s_points, __pyx_k_points, sizeof(__pyx_k_points), 0, 0, 1, 1},
52927   {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1},
52928   {&__pyx_n_s_pos_x, __pyx_k_pos_x, sizeof(__pyx_k_pos_x), 0, 0, 1, 1},
52929   {&__pyx_n_s_pos_y, __pyx_k_pos_y, sizeof(__pyx_k_pos_y), 0, 0, 1, 1},
52930   {&__pyx_n_s_pos_z, __pyx_k_pos_z, sizeof(__pyx_k_pos_z), 0, 0, 1, 1},
52931   {&__pyx_n_s_position, __pyx_k_position, sizeof(__pyx_k_position), 0, 0, 1, 1},
52932   {&__pyx_n_s_positions, __pyx_k_positions, sizeof(__pyx_k_positions), 0, 0, 1, 1},
52933   {&__pyx_n_s_ppos, __pyx_k_ppos, sizeof(__pyx_k_ppos), 0, 0, 1, 1},
52934   {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1},
52935   {&__pyx_n_s_pstart, __pyx_k_pstart, sizeof(__pyx_k_pstart), 0, 0, 1, 1},
52936   {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
52937   {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
52938   {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
52939   {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
52940   {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
52941   {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
52942   {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
52943   {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
52944   {&__pyx_n_s_q, __pyx_k_q, sizeof(__pyx_k_q), 0, 0, 1, 1},
52945   {&__pyx_n_s_q0, __pyx_k_q0, sizeof(__pyx_k_q0), 0, 0, 1, 1},
52946   {&__pyx_n_s_qpos, __pyx_k_qpos, sizeof(__pyx_k_qpos), 0, 0, 1, 1},
52947   {&__pyx_n_s_quadtree_box, __pyx_k_quadtree_box, sizeof(__pyx_k_quadtree_box), 0, 0, 1, 1},
52948   {&__pyx_n_s_rad_Ai, __pyx_k_rad_Ai, sizeof(__pyx_k_rad_Ai), 0, 0, 1, 1},
52949   {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
52950   {&__pyx_n_s_rbox, __pyx_k_rbox, sizeof(__pyx_k_rbox), 0, 0, 1, 1},
52951   {&__pyx_n_s_rbox_Ai, __pyx_k_rbox_Ai, sizeof(__pyx_k_rbox_Ai), 0, 0, 1, 1},
52952   {&__pyx_n_s_rbox_hl, __pyx_k_rbox_hl, sizeof(__pyx_k_rbox_hl), 0, 0, 1, 1},
52953   {&__pyx_n_s_rbox_sol, __pyx_k_rbox_sol, sizeof(__pyx_k_rbox_sol), 0, 0, 1, 1},
52954   {&__pyx_n_s_recursive, __pyx_k_recursive, sizeof(__pyx_k_recursive), 0, 0, 1, 1},
52955   {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
52956   {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
52957   {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
52958   {&__pyx_n_s_resize, __pyx_k_resize, sizeof(__pyx_k_resize), 0, 0, 1, 1},
52959   {&__pyx_n_s_return_dist, __pyx_k_return_dist, sizeof(__pyx_k_return_dist), 0, 0, 1, 1},
52960   {&__pyx_n_s_return_rad, __pyx_k_return_rad, sizeof(__pyx_k_return_rad), 0, 0, 1, 1},
52961   {&__pyx_n_s_rv, __pyx_k_rv, sizeof(__pyx_k_rv), 0, 0, 1, 1},
52962   {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1},
52963   {&__pyx_kp_u_s_2, __pyx_k_s_2, sizeof(__pyx_k_s_2), 0, 1, 0, 0},
52964   {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
52965   {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
52966   {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
52967   {&__pyx_n_s_signatures, __pyx_k_signatures, sizeof(__pyx_k_signatures), 0, 0, 1, 1},
52968   {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
52969   {&__pyx_n_s_solution_radius, __pyx_k_solution_radius, sizeof(__pyx_k_solution_radius), 0, 0, 1, 1},
52970   {&__pyx_n_s_sort_fwd, __pyx_k_sort_fwd, sizeof(__pyx_k_sort_fwd), 0, 0, 1, 1},
52971   {&__pyx_n_s_sort_rev, __pyx_k_sort_rev, sizeof(__pyx_k_sort_rev), 0, 0, 1, 1},
52972   {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
52973   {&__pyx_n_s_spread_bits, __pyx_k_spread_bits, sizeof(__pyx_k_spread_bits), 0, 0, 1, 1},
52974   {&__pyx_n_s_sqrt, __pyx_k_sqrt, sizeof(__pyx_k_sqrt), 0, 0, 1, 1},
52975   {&__pyx_n_s_stack, __pyx_k_stack, sizeof(__pyx_k_stack), 0, 0, 1, 1},
52976   {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
52977   {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
52978   {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
52979   {&__pyx_n_s_stride, __pyx_k_stride, sizeof(__pyx_k_stride), 0, 0, 1, 1},
52980   {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
52981   {&__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},
52982   {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
52983   {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
52984   {&__pyx_n_s_strip, __pyx_k_strip, sizeof(__pyx_k_strip), 0, 0, 1, 1},
52985   {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
52986   {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
52987   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
52988   {&__pyx_n_s_top, __pyx_k_top, sizeof(__pyx_k_top), 0, 0, 1, 1},
52989   {&__pyx_n_s_tri_norm, __pyx_k_tri_norm, sizeof(__pyx_k_tri_norm), 0, 0, 1, 1},
52990   {&__pyx_n_s_triangle_plane_intersect, __pyx_k_triangle_plane_intersect, sizeof(__pyx_k_triangle_plane_intersect), 0, 0, 1, 1},
52991   {&__pyx_n_s_triangles, __pyx_k_triangles, sizeof(__pyx_k_triangles), 0, 0, 1, 1},
52992   {&__pyx_n_s_u, __pyx_k_u, sizeof(__pyx_k_u), 0, 0, 1, 1},
52993   {&__pyx_n_s_uint32, __pyx_k_uint32, sizeof(__pyx_k_uint32), 0, 0, 1, 1},
52994   {&__pyx_n_s_uint64, __pyx_k_uint64, sizeof(__pyx_k_uint64), 0, 0, 1, 1},
52995   {&__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},
52996   {&__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},
52997   {&__pyx_n_s_unique, __pyx_k_unique, sizeof(__pyx_k_unique), 0, 0, 1, 1},
52998   {&__pyx_n_s_units, __pyx_k_units, sizeof(__pyx_k_units), 0, 0, 1, 1},
52999   {&__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},
53000   {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
53001   {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
53002   {&__pyx_n_s_use_loop, __pyx_k_use_loop, sizeof(__pyx_k_use_loop), 0, 0, 1, 1},
53003   {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
53004   {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
53005   {&__pyx_n_s_xor_msb_cy, __pyx_k_xor_msb_cy, sizeof(__pyx_k_xor_msb_cy), 0, 0, 1, 1},
53006   {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
53007   {&__pyx_n_s_y0, __pyx_k_y0, sizeof(__pyx_k_y0), 0, 0, 1, 1},
53008   {&__pyx_n_s_yt_utilities_exceptions, __pyx_k_yt_utilities_exceptions, sizeof(__pyx_k_yt_utilities_exceptions), 0, 0, 1, 1},
53009   {&__pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_k_yt_utilities_lib_geometry_utils, sizeof(__pyx_k_yt_utilities_lib_geometry_utils), 0, 0, 1, 0},
53010   {&__pyx_n_s_yt_utilities_lib_geometry_utils_2, __pyx_k_yt_utilities_lib_geometry_utils_2, sizeof(__pyx_k_yt_utilities_lib_geometry_utils_2), 0, 0, 1, 1},
53011   {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
53012   {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1},
53013   {0, 0, 0, 0, 0, 0, 0}
53014 };
__Pyx_InitCachedBuiltins(void)53015 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
53016   __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 79, __pyx_L1_error)
53017   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 315, __pyx_L1_error)
53018   __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 426, __pyx_L1_error)
53019   __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(1, 583, __pyx_L1_error)
53020   __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 738, __pyx_L1_error)
53021   __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(1, 967, __pyx_L1_error)
53022   __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_n_s_min); if (!__pyx_builtin_min) __PYX_ERR(1, 1203, __pyx_L1_error)
53023   __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_n_s_max); if (!__pyx_builtin_max) __PYX_ERR(1, 1204, __pyx_L1_error)
53024   __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 1321, __pyx_L1_error)
53025   __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(2, 1038, __pyx_L1_error)
53026   __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(4, 148, __pyx_L1_error)
53027   __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(4, 400, __pyx_L1_error)
53028   __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(4, 609, __pyx_L1_error)
53029   __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(4, 828, __pyx_L1_error)
53030   return 0;
53031   __pyx_L1_error:;
53032   return -1;
53033 }
53034 
__Pyx_InitCachedConstants(void)53035 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
53036   __Pyx_RefNannyDeclarations
53037   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
53038 
53039   /* "yt/utilities/lib/geometry_utils.pyx":193
53040  *             for i in range(pstart,end+1,stride):
53041  *                 mstr[i] = '1'
53042  *                 m = int(''.join(mstr[::-1]), 2)             # <<<<<<<<<<<<<<
53043  *             # Invert portion in mask
53044  *             # print(mstr[::-1])
53045  */
53046   __pyx_slice__2 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__2)) __PYX_ERR(1, 193, __pyx_L1_error)
53047   __Pyx_GOTREF(__pyx_slice__2);
53048   __Pyx_GIVEREF(__pyx_slice__2);
53049 
53050   /* "yt/utilities/lib/geometry_utils.pyx":367
53051  *     cdef np.uint64_t p[3]
53052  *     cdef np.ndarray[np.uint64_t, ndim=1] position
53053  *     position = np.zeros(3, 'uint64')             # <<<<<<<<<<<<<<
53054  *     morton_to_point(index, p)
53055  *     for j in range(3):
53056  */
53057   __pyx_tuple__3 = PyTuple_Pack(2, __pyx_int_3, __pyx_n_s_uint64); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 367, __pyx_L1_error)
53058   __Pyx_GOTREF(__pyx_tuple__3);
53059   __Pyx_GIVEREF(__pyx_tuple__3);
53060 
53061   /* "yt/utilities/lib/geometry_utils.pyx":641
53062  *         for j in range(3):
53063  *             # +1 in dimension j
53064  *             nmi = fneighbor(p[i,:],[j],[+1],max_index)             # <<<<<<<<<<<<<<
53065  *             if nmi > 0:
53066  *                 mi_neighbors[n] = np.uint64(nmi)
53067  */
53068   __pyx_slice__4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__4)) __PYX_ERR(1, 641, __pyx_L1_error)
53069   __Pyx_GOTREF(__pyx_slice__4);
53070   __Pyx_GIVEREF(__pyx_slice__4);
53071 
53072   /* "yt/utilities/lib/geometry_utils.pyx":738
53073  *     ind[b] = t
53074  *
53075  * def morton_qsort_partition(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
53076  *                            np.int64_t l, np.int64_t h,
53077  *                            np.ndarray[np.uint64_t, ndim=1] ind,
53078  */
53079   __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_No_matching_signature_found); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 738, __pyx_L1_error)
53080   __Pyx_GOTREF(__pyx_tuple__7);
53081   __Pyx_GIVEREF(__pyx_tuple__7);
53082   __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Function_call_with_ambiguous_arg); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 738, __pyx_L1_error)
53083   __Pyx_GOTREF(__pyx_tuple__8);
53084   __Pyx_GIVEREF(__pyx_tuple__8);
53085 
53086   /* "yt/utilities/lib/geometry_utils.pyx":1007
53087  *                     np.ndarray[np.float64_t, ndim=1] DLE,
53088  *                     np.ndarray[np.float64_t, ndim=1] DRE):
53089  *     c = np.zeros(3, dtype=np.float64)             # <<<<<<<<<<<<<<
53090  *     return quadtree_box(P[i,:],P[idx[k-1],:],order,DLE,DRE,c)
53091  *
53092  */
53093   __pyx_tuple__9 = PyTuple_Pack(1, __pyx_int_3); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 1007, __pyx_L1_error)
53094   __Pyx_GOTREF(__pyx_tuple__9);
53095   __Pyx_GIVEREF(__pyx_tuple__9);
53096 
53097   /* "yt/utilities/lib/geometry_utils.pyx":1120
53098  *     # Make sure that h and l are both larger/smaller than i
53099  *     if (l < i) and (h > i):
53100  *         raise ValueError("Both l and h must be on the same side of i.")             # <<<<<<<<<<<<<<
53101  *     m = np.uint64((h + l)/2)
53102  *     # New range is small enough to consider directly
53103  */
53104   __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Both_l_and_h_must_be_on_the_same); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 1120, __pyx_L1_error)
53105   __Pyx_GOTREF(__pyx_tuple__10);
53106   __Pyx_GIVEREF(__pyx_tuple__10);
53107 
53108   /* "yt/utilities/lib/geometry_utils.pyx":1321
53109  *             nlines += 1
53110  *         elif count == 3:
53111  *             raise RuntimeError("It should be geometrically impossible for a plane to"             # <<<<<<<<<<<<<<
53112  *                                "to intersect all three legs of a triangle. Please contact"
53113  *                                "yt developers with your mesh")
53114  */
53115   __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_It_should_be_geometrically_impos); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 1321, __pyx_L1_error)
53116   __Pyx_GOTREF(__pyx_tuple__13);
53117   __Pyx_GIVEREF(__pyx_tuple__13);
53118 
53119   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272
53120  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
53121  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
53122  *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
53123  *
53124  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
53125  */
53126   __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 272, __pyx_L1_error)
53127   __Pyx_GOTREF(__pyx_tuple__14);
53128   __Pyx_GIVEREF(__pyx_tuple__14);
53129 
53130   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276
53131  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
53132  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
53133  *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
53134  *
53135  *             info.buf = PyArray_DATA(self)
53136  */
53137   __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 276, __pyx_L1_error)
53138   __Pyx_GOTREF(__pyx_tuple__15);
53139   __Pyx_GIVEREF(__pyx_tuple__15);
53140 
53141   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":306
53142  *                 if ((descr.byteorder == c'>' and little_endian) or
53143  *                     (descr.byteorder == c'<' and not little_endian)):
53144  *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
53145  *                 if   t == NPY_BYTE:        f = "b"
53146  *                 elif t == NPY_UBYTE:       f = "B"
53147  */
53148   __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 306, __pyx_L1_error)
53149   __Pyx_GOTREF(__pyx_tuple__16);
53150   __Pyx_GIVEREF(__pyx_tuple__16);
53151 
53152   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856
53153  *
53154  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
53155  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
53156  *
53157  *         if ((child.byteorder == c'>' and little_endian) or
53158  */
53159   __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 856, __pyx_L1_error)
53160   __Pyx_GOTREF(__pyx_tuple__17);
53161   __Pyx_GIVEREF(__pyx_tuple__17);
53162 
53163   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":880
53164  *             t = child.type_num
53165  *             if end - f < 5:
53166  *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
53167  *
53168  *             # Until ticket #99 is fixed, use integers to avoid warnings
53169  */
53170   __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 880, __pyx_L1_error)
53171   __Pyx_GOTREF(__pyx_tuple__18);
53172   __Pyx_GIVEREF(__pyx_tuple__18);
53173 
53174   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1038
53175  *         _import_array()
53176  *     except Exception:
53177  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
53178  *
53179  * cdef inline int import_umath() except -1:
53180  */
53181   __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 1038, __pyx_L1_error)
53182   __Pyx_GOTREF(__pyx_tuple__19);
53183   __Pyx_GIVEREF(__pyx_tuple__19);
53184 
53185   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1044
53186  *         _import_umath()
53187  *     except Exception:
53188  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
53189  *
53190  * cdef inline int import_ufunc() except -1:
53191  */
53192   __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 1044, __pyx_L1_error)
53193   __Pyx_GOTREF(__pyx_tuple__20);
53194   __Pyx_GIVEREF(__pyx_tuple__20);
53195 
53196   /* "View.MemoryView":133
53197  *
53198  *         if not self.ndim:
53199  *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
53200  *
53201  *         if itemsize <= 0:
53202  */
53203   __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(4, 133, __pyx_L1_error)
53204   __Pyx_GOTREF(__pyx_tuple__21);
53205   __Pyx_GIVEREF(__pyx_tuple__21);
53206 
53207   /* "View.MemoryView":136
53208  *
53209  *         if itemsize <= 0:
53210  *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
53211  *
53212  *         if not isinstance(format, bytes):
53213  */
53214   __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(4, 136, __pyx_L1_error)
53215   __Pyx_GOTREF(__pyx_tuple__22);
53216   __Pyx_GIVEREF(__pyx_tuple__22);
53217 
53218   /* "View.MemoryView":148
53219  *
53220  *         if not self._shape:
53221  *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
53222  *
53223  *
53224  */
53225   __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(4, 148, __pyx_L1_error)
53226   __Pyx_GOTREF(__pyx_tuple__23);
53227   __Pyx_GIVEREF(__pyx_tuple__23);
53228 
53229   /* "View.MemoryView":176
53230  *             self.data = <char *>malloc(self.len)
53231  *             if not self.data:
53232  *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
53233  *
53234  *             if self.dtype_is_object:
53235  */
53236   __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(4, 176, __pyx_L1_error)
53237   __Pyx_GOTREF(__pyx_tuple__24);
53238   __Pyx_GIVEREF(__pyx_tuple__24);
53239 
53240   /* "View.MemoryView":192
53241  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
53242  *         if not (flags & bufmode):
53243  *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
53244  *         info.buf = self.data
53245  *         info.len = self.len
53246  */
53247   __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(4, 192, __pyx_L1_error)
53248   __Pyx_GOTREF(__pyx_tuple__25);
53249   __Pyx_GIVEREF(__pyx_tuple__25);
53250 
53251   /* "(tree fragment)":2
53252  * def __reduce_cython__(self):
53253  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
53254  * def __setstate_cython__(self, __pyx_state):
53255  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
53256  */
53257   __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(4, 2, __pyx_L1_error)
53258   __Pyx_GOTREF(__pyx_tuple__26);
53259   __Pyx_GIVEREF(__pyx_tuple__26);
53260 
53261   /* "(tree fragment)":4
53262  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
53263  * def __setstate_cython__(self, __pyx_state):
53264  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
53265  */
53266   __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(4, 4, __pyx_L1_error)
53267   __Pyx_GOTREF(__pyx_tuple__27);
53268   __Pyx_GIVEREF(__pyx_tuple__27);
53269 
53270   /* "View.MemoryView":414
53271  *     def __setitem__(memoryview self, object index, object value):
53272  *         if self.view.readonly:
53273  *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
53274  *
53275  *         have_slices, index = _unellipsify(index, self.view.ndim)
53276  */
53277   __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(4, 414, __pyx_L1_error)
53278   __Pyx_GOTREF(__pyx_tuple__28);
53279   __Pyx_GIVEREF(__pyx_tuple__28);
53280 
53281   /* "View.MemoryView":491
53282  *             result = struct.unpack(self.view.format, bytesitem)
53283  *         except struct.error:
53284  *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
53285  *         else:
53286  *             if len(self.view.format) == 1:
53287  */
53288   __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(4, 491, __pyx_L1_error)
53289   __Pyx_GOTREF(__pyx_tuple__29);
53290   __Pyx_GIVEREF(__pyx_tuple__29);
53291 
53292   /* "View.MemoryView":516
53293  *     def __getbuffer__(self, Py_buffer *info, int flags):
53294  *         if flags & PyBUF_WRITABLE and self.view.readonly:
53295  *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
53296  *
53297  *         if flags & PyBUF_ND:
53298  */
53299   __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(4, 516, __pyx_L1_error)
53300   __Pyx_GOTREF(__pyx_tuple__30);
53301   __Pyx_GIVEREF(__pyx_tuple__30);
53302 
53303   /* "View.MemoryView":566
53304  *         if self.view.strides == NULL:
53305  *
53306  *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
53307  *
53308  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
53309  */
53310   __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(4, 566, __pyx_L1_error)
53311   __Pyx_GOTREF(__pyx_tuple__31);
53312   __Pyx_GIVEREF(__pyx_tuple__31);
53313 
53314   /* "View.MemoryView":573
53315  *     def suboffsets(self):
53316  *         if self.view.suboffsets == NULL:
53317  *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
53318  *
53319  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
53320  */
53321   __pyx_tuple__32 = PyTuple_New(1); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(4, 573, __pyx_L1_error)
53322   __Pyx_GOTREF(__pyx_tuple__32);
53323   __Pyx_INCREF(__pyx_int_neg_1);
53324   __Pyx_GIVEREF(__pyx_int_neg_1);
53325   PyTuple_SET_ITEM(__pyx_tuple__32, 0, __pyx_int_neg_1);
53326   __Pyx_GIVEREF(__pyx_tuple__32);
53327 
53328   /* "(tree fragment)":2
53329  * def __reduce_cython__(self):
53330  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
53331  * def __setstate_cython__(self, __pyx_state):
53332  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
53333  */
53334   __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(4, 2, __pyx_L1_error)
53335   __Pyx_GOTREF(__pyx_tuple__33);
53336   __Pyx_GIVEREF(__pyx_tuple__33);
53337 
53338   /* "(tree fragment)":4
53339  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
53340  * def __setstate_cython__(self, __pyx_state):
53341  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
53342  */
53343   __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(4, 4, __pyx_L1_error)
53344   __Pyx_GOTREF(__pyx_tuple__34);
53345   __Pyx_GIVEREF(__pyx_tuple__34);
53346 
53347   /* "View.MemoryView":699
53348  *     for suboffset in suboffsets[:ndim]:
53349  *         if suboffset >= 0:
53350  *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
53351  *
53352  *
53353  */
53354   __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(4, 699, __pyx_L1_error)
53355   __Pyx_GOTREF(__pyx_tuple__35);
53356   __Pyx_GIVEREF(__pyx_tuple__35);
53357 
53358   /* "(tree fragment)":2
53359  * def __reduce_cython__(self):
53360  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
53361  * def __setstate_cython__(self, __pyx_state):
53362  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
53363  */
53364   __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(4, 2, __pyx_L1_error)
53365   __Pyx_GOTREF(__pyx_tuple__36);
53366   __Pyx_GIVEREF(__pyx_tuple__36);
53367 
53368   /* "(tree fragment)":4
53369  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
53370  * def __setstate_cython__(self, __pyx_state):
53371  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
53372  */
53373   __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(4, 4, __pyx_L1_error)
53374   __Pyx_GOTREF(__pyx_tuple__37);
53375   __Pyx_GIVEREF(__pyx_tuple__37);
53376 
53377   /* "yt/utilities/lib/geometry_utils.pyx":138
53378  * @cython.boundscheck(False)
53379  * @cython.wraparound(False)
53380  * def spread_bits(np.uint64_t x):             # <<<<<<<<<<<<<<
53381  *     return spread_64bits_by2(x)
53382  *
53383  */
53384   __pyx_tuple__42 = PyTuple_Pack(2, __pyx_n_s_x, __pyx_n_s_x); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(1, 138, __pyx_L1_error)
53385   __Pyx_GOTREF(__pyx_tuple__42);
53386   __Pyx_GIVEREF(__pyx_tuple__42);
53387   __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_spread_bits, 138, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(1, 138, __pyx_L1_error)
53388 
53389   /* "yt/utilities/lib/geometry_utils.pyx":144
53390  * @cython.boundscheck(False)
53391  * @cython.wraparound(False)
53392  * def compact_bits(np.uint64_t x):             # <<<<<<<<<<<<<<
53393  *     return compact_64bits_by2(x)
53394  *
53395  */
53396   __pyx_tuple__44 = PyTuple_Pack(2, __pyx_n_s_x, __pyx_n_s_x); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(1, 144, __pyx_L1_error)
53397   __Pyx_GOTREF(__pyx_tuple__44);
53398   __Pyx_GIVEREF(__pyx_tuple__44);
53399   __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_compact_bits, 144, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(1, 144, __pyx_L1_error)
53400 
53401   /* "yt/utilities/lib/geometry_utils.pyx":150
53402  * @cython.boundscheck(False)
53403  * @cython.wraparound(False)
53404  * def lsz(np.uint64_t v, int stride = 1, int start = 0):             # <<<<<<<<<<<<<<
53405  *     cdef int c
53406  *     c = start
53407  */
53408   __pyx_tuple__46 = PyTuple_Pack(4, __pyx_n_s_v, __pyx_n_s_stride, __pyx_n_s_start, __pyx_n_s_c); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(1, 150, __pyx_L1_error)
53409   __Pyx_GOTREF(__pyx_tuple__46);
53410   __Pyx_GIVEREF(__pyx_tuple__46);
53411   __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_lsz, 150, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(1, 150, __pyx_L1_error)
53412 
53413   /* "yt/utilities/lib/geometry_utils.pyx":160
53414  * @cython.boundscheck(False)
53415  * @cython.wraparound(False)
53416  * def lsb(np.uint64_t v, int stride = 1, int start = 0):             # <<<<<<<<<<<<<<
53417  *     cdef int c
53418  *     c = start
53419  */
53420   __pyx_tuple__48 = PyTuple_Pack(4, __pyx_n_s_v, __pyx_n_s_stride, __pyx_n_s_start, __pyx_n_s_c); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(1, 160, __pyx_L1_error)
53421   __Pyx_GOTREF(__pyx_tuple__48);
53422   __Pyx_GIVEREF(__pyx_tuple__48);
53423   __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_lsb, 160, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(1, 160, __pyx_L1_error)
53424 
53425   /* "yt/utilities/lib/geometry_utils.pyx":170
53426  * @cython.boundscheck(False)
53427  * @cython.wraparound(False)
53428  * def bitwise_addition(np.uint64_t x, np.int64_t y0,             # <<<<<<<<<<<<<<
53429  *                      int stride = 1, int start = 0):
53430  *     if (y0 == 0): return x
53431  */
53432   __pyx_tuple__50 = PyTuple_Pack(13, __pyx_n_s_x, __pyx_n_s_y0, __pyx_n_s_stride, __pyx_n_s_start, __pyx_n_s_end, __pyx_n_s_p, __pyx_n_s_pstart, __pyx_n_s_mstr, __pyx_n_s_m, __pyx_n_s_y, __pyx_n_s_out, __pyx_n_s_func_ls, __pyx_n_s_i); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(1, 170, __pyx_L1_error)
53433   __Pyx_GOTREF(__pyx_tuple__50);
53434   __Pyx_GIVEREF(__pyx_tuple__50);
53435   __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_bitwise_addition, 170, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(1, 170, __pyx_L1_error)
53436 
53437   /* "yt/utilities/lib/geometry_utils.pyx":265
53438  * @cython.boundscheck(False)
53439  * @cython.wraparound(False)
53440  * def get_hilbert_indices(int order, np.ndarray[np.int64_t, ndim=2] left_index):             # <<<<<<<<<<<<<<
53441  *     # This is inspired by the scurve package by user cortesi on GH.
53442  *     cdef int i
53443  */
53444   __pyx_tuple__52 = PyTuple_Pack(5, __pyx_n_s_order, __pyx_n_s_left_index, __pyx_n_s_i, __pyx_n_s_p, __pyx_n_s_hilbert_indices); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(1, 265, __pyx_L1_error)
53445   __Pyx_GOTREF(__pyx_tuple__52);
53446   __Pyx_GIVEREF(__pyx_tuple__52);
53447   __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_get_hilbert_indices, 265, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(1, 265, __pyx_L1_error)
53448 
53449   /* "yt/utilities/lib/geometry_utils.pyx":281
53450  * @cython.boundscheck(False)
53451  * @cython.wraparound(False)
53452  * def get_hilbert_points(int order, np.ndarray[np.int64_t, ndim=1] indices):             # <<<<<<<<<<<<<<
53453  *     # This is inspired by the scurve package by user cortesi on GH.
53454  *     cdef int i, j
53455  */
53456   __pyx_tuple__54 = PyTuple_Pack(6, __pyx_n_s_order, __pyx_n_s_indices, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_p, __pyx_n_s_positions); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(1, 281, __pyx_L1_error)
53457   __Pyx_GOTREF(__pyx_tuple__54);
53458   __Pyx_GIVEREF(__pyx_tuple__54);
53459   __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_get_hilbert_points, 281, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(1, 281, __pyx_L1_error)
53460 
53461   /* "yt/utilities/lib/geometry_utils.pyx":309
53462  * @cython.boundscheck(False)
53463  * @cython.wraparound(False)
53464  * def get_morton_index(np.ndarray[np.uint64_t, ndim=1] left_index):             # <<<<<<<<<<<<<<
53465  *     cdef int j
53466  *     cdef np.uint64_t morton_index
53467  */
53468   __pyx_tuple__56 = PyTuple_Pack(4, __pyx_n_s_left_index, __pyx_n_s_j, __pyx_n_s_morton_index, __pyx_n_s_p); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(1, 309, __pyx_L1_error)
53469   __Pyx_GOTREF(__pyx_tuple__56);
53470   __Pyx_GIVEREF(__pyx_tuple__56);
53471   __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_get_morton_index, 309, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(1, 309, __pyx_L1_error)
53472 
53473   /* "yt/utilities/lib/geometry_utils.pyx":324
53474  * @cython.boundscheck(False)
53475  * @cython.wraparound(False)
53476  * def get_morton_indices(np.ndarray[np.uint64_t, ndim=2] left_index):             # <<<<<<<<<<<<<<
53477  *     cdef np.int64_t i
53478  *     cdef int j
53479  */
53480   __pyx_tuple__58 = PyTuple_Pack(5, __pyx_n_s_left_index, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_morton_indices, __pyx_n_s_p); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(1, 324, __pyx_L1_error)
53481   __Pyx_GOTREF(__pyx_tuple__58);
53482   __Pyx_GIVEREF(__pyx_tuple__58);
53483   __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_get_morton_indices, 324, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(1, 324, __pyx_L1_error)
53484 
53485   /* "yt/utilities/lib/geometry_utils.pyx":342
53486  * @cython.boundscheck(False)
53487  * @cython.wraparound(False)
53488  * def get_morton_indices_unravel(np.ndarray[np.uint64_t, ndim=1] left_x,             # <<<<<<<<<<<<<<
53489  *                                np.ndarray[np.uint64_t, ndim=1] left_y,
53490  *                                np.ndarray[np.uint64_t, ndim=1] left_z):
53491  */
53492   __pyx_tuple__60 = PyTuple_Pack(7, __pyx_n_s_left_x, __pyx_n_s_left_y, __pyx_n_s_left_z, __pyx_n_s_i, __pyx_n_s_morton_indices, __pyx_n_s_p, __pyx_n_s_j); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(1, 342, __pyx_L1_error)
53493   __Pyx_GOTREF(__pyx_tuple__60);
53494   __Pyx_GIVEREF(__pyx_tuple__60);
53495   __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_get_morton_indices_unravel, 342, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(1, 342, __pyx_L1_error)
53496 
53497   /* "yt/utilities/lib/geometry_utils.pyx":363
53498  * @cython.boundscheck(False)
53499  * @cython.wraparound(False)
53500  * def get_morton_point(np.uint64_t index):             # <<<<<<<<<<<<<<
53501  *     cdef int j
53502  *     cdef np.uint64_t p[3]
53503  */
53504   __pyx_tuple__62 = PyTuple_Pack(5, __pyx_n_s_index, __pyx_n_s_index, __pyx_n_s_j, __pyx_n_s_p, __pyx_n_s_position); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(1, 363, __pyx_L1_error)
53505   __Pyx_GOTREF(__pyx_tuple__62);
53506   __Pyx_GIVEREF(__pyx_tuple__62);
53507   __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_get_morton_point, 363, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(1, 363, __pyx_L1_error)
53508 
53509   /* "yt/utilities/lib/geometry_utils.pyx":376
53510  * @cython.boundscheck(False)
53511  * @cython.wraparound(False)
53512  * def get_morton_points(np.ndarray[np.uint64_t, ndim=1] indices):             # <<<<<<<<<<<<<<
53513  *     # This is inspired by the scurve package by user cortesi on GH.
53514  *     cdef int i, j
53515  */
53516   __pyx_tuple__64 = PyTuple_Pack(5, __pyx_n_s_indices, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_p, __pyx_n_s_positions); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(1, 376, __pyx_L1_error)
53517   __Pyx_GOTREF(__pyx_tuple__64);
53518   __Pyx_GIVEREF(__pyx_tuple__64);
53519   __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_get_morton_points, 376, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(1, 376, __pyx_L1_error)
53520 
53521   /* "yt/utilities/lib/geometry_utils.pyx":391
53522  * @cython.boundscheck(False)
53523  * @cython.wraparound(False)
53524  * def get_morton_neighbors_coarse(mi1, max_index1, periodic, nn):             # <<<<<<<<<<<<<<
53525  *     cdef int i
53526  *     cdef np.uint32_t ntot
53527  */
53528   __pyx_tuple__66 = PyTuple_Pack(10, __pyx_n_s_mi1, __pyx_n_s_max_index1, __pyx_n_s_periodic, __pyx_n_s_nn, __pyx_n_s_i, __pyx_n_s_ntot, __pyx_n_s_index, __pyx_n_s_ind1_n, __pyx_n_s_neighbors, __pyx_n_s_periodicity); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(1, 391, __pyx_L1_error)
53529   __Pyx_GOTREF(__pyx_tuple__66);
53530   __Pyx_GIVEREF(__pyx_tuple__66);
53531   __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(4, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_get_morton_neighbors_coarse, 391, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(1, 391, __pyx_L1_error)
53532 
53533   /* "yt/utilities/lib/geometry_utils.pyx":470
53534  * @cython.boundscheck(False)
53535  * @cython.wraparound(False)
53536  * def get_morton_neighbors_refined(mi1, mi2, max_index1, max_index2, periodic, nn):             # <<<<<<<<<<<<<<
53537  *     cdef int i
53538  *     cdef np.uint32_t ntot
53539  */
53540   __pyx_tuple__68 = PyTuple_Pack(14, __pyx_n_s_mi1, __pyx_n_s_mi2, __pyx_n_s_max_index1, __pyx_n_s_max_index2, __pyx_n_s_periodic, __pyx_n_s_nn, __pyx_n_s_i, __pyx_n_s_ntot, __pyx_n_s_index, __pyx_n_s_ind1_n, __pyx_n_s_ind2_n, __pyx_n_s_neighbors1, __pyx_n_s_neighbors2, __pyx_n_s_periodicity); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(1, 470, __pyx_L1_error)
53541   __Pyx_GOTREF(__pyx_tuple__68);
53542   __Pyx_GIVEREF(__pyx_tuple__68);
53543   __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(6, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_get_morton_neighbors_refined, 470, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(1, 470, __pyx_L1_error)
53544 
53545   /* "yt/utilities/lib/geometry_utils.pyx":576
53546  * @cython.boundscheck(False)
53547  * @cython.wraparound(False)
53548  * def morton_neighbor_periodic(np.ndarray[np.uint64_t,ndim=1] p,             # <<<<<<<<<<<<<<
53549  *                              list dim_list, list num_list,
53550  *                              np.uint64_t max_index):
53551  */
53552   __pyx_tuple__70 = PyTuple_Pack(8, __pyx_n_s_p, __pyx_n_s_dim_list, __pyx_n_s_num_list, __pyx_n_s_max_index, __pyx_n_s_p1, __pyx_n_s_j, __pyx_n_s_dim, __pyx_n_s_num); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(1, 576, __pyx_L1_error)
53553   __Pyx_GOTREF(__pyx_tuple__70);
53554   __Pyx_GIVEREF(__pyx_tuple__70);
53555   __pyx_codeobj__71 = (PyObject*)__Pyx_PyCode_New(4, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_morton_neighbor_periodic, 576, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__71)) __PYX_ERR(1, 576, __pyx_L1_error)
53556 
53557   /* "yt/utilities/lib/geometry_utils.pyx":590
53558  * @cython.boundscheck(False)
53559  * @cython.wraparound(False)
53560  * def morton_neighbor_bounded(np.ndarray[np.uint64_t,ndim=1] p,             # <<<<<<<<<<<<<<
53561  *                             list dim_list, list num_list,
53562  *                             np.uint64_t max_index):
53563  */
53564   __pyx_tuple__72 = PyTuple_Pack(9, __pyx_n_s_p, __pyx_n_s_dim_list, __pyx_n_s_num_list, __pyx_n_s_max_index, __pyx_n_s_x, __pyx_n_s_p1, __pyx_n_s_j, __pyx_n_s_dim, __pyx_n_s_num); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(1, 590, __pyx_L1_error)
53565   __Pyx_GOTREF(__pyx_tuple__72);
53566   __Pyx_GIVEREF(__pyx_tuple__72);
53567   __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_morton_neighbor_bounded, 590, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(1, 590, __pyx_L1_error)
53568 
53569   /* "yt/utilities/lib/geometry_utils.pyx":609
53570  * @cython.boundscheck(False)
53571  * @cython.wraparound(False)
53572  * def morton_neighbor(np.ndarray[np.uint64_t,ndim=1] p,             # <<<<<<<<<<<<<<
53573  *                     list dim_list, list num_list,
53574  *                     np.uint64_t max_index, periodic = False):
53575  */
53576   __pyx_tuple__74 = PyTuple_Pack(5, __pyx_n_s_p, __pyx_n_s_dim_list, __pyx_n_s_num_list, __pyx_n_s_max_index, __pyx_n_s_periodic); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(1, 609, __pyx_L1_error)
53577   __Pyx_GOTREF(__pyx_tuple__74);
53578   __Pyx_GIVEREF(__pyx_tuple__74);
53579   __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_morton_neighbor, 609, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(1, 609, __pyx_L1_error)
53580 
53581   /* "yt/utilities/lib/geometry_utils.pyx":620
53582  * @cython.boundscheck(False)
53583  * @cython.wraparound(False)
53584  * def get_morton_neighbors(np.ndarray[np.uint64_t,ndim=1] mi,             # <<<<<<<<<<<<<<
53585  *                          int order = ORDER_MAX, periodic = False):
53586  *     """Returns array of neighboring morton indices"""
53587  */
53588   __pyx_tuple__76 = PyTuple_Pack(13, __pyx_n_s_mi, __pyx_n_s_order, __pyx_n_s_periodic, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_l, __pyx_n_s_n, __pyx_n_s_max_index, __pyx_n_s_p, __pyx_n_s_nmi, __pyx_n_s_mi_neighbors, __pyx_n_s_fneighbor); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(1, 620, __pyx_L1_error)
53589   __Pyx_GOTREF(__pyx_tuple__76);
53590   __Pyx_GIVEREF(__pyx_tuple__76);
53591   __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(3, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_get_morton_neighbors, 620, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) __PYX_ERR(1, 620, __pyx_L1_error)
53592 
53593   /* "yt/utilities/lib/geometry_utils.pyx":717
53594  *     return np.unique(np.hstack([mi,mi_neighbors]))
53595  *
53596  * def ifrexp_cy(np.float64_t x):             # <<<<<<<<<<<<<<
53597  *     cdef np.int64_t e, m
53598  *     m = ifrexp(x, &e)
53599  */
53600   __pyx_tuple__78 = PyTuple_Pack(4, __pyx_n_s_x, __pyx_n_s_x, __pyx_n_s_e, __pyx_n_s_m); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(1, 717, __pyx_L1_error)
53601   __Pyx_GOTREF(__pyx_tuple__78);
53602   __Pyx_GIVEREF(__pyx_tuple__78);
53603   __pyx_codeobj__79 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_ifrexp_cy, 717, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__79)) __PYX_ERR(1, 717, __pyx_L1_error)
53604 
53605   /* "yt/utilities/lib/geometry_utils.pyx":722
53606  *     return m,e
53607  *
53608  * def msdb_cy(np.int64_t a, np.int64_t b):             # <<<<<<<<<<<<<<
53609  *     return msdb(a,b)
53610  *
53611  */
53612   __pyx_tuple__80 = PyTuple_Pack(2, __pyx_n_s_a, __pyx_n_s_b); if (unlikely(!__pyx_tuple__80)) __PYX_ERR(1, 722, __pyx_L1_error)
53613   __Pyx_GOTREF(__pyx_tuple__80);
53614   __Pyx_GIVEREF(__pyx_tuple__80);
53615   __pyx_codeobj__81 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__80, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_msdb_cy, 722, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__81)) __PYX_ERR(1, 722, __pyx_L1_error)
53616 
53617   /* "yt/utilities/lib/geometry_utils.pyx":725
53618  *     return msdb(a,b)
53619  *
53620  * def msdb_cy(np.int64_t a, np.int64_t b):             # <<<<<<<<<<<<<<
53621  *     return msdb(a,b)
53622  *
53623  */
53624   __pyx_tuple__82 = PyTuple_Pack(2, __pyx_n_s_a, __pyx_n_s_b); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(1, 725, __pyx_L1_error)
53625   __Pyx_GOTREF(__pyx_tuple__82);
53626   __Pyx_GIVEREF(__pyx_tuple__82);
53627   __pyx_codeobj__83 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__82, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_msdb_cy, 725, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__83)) __PYX_ERR(1, 725, __pyx_L1_error)
53628 
53629   /* "yt/utilities/lib/geometry_utils.pyx":728
53630  *     return msdb(a,b)
53631  *
53632  * def xor_msb_cy(np.float64_t a, np.float64_t b):             # <<<<<<<<<<<<<<
53633  *     return xor_msb(a,b)
53634  *
53635  */
53636   __pyx_tuple__84 = PyTuple_Pack(2, __pyx_n_s_a, __pyx_n_s_b); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(1, 728, __pyx_L1_error)
53637   __Pyx_GOTREF(__pyx_tuple__84);
53638   __Pyx_GIVEREF(__pyx_tuple__84);
53639   __pyx_codeobj__85 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__84, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_xor_msb_cy, 728, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__85)) __PYX_ERR(1, 728, __pyx_L1_error)
53640 
53641   /* "yt/utilities/lib/geometry_utils.pyx":731
53642  *     return xor_msb(a,b)
53643  *
53644  * def morton_qsort_swap(np.ndarray[np.uint64_t, ndim=1] ind,             # <<<<<<<<<<<<<<
53645  *                       np.uint64_t a, np.uint64_t b):
53646  *     # http://www.geeksforgeeks.org/iterative-quick-sort/
53647  */
53648   __pyx_tuple__86 = PyTuple_Pack(4, __pyx_n_s_ind, __pyx_n_s_a, __pyx_n_s_b, __pyx_n_s_t); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(1, 731, __pyx_L1_error)
53649   __Pyx_GOTREF(__pyx_tuple__86);
53650   __Pyx_GIVEREF(__pyx_tuple__86);
53651   __pyx_codeobj__87 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__86, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_morton_qsort_swap, 731, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__87)) __PYX_ERR(1, 731, __pyx_L1_error)
53652 
53653   /* "yt/utilities/lib/geometry_utils.pyx":738
53654  *     ind[b] = t
53655  *
53656  * def morton_qsort_partition(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
53657  *                            np.int64_t l, np.int64_t h,
53658  *                            np.ndarray[np.uint64_t, ndim=1] ind,
53659  */
53660   __pyx_tuple__88 = PyTuple_Pack(12, __pyx_n_s_pos, __pyx_n_s_l, __pyx_n_s_h, __pyx_n_s_ind, __pyx_n_s_use_loop, __pyx_n_s_k, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_ppos, __pyx_n_s_ipos, __pyx_n_s_done, __pyx_n_s_pivot); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(1, 738, __pyx_L1_error)
53661   __Pyx_GOTREF(__pyx_tuple__88);
53662   __Pyx_GIVEREF(__pyx_tuple__88);
53663   __pyx_codeobj__89 = (PyObject*)__Pyx_PyCode_New(5, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__88, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_morton_qsort_partition, 738, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__89)) __PYX_ERR(1, 738, __pyx_L1_error)
53664 
53665   /* "yt/utilities/lib/geometry_utils.pyx":804
53666  * @cython.boundscheck(False)
53667  * @cython.wraparound(False)
53668  * def morton_qsort_recursive(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
53669  *                            np.int64_t l, np.int64_t h,
53670  *                            np.ndarray[np.uint64_t, ndim=1] ind,
53671  */
53672   __pyx_tuple__90 = PyTuple_Pack(6, __pyx_n_s_pos, __pyx_n_s_l, __pyx_n_s_h, __pyx_n_s_ind, __pyx_n_s_use_loop, __pyx_n_s_p); if (unlikely(!__pyx_tuple__90)) __PYX_ERR(1, 804, __pyx_L1_error)
53673   __Pyx_GOTREF(__pyx_tuple__90);
53674   __Pyx_GIVEREF(__pyx_tuple__90);
53675   __pyx_codeobj__91 = (PyObject*)__Pyx_PyCode_New(5, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__90, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_morton_qsort_recursive, 804, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__91)) __PYX_ERR(1, 804, __pyx_L1_error)
53676 
53677   /* "yt/utilities/lib/geometry_utils.pyx":818
53678  * @cython.boundscheck(False)
53679  * @cython.wraparound(False)
53680  * def morton_qsort_iterative(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
53681  *                            np.int64_t l, np.int64_t h,
53682  *                            np.ndarray[np.uint64_t, ndim=1] ind,
53683  */
53684   __pyx_tuple__92 = PyTuple_Pack(8, __pyx_n_s_pos, __pyx_n_s_l, __pyx_n_s_h, __pyx_n_s_ind, __pyx_n_s_use_loop, __pyx_n_s_stack, __pyx_n_s_top, __pyx_n_s_p); if (unlikely(!__pyx_tuple__92)) __PYX_ERR(1, 818, __pyx_L1_error)
53685   __Pyx_GOTREF(__pyx_tuple__92);
53686   __Pyx_GIVEREF(__pyx_tuple__92);
53687   __pyx_codeobj__93 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__92, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_morton_qsort_iterative, 818, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__93)) __PYX_ERR(1, 818, __pyx_L1_error)
53688 
53689   /* "yt/utilities/lib/geometry_utils.pyx":856
53690  * @cython.boundscheck(False)
53691  * @cython.wraparound(False)
53692  * def morton_qsort(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
53693  *                  np.int64_t l, np.int64_t h,
53694  *                  np.ndarray[np.uint64_t, ndim=1] ind,
53695  */
53696   __pyx_tuple__94 = PyTuple_Pack(6, __pyx_n_s_pos, __pyx_n_s_l, __pyx_n_s_h, __pyx_n_s_ind, __pyx_n_s_recursive, __pyx_n_s_use_loop); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(1, 856, __pyx_L1_error)
53697   __Pyx_GOTREF(__pyx_tuple__94);
53698   __Pyx_GIVEREF(__pyx_tuple__94);
53699   __pyx_codeobj__95 = (PyObject*)__Pyx_PyCode_New(6, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__94, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_morton_qsort, 856, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__95)) __PYX_ERR(1, 856, __pyx_L1_error)
53700 
53701   /* "yt/utilities/lib/geometry_utils.pyx":870
53702  * @cython.boundscheck(False)
53703  * @cython.wraparound(False)
53704  * def get_morton_argsort1(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
53705  *                         np.int64_t start, np.int64_t end,
53706  *                         np.ndarray[np.uint64_t, ndim=1] ind):
53707  */
53708   __pyx_tuple__96 = PyTuple_Pack(5, __pyx_n_s_pos, __pyx_n_s_start, __pyx_n_s_end, __pyx_n_s_ind, __pyx_n_s_top); if (unlikely(!__pyx_tuple__96)) __PYX_ERR(1, 870, __pyx_L1_error)
53709   __Pyx_GOTREF(__pyx_tuple__96);
53710   __Pyx_GIVEREF(__pyx_tuple__96);
53711   __pyx_codeobj__97 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__96, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_get_morton_argsort1, 870, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__97)) __PYX_ERR(1, 870, __pyx_L1_error)
53712 
53713   /* "yt/utilities/lib/geometry_utils.pyx":887
53714  *     return
53715  *
53716  * def compare_morton(np.ndarray[floating, ndim=1] p0, np.ndarray[floating, ndim=1] q0):             # <<<<<<<<<<<<<<
53717  *     cdef np.float64_t p[3]
53718  *     cdef np.float64_t q[3]
53719  */
53720   __pyx_tuple__98 = PyTuple_Pack(5, __pyx_n_s_p0, __pyx_n_s_q0, __pyx_n_s_p, __pyx_n_s_q, __pyx_n_s_j); if (unlikely(!__pyx_tuple__98)) __PYX_ERR(1, 887, __pyx_L1_error)
53721   __Pyx_GOTREF(__pyx_tuple__98);
53722   __Pyx_GIVEREF(__pyx_tuple__98);
53723   __pyx_codeobj__99 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__98, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_compare_morton, 887, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__99)) __PYX_ERR(1, 887, __pyx_L1_error)
53724 
53725   /* "yt/utilities/lib/geometry_utils.pyx":938
53726  *     return pos_x.shape[0]
53727  *
53728  * def compute_morton(np.ndarray pos_x, np.ndarray pos_y, np.ndarray pos_z,             # <<<<<<<<<<<<<<
53729  *                    domain_left_edge, domain_right_edge, filter_bbox = False,
53730  *                    order = ORDER_MAX):
53731  */
53732   __pyx_tuple__100 = PyTuple_Pack(16, __pyx_n_s_pos_x, __pyx_n_s_pos_y, __pyx_n_s_pos_z, __pyx_n_s_domain_left_edge, __pyx_n_s_domain_right_edge, __pyx_n_s_filter_bbox, __pyx_n_s_order, __pyx_n_s_i, __pyx_n_s_filter, __pyx_n_s_dds, __pyx_n_s_DLE, __pyx_n_s_DRE, __pyx_n_s_ind, __pyx_n_s_rv, __pyx_n_s_mis, __pyx_n_s_mas); if (unlikely(!__pyx_tuple__100)) __PYX_ERR(1, 938, __pyx_L1_error)
53733   __Pyx_GOTREF(__pyx_tuple__100);
53734   __Pyx_GIVEREF(__pyx_tuple__100);
53735   __pyx_codeobj__101 = (PyObject*)__Pyx_PyCode_New(7, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__100, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_compute_morton, 938, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__101)) __PYX_ERR(1, 938, __pyx_L1_error)
53736 
53737   /* "yt/utilities/lib/geometry_utils.pyx":978
53738  * @cython.boundscheck(False)
53739  * @cython.wraparound(False)
53740  * def dist(np.ndarray[np.float64_t, ndim=1] p0, np.ndarray[np.float64_t, ndim=1] q0):             # <<<<<<<<<<<<<<
53741  *     cdef int j
53742  *     cdef np.float64_t p[3]
53743  */
53744   __pyx_tuple__102 = PyTuple_Pack(5, __pyx_n_s_p0, __pyx_n_s_q0, __pyx_n_s_j, __pyx_n_s_p, __pyx_n_s_q); if (unlikely(!__pyx_tuple__102)) __PYX_ERR(1, 978, __pyx_L1_error)
53745   __Pyx_GOTREF(__pyx_tuple__102);
53746   __Pyx_GIVEREF(__pyx_tuple__102);
53747   __pyx_codeobj__103 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__102, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_dist, 978, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__103)) __PYX_ERR(1, 978, __pyx_L1_error)
53748 
53749   /* "yt/utilities/lib/geometry_utils.pyx":990
53750  * @cython.boundscheck(False)
53751  * @cython.wraparound(False)
53752  * def dist_to_box(np.ndarray[np.float64_t, ndim=1] p,             # <<<<<<<<<<<<<<
53753  *                 np.ndarray[np.float64_t, ndim=1] cbox,
53754  *                 np.float64_t rbox):
53755  */
53756   __pyx_tuple__104 = PyTuple_Pack(5, __pyx_n_s_p, __pyx_n_s_cbox, __pyx_n_s_rbox, __pyx_n_s_j, __pyx_n_s_d); if (unlikely(!__pyx_tuple__104)) __PYX_ERR(1, 990, __pyx_L1_error)
53757   __Pyx_GOTREF(__pyx_tuple__104);
53758   __Pyx_GIVEREF(__pyx_tuple__104);
53759   __pyx_codeobj__105 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__104, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_dist_to_box, 990, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__105)) __PYX_ERR(1, 990, __pyx_L1_error)
53760 
53761   /* "yt/utilities/lib/geometry_utils.pyx":1003
53762  * @cython.boundscheck(False)
53763  * @cython.wraparound(False)
53764  * def solution_radius(np.ndarray[np.float64_t, ndim=2] P, int k, np.uint64_t i,             # <<<<<<<<<<<<<<
53765  *                     np.ndarray[np.uint64_t, ndim=1] idx, int order,
53766  *                     np.ndarray[np.float64_t, ndim=1] DLE,
53767  */
53768   __pyx_tuple__106 = PyTuple_Pack(8, __pyx_n_s_P, __pyx_n_s_k, __pyx_n_s_i, __pyx_n_s_idx, __pyx_n_s_order, __pyx_n_s_DLE, __pyx_n_s_DRE, __pyx_n_s_c); if (unlikely(!__pyx_tuple__106)) __PYX_ERR(1, 1003, __pyx_L1_error)
53769   __Pyx_GOTREF(__pyx_tuple__106);
53770   __Pyx_GIVEREF(__pyx_tuple__106);
53771   __pyx_codeobj__107 = (PyObject*)__Pyx_PyCode_New(7, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__106, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_solution_radius, 1003, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__107)) __PYX_ERR(1, 1003, __pyx_L1_error)
53772 
53773   /* "yt/utilities/lib/geometry_utils.pyx":1013
53774  * @cython.boundscheck(False)
53775  * @cython.wraparound(False)
53776  * def knn_direct(np.ndarray[np.float64_t, ndim=2] P, np.uint64_t k, np.uint64_t i,             # <<<<<<<<<<<<<<
53777  *                np.ndarray[np.uint64_t, ndim=1] idx, return_dist = False,
53778  *                return_rad = False):
53779  */
53780   __pyx_tuple__108 = PyTuple_Pack(12, __pyx_n_s_P, __pyx_n_s_k, __pyx_n_s_i, __pyx_n_s_idx, __pyx_n_s_return_dist, __pyx_n_s_return_rad, __pyx_n_s_j, __pyx_n_s_m, __pyx_n_s_sort_fwd, __pyx_n_s_ipos, __pyx_n_s_jpos, __pyx_n_s_dist); if (unlikely(!__pyx_tuple__108)) __PYX_ERR(1, 1013, __pyx_L1_error)
53781   __Pyx_GOTREF(__pyx_tuple__108);
53782   __Pyx_GIVEREF(__pyx_tuple__108);
53783   __pyx_codeobj__109 = (PyObject*)__Pyx_PyCode_New(6, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__108, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_knn_direct, 1013, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__109)) __PYX_ERR(1, 1013, __pyx_L1_error)
53784 
53785   /* "yt/utilities/lib/geometry_utils.pyx":1058
53786  * @cython.wraparound(False)
53787  * @cython.cdivision(True)
53788  * def quadtree_box(np.ndarray[np.float64_t, ndim=1] p,             # <<<<<<<<<<<<<<
53789  *                  np.ndarray[np.float64_t, ndim=1] q, int order,
53790  *                  np.ndarray[np.float64_t, ndim=1] DLE,
53791  */
53792   __pyx_tuple__110 = PyTuple_Pack(13, __pyx_n_s_p, __pyx_n_s_q, __pyx_n_s_order, __pyx_n_s_DLE, __pyx_n_s_DRE, __pyx_n_s_c, __pyx_n_s_j, __pyx_n_s_ppos, __pyx_n_s_qpos, __pyx_n_s_rbox, __pyx_n_s_cbox, __pyx_n_s_DLE1, __pyx_n_s_DRE1); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(1, 1058, __pyx_L1_error)
53793   __Pyx_GOTREF(__pyx_tuple__110);
53794   __Pyx_GIVEREF(__pyx_tuple__110);
53795   __pyx_codeobj__111 = (PyObject*)__Pyx_PyCode_New(6, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__110, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_quadtree_box, 1058, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__111)) __PYX_ERR(1, 1058, __pyx_L1_error)
53796 
53797   /* "yt/utilities/lib/geometry_utils.pyx":1088
53798  * @cython.wraparound(False)
53799  * @cython.cdivision(True)
53800  * def csearch_morton(np.ndarray[np.float64_t, ndim=2] P, int k, np.uint64_t i,             # <<<<<<<<<<<<<<
53801  *                    np.ndarray[np.uint64_t, ndim=1] Ai,
53802  *                    np.uint64_t l, np.uint64_t h, int order,
53803  */
53804   __pyx_tuple__112 = PyTuple_Pack(17, __pyx_n_s_P, __pyx_n_s_k, __pyx_n_s_i, __pyx_n_s_Ai, __pyx_n_s_l, __pyx_n_s_h, __pyx_n_s_order, __pyx_n_s_DLE, __pyx_n_s_DRE, __pyx_n_s_nu, __pyx_n_s_j, __pyx_n_s_m, __pyx_n_s_rad_Ai, __pyx_n_s_cbox_sol, __pyx_n_s_rbox_sol, __pyx_n_s_cbox_hl, __pyx_n_s_rbox_hl); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(1, 1088, __pyx_L1_error)
53805   __Pyx_GOTREF(__pyx_tuple__112);
53806   __Pyx_GIVEREF(__pyx_tuple__112);
53807   __pyx_codeobj__113 = (PyObject*)__Pyx_PyCode_New(10, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__112, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_csearch_morton, 1088, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__113)) __PYX_ERR(1, 1088, __pyx_L1_error)
53808 
53809   /* "yt/utilities/lib/geometry_utils.pyx":1157
53810  * @cython.wraparound(False)
53811  * @cython.cdivision(True)
53812  * def knn_morton(np.ndarray[np.float64_t, ndim=2] P0, int k, np.uint64_t i0,             # <<<<<<<<<<<<<<
53813  *                float c = 1.0, int nu = 4, issorted = False, int order = ORDER_MAX,
53814  *                np.ndarray[np.float64_t, ndim=1] DLE = np.zeros(3,dtype=np.float64),
53815  */
53816   __pyx_tuple__114 = PyTuple_Pack(24, __pyx_n_s_P0, __pyx_n_s_k, __pyx_n_s_i0, __pyx_n_s_c, __pyx_n_s_nu, __pyx_n_s_issorted, __pyx_n_s_order, __pyx_n_s_DLE, __pyx_n_s_DRE, __pyx_n_s_j, __pyx_n_s_i, __pyx_n_s_N, __pyx_n_s_P, __pyx_n_s_sort_fwd, __pyx_n_s_sort_rev, __pyx_n_s_Ai, __pyx_n_s_idxmin, __pyx_n_s_idxmax, __pyx_n_s_u, __pyx_n_s_l, __pyx_n_s_I, __pyx_n_s_rad_Ai, __pyx_n_s_cbox_Ai, __pyx_n_s_rbox_Ai); if (unlikely(!__pyx_tuple__114)) __PYX_ERR(1, 1157, __pyx_L1_error)
53817   __Pyx_GOTREF(__pyx_tuple__114);
53818   __Pyx_GIVEREF(__pyx_tuple__114);
53819   __pyx_codeobj__115 = (PyObject*)__Pyx_PyCode_New(9, 0, 24, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__114, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_knn_morton, 1157, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__115)) __PYX_ERR(1, 1157, __pyx_L1_error)
53820 
53821   /* "yt/utilities/lib/geometry_utils.pyx":1268
53822  *
53823  * @cython.cdivision(True)
53824  * def triangle_plane_intersect(int ax, np.float64_t coord,             # <<<<<<<<<<<<<<
53825  *                              np.ndarray[np.float64_t, ndim=3] triangles):
53826  *     cdef np.float64_t p0[3]
53827  */
53828   __pyx_tuple__116 = PyTuple_Pack(21, __pyx_n_s_ax, __pyx_n_s_coord, __pyx_n_s_triangles, __pyx_n_s_p0, __pyx_n_s_p1, __pyx_n_s_p2, __pyx_n_s_E0, __pyx_n_s_E1, __pyx_n_s_tri_norm, __pyx_n_s_plane_norm, __pyx_n_s_dp, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_count, __pyx_n_s_ntri, __pyx_n_s_nlines, __pyx_n_s_first, __pyx_n_s_last, __pyx_n_s_points, __pyx_n_s_line_segments); if (unlikely(!__pyx_tuple__116)) __PYX_ERR(1, 1268, __pyx_L1_error)
53829   __Pyx_GOTREF(__pyx_tuple__116);
53830   __Pyx_GIVEREF(__pyx_tuple__116);
53831   __pyx_codeobj__117 = (PyObject*)__Pyx_PyCode_New(3, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__116, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_yt_utilities_lib_geometry_utils, __pyx_n_s_triangle_plane_intersect, 1268, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__117)) __PYX_ERR(1, 1268, __pyx_L1_error)
53832 
53833   /* "View.MemoryView":286
53834  *         return self.name
53835  *
53836  * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
53837  * cdef strided = Enum("<strided and direct>") # default
53838  * cdef indirect = Enum("<strided and indirect>")
53839  */
53840   __pyx_tuple__118 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__118)) __PYX_ERR(4, 286, __pyx_L1_error)
53841   __Pyx_GOTREF(__pyx_tuple__118);
53842   __Pyx_GIVEREF(__pyx_tuple__118);
53843 
53844   /* "View.MemoryView":287
53845  *
53846  * cdef generic = Enum("<strided and direct or indirect>")
53847  * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
53848  * cdef indirect = Enum("<strided and indirect>")
53849  *
53850  */
53851   __pyx_tuple__119 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__119)) __PYX_ERR(4, 287, __pyx_L1_error)
53852   __Pyx_GOTREF(__pyx_tuple__119);
53853   __Pyx_GIVEREF(__pyx_tuple__119);
53854 
53855   /* "View.MemoryView":288
53856  * cdef generic = Enum("<strided and direct or indirect>")
53857  * cdef strided = Enum("<strided and direct>") # default
53858  * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
53859  *
53860  *
53861  */
53862   __pyx_tuple__120 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__120)) __PYX_ERR(4, 288, __pyx_L1_error)
53863   __Pyx_GOTREF(__pyx_tuple__120);
53864   __Pyx_GIVEREF(__pyx_tuple__120);
53865 
53866   /* "View.MemoryView":291
53867  *
53868  *
53869  * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
53870  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
53871  *
53872  */
53873   __pyx_tuple__121 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__121)) __PYX_ERR(4, 291, __pyx_L1_error)
53874   __Pyx_GOTREF(__pyx_tuple__121);
53875   __Pyx_GIVEREF(__pyx_tuple__121);
53876 
53877   /* "View.MemoryView":292
53878  *
53879  * cdef contiguous = Enum("<contiguous and direct>")
53880  * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
53881  *
53882  *
53883  */
53884   __pyx_tuple__122 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__122)) __PYX_ERR(4, 292, __pyx_L1_error)
53885   __Pyx_GOTREF(__pyx_tuple__122);
53886   __Pyx_GIVEREF(__pyx_tuple__122);
53887 
53888   /* "(tree fragment)":1
53889  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
53890  *     cdef object __pyx_PickleError
53891  *     cdef object __pyx_result
53892  */
53893   __pyx_tuple__123 = 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__123)) __PYX_ERR(4, 1, __pyx_L1_error)
53894   __Pyx_GOTREF(__pyx_tuple__123);
53895   __Pyx_GIVEREF(__pyx_tuple__123);
53896   __pyx_codeobj__124 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__123, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__124)) __PYX_ERR(4, 1, __pyx_L1_error)
53897   __Pyx_RefNannyFinishContext();
53898   return 0;
53899   __pyx_L1_error:;
53900   __Pyx_RefNannyFinishContext();
53901   return -1;
53902 }
53903 
__Pyx_InitGlobals(void)53904 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
53905   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(1, 1, __pyx_L1_error);
53906   __pyx_float_1_5 = PyFloat_FromDouble(1.5); if (unlikely(!__pyx_float_1_5)) __PYX_ERR(1, 1, __pyx_L1_error)
53907   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(1, 1, __pyx_L1_error)
53908   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(1, 1, __pyx_L1_error)
53909   __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(1, 1, __pyx_L1_error)
53910   __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(1, 1, __pyx_L1_error)
53911   __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(1, 1, __pyx_L1_error)
53912   __pyx_int_20 = PyInt_FromLong(20); if (unlikely(!__pyx_int_20)) __PYX_ERR(1, 1, __pyx_L1_error)
53913   __pyx_int_2097151 = PyInt_FromLong(2097151L); if (unlikely(!__pyx_int_2097151)) __PYX_ERR(1, 1, __pyx_L1_error)
53914   __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(1, 1, __pyx_L1_error)
53915   __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(1, 1, __pyx_L1_error)
53916   return 0;
53917   __pyx_L1_error:;
53918   return -1;
53919 }
53920 
53921 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
53922 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
53923 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
53924 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
53925 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
53926 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
53927 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
53928 
__Pyx_modinit_global_init_code(void)53929 static int __Pyx_modinit_global_init_code(void) {
53930   __Pyx_RefNannyDeclarations
53931   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
53932   /*--- Global init code ---*/
53933   generic = Py_None; Py_INCREF(Py_None);
53934   strided = Py_None; Py_INCREF(Py_None);
53935   indirect = Py_None; Py_INCREF(Py_None);
53936   contiguous = Py_None; Py_INCREF(Py_None);
53937   indirect_contiguous = Py_None; Py_INCREF(Py_None);
53938   __Pyx_RefNannyFinishContext();
53939   return 0;
53940 }
53941 
__Pyx_modinit_variable_export_code(void)53942 static int __Pyx_modinit_variable_export_code(void) {
53943   __Pyx_RefNannyDeclarations
53944   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
53945   /*--- Variable export code ---*/
53946   __Pyx_RefNannyFinishContext();
53947   return 0;
53948 }
53949 
__Pyx_modinit_function_export_code(void)53950 static int __Pyx_modinit_function_export_code(void) {
53951   __Pyx_RefNannyDeclarations
53952   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
53953   /*--- Function export code ---*/
53954   if (__Pyx_ExportFunction("morton_neighbors_coarse", (void (*)(void))__pyx_f_2yt_9utilities_3lib_14geometry_utils_morton_neighbors_coarse, "__pyx_t_5numpy_uint32_t (__pyx_t_5numpy_uint64_t, __pyx_t_5numpy_uint64_t, int *, __pyx_t_5numpy_uint32_t, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
53955   if (__Pyx_ExportFunction("morton_neighbors_refined", (void (*)(void))__pyx_f_2yt_9utilities_3lib_14geometry_utils_morton_neighbors_refined, "__pyx_t_5numpy_uint32_t (__pyx_t_5numpy_uint64_t, __pyx_t_5numpy_uint64_t, __pyx_t_5numpy_uint64_t, __pyx_t_5numpy_uint64_t, int *, __pyx_t_5numpy_uint32_t, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
53956   __Pyx_RefNannyFinishContext();
53957   return 0;
53958   __pyx_L1_error:;
53959   __Pyx_RefNannyFinishContext();
53960   return -1;
53961 }
53962 
__Pyx_modinit_type_init_code(void)53963 static int __Pyx_modinit_type_init_code(void) {
53964   __Pyx_RefNannyDeclarations
53965   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
53966   /*--- Type init code ---*/
53967   __pyx_vtabptr_array = &__pyx_vtable_array;
53968   __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
53969   if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(4, 105, __pyx_L1_error)
53970   #if PY_VERSION_HEX < 0x030800B1
53971   __pyx_type___pyx_array.tp_print = 0;
53972   #endif
53973   if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(4, 105, __pyx_L1_error)
53974   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(4, 105, __pyx_L1_error)
53975   __pyx_array_type = &__pyx_type___pyx_array;
53976   if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(4, 279, __pyx_L1_error)
53977   #if PY_VERSION_HEX < 0x030800B1
53978   __pyx_type___pyx_MemviewEnum.tp_print = 0;
53979   #endif
53980   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
53981     __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
53982   }
53983   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(4, 279, __pyx_L1_error)
53984   __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
53985   __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
53986   __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
53987   __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
53988   __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
53989   __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
53990   __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
53991   __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
53992   __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
53993   if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(4, 330, __pyx_L1_error)
53994   #if PY_VERSION_HEX < 0x030800B1
53995   __pyx_type___pyx_memoryview.tp_print = 0;
53996   #endif
53997   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
53998     __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
53999   }
54000   if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(4, 330, __pyx_L1_error)
54001   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(4, 330, __pyx_L1_error)
54002   __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
54003   __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
54004   __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
54005   __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
54006   __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
54007   __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
54008   if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(4, 961, __pyx_L1_error)
54009   #if PY_VERSION_HEX < 0x030800B1
54010   __pyx_type___pyx_memoryviewslice.tp_print = 0;
54011   #endif
54012   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
54013     __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
54014   }
54015   if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(4, 961, __pyx_L1_error)
54016   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(4, 961, __pyx_L1_error)
54017   __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
54018   __Pyx_RefNannyFinishContext();
54019   return 0;
54020   __pyx_L1_error:;
54021   __Pyx_RefNannyFinishContext();
54022   return -1;
54023 }
54024 
__Pyx_modinit_type_import_code(void)54025 static int __Pyx_modinit_type_import_code(void) {
54026   __Pyx_RefNannyDeclarations
54027   PyObject *__pyx_t_1 = NULL;
54028   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
54029   /*--- Type import code ---*/
54030   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 9, __pyx_L1_error)
54031   __Pyx_GOTREF(__pyx_t_1);
54032   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
54033   #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
54034   sizeof(PyTypeObject),
54035   #else
54036   sizeof(PyHeapTypeObject),
54037   #endif
54038   __Pyx_ImportType_CheckSize_Warn);
54039    if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(5, 9, __pyx_L1_error)
54040   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
54041   __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 206, __pyx_L1_error)
54042   __Pyx_GOTREF(__pyx_t_1);
54043   __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
54044    if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 206, __pyx_L1_error)
54045   __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn);
54046    if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 229, __pyx_L1_error)
54047   __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn);
54048    if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 233, __pyx_L1_error)
54049   __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
54050    if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 242, __pyx_L1_error)
54051   __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn);
54052    if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 918, __pyx_L1_error)
54053   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
54054   __Pyx_RefNannyFinishContext();
54055   return 0;
54056   __pyx_L1_error:;
54057   __Pyx_XDECREF(__pyx_t_1);
54058   __Pyx_RefNannyFinishContext();
54059   return -1;
54060 }
54061 
__Pyx_modinit_variable_import_code(void)54062 static int __Pyx_modinit_variable_import_code(void) {
54063   __Pyx_RefNannyDeclarations
54064   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
54065   /*--- Variable import code ---*/
54066   __Pyx_RefNannyFinishContext();
54067   return 0;
54068 }
54069 
__Pyx_modinit_function_import_code(void)54070 static int __Pyx_modinit_function_import_code(void) {
54071   __Pyx_RefNannyDeclarations
54072   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
54073   /*--- Function import code ---*/
54074   __Pyx_RefNannyFinishContext();
54075   return 0;
54076 }
54077 
54078 
54079 #if PY_MAJOR_VERSION < 3
54080 #ifdef CYTHON_NO_PYINIT_EXPORT
54081 #define __Pyx_PyMODINIT_FUNC void
54082 #else
54083 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
54084 #endif
54085 #else
54086 #ifdef CYTHON_NO_PYINIT_EXPORT
54087 #define __Pyx_PyMODINIT_FUNC PyObject *
54088 #else
54089 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
54090 #endif
54091 #endif
54092 
54093 
54094 #if PY_MAJOR_VERSION < 3
54095 __Pyx_PyMODINIT_FUNC initgeometry_utils(void) CYTHON_SMALL_CODE; /*proto*/
initgeometry_utils(void)54096 __Pyx_PyMODINIT_FUNC initgeometry_utils(void)
54097 #else
54098 __Pyx_PyMODINIT_FUNC PyInit_geometry_utils(void) CYTHON_SMALL_CODE; /*proto*/
54099 __Pyx_PyMODINIT_FUNC PyInit_geometry_utils(void)
54100 #if CYTHON_PEP489_MULTI_PHASE_INIT
54101 {
54102   return PyModuleDef_Init(&__pyx_moduledef);
54103 }
54104 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
54105     #if PY_VERSION_HEX >= 0x030700A1
54106     static PY_INT64_T main_interpreter_id = -1;
54107     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
54108     if (main_interpreter_id == -1) {
54109         main_interpreter_id = current_id;
54110         return (unlikely(current_id == -1)) ? -1 : 0;
54111     } else if (unlikely(main_interpreter_id != current_id))
54112     #else
54113     static PyInterpreterState *main_interpreter = NULL;
54114     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
54115     if (!main_interpreter) {
54116         main_interpreter = current_interpreter;
54117     } else if (unlikely(main_interpreter != current_interpreter))
54118     #endif
54119     {
54120         PyErr_SetString(
54121             PyExc_ImportError,
54122             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
54123         return -1;
54124     }
54125     return 0;
54126 }
54127 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) {
54128     PyObject *value = PyObject_GetAttrString(spec, from_name);
54129     int result = 0;
54130     if (likely(value)) {
54131         if (allow_none || value != Py_None) {
54132             result = PyDict_SetItemString(moddict, to_name, value);
54133         }
54134         Py_DECREF(value);
54135     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
54136         PyErr_Clear();
54137     } else {
54138         result = -1;
54139     }
54140     return result;
54141 }
54142 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
54143     PyObject *module = NULL, *moddict, *modname;
54144     if (__Pyx_check_single_interpreter())
54145         return NULL;
54146     if (__pyx_m)
54147         return __Pyx_NewRef(__pyx_m);
54148     modname = PyObject_GetAttrString(spec, "name");
54149     if (unlikely(!modname)) goto bad;
54150     module = PyModule_NewObject(modname);
54151     Py_DECREF(modname);
54152     if (unlikely(!module)) goto bad;
54153     moddict = PyModule_GetDict(module);
54154     if (unlikely(!moddict)) goto bad;
54155     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
54156     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
54157     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
54158     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
54159     return module;
54160 bad:
54161     Py_XDECREF(module);
54162     return NULL;
54163 }
54164 
54165 
54166 static CYTHON_SMALL_CODE int __pyx_pymod_exec_geometry_utils(PyObject *__pyx_pyinit_module)
54167 #endif
54168 #endif
54169 {
54170   PyObject *__pyx_t_1 = NULL;
54171   PyObject *__pyx_t_2 = NULL;
54172   PyObject *__pyx_t_3 = NULL;
54173   PyObject *__pyx_t_4 = NULL;
54174   PyObject *__pyx_t_5 = NULL;
54175   PyObject *__pyx_t_6 = NULL;
54176   PyObject *__pyx_t_7 = NULL;
54177   PyObject *__pyx_t_8 = NULL;
54178   PyObject *__pyx_t_9 = NULL;
54179   PyObject *__pyx_t_10 = NULL;
54180   PyObject *__pyx_t_11 = NULL;
54181   PyObject *__pyx_t_12 = NULL;
54182   PyObject *__pyx_t_13 = NULL;
54183   PyObject *__pyx_t_14 = NULL;
54184   PyObject *__pyx_t_15 = NULL;
54185   PyObject *__pyx_t_16 = NULL;
54186   PyObject *__pyx_t_17 = NULL;
54187   PyObject *__pyx_t_18 = NULL;
54188   PyObject *__pyx_t_19 = NULL;
54189   PyObject *__pyx_t_20 = NULL;
54190   static PyThread_type_lock __pyx_t_21[8];
54191   __Pyx_RefNannyDeclarations
54192   #if CYTHON_PEP489_MULTI_PHASE_INIT
54193   if (__pyx_m) {
54194     if (__pyx_m == __pyx_pyinit_module) return 0;
54195     PyErr_SetString(PyExc_RuntimeError, "Module 'geometry_utils' has already been imported. Re-initialisation is not supported.");
54196     return -1;
54197   }
54198   #elif PY_MAJOR_VERSION >= 3
54199   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
54200   #endif
54201   #if CYTHON_REFNANNY
54202 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
54203 if (!__Pyx_RefNanny) {
54204   PyErr_Clear();
54205   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
54206   if (!__Pyx_RefNanny)
54207       Py_FatalError("failed to import 'refnanny' module");
54208 }
54209 #endif
54210   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_geometry_utils(void)", 0);
54211   if (__Pyx_check_binary_version() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
54212   #ifdef __Pxy_PyFrame_Initialize_Offsets
54213   __Pxy_PyFrame_Initialize_Offsets();
54214   #endif
54215   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(1, 1, __pyx_L1_error)
54216   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(1, 1, __pyx_L1_error)
54217   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(1, 1, __pyx_L1_error)
54218   #ifdef __Pyx_CyFunction_USED
54219   if (__pyx_CyFunction_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
54220   #endif
54221   #ifdef __Pyx_FusedFunction_USED
54222   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
54223   #endif
54224   #ifdef __Pyx_Coroutine_USED
54225   if (__pyx_Coroutine_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
54226   #endif
54227   #ifdef __Pyx_Generator_USED
54228   if (__pyx_Generator_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
54229   #endif
54230   #ifdef __Pyx_AsyncGen_USED
54231   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
54232   #endif
54233   #ifdef __Pyx_StopAsyncIteration_USED
54234   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
54235   #endif
54236   /*--- Library function declarations ---*/
54237   /*--- Threads initialization code ---*/
54238   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
54239   #ifdef WITH_THREAD /* Python build with threading support? */
54240   PyEval_InitThreads();
54241   #endif
54242   #endif
54243   /*--- Module creation code ---*/
54244   #if CYTHON_PEP489_MULTI_PHASE_INIT
54245   __pyx_m = __pyx_pyinit_module;
54246   Py_INCREF(__pyx_m);
54247   #else
54248   #if PY_MAJOR_VERSION < 3
54249   __pyx_m = Py_InitModule4("geometry_utils", __pyx_methods, __pyx_k_Simple_integrators_for_the_radi, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
54250   #else
54251   __pyx_m = PyModule_Create(&__pyx_moduledef);
54252   #endif
54253   if (unlikely(!__pyx_m)) __PYX_ERR(1, 1, __pyx_L1_error)
54254   #endif
54255   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(1, 1, __pyx_L1_error)
54256   Py_INCREF(__pyx_d);
54257   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(1, 1, __pyx_L1_error)
54258   Py_INCREF(__pyx_b);
54259   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(1, 1, __pyx_L1_error)
54260   Py_INCREF(__pyx_cython_runtime);
54261   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(1, 1, __pyx_L1_error);
54262   /*--- Initialize various global constants etc. ---*/
54263   if (__Pyx_InitGlobals() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
54264   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
54265   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
54266   #endif
54267   if (__pyx_module_is_main_yt__utilities__lib__geometry_utils) {
54268     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
54269   }
54270   #if PY_MAJOR_VERSION >= 3
54271   {
54272     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(1, 1, __pyx_L1_error)
54273     if (!PyDict_GetItemString(modules, "yt.utilities.lib.geometry_utils")) {
54274       if (unlikely(PyDict_SetItemString(modules, "yt.utilities.lib.geometry_utils", __pyx_m) < 0)) __PYX_ERR(1, 1, __pyx_L1_error)
54275     }
54276   }
54277   #endif
54278   /*--- Builtin init code ---*/
54279   if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error;
54280   /*--- Constants init code ---*/
54281   if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error;
54282   /*--- Global type/function init code ---*/
54283   (void)__Pyx_modinit_global_init_code();
54284   (void)__Pyx_modinit_variable_export_code();
54285   if (unlikely(__Pyx_modinit_function_export_code() != 0)) goto __pyx_L1_error;
54286   if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
54287   if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
54288   (void)__Pyx_modinit_variable_import_code();
54289   (void)__Pyx_modinit_function_import_code();
54290   /*--- Execution code ---*/
54291   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
54292   if (__Pyx_patch_abc() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
54293   #endif
54294 
54295   /* "yt/utilities/lib/geometry_utils.pyx":13
54296  *
54297  *
54298  * import numpy as np             # <<<<<<<<<<<<<<
54299  *
54300  * cimport cython
54301  */
54302   __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
54303   __Pyx_GOTREF(__pyx_t_1);
54304   if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(1, 13, __pyx_L1_error)
54305   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
54306 
54307   /* "yt/utilities/lib/geometry_utils.pyx":23
54308  * from yt.utilities.lib.fp_utils cimport fclip, i64clip
54309  *
54310  * from yt.utilities.exceptions import YTDomainOverflow             # <<<<<<<<<<<<<<
54311  *
54312  * from yt.utilities.lib.vec3_ops cimport L2_norm, cross, dot, subtract
54313  */
54314   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 23, __pyx_L1_error)
54315   __Pyx_GOTREF(__pyx_t_1);
54316   __Pyx_INCREF(__pyx_n_s_YTDomainOverflow);
54317   __Pyx_GIVEREF(__pyx_n_s_YTDomainOverflow);
54318   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_YTDomainOverflow);
54319   __pyx_t_2 = __Pyx_Import(__pyx_n_s_yt_utilities_exceptions, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 23, __pyx_L1_error)
54320   __Pyx_GOTREF(__pyx_t_2);
54321   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
54322   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_YTDomainOverflow); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 23, __pyx_L1_error)
54323   __Pyx_GOTREF(__pyx_t_1);
54324   if (PyDict_SetItem(__pyx_d, __pyx_n_s_YTDomainOverflow, __pyx_t_1) < 0) __PYX_ERR(1, 23, __pyx_L1_error)
54325   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
54326   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54327 
54328   /* "yt/utilities/lib/geometry_utils.pyx":138
54329  * @cython.boundscheck(False)
54330  * @cython.wraparound(False)
54331  * def spread_bits(np.uint64_t x):             # <<<<<<<<<<<<<<
54332  *     return spread_64bits_by2(x)
54333  *
54334  */
54335   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_1spread_bits, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 138, __pyx_L1_error)
54336   __Pyx_GOTREF(__pyx_t_2);
54337   if (PyDict_SetItem(__pyx_d, __pyx_n_s_spread_bits, __pyx_t_2) < 0) __PYX_ERR(1, 138, __pyx_L1_error)
54338   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54339 
54340   /* "yt/utilities/lib/geometry_utils.pyx":144
54341  * @cython.boundscheck(False)
54342  * @cython.wraparound(False)
54343  * def compact_bits(np.uint64_t x):             # <<<<<<<<<<<<<<
54344  *     return compact_64bits_by2(x)
54345  *
54346  */
54347   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_3compact_bits, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 144, __pyx_L1_error)
54348   __Pyx_GOTREF(__pyx_t_2);
54349   if (PyDict_SetItem(__pyx_d, __pyx_n_s_compact_bits, __pyx_t_2) < 0) __PYX_ERR(1, 144, __pyx_L1_error)
54350   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54351 
54352   /* "yt/utilities/lib/geometry_utils.pyx":150
54353  * @cython.boundscheck(False)
54354  * @cython.wraparound(False)
54355  * def lsz(np.uint64_t v, int stride = 1, int start = 0):             # <<<<<<<<<<<<<<
54356  *     cdef int c
54357  *     c = start
54358  */
54359   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_5lsz, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 150, __pyx_L1_error)
54360   __Pyx_GOTREF(__pyx_t_2);
54361   if (PyDict_SetItem(__pyx_d, __pyx_n_s_lsz, __pyx_t_2) < 0) __PYX_ERR(1, 150, __pyx_L1_error)
54362   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54363 
54364   /* "yt/utilities/lib/geometry_utils.pyx":160
54365  * @cython.boundscheck(False)
54366  * @cython.wraparound(False)
54367  * def lsb(np.uint64_t v, int stride = 1, int start = 0):             # <<<<<<<<<<<<<<
54368  *     cdef int c
54369  *     c = start
54370  */
54371   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_7lsb, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 160, __pyx_L1_error)
54372   __Pyx_GOTREF(__pyx_t_2);
54373   if (PyDict_SetItem(__pyx_d, __pyx_n_s_lsb, __pyx_t_2) < 0) __PYX_ERR(1, 160, __pyx_L1_error)
54374   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54375 
54376   /* "yt/utilities/lib/geometry_utils.pyx":170
54377  * @cython.boundscheck(False)
54378  * @cython.wraparound(False)
54379  * def bitwise_addition(np.uint64_t x, np.int64_t y0,             # <<<<<<<<<<<<<<
54380  *                      int stride = 1, int start = 0):
54381  *     if (y0 == 0): return x
54382  */
54383   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_9bitwise_addition, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 170, __pyx_L1_error)
54384   __Pyx_GOTREF(__pyx_t_2);
54385   if (PyDict_SetItem(__pyx_d, __pyx_n_s_bitwise_addition, __pyx_t_2) < 0) __PYX_ERR(1, 170, __pyx_L1_error)
54386   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54387 
54388   /* "yt/utilities/lib/geometry_utils.pyx":265
54389  * @cython.boundscheck(False)
54390  * @cython.wraparound(False)
54391  * def get_hilbert_indices(int order, np.ndarray[np.int64_t, ndim=2] left_index):             # <<<<<<<<<<<<<<
54392  *     # This is inspired by the scurve package by user cortesi on GH.
54393  *     cdef int i
54394  */
54395   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_11get_hilbert_indices, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 265, __pyx_L1_error)
54396   __Pyx_GOTREF(__pyx_t_2);
54397   if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_hilbert_indices, __pyx_t_2) < 0) __PYX_ERR(1, 265, __pyx_L1_error)
54398   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54399 
54400   /* "yt/utilities/lib/geometry_utils.pyx":281
54401  * @cython.boundscheck(False)
54402  * @cython.wraparound(False)
54403  * def get_hilbert_points(int order, np.ndarray[np.int64_t, ndim=1] indices):             # <<<<<<<<<<<<<<
54404  *     # This is inspired by the scurve package by user cortesi on GH.
54405  *     cdef int i, j
54406  */
54407   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_13get_hilbert_points, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 281, __pyx_L1_error)
54408   __Pyx_GOTREF(__pyx_t_2);
54409   if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_hilbert_points, __pyx_t_2) < 0) __PYX_ERR(1, 281, __pyx_L1_error)
54410   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54411 
54412   /* "yt/utilities/lib/geometry_utils.pyx":309
54413  * @cython.boundscheck(False)
54414  * @cython.wraparound(False)
54415  * def get_morton_index(np.ndarray[np.uint64_t, ndim=1] left_index):             # <<<<<<<<<<<<<<
54416  *     cdef int j
54417  *     cdef np.uint64_t morton_index
54418  */
54419   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_15get_morton_index, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 309, __pyx_L1_error)
54420   __Pyx_GOTREF(__pyx_t_2);
54421   if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_morton_index, __pyx_t_2) < 0) __PYX_ERR(1, 309, __pyx_L1_error)
54422   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54423 
54424   /* "yt/utilities/lib/geometry_utils.pyx":324
54425  * @cython.boundscheck(False)
54426  * @cython.wraparound(False)
54427  * def get_morton_indices(np.ndarray[np.uint64_t, ndim=2] left_index):             # <<<<<<<<<<<<<<
54428  *     cdef np.int64_t i
54429  *     cdef int j
54430  */
54431   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_17get_morton_indices, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 324, __pyx_L1_error)
54432   __Pyx_GOTREF(__pyx_t_2);
54433   if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_morton_indices, __pyx_t_2) < 0) __PYX_ERR(1, 324, __pyx_L1_error)
54434   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54435 
54436   /* "yt/utilities/lib/geometry_utils.pyx":342
54437  * @cython.boundscheck(False)
54438  * @cython.wraparound(False)
54439  * def get_morton_indices_unravel(np.ndarray[np.uint64_t, ndim=1] left_x,             # <<<<<<<<<<<<<<
54440  *                                np.ndarray[np.uint64_t, ndim=1] left_y,
54441  *                                np.ndarray[np.uint64_t, ndim=1] left_z):
54442  */
54443   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_19get_morton_indices_unravel, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 342, __pyx_L1_error)
54444   __Pyx_GOTREF(__pyx_t_2);
54445   if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_morton_indices_unravel, __pyx_t_2) < 0) __PYX_ERR(1, 342, __pyx_L1_error)
54446   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54447 
54448   /* "yt/utilities/lib/geometry_utils.pyx":363
54449  * @cython.boundscheck(False)
54450  * @cython.wraparound(False)
54451  * def get_morton_point(np.uint64_t index):             # <<<<<<<<<<<<<<
54452  *     cdef int j
54453  *     cdef np.uint64_t p[3]
54454  */
54455   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_21get_morton_point, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 363, __pyx_L1_error)
54456   __Pyx_GOTREF(__pyx_t_2);
54457   if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_morton_point, __pyx_t_2) < 0) __PYX_ERR(1, 363, __pyx_L1_error)
54458   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54459 
54460   /* "yt/utilities/lib/geometry_utils.pyx":376
54461  * @cython.boundscheck(False)
54462  * @cython.wraparound(False)
54463  * def get_morton_points(np.ndarray[np.uint64_t, ndim=1] indices):             # <<<<<<<<<<<<<<
54464  *     # This is inspired by the scurve package by user cortesi on GH.
54465  *     cdef int i, j
54466  */
54467   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_23get_morton_points, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 376, __pyx_L1_error)
54468   __Pyx_GOTREF(__pyx_t_2);
54469   if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_morton_points, __pyx_t_2) < 0) __PYX_ERR(1, 376, __pyx_L1_error)
54470   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54471 
54472   /* "yt/utilities/lib/geometry_utils.pyx":391
54473  * @cython.boundscheck(False)
54474  * @cython.wraparound(False)
54475  * def get_morton_neighbors_coarse(mi1, max_index1, periodic, nn):             # <<<<<<<<<<<<<<
54476  *     cdef int i
54477  *     cdef np.uint32_t ntot
54478  */
54479   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_25get_morton_neighbors_coarse, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 391, __pyx_L1_error)
54480   __Pyx_GOTREF(__pyx_t_2);
54481   if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_morton_neighbors_coarse, __pyx_t_2) < 0) __PYX_ERR(1, 391, __pyx_L1_error)
54482   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54483 
54484   /* "yt/utilities/lib/geometry_utils.pyx":470
54485  * @cython.boundscheck(False)
54486  * @cython.wraparound(False)
54487  * def get_morton_neighbors_refined(mi1, mi2, max_index1, max_index2, periodic, nn):             # <<<<<<<<<<<<<<
54488  *     cdef int i
54489  *     cdef np.uint32_t ntot
54490  */
54491   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_27get_morton_neighbors_refined, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 470, __pyx_L1_error)
54492   __Pyx_GOTREF(__pyx_t_2);
54493   if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_morton_neighbors_refined, __pyx_t_2) < 0) __PYX_ERR(1, 470, __pyx_L1_error)
54494   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54495 
54496   /* "yt/utilities/lib/geometry_utils.pyx":576
54497  * @cython.boundscheck(False)
54498  * @cython.wraparound(False)
54499  * def morton_neighbor_periodic(np.ndarray[np.uint64_t,ndim=1] p,             # <<<<<<<<<<<<<<
54500  *                              list dim_list, list num_list,
54501  *                              np.uint64_t max_index):
54502  */
54503   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_29morton_neighbor_periodic, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 576, __pyx_L1_error)
54504   __Pyx_GOTREF(__pyx_t_2);
54505   if (PyDict_SetItem(__pyx_d, __pyx_n_s_morton_neighbor_periodic, __pyx_t_2) < 0) __PYX_ERR(1, 576, __pyx_L1_error)
54506   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54507 
54508   /* "yt/utilities/lib/geometry_utils.pyx":590
54509  * @cython.boundscheck(False)
54510  * @cython.wraparound(False)
54511  * def morton_neighbor_bounded(np.ndarray[np.uint64_t,ndim=1] p,             # <<<<<<<<<<<<<<
54512  *                             list dim_list, list num_list,
54513  *                             np.uint64_t max_index):
54514  */
54515   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_31morton_neighbor_bounded, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 590, __pyx_L1_error)
54516   __Pyx_GOTREF(__pyx_t_2);
54517   if (PyDict_SetItem(__pyx_d, __pyx_n_s_morton_neighbor_bounded, __pyx_t_2) < 0) __PYX_ERR(1, 590, __pyx_L1_error)
54518   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54519 
54520   /* "yt/utilities/lib/geometry_utils.pyx":609
54521  * @cython.boundscheck(False)
54522  * @cython.wraparound(False)
54523  * def morton_neighbor(np.ndarray[np.uint64_t,ndim=1] p,             # <<<<<<<<<<<<<<
54524  *                     list dim_list, list num_list,
54525  *                     np.uint64_t max_index, periodic = False):
54526  */
54527   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_33morton_neighbor, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 609, __pyx_L1_error)
54528   __Pyx_GOTREF(__pyx_t_2);
54529   if (PyDict_SetItem(__pyx_d, __pyx_n_s_morton_neighbor, __pyx_t_2) < 0) __PYX_ERR(1, 609, __pyx_L1_error)
54530   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54531 
54532   /* "yt/utilities/lib/geometry_utils.pyx":620
54533  * @cython.boundscheck(False)
54534  * @cython.wraparound(False)
54535  * def get_morton_neighbors(np.ndarray[np.uint64_t,ndim=1] mi,             # <<<<<<<<<<<<<<
54536  *                          int order = ORDER_MAX, periodic = False):
54537  *     """Returns array of neighboring morton indices"""
54538  */
54539   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_35get_morton_neighbors, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 620, __pyx_L1_error)
54540   __Pyx_GOTREF(__pyx_t_2);
54541   if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_morton_neighbors, __pyx_t_2) < 0) __PYX_ERR(1, 620, __pyx_L1_error)
54542   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54543 
54544   /* "yt/utilities/lib/geometry_utils.pyx":717
54545  *     return np.unique(np.hstack([mi,mi_neighbors]))
54546  *
54547  * def ifrexp_cy(np.float64_t x):             # <<<<<<<<<<<<<<
54548  *     cdef np.int64_t e, m
54549  *     m = ifrexp(x, &e)
54550  */
54551   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_37ifrexp_cy, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 717, __pyx_L1_error)
54552   __Pyx_GOTREF(__pyx_t_2);
54553   if (PyDict_SetItem(__pyx_d, __pyx_n_s_ifrexp_cy, __pyx_t_2) < 0) __PYX_ERR(1, 717, __pyx_L1_error)
54554   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54555 
54556   /* "yt/utilities/lib/geometry_utils.pyx":722
54557  *     return m,e
54558  *
54559  * def msdb_cy(np.int64_t a, np.int64_t b):             # <<<<<<<<<<<<<<
54560  *     return msdb(a,b)
54561  *
54562  */
54563   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_39msdb_cy, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 722, __pyx_L1_error)
54564   __Pyx_GOTREF(__pyx_t_2);
54565   if (PyDict_SetItem(__pyx_d, __pyx_n_s_msdb_cy, __pyx_t_2) < 0) __PYX_ERR(1, 722, __pyx_L1_error)
54566   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54567 
54568   /* "yt/utilities/lib/geometry_utils.pyx":725
54569  *     return msdb(a,b)
54570  *
54571  * def msdb_cy(np.int64_t a, np.int64_t b):             # <<<<<<<<<<<<<<
54572  *     return msdb(a,b)
54573  *
54574  */
54575   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_41msdb_cy, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 725, __pyx_L1_error)
54576   __Pyx_GOTREF(__pyx_t_2);
54577   if (PyDict_SetItem(__pyx_d, __pyx_n_s_msdb_cy, __pyx_t_2) < 0) __PYX_ERR(1, 725, __pyx_L1_error)
54578   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54579 
54580   /* "yt/utilities/lib/geometry_utils.pyx":728
54581  *     return msdb(a,b)
54582  *
54583  * def xor_msb_cy(np.float64_t a, np.float64_t b):             # <<<<<<<<<<<<<<
54584  *     return xor_msb(a,b)
54585  *
54586  */
54587   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_43xor_msb_cy, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 728, __pyx_L1_error)
54588   __Pyx_GOTREF(__pyx_t_2);
54589   if (PyDict_SetItem(__pyx_d, __pyx_n_s_xor_msb_cy, __pyx_t_2) < 0) __PYX_ERR(1, 728, __pyx_L1_error)
54590   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54591 
54592   /* "yt/utilities/lib/geometry_utils.pyx":731
54593  *     return xor_msb(a,b)
54594  *
54595  * def morton_qsort_swap(np.ndarray[np.uint64_t, ndim=1] ind,             # <<<<<<<<<<<<<<
54596  *                       np.uint64_t a, np.uint64_t b):
54597  *     # http://www.geeksforgeeks.org/iterative-quick-sort/
54598  */
54599   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_45morton_qsort_swap, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 731, __pyx_L1_error)
54600   __Pyx_GOTREF(__pyx_t_2);
54601   if (PyDict_SetItem(__pyx_d, __pyx_n_s_morton_qsort_swap, __pyx_t_2) < 0) __PYX_ERR(1, 731, __pyx_L1_error)
54602   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
54603 
54604   /* "yt/utilities/lib/geometry_utils.pyx":741
54605  *                            np.int64_t l, np.int64_t h,
54606  *                            np.ndarray[np.uint64_t, ndim=1] ind,
54607  *                            use_loop = False):             # <<<<<<<<<<<<<<
54608  *     # Initialize
54609  *     cdef int k
54610  */
54611   __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 741, __pyx_L1_error)
54612   __Pyx_GOTREF(__pyx_t_2);
54613 
54614   /* "yt/utilities/lib/geometry_utils.pyx":738
54615  *     ind[b] = t
54616  *
54617  * def morton_qsort_partition(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
54618  *                            np.int64_t l, np.int64_t h,
54619  *                            np.ndarray[np.uint64_t, ndim=1] ind,
54620  */
54621   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 738, __pyx_L1_error)
54622   __Pyx_GOTREF(__pyx_t_1);
54623   __Pyx_GIVEREF(__pyx_t_2);
54624   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
54625   __pyx_t_2 = 0;
54626   __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 738, __pyx_L1_error)
54627   __Pyx_GOTREF(__pyx_t_2);
54628   __pyx_t_3 = __pyx_FusedFunction_NewEx(&__pyx_fuse_0__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_77morton_qsort_partition, 0, __pyx_n_s_morton_qsort_partition, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2, __pyx_d, ((PyObject *)__pyx_codeobj__89)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 738, __pyx_L1_error)
54629   __Pyx_GOTREF(__pyx_t_3);
54630   if (!__Pyx_CyFunction_InitDefaults(__pyx_t_3, sizeof(__pyx_defaults2), 1)) __PYX_ERR(1, 738, __pyx_L1_error)
54631 
54632   /* "yt/utilities/lib/geometry_utils.pyx":741
54633  *                            np.int64_t l, np.int64_t h,
54634  *                            np.ndarray[np.uint64_t, ndim=1] ind,
54635  *                            use_loop = False):             # <<<<<<<<<<<<<<
54636  *     # Initialize
54637  *     cdef int k
54638  */
54639   __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 741, __pyx_L1_error)
54640   __Pyx_GOTREF(__pyx_t_4);
54641   __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_t_3)->__pyx_arg_use_loop = __pyx_t_4;
54642   __Pyx_GIVEREF(__pyx_t_4);
54643   __pyx_t_4 = 0;
54644   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_t_1);
54645   __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_3, __pyx_pf_2yt_9utilities_3lib_14geometry_utils_116__defaults__);
54646   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_float, __pyx_t_3) < 0) __PYX_ERR(1, 738, __pyx_L1_error)
54647   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
54648 
54649   /* "yt/utilities/lib/geometry_utils.pyx":738
54650  *     ind[b] = t
54651  *
54652  * def morton_qsort_partition(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
54653  *                            np.int64_t l, np.int64_t h,
54654  *                            np.ndarray[np.uint64_t, ndim=1] ind,
54655  */
54656   __pyx_t_3 = __pyx_FusedFunction_NewEx(&__pyx_fuse_1__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_79morton_qsort_partition, 0, __pyx_n_s_morton_qsort_partition, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2, __pyx_d, ((PyObject *)__pyx_codeobj__89)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 738, __pyx_L1_error)
54657   __Pyx_GOTREF(__pyx_t_3);
54658   if (!__Pyx_CyFunction_InitDefaults(__pyx_t_3, sizeof(__pyx_defaults3), 1)) __PYX_ERR(1, 738, __pyx_L1_error)
54659 
54660   /* "yt/utilities/lib/geometry_utils.pyx":741
54661  *                            np.int64_t l, np.int64_t h,
54662  *                            np.ndarray[np.uint64_t, ndim=1] ind,
54663  *                            use_loop = False):             # <<<<<<<<<<<<<<
54664  *     # Initialize
54665  *     cdef int k
54666  */
54667   __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 741, __pyx_L1_error)
54668   __Pyx_GOTREF(__pyx_t_4);
54669   __Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_t_3)->__pyx_arg_use_loop = __pyx_t_4;
54670   __Pyx_GIVEREF(__pyx_t_4);
54671   __pyx_t_4 = 0;
54672   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_t_1);
54673   __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_3, __pyx_pf_2yt_9utilities_3lib_14geometry_utils_118__defaults__);
54674   if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_double, __pyx_t_3) < 0) __PYX_ERR(1, 738, __pyx_L1_error)
54675   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
54676 
54677   /* "yt/utilities/lib/geometry_utils.pyx":738
54678  *     ind[b] = t
54679  *
54680  * def morton_qsort_partition(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
54681  *                            np.int64_t l, np.int64_t h,
54682  *                            np.ndarray[np.uint64_t, ndim=1] ind,
54683  */
54684   __pyx_t_3 = __pyx_FusedFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_47morton_qsort_partition, 0, __pyx_n_s_morton_qsort_partition, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2, __pyx_d, ((PyObject *)__pyx_codeobj__89)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 738, __pyx_L1_error)
54685   __Pyx_GOTREF(__pyx_t_3);
54686   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_t_1);
54687   ((__pyx_FusedFunctionObject *) __pyx_t_3)->__signatures__ = __pyx_t_2;
54688   __Pyx_GIVEREF(__pyx_t_2);
54689   if (PyDict_SetItem(__pyx_d, __pyx_n_s_morton_qsort_partition, __pyx_t_3) < 0) __PYX_ERR(1, 738, __pyx_L1_error)
54690   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
54691   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
54692 
54693   /* "yt/utilities/lib/geometry_utils.pyx":807
54694  *                            np.int64_t l, np.int64_t h,
54695  *                            np.ndarray[np.uint64_t, ndim=1] ind,
54696  *                            use_loop = False):             # <<<<<<<<<<<<<<
54697  *     # http://www.geeksforgeeks.org/iterative-quick-sort/
54698  *     cdef np.int64_t p
54699  */
54700   __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 807, __pyx_L1_error)
54701   __Pyx_GOTREF(__pyx_t_4);
54702 
54703   /* "yt/utilities/lib/geometry_utils.pyx":804
54704  * @cython.boundscheck(False)
54705  * @cython.wraparound(False)
54706  * def morton_qsort_recursive(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
54707  *                            np.int64_t l, np.int64_t h,
54708  *                            np.ndarray[np.uint64_t, ndim=1] ind,
54709  */
54710   __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 804, __pyx_L1_error)
54711   __Pyx_GOTREF(__pyx_t_5);
54712   __Pyx_GIVEREF(__pyx_t_4);
54713   PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
54714   __pyx_t_4 = 0;
54715   __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 804, __pyx_L1_error)
54716   __Pyx_GOTREF(__pyx_t_4);
54717   __pyx_t_6 = __pyx_FusedFunction_NewEx(&__pyx_fuse_0__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_83morton_qsort_recursive, 0, __pyx_n_s_morton_qsort_recursive, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2, __pyx_d, ((PyObject *)__pyx_codeobj__91)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 804, __pyx_L1_error)
54718   __Pyx_GOTREF(__pyx_t_6);
54719   if (!__Pyx_CyFunction_InitDefaults(__pyx_t_6, sizeof(__pyx_defaults6), 1)) __PYX_ERR(1, 804, __pyx_L1_error)
54720 
54721   /* "yt/utilities/lib/geometry_utils.pyx":807
54722  *                            np.int64_t l, np.int64_t h,
54723  *                            np.ndarray[np.uint64_t, ndim=1] ind,
54724  *                            use_loop = False):             # <<<<<<<<<<<<<<
54725  *     # http://www.geeksforgeeks.org/iterative-quick-sort/
54726  *     cdef np.int64_t p
54727  */
54728   __pyx_t_7 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 807, __pyx_L1_error)
54729   __Pyx_GOTREF(__pyx_t_7);
54730   __Pyx_CyFunction_Defaults(__pyx_defaults6, __pyx_t_6)->__pyx_arg_use_loop = __pyx_t_7;
54731   __Pyx_GIVEREF(__pyx_t_7);
54732   __pyx_t_7 = 0;
54733   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_6, __pyx_t_5);
54734   __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_6, __pyx_pf_2yt_9utilities_3lib_14geometry_utils_124__defaults__);
54735   if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_float, __pyx_t_6) < 0) __PYX_ERR(1, 804, __pyx_L1_error)
54736   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
54737 
54738   /* "yt/utilities/lib/geometry_utils.pyx":804
54739  * @cython.boundscheck(False)
54740  * @cython.wraparound(False)
54741  * def morton_qsort_recursive(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
54742  *                            np.int64_t l, np.int64_t h,
54743  *                            np.ndarray[np.uint64_t, ndim=1] ind,
54744  */
54745   __pyx_t_6 = __pyx_FusedFunction_NewEx(&__pyx_fuse_1__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_85morton_qsort_recursive, 0, __pyx_n_s_morton_qsort_recursive, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2, __pyx_d, ((PyObject *)__pyx_codeobj__91)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 804, __pyx_L1_error)
54746   __Pyx_GOTREF(__pyx_t_6);
54747   if (!__Pyx_CyFunction_InitDefaults(__pyx_t_6, sizeof(__pyx_defaults7), 1)) __PYX_ERR(1, 804, __pyx_L1_error)
54748 
54749   /* "yt/utilities/lib/geometry_utils.pyx":807
54750  *                            np.int64_t l, np.int64_t h,
54751  *                            np.ndarray[np.uint64_t, ndim=1] ind,
54752  *                            use_loop = False):             # <<<<<<<<<<<<<<
54753  *     # http://www.geeksforgeeks.org/iterative-quick-sort/
54754  *     cdef np.int64_t p
54755  */
54756   __pyx_t_7 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 807, __pyx_L1_error)
54757   __Pyx_GOTREF(__pyx_t_7);
54758   __Pyx_CyFunction_Defaults(__pyx_defaults7, __pyx_t_6)->__pyx_arg_use_loop = __pyx_t_7;
54759   __Pyx_GIVEREF(__pyx_t_7);
54760   __pyx_t_7 = 0;
54761   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_6, __pyx_t_5);
54762   __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_6, __pyx_pf_2yt_9utilities_3lib_14geometry_utils_126__defaults__);
54763   if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_double, __pyx_t_6) < 0) __PYX_ERR(1, 804, __pyx_L1_error)
54764   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
54765 
54766   /* "yt/utilities/lib/geometry_utils.pyx":804
54767  * @cython.boundscheck(False)
54768  * @cython.wraparound(False)
54769  * def morton_qsort_recursive(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
54770  *                            np.int64_t l, np.int64_t h,
54771  *                            np.ndarray[np.uint64_t, ndim=1] ind,
54772  */
54773   __pyx_t_6 = __pyx_FusedFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_49morton_qsort_recursive, 0, __pyx_n_s_morton_qsort_recursive, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2, __pyx_d, ((PyObject *)__pyx_codeobj__91)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 804, __pyx_L1_error)
54774   __Pyx_GOTREF(__pyx_t_6);
54775   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_6, __pyx_t_5);
54776   ((__pyx_FusedFunctionObject *) __pyx_t_6)->__signatures__ = __pyx_t_4;
54777   __Pyx_GIVEREF(__pyx_t_4);
54778   if (PyDict_SetItem(__pyx_d, __pyx_n_s_morton_qsort_recursive, __pyx_t_6) < 0) __PYX_ERR(1, 804, __pyx_L1_error)
54779   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
54780   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
54781 
54782   /* "yt/utilities/lib/geometry_utils.pyx":821
54783  *                            np.int64_t l, np.int64_t h,
54784  *                            np.ndarray[np.uint64_t, ndim=1] ind,
54785  *                            use_loop = False):             # <<<<<<<<<<<<<<
54786  *     # http://www.geeksforgeeks.org/iterative-quick-sort/
54787  *     # Auxillary stack
54788  */
54789   __pyx_t_7 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 821, __pyx_L1_error)
54790   __Pyx_GOTREF(__pyx_t_7);
54791 
54792   /* "yt/utilities/lib/geometry_utils.pyx":818
54793  * @cython.boundscheck(False)
54794  * @cython.wraparound(False)
54795  * def morton_qsort_iterative(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
54796  *                            np.int64_t l, np.int64_t h,
54797  *                            np.ndarray[np.uint64_t, ndim=1] ind,
54798  */
54799   __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 818, __pyx_L1_error)
54800   __Pyx_GOTREF(__pyx_t_8);
54801   __Pyx_GIVEREF(__pyx_t_7);
54802   PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
54803   __pyx_t_7 = 0;
54804   __pyx_t_7 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 818, __pyx_L1_error)
54805   __Pyx_GOTREF(__pyx_t_7);
54806   __pyx_t_9 = __pyx_FusedFunction_NewEx(&__pyx_fuse_0__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_89morton_qsort_iterative, 0, __pyx_n_s_morton_qsort_iterative, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2, __pyx_d, ((PyObject *)__pyx_codeobj__93)); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 818, __pyx_L1_error)
54807   __Pyx_GOTREF(__pyx_t_9);
54808   if (!__Pyx_CyFunction_InitDefaults(__pyx_t_9, sizeof(__pyx_defaults10), 1)) __PYX_ERR(1, 818, __pyx_L1_error)
54809 
54810   /* "yt/utilities/lib/geometry_utils.pyx":821
54811  *                            np.int64_t l, np.int64_t h,
54812  *                            np.ndarray[np.uint64_t, ndim=1] ind,
54813  *                            use_loop = False):             # <<<<<<<<<<<<<<
54814  *     # http://www.geeksforgeeks.org/iterative-quick-sort/
54815  *     # Auxillary stack
54816  */
54817   __pyx_t_10 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 821, __pyx_L1_error)
54818   __Pyx_GOTREF(__pyx_t_10);
54819   __Pyx_CyFunction_Defaults(__pyx_defaults10, __pyx_t_9)->__pyx_arg_use_loop = __pyx_t_10;
54820   __Pyx_GIVEREF(__pyx_t_10);
54821   __pyx_t_10 = 0;
54822   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_9, __pyx_t_8);
54823   __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_9, __pyx_pf_2yt_9utilities_3lib_14geometry_utils_132__defaults__);
54824   if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_float, __pyx_t_9) < 0) __PYX_ERR(1, 818, __pyx_L1_error)
54825   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
54826 
54827   /* "yt/utilities/lib/geometry_utils.pyx":818
54828  * @cython.boundscheck(False)
54829  * @cython.wraparound(False)
54830  * def morton_qsort_iterative(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
54831  *                            np.int64_t l, np.int64_t h,
54832  *                            np.ndarray[np.uint64_t, ndim=1] ind,
54833  */
54834   __pyx_t_9 = __pyx_FusedFunction_NewEx(&__pyx_fuse_1__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_91morton_qsort_iterative, 0, __pyx_n_s_morton_qsort_iterative, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2, __pyx_d, ((PyObject *)__pyx_codeobj__93)); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 818, __pyx_L1_error)
54835   __Pyx_GOTREF(__pyx_t_9);
54836   if (!__Pyx_CyFunction_InitDefaults(__pyx_t_9, sizeof(__pyx_defaults11), 1)) __PYX_ERR(1, 818, __pyx_L1_error)
54837 
54838   /* "yt/utilities/lib/geometry_utils.pyx":821
54839  *                            np.int64_t l, np.int64_t h,
54840  *                            np.ndarray[np.uint64_t, ndim=1] ind,
54841  *                            use_loop = False):             # <<<<<<<<<<<<<<
54842  *     # http://www.geeksforgeeks.org/iterative-quick-sort/
54843  *     # Auxillary stack
54844  */
54845   __pyx_t_10 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 821, __pyx_L1_error)
54846   __Pyx_GOTREF(__pyx_t_10);
54847   __Pyx_CyFunction_Defaults(__pyx_defaults11, __pyx_t_9)->__pyx_arg_use_loop = __pyx_t_10;
54848   __Pyx_GIVEREF(__pyx_t_10);
54849   __pyx_t_10 = 0;
54850   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_9, __pyx_t_8);
54851   __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_9, __pyx_pf_2yt_9utilities_3lib_14geometry_utils_134__defaults__);
54852   if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_double, __pyx_t_9) < 0) __PYX_ERR(1, 818, __pyx_L1_error)
54853   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
54854 
54855   /* "yt/utilities/lib/geometry_utils.pyx":818
54856  * @cython.boundscheck(False)
54857  * @cython.wraparound(False)
54858  * def morton_qsort_iterative(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
54859  *                            np.int64_t l, np.int64_t h,
54860  *                            np.ndarray[np.uint64_t, ndim=1] ind,
54861  */
54862   __pyx_t_9 = __pyx_FusedFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_51morton_qsort_iterative, 0, __pyx_n_s_morton_qsort_iterative, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2, __pyx_d, ((PyObject *)__pyx_codeobj__93)); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 818, __pyx_L1_error)
54863   __Pyx_GOTREF(__pyx_t_9);
54864   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_9, __pyx_t_8);
54865   ((__pyx_FusedFunctionObject *) __pyx_t_9)->__signatures__ = __pyx_t_7;
54866   __Pyx_GIVEREF(__pyx_t_7);
54867   if (PyDict_SetItem(__pyx_d, __pyx_n_s_morton_qsort_iterative, __pyx_t_9) < 0) __PYX_ERR(1, 818, __pyx_L1_error)
54868   __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
54869   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
54870 
54871   /* "yt/utilities/lib/geometry_utils.pyx":859
54872  *                  np.int64_t l, np.int64_t h,
54873  *                  np.ndarray[np.uint64_t, ndim=1] ind,
54874  *                  recursive = False,             # <<<<<<<<<<<<<<
54875  *                  use_loop = False):
54876  *     #get_morton_argsort1(pos,l,h,ind)
54877  */
54878   __pyx_t_10 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 859, __pyx_L1_error)
54879   __Pyx_GOTREF(__pyx_t_10);
54880 
54881   /* "yt/utilities/lib/geometry_utils.pyx":860
54882  *                  np.ndarray[np.uint64_t, ndim=1] ind,
54883  *                  recursive = False,
54884  *                  use_loop = False):             # <<<<<<<<<<<<<<
54885  *     #get_morton_argsort1(pos,l,h,ind)
54886  *     if recursive:
54887  */
54888   __pyx_t_11 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 860, __pyx_L1_error)
54889   __Pyx_GOTREF(__pyx_t_11);
54890 
54891   /* "yt/utilities/lib/geometry_utils.pyx":856
54892  * @cython.boundscheck(False)
54893  * @cython.wraparound(False)
54894  * def morton_qsort(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
54895  *                  np.int64_t l, np.int64_t h,
54896  *                  np.ndarray[np.uint64_t, ndim=1] ind,
54897  */
54898   __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 856, __pyx_L1_error)
54899   __Pyx_GOTREF(__pyx_t_12);
54900   __Pyx_GIVEREF(__pyx_t_10);
54901   PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10);
54902   __Pyx_GIVEREF(__pyx_t_11);
54903   PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11);
54904   __pyx_t_10 = 0;
54905   __pyx_t_11 = 0;
54906   __pyx_t_11 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 856, __pyx_L1_error)
54907   __Pyx_GOTREF(__pyx_t_11);
54908   __pyx_t_10 = __pyx_FusedFunction_NewEx(&__pyx_fuse_0__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_95morton_qsort, 0, __pyx_n_s_morton_qsort, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2, __pyx_d, ((PyObject *)__pyx_codeobj__95)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 856, __pyx_L1_error)
54909   __Pyx_GOTREF(__pyx_t_10);
54910   if (!__Pyx_CyFunction_InitDefaults(__pyx_t_10, sizeof(__pyx_defaults14), 2)) __PYX_ERR(1, 856, __pyx_L1_error)
54911 
54912   /* "yt/utilities/lib/geometry_utils.pyx":859
54913  *                  np.int64_t l, np.int64_t h,
54914  *                  np.ndarray[np.uint64_t, ndim=1] ind,
54915  *                  recursive = False,             # <<<<<<<<<<<<<<
54916  *                  use_loop = False):
54917  *     #get_morton_argsort1(pos,l,h,ind)
54918  */
54919   __pyx_t_13 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 859, __pyx_L1_error)
54920   __Pyx_GOTREF(__pyx_t_13);
54921   __Pyx_CyFunction_Defaults(__pyx_defaults14, __pyx_t_10)->__pyx_arg_recursive = __pyx_t_13;
54922   __Pyx_GIVEREF(__pyx_t_13);
54923   __pyx_t_13 = 0;
54924 
54925   /* "yt/utilities/lib/geometry_utils.pyx":860
54926  *                  np.ndarray[np.uint64_t, ndim=1] ind,
54927  *                  recursive = False,
54928  *                  use_loop = False):             # <<<<<<<<<<<<<<
54929  *     #get_morton_argsort1(pos,l,h,ind)
54930  *     if recursive:
54931  */
54932   __pyx_t_13 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 860, __pyx_L1_error)
54933   __Pyx_GOTREF(__pyx_t_13);
54934   __Pyx_CyFunction_Defaults(__pyx_defaults14, __pyx_t_10)->__pyx_arg_use_loop = __pyx_t_13;
54935   __Pyx_GIVEREF(__pyx_t_13);
54936   __pyx_t_13 = 0;
54937   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_10, __pyx_t_12);
54938   __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_10, __pyx_pf_2yt_9utilities_3lib_14geometry_utils_140__defaults__);
54939   if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_float, __pyx_t_10) < 0) __PYX_ERR(1, 856, __pyx_L1_error)
54940   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
54941 
54942   /* "yt/utilities/lib/geometry_utils.pyx":856
54943  * @cython.boundscheck(False)
54944  * @cython.wraparound(False)
54945  * def morton_qsort(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
54946  *                  np.int64_t l, np.int64_t h,
54947  *                  np.ndarray[np.uint64_t, ndim=1] ind,
54948  */
54949   __pyx_t_10 = __pyx_FusedFunction_NewEx(&__pyx_fuse_1__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_97morton_qsort, 0, __pyx_n_s_morton_qsort, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2, __pyx_d, ((PyObject *)__pyx_codeobj__95)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 856, __pyx_L1_error)
54950   __Pyx_GOTREF(__pyx_t_10);
54951   if (!__Pyx_CyFunction_InitDefaults(__pyx_t_10, sizeof(__pyx_defaults15), 2)) __PYX_ERR(1, 856, __pyx_L1_error)
54952 
54953   /* "yt/utilities/lib/geometry_utils.pyx":859
54954  *                  np.int64_t l, np.int64_t h,
54955  *                  np.ndarray[np.uint64_t, ndim=1] ind,
54956  *                  recursive = False,             # <<<<<<<<<<<<<<
54957  *                  use_loop = False):
54958  *     #get_morton_argsort1(pos,l,h,ind)
54959  */
54960   __pyx_t_13 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 859, __pyx_L1_error)
54961   __Pyx_GOTREF(__pyx_t_13);
54962   __Pyx_CyFunction_Defaults(__pyx_defaults15, __pyx_t_10)->__pyx_arg_recursive = __pyx_t_13;
54963   __Pyx_GIVEREF(__pyx_t_13);
54964   __pyx_t_13 = 0;
54965 
54966   /* "yt/utilities/lib/geometry_utils.pyx":860
54967  *                  np.ndarray[np.uint64_t, ndim=1] ind,
54968  *                  recursive = False,
54969  *                  use_loop = False):             # <<<<<<<<<<<<<<
54970  *     #get_morton_argsort1(pos,l,h,ind)
54971  *     if recursive:
54972  */
54973   __pyx_t_13 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 860, __pyx_L1_error)
54974   __Pyx_GOTREF(__pyx_t_13);
54975   __Pyx_CyFunction_Defaults(__pyx_defaults15, __pyx_t_10)->__pyx_arg_use_loop = __pyx_t_13;
54976   __Pyx_GIVEREF(__pyx_t_13);
54977   __pyx_t_13 = 0;
54978   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_10, __pyx_t_12);
54979   __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_10, __pyx_pf_2yt_9utilities_3lib_14geometry_utils_142__defaults__);
54980   if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_double, __pyx_t_10) < 0) __PYX_ERR(1, 856, __pyx_L1_error)
54981   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
54982 
54983   /* "yt/utilities/lib/geometry_utils.pyx":856
54984  * @cython.boundscheck(False)
54985  * @cython.wraparound(False)
54986  * def morton_qsort(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
54987  *                  np.int64_t l, np.int64_t h,
54988  *                  np.ndarray[np.uint64_t, ndim=1] ind,
54989  */
54990   __pyx_t_10 = __pyx_FusedFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_53morton_qsort, 0, __pyx_n_s_morton_qsort, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2, __pyx_d, ((PyObject *)__pyx_codeobj__95)); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 856, __pyx_L1_error)
54991   __Pyx_GOTREF(__pyx_t_10);
54992   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_10, __pyx_t_12);
54993   ((__pyx_FusedFunctionObject *) __pyx_t_10)->__signatures__ = __pyx_t_11;
54994   __Pyx_GIVEREF(__pyx_t_11);
54995   if (PyDict_SetItem(__pyx_d, __pyx_n_s_morton_qsort, __pyx_t_10) < 0) __PYX_ERR(1, 856, __pyx_L1_error)
54996   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
54997   __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
54998 
54999   /* "yt/utilities/lib/geometry_utils.pyx":870
55000  * @cython.boundscheck(False)
55001  * @cython.wraparound(False)
55002  * def get_morton_argsort1(np.ndarray[floating, ndim=2] pos,             # <<<<<<<<<<<<<<
55003  *                         np.int64_t start, np.int64_t end,
55004  *                         np.ndarray[np.uint64_t, ndim=1] ind):
55005  */
55006   __pyx_t_13 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 870, __pyx_L1_error)
55007   __Pyx_GOTREF(__pyx_t_13);
55008   __pyx_t_14 = __pyx_FusedFunction_NewEx(&__pyx_fuse_0__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_101get_morton_argsort1, 0, __pyx_n_s_get_morton_argsort1, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2, __pyx_d, ((PyObject *)__pyx_codeobj__97)); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 870, __pyx_L1_error)
55009   __Pyx_GOTREF(__pyx_t_14);
55010   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_14, __pyx_empty_tuple);
55011   if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_float, __pyx_t_14) < 0) __PYX_ERR(1, 870, __pyx_L1_error)
55012   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
55013   __pyx_t_14 = __pyx_FusedFunction_NewEx(&__pyx_fuse_1__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_103get_morton_argsort1, 0, __pyx_n_s_get_morton_argsort1, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2, __pyx_d, ((PyObject *)__pyx_codeobj__97)); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 870, __pyx_L1_error)
55014   __Pyx_GOTREF(__pyx_t_14);
55015   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_14, __pyx_empty_tuple);
55016   if (PyDict_SetItem(__pyx_t_13, __pyx_n_s_double, __pyx_t_14) < 0) __PYX_ERR(1, 870, __pyx_L1_error)
55017   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
55018   __pyx_t_14 = __pyx_FusedFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_55get_morton_argsort1, 0, __pyx_n_s_get_morton_argsort1, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2, __pyx_d, ((PyObject *)__pyx_codeobj__97)); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 870, __pyx_L1_error)
55019   __Pyx_GOTREF(__pyx_t_14);
55020   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_14, __pyx_empty_tuple);
55021   ((__pyx_FusedFunctionObject *) __pyx_t_14)->__signatures__ = __pyx_t_13;
55022   __Pyx_GIVEREF(__pyx_t_13);
55023   if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_morton_argsort1, __pyx_t_14) < 0) __PYX_ERR(1, 870, __pyx_L1_error)
55024   __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
55025 
55026   /* "yt/utilities/lib/geometry_utils.pyx":887
55027  *     return
55028  *
55029  * def compare_morton(np.ndarray[floating, ndim=1] p0, np.ndarray[floating, ndim=1] q0):             # <<<<<<<<<<<<<<
55030  *     cdef np.float64_t p[3]
55031  *     cdef np.float64_t q[3]
55032  */
55033   __pyx_t_15 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 887, __pyx_L1_error)
55034   __Pyx_GOTREF(__pyx_t_15);
55035   __pyx_t_16 = __pyx_FusedFunction_NewEx(&__pyx_fuse_0__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_107compare_morton, 0, __pyx_n_s_compare_morton, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2, __pyx_d, ((PyObject *)__pyx_codeobj__99)); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 887, __pyx_L1_error)
55036   __Pyx_GOTREF(__pyx_t_16);
55037   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_16, __pyx_empty_tuple);
55038   if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_float, __pyx_t_16) < 0) __PYX_ERR(1, 887, __pyx_L1_error)
55039   __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
55040   __pyx_t_16 = __pyx_FusedFunction_NewEx(&__pyx_fuse_1__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_109compare_morton, 0, __pyx_n_s_compare_morton, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2, __pyx_d, ((PyObject *)__pyx_codeobj__99)); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 887, __pyx_L1_error)
55041   __Pyx_GOTREF(__pyx_t_16);
55042   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_16, __pyx_empty_tuple);
55043   if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_double, __pyx_t_16) < 0) __PYX_ERR(1, 887, __pyx_L1_error)
55044   __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
55045   __pyx_t_16 = __pyx_FusedFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_57compare_morton, 0, __pyx_n_s_compare_morton, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2, __pyx_d, ((PyObject *)__pyx_codeobj__99)); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 887, __pyx_L1_error)
55046   __Pyx_GOTREF(__pyx_t_16);
55047   __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_16, __pyx_empty_tuple);
55048   ((__pyx_FusedFunctionObject *) __pyx_t_16)->__signatures__ = __pyx_t_15;
55049   __Pyx_GIVEREF(__pyx_t_15);
55050   if (PyDict_SetItem(__pyx_d, __pyx_n_s_compare_morton, __pyx_t_16) < 0) __PYX_ERR(1, 887, __pyx_L1_error)
55051   __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
55052 
55053   /* "yt/utilities/lib/geometry_utils.pyx":938
55054  *     return pos_x.shape[0]
55055  *
55056  * def compute_morton(np.ndarray pos_x, np.ndarray pos_y, np.ndarray pos_z,             # <<<<<<<<<<<<<<
55057  *                    domain_left_edge, domain_right_edge, filter_bbox = False,
55058  *                    order = ORDER_MAX):
55059  */
55060   __pyx_t_17 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_59compute_morton, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 938, __pyx_L1_error)
55061   __Pyx_GOTREF(__pyx_t_17);
55062   if (PyDict_SetItem(__pyx_d, __pyx_n_s_compute_morton, __pyx_t_17) < 0) __PYX_ERR(1, 938, __pyx_L1_error)
55063   __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
55064 
55065   /* "yt/utilities/lib/geometry_utils.pyx":978
55066  * @cython.boundscheck(False)
55067  * @cython.wraparound(False)
55068  * def dist(np.ndarray[np.float64_t, ndim=1] p0, np.ndarray[np.float64_t, ndim=1] q0):             # <<<<<<<<<<<<<<
55069  *     cdef int j
55070  *     cdef np.float64_t p[3]
55071  */
55072   __pyx_t_17 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_61dist, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 978, __pyx_L1_error)
55073   __Pyx_GOTREF(__pyx_t_17);
55074   if (PyDict_SetItem(__pyx_d, __pyx_n_s_dist, __pyx_t_17) < 0) __PYX_ERR(1, 978, __pyx_L1_error)
55075   __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
55076 
55077   /* "yt/utilities/lib/geometry_utils.pyx":990
55078  * @cython.boundscheck(False)
55079  * @cython.wraparound(False)
55080  * def dist_to_box(np.ndarray[np.float64_t, ndim=1] p,             # <<<<<<<<<<<<<<
55081  *                 np.ndarray[np.float64_t, ndim=1] cbox,
55082  *                 np.float64_t rbox):
55083  */
55084   __pyx_t_17 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_63dist_to_box, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 990, __pyx_L1_error)
55085   __Pyx_GOTREF(__pyx_t_17);
55086   if (PyDict_SetItem(__pyx_d, __pyx_n_s_dist_to_box, __pyx_t_17) < 0) __PYX_ERR(1, 990, __pyx_L1_error)
55087   __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
55088 
55089   /* "yt/utilities/lib/geometry_utils.pyx":1003
55090  * @cython.boundscheck(False)
55091  * @cython.wraparound(False)
55092  * def solution_radius(np.ndarray[np.float64_t, ndim=2] P, int k, np.uint64_t i,             # <<<<<<<<<<<<<<
55093  *                     np.ndarray[np.uint64_t, ndim=1] idx, int order,
55094  *                     np.ndarray[np.float64_t, ndim=1] DLE,
55095  */
55096   __pyx_t_17 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_65solution_radius, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 1003, __pyx_L1_error)
55097   __Pyx_GOTREF(__pyx_t_17);
55098   if (PyDict_SetItem(__pyx_d, __pyx_n_s_solution_radius, __pyx_t_17) < 0) __PYX_ERR(1, 1003, __pyx_L1_error)
55099   __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
55100 
55101   /* "yt/utilities/lib/geometry_utils.pyx":1013
55102  * @cython.boundscheck(False)
55103  * @cython.wraparound(False)
55104  * def knn_direct(np.ndarray[np.float64_t, ndim=2] P, np.uint64_t k, np.uint64_t i,             # <<<<<<<<<<<<<<
55105  *                np.ndarray[np.uint64_t, ndim=1] idx, return_dist = False,
55106  *                return_rad = False):
55107  */
55108   __pyx_t_17 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_67knn_direct, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 1013, __pyx_L1_error)
55109   __Pyx_GOTREF(__pyx_t_17);
55110   if (PyDict_SetItem(__pyx_d, __pyx_n_s_knn_direct, __pyx_t_17) < 0) __PYX_ERR(1, 1013, __pyx_L1_error)
55111   __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
55112 
55113   /* "yt/utilities/lib/geometry_utils.pyx":1058
55114  * @cython.wraparound(False)
55115  * @cython.cdivision(True)
55116  * def quadtree_box(np.ndarray[np.float64_t, ndim=1] p,             # <<<<<<<<<<<<<<
55117  *                  np.ndarray[np.float64_t, ndim=1] q, int order,
55118  *                  np.ndarray[np.float64_t, ndim=1] DLE,
55119  */
55120   __pyx_t_17 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_69quadtree_box, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 1058, __pyx_L1_error)
55121   __Pyx_GOTREF(__pyx_t_17);
55122   if (PyDict_SetItem(__pyx_d, __pyx_n_s_quadtree_box, __pyx_t_17) < 0) __PYX_ERR(1, 1058, __pyx_L1_error)
55123   __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
55124 
55125   /* "yt/utilities/lib/geometry_utils.pyx":1088
55126  * @cython.wraparound(False)
55127  * @cython.cdivision(True)
55128  * def csearch_morton(np.ndarray[np.float64_t, ndim=2] P, int k, np.uint64_t i,             # <<<<<<<<<<<<<<
55129  *                    np.ndarray[np.uint64_t, ndim=1] Ai,
55130  *                    np.uint64_t l, np.uint64_t h, int order,
55131  */
55132   __pyx_t_17 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_71csearch_morton, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 1088, __pyx_L1_error)
55133   __Pyx_GOTREF(__pyx_t_17);
55134   if (PyDict_SetItem(__pyx_d, __pyx_n_s_csearch_morton, __pyx_t_17) < 0) __PYX_ERR(1, 1088, __pyx_L1_error)
55135   __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
55136 
55137   /* "yt/utilities/lib/geometry_utils.pyx":1159
55138  * def knn_morton(np.ndarray[np.float64_t, ndim=2] P0, int k, np.uint64_t i0,
55139  *                float c = 1.0, int nu = 4, issorted = False, int order = ORDER_MAX,
55140  *                np.ndarray[np.float64_t, ndim=1] DLE = np.zeros(3,dtype=np.float64),             # <<<<<<<<<<<<<<
55141  *                np.ndarray[np.float64_t, ndim=1] DRE = np.zeros(3,dtype=np.float64)):
55142  *     """Get the indicies of the k nearest neighbors to point i.
55143  */
55144   __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_n_s_np); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 1159, __pyx_L1_error)
55145   __Pyx_GOTREF(__pyx_t_17);
55146   __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_zeros); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 1159, __pyx_L1_error)
55147   __Pyx_GOTREF(__pyx_t_18);
55148   __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
55149   __pyx_t_17 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 1159, __pyx_L1_error)
55150   __Pyx_GOTREF(__pyx_t_17);
55151   __Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_n_s_np); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 1159, __pyx_L1_error)
55152   __Pyx_GOTREF(__pyx_t_19);
55153   __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_19, __pyx_n_s_float64); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 1159, __pyx_L1_error)
55154   __Pyx_GOTREF(__pyx_t_20);
55155   __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
55156   if (PyDict_SetItem(__pyx_t_17, __pyx_n_s_dtype, __pyx_t_20) < 0) __PYX_ERR(1, 1159, __pyx_L1_error)
55157   __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
55158   __pyx_t_20 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_tuple__9, __pyx_t_17); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 1159, __pyx_L1_error)
55159   __Pyx_GOTREF(__pyx_t_20);
55160   __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
55161   __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
55162   if (!(likely(((__pyx_t_20) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_20, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 1159, __pyx_L1_error)
55163   __pyx_k__11 = ((PyArrayObject *)__pyx_t_20);
55164   __Pyx_GIVEREF(__pyx_t_20);
55165   __pyx_t_20 = 0;
55166 
55167   /* "yt/utilities/lib/geometry_utils.pyx":1160
55168  *                float c = 1.0, int nu = 4, issorted = False, int order = ORDER_MAX,
55169  *                np.ndarray[np.float64_t, ndim=1] DLE = np.zeros(3,dtype=np.float64),
55170  *                np.ndarray[np.float64_t, ndim=1] DRE = np.zeros(3,dtype=np.float64)):             # <<<<<<<<<<<<<<
55171  *     """Get the indicies of the k nearest neighbors to point i.
55172  *
55173  */
55174   __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_n_s_np); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 1160, __pyx_L1_error)
55175   __Pyx_GOTREF(__pyx_t_20);
55176   __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_20, __pyx_n_s_zeros); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 1160, __pyx_L1_error)
55177   __Pyx_GOTREF(__pyx_t_17);
55178   __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
55179   __pyx_t_20 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 1160, __pyx_L1_error)
55180   __Pyx_GOTREF(__pyx_t_20);
55181   __Pyx_GetModuleGlobalName(__pyx_t_18, __pyx_n_s_np); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 1160, __pyx_L1_error)
55182   __Pyx_GOTREF(__pyx_t_18);
55183   __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s_float64); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 1160, __pyx_L1_error)
55184   __Pyx_GOTREF(__pyx_t_19);
55185   __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
55186   if (PyDict_SetItem(__pyx_t_20, __pyx_n_s_dtype, __pyx_t_19) < 0) __PYX_ERR(1, 1160, __pyx_L1_error)
55187   __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
55188   __pyx_t_19 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_tuple__9, __pyx_t_20); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 1160, __pyx_L1_error)
55189   __Pyx_GOTREF(__pyx_t_19);
55190   __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
55191   __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
55192   if (!(likely(((__pyx_t_19) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_19, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(1, 1160, __pyx_L1_error)
55193   __pyx_k__12 = ((PyArrayObject *)__pyx_t_19);
55194   __Pyx_GIVEREF(__pyx_t_19);
55195   __pyx_t_19 = 0;
55196 
55197   /* "yt/utilities/lib/geometry_utils.pyx":1157
55198  * @cython.wraparound(False)
55199  * @cython.cdivision(True)
55200  * def knn_morton(np.ndarray[np.float64_t, ndim=2] P0, int k, np.uint64_t i0,             # <<<<<<<<<<<<<<
55201  *                float c = 1.0, int nu = 4, issorted = False, int order = ORDER_MAX,
55202  *                np.ndarray[np.float64_t, ndim=1] DLE = np.zeros(3,dtype=np.float64),
55203  */
55204   __pyx_t_19 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_73knn_morton, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 1157, __pyx_L1_error)
55205   __Pyx_GOTREF(__pyx_t_19);
55206   if (PyDict_SetItem(__pyx_d, __pyx_n_s_knn_morton, __pyx_t_19) < 0) __PYX_ERR(1, 1157, __pyx_L1_error)
55207   __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
55208 
55209   /* "yt/utilities/lib/geometry_utils.pyx":1268
55210  *
55211  * @cython.cdivision(True)
55212  * def triangle_plane_intersect(int ax, np.float64_t coord,             # <<<<<<<<<<<<<<
55213  *                              np.ndarray[np.float64_t, ndim=3] triangles):
55214  *     cdef np.float64_t p0[3]
55215  */
55216   __pyx_t_19 = PyCFunction_NewEx(&__pyx_mdef_2yt_9utilities_3lib_14geometry_utils_75triangle_plane_intersect, NULL, __pyx_n_s_yt_utilities_lib_geometry_utils_2); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 1268, __pyx_L1_error)
55217   __Pyx_GOTREF(__pyx_t_19);
55218   if (PyDict_SetItem(__pyx_d, __pyx_n_s_triangle_plane_intersect, __pyx_t_19) < 0) __PYX_ERR(1, 1268, __pyx_L1_error)
55219   __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
55220 
55221   /* "yt/utilities/lib/geometry_utils.pyx":1
55222  * # distutils: libraries = STD_LIBS             # <<<<<<<<<<<<<<
55223  * # distutils: language = c++
55224  * # distutils: extra_compile_args = CPP14_FLAG OMP_ARGS
55225  */
55226   __pyx_t_19 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 1, __pyx_L1_error)
55227   __Pyx_GOTREF(__pyx_t_19);
55228   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_19) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
55229   __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
55230 
55231   /* "View.MemoryView":209
55232  *         info.obj = self
55233  *
55234  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
55235  *
55236  *     def __dealloc__(array self):
55237  */
55238   __pyx_t_19 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 209, __pyx_L1_error)
55239   __Pyx_GOTREF(__pyx_t_19);
55240   if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_19) < 0) __PYX_ERR(4, 209, __pyx_L1_error)
55241   __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
55242   PyType_Modified(__pyx_array_type);
55243 
55244   /* "View.MemoryView":286
55245  *         return self.name
55246  *
55247  * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
55248  * cdef strided = Enum("<strided and direct>") # default
55249  * cdef indirect = Enum("<strided and indirect>")
55250  */
55251   __pyx_t_19 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__118, NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 286, __pyx_L1_error)
55252   __Pyx_GOTREF(__pyx_t_19);
55253   __Pyx_XGOTREF(generic);
55254   __Pyx_DECREF_SET(generic, __pyx_t_19);
55255   __Pyx_GIVEREF(__pyx_t_19);
55256   __pyx_t_19 = 0;
55257 
55258   /* "View.MemoryView":287
55259  *
55260  * cdef generic = Enum("<strided and direct or indirect>")
55261  * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
55262  * cdef indirect = Enum("<strided and indirect>")
55263  *
55264  */
55265   __pyx_t_19 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__119, NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 287, __pyx_L1_error)
55266   __Pyx_GOTREF(__pyx_t_19);
55267   __Pyx_XGOTREF(strided);
55268   __Pyx_DECREF_SET(strided, __pyx_t_19);
55269   __Pyx_GIVEREF(__pyx_t_19);
55270   __pyx_t_19 = 0;
55271 
55272   /* "View.MemoryView":288
55273  * cdef generic = Enum("<strided and direct or indirect>")
55274  * cdef strided = Enum("<strided and direct>") # default
55275  * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
55276  *
55277  *
55278  */
55279   __pyx_t_19 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__120, NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 288, __pyx_L1_error)
55280   __Pyx_GOTREF(__pyx_t_19);
55281   __Pyx_XGOTREF(indirect);
55282   __Pyx_DECREF_SET(indirect, __pyx_t_19);
55283   __Pyx_GIVEREF(__pyx_t_19);
55284   __pyx_t_19 = 0;
55285 
55286   /* "View.MemoryView":291
55287  *
55288  *
55289  * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
55290  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
55291  *
55292  */
55293   __pyx_t_19 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__121, NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 291, __pyx_L1_error)
55294   __Pyx_GOTREF(__pyx_t_19);
55295   __Pyx_XGOTREF(contiguous);
55296   __Pyx_DECREF_SET(contiguous, __pyx_t_19);
55297   __Pyx_GIVEREF(__pyx_t_19);
55298   __pyx_t_19 = 0;
55299 
55300   /* "View.MemoryView":292
55301  *
55302  * cdef contiguous = Enum("<contiguous and direct>")
55303  * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
55304  *
55305  *
55306  */
55307   __pyx_t_19 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__122, NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 292, __pyx_L1_error)
55308   __Pyx_GOTREF(__pyx_t_19);
55309   __Pyx_XGOTREF(indirect_contiguous);
55310   __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_19);
55311   __Pyx_GIVEREF(__pyx_t_19);
55312   __pyx_t_19 = 0;
55313 
55314   /* "View.MemoryView":316
55315  *
55316  * DEF THREAD_LOCKS_PREALLOCATED = 8
55317  * cdef int __pyx_memoryview_thread_locks_used = 0             # <<<<<<<<<<<<<<
55318  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
55319  *     PyThread_allocate_lock(),
55320  */
55321   __pyx_memoryview_thread_locks_used = 0;
55322 
55323   /* "View.MemoryView":317
55324  * DEF THREAD_LOCKS_PREALLOCATED = 8
55325  * cdef int __pyx_memoryview_thread_locks_used = 0
55326  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [             # <<<<<<<<<<<<<<
55327  *     PyThread_allocate_lock(),
55328  *     PyThread_allocate_lock(),
55329  */
55330   __pyx_t_21[0] = PyThread_allocate_lock();
55331   __pyx_t_21[1] = PyThread_allocate_lock();
55332   __pyx_t_21[2] = PyThread_allocate_lock();
55333   __pyx_t_21[3] = PyThread_allocate_lock();
55334   __pyx_t_21[4] = PyThread_allocate_lock();
55335   __pyx_t_21[5] = PyThread_allocate_lock();
55336   __pyx_t_21[6] = PyThread_allocate_lock();
55337   __pyx_t_21[7] = PyThread_allocate_lock();
55338   memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_21, sizeof(__pyx_memoryview_thread_locks[0]) * (8));
55339 
55340   /* "View.MemoryView":545
55341  *         info.obj = self
55342  *
55343  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
55344  *
55345  *
55346  */
55347   __pyx_t_19 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 545, __pyx_L1_error)
55348   __Pyx_GOTREF(__pyx_t_19);
55349   if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_19) < 0) __PYX_ERR(4, 545, __pyx_L1_error)
55350   __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
55351   PyType_Modified(__pyx_memoryview_type);
55352 
55353   /* "View.MemoryView":991
55354  *         return self.from_object
55355  *
55356  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
55357  *
55358  *
55359  */
55360   __pyx_t_19 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 991, __pyx_L1_error)
55361   __Pyx_GOTREF(__pyx_t_19);
55362   if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_19) < 0) __PYX_ERR(4, 991, __pyx_L1_error)
55363   __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
55364   PyType_Modified(__pyx_memoryviewslice_type);
55365 
55366   /* "(tree fragment)":1
55367  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
55368  *     cdef object __pyx_PickleError
55369  *     cdef object __pyx_result
55370  */
55371   __pyx_t_19 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_19)) __PYX_ERR(4, 1, __pyx_L1_error)
55372   __Pyx_GOTREF(__pyx_t_19);
55373   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_19) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
55374   __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
55375 
55376   /* "BufferFormatFromTypeInfo":1460
55377  *
55378  * @cname('__pyx_format_from_typeinfo')
55379  * cdef bytes format_from_typeinfo(__Pyx_TypeInfo *type):             # <<<<<<<<<<<<<<
55380  *     cdef __Pyx_StructField *field
55381  *     cdef __pyx_typeinfo_string fmt
55382  */
55383 
55384   /*--- Wrapped vars code ---*/
55385 
55386   goto __pyx_L0;
55387   __pyx_L1_error:;
55388   __Pyx_XDECREF(__pyx_t_1);
55389   __Pyx_XDECREF(__pyx_t_2);
55390   __Pyx_XDECREF(__pyx_t_3);
55391   __Pyx_XDECREF(__pyx_t_4);
55392   __Pyx_XDECREF(__pyx_t_5);
55393   __Pyx_XDECREF(__pyx_t_6);
55394   __Pyx_XDECREF(__pyx_t_7);
55395   __Pyx_XDECREF(__pyx_t_8);
55396   __Pyx_XDECREF(__pyx_t_9);
55397   __Pyx_XDECREF(__pyx_t_10);
55398   __Pyx_XDECREF(__pyx_t_11);
55399   __Pyx_XDECREF(__pyx_t_12);
55400   __Pyx_XDECREF(__pyx_t_13);
55401   __Pyx_XDECREF(__pyx_t_14);
55402   __Pyx_XDECREF(__pyx_t_15);
55403   __Pyx_XDECREF(__pyx_t_16);
55404   __Pyx_XDECREF(__pyx_t_17);
55405   __Pyx_XDECREF(__pyx_t_18);
55406   __Pyx_XDECREF(__pyx_t_19);
55407   __Pyx_XDECREF(__pyx_t_20);
55408   if (__pyx_m) {
55409     if (__pyx_d) {
55410       __Pyx_AddTraceback("init yt.utilities.lib.geometry_utils", __pyx_clineno, __pyx_lineno, __pyx_filename);
55411     }
55412     Py_CLEAR(__pyx_m);
55413   } else if (!PyErr_Occurred()) {
55414     PyErr_SetString(PyExc_ImportError, "init yt.utilities.lib.geometry_utils");
55415   }
55416   __pyx_L0:;
55417   __Pyx_RefNannyFinishContext();
55418   #if CYTHON_PEP489_MULTI_PHASE_INIT
55419   return (__pyx_m != NULL) ? 0 : -1;
55420   #elif PY_MAJOR_VERSION >= 3
55421   return __pyx_m;
55422   #else
55423   return;
55424   #endif
55425 }
55426 
55427 /* --- Runtime support code --- */
55428 /* Refnanny */
55429 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)55430 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
55431     PyObject *m = NULL, *p = NULL;
55432     void *r = NULL;
55433     m = PyImport_ImportModule(modname);
55434     if (!m) goto end;
55435     p = PyObject_GetAttrString(m, "RefNannyAPI");
55436     if (!p) goto end;
55437     r = PyLong_AsVoidPtr(p);
55438 end:
55439     Py_XDECREF(p);
55440     Py_XDECREF(m);
55441     return (__Pyx_RefNannyAPIStruct *)r;
55442 }
55443 #endif
55444 
55445 /* PyObjectGetAttrStr */
55446 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)55447 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
55448     PyTypeObject* tp = Py_TYPE(obj);
55449     if (likely(tp->tp_getattro))
55450         return tp->tp_getattro(obj, attr_name);
55451 #if PY_MAJOR_VERSION < 3
55452     if (likely(tp->tp_getattr))
55453         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
55454 #endif
55455     return PyObject_GetAttr(obj, attr_name);
55456 }
55457 #endif
55458 
55459 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)55460 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
55461     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
55462     if (unlikely(!result)) {
55463         PyErr_Format(PyExc_NameError,
55464 #if PY_MAJOR_VERSION >= 3
55465             "name '%U' is not defined", name);
55466 #else
55467             "name '%.200s' is not defined", PyString_AS_STRING(name));
55468 #endif
55469     }
55470     return result;
55471 }
55472 
55473 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)55474 static void __Pyx_RaiseDoubleKeywordsError(
55475     const char* func_name,
55476     PyObject* kw_name)
55477 {
55478     PyErr_Format(PyExc_TypeError,
55479         #if PY_MAJOR_VERSION >= 3
55480         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
55481         #else
55482         "%s() got multiple values for keyword argument '%s'", func_name,
55483         PyString_AsString(kw_name));
55484         #endif
55485 }
55486 
55487 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)55488 static int __Pyx_ParseOptionalKeywords(
55489     PyObject *kwds,
55490     PyObject **argnames[],
55491     PyObject *kwds2,
55492     PyObject *values[],
55493     Py_ssize_t num_pos_args,
55494     const char* function_name)
55495 {
55496     PyObject *key = 0, *value = 0;
55497     Py_ssize_t pos = 0;
55498     PyObject*** name;
55499     PyObject*** first_kw_arg = argnames + num_pos_args;
55500     while (PyDict_Next(kwds, &pos, &key, &value)) {
55501         name = first_kw_arg;
55502         while (*name && (**name != key)) name++;
55503         if (*name) {
55504             values[name-argnames] = value;
55505             continue;
55506         }
55507         name = first_kw_arg;
55508         #if PY_MAJOR_VERSION < 3
55509         if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
55510             while (*name) {
55511                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
55512                         && _PyString_Eq(**name, key)) {
55513                     values[name-argnames] = value;
55514                     break;
55515                 }
55516                 name++;
55517             }
55518             if (*name) continue;
55519             else {
55520                 PyObject*** argname = argnames;
55521                 while (argname != first_kw_arg) {
55522                     if ((**argname == key) || (
55523                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
55524                              && _PyString_Eq(**argname, key))) {
55525                         goto arg_passed_twice;
55526                     }
55527                     argname++;
55528                 }
55529             }
55530         } else
55531         #endif
55532         if (likely(PyUnicode_Check(key))) {
55533             while (*name) {
55534                 int cmp = (**name == key) ? 0 :
55535                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
55536                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
55537                 #endif
55538                     PyUnicode_Compare(**name, key);
55539                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
55540                 if (cmp == 0) {
55541                     values[name-argnames] = value;
55542                     break;
55543                 }
55544                 name++;
55545             }
55546             if (*name) continue;
55547             else {
55548                 PyObject*** argname = argnames;
55549                 while (argname != first_kw_arg) {
55550                     int cmp = (**argname == key) ? 0 :
55551                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
55552                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
55553                     #endif
55554                         PyUnicode_Compare(**argname, key);
55555                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
55556                     if (cmp == 0) goto arg_passed_twice;
55557                     argname++;
55558                 }
55559             }
55560         } else
55561             goto invalid_keyword_type;
55562         if (kwds2) {
55563             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
55564         } else {
55565             goto invalid_keyword;
55566         }
55567     }
55568     return 0;
55569 arg_passed_twice:
55570     __Pyx_RaiseDoubleKeywordsError(function_name, key);
55571     goto bad;
55572 invalid_keyword_type:
55573     PyErr_Format(PyExc_TypeError,
55574         "%.200s() keywords must be strings", function_name);
55575     goto bad;
55576 invalid_keyword:
55577     PyErr_Format(PyExc_TypeError,
55578     #if PY_MAJOR_VERSION < 3
55579         "%.200s() got an unexpected keyword argument '%.200s'",
55580         function_name, PyString_AsString(key));
55581     #else
55582         "%s() got an unexpected keyword argument '%U'",
55583         function_name, key);
55584     #endif
55585 bad:
55586     return -1;
55587 }
55588 
55589 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)55590 static void __Pyx_RaiseArgtupleInvalid(
55591     const char* func_name,
55592     int exact,
55593     Py_ssize_t num_min,
55594     Py_ssize_t num_max,
55595     Py_ssize_t num_found)
55596 {
55597     Py_ssize_t num_expected;
55598     const char *more_or_less;
55599     if (num_found < num_min) {
55600         num_expected = num_min;
55601         more_or_less = "at least";
55602     } else {
55603         num_expected = num_max;
55604         more_or_less = "at most";
55605     }
55606     if (exact) {
55607         more_or_less = "exactly";
55608     }
55609     PyErr_Format(PyExc_TypeError,
55610                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
55611                  func_name, more_or_less, num_expected,
55612                  (num_expected == 1) ? "" : "s", num_found);
55613 }
55614 
55615 /* PyDictVersioning */
55616 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)55617 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
55618     PyObject *dict = Py_TYPE(obj)->tp_dict;
55619     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
55620 }
__Pyx_get_object_dict_version(PyObject * obj)55621 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
55622     PyObject **dictptr = NULL;
55623     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
55624     if (offset) {
55625 #if CYTHON_COMPILING_IN_CPYTHON
55626         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
55627 #else
55628         dictptr = _PyObject_GetDictPtr(obj);
55629 #endif
55630     }
55631     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
55632 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)55633 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
55634     PyObject *dict = Py_TYPE(obj)->tp_dict;
55635     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
55636         return 0;
55637     return obj_dict_version == __Pyx_get_object_dict_version(obj);
55638 }
55639 #endif
55640 
55641 /* GetModuleGlobalName */
55642 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)55643 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
55644 #else
55645 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
55646 #endif
55647 {
55648     PyObject *result;
55649 #if !CYTHON_AVOID_BORROWED_REFS
55650 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
55651     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
55652     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
55653     if (likely(result)) {
55654         return __Pyx_NewRef(result);
55655     } else if (unlikely(PyErr_Occurred())) {
55656         return NULL;
55657     }
55658 #else
55659     result = PyDict_GetItem(__pyx_d, name);
55660     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
55661     if (likely(result)) {
55662         return __Pyx_NewRef(result);
55663     }
55664 #endif
55665 #else
55666     result = PyObject_GetItem(__pyx_d, name);
55667     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
55668     if (likely(result)) {
55669         return __Pyx_NewRef(result);
55670     }
55671     PyErr_Clear();
55672 #endif
55673     return __Pyx_GetBuiltinName(name);
55674 }
55675 
55676 /* PyCFunctionFastCall */
55677 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)55678 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
55679     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
55680     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
55681     PyObject *self = PyCFunction_GET_SELF(func);
55682     int flags = PyCFunction_GET_FLAGS(func);
55683     assert(PyCFunction_Check(func));
55684     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
55685     assert(nargs >= 0);
55686     assert(nargs == 0 || args != NULL);
55687     /* _PyCFunction_FastCallDict() must not be called with an exception set,
55688        because it may clear it (directly or indirectly) and so the
55689        caller loses its exception */
55690     assert(!PyErr_Occurred());
55691     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
55692         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
55693     } else {
55694         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
55695     }
55696 }
55697 #endif
55698 
55699 /* PyFunctionFastCall */
55700 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)55701 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
55702                                                PyObject *globals) {
55703     PyFrameObject *f;
55704     PyThreadState *tstate = __Pyx_PyThreadState_Current;
55705     PyObject **fastlocals;
55706     Py_ssize_t i;
55707     PyObject *result;
55708     assert(globals != NULL);
55709     /* XXX Perhaps we should create a specialized
55710        PyFrame_New() that doesn't take locals, but does
55711        take builtins without sanity checking them.
55712        */
55713     assert(tstate != NULL);
55714     f = PyFrame_New(tstate, co, globals, NULL);
55715     if (f == NULL) {
55716         return NULL;
55717     }
55718     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
55719     for (i = 0; i < na; i++) {
55720         Py_INCREF(*args);
55721         fastlocals[i] = *args++;
55722     }
55723     result = PyEval_EvalFrameEx(f,0);
55724     ++tstate->recursion_depth;
55725     Py_DECREF(f);
55726     --tstate->recursion_depth;
55727     return result;
55728 }
55729 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)55730 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
55731     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
55732     PyObject *globals = PyFunction_GET_GLOBALS(func);
55733     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
55734     PyObject *closure;
55735 #if PY_MAJOR_VERSION >= 3
55736     PyObject *kwdefs;
55737 #endif
55738     PyObject *kwtuple, **k;
55739     PyObject **d;
55740     Py_ssize_t nd;
55741     Py_ssize_t nk;
55742     PyObject *result;
55743     assert(kwargs == NULL || PyDict_Check(kwargs));
55744     nk = kwargs ? PyDict_Size(kwargs) : 0;
55745     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
55746         return NULL;
55747     }
55748     if (
55749 #if PY_MAJOR_VERSION >= 3
55750             co->co_kwonlyargcount == 0 &&
55751 #endif
55752             likely(kwargs == NULL || nk == 0) &&
55753             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
55754         if (argdefs == NULL && co->co_argcount == nargs) {
55755             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
55756             goto done;
55757         }
55758         else if (nargs == 0 && argdefs != NULL
55759                  && co->co_argcount == Py_SIZE(argdefs)) {
55760             /* function called with no arguments, but all parameters have
55761                a default value: use default values as arguments .*/
55762             args = &PyTuple_GET_ITEM(argdefs, 0);
55763             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
55764             goto done;
55765         }
55766     }
55767     if (kwargs != NULL) {
55768         Py_ssize_t pos, i;
55769         kwtuple = PyTuple_New(2 * nk);
55770         if (kwtuple == NULL) {
55771             result = NULL;
55772             goto done;
55773         }
55774         k = &PyTuple_GET_ITEM(kwtuple, 0);
55775         pos = i = 0;
55776         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
55777             Py_INCREF(k[i]);
55778             Py_INCREF(k[i+1]);
55779             i += 2;
55780         }
55781         nk = i / 2;
55782     }
55783     else {
55784         kwtuple = NULL;
55785         k = NULL;
55786     }
55787     closure = PyFunction_GET_CLOSURE(func);
55788 #if PY_MAJOR_VERSION >= 3
55789     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
55790 #endif
55791     if (argdefs != NULL) {
55792         d = &PyTuple_GET_ITEM(argdefs, 0);
55793         nd = Py_SIZE(argdefs);
55794     }
55795     else {
55796         d = NULL;
55797         nd = 0;
55798     }
55799 #if PY_MAJOR_VERSION >= 3
55800     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
55801                                args, (int)nargs,
55802                                k, (int)nk,
55803                                d, (int)nd, kwdefs, closure);
55804 #else
55805     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
55806                                args, (int)nargs,
55807                                k, (int)nk,
55808                                d, (int)nd, closure);
55809 #endif
55810     Py_XDECREF(kwtuple);
55811 done:
55812     Py_LeaveRecursiveCall();
55813     return result;
55814 }
55815 #endif
55816 #endif
55817 
55818 /* PyObjectCall */
55819 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)55820 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
55821     PyObject *result;
55822     ternaryfunc call = func->ob_type->tp_call;
55823     if (unlikely(!call))
55824         return PyObject_Call(func, arg, kw);
55825     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
55826         return NULL;
55827     result = (*call)(func, arg, kw);
55828     Py_LeaveRecursiveCall();
55829     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
55830         PyErr_SetString(
55831             PyExc_SystemError,
55832             "NULL result without error in PyObject_Call");
55833     }
55834     return result;
55835 }
55836 #endif
55837 
55838 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)55839 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
55840     PyObject *args, *result = NULL;
55841     #if CYTHON_FAST_PYCALL
55842     if (PyFunction_Check(function)) {
55843         PyObject *args[2] = {arg1, arg2};
55844         return __Pyx_PyFunction_FastCall(function, args, 2);
55845     }
55846     #endif
55847     #if CYTHON_FAST_PYCCALL
55848     if (__Pyx_PyFastCFunction_Check(function)) {
55849         PyObject *args[2] = {arg1, arg2};
55850         return __Pyx_PyCFunction_FastCall(function, args, 2);
55851     }
55852     #endif
55853     args = PyTuple_New(2);
55854     if (unlikely(!args)) goto done;
55855     Py_INCREF(arg1);
55856     PyTuple_SET_ITEM(args, 0, arg1);
55857     Py_INCREF(arg2);
55858     PyTuple_SET_ITEM(args, 1, arg2);
55859     Py_INCREF(function);
55860     result = __Pyx_PyObject_Call(function, args, NULL);
55861     Py_DECREF(args);
55862     Py_DECREF(function);
55863 done:
55864     return result;
55865 }
55866 
55867 /* PyObjectCallMethO */
55868 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)55869 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
55870     PyObject *self, *result;
55871     PyCFunction cfunc;
55872     cfunc = PyCFunction_GET_FUNCTION(func);
55873     self = PyCFunction_GET_SELF(func);
55874     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
55875         return NULL;
55876     result = cfunc(self, arg);
55877     Py_LeaveRecursiveCall();
55878     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
55879         PyErr_SetString(
55880             PyExc_SystemError,
55881             "NULL result without error in PyObject_Call");
55882     }
55883     return result;
55884 }
55885 #endif
55886 
55887 /* PyObjectCallOneArg */
55888 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)55889 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
55890     PyObject *result;
55891     PyObject *args = PyTuple_New(1);
55892     if (unlikely(!args)) return NULL;
55893     Py_INCREF(arg);
55894     PyTuple_SET_ITEM(args, 0, arg);
55895     result = __Pyx_PyObject_Call(func, args, NULL);
55896     Py_DECREF(args);
55897     return result;
55898 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)55899 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
55900 #if CYTHON_FAST_PYCALL
55901     if (PyFunction_Check(func)) {
55902         return __Pyx_PyFunction_FastCall(func, &arg, 1);
55903     }
55904 #endif
55905     if (likely(PyCFunction_Check(func))) {
55906         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
55907             return __Pyx_PyObject_CallMethO(func, arg);
55908 #if CYTHON_FAST_PYCCALL
55909         } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
55910             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
55911 #endif
55912         }
55913     }
55914     return __Pyx__PyObject_CallOneArg(func, arg);
55915 }
55916 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)55917 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
55918     PyObject *result;
55919     PyObject *args = PyTuple_Pack(1, arg);
55920     if (unlikely(!args)) return NULL;
55921     result = __Pyx_PyObject_Call(func, args, NULL);
55922     Py_DECREF(args);
55923     return result;
55924 }
55925 #endif
55926 
55927 /* SetItemInt */
__Pyx_SetItemInt_Generic(PyObject * o,PyObject * j,PyObject * v)55928 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
55929     int r;
55930     if (!j) return -1;
55931     r = PyObject_SetItem(o, j, v);
55932     Py_DECREF(j);
55933     return r;
55934 }
__Pyx_SetItemInt_Fast(PyObject * o,Py_ssize_t i,PyObject * v,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)55935 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
55936                                                CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
55937 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
55938     if (is_list || PyList_CheckExact(o)) {
55939         Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
55940         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
55941             PyObject* old = PyList_GET_ITEM(o, n);
55942             Py_INCREF(v);
55943             PyList_SET_ITEM(o, n, v);
55944             Py_DECREF(old);
55945             return 1;
55946         }
55947     } else {
55948         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
55949         if (likely(m && m->sq_ass_item)) {
55950             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
55951                 Py_ssize_t l = m->sq_length(o);
55952                 if (likely(l >= 0)) {
55953                     i += l;
55954                 } else {
55955                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
55956                         return -1;
55957                     PyErr_Clear();
55958                 }
55959             }
55960             return m->sq_ass_item(o, i, v);
55961         }
55962     }
55963 #else
55964 #if CYTHON_COMPILING_IN_PYPY
55965     if (is_list || (PySequence_Check(o) && !PyDict_Check(o)))
55966 #else
55967     if (is_list || PySequence_Check(o))
55968 #endif
55969     {
55970         return PySequence_SetItem(o, i, v);
55971     }
55972 #endif
55973     return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
55974 }
55975 
55976 /* StringJoin */
55977 #if !CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyBytes_Join(PyObject * sep,PyObject * values)55978 static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
55979     return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
55980 }
55981 #endif
55982 
55983 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)55984 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
55985     PyObject *r;
55986     if (!j) return NULL;
55987     r = PyObject_GetItem(o, j);
55988     Py_DECREF(j);
55989     return r;
55990 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)55991 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
55992                                                               CYTHON_NCP_UNUSED int wraparound,
55993                                                               CYTHON_NCP_UNUSED int boundscheck) {
55994 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
55995     Py_ssize_t wrapped_i = i;
55996     if (wraparound & unlikely(i < 0)) {
55997         wrapped_i += PyList_GET_SIZE(o);
55998     }
55999     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
56000         PyObject *r = PyList_GET_ITEM(o, wrapped_i);
56001         Py_INCREF(r);
56002         return r;
56003     }
56004     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
56005 #else
56006     return PySequence_GetItem(o, i);
56007 #endif
56008 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)56009 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
56010                                                               CYTHON_NCP_UNUSED int wraparound,
56011                                                               CYTHON_NCP_UNUSED int boundscheck) {
56012 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
56013     Py_ssize_t wrapped_i = i;
56014     if (wraparound & unlikely(i < 0)) {
56015         wrapped_i += PyTuple_GET_SIZE(o);
56016     }
56017     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
56018         PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
56019         Py_INCREF(r);
56020         return r;
56021     }
56022     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
56023 #else
56024     return PySequence_GetItem(o, i);
56025 #endif
56026 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)56027 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
56028                                                      CYTHON_NCP_UNUSED int wraparound,
56029                                                      CYTHON_NCP_UNUSED int boundscheck) {
56030 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
56031     if (is_list || PyList_CheckExact(o)) {
56032         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
56033         if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
56034             PyObject *r = PyList_GET_ITEM(o, n);
56035             Py_INCREF(r);
56036             return r;
56037         }
56038     }
56039     else if (PyTuple_CheckExact(o)) {
56040         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
56041         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
56042             PyObject *r = PyTuple_GET_ITEM(o, n);
56043             Py_INCREF(r);
56044             return r;
56045         }
56046     } else {
56047         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
56048         if (likely(m && m->sq_item)) {
56049             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
56050                 Py_ssize_t l = m->sq_length(o);
56051                 if (likely(l >= 0)) {
56052                     i += l;
56053                 } else {
56054                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
56055                         return NULL;
56056                     PyErr_Clear();
56057                 }
56058             }
56059             return m->sq_item(o, i);
56060         }
56061     }
56062 #else
56063     if (is_list || PySequence_Check(o)) {
56064         return PySequence_GetItem(o, i);
56065     }
56066 #endif
56067     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
56068 }
56069 
56070 /* ObjectGetItem */
56071 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetIndex(PyObject * obj,PyObject * index)56072 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
56073     PyObject *runerr;
56074     Py_ssize_t key_value;
56075     PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
56076     if (unlikely(!(m && m->sq_item))) {
56077         PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
56078         return NULL;
56079     }
56080     key_value = __Pyx_PyIndex_AsSsize_t(index);
56081     if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
56082         return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
56083     }
56084     if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
56085         PyErr_Clear();
56086         PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
56087     }
56088     return NULL;
56089 }
__Pyx_PyObject_GetItem(PyObject * obj,PyObject * key)56090 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
56091     PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
56092     if (likely(m && m->mp_subscript)) {
56093         return m->mp_subscript(obj, key);
56094     }
56095     return __Pyx_PyObject_GetIndex(obj, key);
56096 }
56097 #endif
56098 
56099 /* ArgTypeTest */
__Pyx__ArgTypeTest(PyObject * obj,PyTypeObject * type,const char * name,int exact)56100 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
56101 {
56102     if (unlikely(!type)) {
56103         PyErr_SetString(PyExc_SystemError, "Missing type object");
56104         return 0;
56105     }
56106     else if (exact) {
56107         #if PY_MAJOR_VERSION == 2
56108         if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
56109         #endif
56110     }
56111     else {
56112         if (likely(__Pyx_TypeCheck(obj, type))) return 1;
56113     }
56114     PyErr_Format(PyExc_TypeError,
56115         "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
56116         name, type->tp_name, Py_TYPE(obj)->tp_name);
56117     return 0;
56118 }
56119 
56120 /* IsLittleEndian */
__Pyx_Is_Little_Endian(void)56121 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
56122 {
56123   union {
56124     uint32_t u32;
56125     uint8_t u8[4];
56126   } S;
56127   S.u32 = 0x01020304;
56128   return S.u8[0] == 4;
56129 }
56130 
56131 /* BufferFormatCheck */
__Pyx_BufFmt_Init(__Pyx_BufFmt_Context * ctx,__Pyx_BufFmt_StackElem * stack,__Pyx_TypeInfo * type)56132 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
56133                               __Pyx_BufFmt_StackElem* stack,
56134                               __Pyx_TypeInfo* type) {
56135   stack[0].field = &ctx->root;
56136   stack[0].parent_offset = 0;
56137   ctx->root.type = type;
56138   ctx->root.name = "buffer dtype";
56139   ctx->root.offset = 0;
56140   ctx->head = stack;
56141   ctx->head->field = &ctx->root;
56142   ctx->fmt_offset = 0;
56143   ctx->head->parent_offset = 0;
56144   ctx->new_packmode = '@';
56145   ctx->enc_packmode = '@';
56146   ctx->new_count = 1;
56147   ctx->enc_count = 0;
56148   ctx->enc_type = 0;
56149   ctx->is_complex = 0;
56150   ctx->is_valid_array = 0;
56151   ctx->struct_alignment = 0;
56152   while (type->typegroup == 'S') {
56153     ++ctx->head;
56154     ctx->head->field = type->fields;
56155     ctx->head->parent_offset = 0;
56156     type = type->fields->type;
56157   }
56158 }
__Pyx_BufFmt_ParseNumber(const char ** ts)56159 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
56160     int count;
56161     const char* t = *ts;
56162     if (*t < '0' || *t > '9') {
56163       return -1;
56164     } else {
56165         count = *t++ - '0';
56166         while (*t >= '0' && *t <= '9') {
56167             count *= 10;
56168             count += *t++ - '0';
56169         }
56170     }
56171     *ts = t;
56172     return count;
56173 }
__Pyx_BufFmt_ExpectNumber(const char ** ts)56174 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
56175     int number = __Pyx_BufFmt_ParseNumber(ts);
56176     if (number == -1)
56177         PyErr_Format(PyExc_ValueError,\
56178                      "Does not understand character buffer dtype format string ('%c')", **ts);
56179     return number;
56180 }
__Pyx_BufFmt_RaiseUnexpectedChar(char ch)56181 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
56182   PyErr_Format(PyExc_ValueError,
56183                "Unexpected format string character: '%c'", ch);
56184 }
__Pyx_BufFmt_DescribeTypeChar(char ch,int is_complex)56185 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
56186   switch (ch) {
56187     case 'c': return "'char'";
56188     case 'b': return "'signed char'";
56189     case 'B': return "'unsigned char'";
56190     case 'h': return "'short'";
56191     case 'H': return "'unsigned short'";
56192     case 'i': return "'int'";
56193     case 'I': return "'unsigned int'";
56194     case 'l': return "'long'";
56195     case 'L': return "'unsigned long'";
56196     case 'q': return "'long long'";
56197     case 'Q': return "'unsigned long long'";
56198     case 'f': return (is_complex ? "'complex float'" : "'float'");
56199     case 'd': return (is_complex ? "'complex double'" : "'double'");
56200     case 'g': return (is_complex ? "'complex long double'" : "'long double'");
56201     case 'T': return "a struct";
56202     case 'O': return "Python object";
56203     case 'P': return "a pointer";
56204     case 's': case 'p': return "a string";
56205     case 0: return "end";
56206     default: return "unparseable format string";
56207   }
56208 }
__Pyx_BufFmt_TypeCharToStandardSize(char ch,int is_complex)56209 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
56210   switch (ch) {
56211     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
56212     case 'h': case 'H': return 2;
56213     case 'i': case 'I': case 'l': case 'L': return 4;
56214     case 'q': case 'Q': return 8;
56215     case 'f': return (is_complex ? 8 : 4);
56216     case 'd': return (is_complex ? 16 : 8);
56217     case 'g': {
56218       PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
56219       return 0;
56220     }
56221     case 'O': case 'P': return sizeof(void*);
56222     default:
56223       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
56224       return 0;
56225     }
56226 }
__Pyx_BufFmt_TypeCharToNativeSize(char ch,int is_complex)56227 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
56228   switch (ch) {
56229     case 'c': case 'b': case 'B': case 's': case 'p': return 1;
56230     case 'h': case 'H': return sizeof(short);
56231     case 'i': case 'I': return sizeof(int);
56232     case 'l': case 'L': return sizeof(long);
56233     #ifdef HAVE_LONG_LONG
56234     case 'q': case 'Q': return sizeof(PY_LONG_LONG);
56235     #endif
56236     case 'f': return sizeof(float) * (is_complex ? 2 : 1);
56237     case 'd': return sizeof(double) * (is_complex ? 2 : 1);
56238     case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
56239     case 'O': case 'P': return sizeof(void*);
56240     default: {
56241       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
56242       return 0;
56243     }
56244   }
56245 }
56246 typedef struct { char c; short x; } __Pyx_st_short;
56247 typedef struct { char c; int x; } __Pyx_st_int;
56248 typedef struct { char c; long x; } __Pyx_st_long;
56249 typedef struct { char c; float x; } __Pyx_st_float;
56250 typedef struct { char c; double x; } __Pyx_st_double;
56251 typedef struct { char c; long double x; } __Pyx_st_longdouble;
56252 typedef struct { char c; void *x; } __Pyx_st_void_p;
56253 #ifdef HAVE_LONG_LONG
56254 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
56255 #endif
__Pyx_BufFmt_TypeCharToAlignment(char ch,CYTHON_UNUSED int is_complex)56256 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
56257   switch (ch) {
56258     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
56259     case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
56260     case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
56261     case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
56262 #ifdef HAVE_LONG_LONG
56263     case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
56264 #endif
56265     case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
56266     case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
56267     case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
56268     case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
56269     default:
56270       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
56271       return 0;
56272     }
56273 }
56274 /* These are for computing the padding at the end of the struct to align
56275    on the first member of the struct. This will probably the same as above,
56276    but we don't have any guarantees.
56277  */
56278 typedef struct { short x; char c; } __Pyx_pad_short;
56279 typedef struct { int x; char c; } __Pyx_pad_int;
56280 typedef struct { long x; char c; } __Pyx_pad_long;
56281 typedef struct { float x; char c; } __Pyx_pad_float;
56282 typedef struct { double x; char c; } __Pyx_pad_double;
56283 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
56284 typedef struct { void *x; char c; } __Pyx_pad_void_p;
56285 #ifdef HAVE_LONG_LONG
56286 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
56287 #endif
__Pyx_BufFmt_TypeCharToPadding(char ch,CYTHON_UNUSED int is_complex)56288 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
56289   switch (ch) {
56290     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
56291     case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
56292     case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
56293     case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
56294 #ifdef HAVE_LONG_LONG
56295     case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
56296 #endif
56297     case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
56298     case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
56299     case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
56300     case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
56301     default:
56302       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
56303       return 0;
56304     }
56305 }
__Pyx_BufFmt_TypeCharToGroup(char ch,int is_complex)56306 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
56307   switch (ch) {
56308     case 'c':
56309         return 'H';
56310     case 'b': case 'h': case 'i':
56311     case 'l': case 'q': case 's': case 'p':
56312         return 'I';
56313     case 'B': case 'H': case 'I': case 'L': case 'Q':
56314         return 'U';
56315     case 'f': case 'd': case 'g':
56316         return (is_complex ? 'C' : 'R');
56317     case 'O':
56318         return 'O';
56319     case 'P':
56320         return 'P';
56321     default: {
56322       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
56323       return 0;
56324     }
56325   }
56326 }
__Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context * ctx)56327 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
56328   if (ctx->head == NULL || ctx->head->field == &ctx->root) {
56329     const char* expected;
56330     const char* quote;
56331     if (ctx->head == NULL) {
56332       expected = "end";
56333       quote = "";
56334     } else {
56335       expected = ctx->head->field->type->name;
56336       quote = "'";
56337     }
56338     PyErr_Format(PyExc_ValueError,
56339                  "Buffer dtype mismatch, expected %s%s%s but got %s",
56340                  quote, expected, quote,
56341                  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
56342   } else {
56343     __Pyx_StructField* field = ctx->head->field;
56344     __Pyx_StructField* parent = (ctx->head - 1)->field;
56345     PyErr_Format(PyExc_ValueError,
56346                  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
56347                  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
56348                  parent->type->name, field->name);
56349   }
56350 }
__Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context * ctx)56351 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
56352   char group;
56353   size_t size, offset, arraysize = 1;
56354   if (ctx->enc_type == 0) return 0;
56355   if (ctx->head->field->type->arraysize[0]) {
56356     int i, ndim = 0;
56357     if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
56358         ctx->is_valid_array = ctx->head->field->type->ndim == 1;
56359         ndim = 1;
56360         if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
56361             PyErr_Format(PyExc_ValueError,
56362                          "Expected a dimension of size %zu, got %zu",
56363                          ctx->head->field->type->arraysize[0], ctx->enc_count);
56364             return -1;
56365         }
56366     }
56367     if (!ctx->is_valid_array) {
56368       PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
56369                    ctx->head->field->type->ndim, ndim);
56370       return -1;
56371     }
56372     for (i = 0; i < ctx->head->field->type->ndim; i++) {
56373       arraysize *= ctx->head->field->type->arraysize[i];
56374     }
56375     ctx->is_valid_array = 0;
56376     ctx->enc_count = 1;
56377   }
56378   group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
56379   do {
56380     __Pyx_StructField* field = ctx->head->field;
56381     __Pyx_TypeInfo* type = field->type;
56382     if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
56383       size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
56384     } else {
56385       size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
56386     }
56387     if (ctx->enc_packmode == '@') {
56388       size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
56389       size_t align_mod_offset;
56390       if (align_at == 0) return -1;
56391       align_mod_offset = ctx->fmt_offset % align_at;
56392       if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
56393       if (ctx->struct_alignment == 0)
56394           ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
56395                                                                  ctx->is_complex);
56396     }
56397     if (type->size != size || type->typegroup != group) {
56398       if (type->typegroup == 'C' && type->fields != NULL) {
56399         size_t parent_offset = ctx->head->parent_offset + field->offset;
56400         ++ctx->head;
56401         ctx->head->field = type->fields;
56402         ctx->head->parent_offset = parent_offset;
56403         continue;
56404       }
56405       if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
56406       } else {
56407           __Pyx_BufFmt_RaiseExpected(ctx);
56408           return -1;
56409       }
56410     }
56411     offset = ctx->head->parent_offset + field->offset;
56412     if (ctx->fmt_offset != offset) {
56413       PyErr_Format(PyExc_ValueError,
56414                    "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
56415                    (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
56416       return -1;
56417     }
56418     ctx->fmt_offset += size;
56419     if (arraysize)
56420       ctx->fmt_offset += (arraysize - 1) * size;
56421     --ctx->enc_count;
56422     while (1) {
56423       if (field == &ctx->root) {
56424         ctx->head = NULL;
56425         if (ctx->enc_count != 0) {
56426           __Pyx_BufFmt_RaiseExpected(ctx);
56427           return -1;
56428         }
56429         break;
56430       }
56431       ctx->head->field = ++field;
56432       if (field->type == NULL) {
56433         --ctx->head;
56434         field = ctx->head->field;
56435         continue;
56436       } else if (field->type->typegroup == 'S') {
56437         size_t parent_offset = ctx->head->parent_offset + field->offset;
56438         if (field->type->fields->type == NULL) continue;
56439         field = field->type->fields;
56440         ++ctx->head;
56441         ctx->head->field = field;
56442         ctx->head->parent_offset = parent_offset;
56443         break;
56444       } else {
56445         break;
56446       }
56447     }
56448   } while (ctx->enc_count);
56449   ctx->enc_type = 0;
56450   ctx->is_complex = 0;
56451   return 0;
56452 }
56453 static PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context * ctx,const char ** tsp)56454 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
56455 {
56456     const char *ts = *tsp;
56457     int i = 0, number;
56458     int ndim = ctx->head->field->type->ndim;
56459 ;
56460     ++ts;
56461     if (ctx->new_count != 1) {
56462         PyErr_SetString(PyExc_ValueError,
56463                         "Cannot handle repeated arrays in format string");
56464         return NULL;
56465     }
56466     if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
56467     while (*ts && *ts != ')') {
56468         switch (*ts) {
56469             case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
56470             default:  break;
56471         }
56472         number = __Pyx_BufFmt_ExpectNumber(&ts);
56473         if (number == -1) return NULL;
56474         if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
56475             return PyErr_Format(PyExc_ValueError,
56476                         "Expected a dimension of size %zu, got %d",
56477                         ctx->head->field->type->arraysize[i], number);
56478         if (*ts != ',' && *ts != ')')
56479             return PyErr_Format(PyExc_ValueError,
56480                                 "Expected a comma in format string, got '%c'", *ts);
56481         if (*ts == ',') ts++;
56482         i++;
56483     }
56484     if (i != ndim)
56485         return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
56486                             ctx->head->field->type->ndim, i);
56487     if (!*ts) {
56488         PyErr_SetString(PyExc_ValueError,
56489                         "Unexpected end of format string, expected ')'");
56490         return NULL;
56491     }
56492     ctx->is_valid_array = 1;
56493     ctx->new_count = 1;
56494     *tsp = ++ts;
56495     return Py_None;
56496 }
__Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context * ctx,const char * ts)56497 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
56498   int got_Z = 0;
56499   while (1) {
56500     switch(*ts) {
56501       case 0:
56502         if (ctx->enc_type != 0 && ctx->head == NULL) {
56503           __Pyx_BufFmt_RaiseExpected(ctx);
56504           return NULL;
56505         }
56506         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
56507         if (ctx->head != NULL) {
56508           __Pyx_BufFmt_RaiseExpected(ctx);
56509           return NULL;
56510         }
56511         return ts;
56512       case ' ':
56513       case '\r':
56514       case '\n':
56515         ++ts;
56516         break;
56517       case '<':
56518         if (!__Pyx_Is_Little_Endian()) {
56519           PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
56520           return NULL;
56521         }
56522         ctx->new_packmode = '=';
56523         ++ts;
56524         break;
56525       case '>':
56526       case '!':
56527         if (__Pyx_Is_Little_Endian()) {
56528           PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
56529           return NULL;
56530         }
56531         ctx->new_packmode = '=';
56532         ++ts;
56533         break;
56534       case '=':
56535       case '@':
56536       case '^':
56537         ctx->new_packmode = *ts++;
56538         break;
56539       case 'T':
56540         {
56541           const char* ts_after_sub;
56542           size_t i, struct_count = ctx->new_count;
56543           size_t struct_alignment = ctx->struct_alignment;
56544           ctx->new_count = 1;
56545           ++ts;
56546           if (*ts != '{') {
56547             PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
56548             return NULL;
56549           }
56550           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
56551           ctx->enc_type = 0;
56552           ctx->enc_count = 0;
56553           ctx->struct_alignment = 0;
56554           ++ts;
56555           ts_after_sub = ts;
56556           for (i = 0; i != struct_count; ++i) {
56557             ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
56558             if (!ts_after_sub) return NULL;
56559           }
56560           ts = ts_after_sub;
56561           if (struct_alignment) ctx->struct_alignment = struct_alignment;
56562         }
56563         break;
56564       case '}':
56565         {
56566           size_t alignment = ctx->struct_alignment;
56567           ++ts;
56568           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
56569           ctx->enc_type = 0;
56570           if (alignment && ctx->fmt_offset % alignment) {
56571             ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
56572           }
56573         }
56574         return ts;
56575       case 'x':
56576         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
56577         ctx->fmt_offset += ctx->new_count;
56578         ctx->new_count = 1;
56579         ctx->enc_count = 0;
56580         ctx->enc_type = 0;
56581         ctx->enc_packmode = ctx->new_packmode;
56582         ++ts;
56583         break;
56584       case 'Z':
56585         got_Z = 1;
56586         ++ts;
56587         if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
56588           __Pyx_BufFmt_RaiseUnexpectedChar('Z');
56589           return NULL;
56590         }
56591         CYTHON_FALLTHROUGH;
56592       case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
56593       case 'l': case 'L': case 'q': case 'Q':
56594       case 'f': case 'd': case 'g':
56595       case 'O': case 'p':
56596         if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
56597             ctx->enc_packmode == ctx->new_packmode) {
56598           ctx->enc_count += ctx->new_count;
56599           ctx->new_count = 1;
56600           got_Z = 0;
56601           ++ts;
56602           break;
56603         }
56604         CYTHON_FALLTHROUGH;
56605       case 's':
56606         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
56607         ctx->enc_count = ctx->new_count;
56608         ctx->enc_packmode = ctx->new_packmode;
56609         ctx->enc_type = *ts;
56610         ctx->is_complex = got_Z;
56611         ++ts;
56612         ctx->new_count = 1;
56613         got_Z = 0;
56614         break;
56615       case ':':
56616         ++ts;
56617         while(*ts != ':') ++ts;
56618         ++ts;
56619         break;
56620       case '(':
56621         if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
56622         break;
56623       default:
56624         {
56625           int number = __Pyx_BufFmt_ExpectNumber(&ts);
56626           if (number == -1) return NULL;
56627           ctx->new_count = (size_t)number;
56628         }
56629     }
56630   }
56631 }
56632 
56633 /* BufferGetAndValidate */
__Pyx_SafeReleaseBuffer(Py_buffer * info)56634   static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
56635   if (unlikely(info->buf == NULL)) return;
56636   if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
56637   __Pyx_ReleaseBuffer(info);
56638 }
__Pyx_ZeroBuffer(Py_buffer * buf)56639 static void __Pyx_ZeroBuffer(Py_buffer* buf) {
56640   buf->buf = NULL;
56641   buf->obj = NULL;
56642   buf->strides = __Pyx_zeros;
56643   buf->shape = __Pyx_zeros;
56644   buf->suboffsets = __Pyx_minusones;
56645 }
__Pyx__GetBufferAndValidate(Py_buffer * buf,PyObject * obj,__Pyx_TypeInfo * dtype,int flags,int nd,int cast,__Pyx_BufFmt_StackElem * stack)56646 static int __Pyx__GetBufferAndValidate(
56647         Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
56648         int nd, int cast, __Pyx_BufFmt_StackElem* stack)
56649 {
56650   buf->buf = NULL;
56651   if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
56652     __Pyx_ZeroBuffer(buf);
56653     return -1;
56654   }
56655   if (unlikely(buf->ndim != nd)) {
56656     PyErr_Format(PyExc_ValueError,
56657                  "Buffer has wrong number of dimensions (expected %d, got %d)",
56658                  nd, buf->ndim);
56659     goto fail;
56660   }
56661   if (!cast) {
56662     __Pyx_BufFmt_Context ctx;
56663     __Pyx_BufFmt_Init(&ctx, stack, dtype);
56664     if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
56665   }
56666   if (unlikely((size_t)buf->itemsize != dtype->size)) {
56667     PyErr_Format(PyExc_ValueError,
56668       "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
56669       buf->itemsize, (buf->itemsize > 1) ? "s" : "",
56670       dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
56671     goto fail;
56672   }
56673   if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
56674   return 0;
56675 fail:;
56676   __Pyx_SafeReleaseBuffer(buf);
56677   return -1;
56678 }
56679 
56680 /* ExtTypeTest */
__Pyx_TypeTest(PyObject * obj,PyTypeObject * type)56681   static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
56682     if (unlikely(!type)) {
56683         PyErr_SetString(PyExc_SystemError, "Missing type object");
56684         return 0;
56685     }
56686     if (likely(__Pyx_TypeCheck(obj, type)))
56687         return 1;
56688     PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
56689                  Py_TYPE(obj)->tp_name, type->tp_name);
56690     return 0;
56691 }
56692 
56693 /* BufferFallbackError */
__Pyx_RaiseBufferFallbackError(void)56694   static void __Pyx_RaiseBufferFallbackError(void) {
56695   PyErr_SetString(PyExc_ValueError,
56696      "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
56697 }
56698 
56699 /* PyErrFetchRestore */
56700   #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)56701 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
56702     PyObject *tmp_type, *tmp_value, *tmp_tb;
56703     tmp_type = tstate->curexc_type;
56704     tmp_value = tstate->curexc_value;
56705     tmp_tb = tstate->curexc_traceback;
56706     tstate->curexc_type = type;
56707     tstate->curexc_value = value;
56708     tstate->curexc_traceback = tb;
56709     Py_XDECREF(tmp_type);
56710     Py_XDECREF(tmp_value);
56711     Py_XDECREF(tmp_tb);
56712 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)56713 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
56714     *type = tstate->curexc_type;
56715     *value = tstate->curexc_value;
56716     *tb = tstate->curexc_traceback;
56717     tstate->curexc_type = 0;
56718     tstate->curexc_value = 0;
56719     tstate->curexc_traceback = 0;
56720 }
56721 #endif
56722 
56723 /* RaiseException */
56724   #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)56725 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
56726                         CYTHON_UNUSED PyObject *cause) {
56727     __Pyx_PyThreadState_declare
56728     Py_XINCREF(type);
56729     if (!value || value == Py_None)
56730         value = NULL;
56731     else
56732         Py_INCREF(value);
56733     if (!tb || tb == Py_None)
56734         tb = NULL;
56735     else {
56736         Py_INCREF(tb);
56737         if (!PyTraceBack_Check(tb)) {
56738             PyErr_SetString(PyExc_TypeError,
56739                 "raise: arg 3 must be a traceback or None");
56740             goto raise_error;
56741         }
56742     }
56743     if (PyType_Check(type)) {
56744 #if CYTHON_COMPILING_IN_PYPY
56745         if (!value) {
56746             Py_INCREF(Py_None);
56747             value = Py_None;
56748         }
56749 #endif
56750         PyErr_NormalizeException(&type, &value, &tb);
56751     } else {
56752         if (value) {
56753             PyErr_SetString(PyExc_TypeError,
56754                 "instance exception may not have a separate value");
56755             goto raise_error;
56756         }
56757         value = type;
56758         type = (PyObject*) Py_TYPE(type);
56759         Py_INCREF(type);
56760         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
56761             PyErr_SetString(PyExc_TypeError,
56762                 "raise: exception class must be a subclass of BaseException");
56763             goto raise_error;
56764         }
56765     }
56766     __Pyx_PyThreadState_assign
56767     __Pyx_ErrRestore(type, value, tb);
56768     return;
56769 raise_error:
56770     Py_XDECREF(value);
56771     Py_XDECREF(type);
56772     Py_XDECREF(tb);
56773     return;
56774 }
56775 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)56776 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
56777     PyObject* owned_instance = NULL;
56778     if (tb == Py_None) {
56779         tb = 0;
56780     } else if (tb && !PyTraceBack_Check(tb)) {
56781         PyErr_SetString(PyExc_TypeError,
56782             "raise: arg 3 must be a traceback or None");
56783         goto bad;
56784     }
56785     if (value == Py_None)
56786         value = 0;
56787     if (PyExceptionInstance_Check(type)) {
56788         if (value) {
56789             PyErr_SetString(PyExc_TypeError,
56790                 "instance exception may not have a separate value");
56791             goto bad;
56792         }
56793         value = type;
56794         type = (PyObject*) Py_TYPE(value);
56795     } else if (PyExceptionClass_Check(type)) {
56796         PyObject *instance_class = NULL;
56797         if (value && PyExceptionInstance_Check(value)) {
56798             instance_class = (PyObject*) Py_TYPE(value);
56799             if (instance_class != type) {
56800                 int is_subclass = PyObject_IsSubclass(instance_class, type);
56801                 if (!is_subclass) {
56802                     instance_class = NULL;
56803                 } else if (unlikely(is_subclass == -1)) {
56804                     goto bad;
56805                 } else {
56806                     type = instance_class;
56807                 }
56808             }
56809         }
56810         if (!instance_class) {
56811             PyObject *args;
56812             if (!value)
56813                 args = PyTuple_New(0);
56814             else if (PyTuple_Check(value)) {
56815                 Py_INCREF(value);
56816                 args = value;
56817             } else
56818                 args = PyTuple_Pack(1, value);
56819             if (!args)
56820                 goto bad;
56821             owned_instance = PyObject_Call(type, args, NULL);
56822             Py_DECREF(args);
56823             if (!owned_instance)
56824                 goto bad;
56825             value = owned_instance;
56826             if (!PyExceptionInstance_Check(value)) {
56827                 PyErr_Format(PyExc_TypeError,
56828                              "calling %R should have returned an instance of "
56829                              "BaseException, not %R",
56830                              type, Py_TYPE(value));
56831                 goto bad;
56832             }
56833         }
56834     } else {
56835         PyErr_SetString(PyExc_TypeError,
56836             "raise: exception class must be a subclass of BaseException");
56837         goto bad;
56838     }
56839     if (cause) {
56840         PyObject *fixed_cause;
56841         if (cause == Py_None) {
56842             fixed_cause = NULL;
56843         } else if (PyExceptionClass_Check(cause)) {
56844             fixed_cause = PyObject_CallObject(cause, NULL);
56845             if (fixed_cause == NULL)
56846                 goto bad;
56847         } else if (PyExceptionInstance_Check(cause)) {
56848             fixed_cause = cause;
56849             Py_INCREF(fixed_cause);
56850         } else {
56851             PyErr_SetString(PyExc_TypeError,
56852                             "exception causes must derive from "
56853                             "BaseException");
56854             goto bad;
56855         }
56856         PyException_SetCause(value, fixed_cause);
56857     }
56858     PyErr_SetObject(type, value);
56859     if (tb) {
56860 #if CYTHON_COMPILING_IN_PYPY
56861         PyObject *tmp_type, *tmp_value, *tmp_tb;
56862         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
56863         Py_INCREF(tb);
56864         PyErr_Restore(tmp_type, tmp_value, tb);
56865         Py_XDECREF(tmp_tb);
56866 #else
56867         PyThreadState *tstate = __Pyx_PyThreadState_Current;
56868         PyObject* tmp_tb = tstate->curexc_traceback;
56869         if (tb != tmp_tb) {
56870             Py_INCREF(tb);
56871             tstate->curexc_traceback = tb;
56872             Py_XDECREF(tmp_tb);
56873         }
56874 #endif
56875     }
56876 bad:
56877     Py_XDECREF(owned_instance);
56878     return;
56879 }
56880 #endif
56881 
56882 /* PyIntBinop */
56883   #if !CYTHON_COMPILING_IN_PYPY
__Pyx_PyInt_AddObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,int inplace,int zerodivision_check)56884 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
56885     (void)inplace;
56886     (void)zerodivision_check;
56887     #if PY_MAJOR_VERSION < 3
56888     if (likely(PyInt_CheckExact(op1))) {
56889         const long b = intval;
56890         long x;
56891         long a = PyInt_AS_LONG(op1);
56892             x = (long)((unsigned long)a + b);
56893             if (likely((x^a) >= 0 || (x^b) >= 0))
56894                 return PyInt_FromLong(x);
56895             return PyLong_Type.tp_as_number->nb_add(op1, op2);
56896     }
56897     #endif
56898     #if CYTHON_USE_PYLONG_INTERNALS
56899     if (likely(PyLong_CheckExact(op1))) {
56900         const long b = intval;
56901         long a, x;
56902 #ifdef HAVE_LONG_LONG
56903         const PY_LONG_LONG llb = intval;
56904         PY_LONG_LONG lla, llx;
56905 #endif
56906         const digit* digits = ((PyLongObject*)op1)->ob_digit;
56907         const Py_ssize_t size = Py_SIZE(op1);
56908         if (likely(__Pyx_sst_abs(size) <= 1)) {
56909             a = likely(size) ? digits[0] : 0;
56910             if (size == -1) a = -a;
56911         } else {
56912             switch (size) {
56913                 case -2:
56914                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
56915                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
56916                         break;
56917 #ifdef HAVE_LONG_LONG
56918                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
56919                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
56920                         goto long_long;
56921 #endif
56922                     }
56923                     CYTHON_FALLTHROUGH;
56924                 case 2:
56925                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
56926                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
56927                         break;
56928 #ifdef HAVE_LONG_LONG
56929                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
56930                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
56931                         goto long_long;
56932 #endif
56933                     }
56934                     CYTHON_FALLTHROUGH;
56935                 case -3:
56936                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
56937                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
56938                         break;
56939 #ifdef HAVE_LONG_LONG
56940                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
56941                         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]));
56942                         goto long_long;
56943 #endif
56944                     }
56945                     CYTHON_FALLTHROUGH;
56946                 case 3:
56947                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
56948                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
56949                         break;
56950 #ifdef HAVE_LONG_LONG
56951                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
56952                         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]));
56953                         goto long_long;
56954 #endif
56955                     }
56956                     CYTHON_FALLTHROUGH;
56957                 case -4:
56958                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
56959                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
56960                         break;
56961 #ifdef HAVE_LONG_LONG
56962                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
56963                         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]));
56964                         goto long_long;
56965 #endif
56966                     }
56967                     CYTHON_FALLTHROUGH;
56968                 case 4:
56969                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
56970                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
56971                         break;
56972 #ifdef HAVE_LONG_LONG
56973                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
56974                         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]));
56975                         goto long_long;
56976 #endif
56977                     }
56978                     CYTHON_FALLTHROUGH;
56979                 default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
56980             }
56981         }
56982                 x = a + b;
56983             return PyLong_FromLong(x);
56984 #ifdef HAVE_LONG_LONG
56985         long_long:
56986                 llx = lla + llb;
56987             return PyLong_FromLongLong(llx);
56988 #endif
56989 
56990 
56991     }
56992     #endif
56993     if (PyFloat_CheckExact(op1)) {
56994         const long b = intval;
56995         double a = PyFloat_AS_DOUBLE(op1);
56996             double result;
56997             PyFPE_START_PROTECT("add", return NULL)
56998             result = ((double)a) + (double)b;
56999             PyFPE_END_PROTECT(result)
57000             return PyFloat_FromDouble(result);
57001     }
57002     return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
57003 }
57004 #endif
57005 
57006 /* MemviewSliceInit */
57007   static int
__Pyx_init_memviewslice(struct __pyx_memoryview_obj * memview,int ndim,__Pyx_memviewslice * memviewslice,int memview_is_new_reference)57008 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
57009                         int ndim,
57010                         __Pyx_memviewslice *memviewslice,
57011                         int memview_is_new_reference)
57012 {
57013     __Pyx_RefNannyDeclarations
57014     int i, retval=-1;
57015     Py_buffer *buf = &memview->view;
57016     __Pyx_RefNannySetupContext("init_memviewslice", 0);
57017     if (memviewslice->memview || memviewslice->data) {
57018         PyErr_SetString(PyExc_ValueError,
57019             "memviewslice is already initialized!");
57020         goto fail;
57021     }
57022     if (buf->strides) {
57023         for (i = 0; i < ndim; i++) {
57024             memviewslice->strides[i] = buf->strides[i];
57025         }
57026     } else {
57027         Py_ssize_t stride = buf->itemsize;
57028         for (i = ndim - 1; i >= 0; i--) {
57029             memviewslice->strides[i] = stride;
57030             stride *= buf->shape[i];
57031         }
57032     }
57033     for (i = 0; i < ndim; i++) {
57034         memviewslice->shape[i]   = buf->shape[i];
57035         if (buf->suboffsets) {
57036             memviewslice->suboffsets[i] = buf->suboffsets[i];
57037         } else {
57038             memviewslice->suboffsets[i] = -1;
57039         }
57040     }
57041     memviewslice->memview = memview;
57042     memviewslice->data = (char *)buf->buf;
57043     if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
57044         Py_INCREF(memview);
57045     }
57046     retval = 0;
57047     goto no_fail;
57048 fail:
57049     memviewslice->memview = 0;
57050     memviewslice->data = 0;
57051     retval = -1;
57052 no_fail:
57053     __Pyx_RefNannyFinishContext();
57054     return retval;
57055 }
57056 #ifndef Py_NO_RETURN
57057 #define Py_NO_RETURN
57058 #endif
__pyx_fatalerror(const char * fmt,...)57059 static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
57060     va_list vargs;
57061     char msg[200];
57062 #ifdef HAVE_STDARG_PROTOTYPES
57063     va_start(vargs, fmt);
57064 #else
57065     va_start(vargs);
57066 #endif
57067     vsnprintf(msg, 200, fmt, vargs);
57068     va_end(vargs);
57069     Py_FatalError(msg);
57070 }
57071 static CYTHON_INLINE int
__pyx_add_acquisition_count_locked(__pyx_atomic_int * acquisition_count,PyThread_type_lock lock)57072 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
57073                                    PyThread_type_lock lock)
57074 {
57075     int result;
57076     PyThread_acquire_lock(lock, 1);
57077     result = (*acquisition_count)++;
57078     PyThread_release_lock(lock);
57079     return result;
57080 }
57081 static CYTHON_INLINE int
__pyx_sub_acquisition_count_locked(__pyx_atomic_int * acquisition_count,PyThread_type_lock lock)57082 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
57083                                    PyThread_type_lock lock)
57084 {
57085     int result;
57086     PyThread_acquire_lock(lock, 1);
57087     result = (*acquisition_count)--;
57088     PyThread_release_lock(lock);
57089     return result;
57090 }
57091 static CYTHON_INLINE void
__Pyx_INC_MEMVIEW(__Pyx_memviewslice * memslice,int have_gil,int lineno)57092 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
57093 {
57094     int first_time;
57095     struct __pyx_memoryview_obj *memview = memslice->memview;
57096     if (!memview || (PyObject *) memview == Py_None)
57097         return;
57098     if (__pyx_get_slice_count(memview) < 0)
57099         __pyx_fatalerror("Acquisition count is %d (line %d)",
57100                          __pyx_get_slice_count(memview), lineno);
57101     first_time = __pyx_add_acquisition_count(memview) == 0;
57102     if (first_time) {
57103         if (have_gil) {
57104             Py_INCREF((PyObject *) memview);
57105         } else {
57106             PyGILState_STATE _gilstate = PyGILState_Ensure();
57107             Py_INCREF((PyObject *) memview);
57108             PyGILState_Release(_gilstate);
57109         }
57110     }
57111 }
__Pyx_XDEC_MEMVIEW(__Pyx_memviewslice * memslice,int have_gil,int lineno)57112 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
57113                                              int have_gil, int lineno) {
57114     int last_time;
57115     struct __pyx_memoryview_obj *memview = memslice->memview;
57116     if (!memview ) {
57117         return;
57118     } else if ((PyObject *) memview == Py_None) {
57119         memslice->memview = NULL;
57120         return;
57121     }
57122     if (__pyx_get_slice_count(memview) <= 0)
57123         __pyx_fatalerror("Acquisition count is %d (line %d)",
57124                          __pyx_get_slice_count(memview), lineno);
57125     last_time = __pyx_sub_acquisition_count(memview) == 1;
57126     memslice->data = NULL;
57127     if (last_time) {
57128         if (have_gil) {
57129             Py_CLEAR(memslice->memview);
57130         } else {
57131             PyGILState_STATE _gilstate = PyGILState_Ensure();
57132             Py_CLEAR(memslice->memview);
57133             PyGILState_Release(_gilstate);
57134         }
57135     } else {
57136         memslice->memview = NULL;
57137     }
57138 }
57139 
57140 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)57141   static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
57142     PyErr_Format(PyExc_ValueError,
57143                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
57144 }
57145 
57146 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)57147   static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
57148     PyErr_Format(PyExc_ValueError,
57149                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
57150                  index, (index == 1) ? "" : "s");
57151 }
57152 
57153 /* IterFinish */
__Pyx_IterFinish(void)57154   static CYTHON_INLINE int __Pyx_IterFinish(void) {
57155 #if CYTHON_FAST_THREAD_STATE
57156     PyThreadState *tstate = __Pyx_PyThreadState_Current;
57157     PyObject* exc_type = tstate->curexc_type;
57158     if (unlikely(exc_type)) {
57159         if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
57160             PyObject *exc_value, *exc_tb;
57161             exc_value = tstate->curexc_value;
57162             exc_tb = tstate->curexc_traceback;
57163             tstate->curexc_type = 0;
57164             tstate->curexc_value = 0;
57165             tstate->curexc_traceback = 0;
57166             Py_DECREF(exc_type);
57167             Py_XDECREF(exc_value);
57168             Py_XDECREF(exc_tb);
57169             return 0;
57170         } else {
57171             return -1;
57172         }
57173     }
57174     return 0;
57175 #else
57176     if (unlikely(PyErr_Occurred())) {
57177         if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
57178             PyErr_Clear();
57179             return 0;
57180         } else {
57181             return -1;
57182         }
57183     }
57184     return 0;
57185 #endif
57186 }
57187 
57188 /* UnpackItemEndCheck */
__Pyx_IternextUnpackEndCheck(PyObject * retval,Py_ssize_t expected)57189   static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
57190     if (unlikely(retval)) {
57191         Py_DECREF(retval);
57192         __Pyx_RaiseTooManyValuesError(expected);
57193         return -1;
57194     } else {
57195         return __Pyx_IterFinish();
57196     }
57197     return 0;
57198 }
57199 
57200 /* BufferIndexError */
__Pyx_RaiseBufferIndexError(int axis)57201   static void __Pyx_RaiseBufferIndexError(int axis) {
57202   PyErr_Format(PyExc_IndexError,
57203      "Out of bounds on buffer access (axis %d)", axis);
57204 }
57205 
57206 /* DictGetItem */
57207   #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
__Pyx_PyDict_GetItem(PyObject * d,PyObject * key)57208 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
57209     PyObject *value;
57210     value = PyDict_GetItemWithError(d, key);
57211     if (unlikely(!value)) {
57212         if (!PyErr_Occurred()) {
57213             if (unlikely(PyTuple_Check(key))) {
57214                 PyObject* args = PyTuple_Pack(1, key);
57215                 if (likely(args)) {
57216                     PyErr_SetObject(PyExc_KeyError, args);
57217                     Py_DECREF(args);
57218                 }
57219             } else {
57220                 PyErr_SetObject(PyExc_KeyError, key);
57221             }
57222         }
57223         return NULL;
57224     }
57225     Py_INCREF(value);
57226     return value;
57227 }
57228 #endif
57229 
57230 /* UnicodeAsUCS4 */
__Pyx_PyUnicode_AsPy_UCS4(PyObject * x)57231   static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject* x) {
57232    Py_ssize_t length;
57233    #if CYTHON_PEP393_ENABLED
57234    length = PyUnicode_GET_LENGTH(x);
57235    if (likely(length == 1)) {
57236        return PyUnicode_READ_CHAR(x, 0);
57237    }
57238    #else
57239    length = PyUnicode_GET_SIZE(x);
57240    if (likely(length == 1)) {
57241        return PyUnicode_AS_UNICODE(x)[0];
57242    }
57243    #if Py_UNICODE_SIZE == 2
57244    else if (PyUnicode_GET_SIZE(x) == 2) {
57245        Py_UCS4 high_val = PyUnicode_AS_UNICODE(x)[0];
57246        if (high_val >= 0xD800 && high_val <= 0xDBFF) {
57247            Py_UCS4 low_val = PyUnicode_AS_UNICODE(x)[1];
57248            if (low_val >= 0xDC00 && low_val <= 0xDFFF) {
57249                return 0x10000 + (((high_val & ((1<<10)-1)) << 10) | (low_val & ((1<<10)-1)));
57250            }
57251        }
57252    }
57253    #endif
57254    #endif
57255    PyErr_Format(PyExc_ValueError,
57256                 "only single character unicode strings can be converted to Py_UCS4, "
57257                 "got length %" CYTHON_FORMAT_SSIZE_T "d", length);
57258    return (Py_UCS4)-1;
57259 }
57260 
57261 /* object_ord */
__Pyx__PyObject_Ord(PyObject * c)57262   static long __Pyx__PyObject_Ord(PyObject* c) {
57263     Py_ssize_t size;
57264     if (PyBytes_Check(c)) {
57265         size = PyBytes_GET_SIZE(c);
57266         if (likely(size == 1)) {
57267             return (unsigned char) PyBytes_AS_STRING(c)[0];
57268         }
57269 #if PY_MAJOR_VERSION < 3
57270     } else if (PyUnicode_Check(c)) {
57271         return (long)__Pyx_PyUnicode_AsPy_UCS4(c);
57272 #endif
57273 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
57274     } else if (PyByteArray_Check(c)) {
57275         size = PyByteArray_GET_SIZE(c);
57276         if (likely(size == 1)) {
57277             return (unsigned char) PyByteArray_AS_STRING(c)[0];
57278         }
57279 #endif
57280     } else {
57281         PyErr_Format(PyExc_TypeError,
57282             "ord() expected string of length 1, but %.200s found", c->ob_type->tp_name);
57283         return (long)(Py_UCS4)-1;
57284     }
57285     PyErr_Format(PyExc_TypeError,
57286         "ord() expected a character, but string of length %zd found", size);
57287     return (long)(Py_UCS4)-1;
57288 }
57289 
57290 /* PyObjectCallNoArg */
57291   #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallNoArg(PyObject * func)57292 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
57293 #if CYTHON_FAST_PYCALL
57294     if (PyFunction_Check(func)) {
57295         return __Pyx_PyFunction_FastCall(func, NULL, 0);
57296     }
57297 #endif
57298 #ifdef __Pyx_CyFunction_USED
57299     if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
57300 #else
57301     if (likely(PyCFunction_Check(func)))
57302 #endif
57303     {
57304         if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
57305             return __Pyx_PyObject_CallMethO(func, NULL);
57306         }
57307     }
57308     return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
57309 }
57310 #endif
57311 
57312 /* PyObjectGetMethod */
__Pyx_PyObject_GetMethod(PyObject * obj,PyObject * name,PyObject ** method)57313   static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
57314     PyObject *attr;
57315 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
57316     PyTypeObject *tp = Py_TYPE(obj);
57317     PyObject *descr;
57318     descrgetfunc f = NULL;
57319     PyObject **dictptr, *dict;
57320     int meth_found = 0;
57321     assert (*method == NULL);
57322     if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
57323         attr = __Pyx_PyObject_GetAttrStr(obj, name);
57324         goto try_unpack;
57325     }
57326     if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
57327         return 0;
57328     }
57329     descr = _PyType_Lookup(tp, name);
57330     if (likely(descr != NULL)) {
57331         Py_INCREF(descr);
57332 #if PY_MAJOR_VERSION >= 3
57333         #ifdef __Pyx_CyFunction_USED
57334         if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
57335         #else
57336         if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
57337         #endif
57338 #else
57339         #ifdef __Pyx_CyFunction_USED
57340         if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
57341         #else
57342         if (likely(PyFunction_Check(descr)))
57343         #endif
57344 #endif
57345         {
57346             meth_found = 1;
57347         } else {
57348             f = Py_TYPE(descr)->tp_descr_get;
57349             if (f != NULL && PyDescr_IsData(descr)) {
57350                 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
57351                 Py_DECREF(descr);
57352                 goto try_unpack;
57353             }
57354         }
57355     }
57356     dictptr = _PyObject_GetDictPtr(obj);
57357     if (dictptr != NULL && (dict = *dictptr) != NULL) {
57358         Py_INCREF(dict);
57359         attr = __Pyx_PyDict_GetItemStr(dict, name);
57360         if (attr != NULL) {
57361             Py_INCREF(attr);
57362             Py_DECREF(dict);
57363             Py_XDECREF(descr);
57364             goto try_unpack;
57365         }
57366         Py_DECREF(dict);
57367     }
57368     if (meth_found) {
57369         *method = descr;
57370         return 1;
57371     }
57372     if (f != NULL) {
57373         attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
57374         Py_DECREF(descr);
57375         goto try_unpack;
57376     }
57377     if (descr != NULL) {
57378         *method = descr;
57379         return 0;
57380     }
57381     PyErr_Format(PyExc_AttributeError,
57382 #if PY_MAJOR_VERSION >= 3
57383                  "'%.50s' object has no attribute '%U'",
57384                  tp->tp_name, name);
57385 #else
57386                  "'%.50s' object has no attribute '%.400s'",
57387                  tp->tp_name, PyString_AS_STRING(name));
57388 #endif
57389     return 0;
57390 #else
57391     attr = __Pyx_PyObject_GetAttrStr(obj, name);
57392     goto try_unpack;
57393 #endif
57394 try_unpack:
57395 #if CYTHON_UNPACK_METHODS
57396     if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
57397         PyObject *function = PyMethod_GET_FUNCTION(attr);
57398         Py_INCREF(function);
57399         Py_DECREF(attr);
57400         *method = function;
57401         return 1;
57402     }
57403 #endif
57404     *method = attr;
57405     return 0;
57406 }
57407 
57408 /* PyObjectCallMethod0 */
__Pyx_PyObject_CallMethod0(PyObject * obj,PyObject * method_name)57409   static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
57410     PyObject *method = NULL, *result = NULL;
57411     int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
57412     if (likely(is_method)) {
57413         result = __Pyx_PyObject_CallOneArg(method, obj);
57414         Py_DECREF(method);
57415         return result;
57416     }
57417     if (unlikely(!method)) goto bad;
57418     result = __Pyx_PyObject_CallNoArg(method);
57419     Py_DECREF(method);
57420 bad:
57421     return result;
57422 }
57423 
57424 /* RaiseNoneIterError */
__Pyx_RaiseNoneNotIterableError(void)57425   static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
57426     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
57427 }
57428 
57429 /* UnpackTupleError */
__Pyx_UnpackTupleError(PyObject * t,Py_ssize_t index)57430   static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
57431     if (t == Py_None) {
57432       __Pyx_RaiseNoneNotIterableError();
57433     } else if (PyTuple_GET_SIZE(t) < index) {
57434       __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
57435     } else {
57436       __Pyx_RaiseTooManyValuesError(index);
57437     }
57438 }
57439 
57440 /* UnpackTuple2 */
__Pyx_unpack_tuple2_exact(PyObject * tuple,PyObject ** pvalue1,PyObject ** pvalue2,int decref_tuple)57441   static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
57442         PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
57443     PyObject *value1 = NULL, *value2 = NULL;
57444 #if CYTHON_COMPILING_IN_PYPY
57445     value1 = PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
57446     value2 = PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
57447 #else
57448     value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
57449     value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
57450 #endif
57451     if (decref_tuple) {
57452         Py_DECREF(tuple);
57453     }
57454     *pvalue1 = value1;
57455     *pvalue2 = value2;
57456     return 0;
57457 #if CYTHON_COMPILING_IN_PYPY
57458 bad:
57459     Py_XDECREF(value1);
57460     Py_XDECREF(value2);
57461     if (decref_tuple) { Py_XDECREF(tuple); }
57462     return -1;
57463 #endif
57464 }
__Pyx_unpack_tuple2_generic(PyObject * tuple,PyObject ** pvalue1,PyObject ** pvalue2,int has_known_size,int decref_tuple)57465 static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
57466                                        int has_known_size, int decref_tuple) {
57467     Py_ssize_t index;
57468     PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
57469     iternextfunc iternext;
57470     iter = PyObject_GetIter(tuple);
57471     if (unlikely(!iter)) goto bad;
57472     if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
57473     iternext = Py_TYPE(iter)->tp_iternext;
57474     value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
57475     value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
57476     if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
57477     Py_DECREF(iter);
57478     *pvalue1 = value1;
57479     *pvalue2 = value2;
57480     return 0;
57481 unpacking_failed:
57482     if (!has_known_size && __Pyx_IterFinish() == 0)
57483         __Pyx_RaiseNeedMoreValuesError(index);
57484 bad:
57485     Py_XDECREF(iter);
57486     Py_XDECREF(value1);
57487     Py_XDECREF(value2);
57488     if (decref_tuple) { Py_XDECREF(tuple); }
57489     return -1;
57490 }
57491 
57492 /* dict_iter */
__Pyx_dict_iterator(PyObject * iterable,int is_dict,PyObject * method_name,Py_ssize_t * p_orig_length,int * p_source_is_dict)57493   static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
57494                                                    Py_ssize_t* p_orig_length, int* p_source_is_dict) {
57495     is_dict = is_dict || likely(PyDict_CheckExact(iterable));
57496     *p_source_is_dict = is_dict;
57497     if (is_dict) {
57498 #if !CYTHON_COMPILING_IN_PYPY
57499         *p_orig_length = PyDict_Size(iterable);
57500         Py_INCREF(iterable);
57501         return iterable;
57502 #elif PY_MAJOR_VERSION >= 3
57503         static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
57504         PyObject **pp = NULL;
57505         if (method_name) {
57506             const char *name = PyUnicode_AsUTF8(method_name);
57507             if (strcmp(name, "iteritems") == 0) pp = &py_items;
57508             else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
57509             else if (strcmp(name, "itervalues") == 0) pp = &py_values;
57510             if (pp) {
57511                 if (!*pp) {
57512                     *pp = PyUnicode_FromString(name + 4);
57513                     if (!*pp)
57514                         return NULL;
57515                 }
57516                 method_name = *pp;
57517             }
57518         }
57519 #endif
57520     }
57521     *p_orig_length = 0;
57522     if (method_name) {
57523         PyObject* iter;
57524         iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
57525         if (!iterable)
57526             return NULL;
57527 #if !CYTHON_COMPILING_IN_PYPY
57528         if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
57529             return iterable;
57530 #endif
57531         iter = PyObject_GetIter(iterable);
57532         Py_DECREF(iterable);
57533         return iter;
57534     }
57535     return PyObject_GetIter(iterable);
57536 }
__Pyx_dict_iter_next(PyObject * iter_obj,CYTHON_NCP_UNUSED Py_ssize_t orig_length,CYTHON_NCP_UNUSED Py_ssize_t * ppos,PyObject ** pkey,PyObject ** pvalue,PyObject ** pitem,int source_is_dict)57537 static CYTHON_INLINE int __Pyx_dict_iter_next(
57538         PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
57539         PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
57540     PyObject* next_item;
57541 #if !CYTHON_COMPILING_IN_PYPY
57542     if (source_is_dict) {
57543         PyObject *key, *value;
57544         if (unlikely(orig_length != PyDict_Size(iter_obj))) {
57545             PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
57546             return -1;
57547         }
57548         if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
57549             return 0;
57550         }
57551         if (pitem) {
57552             PyObject* tuple = PyTuple_New(2);
57553             if (unlikely(!tuple)) {
57554                 return -1;
57555             }
57556             Py_INCREF(key);
57557             Py_INCREF(value);
57558             PyTuple_SET_ITEM(tuple, 0, key);
57559             PyTuple_SET_ITEM(tuple, 1, value);
57560             *pitem = tuple;
57561         } else {
57562             if (pkey) {
57563                 Py_INCREF(key);
57564                 *pkey = key;
57565             }
57566             if (pvalue) {
57567                 Py_INCREF(value);
57568                 *pvalue = value;
57569             }
57570         }
57571         return 1;
57572     } else if (PyTuple_CheckExact(iter_obj)) {
57573         Py_ssize_t pos = *ppos;
57574         if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
57575         *ppos = pos + 1;
57576         next_item = PyTuple_GET_ITEM(iter_obj, pos);
57577         Py_INCREF(next_item);
57578     } else if (PyList_CheckExact(iter_obj)) {
57579         Py_ssize_t pos = *ppos;
57580         if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
57581         *ppos = pos + 1;
57582         next_item = PyList_GET_ITEM(iter_obj, pos);
57583         Py_INCREF(next_item);
57584     } else
57585 #endif
57586     {
57587         next_item = PyIter_Next(iter_obj);
57588         if (unlikely(!next_item)) {
57589             return __Pyx_IterFinish();
57590         }
57591     }
57592     if (pitem) {
57593         *pitem = next_item;
57594     } else if (pkey && pvalue) {
57595         if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
57596             return -1;
57597     } else if (pkey) {
57598         *pkey = next_item;
57599     } else {
57600         *pvalue = next_item;
57601     }
57602     return 1;
57603 }
57604 
57605 /* WriteUnraisableException */
__Pyx_WriteUnraisable(const char * name,CYTHON_UNUSED int clineno,CYTHON_UNUSED int lineno,CYTHON_UNUSED const char * filename,int full_traceback,CYTHON_UNUSED int nogil)57606   static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
57607                                   CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
57608                                   int full_traceback, CYTHON_UNUSED int nogil) {
57609     PyObject *old_exc, *old_val, *old_tb;
57610     PyObject *ctx;
57611     __Pyx_PyThreadState_declare
57612 #ifdef WITH_THREAD
57613     PyGILState_STATE state;
57614     if (nogil)
57615         state = PyGILState_Ensure();
57616 #ifdef _MSC_VER
57617     else state = (PyGILState_STATE)-1;
57618 #endif
57619 #endif
57620     __Pyx_PyThreadState_assign
57621     __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
57622     if (full_traceback) {
57623         Py_XINCREF(old_exc);
57624         Py_XINCREF(old_val);
57625         Py_XINCREF(old_tb);
57626         __Pyx_ErrRestore(old_exc, old_val, old_tb);
57627         PyErr_PrintEx(1);
57628     }
57629     #if PY_MAJOR_VERSION < 3
57630     ctx = PyString_FromString(name);
57631     #else
57632     ctx = PyUnicode_FromString(name);
57633     #endif
57634     __Pyx_ErrRestore(old_exc, old_val, old_tb);
57635     if (!ctx) {
57636         PyErr_WriteUnraisable(Py_None);
57637     } else {
57638         PyErr_WriteUnraisable(ctx);
57639         Py_DECREF(ctx);
57640     }
57641 #ifdef WITH_THREAD
57642     if (nogil)
57643         PyGILState_Release(state);
57644 #endif
57645 }
57646 
57647 /* SliceObject */
__Pyx_PyObject_GetSlice(PyObject * obj,Py_ssize_t cstart,Py_ssize_t cstop,PyObject ** _py_start,PyObject ** _py_stop,PyObject ** _py_slice,int has_cstart,int has_cstop,CYTHON_UNUSED int wraparound)57648   static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
57649         Py_ssize_t cstart, Py_ssize_t cstop,
57650         PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
57651         int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
57652 #if CYTHON_USE_TYPE_SLOTS
57653     PyMappingMethods* mp;
57654 #if PY_MAJOR_VERSION < 3
57655     PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
57656     if (likely(ms && ms->sq_slice)) {
57657         if (!has_cstart) {
57658             if (_py_start && (*_py_start != Py_None)) {
57659                 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
57660                 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
57661             } else
57662                 cstart = 0;
57663         }
57664         if (!has_cstop) {
57665             if (_py_stop && (*_py_stop != Py_None)) {
57666                 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
57667                 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
57668             } else
57669                 cstop = PY_SSIZE_T_MAX;
57670         }
57671         if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
57672             Py_ssize_t l = ms->sq_length(obj);
57673             if (likely(l >= 0)) {
57674                 if (cstop < 0) {
57675                     cstop += l;
57676                     if (cstop < 0) cstop = 0;
57677                 }
57678                 if (cstart < 0) {
57679                     cstart += l;
57680                     if (cstart < 0) cstart = 0;
57681                 }
57682             } else {
57683                 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
57684                     goto bad;
57685                 PyErr_Clear();
57686             }
57687         }
57688         return ms->sq_slice(obj, cstart, cstop);
57689     }
57690 #endif
57691     mp = Py_TYPE(obj)->tp_as_mapping;
57692     if (likely(mp && mp->mp_subscript))
57693 #endif
57694     {
57695         PyObject* result;
57696         PyObject *py_slice, *py_start, *py_stop;
57697         if (_py_slice) {
57698             py_slice = *_py_slice;
57699         } else {
57700             PyObject* owned_start = NULL;
57701             PyObject* owned_stop = NULL;
57702             if (_py_start) {
57703                 py_start = *_py_start;
57704             } else {
57705                 if (has_cstart) {
57706                     owned_start = py_start = PyInt_FromSsize_t(cstart);
57707                     if (unlikely(!py_start)) goto bad;
57708                 } else
57709                     py_start = Py_None;
57710             }
57711             if (_py_stop) {
57712                 py_stop = *_py_stop;
57713             } else {
57714                 if (has_cstop) {
57715                     owned_stop = py_stop = PyInt_FromSsize_t(cstop);
57716                     if (unlikely(!py_stop)) {
57717                         Py_XDECREF(owned_start);
57718                         goto bad;
57719                     }
57720                 } else
57721                     py_stop = Py_None;
57722             }
57723             py_slice = PySlice_New(py_start, py_stop, Py_None);
57724             Py_XDECREF(owned_start);
57725             Py_XDECREF(owned_stop);
57726             if (unlikely(!py_slice)) goto bad;
57727         }
57728 #if CYTHON_USE_TYPE_SLOTS
57729         result = mp->mp_subscript(obj, py_slice);
57730 #else
57731         result = PyObject_GetItem(obj, py_slice);
57732 #endif
57733         if (!_py_slice) {
57734             Py_DECREF(py_slice);
57735         }
57736         return result;
57737     }
57738     PyErr_Format(PyExc_TypeError,
57739         "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
57740 bad:
57741     return NULL;
57742 }
57743 
57744 /* GetTopmostException */
57745   #if CYTHON_USE_EXC_INFO_STACK
57746 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)57747 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
57748 {
57749     _PyErr_StackItem *exc_info = tstate->exc_info;
57750     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
57751            exc_info->previous_item != NULL)
57752     {
57753         exc_info = exc_info->previous_item;
57754     }
57755     return exc_info;
57756 }
57757 #endif
57758 
57759 /* SaveResetException */
57760   #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)57761 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
57762     #if CYTHON_USE_EXC_INFO_STACK
57763     _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
57764     *type = exc_info->exc_type;
57765     *value = exc_info->exc_value;
57766     *tb = exc_info->exc_traceback;
57767     #else
57768     *type = tstate->exc_type;
57769     *value = tstate->exc_value;
57770     *tb = tstate->exc_traceback;
57771     #endif
57772     Py_XINCREF(*type);
57773     Py_XINCREF(*value);
57774     Py_XINCREF(*tb);
57775 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)57776 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
57777     PyObject *tmp_type, *tmp_value, *tmp_tb;
57778     #if CYTHON_USE_EXC_INFO_STACK
57779     _PyErr_StackItem *exc_info = tstate->exc_info;
57780     tmp_type = exc_info->exc_type;
57781     tmp_value = exc_info->exc_value;
57782     tmp_tb = exc_info->exc_traceback;
57783     exc_info->exc_type = type;
57784     exc_info->exc_value = value;
57785     exc_info->exc_traceback = tb;
57786     #else
57787     tmp_type = tstate->exc_type;
57788     tmp_value = tstate->exc_value;
57789     tmp_tb = tstate->exc_traceback;
57790     tstate->exc_type = type;
57791     tstate->exc_value = value;
57792     tstate->exc_traceback = tb;
57793     #endif
57794     Py_XDECREF(tmp_type);
57795     Py_XDECREF(tmp_value);
57796     Py_XDECREF(tmp_tb);
57797 }
57798 #endif
57799 
57800 /* PyErrExceptionMatches */
57801   #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)57802 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
57803     Py_ssize_t i, n;
57804     n = PyTuple_GET_SIZE(tuple);
57805 #if PY_MAJOR_VERSION >= 3
57806     for (i=0; i<n; i++) {
57807         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
57808     }
57809 #endif
57810     for (i=0; i<n; i++) {
57811         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
57812     }
57813     return 0;
57814 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)57815 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
57816     PyObject *exc_type = tstate->curexc_type;
57817     if (exc_type == err) return 1;
57818     if (unlikely(!exc_type)) return 0;
57819     if (unlikely(PyTuple_Check(err)))
57820         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
57821     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
57822 }
57823 #endif
57824 
57825 /* GetException */
57826   #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)57827 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
57828 #else
57829 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
57830 #endif
57831 {
57832     PyObject *local_type, *local_value, *local_tb;
57833 #if CYTHON_FAST_THREAD_STATE
57834     PyObject *tmp_type, *tmp_value, *tmp_tb;
57835     local_type = tstate->curexc_type;
57836     local_value = tstate->curexc_value;
57837     local_tb = tstate->curexc_traceback;
57838     tstate->curexc_type = 0;
57839     tstate->curexc_value = 0;
57840     tstate->curexc_traceback = 0;
57841 #else
57842     PyErr_Fetch(&local_type, &local_value, &local_tb);
57843 #endif
57844     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
57845 #if CYTHON_FAST_THREAD_STATE
57846     if (unlikely(tstate->curexc_type))
57847 #else
57848     if (unlikely(PyErr_Occurred()))
57849 #endif
57850         goto bad;
57851     #if PY_MAJOR_VERSION >= 3
57852     if (local_tb) {
57853         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
57854             goto bad;
57855     }
57856     #endif
57857     Py_XINCREF(local_tb);
57858     Py_XINCREF(local_type);
57859     Py_XINCREF(local_value);
57860     *type = local_type;
57861     *value = local_value;
57862     *tb = local_tb;
57863 #if CYTHON_FAST_THREAD_STATE
57864     #if CYTHON_USE_EXC_INFO_STACK
57865     {
57866         _PyErr_StackItem *exc_info = tstate->exc_info;
57867         tmp_type = exc_info->exc_type;
57868         tmp_value = exc_info->exc_value;
57869         tmp_tb = exc_info->exc_traceback;
57870         exc_info->exc_type = local_type;
57871         exc_info->exc_value = local_value;
57872         exc_info->exc_traceback = local_tb;
57873     }
57874     #else
57875     tmp_type = tstate->exc_type;
57876     tmp_value = tstate->exc_value;
57877     tmp_tb = tstate->exc_traceback;
57878     tstate->exc_type = local_type;
57879     tstate->exc_value = local_value;
57880     tstate->exc_traceback = local_tb;
57881     #endif
57882     Py_XDECREF(tmp_type);
57883     Py_XDECREF(tmp_value);
57884     Py_XDECREF(tmp_tb);
57885 #else
57886     PyErr_SetExcInfo(local_type, local_value, local_tb);
57887 #endif
57888     return 0;
57889 bad:
57890     *type = 0;
57891     *value = 0;
57892     *tb = 0;
57893     Py_XDECREF(local_type);
57894     Py_XDECREF(local_value);
57895     Py_XDECREF(local_tb);
57896     return -1;
57897 }
57898 
57899 /* GetAttr */
__Pyx_GetAttr(PyObject * o,PyObject * n)57900   static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
57901 #if CYTHON_USE_TYPE_SLOTS
57902 #if PY_MAJOR_VERSION >= 3
57903     if (likely(PyUnicode_Check(n)))
57904 #else
57905     if (likely(PyString_Check(n)))
57906 #endif
57907         return __Pyx_PyObject_GetAttrStr(o, n);
57908 #endif
57909     return PyObject_GetAttr(o, n);
57910 }
57911 
57912 /* HasAttr */
__Pyx_HasAttr(PyObject * o,PyObject * n)57913   static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
57914     PyObject *r;
57915     if (unlikely(!__Pyx_PyBaseString_Check(n))) {
57916         PyErr_SetString(PyExc_TypeError,
57917                         "hasattr(): attribute name must be string");
57918         return -1;
57919     }
57920     r = __Pyx_GetAttr(o, n);
57921     if (unlikely(!r)) {
57922         PyErr_Clear();
57923         return 0;
57924     } else {
57925         Py_DECREF(r);
57926         return 1;
57927     }
57928 }
57929 
57930 /* BytesEquals */
__Pyx_PyBytes_Equals(PyObject * s1,PyObject * s2,int equals)57931   static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
57932 #if CYTHON_COMPILING_IN_PYPY
57933     return PyObject_RichCompareBool(s1, s2, equals);
57934 #else
57935     if (s1 == s2) {
57936         return (equals == Py_EQ);
57937     } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
57938         const char *ps1, *ps2;
57939         Py_ssize_t length = PyBytes_GET_SIZE(s1);
57940         if (length != PyBytes_GET_SIZE(s2))
57941             return (equals == Py_NE);
57942         ps1 = PyBytes_AS_STRING(s1);
57943         ps2 = PyBytes_AS_STRING(s2);
57944         if (ps1[0] != ps2[0]) {
57945             return (equals == Py_NE);
57946         } else if (length == 1) {
57947             return (equals == Py_EQ);
57948         } else {
57949             int result;
57950 #if CYTHON_USE_UNICODE_INTERNALS
57951             Py_hash_t hash1, hash2;
57952             hash1 = ((PyBytesObject*)s1)->ob_shash;
57953             hash2 = ((PyBytesObject*)s2)->ob_shash;
57954             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
57955                 return (equals == Py_NE);
57956             }
57957 #endif
57958             result = memcmp(ps1, ps2, (size_t)length);
57959             return (equals == Py_EQ) ? (result == 0) : (result != 0);
57960         }
57961     } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
57962         return (equals == Py_NE);
57963     } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
57964         return (equals == Py_NE);
57965     } else {
57966         int result;
57967         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
57968         if (!py_result)
57969             return -1;
57970         result = __Pyx_PyObject_IsTrue(py_result);
57971         Py_DECREF(py_result);
57972         return result;
57973     }
57974 #endif
57975 }
57976 
57977 /* UnicodeEquals */
__Pyx_PyUnicode_Equals(PyObject * s1,PyObject * s2,int equals)57978   static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
57979 #if CYTHON_COMPILING_IN_PYPY
57980     return PyObject_RichCompareBool(s1, s2, equals);
57981 #else
57982 #if PY_MAJOR_VERSION < 3
57983     PyObject* owned_ref = NULL;
57984 #endif
57985     int s1_is_unicode, s2_is_unicode;
57986     if (s1 == s2) {
57987         goto return_eq;
57988     }
57989     s1_is_unicode = PyUnicode_CheckExact(s1);
57990     s2_is_unicode = PyUnicode_CheckExact(s2);
57991 #if PY_MAJOR_VERSION < 3
57992     if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
57993         owned_ref = PyUnicode_FromObject(s2);
57994         if (unlikely(!owned_ref))
57995             return -1;
57996         s2 = owned_ref;
57997         s2_is_unicode = 1;
57998     } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
57999         owned_ref = PyUnicode_FromObject(s1);
58000         if (unlikely(!owned_ref))
58001             return -1;
58002         s1 = owned_ref;
58003         s1_is_unicode = 1;
58004     } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
58005         return __Pyx_PyBytes_Equals(s1, s2, equals);
58006     }
58007 #endif
58008     if (s1_is_unicode & s2_is_unicode) {
58009         Py_ssize_t length;
58010         int kind;
58011         void *data1, *data2;
58012         if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
58013             return -1;
58014         length = __Pyx_PyUnicode_GET_LENGTH(s1);
58015         if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
58016             goto return_ne;
58017         }
58018 #if CYTHON_USE_UNICODE_INTERNALS
58019         {
58020             Py_hash_t hash1, hash2;
58021         #if CYTHON_PEP393_ENABLED
58022             hash1 = ((PyASCIIObject*)s1)->hash;
58023             hash2 = ((PyASCIIObject*)s2)->hash;
58024         #else
58025             hash1 = ((PyUnicodeObject*)s1)->hash;
58026             hash2 = ((PyUnicodeObject*)s2)->hash;
58027         #endif
58028             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
58029                 goto return_ne;
58030             }
58031         }
58032 #endif
58033         kind = __Pyx_PyUnicode_KIND(s1);
58034         if (kind != __Pyx_PyUnicode_KIND(s2)) {
58035             goto return_ne;
58036         }
58037         data1 = __Pyx_PyUnicode_DATA(s1);
58038         data2 = __Pyx_PyUnicode_DATA(s2);
58039         if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
58040             goto return_ne;
58041         } else if (length == 1) {
58042             goto return_eq;
58043         } else {
58044             int result = memcmp(data1, data2, (size_t)(length * kind));
58045             #if PY_MAJOR_VERSION < 3
58046             Py_XDECREF(owned_ref);
58047             #endif
58048             return (equals == Py_EQ) ? (result == 0) : (result != 0);
58049         }
58050     } else if ((s1 == Py_None) & s2_is_unicode) {
58051         goto return_ne;
58052     } else if ((s2 == Py_None) & s1_is_unicode) {
58053         goto return_ne;
58054     } else {
58055         int result;
58056         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
58057         #if PY_MAJOR_VERSION < 3
58058         Py_XDECREF(owned_ref);
58059         #endif
58060         if (!py_result)
58061             return -1;
58062         result = __Pyx_PyObject_IsTrue(py_result);
58063         Py_DECREF(py_result);
58064         return result;
58065     }
58066 return_eq:
58067     #if PY_MAJOR_VERSION < 3
58068     Py_XDECREF(owned_ref);
58069     #endif
58070     return (equals == Py_EQ);
58071 return_ne:
58072     #if PY_MAJOR_VERSION < 3
58073     Py_XDECREF(owned_ref);
58074     #endif
58075     return (equals == Py_NE);
58076 #endif
58077 }
58078 
58079 /* None */
__Pyx_div_Py_ssize_t(Py_ssize_t a,Py_ssize_t b)58080   static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
58081     Py_ssize_t q = a / b;
58082     Py_ssize_t r = a - q*b;
58083     q -= ((r != 0) & ((r ^ b) < 0));
58084     return q;
58085 }
58086 
58087 /* decode_c_string */
__Pyx_decode_c_string(const char * cstring,Py_ssize_t start,Py_ssize_t stop,const char * encoding,const char * errors,PyObject * (* decode_func)(const char * s,Py_ssize_t size,const char * errors))58088   static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
58089          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
58090          const char* encoding, const char* errors,
58091          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
58092     Py_ssize_t length;
58093     if (unlikely((start < 0) | (stop < 0))) {
58094         size_t slen = strlen(cstring);
58095         if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
58096             PyErr_SetString(PyExc_OverflowError,
58097                             "c-string too long to convert to Python");
58098             return NULL;
58099         }
58100         length = (Py_ssize_t) slen;
58101         if (start < 0) {
58102             start += length;
58103             if (start < 0)
58104                 start = 0;
58105         }
58106         if (stop < 0)
58107             stop += length;
58108     }
58109     length = stop - start;
58110     if (unlikely(length <= 0))
58111         return PyUnicode_FromUnicode(NULL, 0);
58112     cstring += start;
58113     if (decode_func) {
58114         return decode_func(cstring, length, errors);
58115     } else {
58116         return PyUnicode_Decode(cstring, length, encoding, errors);
58117     }
58118 }
58119 
58120 /* GetAttr3 */
__Pyx_GetAttr3Default(PyObject * d)58121   static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
58122     __Pyx_PyThreadState_declare
58123     __Pyx_PyThreadState_assign
58124     if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
58125         return NULL;
58126     __Pyx_PyErr_Clear();
58127     Py_INCREF(d);
58128     return d;
58129 }
__Pyx_GetAttr3(PyObject * o,PyObject * n,PyObject * d)58130 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
58131     PyObject *r = __Pyx_GetAttr(o, n);
58132     return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
58133 }
58134 
58135 /* SwapException */
58136   #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSwap(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)58137 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
58138     PyObject *tmp_type, *tmp_value, *tmp_tb;
58139     #if CYTHON_USE_EXC_INFO_STACK
58140     _PyErr_StackItem *exc_info = tstate->exc_info;
58141     tmp_type = exc_info->exc_type;
58142     tmp_value = exc_info->exc_value;
58143     tmp_tb = exc_info->exc_traceback;
58144     exc_info->exc_type = *type;
58145     exc_info->exc_value = *value;
58146     exc_info->exc_traceback = *tb;
58147     #else
58148     tmp_type = tstate->exc_type;
58149     tmp_value = tstate->exc_value;
58150     tmp_tb = tstate->exc_traceback;
58151     tstate->exc_type = *type;
58152     tstate->exc_value = *value;
58153     tstate->exc_traceback = *tb;
58154     #endif
58155     *type = tmp_type;
58156     *value = tmp_value;
58157     *tb = tmp_tb;
58158 }
58159 #else
__Pyx_ExceptionSwap(PyObject ** type,PyObject ** value,PyObject ** tb)58160 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
58161     PyObject *tmp_type, *tmp_value, *tmp_tb;
58162     PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
58163     PyErr_SetExcInfo(*type, *value, *tb);
58164     *type = tmp_type;
58165     *value = tmp_value;
58166     *tb = tmp_tb;
58167 }
58168 #endif
58169 
58170 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)58171   static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
58172     PyObject *empty_list = 0;
58173     PyObject *module = 0;
58174     PyObject *global_dict = 0;
58175     PyObject *empty_dict = 0;
58176     PyObject *list;
58177     #if PY_MAJOR_VERSION < 3
58178     PyObject *py_import;
58179     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
58180     if (!py_import)
58181         goto bad;
58182     #endif
58183     if (from_list)
58184         list = from_list;
58185     else {
58186         empty_list = PyList_New(0);
58187         if (!empty_list)
58188             goto bad;
58189         list = empty_list;
58190     }
58191     global_dict = PyModule_GetDict(__pyx_m);
58192     if (!global_dict)
58193         goto bad;
58194     empty_dict = PyDict_New();
58195     if (!empty_dict)
58196         goto bad;
58197     {
58198         #if PY_MAJOR_VERSION >= 3
58199         if (level == -1) {
58200             if (strchr(__Pyx_MODULE_NAME, '.')) {
58201                 module = PyImport_ImportModuleLevelObject(
58202                     name, global_dict, empty_dict, list, 1);
58203                 if (!module) {
58204                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
58205                         goto bad;
58206                     PyErr_Clear();
58207                 }
58208             }
58209             level = 0;
58210         }
58211         #endif
58212         if (!module) {
58213             #if PY_MAJOR_VERSION < 3
58214             PyObject *py_level = PyInt_FromLong(level);
58215             if (!py_level)
58216                 goto bad;
58217             module = PyObject_CallFunctionObjArgs(py_import,
58218                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
58219             Py_DECREF(py_level);
58220             #else
58221             module = PyImport_ImportModuleLevelObject(
58222                 name, global_dict, empty_dict, list, level);
58223             #endif
58224         }
58225     }
58226 bad:
58227     #if PY_MAJOR_VERSION < 3
58228     Py_XDECREF(py_import);
58229     #endif
58230     Py_XDECREF(empty_list);
58231     Py_XDECREF(empty_dict);
58232     return module;
58233 }
58234 
58235 /* FastTypeChecks */
58236   #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)58237 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
58238     while (a) {
58239         a = a->tp_base;
58240         if (a == b)
58241             return 1;
58242     }
58243     return b == &PyBaseObject_Type;
58244 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)58245 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
58246     PyObject *mro;
58247     if (a == b) return 1;
58248     mro = a->tp_mro;
58249     if (likely(mro)) {
58250         Py_ssize_t i, n;
58251         n = PyTuple_GET_SIZE(mro);
58252         for (i = 0; i < n; i++) {
58253             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
58254                 return 1;
58255         }
58256         return 0;
58257     }
58258     return __Pyx_InBases(a, b);
58259 }
58260 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)58261 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
58262     PyObject *exception, *value, *tb;
58263     int res;
58264     __Pyx_PyThreadState_declare
58265     __Pyx_PyThreadState_assign
58266     __Pyx_ErrFetch(&exception, &value, &tb);
58267     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
58268     if (unlikely(res == -1)) {
58269         PyErr_WriteUnraisable(err);
58270         res = 0;
58271     }
58272     if (!res) {
58273         res = PyObject_IsSubclass(err, exc_type2);
58274         if (unlikely(res == -1)) {
58275             PyErr_WriteUnraisable(err);
58276             res = 0;
58277         }
58278     }
58279     __Pyx_ErrRestore(exception, value, tb);
58280     return res;
58281 }
58282 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)58283 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
58284     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
58285     if (!res) {
58286         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
58287     }
58288     return res;
58289 }
58290 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)58291 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
58292     Py_ssize_t i, n;
58293     assert(PyExceptionClass_Check(exc_type));
58294     n = PyTuple_GET_SIZE(tuple);
58295 #if PY_MAJOR_VERSION >= 3
58296     for (i=0; i<n; i++) {
58297         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
58298     }
58299 #endif
58300     for (i=0; i<n; i++) {
58301         PyObject *t = PyTuple_GET_ITEM(tuple, i);
58302         #if PY_MAJOR_VERSION < 3
58303         if (likely(exc_type == t)) return 1;
58304         #endif
58305         if (likely(PyExceptionClass_Check(t))) {
58306             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
58307         } else {
58308         }
58309     }
58310     return 0;
58311 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)58312 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
58313     if (likely(err == exc_type)) return 1;
58314     if (likely(PyExceptionClass_Check(err))) {
58315         if (likely(PyExceptionClass_Check(exc_type))) {
58316             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
58317         } else if (likely(PyTuple_Check(exc_type))) {
58318             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
58319         } else {
58320         }
58321     }
58322     return PyErr_GivenExceptionMatches(err, exc_type);
58323 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)58324 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
58325     assert(PyExceptionClass_Check(exc_type1));
58326     assert(PyExceptionClass_Check(exc_type2));
58327     if (likely(err == exc_type1 || err == exc_type2)) return 1;
58328     if (likely(PyExceptionClass_Check(err))) {
58329         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
58330     }
58331     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
58332 }
58333 #endif
58334 
58335 /* None */
__Pyx_RaiseUnboundLocalError(const char * varname)58336   static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
58337     PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
58338 }
58339 
58340 /* None */
__Pyx_div_long(long a,long b)58341   static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
58342     long q = a / b;
58343     long r = a - q*b;
58344     q -= ((r != 0) & ((r ^ b) < 0));
58345     return q;
58346 }
58347 
58348 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)58349   static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
58350     PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
58351     if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
58352         PyErr_Format(PyExc_ImportError,
58353         #if PY_MAJOR_VERSION < 3
58354             "cannot import name %.230s", PyString_AS_STRING(name));
58355         #else
58356             "cannot import name %S", name);
58357         #endif
58358     }
58359     return value;
58360 }
58361 
58362 /* PyObject_GenericGetAttrNoDict */
58363   #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)58364 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
58365     PyErr_Format(PyExc_AttributeError,
58366 #if PY_MAJOR_VERSION >= 3
58367                  "'%.50s' object has no attribute '%U'",
58368                  tp->tp_name, attr_name);
58369 #else
58370                  "'%.50s' object has no attribute '%.400s'",
58371                  tp->tp_name, PyString_AS_STRING(attr_name));
58372 #endif
58373     return NULL;
58374 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)58375 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
58376     PyObject *descr;
58377     PyTypeObject *tp = Py_TYPE(obj);
58378     if (unlikely(!PyString_Check(attr_name))) {
58379         return PyObject_GenericGetAttr(obj, attr_name);
58380     }
58381     assert(!tp->tp_dictoffset);
58382     descr = _PyType_Lookup(tp, attr_name);
58383     if (unlikely(!descr)) {
58384         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
58385     }
58386     Py_INCREF(descr);
58387     #if PY_MAJOR_VERSION < 3
58388     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
58389     #endif
58390     {
58391         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
58392         if (unlikely(f)) {
58393             PyObject *res = f(descr, obj, (PyObject *)tp);
58394             Py_DECREF(descr);
58395             return res;
58396         }
58397     }
58398     return descr;
58399 }
58400 #endif
58401 
58402 /* PyObject_GenericGetAttr */
58403   #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)58404 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
58405     if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
58406         return PyObject_GenericGetAttr(obj, attr_name);
58407     }
58408     return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
58409 }
58410 #endif
58411 
58412 /* SetVTable */
__Pyx_SetVtable(PyObject * dict,void * vtable)58413   static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
58414 #if PY_VERSION_HEX >= 0x02070000
58415     PyObject *ob = PyCapsule_New(vtable, 0, 0);
58416 #else
58417     PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
58418 #endif
58419     if (!ob)
58420         goto bad;
58421     if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
58422         goto bad;
58423     Py_DECREF(ob);
58424     return 0;
58425 bad:
58426     Py_XDECREF(ob);
58427     return -1;
58428 }
58429 
58430 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)58431   static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
58432   int ret;
58433   PyObject *name_attr;
58434   name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
58435   if (likely(name_attr)) {
58436       ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
58437   } else {
58438       ret = -1;
58439   }
58440   if (unlikely(ret < 0)) {
58441       PyErr_Clear();
58442       ret = 0;
58443   }
58444   Py_XDECREF(name_attr);
58445   return ret;
58446 }
__Pyx_setup_reduce(PyObject * type_obj)58447 static int __Pyx_setup_reduce(PyObject* type_obj) {
58448     int ret = 0;
58449     PyObject *object_reduce = NULL;
58450     PyObject *object_reduce_ex = NULL;
58451     PyObject *reduce = NULL;
58452     PyObject *reduce_ex = NULL;
58453     PyObject *reduce_cython = NULL;
58454     PyObject *setstate = NULL;
58455     PyObject *setstate_cython = NULL;
58456 #if CYTHON_USE_PYTYPE_LOOKUP
58457     if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD;
58458 #else
58459     if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD;
58460 #endif
58461 #if CYTHON_USE_PYTYPE_LOOKUP
58462     object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
58463 #else
58464     object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
58465 #endif
58466     reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto BAD;
58467     if (reduce_ex == object_reduce_ex) {
58468 #if CYTHON_USE_PYTYPE_LOOKUP
58469         object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
58470 #else
58471         object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
58472 #endif
58473         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto BAD;
58474         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
58475             reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD;
58476             ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD;
58477             ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD;
58478             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
58479             if (!setstate) PyErr_Clear();
58480             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
58481                 setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD;
58482                 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD;
58483                 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD;
58484             }
58485             PyType_Modified((PyTypeObject*)type_obj);
58486         }
58487     }
58488     goto GOOD;
58489 BAD:
58490     if (!PyErr_Occurred())
58491         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
58492     ret = -1;
58493 GOOD:
58494 #if !CYTHON_USE_PYTYPE_LOOKUP
58495     Py_XDECREF(object_reduce);
58496     Py_XDECREF(object_reduce_ex);
58497 #endif
58498     Py_XDECREF(reduce);
58499     Py_XDECREF(reduce_ex);
58500     Py_XDECREF(reduce_cython);
58501     Py_XDECREF(setstate);
58502     Py_XDECREF(setstate_cython);
58503     return ret;
58504 }
58505 
58506 /* TypeImport */
58507   #ifndef __PYX_HAVE_RT_ImportType
58508 #define __PYX_HAVE_RT_ImportType
__Pyx_ImportType(PyObject * module,const char * module_name,const char * class_name,size_t size,enum __Pyx_ImportType_CheckSize check_size)58509 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
58510     size_t size, enum __Pyx_ImportType_CheckSize check_size)
58511 {
58512     PyObject *result = 0;
58513     char warning[200];
58514     Py_ssize_t basicsize;
58515 #ifdef Py_LIMITED_API
58516     PyObject *py_basicsize;
58517 #endif
58518     result = PyObject_GetAttrString(module, class_name);
58519     if (!result)
58520         goto bad;
58521     if (!PyType_Check(result)) {
58522         PyErr_Format(PyExc_TypeError,
58523             "%.200s.%.200s is not a type object",
58524             module_name, class_name);
58525         goto bad;
58526     }
58527 #ifndef Py_LIMITED_API
58528     basicsize = ((PyTypeObject *)result)->tp_basicsize;
58529 #else
58530     py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
58531     if (!py_basicsize)
58532         goto bad;
58533     basicsize = PyLong_AsSsize_t(py_basicsize);
58534     Py_DECREF(py_basicsize);
58535     py_basicsize = 0;
58536     if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
58537         goto bad;
58538 #endif
58539     if ((size_t)basicsize < size) {
58540         PyErr_Format(PyExc_ValueError,
58541             "%.200s.%.200s size changed, may indicate binary incompatibility. "
58542             "Expected %zd from C header, got %zd from PyObject",
58543             module_name, class_name, size, basicsize);
58544         goto bad;
58545     }
58546     if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
58547         PyErr_Format(PyExc_ValueError,
58548             "%.200s.%.200s size changed, may indicate binary incompatibility. "
58549             "Expected %zd from C header, got %zd from PyObject",
58550             module_name, class_name, size, basicsize);
58551         goto bad;
58552     }
58553     else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
58554         PyOS_snprintf(warning, sizeof(warning),
58555             "%s.%s size changed, may indicate binary incompatibility. "
58556             "Expected %zd from C header, got %zd from PyObject",
58557             module_name, class_name, size, basicsize);
58558         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
58559     }
58560     return (PyTypeObject *)result;
58561 bad:
58562     Py_XDECREF(result);
58563     return NULL;
58564 }
58565 #endif
58566 
58567 /* FetchCommonType */
__Pyx_FetchCommonType(PyTypeObject * type)58568   static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
58569     PyObject* fake_module;
58570     PyTypeObject* cached_type = NULL;
58571     fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
58572     if (!fake_module) return NULL;
58573     Py_INCREF(fake_module);
58574     cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
58575     if (cached_type) {
58576         if (!PyType_Check((PyObject*)cached_type)) {
58577             PyErr_Format(PyExc_TypeError,
58578                 "Shared Cython type %.200s is not a type object",
58579                 type->tp_name);
58580             goto bad;
58581         }
58582         if (cached_type->tp_basicsize != type->tp_basicsize) {
58583             PyErr_Format(PyExc_TypeError,
58584                 "Shared Cython type %.200s has the wrong size, try recompiling",
58585                 type->tp_name);
58586             goto bad;
58587         }
58588     } else {
58589         if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
58590         PyErr_Clear();
58591         if (PyType_Ready(type) < 0) goto bad;
58592         if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
58593             goto bad;
58594         Py_INCREF(type);
58595         cached_type = type;
58596     }
58597 done:
58598     Py_DECREF(fake_module);
58599     return cached_type;
58600 bad:
58601     Py_XDECREF(cached_type);
58602     cached_type = NULL;
58603     goto done;
58604 }
58605 
58606 /* CythonFunction */
58607   #include <structmember.h>
58608 static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * closure)58609 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
58610 {
58611     if (unlikely(op->func_doc == NULL)) {
58612         if (op->func.m_ml->ml_doc) {
58613 #if PY_MAJOR_VERSION >= 3
58614             op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
58615 #else
58616             op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
58617 #endif
58618             if (unlikely(op->func_doc == NULL))
58619                 return NULL;
58620         } else {
58621             Py_INCREF(Py_None);
58622             return Py_None;
58623         }
58624     }
58625     Py_INCREF(op->func_doc);
58626     return op->func_doc;
58627 }
58628 static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)58629 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
58630 {
58631     PyObject *tmp = op->func_doc;
58632     if (value == NULL) {
58633         value = Py_None;
58634     }
58635     Py_INCREF(value);
58636     op->func_doc = value;
58637     Py_XDECREF(tmp);
58638     return 0;
58639 }
58640 static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)58641 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
58642 {
58643     if (unlikely(op->func_name == NULL)) {
58644 #if PY_MAJOR_VERSION >= 3
58645         op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
58646 #else
58647         op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
58648 #endif
58649         if (unlikely(op->func_name == NULL))
58650             return NULL;
58651     }
58652     Py_INCREF(op->func_name);
58653     return op->func_name;
58654 }
58655 static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)58656 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
58657 {
58658     PyObject *tmp;
58659 #if PY_MAJOR_VERSION >= 3
58660     if (unlikely(value == NULL || !PyUnicode_Check(value)))
58661 #else
58662     if (unlikely(value == NULL || !PyString_Check(value)))
58663 #endif
58664     {
58665         PyErr_SetString(PyExc_TypeError,
58666                         "__name__ must be set to a string object");
58667         return -1;
58668     }
58669     tmp = op->func_name;
58670     Py_INCREF(value);
58671     op->func_name = value;
58672     Py_XDECREF(tmp);
58673     return 0;
58674 }
58675 static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)58676 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
58677 {
58678     Py_INCREF(op->func_qualname);
58679     return op->func_qualname;
58680 }
58681 static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)58682 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
58683 {
58684     PyObject *tmp;
58685 #if PY_MAJOR_VERSION >= 3
58686     if (unlikely(value == NULL || !PyUnicode_Check(value)))
58687 #else
58688     if (unlikely(value == NULL || !PyString_Check(value)))
58689 #endif
58690     {
58691         PyErr_SetString(PyExc_TypeError,
58692                         "__qualname__ must be set to a string object");
58693         return -1;
58694     }
58695     tmp = op->func_qualname;
58696     Py_INCREF(value);
58697     op->func_qualname = value;
58698     Py_XDECREF(tmp);
58699     return 0;
58700 }
58701 static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject * m,CYTHON_UNUSED void * closure)58702 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
58703 {
58704     PyObject *self;
58705     self = m->func_closure;
58706     if (self == NULL)
58707         self = Py_None;
58708     Py_INCREF(self);
58709     return self;
58710 }
58711 static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)58712 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
58713 {
58714     if (unlikely(op->func_dict == NULL)) {
58715         op->func_dict = PyDict_New();
58716         if (unlikely(op->func_dict == NULL))
58717             return NULL;
58718     }
58719     Py_INCREF(op->func_dict);
58720     return op->func_dict;
58721 }
58722 static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)58723 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
58724 {
58725     PyObject *tmp;
58726     if (unlikely(value == NULL)) {
58727         PyErr_SetString(PyExc_TypeError,
58728                "function's dictionary may not be deleted");
58729         return -1;
58730     }
58731     if (unlikely(!PyDict_Check(value))) {
58732         PyErr_SetString(PyExc_TypeError,
58733                "setting function's dictionary to a non-dict");
58734         return -1;
58735     }
58736     tmp = op->func_dict;
58737     Py_INCREF(value);
58738     op->func_dict = value;
58739     Py_XDECREF(tmp);
58740     return 0;
58741 }
58742 static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)58743 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
58744 {
58745     Py_INCREF(op->func_globals);
58746     return op->func_globals;
58747 }
58748 static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)58749 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
58750 {
58751     Py_INCREF(Py_None);
58752     return Py_None;
58753 }
58754 static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)58755 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
58756 {
58757     PyObject* result = (op->func_code) ? op->func_code : Py_None;
58758     Py_INCREF(result);
58759     return result;
58760 }
58761 static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject * op)58762 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
58763     int result = 0;
58764     PyObject *res = op->defaults_getter((PyObject *) op);
58765     if (unlikely(!res))
58766         return -1;
58767     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
58768     op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
58769     Py_INCREF(op->defaults_tuple);
58770     op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
58771     Py_INCREF(op->defaults_kwdict);
58772     #else
58773     op->defaults_tuple = PySequence_ITEM(res, 0);
58774     if (unlikely(!op->defaults_tuple)) result = -1;
58775     else {
58776         op->defaults_kwdict = PySequence_ITEM(res, 1);
58777         if (unlikely(!op->defaults_kwdict)) result = -1;
58778     }
58779     #endif
58780     Py_DECREF(res);
58781     return result;
58782 }
58783 static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)58784 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
58785     PyObject* tmp;
58786     if (!value) {
58787         value = Py_None;
58788     } else if (value != Py_None && !PyTuple_Check(value)) {
58789         PyErr_SetString(PyExc_TypeError,
58790                         "__defaults__ must be set to a tuple object");
58791         return -1;
58792     }
58793     Py_INCREF(value);
58794     tmp = op->defaults_tuple;
58795     op->defaults_tuple = value;
58796     Py_XDECREF(tmp);
58797     return 0;
58798 }
58799 static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)58800 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
58801     PyObject* result = op->defaults_tuple;
58802     if (unlikely(!result)) {
58803         if (op->defaults_getter) {
58804             if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
58805             result = op->defaults_tuple;
58806         } else {
58807             result = Py_None;
58808         }
58809     }
58810     Py_INCREF(result);
58811     return result;
58812 }
58813 static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)58814 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
58815     PyObject* tmp;
58816     if (!value) {
58817         value = Py_None;
58818     } else if (value != Py_None && !PyDict_Check(value)) {
58819         PyErr_SetString(PyExc_TypeError,
58820                         "__kwdefaults__ must be set to a dict object");
58821         return -1;
58822     }
58823     Py_INCREF(value);
58824     tmp = op->defaults_kwdict;
58825     op->defaults_kwdict = value;
58826     Py_XDECREF(tmp);
58827     return 0;
58828 }
58829 static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)58830 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
58831     PyObject* result = op->defaults_kwdict;
58832     if (unlikely(!result)) {
58833         if (op->defaults_getter) {
58834             if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
58835             result = op->defaults_kwdict;
58836         } else {
58837             result = Py_None;
58838         }
58839     }
58840     Py_INCREF(result);
58841     return result;
58842 }
58843 static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)58844 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
58845     PyObject* tmp;
58846     if (!value || value == Py_None) {
58847         value = NULL;
58848     } else if (!PyDict_Check(value)) {
58849         PyErr_SetString(PyExc_TypeError,
58850                         "__annotations__ must be set to a dict object");
58851         return -1;
58852     }
58853     Py_XINCREF(value);
58854     tmp = op->func_annotations;
58855     op->func_annotations = value;
58856     Py_XDECREF(tmp);
58857     return 0;
58858 }
58859 static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)58860 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
58861     PyObject* result = op->func_annotations;
58862     if (unlikely(!result)) {
58863         result = PyDict_New();
58864         if (unlikely(!result)) return NULL;
58865         op->func_annotations = result;
58866     }
58867     Py_INCREF(result);
58868     return result;
58869 }
58870 static PyGetSetDef __pyx_CyFunction_getsets[] = {
58871     {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
58872     {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
58873     {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
58874     {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
58875     {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
58876     {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
58877     {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
58878     {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
58879     {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
58880     {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
58881     {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
58882     {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
58883     {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
58884     {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
58885     {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
58886     {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
58887     {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
58888     {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
58889     {0, 0, 0, 0, 0}
58890 };
58891 static PyMemberDef __pyx_CyFunction_members[] = {
58892     {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
58893     {0, 0, 0,  0, 0}
58894 };
58895 static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject * m,CYTHON_UNUSED PyObject * args)58896 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
58897 {
58898 #if PY_MAJOR_VERSION >= 3
58899     return PyUnicode_FromString(m->func.m_ml->ml_name);
58900 #else
58901     return PyString_FromString(m->func.m_ml->ml_name);
58902 #endif
58903 }
58904 static PyMethodDef __pyx_CyFunction_methods[] = {
58905     {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
58906     {0, 0, 0, 0}
58907 };
58908 #if PY_VERSION_HEX < 0x030500A0
58909 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
58910 #else
58911 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
58912 #endif
__Pyx_CyFunction_New(PyTypeObject * type,PyMethodDef * ml,int flags,PyObject * qualname,PyObject * closure,PyObject * module,PyObject * globals,PyObject * code)58913 static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
58914                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
58915     __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
58916     if (op == NULL)
58917         return NULL;
58918     op->flags = flags;
58919     __Pyx_CyFunction_weakreflist(op) = NULL;
58920     op->func.m_ml = ml;
58921     op->func.m_self = (PyObject *) op;
58922     Py_XINCREF(closure);
58923     op->func_closure = closure;
58924     Py_XINCREF(module);
58925     op->func.m_module = module;
58926     op->func_dict = NULL;
58927     op->func_name = NULL;
58928     Py_INCREF(qualname);
58929     op->func_qualname = qualname;
58930     op->func_doc = NULL;
58931     op->func_classobj = NULL;
58932     op->func_globals = globals;
58933     Py_INCREF(op->func_globals);
58934     Py_XINCREF(code);
58935     op->func_code = code;
58936     op->defaults_pyobjects = 0;
58937     op->defaults = NULL;
58938     op->defaults_tuple = NULL;
58939     op->defaults_kwdict = NULL;
58940     op->defaults_getter = NULL;
58941     op->func_annotations = NULL;
58942     PyObject_GC_Track(op);
58943     return (PyObject *) op;
58944 }
58945 static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject * m)58946 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
58947 {
58948     Py_CLEAR(m->func_closure);
58949     Py_CLEAR(m->func.m_module);
58950     Py_CLEAR(m->func_dict);
58951     Py_CLEAR(m->func_name);
58952     Py_CLEAR(m->func_qualname);
58953     Py_CLEAR(m->func_doc);
58954     Py_CLEAR(m->func_globals);
58955     Py_CLEAR(m->func_code);
58956     Py_CLEAR(m->func_classobj);
58957     Py_CLEAR(m->defaults_tuple);
58958     Py_CLEAR(m->defaults_kwdict);
58959     Py_CLEAR(m->func_annotations);
58960     if (m->defaults) {
58961         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
58962         int i;
58963         for (i = 0; i < m->defaults_pyobjects; i++)
58964             Py_XDECREF(pydefaults[i]);
58965         PyObject_Free(m->defaults);
58966         m->defaults = NULL;
58967     }
58968     return 0;
58969 }
__Pyx__CyFunction_dealloc(__pyx_CyFunctionObject * m)58970 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
58971 {
58972     if (__Pyx_CyFunction_weakreflist(m) != NULL)
58973         PyObject_ClearWeakRefs((PyObject *) m);
58974     __Pyx_CyFunction_clear(m);
58975     PyObject_GC_Del(m);
58976 }
__Pyx_CyFunction_dealloc(__pyx_CyFunctionObject * m)58977 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
58978 {
58979     PyObject_GC_UnTrack(m);
58980     __Pyx__CyFunction_dealloc(m);
58981 }
__Pyx_CyFunction_traverse(__pyx_CyFunctionObject * m,visitproc visit,void * arg)58982 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
58983 {
58984     Py_VISIT(m->func_closure);
58985     Py_VISIT(m->func.m_module);
58986     Py_VISIT(m->func_dict);
58987     Py_VISIT(m->func_name);
58988     Py_VISIT(m->func_qualname);
58989     Py_VISIT(m->func_doc);
58990     Py_VISIT(m->func_globals);
58991     Py_VISIT(m->func_code);
58992     Py_VISIT(m->func_classobj);
58993     Py_VISIT(m->defaults_tuple);
58994     Py_VISIT(m->defaults_kwdict);
58995     if (m->defaults) {
58996         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
58997         int i;
58998         for (i = 0; i < m->defaults_pyobjects; i++)
58999             Py_VISIT(pydefaults[i]);
59000     }
59001     return 0;
59002 }
__Pyx_CyFunction_descr_get(PyObject * func,PyObject * obj,PyObject * type)59003 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
59004 {
59005     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
59006     if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
59007         Py_INCREF(func);
59008         return func;
59009     }
59010     if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
59011         if (type == NULL)
59012             type = (PyObject *)(Py_TYPE(obj));
59013         return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
59014     }
59015     if (obj == Py_None)
59016         obj = NULL;
59017     return __Pyx_PyMethod_New(func, obj, type);
59018 }
59019 static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject * op)59020 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
59021 {
59022 #if PY_MAJOR_VERSION >= 3
59023     return PyUnicode_FromFormat("<cyfunction %U at %p>",
59024                                 op->func_qualname, (void *)op);
59025 #else
59026     return PyString_FromFormat("<cyfunction %s at %p>",
59027                                PyString_AsString(op->func_qualname), (void *)op);
59028 #endif
59029 }
__Pyx_CyFunction_CallMethod(PyObject * func,PyObject * self,PyObject * arg,PyObject * kw)59030 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
59031     PyCFunctionObject* f = (PyCFunctionObject*)func;
59032     PyCFunction meth = f->m_ml->ml_meth;
59033     Py_ssize_t size;
59034     switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
59035     case METH_VARARGS:
59036         if (likely(kw == NULL || PyDict_Size(kw) == 0))
59037             return (*meth)(self, arg);
59038         break;
59039     case METH_VARARGS | METH_KEYWORDS:
59040         return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
59041     case METH_NOARGS:
59042         if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
59043             size = PyTuple_GET_SIZE(arg);
59044             if (likely(size == 0))
59045                 return (*meth)(self, NULL);
59046             PyErr_Format(PyExc_TypeError,
59047                 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
59048                 f->m_ml->ml_name, size);
59049             return NULL;
59050         }
59051         break;
59052     case METH_O:
59053         if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
59054             size = PyTuple_GET_SIZE(arg);
59055             if (likely(size == 1)) {
59056                 PyObject *result, *arg0;
59057                 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
59058                 arg0 = PyTuple_GET_ITEM(arg, 0);
59059                 #else
59060                 arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
59061                 #endif
59062                 result = (*meth)(self, arg0);
59063                 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
59064                 Py_DECREF(arg0);
59065                 #endif
59066                 return result;
59067             }
59068             PyErr_Format(PyExc_TypeError,
59069                 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
59070                 f->m_ml->ml_name, size);
59071             return NULL;
59072         }
59073         break;
59074     default:
59075         PyErr_SetString(PyExc_SystemError, "Bad call flags in "
59076                         "__Pyx_CyFunction_Call. METH_OLDARGS is no "
59077                         "longer supported!");
59078         return NULL;
59079     }
59080     PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
59081                  f->m_ml->ml_name);
59082     return NULL;
59083 }
__Pyx_CyFunction_Call(PyObject * func,PyObject * arg,PyObject * kw)59084 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
59085     return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
59086 }
__Pyx_CyFunction_CallAsMethod(PyObject * func,PyObject * args,PyObject * kw)59087 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
59088     PyObject *result;
59089     __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
59090     if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
59091         Py_ssize_t argc;
59092         PyObject *new_args;
59093         PyObject *self;
59094         argc = PyTuple_GET_SIZE(args);
59095         new_args = PyTuple_GetSlice(args, 1, argc);
59096         if (unlikely(!new_args))
59097             return NULL;
59098         self = PyTuple_GetItem(args, 0);
59099         if (unlikely(!self)) {
59100             Py_DECREF(new_args);
59101             return NULL;
59102         }
59103         result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
59104         Py_DECREF(new_args);
59105     } else {
59106         result = __Pyx_CyFunction_Call(func, args, kw);
59107     }
59108     return result;
59109 }
59110 static PyTypeObject __pyx_CyFunctionType_type = {
59111     PyVarObject_HEAD_INIT(0, 0)
59112     "cython_function_or_method",
59113     sizeof(__pyx_CyFunctionObject),
59114     0,
59115     (destructor) __Pyx_CyFunction_dealloc,
59116     0,
59117     0,
59118     0,
59119 #if PY_MAJOR_VERSION < 3
59120     0,
59121 #else
59122     0,
59123 #endif
59124     (reprfunc) __Pyx_CyFunction_repr,
59125     0,
59126     0,
59127     0,
59128     0,
59129     __Pyx_CyFunction_CallAsMethod,
59130     0,
59131     0,
59132     0,
59133     0,
59134     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
59135     0,
59136     (traverseproc) __Pyx_CyFunction_traverse,
59137     (inquiry) __Pyx_CyFunction_clear,
59138     0,
59139 #if PY_VERSION_HEX < 0x030500A0
59140     offsetof(__pyx_CyFunctionObject, func_weakreflist),
59141 #else
59142     offsetof(PyCFunctionObject, m_weakreflist),
59143 #endif
59144     0,
59145     0,
59146     __pyx_CyFunction_methods,
59147     __pyx_CyFunction_members,
59148     __pyx_CyFunction_getsets,
59149     0,
59150     0,
59151     __Pyx_CyFunction_descr_get,
59152     0,
59153     offsetof(__pyx_CyFunctionObject, func_dict),
59154     0,
59155     0,
59156     0,
59157     0,
59158     0,
59159     0,
59160     0,
59161     0,
59162     0,
59163     0,
59164     0,
59165     0,
59166 #if PY_VERSION_HEX >= 0x030400a1
59167     0,
59168 #endif
59169 #if PY_VERSION_HEX >= 0x030800b1
59170     0,
59171 #endif
59172 };
__pyx_CyFunction_init(void)59173 static int __pyx_CyFunction_init(void) {
59174     __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
59175     if (unlikely(__pyx_CyFunctionType == NULL)) {
59176         return -1;
59177     }
59178     return 0;
59179 }
__Pyx_CyFunction_InitDefaults(PyObject * func,size_t size,int pyobjects)59180 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
59181     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
59182     m->defaults = PyObject_Malloc(size);
59183     if (unlikely(!m->defaults))
59184         return PyErr_NoMemory();
59185     memset(m->defaults, 0, size);
59186     m->defaults_pyobjects = pyobjects;
59187     return m->defaults;
59188 }
__Pyx_CyFunction_SetDefaultsTuple(PyObject * func,PyObject * tuple)59189 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
59190     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
59191     m->defaults_tuple = tuple;
59192     Py_INCREF(tuple);
59193 }
__Pyx_CyFunction_SetDefaultsKwDict(PyObject * func,PyObject * dict)59194 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
59195     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
59196     m->defaults_kwdict = dict;
59197     Py_INCREF(dict);
59198 }
__Pyx_CyFunction_SetAnnotationsDict(PyObject * func,PyObject * dict)59199 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
59200     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
59201     m->func_annotations = dict;
59202     Py_INCREF(dict);
59203 }
59204 
59205 /* FusedFunction */
59206   static PyObject *
__pyx_FusedFunction_New(PyTypeObject * type,PyMethodDef * ml,int flags,PyObject * qualname,PyObject * self,PyObject * module,PyObject * globals,PyObject * code)59207 __pyx_FusedFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags,
59208                         PyObject *qualname, PyObject *self,
59209                         PyObject *module, PyObject *globals,
59210                         PyObject *code)
59211 {
59212     __pyx_FusedFunctionObject *fusedfunc =
59213         (__pyx_FusedFunctionObject *) __Pyx_CyFunction_New(type, ml, flags, qualname,
59214                                                            self, module, globals, code);
59215     if (!fusedfunc)
59216         return NULL;
59217     fusedfunc->__signatures__ = NULL;
59218     fusedfunc->type = NULL;
59219     fusedfunc->self = NULL;
59220     return (PyObject *) fusedfunc;
59221 }
59222 static void
__pyx_FusedFunction_dealloc(__pyx_FusedFunctionObject * self)59223 __pyx_FusedFunction_dealloc(__pyx_FusedFunctionObject *self)
59224 {
59225     PyObject_GC_UnTrack(self);
59226     Py_CLEAR(self->self);
59227     Py_CLEAR(self->type);
59228     Py_CLEAR(self->__signatures__);
59229     __Pyx__CyFunction_dealloc((__pyx_CyFunctionObject *) self);
59230 }
59231 static int
__pyx_FusedFunction_traverse(__pyx_FusedFunctionObject * self,visitproc visit,void * arg)59232 __pyx_FusedFunction_traverse(__pyx_FusedFunctionObject *self,
59233                              visitproc visit,
59234                              void *arg)
59235 {
59236     Py_VISIT(self->self);
59237     Py_VISIT(self->type);
59238     Py_VISIT(self->__signatures__);
59239     return __Pyx_CyFunction_traverse((__pyx_CyFunctionObject *) self, visit, arg);
59240 }
59241 static int
__pyx_FusedFunction_clear(__pyx_FusedFunctionObject * self)59242 __pyx_FusedFunction_clear(__pyx_FusedFunctionObject *self)
59243 {
59244     Py_CLEAR(self->self);
59245     Py_CLEAR(self->type);
59246     Py_CLEAR(self->__signatures__);
59247     return __Pyx_CyFunction_clear((__pyx_CyFunctionObject *) self);
59248 }
59249 static PyObject *
__pyx_FusedFunction_descr_get(PyObject * self,PyObject * obj,PyObject * type)59250 __pyx_FusedFunction_descr_get(PyObject *self, PyObject *obj, PyObject *type)
59251 {
59252     __pyx_FusedFunctionObject *func, *meth;
59253     func = (__pyx_FusedFunctionObject *) self;
59254     if (func->self || func->func.flags & __Pyx_CYFUNCTION_STATICMETHOD) {
59255         Py_INCREF(self);
59256         return self;
59257     }
59258     if (obj == Py_None)
59259         obj = NULL;
59260     meth = (__pyx_FusedFunctionObject *) __pyx_FusedFunction_NewEx(
59261                     ((PyCFunctionObject *) func)->m_ml,
59262                     ((__pyx_CyFunctionObject *) func)->flags,
59263                     ((__pyx_CyFunctionObject *) func)->func_qualname,
59264                     ((__pyx_CyFunctionObject *) func)->func_closure,
59265                     ((PyCFunctionObject *) func)->m_module,
59266                     ((__pyx_CyFunctionObject *) func)->func_globals,
59267                     ((__pyx_CyFunctionObject *) func)->func_code);
59268     if (!meth)
59269         return NULL;
59270     Py_XINCREF(func->func.func_classobj);
59271     meth->func.func_classobj = func->func.func_classobj;
59272     Py_XINCREF(func->__signatures__);
59273     meth->__signatures__ = func->__signatures__;
59274     Py_XINCREF(type);
59275     meth->type = type;
59276     Py_XINCREF(func->func.defaults_tuple);
59277     meth->func.defaults_tuple = func->func.defaults_tuple;
59278     if (func->func.flags & __Pyx_CYFUNCTION_CLASSMETHOD)
59279         obj = type;
59280     Py_XINCREF(obj);
59281     meth->self = obj;
59282     return (PyObject *) meth;
59283 }
59284 static PyObject *
_obj_to_str(PyObject * obj)59285 _obj_to_str(PyObject *obj)
59286 {
59287     if (PyType_Check(obj))
59288         return PyObject_GetAttr(obj, __pyx_n_s_name_2);
59289     else
59290         return PyObject_Str(obj);
59291 }
59292 static PyObject *
__pyx_FusedFunction_getitem(__pyx_FusedFunctionObject * self,PyObject * idx)59293 __pyx_FusedFunction_getitem(__pyx_FusedFunctionObject *self, PyObject *idx)
59294 {
59295     PyObject *signature = NULL;
59296     PyObject *unbound_result_func;
59297     PyObject *result_func = NULL;
59298     if (self->__signatures__ == NULL) {
59299         PyErr_SetString(PyExc_TypeError, "Function is not fused");
59300         return NULL;
59301     }
59302     if (PyTuple_Check(idx)) {
59303         PyObject *list = PyList_New(0);
59304         Py_ssize_t n = PyTuple_GET_SIZE(idx);
59305         PyObject *string = NULL;
59306         PyObject *sep = NULL;
59307         int i;
59308         if (!list)
59309             return NULL;
59310         for (i = 0; i < n; i++) {
59311 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
59312             PyObject *item = PyTuple_GET_ITEM(idx, i);
59313 #else
59314             PyObject *item = PySequence_ITEM(idx, i);
59315 #endif
59316             string = _obj_to_str(item);
59317 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
59318             Py_DECREF(item);
59319 #endif
59320             if (!string || PyList_Append(list, string) < 0)
59321                 goto __pyx_err;
59322             Py_DECREF(string);
59323         }
59324         sep = PyUnicode_FromString("|");
59325         if (sep)
59326             signature = PyUnicode_Join(sep, list);
59327 __pyx_err:
59328 ;
59329         Py_DECREF(list);
59330         Py_XDECREF(sep);
59331     } else {
59332         signature = _obj_to_str(idx);
59333     }
59334     if (!signature)
59335         return NULL;
59336     unbound_result_func = PyObject_GetItem(self->__signatures__, signature);
59337     if (unbound_result_func) {
59338         if (self->self || self->type) {
59339             __pyx_FusedFunctionObject *unbound = (__pyx_FusedFunctionObject *) unbound_result_func;
59340             Py_CLEAR(unbound->func.func_classobj);
59341             Py_XINCREF(self->func.func_classobj);
59342             unbound->func.func_classobj = self->func.func_classobj;
59343             result_func = __pyx_FusedFunction_descr_get(unbound_result_func,
59344                                                         self->self, self->type);
59345         } else {
59346             result_func = unbound_result_func;
59347             Py_INCREF(result_func);
59348         }
59349     }
59350     Py_DECREF(signature);
59351     Py_XDECREF(unbound_result_func);
59352     return result_func;
59353 }
59354 static PyObject *
__pyx_FusedFunction_callfunction(PyObject * func,PyObject * args,PyObject * kw)59355 __pyx_FusedFunction_callfunction(PyObject *func, PyObject *args, PyObject *kw)
59356 {
59357      __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
59358     int static_specialized = (cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD &&
59359                               !((__pyx_FusedFunctionObject *) func)->__signatures__);
59360     if (cyfunc->flags & __Pyx_CYFUNCTION_CCLASS && !static_specialized) {
59361         return __Pyx_CyFunction_CallAsMethod(func, args, kw);
59362     } else {
59363         return __Pyx_CyFunction_Call(func, args, kw);
59364     }
59365 }
59366 static PyObject *
__pyx_FusedFunction_call(PyObject * func,PyObject * args,PyObject * kw)59367 __pyx_FusedFunction_call(PyObject *func, PyObject *args, PyObject *kw)
59368 {
59369     __pyx_FusedFunctionObject *binding_func = (__pyx_FusedFunctionObject *) func;
59370     Py_ssize_t argc = PyTuple_GET_SIZE(args);
59371     PyObject *new_args = NULL;
59372     __pyx_FusedFunctionObject *new_func = NULL;
59373     PyObject *result = NULL;
59374     PyObject *self = NULL;
59375     int is_staticmethod = binding_func->func.flags & __Pyx_CYFUNCTION_STATICMETHOD;
59376     int is_classmethod = binding_func->func.flags & __Pyx_CYFUNCTION_CLASSMETHOD;
59377     if (binding_func->self) {
59378         Py_ssize_t i;
59379         new_args = PyTuple_New(argc + 1);
59380         if (!new_args)
59381             return NULL;
59382         self = binding_func->self;
59383 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
59384         Py_INCREF(self);
59385 #endif
59386         Py_INCREF(self);
59387         PyTuple_SET_ITEM(new_args, 0, self);
59388         for (i = 0; i < argc; i++) {
59389 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
59390             PyObject *item = PyTuple_GET_ITEM(args, i);
59391             Py_INCREF(item);
59392 #else
59393             PyObject *item = PySequence_ITEM(args, i);  if (unlikely(!item)) goto bad;
59394 #endif
59395             PyTuple_SET_ITEM(new_args, i + 1, item);
59396         }
59397         args = new_args;
59398     } else if (binding_func->type) {
59399         if (argc < 1) {
59400             PyErr_SetString(PyExc_TypeError, "Need at least one argument, 0 given.");
59401             return NULL;
59402         }
59403 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
59404         self = PyTuple_GET_ITEM(args, 0);
59405 #else
59406         self = PySequence_ITEM(args, 0);  if (unlikely(!self)) return NULL;
59407 #endif
59408     }
59409     if (self && !is_classmethod && !is_staticmethod) {
59410         int is_instance = PyObject_IsInstance(self, binding_func->type);
59411         if (unlikely(!is_instance)) {
59412             PyErr_Format(PyExc_TypeError,
59413                          "First argument should be of type %.200s, got %.200s.",
59414                          ((PyTypeObject *) binding_func->type)->tp_name,
59415                          self->ob_type->tp_name);
59416             goto bad;
59417         } else if (unlikely(is_instance == -1)) {
59418             goto bad;
59419         }
59420     }
59421 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
59422     Py_XDECREF(self);
59423     self = NULL;
59424 #endif
59425     if (binding_func->__signatures__) {
59426         PyObject *tup;
59427         if (is_staticmethod && binding_func->func.flags & __Pyx_CYFUNCTION_CCLASS) {
59428             tup = PyTuple_Pack(3, args,
59429                                kw == NULL ? Py_None : kw,
59430                                binding_func->func.defaults_tuple);
59431             if (unlikely(!tup)) goto bad;
59432             new_func = (__pyx_FusedFunctionObject *) __Pyx_CyFunction_CallMethod(
59433                 func, binding_func->__signatures__, tup, NULL);
59434         } else {
59435             tup = PyTuple_Pack(4, binding_func->__signatures__, args,
59436                                kw == NULL ? Py_None : kw,
59437                                binding_func->func.defaults_tuple);
59438             if (unlikely(!tup)) goto bad;
59439             new_func = (__pyx_FusedFunctionObject *) __pyx_FusedFunction_callfunction(func, tup, NULL);
59440         }
59441         Py_DECREF(tup);
59442         if (unlikely(!new_func))
59443             goto bad;
59444         Py_XINCREF(binding_func->func.func_classobj);
59445         Py_CLEAR(new_func->func.func_classobj);
59446         new_func->func.func_classobj = binding_func->func.func_classobj;
59447         func = (PyObject *) new_func;
59448     }
59449     result = __pyx_FusedFunction_callfunction(func, args, kw);
59450 bad:
59451 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
59452     Py_XDECREF(self);
59453 #endif
59454     Py_XDECREF(new_args);
59455     Py_XDECREF((PyObject *) new_func);
59456     return result;
59457 }
59458 static PyMemberDef __pyx_FusedFunction_members[] = {
59459     {(char *) "__signatures__",
59460      T_OBJECT,
59461      offsetof(__pyx_FusedFunctionObject, __signatures__),
59462      READONLY,
59463      0},
59464     {0, 0, 0, 0, 0},
59465 };
59466 static PyMappingMethods __pyx_FusedFunction_mapping_methods = {
59467     0,
59468     (binaryfunc) __pyx_FusedFunction_getitem,
59469     0,
59470 };
59471 static PyTypeObject __pyx_FusedFunctionType_type = {
59472     PyVarObject_HEAD_INIT(0, 0)
59473     "fused_cython_function",
59474     sizeof(__pyx_FusedFunctionObject),
59475     0,
59476     (destructor) __pyx_FusedFunction_dealloc,
59477     0,
59478     0,
59479     0,
59480 #if PY_MAJOR_VERSION < 3
59481     0,
59482 #else
59483     0,
59484 #endif
59485     0,
59486     0,
59487     0,
59488     &__pyx_FusedFunction_mapping_methods,
59489     0,
59490     (ternaryfunc) __pyx_FusedFunction_call,
59491     0,
59492     0,
59493     0,
59494     0,
59495     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
59496     0,
59497     (traverseproc) __pyx_FusedFunction_traverse,
59498     (inquiry) __pyx_FusedFunction_clear,
59499     0,
59500     0,
59501     0,
59502     0,
59503     0,
59504     __pyx_FusedFunction_members,
59505     __pyx_CyFunction_getsets,
59506     &__pyx_CyFunctionType_type,
59507     0,
59508     __pyx_FusedFunction_descr_get,
59509     0,
59510     0,
59511     0,
59512     0,
59513     0,
59514     0,
59515     0,
59516     0,
59517     0,
59518     0,
59519     0,
59520     0,
59521     0,
59522     0,
59523 #if PY_VERSION_HEX >= 0x030400a1
59524     0,
59525 #endif
59526 #if PY_VERSION_HEX >= 0x030800b1
59527     0,
59528 #endif
59529 };
__pyx_FusedFunction_init(void)59530 static int __pyx_FusedFunction_init(void) {
59531     __pyx_FusedFunctionType = __Pyx_FetchCommonType(&__pyx_FusedFunctionType_type);
59532     if (__pyx_FusedFunctionType == NULL) {
59533         return -1;
59534     }
59535     return 0;
59536 }
59537 
59538 /* CLineInTraceback */
59539   #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(PyThreadState * tstate,int c_line)59540 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
59541     PyObject *use_cline;
59542     PyObject *ptype, *pvalue, *ptraceback;
59543 #if CYTHON_COMPILING_IN_CPYTHON
59544     PyObject **cython_runtime_dict;
59545 #endif
59546     if (unlikely(!__pyx_cython_runtime)) {
59547         return c_line;
59548     }
59549     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
59550 #if CYTHON_COMPILING_IN_CPYTHON
59551     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
59552     if (likely(cython_runtime_dict)) {
59553         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
59554             use_cline, *cython_runtime_dict,
59555             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
59556     } else
59557 #endif
59558     {
59559       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
59560       if (use_cline_obj) {
59561         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
59562         Py_DECREF(use_cline_obj);
59563       } else {
59564         PyErr_Clear();
59565         use_cline = NULL;
59566       }
59567     }
59568     if (!use_cline) {
59569         c_line = 0;
59570         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
59571     }
59572     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
59573         c_line = 0;
59574     }
59575     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
59576     return c_line;
59577 }
59578 #endif
59579 
59580 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)59581   static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
59582     int start = 0, mid = 0, end = count - 1;
59583     if (end >= 0 && code_line > entries[end].code_line) {
59584         return count;
59585     }
59586     while (start < end) {
59587         mid = start + (end - start) / 2;
59588         if (code_line < entries[mid].code_line) {
59589             end = mid;
59590         } else if (code_line > entries[mid].code_line) {
59591              start = mid + 1;
59592         } else {
59593             return mid;
59594         }
59595     }
59596     if (code_line <= entries[mid].code_line) {
59597         return mid;
59598     } else {
59599         return mid + 1;
59600     }
59601 }
__pyx_find_code_object(int code_line)59602 static PyCodeObject *__pyx_find_code_object(int code_line) {
59603     PyCodeObject* code_object;
59604     int pos;
59605     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
59606         return NULL;
59607     }
59608     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
59609     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
59610         return NULL;
59611     }
59612     code_object = __pyx_code_cache.entries[pos].code_object;
59613     Py_INCREF(code_object);
59614     return code_object;
59615 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)59616 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
59617     int pos, i;
59618     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
59619     if (unlikely(!code_line)) {
59620         return;
59621     }
59622     if (unlikely(!entries)) {
59623         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
59624         if (likely(entries)) {
59625             __pyx_code_cache.entries = entries;
59626             __pyx_code_cache.max_count = 64;
59627             __pyx_code_cache.count = 1;
59628             entries[0].code_line = code_line;
59629             entries[0].code_object = code_object;
59630             Py_INCREF(code_object);
59631         }
59632         return;
59633     }
59634     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
59635     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
59636         PyCodeObject* tmp = entries[pos].code_object;
59637         entries[pos].code_object = code_object;
59638         Py_DECREF(tmp);
59639         return;
59640     }
59641     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
59642         int new_max = __pyx_code_cache.max_count + 64;
59643         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
59644             __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
59645         if (unlikely(!entries)) {
59646             return;
59647         }
59648         __pyx_code_cache.entries = entries;
59649         __pyx_code_cache.max_count = new_max;
59650     }
59651     for (i=__pyx_code_cache.count; i>pos; i--) {
59652         entries[i] = entries[i-1];
59653     }
59654     entries[pos].code_line = code_line;
59655     entries[pos].code_object = code_object;
59656     __pyx_code_cache.count++;
59657     Py_INCREF(code_object);
59658 }
59659 
59660 /* AddTraceback */
59661   #include "compile.h"
59662 #include "frameobject.h"
59663 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)59664 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
59665             const char *funcname, int c_line,
59666             int py_line, const char *filename) {
59667     PyCodeObject *py_code = 0;
59668     PyObject *py_srcfile = 0;
59669     PyObject *py_funcname = 0;
59670     #if PY_MAJOR_VERSION < 3
59671     py_srcfile = PyString_FromString(filename);
59672     #else
59673     py_srcfile = PyUnicode_FromString(filename);
59674     #endif
59675     if (!py_srcfile) goto bad;
59676     if (c_line) {
59677         #if PY_MAJOR_VERSION < 3
59678         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
59679         #else
59680         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
59681         #endif
59682     }
59683     else {
59684         #if PY_MAJOR_VERSION < 3
59685         py_funcname = PyString_FromString(funcname);
59686         #else
59687         py_funcname = PyUnicode_FromString(funcname);
59688         #endif
59689     }
59690     if (!py_funcname) goto bad;
59691     py_code = __Pyx_PyCode_New(
59692         0,
59693         0,
59694         0,
59695         0,
59696         0,
59697         __pyx_empty_bytes, /*PyObject *code,*/
59698         __pyx_empty_tuple, /*PyObject *consts,*/
59699         __pyx_empty_tuple, /*PyObject *names,*/
59700         __pyx_empty_tuple, /*PyObject *varnames,*/
59701         __pyx_empty_tuple, /*PyObject *freevars,*/
59702         __pyx_empty_tuple, /*PyObject *cellvars,*/
59703         py_srcfile,   /*PyObject *filename,*/
59704         py_funcname,  /*PyObject *name,*/
59705         py_line,
59706         __pyx_empty_bytes  /*PyObject *lnotab*/
59707     );
59708     Py_DECREF(py_srcfile);
59709     Py_DECREF(py_funcname);
59710     return py_code;
59711 bad:
59712     Py_XDECREF(py_srcfile);
59713     Py_XDECREF(py_funcname);
59714     return NULL;
59715 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)59716 static void __Pyx_AddTraceback(const char *funcname, int c_line,
59717                                int py_line, const char *filename) {
59718     PyCodeObject *py_code = 0;
59719     PyFrameObject *py_frame = 0;
59720     PyThreadState *tstate = __Pyx_PyThreadState_Current;
59721     if (c_line) {
59722         c_line = __Pyx_CLineForTraceback(tstate, c_line);
59723     }
59724     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
59725     if (!py_code) {
59726         py_code = __Pyx_CreateCodeObjectForTraceback(
59727             funcname, c_line, py_line, filename);
59728         if (!py_code) goto bad;
59729         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
59730     }
59731     py_frame = PyFrame_New(
59732         tstate,            /*PyThreadState *tstate,*/
59733         py_code,           /*PyCodeObject *code,*/
59734         __pyx_d,    /*PyObject *globals,*/
59735         0                  /*PyObject *locals*/
59736     );
59737     if (!py_frame) goto bad;
59738     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
59739     PyTraceBack_Here(py_frame);
59740 bad:
59741     Py_XDECREF(py_code);
59742     Py_XDECREF(py_frame);
59743 }
59744 
59745 #if PY_MAJOR_VERSION < 3
__Pyx_GetBuffer(PyObject * obj,Py_buffer * view,int flags)59746 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
59747     if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
59748         if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
59749         if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
59750         if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
59751     PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
59752     return -1;
59753 }
__Pyx_ReleaseBuffer(Py_buffer * view)59754 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
59755     PyObject *obj = view->obj;
59756     if (!obj) return;
59757     if (PyObject_CheckBuffer(obj)) {
59758         PyBuffer_Release(view);
59759         return;
59760     }
59761     if ((0)) {}
59762         else if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view);
59763     view->obj = NULL;
59764     Py_DECREF(obj);
59765 }
59766 #endif
59767 
59768 
59769   /* MemviewSliceIsContig */
59770   static int
__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs,char order,int ndim)59771 __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
59772 {
59773     int i, index, step, start;
59774     Py_ssize_t itemsize = mvs.memview->view.itemsize;
59775     if (order == 'F') {
59776         step = 1;
59777         start = 0;
59778     } else {
59779         step = -1;
59780         start = ndim - 1;
59781     }
59782     for (i = 0; i < ndim; i++) {
59783         index = start + step * i;
59784         if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
59785             return 0;
59786         itemsize *= mvs.shape[index];
59787     }
59788     return 1;
59789 }
59790 
59791 /* OverlappingSlices */
59792   static void
__pyx_get_array_memory_extents(__Pyx_memviewslice * slice,void ** out_start,void ** out_end,int ndim,size_t itemsize)59793 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
59794                                void **out_start, void **out_end,
59795                                int ndim, size_t itemsize)
59796 {
59797     char *start, *end;
59798     int i;
59799     start = end = slice->data;
59800     for (i = 0; i < ndim; i++) {
59801         Py_ssize_t stride = slice->strides[i];
59802         Py_ssize_t extent = slice->shape[i];
59803         if (extent == 0) {
59804             *out_start = *out_end = start;
59805             return;
59806         } else {
59807             if (stride > 0)
59808                 end += stride * (extent - 1);
59809             else
59810                 start += stride * (extent - 1);
59811         }
59812     }
59813     *out_start = start;
59814     *out_end = end + itemsize;
59815 }
59816 static int
__pyx_slices_overlap(__Pyx_memviewslice * slice1,__Pyx_memviewslice * slice2,int ndim,size_t itemsize)59817 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
59818                      __Pyx_memviewslice *slice2,
59819                      int ndim, size_t itemsize)
59820 {
59821     void *start1, *end1, *start2, *end2;
59822     __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
59823     __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
59824     return (start1 < end2) && (start2 < end1);
59825 }
59826 
59827 /* Capsule */
59828   static CYTHON_INLINE PyObject *
__pyx_capsule_create(void * p,CYTHON_UNUSED const char * sig)59829 __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
59830 {
59831     PyObject *cobj;
59832 #if PY_VERSION_HEX >= 0x02070000
59833     cobj = PyCapsule_New(p, sig, NULL);
59834 #else
59835     cobj = PyCObject_FromVoidPtr(p, NULL);
59836 #endif
59837     return cobj;
59838 }
59839 
59840 /* CIntFromPyVerify */
59841   #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
59842     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
59843 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
59844     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
59845 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
59846     {\
59847         func_type value = func_value;\
59848         if (sizeof(target_type) < sizeof(func_type)) {\
59849             if (unlikely(value != (func_type) (target_type) value)) {\
59850                 func_type zero = 0;\
59851                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
59852                     return (target_type) -1;\
59853                 if (is_unsigned && unlikely(value < zero))\
59854                     goto raise_neg_overflow;\
59855                 else\
59856                     goto raise_overflow;\
59857             }\
59858         }\
59859         return (target_type) value;\
59860     }
59861 
59862 /* TypeInfoCompare */
59863   static int
__pyx_typeinfo_cmp(__Pyx_TypeInfo * a,__Pyx_TypeInfo * b)59864 __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
59865 {
59866     int i;
59867     if (!a || !b)
59868         return 0;
59869     if (a == b)
59870         return 1;
59871     if (a->size != b->size || a->typegroup != b->typegroup ||
59872             a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
59873         if (a->typegroup == 'H' || b->typegroup == 'H') {
59874             return a->size == b->size;
59875         } else {
59876             return 0;
59877         }
59878     }
59879     if (a->ndim) {
59880         for (i = 0; i < a->ndim; i++)
59881             if (a->arraysize[i] != b->arraysize[i])
59882                 return 0;
59883     }
59884     if (a->typegroup == 'S') {
59885         if (a->flags != b->flags)
59886             return 0;
59887         if (a->fields || b->fields) {
59888             if (!(a->fields && b->fields))
59889                 return 0;
59890             for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
59891                 __Pyx_StructField *field_a = a->fields + i;
59892                 __Pyx_StructField *field_b = b->fields + i;
59893                 if (field_a->offset != field_b->offset ||
59894                     !__pyx_typeinfo_cmp(field_a->type, field_b->type))
59895                     return 0;
59896             }
59897             return !a->fields[i].type && !b->fields[i].type;
59898         }
59899     }
59900     return 1;
59901 }
59902 
59903 /* MemviewSliceValidateAndInit */
59904   static int
__pyx_check_strides(Py_buffer * buf,int dim,int ndim,int spec)59905 __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
59906 {
59907     if (buf->shape[dim] <= 1)
59908         return 1;
59909     if (buf->strides) {
59910         if (spec & __Pyx_MEMVIEW_CONTIG) {
59911             if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
59912                 if (buf->strides[dim] != sizeof(void *)) {
59913                     PyErr_Format(PyExc_ValueError,
59914                                  "Buffer is not indirectly contiguous "
59915                                  "in dimension %d.", dim);
59916                     goto fail;
59917                 }
59918             } else if (buf->strides[dim] != buf->itemsize) {
59919                 PyErr_SetString(PyExc_ValueError,
59920                                 "Buffer and memoryview are not contiguous "
59921                                 "in the same dimension.");
59922                 goto fail;
59923             }
59924         }
59925         if (spec & __Pyx_MEMVIEW_FOLLOW) {
59926             Py_ssize_t stride = buf->strides[dim];
59927             if (stride < 0)
59928                 stride = -stride;
59929             if (stride < buf->itemsize) {
59930                 PyErr_SetString(PyExc_ValueError,
59931                                 "Buffer and memoryview are not contiguous "
59932                                 "in the same dimension.");
59933                 goto fail;
59934             }
59935         }
59936     } else {
59937         if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) {
59938             PyErr_Format(PyExc_ValueError,
59939                          "C-contiguous buffer is not contiguous in "
59940                          "dimension %d", dim);
59941             goto fail;
59942         } else if (spec & (__Pyx_MEMVIEW_PTR)) {
59943             PyErr_Format(PyExc_ValueError,
59944                          "C-contiguous buffer is not indirect in "
59945                          "dimension %d", dim);
59946             goto fail;
59947         } else if (buf->suboffsets) {
59948             PyErr_SetString(PyExc_ValueError,
59949                             "Buffer exposes suboffsets but no strides");
59950             goto fail;
59951         }
59952     }
59953     return 1;
59954 fail:
59955     return 0;
59956 }
59957 static int
__pyx_check_suboffsets(Py_buffer * buf,int dim,CYTHON_UNUSED int ndim,int spec)59958 __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
59959 {
59960     if (spec & __Pyx_MEMVIEW_DIRECT) {
59961         if (buf->suboffsets && buf->suboffsets[dim] >= 0) {
59962             PyErr_Format(PyExc_ValueError,
59963                          "Buffer not compatible with direct access "
59964                          "in dimension %d.", dim);
59965             goto fail;
59966         }
59967     }
59968     if (spec & __Pyx_MEMVIEW_PTR) {
59969         if (!buf->suboffsets || (buf->suboffsets[dim] < 0)) {
59970             PyErr_Format(PyExc_ValueError,
59971                          "Buffer is not indirectly accessible "
59972                          "in dimension %d.", dim);
59973             goto fail;
59974         }
59975     }
59976     return 1;
59977 fail:
59978     return 0;
59979 }
59980 static int
__pyx_verify_contig(Py_buffer * buf,int ndim,int c_or_f_flag)59981 __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
59982 {
59983     int i;
59984     if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
59985         Py_ssize_t stride = 1;
59986         for (i = 0; i < ndim; i++) {
59987             if (stride * buf->itemsize != buf->strides[i] &&
59988                     buf->shape[i] > 1)
59989             {
59990                 PyErr_SetString(PyExc_ValueError,
59991                     "Buffer not fortran contiguous.");
59992                 goto fail;
59993             }
59994             stride = stride * buf->shape[i];
59995         }
59996     } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
59997         Py_ssize_t stride = 1;
59998         for (i = ndim - 1; i >- 1; i--) {
59999             if (stride * buf->itemsize != buf->strides[i] &&
60000                     buf->shape[i] > 1) {
60001                 PyErr_SetString(PyExc_ValueError,
60002                     "Buffer not C contiguous.");
60003                 goto fail;
60004             }
60005             stride = stride * buf->shape[i];
60006         }
60007     }
60008     return 1;
60009 fail:
60010     return 0;
60011 }
__Pyx_ValidateAndInit_memviewslice(int * axes_specs,int c_or_f_flag,int buf_flags,int ndim,__Pyx_TypeInfo * dtype,__Pyx_BufFmt_StackElem stack[],__Pyx_memviewslice * memviewslice,PyObject * original_obj)60012 static int __Pyx_ValidateAndInit_memviewslice(
60013                 int *axes_specs,
60014                 int c_or_f_flag,
60015                 int buf_flags,
60016                 int ndim,
60017                 __Pyx_TypeInfo *dtype,
60018                 __Pyx_BufFmt_StackElem stack[],
60019                 __Pyx_memviewslice *memviewslice,
60020                 PyObject *original_obj)
60021 {
60022     struct __pyx_memoryview_obj *memview, *new_memview;
60023     __Pyx_RefNannyDeclarations
60024     Py_buffer *buf;
60025     int i, spec = 0, retval = -1;
60026     __Pyx_BufFmt_Context ctx;
60027     int from_memoryview = __pyx_memoryview_check(original_obj);
60028     __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
60029     if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
60030                                                             original_obj)->typeinfo)) {
60031         memview = (struct __pyx_memoryview_obj *) original_obj;
60032         new_memview = NULL;
60033     } else {
60034         memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
60035                                             original_obj, buf_flags, 0, dtype);
60036         new_memview = memview;
60037         if (unlikely(!memview))
60038             goto fail;
60039     }
60040     buf = &memview->view;
60041     if (buf->ndim != ndim) {
60042         PyErr_Format(PyExc_ValueError,
60043                 "Buffer has wrong number of dimensions (expected %d, got %d)",
60044                 ndim, buf->ndim);
60045         goto fail;
60046     }
60047     if (new_memview) {
60048         __Pyx_BufFmt_Init(&ctx, stack, dtype);
60049         if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
60050     }
60051     if ((unsigned) buf->itemsize != dtype->size) {
60052         PyErr_Format(PyExc_ValueError,
60053                      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
60054                      "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
60055                      buf->itemsize,
60056                      (buf->itemsize > 1) ? "s" : "",
60057                      dtype->name,
60058                      dtype->size,
60059                      (dtype->size > 1) ? "s" : "");
60060         goto fail;
60061     }
60062     for (i = 0; i < ndim; i++) {
60063         spec = axes_specs[i];
60064         if (!__pyx_check_strides(buf, i, ndim, spec))
60065             goto fail;
60066         if (!__pyx_check_suboffsets(buf, i, ndim, spec))
60067             goto fail;
60068     }
60069     if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))
60070         goto fail;
60071     if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
60072                                          new_memview != NULL) == -1)) {
60073         goto fail;
60074     }
60075     retval = 0;
60076     goto no_fail;
60077 fail:
60078     Py_XDECREF(new_memview);
60079     retval = -1;
60080 no_fail:
60081     __Pyx_RefNannyFinishContext();
60082     return retval;
60083 }
60084 
60085 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject * obj,int writable_flag)60086   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *obj, int writable_flag) {
60087     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
60088     __Pyx_BufFmt_StackElem stack[1];
60089     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
60090     int retcode;
60091     if (obj == Py_None) {
60092         result.memview = (struct __pyx_memoryview_obj *) Py_None;
60093         return result;
60094     }
60095     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
60096                                                  PyBUF_RECORDS_RO | writable_flag, 2,
60097                                                  &__Pyx_TypeInfo_float, stack,
60098                                                  &result, obj);
60099     if (unlikely(retcode == -1))
60100         goto __pyx_fail;
60101     return result;
60102 __pyx_fail:
60103     result.memview = NULL;
60104     result.data = NULL;
60105     return result;
60106 }
60107 
60108 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_dsds_double(PyObject * obj,int writable_flag)60109   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_double(PyObject *obj, int writable_flag) {
60110     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
60111     __Pyx_BufFmt_StackElem stack[1];
60112     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
60113     int retcode;
60114     if (obj == Py_None) {
60115         result.memview = (struct __pyx_memoryview_obj *) Py_None;
60116         return result;
60117     }
60118     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
60119                                                  PyBUF_RECORDS_RO | writable_flag, 2,
60120                                                  &__Pyx_TypeInfo_double, stack,
60121                                                  &result, obj);
60122     if (unlikely(retcode == -1))
60123         goto __pyx_fail;
60124     return result;
60125 __pyx_fail:
60126     result.memview = NULL;
60127     result.data = NULL;
60128     return result;
60129 }
60130 
60131 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject * obj,int writable_flag)60132   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *obj, int writable_flag) {
60133     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
60134     __Pyx_BufFmt_StackElem stack[1];
60135     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
60136     int retcode;
60137     if (obj == Py_None) {
60138         result.memview = (struct __pyx_memoryview_obj *) Py_None;
60139         return result;
60140     }
60141     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
60142                                                  PyBUF_RECORDS_RO | writable_flag, 1,
60143                                                  &__Pyx_TypeInfo_float, stack,
60144                                                  &result, obj);
60145     if (unlikely(retcode == -1))
60146         goto __pyx_fail;
60147     return result;
60148 __pyx_fail:
60149     result.memview = NULL;
60150     result.data = NULL;
60151     return result;
60152 }
60153 
60154 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject * obj,int writable_flag)60155   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *obj, int writable_flag) {
60156     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
60157     __Pyx_BufFmt_StackElem stack[1];
60158     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
60159     int retcode;
60160     if (obj == Py_None) {
60161         result.memview = (struct __pyx_memoryview_obj *) Py_None;
60162         return result;
60163     }
60164     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
60165                                                  PyBUF_RECORDS_RO | writable_flag, 1,
60166                                                  &__Pyx_TypeInfo_double, stack,
60167                                                  &result, obj);
60168     if (unlikely(retcode == -1))
60169         goto __pyx_fail;
60170     return result;
60171 __pyx_fail:
60172     result.memview = NULL;
60173     result.data = NULL;
60174     return result;
60175 }
60176 
60177 /* CIntToPy */
__Pyx_PyInt_From_npy_int64(npy_int64 value)60178   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int64(npy_int64 value) {
60179     const npy_int64 neg_one = (npy_int64) ((npy_int64) 0 - (npy_int64) 1), const_zero = (npy_int64) 0;
60180     const int is_unsigned = neg_one > const_zero;
60181     if (is_unsigned) {
60182         if (sizeof(npy_int64) < sizeof(long)) {
60183             return PyInt_FromLong((long) value);
60184         } else if (sizeof(npy_int64) <= sizeof(unsigned long)) {
60185             return PyLong_FromUnsignedLong((unsigned long) value);
60186 #ifdef HAVE_LONG_LONG
60187         } else if (sizeof(npy_int64) <= sizeof(unsigned PY_LONG_LONG)) {
60188             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
60189 #endif
60190         }
60191     } else {
60192         if (sizeof(npy_int64) <= sizeof(long)) {
60193             return PyInt_FromLong((long) value);
60194 #ifdef HAVE_LONG_LONG
60195         } else if (sizeof(npy_int64) <= sizeof(PY_LONG_LONG)) {
60196             return PyLong_FromLongLong((PY_LONG_LONG) value);
60197 #endif
60198         }
60199     }
60200     {
60201         int one = 1; int little = (int)*(unsigned char *)&one;
60202         unsigned char *bytes = (unsigned char *)&value;
60203         return _PyLong_FromByteArray(bytes, sizeof(npy_int64),
60204                                      little, !is_unsigned);
60205     }
60206 }
60207 
60208 /* None */
__Pyx_pow___pyx_t_5numpy_int64_t(__pyx_t_5numpy_int64_t b,__pyx_t_5numpy_int64_t e)60209   static CYTHON_INLINE __pyx_t_5numpy_int64_t __Pyx_pow___pyx_t_5numpy_int64_t(__pyx_t_5numpy_int64_t b, __pyx_t_5numpy_int64_t e) {
60210     __pyx_t_5numpy_int64_t t = b;
60211     switch (e) {
60212         case 3:
60213             t *= b;
60214         CYTHON_FALLTHROUGH;
60215         case 2:
60216             t *= b;
60217         CYTHON_FALLTHROUGH;
60218         case 1:
60219             return t;
60220         case 0:
60221             return 1;
60222     }
60223     #if 1
60224     if (unlikely(e<0)) return 0;
60225     #endif
60226     t = 1;
60227     while (likely(e)) {
60228         t *= (b * (e&1)) | ((~e)&1);
60229         b *= b;
60230         e >>= 1;
60231     }
60232     return t;
60233 }
60234 
60235 /* CIntToPy */
__Pyx_PyInt_From_npy_uint64(npy_uint64 value)60236   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_uint64(npy_uint64 value) {
60237     const npy_uint64 neg_one = (npy_uint64) ((npy_uint64) 0 - (npy_uint64) 1), const_zero = (npy_uint64) 0;
60238     const int is_unsigned = neg_one > const_zero;
60239     if (is_unsigned) {
60240         if (sizeof(npy_uint64) < sizeof(long)) {
60241             return PyInt_FromLong((long) value);
60242         } else if (sizeof(npy_uint64) <= sizeof(unsigned long)) {
60243             return PyLong_FromUnsignedLong((unsigned long) value);
60244 #ifdef HAVE_LONG_LONG
60245         } else if (sizeof(npy_uint64) <= sizeof(unsigned PY_LONG_LONG)) {
60246             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
60247 #endif
60248         }
60249     } else {
60250         if (sizeof(npy_uint64) <= sizeof(long)) {
60251             return PyInt_FromLong((long) value);
60252 #ifdef HAVE_LONG_LONG
60253         } else if (sizeof(npy_uint64) <= sizeof(PY_LONG_LONG)) {
60254             return PyLong_FromLongLong((PY_LONG_LONG) value);
60255 #endif
60256         }
60257     }
60258     {
60259         int one = 1; int little = (int)*(unsigned char *)&one;
60260         unsigned char *bytes = (unsigned char *)&value;
60261         return _PyLong_FromByteArray(bytes, sizeof(npy_uint64),
60262                                      little, !is_unsigned);
60263     }
60264 }
60265 
60266 /* CIntToPy */
__Pyx_PyInt_From_int(int value)60267   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
60268     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
60269     const int is_unsigned = neg_one > const_zero;
60270     if (is_unsigned) {
60271         if (sizeof(int) < sizeof(long)) {
60272             return PyInt_FromLong((long) value);
60273         } else if (sizeof(int) <= sizeof(unsigned long)) {
60274             return PyLong_FromUnsignedLong((unsigned long) value);
60275 #ifdef HAVE_LONG_LONG
60276         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
60277             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
60278 #endif
60279         }
60280     } else {
60281         if (sizeof(int) <= sizeof(long)) {
60282             return PyInt_FromLong((long) value);
60283 #ifdef HAVE_LONG_LONG
60284         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
60285             return PyLong_FromLongLong((PY_LONG_LONG) value);
60286 #endif
60287         }
60288     }
60289     {
60290         int one = 1; int little = (int)*(unsigned char *)&one;
60291         unsigned char *bytes = (unsigned char *)&value;
60292         return _PyLong_FromByteArray(bytes, sizeof(int),
60293                                      little, !is_unsigned);
60294     }
60295 }
60296 
60297 /* CIntToPy */
__Pyx_PyInt_From_long(long value)60298   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
60299     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
60300     const int is_unsigned = neg_one > const_zero;
60301     if (is_unsigned) {
60302         if (sizeof(long) < sizeof(long)) {
60303             return PyInt_FromLong((long) value);
60304         } else if (sizeof(long) <= sizeof(unsigned long)) {
60305             return PyLong_FromUnsignedLong((unsigned long) value);
60306 #ifdef HAVE_LONG_LONG
60307         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
60308             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
60309 #endif
60310         }
60311     } else {
60312         if (sizeof(long) <= sizeof(long)) {
60313             return PyInt_FromLong((long) value);
60314 #ifdef HAVE_LONG_LONG
60315         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
60316             return PyLong_FromLongLong((PY_LONG_LONG) value);
60317 #endif
60318         }
60319     }
60320     {
60321         int one = 1; int little = (int)*(unsigned char *)&one;
60322         unsigned char *bytes = (unsigned char *)&value;
60323         return _PyLong_FromByteArray(bytes, sizeof(long),
60324                                      little, !is_unsigned);
60325     }
60326 }
60327 
60328 /* CIntToPy */
__Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value)60329   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
60330     const Py_intptr_t neg_one = (Py_intptr_t) ((Py_intptr_t) 0 - (Py_intptr_t) 1), const_zero = (Py_intptr_t) 0;
60331     const int is_unsigned = neg_one > const_zero;
60332     if (is_unsigned) {
60333         if (sizeof(Py_intptr_t) < sizeof(long)) {
60334             return PyInt_FromLong((long) value);
60335         } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
60336             return PyLong_FromUnsignedLong((unsigned long) value);
60337 #ifdef HAVE_LONG_LONG
60338         } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
60339             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
60340 #endif
60341         }
60342     } else {
60343         if (sizeof(Py_intptr_t) <= sizeof(long)) {
60344             return PyInt_FromLong((long) value);
60345 #ifdef HAVE_LONG_LONG
60346         } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
60347             return PyLong_FromLongLong((PY_LONG_LONG) value);
60348 #endif
60349         }
60350     }
60351     {
60352         int one = 1; int little = (int)*(unsigned char *)&one;
60353         unsigned char *bytes = (unsigned char *)&value;
60354         return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
60355                                      little, !is_unsigned);
60356     }
60357 }
60358 
60359 /* CIntToPy */
__Pyx_PyInt_From_npy_uint32(npy_uint32 value)60360   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_uint32(npy_uint32 value) {
60361     const npy_uint32 neg_one = (npy_uint32) ((npy_uint32) 0 - (npy_uint32) 1), const_zero = (npy_uint32) 0;
60362     const int is_unsigned = neg_one > const_zero;
60363     if (is_unsigned) {
60364         if (sizeof(npy_uint32) < sizeof(long)) {
60365             return PyInt_FromLong((long) value);
60366         } else if (sizeof(npy_uint32) <= sizeof(unsigned long)) {
60367             return PyLong_FromUnsignedLong((unsigned long) value);
60368 #ifdef HAVE_LONG_LONG
60369         } else if (sizeof(npy_uint32) <= sizeof(unsigned PY_LONG_LONG)) {
60370             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
60371 #endif
60372         }
60373     } else {
60374         if (sizeof(npy_uint32) <= sizeof(long)) {
60375             return PyInt_FromLong((long) value);
60376 #ifdef HAVE_LONG_LONG
60377         } else if (sizeof(npy_uint32) <= sizeof(PY_LONG_LONG)) {
60378             return PyLong_FromLongLong((PY_LONG_LONG) value);
60379 #endif
60380         }
60381     }
60382     {
60383         int one = 1; int little = (int)*(unsigned char *)&one;
60384         unsigned char *bytes = (unsigned char *)&value;
60385         return _PyLong_FromByteArray(bytes, sizeof(npy_uint32),
60386                                      little, !is_unsigned);
60387     }
60388 }
60389 
60390 /* Print */
60391   #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
__Pyx_GetStdout(void)60392 static PyObject *__Pyx_GetStdout(void) {
60393     PyObject *f = PySys_GetObject((char *)"stdout");
60394     if (!f) {
60395         PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
60396     }
60397     return f;
60398 }
__Pyx_Print(PyObject * f,PyObject * arg_tuple,int newline)60399 static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
60400     int i;
60401     if (!f) {
60402         if (!(f = __Pyx_GetStdout()))
60403             return -1;
60404     }
60405     Py_INCREF(f);
60406     for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
60407         PyObject* v;
60408         if (PyFile_SoftSpace(f, 1)) {
60409             if (PyFile_WriteString(" ", f) < 0)
60410                 goto error;
60411         }
60412         v = PyTuple_GET_ITEM(arg_tuple, i);
60413         if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
60414             goto error;
60415         if (PyString_Check(v)) {
60416             char *s = PyString_AsString(v);
60417             Py_ssize_t len = PyString_Size(v);
60418             if (len > 0) {
60419                 switch (s[len-1]) {
60420                     case ' ': break;
60421                     case '\f': case '\r': case '\n': case '\t': case '\v':
60422                         PyFile_SoftSpace(f, 0);
60423                         break;
60424                     default:  break;
60425                 }
60426             }
60427         }
60428     }
60429     if (newline) {
60430         if (PyFile_WriteString("\n", f) < 0)
60431             goto error;
60432         PyFile_SoftSpace(f, 0);
60433     }
60434     Py_DECREF(f);
60435     return 0;
60436 error:
60437     Py_DECREF(f);
60438     return -1;
60439 }
60440 #else
__Pyx_Print(PyObject * stream,PyObject * arg_tuple,int newline)60441 static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
60442     PyObject* kwargs = 0;
60443     PyObject* result = 0;
60444     PyObject* end_string;
60445     if (unlikely(!__pyx_print)) {
60446         __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print);
60447         if (!__pyx_print)
60448             return -1;
60449     }
60450     if (stream) {
60451         kwargs = PyDict_New();
60452         if (unlikely(!kwargs))
60453             return -1;
60454         if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0))
60455             goto bad;
60456         if (!newline) {
60457             end_string = PyUnicode_FromStringAndSize(" ", 1);
60458             if (unlikely(!end_string))
60459                 goto bad;
60460             if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) {
60461                 Py_DECREF(end_string);
60462                 goto bad;
60463             }
60464             Py_DECREF(end_string);
60465         }
60466     } else if (!newline) {
60467         if (unlikely(!__pyx_print_kwargs)) {
60468             __pyx_print_kwargs = PyDict_New();
60469             if (unlikely(!__pyx_print_kwargs))
60470                 return -1;
60471             end_string = PyUnicode_FromStringAndSize(" ", 1);
60472             if (unlikely(!end_string))
60473                 return -1;
60474             if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) {
60475                 Py_DECREF(end_string);
60476                 return -1;
60477             }
60478             Py_DECREF(end_string);
60479         }
60480         kwargs = __pyx_print_kwargs;
60481     }
60482     result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
60483     if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
60484         Py_DECREF(kwargs);
60485     if (!result)
60486         return -1;
60487     Py_DECREF(result);
60488     return 0;
60489 bad:
60490     if (kwargs != __pyx_print_kwargs)
60491         Py_XDECREF(kwargs);
60492     return -1;
60493 }
60494 #endif
60495 
60496 /* MemviewDtypeToObject */
__pyx_memview_get_nn___pyx_t_5numpy_float64_t(const char * itemp)60497   static CYTHON_INLINE PyObject *__pyx_memview_get_nn___pyx_t_5numpy_float64_t(const char *itemp) {
60498     return (PyObject *) PyFloat_FromDouble(*(__pyx_t_5numpy_float64_t *) itemp);
60499 }
__pyx_memview_set_nn___pyx_t_5numpy_float64_t(const char * itemp,PyObject * obj)60500 static CYTHON_INLINE int __pyx_memview_set_nn___pyx_t_5numpy_float64_t(const char *itemp, PyObject *obj) {
60501     __pyx_t_5numpy_float64_t value = __pyx_PyFloat_AsDouble(obj);
60502     if ((value == ((npy_float64)-1)) && PyErr_Occurred())
60503         return 0;
60504     *(__pyx_t_5numpy_float64_t *) itemp = value;
60505     return 1;
60506 }
60507 
60508 /* MemviewDtypeToObject */
__pyx_memview_get_nn___pyx_t_5numpy_int64_t(const char * itemp)60509   static CYTHON_INLINE PyObject *__pyx_memview_get_nn___pyx_t_5numpy_int64_t(const char *itemp) {
60510     return (PyObject *) __Pyx_PyInt_From_npy_int64(*(__pyx_t_5numpy_int64_t *) itemp);
60511 }
__pyx_memview_set_nn___pyx_t_5numpy_int64_t(const char * itemp,PyObject * obj)60512 static CYTHON_INLINE int __pyx_memview_set_nn___pyx_t_5numpy_int64_t(const char *itemp, PyObject *obj) {
60513     __pyx_t_5numpy_int64_t value = __Pyx_PyInt_As_npy_int64(obj);
60514     if ((value == ((npy_int64)-1)) && PyErr_Occurred())
60515         return 0;
60516     *(__pyx_t_5numpy_int64_t *) itemp = value;
60517     return 1;
60518 }
60519 
60520 /* Declarations */
60521   #if CYTHON_CCOMPLEX
60522   #ifdef __cplusplus
__pyx_t_float_complex_from_parts(float x,float y)60523     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
60524       return ::std::complex< float >(x, y);
60525     }
60526   #else
__pyx_t_float_complex_from_parts(float x,float y)60527     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
60528       return x + y*(__pyx_t_float_complex)_Complex_I;
60529     }
60530   #endif
60531 #else
__pyx_t_float_complex_from_parts(float x,float y)60532     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
60533       __pyx_t_float_complex z;
60534       z.real = x;
60535       z.imag = y;
60536       return z;
60537     }
60538 #endif
60539 
60540 /* Arithmetic */
60541   #if CYTHON_CCOMPLEX
60542 #else
__Pyx_c_eq_float(__pyx_t_float_complex a,__pyx_t_float_complex b)60543     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
60544        return (a.real == b.real) && (a.imag == b.imag);
60545     }
__Pyx_c_sum_float(__pyx_t_float_complex a,__pyx_t_float_complex b)60546     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
60547         __pyx_t_float_complex z;
60548         z.real = a.real + b.real;
60549         z.imag = a.imag + b.imag;
60550         return z;
60551     }
__Pyx_c_diff_float(__pyx_t_float_complex a,__pyx_t_float_complex b)60552     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
60553         __pyx_t_float_complex z;
60554         z.real = a.real - b.real;
60555         z.imag = a.imag - b.imag;
60556         return z;
60557     }
__Pyx_c_prod_float(__pyx_t_float_complex a,__pyx_t_float_complex b)60558     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
60559         __pyx_t_float_complex z;
60560         z.real = a.real * b.real - a.imag * b.imag;
60561         z.imag = a.real * b.imag + a.imag * b.real;
60562         return z;
60563     }
60564     #if 1
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)60565     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
60566         if (b.imag == 0) {
60567             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
60568         } else if (fabsf(b.real) >= fabsf(b.imag)) {
60569             if (b.real == 0 && b.imag == 0) {
60570                 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
60571             } else {
60572                 float r = b.imag / b.real;
60573                 float s = (float)(1.0) / (b.real + b.imag * r);
60574                 return __pyx_t_float_complex_from_parts(
60575                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
60576             }
60577         } else {
60578             float r = b.real / b.imag;
60579             float s = (float)(1.0) / (b.imag + b.real * r);
60580             return __pyx_t_float_complex_from_parts(
60581                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
60582         }
60583     }
60584     #else
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)60585     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
60586         if (b.imag == 0) {
60587             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
60588         } else {
60589             float denom = b.real * b.real + b.imag * b.imag;
60590             return __pyx_t_float_complex_from_parts(
60591                 (a.real * b.real + a.imag * b.imag) / denom,
60592                 (a.imag * b.real - a.real * b.imag) / denom);
60593         }
60594     }
60595     #endif
__Pyx_c_neg_float(__pyx_t_float_complex a)60596     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
60597         __pyx_t_float_complex z;
60598         z.real = -a.real;
60599         z.imag = -a.imag;
60600         return z;
60601     }
__Pyx_c_is_zero_float(__pyx_t_float_complex a)60602     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
60603        return (a.real == 0) && (a.imag == 0);
60604     }
__Pyx_c_conj_float(__pyx_t_float_complex a)60605     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
60606         __pyx_t_float_complex z;
60607         z.real =  a.real;
60608         z.imag = -a.imag;
60609         return z;
60610     }
60611     #if 1
__Pyx_c_abs_float(__pyx_t_float_complex z)60612         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
60613           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
60614             return sqrtf(z.real*z.real + z.imag*z.imag);
60615           #else
60616             return hypotf(z.real, z.imag);
60617           #endif
60618         }
__Pyx_c_pow_float(__pyx_t_float_complex a,__pyx_t_float_complex b)60619         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
60620             __pyx_t_float_complex z;
60621             float r, lnr, theta, z_r, z_theta;
60622             if (b.imag == 0 && b.real == (int)b.real) {
60623                 if (b.real < 0) {
60624                     float denom = a.real * a.real + a.imag * a.imag;
60625                     a.real = a.real / denom;
60626                     a.imag = -a.imag / denom;
60627                     b.real = -b.real;
60628                 }
60629                 switch ((int)b.real) {
60630                     case 0:
60631                         z.real = 1;
60632                         z.imag = 0;
60633                         return z;
60634                     case 1:
60635                         return a;
60636                     case 2:
60637                         z = __Pyx_c_prod_float(a, a);
60638                         return __Pyx_c_prod_float(a, a);
60639                     case 3:
60640                         z = __Pyx_c_prod_float(a, a);
60641                         return __Pyx_c_prod_float(z, a);
60642                     case 4:
60643                         z = __Pyx_c_prod_float(a, a);
60644                         return __Pyx_c_prod_float(z, z);
60645                 }
60646             }
60647             if (a.imag == 0) {
60648                 if (a.real == 0) {
60649                     return a;
60650                 } else if (b.imag == 0) {
60651                     z.real = powf(a.real, b.real);
60652                     z.imag = 0;
60653                     return z;
60654                 } else if (a.real > 0) {
60655                     r = a.real;
60656                     theta = 0;
60657                 } else {
60658                     r = -a.real;
60659                     theta = atan2f(0.0, -1.0);
60660                 }
60661             } else {
60662                 r = __Pyx_c_abs_float(a);
60663                 theta = atan2f(a.imag, a.real);
60664             }
60665             lnr = logf(r);
60666             z_r = expf(lnr * b.real - theta * b.imag);
60667             z_theta = theta * b.real + lnr * b.imag;
60668             z.real = z_r * cosf(z_theta);
60669             z.imag = z_r * sinf(z_theta);
60670             return z;
60671         }
60672     #endif
60673 #endif
60674 
60675 /* Declarations */
60676   #if CYTHON_CCOMPLEX
60677   #ifdef __cplusplus
__pyx_t_double_complex_from_parts(double x,double y)60678     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
60679       return ::std::complex< double >(x, y);
60680     }
60681   #else
__pyx_t_double_complex_from_parts(double x,double y)60682     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
60683       return x + y*(__pyx_t_double_complex)_Complex_I;
60684     }
60685   #endif
60686 #else
__pyx_t_double_complex_from_parts(double x,double y)60687     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
60688       __pyx_t_double_complex z;
60689       z.real = x;
60690       z.imag = y;
60691       return z;
60692     }
60693 #endif
60694 
60695 /* Arithmetic */
60696   #if CYTHON_CCOMPLEX
60697 #else
__Pyx_c_eq_double(__pyx_t_double_complex a,__pyx_t_double_complex b)60698     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
60699        return (a.real == b.real) && (a.imag == b.imag);
60700     }
__Pyx_c_sum_double(__pyx_t_double_complex a,__pyx_t_double_complex b)60701     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
60702         __pyx_t_double_complex z;
60703         z.real = a.real + b.real;
60704         z.imag = a.imag + b.imag;
60705         return z;
60706     }
__Pyx_c_diff_double(__pyx_t_double_complex a,__pyx_t_double_complex b)60707     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
60708         __pyx_t_double_complex z;
60709         z.real = a.real - b.real;
60710         z.imag = a.imag - b.imag;
60711         return z;
60712     }
__Pyx_c_prod_double(__pyx_t_double_complex a,__pyx_t_double_complex b)60713     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
60714         __pyx_t_double_complex z;
60715         z.real = a.real * b.real - a.imag * b.imag;
60716         z.imag = a.real * b.imag + a.imag * b.real;
60717         return z;
60718     }
60719     #if 1
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)60720     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
60721         if (b.imag == 0) {
60722             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
60723         } else if (fabs(b.real) >= fabs(b.imag)) {
60724             if (b.real == 0 && b.imag == 0) {
60725                 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
60726             } else {
60727                 double r = b.imag / b.real;
60728                 double s = (double)(1.0) / (b.real + b.imag * r);
60729                 return __pyx_t_double_complex_from_parts(
60730                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
60731             }
60732         } else {
60733             double r = b.real / b.imag;
60734             double s = (double)(1.0) / (b.imag + b.real * r);
60735             return __pyx_t_double_complex_from_parts(
60736                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
60737         }
60738     }
60739     #else
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)60740     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
60741         if (b.imag == 0) {
60742             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
60743         } else {
60744             double denom = b.real * b.real + b.imag * b.imag;
60745             return __pyx_t_double_complex_from_parts(
60746                 (a.real * b.real + a.imag * b.imag) / denom,
60747                 (a.imag * b.real - a.real * b.imag) / denom);
60748         }
60749     }
60750     #endif
__Pyx_c_neg_double(__pyx_t_double_complex a)60751     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
60752         __pyx_t_double_complex z;
60753         z.real = -a.real;
60754         z.imag = -a.imag;
60755         return z;
60756     }
__Pyx_c_is_zero_double(__pyx_t_double_complex a)60757     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
60758        return (a.real == 0) && (a.imag == 0);
60759     }
__Pyx_c_conj_double(__pyx_t_double_complex a)60760     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
60761         __pyx_t_double_complex z;
60762         z.real =  a.real;
60763         z.imag = -a.imag;
60764         return z;
60765     }
60766     #if 1
__Pyx_c_abs_double(__pyx_t_double_complex z)60767         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
60768           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
60769             return sqrt(z.real*z.real + z.imag*z.imag);
60770           #else
60771             return hypot(z.real, z.imag);
60772           #endif
60773         }
__Pyx_c_pow_double(__pyx_t_double_complex a,__pyx_t_double_complex b)60774         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
60775             __pyx_t_double_complex z;
60776             double r, lnr, theta, z_r, z_theta;
60777             if (b.imag == 0 && b.real == (int)b.real) {
60778                 if (b.real < 0) {
60779                     double denom = a.real * a.real + a.imag * a.imag;
60780                     a.real = a.real / denom;
60781                     a.imag = -a.imag / denom;
60782                     b.real = -b.real;
60783                 }
60784                 switch ((int)b.real) {
60785                     case 0:
60786                         z.real = 1;
60787                         z.imag = 0;
60788                         return z;
60789                     case 1:
60790                         return a;
60791                     case 2:
60792                         z = __Pyx_c_prod_double(a, a);
60793                         return __Pyx_c_prod_double(a, a);
60794                     case 3:
60795                         z = __Pyx_c_prod_double(a, a);
60796                         return __Pyx_c_prod_double(z, a);
60797                     case 4:
60798                         z = __Pyx_c_prod_double(a, a);
60799                         return __Pyx_c_prod_double(z, z);
60800                 }
60801             }
60802             if (a.imag == 0) {
60803                 if (a.real == 0) {
60804                     return a;
60805                 } else if (b.imag == 0) {
60806                     z.real = pow(a.real, b.real);
60807                     z.imag = 0;
60808                     return z;
60809                 } else if (a.real > 0) {
60810                     r = a.real;
60811                     theta = 0;
60812                 } else {
60813                     r = -a.real;
60814                     theta = atan2(0.0, -1.0);
60815                 }
60816             } else {
60817                 r = __Pyx_c_abs_double(a);
60818                 theta = atan2(a.imag, a.real);
60819             }
60820             lnr = log(r);
60821             z_r = exp(lnr * b.real - theta * b.imag);
60822             z_theta = theta * b.real + lnr * b.imag;
60823             z.real = z_r * cos(z_theta);
60824             z.imag = z_r * sin(z_theta);
60825             return z;
60826         }
60827     #endif
60828 #endif
60829 
60830 /* CIntToPy */
__Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value)60831   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
60832     const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0;
60833     const int is_unsigned = neg_one > const_zero;
60834     if (is_unsigned) {
60835         if (sizeof(enum NPY_TYPES) < sizeof(long)) {
60836             return PyInt_FromLong((long) value);
60837         } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
60838             return PyLong_FromUnsignedLong((unsigned long) value);
60839 #ifdef HAVE_LONG_LONG
60840         } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
60841             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
60842 #endif
60843         }
60844     } else {
60845         if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
60846             return PyInt_FromLong((long) value);
60847 #ifdef HAVE_LONG_LONG
60848         } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
60849             return PyLong_FromLongLong((PY_LONG_LONG) value);
60850 #endif
60851         }
60852     }
60853     {
60854         int one = 1; int little = (int)*(unsigned char *)&one;
60855         unsigned char *bytes = (unsigned char *)&value;
60856         return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
60857                                      little, !is_unsigned);
60858     }
60859 }
60860 
60861 /* MemviewSliceCopyTemplate */
60862   static __Pyx_memviewslice
__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice * from_mvs,const char * mode,int ndim,size_t sizeof_dtype,int contig_flag,int dtype_is_object)60863 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
60864                                  const char *mode, int ndim,
60865                                  size_t sizeof_dtype, int contig_flag,
60866                                  int dtype_is_object)
60867 {
60868     __Pyx_RefNannyDeclarations
60869     int i;
60870     __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
60871     struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
60872     Py_buffer *buf = &from_memview->view;
60873     PyObject *shape_tuple = NULL;
60874     PyObject *temp_int = NULL;
60875     struct __pyx_array_obj *array_obj = NULL;
60876     struct __pyx_memoryview_obj *memview_obj = NULL;
60877     __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
60878     for (i = 0; i < ndim; i++) {
60879         if (from_mvs->suboffsets[i] >= 0) {
60880             PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
60881                                            "indirect dimensions (axis %d)", i);
60882             goto fail;
60883         }
60884     }
60885     shape_tuple = PyTuple_New(ndim);
60886     if (unlikely(!shape_tuple)) {
60887         goto fail;
60888     }
60889     __Pyx_GOTREF(shape_tuple);
60890     for(i = 0; i < ndim; i++) {
60891         temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
60892         if(unlikely(!temp_int)) {
60893             goto fail;
60894         } else {
60895             PyTuple_SET_ITEM(shape_tuple, i, temp_int);
60896             temp_int = NULL;
60897         }
60898     }
60899     array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
60900     if (unlikely(!array_obj)) {
60901         goto fail;
60902     }
60903     __Pyx_GOTREF(array_obj);
60904     memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
60905                                     (PyObject *) array_obj, contig_flag,
60906                                     dtype_is_object,
60907                                     from_mvs->memview->typeinfo);
60908     if (unlikely(!memview_obj))
60909         goto fail;
60910     if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
60911         goto fail;
60912     if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
60913                                                 dtype_is_object) < 0))
60914         goto fail;
60915     goto no_fail;
60916 fail:
60917     __Pyx_XDECREF(new_mvs.memview);
60918     new_mvs.memview = NULL;
60919     new_mvs.data = NULL;
60920 no_fail:
60921     __Pyx_XDECREF(shape_tuple);
60922     __Pyx_XDECREF(temp_int);
60923     __Pyx_XDECREF(array_obj);
60924     __Pyx_RefNannyFinishContext();
60925     return new_mvs;
60926 }
60927 
60928 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)60929   static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
60930     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
60931     const int is_unsigned = neg_one > const_zero;
60932 #if PY_MAJOR_VERSION < 3
60933     if (likely(PyInt_Check(x))) {
60934         if (sizeof(int) < sizeof(long)) {
60935             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
60936         } else {
60937             long val = PyInt_AS_LONG(x);
60938             if (is_unsigned && unlikely(val < 0)) {
60939                 goto raise_neg_overflow;
60940             }
60941             return (int) val;
60942         }
60943     } else
60944 #endif
60945     if (likely(PyLong_Check(x))) {
60946         if (is_unsigned) {
60947 #if CYTHON_USE_PYLONG_INTERNALS
60948             const digit* digits = ((PyLongObject*)x)->ob_digit;
60949             switch (Py_SIZE(x)) {
60950                 case  0: return (int) 0;
60951                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
60952                 case 2:
60953                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
60954                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
60955                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
60956                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
60957                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
60958                         }
60959                     }
60960                     break;
60961                 case 3:
60962                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
60963                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
60964                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
60965                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
60966                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
60967                         }
60968                     }
60969                     break;
60970                 case 4:
60971                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
60972                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
60973                             __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])))
60974                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
60975                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
60976                         }
60977                     }
60978                     break;
60979             }
60980 #endif
60981 #if CYTHON_COMPILING_IN_CPYTHON
60982             if (unlikely(Py_SIZE(x) < 0)) {
60983                 goto raise_neg_overflow;
60984             }
60985 #else
60986             {
60987                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
60988                 if (unlikely(result < 0))
60989                     return (int) -1;
60990                 if (unlikely(result == 1))
60991                     goto raise_neg_overflow;
60992             }
60993 #endif
60994             if (sizeof(int) <= sizeof(unsigned long)) {
60995                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
60996 #ifdef HAVE_LONG_LONG
60997             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
60998                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
60999 #endif
61000             }
61001         } else {
61002 #if CYTHON_USE_PYLONG_INTERNALS
61003             const digit* digits = ((PyLongObject*)x)->ob_digit;
61004             switch (Py_SIZE(x)) {
61005                 case  0: return (int) 0;
61006                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
61007                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
61008                 case -2:
61009                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
61010                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
61011                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61012                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
61013                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
61014                         }
61015                     }
61016                     break;
61017                 case 2:
61018                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
61019                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
61020                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61021                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
61022                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
61023                         }
61024                     }
61025                     break;
61026                 case -3:
61027                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
61028                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
61029                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61030                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
61031                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
61032                         }
61033                     }
61034                     break;
61035                 case 3:
61036                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
61037                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
61038                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61039                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
61040                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
61041                         }
61042                     }
61043                     break;
61044                 case -4:
61045                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
61046                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
61047                             __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])))
61048                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
61049                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
61050                         }
61051                     }
61052                     break;
61053                 case 4:
61054                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
61055                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
61056                             __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])))
61057                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
61058                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
61059                         }
61060                     }
61061                     break;
61062             }
61063 #endif
61064             if (sizeof(int) <= sizeof(long)) {
61065                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
61066 #ifdef HAVE_LONG_LONG
61067             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
61068                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
61069 #endif
61070             }
61071         }
61072         {
61073 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
61074             PyErr_SetString(PyExc_RuntimeError,
61075                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
61076 #else
61077             int val;
61078             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
61079  #if PY_MAJOR_VERSION < 3
61080             if (likely(v) && !PyLong_Check(v)) {
61081                 PyObject *tmp = v;
61082                 v = PyNumber_Long(tmp);
61083                 Py_DECREF(tmp);
61084             }
61085  #endif
61086             if (likely(v)) {
61087                 int one = 1; int is_little = (int)*(unsigned char *)&one;
61088                 unsigned char *bytes = (unsigned char *)&val;
61089                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
61090                                               bytes, sizeof(val),
61091                                               is_little, !is_unsigned);
61092                 Py_DECREF(v);
61093                 if (likely(!ret))
61094                     return val;
61095             }
61096 #endif
61097             return (int) -1;
61098         }
61099     } else {
61100         int val;
61101         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
61102         if (!tmp) return (int) -1;
61103         val = __Pyx_PyInt_As_int(tmp);
61104         Py_DECREF(tmp);
61105         return val;
61106     }
61107 raise_overflow:
61108     PyErr_SetString(PyExc_OverflowError,
61109         "value too large to convert to int");
61110     return (int) -1;
61111 raise_neg_overflow:
61112     PyErr_SetString(PyExc_OverflowError,
61113         "can't convert negative value to int");
61114     return (int) -1;
61115 }
61116 
61117 /* CIntFromPy */
__Pyx_PyInt_As_npy_uint64(PyObject * x)61118   static CYTHON_INLINE npy_uint64 __Pyx_PyInt_As_npy_uint64(PyObject *x) {
61119     const npy_uint64 neg_one = (npy_uint64) ((npy_uint64) 0 - (npy_uint64) 1), const_zero = (npy_uint64) 0;
61120     const int is_unsigned = neg_one > const_zero;
61121 #if PY_MAJOR_VERSION < 3
61122     if (likely(PyInt_Check(x))) {
61123         if (sizeof(npy_uint64) < sizeof(long)) {
61124             __PYX_VERIFY_RETURN_INT(npy_uint64, long, PyInt_AS_LONG(x))
61125         } else {
61126             long val = PyInt_AS_LONG(x);
61127             if (is_unsigned && unlikely(val < 0)) {
61128                 goto raise_neg_overflow;
61129             }
61130             return (npy_uint64) val;
61131         }
61132     } else
61133 #endif
61134     if (likely(PyLong_Check(x))) {
61135         if (is_unsigned) {
61136 #if CYTHON_USE_PYLONG_INTERNALS
61137             const digit* digits = ((PyLongObject*)x)->ob_digit;
61138             switch (Py_SIZE(x)) {
61139                 case  0: return (npy_uint64) 0;
61140                 case  1: __PYX_VERIFY_RETURN_INT(npy_uint64, digit, digits[0])
61141                 case 2:
61142                     if (8 * sizeof(npy_uint64) > 1 * PyLong_SHIFT) {
61143                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
61144                             __PYX_VERIFY_RETURN_INT(npy_uint64, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61145                         } else if (8 * sizeof(npy_uint64) >= 2 * PyLong_SHIFT) {
61146                             return (npy_uint64) (((((npy_uint64)digits[1]) << PyLong_SHIFT) | (npy_uint64)digits[0]));
61147                         }
61148                     }
61149                     break;
61150                 case 3:
61151                     if (8 * sizeof(npy_uint64) > 2 * PyLong_SHIFT) {
61152                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
61153                             __PYX_VERIFY_RETURN_INT(npy_uint64, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61154                         } else if (8 * sizeof(npy_uint64) >= 3 * PyLong_SHIFT) {
61155                             return (npy_uint64) (((((((npy_uint64)digits[2]) << PyLong_SHIFT) | (npy_uint64)digits[1]) << PyLong_SHIFT) | (npy_uint64)digits[0]));
61156                         }
61157                     }
61158                     break;
61159                 case 4:
61160                     if (8 * sizeof(npy_uint64) > 3 * PyLong_SHIFT) {
61161                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
61162                             __PYX_VERIFY_RETURN_INT(npy_uint64, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61163                         } else if (8 * sizeof(npy_uint64) >= 4 * PyLong_SHIFT) {
61164                             return (npy_uint64) (((((((((npy_uint64)digits[3]) << PyLong_SHIFT) | (npy_uint64)digits[2]) << PyLong_SHIFT) | (npy_uint64)digits[1]) << PyLong_SHIFT) | (npy_uint64)digits[0]));
61165                         }
61166                     }
61167                     break;
61168             }
61169 #endif
61170 #if CYTHON_COMPILING_IN_CPYTHON
61171             if (unlikely(Py_SIZE(x) < 0)) {
61172                 goto raise_neg_overflow;
61173             }
61174 #else
61175             {
61176                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
61177                 if (unlikely(result < 0))
61178                     return (npy_uint64) -1;
61179                 if (unlikely(result == 1))
61180                     goto raise_neg_overflow;
61181             }
61182 #endif
61183             if (sizeof(npy_uint64) <= sizeof(unsigned long)) {
61184                 __PYX_VERIFY_RETURN_INT_EXC(npy_uint64, unsigned long, PyLong_AsUnsignedLong(x))
61185 #ifdef HAVE_LONG_LONG
61186             } else if (sizeof(npy_uint64) <= sizeof(unsigned PY_LONG_LONG)) {
61187                 __PYX_VERIFY_RETURN_INT_EXC(npy_uint64, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
61188 #endif
61189             }
61190         } else {
61191 #if CYTHON_USE_PYLONG_INTERNALS
61192             const digit* digits = ((PyLongObject*)x)->ob_digit;
61193             switch (Py_SIZE(x)) {
61194                 case  0: return (npy_uint64) 0;
61195                 case -1: __PYX_VERIFY_RETURN_INT(npy_uint64, sdigit, (sdigit) (-(sdigit)digits[0]))
61196                 case  1: __PYX_VERIFY_RETURN_INT(npy_uint64,  digit, +digits[0])
61197                 case -2:
61198                     if (8 * sizeof(npy_uint64) - 1 > 1 * PyLong_SHIFT) {
61199                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
61200                             __PYX_VERIFY_RETURN_INT(npy_uint64, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61201                         } else if (8 * sizeof(npy_uint64) - 1 > 2 * PyLong_SHIFT) {
61202                             return (npy_uint64) (((npy_uint64)-1)*(((((npy_uint64)digits[1]) << PyLong_SHIFT) | (npy_uint64)digits[0])));
61203                         }
61204                     }
61205                     break;
61206                 case 2:
61207                     if (8 * sizeof(npy_uint64) > 1 * PyLong_SHIFT) {
61208                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
61209                             __PYX_VERIFY_RETURN_INT(npy_uint64, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61210                         } else if (8 * sizeof(npy_uint64) - 1 > 2 * PyLong_SHIFT) {
61211                             return (npy_uint64) ((((((npy_uint64)digits[1]) << PyLong_SHIFT) | (npy_uint64)digits[0])));
61212                         }
61213                     }
61214                     break;
61215                 case -3:
61216                     if (8 * sizeof(npy_uint64) - 1 > 2 * PyLong_SHIFT) {
61217                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
61218                             __PYX_VERIFY_RETURN_INT(npy_uint64, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61219                         } else if (8 * sizeof(npy_uint64) - 1 > 3 * PyLong_SHIFT) {
61220                             return (npy_uint64) (((npy_uint64)-1)*(((((((npy_uint64)digits[2]) << PyLong_SHIFT) | (npy_uint64)digits[1]) << PyLong_SHIFT) | (npy_uint64)digits[0])));
61221                         }
61222                     }
61223                     break;
61224                 case 3:
61225                     if (8 * sizeof(npy_uint64) > 2 * PyLong_SHIFT) {
61226                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
61227                             __PYX_VERIFY_RETURN_INT(npy_uint64, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61228                         } else if (8 * sizeof(npy_uint64) - 1 > 3 * PyLong_SHIFT) {
61229                             return (npy_uint64) ((((((((npy_uint64)digits[2]) << PyLong_SHIFT) | (npy_uint64)digits[1]) << PyLong_SHIFT) | (npy_uint64)digits[0])));
61230                         }
61231                     }
61232                     break;
61233                 case -4:
61234                     if (8 * sizeof(npy_uint64) - 1 > 3 * PyLong_SHIFT) {
61235                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
61236                             __PYX_VERIFY_RETURN_INT(npy_uint64, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61237                         } else if (8 * sizeof(npy_uint64) - 1 > 4 * PyLong_SHIFT) {
61238                             return (npy_uint64) (((npy_uint64)-1)*(((((((((npy_uint64)digits[3]) << PyLong_SHIFT) | (npy_uint64)digits[2]) << PyLong_SHIFT) | (npy_uint64)digits[1]) << PyLong_SHIFT) | (npy_uint64)digits[0])));
61239                         }
61240                     }
61241                     break;
61242                 case 4:
61243                     if (8 * sizeof(npy_uint64) > 3 * PyLong_SHIFT) {
61244                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
61245                             __PYX_VERIFY_RETURN_INT(npy_uint64, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61246                         } else if (8 * sizeof(npy_uint64) - 1 > 4 * PyLong_SHIFT) {
61247                             return (npy_uint64) ((((((((((npy_uint64)digits[3]) << PyLong_SHIFT) | (npy_uint64)digits[2]) << PyLong_SHIFT) | (npy_uint64)digits[1]) << PyLong_SHIFT) | (npy_uint64)digits[0])));
61248                         }
61249                     }
61250                     break;
61251             }
61252 #endif
61253             if (sizeof(npy_uint64) <= sizeof(long)) {
61254                 __PYX_VERIFY_RETURN_INT_EXC(npy_uint64, long, PyLong_AsLong(x))
61255 #ifdef HAVE_LONG_LONG
61256             } else if (sizeof(npy_uint64) <= sizeof(PY_LONG_LONG)) {
61257                 __PYX_VERIFY_RETURN_INT_EXC(npy_uint64, PY_LONG_LONG, PyLong_AsLongLong(x))
61258 #endif
61259             }
61260         }
61261         {
61262 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
61263             PyErr_SetString(PyExc_RuntimeError,
61264                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
61265 #else
61266             npy_uint64 val;
61267             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
61268  #if PY_MAJOR_VERSION < 3
61269             if (likely(v) && !PyLong_Check(v)) {
61270                 PyObject *tmp = v;
61271                 v = PyNumber_Long(tmp);
61272                 Py_DECREF(tmp);
61273             }
61274  #endif
61275             if (likely(v)) {
61276                 int one = 1; int is_little = (int)*(unsigned char *)&one;
61277                 unsigned char *bytes = (unsigned char *)&val;
61278                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
61279                                               bytes, sizeof(val),
61280                                               is_little, !is_unsigned);
61281                 Py_DECREF(v);
61282                 if (likely(!ret))
61283                     return val;
61284             }
61285 #endif
61286             return (npy_uint64) -1;
61287         }
61288     } else {
61289         npy_uint64 val;
61290         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
61291         if (!tmp) return (npy_uint64) -1;
61292         val = __Pyx_PyInt_As_npy_uint64(tmp);
61293         Py_DECREF(tmp);
61294         return val;
61295     }
61296 raise_overflow:
61297     PyErr_SetString(PyExc_OverflowError,
61298         "value too large to convert to npy_uint64");
61299     return (npy_uint64) -1;
61300 raise_neg_overflow:
61301     PyErr_SetString(PyExc_OverflowError,
61302         "can't convert negative value to npy_uint64");
61303     return (npy_uint64) -1;
61304 }
61305 
61306 /* CIntFromPy */
__Pyx_PyInt_As_npy_uint32(PyObject * x)61307   static CYTHON_INLINE npy_uint32 __Pyx_PyInt_As_npy_uint32(PyObject *x) {
61308     const npy_uint32 neg_one = (npy_uint32) ((npy_uint32) 0 - (npy_uint32) 1), const_zero = (npy_uint32) 0;
61309     const int is_unsigned = neg_one > const_zero;
61310 #if PY_MAJOR_VERSION < 3
61311     if (likely(PyInt_Check(x))) {
61312         if (sizeof(npy_uint32) < sizeof(long)) {
61313             __PYX_VERIFY_RETURN_INT(npy_uint32, long, PyInt_AS_LONG(x))
61314         } else {
61315             long val = PyInt_AS_LONG(x);
61316             if (is_unsigned && unlikely(val < 0)) {
61317                 goto raise_neg_overflow;
61318             }
61319             return (npy_uint32) val;
61320         }
61321     } else
61322 #endif
61323     if (likely(PyLong_Check(x))) {
61324         if (is_unsigned) {
61325 #if CYTHON_USE_PYLONG_INTERNALS
61326             const digit* digits = ((PyLongObject*)x)->ob_digit;
61327             switch (Py_SIZE(x)) {
61328                 case  0: return (npy_uint32) 0;
61329                 case  1: __PYX_VERIFY_RETURN_INT(npy_uint32, digit, digits[0])
61330                 case 2:
61331                     if (8 * sizeof(npy_uint32) > 1 * PyLong_SHIFT) {
61332                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
61333                             __PYX_VERIFY_RETURN_INT(npy_uint32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61334                         } else if (8 * sizeof(npy_uint32) >= 2 * PyLong_SHIFT) {
61335                             return (npy_uint32) (((((npy_uint32)digits[1]) << PyLong_SHIFT) | (npy_uint32)digits[0]));
61336                         }
61337                     }
61338                     break;
61339                 case 3:
61340                     if (8 * sizeof(npy_uint32) > 2 * PyLong_SHIFT) {
61341                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
61342                             __PYX_VERIFY_RETURN_INT(npy_uint32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61343                         } else if (8 * sizeof(npy_uint32) >= 3 * PyLong_SHIFT) {
61344                             return (npy_uint32) (((((((npy_uint32)digits[2]) << PyLong_SHIFT) | (npy_uint32)digits[1]) << PyLong_SHIFT) | (npy_uint32)digits[0]));
61345                         }
61346                     }
61347                     break;
61348                 case 4:
61349                     if (8 * sizeof(npy_uint32) > 3 * PyLong_SHIFT) {
61350                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
61351                             __PYX_VERIFY_RETURN_INT(npy_uint32, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61352                         } else if (8 * sizeof(npy_uint32) >= 4 * PyLong_SHIFT) {
61353                             return (npy_uint32) (((((((((npy_uint32)digits[3]) << PyLong_SHIFT) | (npy_uint32)digits[2]) << PyLong_SHIFT) | (npy_uint32)digits[1]) << PyLong_SHIFT) | (npy_uint32)digits[0]));
61354                         }
61355                     }
61356                     break;
61357             }
61358 #endif
61359 #if CYTHON_COMPILING_IN_CPYTHON
61360             if (unlikely(Py_SIZE(x) < 0)) {
61361                 goto raise_neg_overflow;
61362             }
61363 #else
61364             {
61365                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
61366                 if (unlikely(result < 0))
61367                     return (npy_uint32) -1;
61368                 if (unlikely(result == 1))
61369                     goto raise_neg_overflow;
61370             }
61371 #endif
61372             if (sizeof(npy_uint32) <= sizeof(unsigned long)) {
61373                 __PYX_VERIFY_RETURN_INT_EXC(npy_uint32, unsigned long, PyLong_AsUnsignedLong(x))
61374 #ifdef HAVE_LONG_LONG
61375             } else if (sizeof(npy_uint32) <= sizeof(unsigned PY_LONG_LONG)) {
61376                 __PYX_VERIFY_RETURN_INT_EXC(npy_uint32, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
61377 #endif
61378             }
61379         } else {
61380 #if CYTHON_USE_PYLONG_INTERNALS
61381             const digit* digits = ((PyLongObject*)x)->ob_digit;
61382             switch (Py_SIZE(x)) {
61383                 case  0: return (npy_uint32) 0;
61384                 case -1: __PYX_VERIFY_RETURN_INT(npy_uint32, sdigit, (sdigit) (-(sdigit)digits[0]))
61385                 case  1: __PYX_VERIFY_RETURN_INT(npy_uint32,  digit, +digits[0])
61386                 case -2:
61387                     if (8 * sizeof(npy_uint32) - 1 > 1 * PyLong_SHIFT) {
61388                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
61389                             __PYX_VERIFY_RETURN_INT(npy_uint32, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61390                         } else if (8 * sizeof(npy_uint32) - 1 > 2 * PyLong_SHIFT) {
61391                             return (npy_uint32) (((npy_uint32)-1)*(((((npy_uint32)digits[1]) << PyLong_SHIFT) | (npy_uint32)digits[0])));
61392                         }
61393                     }
61394                     break;
61395                 case 2:
61396                     if (8 * sizeof(npy_uint32) > 1 * PyLong_SHIFT) {
61397                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
61398                             __PYX_VERIFY_RETURN_INT(npy_uint32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61399                         } else if (8 * sizeof(npy_uint32) - 1 > 2 * PyLong_SHIFT) {
61400                             return (npy_uint32) ((((((npy_uint32)digits[1]) << PyLong_SHIFT) | (npy_uint32)digits[0])));
61401                         }
61402                     }
61403                     break;
61404                 case -3:
61405                     if (8 * sizeof(npy_uint32) - 1 > 2 * PyLong_SHIFT) {
61406                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
61407                             __PYX_VERIFY_RETURN_INT(npy_uint32, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61408                         } else if (8 * sizeof(npy_uint32) - 1 > 3 * PyLong_SHIFT) {
61409                             return (npy_uint32) (((npy_uint32)-1)*(((((((npy_uint32)digits[2]) << PyLong_SHIFT) | (npy_uint32)digits[1]) << PyLong_SHIFT) | (npy_uint32)digits[0])));
61410                         }
61411                     }
61412                     break;
61413                 case 3:
61414                     if (8 * sizeof(npy_uint32) > 2 * PyLong_SHIFT) {
61415                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
61416                             __PYX_VERIFY_RETURN_INT(npy_uint32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61417                         } else if (8 * sizeof(npy_uint32) - 1 > 3 * PyLong_SHIFT) {
61418                             return (npy_uint32) ((((((((npy_uint32)digits[2]) << PyLong_SHIFT) | (npy_uint32)digits[1]) << PyLong_SHIFT) | (npy_uint32)digits[0])));
61419                         }
61420                     }
61421                     break;
61422                 case -4:
61423                     if (8 * sizeof(npy_uint32) - 1 > 3 * PyLong_SHIFT) {
61424                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
61425                             __PYX_VERIFY_RETURN_INT(npy_uint32, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61426                         } else if (8 * sizeof(npy_uint32) - 1 > 4 * PyLong_SHIFT) {
61427                             return (npy_uint32) (((npy_uint32)-1)*(((((((((npy_uint32)digits[3]) << PyLong_SHIFT) | (npy_uint32)digits[2]) << PyLong_SHIFT) | (npy_uint32)digits[1]) << PyLong_SHIFT) | (npy_uint32)digits[0])));
61428                         }
61429                     }
61430                     break;
61431                 case 4:
61432                     if (8 * sizeof(npy_uint32) > 3 * PyLong_SHIFT) {
61433                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
61434                             __PYX_VERIFY_RETURN_INT(npy_uint32, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61435                         } else if (8 * sizeof(npy_uint32) - 1 > 4 * PyLong_SHIFT) {
61436                             return (npy_uint32) ((((((((((npy_uint32)digits[3]) << PyLong_SHIFT) | (npy_uint32)digits[2]) << PyLong_SHIFT) | (npy_uint32)digits[1]) << PyLong_SHIFT) | (npy_uint32)digits[0])));
61437                         }
61438                     }
61439                     break;
61440             }
61441 #endif
61442             if (sizeof(npy_uint32) <= sizeof(long)) {
61443                 __PYX_VERIFY_RETURN_INT_EXC(npy_uint32, long, PyLong_AsLong(x))
61444 #ifdef HAVE_LONG_LONG
61445             } else if (sizeof(npy_uint32) <= sizeof(PY_LONG_LONG)) {
61446                 __PYX_VERIFY_RETURN_INT_EXC(npy_uint32, PY_LONG_LONG, PyLong_AsLongLong(x))
61447 #endif
61448             }
61449         }
61450         {
61451 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
61452             PyErr_SetString(PyExc_RuntimeError,
61453                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
61454 #else
61455             npy_uint32 val;
61456             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
61457  #if PY_MAJOR_VERSION < 3
61458             if (likely(v) && !PyLong_Check(v)) {
61459                 PyObject *tmp = v;
61460                 v = PyNumber_Long(tmp);
61461                 Py_DECREF(tmp);
61462             }
61463  #endif
61464             if (likely(v)) {
61465                 int one = 1; int is_little = (int)*(unsigned char *)&one;
61466                 unsigned char *bytes = (unsigned char *)&val;
61467                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
61468                                               bytes, sizeof(val),
61469                                               is_little, !is_unsigned);
61470                 Py_DECREF(v);
61471                 if (likely(!ret))
61472                     return val;
61473             }
61474 #endif
61475             return (npy_uint32) -1;
61476         }
61477     } else {
61478         npy_uint32 val;
61479         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
61480         if (!tmp) return (npy_uint32) -1;
61481         val = __Pyx_PyInt_As_npy_uint32(tmp);
61482         Py_DECREF(tmp);
61483         return val;
61484     }
61485 raise_overflow:
61486     PyErr_SetString(PyExc_OverflowError,
61487         "value too large to convert to npy_uint32");
61488     return (npy_uint32) -1;
61489 raise_neg_overflow:
61490     PyErr_SetString(PyExc_OverflowError,
61491         "can't convert negative value to npy_uint32");
61492     return (npy_uint32) -1;
61493 }
61494 
61495 /* CIntFromPy */
__Pyx_PyInt_As_npy_int64(PyObject * x)61496   static CYTHON_INLINE npy_int64 __Pyx_PyInt_As_npy_int64(PyObject *x) {
61497     const npy_int64 neg_one = (npy_int64) ((npy_int64) 0 - (npy_int64) 1), const_zero = (npy_int64) 0;
61498     const int is_unsigned = neg_one > const_zero;
61499 #if PY_MAJOR_VERSION < 3
61500     if (likely(PyInt_Check(x))) {
61501         if (sizeof(npy_int64) < sizeof(long)) {
61502             __PYX_VERIFY_RETURN_INT(npy_int64, long, PyInt_AS_LONG(x))
61503         } else {
61504             long val = PyInt_AS_LONG(x);
61505             if (is_unsigned && unlikely(val < 0)) {
61506                 goto raise_neg_overflow;
61507             }
61508             return (npy_int64) val;
61509         }
61510     } else
61511 #endif
61512     if (likely(PyLong_Check(x))) {
61513         if (is_unsigned) {
61514 #if CYTHON_USE_PYLONG_INTERNALS
61515             const digit* digits = ((PyLongObject*)x)->ob_digit;
61516             switch (Py_SIZE(x)) {
61517                 case  0: return (npy_int64) 0;
61518                 case  1: __PYX_VERIFY_RETURN_INT(npy_int64, digit, digits[0])
61519                 case 2:
61520                     if (8 * sizeof(npy_int64) > 1 * PyLong_SHIFT) {
61521                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
61522                             __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61523                         } else if (8 * sizeof(npy_int64) >= 2 * PyLong_SHIFT) {
61524                             return (npy_int64) (((((npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0]));
61525                         }
61526                     }
61527                     break;
61528                 case 3:
61529                     if (8 * sizeof(npy_int64) > 2 * PyLong_SHIFT) {
61530                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
61531                             __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61532                         } else if (8 * sizeof(npy_int64) >= 3 * PyLong_SHIFT) {
61533                             return (npy_int64) (((((((npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0]));
61534                         }
61535                     }
61536                     break;
61537                 case 4:
61538                     if (8 * sizeof(npy_int64) > 3 * PyLong_SHIFT) {
61539                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
61540                             __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])))
61541                         } else if (8 * sizeof(npy_int64) >= 4 * PyLong_SHIFT) {
61542                             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]));
61543                         }
61544                     }
61545                     break;
61546             }
61547 #endif
61548 #if CYTHON_COMPILING_IN_CPYTHON
61549             if (unlikely(Py_SIZE(x) < 0)) {
61550                 goto raise_neg_overflow;
61551             }
61552 #else
61553             {
61554                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
61555                 if (unlikely(result < 0))
61556                     return (npy_int64) -1;
61557                 if (unlikely(result == 1))
61558                     goto raise_neg_overflow;
61559             }
61560 #endif
61561             if (sizeof(npy_int64) <= sizeof(unsigned long)) {
61562                 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, unsigned long, PyLong_AsUnsignedLong(x))
61563 #ifdef HAVE_LONG_LONG
61564             } else if (sizeof(npy_int64) <= sizeof(unsigned PY_LONG_LONG)) {
61565                 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
61566 #endif
61567             }
61568         } else {
61569 #if CYTHON_USE_PYLONG_INTERNALS
61570             const digit* digits = ((PyLongObject*)x)->ob_digit;
61571             switch (Py_SIZE(x)) {
61572                 case  0: return (npy_int64) 0;
61573                 case -1: __PYX_VERIFY_RETURN_INT(npy_int64, sdigit, (sdigit) (-(sdigit)digits[0]))
61574                 case  1: __PYX_VERIFY_RETURN_INT(npy_int64,  digit, +digits[0])
61575                 case -2:
61576                     if (8 * sizeof(npy_int64) - 1 > 1 * PyLong_SHIFT) {
61577                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
61578                             __PYX_VERIFY_RETURN_INT(npy_int64, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61579                         } else if (8 * sizeof(npy_int64) - 1 > 2 * PyLong_SHIFT) {
61580                             return (npy_int64) (((npy_int64)-1)*(((((npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
61581                         }
61582                     }
61583                     break;
61584                 case 2:
61585                     if (8 * sizeof(npy_int64) > 1 * PyLong_SHIFT) {
61586                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
61587                             __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61588                         } else if (8 * sizeof(npy_int64) - 1 > 2 * PyLong_SHIFT) {
61589                             return (npy_int64) ((((((npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
61590                         }
61591                     }
61592                     break;
61593                 case -3:
61594                     if (8 * sizeof(npy_int64) - 1 > 2 * PyLong_SHIFT) {
61595                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
61596                             __PYX_VERIFY_RETURN_INT(npy_int64, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61597                         } else if (8 * sizeof(npy_int64) - 1 > 3 * PyLong_SHIFT) {
61598                             return (npy_int64) (((npy_int64)-1)*(((((((npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
61599                         }
61600                     }
61601                     break;
61602                 case 3:
61603                     if (8 * sizeof(npy_int64) > 2 * PyLong_SHIFT) {
61604                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
61605                             __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61606                         } else if (8 * sizeof(npy_int64) - 1 > 3 * PyLong_SHIFT) {
61607                             return (npy_int64) ((((((((npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
61608                         }
61609                     }
61610                     break;
61611                 case -4:
61612                     if (8 * sizeof(npy_int64) - 1 > 3 * PyLong_SHIFT) {
61613                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
61614                             __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])))
61615                         } else if (8 * sizeof(npy_int64) - 1 > 4 * PyLong_SHIFT) {
61616                             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])));
61617                         }
61618                     }
61619                     break;
61620                 case 4:
61621                     if (8 * sizeof(npy_int64) > 3 * PyLong_SHIFT) {
61622                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
61623                             __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])))
61624                         } else if (8 * sizeof(npy_int64) - 1 > 4 * PyLong_SHIFT) {
61625                             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])));
61626                         }
61627                     }
61628                     break;
61629             }
61630 #endif
61631             if (sizeof(npy_int64) <= sizeof(long)) {
61632                 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, long, PyLong_AsLong(x))
61633 #ifdef HAVE_LONG_LONG
61634             } else if (sizeof(npy_int64) <= sizeof(PY_LONG_LONG)) {
61635                 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, PY_LONG_LONG, PyLong_AsLongLong(x))
61636 #endif
61637             }
61638         }
61639         {
61640 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
61641             PyErr_SetString(PyExc_RuntimeError,
61642                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
61643 #else
61644             npy_int64 val;
61645             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
61646  #if PY_MAJOR_VERSION < 3
61647             if (likely(v) && !PyLong_Check(v)) {
61648                 PyObject *tmp = v;
61649                 v = PyNumber_Long(tmp);
61650                 Py_DECREF(tmp);
61651             }
61652  #endif
61653             if (likely(v)) {
61654                 int one = 1; int is_little = (int)*(unsigned char *)&one;
61655                 unsigned char *bytes = (unsigned char *)&val;
61656                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
61657                                               bytes, sizeof(val),
61658                                               is_little, !is_unsigned);
61659                 Py_DECREF(v);
61660                 if (likely(!ret))
61661                     return val;
61662             }
61663 #endif
61664             return (npy_int64) -1;
61665         }
61666     } else {
61667         npy_int64 val;
61668         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
61669         if (!tmp) return (npy_int64) -1;
61670         val = __Pyx_PyInt_As_npy_int64(tmp);
61671         Py_DECREF(tmp);
61672         return val;
61673     }
61674 raise_overflow:
61675     PyErr_SetString(PyExc_OverflowError,
61676         "value too large to convert to npy_int64");
61677     return (npy_int64) -1;
61678 raise_neg_overflow:
61679     PyErr_SetString(PyExc_OverflowError,
61680         "can't convert negative value to npy_int64");
61681     return (npy_int64) -1;
61682 }
61683 
61684 /* TypeInfoToFormat */
__Pyx_TypeInfoToFormat(__Pyx_TypeInfo * type)61685   static struct __pyx_typeinfo_string __Pyx_TypeInfoToFormat(__Pyx_TypeInfo *type) {
61686     struct __pyx_typeinfo_string result = { {0} };
61687     char *buf = (char *) result.string;
61688     size_t size = type->size;
61689     switch (type->typegroup) {
61690         case 'H':
61691             *buf = 'c';
61692             break;
61693         case 'I':
61694         case 'U':
61695             if (size == 1)
61696                 *buf = (type->is_unsigned) ? 'B' : 'b';
61697             else if (size == 2)
61698                 *buf = (type->is_unsigned) ? 'H' : 'h';
61699             else if (size == 4)
61700                 *buf = (type->is_unsigned) ? 'I' : 'i';
61701             else if (size == 8)
61702                 *buf = (type->is_unsigned) ? 'Q' : 'q';
61703             break;
61704         case 'P':
61705             *buf = 'P';
61706             break;
61707         case 'C':
61708          {
61709             __Pyx_TypeInfo complex_type = *type;
61710             complex_type.typegroup = 'R';
61711             complex_type.size /= 2;
61712             *buf++ = 'Z';
61713             *buf = __Pyx_TypeInfoToFormat(&complex_type).string[0];
61714             break;
61715          }
61716         case 'R':
61717             if (size == 4)
61718                 *buf = 'f';
61719             else if (size == 8)
61720                 *buf = 'd';
61721             else
61722                 *buf = 'g';
61723             break;
61724     }
61725     return result;
61726 }
61727 
61728 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)61729   static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
61730     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
61731     const int is_unsigned = neg_one > const_zero;
61732 #if PY_MAJOR_VERSION < 3
61733     if (likely(PyInt_Check(x))) {
61734         if (sizeof(long) < sizeof(long)) {
61735             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
61736         } else {
61737             long val = PyInt_AS_LONG(x);
61738             if (is_unsigned && unlikely(val < 0)) {
61739                 goto raise_neg_overflow;
61740             }
61741             return (long) val;
61742         }
61743     } else
61744 #endif
61745     if (likely(PyLong_Check(x))) {
61746         if (is_unsigned) {
61747 #if CYTHON_USE_PYLONG_INTERNALS
61748             const digit* digits = ((PyLongObject*)x)->ob_digit;
61749             switch (Py_SIZE(x)) {
61750                 case  0: return (long) 0;
61751                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
61752                 case 2:
61753                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
61754                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
61755                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61756                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
61757                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
61758                         }
61759                     }
61760                     break;
61761                 case 3:
61762                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
61763                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
61764                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61765                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
61766                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
61767                         }
61768                     }
61769                     break;
61770                 case 4:
61771                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
61772                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
61773                             __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])))
61774                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
61775                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
61776                         }
61777                     }
61778                     break;
61779             }
61780 #endif
61781 #if CYTHON_COMPILING_IN_CPYTHON
61782             if (unlikely(Py_SIZE(x) < 0)) {
61783                 goto raise_neg_overflow;
61784             }
61785 #else
61786             {
61787                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
61788                 if (unlikely(result < 0))
61789                     return (long) -1;
61790                 if (unlikely(result == 1))
61791                     goto raise_neg_overflow;
61792             }
61793 #endif
61794             if (sizeof(long) <= sizeof(unsigned long)) {
61795                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
61796 #ifdef HAVE_LONG_LONG
61797             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
61798                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
61799 #endif
61800             }
61801         } else {
61802 #if CYTHON_USE_PYLONG_INTERNALS
61803             const digit* digits = ((PyLongObject*)x)->ob_digit;
61804             switch (Py_SIZE(x)) {
61805                 case  0: return (long) 0;
61806                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
61807                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
61808                 case -2:
61809                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
61810                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
61811                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61812                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
61813                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
61814                         }
61815                     }
61816                     break;
61817                 case 2:
61818                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
61819                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
61820                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61821                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
61822                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
61823                         }
61824                     }
61825                     break;
61826                 case -3:
61827                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
61828                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
61829                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61830                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
61831                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
61832                         }
61833                     }
61834                     break;
61835                 case 3:
61836                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
61837                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
61838                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
61839                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
61840                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
61841                         }
61842                     }
61843                     break;
61844                 case -4:
61845                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
61846                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
61847                             __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])))
61848                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
61849                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
61850                         }
61851                     }
61852                     break;
61853                 case 4:
61854                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
61855                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
61856                             __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])))
61857                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
61858                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
61859                         }
61860                     }
61861                     break;
61862             }
61863 #endif
61864             if (sizeof(long) <= sizeof(long)) {
61865                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
61866 #ifdef HAVE_LONG_LONG
61867             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
61868                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
61869 #endif
61870             }
61871         }
61872         {
61873 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
61874             PyErr_SetString(PyExc_RuntimeError,
61875                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
61876 #else
61877             long val;
61878             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
61879  #if PY_MAJOR_VERSION < 3
61880             if (likely(v) && !PyLong_Check(v)) {
61881                 PyObject *tmp = v;
61882                 v = PyNumber_Long(tmp);
61883                 Py_DECREF(tmp);
61884             }
61885  #endif
61886             if (likely(v)) {
61887                 int one = 1; int is_little = (int)*(unsigned char *)&one;
61888                 unsigned char *bytes = (unsigned char *)&val;
61889                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
61890                                               bytes, sizeof(val),
61891                                               is_little, !is_unsigned);
61892                 Py_DECREF(v);
61893                 if (likely(!ret))
61894                     return val;
61895             }
61896 #endif
61897             return (long) -1;
61898         }
61899     } else {
61900         long val;
61901         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
61902         if (!tmp) return (long) -1;
61903         val = __Pyx_PyInt_As_long(tmp);
61904         Py_DECREF(tmp);
61905         return val;
61906     }
61907 raise_overflow:
61908     PyErr_SetString(PyExc_OverflowError,
61909         "value too large to convert to long");
61910     return (long) -1;
61911 raise_neg_overflow:
61912     PyErr_SetString(PyExc_OverflowError,
61913         "can't convert negative value to long");
61914     return (long) -1;
61915 }
61916 
61917 /* BytesContains */
__Pyx_BytesContains(PyObject * bytes,char character)61918   static CYTHON_INLINE int __Pyx_BytesContains(PyObject* bytes, char character) {
61919     const Py_ssize_t length = PyBytes_GET_SIZE(bytes);
61920     char* char_start = PyBytes_AS_STRING(bytes);
61921     return memchr(char_start, (unsigned char)character, (size_t)length) != NULL;
61922 }
61923 
61924 /* PrintOne */
61925   #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
__Pyx_PrintOne(PyObject * f,PyObject * o)61926 static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
61927     if (!f) {
61928         if (!(f = __Pyx_GetStdout()))
61929             return -1;
61930     }
61931     Py_INCREF(f);
61932     if (PyFile_SoftSpace(f, 0)) {
61933         if (PyFile_WriteString(" ", f) < 0)
61934             goto error;
61935     }
61936     if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
61937         goto error;
61938     if (PyFile_WriteString("\n", f) < 0)
61939         goto error;
61940     Py_DECREF(f);
61941     return 0;
61942 error:
61943     Py_DECREF(f);
61944     return -1;
61945     /* the line below is just to avoid C compiler
61946      * warnings about unused functions */
61947     return __Pyx_Print(f, NULL, 0);
61948 }
61949 #else
__Pyx_PrintOne(PyObject * stream,PyObject * o)61950 static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
61951     int res;
61952     PyObject* arg_tuple = PyTuple_Pack(1, o);
61953     if (unlikely(!arg_tuple))
61954         return -1;
61955     res = __Pyx_Print(stream, arg_tuple, 1);
61956     Py_DECREF(arg_tuple);
61957     return res;
61958 }
61959 #endif
61960 
61961 /* ImportNumPyArray */
__Pyx__ImportNumPyArray(void)61962   static PyObject* __Pyx__ImportNumPyArray(void) {
61963     PyObject *numpy_module, *ndarray_object = NULL;
61964     numpy_module = __Pyx_Import(__pyx_n_s_numpy, NULL, 0);
61965     if (likely(numpy_module)) {
61966         ndarray_object = PyObject_GetAttrString(numpy_module, "ndarray");
61967         Py_DECREF(numpy_module);
61968     }
61969     if (unlikely(!ndarray_object)) {
61970         PyErr_Clear();
61971     }
61972     if (unlikely(!ndarray_object || !PyObject_TypeCheck(ndarray_object, &PyType_Type))) {
61973         Py_XDECREF(ndarray_object);
61974         Py_INCREF(Py_None);
61975         ndarray_object = Py_None;
61976     }
61977     return ndarray_object;
61978 }
__Pyx_ImportNumPyArrayTypeIfAvailable(void)61979 static CYTHON_INLINE PyObject* __Pyx_ImportNumPyArrayTypeIfAvailable(void) {
61980     if (unlikely(!__pyx_numpy_ndarray)) {
61981         __pyx_numpy_ndarray = __Pyx__ImportNumPyArray();
61982     }
61983     Py_INCREF(__pyx_numpy_ndarray);
61984     return __pyx_numpy_ndarray;
61985 }
61986 
61987 /* CIntFromPy */
__Pyx_PyInt_As_char(PyObject * x)61988   static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
61989     const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0;
61990     const int is_unsigned = neg_one > const_zero;
61991 #if PY_MAJOR_VERSION < 3
61992     if (likely(PyInt_Check(x))) {
61993         if (sizeof(char) < sizeof(long)) {
61994             __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
61995         } else {
61996             long val = PyInt_AS_LONG(x);
61997             if (is_unsigned && unlikely(val < 0)) {
61998                 goto raise_neg_overflow;
61999             }
62000             return (char) val;
62001         }
62002     } else
62003 #endif
62004     if (likely(PyLong_Check(x))) {
62005         if (is_unsigned) {
62006 #if CYTHON_USE_PYLONG_INTERNALS
62007             const digit* digits = ((PyLongObject*)x)->ob_digit;
62008             switch (Py_SIZE(x)) {
62009                 case  0: return (char) 0;
62010                 case  1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
62011                 case 2:
62012                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
62013                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
62014                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
62015                         } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
62016                             return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
62017                         }
62018                     }
62019                     break;
62020                 case 3:
62021                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
62022                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
62023                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
62024                         } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
62025                             return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
62026                         }
62027                     }
62028                     break;
62029                 case 4:
62030                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
62031                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
62032                             __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])))
62033                         } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
62034                             return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
62035                         }
62036                     }
62037                     break;
62038             }
62039 #endif
62040 #if CYTHON_COMPILING_IN_CPYTHON
62041             if (unlikely(Py_SIZE(x) < 0)) {
62042                 goto raise_neg_overflow;
62043             }
62044 #else
62045             {
62046                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
62047                 if (unlikely(result < 0))
62048                     return (char) -1;
62049                 if (unlikely(result == 1))
62050                     goto raise_neg_overflow;
62051             }
62052 #endif
62053             if (sizeof(char) <= sizeof(unsigned long)) {
62054                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
62055 #ifdef HAVE_LONG_LONG
62056             } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
62057                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
62058 #endif
62059             }
62060         } else {
62061 #if CYTHON_USE_PYLONG_INTERNALS
62062             const digit* digits = ((PyLongObject*)x)->ob_digit;
62063             switch (Py_SIZE(x)) {
62064                 case  0: return (char) 0;
62065                 case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
62066                 case  1: __PYX_VERIFY_RETURN_INT(char,  digit, +digits[0])
62067                 case -2:
62068                     if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
62069                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
62070                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
62071                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
62072                             return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
62073                         }
62074                     }
62075                     break;
62076                 case 2:
62077                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
62078                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
62079                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
62080                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
62081                             return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
62082                         }
62083                     }
62084                     break;
62085                 case -3:
62086                     if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
62087                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
62088                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
62089                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
62090                             return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
62091                         }
62092                     }
62093                     break;
62094                 case 3:
62095                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
62096                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
62097                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
62098                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
62099                             return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
62100                         }
62101                     }
62102                     break;
62103                 case -4:
62104                     if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
62105                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
62106                             __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])))
62107                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
62108                             return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
62109                         }
62110                     }
62111                     break;
62112                 case 4:
62113                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
62114                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
62115                             __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])))
62116                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
62117                             return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
62118                         }
62119                     }
62120                     break;
62121             }
62122 #endif
62123             if (sizeof(char) <= sizeof(long)) {
62124                 __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
62125 #ifdef HAVE_LONG_LONG
62126             } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
62127                 __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
62128 #endif
62129             }
62130         }
62131         {
62132 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
62133             PyErr_SetString(PyExc_RuntimeError,
62134                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
62135 #else
62136             char val;
62137             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
62138  #if PY_MAJOR_VERSION < 3
62139             if (likely(v) && !PyLong_Check(v)) {
62140                 PyObject *tmp = v;
62141                 v = PyNumber_Long(tmp);
62142                 Py_DECREF(tmp);
62143             }
62144  #endif
62145             if (likely(v)) {
62146                 int one = 1; int is_little = (int)*(unsigned char *)&one;
62147                 unsigned char *bytes = (unsigned char *)&val;
62148                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
62149                                               bytes, sizeof(val),
62150                                               is_little, !is_unsigned);
62151                 Py_DECREF(v);
62152                 if (likely(!ret))
62153                     return val;
62154             }
62155 #endif
62156             return (char) -1;
62157         }
62158     } else {
62159         char val;
62160         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
62161         if (!tmp) return (char) -1;
62162         val = __Pyx_PyInt_As_char(tmp);
62163         Py_DECREF(tmp);
62164         return val;
62165     }
62166 raise_overflow:
62167     PyErr_SetString(PyExc_OverflowError,
62168         "value too large to convert to char");
62169     return (char) -1;
62170 raise_neg_overflow:
62171     PyErr_SetString(PyExc_OverflowError,
62172         "can't convert negative value to char");
62173     return (char) -1;
62174 }
62175 
62176 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_uint32_t(PyObject * obj,int writable_flag)62177   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_uint32_t(PyObject *obj, int writable_flag) {
62178     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
62179     __Pyx_BufFmt_StackElem stack[1];
62180     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
62181     int retcode;
62182     if (obj == Py_None) {
62183         result.memview = (struct __pyx_memoryview_obj *) Py_None;
62184         return result;
62185     }
62186     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
62187                                                  PyBUF_RECORDS_RO | writable_flag, 2,
62188                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint32_t, stack,
62189                                                  &result, obj);
62190     if (unlikely(retcode == -1))
62191         goto __pyx_fail;
62192     return result;
62193 __pyx_fail:
62194     result.memview = NULL;
62195     result.data = NULL;
62196     return result;
62197 }
62198 
62199 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_uint64_t(PyObject * obj,int writable_flag)62200   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_uint64_t(PyObject *obj, int writable_flag) {
62201     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
62202     __Pyx_BufFmt_StackElem stack[1];
62203     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
62204     int retcode;
62205     if (obj == Py_None) {
62206         result.memview = (struct __pyx_memoryview_obj *) Py_None;
62207         return result;
62208     }
62209     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
62210                                                  PyBUF_RECORDS_RO | writable_flag, 2,
62211                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, stack,
62212                                                  &result, obj);
62213     if (unlikely(retcode == -1))
62214         goto __pyx_fail;
62215     return result;
62216 __pyx_fail:
62217     result.memview = NULL;
62218     result.data = NULL;
62219     return result;
62220 }
62221 
62222 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_uint64_t(PyObject * obj,int writable_flag)62223   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_uint64_t(PyObject *obj, int writable_flag) {
62224     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
62225     __Pyx_BufFmt_StackElem stack[1];
62226     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
62227     int retcode;
62228     if (obj == Py_None) {
62229         result.memview = (struct __pyx_memoryview_obj *) Py_None;
62230         return result;
62231     }
62232     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
62233                                                  PyBUF_RECORDS_RO | writable_flag, 1,
62234                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint64_t, stack,
62235                                                  &result, obj);
62236     if (unlikely(retcode == -1))
62237         goto __pyx_fail;
62238     return result;
62239 __pyx_fail:
62240     result.memview = NULL;
62241     result.data = NULL;
62242     return result;
62243 }
62244 
62245 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(PyObject * obj,int writable_flag)62246   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float64_t(PyObject *obj, int writable_flag) {
62247     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
62248     __Pyx_BufFmt_StackElem stack[1];
62249     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
62250     int retcode;
62251     if (obj == Py_None) {
62252         result.memview = (struct __pyx_memoryview_obj *) Py_None;
62253         return result;
62254     }
62255     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
62256                                                  PyBUF_RECORDS_RO | writable_flag, 1,
62257                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, stack,
62258                                                  &result, obj);
62259     if (unlikely(retcode == -1))
62260         goto __pyx_fail;
62261     return result;
62262 __pyx_fail:
62263     result.memview = NULL;
62264     result.data = NULL;
62265     return result;
62266 }
62267 
62268 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int64_t(PyObject * obj,int writable_flag)62269   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_int64_t(PyObject *obj, int writable_flag) {
62270     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
62271     __Pyx_BufFmt_StackElem stack[1];
62272     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
62273     int retcode;
62274     if (obj == Py_None) {
62275         result.memview = (struct __pyx_memoryview_obj *) Py_None;
62276         return result;
62277     }
62278     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
62279                                                  PyBUF_RECORDS_RO | writable_flag, 1,
62280                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, stack,
62281                                                  &result, obj);
62282     if (unlikely(retcode == -1))
62283         goto __pyx_fail;
62284     return result;
62285 __pyx_fail:
62286     result.memview = NULL;
62287     result.data = NULL;
62288     return result;
62289 }
62290 
62291 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)62292   static int __Pyx_check_binary_version(void) {
62293     char ctversion[4], rtversion[4];
62294     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
62295     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
62296     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
62297         char message[200];
62298         PyOS_snprintf(message, sizeof(message),
62299                       "compiletime version %s of module '%.100s' "
62300                       "does not match runtime version %s",
62301                       ctversion, __Pyx_MODULE_NAME, rtversion);
62302         return PyErr_WarnEx(NULL, message, 1);
62303     }
62304     return 0;
62305 }
62306 
62307 /* FunctionExport */
__Pyx_ExportFunction(const char * name,void (* f)(void),const char * sig)62308   static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
62309     PyObject *d = 0;
62310     PyObject *cobj = 0;
62311     union {
62312         void (*fp)(void);
62313         void *p;
62314     } tmp;
62315     d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
62316     if (!d) {
62317         PyErr_Clear();
62318         d = PyDict_New();
62319         if (!d)
62320             goto bad;
62321         Py_INCREF(d);
62322         if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
62323             goto bad;
62324     }
62325     tmp.fp = f;
62326 #if PY_VERSION_HEX >= 0x02070000
62327     cobj = PyCapsule_New(tmp.p, sig, 0);
62328 #else
62329     cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
62330 #endif
62331     if (!cobj)
62332         goto bad;
62333     if (PyDict_SetItemString(d, name, cobj) < 0)
62334         goto bad;
62335     Py_DECREF(cobj);
62336     Py_DECREF(d);
62337     return 0;
62338 bad:
62339     Py_XDECREF(cobj);
62340     Py_XDECREF(d);
62341     return -1;
62342 }
62343 
62344 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)62345   static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
62346     while (t->p) {
62347         #if PY_MAJOR_VERSION < 3
62348         if (t->is_unicode) {
62349             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
62350         } else if (t->intern) {
62351             *t->p = PyString_InternFromString(t->s);
62352         } else {
62353             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
62354         }
62355         #else
62356         if (t->is_unicode | t->is_str) {
62357             if (t->intern) {
62358                 *t->p = PyUnicode_InternFromString(t->s);
62359             } else if (t->encoding) {
62360                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
62361             } else {
62362                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
62363             }
62364         } else {
62365             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
62366         }
62367         #endif
62368         if (!*t->p)
62369             return -1;
62370         if (PyObject_Hash(*t->p) == -1)
62371             return -1;
62372         ++t;
62373     }
62374     return 0;
62375 }
62376 
__Pyx_PyUnicode_FromString(const char * c_str)62377 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
62378     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
62379 }
__Pyx_PyObject_AsString(PyObject * o)62380 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
62381     Py_ssize_t ignore;
62382     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
62383 }
62384 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
62385 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)62386 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
62387     char* defenc_c;
62388     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
62389     if (!defenc) return NULL;
62390     defenc_c = PyBytes_AS_STRING(defenc);
62391 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
62392     {
62393         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
62394         char* c;
62395         for (c = defenc_c; c < end; c++) {
62396             if ((unsigned char) (*c) >= 128) {
62397                 PyUnicode_AsASCIIString(o);
62398                 return NULL;
62399             }
62400         }
62401     }
62402 #endif
62403     *length = PyBytes_GET_SIZE(defenc);
62404     return defenc_c;
62405 }
62406 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)62407 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
62408     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
62409 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
62410     if (likely(PyUnicode_IS_ASCII(o))) {
62411         *length = PyUnicode_GET_LENGTH(o);
62412         return PyUnicode_AsUTF8(o);
62413     } else {
62414         PyUnicode_AsASCIIString(o);
62415         return NULL;
62416     }
62417 #else
62418     return PyUnicode_AsUTF8AndSize(o, length);
62419 #endif
62420 }
62421 #endif
62422 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)62423 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
62424 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
62425     if (
62426 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
62427             __Pyx_sys_getdefaultencoding_not_ascii &&
62428 #endif
62429             PyUnicode_Check(o)) {
62430         return __Pyx_PyUnicode_AsStringAndSize(o, length);
62431     } else
62432 #endif
62433 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
62434     if (PyByteArray_Check(o)) {
62435         *length = PyByteArray_GET_SIZE(o);
62436         return PyByteArray_AS_STRING(o);
62437     } else
62438 #endif
62439     {
62440         char* result;
62441         int r = PyBytes_AsStringAndSize(o, &result, length);
62442         if (unlikely(r < 0)) {
62443             return NULL;
62444         } else {
62445             return result;
62446         }
62447     }
62448 }
__Pyx_PyObject_IsTrue(PyObject * x)62449 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
62450    int is_true = x == Py_True;
62451    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
62452    else return PyObject_IsTrue(x);
62453 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)62454 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
62455     int retval;
62456     if (unlikely(!x)) return -1;
62457     retval = __Pyx_PyObject_IsTrue(x);
62458     Py_DECREF(x);
62459     return retval;
62460 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)62461 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
62462 #if PY_MAJOR_VERSION >= 3
62463     if (PyLong_Check(result)) {
62464         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
62465                 "__int__ returned non-int (type %.200s).  "
62466                 "The ability to return an instance of a strict subclass of int "
62467                 "is deprecated, and may be removed in a future version of Python.",
62468                 Py_TYPE(result)->tp_name)) {
62469             Py_DECREF(result);
62470             return NULL;
62471         }
62472         return result;
62473     }
62474 #endif
62475     PyErr_Format(PyExc_TypeError,
62476                  "__%.4s__ returned non-%.4s (type %.200s)",
62477                  type_name, type_name, Py_TYPE(result)->tp_name);
62478     Py_DECREF(result);
62479     return NULL;
62480 }
__Pyx_PyNumber_IntOrLong(PyObject * x)62481 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
62482 #if CYTHON_USE_TYPE_SLOTS
62483   PyNumberMethods *m;
62484 #endif
62485   const char *name = NULL;
62486   PyObject *res = NULL;
62487 #if PY_MAJOR_VERSION < 3
62488   if (likely(PyInt_Check(x) || PyLong_Check(x)))
62489 #else
62490   if (likely(PyLong_Check(x)))
62491 #endif
62492     return __Pyx_NewRef(x);
62493 #if CYTHON_USE_TYPE_SLOTS
62494   m = Py_TYPE(x)->tp_as_number;
62495   #if PY_MAJOR_VERSION < 3
62496   if (m && m->nb_int) {
62497     name = "int";
62498     res = m->nb_int(x);
62499   }
62500   else if (m && m->nb_long) {
62501     name = "long";
62502     res = m->nb_long(x);
62503   }
62504   #else
62505   if (likely(m && m->nb_int)) {
62506     name = "int";
62507     res = m->nb_int(x);
62508   }
62509   #endif
62510 #else
62511   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
62512     res = PyNumber_Int(x);
62513   }
62514 #endif
62515   if (likely(res)) {
62516 #if PY_MAJOR_VERSION < 3
62517     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
62518 #else
62519     if (unlikely(!PyLong_CheckExact(res))) {
62520 #endif
62521         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
62522     }
62523   }
62524   else if (!PyErr_Occurred()) {
62525     PyErr_SetString(PyExc_TypeError,
62526                     "an integer is required");
62527   }
62528   return res;
62529 }
62530 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
62531   Py_ssize_t ival;
62532   PyObject *x;
62533 #if PY_MAJOR_VERSION < 3
62534   if (likely(PyInt_CheckExact(b))) {
62535     if (sizeof(Py_ssize_t) >= sizeof(long))
62536         return PyInt_AS_LONG(b);
62537     else
62538         return PyInt_AsSsize_t(b);
62539   }
62540 #endif
62541   if (likely(PyLong_CheckExact(b))) {
62542     #if CYTHON_USE_PYLONG_INTERNALS
62543     const digit* digits = ((PyLongObject*)b)->ob_digit;
62544     const Py_ssize_t size = Py_SIZE(b);
62545     if (likely(__Pyx_sst_abs(size) <= 1)) {
62546         ival = likely(size) ? digits[0] : 0;
62547         if (size == -1) ival = -ival;
62548         return ival;
62549     } else {
62550       switch (size) {
62551          case 2:
62552            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
62553              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
62554            }
62555            break;
62556          case -2:
62557            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
62558              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
62559            }
62560            break;
62561          case 3:
62562            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
62563              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
62564            }
62565            break;
62566          case -3:
62567            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
62568              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
62569            }
62570            break;
62571          case 4:
62572            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
62573              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]));
62574            }
62575            break;
62576          case -4:
62577            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
62578              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]));
62579            }
62580            break;
62581       }
62582     }
62583     #endif
62584     return PyLong_AsSsize_t(b);
62585   }
62586   x = PyNumber_Index(b);
62587   if (!x) return -1;
62588   ival = PyInt_AsSsize_t(x);
62589   Py_DECREF(x);
62590   return ival;
62591 }
62592 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
62593   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
62594 }
62595 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
62596     return PyInt_FromSize_t(ival);
62597 }
62598 
62599 
62600 #endif /* Py_PYTHON_H */
62601