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         "include_dirs": [
10             "yt/utilities/lib"
11         ],
12         "libraries": [
13             "m"
14         ],
15         "name": "yt.utilities.lib.primitives",
16         "sources": [
17             "yt/utilities/lib/primitives.pyx"
18         ]
19     },
20     "module_name": "yt.utilities.lib.primitives"
21 }
22 END: Cython Metadata */
23 
24 #define PY_SSIZE_T_CLEAN
25 #include "Python.h"
26 #ifndef Py_PYTHON_H
27     #error Python headers needed to compile C extensions, please install development version of Python.
28 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
29     #error Cython requires Python 2.6+ or Python 3.3+.
30 #else
31 #define CYTHON_ABI "0_29_12"
32 #define CYTHON_HEX_VERSION 0x001D0CF0
33 #define CYTHON_FUTURE_DIVISION 0
34 #include <stddef.h>
35 #ifndef offsetof
36   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
37 #endif
38 #if !defined(WIN32) && !defined(MS_WINDOWS)
39   #ifndef __stdcall
40     #define __stdcall
41   #endif
42   #ifndef __cdecl
43     #define __cdecl
44   #endif
45   #ifndef __fastcall
46     #define __fastcall
47   #endif
48 #endif
49 #ifndef DL_IMPORT
50   #define DL_IMPORT(t) t
51 #endif
52 #ifndef DL_EXPORT
53   #define DL_EXPORT(t) t
54 #endif
55 #define __PYX_COMMA ,
56 #ifndef HAVE_LONG_LONG
57   #if PY_VERSION_HEX >= 0x02070000
58     #define HAVE_LONG_LONG
59   #endif
60 #endif
61 #ifndef PY_LONG_LONG
62   #define PY_LONG_LONG LONG_LONG
63 #endif
64 #ifndef Py_HUGE_VAL
65   #define Py_HUGE_VAL HUGE_VAL
66 #endif
67 #ifdef PYPY_VERSION
68   #define CYTHON_COMPILING_IN_PYPY 1
69   #define CYTHON_COMPILING_IN_PYSTON 0
70   #define CYTHON_COMPILING_IN_CPYTHON 0
71   #undef CYTHON_USE_TYPE_SLOTS
72   #define CYTHON_USE_TYPE_SLOTS 0
73   #undef CYTHON_USE_PYTYPE_LOOKUP
74   #define CYTHON_USE_PYTYPE_LOOKUP 0
75   #if PY_VERSION_HEX < 0x03050000
76     #undef CYTHON_USE_ASYNC_SLOTS
77     #define CYTHON_USE_ASYNC_SLOTS 0
78   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
79     #define CYTHON_USE_ASYNC_SLOTS 1
80   #endif
81   #undef CYTHON_USE_PYLIST_INTERNALS
82   #define CYTHON_USE_PYLIST_INTERNALS 0
83   #undef CYTHON_USE_UNICODE_INTERNALS
84   #define CYTHON_USE_UNICODE_INTERNALS 0
85   #undef CYTHON_USE_UNICODE_WRITER
86   #define CYTHON_USE_UNICODE_WRITER 0
87   #undef CYTHON_USE_PYLONG_INTERNALS
88   #define CYTHON_USE_PYLONG_INTERNALS 0
89   #undef CYTHON_AVOID_BORROWED_REFS
90   #define CYTHON_AVOID_BORROWED_REFS 1
91   #undef CYTHON_ASSUME_SAFE_MACROS
92   #define CYTHON_ASSUME_SAFE_MACROS 0
93   #undef CYTHON_UNPACK_METHODS
94   #define CYTHON_UNPACK_METHODS 0
95   #undef CYTHON_FAST_THREAD_STATE
96   #define CYTHON_FAST_THREAD_STATE 0
97   #undef CYTHON_FAST_PYCALL
98   #define CYTHON_FAST_PYCALL 0
99   #undef CYTHON_PEP489_MULTI_PHASE_INIT
100   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
101   #undef CYTHON_USE_TP_FINALIZE
102   #define CYTHON_USE_TP_FINALIZE 0
103   #undef CYTHON_USE_DICT_VERSIONS
104   #define CYTHON_USE_DICT_VERSIONS 0
105   #undef CYTHON_USE_EXC_INFO_STACK
106   #define CYTHON_USE_EXC_INFO_STACK 0
107 #elif defined(PYSTON_VERSION)
108   #define CYTHON_COMPILING_IN_PYPY 0
109   #define CYTHON_COMPILING_IN_PYSTON 1
110   #define CYTHON_COMPILING_IN_CPYTHON 0
111   #ifndef CYTHON_USE_TYPE_SLOTS
112     #define CYTHON_USE_TYPE_SLOTS 1
113   #endif
114   #undef CYTHON_USE_PYTYPE_LOOKUP
115   #define CYTHON_USE_PYTYPE_LOOKUP 0
116   #undef CYTHON_USE_ASYNC_SLOTS
117   #define CYTHON_USE_ASYNC_SLOTS 0
118   #undef CYTHON_USE_PYLIST_INTERNALS
119   #define CYTHON_USE_PYLIST_INTERNALS 0
120   #ifndef CYTHON_USE_UNICODE_INTERNALS
121     #define CYTHON_USE_UNICODE_INTERNALS 1
122   #endif
123   #undef CYTHON_USE_UNICODE_WRITER
124   #define CYTHON_USE_UNICODE_WRITER 0
125   #undef CYTHON_USE_PYLONG_INTERNALS
126   #define CYTHON_USE_PYLONG_INTERNALS 0
127   #ifndef CYTHON_AVOID_BORROWED_REFS
128     #define CYTHON_AVOID_BORROWED_REFS 0
129   #endif
130   #ifndef CYTHON_ASSUME_SAFE_MACROS
131     #define CYTHON_ASSUME_SAFE_MACROS 1
132   #endif
133   #ifndef CYTHON_UNPACK_METHODS
134     #define CYTHON_UNPACK_METHODS 1
135   #endif
136   #undef CYTHON_FAST_THREAD_STATE
137   #define CYTHON_FAST_THREAD_STATE 0
138   #undef CYTHON_FAST_PYCALL
139   #define CYTHON_FAST_PYCALL 0
140   #undef CYTHON_PEP489_MULTI_PHASE_INIT
141   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
142   #undef CYTHON_USE_TP_FINALIZE
143   #define CYTHON_USE_TP_FINALIZE 0
144   #undef CYTHON_USE_DICT_VERSIONS
145   #define CYTHON_USE_DICT_VERSIONS 0
146   #undef CYTHON_USE_EXC_INFO_STACK
147   #define CYTHON_USE_EXC_INFO_STACK 0
148 #else
149   #define CYTHON_COMPILING_IN_PYPY 0
150   #define CYTHON_COMPILING_IN_PYSTON 0
151   #define CYTHON_COMPILING_IN_CPYTHON 1
152   #ifndef CYTHON_USE_TYPE_SLOTS
153     #define CYTHON_USE_TYPE_SLOTS 1
154   #endif
155   #if PY_VERSION_HEX < 0x02070000
156     #undef CYTHON_USE_PYTYPE_LOOKUP
157     #define CYTHON_USE_PYTYPE_LOOKUP 0
158   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
159     #define CYTHON_USE_PYTYPE_LOOKUP 1
160   #endif
161   #if PY_MAJOR_VERSION < 3
162     #undef CYTHON_USE_ASYNC_SLOTS
163     #define CYTHON_USE_ASYNC_SLOTS 0
164   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
165     #define CYTHON_USE_ASYNC_SLOTS 1
166   #endif
167   #if PY_VERSION_HEX < 0x02070000
168     #undef CYTHON_USE_PYLONG_INTERNALS
169     #define CYTHON_USE_PYLONG_INTERNALS 0
170   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
171     #define CYTHON_USE_PYLONG_INTERNALS 1
172   #endif
173   #ifndef CYTHON_USE_PYLIST_INTERNALS
174     #define CYTHON_USE_PYLIST_INTERNALS 1
175   #endif
176   #ifndef CYTHON_USE_UNICODE_INTERNALS
177     #define CYTHON_USE_UNICODE_INTERNALS 1
178   #endif
179   #if PY_VERSION_HEX < 0x030300F0
180     #undef CYTHON_USE_UNICODE_WRITER
181     #define CYTHON_USE_UNICODE_WRITER 0
182   #elif !defined(CYTHON_USE_UNICODE_WRITER)
183     #define CYTHON_USE_UNICODE_WRITER 1
184   #endif
185   #ifndef CYTHON_AVOID_BORROWED_REFS
186     #define CYTHON_AVOID_BORROWED_REFS 0
187   #endif
188   #ifndef CYTHON_ASSUME_SAFE_MACROS
189     #define CYTHON_ASSUME_SAFE_MACROS 1
190   #endif
191   #ifndef CYTHON_UNPACK_METHODS
192     #define CYTHON_UNPACK_METHODS 1
193   #endif
194   #ifndef CYTHON_FAST_THREAD_STATE
195     #define CYTHON_FAST_THREAD_STATE 1
196   #endif
197   #ifndef CYTHON_FAST_PYCALL
198     #define CYTHON_FAST_PYCALL 1
199   #endif
200   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
201     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
202   #endif
203   #ifndef CYTHON_USE_TP_FINALIZE
204     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
205   #endif
206   #ifndef CYTHON_USE_DICT_VERSIONS
207     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
208   #endif
209   #ifndef CYTHON_USE_EXC_INFO_STACK
210     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
211   #endif
212 #endif
213 #if !defined(CYTHON_FAST_PYCCALL)
214 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
215 #endif
216 #if CYTHON_USE_PYLONG_INTERNALS
217   #include "longintrepr.h"
218   #undef SHIFT
219   #undef BASE
220   #undef MASK
221   #ifdef SIZEOF_VOID_P
222     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
223   #endif
224 #endif
225 #ifndef __has_attribute
226   #define __has_attribute(x) 0
227 #endif
228 #ifndef __has_cpp_attribute
229   #define __has_cpp_attribute(x) 0
230 #endif
231 #ifndef CYTHON_RESTRICT
232   #if defined(__GNUC__)
233     #define CYTHON_RESTRICT __restrict__
234   #elif defined(_MSC_VER) && _MSC_VER >= 1400
235     #define CYTHON_RESTRICT __restrict
236   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
237     #define CYTHON_RESTRICT restrict
238   #else
239     #define CYTHON_RESTRICT
240   #endif
241 #endif
242 #ifndef CYTHON_UNUSED
243 # if defined(__GNUC__)
244 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
245 #     define CYTHON_UNUSED __attribute__ ((__unused__))
246 #   else
247 #     define CYTHON_UNUSED
248 #   endif
249 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
250 #   define CYTHON_UNUSED __attribute__ ((__unused__))
251 # else
252 #   define CYTHON_UNUSED
253 # endif
254 #endif
255 #ifndef CYTHON_MAYBE_UNUSED_VAR
256 #  if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)257      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
258 #  else
259 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
260 #  endif
261 #endif
262 #ifndef CYTHON_NCP_UNUSED
263 # if CYTHON_COMPILING_IN_CPYTHON
264 #  define CYTHON_NCP_UNUSED
265 # else
266 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
267 # endif
268 #endif
269 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
270 #ifdef _MSC_VER
271     #ifndef _MSC_STDINT_H_
272         #if _MSC_VER < 1300
273            typedef unsigned char     uint8_t;
274            typedef unsigned int      uint32_t;
275         #else
276            typedef unsigned __int8   uint8_t;
277            typedef unsigned __int32  uint32_t;
278         #endif
279     #endif
280 #else
281    #include <stdint.h>
282 #endif
283 #ifndef CYTHON_FALLTHROUGH
284   #if defined(__cplusplus) && __cplusplus >= 201103L
285     #if __has_cpp_attribute(fallthrough)
286       #define CYTHON_FALLTHROUGH [[fallthrough]]
287     #elif __has_cpp_attribute(clang::fallthrough)
288       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
289     #elif __has_cpp_attribute(gnu::fallthrough)
290       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
291     #endif
292   #endif
293   #ifndef CYTHON_FALLTHROUGH
294     #if __has_attribute(fallthrough)
295       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
296     #else
297       #define CYTHON_FALLTHROUGH
298     #endif
299   #endif
300   #if defined(__clang__ ) && defined(__apple_build_version__)
301     #if __apple_build_version__ < 7000000
302       #undef  CYTHON_FALLTHROUGH
303       #define CYTHON_FALLTHROUGH
304     #endif
305   #endif
306 #endif
307 
308 #ifndef CYTHON_INLINE
309   #if defined(__clang__)
310     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
311   #elif defined(__GNUC__)
312     #define CYTHON_INLINE __inline__
313   #elif defined(_MSC_VER)
314     #define CYTHON_INLINE __inline
315   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
316     #define CYTHON_INLINE inline
317   #else
318     #define CYTHON_INLINE
319   #endif
320 #endif
321 
322 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
323   #define Py_OptimizeFlag 0
324 #endif
325 #define __PYX_BUILD_PY_SSIZE_T "n"
326 #define CYTHON_FORMAT_SSIZE_T "z"
327 #if PY_MAJOR_VERSION < 3
328   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
329   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
330           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
331   #define __Pyx_DefaultClassType PyClass_Type
332 #else
333   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
334 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
335   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
336           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
337 #else
338   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
339           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
340 #endif
341   #define __Pyx_DefaultClassType PyType_Type
342 #endif
343 #ifndef Py_TPFLAGS_CHECKTYPES
344   #define Py_TPFLAGS_CHECKTYPES 0
345 #endif
346 #ifndef Py_TPFLAGS_HAVE_INDEX
347   #define Py_TPFLAGS_HAVE_INDEX 0
348 #endif
349 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
350   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
351 #endif
352 #ifndef Py_TPFLAGS_HAVE_FINALIZE
353   #define Py_TPFLAGS_HAVE_FINALIZE 0
354 #endif
355 #ifndef METH_STACKLESS
356   #define METH_STACKLESS 0
357 #endif
358 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
359   #ifndef METH_FASTCALL
360      #define METH_FASTCALL 0x80
361   #endif
362   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
363   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
364                                                           Py_ssize_t nargs, PyObject *kwnames);
365 #else
366   #define __Pyx_PyCFunctionFast _PyCFunctionFast
367   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
368 #endif
369 #if CYTHON_FAST_PYCCALL
370 #define __Pyx_PyFastCFunction_Check(func)\
371     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
372 #else
373 #define __Pyx_PyFastCFunction_Check(func) 0
374 #endif
375 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
376   #define PyObject_Malloc(s)   PyMem_Malloc(s)
377   #define PyObject_Free(p)     PyMem_Free(p)
378   #define PyObject_Realloc(p)  PyMem_Realloc(p)
379 #endif
380 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
381   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
382   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
383   #define PyMem_RawFree(p)             PyMem_Free(p)
384 #endif
385 #if CYTHON_COMPILING_IN_PYSTON
386   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
387   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
388 #else
389   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
390   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
391 #endif
392 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
393   #define __Pyx_PyThreadState_Current PyThreadState_GET()
394 #elif PY_VERSION_HEX >= 0x03060000
395   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
396 #elif PY_VERSION_HEX >= 0x03000000
397   #define __Pyx_PyThreadState_Current PyThreadState_GET()
398 #else
399   #define __Pyx_PyThreadState_Current _PyThreadState_Current
400 #endif
401 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
402 #include "pythread.h"
403 #define Py_tss_NEEDS_INIT 0
404 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)405 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
406   *key = PyThread_create_key();
407   return 0;
408 }
PyThread_tss_alloc(void)409 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
410   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
411   *key = Py_tss_NEEDS_INIT;
412   return key;
413 }
PyThread_tss_free(Py_tss_t * key)414 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
415   PyObject_Free(key);
416 }
PyThread_tss_is_created(Py_tss_t * key)417 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
418   return *key != Py_tss_NEEDS_INIT;
419 }
PyThread_tss_delete(Py_tss_t * key)420 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
421   PyThread_delete_key(*key);
422   *key = Py_tss_NEEDS_INIT;
423 }
PyThread_tss_set(Py_tss_t * key,void * value)424 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
425   return PyThread_set_key_value(*key, value);
426 }
PyThread_tss_get(Py_tss_t * key)427 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
428   return PyThread_get_key_value(*key);
429 }
430 #endif
431 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
432 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
433 #else
434 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
435 #endif
436 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
437   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
438   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
439 #else
440   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
441   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
442 #endif
443 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
444 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
445 #else
446 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
447 #endif
448 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
449   #define CYTHON_PEP393_ENABLED 1
450   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
451                                               0 : _PyUnicode_Ready((PyObject *)(op)))
452   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
453   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
454   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
455   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
456   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
457   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
458   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
459   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
460 #else
461   #define CYTHON_PEP393_ENABLED 0
462   #define PyUnicode_1BYTE_KIND  1
463   #define PyUnicode_2BYTE_KIND  2
464   #define PyUnicode_4BYTE_KIND  4
465   #define __Pyx_PyUnicode_READY(op)       (0)
466   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
467   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
468   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
469   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
470   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
471   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
472   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
473   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
474 #endif
475 #if CYTHON_COMPILING_IN_PYPY
476   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
477   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
478 #else
479   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
480   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
481       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
482 #endif
483 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
484   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
485 #endif
486 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
487   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
488 #endif
489 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
490   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
491 #endif
492 #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))
493 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
494 #if PY_MAJOR_VERSION >= 3
495   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
496 #else
497   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
498 #endif
499 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
500   #define PyObject_ASCII(o)            PyObject_Repr(o)
501 #endif
502 #if PY_MAJOR_VERSION >= 3
503   #define PyBaseString_Type            PyUnicode_Type
504   #define PyStringObject               PyUnicodeObject
505   #define PyString_Type                PyUnicode_Type
506   #define PyString_Check               PyUnicode_Check
507   #define PyString_CheckExact          PyUnicode_CheckExact
508   #define PyObject_Unicode             PyObject_Str
509 #endif
510 #if PY_MAJOR_VERSION >= 3
511   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
512   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
513 #else
514   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
515   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
516 #endif
517 #ifndef PySet_CheckExact
518   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
519 #endif
520 #if CYTHON_ASSUME_SAFE_MACROS
521   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
522 #else
523   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
524 #endif
525 #if PY_MAJOR_VERSION >= 3
526   #define PyIntObject                  PyLongObject
527   #define PyInt_Type                   PyLong_Type
528   #define PyInt_Check(op)              PyLong_Check(op)
529   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
530   #define PyInt_FromString             PyLong_FromString
531   #define PyInt_FromUnicode            PyLong_FromUnicode
532   #define PyInt_FromLong               PyLong_FromLong
533   #define PyInt_FromSize_t             PyLong_FromSize_t
534   #define PyInt_FromSsize_t            PyLong_FromSsize_t
535   #define PyInt_AsLong                 PyLong_AsLong
536   #define PyInt_AS_LONG                PyLong_AS_LONG
537   #define PyInt_AsSsize_t              PyLong_AsSsize_t
538   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
539   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
540   #define PyNumber_Int                 PyNumber_Long
541 #endif
542 #if PY_MAJOR_VERSION >= 3
543   #define PyBoolObject                 PyLongObject
544 #endif
545 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
546   #ifndef PyUnicode_InternFromString
547     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
548   #endif
549 #endif
550 #if PY_VERSION_HEX < 0x030200A4
551   typedef long Py_hash_t;
552   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
553   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
554 #else
555   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
556   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
557 #endif
558 #if PY_MAJOR_VERSION >= 3
559   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
560 #else
561   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
562 #endif
563 #if CYTHON_USE_ASYNC_SLOTS
564   #if PY_VERSION_HEX >= 0x030500B1
565     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
566     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
567   #else
568     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
569   #endif
570 #else
571   #define __Pyx_PyType_AsAsync(obj) NULL
572 #endif
573 #ifndef __Pyx_PyAsyncMethodsStruct
574     typedef struct {
575         unaryfunc am_await;
576         unaryfunc am_aiter;
577         unaryfunc am_anext;
578     } __Pyx_PyAsyncMethodsStruct;
579 #endif
580 
581 #if defined(WIN32) || defined(MS_WINDOWS)
582   #define _USE_MATH_DEFINES
583 #endif
584 #include <math.h>
585 #ifdef NAN
586 #define __PYX_NAN() ((float) NAN)
587 #else
__PYX_NAN()588 static CYTHON_INLINE float __PYX_NAN() {
589   float value;
590   memset(&value, 0xFF, sizeof(value));
591   return value;
592 }
593 #endif
594 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
595 #define __Pyx_truncl trunc
596 #else
597 #define __Pyx_truncl truncl
598 #endif
599 
600 
601 #define __PYX_ERR(f_index, lineno, Ln_error) \
602 { \
603   __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
604 }
605 
606 #ifndef __PYX_EXTERN_C
607   #ifdef __cplusplus
608     #define __PYX_EXTERN_C extern "C"
609   #else
610     #define __PYX_EXTERN_C extern
611   #endif
612 #endif
613 
614 #define __PYX_HAVE__yt__utilities__lib__primitives
615 #define __PYX_HAVE_API__yt__utilities__lib__primitives
616 /* Early includes */
617 #include <string.h>
618 #include <stdio.h>
619 #include "numpy/arrayobject.h"
620 #include "numpy/ufuncobject.h"
621 #include <math.h>
622 #include "platform_dep.h"
623 #ifdef _OPENMP
624 #include <omp.h>
625 #endif /* _OPENMP */
626 
627 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
628 #define CYTHON_WITHOUT_ASSERTIONS
629 #endif
630 
631 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
632                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
633 
634 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
635 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
636 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
637 #define __PYX_DEFAULT_STRING_ENCODING ""
638 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
639 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
640 #define __Pyx_uchar_cast(c) ((unsigned char)c)
641 #define __Pyx_long_cast(x) ((long)x)
642 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
643     (sizeof(type) < sizeof(Py_ssize_t))  ||\
644     (sizeof(type) > sizeof(Py_ssize_t) &&\
645           likely(v < (type)PY_SSIZE_T_MAX ||\
646                  v == (type)PY_SSIZE_T_MAX)  &&\
647           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
648                                 v == (type)PY_SSIZE_T_MIN)))  ||\
649     (sizeof(type) == sizeof(Py_ssize_t) &&\
650           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
651                                v == (type)PY_SSIZE_T_MAX)))  )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)652 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
653     return (size_t) i < (size_t) limit;
654 }
655 #if defined (__cplusplus) && __cplusplus >= 201103L
656     #include <cstdlib>
657     #define __Pyx_sst_abs(value) std::abs(value)
658 #elif SIZEOF_INT >= SIZEOF_SIZE_T
659     #define __Pyx_sst_abs(value) abs(value)
660 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
661     #define __Pyx_sst_abs(value) labs(value)
662 #elif defined (_MSC_VER)
663     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
664 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
665     #define __Pyx_sst_abs(value) llabs(value)
666 #elif defined (__GNUC__)
667     #define __Pyx_sst_abs(value) __builtin_llabs(value)
668 #else
669     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
670 #endif
671 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
672 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
673 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
674 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
675 #define __Pyx_PyBytes_FromString        PyBytes_FromString
676 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
677 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
678 #if PY_MAJOR_VERSION < 3
679     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
680     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
681 #else
682     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
683     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
684 #endif
685 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
686 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
687 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
688 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
689 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
690 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
691 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
692 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
693 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
694 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
695 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
696 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
697 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
698 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
699 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
700 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)701 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
702     const Py_UNICODE *u_end = u;
703     while (*u_end++) ;
704     return (size_t)(u_end - u - 1);
705 }
706 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
707 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
708 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
709 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
710 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
711 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
712 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
713 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
714 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
715 #define __Pyx_PySequence_Tuple(obj)\
716     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
717 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
718 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
719 #if CYTHON_ASSUME_SAFE_MACROS
720 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
721 #else
722 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
723 #endif
724 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
725 #if PY_MAJOR_VERSION >= 3
726 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
727 #else
728 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
729 #endif
730 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
731 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
732 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)733 static int __Pyx_init_sys_getdefaultencoding_params(void) {
734     PyObject* sys;
735     PyObject* default_encoding = NULL;
736     PyObject* ascii_chars_u = NULL;
737     PyObject* ascii_chars_b = NULL;
738     const char* default_encoding_c;
739     sys = PyImport_ImportModule("sys");
740     if (!sys) goto bad;
741     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
742     Py_DECREF(sys);
743     if (!default_encoding) goto bad;
744     default_encoding_c = PyBytes_AsString(default_encoding);
745     if (!default_encoding_c) goto bad;
746     if (strcmp(default_encoding_c, "ascii") == 0) {
747         __Pyx_sys_getdefaultencoding_not_ascii = 0;
748     } else {
749         char ascii_chars[128];
750         int c;
751         for (c = 0; c < 128; c++) {
752             ascii_chars[c] = c;
753         }
754         __Pyx_sys_getdefaultencoding_not_ascii = 1;
755         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
756         if (!ascii_chars_u) goto bad;
757         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
758         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
759             PyErr_Format(
760                 PyExc_ValueError,
761                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
762                 default_encoding_c);
763             goto bad;
764         }
765         Py_DECREF(ascii_chars_u);
766         Py_DECREF(ascii_chars_b);
767     }
768     Py_DECREF(default_encoding);
769     return 0;
770 bad:
771     Py_XDECREF(default_encoding);
772     Py_XDECREF(ascii_chars_u);
773     Py_XDECREF(ascii_chars_b);
774     return -1;
775 }
776 #endif
777 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
778 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
779 #else
780 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
781 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
782 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)783 static int __Pyx_init_sys_getdefaultencoding_params(void) {
784     PyObject* sys;
785     PyObject* default_encoding = NULL;
786     char* default_encoding_c;
787     sys = PyImport_ImportModule("sys");
788     if (!sys) goto bad;
789     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
790     Py_DECREF(sys);
791     if (!default_encoding) goto bad;
792     default_encoding_c = PyBytes_AsString(default_encoding);
793     if (!default_encoding_c) goto bad;
794     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
795     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
796     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
797     Py_DECREF(default_encoding);
798     return 0;
799 bad:
800     Py_XDECREF(default_encoding);
801     return -1;
802 }
803 #endif
804 #endif
805 
806 
807 /* Test for GCC > 2.95 */
808 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
809   #define likely(x)   __builtin_expect(!!(x), 1)
810   #define unlikely(x) __builtin_expect(!!(x), 0)
811 #else /* !__GNUC__ or GCC < 2.95 */
812   #define likely(x)   (x)
813   #define unlikely(x) (x)
814 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)815 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
816 
817 static PyObject *__pyx_m = NULL;
818 static PyObject *__pyx_d;
819 static PyObject *__pyx_b;
820 static PyObject *__pyx_cython_runtime = NULL;
821 static PyObject *__pyx_empty_tuple;
822 static PyObject *__pyx_empty_bytes;
823 static PyObject *__pyx_empty_unicode;
824 static int __pyx_lineno;
825 static int __pyx_clineno = 0;
826 static const char * __pyx_cfilenm= __FILE__;
827 static const char *__pyx_filename;
828 
829 /* Header.proto */
830 #if !defined(CYTHON_CCOMPLEX)
831   #if defined(__cplusplus)
832     #define CYTHON_CCOMPLEX 1
833   #elif defined(_Complex_I)
834     #define CYTHON_CCOMPLEX 1
835   #else
836     #define CYTHON_CCOMPLEX 0
837   #endif
838 #endif
839 #if CYTHON_CCOMPLEX
840   #ifdef __cplusplus
841     #include <complex>
842   #else
843     #include <complex.h>
844   #endif
845 #endif
846 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
847   #undef _Complex_I
848   #define _Complex_I 1.0fj
849 #endif
850 
851 
852 static const char *__pyx_f[] = {
853   "yt/utilities/lib/primitives.pyx",
854   "__init__.pxd",
855   "type.pxd",
856 };
857 
858 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":776
859  * # in Cython to enable them only on the right systems.
860  *
861  * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
862  * ctypedef npy_int16      int16_t
863  * ctypedef npy_int32      int32_t
864  */
865 typedef npy_int8 __pyx_t_5numpy_int8_t;
866 
867 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":777
868  *
869  * ctypedef npy_int8       int8_t
870  * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
871  * ctypedef npy_int32      int32_t
872  * ctypedef npy_int64      int64_t
873  */
874 typedef npy_int16 __pyx_t_5numpy_int16_t;
875 
876 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":778
877  * ctypedef npy_int8       int8_t
878  * ctypedef npy_int16      int16_t
879  * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
880  * ctypedef npy_int64      int64_t
881  * #ctypedef npy_int96      int96_t
882  */
883 typedef npy_int32 __pyx_t_5numpy_int32_t;
884 
885 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":779
886  * ctypedef npy_int16      int16_t
887  * ctypedef npy_int32      int32_t
888  * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
889  * #ctypedef npy_int96      int96_t
890  * #ctypedef npy_int128     int128_t
891  */
892 typedef npy_int64 __pyx_t_5numpy_int64_t;
893 
894 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":783
895  * #ctypedef npy_int128     int128_t
896  *
897  * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
898  * ctypedef npy_uint16     uint16_t
899  * ctypedef npy_uint32     uint32_t
900  */
901 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
902 
903 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":784
904  *
905  * ctypedef npy_uint8      uint8_t
906  * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
907  * ctypedef npy_uint32     uint32_t
908  * ctypedef npy_uint64     uint64_t
909  */
910 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
911 
912 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":785
913  * ctypedef npy_uint8      uint8_t
914  * ctypedef npy_uint16     uint16_t
915  * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
916  * ctypedef npy_uint64     uint64_t
917  * #ctypedef npy_uint96     uint96_t
918  */
919 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
920 
921 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":786
922  * ctypedef npy_uint16     uint16_t
923  * ctypedef npy_uint32     uint32_t
924  * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
925  * #ctypedef npy_uint96     uint96_t
926  * #ctypedef npy_uint128    uint128_t
927  */
928 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
929 
930 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":790
931  * #ctypedef npy_uint128    uint128_t
932  *
933  * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
934  * ctypedef npy_float64    float64_t
935  * #ctypedef npy_float80    float80_t
936  */
937 typedef npy_float32 __pyx_t_5numpy_float32_t;
938 
939 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":791
940  *
941  * ctypedef npy_float32    float32_t
942  * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
943  * #ctypedef npy_float80    float80_t
944  * #ctypedef npy_float128   float128_t
945  */
946 typedef npy_float64 __pyx_t_5numpy_float64_t;
947 
948 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":800
949  * # The int types are mapped a bit surprising --
950  * # numpy.int corresponds to 'l' and numpy.long to 'q'
951  * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
952  * ctypedef npy_longlong   long_t
953  * ctypedef npy_longlong   longlong_t
954  */
955 typedef npy_long __pyx_t_5numpy_int_t;
956 
957 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":801
958  * # numpy.int corresponds to 'l' and numpy.long to 'q'
959  * ctypedef npy_long       int_t
960  * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
961  * ctypedef npy_longlong   longlong_t
962  *
963  */
964 typedef npy_longlong __pyx_t_5numpy_long_t;
965 
966 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":802
967  * ctypedef npy_long       int_t
968  * ctypedef npy_longlong   long_t
969  * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
970  *
971  * ctypedef npy_ulong      uint_t
972  */
973 typedef npy_longlong __pyx_t_5numpy_longlong_t;
974 
975 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":804
976  * ctypedef npy_longlong   longlong_t
977  *
978  * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
979  * ctypedef npy_ulonglong  ulong_t
980  * ctypedef npy_ulonglong  ulonglong_t
981  */
982 typedef npy_ulong __pyx_t_5numpy_uint_t;
983 
984 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":805
985  *
986  * ctypedef npy_ulong      uint_t
987  * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
988  * ctypedef npy_ulonglong  ulonglong_t
989  *
990  */
991 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
992 
993 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":806
994  * ctypedef npy_ulong      uint_t
995  * ctypedef npy_ulonglong  ulong_t
996  * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
997  *
998  * ctypedef npy_intp       intp_t
999  */
1000 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1001 
1002 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":808
1003  * ctypedef npy_ulonglong  ulonglong_t
1004  *
1005  * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
1006  * ctypedef npy_uintp      uintp_t
1007  *
1008  */
1009 typedef npy_intp __pyx_t_5numpy_intp_t;
1010 
1011 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":809
1012  *
1013  * ctypedef npy_intp       intp_t
1014  * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
1015  *
1016  * ctypedef npy_double     float_t
1017  */
1018 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1019 
1020 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":811
1021  * ctypedef npy_uintp      uintp_t
1022  *
1023  * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
1024  * ctypedef npy_double     double_t
1025  * ctypedef npy_longdouble longdouble_t
1026  */
1027 typedef npy_double __pyx_t_5numpy_float_t;
1028 
1029 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":812
1030  *
1031  * ctypedef npy_double     float_t
1032  * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
1033  * ctypedef npy_longdouble longdouble_t
1034  *
1035  */
1036 typedef npy_double __pyx_t_5numpy_double_t;
1037 
1038 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":813
1039  * ctypedef npy_double     float_t
1040  * ctypedef npy_double     double_t
1041  * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
1042  *
1043  * ctypedef npy_cfloat      cfloat_t
1044  */
1045 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1046 /* Declarations.proto */
1047 #if CYTHON_CCOMPLEX
1048   #ifdef __cplusplus
1049     typedef ::std::complex< float > __pyx_t_float_complex;
1050   #else
1051     typedef float _Complex __pyx_t_float_complex;
1052   #endif
1053 #else
1054     typedef struct { float real, imag; } __pyx_t_float_complex;
1055 #endif
1056 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1057 
1058 /* Declarations.proto */
1059 #if CYTHON_CCOMPLEX
1060   #ifdef __cplusplus
1061     typedef ::std::complex< double > __pyx_t_double_complex;
1062   #else
1063     typedef double _Complex __pyx_t_double_complex;
1064   #endif
1065 #else
1066     typedef struct { double real, imag; } __pyx_t_double_complex;
1067 #endif
1068 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1069 
1070 
1071 /*--- Type declarations ---*/
1072 
1073 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":815
1074  * ctypedef npy_longdouble longdouble_t
1075  *
1076  * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
1077  * ctypedef npy_cdouble     cdouble_t
1078  * ctypedef npy_clongdouble clongdouble_t
1079  */
1080 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1081 
1082 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":816
1083  *
1084  * ctypedef npy_cfloat      cfloat_t
1085  * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
1086  * ctypedef npy_clongdouble clongdouble_t
1087  *
1088  */
1089 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1090 
1091 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":817
1092  * ctypedef npy_cfloat      cfloat_t
1093  * ctypedef npy_cdouble     cdouble_t
1094  * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
1095  *
1096  * ctypedef npy_cdouble     complex_t
1097  */
1098 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1099 
1100 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":819
1101  * ctypedef npy_clongdouble clongdouble_t
1102  *
1103  * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
1104  *
1105  * cdef inline object PyArray_MultiIterNew1(a):
1106  */
1107 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1108 struct __pyx_t_2yt_9utilities_3lib_10primitives_Ray;
1109 struct __pyx_t_2yt_9utilities_3lib_10primitives_BBox;
1110 struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData;
1111 struct __pyx_t_2yt_9utilities_3lib_10primitives_Triangle;
1112 struct __pyx_t_2yt_9utilities_3lib_10primitives_Patch;
1113 struct __pyx_t_2yt_9utilities_3lib_10primitives_TetPatch;
1114 
1115 /* "yt/utilities/lib/primitives.pxd":10
1116  *
1117  *
1118  * cdef struct Ray:             # <<<<<<<<<<<<<<
1119  *     np.float64_t origin[3]
1120  *     np.float64_t direction[3]
1121  */
1122 struct __pyx_t_2yt_9utilities_3lib_10primitives_Ray {
1123   __pyx_t_5numpy_float64_t origin[3];
1124   __pyx_t_5numpy_float64_t direction[3];
1125   __pyx_t_5numpy_float64_t inv_dir[3];
1126   __pyx_t_5numpy_float64_t data_val;
1127   __pyx_t_5numpy_float64_t t_near;
1128   __pyx_t_5numpy_float64_t t_far;
1129   __pyx_t_5numpy_int64_t elem_id;
1130   __pyx_t_5numpy_int64_t near_boundary;
1131 };
1132 
1133 /* "yt/utilities/lib/primitives.pxd":20
1134  *     np.int64_t near_boundary
1135  *
1136  * cdef struct BBox:             # <<<<<<<<<<<<<<
1137  *     np.float64_t left_edge[3]
1138  *     np.float64_t right_edge[3]
1139  */
1140 struct __pyx_t_2yt_9utilities_3lib_10primitives_BBox {
1141   __pyx_t_5numpy_float64_t left_edge[3];
1142   __pyx_t_5numpy_float64_t right_edge[3];
1143 };
1144 
1145 /* "yt/utilities/lib/primitives.pxd":24
1146  *     np.float64_t right_edge[3]
1147  *
1148  * cdef struct RayHitData:             # <<<<<<<<<<<<<<
1149  *     np.float64_t u
1150  *     np.float64_t v
1151  */
1152 struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData {
1153   __pyx_t_5numpy_float64_t u;
1154   __pyx_t_5numpy_float64_t v;
1155   __pyx_t_5numpy_float64_t t;
1156   __pyx_t_5numpy_int64_t converged;
1157 };
1158 
1159 /* "yt/utilities/lib/primitives.pxd":30
1160  *     np.int64_t converged
1161  *
1162  * cdef struct Triangle:             # <<<<<<<<<<<<<<
1163  *     np.float64_t p0[3]
1164  *     np.float64_t p1[3]
1165  */
1166 struct __pyx_t_2yt_9utilities_3lib_10primitives_Triangle {
1167   __pyx_t_5numpy_float64_t p0[3];
1168   __pyx_t_5numpy_float64_t p1[3];
1169   __pyx_t_5numpy_float64_t p2[3];
1170   __pyx_t_5numpy_int64_t elem_id;
1171 };
1172 
1173 /* "yt/utilities/lib/primitives.pxd":50
1174  *                         BBox* bbox) nogil
1175  *
1176  * cdef struct Patch:             # <<<<<<<<<<<<<<
1177  *     np.float64_t[8][3] v  # 8 vertices per patch
1178  *     np.int64_t elem_id
1179  */
1180 struct __pyx_t_2yt_9utilities_3lib_10primitives_Patch {
1181   __pyx_t_5numpy_float64_t v[8][3];
1182   __pyx_t_5numpy_int64_t elem_id;
1183 };
1184 
1185 /* "yt/utilities/lib/primitives.pxd":85
1186  *                      BBox* bbox) nogil
1187  *
1188  * cdef struct TetPatch:             # <<<<<<<<<<<<<<
1189  *     np.float64_t[6][3] v # 6 vertices per patch
1190  *     np.int64_t elem_id
1191  */
1192 struct __pyx_t_2yt_9utilities_3lib_10primitives_TetPatch {
1193   __pyx_t_5numpy_float64_t v[6][3];
1194   __pyx_t_5numpy_int64_t elem_id;
1195 };
1196 
1197 /* --- Runtime support code (head) --- */
1198 /* Refnanny.proto */
1199 #ifndef CYTHON_REFNANNY
1200   #define CYTHON_REFNANNY 0
1201 #endif
1202 #if CYTHON_REFNANNY
1203   typedef struct {
1204     void (*INCREF)(void*, PyObject*, int);
1205     void (*DECREF)(void*, PyObject*, int);
1206     void (*GOTREF)(void*, PyObject*, int);
1207     void (*GIVEREF)(void*, PyObject*, int);
1208     void* (*SetupContext)(const char*, int, const char*);
1209     void (*FinishContext)(void**);
1210   } __Pyx_RefNannyAPIStruct;
1211   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1212   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1213   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1214 #ifdef WITH_THREAD
1215   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1216           if (acquire_gil) {\
1217               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1218               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1219               PyGILState_Release(__pyx_gilstate_save);\
1220           } else {\
1221               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1222           }
1223 #else
1224   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1225           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1226 #endif
1227   #define __Pyx_RefNannyFinishContext()\
1228           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1229   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1230   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1231   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1232   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1233   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1234   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1235   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1236   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1237 #else
1238   #define __Pyx_RefNannyDeclarations
1239   #define __Pyx_RefNannySetupContext(name, acquire_gil)
1240   #define __Pyx_RefNannyFinishContext()
1241   #define __Pyx_INCREF(r) Py_INCREF(r)
1242   #define __Pyx_DECREF(r) Py_DECREF(r)
1243   #define __Pyx_GOTREF(r)
1244   #define __Pyx_GIVEREF(r)
1245   #define __Pyx_XINCREF(r) Py_XINCREF(r)
1246   #define __Pyx_XDECREF(r) Py_XDECREF(r)
1247   #define __Pyx_XGOTREF(r)
1248   #define __Pyx_XGIVEREF(r)
1249 #endif
1250 #define __Pyx_XDECREF_SET(r, v) do {\
1251         PyObject *tmp = (PyObject *) r;\
1252         r = v; __Pyx_XDECREF(tmp);\
1253     } while (0)
1254 #define __Pyx_DECREF_SET(r, v) do {\
1255         PyObject *tmp = (PyObject *) r;\
1256         r = v; __Pyx_DECREF(tmp);\
1257     } while (0)
1258 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1259 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1260 
1261 /* PyObjectGetAttrStr.proto */
1262 #if CYTHON_USE_TYPE_SLOTS
1263 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1264 #else
1265 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1266 #endif
1267 
1268 /* GetBuiltinName.proto */
1269 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1270 
1271 /* PyObjectCall.proto */
1272 #if CYTHON_COMPILING_IN_CPYTHON
1273 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1274 #else
1275 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1276 #endif
1277 
1278 /* PyThreadStateGet.proto */
1279 #if CYTHON_FAST_THREAD_STATE
1280 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
1281 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
1282 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
1283 #else
1284 #define __Pyx_PyThreadState_declare
1285 #define __Pyx_PyThreadState_assign
1286 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
1287 #endif
1288 
1289 /* PyErrFetchRestore.proto */
1290 #if CYTHON_FAST_THREAD_STATE
1291 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1292 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1293 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1294 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1295 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1296 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1297 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1298 #if CYTHON_COMPILING_IN_CPYTHON
1299 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1300 #else
1301 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1302 #endif
1303 #else
1304 #define __Pyx_PyErr_Clear() PyErr_Clear()
1305 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1306 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
1307 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
1308 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
1309 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
1310 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
1311 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
1312 #endif
1313 
1314 /* RaiseException.proto */
1315 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1316 
1317 /* PyCFunctionFastCall.proto */
1318 #if CYTHON_FAST_PYCCALL
1319 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1320 #else
1321 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1322 #endif
1323 
1324 /* PyFunctionFastCall.proto */
1325 #if CYTHON_FAST_PYCALL
1326 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1327     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1328 #if 1 || PY_VERSION_HEX < 0x030600B1
1329 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1330 #else
1331 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1332 #endif
1333 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1334     (sizeof(char [1 - 2*!(cond)]) - 1)
1335 #ifndef Py_MEMBER_SIZE
1336 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1337 #endif
1338   static size_t __pyx_pyframe_localsplus_offset = 0;
1339   #include "frameobject.h"
1340   #define __Pxy_PyFrame_Initialize_Offsets()\
1341     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1342      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1343   #define __Pyx_PyFrame_GetLocalsplus(frame)\
1344     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1345 #endif
1346 
1347 /* PyObjectCallMethO.proto */
1348 #if CYTHON_COMPILING_IN_CPYTHON
1349 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1350 #endif
1351 
1352 /* PyObjectCallOneArg.proto */
1353 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1354 
1355 /* DictGetItem.proto */
1356 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1357 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1358 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1359     (likely(PyDict_CheckExact(obj)) ?\
1360      __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1361 #else
1362 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1363 #define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
1364 #endif
1365 
1366 /* RaiseTooManyValuesToUnpack.proto */
1367 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1368 
1369 /* RaiseNeedMoreValuesToUnpack.proto */
1370 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1371 
1372 /* RaiseNoneIterError.proto */
1373 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1374 
1375 /* ExtTypeTest.proto */
1376 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1377 
1378 /* GetTopmostException.proto */
1379 #if CYTHON_USE_EXC_INFO_STACK
1380 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1381 #endif
1382 
1383 /* SaveResetException.proto */
1384 #if CYTHON_FAST_THREAD_STATE
1385 #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1386 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1387 #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1388 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1389 #else
1390 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1391 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1392 #endif
1393 
1394 /* PyErrExceptionMatches.proto */
1395 #if CYTHON_FAST_THREAD_STATE
1396 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1397 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1398 #else
1399 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1400 #endif
1401 
1402 /* GetException.proto */
1403 #if CYTHON_FAST_THREAD_STATE
1404 #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
1405 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1406 #else
1407 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1408 #endif
1409 
1410 /* TypeImport.proto */
1411 #ifndef __PYX_HAVE_RT_ImportType_proto
1412 #define __PYX_HAVE_RT_ImportType_proto
1413 enum __Pyx_ImportType_CheckSize {
1414    __Pyx_ImportType_CheckSize_Error = 0,
1415    __Pyx_ImportType_CheckSize_Warn = 1,
1416    __Pyx_ImportType_CheckSize_Ignore = 2
1417 };
1418 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1419 #endif
1420 
1421 /* Import.proto */
1422 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1423 
1424 /* PyDictVersioning.proto */
1425 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1426 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1427 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1428 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1429     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1430     (cache_var) = (value);
1431 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1432     static PY_UINT64_T __pyx_dict_version = 0;\
1433     static PyObject *__pyx_dict_cached_value = NULL;\
1434     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1435         (VAR) = __pyx_dict_cached_value;\
1436     } else {\
1437         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1438         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1439     }\
1440 }
1441 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1442 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1443 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1444 #else
1445 #define __PYX_GET_DICT_VERSION(dict)  (0)
1446 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1447 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1448 #endif
1449 
1450 /* GetModuleGlobalName.proto */
1451 #if CYTHON_USE_DICT_VERSIONS
1452 #define __Pyx_GetModuleGlobalName(var, name)  {\
1453     static PY_UINT64_T __pyx_dict_version = 0;\
1454     static PyObject *__pyx_dict_cached_value = NULL;\
1455     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1456         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1457         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1458 }
1459 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1460     PY_UINT64_T __pyx_dict_version;\
1461     PyObject *__pyx_dict_cached_value;\
1462     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1463 }
1464 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1465 #else
1466 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1467 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1468 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1469 #endif
1470 
1471 /* CLineInTraceback.proto */
1472 #ifdef CYTHON_CLINE_IN_TRACEBACK
1473 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1474 #else
1475 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1476 #endif
1477 
1478 /* CodeObjectCache.proto */
1479 typedef struct {
1480     PyCodeObject* code_object;
1481     int code_line;
1482 } __Pyx_CodeObjectCacheEntry;
1483 struct __Pyx_CodeObjectCache {
1484     int count;
1485     int max_count;
1486     __Pyx_CodeObjectCacheEntry* entries;
1487 };
1488 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1489 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1490 static PyCodeObject *__pyx_find_code_object(int code_line);
1491 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1492 
1493 /* AddTraceback.proto */
1494 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1495                                int py_line, const char *filename);
1496 
1497 /* CIntToPy.proto */
1498 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int64(npy_int64 value);
1499 
1500 /* RealImag.proto */
1501 #if CYTHON_CCOMPLEX
1502   #ifdef __cplusplus
1503     #define __Pyx_CREAL(z) ((z).real())
1504     #define __Pyx_CIMAG(z) ((z).imag())
1505   #else
1506     #define __Pyx_CREAL(z) (__real__(z))
1507     #define __Pyx_CIMAG(z) (__imag__(z))
1508   #endif
1509 #else
1510     #define __Pyx_CREAL(z) ((z).real)
1511     #define __Pyx_CIMAG(z) ((z).imag)
1512 #endif
1513 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
1514         && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
1515     #define __Pyx_SET_CREAL(z,x) ((z).real(x))
1516     #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
1517 #else
1518     #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1519     #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1520 #endif
1521 
1522 /* Arithmetic.proto */
1523 #if CYTHON_CCOMPLEX
1524     #define __Pyx_c_eq_float(a, b)   ((a)==(b))
1525     #define __Pyx_c_sum_float(a, b)  ((a)+(b))
1526     #define __Pyx_c_diff_float(a, b) ((a)-(b))
1527     #define __Pyx_c_prod_float(a, b) ((a)*(b))
1528     #define __Pyx_c_quot_float(a, b) ((a)/(b))
1529     #define __Pyx_c_neg_float(a)     (-(a))
1530   #ifdef __cplusplus
1531     #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1532     #define __Pyx_c_conj_float(z)    (::std::conj(z))
1533     #if 1
1534         #define __Pyx_c_abs_float(z)     (::std::abs(z))
1535         #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
1536     #endif
1537   #else
1538     #define __Pyx_c_is_zero_float(z) ((z)==0)
1539     #define __Pyx_c_conj_float(z)    (conjf(z))
1540     #if 1
1541         #define __Pyx_c_abs_float(z)     (cabsf(z))
1542         #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
1543     #endif
1544  #endif
1545 #else
1546     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
1547     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
1548     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
1549     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
1550     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
1551     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
1552     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
1553     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
1554     #if 1
1555         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
1556         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
1557     #endif
1558 #endif
1559 
1560 /* Arithmetic.proto */
1561 #if CYTHON_CCOMPLEX
1562     #define __Pyx_c_eq_double(a, b)   ((a)==(b))
1563     #define __Pyx_c_sum_double(a, b)  ((a)+(b))
1564     #define __Pyx_c_diff_double(a, b) ((a)-(b))
1565     #define __Pyx_c_prod_double(a, b) ((a)*(b))
1566     #define __Pyx_c_quot_double(a, b) ((a)/(b))
1567     #define __Pyx_c_neg_double(a)     (-(a))
1568   #ifdef __cplusplus
1569     #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1570     #define __Pyx_c_conj_double(z)    (::std::conj(z))
1571     #if 1
1572         #define __Pyx_c_abs_double(z)     (::std::abs(z))
1573         #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
1574     #endif
1575   #else
1576     #define __Pyx_c_is_zero_double(z) ((z)==0)
1577     #define __Pyx_c_conj_double(z)    (conj(z))
1578     #if 1
1579         #define __Pyx_c_abs_double(z)     (cabs(z))
1580         #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
1581     #endif
1582  #endif
1583 #else
1584     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
1585     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
1586     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
1587     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
1588     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
1589     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
1590     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
1591     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
1592     #if 1
1593         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
1594         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
1595     #endif
1596 #endif
1597 
1598 /* CIntToPy.proto */
1599 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1600 
1601 /* CIntToPy.proto */
1602 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
1603 
1604 /* CIntFromPy.proto */
1605 static CYTHON_INLINE npy_int64 __Pyx_PyInt_As_npy_int64(PyObject *);
1606 
1607 /* CIntFromPy.proto */
1608 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1609 
1610 /* CIntFromPy.proto */
1611 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1612 
1613 /* CIntToPy.proto */
1614 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1615 
1616 /* FastTypeChecks.proto */
1617 #if CYTHON_COMPILING_IN_CPYTHON
1618 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1619 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1620 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1621 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1622 #else
1623 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1624 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1625 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1626 #endif
1627 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1628 
1629 /* CheckBinaryVersion.proto */
1630 static int __Pyx_check_binary_version(void);
1631 
1632 /* FunctionExport.proto */
1633 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);
1634 
1635 /* InitStrings.proto */
1636 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1637 
1638 
1639 /* Module declarations from 'cython' */
1640 
1641 /* Module declarations from 'cpython.buffer' */
1642 
1643 /* Module declarations from 'libc.string' */
1644 
1645 /* Module declarations from 'libc.stdio' */
1646 
1647 /* Module declarations from '__builtin__' */
1648 
1649 /* Module declarations from 'cpython.type' */
1650 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1651 
1652 /* Module declarations from 'cpython' */
1653 
1654 /* Module declarations from 'cpython.object' */
1655 
1656 /* Module declarations from 'cpython.ref' */
1657 
1658 /* Module declarations from 'cpython.mem' */
1659 
1660 /* Module declarations from 'numpy' */
1661 
1662 /* Module declarations from 'numpy' */
1663 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
1664 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
1665 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
1666 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
1667 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
1668 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
1669 
1670 /* Module declarations from 'libc.math' */
1671 
1672 /* Module declarations from 'yt.utilities.lib.vec3_ops' */
1673 static CYTHON_INLINE float __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(float *, float *); /*proto*/
1674 static CYTHON_INLINE double __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(double *, double *); /*proto*/
1675 static CYTHON_INLINE void __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_cross(float *, float *, float *); /*proto*/
1676 static CYTHON_INLINE void __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_cross(double *, double *, double *); /*proto*/
1677 static CYTHON_INLINE void __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_subtract(double *, double *, double *); /*proto*/
1678 static CYTHON_INLINE float __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_distance(float *, float *); /*proto*/
1679 static CYTHON_INLINE double __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_distance(double *, double *); /*proto*/
1680 static CYTHON_INLINE float __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_L2_norm(float *); /*proto*/
1681 static CYTHON_INLINE double __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_L2_norm(double *); /*proto*/
1682 
1683 /* Module declarations from 'yt.utilities.lib.primitives' */
1684 static __pyx_t_5numpy_float64_t __pyx_v_2yt_9utilities_3lib_10primitives_DETERMINANT_EPS;
1685 static __pyx_t_5numpy_float64_t __pyx_v_2yt_9utilities_3lib_10primitives_INF;
1686 static void __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceFunc(float (*)[3], float const , float const , float *); /*proto*/
1687 static void __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceFunc(double (*)[3], double const , double const , double *); /*proto*/
1688 static void __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceDerivU(float (*)[3], float const , float const , float *); /*proto*/
1689 static void __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceDerivU(double (*)[3], double const , double const , double *); /*proto*/
1690 static void __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceDerivV(float (*)[3], float const , float const , float *); /*proto*/
1691 static void __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceDerivV(double (*)[3], double const , double const , double *); /*proto*/
1692 static struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_compute_patch_hit(float (*)[3], float *, float *); /*proto*/
1693 static struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_compute_patch_hit(double (*)[3], double *, double *); /*proto*/
1694 static struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_compute_tet_patch_hit(float (*)[3], float *, float *); /*proto*/
1695 static struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_compute_tet_patch_hit(double (*)[3], double *, double *); /*proto*/
1696 static void __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceFunc(float (*)[3], float const , float const , float *); /*proto*/
1697 static void __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceFunc(double (*)[3], double const , double const , double *); /*proto*/
1698 static void __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceDerivU(float (*)[3], float const , float const , float *); /*proto*/
1699 static void __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceDerivU(double (*)[3], double const , double const , double *); /*proto*/
1700 static void __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceDerivV(float (*)[3], float const , float const , float *); /*proto*/
1701 static void __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceDerivV(double (*)[3], double const , double const , double *); /*proto*/
1702 #define __Pyx_MODULE_NAME "yt.utilities.lib.primitives"
1703 extern int __pyx_module_is_main_yt__utilities__lib__primitives;
1704 int __pyx_module_is_main_yt__utilities__lib__primitives = 0;
1705 
1706 /* Implementation of 'yt.utilities.lib.primitives' */
1707 static PyObject *__pyx_builtin_range;
1708 static PyObject *__pyx_builtin_ValueError;
1709 static PyObject *__pyx_builtin_RuntimeError;
1710 static PyObject *__pyx_builtin_ImportError;
1711 static const char __pyx_k_np[] = "np";
1712 static const char __pyx_k_inf[] = "inf";
1713 static const char __pyx_k_main[] = "__main__";
1714 static const char __pyx_k_name[] = "__name__";
1715 static const char __pyx_k_test[] = "__test__";
1716 static const char __pyx_k_numpy[] = "numpy";
1717 static const char __pyx_k_range[] = "range";
1718 static const char __pyx_k_import[] = "__import__";
1719 static const char __pyx_k_ValueError[] = "ValueError";
1720 static const char __pyx_k_ImportError[] = "ImportError";
1721 static const char __pyx_k_RuntimeError[] = "RuntimeError";
1722 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1723 static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
1724 static const char __pyx_k_This_file_contains_definitions[] = "\n\nThis file contains definitions of the various primitives that can be used\nby the Cython ray-tracer for unstructured mesh rendering. To define a new\nprimitive type, you need to define a struct that represents it. You also\nneed to provide three functions:\n\n1. A function that computes the intersection between a given ray and a given primitive.\n2. A function that computes the centroid of the primitive type.\n3. A function that computes the axis-aligned bounding box of a given primitive.\n\n";
1725 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
1726 static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
1727 static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
1728 static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
1729 static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
1730 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
1731 static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
1732 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
1733 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
1734 static PyObject *__pyx_n_s_ImportError;
1735 static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
1736 static PyObject *__pyx_n_s_RuntimeError;
1737 static PyObject *__pyx_n_s_ValueError;
1738 static PyObject *__pyx_n_s_cline_in_traceback;
1739 static PyObject *__pyx_n_s_import;
1740 static PyObject *__pyx_n_s_inf;
1741 static PyObject *__pyx_n_s_main;
1742 static PyObject *__pyx_n_s_name;
1743 static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
1744 static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
1745 static PyObject *__pyx_n_s_np;
1746 static PyObject *__pyx_n_s_numpy;
1747 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
1748 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
1749 static PyObject *__pyx_n_s_range;
1750 static PyObject *__pyx_n_s_test;
1751 static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
1752 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
1753 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
1754 static PyObject *__pyx_tuple_;
1755 static PyObject *__pyx_tuple__2;
1756 static PyObject *__pyx_tuple__3;
1757 static PyObject *__pyx_tuple__4;
1758 static PyObject *__pyx_tuple__5;
1759 static PyObject *__pyx_tuple__6;
1760 static PyObject *__pyx_tuple__7;
1761 /* Late includes */
1762 
1763 /* "yt/utilities/lib/primitives.pyx":36
1764  * @cython.wraparound(False)
1765  * @cython.cdivision(True)
1766  * cdef np.int64_t ray_bbox_intersect(Ray* ray, const BBox bbox) nogil:             # <<<<<<<<<<<<<<
1767  *     '''
1768  *
1769  */
1770 
__pyx_f_2yt_9utilities_3lib_10primitives_ray_bbox_intersect(struct __pyx_t_2yt_9utilities_3lib_10primitives_Ray * __pyx_v_ray,struct __pyx_t_2yt_9utilities_3lib_10primitives_BBox const __pyx_v_bbox)1771 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_10primitives_ray_bbox_intersect(struct __pyx_t_2yt_9utilities_3lib_10primitives_Ray *__pyx_v_ray, struct __pyx_t_2yt_9utilities_3lib_10primitives_BBox const __pyx_v_bbox) {
1772   __pyx_t_5numpy_float64_t __pyx_v_tmin;
1773   __pyx_t_5numpy_float64_t __pyx_v_tmax;
1774   __pyx_t_5numpy_int64_t __pyx_v_i;
1775   __pyx_t_5numpy_float64_t __pyx_v_t1;
1776   __pyx_t_5numpy_float64_t __pyx_v_t2;
1777   __pyx_t_5numpy_int64_t __pyx_r;
1778   __pyx_t_5numpy_int64_t __pyx_t_1;
1779 
1780   /* "yt/utilities/lib/primitives.pyx":46
1781  *     # https://tavianator.com/fast-branchless-raybounding-box-intersections/
1782  *
1783  *     cdef np.float64_t tmin = -INF             # <<<<<<<<<<<<<<
1784  *     cdef np.float64_t tmax =  INF
1785  *
1786  */
1787   __pyx_v_tmin = (-__pyx_v_2yt_9utilities_3lib_10primitives_INF);
1788 
1789   /* "yt/utilities/lib/primitives.pyx":47
1790  *
1791  *     cdef np.float64_t tmin = -INF
1792  *     cdef np.float64_t tmax =  INF             # <<<<<<<<<<<<<<
1793  *
1794  *     cdef np.int64_t i
1795  */
1796   __pyx_v_tmax = __pyx_v_2yt_9utilities_3lib_10primitives_INF;
1797 
1798   /* "yt/utilities/lib/primitives.pyx":51
1799  *     cdef np.int64_t i
1800  *     cdef np.float64_t t1, t2
1801  *     for i in range(3):             # <<<<<<<<<<<<<<
1802  *         t1 = (bbox.left_edge[i]  - ray.origin[i])*ray.inv_dir[i]
1803  *         t2 = (bbox.right_edge[i] - ray.origin[i])*ray.inv_dir[i]
1804  */
1805   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
1806     __pyx_v_i = __pyx_t_1;
1807 
1808     /* "yt/utilities/lib/primitives.pyx":52
1809  *     cdef np.float64_t t1, t2
1810  *     for i in range(3):
1811  *         t1 = (bbox.left_edge[i]  - ray.origin[i])*ray.inv_dir[i]             # <<<<<<<<<<<<<<
1812  *         t2 = (bbox.right_edge[i] - ray.origin[i])*ray.inv_dir[i]
1813  *         tmin = fmax(tmin, fmin(t1, t2))
1814  */
1815     __pyx_v_t1 = (((__pyx_v_bbox.left_edge[__pyx_v_i]) - (__pyx_v_ray->origin[__pyx_v_i])) * (__pyx_v_ray->inv_dir[__pyx_v_i]));
1816 
1817     /* "yt/utilities/lib/primitives.pyx":53
1818  *     for i in range(3):
1819  *         t1 = (bbox.left_edge[i]  - ray.origin[i])*ray.inv_dir[i]
1820  *         t2 = (bbox.right_edge[i] - ray.origin[i])*ray.inv_dir[i]             # <<<<<<<<<<<<<<
1821  *         tmin = fmax(tmin, fmin(t1, t2))
1822  *         tmax = fmin(tmax, fmax(t1, t2))
1823  */
1824     __pyx_v_t2 = (((__pyx_v_bbox.right_edge[__pyx_v_i]) - (__pyx_v_ray->origin[__pyx_v_i])) * (__pyx_v_ray->inv_dir[__pyx_v_i]));
1825 
1826     /* "yt/utilities/lib/primitives.pyx":54
1827  *         t1 = (bbox.left_edge[i]  - ray.origin[i])*ray.inv_dir[i]
1828  *         t2 = (bbox.right_edge[i] - ray.origin[i])*ray.inv_dir[i]
1829  *         tmin = fmax(tmin, fmin(t1, t2))             # <<<<<<<<<<<<<<
1830  *         tmax = fmin(tmax, fmax(t1, t2))
1831  *
1832  */
1833     __pyx_v_tmin = fmax(__pyx_v_tmin, fmin(__pyx_v_t1, __pyx_v_t2));
1834 
1835     /* "yt/utilities/lib/primitives.pyx":55
1836  *         t2 = (bbox.right_edge[i] - ray.origin[i])*ray.inv_dir[i]
1837  *         tmin = fmax(tmin, fmin(t1, t2))
1838  *         tmax = fmin(tmax, fmax(t1, t2))             # <<<<<<<<<<<<<<
1839  *
1840  *     return tmax >= fmax(tmin, 0.0)
1841  */
1842     __pyx_v_tmax = fmin(__pyx_v_tmax, fmax(__pyx_v_t1, __pyx_v_t2));
1843   }
1844 
1845   /* "yt/utilities/lib/primitives.pyx":57
1846  *         tmax = fmin(tmax, fmax(t1, t2))
1847  *
1848  *     return tmax >= fmax(tmin, 0.0)             # <<<<<<<<<<<<<<
1849  *
1850  * @cython.boundscheck(False)
1851  */
1852   __pyx_r = (__pyx_v_tmax >= fmax(__pyx_v_tmin, 0.0));
1853   goto __pyx_L0;
1854 
1855   /* "yt/utilities/lib/primitives.pyx":36
1856  * @cython.wraparound(False)
1857  * @cython.cdivision(True)
1858  * cdef np.int64_t ray_bbox_intersect(Ray* ray, const BBox bbox) nogil:             # <<<<<<<<<<<<<<
1859  *     '''
1860  *
1861  */
1862 
1863   /* function exit code */
1864   __pyx_L0:;
1865   return __pyx_r;
1866 }
1867 
1868 /* "yt/utilities/lib/primitives.pyx":62
1869  * @cython.wraparound(False)
1870  * @cython.cdivision(True)
1871  * cdef np.int64_t ray_triangle_intersect(const void* primitives,             # <<<<<<<<<<<<<<
1872  *                                        const np.int64_t item,
1873  *                                        Ray* ray) nogil:
1874  */
1875 
__pyx_f_2yt_9utilities_3lib_10primitives_ray_triangle_intersect(void const * __pyx_v_primitives,__pyx_t_5numpy_int64_t const __pyx_v_item,struct __pyx_t_2yt_9utilities_3lib_10primitives_Ray * __pyx_v_ray)1876 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_10primitives_ray_triangle_intersect(void const *__pyx_v_primitives, __pyx_t_5numpy_int64_t const __pyx_v_item, struct __pyx_t_2yt_9utilities_3lib_10primitives_Ray *__pyx_v_ray) {
1877   struct __pyx_t_2yt_9utilities_3lib_10primitives_Triangle __pyx_v_tri;
1878   __pyx_t_5numpy_float64_t __pyx_v_e1[3];
1879   __pyx_t_5numpy_float64_t __pyx_v_e2[3];
1880   __pyx_t_5numpy_float64_t __pyx_v_P[3];
1881   __pyx_t_5numpy_float64_t __pyx_v_det;
1882   __pyx_t_5numpy_float64_t __pyx_v_inv_det;
1883   __pyx_t_5numpy_float64_t __pyx_v_T[3];
1884   __pyx_t_5numpy_float64_t __pyx_v_u;
1885   __pyx_t_5numpy_float64_t __pyx_v_Q[3];
1886   __pyx_t_5numpy_float64_t __pyx_v_v;
1887   __pyx_t_5numpy_float64_t __pyx_v_t;
1888   __pyx_t_5numpy_int64_t __pyx_r;
1889   int __pyx_t_1;
1890   int __pyx_t_2;
1891   __pyx_t_5numpy_int64_t __pyx_t_3;
1892 
1893   /* "yt/utilities/lib/primitives.pyx":77
1894  *     # https://en.wikipedia.org/wiki/M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm
1895  *
1896  *     cdef Triangle tri = (<Triangle*> primitives)[item]             # <<<<<<<<<<<<<<
1897  *
1898  *     # edge vectors
1899  */
1900   __pyx_v_tri = (((struct __pyx_t_2yt_9utilities_3lib_10primitives_Triangle *)__pyx_v_primitives)[__pyx_v_item]);
1901 
1902   /* "yt/utilities/lib/primitives.pyx":82
1903  *     cdef np.float64_t e1[3]
1904  *     cdef np.float64_t e2[3]
1905  *     subtract(tri.p1, tri.p0, e1)             # <<<<<<<<<<<<<<
1906  *     subtract(tri.p2, tri.p0, e2)
1907  *
1908  */
1909   __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_subtract(__pyx_v_tri.p1, __pyx_v_tri.p0, __pyx_v_e1);
1910 
1911   /* "yt/utilities/lib/primitives.pyx":83
1912  *     cdef np.float64_t e2[3]
1913  *     subtract(tri.p1, tri.p0, e1)
1914  *     subtract(tri.p2, tri.p0, e2)             # <<<<<<<<<<<<<<
1915  *
1916  *     cdef np.float64_t P[3]
1917  */
1918   __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_subtract(__pyx_v_tri.p2, __pyx_v_tri.p0, __pyx_v_e2);
1919 
1920   /* "yt/utilities/lib/primitives.pyx":86
1921  *
1922  *     cdef np.float64_t P[3]
1923  *     cross(ray.direction, e2, P)             # <<<<<<<<<<<<<<
1924  *
1925  *     cdef np.float64_t det, inv_det
1926  */
1927   __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_cross(__pyx_v_ray->direction, __pyx_v_e2, __pyx_v_P);
1928 
1929   /* "yt/utilities/lib/primitives.pyx":89
1930  *
1931  *     cdef np.float64_t det, inv_det
1932  *     det = dot(e1, P)             # <<<<<<<<<<<<<<
1933  *     if(det > -DETERMINANT_EPS and det < DETERMINANT_EPS):
1934  *         return False
1935  */
1936   __pyx_v_det = __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_e1, __pyx_v_P);
1937 
1938   /* "yt/utilities/lib/primitives.pyx":90
1939  *     cdef np.float64_t det, inv_det
1940  *     det = dot(e1, P)
1941  *     if(det > -DETERMINANT_EPS and det < DETERMINANT_EPS):             # <<<<<<<<<<<<<<
1942  *         return False
1943  *     inv_det = 1.0 / det
1944  */
1945   __pyx_t_2 = ((__pyx_v_det > (-__pyx_v_2yt_9utilities_3lib_10primitives_DETERMINANT_EPS)) != 0);
1946   if (__pyx_t_2) {
1947   } else {
1948     __pyx_t_1 = __pyx_t_2;
1949     goto __pyx_L4_bool_binop_done;
1950   }
1951   __pyx_t_2 = ((__pyx_v_det < __pyx_v_2yt_9utilities_3lib_10primitives_DETERMINANT_EPS) != 0);
1952   __pyx_t_1 = __pyx_t_2;
1953   __pyx_L4_bool_binop_done:;
1954   if (__pyx_t_1) {
1955 
1956     /* "yt/utilities/lib/primitives.pyx":91
1957  *     det = dot(e1, P)
1958  *     if(det > -DETERMINANT_EPS and det < DETERMINANT_EPS):
1959  *         return False             # <<<<<<<<<<<<<<
1960  *     inv_det = 1.0 / det
1961  *
1962  */
1963     __pyx_r = 0;
1964     goto __pyx_L0;
1965 
1966     /* "yt/utilities/lib/primitives.pyx":90
1967  *     cdef np.float64_t det, inv_det
1968  *     det = dot(e1, P)
1969  *     if(det > -DETERMINANT_EPS and det < DETERMINANT_EPS):             # <<<<<<<<<<<<<<
1970  *         return False
1971  *     inv_det = 1.0 / det
1972  */
1973   }
1974 
1975   /* "yt/utilities/lib/primitives.pyx":92
1976  *     if(det > -DETERMINANT_EPS and det < DETERMINANT_EPS):
1977  *         return False
1978  *     inv_det = 1.0 / det             # <<<<<<<<<<<<<<
1979  *
1980  *     cdef np.float64_t T[3]
1981  */
1982   __pyx_v_inv_det = (1.0 / __pyx_v_det);
1983 
1984   /* "yt/utilities/lib/primitives.pyx":95
1985  *
1986  *     cdef np.float64_t T[3]
1987  *     subtract(ray.origin, tri.p0, T)             # <<<<<<<<<<<<<<
1988  *
1989  *     cdef np.float64_t u = dot(T, P) * inv_det
1990  */
1991   __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_subtract(__pyx_v_ray->origin, __pyx_v_tri.p0, __pyx_v_T);
1992 
1993   /* "yt/utilities/lib/primitives.pyx":97
1994  *     subtract(ray.origin, tri.p0, T)
1995  *
1996  *     cdef np.float64_t u = dot(T, P) * inv_det             # <<<<<<<<<<<<<<
1997  *     if(u < 0.0 or u > 1.0):
1998  *         return False
1999  */
2000   __pyx_v_u = (__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_T, __pyx_v_P) * __pyx_v_inv_det);
2001 
2002   /* "yt/utilities/lib/primitives.pyx":98
2003  *
2004  *     cdef np.float64_t u = dot(T, P) * inv_det
2005  *     if(u < 0.0 or u > 1.0):             # <<<<<<<<<<<<<<
2006  *         return False
2007  *
2008  */
2009   __pyx_t_2 = ((__pyx_v_u < 0.0) != 0);
2010   if (!__pyx_t_2) {
2011   } else {
2012     __pyx_t_1 = __pyx_t_2;
2013     goto __pyx_L7_bool_binop_done;
2014   }
2015   __pyx_t_2 = ((__pyx_v_u > 1.0) != 0);
2016   __pyx_t_1 = __pyx_t_2;
2017   __pyx_L7_bool_binop_done:;
2018   if (__pyx_t_1) {
2019 
2020     /* "yt/utilities/lib/primitives.pyx":99
2021  *     cdef np.float64_t u = dot(T, P) * inv_det
2022  *     if(u < 0.0 or u > 1.0):
2023  *         return False             # <<<<<<<<<<<<<<
2024  *
2025  *     cdef np.float64_t Q[3]
2026  */
2027     __pyx_r = 0;
2028     goto __pyx_L0;
2029 
2030     /* "yt/utilities/lib/primitives.pyx":98
2031  *
2032  *     cdef np.float64_t u = dot(T, P) * inv_det
2033  *     if(u < 0.0 or u > 1.0):             # <<<<<<<<<<<<<<
2034  *         return False
2035  *
2036  */
2037   }
2038 
2039   /* "yt/utilities/lib/primitives.pyx":102
2040  *
2041  *     cdef np.float64_t Q[3]
2042  *     cross(T, e1, Q)             # <<<<<<<<<<<<<<
2043  *
2044  *     cdef np.float64_t v = dot(ray.direction, Q) * inv_det
2045  */
2046   __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_cross(__pyx_v_T, __pyx_v_e1, __pyx_v_Q);
2047 
2048   /* "yt/utilities/lib/primitives.pyx":104
2049  *     cross(T, e1, Q)
2050  *
2051  *     cdef np.float64_t v = dot(ray.direction, Q) * inv_det             # <<<<<<<<<<<<<<
2052  *     if(v < 0.0 or u + v  > 1.0):
2053  *         return False
2054  */
2055   __pyx_v_v = (__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_ray->direction, __pyx_v_Q) * __pyx_v_inv_det);
2056 
2057   /* "yt/utilities/lib/primitives.pyx":105
2058  *
2059  *     cdef np.float64_t v = dot(ray.direction, Q) * inv_det
2060  *     if(v < 0.0 or u + v  > 1.0):             # <<<<<<<<<<<<<<
2061  *         return False
2062  *
2063  */
2064   __pyx_t_2 = ((__pyx_v_v < 0.0) != 0);
2065   if (!__pyx_t_2) {
2066   } else {
2067     __pyx_t_1 = __pyx_t_2;
2068     goto __pyx_L10_bool_binop_done;
2069   }
2070   __pyx_t_2 = (((__pyx_v_u + __pyx_v_v) > 1.0) != 0);
2071   __pyx_t_1 = __pyx_t_2;
2072   __pyx_L10_bool_binop_done:;
2073   if (__pyx_t_1) {
2074 
2075     /* "yt/utilities/lib/primitives.pyx":106
2076  *     cdef np.float64_t v = dot(ray.direction, Q) * inv_det
2077  *     if(v < 0.0 or u + v  > 1.0):
2078  *         return False             # <<<<<<<<<<<<<<
2079  *
2080  *     cdef np.float64_t t = dot(e2, Q) * inv_det
2081  */
2082     __pyx_r = 0;
2083     goto __pyx_L0;
2084 
2085     /* "yt/utilities/lib/primitives.pyx":105
2086  *
2087  *     cdef np.float64_t v = dot(ray.direction, Q) * inv_det
2088  *     if(v < 0.0 or u + v  > 1.0):             # <<<<<<<<<<<<<<
2089  *         return False
2090  *
2091  */
2092   }
2093 
2094   /* "yt/utilities/lib/primitives.pyx":108
2095  *         return False
2096  *
2097  *     cdef np.float64_t t = dot(e2, Q) * inv_det             # <<<<<<<<<<<<<<
2098  *
2099  *     if(t > DETERMINANT_EPS and t < ray.t_far):
2100  */
2101   __pyx_v_t = (__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_e2, __pyx_v_Q) * __pyx_v_inv_det);
2102 
2103   /* "yt/utilities/lib/primitives.pyx":110
2104  *     cdef np.float64_t t = dot(e2, Q) * inv_det
2105  *
2106  *     if(t > DETERMINANT_EPS and t < ray.t_far):             # <<<<<<<<<<<<<<
2107  *         ray.t_far = t
2108  *         ray.elem_id = tri.elem_id
2109  */
2110   __pyx_t_2 = ((__pyx_v_t > __pyx_v_2yt_9utilities_3lib_10primitives_DETERMINANT_EPS) != 0);
2111   if (__pyx_t_2) {
2112   } else {
2113     __pyx_t_1 = __pyx_t_2;
2114     goto __pyx_L13_bool_binop_done;
2115   }
2116   __pyx_t_2 = ((__pyx_v_t < __pyx_v_ray->t_far) != 0);
2117   __pyx_t_1 = __pyx_t_2;
2118   __pyx_L13_bool_binop_done:;
2119   if (__pyx_t_1) {
2120 
2121     /* "yt/utilities/lib/primitives.pyx":111
2122  *
2123  *     if(t > DETERMINANT_EPS and t < ray.t_far):
2124  *         ray.t_far = t             # <<<<<<<<<<<<<<
2125  *         ray.elem_id = tri.elem_id
2126  *         return True
2127  */
2128     __pyx_v_ray->t_far = __pyx_v_t;
2129 
2130     /* "yt/utilities/lib/primitives.pyx":112
2131  *     if(t > DETERMINANT_EPS and t < ray.t_far):
2132  *         ray.t_far = t
2133  *         ray.elem_id = tri.elem_id             # <<<<<<<<<<<<<<
2134  *         return True
2135  *
2136  */
2137     __pyx_t_3 = __pyx_v_tri.elem_id;
2138     __pyx_v_ray->elem_id = __pyx_t_3;
2139 
2140     /* "yt/utilities/lib/primitives.pyx":113
2141  *         ray.t_far = t
2142  *         ray.elem_id = tri.elem_id
2143  *         return True             # <<<<<<<<<<<<<<
2144  *
2145  *     return False
2146  */
2147     __pyx_r = 1;
2148     goto __pyx_L0;
2149 
2150     /* "yt/utilities/lib/primitives.pyx":110
2151  *     cdef np.float64_t t = dot(e2, Q) * inv_det
2152  *
2153  *     if(t > DETERMINANT_EPS and t < ray.t_far):             # <<<<<<<<<<<<<<
2154  *         ray.t_far = t
2155  *         ray.elem_id = tri.elem_id
2156  */
2157   }
2158 
2159   /* "yt/utilities/lib/primitives.pyx":115
2160  *         return True
2161  *
2162  *     return False             # <<<<<<<<<<<<<<
2163  *
2164  *
2165  */
2166   __pyx_r = 0;
2167   goto __pyx_L0;
2168 
2169   /* "yt/utilities/lib/primitives.pyx":62
2170  * @cython.wraparound(False)
2171  * @cython.cdivision(True)
2172  * cdef np.int64_t ray_triangle_intersect(const void* primitives,             # <<<<<<<<<<<<<<
2173  *                                        const np.int64_t item,
2174  *                                        Ray* ray) nogil:
2175  */
2176 
2177   /* function exit code */
2178   __pyx_L0:;
2179   return __pyx_r;
2180 }
2181 
2182 /* "yt/utilities/lib/primitives.pyx":121
2183  * @cython.wraparound(False)
2184  * @cython.cdivision(True)
2185  * cdef void triangle_centroid(const void *primitives,             # <<<<<<<<<<<<<<
2186  *                             const np.int64_t item,
2187  *                             np.float64_t[3] centroid) nogil:
2188  */
2189 
__pyx_f_2yt_9utilities_3lib_10primitives_triangle_centroid(void const * __pyx_v_primitives,__pyx_t_5numpy_int64_t const __pyx_v_item,__pyx_t_5numpy_float64_t * __pyx_v_centroid)2190 static void __pyx_f_2yt_9utilities_3lib_10primitives_triangle_centroid(void const *__pyx_v_primitives, __pyx_t_5numpy_int64_t const __pyx_v_item, __pyx_t_5numpy_float64_t *__pyx_v_centroid) {
2191   struct __pyx_t_2yt_9utilities_3lib_10primitives_Triangle __pyx_v_tri;
2192   __pyx_t_5numpy_int64_t __pyx_v_i;
2193   __pyx_t_5numpy_int64_t __pyx_t_1;
2194 
2195   /* "yt/utilities/lib/primitives.pyx":132
2196  *     '''
2197  *
2198  *     cdef Triangle tri = (<Triangle*> primitives)[item]             # <<<<<<<<<<<<<<
2199  *     cdef np.int64_t i
2200  *     for i in range(3):
2201  */
2202   __pyx_v_tri = (((struct __pyx_t_2yt_9utilities_3lib_10primitives_Triangle *)__pyx_v_primitives)[__pyx_v_item]);
2203 
2204   /* "yt/utilities/lib/primitives.pyx":134
2205  *     cdef Triangle tri = (<Triangle*> primitives)[item]
2206  *     cdef np.int64_t i
2207  *     for i in range(3):             # <<<<<<<<<<<<<<
2208  *         centroid[i] = (tri.p0[i] + tri.p1[i] + tri.p2[i]) / 3.0
2209  *
2210  */
2211   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
2212     __pyx_v_i = __pyx_t_1;
2213 
2214     /* "yt/utilities/lib/primitives.pyx":135
2215  *     cdef np.int64_t i
2216  *     for i in range(3):
2217  *         centroid[i] = (tri.p0[i] + tri.p1[i] + tri.p2[i]) / 3.0             # <<<<<<<<<<<<<<
2218  *
2219  *
2220  */
2221     (__pyx_v_centroid[__pyx_v_i]) = ((((__pyx_v_tri.p0[__pyx_v_i]) + (__pyx_v_tri.p1[__pyx_v_i])) + (__pyx_v_tri.p2[__pyx_v_i])) / 3.0);
2222   }
2223 
2224   /* "yt/utilities/lib/primitives.pyx":121
2225  * @cython.wraparound(False)
2226  * @cython.cdivision(True)
2227  * cdef void triangle_centroid(const void *primitives,             # <<<<<<<<<<<<<<
2228  *                             const np.int64_t item,
2229  *                             np.float64_t[3] centroid) nogil:
2230  */
2231 
2232   /* function exit code */
2233 }
2234 
2235 /* "yt/utilities/lib/primitives.pyx":141
2236  * @cython.wraparound(False)
2237  * @cython.cdivision(True)
2238  * cdef void triangle_bbox(const void *primitives,             # <<<<<<<<<<<<<<
2239  *                         const np.int64_t item,
2240  *                         BBox* bbox) nogil:
2241  */
2242 
__pyx_f_2yt_9utilities_3lib_10primitives_triangle_bbox(void const * __pyx_v_primitives,__pyx_t_5numpy_int64_t const __pyx_v_item,struct __pyx_t_2yt_9utilities_3lib_10primitives_BBox * __pyx_v_bbox)2243 static void __pyx_f_2yt_9utilities_3lib_10primitives_triangle_bbox(void const *__pyx_v_primitives, __pyx_t_5numpy_int64_t const __pyx_v_item, struct __pyx_t_2yt_9utilities_3lib_10primitives_BBox *__pyx_v_bbox) {
2244   struct __pyx_t_2yt_9utilities_3lib_10primitives_Triangle __pyx_v_tri;
2245   __pyx_t_5numpy_int64_t __pyx_v_i;
2246   __pyx_t_5numpy_int64_t __pyx_t_1;
2247 
2248   /* "yt/utilities/lib/primitives.pyx":152
2249  *     '''
2250  *
2251  *     cdef Triangle tri = (<Triangle*> primitives)[item]             # <<<<<<<<<<<<<<
2252  *     cdef np.int64_t i
2253  *     for i in range(3):
2254  */
2255   __pyx_v_tri = (((struct __pyx_t_2yt_9utilities_3lib_10primitives_Triangle *)__pyx_v_primitives)[__pyx_v_item]);
2256 
2257   /* "yt/utilities/lib/primitives.pyx":154
2258  *     cdef Triangle tri = (<Triangle*> primitives)[item]
2259  *     cdef np.int64_t i
2260  *     for i in range(3):             # <<<<<<<<<<<<<<
2261  *         bbox.left_edge[i] = fmin(fmin(tri.p0[i], tri.p1[i]), tri.p2[i])
2262  *         bbox.right_edge[i] = fmax(fmax(tri.p0[i], tri.p1[i]), tri.p2[i])
2263  */
2264   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
2265     __pyx_v_i = __pyx_t_1;
2266 
2267     /* "yt/utilities/lib/primitives.pyx":155
2268  *     cdef np.int64_t i
2269  *     for i in range(3):
2270  *         bbox.left_edge[i] = fmin(fmin(tri.p0[i], tri.p1[i]), tri.p2[i])             # <<<<<<<<<<<<<<
2271  *         bbox.right_edge[i] = fmax(fmax(tri.p0[i], tri.p1[i]), tri.p2[i])
2272  *
2273  */
2274     (__pyx_v_bbox->left_edge[__pyx_v_i]) = fmin(fmin((__pyx_v_tri.p0[__pyx_v_i]), (__pyx_v_tri.p1[__pyx_v_i])), (__pyx_v_tri.p2[__pyx_v_i]));
2275 
2276     /* "yt/utilities/lib/primitives.pyx":156
2277  *     for i in range(3):
2278  *         bbox.left_edge[i] = fmin(fmin(tri.p0[i], tri.p1[i]), tri.p2[i])
2279  *         bbox.right_edge[i] = fmax(fmax(tri.p0[i], tri.p1[i]), tri.p2[i])             # <<<<<<<<<<<<<<
2280  *
2281  *
2282  */
2283     (__pyx_v_bbox->right_edge[__pyx_v_i]) = fmax(fmax((__pyx_v_tri.p0[__pyx_v_i]), (__pyx_v_tri.p1[__pyx_v_i])), (__pyx_v_tri.p2[__pyx_v_i]));
2284   }
2285 
2286   /* "yt/utilities/lib/primitives.pyx":141
2287  * @cython.wraparound(False)
2288  * @cython.cdivision(True)
2289  * cdef void triangle_bbox(const void *primitives,             # <<<<<<<<<<<<<<
2290  *                         const np.int64_t item,
2291  *                         BBox* bbox) nogil:
2292  */
2293 
2294   /* function exit code */
2295 }
2296 
2297 /* "yt/utilities/lib/primitives.pyx":162
2298  * @cython.wraparound(False)
2299  * @cython.cdivision(True)
2300  * cdef void patchSurfaceFunc(const cython.floating[8][3] verts,             # <<<<<<<<<<<<<<
2301  *                            const cython.floating u,
2302  *                            const cython.floating v,
2303  */
2304 
__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceFunc(float (* __pyx_v_verts)[3],float const __pyx_v_u,float const __pyx_v_v,float * __pyx_v_S)2305 static void __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceFunc(float (*__pyx_v_verts)[3], float const __pyx_v_u, float const __pyx_v_v, float *__pyx_v_S) {
2306   int __pyx_v_i;
2307   int __pyx_t_1;
2308 
2309   /* "yt/utilities/lib/primitives.pyx":177
2310  *     '''
2311  *     cdef int i
2312  *     for i in range(3):             # <<<<<<<<<<<<<<
2313  *         S[i] = 0.25*(1.0 - u)*(1.0 - v)*(-u - v - 1)*verts[0][i] + \
2314  *                0.25*(1.0 + u)*(1.0 - v)*( u - v - 1)*verts[1][i] + \
2315  */
2316   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
2317     __pyx_v_i = __pyx_t_1;
2318 
2319     /* "yt/utilities/lib/primitives.pyx":178
2320  *     cdef int i
2321  *     for i in range(3):
2322  *         S[i] = 0.25*(1.0 - u)*(1.0 - v)*(-u - v - 1)*verts[0][i] + \             # <<<<<<<<<<<<<<
2323  *                0.25*(1.0 + u)*(1.0 - v)*( u - v - 1)*verts[1][i] + \
2324  *                0.25*(1.0 + u)*(1.0 + v)*( u + v - 1)*verts[2][i] + \
2325  */
2326     (__pyx_v_S[__pyx_v_i]) = (((((((((((0.25 * (1.0 - __pyx_v_u)) * (1.0 - __pyx_v_v)) * (((-__pyx_v_u) - __pyx_v_v) - 1.0)) * ((__pyx_v_verts[0])[__pyx_v_i])) + ((((0.25 * (1.0 + __pyx_v_u)) * (1.0 - __pyx_v_v)) * ((__pyx_v_u - __pyx_v_v) - 1.0)) * ((__pyx_v_verts[1])[__pyx_v_i]))) + ((((0.25 * (1.0 + __pyx_v_u)) * (1.0 + __pyx_v_v)) * ((__pyx_v_u + __pyx_v_v) - 1.0)) * ((__pyx_v_verts[2])[__pyx_v_i]))) + ((((0.25 * (1.0 - __pyx_v_u)) * (1.0 + __pyx_v_v)) * (((-__pyx_v_u) + __pyx_v_v) - 1.0)) * ((__pyx_v_verts[3])[__pyx_v_i]))) + (((0.5 * (1.0 - __pyx_v_u)) * (1.0 - (__pyx_v_v * __pyx_v_v))) * ((__pyx_v_verts[4])[__pyx_v_i]))) + (((0.5 * (1.0 - (__pyx_v_u * __pyx_v_u))) * (1.0 - __pyx_v_v)) * ((__pyx_v_verts[5])[__pyx_v_i]))) + (((0.5 * (1.0 + __pyx_v_u)) * (1.0 - (__pyx_v_v * __pyx_v_v))) * ((__pyx_v_verts[6])[__pyx_v_i]))) + (((0.5 * (1.0 - (__pyx_v_u * __pyx_v_u))) * (1.0 + __pyx_v_v)) * ((__pyx_v_verts[7])[__pyx_v_i])));
2327   }
2328 
2329   /* "yt/utilities/lib/primitives.pyx":162
2330  * @cython.wraparound(False)
2331  * @cython.cdivision(True)
2332  * cdef void patchSurfaceFunc(const cython.floating[8][3] verts,             # <<<<<<<<<<<<<<
2333  *                            const cython.floating u,
2334  *                            const cython.floating v,
2335  */
2336 
2337   /* function exit code */
2338 }
2339 
__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceFunc(double (* __pyx_v_verts)[3],double const __pyx_v_u,double const __pyx_v_v,double * __pyx_v_S)2340 static void __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceFunc(double (*__pyx_v_verts)[3], double const __pyx_v_u, double const __pyx_v_v, double *__pyx_v_S) {
2341   int __pyx_v_i;
2342   int __pyx_t_1;
2343 
2344   /* "yt/utilities/lib/primitives.pyx":177
2345  *     '''
2346  *     cdef int i
2347  *     for i in range(3):             # <<<<<<<<<<<<<<
2348  *         S[i] = 0.25*(1.0 - u)*(1.0 - v)*(-u - v - 1)*verts[0][i] + \
2349  *                0.25*(1.0 + u)*(1.0 - v)*( u - v - 1)*verts[1][i] + \
2350  */
2351   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
2352     __pyx_v_i = __pyx_t_1;
2353 
2354     /* "yt/utilities/lib/primitives.pyx":178
2355  *     cdef int i
2356  *     for i in range(3):
2357  *         S[i] = 0.25*(1.0 - u)*(1.0 - v)*(-u - v - 1)*verts[0][i] + \             # <<<<<<<<<<<<<<
2358  *                0.25*(1.0 + u)*(1.0 - v)*( u - v - 1)*verts[1][i] + \
2359  *                0.25*(1.0 + u)*(1.0 + v)*( u + v - 1)*verts[2][i] + \
2360  */
2361     (__pyx_v_S[__pyx_v_i]) = (((((((((((0.25 * (1.0 - __pyx_v_u)) * (1.0 - __pyx_v_v)) * (((-__pyx_v_u) - __pyx_v_v) - 1.0)) * ((__pyx_v_verts[0])[__pyx_v_i])) + ((((0.25 * (1.0 + __pyx_v_u)) * (1.0 - __pyx_v_v)) * ((__pyx_v_u - __pyx_v_v) - 1.0)) * ((__pyx_v_verts[1])[__pyx_v_i]))) + ((((0.25 * (1.0 + __pyx_v_u)) * (1.0 + __pyx_v_v)) * ((__pyx_v_u + __pyx_v_v) - 1.0)) * ((__pyx_v_verts[2])[__pyx_v_i]))) + ((((0.25 * (1.0 - __pyx_v_u)) * (1.0 + __pyx_v_v)) * (((-__pyx_v_u) + __pyx_v_v) - 1.0)) * ((__pyx_v_verts[3])[__pyx_v_i]))) + (((0.5 * (1.0 - __pyx_v_u)) * (1.0 - (__pyx_v_v * __pyx_v_v))) * ((__pyx_v_verts[4])[__pyx_v_i]))) + (((0.5 * (1.0 - (__pyx_v_u * __pyx_v_u))) * (1.0 - __pyx_v_v)) * ((__pyx_v_verts[5])[__pyx_v_i]))) + (((0.5 * (1.0 + __pyx_v_u)) * (1.0 - (__pyx_v_v * __pyx_v_v))) * ((__pyx_v_verts[6])[__pyx_v_i]))) + (((0.5 * (1.0 - (__pyx_v_u * __pyx_v_u))) * (1.0 + __pyx_v_v)) * ((__pyx_v_verts[7])[__pyx_v_i])));
2362   }
2363 
2364   /* "yt/utilities/lib/primitives.pyx":162
2365  * @cython.wraparound(False)
2366  * @cython.cdivision(True)
2367  * cdef void patchSurfaceFunc(const cython.floating[8][3] verts,             # <<<<<<<<<<<<<<
2368  *                            const cython.floating u,
2369  *                            const cython.floating v,
2370  */
2371 
2372   /* function exit code */
2373 }
2374 
2375 /* "yt/utilities/lib/primitives.pyx":191
2376  * @cython.wraparound(False)
2377  * @cython.cdivision(True)
2378  * cdef void patchSurfaceDerivU(const cython.floating[8][3] verts,             # <<<<<<<<<<<<<<
2379  *                              const cython.floating u,
2380  *                              const cython.floating v,
2381  */
2382 
__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceDerivU(float (* __pyx_v_verts)[3],float const __pyx_v_u,float const __pyx_v_v,float * __pyx_v_Su)2383 static void __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceDerivU(float (*__pyx_v_verts)[3], float const __pyx_v_u, float const __pyx_v_v, float *__pyx_v_Su) {
2384   int __pyx_v_i;
2385   int __pyx_t_1;
2386 
2387   /* "yt/utilities/lib/primitives.pyx":201
2388  *     '''
2389  *     cdef int i
2390  *     for i in range(3):             # <<<<<<<<<<<<<<
2391  *         Su[i] = (-0.25*(v - 1.0)*(u + v + 1) - 0.25*(u - 1.0)*(v - 1.0))*verts[0][i] + \
2392  *                 (-0.25*(v - 1.0)*(u - v - 1) - 0.25*(u + 1.0)*(v - 1.0))*verts[1][i] + \
2393  */
2394   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
2395     __pyx_v_i = __pyx_t_1;
2396 
2397     /* "yt/utilities/lib/primitives.pyx":202
2398  *     cdef int i
2399  *     for i in range(3):
2400  *         Su[i] = (-0.25*(v - 1.0)*(u + v + 1) - 0.25*(u - 1.0)*(v - 1.0))*verts[0][i] + \             # <<<<<<<<<<<<<<
2401  *                 (-0.25*(v - 1.0)*(u - v - 1) - 0.25*(u + 1.0)*(v - 1.0))*verts[1][i] + \
2402  *                 ( 0.25*(v + 1.0)*(u + v - 1) + 0.25*(u + 1.0)*(v + 1.0))*verts[2][i] + \
2403  */
2404     (__pyx_v_Su[__pyx_v_i]) = (((((((((((-0.25 * (__pyx_v_v - 1.0)) * ((__pyx_v_u + __pyx_v_v) + 1.0)) - ((0.25 * (__pyx_v_u - 1.0)) * (__pyx_v_v - 1.0))) * ((__pyx_v_verts[0])[__pyx_v_i])) + ((((-0.25 * (__pyx_v_v - 1.0)) * ((__pyx_v_u - __pyx_v_v) - 1.0)) - ((0.25 * (__pyx_v_u + 1.0)) * (__pyx_v_v - 1.0))) * ((__pyx_v_verts[1])[__pyx_v_i]))) + ((((0.25 * (__pyx_v_v + 1.0)) * ((__pyx_v_u + __pyx_v_v) - 1.0)) + ((0.25 * (__pyx_v_u + 1.0)) * (__pyx_v_v + 1.0))) * ((__pyx_v_verts[2])[__pyx_v_i]))) + ((((0.25 * (__pyx_v_v + 1.0)) * ((__pyx_v_u - __pyx_v_v) + 1.0)) + ((0.25 * (__pyx_v_u - 1.0)) * (__pyx_v_v + 1.0))) * ((__pyx_v_verts[3])[__pyx_v_i]))) + ((0.5 * ((__pyx_v_v * __pyx_v_v) - 1.0)) * ((__pyx_v_verts[4])[__pyx_v_i]))) + ((__pyx_v_u * (__pyx_v_v - 1.0)) * ((__pyx_v_verts[5])[__pyx_v_i]))) - ((0.5 * ((__pyx_v_v * __pyx_v_v) - 1.0)) * ((__pyx_v_verts[6])[__pyx_v_i]))) - ((__pyx_v_u * (__pyx_v_v + 1.0)) * ((__pyx_v_verts[7])[__pyx_v_i])));
2405   }
2406 
2407   /* "yt/utilities/lib/primitives.pyx":191
2408  * @cython.wraparound(False)
2409  * @cython.cdivision(True)
2410  * cdef void patchSurfaceDerivU(const cython.floating[8][3] verts,             # <<<<<<<<<<<<<<
2411  *                              const cython.floating u,
2412  *                              const cython.floating v,
2413  */
2414 
2415   /* function exit code */
2416 }
2417 
__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceDerivU(double (* __pyx_v_verts)[3],double const __pyx_v_u,double const __pyx_v_v,double * __pyx_v_Su)2418 static void __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceDerivU(double (*__pyx_v_verts)[3], double const __pyx_v_u, double const __pyx_v_v, double *__pyx_v_Su) {
2419   int __pyx_v_i;
2420   int __pyx_t_1;
2421 
2422   /* "yt/utilities/lib/primitives.pyx":201
2423  *     '''
2424  *     cdef int i
2425  *     for i in range(3):             # <<<<<<<<<<<<<<
2426  *         Su[i] = (-0.25*(v - 1.0)*(u + v + 1) - 0.25*(u - 1.0)*(v - 1.0))*verts[0][i] + \
2427  *                 (-0.25*(v - 1.0)*(u - v - 1) - 0.25*(u + 1.0)*(v - 1.0))*verts[1][i] + \
2428  */
2429   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
2430     __pyx_v_i = __pyx_t_1;
2431 
2432     /* "yt/utilities/lib/primitives.pyx":202
2433  *     cdef int i
2434  *     for i in range(3):
2435  *         Su[i] = (-0.25*(v - 1.0)*(u + v + 1) - 0.25*(u - 1.0)*(v - 1.0))*verts[0][i] + \             # <<<<<<<<<<<<<<
2436  *                 (-0.25*(v - 1.0)*(u - v - 1) - 0.25*(u + 1.0)*(v - 1.0))*verts[1][i] + \
2437  *                 ( 0.25*(v + 1.0)*(u + v - 1) + 0.25*(u + 1.0)*(v + 1.0))*verts[2][i] + \
2438  */
2439     (__pyx_v_Su[__pyx_v_i]) = (((((((((((-0.25 * (__pyx_v_v - 1.0)) * ((__pyx_v_u + __pyx_v_v) + 1.0)) - ((0.25 * (__pyx_v_u - 1.0)) * (__pyx_v_v - 1.0))) * ((__pyx_v_verts[0])[__pyx_v_i])) + ((((-0.25 * (__pyx_v_v - 1.0)) * ((__pyx_v_u - __pyx_v_v) - 1.0)) - ((0.25 * (__pyx_v_u + 1.0)) * (__pyx_v_v - 1.0))) * ((__pyx_v_verts[1])[__pyx_v_i]))) + ((((0.25 * (__pyx_v_v + 1.0)) * ((__pyx_v_u + __pyx_v_v) - 1.0)) + ((0.25 * (__pyx_v_u + 1.0)) * (__pyx_v_v + 1.0))) * ((__pyx_v_verts[2])[__pyx_v_i]))) + ((((0.25 * (__pyx_v_v + 1.0)) * ((__pyx_v_u - __pyx_v_v) + 1.0)) + ((0.25 * (__pyx_v_u - 1.0)) * (__pyx_v_v + 1.0))) * ((__pyx_v_verts[3])[__pyx_v_i]))) + ((0.5 * ((__pyx_v_v * __pyx_v_v) - 1.0)) * ((__pyx_v_verts[4])[__pyx_v_i]))) + ((__pyx_v_u * (__pyx_v_v - 1.0)) * ((__pyx_v_verts[5])[__pyx_v_i]))) - ((0.5 * ((__pyx_v_v * __pyx_v_v) - 1.0)) * ((__pyx_v_verts[6])[__pyx_v_i]))) - ((__pyx_v_u * (__pyx_v_v + 1.0)) * ((__pyx_v_verts[7])[__pyx_v_i])));
2440   }
2441 
2442   /* "yt/utilities/lib/primitives.pyx":191
2443  * @cython.wraparound(False)
2444  * @cython.cdivision(True)
2445  * cdef void patchSurfaceDerivU(const cython.floating[8][3] verts,             # <<<<<<<<<<<<<<
2446  *                              const cython.floating u,
2447  *                              const cython.floating v,
2448  */
2449 
2450   /* function exit code */
2451 }
2452 
2453 /* "yt/utilities/lib/primitives.pyx":213
2454  * @cython.wraparound(False)
2455  * @cython.cdivision(True)
2456  * cdef void patchSurfaceDerivV(const cython.floating[8][3] verts,             # <<<<<<<<<<<<<<
2457  *                              const cython.floating u,
2458  *                              const cython.floating v,
2459  */
2460 
__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceDerivV(float (* __pyx_v_verts)[3],float const __pyx_v_u,float const __pyx_v_v,float * __pyx_v_Sv)2461 static void __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceDerivV(float (*__pyx_v_verts)[3], float const __pyx_v_u, float const __pyx_v_v, float *__pyx_v_Sv) {
2462   int __pyx_v_i;
2463   int __pyx_t_1;
2464 
2465   /* "yt/utilities/lib/primitives.pyx":224
2466  *
2467  *     cdef int i
2468  *     for i in range(3):             # <<<<<<<<<<<<<<
2469  *         Sv[i] = (-0.25*(u - 1.0)*(u + v + 1) - 0.25*(u - 1.0)*(v - 1.0))*verts[0][i] + \
2470  *                 (-0.25*(u + 1.0)*(u - v - 1) + 0.25*(u + 1.0)*(v - 1.0))*verts[1][i] + \
2471  */
2472   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
2473     __pyx_v_i = __pyx_t_1;
2474 
2475     /* "yt/utilities/lib/primitives.pyx":225
2476  *     cdef int i
2477  *     for i in range(3):
2478  *         Sv[i] = (-0.25*(u - 1.0)*(u + v + 1) - 0.25*(u - 1.0)*(v - 1.0))*verts[0][i] + \             # <<<<<<<<<<<<<<
2479  *                 (-0.25*(u + 1.0)*(u - v - 1) + 0.25*(u + 1.0)*(v - 1.0))*verts[1][i] + \
2480  *                 ( 0.25*(u + 1.0)*(u + v - 1) + 0.25*(u + 1.0)*(v + 1.0))*verts[2][i] + \
2481  */
2482     (__pyx_v_Sv[__pyx_v_i]) = (((((((((((-0.25 * (__pyx_v_u - 1.0)) * ((__pyx_v_u + __pyx_v_v) + 1.0)) - ((0.25 * (__pyx_v_u - 1.0)) * (__pyx_v_v - 1.0))) * ((__pyx_v_verts[0])[__pyx_v_i])) + ((((-0.25 * (__pyx_v_u + 1.0)) * ((__pyx_v_u - __pyx_v_v) - 1.0)) + ((0.25 * (__pyx_v_u + 1.0)) * (__pyx_v_v - 1.0))) * ((__pyx_v_verts[1])[__pyx_v_i]))) + ((((0.25 * (__pyx_v_u + 1.0)) * ((__pyx_v_u + __pyx_v_v) - 1.0)) + ((0.25 * (__pyx_v_u + 1.0)) * (__pyx_v_v + 1.0))) * ((__pyx_v_verts[2])[__pyx_v_i]))) + ((((0.25 * (__pyx_v_u - 1.0)) * ((__pyx_v_u - __pyx_v_v) + 1.0)) - ((0.25 * (__pyx_v_u - 1.0)) * (__pyx_v_v + 1.0))) * ((__pyx_v_verts[3])[__pyx_v_i]))) + ((0.5 * ((__pyx_v_u * __pyx_v_u) - 1.0)) * ((__pyx_v_verts[5])[__pyx_v_i]))) + ((__pyx_v_v * (__pyx_v_u - 1.0)) * ((__pyx_v_verts[4])[__pyx_v_i]))) - ((0.5 * ((__pyx_v_u * __pyx_v_u) - 1.0)) * ((__pyx_v_verts[7])[__pyx_v_i]))) - ((__pyx_v_v * (__pyx_v_u + 1.0)) * ((__pyx_v_verts[6])[__pyx_v_i])));
2483   }
2484 
2485   /* "yt/utilities/lib/primitives.pyx":213
2486  * @cython.wraparound(False)
2487  * @cython.cdivision(True)
2488  * cdef void patchSurfaceDerivV(const cython.floating[8][3] verts,             # <<<<<<<<<<<<<<
2489  *                              const cython.floating u,
2490  *                              const cython.floating v,
2491  */
2492 
2493   /* function exit code */
2494 }
2495 
__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceDerivV(double (* __pyx_v_verts)[3],double const __pyx_v_u,double const __pyx_v_v,double * __pyx_v_Sv)2496 static void __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceDerivV(double (*__pyx_v_verts)[3], double const __pyx_v_u, double const __pyx_v_v, double *__pyx_v_Sv) {
2497   int __pyx_v_i;
2498   int __pyx_t_1;
2499 
2500   /* "yt/utilities/lib/primitives.pyx":224
2501  *
2502  *     cdef int i
2503  *     for i in range(3):             # <<<<<<<<<<<<<<
2504  *         Sv[i] = (-0.25*(u - 1.0)*(u + v + 1) - 0.25*(u - 1.0)*(v - 1.0))*verts[0][i] + \
2505  *                 (-0.25*(u + 1.0)*(u - v - 1) + 0.25*(u + 1.0)*(v - 1.0))*verts[1][i] + \
2506  */
2507   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
2508     __pyx_v_i = __pyx_t_1;
2509 
2510     /* "yt/utilities/lib/primitives.pyx":225
2511  *     cdef int i
2512  *     for i in range(3):
2513  *         Sv[i] = (-0.25*(u - 1.0)*(u + v + 1) - 0.25*(u - 1.0)*(v - 1.0))*verts[0][i] + \             # <<<<<<<<<<<<<<
2514  *                 (-0.25*(u + 1.0)*(u - v - 1) + 0.25*(u + 1.0)*(v - 1.0))*verts[1][i] + \
2515  *                 ( 0.25*(u + 1.0)*(u + v - 1) + 0.25*(u + 1.0)*(v + 1.0))*verts[2][i] + \
2516  */
2517     (__pyx_v_Sv[__pyx_v_i]) = (((((((((((-0.25 * (__pyx_v_u - 1.0)) * ((__pyx_v_u + __pyx_v_v) + 1.0)) - ((0.25 * (__pyx_v_u - 1.0)) * (__pyx_v_v - 1.0))) * ((__pyx_v_verts[0])[__pyx_v_i])) + ((((-0.25 * (__pyx_v_u + 1.0)) * ((__pyx_v_u - __pyx_v_v) - 1.0)) + ((0.25 * (__pyx_v_u + 1.0)) * (__pyx_v_v - 1.0))) * ((__pyx_v_verts[1])[__pyx_v_i]))) + ((((0.25 * (__pyx_v_u + 1.0)) * ((__pyx_v_u + __pyx_v_v) - 1.0)) + ((0.25 * (__pyx_v_u + 1.0)) * (__pyx_v_v + 1.0))) * ((__pyx_v_verts[2])[__pyx_v_i]))) + ((((0.25 * (__pyx_v_u - 1.0)) * ((__pyx_v_u - __pyx_v_v) + 1.0)) - ((0.25 * (__pyx_v_u - 1.0)) * (__pyx_v_v + 1.0))) * ((__pyx_v_verts[3])[__pyx_v_i]))) + ((0.5 * ((__pyx_v_u * __pyx_v_u) - 1.0)) * ((__pyx_v_verts[5])[__pyx_v_i]))) + ((__pyx_v_v * (__pyx_v_u - 1.0)) * ((__pyx_v_verts[4])[__pyx_v_i]))) - ((0.5 * ((__pyx_v_u * __pyx_v_u) - 1.0)) * ((__pyx_v_verts[7])[__pyx_v_i]))) - ((__pyx_v_v * (__pyx_v_u + 1.0)) * ((__pyx_v_verts[6])[__pyx_v_i])));
2518   }
2519 
2520   /* "yt/utilities/lib/primitives.pyx":213
2521  * @cython.wraparound(False)
2522  * @cython.cdivision(True)
2523  * cdef void patchSurfaceDerivV(const cython.floating[8][3] verts,             # <<<<<<<<<<<<<<
2524  *                              const cython.floating u,
2525  *                              const cython.floating v,
2526  */
2527 
2528   /* function exit code */
2529 }
2530 
2531 /* "yt/utilities/lib/primitives.pyx":236
2532  * @cython.wraparound(False)
2533  * @cython.cdivision(True)
2534  * cdef RayHitData compute_patch_hit(cython.floating[8][3] verts,             # <<<<<<<<<<<<<<
2535  *                                   cython.floating[3] ray_origin,
2536  *                                   cython.floating[3] ray_direction) nogil:
2537  */
2538 
__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_compute_patch_hit(float (* __pyx_v_verts)[3],float * __pyx_v_ray_origin,float * __pyx_v_ray_direction)2539 static struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_compute_patch_hit(float (*__pyx_v_verts)[3], float *__pyx_v_ray_origin, float *__pyx_v_ray_direction) {
2540   float __pyx_v_n[3];
2541   float __pyx_v_N1[3];
2542   float __pyx_v_N2[3];
2543   float __pyx_v_A;
2544   long __pyx_v_i;
2545   float __pyx_v_d1;
2546   float __pyx_v_d2;
2547   float __pyx_v_u;
2548   float __pyx_v_v;
2549   float __pyx_v_S[3];
2550   float __pyx_v_fu;
2551   float __pyx_v_fv;
2552   float __pyx_v_err;
2553   float __pyx_v_tol;
2554   int __pyx_v_iterations;
2555   int __pyx_v_max_iter;
2556   float __pyx_v_Su[3];
2557   float __pyx_v_Sv[3];
2558   float __pyx_v_J11;
2559   float __pyx_v_J12;
2560   float __pyx_v_J21;
2561   float __pyx_v_J22;
2562   float __pyx_v_det;
2563   float __pyx_v_t;
2564   struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData __pyx_v_hd;
2565   struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData __pyx_r;
2566   long __pyx_t_1;
2567   int __pyx_t_2;
2568   int __pyx_t_3;
2569 
2570   /* "yt/utilities/lib/primitives.pyx":248
2571  *     # first we compute the two planes that define the ray.
2572  *     cdef cython.floating[3] n, N1, N2
2573  *     cdef cython.floating A = dot(ray_direction, ray_direction)             # <<<<<<<<<<<<<<
2574  *     for i in range(3):
2575  *         n[i] = ray_direction[i] / A
2576  */
2577   __pyx_v_A = __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_ray_direction, __pyx_v_ray_direction);
2578 
2579   /* "yt/utilities/lib/primitives.pyx":249
2580  *     cdef cython.floating[3] n, N1, N2
2581  *     cdef cython.floating A = dot(ray_direction, ray_direction)
2582  *     for i in range(3):             # <<<<<<<<<<<<<<
2583  *         n[i] = ray_direction[i] / A
2584  *
2585  */
2586   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
2587     __pyx_v_i = __pyx_t_1;
2588 
2589     /* "yt/utilities/lib/primitives.pyx":250
2590  *     cdef cython.floating A = dot(ray_direction, ray_direction)
2591  *     for i in range(3):
2592  *         n[i] = ray_direction[i] / A             # <<<<<<<<<<<<<<
2593  *
2594  *     if ((fabs(n[0]) > fabs(n[1])) and (fabs(n[0]) > fabs(n[2]))):
2595  */
2596     (__pyx_v_n[__pyx_v_i]) = ((__pyx_v_ray_direction[__pyx_v_i]) / __pyx_v_A);
2597   }
2598 
2599   /* "yt/utilities/lib/primitives.pyx":252
2600  *         n[i] = ray_direction[i] / A
2601  *
2602  *     if ((fabs(n[0]) > fabs(n[1])) and (fabs(n[0]) > fabs(n[2]))):             # <<<<<<<<<<<<<<
2603  *         N1[0] = n[1]
2604  *         N1[1] =-n[0]
2605  */
2606   __pyx_t_3 = ((fabs((__pyx_v_n[0])) > fabs((__pyx_v_n[1]))) != 0);
2607   if (__pyx_t_3) {
2608   } else {
2609     __pyx_t_2 = __pyx_t_3;
2610     goto __pyx_L6_bool_binop_done;
2611   }
2612   __pyx_t_3 = ((fabs((__pyx_v_n[0])) > fabs((__pyx_v_n[2]))) != 0);
2613   __pyx_t_2 = __pyx_t_3;
2614   __pyx_L6_bool_binop_done:;
2615   if (__pyx_t_2) {
2616 
2617     /* "yt/utilities/lib/primitives.pyx":253
2618  *
2619  *     if ((fabs(n[0]) > fabs(n[1])) and (fabs(n[0]) > fabs(n[2]))):
2620  *         N1[0] = n[1]             # <<<<<<<<<<<<<<
2621  *         N1[1] =-n[0]
2622  *         N1[2] = 0.0
2623  */
2624     (__pyx_v_N1[0]) = (__pyx_v_n[1]);
2625 
2626     /* "yt/utilities/lib/primitives.pyx":254
2627  *     if ((fabs(n[0]) > fabs(n[1])) and (fabs(n[0]) > fabs(n[2]))):
2628  *         N1[0] = n[1]
2629  *         N1[1] =-n[0]             # <<<<<<<<<<<<<<
2630  *         N1[2] = 0.0
2631  *     else:
2632  */
2633     (__pyx_v_N1[1]) = (-(__pyx_v_n[0]));
2634 
2635     /* "yt/utilities/lib/primitives.pyx":255
2636  *         N1[0] = n[1]
2637  *         N1[1] =-n[0]
2638  *         N1[2] = 0.0             # <<<<<<<<<<<<<<
2639  *     else:
2640  *         N1[0] = 0.0
2641  */
2642     (__pyx_v_N1[2]) = 0.0;
2643 
2644     /* "yt/utilities/lib/primitives.pyx":252
2645  *         n[i] = ray_direction[i] / A
2646  *
2647  *     if ((fabs(n[0]) > fabs(n[1])) and (fabs(n[0]) > fabs(n[2]))):             # <<<<<<<<<<<<<<
2648  *         N1[0] = n[1]
2649  *         N1[1] =-n[0]
2650  */
2651     goto __pyx_L5;
2652   }
2653 
2654   /* "yt/utilities/lib/primitives.pyx":257
2655  *         N1[2] = 0.0
2656  *     else:
2657  *         N1[0] = 0.0             # <<<<<<<<<<<<<<
2658  *         N1[1] = n[2]
2659  *         N1[2] =-n[1]
2660  */
2661   /*else*/ {
2662     (__pyx_v_N1[0]) = 0.0;
2663 
2664     /* "yt/utilities/lib/primitives.pyx":258
2665  *     else:
2666  *         N1[0] = 0.0
2667  *         N1[1] = n[2]             # <<<<<<<<<<<<<<
2668  *         N1[2] =-n[1]
2669  *     cross(N1, n, N2)
2670  */
2671     (__pyx_v_N1[1]) = (__pyx_v_n[2]);
2672 
2673     /* "yt/utilities/lib/primitives.pyx":259
2674  *         N1[0] = 0.0
2675  *         N1[1] = n[2]
2676  *         N1[2] =-n[1]             # <<<<<<<<<<<<<<
2677  *     cross(N1, n, N2)
2678  *
2679  */
2680     (__pyx_v_N1[2]) = (-(__pyx_v_n[1]));
2681   }
2682   __pyx_L5:;
2683 
2684   /* "yt/utilities/lib/primitives.pyx":260
2685  *         N1[1] = n[2]
2686  *         N1[2] =-n[1]
2687  *     cross(N1, n, N2)             # <<<<<<<<<<<<<<
2688  *
2689  *     cdef cython.floating d1 = -dot(N1, ray_origin)
2690  */
2691   __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_cross(__pyx_v_N1, __pyx_v_n, __pyx_v_N2);
2692 
2693   /* "yt/utilities/lib/primitives.pyx":262
2694  *     cross(N1, n, N2)
2695  *
2696  *     cdef cython.floating d1 = -dot(N1, ray_origin)             # <<<<<<<<<<<<<<
2697  *     cdef cython.floating d2 = -dot(N2, ray_origin)
2698  *
2699  */
2700   __pyx_v_d1 = (-__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N1, __pyx_v_ray_origin));
2701 
2702   /* "yt/utilities/lib/primitives.pyx":263
2703  *
2704  *     cdef cython.floating d1 = -dot(N1, ray_origin)
2705  *     cdef cython.floating d2 = -dot(N2, ray_origin)             # <<<<<<<<<<<<<<
2706  *
2707  *     # the initial guess is set to zero
2708  */
2709   __pyx_v_d2 = (-__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N2, __pyx_v_ray_origin));
2710 
2711   /* "yt/utilities/lib/primitives.pyx":266
2712  *
2713  *     # the initial guess is set to zero
2714  *     cdef cython.floating u = 0.0             # <<<<<<<<<<<<<<
2715  *     cdef cython.floating v = 0.0
2716  *     cdef cython.floating[3] S
2717  */
2718   __pyx_v_u = 0.0;
2719 
2720   /* "yt/utilities/lib/primitives.pyx":267
2721  *     # the initial guess is set to zero
2722  *     cdef cython.floating u = 0.0
2723  *     cdef cython.floating v = 0.0             # <<<<<<<<<<<<<<
2724  *     cdef cython.floating[3] S
2725  *     patchSurfaceFunc(verts, u, v, S)
2726  */
2727   __pyx_v_v = 0.0;
2728 
2729   /* "yt/utilities/lib/primitives.pyx":269
2730  *     cdef cython.floating v = 0.0
2731  *     cdef cython.floating[3] S
2732  *     patchSurfaceFunc(verts, u, v, S)             # <<<<<<<<<<<<<<
2733  *     cdef cython.floating fu = dot(N1, S) + d1
2734  *     cdef cython.floating fv = dot(N2, S) + d2
2735  */
2736   __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceFunc(__pyx_v_verts, __pyx_v_u, __pyx_v_v, __pyx_v_S);
2737 
2738   /* "yt/utilities/lib/primitives.pyx":270
2739  *     cdef cython.floating[3] S
2740  *     patchSurfaceFunc(verts, u, v, S)
2741  *     cdef cython.floating fu = dot(N1, S) + d1             # <<<<<<<<<<<<<<
2742  *     cdef cython.floating fv = dot(N2, S) + d2
2743  *     cdef cython.floating err = fmax(fabs(fu), fabs(fv))
2744  */
2745   __pyx_v_fu = (__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N1, __pyx_v_S) + __pyx_v_d1);
2746 
2747   /* "yt/utilities/lib/primitives.pyx":271
2748  *     patchSurfaceFunc(verts, u, v, S)
2749  *     cdef cython.floating fu = dot(N1, S) + d1
2750  *     cdef cython.floating fv = dot(N2, S) + d2             # <<<<<<<<<<<<<<
2751  *     cdef cython.floating err = fmax(fabs(fu), fabs(fv))
2752  *
2753  */
2754   __pyx_v_fv = (__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N2, __pyx_v_S) + __pyx_v_d2);
2755 
2756   /* "yt/utilities/lib/primitives.pyx":272
2757  *     cdef cython.floating fu = dot(N1, S) + d1
2758  *     cdef cython.floating fv = dot(N2, S) + d2
2759  *     cdef cython.floating err = fmax(fabs(fu), fabs(fv))             # <<<<<<<<<<<<<<
2760  *
2761  *     # begin Newton iteration
2762  */
2763   __pyx_v_err = fmax(fabs(__pyx_v_fu), fabs(__pyx_v_fv));
2764 
2765   /* "yt/utilities/lib/primitives.pyx":275
2766  *
2767  *     # begin Newton iteration
2768  *     cdef cython.floating tol = 1.0e-5             # <<<<<<<<<<<<<<
2769  *     cdef int iterations = 0
2770  *     cdef int max_iter = 10
2771  */
2772   __pyx_v_tol = 1.0e-5;
2773 
2774   /* "yt/utilities/lib/primitives.pyx":276
2775  *     # begin Newton iteration
2776  *     cdef cython.floating tol = 1.0e-5
2777  *     cdef int iterations = 0             # <<<<<<<<<<<<<<
2778  *     cdef int max_iter = 10
2779  *     cdef cython.floating[3] Su
2780  */
2781   __pyx_v_iterations = 0;
2782 
2783   /* "yt/utilities/lib/primitives.pyx":277
2784  *     cdef cython.floating tol = 1.0e-5
2785  *     cdef int iterations = 0
2786  *     cdef int max_iter = 10             # <<<<<<<<<<<<<<
2787  *     cdef cython.floating[3] Su
2788  *     cdef cython.floating[3] Sv
2789  */
2790   __pyx_v_max_iter = 10;
2791 
2792   /* "yt/utilities/lib/primitives.pyx":281
2793  *     cdef cython.floating[3] Sv
2794  *     cdef cython.floating J11, J12, J21, J22, det
2795  *     while ((err > tol) and (iterations < max_iter)):             # <<<<<<<<<<<<<<
2796  *         # compute the Jacobian
2797  *         patchSurfaceDerivU(verts, u, v, Su)
2798  */
2799   while (1) {
2800     __pyx_t_3 = ((__pyx_v_err > __pyx_v_tol) != 0);
2801     if (__pyx_t_3) {
2802     } else {
2803       __pyx_t_2 = __pyx_t_3;
2804       goto __pyx_L10_bool_binop_done;
2805     }
2806     __pyx_t_3 = ((__pyx_v_iterations < __pyx_v_max_iter) != 0);
2807     __pyx_t_2 = __pyx_t_3;
2808     __pyx_L10_bool_binop_done:;
2809     if (!__pyx_t_2) break;
2810 
2811     /* "yt/utilities/lib/primitives.pyx":283
2812  *     while ((err > tol) and (iterations < max_iter)):
2813  *         # compute the Jacobian
2814  *         patchSurfaceDerivU(verts, u, v, Su)             # <<<<<<<<<<<<<<
2815  *         patchSurfaceDerivV(verts, u, v, Sv)
2816  *         J11 = dot(N1, Su)
2817  */
2818     __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceDerivU(__pyx_v_verts, __pyx_v_u, __pyx_v_v, __pyx_v_Su);
2819 
2820     /* "yt/utilities/lib/primitives.pyx":284
2821  *         # compute the Jacobian
2822  *         patchSurfaceDerivU(verts, u, v, Su)
2823  *         patchSurfaceDerivV(verts, u, v, Sv)             # <<<<<<<<<<<<<<
2824  *         J11 = dot(N1, Su)
2825  *         J12 = dot(N1, Sv)
2826  */
2827     __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceDerivV(__pyx_v_verts, __pyx_v_u, __pyx_v_v, __pyx_v_Sv);
2828 
2829     /* "yt/utilities/lib/primitives.pyx":285
2830  *         patchSurfaceDerivU(verts, u, v, Su)
2831  *         patchSurfaceDerivV(verts, u, v, Sv)
2832  *         J11 = dot(N1, Su)             # <<<<<<<<<<<<<<
2833  *         J12 = dot(N1, Sv)
2834  *         J21 = dot(N2, Su)
2835  */
2836     __pyx_v_J11 = __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N1, __pyx_v_Su);
2837 
2838     /* "yt/utilities/lib/primitives.pyx":286
2839  *         patchSurfaceDerivV(verts, u, v, Sv)
2840  *         J11 = dot(N1, Su)
2841  *         J12 = dot(N1, Sv)             # <<<<<<<<<<<<<<
2842  *         J21 = dot(N2, Su)
2843  *         J22 = dot(N2, Sv)
2844  */
2845     __pyx_v_J12 = __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N1, __pyx_v_Sv);
2846 
2847     /* "yt/utilities/lib/primitives.pyx":287
2848  *         J11 = dot(N1, Su)
2849  *         J12 = dot(N1, Sv)
2850  *         J21 = dot(N2, Su)             # <<<<<<<<<<<<<<
2851  *         J22 = dot(N2, Sv)
2852  *         det = (J11*J22 - J12*J21)
2853  */
2854     __pyx_v_J21 = __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N2, __pyx_v_Su);
2855 
2856     /* "yt/utilities/lib/primitives.pyx":288
2857  *         J12 = dot(N1, Sv)
2858  *         J21 = dot(N2, Su)
2859  *         J22 = dot(N2, Sv)             # <<<<<<<<<<<<<<
2860  *         det = (J11*J22 - J12*J21)
2861  *
2862  */
2863     __pyx_v_J22 = __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N2, __pyx_v_Sv);
2864 
2865     /* "yt/utilities/lib/primitives.pyx":289
2866  *         J21 = dot(N2, Su)
2867  *         J22 = dot(N2, Sv)
2868  *         det = (J11*J22 - J12*J21)             # <<<<<<<<<<<<<<
2869  *
2870  *         # update the u, v values
2871  */
2872     __pyx_v_det = ((__pyx_v_J11 * __pyx_v_J22) - (__pyx_v_J12 * __pyx_v_J21));
2873 
2874     /* "yt/utilities/lib/primitives.pyx":292
2875  *
2876  *         # update the u, v values
2877  *         u -= ( J22*fu - J12*fv) / det             # <<<<<<<<<<<<<<
2878  *         v -= (-J21*fu + J11*fv) / det
2879  *
2880  */
2881     __pyx_v_u = (__pyx_v_u - (((__pyx_v_J22 * __pyx_v_fu) - (__pyx_v_J12 * __pyx_v_fv)) / __pyx_v_det));
2882 
2883     /* "yt/utilities/lib/primitives.pyx":293
2884  *         # update the u, v values
2885  *         u -= ( J22*fu - J12*fv) / det
2886  *         v -= (-J21*fu + J11*fv) / det             # <<<<<<<<<<<<<<
2887  *
2888  *         patchSurfaceFunc(verts, u, v, S)
2889  */
2890     __pyx_v_v = (__pyx_v_v - ((((-__pyx_v_J21) * __pyx_v_fu) + (__pyx_v_J11 * __pyx_v_fv)) / __pyx_v_det));
2891 
2892     /* "yt/utilities/lib/primitives.pyx":295
2893  *         v -= (-J21*fu + J11*fv) / det
2894  *
2895  *         patchSurfaceFunc(verts, u, v, S)             # <<<<<<<<<<<<<<
2896  *         fu = dot(N1, S) + d1
2897  *         fv = dot(N2, S) + d2
2898  */
2899     __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceFunc(__pyx_v_verts, __pyx_v_u, __pyx_v_v, __pyx_v_S);
2900 
2901     /* "yt/utilities/lib/primitives.pyx":296
2902  *
2903  *         patchSurfaceFunc(verts, u, v, S)
2904  *         fu = dot(N1, S) + d1             # <<<<<<<<<<<<<<
2905  *         fv = dot(N2, S) + d2
2906  *
2907  */
2908     __pyx_v_fu = (__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N1, __pyx_v_S) + __pyx_v_d1);
2909 
2910     /* "yt/utilities/lib/primitives.pyx":297
2911  *         patchSurfaceFunc(verts, u, v, S)
2912  *         fu = dot(N1, S) + d1
2913  *         fv = dot(N2, S) + d2             # <<<<<<<<<<<<<<
2914  *
2915  *         err = fmax(fabs(fu), fabs(fv))
2916  */
2917     __pyx_v_fv = (__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N2, __pyx_v_S) + __pyx_v_d2);
2918 
2919     /* "yt/utilities/lib/primitives.pyx":299
2920  *         fv = dot(N2, S) + d2
2921  *
2922  *         err = fmax(fabs(fu), fabs(fv))             # <<<<<<<<<<<<<<
2923  *         iterations += 1
2924  *
2925  */
2926     __pyx_v_err = fmax(fabs(__pyx_v_fu), fabs(__pyx_v_fv));
2927 
2928     /* "yt/utilities/lib/primitives.pyx":300
2929  *
2930  *         err = fmax(fabs(fu), fabs(fv))
2931  *         iterations += 1             # <<<<<<<<<<<<<<
2932  *
2933  *     # t is the distance along the ray to this hit
2934  */
2935     __pyx_v_iterations = (__pyx_v_iterations + 1);
2936   }
2937 
2938   /* "yt/utilities/lib/primitives.pyx":303
2939  *
2940  *     # t is the distance along the ray to this hit
2941  *     cdef cython.floating t = distance(S, ray_origin) / L2_norm(ray_direction)             # <<<<<<<<<<<<<<
2942  *
2943  *     # return hit data
2944  */
2945   __pyx_v_t = (__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_distance(__pyx_v_S, __pyx_v_ray_origin) / __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_L2_norm(__pyx_v_ray_direction));
2946 
2947   /* "yt/utilities/lib/primitives.pyx":307
2948  *     # return hit data
2949  *     cdef RayHitData hd
2950  *     hd.u = u             # <<<<<<<<<<<<<<
2951  *     hd.v = v
2952  *     hd.t = t
2953  */
2954   __pyx_v_hd.u = __pyx_v_u;
2955 
2956   /* "yt/utilities/lib/primitives.pyx":308
2957  *     cdef RayHitData hd
2958  *     hd.u = u
2959  *     hd.v = v             # <<<<<<<<<<<<<<
2960  *     hd.t = t
2961  *     hd.converged = (iterations < max_iter)
2962  */
2963   __pyx_v_hd.v = __pyx_v_v;
2964 
2965   /* "yt/utilities/lib/primitives.pyx":309
2966  *     hd.u = u
2967  *     hd.v = v
2968  *     hd.t = t             # <<<<<<<<<<<<<<
2969  *     hd.converged = (iterations < max_iter)
2970  *     return hd
2971  */
2972   __pyx_v_hd.t = __pyx_v_t;
2973 
2974   /* "yt/utilities/lib/primitives.pyx":310
2975  *     hd.v = v
2976  *     hd.t = t
2977  *     hd.converged = (iterations < max_iter)             # <<<<<<<<<<<<<<
2978  *     return hd
2979  *
2980  */
2981   __pyx_v_hd.converged = (__pyx_v_iterations < __pyx_v_max_iter);
2982 
2983   /* "yt/utilities/lib/primitives.pyx":311
2984  *     hd.t = t
2985  *     hd.converged = (iterations < max_iter)
2986  *     return hd             # <<<<<<<<<<<<<<
2987  *
2988  *
2989  */
2990   __pyx_r = __pyx_v_hd;
2991   goto __pyx_L0;
2992 
2993   /* "yt/utilities/lib/primitives.pyx":236
2994  * @cython.wraparound(False)
2995  * @cython.cdivision(True)
2996  * cdef RayHitData compute_patch_hit(cython.floating[8][3] verts,             # <<<<<<<<<<<<<<
2997  *                                   cython.floating[3] ray_origin,
2998  *                                   cython.floating[3] ray_direction) nogil:
2999  */
3000 
3001   /* function exit code */
3002   __pyx_L0:;
3003   return __pyx_r;
3004 }
3005 
__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_compute_patch_hit(double (* __pyx_v_verts)[3],double * __pyx_v_ray_origin,double * __pyx_v_ray_direction)3006 static struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_compute_patch_hit(double (*__pyx_v_verts)[3], double *__pyx_v_ray_origin, double *__pyx_v_ray_direction) {
3007   double __pyx_v_n[3];
3008   double __pyx_v_N1[3];
3009   double __pyx_v_N2[3];
3010   double __pyx_v_A;
3011   long __pyx_v_i;
3012   double __pyx_v_d1;
3013   double __pyx_v_d2;
3014   double __pyx_v_u;
3015   double __pyx_v_v;
3016   double __pyx_v_S[3];
3017   double __pyx_v_fu;
3018   double __pyx_v_fv;
3019   double __pyx_v_err;
3020   double __pyx_v_tol;
3021   int __pyx_v_iterations;
3022   int __pyx_v_max_iter;
3023   double __pyx_v_Su[3];
3024   double __pyx_v_Sv[3];
3025   double __pyx_v_J11;
3026   double __pyx_v_J12;
3027   double __pyx_v_J21;
3028   double __pyx_v_J22;
3029   double __pyx_v_det;
3030   double __pyx_v_t;
3031   struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData __pyx_v_hd;
3032   struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData __pyx_r;
3033   long __pyx_t_1;
3034   int __pyx_t_2;
3035   int __pyx_t_3;
3036 
3037   /* "yt/utilities/lib/primitives.pyx":248
3038  *     # first we compute the two planes that define the ray.
3039  *     cdef cython.floating[3] n, N1, N2
3040  *     cdef cython.floating A = dot(ray_direction, ray_direction)             # <<<<<<<<<<<<<<
3041  *     for i in range(3):
3042  *         n[i] = ray_direction[i] / A
3043  */
3044   __pyx_v_A = __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_ray_direction, __pyx_v_ray_direction);
3045 
3046   /* "yt/utilities/lib/primitives.pyx":249
3047  *     cdef cython.floating[3] n, N1, N2
3048  *     cdef cython.floating A = dot(ray_direction, ray_direction)
3049  *     for i in range(3):             # <<<<<<<<<<<<<<
3050  *         n[i] = ray_direction[i] / A
3051  *
3052  */
3053   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
3054     __pyx_v_i = __pyx_t_1;
3055 
3056     /* "yt/utilities/lib/primitives.pyx":250
3057  *     cdef cython.floating A = dot(ray_direction, ray_direction)
3058  *     for i in range(3):
3059  *         n[i] = ray_direction[i] / A             # <<<<<<<<<<<<<<
3060  *
3061  *     if ((fabs(n[0]) > fabs(n[1])) and (fabs(n[0]) > fabs(n[2]))):
3062  */
3063     (__pyx_v_n[__pyx_v_i]) = ((__pyx_v_ray_direction[__pyx_v_i]) / __pyx_v_A);
3064   }
3065 
3066   /* "yt/utilities/lib/primitives.pyx":252
3067  *         n[i] = ray_direction[i] / A
3068  *
3069  *     if ((fabs(n[0]) > fabs(n[1])) and (fabs(n[0]) > fabs(n[2]))):             # <<<<<<<<<<<<<<
3070  *         N1[0] = n[1]
3071  *         N1[1] =-n[0]
3072  */
3073   __pyx_t_3 = ((fabs((__pyx_v_n[0])) > fabs((__pyx_v_n[1]))) != 0);
3074   if (__pyx_t_3) {
3075   } else {
3076     __pyx_t_2 = __pyx_t_3;
3077     goto __pyx_L6_bool_binop_done;
3078   }
3079   __pyx_t_3 = ((fabs((__pyx_v_n[0])) > fabs((__pyx_v_n[2]))) != 0);
3080   __pyx_t_2 = __pyx_t_3;
3081   __pyx_L6_bool_binop_done:;
3082   if (__pyx_t_2) {
3083 
3084     /* "yt/utilities/lib/primitives.pyx":253
3085  *
3086  *     if ((fabs(n[0]) > fabs(n[1])) and (fabs(n[0]) > fabs(n[2]))):
3087  *         N1[0] = n[1]             # <<<<<<<<<<<<<<
3088  *         N1[1] =-n[0]
3089  *         N1[2] = 0.0
3090  */
3091     (__pyx_v_N1[0]) = (__pyx_v_n[1]);
3092 
3093     /* "yt/utilities/lib/primitives.pyx":254
3094  *     if ((fabs(n[0]) > fabs(n[1])) and (fabs(n[0]) > fabs(n[2]))):
3095  *         N1[0] = n[1]
3096  *         N1[1] =-n[0]             # <<<<<<<<<<<<<<
3097  *         N1[2] = 0.0
3098  *     else:
3099  */
3100     (__pyx_v_N1[1]) = (-(__pyx_v_n[0]));
3101 
3102     /* "yt/utilities/lib/primitives.pyx":255
3103  *         N1[0] = n[1]
3104  *         N1[1] =-n[0]
3105  *         N1[2] = 0.0             # <<<<<<<<<<<<<<
3106  *     else:
3107  *         N1[0] = 0.0
3108  */
3109     (__pyx_v_N1[2]) = 0.0;
3110 
3111     /* "yt/utilities/lib/primitives.pyx":252
3112  *         n[i] = ray_direction[i] / A
3113  *
3114  *     if ((fabs(n[0]) > fabs(n[1])) and (fabs(n[0]) > fabs(n[2]))):             # <<<<<<<<<<<<<<
3115  *         N1[0] = n[1]
3116  *         N1[1] =-n[0]
3117  */
3118     goto __pyx_L5;
3119   }
3120 
3121   /* "yt/utilities/lib/primitives.pyx":257
3122  *         N1[2] = 0.0
3123  *     else:
3124  *         N1[0] = 0.0             # <<<<<<<<<<<<<<
3125  *         N1[1] = n[2]
3126  *         N1[2] =-n[1]
3127  */
3128   /*else*/ {
3129     (__pyx_v_N1[0]) = 0.0;
3130 
3131     /* "yt/utilities/lib/primitives.pyx":258
3132  *     else:
3133  *         N1[0] = 0.0
3134  *         N1[1] = n[2]             # <<<<<<<<<<<<<<
3135  *         N1[2] =-n[1]
3136  *     cross(N1, n, N2)
3137  */
3138     (__pyx_v_N1[1]) = (__pyx_v_n[2]);
3139 
3140     /* "yt/utilities/lib/primitives.pyx":259
3141  *         N1[0] = 0.0
3142  *         N1[1] = n[2]
3143  *         N1[2] =-n[1]             # <<<<<<<<<<<<<<
3144  *     cross(N1, n, N2)
3145  *
3146  */
3147     (__pyx_v_N1[2]) = (-(__pyx_v_n[1]));
3148   }
3149   __pyx_L5:;
3150 
3151   /* "yt/utilities/lib/primitives.pyx":260
3152  *         N1[1] = n[2]
3153  *         N1[2] =-n[1]
3154  *     cross(N1, n, N2)             # <<<<<<<<<<<<<<
3155  *
3156  *     cdef cython.floating d1 = -dot(N1, ray_origin)
3157  */
3158   __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_cross(__pyx_v_N1, __pyx_v_n, __pyx_v_N2);
3159 
3160   /* "yt/utilities/lib/primitives.pyx":262
3161  *     cross(N1, n, N2)
3162  *
3163  *     cdef cython.floating d1 = -dot(N1, ray_origin)             # <<<<<<<<<<<<<<
3164  *     cdef cython.floating d2 = -dot(N2, ray_origin)
3165  *
3166  */
3167   __pyx_v_d1 = (-__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N1, __pyx_v_ray_origin));
3168 
3169   /* "yt/utilities/lib/primitives.pyx":263
3170  *
3171  *     cdef cython.floating d1 = -dot(N1, ray_origin)
3172  *     cdef cython.floating d2 = -dot(N2, ray_origin)             # <<<<<<<<<<<<<<
3173  *
3174  *     # the initial guess is set to zero
3175  */
3176   __pyx_v_d2 = (-__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N2, __pyx_v_ray_origin));
3177 
3178   /* "yt/utilities/lib/primitives.pyx":266
3179  *
3180  *     # the initial guess is set to zero
3181  *     cdef cython.floating u = 0.0             # <<<<<<<<<<<<<<
3182  *     cdef cython.floating v = 0.0
3183  *     cdef cython.floating[3] S
3184  */
3185   __pyx_v_u = 0.0;
3186 
3187   /* "yt/utilities/lib/primitives.pyx":267
3188  *     # the initial guess is set to zero
3189  *     cdef cython.floating u = 0.0
3190  *     cdef cython.floating v = 0.0             # <<<<<<<<<<<<<<
3191  *     cdef cython.floating[3] S
3192  *     patchSurfaceFunc(verts, u, v, S)
3193  */
3194   __pyx_v_v = 0.0;
3195 
3196   /* "yt/utilities/lib/primitives.pyx":269
3197  *     cdef cython.floating v = 0.0
3198  *     cdef cython.floating[3] S
3199  *     patchSurfaceFunc(verts, u, v, S)             # <<<<<<<<<<<<<<
3200  *     cdef cython.floating fu = dot(N1, S) + d1
3201  *     cdef cython.floating fv = dot(N2, S) + d2
3202  */
3203   __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceFunc(__pyx_v_verts, __pyx_v_u, __pyx_v_v, __pyx_v_S);
3204 
3205   /* "yt/utilities/lib/primitives.pyx":270
3206  *     cdef cython.floating[3] S
3207  *     patchSurfaceFunc(verts, u, v, S)
3208  *     cdef cython.floating fu = dot(N1, S) + d1             # <<<<<<<<<<<<<<
3209  *     cdef cython.floating fv = dot(N2, S) + d2
3210  *     cdef cython.floating err = fmax(fabs(fu), fabs(fv))
3211  */
3212   __pyx_v_fu = (__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N1, __pyx_v_S) + __pyx_v_d1);
3213 
3214   /* "yt/utilities/lib/primitives.pyx":271
3215  *     patchSurfaceFunc(verts, u, v, S)
3216  *     cdef cython.floating fu = dot(N1, S) + d1
3217  *     cdef cython.floating fv = dot(N2, S) + d2             # <<<<<<<<<<<<<<
3218  *     cdef cython.floating err = fmax(fabs(fu), fabs(fv))
3219  *
3220  */
3221   __pyx_v_fv = (__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N2, __pyx_v_S) + __pyx_v_d2);
3222 
3223   /* "yt/utilities/lib/primitives.pyx":272
3224  *     cdef cython.floating fu = dot(N1, S) + d1
3225  *     cdef cython.floating fv = dot(N2, S) + d2
3226  *     cdef cython.floating err = fmax(fabs(fu), fabs(fv))             # <<<<<<<<<<<<<<
3227  *
3228  *     # begin Newton iteration
3229  */
3230   __pyx_v_err = fmax(fabs(__pyx_v_fu), fabs(__pyx_v_fv));
3231 
3232   /* "yt/utilities/lib/primitives.pyx":275
3233  *
3234  *     # begin Newton iteration
3235  *     cdef cython.floating tol = 1.0e-5             # <<<<<<<<<<<<<<
3236  *     cdef int iterations = 0
3237  *     cdef int max_iter = 10
3238  */
3239   __pyx_v_tol = 1.0e-5;
3240 
3241   /* "yt/utilities/lib/primitives.pyx":276
3242  *     # begin Newton iteration
3243  *     cdef cython.floating tol = 1.0e-5
3244  *     cdef int iterations = 0             # <<<<<<<<<<<<<<
3245  *     cdef int max_iter = 10
3246  *     cdef cython.floating[3] Su
3247  */
3248   __pyx_v_iterations = 0;
3249 
3250   /* "yt/utilities/lib/primitives.pyx":277
3251  *     cdef cython.floating tol = 1.0e-5
3252  *     cdef int iterations = 0
3253  *     cdef int max_iter = 10             # <<<<<<<<<<<<<<
3254  *     cdef cython.floating[3] Su
3255  *     cdef cython.floating[3] Sv
3256  */
3257   __pyx_v_max_iter = 10;
3258 
3259   /* "yt/utilities/lib/primitives.pyx":281
3260  *     cdef cython.floating[3] Sv
3261  *     cdef cython.floating J11, J12, J21, J22, det
3262  *     while ((err > tol) and (iterations < max_iter)):             # <<<<<<<<<<<<<<
3263  *         # compute the Jacobian
3264  *         patchSurfaceDerivU(verts, u, v, Su)
3265  */
3266   while (1) {
3267     __pyx_t_3 = ((__pyx_v_err > __pyx_v_tol) != 0);
3268     if (__pyx_t_3) {
3269     } else {
3270       __pyx_t_2 = __pyx_t_3;
3271       goto __pyx_L10_bool_binop_done;
3272     }
3273     __pyx_t_3 = ((__pyx_v_iterations < __pyx_v_max_iter) != 0);
3274     __pyx_t_2 = __pyx_t_3;
3275     __pyx_L10_bool_binop_done:;
3276     if (!__pyx_t_2) break;
3277 
3278     /* "yt/utilities/lib/primitives.pyx":283
3279  *     while ((err > tol) and (iterations < max_iter)):
3280  *         # compute the Jacobian
3281  *         patchSurfaceDerivU(verts, u, v, Su)             # <<<<<<<<<<<<<<
3282  *         patchSurfaceDerivV(verts, u, v, Sv)
3283  *         J11 = dot(N1, Su)
3284  */
3285     __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceDerivU(__pyx_v_verts, __pyx_v_u, __pyx_v_v, __pyx_v_Su);
3286 
3287     /* "yt/utilities/lib/primitives.pyx":284
3288  *         # compute the Jacobian
3289  *         patchSurfaceDerivU(verts, u, v, Su)
3290  *         patchSurfaceDerivV(verts, u, v, Sv)             # <<<<<<<<<<<<<<
3291  *         J11 = dot(N1, Su)
3292  *         J12 = dot(N1, Sv)
3293  */
3294     __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceDerivV(__pyx_v_verts, __pyx_v_u, __pyx_v_v, __pyx_v_Sv);
3295 
3296     /* "yt/utilities/lib/primitives.pyx":285
3297  *         patchSurfaceDerivU(verts, u, v, Su)
3298  *         patchSurfaceDerivV(verts, u, v, Sv)
3299  *         J11 = dot(N1, Su)             # <<<<<<<<<<<<<<
3300  *         J12 = dot(N1, Sv)
3301  *         J21 = dot(N2, Su)
3302  */
3303     __pyx_v_J11 = __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N1, __pyx_v_Su);
3304 
3305     /* "yt/utilities/lib/primitives.pyx":286
3306  *         patchSurfaceDerivV(verts, u, v, Sv)
3307  *         J11 = dot(N1, Su)
3308  *         J12 = dot(N1, Sv)             # <<<<<<<<<<<<<<
3309  *         J21 = dot(N2, Su)
3310  *         J22 = dot(N2, Sv)
3311  */
3312     __pyx_v_J12 = __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N1, __pyx_v_Sv);
3313 
3314     /* "yt/utilities/lib/primitives.pyx":287
3315  *         J11 = dot(N1, Su)
3316  *         J12 = dot(N1, Sv)
3317  *         J21 = dot(N2, Su)             # <<<<<<<<<<<<<<
3318  *         J22 = dot(N2, Sv)
3319  *         det = (J11*J22 - J12*J21)
3320  */
3321     __pyx_v_J21 = __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N2, __pyx_v_Su);
3322 
3323     /* "yt/utilities/lib/primitives.pyx":288
3324  *         J12 = dot(N1, Sv)
3325  *         J21 = dot(N2, Su)
3326  *         J22 = dot(N2, Sv)             # <<<<<<<<<<<<<<
3327  *         det = (J11*J22 - J12*J21)
3328  *
3329  */
3330     __pyx_v_J22 = __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N2, __pyx_v_Sv);
3331 
3332     /* "yt/utilities/lib/primitives.pyx":289
3333  *         J21 = dot(N2, Su)
3334  *         J22 = dot(N2, Sv)
3335  *         det = (J11*J22 - J12*J21)             # <<<<<<<<<<<<<<
3336  *
3337  *         # update the u, v values
3338  */
3339     __pyx_v_det = ((__pyx_v_J11 * __pyx_v_J22) - (__pyx_v_J12 * __pyx_v_J21));
3340 
3341     /* "yt/utilities/lib/primitives.pyx":292
3342  *
3343  *         # update the u, v values
3344  *         u -= ( J22*fu - J12*fv) / det             # <<<<<<<<<<<<<<
3345  *         v -= (-J21*fu + J11*fv) / det
3346  *
3347  */
3348     __pyx_v_u = (__pyx_v_u - (((__pyx_v_J22 * __pyx_v_fu) - (__pyx_v_J12 * __pyx_v_fv)) / __pyx_v_det));
3349 
3350     /* "yt/utilities/lib/primitives.pyx":293
3351  *         # update the u, v values
3352  *         u -= ( J22*fu - J12*fv) / det
3353  *         v -= (-J21*fu + J11*fv) / det             # <<<<<<<<<<<<<<
3354  *
3355  *         patchSurfaceFunc(verts, u, v, S)
3356  */
3357     __pyx_v_v = (__pyx_v_v - ((((-__pyx_v_J21) * __pyx_v_fu) + (__pyx_v_J11 * __pyx_v_fv)) / __pyx_v_det));
3358 
3359     /* "yt/utilities/lib/primitives.pyx":295
3360  *         v -= (-J21*fu + J11*fv) / det
3361  *
3362  *         patchSurfaceFunc(verts, u, v, S)             # <<<<<<<<<<<<<<
3363  *         fu = dot(N1, S) + d1
3364  *         fv = dot(N2, S) + d2
3365  */
3366     __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceFunc(__pyx_v_verts, __pyx_v_u, __pyx_v_v, __pyx_v_S);
3367 
3368     /* "yt/utilities/lib/primitives.pyx":296
3369  *
3370  *         patchSurfaceFunc(verts, u, v, S)
3371  *         fu = dot(N1, S) + d1             # <<<<<<<<<<<<<<
3372  *         fv = dot(N2, S) + d2
3373  *
3374  */
3375     __pyx_v_fu = (__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N1, __pyx_v_S) + __pyx_v_d1);
3376 
3377     /* "yt/utilities/lib/primitives.pyx":297
3378  *         patchSurfaceFunc(verts, u, v, S)
3379  *         fu = dot(N1, S) + d1
3380  *         fv = dot(N2, S) + d2             # <<<<<<<<<<<<<<
3381  *
3382  *         err = fmax(fabs(fu), fabs(fv))
3383  */
3384     __pyx_v_fv = (__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N2, __pyx_v_S) + __pyx_v_d2);
3385 
3386     /* "yt/utilities/lib/primitives.pyx":299
3387  *         fv = dot(N2, S) + d2
3388  *
3389  *         err = fmax(fabs(fu), fabs(fv))             # <<<<<<<<<<<<<<
3390  *         iterations += 1
3391  *
3392  */
3393     __pyx_v_err = fmax(fabs(__pyx_v_fu), fabs(__pyx_v_fv));
3394 
3395     /* "yt/utilities/lib/primitives.pyx":300
3396  *
3397  *         err = fmax(fabs(fu), fabs(fv))
3398  *         iterations += 1             # <<<<<<<<<<<<<<
3399  *
3400  *     # t is the distance along the ray to this hit
3401  */
3402     __pyx_v_iterations = (__pyx_v_iterations + 1);
3403   }
3404 
3405   /* "yt/utilities/lib/primitives.pyx":303
3406  *
3407  *     # t is the distance along the ray to this hit
3408  *     cdef cython.floating t = distance(S, ray_origin) / L2_norm(ray_direction)             # <<<<<<<<<<<<<<
3409  *
3410  *     # return hit data
3411  */
3412   __pyx_v_t = (__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_distance(__pyx_v_S, __pyx_v_ray_origin) / __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_L2_norm(__pyx_v_ray_direction));
3413 
3414   /* "yt/utilities/lib/primitives.pyx":307
3415  *     # return hit data
3416  *     cdef RayHitData hd
3417  *     hd.u = u             # <<<<<<<<<<<<<<
3418  *     hd.v = v
3419  *     hd.t = t
3420  */
3421   __pyx_v_hd.u = __pyx_v_u;
3422 
3423   /* "yt/utilities/lib/primitives.pyx":308
3424  *     cdef RayHitData hd
3425  *     hd.u = u
3426  *     hd.v = v             # <<<<<<<<<<<<<<
3427  *     hd.t = t
3428  *     hd.converged = (iterations < max_iter)
3429  */
3430   __pyx_v_hd.v = __pyx_v_v;
3431 
3432   /* "yt/utilities/lib/primitives.pyx":309
3433  *     hd.u = u
3434  *     hd.v = v
3435  *     hd.t = t             # <<<<<<<<<<<<<<
3436  *     hd.converged = (iterations < max_iter)
3437  *     return hd
3438  */
3439   __pyx_v_hd.t = __pyx_v_t;
3440 
3441   /* "yt/utilities/lib/primitives.pyx":310
3442  *     hd.v = v
3443  *     hd.t = t
3444  *     hd.converged = (iterations < max_iter)             # <<<<<<<<<<<<<<
3445  *     return hd
3446  *
3447  */
3448   __pyx_v_hd.converged = (__pyx_v_iterations < __pyx_v_max_iter);
3449 
3450   /* "yt/utilities/lib/primitives.pyx":311
3451  *     hd.t = t
3452  *     hd.converged = (iterations < max_iter)
3453  *     return hd             # <<<<<<<<<<<<<<
3454  *
3455  *
3456  */
3457   __pyx_r = __pyx_v_hd;
3458   goto __pyx_L0;
3459 
3460   /* "yt/utilities/lib/primitives.pyx":236
3461  * @cython.wraparound(False)
3462  * @cython.cdivision(True)
3463  * cdef RayHitData compute_patch_hit(cython.floating[8][3] verts,             # <<<<<<<<<<<<<<
3464  *                                   cython.floating[3] ray_origin,
3465  *                                   cython.floating[3] ray_direction) nogil:
3466  */
3467 
3468   /* function exit code */
3469   __pyx_L0:;
3470   return __pyx_r;
3471 }
3472 
3473 /* "yt/utilities/lib/primitives.pyx":317
3474  * @cython.wraparound(False)
3475  * @cython.cdivision(True)
3476  * cdef np.int64_t ray_patch_intersect(const void* primitives,             # <<<<<<<<<<<<<<
3477  *                                     const np.int64_t item,
3478  *                                     Ray* ray) nogil:
3479  */
3480 
__pyx_f_2yt_9utilities_3lib_10primitives_ray_patch_intersect(void const * __pyx_v_primitives,__pyx_t_5numpy_int64_t const __pyx_v_item,struct __pyx_t_2yt_9utilities_3lib_10primitives_Ray * __pyx_v_ray)3481 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_10primitives_ray_patch_intersect(void const *__pyx_v_primitives, __pyx_t_5numpy_int64_t const __pyx_v_item, struct __pyx_t_2yt_9utilities_3lib_10primitives_Ray *__pyx_v_ray) {
3482   struct __pyx_t_2yt_9utilities_3lib_10primitives_Patch __pyx_v_patch;
3483   struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData __pyx_v_hd;
3484   __pyx_t_5numpy_int64_t __pyx_r;
3485   int __pyx_t_1;
3486   int __pyx_t_2;
3487   __pyx_t_5numpy_float64_t __pyx_t_3;
3488   __pyx_t_5numpy_int64_t __pyx_t_4;
3489 
3490   /* "yt/utilities/lib/primitives.pyx":329
3491  *
3492  *     '''
3493  *     cdef Patch patch = (<Patch*> primitives)[item]             # <<<<<<<<<<<<<<
3494  *
3495  *     cdef RayHitData hd = compute_patch_hit(patch.v, ray.origin, ray.direction)
3496  */
3497   __pyx_v_patch = (((struct __pyx_t_2yt_9utilities_3lib_10primitives_Patch *)__pyx_v_primitives)[__pyx_v_item]);
3498 
3499   /* "yt/utilities/lib/primitives.pyx":331
3500  *     cdef Patch patch = (<Patch*> primitives)[item]
3501  *
3502  *     cdef RayHitData hd = compute_patch_hit(patch.v, ray.origin, ray.direction)             # <<<<<<<<<<<<<<
3503  *
3504  *     # only count this is it's the closest hit
3505  */
3506   __pyx_v_hd = __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_compute_patch_hit(__pyx_v_patch.v, __pyx_v_ray->origin, __pyx_v_ray->direction);
3507 
3508   /* "yt/utilities/lib/primitives.pyx":334
3509  *
3510  *     # only count this is it's the closest hit
3511  *     if (hd.t < ray.t_near or hd.t > ray.t_far):             # <<<<<<<<<<<<<<
3512  *         return False
3513  *
3514  */
3515   __pyx_t_2 = ((__pyx_v_hd.t < __pyx_v_ray->t_near) != 0);
3516   if (!__pyx_t_2) {
3517   } else {
3518     __pyx_t_1 = __pyx_t_2;
3519     goto __pyx_L4_bool_binop_done;
3520   }
3521   __pyx_t_2 = ((__pyx_v_hd.t > __pyx_v_ray->t_far) != 0);
3522   __pyx_t_1 = __pyx_t_2;
3523   __pyx_L4_bool_binop_done:;
3524   if (__pyx_t_1) {
3525 
3526     /* "yt/utilities/lib/primitives.pyx":335
3527  *     # only count this is it's the closest hit
3528  *     if (hd.t < ray.t_near or hd.t > ray.t_far):
3529  *         return False             # <<<<<<<<<<<<<<
3530  *
3531  *     if (fabs(hd.u) <= 1.0 and fabs(hd.v) <= 1.0 and hd.converged):
3532  */
3533     __pyx_r = 0;
3534     goto __pyx_L0;
3535 
3536     /* "yt/utilities/lib/primitives.pyx":334
3537  *
3538  *     # only count this is it's the closest hit
3539  *     if (hd.t < ray.t_near or hd.t > ray.t_far):             # <<<<<<<<<<<<<<
3540  *         return False
3541  *
3542  */
3543   }
3544 
3545   /* "yt/utilities/lib/primitives.pyx":337
3546  *         return False
3547  *
3548  *     if (fabs(hd.u) <= 1.0 and fabs(hd.v) <= 1.0 and hd.converged):             # <<<<<<<<<<<<<<
3549  *         # we have a hit, so update ray information
3550  *         ray.t_far = hd.t
3551  */
3552   __pyx_t_2 = ((fabs(__pyx_v_hd.u) <= 1.0) != 0);
3553   if (__pyx_t_2) {
3554   } else {
3555     __pyx_t_1 = __pyx_t_2;
3556     goto __pyx_L7_bool_binop_done;
3557   }
3558   __pyx_t_2 = ((fabs(__pyx_v_hd.v) <= 1.0) != 0);
3559   if (__pyx_t_2) {
3560   } else {
3561     __pyx_t_1 = __pyx_t_2;
3562     goto __pyx_L7_bool_binop_done;
3563   }
3564   __pyx_t_2 = (__pyx_v_hd.converged != 0);
3565   __pyx_t_1 = __pyx_t_2;
3566   __pyx_L7_bool_binop_done:;
3567   if (__pyx_t_1) {
3568 
3569     /* "yt/utilities/lib/primitives.pyx":339
3570  *     if (fabs(hd.u) <= 1.0 and fabs(hd.v) <= 1.0 and hd.converged):
3571  *         # we have a hit, so update ray information
3572  *         ray.t_far = hd.t             # <<<<<<<<<<<<<<
3573  *         ray.elem_id = patch.elem_id
3574  *         return True
3575  */
3576     __pyx_t_3 = __pyx_v_hd.t;
3577     __pyx_v_ray->t_far = __pyx_t_3;
3578 
3579     /* "yt/utilities/lib/primitives.pyx":340
3580  *         # we have a hit, so update ray information
3581  *         ray.t_far = hd.t
3582  *         ray.elem_id = patch.elem_id             # <<<<<<<<<<<<<<
3583  *         return True
3584  *
3585  */
3586     __pyx_t_4 = __pyx_v_patch.elem_id;
3587     __pyx_v_ray->elem_id = __pyx_t_4;
3588 
3589     /* "yt/utilities/lib/primitives.pyx":341
3590  *         ray.t_far = hd.t
3591  *         ray.elem_id = patch.elem_id
3592  *         return True             # <<<<<<<<<<<<<<
3593  *
3594  *     return False
3595  */
3596     __pyx_r = 1;
3597     goto __pyx_L0;
3598 
3599     /* "yt/utilities/lib/primitives.pyx":337
3600  *         return False
3601  *
3602  *     if (fabs(hd.u) <= 1.0 and fabs(hd.v) <= 1.0 and hd.converged):             # <<<<<<<<<<<<<<
3603  *         # we have a hit, so update ray information
3604  *         ray.t_far = hd.t
3605  */
3606   }
3607 
3608   /* "yt/utilities/lib/primitives.pyx":343
3609  *         return True
3610  *
3611  *     return False             # <<<<<<<<<<<<<<
3612  *
3613  *
3614  */
3615   __pyx_r = 0;
3616   goto __pyx_L0;
3617 
3618   /* "yt/utilities/lib/primitives.pyx":317
3619  * @cython.wraparound(False)
3620  * @cython.cdivision(True)
3621  * cdef np.int64_t ray_patch_intersect(const void* primitives,             # <<<<<<<<<<<<<<
3622  *                                     const np.int64_t item,
3623  *                                     Ray* ray) nogil:
3624  */
3625 
3626   /* function exit code */
3627   __pyx_L0:;
3628   return __pyx_r;
3629 }
3630 
3631 /* "yt/utilities/lib/primitives.pyx":349
3632  * @cython.wraparound(False)
3633  * @cython.cdivision(True)
3634  * cdef void patch_centroid(const void *primitives,             # <<<<<<<<<<<<<<
3635  *                          const np.int64_t item,
3636  *                          np.float64_t[3] centroid) nogil:
3637  */
3638 
__pyx_f_2yt_9utilities_3lib_10primitives_patch_centroid(void const * __pyx_v_primitives,__pyx_t_5numpy_int64_t const __pyx_v_item,__pyx_t_5numpy_float64_t * __pyx_v_centroid)3639 static void __pyx_f_2yt_9utilities_3lib_10primitives_patch_centroid(void const *__pyx_v_primitives, __pyx_t_5numpy_int64_t const __pyx_v_item, __pyx_t_5numpy_float64_t *__pyx_v_centroid) {
3640   __pyx_t_5numpy_int64_t __pyx_v_i;
3641   __pyx_t_5numpy_int64_t __pyx_v_j;
3642   struct __pyx_t_2yt_9utilities_3lib_10primitives_Patch __pyx_v_patch;
3643   __pyx_t_5numpy_int64_t __pyx_t_1;
3644   __pyx_t_5numpy_int64_t __pyx_t_2;
3645   __pyx_t_5numpy_int64_t __pyx_t_3;
3646 
3647   /* "yt/utilities/lib/primitives.pyx":361
3648  *
3649  *     cdef np.int64_t i, j
3650  *     cdef Patch patch = (<Patch*> primitives)[item]             # <<<<<<<<<<<<<<
3651  *
3652  *     for j in range(3):
3653  */
3654   __pyx_v_patch = (((struct __pyx_t_2yt_9utilities_3lib_10primitives_Patch *)__pyx_v_primitives)[__pyx_v_item]);
3655 
3656   /* "yt/utilities/lib/primitives.pyx":363
3657  *     cdef Patch patch = (<Patch*> primitives)[item]
3658  *
3659  *     for j in range(3):             # <<<<<<<<<<<<<<
3660  *         centroid[j] = 0.0
3661  *
3662  */
3663   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
3664     __pyx_v_j = __pyx_t_1;
3665 
3666     /* "yt/utilities/lib/primitives.pyx":364
3667  *
3668  *     for j in range(3):
3669  *         centroid[j] = 0.0             # <<<<<<<<<<<<<<
3670  *
3671  *     for i in range(8):
3672  */
3673     (__pyx_v_centroid[__pyx_v_j]) = 0.0;
3674   }
3675 
3676   /* "yt/utilities/lib/primitives.pyx":366
3677  *         centroid[j] = 0.0
3678  *
3679  *     for i in range(8):             # <<<<<<<<<<<<<<
3680  *         for j in range(3):
3681  *             centroid[j] += patch.v[i][j]
3682  */
3683   for (__pyx_t_1 = 0; __pyx_t_1 < 8; __pyx_t_1+=1) {
3684     __pyx_v_i = __pyx_t_1;
3685 
3686     /* "yt/utilities/lib/primitives.pyx":367
3687  *
3688  *     for i in range(8):
3689  *         for j in range(3):             # <<<<<<<<<<<<<<
3690  *             centroid[j] += patch.v[i][j]
3691  *
3692  */
3693     for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) {
3694       __pyx_v_j = __pyx_t_2;
3695 
3696       /* "yt/utilities/lib/primitives.pyx":368
3697  *     for i in range(8):
3698  *         for j in range(3):
3699  *             centroid[j] += patch.v[i][j]             # <<<<<<<<<<<<<<
3700  *
3701  *     for j in range(3):
3702  */
3703       __pyx_t_3 = __pyx_v_j;
3704       (__pyx_v_centroid[__pyx_t_3]) = ((__pyx_v_centroid[__pyx_t_3]) + ((__pyx_v_patch.v[__pyx_v_i])[__pyx_v_j]));
3705     }
3706   }
3707 
3708   /* "yt/utilities/lib/primitives.pyx":370
3709  *             centroid[j] += patch.v[i][j]
3710  *
3711  *     for j in range(3):             # <<<<<<<<<<<<<<
3712  *         centroid[j] /= 8.0
3713  *
3714  */
3715   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
3716     __pyx_v_j = __pyx_t_1;
3717 
3718     /* "yt/utilities/lib/primitives.pyx":371
3719  *
3720  *     for j in range(3):
3721  *         centroid[j] /= 8.0             # <<<<<<<<<<<<<<
3722  *
3723  *
3724  */
3725     __pyx_t_2 = __pyx_v_j;
3726     (__pyx_v_centroid[__pyx_t_2]) = ((__pyx_v_centroid[__pyx_t_2]) / 8.0);
3727   }
3728 
3729   /* "yt/utilities/lib/primitives.pyx":349
3730  * @cython.wraparound(False)
3731  * @cython.cdivision(True)
3732  * cdef void patch_centroid(const void *primitives,             # <<<<<<<<<<<<<<
3733  *                          const np.int64_t item,
3734  *                          np.float64_t[3] centroid) nogil:
3735  */
3736 
3737   /* function exit code */
3738 }
3739 
3740 /* "yt/utilities/lib/primitives.pyx":377
3741  * @cython.wraparound(False)
3742  * @cython.cdivision(True)
3743  * cdef void patch_bbox(const void *primitives,             # <<<<<<<<<<<<<<
3744  *                     const np.int64_t item,
3745  *                      BBox* bbox) nogil:
3746  */
3747 
__pyx_f_2yt_9utilities_3lib_10primitives_patch_bbox(void const * __pyx_v_primitives,__pyx_t_5numpy_int64_t const __pyx_v_item,struct __pyx_t_2yt_9utilities_3lib_10primitives_BBox * __pyx_v_bbox)3748 static void __pyx_f_2yt_9utilities_3lib_10primitives_patch_bbox(void const *__pyx_v_primitives, __pyx_t_5numpy_int64_t const __pyx_v_item, struct __pyx_t_2yt_9utilities_3lib_10primitives_BBox *__pyx_v_bbox) {
3749   __pyx_t_5numpy_int64_t __pyx_v_i;
3750   __pyx_t_5numpy_int64_t __pyx_v_j;
3751   struct __pyx_t_2yt_9utilities_3lib_10primitives_Patch __pyx_v_patch;
3752   __pyx_t_5numpy_int64_t __pyx_t_1;
3753   __pyx_t_5numpy_int64_t __pyx_t_2;
3754 
3755   /* "yt/utilities/lib/primitives.pyx":390
3756  *
3757  *     cdef np.int64_t i, j
3758  *     cdef Patch patch = (<Patch*> primitives)[item]             # <<<<<<<<<<<<<<
3759  *
3760  *     for j in range(3):
3761  */
3762   __pyx_v_patch = (((struct __pyx_t_2yt_9utilities_3lib_10primitives_Patch *)__pyx_v_primitives)[__pyx_v_item]);
3763 
3764   /* "yt/utilities/lib/primitives.pyx":392
3765  *     cdef Patch patch = (<Patch*> primitives)[item]
3766  *
3767  *     for j in range(3):             # <<<<<<<<<<<<<<
3768  *         bbox.left_edge[j] = patch.v[0][j]
3769  *         bbox.right_edge[j] = patch.v[0][j]
3770  */
3771   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
3772     __pyx_v_j = __pyx_t_1;
3773 
3774     /* "yt/utilities/lib/primitives.pyx":393
3775  *
3776  *     for j in range(3):
3777  *         bbox.left_edge[j] = patch.v[0][j]             # <<<<<<<<<<<<<<
3778  *         bbox.right_edge[j] = patch.v[0][j]
3779  *
3780  */
3781     (__pyx_v_bbox->left_edge[__pyx_v_j]) = ((__pyx_v_patch.v[0])[__pyx_v_j]);
3782 
3783     /* "yt/utilities/lib/primitives.pyx":394
3784  *     for j in range(3):
3785  *         bbox.left_edge[j] = patch.v[0][j]
3786  *         bbox.right_edge[j] = patch.v[0][j]             # <<<<<<<<<<<<<<
3787  *
3788  *     for i in range(1, 8):
3789  */
3790     (__pyx_v_bbox->right_edge[__pyx_v_j]) = ((__pyx_v_patch.v[0])[__pyx_v_j]);
3791   }
3792 
3793   /* "yt/utilities/lib/primitives.pyx":396
3794  *         bbox.right_edge[j] = patch.v[0][j]
3795  *
3796  *     for i in range(1, 8):             # <<<<<<<<<<<<<<
3797  *         for j in range(3):
3798  *             bbox.left_edge[j] = fmin(bbox.left_edge[j], patch.v[i][j])
3799  */
3800   for (__pyx_t_1 = 1; __pyx_t_1 < 8; __pyx_t_1+=1) {
3801     __pyx_v_i = __pyx_t_1;
3802 
3803     /* "yt/utilities/lib/primitives.pyx":397
3804  *
3805  *     for i in range(1, 8):
3806  *         for j in range(3):             # <<<<<<<<<<<<<<
3807  *             bbox.left_edge[j] = fmin(bbox.left_edge[j], patch.v[i][j])
3808  *             bbox.right_edge[j] = fmax(bbox.right_edge[j], patch.v[i][j])
3809  */
3810     for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) {
3811       __pyx_v_j = __pyx_t_2;
3812 
3813       /* "yt/utilities/lib/primitives.pyx":398
3814  *     for i in range(1, 8):
3815  *         for j in range(3):
3816  *             bbox.left_edge[j] = fmin(bbox.left_edge[j], patch.v[i][j])             # <<<<<<<<<<<<<<
3817  *             bbox.right_edge[j] = fmax(bbox.right_edge[j], patch.v[i][j])
3818  *
3819  */
3820       (__pyx_v_bbox->left_edge[__pyx_v_j]) = fmin((__pyx_v_bbox->left_edge[__pyx_v_j]), ((__pyx_v_patch.v[__pyx_v_i])[__pyx_v_j]));
3821 
3822       /* "yt/utilities/lib/primitives.pyx":399
3823  *         for j in range(3):
3824  *             bbox.left_edge[j] = fmin(bbox.left_edge[j], patch.v[i][j])
3825  *             bbox.right_edge[j] = fmax(bbox.right_edge[j], patch.v[i][j])             # <<<<<<<<<<<<<<
3826  *
3827  *
3828  */
3829       (__pyx_v_bbox->right_edge[__pyx_v_j]) = fmax((__pyx_v_bbox->right_edge[__pyx_v_j]), ((__pyx_v_patch.v[__pyx_v_i])[__pyx_v_j]));
3830     }
3831   }
3832 
3833   /* "yt/utilities/lib/primitives.pyx":377
3834  * @cython.wraparound(False)
3835  * @cython.cdivision(True)
3836  * cdef void patch_bbox(const void *primitives,             # <<<<<<<<<<<<<<
3837  *                     const np.int64_t item,
3838  *                      BBox* bbox) nogil:
3839  */
3840 
3841   /* function exit code */
3842 }
3843 
3844 /* "yt/utilities/lib/primitives.pyx":405
3845  * @cython.wraparound(False)
3846  * @cython.cdivision(True)
3847  * cdef void tet_patchSurfaceFunc(const cython.floating[6][3] verts,             # <<<<<<<<<<<<<<
3848  *                            const cython.floating u,
3849  *                            const cython.floating v,
3850  */
3851 
__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceFunc(float (* __pyx_v_verts)[3],float const __pyx_v_u,float const __pyx_v_v,float * __pyx_v_S)3852 static void __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceFunc(float (*__pyx_v_verts)[3], float const __pyx_v_u, float const __pyx_v_v, float *__pyx_v_S) {
3853   int __pyx_v_i;
3854   int __pyx_t_1;
3855 
3856   /* "yt/utilities/lib/primitives.pyx":412
3857  *     cdef int i
3858  *     # Computes for canonical triangle coordinates
3859  *     for i in range(3):             # <<<<<<<<<<<<<<
3860  *         S[i] = (1.0 - 3.0*u + 2.0*u*u - 3.0*v + 2.0*v*v + 4.0*u*v)*verts[0][i] + \
3861  *              (-u + 2.0*u*u)*verts[1][i] + \
3862  */
3863   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
3864     __pyx_v_i = __pyx_t_1;
3865 
3866     /* "yt/utilities/lib/primitives.pyx":413
3867  *     # Computes for canonical triangle coordinates
3868  *     for i in range(3):
3869  *         S[i] = (1.0 - 3.0*u + 2.0*u*u - 3.0*v + 2.0*v*v + 4.0*u*v)*verts[0][i] + \             # <<<<<<<<<<<<<<
3870  *              (-u + 2.0*u*u)*verts[1][i] + \
3871  *              (-v + 2.0*v*v)*verts[2][i] + \
3872  */
3873     (__pyx_v_S[__pyx_v_i]) = (((((((((((1.0 - (3.0 * __pyx_v_u)) + ((2.0 * __pyx_v_u) * __pyx_v_u)) - (3.0 * __pyx_v_v)) + ((2.0 * __pyx_v_v) * __pyx_v_v)) + ((4.0 * __pyx_v_u) * __pyx_v_v)) * ((__pyx_v_verts[0])[__pyx_v_i])) + (((-__pyx_v_u) + ((2.0 * __pyx_v_u) * __pyx_v_u)) * ((__pyx_v_verts[1])[__pyx_v_i]))) + (((-__pyx_v_v) + ((2.0 * __pyx_v_v) * __pyx_v_v)) * ((__pyx_v_verts[2])[__pyx_v_i]))) + ((((4.0 * __pyx_v_u) - ((4.0 * __pyx_v_u) * __pyx_v_u)) - ((4.0 * __pyx_v_u) * __pyx_v_v)) * ((__pyx_v_verts[3])[__pyx_v_i]))) + (((4.0 * __pyx_v_u) * __pyx_v_v) * ((__pyx_v_verts[4])[__pyx_v_i]))) + ((((4.0 * __pyx_v_v) - ((4.0 * __pyx_v_v) * __pyx_v_v)) - ((4.0 * __pyx_v_u) * __pyx_v_v)) * ((__pyx_v_verts[5])[__pyx_v_i])));
3874   }
3875 
3876   /* "yt/utilities/lib/primitives.pyx":405
3877  * @cython.wraparound(False)
3878  * @cython.cdivision(True)
3879  * cdef void tet_patchSurfaceFunc(const cython.floating[6][3] verts,             # <<<<<<<<<<<<<<
3880  *                            const cython.floating u,
3881  *                            const cython.floating v,
3882  */
3883 
3884   /* function exit code */
3885 }
3886 
__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceFunc(double (* __pyx_v_verts)[3],double const __pyx_v_u,double const __pyx_v_v,double * __pyx_v_S)3887 static void __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceFunc(double (*__pyx_v_verts)[3], double const __pyx_v_u, double const __pyx_v_v, double *__pyx_v_S) {
3888   int __pyx_v_i;
3889   int __pyx_t_1;
3890 
3891   /* "yt/utilities/lib/primitives.pyx":412
3892  *     cdef int i
3893  *     # Computes for canonical triangle coordinates
3894  *     for i in range(3):             # <<<<<<<<<<<<<<
3895  *         S[i] = (1.0 - 3.0*u + 2.0*u*u - 3.0*v + 2.0*v*v + 4.0*u*v)*verts[0][i] + \
3896  *              (-u + 2.0*u*u)*verts[1][i] + \
3897  */
3898   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
3899     __pyx_v_i = __pyx_t_1;
3900 
3901     /* "yt/utilities/lib/primitives.pyx":413
3902  *     # Computes for canonical triangle coordinates
3903  *     for i in range(3):
3904  *         S[i] = (1.0 - 3.0*u + 2.0*u*u - 3.0*v + 2.0*v*v + 4.0*u*v)*verts[0][i] + \             # <<<<<<<<<<<<<<
3905  *              (-u + 2.0*u*u)*verts[1][i] + \
3906  *              (-v + 2.0*v*v)*verts[2][i] + \
3907  */
3908     (__pyx_v_S[__pyx_v_i]) = (((((((((((1.0 - (3.0 * __pyx_v_u)) + ((2.0 * __pyx_v_u) * __pyx_v_u)) - (3.0 * __pyx_v_v)) + ((2.0 * __pyx_v_v) * __pyx_v_v)) + ((4.0 * __pyx_v_u) * __pyx_v_v)) * ((__pyx_v_verts[0])[__pyx_v_i])) + (((-__pyx_v_u) + ((2.0 * __pyx_v_u) * __pyx_v_u)) * ((__pyx_v_verts[1])[__pyx_v_i]))) + (((-__pyx_v_v) + ((2.0 * __pyx_v_v) * __pyx_v_v)) * ((__pyx_v_verts[2])[__pyx_v_i]))) + ((((4.0 * __pyx_v_u) - ((4.0 * __pyx_v_u) * __pyx_v_u)) - ((4.0 * __pyx_v_u) * __pyx_v_v)) * ((__pyx_v_verts[3])[__pyx_v_i]))) + (((4.0 * __pyx_v_u) * __pyx_v_v) * ((__pyx_v_verts[4])[__pyx_v_i]))) + ((((4.0 * __pyx_v_v) - ((4.0 * __pyx_v_v) * __pyx_v_v)) - ((4.0 * __pyx_v_u) * __pyx_v_v)) * ((__pyx_v_verts[5])[__pyx_v_i])));
3909   }
3910 
3911   /* "yt/utilities/lib/primitives.pyx":405
3912  * @cython.wraparound(False)
3913  * @cython.cdivision(True)
3914  * cdef void tet_patchSurfaceFunc(const cython.floating[6][3] verts,             # <<<<<<<<<<<<<<
3915  *                            const cython.floating u,
3916  *                            const cython.floating v,
3917  */
3918 
3919   /* function exit code */
3920 }
3921 
3922 /* "yt/utilities/lib/primitives.pyx":423
3923  * @cython.wraparound(False)
3924  * @cython.cdivision(True)
3925  * cdef void tet_patchSurfaceDerivU(const cython.floating[6][3] verts,             # <<<<<<<<<<<<<<
3926  *                              const cython.floating u,
3927  *                              const cython.floating v,
3928  */
3929 
__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceDerivU(float (* __pyx_v_verts)[3],float const __pyx_v_u,float const __pyx_v_v,float * __pyx_v_Su)3930 static void __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceDerivU(float (*__pyx_v_verts)[3], float const __pyx_v_u, float const __pyx_v_v, float *__pyx_v_Su) {
3931   int __pyx_v_i;
3932   int __pyx_t_1;
3933 
3934   /* "yt/utilities/lib/primitives.pyx":429
3935  *     cdef int i
3936  *     # Computes for canonical triangle coordinates
3937  *     for i in range(3):             # <<<<<<<<<<<<<<
3938  *         Su[i] = (-3.0 + 4.0*u + 4.0*v)*verts[0][i] + \
3939  *              (-1.0 + 4.0*u)*verts[1][i] + \
3940  */
3941   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
3942     __pyx_v_i = __pyx_t_1;
3943 
3944     /* "yt/utilities/lib/primitives.pyx":430
3945  *     # Computes for canonical triangle coordinates
3946  *     for i in range(3):
3947  *         Su[i] = (-3.0 + 4.0*u + 4.0*v)*verts[0][i] + \             # <<<<<<<<<<<<<<
3948  *              (-1.0 + 4.0*u)*verts[1][i] + \
3949  *              (4.0 - 8.0*u - 4.0*v)*verts[3][i] + \
3950  */
3951     (__pyx_v_Su[__pyx_v_i]) = (((((((-3.0 + (4.0 * __pyx_v_u)) + (4.0 * __pyx_v_v)) * ((__pyx_v_verts[0])[__pyx_v_i])) + ((-1.0 + (4.0 * __pyx_v_u)) * ((__pyx_v_verts[1])[__pyx_v_i]))) + (((4.0 - (8.0 * __pyx_v_u)) - (4.0 * __pyx_v_v)) * ((__pyx_v_verts[3])[__pyx_v_i]))) + ((4.0 * __pyx_v_v) * ((__pyx_v_verts[4])[__pyx_v_i]))) + ((-4.0 * __pyx_v_v) * ((__pyx_v_verts[5])[__pyx_v_i])));
3952   }
3953 
3954   /* "yt/utilities/lib/primitives.pyx":423
3955  * @cython.wraparound(False)
3956  * @cython.cdivision(True)
3957  * cdef void tet_patchSurfaceDerivU(const cython.floating[6][3] verts,             # <<<<<<<<<<<<<<
3958  *                              const cython.floating u,
3959  *                              const cython.floating v,
3960  */
3961 
3962   /* function exit code */
3963 }
3964 
__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceDerivU(double (* __pyx_v_verts)[3],double const __pyx_v_u,double const __pyx_v_v,double * __pyx_v_Su)3965 static void __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceDerivU(double (*__pyx_v_verts)[3], double const __pyx_v_u, double const __pyx_v_v, double *__pyx_v_Su) {
3966   int __pyx_v_i;
3967   int __pyx_t_1;
3968 
3969   /* "yt/utilities/lib/primitives.pyx":429
3970  *     cdef int i
3971  *     # Computes for canonical triangle coordinates
3972  *     for i in range(3):             # <<<<<<<<<<<<<<
3973  *         Su[i] = (-3.0 + 4.0*u + 4.0*v)*verts[0][i] + \
3974  *              (-1.0 + 4.0*u)*verts[1][i] + \
3975  */
3976   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
3977     __pyx_v_i = __pyx_t_1;
3978 
3979     /* "yt/utilities/lib/primitives.pyx":430
3980  *     # Computes for canonical triangle coordinates
3981  *     for i in range(3):
3982  *         Su[i] = (-3.0 + 4.0*u + 4.0*v)*verts[0][i] + \             # <<<<<<<<<<<<<<
3983  *              (-1.0 + 4.0*u)*verts[1][i] + \
3984  *              (4.0 - 8.0*u - 4.0*v)*verts[3][i] + \
3985  */
3986     (__pyx_v_Su[__pyx_v_i]) = (((((((-3.0 + (4.0 * __pyx_v_u)) + (4.0 * __pyx_v_v)) * ((__pyx_v_verts[0])[__pyx_v_i])) + ((-1.0 + (4.0 * __pyx_v_u)) * ((__pyx_v_verts[1])[__pyx_v_i]))) + (((4.0 - (8.0 * __pyx_v_u)) - (4.0 * __pyx_v_v)) * ((__pyx_v_verts[3])[__pyx_v_i]))) + ((4.0 * __pyx_v_v) * ((__pyx_v_verts[4])[__pyx_v_i]))) + ((-4.0 * __pyx_v_v) * ((__pyx_v_verts[5])[__pyx_v_i])));
3987   }
3988 
3989   /* "yt/utilities/lib/primitives.pyx":423
3990  * @cython.wraparound(False)
3991  * @cython.cdivision(True)
3992  * cdef void tet_patchSurfaceDerivU(const cython.floating[6][3] verts,             # <<<<<<<<<<<<<<
3993  *                              const cython.floating u,
3994  *                              const cython.floating v,
3995  */
3996 
3997   /* function exit code */
3998 }
3999 
4000 /* "yt/utilities/lib/primitives.pyx":440
4001  * @cython.wraparound(False)
4002  * @cython.cdivision(True)
4003  * cdef void tet_patchSurfaceDerivV(const cython.floating[6][3] verts,             # <<<<<<<<<<<<<<
4004  *                              const cython.floating u,
4005  *                              const cython.floating v,
4006  */
4007 
__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceDerivV(float (* __pyx_v_verts)[3],float const __pyx_v_u,float const __pyx_v_v,float * __pyx_v_Sv)4008 static void __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceDerivV(float (*__pyx_v_verts)[3], float const __pyx_v_u, float const __pyx_v_v, float *__pyx_v_Sv) {
4009   int __pyx_v_i;
4010   int __pyx_t_1;
4011 
4012   /* "yt/utilities/lib/primitives.pyx":447
4013  *     cdef int i
4014  *     # Computes for canonical triangle coordinates
4015  *     for i in range(3):             # <<<<<<<<<<<<<<
4016  *         Sv[i] = (-3.0 + 4.0*v + 4.0*u)*verts[0][i] + \
4017  *              (-1.0 + 4.0*v)*verts[2][i] + \
4018  */
4019   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
4020     __pyx_v_i = __pyx_t_1;
4021 
4022     /* "yt/utilities/lib/primitives.pyx":448
4023  *     # Computes for canonical triangle coordinates
4024  *     for i in range(3):
4025  *         Sv[i] = (-3.0 + 4.0*v + 4.0*u)*verts[0][i] + \             # <<<<<<<<<<<<<<
4026  *              (-1.0 + 4.0*v)*verts[2][i] + \
4027  *              (-4.0*u)*verts[3][i] + \
4028  */
4029     (__pyx_v_Sv[__pyx_v_i]) = (((((((-3.0 + (4.0 * __pyx_v_v)) + (4.0 * __pyx_v_u)) * ((__pyx_v_verts[0])[__pyx_v_i])) + ((-1.0 + (4.0 * __pyx_v_v)) * ((__pyx_v_verts[2])[__pyx_v_i]))) + ((-4.0 * __pyx_v_u) * ((__pyx_v_verts[3])[__pyx_v_i]))) + ((4.0 * __pyx_v_u) * ((__pyx_v_verts[4])[__pyx_v_i]))) + (((4.0 - (8.0 * __pyx_v_v)) - (4.0 * __pyx_v_u)) * ((__pyx_v_verts[5])[__pyx_v_i])));
4030   }
4031 
4032   /* "yt/utilities/lib/primitives.pyx":440
4033  * @cython.wraparound(False)
4034  * @cython.cdivision(True)
4035  * cdef void tet_patchSurfaceDerivV(const cython.floating[6][3] verts,             # <<<<<<<<<<<<<<
4036  *                              const cython.floating u,
4037  *                              const cython.floating v,
4038  */
4039 
4040   /* function exit code */
4041 }
4042 
__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceDerivV(double (* __pyx_v_verts)[3],double const __pyx_v_u,double const __pyx_v_v,double * __pyx_v_Sv)4043 static void __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceDerivV(double (*__pyx_v_verts)[3], double const __pyx_v_u, double const __pyx_v_v, double *__pyx_v_Sv) {
4044   int __pyx_v_i;
4045   int __pyx_t_1;
4046 
4047   /* "yt/utilities/lib/primitives.pyx":447
4048  *     cdef int i
4049  *     # Computes for canonical triangle coordinates
4050  *     for i in range(3):             # <<<<<<<<<<<<<<
4051  *         Sv[i] = (-3.0 + 4.0*v + 4.0*u)*verts[0][i] + \
4052  *              (-1.0 + 4.0*v)*verts[2][i] + \
4053  */
4054   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
4055     __pyx_v_i = __pyx_t_1;
4056 
4057     /* "yt/utilities/lib/primitives.pyx":448
4058  *     # Computes for canonical triangle coordinates
4059  *     for i in range(3):
4060  *         Sv[i] = (-3.0 + 4.0*v + 4.0*u)*verts[0][i] + \             # <<<<<<<<<<<<<<
4061  *              (-1.0 + 4.0*v)*verts[2][i] + \
4062  *              (-4.0*u)*verts[3][i] + \
4063  */
4064     (__pyx_v_Sv[__pyx_v_i]) = (((((((-3.0 + (4.0 * __pyx_v_v)) + (4.0 * __pyx_v_u)) * ((__pyx_v_verts[0])[__pyx_v_i])) + ((-1.0 + (4.0 * __pyx_v_v)) * ((__pyx_v_verts[2])[__pyx_v_i]))) + ((-4.0 * __pyx_v_u) * ((__pyx_v_verts[3])[__pyx_v_i]))) + ((4.0 * __pyx_v_u) * ((__pyx_v_verts[4])[__pyx_v_i]))) + (((4.0 - (8.0 * __pyx_v_v)) - (4.0 * __pyx_v_u)) * ((__pyx_v_verts[5])[__pyx_v_i])));
4065   }
4066 
4067   /* "yt/utilities/lib/primitives.pyx":440
4068  * @cython.wraparound(False)
4069  * @cython.cdivision(True)
4070  * cdef void tet_patchSurfaceDerivV(const cython.floating[6][3] verts,             # <<<<<<<<<<<<<<
4071  *                              const cython.floating u,
4072  *                              const cython.floating v,
4073  */
4074 
4075   /* function exit code */
4076 }
4077 
4078 /* "yt/utilities/lib/primitives.pyx":458
4079  * @cython.wraparound(False)
4080  * @cython.cdivision(True)
4081  * cdef RayHitData compute_tet_patch_hit(cython.floating[6][3] verts,             # <<<<<<<<<<<<<<
4082  *                                   cython.floating[3] ray_origin,
4083  *                                   cython.floating[3] ray_direction) nogil:
4084  */
4085 
__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_compute_tet_patch_hit(float (* __pyx_v_verts)[3],float * __pyx_v_ray_origin,float * __pyx_v_ray_direction)4086 static struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_compute_tet_patch_hit(float (*__pyx_v_verts)[3], float *__pyx_v_ray_origin, float *__pyx_v_ray_direction) {
4087   float __pyx_v_n[3];
4088   float __pyx_v_N1[3];
4089   float __pyx_v_N2[3];
4090   float __pyx_v_A;
4091   long __pyx_v_i;
4092   float __pyx_v_d1;
4093   float __pyx_v_d2;
4094   float __pyx_v_u;
4095   float __pyx_v_v;
4096   float __pyx_v_S[3];
4097   float __pyx_v_fu;
4098   float __pyx_v_fv;
4099   float __pyx_v_err;
4100   float __pyx_v_tol;
4101   int __pyx_v_iterations;
4102   int __pyx_v_max_iter;
4103   float __pyx_v_Su[3];
4104   float __pyx_v_Sv[3];
4105   float __pyx_v_J11;
4106   float __pyx_v_J12;
4107   float __pyx_v_J21;
4108   float __pyx_v_J22;
4109   float __pyx_v_det;
4110   float __pyx_v_t;
4111   struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData __pyx_v_hd;
4112   struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData __pyx_r;
4113   long __pyx_t_1;
4114   int __pyx_t_2;
4115   int __pyx_t_3;
4116 
4117   /* "yt/utilities/lib/primitives.pyx":464
4118  *     # first we compute the two planes that define the ray.
4119  *     cdef cython.floating[3] n, N1, N2
4120  *     cdef cython.floating A = dot(ray_direction, ray_direction)             # <<<<<<<<<<<<<<
4121  *     for i in range(3):
4122  *         n[i] = ray_direction[i] / A
4123  */
4124   __pyx_v_A = __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_ray_direction, __pyx_v_ray_direction);
4125 
4126   /* "yt/utilities/lib/primitives.pyx":465
4127  *     cdef cython.floating[3] n, N1, N2
4128  *     cdef cython.floating A = dot(ray_direction, ray_direction)
4129  *     for i in range(3):             # <<<<<<<<<<<<<<
4130  *         n[i] = ray_direction[i] / A
4131  *
4132  */
4133   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
4134     __pyx_v_i = __pyx_t_1;
4135 
4136     /* "yt/utilities/lib/primitives.pyx":466
4137  *     cdef cython.floating A = dot(ray_direction, ray_direction)
4138  *     for i in range(3):
4139  *         n[i] = ray_direction[i] / A             # <<<<<<<<<<<<<<
4140  *
4141  *     if ((fabs(n[0]) > fabs(n[1])) and (fabs(n[0]) > fabs(n[2]))):
4142  */
4143     (__pyx_v_n[__pyx_v_i]) = ((__pyx_v_ray_direction[__pyx_v_i]) / __pyx_v_A);
4144   }
4145 
4146   /* "yt/utilities/lib/primitives.pyx":468
4147  *         n[i] = ray_direction[i] / A
4148  *
4149  *     if ((fabs(n[0]) > fabs(n[1])) and (fabs(n[0]) > fabs(n[2]))):             # <<<<<<<<<<<<<<
4150  *         N1[0] = n[1]
4151  *         N1[1] =-n[0]
4152  */
4153   __pyx_t_3 = ((fabs((__pyx_v_n[0])) > fabs((__pyx_v_n[1]))) != 0);
4154   if (__pyx_t_3) {
4155   } else {
4156     __pyx_t_2 = __pyx_t_3;
4157     goto __pyx_L6_bool_binop_done;
4158   }
4159   __pyx_t_3 = ((fabs((__pyx_v_n[0])) > fabs((__pyx_v_n[2]))) != 0);
4160   __pyx_t_2 = __pyx_t_3;
4161   __pyx_L6_bool_binop_done:;
4162   if (__pyx_t_2) {
4163 
4164     /* "yt/utilities/lib/primitives.pyx":469
4165  *
4166  *     if ((fabs(n[0]) > fabs(n[1])) and (fabs(n[0]) > fabs(n[2]))):
4167  *         N1[0] = n[1]             # <<<<<<<<<<<<<<
4168  *         N1[1] =-n[0]
4169  *         N1[2] = 0.0
4170  */
4171     (__pyx_v_N1[0]) = (__pyx_v_n[1]);
4172 
4173     /* "yt/utilities/lib/primitives.pyx":470
4174  *     if ((fabs(n[0]) > fabs(n[1])) and (fabs(n[0]) > fabs(n[2]))):
4175  *         N1[0] = n[1]
4176  *         N1[1] =-n[0]             # <<<<<<<<<<<<<<
4177  *         N1[2] = 0.0
4178  *     else:
4179  */
4180     (__pyx_v_N1[1]) = (-(__pyx_v_n[0]));
4181 
4182     /* "yt/utilities/lib/primitives.pyx":471
4183  *         N1[0] = n[1]
4184  *         N1[1] =-n[0]
4185  *         N1[2] = 0.0             # <<<<<<<<<<<<<<
4186  *     else:
4187  *         N1[0] = 0.0
4188  */
4189     (__pyx_v_N1[2]) = 0.0;
4190 
4191     /* "yt/utilities/lib/primitives.pyx":468
4192  *         n[i] = ray_direction[i] / A
4193  *
4194  *     if ((fabs(n[0]) > fabs(n[1])) and (fabs(n[0]) > fabs(n[2]))):             # <<<<<<<<<<<<<<
4195  *         N1[0] = n[1]
4196  *         N1[1] =-n[0]
4197  */
4198     goto __pyx_L5;
4199   }
4200 
4201   /* "yt/utilities/lib/primitives.pyx":473
4202  *         N1[2] = 0.0
4203  *     else:
4204  *         N1[0] = 0.0             # <<<<<<<<<<<<<<
4205  *         N1[1] = n[2]
4206  *         N1[2] =-n[1]
4207  */
4208   /*else*/ {
4209     (__pyx_v_N1[0]) = 0.0;
4210 
4211     /* "yt/utilities/lib/primitives.pyx":474
4212  *     else:
4213  *         N1[0] = 0.0
4214  *         N1[1] = n[2]             # <<<<<<<<<<<<<<
4215  *         N1[2] =-n[1]
4216  *     cross(N1, n, N2)
4217  */
4218     (__pyx_v_N1[1]) = (__pyx_v_n[2]);
4219 
4220     /* "yt/utilities/lib/primitives.pyx":475
4221  *         N1[0] = 0.0
4222  *         N1[1] = n[2]
4223  *         N1[2] =-n[1]             # <<<<<<<<<<<<<<
4224  *     cross(N1, n, N2)
4225  *
4226  */
4227     (__pyx_v_N1[2]) = (-(__pyx_v_n[1]));
4228   }
4229   __pyx_L5:;
4230 
4231   /* "yt/utilities/lib/primitives.pyx":476
4232  *         N1[1] = n[2]
4233  *         N1[2] =-n[1]
4234  *     cross(N1, n, N2)             # <<<<<<<<<<<<<<
4235  *
4236  *     cdef cython.floating d1 = -dot(N1, ray_origin)
4237  */
4238   __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_cross(__pyx_v_N1, __pyx_v_n, __pyx_v_N2);
4239 
4240   /* "yt/utilities/lib/primitives.pyx":478
4241  *     cross(N1, n, N2)
4242  *
4243  *     cdef cython.floating d1 = -dot(N1, ray_origin)             # <<<<<<<<<<<<<<
4244  *     cdef cython.floating d2 = -dot(N2, ray_origin)
4245  *
4246  */
4247   __pyx_v_d1 = (-__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N1, __pyx_v_ray_origin));
4248 
4249   /* "yt/utilities/lib/primitives.pyx":479
4250  *
4251  *     cdef cython.floating d1 = -dot(N1, ray_origin)
4252  *     cdef cython.floating d2 = -dot(N2, ray_origin)             # <<<<<<<<<<<<<<
4253  *
4254  *     # the initial guess is set to zero
4255  */
4256   __pyx_v_d2 = (-__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N2, __pyx_v_ray_origin));
4257 
4258   /* "yt/utilities/lib/primitives.pyx":482
4259  *
4260  *     # the initial guess is set to zero
4261  *     cdef cython.floating u = 0.0             # <<<<<<<<<<<<<<
4262  *     cdef cython.floating v = 0.0
4263  *     cdef cython.floating[3] S
4264  */
4265   __pyx_v_u = 0.0;
4266 
4267   /* "yt/utilities/lib/primitives.pyx":483
4268  *     # the initial guess is set to zero
4269  *     cdef cython.floating u = 0.0
4270  *     cdef cython.floating v = 0.0             # <<<<<<<<<<<<<<
4271  *     cdef cython.floating[3] S
4272  *     tet_patchSurfaceFunc(verts, u, v, S)
4273  */
4274   __pyx_v_v = 0.0;
4275 
4276   /* "yt/utilities/lib/primitives.pyx":485
4277  *     cdef cython.floating v = 0.0
4278  *     cdef cython.floating[3] S
4279  *     tet_patchSurfaceFunc(verts, u, v, S)             # <<<<<<<<<<<<<<
4280  *     cdef cython.floating fu = dot(N1, S) + d1
4281  *     cdef cython.floating fv = dot(N2, S) + d2
4282  */
4283   __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceFunc(__pyx_v_verts, __pyx_v_u, __pyx_v_v, __pyx_v_S);
4284 
4285   /* "yt/utilities/lib/primitives.pyx":486
4286  *     cdef cython.floating[3] S
4287  *     tet_patchSurfaceFunc(verts, u, v, S)
4288  *     cdef cython.floating fu = dot(N1, S) + d1             # <<<<<<<<<<<<<<
4289  *     cdef cython.floating fv = dot(N2, S) + d2
4290  *     cdef cython.floating err = fmax(fabs(fu), fabs(fv))
4291  */
4292   __pyx_v_fu = (__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N1, __pyx_v_S) + __pyx_v_d1);
4293 
4294   /* "yt/utilities/lib/primitives.pyx":487
4295  *     tet_patchSurfaceFunc(verts, u, v, S)
4296  *     cdef cython.floating fu = dot(N1, S) + d1
4297  *     cdef cython.floating fv = dot(N2, S) + d2             # <<<<<<<<<<<<<<
4298  *     cdef cython.floating err = fmax(fabs(fu), fabs(fv))
4299  *
4300  */
4301   __pyx_v_fv = (__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N2, __pyx_v_S) + __pyx_v_d2);
4302 
4303   /* "yt/utilities/lib/primitives.pyx":488
4304  *     cdef cython.floating fu = dot(N1, S) + d1
4305  *     cdef cython.floating fv = dot(N2, S) + d2
4306  *     cdef cython.floating err = fmax(fabs(fu), fabs(fv))             # <<<<<<<<<<<<<<
4307  *
4308  *     # begin Newton iteration
4309  */
4310   __pyx_v_err = fmax(fabs(__pyx_v_fu), fabs(__pyx_v_fv));
4311 
4312   /* "yt/utilities/lib/primitives.pyx":491
4313  *
4314  *     # begin Newton iteration
4315  *     cdef cython.floating tol = 1.0e-5             # <<<<<<<<<<<<<<
4316  *     cdef int iterations = 0
4317  *     cdef int max_iter = 10
4318  */
4319   __pyx_v_tol = 1.0e-5;
4320 
4321   /* "yt/utilities/lib/primitives.pyx":492
4322  *     # begin Newton iteration
4323  *     cdef cython.floating tol = 1.0e-5
4324  *     cdef int iterations = 0             # <<<<<<<<<<<<<<
4325  *     cdef int max_iter = 10
4326  *     cdef cython.floating[3] Su
4327  */
4328   __pyx_v_iterations = 0;
4329 
4330   /* "yt/utilities/lib/primitives.pyx":493
4331  *     cdef cython.floating tol = 1.0e-5
4332  *     cdef int iterations = 0
4333  *     cdef int max_iter = 10             # <<<<<<<<<<<<<<
4334  *     cdef cython.floating[3] Su
4335  *     cdef cython.floating[3] Sv
4336  */
4337   __pyx_v_max_iter = 10;
4338 
4339   /* "yt/utilities/lib/primitives.pyx":497
4340  *     cdef cython.floating[3] Sv
4341  *     cdef cython.floating J11, J12, J21, J22, det
4342  *     while ((err > tol) and (iterations < max_iter)):             # <<<<<<<<<<<<<<
4343  *         # compute the Jacobian
4344  *         tet_patchSurfaceDerivU(verts, u, v, Su)
4345  */
4346   while (1) {
4347     __pyx_t_3 = ((__pyx_v_err > __pyx_v_tol) != 0);
4348     if (__pyx_t_3) {
4349     } else {
4350       __pyx_t_2 = __pyx_t_3;
4351       goto __pyx_L10_bool_binop_done;
4352     }
4353     __pyx_t_3 = ((__pyx_v_iterations < __pyx_v_max_iter) != 0);
4354     __pyx_t_2 = __pyx_t_3;
4355     __pyx_L10_bool_binop_done:;
4356     if (!__pyx_t_2) break;
4357 
4358     /* "yt/utilities/lib/primitives.pyx":499
4359  *     while ((err > tol) and (iterations < max_iter)):
4360  *         # compute the Jacobian
4361  *         tet_patchSurfaceDerivU(verts, u, v, Su)             # <<<<<<<<<<<<<<
4362  *         tet_patchSurfaceDerivV(verts, u, v, Sv)
4363  *         J11 = dot(N1, Su)
4364  */
4365     __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceDerivU(__pyx_v_verts, __pyx_v_u, __pyx_v_v, __pyx_v_Su);
4366 
4367     /* "yt/utilities/lib/primitives.pyx":500
4368  *         # compute the Jacobian
4369  *         tet_patchSurfaceDerivU(verts, u, v, Su)
4370  *         tet_patchSurfaceDerivV(verts, u, v, Sv)             # <<<<<<<<<<<<<<
4371  *         J11 = dot(N1, Su)
4372  *         J12 = dot(N1, Sv)
4373  */
4374     __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceDerivV(__pyx_v_verts, __pyx_v_u, __pyx_v_v, __pyx_v_Sv);
4375 
4376     /* "yt/utilities/lib/primitives.pyx":501
4377  *         tet_patchSurfaceDerivU(verts, u, v, Su)
4378  *         tet_patchSurfaceDerivV(verts, u, v, Sv)
4379  *         J11 = dot(N1, Su)             # <<<<<<<<<<<<<<
4380  *         J12 = dot(N1, Sv)
4381  *         J21 = dot(N2, Su)
4382  */
4383     __pyx_v_J11 = __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N1, __pyx_v_Su);
4384 
4385     /* "yt/utilities/lib/primitives.pyx":502
4386  *         tet_patchSurfaceDerivV(verts, u, v, Sv)
4387  *         J11 = dot(N1, Su)
4388  *         J12 = dot(N1, Sv)             # <<<<<<<<<<<<<<
4389  *         J21 = dot(N2, Su)
4390  *         J22 = dot(N2, Sv)
4391  */
4392     __pyx_v_J12 = __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N1, __pyx_v_Sv);
4393 
4394     /* "yt/utilities/lib/primitives.pyx":503
4395  *         J11 = dot(N1, Su)
4396  *         J12 = dot(N1, Sv)
4397  *         J21 = dot(N2, Su)             # <<<<<<<<<<<<<<
4398  *         J22 = dot(N2, Sv)
4399  *         det = (J11*J22 - J12*J21)
4400  */
4401     __pyx_v_J21 = __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N2, __pyx_v_Su);
4402 
4403     /* "yt/utilities/lib/primitives.pyx":504
4404  *         J12 = dot(N1, Sv)
4405  *         J21 = dot(N2, Su)
4406  *         J22 = dot(N2, Sv)             # <<<<<<<<<<<<<<
4407  *         det = (J11*J22 - J12*J21)
4408  *
4409  */
4410     __pyx_v_J22 = __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N2, __pyx_v_Sv);
4411 
4412     /* "yt/utilities/lib/primitives.pyx":505
4413  *         J21 = dot(N2, Su)
4414  *         J22 = dot(N2, Sv)
4415  *         det = (J11*J22 - J12*J21)             # <<<<<<<<<<<<<<
4416  *
4417  *         # update the u, v values
4418  */
4419     __pyx_v_det = ((__pyx_v_J11 * __pyx_v_J22) - (__pyx_v_J12 * __pyx_v_J21));
4420 
4421     /* "yt/utilities/lib/primitives.pyx":508
4422  *
4423  *         # update the u, v values
4424  *         u -= ( J22*fu - J12*fv) / det             # <<<<<<<<<<<<<<
4425  *         v -= (-J21*fu + J11*fv) / det
4426  *
4427  */
4428     __pyx_v_u = (__pyx_v_u - (((__pyx_v_J22 * __pyx_v_fu) - (__pyx_v_J12 * __pyx_v_fv)) / __pyx_v_det));
4429 
4430     /* "yt/utilities/lib/primitives.pyx":509
4431  *         # update the u, v values
4432  *         u -= ( J22*fu - J12*fv) / det
4433  *         v -= (-J21*fu + J11*fv) / det             # <<<<<<<<<<<<<<
4434  *
4435  *         tet_patchSurfaceFunc(verts, u, v, S)
4436  */
4437     __pyx_v_v = (__pyx_v_v - ((((-__pyx_v_J21) * __pyx_v_fu) + (__pyx_v_J11 * __pyx_v_fv)) / __pyx_v_det));
4438 
4439     /* "yt/utilities/lib/primitives.pyx":511
4440  *         v -= (-J21*fu + J11*fv) / det
4441  *
4442  *         tet_patchSurfaceFunc(verts, u, v, S)             # <<<<<<<<<<<<<<
4443  *         fu = dot(N1, S) + d1
4444  *         fv = dot(N2, S) + d2
4445  */
4446     __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceFunc(__pyx_v_verts, __pyx_v_u, __pyx_v_v, __pyx_v_S);
4447 
4448     /* "yt/utilities/lib/primitives.pyx":512
4449  *
4450  *         tet_patchSurfaceFunc(verts, u, v, S)
4451  *         fu = dot(N1, S) + d1             # <<<<<<<<<<<<<<
4452  *         fv = dot(N2, S) + d2
4453  *
4454  */
4455     __pyx_v_fu = (__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N1, __pyx_v_S) + __pyx_v_d1);
4456 
4457     /* "yt/utilities/lib/primitives.pyx":513
4458  *         tet_patchSurfaceFunc(verts, u, v, S)
4459  *         fu = dot(N1, S) + d1
4460  *         fv = dot(N2, S) + d2             # <<<<<<<<<<<<<<
4461  *
4462  *         err = fmax(fabs(fu), fabs(fv))
4463  */
4464     __pyx_v_fv = (__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N2, __pyx_v_S) + __pyx_v_d2);
4465 
4466     /* "yt/utilities/lib/primitives.pyx":515
4467  *         fv = dot(N2, S) + d2
4468  *
4469  *         err = fmax(fabs(fu), fabs(fv))             # <<<<<<<<<<<<<<
4470  *         iterations += 1
4471  *
4472  */
4473     __pyx_v_err = fmax(fabs(__pyx_v_fu), fabs(__pyx_v_fv));
4474 
4475     /* "yt/utilities/lib/primitives.pyx":516
4476  *
4477  *         err = fmax(fabs(fu), fabs(fv))
4478  *         iterations += 1             # <<<<<<<<<<<<<<
4479  *
4480  *     # t is the distance along the ray to this hit
4481  */
4482     __pyx_v_iterations = (__pyx_v_iterations + 1);
4483   }
4484 
4485   /* "yt/utilities/lib/primitives.pyx":519
4486  *
4487  *     # t is the distance along the ray to this hit
4488  *     cdef cython.floating t = distance(S, ray_origin) / L2_norm(ray_direction)             # <<<<<<<<<<<<<<
4489  *
4490  *     # return hit data
4491  */
4492   __pyx_v_t = (__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_distance(__pyx_v_S, __pyx_v_ray_origin) / __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_L2_norm(__pyx_v_ray_direction));
4493 
4494   /* "yt/utilities/lib/primitives.pyx":523
4495  *     # return hit data
4496  *     cdef RayHitData hd
4497  *     hd.u = u             # <<<<<<<<<<<<<<
4498  *     hd.v = v
4499  *     hd.t = t
4500  */
4501   __pyx_v_hd.u = __pyx_v_u;
4502 
4503   /* "yt/utilities/lib/primitives.pyx":524
4504  *     cdef RayHitData hd
4505  *     hd.u = u
4506  *     hd.v = v             # <<<<<<<<<<<<<<
4507  *     hd.t = t
4508  *     hd.converged = (iterations < max_iter)
4509  */
4510   __pyx_v_hd.v = __pyx_v_v;
4511 
4512   /* "yt/utilities/lib/primitives.pyx":525
4513  *     hd.u = u
4514  *     hd.v = v
4515  *     hd.t = t             # <<<<<<<<<<<<<<
4516  *     hd.converged = (iterations < max_iter)
4517  *     return hd
4518  */
4519   __pyx_v_hd.t = __pyx_v_t;
4520 
4521   /* "yt/utilities/lib/primitives.pyx":526
4522  *     hd.v = v
4523  *     hd.t = t
4524  *     hd.converged = (iterations < max_iter)             # <<<<<<<<<<<<<<
4525  *     return hd
4526  *
4527  */
4528   __pyx_v_hd.converged = (__pyx_v_iterations < __pyx_v_max_iter);
4529 
4530   /* "yt/utilities/lib/primitives.pyx":527
4531  *     hd.t = t
4532  *     hd.converged = (iterations < max_iter)
4533  *     return hd             # <<<<<<<<<<<<<<
4534  *
4535  *
4536  */
4537   __pyx_r = __pyx_v_hd;
4538   goto __pyx_L0;
4539 
4540   /* "yt/utilities/lib/primitives.pyx":458
4541  * @cython.wraparound(False)
4542  * @cython.cdivision(True)
4543  * cdef RayHitData compute_tet_patch_hit(cython.floating[6][3] verts,             # <<<<<<<<<<<<<<
4544  *                                   cython.floating[3] ray_origin,
4545  *                                   cython.floating[3] ray_direction) nogil:
4546  */
4547 
4548   /* function exit code */
4549   __pyx_L0:;
4550   return __pyx_r;
4551 }
4552 
__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_compute_tet_patch_hit(double (* __pyx_v_verts)[3],double * __pyx_v_ray_origin,double * __pyx_v_ray_direction)4553 static struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_compute_tet_patch_hit(double (*__pyx_v_verts)[3], double *__pyx_v_ray_origin, double *__pyx_v_ray_direction) {
4554   double __pyx_v_n[3];
4555   double __pyx_v_N1[3];
4556   double __pyx_v_N2[3];
4557   double __pyx_v_A;
4558   long __pyx_v_i;
4559   double __pyx_v_d1;
4560   double __pyx_v_d2;
4561   double __pyx_v_u;
4562   double __pyx_v_v;
4563   double __pyx_v_S[3];
4564   double __pyx_v_fu;
4565   double __pyx_v_fv;
4566   double __pyx_v_err;
4567   double __pyx_v_tol;
4568   int __pyx_v_iterations;
4569   int __pyx_v_max_iter;
4570   double __pyx_v_Su[3];
4571   double __pyx_v_Sv[3];
4572   double __pyx_v_J11;
4573   double __pyx_v_J12;
4574   double __pyx_v_J21;
4575   double __pyx_v_J22;
4576   double __pyx_v_det;
4577   double __pyx_v_t;
4578   struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData __pyx_v_hd;
4579   struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData __pyx_r;
4580   long __pyx_t_1;
4581   int __pyx_t_2;
4582   int __pyx_t_3;
4583 
4584   /* "yt/utilities/lib/primitives.pyx":464
4585  *     # first we compute the two planes that define the ray.
4586  *     cdef cython.floating[3] n, N1, N2
4587  *     cdef cython.floating A = dot(ray_direction, ray_direction)             # <<<<<<<<<<<<<<
4588  *     for i in range(3):
4589  *         n[i] = ray_direction[i] / A
4590  */
4591   __pyx_v_A = __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_ray_direction, __pyx_v_ray_direction);
4592 
4593   /* "yt/utilities/lib/primitives.pyx":465
4594  *     cdef cython.floating[3] n, N1, N2
4595  *     cdef cython.floating A = dot(ray_direction, ray_direction)
4596  *     for i in range(3):             # <<<<<<<<<<<<<<
4597  *         n[i] = ray_direction[i] / A
4598  *
4599  */
4600   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
4601     __pyx_v_i = __pyx_t_1;
4602 
4603     /* "yt/utilities/lib/primitives.pyx":466
4604  *     cdef cython.floating A = dot(ray_direction, ray_direction)
4605  *     for i in range(3):
4606  *         n[i] = ray_direction[i] / A             # <<<<<<<<<<<<<<
4607  *
4608  *     if ((fabs(n[0]) > fabs(n[1])) and (fabs(n[0]) > fabs(n[2]))):
4609  */
4610     (__pyx_v_n[__pyx_v_i]) = ((__pyx_v_ray_direction[__pyx_v_i]) / __pyx_v_A);
4611   }
4612 
4613   /* "yt/utilities/lib/primitives.pyx":468
4614  *         n[i] = ray_direction[i] / A
4615  *
4616  *     if ((fabs(n[0]) > fabs(n[1])) and (fabs(n[0]) > fabs(n[2]))):             # <<<<<<<<<<<<<<
4617  *         N1[0] = n[1]
4618  *         N1[1] =-n[0]
4619  */
4620   __pyx_t_3 = ((fabs((__pyx_v_n[0])) > fabs((__pyx_v_n[1]))) != 0);
4621   if (__pyx_t_3) {
4622   } else {
4623     __pyx_t_2 = __pyx_t_3;
4624     goto __pyx_L6_bool_binop_done;
4625   }
4626   __pyx_t_3 = ((fabs((__pyx_v_n[0])) > fabs((__pyx_v_n[2]))) != 0);
4627   __pyx_t_2 = __pyx_t_3;
4628   __pyx_L6_bool_binop_done:;
4629   if (__pyx_t_2) {
4630 
4631     /* "yt/utilities/lib/primitives.pyx":469
4632  *
4633  *     if ((fabs(n[0]) > fabs(n[1])) and (fabs(n[0]) > fabs(n[2]))):
4634  *         N1[0] = n[1]             # <<<<<<<<<<<<<<
4635  *         N1[1] =-n[0]
4636  *         N1[2] = 0.0
4637  */
4638     (__pyx_v_N1[0]) = (__pyx_v_n[1]);
4639 
4640     /* "yt/utilities/lib/primitives.pyx":470
4641  *     if ((fabs(n[0]) > fabs(n[1])) and (fabs(n[0]) > fabs(n[2]))):
4642  *         N1[0] = n[1]
4643  *         N1[1] =-n[0]             # <<<<<<<<<<<<<<
4644  *         N1[2] = 0.0
4645  *     else:
4646  */
4647     (__pyx_v_N1[1]) = (-(__pyx_v_n[0]));
4648 
4649     /* "yt/utilities/lib/primitives.pyx":471
4650  *         N1[0] = n[1]
4651  *         N1[1] =-n[0]
4652  *         N1[2] = 0.0             # <<<<<<<<<<<<<<
4653  *     else:
4654  *         N1[0] = 0.0
4655  */
4656     (__pyx_v_N1[2]) = 0.0;
4657 
4658     /* "yt/utilities/lib/primitives.pyx":468
4659  *         n[i] = ray_direction[i] / A
4660  *
4661  *     if ((fabs(n[0]) > fabs(n[1])) and (fabs(n[0]) > fabs(n[2]))):             # <<<<<<<<<<<<<<
4662  *         N1[0] = n[1]
4663  *         N1[1] =-n[0]
4664  */
4665     goto __pyx_L5;
4666   }
4667 
4668   /* "yt/utilities/lib/primitives.pyx":473
4669  *         N1[2] = 0.0
4670  *     else:
4671  *         N1[0] = 0.0             # <<<<<<<<<<<<<<
4672  *         N1[1] = n[2]
4673  *         N1[2] =-n[1]
4674  */
4675   /*else*/ {
4676     (__pyx_v_N1[0]) = 0.0;
4677 
4678     /* "yt/utilities/lib/primitives.pyx":474
4679  *     else:
4680  *         N1[0] = 0.0
4681  *         N1[1] = n[2]             # <<<<<<<<<<<<<<
4682  *         N1[2] =-n[1]
4683  *     cross(N1, n, N2)
4684  */
4685     (__pyx_v_N1[1]) = (__pyx_v_n[2]);
4686 
4687     /* "yt/utilities/lib/primitives.pyx":475
4688  *         N1[0] = 0.0
4689  *         N1[1] = n[2]
4690  *         N1[2] =-n[1]             # <<<<<<<<<<<<<<
4691  *     cross(N1, n, N2)
4692  *
4693  */
4694     (__pyx_v_N1[2]) = (-(__pyx_v_n[1]));
4695   }
4696   __pyx_L5:;
4697 
4698   /* "yt/utilities/lib/primitives.pyx":476
4699  *         N1[1] = n[2]
4700  *         N1[2] =-n[1]
4701  *     cross(N1, n, N2)             # <<<<<<<<<<<<<<
4702  *
4703  *     cdef cython.floating d1 = -dot(N1, ray_origin)
4704  */
4705   __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_cross(__pyx_v_N1, __pyx_v_n, __pyx_v_N2);
4706 
4707   /* "yt/utilities/lib/primitives.pyx":478
4708  *     cross(N1, n, N2)
4709  *
4710  *     cdef cython.floating d1 = -dot(N1, ray_origin)             # <<<<<<<<<<<<<<
4711  *     cdef cython.floating d2 = -dot(N2, ray_origin)
4712  *
4713  */
4714   __pyx_v_d1 = (-__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N1, __pyx_v_ray_origin));
4715 
4716   /* "yt/utilities/lib/primitives.pyx":479
4717  *
4718  *     cdef cython.floating d1 = -dot(N1, ray_origin)
4719  *     cdef cython.floating d2 = -dot(N2, ray_origin)             # <<<<<<<<<<<<<<
4720  *
4721  *     # the initial guess is set to zero
4722  */
4723   __pyx_v_d2 = (-__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N2, __pyx_v_ray_origin));
4724 
4725   /* "yt/utilities/lib/primitives.pyx":482
4726  *
4727  *     # the initial guess is set to zero
4728  *     cdef cython.floating u = 0.0             # <<<<<<<<<<<<<<
4729  *     cdef cython.floating v = 0.0
4730  *     cdef cython.floating[3] S
4731  */
4732   __pyx_v_u = 0.0;
4733 
4734   /* "yt/utilities/lib/primitives.pyx":483
4735  *     # the initial guess is set to zero
4736  *     cdef cython.floating u = 0.0
4737  *     cdef cython.floating v = 0.0             # <<<<<<<<<<<<<<
4738  *     cdef cython.floating[3] S
4739  *     tet_patchSurfaceFunc(verts, u, v, S)
4740  */
4741   __pyx_v_v = 0.0;
4742 
4743   /* "yt/utilities/lib/primitives.pyx":485
4744  *     cdef cython.floating v = 0.0
4745  *     cdef cython.floating[3] S
4746  *     tet_patchSurfaceFunc(verts, u, v, S)             # <<<<<<<<<<<<<<
4747  *     cdef cython.floating fu = dot(N1, S) + d1
4748  *     cdef cython.floating fv = dot(N2, S) + d2
4749  */
4750   __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceFunc(__pyx_v_verts, __pyx_v_u, __pyx_v_v, __pyx_v_S);
4751 
4752   /* "yt/utilities/lib/primitives.pyx":486
4753  *     cdef cython.floating[3] S
4754  *     tet_patchSurfaceFunc(verts, u, v, S)
4755  *     cdef cython.floating fu = dot(N1, S) + d1             # <<<<<<<<<<<<<<
4756  *     cdef cython.floating fv = dot(N2, S) + d2
4757  *     cdef cython.floating err = fmax(fabs(fu), fabs(fv))
4758  */
4759   __pyx_v_fu = (__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N1, __pyx_v_S) + __pyx_v_d1);
4760 
4761   /* "yt/utilities/lib/primitives.pyx":487
4762  *     tet_patchSurfaceFunc(verts, u, v, S)
4763  *     cdef cython.floating fu = dot(N1, S) + d1
4764  *     cdef cython.floating fv = dot(N2, S) + d2             # <<<<<<<<<<<<<<
4765  *     cdef cython.floating err = fmax(fabs(fu), fabs(fv))
4766  *
4767  */
4768   __pyx_v_fv = (__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N2, __pyx_v_S) + __pyx_v_d2);
4769 
4770   /* "yt/utilities/lib/primitives.pyx":488
4771  *     cdef cython.floating fu = dot(N1, S) + d1
4772  *     cdef cython.floating fv = dot(N2, S) + d2
4773  *     cdef cython.floating err = fmax(fabs(fu), fabs(fv))             # <<<<<<<<<<<<<<
4774  *
4775  *     # begin Newton iteration
4776  */
4777   __pyx_v_err = fmax(fabs(__pyx_v_fu), fabs(__pyx_v_fv));
4778 
4779   /* "yt/utilities/lib/primitives.pyx":491
4780  *
4781  *     # begin Newton iteration
4782  *     cdef cython.floating tol = 1.0e-5             # <<<<<<<<<<<<<<
4783  *     cdef int iterations = 0
4784  *     cdef int max_iter = 10
4785  */
4786   __pyx_v_tol = 1.0e-5;
4787 
4788   /* "yt/utilities/lib/primitives.pyx":492
4789  *     # begin Newton iteration
4790  *     cdef cython.floating tol = 1.0e-5
4791  *     cdef int iterations = 0             # <<<<<<<<<<<<<<
4792  *     cdef int max_iter = 10
4793  *     cdef cython.floating[3] Su
4794  */
4795   __pyx_v_iterations = 0;
4796 
4797   /* "yt/utilities/lib/primitives.pyx":493
4798  *     cdef cython.floating tol = 1.0e-5
4799  *     cdef int iterations = 0
4800  *     cdef int max_iter = 10             # <<<<<<<<<<<<<<
4801  *     cdef cython.floating[3] Su
4802  *     cdef cython.floating[3] Sv
4803  */
4804   __pyx_v_max_iter = 10;
4805 
4806   /* "yt/utilities/lib/primitives.pyx":497
4807  *     cdef cython.floating[3] Sv
4808  *     cdef cython.floating J11, J12, J21, J22, det
4809  *     while ((err > tol) and (iterations < max_iter)):             # <<<<<<<<<<<<<<
4810  *         # compute the Jacobian
4811  *         tet_patchSurfaceDerivU(verts, u, v, Su)
4812  */
4813   while (1) {
4814     __pyx_t_3 = ((__pyx_v_err > __pyx_v_tol) != 0);
4815     if (__pyx_t_3) {
4816     } else {
4817       __pyx_t_2 = __pyx_t_3;
4818       goto __pyx_L10_bool_binop_done;
4819     }
4820     __pyx_t_3 = ((__pyx_v_iterations < __pyx_v_max_iter) != 0);
4821     __pyx_t_2 = __pyx_t_3;
4822     __pyx_L10_bool_binop_done:;
4823     if (!__pyx_t_2) break;
4824 
4825     /* "yt/utilities/lib/primitives.pyx":499
4826  *     while ((err > tol) and (iterations < max_iter)):
4827  *         # compute the Jacobian
4828  *         tet_patchSurfaceDerivU(verts, u, v, Su)             # <<<<<<<<<<<<<<
4829  *         tet_patchSurfaceDerivV(verts, u, v, Sv)
4830  *         J11 = dot(N1, Su)
4831  */
4832     __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceDerivU(__pyx_v_verts, __pyx_v_u, __pyx_v_v, __pyx_v_Su);
4833 
4834     /* "yt/utilities/lib/primitives.pyx":500
4835  *         # compute the Jacobian
4836  *         tet_patchSurfaceDerivU(verts, u, v, Su)
4837  *         tet_patchSurfaceDerivV(verts, u, v, Sv)             # <<<<<<<<<<<<<<
4838  *         J11 = dot(N1, Su)
4839  *         J12 = dot(N1, Sv)
4840  */
4841     __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceDerivV(__pyx_v_verts, __pyx_v_u, __pyx_v_v, __pyx_v_Sv);
4842 
4843     /* "yt/utilities/lib/primitives.pyx":501
4844  *         tet_patchSurfaceDerivU(verts, u, v, Su)
4845  *         tet_patchSurfaceDerivV(verts, u, v, Sv)
4846  *         J11 = dot(N1, Su)             # <<<<<<<<<<<<<<
4847  *         J12 = dot(N1, Sv)
4848  *         J21 = dot(N2, Su)
4849  */
4850     __pyx_v_J11 = __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N1, __pyx_v_Su);
4851 
4852     /* "yt/utilities/lib/primitives.pyx":502
4853  *         tet_patchSurfaceDerivV(verts, u, v, Sv)
4854  *         J11 = dot(N1, Su)
4855  *         J12 = dot(N1, Sv)             # <<<<<<<<<<<<<<
4856  *         J21 = dot(N2, Su)
4857  *         J22 = dot(N2, Sv)
4858  */
4859     __pyx_v_J12 = __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N1, __pyx_v_Sv);
4860 
4861     /* "yt/utilities/lib/primitives.pyx":503
4862  *         J11 = dot(N1, Su)
4863  *         J12 = dot(N1, Sv)
4864  *         J21 = dot(N2, Su)             # <<<<<<<<<<<<<<
4865  *         J22 = dot(N2, Sv)
4866  *         det = (J11*J22 - J12*J21)
4867  */
4868     __pyx_v_J21 = __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N2, __pyx_v_Su);
4869 
4870     /* "yt/utilities/lib/primitives.pyx":504
4871  *         J12 = dot(N1, Sv)
4872  *         J21 = dot(N2, Su)
4873  *         J22 = dot(N2, Sv)             # <<<<<<<<<<<<<<
4874  *         det = (J11*J22 - J12*J21)
4875  *
4876  */
4877     __pyx_v_J22 = __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N2, __pyx_v_Sv);
4878 
4879     /* "yt/utilities/lib/primitives.pyx":505
4880  *         J21 = dot(N2, Su)
4881  *         J22 = dot(N2, Sv)
4882  *         det = (J11*J22 - J12*J21)             # <<<<<<<<<<<<<<
4883  *
4884  *         # update the u, v values
4885  */
4886     __pyx_v_det = ((__pyx_v_J11 * __pyx_v_J22) - (__pyx_v_J12 * __pyx_v_J21));
4887 
4888     /* "yt/utilities/lib/primitives.pyx":508
4889  *
4890  *         # update the u, v values
4891  *         u -= ( J22*fu - J12*fv) / det             # <<<<<<<<<<<<<<
4892  *         v -= (-J21*fu + J11*fv) / det
4893  *
4894  */
4895     __pyx_v_u = (__pyx_v_u - (((__pyx_v_J22 * __pyx_v_fu) - (__pyx_v_J12 * __pyx_v_fv)) / __pyx_v_det));
4896 
4897     /* "yt/utilities/lib/primitives.pyx":509
4898  *         # update the u, v values
4899  *         u -= ( J22*fu - J12*fv) / det
4900  *         v -= (-J21*fu + J11*fv) / det             # <<<<<<<<<<<<<<
4901  *
4902  *         tet_patchSurfaceFunc(verts, u, v, S)
4903  */
4904     __pyx_v_v = (__pyx_v_v - ((((-__pyx_v_J21) * __pyx_v_fu) + (__pyx_v_J11 * __pyx_v_fv)) / __pyx_v_det));
4905 
4906     /* "yt/utilities/lib/primitives.pyx":511
4907  *         v -= (-J21*fu + J11*fv) / det
4908  *
4909  *         tet_patchSurfaceFunc(verts, u, v, S)             # <<<<<<<<<<<<<<
4910  *         fu = dot(N1, S) + d1
4911  *         fv = dot(N2, S) + d2
4912  */
4913     __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceFunc(__pyx_v_verts, __pyx_v_u, __pyx_v_v, __pyx_v_S);
4914 
4915     /* "yt/utilities/lib/primitives.pyx":512
4916  *
4917  *         tet_patchSurfaceFunc(verts, u, v, S)
4918  *         fu = dot(N1, S) + d1             # <<<<<<<<<<<<<<
4919  *         fv = dot(N2, S) + d2
4920  *
4921  */
4922     __pyx_v_fu = (__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N1, __pyx_v_S) + __pyx_v_d1);
4923 
4924     /* "yt/utilities/lib/primitives.pyx":513
4925  *         tet_patchSurfaceFunc(verts, u, v, S)
4926  *         fu = dot(N1, S) + d1
4927  *         fv = dot(N2, S) + d2             # <<<<<<<<<<<<<<
4928  *
4929  *         err = fmax(fabs(fu), fabs(fv))
4930  */
4931     __pyx_v_fv = (__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(__pyx_v_N2, __pyx_v_S) + __pyx_v_d2);
4932 
4933     /* "yt/utilities/lib/primitives.pyx":515
4934  *         fv = dot(N2, S) + d2
4935  *
4936  *         err = fmax(fabs(fu), fabs(fv))             # <<<<<<<<<<<<<<
4937  *         iterations += 1
4938  *
4939  */
4940     __pyx_v_err = fmax(fabs(__pyx_v_fu), fabs(__pyx_v_fv));
4941 
4942     /* "yt/utilities/lib/primitives.pyx":516
4943  *
4944  *         err = fmax(fabs(fu), fabs(fv))
4945  *         iterations += 1             # <<<<<<<<<<<<<<
4946  *
4947  *     # t is the distance along the ray to this hit
4948  */
4949     __pyx_v_iterations = (__pyx_v_iterations + 1);
4950   }
4951 
4952   /* "yt/utilities/lib/primitives.pyx":519
4953  *
4954  *     # t is the distance along the ray to this hit
4955  *     cdef cython.floating t = distance(S, ray_origin) / L2_norm(ray_direction)             # <<<<<<<<<<<<<<
4956  *
4957  *     # return hit data
4958  */
4959   __pyx_v_t = (__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_distance(__pyx_v_S, __pyx_v_ray_origin) / __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_L2_norm(__pyx_v_ray_direction));
4960 
4961   /* "yt/utilities/lib/primitives.pyx":523
4962  *     # return hit data
4963  *     cdef RayHitData hd
4964  *     hd.u = u             # <<<<<<<<<<<<<<
4965  *     hd.v = v
4966  *     hd.t = t
4967  */
4968   __pyx_v_hd.u = __pyx_v_u;
4969 
4970   /* "yt/utilities/lib/primitives.pyx":524
4971  *     cdef RayHitData hd
4972  *     hd.u = u
4973  *     hd.v = v             # <<<<<<<<<<<<<<
4974  *     hd.t = t
4975  *     hd.converged = (iterations < max_iter)
4976  */
4977   __pyx_v_hd.v = __pyx_v_v;
4978 
4979   /* "yt/utilities/lib/primitives.pyx":525
4980  *     hd.u = u
4981  *     hd.v = v
4982  *     hd.t = t             # <<<<<<<<<<<<<<
4983  *     hd.converged = (iterations < max_iter)
4984  *     return hd
4985  */
4986   __pyx_v_hd.t = __pyx_v_t;
4987 
4988   /* "yt/utilities/lib/primitives.pyx":526
4989  *     hd.v = v
4990  *     hd.t = t
4991  *     hd.converged = (iterations < max_iter)             # <<<<<<<<<<<<<<
4992  *     return hd
4993  *
4994  */
4995   __pyx_v_hd.converged = (__pyx_v_iterations < __pyx_v_max_iter);
4996 
4997   /* "yt/utilities/lib/primitives.pyx":527
4998  *     hd.t = t
4999  *     hd.converged = (iterations < max_iter)
5000  *     return hd             # <<<<<<<<<<<<<<
5001  *
5002  *
5003  */
5004   __pyx_r = __pyx_v_hd;
5005   goto __pyx_L0;
5006 
5007   /* "yt/utilities/lib/primitives.pyx":458
5008  * @cython.wraparound(False)
5009  * @cython.cdivision(True)
5010  * cdef RayHitData compute_tet_patch_hit(cython.floating[6][3] verts,             # <<<<<<<<<<<<<<
5011  *                                   cython.floating[3] ray_origin,
5012  *                                   cython.floating[3] ray_direction) nogil:
5013  */
5014 
5015   /* function exit code */
5016   __pyx_L0:;
5017   return __pyx_r;
5018 }
5019 
5020 /* "yt/utilities/lib/primitives.pyx":533
5021  * @cython.wraparound(False)
5022  * @cython.cdivision(True)
5023  * cdef np.int64_t ray_tet_patch_intersect(const void* primitives,             # <<<<<<<<<<<<<<
5024  *                                     const np.int64_t item,
5025  *                                     Ray* ray) nogil:
5026  */
5027 
__pyx_f_2yt_9utilities_3lib_10primitives_ray_tet_patch_intersect(void const * __pyx_v_primitives,__pyx_t_5numpy_int64_t const __pyx_v_item,struct __pyx_t_2yt_9utilities_3lib_10primitives_Ray * __pyx_v_ray)5028 static __pyx_t_5numpy_int64_t __pyx_f_2yt_9utilities_3lib_10primitives_ray_tet_patch_intersect(void const *__pyx_v_primitives, __pyx_t_5numpy_int64_t const __pyx_v_item, struct __pyx_t_2yt_9utilities_3lib_10primitives_Ray *__pyx_v_ray) {
5029   struct __pyx_t_2yt_9utilities_3lib_10primitives_TetPatch __pyx_v_tet_patch;
5030   struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData __pyx_v_hd;
5031   __pyx_t_5numpy_int64_t __pyx_r;
5032   int __pyx_t_1;
5033   int __pyx_t_2;
5034   __pyx_t_5numpy_float64_t __pyx_t_3;
5035   __pyx_t_5numpy_int64_t __pyx_t_4;
5036 
5037   /* "yt/utilities/lib/primitives.pyx":537
5038  *                                     Ray* ray) nogil:
5039  *
5040  *     cdef TetPatch tet_patch = (<TetPatch*> primitives)[item]             # <<<<<<<<<<<<<<
5041  *
5042  *     cdef RayHitData hd = compute_tet_patch_hit(tet_patch.v, ray.origin, ray.direction)
5043  */
5044   __pyx_v_tet_patch = (((struct __pyx_t_2yt_9utilities_3lib_10primitives_TetPatch *)__pyx_v_primitives)[__pyx_v_item]);
5045 
5046   /* "yt/utilities/lib/primitives.pyx":539
5047  *     cdef TetPatch tet_patch = (<TetPatch*> primitives)[item]
5048  *
5049  *     cdef RayHitData hd = compute_tet_patch_hit(tet_patch.v, ray.origin, ray.direction)             # <<<<<<<<<<<<<<
5050  *
5051  *     # only count this is it's the closest hit
5052  */
5053   __pyx_v_hd = __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_compute_tet_patch_hit(__pyx_v_tet_patch.v, __pyx_v_ray->origin, __pyx_v_ray->direction);
5054 
5055   /* "yt/utilities/lib/primitives.pyx":542
5056  *
5057  *     # only count this is it's the closest hit
5058  *     if (hd.t < ray.t_near or hd.t > ray.t_far):             # <<<<<<<<<<<<<<
5059  *         return False
5060  *
5061  */
5062   __pyx_t_2 = ((__pyx_v_hd.t < __pyx_v_ray->t_near) != 0);
5063   if (!__pyx_t_2) {
5064   } else {
5065     __pyx_t_1 = __pyx_t_2;
5066     goto __pyx_L4_bool_binop_done;
5067   }
5068   __pyx_t_2 = ((__pyx_v_hd.t > __pyx_v_ray->t_far) != 0);
5069   __pyx_t_1 = __pyx_t_2;
5070   __pyx_L4_bool_binop_done:;
5071   if (__pyx_t_1) {
5072 
5073     /* "yt/utilities/lib/primitives.pyx":543
5074  *     # only count this is it's the closest hit
5075  *     if (hd.t < ray.t_near or hd.t > ray.t_far):
5076  *         return False             # <<<<<<<<<<<<<<
5077  *
5078  *     if (0 <= hd.u and 0 <= hd.v and hd.u + hd.v <= 1.0 and hd.converged):
5079  */
5080     __pyx_r = 0;
5081     goto __pyx_L0;
5082 
5083     /* "yt/utilities/lib/primitives.pyx":542
5084  *
5085  *     # only count this is it's the closest hit
5086  *     if (hd.t < ray.t_near or hd.t > ray.t_far):             # <<<<<<<<<<<<<<
5087  *         return False
5088  *
5089  */
5090   }
5091 
5092   /* "yt/utilities/lib/primitives.pyx":545
5093  *         return False
5094  *
5095  *     if (0 <= hd.u and 0 <= hd.v and hd.u + hd.v <= 1.0 and hd.converged):             # <<<<<<<<<<<<<<
5096  *         # we have a hit, so update ray information
5097  *         ray.t_far = hd.t
5098  */
5099   __pyx_t_2 = ((0.0 <= __pyx_v_hd.u) != 0);
5100   if (__pyx_t_2) {
5101   } else {
5102     __pyx_t_1 = __pyx_t_2;
5103     goto __pyx_L7_bool_binop_done;
5104   }
5105   __pyx_t_2 = ((0.0 <= __pyx_v_hd.v) != 0);
5106   if (__pyx_t_2) {
5107   } else {
5108     __pyx_t_1 = __pyx_t_2;
5109     goto __pyx_L7_bool_binop_done;
5110   }
5111   __pyx_t_2 = (((__pyx_v_hd.u + __pyx_v_hd.v) <= 1.0) != 0);
5112   if (__pyx_t_2) {
5113   } else {
5114     __pyx_t_1 = __pyx_t_2;
5115     goto __pyx_L7_bool_binop_done;
5116   }
5117   __pyx_t_2 = (__pyx_v_hd.converged != 0);
5118   __pyx_t_1 = __pyx_t_2;
5119   __pyx_L7_bool_binop_done:;
5120   if (__pyx_t_1) {
5121 
5122     /* "yt/utilities/lib/primitives.pyx":547
5123  *     if (0 <= hd.u and 0 <= hd.v and hd.u + hd.v <= 1.0 and hd.converged):
5124  *         # we have a hit, so update ray information
5125  *         ray.t_far = hd.t             # <<<<<<<<<<<<<<
5126  *         ray.elem_id = tet_patch.elem_id
5127  *         return True
5128  */
5129     __pyx_t_3 = __pyx_v_hd.t;
5130     __pyx_v_ray->t_far = __pyx_t_3;
5131 
5132     /* "yt/utilities/lib/primitives.pyx":548
5133  *         # we have a hit, so update ray information
5134  *         ray.t_far = hd.t
5135  *         ray.elem_id = tet_patch.elem_id             # <<<<<<<<<<<<<<
5136  *         return True
5137  *
5138  */
5139     __pyx_t_4 = __pyx_v_tet_patch.elem_id;
5140     __pyx_v_ray->elem_id = __pyx_t_4;
5141 
5142     /* "yt/utilities/lib/primitives.pyx":549
5143  *         ray.t_far = hd.t
5144  *         ray.elem_id = tet_patch.elem_id
5145  *         return True             # <<<<<<<<<<<<<<
5146  *
5147  *     return False
5148  */
5149     __pyx_r = 1;
5150     goto __pyx_L0;
5151 
5152     /* "yt/utilities/lib/primitives.pyx":545
5153  *         return False
5154  *
5155  *     if (0 <= hd.u and 0 <= hd.v and hd.u + hd.v <= 1.0 and hd.converged):             # <<<<<<<<<<<<<<
5156  *         # we have a hit, so update ray information
5157  *         ray.t_far = hd.t
5158  */
5159   }
5160 
5161   /* "yt/utilities/lib/primitives.pyx":551
5162  *         return True
5163  *
5164  *     return False             # <<<<<<<<<<<<<<
5165  *
5166  *
5167  */
5168   __pyx_r = 0;
5169   goto __pyx_L0;
5170 
5171   /* "yt/utilities/lib/primitives.pyx":533
5172  * @cython.wraparound(False)
5173  * @cython.cdivision(True)
5174  * cdef np.int64_t ray_tet_patch_intersect(const void* primitives,             # <<<<<<<<<<<<<<
5175  *                                     const np.int64_t item,
5176  *                                     Ray* ray) nogil:
5177  */
5178 
5179   /* function exit code */
5180   __pyx_L0:;
5181   return __pyx_r;
5182 }
5183 
5184 /* "yt/utilities/lib/primitives.pyx":557
5185  * @cython.wraparound(False)
5186  * @cython.cdivision(True)
5187  * cdef void tet_patch_centroid(const void *primitives,             # <<<<<<<<<<<<<<
5188  *                          const np.int64_t item,
5189  *                          np.float64_t[3] centroid) nogil:
5190  */
5191 
__pyx_f_2yt_9utilities_3lib_10primitives_tet_patch_centroid(void const * __pyx_v_primitives,__pyx_t_5numpy_int64_t const __pyx_v_item,__pyx_t_5numpy_float64_t * __pyx_v_centroid)5192 static void __pyx_f_2yt_9utilities_3lib_10primitives_tet_patch_centroid(void const *__pyx_v_primitives, __pyx_t_5numpy_int64_t const __pyx_v_item, __pyx_t_5numpy_float64_t *__pyx_v_centroid) {
5193   __pyx_t_5numpy_int64_t __pyx_v_i;
5194   __pyx_t_5numpy_int64_t __pyx_v_j;
5195   struct __pyx_t_2yt_9utilities_3lib_10primitives_TetPatch __pyx_v_tet_patch;
5196   __pyx_t_5numpy_int64_t __pyx_t_1;
5197   __pyx_t_5numpy_int64_t __pyx_t_2;
5198   __pyx_t_5numpy_int64_t __pyx_t_3;
5199 
5200   /* "yt/utilities/lib/primitives.pyx":562
5201  *
5202  *     cdef np.int64_t i, j
5203  *     cdef TetPatch tet_patch = (<TetPatch*> primitives)[item]             # <<<<<<<<<<<<<<
5204  *
5205  *     for j in range(3):
5206  */
5207   __pyx_v_tet_patch = (((struct __pyx_t_2yt_9utilities_3lib_10primitives_TetPatch *)__pyx_v_primitives)[__pyx_v_item]);
5208 
5209   /* "yt/utilities/lib/primitives.pyx":564
5210  *     cdef TetPatch tet_patch = (<TetPatch*> primitives)[item]
5211  *
5212  *     for j in range(3):             # <<<<<<<<<<<<<<
5213  *         centroid[j] = 0.0
5214  *
5215  */
5216   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
5217     __pyx_v_j = __pyx_t_1;
5218 
5219     /* "yt/utilities/lib/primitives.pyx":565
5220  *
5221  *     for j in range(3):
5222  *         centroid[j] = 0.0             # <<<<<<<<<<<<<<
5223  *
5224  *     for i in range(6):
5225  */
5226     (__pyx_v_centroid[__pyx_v_j]) = 0.0;
5227   }
5228 
5229   /* "yt/utilities/lib/primitives.pyx":567
5230  *         centroid[j] = 0.0
5231  *
5232  *     for i in range(6):             # <<<<<<<<<<<<<<
5233  *         for j in range(3):
5234  *             centroid[j] += tet_patch.v[i][j]
5235  */
5236   for (__pyx_t_1 = 0; __pyx_t_1 < 6; __pyx_t_1+=1) {
5237     __pyx_v_i = __pyx_t_1;
5238 
5239     /* "yt/utilities/lib/primitives.pyx":568
5240  *
5241  *     for i in range(6):
5242  *         for j in range(3):             # <<<<<<<<<<<<<<
5243  *             centroid[j] += tet_patch.v[i][j]
5244  *
5245  */
5246     for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) {
5247       __pyx_v_j = __pyx_t_2;
5248 
5249       /* "yt/utilities/lib/primitives.pyx":569
5250  *     for i in range(6):
5251  *         for j in range(3):
5252  *             centroid[j] += tet_patch.v[i][j]             # <<<<<<<<<<<<<<
5253  *
5254  *     for j in range(3):
5255  */
5256       __pyx_t_3 = __pyx_v_j;
5257       (__pyx_v_centroid[__pyx_t_3]) = ((__pyx_v_centroid[__pyx_t_3]) + ((__pyx_v_tet_patch.v[__pyx_v_i])[__pyx_v_j]));
5258     }
5259   }
5260 
5261   /* "yt/utilities/lib/primitives.pyx":571
5262  *             centroid[j] += tet_patch.v[i][j]
5263  *
5264  *     for j in range(3):             # <<<<<<<<<<<<<<
5265  *         centroid[j] /= 6.0
5266  *
5267  */
5268   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
5269     __pyx_v_j = __pyx_t_1;
5270 
5271     /* "yt/utilities/lib/primitives.pyx":572
5272  *
5273  *     for j in range(3):
5274  *         centroid[j] /= 6.0             # <<<<<<<<<<<<<<
5275  *
5276  *
5277  */
5278     __pyx_t_2 = __pyx_v_j;
5279     (__pyx_v_centroid[__pyx_t_2]) = ((__pyx_v_centroid[__pyx_t_2]) / 6.0);
5280   }
5281 
5282   /* "yt/utilities/lib/primitives.pyx":557
5283  * @cython.wraparound(False)
5284  * @cython.cdivision(True)
5285  * cdef void tet_patch_centroid(const void *primitives,             # <<<<<<<<<<<<<<
5286  *                          const np.int64_t item,
5287  *                          np.float64_t[3] centroid) nogil:
5288  */
5289 
5290   /* function exit code */
5291 }
5292 
5293 /* "yt/utilities/lib/primitives.pyx":578
5294  * @cython.wraparound(False)
5295  * @cython.cdivision(True)
5296  * cdef void tet_patch_bbox(const void *primitives,             # <<<<<<<<<<<<<<
5297  *                     const np.int64_t item,
5298  *                      BBox* bbox) nogil:
5299  */
5300 
__pyx_f_2yt_9utilities_3lib_10primitives_tet_patch_bbox(void const * __pyx_v_primitives,__pyx_t_5numpy_int64_t const __pyx_v_item,struct __pyx_t_2yt_9utilities_3lib_10primitives_BBox * __pyx_v_bbox)5301 static void __pyx_f_2yt_9utilities_3lib_10primitives_tet_patch_bbox(void const *__pyx_v_primitives, __pyx_t_5numpy_int64_t const __pyx_v_item, struct __pyx_t_2yt_9utilities_3lib_10primitives_BBox *__pyx_v_bbox) {
5302   __pyx_t_5numpy_int64_t __pyx_v_i;
5303   __pyx_t_5numpy_int64_t __pyx_v_j;
5304   struct __pyx_t_2yt_9utilities_3lib_10primitives_TetPatch __pyx_v_tet_patch;
5305   __pyx_t_5numpy_int64_t __pyx_t_1;
5306   __pyx_t_5numpy_int64_t __pyx_t_2;
5307 
5308   /* "yt/utilities/lib/primitives.pyx":583
5309  *
5310  *     cdef np.int64_t i, j
5311  *     cdef TetPatch tet_patch = (<TetPatch*> primitives)[item]             # <<<<<<<<<<<<<<
5312  *
5313  *     for j in range(3):
5314  */
5315   __pyx_v_tet_patch = (((struct __pyx_t_2yt_9utilities_3lib_10primitives_TetPatch *)__pyx_v_primitives)[__pyx_v_item]);
5316 
5317   /* "yt/utilities/lib/primitives.pyx":585
5318  *     cdef TetPatch tet_patch = (<TetPatch*> primitives)[item]
5319  *
5320  *     for j in range(3):             # <<<<<<<<<<<<<<
5321  *         bbox.left_edge[j] = tet_patch.v[0][j]
5322  *         bbox.right_edge[j] = tet_patch.v[0][j]
5323  */
5324   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
5325     __pyx_v_j = __pyx_t_1;
5326 
5327     /* "yt/utilities/lib/primitives.pyx":586
5328  *
5329  *     for j in range(3):
5330  *         bbox.left_edge[j] = tet_patch.v[0][j]             # <<<<<<<<<<<<<<
5331  *         bbox.right_edge[j] = tet_patch.v[0][j]
5332  *
5333  */
5334     (__pyx_v_bbox->left_edge[__pyx_v_j]) = ((__pyx_v_tet_patch.v[0])[__pyx_v_j]);
5335 
5336     /* "yt/utilities/lib/primitives.pyx":587
5337  *     for j in range(3):
5338  *         bbox.left_edge[j] = tet_patch.v[0][j]
5339  *         bbox.right_edge[j] = tet_patch.v[0][j]             # <<<<<<<<<<<<<<
5340  *
5341  *     for i in range(1, 6):
5342  */
5343     (__pyx_v_bbox->right_edge[__pyx_v_j]) = ((__pyx_v_tet_patch.v[0])[__pyx_v_j]);
5344   }
5345 
5346   /* "yt/utilities/lib/primitives.pyx":589
5347  *         bbox.right_edge[j] = tet_patch.v[0][j]
5348  *
5349  *     for i in range(1, 6):             # <<<<<<<<<<<<<<
5350  *         for j in range(3):
5351  *             bbox.left_edge[j] = fmin(bbox.left_edge[j], tet_patch.v[i][j])
5352  */
5353   for (__pyx_t_1 = 1; __pyx_t_1 < 6; __pyx_t_1+=1) {
5354     __pyx_v_i = __pyx_t_1;
5355 
5356     /* "yt/utilities/lib/primitives.pyx":590
5357  *
5358  *     for i in range(1, 6):
5359  *         for j in range(3):             # <<<<<<<<<<<<<<
5360  *             bbox.left_edge[j] = fmin(bbox.left_edge[j], tet_patch.v[i][j])
5361  *             bbox.right_edge[j] = fmax(bbox.right_edge[j], tet_patch.v[i][j])
5362  */
5363     for (__pyx_t_2 = 0; __pyx_t_2 < 3; __pyx_t_2+=1) {
5364       __pyx_v_j = __pyx_t_2;
5365 
5366       /* "yt/utilities/lib/primitives.pyx":591
5367  *     for i in range(1, 6):
5368  *         for j in range(3):
5369  *             bbox.left_edge[j] = fmin(bbox.left_edge[j], tet_patch.v[i][j])             # <<<<<<<<<<<<<<
5370  *             bbox.right_edge[j] = fmax(bbox.right_edge[j], tet_patch.v[i][j])
5371  */
5372       (__pyx_v_bbox->left_edge[__pyx_v_j]) = fmin((__pyx_v_bbox->left_edge[__pyx_v_j]), ((__pyx_v_tet_patch.v[__pyx_v_i])[__pyx_v_j]));
5373 
5374       /* "yt/utilities/lib/primitives.pyx":592
5375  *         for j in range(3):
5376  *             bbox.left_edge[j] = fmin(bbox.left_edge[j], tet_patch.v[i][j])
5377  *             bbox.right_edge[j] = fmax(bbox.right_edge[j], tet_patch.v[i][j])             # <<<<<<<<<<<<<<
5378  */
5379       (__pyx_v_bbox->right_edge[__pyx_v_j]) = fmax((__pyx_v_bbox->right_edge[__pyx_v_j]), ((__pyx_v_tet_patch.v[__pyx_v_i])[__pyx_v_j]));
5380     }
5381   }
5382 
5383   /* "yt/utilities/lib/primitives.pyx":578
5384  * @cython.wraparound(False)
5385  * @cython.cdivision(True)
5386  * cdef void tet_patch_bbox(const void *primitives,             # <<<<<<<<<<<<<<
5387  *                     const np.int64_t item,
5388  *                      BBox* bbox) nogil:
5389  */
5390 
5391   /* function exit code */
5392 }
5393 
5394 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":258
5395  *         # experimental exception made for __getbuffer__ and __releasebuffer__
5396  *         # -- the details of this may change.
5397  *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
5398  *             # This implementation of getbuffer is geared towards Cython
5399  *             # requirements, and does not yet fulfill the PEP.
5400  */
5401 
5402 /* Python wrapper */
5403 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)5404 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
5405   int __pyx_r;
5406   __Pyx_RefNannyDeclarations
5407   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
5408   __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
5409 
5410   /* function exit code */
5411   __Pyx_RefNannyFinishContext();
5412   return __pyx_r;
5413 }
5414 
__pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)5415 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
5416   int __pyx_v_i;
5417   int __pyx_v_ndim;
5418   int __pyx_v_endian_detector;
5419   int __pyx_v_little_endian;
5420   int __pyx_v_t;
5421   char *__pyx_v_f;
5422   PyArray_Descr *__pyx_v_descr = 0;
5423   int __pyx_v_offset;
5424   int __pyx_r;
5425   __Pyx_RefNannyDeclarations
5426   int __pyx_t_1;
5427   int __pyx_t_2;
5428   PyObject *__pyx_t_3 = NULL;
5429   int __pyx_t_4;
5430   int __pyx_t_5;
5431   int __pyx_t_6;
5432   PyArray_Descr *__pyx_t_7;
5433   PyObject *__pyx_t_8 = NULL;
5434   char *__pyx_t_9;
5435   if (__pyx_v_info == NULL) {
5436     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
5437     return -1;
5438   }
5439   __Pyx_RefNannySetupContext("__getbuffer__", 0);
5440   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
5441   __Pyx_GIVEREF(__pyx_v_info->obj);
5442 
5443   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":265
5444  *
5445  *             cdef int i, ndim
5446  *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
5447  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
5448  *
5449  */
5450   __pyx_v_endian_detector = 1;
5451 
5452   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":266
5453  *             cdef int i, ndim
5454  *             cdef int endian_detector = 1
5455  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
5456  *
5457  *             ndim = PyArray_NDIM(self)
5458  */
5459   __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
5460 
5461   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":268
5462  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
5463  *
5464  *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
5465  *
5466  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
5467  */
5468   __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
5469 
5470   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
5471  *             ndim = PyArray_NDIM(self)
5472  *
5473  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
5474  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
5475  *                 raise ValueError(u"ndarray is not C contiguous")
5476  */
5477   __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
5478   if (__pyx_t_2) {
5479   } else {
5480     __pyx_t_1 = __pyx_t_2;
5481     goto __pyx_L4_bool_binop_done;
5482   }
5483 
5484   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":271
5485  *
5486  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
5487  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
5488  *                 raise ValueError(u"ndarray is not C contiguous")
5489  *
5490  */
5491   __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0);
5492   __pyx_t_1 = __pyx_t_2;
5493   __pyx_L4_bool_binop_done:;
5494 
5495   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
5496  *             ndim = PyArray_NDIM(self)
5497  *
5498  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
5499  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
5500  *                 raise ValueError(u"ndarray is not C contiguous")
5501  */
5502   if (unlikely(__pyx_t_1)) {
5503 
5504     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272
5505  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
5506  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
5507  *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
5508  *
5509  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
5510  */
5511     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 272, __pyx_L1_error)
5512     __Pyx_GOTREF(__pyx_t_3);
5513     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5514     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5515     __PYX_ERR(1, 272, __pyx_L1_error)
5516 
5517     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
5518  *             ndim = PyArray_NDIM(self)
5519  *
5520  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
5521  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
5522  *                 raise ValueError(u"ndarray is not C contiguous")
5523  */
5524   }
5525 
5526   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
5527  *                 raise ValueError(u"ndarray is not C contiguous")
5528  *
5529  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
5530  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
5531  *                 raise ValueError(u"ndarray is not Fortran contiguous")
5532  */
5533   __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
5534   if (__pyx_t_2) {
5535   } else {
5536     __pyx_t_1 = __pyx_t_2;
5537     goto __pyx_L7_bool_binop_done;
5538   }
5539 
5540   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":275
5541  *
5542  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
5543  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
5544  *                 raise ValueError(u"ndarray is not Fortran contiguous")
5545  *
5546  */
5547   __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0);
5548   __pyx_t_1 = __pyx_t_2;
5549   __pyx_L7_bool_binop_done:;
5550 
5551   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
5552  *                 raise ValueError(u"ndarray is not C contiguous")
5553  *
5554  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
5555  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
5556  *                 raise ValueError(u"ndarray is not Fortran contiguous")
5557  */
5558   if (unlikely(__pyx_t_1)) {
5559 
5560     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276
5561  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
5562  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
5563  *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
5564  *
5565  *             info.buf = PyArray_DATA(self)
5566  */
5567     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __pyx_L1_error)
5568     __Pyx_GOTREF(__pyx_t_3);
5569     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5570     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5571     __PYX_ERR(1, 276, __pyx_L1_error)
5572 
5573     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
5574  *                 raise ValueError(u"ndarray is not C contiguous")
5575  *
5576  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
5577  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
5578  *                 raise ValueError(u"ndarray is not Fortran contiguous")
5579  */
5580   }
5581 
5582   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":278
5583  *                 raise ValueError(u"ndarray is not Fortran contiguous")
5584  *
5585  *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
5586  *             info.ndim = ndim
5587  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
5588  */
5589   __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
5590 
5591   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":279
5592  *
5593  *             info.buf = PyArray_DATA(self)
5594  *             info.ndim = ndim             # <<<<<<<<<<<<<<
5595  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
5596  *                 # Allocate new buffer for strides and shape info.
5597  */
5598   __pyx_v_info->ndim = __pyx_v_ndim;
5599 
5600   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280
5601  *             info.buf = PyArray_DATA(self)
5602  *             info.ndim = ndim
5603  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
5604  *                 # Allocate new buffer for strides and shape info.
5605  *                 # This is allocated as one block, strides first.
5606  */
5607   __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
5608   if (__pyx_t_1) {
5609 
5610     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":283
5611  *                 # Allocate new buffer for strides and shape info.
5612  *                 # This is allocated as one block, strides first.
5613  *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)             # <<<<<<<<<<<<<<
5614  *                 info.shape = info.strides + ndim
5615  *                 for i in range(ndim):
5616  */
5617     __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim))));
5618 
5619     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":284
5620  *                 # This is allocated as one block, strides first.
5621  *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
5622  *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
5623  *                 for i in range(ndim):
5624  *                     info.strides[i] = PyArray_STRIDES(self)[i]
5625  */
5626     __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
5627 
5628     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":285
5629  *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
5630  *                 info.shape = info.strides + ndim
5631  *                 for i in range(ndim):             # <<<<<<<<<<<<<<
5632  *                     info.strides[i] = PyArray_STRIDES(self)[i]
5633  *                     info.shape[i] = PyArray_DIMS(self)[i]
5634  */
5635     __pyx_t_4 = __pyx_v_ndim;
5636     __pyx_t_5 = __pyx_t_4;
5637     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
5638       __pyx_v_i = __pyx_t_6;
5639 
5640       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":286
5641  *                 info.shape = info.strides + ndim
5642  *                 for i in range(ndim):
5643  *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
5644  *                     info.shape[i] = PyArray_DIMS(self)[i]
5645  *             else:
5646  */
5647       (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
5648 
5649       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":287
5650  *                 for i in range(ndim):
5651  *                     info.strides[i] = PyArray_STRIDES(self)[i]
5652  *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
5653  *             else:
5654  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
5655  */
5656       (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
5657     }
5658 
5659     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280
5660  *             info.buf = PyArray_DATA(self)
5661  *             info.ndim = ndim
5662  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
5663  *                 # Allocate new buffer for strides and shape info.
5664  *                 # This is allocated as one block, strides first.
5665  */
5666     goto __pyx_L9;
5667   }
5668 
5669   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":289
5670  *                     info.shape[i] = PyArray_DIMS(self)[i]
5671  *             else:
5672  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
5673  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
5674  *             info.suboffsets = NULL
5675  */
5676   /*else*/ {
5677     __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
5678 
5679     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":290
5680  *             else:
5681  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
5682  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)             # <<<<<<<<<<<<<<
5683  *             info.suboffsets = NULL
5684  *             info.itemsize = PyArray_ITEMSIZE(self)
5685  */
5686     __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
5687   }
5688   __pyx_L9:;
5689 
5690   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":291
5691  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
5692  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
5693  *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
5694  *             info.itemsize = PyArray_ITEMSIZE(self)
5695  *             info.readonly = not PyArray_ISWRITEABLE(self)
5696  */
5697   __pyx_v_info->suboffsets = NULL;
5698 
5699   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":292
5700  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
5701  *             info.suboffsets = NULL
5702  *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
5703  *             info.readonly = not PyArray_ISWRITEABLE(self)
5704  *
5705  */
5706   __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
5707 
5708   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":293
5709  *             info.suboffsets = NULL
5710  *             info.itemsize = PyArray_ITEMSIZE(self)
5711  *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
5712  *
5713  *             cdef int t
5714  */
5715   __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
5716 
5717   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":296
5718  *
5719  *             cdef int t
5720  *             cdef char* f = NULL             # <<<<<<<<<<<<<<
5721  *             cdef dtype descr = <dtype>PyArray_DESCR(self)
5722  *             cdef int offset
5723  */
5724   __pyx_v_f = NULL;
5725 
5726   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":297
5727  *             cdef int t
5728  *             cdef char* f = NULL
5729  *             cdef dtype descr = <dtype>PyArray_DESCR(self)             # <<<<<<<<<<<<<<
5730  *             cdef int offset
5731  *
5732  */
5733   __pyx_t_7 = PyArray_DESCR(__pyx_v_self);
5734   __pyx_t_3 = ((PyObject *)__pyx_t_7);
5735   __Pyx_INCREF(__pyx_t_3);
5736   __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
5737   __pyx_t_3 = 0;
5738 
5739   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":300
5740  *             cdef int offset
5741  *
5742  *             info.obj = self             # <<<<<<<<<<<<<<
5743  *
5744  *             if not PyDataType_HASFIELDS(descr):
5745  */
5746   __Pyx_INCREF(((PyObject *)__pyx_v_self));
5747   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
5748   __Pyx_GOTREF(__pyx_v_info->obj);
5749   __Pyx_DECREF(__pyx_v_info->obj);
5750   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
5751 
5752   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302
5753  *             info.obj = self
5754  *
5755  *             if not PyDataType_HASFIELDS(descr):             # <<<<<<<<<<<<<<
5756  *                 t = descr.type_num
5757  *                 if ((descr.byteorder == c'>' and little_endian) or
5758  */
5759   __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0);
5760   if (__pyx_t_1) {
5761 
5762     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":303
5763  *
5764  *             if not PyDataType_HASFIELDS(descr):
5765  *                 t = descr.type_num             # <<<<<<<<<<<<<<
5766  *                 if ((descr.byteorder == c'>' and little_endian) or
5767  *                     (descr.byteorder == c'<' and not little_endian)):
5768  */
5769     __pyx_t_4 = __pyx_v_descr->type_num;
5770     __pyx_v_t = __pyx_t_4;
5771 
5772     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
5773  *             if not PyDataType_HASFIELDS(descr):
5774  *                 t = descr.type_num
5775  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
5776  *                     (descr.byteorder == c'<' and not little_endian)):
5777  *                     raise ValueError(u"Non-native byte order not supported")
5778  */
5779     __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
5780     if (!__pyx_t_2) {
5781       goto __pyx_L15_next_or;
5782     } else {
5783     }
5784     __pyx_t_2 = (__pyx_v_little_endian != 0);
5785     if (!__pyx_t_2) {
5786     } else {
5787       __pyx_t_1 = __pyx_t_2;
5788       goto __pyx_L14_bool_binop_done;
5789     }
5790     __pyx_L15_next_or:;
5791 
5792     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":305
5793  *                 t = descr.type_num
5794  *                 if ((descr.byteorder == c'>' and little_endian) or
5795  *                     (descr.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
5796  *                     raise ValueError(u"Non-native byte order not supported")
5797  *                 if   t == NPY_BYTE:        f = "b"
5798  */
5799     __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
5800     if (__pyx_t_2) {
5801     } else {
5802       __pyx_t_1 = __pyx_t_2;
5803       goto __pyx_L14_bool_binop_done;
5804     }
5805     __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
5806     __pyx_t_1 = __pyx_t_2;
5807     __pyx_L14_bool_binop_done:;
5808 
5809     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
5810  *             if not PyDataType_HASFIELDS(descr):
5811  *                 t = descr.type_num
5812  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
5813  *                     (descr.byteorder == c'<' and not little_endian)):
5814  *                     raise ValueError(u"Non-native byte order not supported")
5815  */
5816     if (unlikely(__pyx_t_1)) {
5817 
5818       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":306
5819  *                 if ((descr.byteorder == c'>' and little_endian) or
5820  *                     (descr.byteorder == c'<' and not little_endian)):
5821  *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
5822  *                 if   t == NPY_BYTE:        f = "b"
5823  *                 elif t == NPY_UBYTE:       f = "B"
5824  */
5825       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 306, __pyx_L1_error)
5826       __Pyx_GOTREF(__pyx_t_3);
5827       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5828       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5829       __PYX_ERR(1, 306, __pyx_L1_error)
5830 
5831       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304
5832  *             if not PyDataType_HASFIELDS(descr):
5833  *                 t = descr.type_num
5834  *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
5835  *                     (descr.byteorder == c'<' and not little_endian)):
5836  *                     raise ValueError(u"Non-native byte order not supported")
5837  */
5838     }
5839 
5840     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":307
5841  *                     (descr.byteorder == c'<' and not little_endian)):
5842  *                     raise ValueError(u"Non-native byte order not supported")
5843  *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
5844  *                 elif t == NPY_UBYTE:       f = "B"
5845  *                 elif t == NPY_SHORT:       f = "h"
5846  */
5847     switch (__pyx_v_t) {
5848       case NPY_BYTE:
5849       __pyx_v_f = ((char *)"b");
5850       break;
5851       case NPY_UBYTE:
5852 
5853       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":308
5854  *                     raise ValueError(u"Non-native byte order not supported")
5855  *                 if   t == NPY_BYTE:        f = "b"
5856  *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
5857  *                 elif t == NPY_SHORT:       f = "h"
5858  *                 elif t == NPY_USHORT:      f = "H"
5859  */
5860       __pyx_v_f = ((char *)"B");
5861       break;
5862       case NPY_SHORT:
5863 
5864       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":309
5865  *                 if   t == NPY_BYTE:        f = "b"
5866  *                 elif t == NPY_UBYTE:       f = "B"
5867  *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
5868  *                 elif t == NPY_USHORT:      f = "H"
5869  *                 elif t == NPY_INT:         f = "i"
5870  */
5871       __pyx_v_f = ((char *)"h");
5872       break;
5873       case NPY_USHORT:
5874 
5875       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":310
5876  *                 elif t == NPY_UBYTE:       f = "B"
5877  *                 elif t == NPY_SHORT:       f = "h"
5878  *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
5879  *                 elif t == NPY_INT:         f = "i"
5880  *                 elif t == NPY_UINT:        f = "I"
5881  */
5882       __pyx_v_f = ((char *)"H");
5883       break;
5884       case NPY_INT:
5885 
5886       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":311
5887  *                 elif t == NPY_SHORT:       f = "h"
5888  *                 elif t == NPY_USHORT:      f = "H"
5889  *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
5890  *                 elif t == NPY_UINT:        f = "I"
5891  *                 elif t == NPY_LONG:        f = "l"
5892  */
5893       __pyx_v_f = ((char *)"i");
5894       break;
5895       case NPY_UINT:
5896 
5897       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":312
5898  *                 elif t == NPY_USHORT:      f = "H"
5899  *                 elif t == NPY_INT:         f = "i"
5900  *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
5901  *                 elif t == NPY_LONG:        f = "l"
5902  *                 elif t == NPY_ULONG:       f = "L"
5903  */
5904       __pyx_v_f = ((char *)"I");
5905       break;
5906       case NPY_LONG:
5907 
5908       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":313
5909  *                 elif t == NPY_INT:         f = "i"
5910  *                 elif t == NPY_UINT:        f = "I"
5911  *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
5912  *                 elif t == NPY_ULONG:       f = "L"
5913  *                 elif t == NPY_LONGLONG:    f = "q"
5914  */
5915       __pyx_v_f = ((char *)"l");
5916       break;
5917       case NPY_ULONG:
5918 
5919       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":314
5920  *                 elif t == NPY_UINT:        f = "I"
5921  *                 elif t == NPY_LONG:        f = "l"
5922  *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
5923  *                 elif t == NPY_LONGLONG:    f = "q"
5924  *                 elif t == NPY_ULONGLONG:   f = "Q"
5925  */
5926       __pyx_v_f = ((char *)"L");
5927       break;
5928       case NPY_LONGLONG:
5929 
5930       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":315
5931  *                 elif t == NPY_LONG:        f = "l"
5932  *                 elif t == NPY_ULONG:       f = "L"
5933  *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
5934  *                 elif t == NPY_ULONGLONG:   f = "Q"
5935  *                 elif t == NPY_FLOAT:       f = "f"
5936  */
5937       __pyx_v_f = ((char *)"q");
5938       break;
5939       case NPY_ULONGLONG:
5940 
5941       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":316
5942  *                 elif t == NPY_ULONG:       f = "L"
5943  *                 elif t == NPY_LONGLONG:    f = "q"
5944  *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
5945  *                 elif t == NPY_FLOAT:       f = "f"
5946  *                 elif t == NPY_DOUBLE:      f = "d"
5947  */
5948       __pyx_v_f = ((char *)"Q");
5949       break;
5950       case NPY_FLOAT:
5951 
5952       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":317
5953  *                 elif t == NPY_LONGLONG:    f = "q"
5954  *                 elif t == NPY_ULONGLONG:   f = "Q"
5955  *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
5956  *                 elif t == NPY_DOUBLE:      f = "d"
5957  *                 elif t == NPY_LONGDOUBLE:  f = "g"
5958  */
5959       __pyx_v_f = ((char *)"f");
5960       break;
5961       case NPY_DOUBLE:
5962 
5963       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":318
5964  *                 elif t == NPY_ULONGLONG:   f = "Q"
5965  *                 elif t == NPY_FLOAT:       f = "f"
5966  *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
5967  *                 elif t == NPY_LONGDOUBLE:  f = "g"
5968  *                 elif t == NPY_CFLOAT:      f = "Zf"
5969  */
5970       __pyx_v_f = ((char *)"d");
5971       break;
5972       case NPY_LONGDOUBLE:
5973 
5974       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":319
5975  *                 elif t == NPY_FLOAT:       f = "f"
5976  *                 elif t == NPY_DOUBLE:      f = "d"
5977  *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
5978  *                 elif t == NPY_CFLOAT:      f = "Zf"
5979  *                 elif t == NPY_CDOUBLE:     f = "Zd"
5980  */
5981       __pyx_v_f = ((char *)"g");
5982       break;
5983       case NPY_CFLOAT:
5984 
5985       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":320
5986  *                 elif t == NPY_DOUBLE:      f = "d"
5987  *                 elif t == NPY_LONGDOUBLE:  f = "g"
5988  *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
5989  *                 elif t == NPY_CDOUBLE:     f = "Zd"
5990  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
5991  */
5992       __pyx_v_f = ((char *)"Zf");
5993       break;
5994       case NPY_CDOUBLE:
5995 
5996       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":321
5997  *                 elif t == NPY_LONGDOUBLE:  f = "g"
5998  *                 elif t == NPY_CFLOAT:      f = "Zf"
5999  *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
6000  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
6001  *                 elif t == NPY_OBJECT:      f = "O"
6002  */
6003       __pyx_v_f = ((char *)"Zd");
6004       break;
6005       case NPY_CLONGDOUBLE:
6006 
6007       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":322
6008  *                 elif t == NPY_CFLOAT:      f = "Zf"
6009  *                 elif t == NPY_CDOUBLE:     f = "Zd"
6010  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
6011  *                 elif t == NPY_OBJECT:      f = "O"
6012  *                 else:
6013  */
6014       __pyx_v_f = ((char *)"Zg");
6015       break;
6016       case NPY_OBJECT:
6017 
6018       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":323
6019  *                 elif t == NPY_CDOUBLE:     f = "Zd"
6020  *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
6021  *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
6022  *                 else:
6023  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
6024  */
6025       __pyx_v_f = ((char *)"O");
6026       break;
6027       default:
6028 
6029       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":325
6030  *                 elif t == NPY_OBJECT:      f = "O"
6031  *                 else:
6032  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
6033  *                 info.format = f
6034  *                 return
6035  */
6036       __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error)
6037       __Pyx_GOTREF(__pyx_t_3);
6038       __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 325, __pyx_L1_error)
6039       __Pyx_GOTREF(__pyx_t_8);
6040       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6041       __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error)
6042       __Pyx_GOTREF(__pyx_t_3);
6043       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6044       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6045       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6046       __PYX_ERR(1, 325, __pyx_L1_error)
6047       break;
6048     }
6049 
6050     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":326
6051  *                 else:
6052  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
6053  *                 info.format = f             # <<<<<<<<<<<<<<
6054  *                 return
6055  *             else:
6056  */
6057     __pyx_v_info->format = __pyx_v_f;
6058 
6059     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":327
6060  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
6061  *                 info.format = f
6062  *                 return             # <<<<<<<<<<<<<<
6063  *             else:
6064  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
6065  */
6066     __pyx_r = 0;
6067     goto __pyx_L0;
6068 
6069     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302
6070  *             info.obj = self
6071  *
6072  *             if not PyDataType_HASFIELDS(descr):             # <<<<<<<<<<<<<<
6073  *                 t = descr.type_num
6074  *                 if ((descr.byteorder == c'>' and little_endian) or
6075  */
6076   }
6077 
6078   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":329
6079  *                 return
6080  *             else:
6081  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
6082  *                 info.format[0] = c'^' # Native data types, manual alignment
6083  *                 offset = 0
6084  */
6085   /*else*/ {
6086     __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF));
6087 
6088     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":330
6089  *             else:
6090  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
6091  *                 info.format[0] = c'^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
6092  *                 offset = 0
6093  *                 f = _util_dtypestring(descr, info.format + 1,
6094  */
6095     (__pyx_v_info->format[0]) = '^';
6096 
6097     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":331
6098  *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
6099  *                 info.format[0] = c'^' # Native data types, manual alignment
6100  *                 offset = 0             # <<<<<<<<<<<<<<
6101  *                 f = _util_dtypestring(descr, info.format + 1,
6102  *                                       info.format + _buffer_format_string_len,
6103  */
6104     __pyx_v_offset = 0;
6105 
6106     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":332
6107  *                 info.format[0] = c'^' # Native data types, manual alignment
6108  *                 offset = 0
6109  *                 f = _util_dtypestring(descr, info.format + 1,             # <<<<<<<<<<<<<<
6110  *                                       info.format + _buffer_format_string_len,
6111  *                                       &offset)
6112  */
6113     __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 332, __pyx_L1_error)
6114     __pyx_v_f = __pyx_t_9;
6115 
6116     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":335
6117  *                                       info.format + _buffer_format_string_len,
6118  *                                       &offset)
6119  *                 f[0] = c'\0' # Terminate format string             # <<<<<<<<<<<<<<
6120  *
6121  *         def __releasebuffer__(ndarray self, Py_buffer* info):
6122  */
6123     (__pyx_v_f[0]) = '\x00';
6124   }
6125 
6126   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":258
6127  *         # experimental exception made for __getbuffer__ and __releasebuffer__
6128  *         # -- the details of this may change.
6129  *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
6130  *             # This implementation of getbuffer is geared towards Cython
6131  *             # requirements, and does not yet fulfill the PEP.
6132  */
6133 
6134   /* function exit code */
6135   __pyx_r = 0;
6136   goto __pyx_L0;
6137   __pyx_L1_error:;
6138   __Pyx_XDECREF(__pyx_t_3);
6139   __Pyx_XDECREF(__pyx_t_8);
6140   __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6141   __pyx_r = -1;
6142   if (__pyx_v_info->obj != NULL) {
6143     __Pyx_GOTREF(__pyx_v_info->obj);
6144     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
6145   }
6146   goto __pyx_L2;
6147   __pyx_L0:;
6148   if (__pyx_v_info->obj == Py_None) {
6149     __Pyx_GOTREF(__pyx_v_info->obj);
6150     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
6151   }
6152   __pyx_L2:;
6153   __Pyx_XDECREF((PyObject *)__pyx_v_descr);
6154   __Pyx_RefNannyFinishContext();
6155   return __pyx_r;
6156 }
6157 
6158 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":337
6159  *                 f[0] = c'\0' # Terminate format string
6160  *
6161  *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
6162  *             if PyArray_HASFIELDS(self):
6163  *                 PyObject_Free(info.format)
6164  */
6165 
6166 /* Python wrapper */
6167 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)6168 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
6169   __Pyx_RefNannyDeclarations
6170   __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
6171   __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
6172 
6173   /* function exit code */
6174   __Pyx_RefNannyFinishContext();
6175 }
6176 
__pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject * __pyx_v_self,Py_buffer * __pyx_v_info)6177 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
6178   __Pyx_RefNannyDeclarations
6179   int __pyx_t_1;
6180   __Pyx_RefNannySetupContext("__releasebuffer__", 0);
6181 
6182   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":338
6183  *
6184  *         def __releasebuffer__(ndarray self, Py_buffer* info):
6185  *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
6186  *                 PyObject_Free(info.format)
6187  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
6188  */
6189   __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
6190   if (__pyx_t_1) {
6191 
6192     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":339
6193  *         def __releasebuffer__(ndarray self, Py_buffer* info):
6194  *             if PyArray_HASFIELDS(self):
6195  *                 PyObject_Free(info.format)             # <<<<<<<<<<<<<<
6196  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
6197  *                 PyObject_Free(info.strides)
6198  */
6199     PyObject_Free(__pyx_v_info->format);
6200 
6201     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":338
6202  *
6203  *         def __releasebuffer__(ndarray self, Py_buffer* info):
6204  *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
6205  *                 PyObject_Free(info.format)
6206  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
6207  */
6208   }
6209 
6210   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":340
6211  *             if PyArray_HASFIELDS(self):
6212  *                 PyObject_Free(info.format)
6213  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
6214  *                 PyObject_Free(info.strides)
6215  *                 # info.shape was stored after info.strides in the same block
6216  */
6217   __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
6218   if (__pyx_t_1) {
6219 
6220     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":341
6221  *                 PyObject_Free(info.format)
6222  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
6223  *                 PyObject_Free(info.strides)             # <<<<<<<<<<<<<<
6224  *                 # info.shape was stored after info.strides in the same block
6225  *
6226  */
6227     PyObject_Free(__pyx_v_info->strides);
6228 
6229     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":340
6230  *             if PyArray_HASFIELDS(self):
6231  *                 PyObject_Free(info.format)
6232  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
6233  *                 PyObject_Free(info.strides)
6234  *                 # info.shape was stored after info.strides in the same block
6235  */
6236   }
6237 
6238   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":337
6239  *                 f[0] = c'\0' # Terminate format string
6240  *
6241  *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
6242  *             if PyArray_HASFIELDS(self):
6243  *                 PyObject_Free(info.format)
6244  */
6245 
6246   /* function exit code */
6247   __Pyx_RefNannyFinishContext();
6248 }
6249 
6250 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":821
6251  * ctypedef npy_cdouble     complex_t
6252  *
6253  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
6254  *     return PyArray_MultiIterNew(1, <void*>a)
6255  *
6256  */
6257 
__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject * __pyx_v_a)6258 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
6259   PyObject *__pyx_r = NULL;
6260   __Pyx_RefNannyDeclarations
6261   PyObject *__pyx_t_1 = NULL;
6262   __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
6263 
6264   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":822
6265  *
6266  * cdef inline object PyArray_MultiIterNew1(a):
6267  *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
6268  *
6269  * cdef inline object PyArray_MultiIterNew2(a, b):
6270  */
6271   __Pyx_XDECREF(__pyx_r);
6272   __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 822, __pyx_L1_error)
6273   __Pyx_GOTREF(__pyx_t_1);
6274   __pyx_r = __pyx_t_1;
6275   __pyx_t_1 = 0;
6276   goto __pyx_L0;
6277 
6278   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":821
6279  * ctypedef npy_cdouble     complex_t
6280  *
6281  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
6282  *     return PyArray_MultiIterNew(1, <void*>a)
6283  *
6284  */
6285 
6286   /* function exit code */
6287   __pyx_L1_error:;
6288   __Pyx_XDECREF(__pyx_t_1);
6289   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
6290   __pyx_r = 0;
6291   __pyx_L0:;
6292   __Pyx_XGIVEREF(__pyx_r);
6293   __Pyx_RefNannyFinishContext();
6294   return __pyx_r;
6295 }
6296 
6297 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":824
6298  *     return PyArray_MultiIterNew(1, <void*>a)
6299  *
6300  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
6301  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6302  *
6303  */
6304 
__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject * __pyx_v_a,PyObject * __pyx_v_b)6305 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
6306   PyObject *__pyx_r = NULL;
6307   __Pyx_RefNannyDeclarations
6308   PyObject *__pyx_t_1 = NULL;
6309   __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
6310 
6311   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":825
6312  *
6313  * cdef inline object PyArray_MultiIterNew2(a, b):
6314  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
6315  *
6316  * cdef inline object PyArray_MultiIterNew3(a, b, c):
6317  */
6318   __Pyx_XDECREF(__pyx_r);
6319   __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 825, __pyx_L1_error)
6320   __Pyx_GOTREF(__pyx_t_1);
6321   __pyx_r = __pyx_t_1;
6322   __pyx_t_1 = 0;
6323   goto __pyx_L0;
6324 
6325   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":824
6326  *     return PyArray_MultiIterNew(1, <void*>a)
6327  *
6328  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
6329  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6330  *
6331  */
6332 
6333   /* function exit code */
6334   __pyx_L1_error:;
6335   __Pyx_XDECREF(__pyx_t_1);
6336   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
6337   __pyx_r = 0;
6338   __pyx_L0:;
6339   __Pyx_XGIVEREF(__pyx_r);
6340   __Pyx_RefNannyFinishContext();
6341   return __pyx_r;
6342 }
6343 
6344 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827
6345  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6346  *
6347  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
6348  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6349  *
6350  */
6351 
__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c)6352 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
6353   PyObject *__pyx_r = NULL;
6354   __Pyx_RefNannyDeclarations
6355   PyObject *__pyx_t_1 = NULL;
6356   __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
6357 
6358   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":828
6359  *
6360  * cdef inline object PyArray_MultiIterNew3(a, b, c):
6361  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
6362  *
6363  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
6364  */
6365   __Pyx_XDECREF(__pyx_r);
6366   __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 828, __pyx_L1_error)
6367   __Pyx_GOTREF(__pyx_t_1);
6368   __pyx_r = __pyx_t_1;
6369   __pyx_t_1 = 0;
6370   goto __pyx_L0;
6371 
6372   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827
6373  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6374  *
6375  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
6376  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6377  *
6378  */
6379 
6380   /* function exit code */
6381   __pyx_L1_error:;
6382   __Pyx_XDECREF(__pyx_t_1);
6383   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
6384   __pyx_r = 0;
6385   __pyx_L0:;
6386   __Pyx_XGIVEREF(__pyx_r);
6387   __Pyx_RefNannyFinishContext();
6388   return __pyx_r;
6389 }
6390 
6391 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":830
6392  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6393  *
6394  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
6395  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6396  *
6397  */
6398 
__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c,PyObject * __pyx_v_d)6399 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) {
6400   PyObject *__pyx_r = NULL;
6401   __Pyx_RefNannyDeclarations
6402   PyObject *__pyx_t_1 = NULL;
6403   __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
6404 
6405   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":831
6406  *
6407  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
6408  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
6409  *
6410  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
6411  */
6412   __Pyx_XDECREF(__pyx_r);
6413   __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 831, __pyx_L1_error)
6414   __Pyx_GOTREF(__pyx_t_1);
6415   __pyx_r = __pyx_t_1;
6416   __pyx_t_1 = 0;
6417   goto __pyx_L0;
6418 
6419   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":830
6420  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6421  *
6422  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
6423  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6424  *
6425  */
6426 
6427   /* function exit code */
6428   __pyx_L1_error:;
6429   __Pyx_XDECREF(__pyx_t_1);
6430   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
6431   __pyx_r = 0;
6432   __pyx_L0:;
6433   __Pyx_XGIVEREF(__pyx_r);
6434   __Pyx_RefNannyFinishContext();
6435   return __pyx_r;
6436 }
6437 
6438 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":833
6439  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6440  *
6441  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
6442  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6443  *
6444  */
6445 
__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)6446 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) {
6447   PyObject *__pyx_r = NULL;
6448   __Pyx_RefNannyDeclarations
6449   PyObject *__pyx_t_1 = NULL;
6450   __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
6451 
6452   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":834
6453  *
6454  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
6455  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
6456  *
6457  * cdef inline tuple PyDataType_SHAPE(dtype d):
6458  */
6459   __Pyx_XDECREF(__pyx_r);
6460   __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 834, __pyx_L1_error)
6461   __Pyx_GOTREF(__pyx_t_1);
6462   __pyx_r = __pyx_t_1;
6463   __pyx_t_1 = 0;
6464   goto __pyx_L0;
6465 
6466   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":833
6467  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6468  *
6469  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
6470  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6471  *
6472  */
6473 
6474   /* function exit code */
6475   __pyx_L1_error:;
6476   __Pyx_XDECREF(__pyx_t_1);
6477   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
6478   __pyx_r = 0;
6479   __pyx_L0:;
6480   __Pyx_XGIVEREF(__pyx_r);
6481   __Pyx_RefNannyFinishContext();
6482   return __pyx_r;
6483 }
6484 
6485 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":836
6486  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6487  *
6488  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
6489  *     if PyDataType_HASSUBARRAY(d):
6490  *         return <tuple>d.subarray.shape
6491  */
6492 
__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr * __pyx_v_d)6493 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
6494   PyObject *__pyx_r = NULL;
6495   __Pyx_RefNannyDeclarations
6496   int __pyx_t_1;
6497   __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
6498 
6499   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837
6500  *
6501  * cdef inline tuple PyDataType_SHAPE(dtype d):
6502  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
6503  *         return <tuple>d.subarray.shape
6504  *     else:
6505  */
6506   __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
6507   if (__pyx_t_1) {
6508 
6509     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":838
6510  * cdef inline tuple PyDataType_SHAPE(dtype d):
6511  *     if PyDataType_HASSUBARRAY(d):
6512  *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
6513  *     else:
6514  *         return ()
6515  */
6516     __Pyx_XDECREF(__pyx_r);
6517     __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
6518     __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
6519     goto __pyx_L0;
6520 
6521     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837
6522  *
6523  * cdef inline tuple PyDataType_SHAPE(dtype d):
6524  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
6525  *         return <tuple>d.subarray.shape
6526  *     else:
6527  */
6528   }
6529 
6530   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":840
6531  *         return <tuple>d.subarray.shape
6532  *     else:
6533  *         return ()             # <<<<<<<<<<<<<<
6534  *
6535  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
6536  */
6537   /*else*/ {
6538     __Pyx_XDECREF(__pyx_r);
6539     __Pyx_INCREF(__pyx_empty_tuple);
6540     __pyx_r = __pyx_empty_tuple;
6541     goto __pyx_L0;
6542   }
6543 
6544   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":836
6545  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6546  *
6547  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
6548  *     if PyDataType_HASSUBARRAY(d):
6549  *         return <tuple>d.subarray.shape
6550  */
6551 
6552   /* function exit code */
6553   __pyx_L0:;
6554   __Pyx_XGIVEREF(__pyx_r);
6555   __Pyx_RefNannyFinishContext();
6556   return __pyx_r;
6557 }
6558 
6559 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842
6560  *         return ()
6561  *
6562  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
6563  *     # Recursive utility function used in __getbuffer__ to get format
6564  *     # string. The new location in the format string is returned.
6565  */
6566 
__pyx_f_5numpy__util_dtypestring(PyArray_Descr * __pyx_v_descr,char * __pyx_v_f,char * __pyx_v_end,int * __pyx_v_offset)6567 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) {
6568   PyArray_Descr *__pyx_v_child = 0;
6569   int __pyx_v_endian_detector;
6570   int __pyx_v_little_endian;
6571   PyObject *__pyx_v_fields = 0;
6572   PyObject *__pyx_v_childname = NULL;
6573   PyObject *__pyx_v_new_offset = NULL;
6574   PyObject *__pyx_v_t = NULL;
6575   char *__pyx_r;
6576   __Pyx_RefNannyDeclarations
6577   PyObject *__pyx_t_1 = NULL;
6578   Py_ssize_t __pyx_t_2;
6579   PyObject *__pyx_t_3 = NULL;
6580   PyObject *__pyx_t_4 = NULL;
6581   int __pyx_t_5;
6582   int __pyx_t_6;
6583   int __pyx_t_7;
6584   long __pyx_t_8;
6585   char *__pyx_t_9;
6586   __Pyx_RefNannySetupContext("_util_dtypestring", 0);
6587 
6588   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":847
6589  *
6590  *     cdef dtype child
6591  *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
6592  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
6593  *     cdef tuple fields
6594  */
6595   __pyx_v_endian_detector = 1;
6596 
6597   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":848
6598  *     cdef dtype child
6599  *     cdef int endian_detector = 1
6600  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
6601  *     cdef tuple fields
6602  *
6603  */
6604   __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
6605 
6606   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851
6607  *     cdef tuple fields
6608  *
6609  *     for childname in descr.names:             # <<<<<<<<<<<<<<
6610  *         fields = descr.fields[childname]
6611  *         child, new_offset = fields
6612  */
6613   if (unlikely(__pyx_v_descr->names == Py_None)) {
6614     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
6615     __PYX_ERR(1, 851, __pyx_L1_error)
6616   }
6617   __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
6618   for (;;) {
6619     if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
6620     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6621     __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 851, __pyx_L1_error)
6622     #else
6623     __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 851, __pyx_L1_error)
6624     __Pyx_GOTREF(__pyx_t_3);
6625     #endif
6626     __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
6627     __pyx_t_3 = 0;
6628 
6629     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":852
6630  *
6631  *     for childname in descr.names:
6632  *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
6633  *         child, new_offset = fields
6634  *
6635  */
6636     if (unlikely(__pyx_v_descr->fields == Py_None)) {
6637       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6638       __PYX_ERR(1, 852, __pyx_L1_error)
6639     }
6640     __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __pyx_L1_error)
6641     __Pyx_GOTREF(__pyx_t_3);
6642     if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 852, __pyx_L1_error)
6643     __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
6644     __pyx_t_3 = 0;
6645 
6646     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":853
6647  *     for childname in descr.names:
6648  *         fields = descr.fields[childname]
6649  *         child, new_offset = fields             # <<<<<<<<<<<<<<
6650  *
6651  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
6652  */
6653     if (likely(__pyx_v_fields != Py_None)) {
6654       PyObject* sequence = __pyx_v_fields;
6655       Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
6656       if (unlikely(size != 2)) {
6657         if (size > 2) __Pyx_RaiseTooManyValuesError(2);
6658         else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
6659         __PYX_ERR(1, 853, __pyx_L1_error)
6660       }
6661       #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6662       __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
6663       __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
6664       __Pyx_INCREF(__pyx_t_3);
6665       __Pyx_INCREF(__pyx_t_4);
6666       #else
6667       __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 853, __pyx_L1_error)
6668       __Pyx_GOTREF(__pyx_t_3);
6669       __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error)
6670       __Pyx_GOTREF(__pyx_t_4);
6671       #endif
6672     } else {
6673       __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 853, __pyx_L1_error)
6674     }
6675     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 853, __pyx_L1_error)
6676     __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
6677     __pyx_t_3 = 0;
6678     __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
6679     __pyx_t_4 = 0;
6680 
6681     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855
6682  *         child, new_offset = fields
6683  *
6684  *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
6685  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
6686  *
6687  */
6688     __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error)
6689     __Pyx_GOTREF(__pyx_t_4);
6690     __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error)
6691     __Pyx_GOTREF(__pyx_t_3);
6692     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6693     __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 855, __pyx_L1_error)
6694     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6695     __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
6696     if (unlikely(__pyx_t_6)) {
6697 
6698       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856
6699  *
6700  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
6701  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
6702  *
6703  *         if ((child.byteorder == c'>' and little_endian) or
6704  */
6705       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 856, __pyx_L1_error)
6706       __Pyx_GOTREF(__pyx_t_3);
6707       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6708       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6709       __PYX_ERR(1, 856, __pyx_L1_error)
6710 
6711       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855
6712  *         child, new_offset = fields
6713  *
6714  *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
6715  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
6716  *
6717  */
6718     }
6719 
6720     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
6721  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
6722  *
6723  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
6724  *             (child.byteorder == c'<' and not little_endian)):
6725  *             raise ValueError(u"Non-native byte order not supported")
6726  */
6727     __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
6728     if (!__pyx_t_7) {
6729       goto __pyx_L8_next_or;
6730     } else {
6731     }
6732     __pyx_t_7 = (__pyx_v_little_endian != 0);
6733     if (!__pyx_t_7) {
6734     } else {
6735       __pyx_t_6 = __pyx_t_7;
6736       goto __pyx_L7_bool_binop_done;
6737     }
6738     __pyx_L8_next_or:;
6739 
6740     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":859
6741  *
6742  *         if ((child.byteorder == c'>' and little_endian) or
6743  *             (child.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
6744  *             raise ValueError(u"Non-native byte order not supported")
6745  *             # One could encode it in the format string and have Cython
6746  */
6747     __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
6748     if (__pyx_t_7) {
6749     } else {
6750       __pyx_t_6 = __pyx_t_7;
6751       goto __pyx_L7_bool_binop_done;
6752     }
6753     __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
6754     __pyx_t_6 = __pyx_t_7;
6755     __pyx_L7_bool_binop_done:;
6756 
6757     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
6758  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
6759  *
6760  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
6761  *             (child.byteorder == c'<' and not little_endian)):
6762  *             raise ValueError(u"Non-native byte order not supported")
6763  */
6764     if (unlikely(__pyx_t_6)) {
6765 
6766       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":860
6767  *         if ((child.byteorder == c'>' and little_endian) or
6768  *             (child.byteorder == c'<' and not little_endian)):
6769  *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
6770  *             # One could encode it in the format string and have Cython
6771  *             # complain instead, BUT: < and > in format strings also imply
6772  */
6773       __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 860, __pyx_L1_error)
6774       __Pyx_GOTREF(__pyx_t_3);
6775       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6776       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6777       __PYX_ERR(1, 860, __pyx_L1_error)
6778 
6779       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
6780  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
6781  *
6782  *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
6783  *             (child.byteorder == c'<' and not little_endian)):
6784  *             raise ValueError(u"Non-native byte order not supported")
6785  */
6786     }
6787 
6788     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":870
6789  *
6790  *         # Output padding bytes
6791  *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
6792  *             f[0] = 120 # "x"; pad byte
6793  *             f += 1
6794  */
6795     while (1) {
6796       __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 870, __pyx_L1_error)
6797       __Pyx_GOTREF(__pyx_t_3);
6798       __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 870, __pyx_L1_error)
6799       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6800       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 870, __pyx_L1_error)
6801       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6802       if (!__pyx_t_6) break;
6803 
6804       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":871
6805  *         # Output padding bytes
6806  *         while offset[0] < new_offset:
6807  *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
6808  *             f += 1
6809  *             offset[0] += 1
6810  */
6811       (__pyx_v_f[0]) = 0x78;
6812 
6813       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":872
6814  *         while offset[0] < new_offset:
6815  *             f[0] = 120 # "x"; pad byte
6816  *             f += 1             # <<<<<<<<<<<<<<
6817  *             offset[0] += 1
6818  *
6819  */
6820       __pyx_v_f = (__pyx_v_f + 1);
6821 
6822       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":873
6823  *             f[0] = 120 # "x"; pad byte
6824  *             f += 1
6825  *             offset[0] += 1             # <<<<<<<<<<<<<<
6826  *
6827  *         offset[0] += child.itemsize
6828  */
6829       __pyx_t_8 = 0;
6830       (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
6831     }
6832 
6833     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":875
6834  *             offset[0] += 1
6835  *
6836  *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
6837  *
6838  *         if not PyDataType_HASFIELDS(child):
6839  */
6840     __pyx_t_8 = 0;
6841     (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
6842 
6843     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":877
6844  *         offset[0] += child.itemsize
6845  *
6846  *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
6847  *             t = child.type_num
6848  *             if end - f < 5:
6849  */
6850     __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
6851     if (__pyx_t_6) {
6852 
6853       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":878
6854  *
6855  *         if not PyDataType_HASFIELDS(child):
6856  *             t = child.type_num             # <<<<<<<<<<<<<<
6857  *             if end - f < 5:
6858  *                 raise RuntimeError(u"Format string allocated too short.")
6859  */
6860       __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 878, __pyx_L1_error)
6861       __Pyx_GOTREF(__pyx_t_4);
6862       __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
6863       __pyx_t_4 = 0;
6864 
6865       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":879
6866  *         if not PyDataType_HASFIELDS(child):
6867  *             t = child.type_num
6868  *             if end - f < 5:             # <<<<<<<<<<<<<<
6869  *                 raise RuntimeError(u"Format string allocated too short.")
6870  *
6871  */
6872       __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
6873       if (unlikely(__pyx_t_6)) {
6874 
6875         /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":880
6876  *             t = child.type_num
6877  *             if end - f < 5:
6878  *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
6879  *
6880  *             # Until ticket #99 is fixed, use integers to avoid warnings
6881  */
6882         __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 880, __pyx_L1_error)
6883         __Pyx_GOTREF(__pyx_t_4);
6884         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
6885         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6886         __PYX_ERR(1, 880, __pyx_L1_error)
6887 
6888         /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":879
6889  *         if not PyDataType_HASFIELDS(child):
6890  *             t = child.type_num
6891  *             if end - f < 5:             # <<<<<<<<<<<<<<
6892  *                 raise RuntimeError(u"Format string allocated too short.")
6893  *
6894  */
6895       }
6896 
6897       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":883
6898  *
6899  *             # Until ticket #99 is fixed, use integers to avoid warnings
6900  *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
6901  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
6902  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
6903  */
6904       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 883, __pyx_L1_error)
6905       __Pyx_GOTREF(__pyx_t_4);
6906       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 883, __pyx_L1_error)
6907       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6908       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 883, __pyx_L1_error)
6909       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6910       if (__pyx_t_6) {
6911         (__pyx_v_f[0]) = 98;
6912         goto __pyx_L15;
6913       }
6914 
6915       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":884
6916  *             # Until ticket #99 is fixed, use integers to avoid warnings
6917  *             if   t == NPY_BYTE:        f[0] =  98 #"b"
6918  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
6919  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
6920  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
6921  */
6922       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 884, __pyx_L1_error)
6923       __Pyx_GOTREF(__pyx_t_3);
6924       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 884, __pyx_L1_error)
6925       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6926       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 884, __pyx_L1_error)
6927       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6928       if (__pyx_t_6) {
6929         (__pyx_v_f[0]) = 66;
6930         goto __pyx_L15;
6931       }
6932 
6933       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":885
6934  *             if   t == NPY_BYTE:        f[0] =  98 #"b"
6935  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
6936  *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
6937  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
6938  *             elif t == NPY_INT:         f[0] = 105 #"i"
6939  */
6940       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 885, __pyx_L1_error)
6941       __Pyx_GOTREF(__pyx_t_4);
6942       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 885, __pyx_L1_error)
6943       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6944       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 885, __pyx_L1_error)
6945       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6946       if (__pyx_t_6) {
6947         (__pyx_v_f[0]) = 0x68;
6948         goto __pyx_L15;
6949       }
6950 
6951       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":886
6952  *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
6953  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
6954  *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
6955  *             elif t == NPY_INT:         f[0] = 105 #"i"
6956  *             elif t == NPY_UINT:        f[0] =  73 #"I"
6957  */
6958       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 886, __pyx_L1_error)
6959       __Pyx_GOTREF(__pyx_t_3);
6960       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 886, __pyx_L1_error)
6961       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6962       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 886, __pyx_L1_error)
6963       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6964       if (__pyx_t_6) {
6965         (__pyx_v_f[0]) = 72;
6966         goto __pyx_L15;
6967       }
6968 
6969       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":887
6970  *             elif t == NPY_SHORT:       f[0] = 104 #"h"
6971  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
6972  *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
6973  *             elif t == NPY_UINT:        f[0] =  73 #"I"
6974  *             elif t == NPY_LONG:        f[0] = 108 #"l"
6975  */
6976       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 887, __pyx_L1_error)
6977       __Pyx_GOTREF(__pyx_t_4);
6978       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 887, __pyx_L1_error)
6979       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6980       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 887, __pyx_L1_error)
6981       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6982       if (__pyx_t_6) {
6983         (__pyx_v_f[0]) = 0x69;
6984         goto __pyx_L15;
6985       }
6986 
6987       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":888
6988  *             elif t == NPY_USHORT:      f[0] =  72 #"H"
6989  *             elif t == NPY_INT:         f[0] = 105 #"i"
6990  *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
6991  *             elif t == NPY_LONG:        f[0] = 108 #"l"
6992  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
6993  */
6994       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 888, __pyx_L1_error)
6995       __Pyx_GOTREF(__pyx_t_3);
6996       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 888, __pyx_L1_error)
6997       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6998       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 888, __pyx_L1_error)
6999       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7000       if (__pyx_t_6) {
7001         (__pyx_v_f[0]) = 73;
7002         goto __pyx_L15;
7003       }
7004 
7005       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":889
7006  *             elif t == NPY_INT:         f[0] = 105 #"i"
7007  *             elif t == NPY_UINT:        f[0] =  73 #"I"
7008  *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
7009  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
7010  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
7011  */
7012       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 889, __pyx_L1_error)
7013       __Pyx_GOTREF(__pyx_t_4);
7014       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 889, __pyx_L1_error)
7015       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7016       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 889, __pyx_L1_error)
7017       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7018       if (__pyx_t_6) {
7019         (__pyx_v_f[0]) = 0x6C;
7020         goto __pyx_L15;
7021       }
7022 
7023       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":890
7024  *             elif t == NPY_UINT:        f[0] =  73 #"I"
7025  *             elif t == NPY_LONG:        f[0] = 108 #"l"
7026  *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
7027  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
7028  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
7029  */
7030       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 890, __pyx_L1_error)
7031       __Pyx_GOTREF(__pyx_t_3);
7032       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 890, __pyx_L1_error)
7033       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7034       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 890, __pyx_L1_error)
7035       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7036       if (__pyx_t_6) {
7037         (__pyx_v_f[0]) = 76;
7038         goto __pyx_L15;
7039       }
7040 
7041       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":891
7042  *             elif t == NPY_LONG:        f[0] = 108 #"l"
7043  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
7044  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
7045  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
7046  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
7047  */
7048       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 891, __pyx_L1_error)
7049       __Pyx_GOTREF(__pyx_t_4);
7050       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 891, __pyx_L1_error)
7051       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7052       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 891, __pyx_L1_error)
7053       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7054       if (__pyx_t_6) {
7055         (__pyx_v_f[0]) = 0x71;
7056         goto __pyx_L15;
7057       }
7058 
7059       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":892
7060  *             elif t == NPY_ULONG:       f[0] = 76  #"L"
7061  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
7062  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
7063  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
7064  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
7065  */
7066       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 892, __pyx_L1_error)
7067       __Pyx_GOTREF(__pyx_t_3);
7068       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 892, __pyx_L1_error)
7069       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7070       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 892, __pyx_L1_error)
7071       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7072       if (__pyx_t_6) {
7073         (__pyx_v_f[0]) = 81;
7074         goto __pyx_L15;
7075       }
7076 
7077       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":893
7078  *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
7079  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
7080  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
7081  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
7082  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
7083  */
7084       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 893, __pyx_L1_error)
7085       __Pyx_GOTREF(__pyx_t_4);
7086       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 893, __pyx_L1_error)
7087       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7088       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 893, __pyx_L1_error)
7089       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7090       if (__pyx_t_6) {
7091         (__pyx_v_f[0]) = 0x66;
7092         goto __pyx_L15;
7093       }
7094 
7095       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":894
7096  *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
7097  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
7098  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
7099  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
7100  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
7101  */
7102       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 894, __pyx_L1_error)
7103       __Pyx_GOTREF(__pyx_t_3);
7104       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 894, __pyx_L1_error)
7105       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7106       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 894, __pyx_L1_error)
7107       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7108       if (__pyx_t_6) {
7109         (__pyx_v_f[0]) = 0x64;
7110         goto __pyx_L15;
7111       }
7112 
7113       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":895
7114  *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
7115  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
7116  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
7117  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
7118  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
7119  */
7120       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 895, __pyx_L1_error)
7121       __Pyx_GOTREF(__pyx_t_4);
7122       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 895, __pyx_L1_error)
7123       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7124       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 895, __pyx_L1_error)
7125       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7126       if (__pyx_t_6) {
7127         (__pyx_v_f[0]) = 0x67;
7128         goto __pyx_L15;
7129       }
7130 
7131       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":896
7132  *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
7133  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
7134  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
7135  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
7136  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
7137  */
7138       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 896, __pyx_L1_error)
7139       __Pyx_GOTREF(__pyx_t_3);
7140       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 896, __pyx_L1_error)
7141       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7142       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 896, __pyx_L1_error)
7143       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7144       if (__pyx_t_6) {
7145         (__pyx_v_f[0]) = 90;
7146         (__pyx_v_f[1]) = 0x66;
7147         __pyx_v_f = (__pyx_v_f + 1);
7148         goto __pyx_L15;
7149       }
7150 
7151       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":897
7152  *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
7153  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
7154  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
7155  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
7156  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
7157  */
7158       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 897, __pyx_L1_error)
7159       __Pyx_GOTREF(__pyx_t_4);
7160       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 897, __pyx_L1_error)
7161       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7162       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 897, __pyx_L1_error)
7163       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7164       if (__pyx_t_6) {
7165         (__pyx_v_f[0]) = 90;
7166         (__pyx_v_f[1]) = 0x64;
7167         __pyx_v_f = (__pyx_v_f + 1);
7168         goto __pyx_L15;
7169       }
7170 
7171       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":898
7172  *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
7173  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
7174  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
7175  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
7176  *             else:
7177  */
7178       __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 898, __pyx_L1_error)
7179       __Pyx_GOTREF(__pyx_t_3);
7180       __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 898, __pyx_L1_error)
7181       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7182       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 898, __pyx_L1_error)
7183       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7184       if (__pyx_t_6) {
7185         (__pyx_v_f[0]) = 90;
7186         (__pyx_v_f[1]) = 0x67;
7187         __pyx_v_f = (__pyx_v_f + 1);
7188         goto __pyx_L15;
7189       }
7190 
7191       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":899
7192  *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
7193  *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
7194  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
7195  *             else:
7196  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
7197  */
7198       __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 899, __pyx_L1_error)
7199       __Pyx_GOTREF(__pyx_t_4);
7200       __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 899, __pyx_L1_error)
7201       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7202       __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 899, __pyx_L1_error)
7203       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7204       if (likely(__pyx_t_6)) {
7205         (__pyx_v_f[0]) = 79;
7206         goto __pyx_L15;
7207       }
7208 
7209       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":901
7210  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
7211  *             else:
7212  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
7213  *             f += 1
7214  *         else:
7215  */
7216       /*else*/ {
7217         __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 901, __pyx_L1_error)
7218         __Pyx_GOTREF(__pyx_t_3);
7219         __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 901, __pyx_L1_error)
7220         __Pyx_GOTREF(__pyx_t_4);
7221         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7222         __Pyx_Raise(__pyx_t_4, 0, 0, 0);
7223         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7224         __PYX_ERR(1, 901, __pyx_L1_error)
7225       }
7226       __pyx_L15:;
7227 
7228       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":902
7229  *             else:
7230  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
7231  *             f += 1             # <<<<<<<<<<<<<<
7232  *         else:
7233  *             # Cython ignores struct boundary information ("T{...}"),
7234  */
7235       __pyx_v_f = (__pyx_v_f + 1);
7236 
7237       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":877
7238  *         offset[0] += child.itemsize
7239  *
7240  *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
7241  *             t = child.type_num
7242  *             if end - f < 5:
7243  */
7244       goto __pyx_L13;
7245     }
7246 
7247     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":906
7248  *             # Cython ignores struct boundary information ("T{...}"),
7249  *             # so don't output it
7250  *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
7251  *     return f
7252  *
7253  */
7254     /*else*/ {
7255       __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 906, __pyx_L1_error)
7256       __pyx_v_f = __pyx_t_9;
7257     }
7258     __pyx_L13:;
7259 
7260     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851
7261  *     cdef tuple fields
7262  *
7263  *     for childname in descr.names:             # <<<<<<<<<<<<<<
7264  *         fields = descr.fields[childname]
7265  *         child, new_offset = fields
7266  */
7267   }
7268   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7269 
7270   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":907
7271  *             # so don't output it
7272  *             f = _util_dtypestring(child, f, end, offset)
7273  *     return f             # <<<<<<<<<<<<<<
7274  *
7275  *
7276  */
7277   __pyx_r = __pyx_v_f;
7278   goto __pyx_L0;
7279 
7280   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842
7281  *         return ()
7282  *
7283  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
7284  *     # Recursive utility function used in __getbuffer__ to get format
7285  *     # string. The new location in the format string is returned.
7286  */
7287 
7288   /* function exit code */
7289   __pyx_L1_error:;
7290   __Pyx_XDECREF(__pyx_t_1);
7291   __Pyx_XDECREF(__pyx_t_3);
7292   __Pyx_XDECREF(__pyx_t_4);
7293   __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
7294   __pyx_r = NULL;
7295   __pyx_L0:;
7296   __Pyx_XDECREF((PyObject *)__pyx_v_child);
7297   __Pyx_XDECREF(__pyx_v_fields);
7298   __Pyx_XDECREF(__pyx_v_childname);
7299   __Pyx_XDECREF(__pyx_v_new_offset);
7300   __Pyx_XDECREF(__pyx_v_t);
7301   __Pyx_RefNannyFinishContext();
7302   return __pyx_r;
7303 }
7304 
7305 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022
7306  *     int _import_umath() except -1
7307  *
7308  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
7309  *     Py_INCREF(base) # important to do this before stealing the reference below!
7310  *     PyArray_SetBaseObject(arr, base)
7311  */
7312 
__pyx_f_5numpy_set_array_base(PyArrayObject * __pyx_v_arr,PyObject * __pyx_v_base)7313 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
7314   __Pyx_RefNannyDeclarations
7315   __Pyx_RefNannySetupContext("set_array_base", 0);
7316 
7317   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1023
7318  *
7319  * cdef inline void set_array_base(ndarray arr, object base):
7320  *     Py_INCREF(base) # important to do this before stealing the reference below!             # <<<<<<<<<<<<<<
7321  *     PyArray_SetBaseObject(arr, base)
7322  *
7323  */
7324   Py_INCREF(__pyx_v_base);
7325 
7326   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1024
7327  * cdef inline void set_array_base(ndarray arr, object base):
7328  *     Py_INCREF(base) # important to do this before stealing the reference below!
7329  *     PyArray_SetBaseObject(arr, base)             # <<<<<<<<<<<<<<
7330  *
7331  * cdef inline object get_array_base(ndarray arr):
7332  */
7333   (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
7334 
7335   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022
7336  *     int _import_umath() except -1
7337  *
7338  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
7339  *     Py_INCREF(base) # important to do this before stealing the reference below!
7340  *     PyArray_SetBaseObject(arr, base)
7341  */
7342 
7343   /* function exit code */
7344   __Pyx_RefNannyFinishContext();
7345 }
7346 
7347 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1026
7348  *     PyArray_SetBaseObject(arr, base)
7349  *
7350  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
7351  *     base = PyArray_BASE(arr)
7352  *     if base is NULL:
7353  */
7354 
__pyx_f_5numpy_get_array_base(PyArrayObject * __pyx_v_arr)7355 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
7356   PyObject *__pyx_v_base;
7357   PyObject *__pyx_r = NULL;
7358   __Pyx_RefNannyDeclarations
7359   int __pyx_t_1;
7360   __Pyx_RefNannySetupContext("get_array_base", 0);
7361 
7362   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1027
7363  *
7364  * cdef inline object get_array_base(ndarray arr):
7365  *     base = PyArray_BASE(arr)             # <<<<<<<<<<<<<<
7366  *     if base is NULL:
7367  *         return None
7368  */
7369   __pyx_v_base = PyArray_BASE(__pyx_v_arr);
7370 
7371   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1028
7372  * cdef inline object get_array_base(ndarray arr):
7373  *     base = PyArray_BASE(arr)
7374  *     if base is NULL:             # <<<<<<<<<<<<<<
7375  *         return None
7376  *     return <object>base
7377  */
7378   __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
7379   if (__pyx_t_1) {
7380 
7381     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1029
7382  *     base = PyArray_BASE(arr)
7383  *     if base is NULL:
7384  *         return None             # <<<<<<<<<<<<<<
7385  *     return <object>base
7386  *
7387  */
7388     __Pyx_XDECREF(__pyx_r);
7389     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7390     goto __pyx_L0;
7391 
7392     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1028
7393  * cdef inline object get_array_base(ndarray arr):
7394  *     base = PyArray_BASE(arr)
7395  *     if base is NULL:             # <<<<<<<<<<<<<<
7396  *         return None
7397  *     return <object>base
7398  */
7399   }
7400 
7401   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1030
7402  *     if base is NULL:
7403  *         return None
7404  *     return <object>base             # <<<<<<<<<<<<<<
7405  *
7406  * # Versions of the import_* functions which are more suitable for
7407  */
7408   __Pyx_XDECREF(__pyx_r);
7409   __Pyx_INCREF(((PyObject *)__pyx_v_base));
7410   __pyx_r = ((PyObject *)__pyx_v_base);
7411   goto __pyx_L0;
7412 
7413   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1026
7414  *     PyArray_SetBaseObject(arr, base)
7415  *
7416  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
7417  *     base = PyArray_BASE(arr)
7418  *     if base is NULL:
7419  */
7420 
7421   /* function exit code */
7422   __pyx_L0:;
7423   __Pyx_XGIVEREF(__pyx_r);
7424   __Pyx_RefNannyFinishContext();
7425   return __pyx_r;
7426 }
7427 
7428 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1034
7429  * # Versions of the import_* functions which are more suitable for
7430  * # Cython code.
7431  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
7432  *     try:
7433  *         _import_array()
7434  */
7435 
__pyx_f_5numpy_import_array(void)7436 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
7437   int __pyx_r;
7438   __Pyx_RefNannyDeclarations
7439   PyObject *__pyx_t_1 = NULL;
7440   PyObject *__pyx_t_2 = NULL;
7441   PyObject *__pyx_t_3 = NULL;
7442   int __pyx_t_4;
7443   PyObject *__pyx_t_5 = NULL;
7444   PyObject *__pyx_t_6 = NULL;
7445   PyObject *__pyx_t_7 = NULL;
7446   PyObject *__pyx_t_8 = NULL;
7447   __Pyx_RefNannySetupContext("import_array", 0);
7448 
7449   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
7450  * # Cython code.
7451  * cdef inline int import_array() except -1:
7452  *     try:             # <<<<<<<<<<<<<<
7453  *         _import_array()
7454  *     except Exception:
7455  */
7456   {
7457     __Pyx_PyThreadState_declare
7458     __Pyx_PyThreadState_assign
7459     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
7460     __Pyx_XGOTREF(__pyx_t_1);
7461     __Pyx_XGOTREF(__pyx_t_2);
7462     __Pyx_XGOTREF(__pyx_t_3);
7463     /*try:*/ {
7464 
7465       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1036
7466  * cdef inline int import_array() except -1:
7467  *     try:
7468  *         _import_array()             # <<<<<<<<<<<<<<
7469  *     except Exception:
7470  *         raise ImportError("numpy.core.multiarray failed to import")
7471  */
7472       __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1036, __pyx_L3_error)
7473 
7474       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
7475  * # Cython code.
7476  * cdef inline int import_array() except -1:
7477  *     try:             # <<<<<<<<<<<<<<
7478  *         _import_array()
7479  *     except Exception:
7480  */
7481     }
7482     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7483     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7484     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7485     goto __pyx_L8_try_end;
7486     __pyx_L3_error:;
7487 
7488     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1037
7489  *     try:
7490  *         _import_array()
7491  *     except Exception:             # <<<<<<<<<<<<<<
7492  *         raise ImportError("numpy.core.multiarray failed to import")
7493  *
7494  */
7495     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7496     if (__pyx_t_4) {
7497       __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
7498       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1037, __pyx_L5_except_error)
7499       __Pyx_GOTREF(__pyx_t_5);
7500       __Pyx_GOTREF(__pyx_t_6);
7501       __Pyx_GOTREF(__pyx_t_7);
7502 
7503       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1038
7504  *         _import_array()
7505  *     except Exception:
7506  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
7507  *
7508  * cdef inline int import_umath() except -1:
7509  */
7510       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1038, __pyx_L5_except_error)
7511       __Pyx_GOTREF(__pyx_t_8);
7512       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
7513       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7514       __PYX_ERR(1, 1038, __pyx_L5_except_error)
7515     }
7516     goto __pyx_L5_except_error;
7517     __pyx_L5_except_error:;
7518 
7519     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035
7520  * # Cython code.
7521  * cdef inline int import_array() except -1:
7522  *     try:             # <<<<<<<<<<<<<<
7523  *         _import_array()
7524  *     except Exception:
7525  */
7526     __Pyx_XGIVEREF(__pyx_t_1);
7527     __Pyx_XGIVEREF(__pyx_t_2);
7528     __Pyx_XGIVEREF(__pyx_t_3);
7529     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7530     goto __pyx_L1_error;
7531     __pyx_L8_try_end:;
7532   }
7533 
7534   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1034
7535  * # Versions of the import_* functions which are more suitable for
7536  * # Cython code.
7537  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
7538  *     try:
7539  *         _import_array()
7540  */
7541 
7542   /* function exit code */
7543   __pyx_r = 0;
7544   goto __pyx_L0;
7545   __pyx_L1_error:;
7546   __Pyx_XDECREF(__pyx_t_5);
7547   __Pyx_XDECREF(__pyx_t_6);
7548   __Pyx_XDECREF(__pyx_t_7);
7549   __Pyx_XDECREF(__pyx_t_8);
7550   __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
7551   __pyx_r = -1;
7552   __pyx_L0:;
7553   __Pyx_RefNannyFinishContext();
7554   return __pyx_r;
7555 }
7556 
7557 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1040
7558  *         raise ImportError("numpy.core.multiarray failed to import")
7559  *
7560  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
7561  *     try:
7562  *         _import_umath()
7563  */
7564 
__pyx_f_5numpy_import_umath(void)7565 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
7566   int __pyx_r;
7567   __Pyx_RefNannyDeclarations
7568   PyObject *__pyx_t_1 = NULL;
7569   PyObject *__pyx_t_2 = NULL;
7570   PyObject *__pyx_t_3 = NULL;
7571   int __pyx_t_4;
7572   PyObject *__pyx_t_5 = NULL;
7573   PyObject *__pyx_t_6 = NULL;
7574   PyObject *__pyx_t_7 = NULL;
7575   PyObject *__pyx_t_8 = NULL;
7576   __Pyx_RefNannySetupContext("import_umath", 0);
7577 
7578   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
7579  *
7580  * cdef inline int import_umath() except -1:
7581  *     try:             # <<<<<<<<<<<<<<
7582  *         _import_umath()
7583  *     except Exception:
7584  */
7585   {
7586     __Pyx_PyThreadState_declare
7587     __Pyx_PyThreadState_assign
7588     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
7589     __Pyx_XGOTREF(__pyx_t_1);
7590     __Pyx_XGOTREF(__pyx_t_2);
7591     __Pyx_XGOTREF(__pyx_t_3);
7592     /*try:*/ {
7593 
7594       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1042
7595  * cdef inline int import_umath() except -1:
7596  *     try:
7597  *         _import_umath()             # <<<<<<<<<<<<<<
7598  *     except Exception:
7599  *         raise ImportError("numpy.core.umath failed to import")
7600  */
7601       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1042, __pyx_L3_error)
7602 
7603       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
7604  *
7605  * cdef inline int import_umath() except -1:
7606  *     try:             # <<<<<<<<<<<<<<
7607  *         _import_umath()
7608  *     except Exception:
7609  */
7610     }
7611     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7612     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7613     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7614     goto __pyx_L8_try_end;
7615     __pyx_L3_error:;
7616 
7617     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1043
7618  *     try:
7619  *         _import_umath()
7620  *     except Exception:             # <<<<<<<<<<<<<<
7621  *         raise ImportError("numpy.core.umath failed to import")
7622  *
7623  */
7624     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7625     if (__pyx_t_4) {
7626       __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
7627       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1043, __pyx_L5_except_error)
7628       __Pyx_GOTREF(__pyx_t_5);
7629       __Pyx_GOTREF(__pyx_t_6);
7630       __Pyx_GOTREF(__pyx_t_7);
7631 
7632       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1044
7633  *         _import_umath()
7634  *     except Exception:
7635  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
7636  *
7637  * cdef inline int import_ufunc() except -1:
7638  */
7639       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1044, __pyx_L5_except_error)
7640       __Pyx_GOTREF(__pyx_t_8);
7641       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
7642       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7643       __PYX_ERR(1, 1044, __pyx_L5_except_error)
7644     }
7645     goto __pyx_L5_except_error;
7646     __pyx_L5_except_error:;
7647 
7648     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041
7649  *
7650  * cdef inline int import_umath() except -1:
7651  *     try:             # <<<<<<<<<<<<<<
7652  *         _import_umath()
7653  *     except Exception:
7654  */
7655     __Pyx_XGIVEREF(__pyx_t_1);
7656     __Pyx_XGIVEREF(__pyx_t_2);
7657     __Pyx_XGIVEREF(__pyx_t_3);
7658     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7659     goto __pyx_L1_error;
7660     __pyx_L8_try_end:;
7661   }
7662 
7663   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1040
7664  *         raise ImportError("numpy.core.multiarray failed to import")
7665  *
7666  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
7667  *     try:
7668  *         _import_umath()
7669  */
7670 
7671   /* function exit code */
7672   __pyx_r = 0;
7673   goto __pyx_L0;
7674   __pyx_L1_error:;
7675   __Pyx_XDECREF(__pyx_t_5);
7676   __Pyx_XDECREF(__pyx_t_6);
7677   __Pyx_XDECREF(__pyx_t_7);
7678   __Pyx_XDECREF(__pyx_t_8);
7679   __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
7680   __pyx_r = -1;
7681   __pyx_L0:;
7682   __Pyx_RefNannyFinishContext();
7683   return __pyx_r;
7684 }
7685 
7686 /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046
7687  *         raise ImportError("numpy.core.umath failed to import")
7688  *
7689  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
7690  *     try:
7691  *         _import_umath()
7692  */
7693 
__pyx_f_5numpy_import_ufunc(void)7694 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
7695   int __pyx_r;
7696   __Pyx_RefNannyDeclarations
7697   PyObject *__pyx_t_1 = NULL;
7698   PyObject *__pyx_t_2 = NULL;
7699   PyObject *__pyx_t_3 = NULL;
7700   int __pyx_t_4;
7701   PyObject *__pyx_t_5 = NULL;
7702   PyObject *__pyx_t_6 = NULL;
7703   PyObject *__pyx_t_7 = NULL;
7704   PyObject *__pyx_t_8 = NULL;
7705   __Pyx_RefNannySetupContext("import_ufunc", 0);
7706 
7707   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
7708  *
7709  * cdef inline int import_ufunc() except -1:
7710  *     try:             # <<<<<<<<<<<<<<
7711  *         _import_umath()
7712  *     except Exception:
7713  */
7714   {
7715     __Pyx_PyThreadState_declare
7716     __Pyx_PyThreadState_assign
7717     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
7718     __Pyx_XGOTREF(__pyx_t_1);
7719     __Pyx_XGOTREF(__pyx_t_2);
7720     __Pyx_XGOTREF(__pyx_t_3);
7721     /*try:*/ {
7722 
7723       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1048
7724  * cdef inline int import_ufunc() except -1:
7725  *     try:
7726  *         _import_umath()             # <<<<<<<<<<<<<<
7727  *     except Exception:
7728  *         raise ImportError("numpy.core.umath failed to import")
7729  */
7730       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1048, __pyx_L3_error)
7731 
7732       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
7733  *
7734  * cdef inline int import_ufunc() except -1:
7735  *     try:             # <<<<<<<<<<<<<<
7736  *         _import_umath()
7737  *     except Exception:
7738  */
7739     }
7740     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7741     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7742     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7743     goto __pyx_L8_try_end;
7744     __pyx_L3_error:;
7745 
7746     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1049
7747  *     try:
7748  *         _import_umath()
7749  *     except Exception:             # <<<<<<<<<<<<<<
7750  *         raise ImportError("numpy.core.umath failed to import")
7751  */
7752     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7753     if (__pyx_t_4) {
7754       __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
7755       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1049, __pyx_L5_except_error)
7756       __Pyx_GOTREF(__pyx_t_5);
7757       __Pyx_GOTREF(__pyx_t_6);
7758       __Pyx_GOTREF(__pyx_t_7);
7759 
7760       /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1050
7761  *         _import_umath()
7762  *     except Exception:
7763  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
7764  */
7765       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1050, __pyx_L5_except_error)
7766       __Pyx_GOTREF(__pyx_t_8);
7767       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
7768       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7769       __PYX_ERR(1, 1050, __pyx_L5_except_error)
7770     }
7771     goto __pyx_L5_except_error;
7772     __pyx_L5_except_error:;
7773 
7774     /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047
7775  *
7776  * cdef inline int import_ufunc() except -1:
7777  *     try:             # <<<<<<<<<<<<<<
7778  *         _import_umath()
7779  *     except Exception:
7780  */
7781     __Pyx_XGIVEREF(__pyx_t_1);
7782     __Pyx_XGIVEREF(__pyx_t_2);
7783     __Pyx_XGIVEREF(__pyx_t_3);
7784     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7785     goto __pyx_L1_error;
7786     __pyx_L8_try_end:;
7787   }
7788 
7789   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046
7790  *         raise ImportError("numpy.core.umath failed to import")
7791  *
7792  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
7793  *     try:
7794  *         _import_umath()
7795  */
7796 
7797   /* function exit code */
7798   __pyx_r = 0;
7799   goto __pyx_L0;
7800   __pyx_L1_error:;
7801   __Pyx_XDECREF(__pyx_t_5);
7802   __Pyx_XDECREF(__pyx_t_6);
7803   __Pyx_XDECREF(__pyx_t_7);
7804   __Pyx_XDECREF(__pyx_t_8);
7805   __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
7806   __pyx_r = -1;
7807   __pyx_L0:;
7808   __Pyx_RefNannyFinishContext();
7809   return __pyx_r;
7810 }
7811 
7812 /* "vec3_ops.pxd":9
7813  * @cython.wraparound(False)
7814  * @cython.cdivision(True)
7815  * cdef inline cython.floating dot(const cython.floating[3] a,             # <<<<<<<<<<<<<<
7816  *                                 const cython.floating[3] b) nogil:
7817  *     return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]
7818  */
7819 
__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(float * __pyx_v_a,float * __pyx_v_b)7820 static CYTHON_INLINE float __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(float *__pyx_v_a, float *__pyx_v_b) {
7821   float __pyx_r;
7822 
7823   /* "vec3_ops.pxd":11
7824  * cdef inline cython.floating dot(const cython.floating[3] a,
7825  *                                 const cython.floating[3] b) nogil:
7826  *     return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]             # <<<<<<<<<<<<<<
7827  *
7828  *
7829  */
7830   __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])));
7831   goto __pyx_L0;
7832 
7833   /* "vec3_ops.pxd":9
7834  * @cython.wraparound(False)
7835  * @cython.cdivision(True)
7836  * cdef inline cython.floating dot(const cython.floating[3] a,             # <<<<<<<<<<<<<<
7837  *                                 const cython.floating[3] b) nogil:
7838  *     return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]
7839  */
7840 
7841   /* function exit code */
7842   __pyx_L0:;
7843   return __pyx_r;
7844 }
7845 
__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(double * __pyx_v_a,double * __pyx_v_b)7846 static CYTHON_INLINE double __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_dot(double *__pyx_v_a, double *__pyx_v_b) {
7847   double __pyx_r;
7848 
7849   /* "vec3_ops.pxd":11
7850  * cdef inline cython.floating dot(const cython.floating[3] a,
7851  *                                 const cython.floating[3] b) nogil:
7852  *     return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]             # <<<<<<<<<<<<<<
7853  *
7854  *
7855  */
7856   __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])));
7857   goto __pyx_L0;
7858 
7859   /* "vec3_ops.pxd":9
7860  * @cython.wraparound(False)
7861  * @cython.cdivision(True)
7862  * cdef inline cython.floating dot(const cython.floating[3] a,             # <<<<<<<<<<<<<<
7863  *                                 const cython.floating[3] b) nogil:
7864  *     return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]
7865  */
7866 
7867   /* function exit code */
7868   __pyx_L0:;
7869   return __pyx_r;
7870 }
7871 
7872 /* "vec3_ops.pxd":17
7873  * @cython.wraparound(False)
7874  * @cython.cdivision(True)
7875  * cdef inline void cross(const cython.floating[3] a,             # <<<<<<<<<<<<<<
7876  *                        const cython.floating[3] b,
7877  *                        cython.floating c[3]) nogil:
7878  */
7879 
__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_cross(float * __pyx_v_a,float * __pyx_v_b,float * __pyx_v_c)7880 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) {
7881 
7882   /* "vec3_ops.pxd":20
7883  *                        const cython.floating[3] b,
7884  *                        cython.floating c[3]) nogil:
7885  *     c[0] = a[1]*b[2] - a[2]*b[1]             # <<<<<<<<<<<<<<
7886  *     c[1] = a[2]*b[0] - a[0]*b[2]
7887  *     c[2] = a[0]*b[1] - a[1]*b[0]
7888  */
7889   (__pyx_v_c[0]) = (((__pyx_v_a[1]) * (__pyx_v_b[2])) - ((__pyx_v_a[2]) * (__pyx_v_b[1])));
7890 
7891   /* "vec3_ops.pxd":21
7892  *                        cython.floating c[3]) nogil:
7893  *     c[0] = a[1]*b[2] - a[2]*b[1]
7894  *     c[1] = a[2]*b[0] - a[0]*b[2]             # <<<<<<<<<<<<<<
7895  *     c[2] = a[0]*b[1] - a[1]*b[0]
7896  *
7897  */
7898   (__pyx_v_c[1]) = (((__pyx_v_a[2]) * (__pyx_v_b[0])) - ((__pyx_v_a[0]) * (__pyx_v_b[2])));
7899 
7900   /* "vec3_ops.pxd":22
7901  *     c[0] = a[1]*b[2] - a[2]*b[1]
7902  *     c[1] = a[2]*b[0] - a[0]*b[2]
7903  *     c[2] = a[0]*b[1] - a[1]*b[0]             # <<<<<<<<<<<<<<
7904  *
7905  *
7906  */
7907   (__pyx_v_c[2]) = (((__pyx_v_a[0]) * (__pyx_v_b[1])) - ((__pyx_v_a[1]) * (__pyx_v_b[0])));
7908 
7909   /* "vec3_ops.pxd":17
7910  * @cython.wraparound(False)
7911  * @cython.cdivision(True)
7912  * cdef inline void cross(const cython.floating[3] a,             # <<<<<<<<<<<<<<
7913  *                        const cython.floating[3] b,
7914  *                        cython.floating c[3]) nogil:
7915  */
7916 
7917   /* function exit code */
7918 }
7919 
__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_cross(double * __pyx_v_a,double * __pyx_v_b,double * __pyx_v_c)7920 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) {
7921 
7922   /* "vec3_ops.pxd":20
7923  *                        const cython.floating[3] b,
7924  *                        cython.floating c[3]) nogil:
7925  *     c[0] = a[1]*b[2] - a[2]*b[1]             # <<<<<<<<<<<<<<
7926  *     c[1] = a[2]*b[0] - a[0]*b[2]
7927  *     c[2] = a[0]*b[1] - a[1]*b[0]
7928  */
7929   (__pyx_v_c[0]) = (((__pyx_v_a[1]) * (__pyx_v_b[2])) - ((__pyx_v_a[2]) * (__pyx_v_b[1])));
7930 
7931   /* "vec3_ops.pxd":21
7932  *                        cython.floating c[3]) nogil:
7933  *     c[0] = a[1]*b[2] - a[2]*b[1]
7934  *     c[1] = a[2]*b[0] - a[0]*b[2]             # <<<<<<<<<<<<<<
7935  *     c[2] = a[0]*b[1] - a[1]*b[0]
7936  *
7937  */
7938   (__pyx_v_c[1]) = (((__pyx_v_a[2]) * (__pyx_v_b[0])) - ((__pyx_v_a[0]) * (__pyx_v_b[2])));
7939 
7940   /* "vec3_ops.pxd":22
7941  *     c[0] = a[1]*b[2] - a[2]*b[1]
7942  *     c[1] = a[2]*b[0] - a[0]*b[2]
7943  *     c[2] = a[0]*b[1] - a[1]*b[0]             # <<<<<<<<<<<<<<
7944  *
7945  *
7946  */
7947   (__pyx_v_c[2]) = (((__pyx_v_a[0]) * (__pyx_v_b[1])) - ((__pyx_v_a[1]) * (__pyx_v_b[0])));
7948 
7949   /* "vec3_ops.pxd":17
7950  * @cython.wraparound(False)
7951  * @cython.cdivision(True)
7952  * cdef inline void cross(const cython.floating[3] a,             # <<<<<<<<<<<<<<
7953  *                        const cython.floating[3] b,
7954  *                        cython.floating c[3]) nogil:
7955  */
7956 
7957   /* function exit code */
7958 }
7959 
7960 /* "vec3_ops.pxd":28
7961  * @cython.wraparound(False)
7962  * @cython.cdivision(True)
7963  * cdef inline void subtract(const cython.floating[3] a,             # <<<<<<<<<<<<<<
7964  *                           const cython.floating[3] b,
7965  *                           cython.floating c[3]) nogil:
7966  */
7967 
__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_subtract(float * __pyx_v_a,float * __pyx_v_b,float * __pyx_v_c)7968 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) {
7969 
7970   /* "vec3_ops.pxd":31
7971  *                           const cython.floating[3] b,
7972  *                           cython.floating c[3]) nogil:
7973  *     c[0] = a[0] - b[0]             # <<<<<<<<<<<<<<
7974  *     c[1] = a[1] - b[1]
7975  *     c[2] = a[2] - b[2]
7976  */
7977   (__pyx_v_c[0]) = ((__pyx_v_a[0]) - (__pyx_v_b[0]));
7978 
7979   /* "vec3_ops.pxd":32
7980  *                           cython.floating c[3]) nogil:
7981  *     c[0] = a[0] - b[0]
7982  *     c[1] = a[1] - b[1]             # <<<<<<<<<<<<<<
7983  *     c[2] = a[2] - b[2]
7984  *
7985  */
7986   (__pyx_v_c[1]) = ((__pyx_v_a[1]) - (__pyx_v_b[1]));
7987 
7988   /* "vec3_ops.pxd":33
7989  *     c[0] = a[0] - b[0]
7990  *     c[1] = a[1] - b[1]
7991  *     c[2] = a[2] - b[2]             # <<<<<<<<<<<<<<
7992  *
7993  *
7994  */
7995   (__pyx_v_c[2]) = ((__pyx_v_a[2]) - (__pyx_v_b[2]));
7996 
7997   /* "vec3_ops.pxd":28
7998  * @cython.wraparound(False)
7999  * @cython.cdivision(True)
8000  * cdef inline void subtract(const cython.floating[3] a,             # <<<<<<<<<<<<<<
8001  *                           const cython.floating[3] b,
8002  *                           cython.floating c[3]) nogil:
8003  */
8004 
8005   /* function exit code */
8006 }
8007 
__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_subtract(double * __pyx_v_a,double * __pyx_v_b,double * __pyx_v_c)8008 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) {
8009 
8010   /* "vec3_ops.pxd":31
8011  *                           const cython.floating[3] b,
8012  *                           cython.floating c[3]) nogil:
8013  *     c[0] = a[0] - b[0]             # <<<<<<<<<<<<<<
8014  *     c[1] = a[1] - b[1]
8015  *     c[2] = a[2] - b[2]
8016  */
8017   (__pyx_v_c[0]) = ((__pyx_v_a[0]) - (__pyx_v_b[0]));
8018 
8019   /* "vec3_ops.pxd":32
8020  *                           cython.floating c[3]) nogil:
8021  *     c[0] = a[0] - b[0]
8022  *     c[1] = a[1] - b[1]             # <<<<<<<<<<<<<<
8023  *     c[2] = a[2] - b[2]
8024  *
8025  */
8026   (__pyx_v_c[1]) = ((__pyx_v_a[1]) - (__pyx_v_b[1]));
8027 
8028   /* "vec3_ops.pxd":33
8029  *     c[0] = a[0] - b[0]
8030  *     c[1] = a[1] - b[1]
8031  *     c[2] = a[2] - b[2]             # <<<<<<<<<<<<<<
8032  *
8033  *
8034  */
8035   (__pyx_v_c[2]) = ((__pyx_v_a[2]) - (__pyx_v_b[2]));
8036 
8037   /* "vec3_ops.pxd":28
8038  * @cython.wraparound(False)
8039  * @cython.cdivision(True)
8040  * cdef inline void subtract(const cython.floating[3] a,             # <<<<<<<<<<<<<<
8041  *                           const cython.floating[3] b,
8042  *                           cython.floating c[3]) nogil:
8043  */
8044 
8045   /* function exit code */
8046 }
8047 
8048 /* "vec3_ops.pxd":39
8049  * @cython.wraparound(False)
8050  * @cython.cdivision(True)
8051  * cdef inline cython.floating distance(const cython.floating[3] a,             # <<<<<<<<<<<<<<
8052  *                                      const cython.floating[3] b) nogil:
8053  *     return sqrt((a[0] - b[0])**2 + (a[1] - b[1])**2 +(a[2] - b[2])**2)
8054  */
8055 
__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_distance(float * __pyx_v_a,float * __pyx_v_b)8056 static CYTHON_INLINE float __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_distance(float *__pyx_v_a, float *__pyx_v_b) {
8057   float __pyx_r;
8058 
8059   /* "vec3_ops.pxd":41
8060  * cdef inline cython.floating distance(const cython.floating[3] a,
8061  *                                      const cython.floating[3] b) nogil:
8062  *     return sqrt((a[0] - b[0])**2 + (a[1] - b[1])**2 +(a[2] - b[2])**2)             # <<<<<<<<<<<<<<
8063  *
8064  *
8065  */
8066   __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)));
8067   goto __pyx_L0;
8068 
8069   /* "vec3_ops.pxd":39
8070  * @cython.wraparound(False)
8071  * @cython.cdivision(True)
8072  * cdef inline cython.floating distance(const cython.floating[3] a,             # <<<<<<<<<<<<<<
8073  *                                      const cython.floating[3] b) nogil:
8074  *     return sqrt((a[0] - b[0])**2 + (a[1] - b[1])**2 +(a[2] - b[2])**2)
8075  */
8076 
8077   /* function exit code */
8078   __pyx_L0:;
8079   return __pyx_r;
8080 }
8081 
__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_distance(double * __pyx_v_a,double * __pyx_v_b)8082 static CYTHON_INLINE double __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_distance(double *__pyx_v_a, double *__pyx_v_b) {
8083   double __pyx_r;
8084 
8085   /* "vec3_ops.pxd":41
8086  * cdef inline cython.floating distance(const cython.floating[3] a,
8087  *                                      const cython.floating[3] b) nogil:
8088  *     return sqrt((a[0] - b[0])**2 + (a[1] - b[1])**2 +(a[2] - b[2])**2)             # <<<<<<<<<<<<<<
8089  *
8090  *
8091  */
8092   __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)));
8093   goto __pyx_L0;
8094 
8095   /* "vec3_ops.pxd":39
8096  * @cython.wraparound(False)
8097  * @cython.cdivision(True)
8098  * cdef inline cython.floating distance(const cython.floating[3] a,             # <<<<<<<<<<<<<<
8099  *                                      const cython.floating[3] b) nogil:
8100  *     return sqrt((a[0] - b[0])**2 + (a[1] - b[1])**2 +(a[2] - b[2])**2)
8101  */
8102 
8103   /* function exit code */
8104   __pyx_L0:;
8105   return __pyx_r;
8106 }
8107 
8108 /* "vec3_ops.pxd":47
8109  * @cython.wraparound(False)
8110  * @cython.cdivision(True)
8111  * cdef inline void fma(const cython.floating f,             # <<<<<<<<<<<<<<
8112  *                      const cython.floating[3] a,
8113  *                      const cython.floating[3] b,
8114  */
8115 
__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)8116 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) {
8117 
8118   /* "vec3_ops.pxd":51
8119  *                      const cython.floating[3] b,
8120  *                      cython.floating[3] c) nogil:
8121  *     c[0] = f * a[0] + b[0]             # <<<<<<<<<<<<<<
8122  *     c[1] = f * a[1] + b[1]
8123  *     c[2] = f * a[2] + b[2]
8124  */
8125   (__pyx_v_c[0]) = ((__pyx_v_f * (__pyx_v_a[0])) + (__pyx_v_b[0]));
8126 
8127   /* "vec3_ops.pxd":52
8128  *                      cython.floating[3] c) nogil:
8129  *     c[0] = f * a[0] + b[0]
8130  *     c[1] = f * a[1] + b[1]             # <<<<<<<<<<<<<<
8131  *     c[2] = f * a[2] + b[2]
8132  *
8133  */
8134   (__pyx_v_c[1]) = ((__pyx_v_f * (__pyx_v_a[1])) + (__pyx_v_b[1]));
8135 
8136   /* "vec3_ops.pxd":53
8137  *     c[0] = f * a[0] + b[0]
8138  *     c[1] = f * a[1] + b[1]
8139  *     c[2] = f * a[2] + b[2]             # <<<<<<<<<<<<<<
8140  *
8141  *
8142  */
8143   (__pyx_v_c[2]) = ((__pyx_v_f * (__pyx_v_a[2])) + (__pyx_v_b[2]));
8144 
8145   /* "vec3_ops.pxd":47
8146  * @cython.wraparound(False)
8147  * @cython.cdivision(True)
8148  * cdef inline void fma(const cython.floating f,             # <<<<<<<<<<<<<<
8149  *                      const cython.floating[3] a,
8150  *                      const cython.floating[3] b,
8151  */
8152 
8153   /* function exit code */
8154 }
8155 
__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)8156 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) {
8157 
8158   /* "vec3_ops.pxd":51
8159  *                      const cython.floating[3] b,
8160  *                      cython.floating[3] c) nogil:
8161  *     c[0] = f * a[0] + b[0]             # <<<<<<<<<<<<<<
8162  *     c[1] = f * a[1] + b[1]
8163  *     c[2] = f * a[2] + b[2]
8164  */
8165   (__pyx_v_c[0]) = ((__pyx_v_f * (__pyx_v_a[0])) + (__pyx_v_b[0]));
8166 
8167   /* "vec3_ops.pxd":52
8168  *                      cython.floating[3] c) nogil:
8169  *     c[0] = f * a[0] + b[0]
8170  *     c[1] = f * a[1] + b[1]             # <<<<<<<<<<<<<<
8171  *     c[2] = f * a[2] + b[2]
8172  *
8173  */
8174   (__pyx_v_c[1]) = ((__pyx_v_f * (__pyx_v_a[1])) + (__pyx_v_b[1]));
8175 
8176   /* "vec3_ops.pxd":53
8177  *     c[0] = f * a[0] + b[0]
8178  *     c[1] = f * a[1] + b[1]
8179  *     c[2] = f * a[2] + b[2]             # <<<<<<<<<<<<<<
8180  *
8181  *
8182  */
8183   (__pyx_v_c[2]) = ((__pyx_v_f * (__pyx_v_a[2])) + (__pyx_v_b[2]));
8184 
8185   /* "vec3_ops.pxd":47
8186  * @cython.wraparound(False)
8187  * @cython.cdivision(True)
8188  * cdef inline void fma(const cython.floating f,             # <<<<<<<<<<<<<<
8189  *                      const cython.floating[3] a,
8190  *                      const cython.floating[3] b,
8191  */
8192 
8193   /* function exit code */
8194 }
8195 
8196 /* "vec3_ops.pxd":59
8197  * @cython.wraparound(False)
8198  * @cython.cdivision(True)
8199  * cdef inline cython.floating L2_norm(const cython.floating[3] a) nogil:             # <<<<<<<<<<<<<<
8200  *     return sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2])
8201  */
8202 
__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_L2_norm(float * __pyx_v_a)8203 static CYTHON_INLINE float __pyx_fuse_0__pyx_f_2yt_9utilities_3lib_8vec3_ops_L2_norm(float *__pyx_v_a) {
8204   float __pyx_r;
8205 
8206   /* "vec3_ops.pxd":60
8207  * @cython.cdivision(True)
8208  * cdef inline cython.floating L2_norm(const cython.floating[3] a) nogil:
8209  *     return sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2])             # <<<<<<<<<<<<<<
8210  */
8211   __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]))));
8212   goto __pyx_L0;
8213 
8214   /* "vec3_ops.pxd":59
8215  * @cython.wraparound(False)
8216  * @cython.cdivision(True)
8217  * cdef inline cython.floating L2_norm(const cython.floating[3] a) nogil:             # <<<<<<<<<<<<<<
8218  *     return sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2])
8219  */
8220 
8221   /* function exit code */
8222   __pyx_L0:;
8223   return __pyx_r;
8224 }
8225 
__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_L2_norm(double * __pyx_v_a)8226 static CYTHON_INLINE double __pyx_fuse_1__pyx_f_2yt_9utilities_3lib_8vec3_ops_L2_norm(double *__pyx_v_a) {
8227   double __pyx_r;
8228 
8229   /* "vec3_ops.pxd":60
8230  * @cython.cdivision(True)
8231  * cdef inline cython.floating L2_norm(const cython.floating[3] a) nogil:
8232  *     return sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2])             # <<<<<<<<<<<<<<
8233  */
8234   __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]))));
8235   goto __pyx_L0;
8236 
8237   /* "vec3_ops.pxd":59
8238  * @cython.wraparound(False)
8239  * @cython.cdivision(True)
8240  * cdef inline cython.floating L2_norm(const cython.floating[3] a) nogil:             # <<<<<<<<<<<<<<
8241  *     return sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2])
8242  */
8243 
8244   /* function exit code */
8245   __pyx_L0:;
8246   return __pyx_r;
8247 }
8248 
8249 static PyMethodDef __pyx_methods[] = {
8250   {0, 0, 0, 0}
8251 };
8252 
8253 #if PY_MAJOR_VERSION >= 3
8254 #if CYTHON_PEP489_MULTI_PHASE_INIT
8255 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
8256 static int __pyx_pymod_exec_primitives(PyObject* module); /*proto*/
8257 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
8258   {Py_mod_create, (void*)__pyx_pymod_create},
8259   {Py_mod_exec, (void*)__pyx_pymod_exec_primitives},
8260   {0, NULL}
8261 };
8262 #endif
8263 
8264 static struct PyModuleDef __pyx_moduledef = {
8265     PyModuleDef_HEAD_INIT,
8266     "primitives",
8267     __pyx_k_This_file_contains_definitions, /* m_doc */
8268   #if CYTHON_PEP489_MULTI_PHASE_INIT
8269     0, /* m_size */
8270   #else
8271     -1, /* m_size */
8272   #endif
8273     __pyx_methods /* m_methods */,
8274   #if CYTHON_PEP489_MULTI_PHASE_INIT
8275     __pyx_moduledef_slots, /* m_slots */
8276   #else
8277     NULL, /* m_reload */
8278   #endif
8279     NULL, /* m_traverse */
8280     NULL, /* m_clear */
8281     NULL /* m_free */
8282 };
8283 #endif
8284 #ifndef CYTHON_SMALL_CODE
8285 #if defined(__clang__)
8286     #define CYTHON_SMALL_CODE
8287 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
8288     #define CYTHON_SMALL_CODE __attribute__((cold))
8289 #else
8290     #define CYTHON_SMALL_CODE
8291 #endif
8292 #endif
8293 
8294 static __Pyx_StringTabEntry __pyx_string_tab[] = {
8295   {&__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},
8296   {&__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},
8297   {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
8298   {&__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},
8299   {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
8300   {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
8301   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
8302   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
8303   {&__pyx_n_s_inf, __pyx_k_inf, sizeof(__pyx_k_inf), 0, 0, 1, 1},
8304   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
8305   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
8306   {&__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},
8307   {&__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},
8308   {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
8309   {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
8310   {&__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},
8311   {&__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},
8312   {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
8313   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
8314   {&__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},
8315   {0, 0, 0, 0, 0, 0, 0}
8316 };
__Pyx_InitCachedBuiltins(void)8317 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
8318   __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 51, __pyx_L1_error)
8319   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 272, __pyx_L1_error)
8320   __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 856, __pyx_L1_error)
8321   __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 1038, __pyx_L1_error)
8322   return 0;
8323   __pyx_L1_error:;
8324   return -1;
8325 }
8326 
__Pyx_InitCachedConstants(void)8327 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
8328   __Pyx_RefNannyDeclarations
8329   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
8330 
8331   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272
8332  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
8333  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
8334  *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
8335  *
8336  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
8337  */
8338   __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 272, __pyx_L1_error)
8339   __Pyx_GOTREF(__pyx_tuple_);
8340   __Pyx_GIVEREF(__pyx_tuple_);
8341 
8342   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276
8343  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
8344  *                 and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
8345  *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
8346  *
8347  *             info.buf = PyArray_DATA(self)
8348  */
8349   __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 276, __pyx_L1_error)
8350   __Pyx_GOTREF(__pyx_tuple__2);
8351   __Pyx_GIVEREF(__pyx_tuple__2);
8352 
8353   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":306
8354  *                 if ((descr.byteorder == c'>' and little_endian) or
8355  *                     (descr.byteorder == c'<' and not little_endian)):
8356  *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
8357  *                 if   t == NPY_BYTE:        f = "b"
8358  *                 elif t == NPY_UBYTE:       f = "B"
8359  */
8360   __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 306, __pyx_L1_error)
8361   __Pyx_GOTREF(__pyx_tuple__3);
8362   __Pyx_GIVEREF(__pyx_tuple__3);
8363 
8364   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856
8365  *
8366  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
8367  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
8368  *
8369  *         if ((child.byteorder == c'>' and little_endian) or
8370  */
8371   __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 856, __pyx_L1_error)
8372   __Pyx_GOTREF(__pyx_tuple__4);
8373   __Pyx_GIVEREF(__pyx_tuple__4);
8374 
8375   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":880
8376  *             t = child.type_num
8377  *             if end - f < 5:
8378  *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
8379  *
8380  *             # Until ticket #99 is fixed, use integers to avoid warnings
8381  */
8382   __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 880, __pyx_L1_error)
8383   __Pyx_GOTREF(__pyx_tuple__5);
8384   __Pyx_GIVEREF(__pyx_tuple__5);
8385 
8386   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1038
8387  *         _import_array()
8388  *     except Exception:
8389  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
8390  *
8391  * cdef inline int import_umath() except -1:
8392  */
8393   __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 1038, __pyx_L1_error)
8394   __Pyx_GOTREF(__pyx_tuple__6);
8395   __Pyx_GIVEREF(__pyx_tuple__6);
8396 
8397   /* "../../../.local/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1044
8398  *         _import_umath()
8399  *     except Exception:
8400  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
8401  *
8402  * cdef inline int import_ufunc() except -1:
8403  */
8404   __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 1044, __pyx_L1_error)
8405   __Pyx_GOTREF(__pyx_tuple__7);
8406   __Pyx_GIVEREF(__pyx_tuple__7);
8407   __Pyx_RefNannyFinishContext();
8408   return 0;
8409   __pyx_L1_error:;
8410   __Pyx_RefNannyFinishContext();
8411   return -1;
8412 }
8413 
__Pyx_InitGlobals(void)8414 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
8415   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
8416   return 0;
8417   __pyx_L1_error:;
8418   return -1;
8419 }
8420 
8421 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
8422 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
8423 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
8424 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
8425 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
8426 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
8427 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
8428 
__Pyx_modinit_global_init_code(void)8429 static int __Pyx_modinit_global_init_code(void) {
8430   __Pyx_RefNannyDeclarations
8431   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
8432   /*--- Global init code ---*/
8433   __Pyx_RefNannyFinishContext();
8434   return 0;
8435 }
8436 
__Pyx_modinit_variable_export_code(void)8437 static int __Pyx_modinit_variable_export_code(void) {
8438   __Pyx_RefNannyDeclarations
8439   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
8440   /*--- Variable export code ---*/
8441   __Pyx_RefNannyFinishContext();
8442   return 0;
8443 }
8444 
__Pyx_modinit_function_export_code(void)8445 static int __Pyx_modinit_function_export_code(void) {
8446   __Pyx_RefNannyDeclarations
8447   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
8448   /*--- Function export code ---*/
8449   if (__Pyx_ExportFunction("ray_bbox_intersect", (void (*)(void))__pyx_f_2yt_9utilities_3lib_10primitives_ray_bbox_intersect, "__pyx_t_5numpy_int64_t (struct __pyx_t_2yt_9utilities_3lib_10primitives_Ray *, struct __pyx_t_2yt_9utilities_3lib_10primitives_BBox const )") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8450   if (__Pyx_ExportFunction("ray_triangle_intersect", (void (*)(void))__pyx_f_2yt_9utilities_3lib_10primitives_ray_triangle_intersect, "__pyx_t_5numpy_int64_t (void const *, __pyx_t_5numpy_int64_t const , struct __pyx_t_2yt_9utilities_3lib_10primitives_Ray *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8451   if (__Pyx_ExportFunction("triangle_centroid", (void (*)(void))__pyx_f_2yt_9utilities_3lib_10primitives_triangle_centroid, "void (void const *, __pyx_t_5numpy_int64_t const , __pyx_t_5numpy_float64_t *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8452   if (__Pyx_ExportFunction("triangle_bbox", (void (*)(void))__pyx_f_2yt_9utilities_3lib_10primitives_triangle_bbox, "void (void const *, __pyx_t_5numpy_int64_t const , struct __pyx_t_2yt_9utilities_3lib_10primitives_BBox *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8453   if (__Pyx_ExportFunction("ray_patch_intersect", (void (*)(void))__pyx_f_2yt_9utilities_3lib_10primitives_ray_patch_intersect, "__pyx_t_5numpy_int64_t (void const *, __pyx_t_5numpy_int64_t const , struct __pyx_t_2yt_9utilities_3lib_10primitives_Ray *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8454   if (__Pyx_ExportFunction("patch_centroid", (void (*)(void))__pyx_f_2yt_9utilities_3lib_10primitives_patch_centroid, "void (void const *, __pyx_t_5numpy_int64_t const , __pyx_t_5numpy_float64_t *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8455   if (__Pyx_ExportFunction("patch_bbox", (void (*)(void))__pyx_f_2yt_9utilities_3lib_10primitives_patch_bbox, "void (void const *, __pyx_t_5numpy_int64_t const , struct __pyx_t_2yt_9utilities_3lib_10primitives_BBox *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8456   if (__Pyx_ExportFunction("ray_tet_patch_intersect", (void (*)(void))__pyx_f_2yt_9utilities_3lib_10primitives_ray_tet_patch_intersect, "__pyx_t_5numpy_int64_t (void const *, __pyx_t_5numpy_int64_t const , struct __pyx_t_2yt_9utilities_3lib_10primitives_Ray *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8457   if (__Pyx_ExportFunction("tet_patch_centroid", (void (*)(void))__pyx_f_2yt_9utilities_3lib_10primitives_tet_patch_centroid, "void (void const *, __pyx_t_5numpy_int64_t const , __pyx_t_5numpy_float64_t *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8458   if (__Pyx_ExportFunction("tet_patch_bbox", (void (*)(void))__pyx_f_2yt_9utilities_3lib_10primitives_tet_patch_bbox, "void (void const *, __pyx_t_5numpy_int64_t const , struct __pyx_t_2yt_9utilities_3lib_10primitives_BBox *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8459   if (__Pyx_ExportFunction("__pyx_fuse_0patchSurfaceFunc", (void (*)(void))__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceFunc, "void (float (*)[3], float const , float const , float *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8460   if (__Pyx_ExportFunction("__pyx_fuse_1patchSurfaceFunc", (void (*)(void))__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceFunc, "void (double (*)[3], double const , double const , double *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8461   if (__Pyx_ExportFunction("__pyx_fuse_0patchSurfaceDerivU", (void (*)(void))__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceDerivU, "void (float (*)[3], float const , float const , float *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8462   if (__Pyx_ExportFunction("__pyx_fuse_1patchSurfaceDerivU", (void (*)(void))__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceDerivU, "void (double (*)[3], double const , double const , double *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8463   if (__Pyx_ExportFunction("__pyx_fuse_0patchSurfaceDerivV", (void (*)(void))__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceDerivV, "void (float (*)[3], float const , float const , float *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8464   if (__Pyx_ExportFunction("__pyx_fuse_1patchSurfaceDerivV", (void (*)(void))__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_patchSurfaceDerivV, "void (double (*)[3], double const , double const , double *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8465   if (__Pyx_ExportFunction("__pyx_fuse_0compute_patch_hit", (void (*)(void))__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_compute_patch_hit, "struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData (float (*)[3], float *, float *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8466   if (__Pyx_ExportFunction("__pyx_fuse_1compute_patch_hit", (void (*)(void))__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_compute_patch_hit, "struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData (double (*)[3], double *, double *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8467   if (__Pyx_ExportFunction("__pyx_fuse_0compute_tet_patch_hit", (void (*)(void))__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_compute_tet_patch_hit, "struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData (float (*)[3], float *, float *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8468   if (__Pyx_ExportFunction("__pyx_fuse_1compute_tet_patch_hit", (void (*)(void))__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_compute_tet_patch_hit, "struct __pyx_t_2yt_9utilities_3lib_10primitives_RayHitData (double (*)[3], double *, double *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8469   if (__Pyx_ExportFunction("__pyx_fuse_0tet_patchSurfaceFunc", (void (*)(void))__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceFunc, "void (float (*)[3], float const , float const , float *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8470   if (__Pyx_ExportFunction("__pyx_fuse_1tet_patchSurfaceFunc", (void (*)(void))__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceFunc, "void (double (*)[3], double const , double const , double *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8471   if (__Pyx_ExportFunction("__pyx_fuse_0tet_patchSurfaceDerivU", (void (*)(void))__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceDerivU, "void (float (*)[3], float const , float const , float *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8472   if (__Pyx_ExportFunction("__pyx_fuse_1tet_patchSurfaceDerivU", (void (*)(void))__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceDerivU, "void (double (*)[3], double const , double const , double *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8473   if (__Pyx_ExportFunction("__pyx_fuse_0tet_patchSurfaceDerivV", (void (*)(void))__pyx_fuse_0__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceDerivV, "void (float (*)[3], float const , float const , float *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8474   if (__Pyx_ExportFunction("__pyx_fuse_1tet_patchSurfaceDerivV", (void (*)(void))__pyx_fuse_1__pyx_f_2yt_9utilities_3lib_10primitives_tet_patchSurfaceDerivV, "void (double (*)[3], double const , double const , double *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8475   __Pyx_RefNannyFinishContext();
8476   return 0;
8477   __pyx_L1_error:;
8478   __Pyx_RefNannyFinishContext();
8479   return -1;
8480 }
8481 
__Pyx_modinit_type_init_code(void)8482 static int __Pyx_modinit_type_init_code(void) {
8483   __Pyx_RefNannyDeclarations
8484   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
8485   /*--- Type init code ---*/
8486   __Pyx_RefNannyFinishContext();
8487   return 0;
8488 }
8489 
__Pyx_modinit_type_import_code(void)8490 static int __Pyx_modinit_type_import_code(void) {
8491   __Pyx_RefNannyDeclarations
8492   PyObject *__pyx_t_1 = NULL;
8493   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
8494   /*--- Type import code ---*/
8495   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
8496   __Pyx_GOTREF(__pyx_t_1);
8497   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
8498   #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
8499   sizeof(PyTypeObject),
8500   #else
8501   sizeof(PyHeapTypeObject),
8502   #endif
8503   __Pyx_ImportType_CheckSize_Warn);
8504    if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
8505   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8506   __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 206, __pyx_L1_error)
8507   __Pyx_GOTREF(__pyx_t_1);
8508   __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
8509    if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 206, __pyx_L1_error)
8510   __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn);
8511    if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 229, __pyx_L1_error)
8512   __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn);
8513    if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 233, __pyx_L1_error)
8514   __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
8515    if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 242, __pyx_L1_error)
8516   __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn);
8517    if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 918, __pyx_L1_error)
8518   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8519   __Pyx_RefNannyFinishContext();
8520   return 0;
8521   __pyx_L1_error:;
8522   __Pyx_XDECREF(__pyx_t_1);
8523   __Pyx_RefNannyFinishContext();
8524   return -1;
8525 }
8526 
__Pyx_modinit_variable_import_code(void)8527 static int __Pyx_modinit_variable_import_code(void) {
8528   __Pyx_RefNannyDeclarations
8529   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
8530   /*--- Variable import code ---*/
8531   __Pyx_RefNannyFinishContext();
8532   return 0;
8533 }
8534 
__Pyx_modinit_function_import_code(void)8535 static int __Pyx_modinit_function_import_code(void) {
8536   __Pyx_RefNannyDeclarations
8537   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
8538   /*--- Function import code ---*/
8539   __Pyx_RefNannyFinishContext();
8540   return 0;
8541 }
8542 
8543 
8544 #if PY_MAJOR_VERSION < 3
8545 #ifdef CYTHON_NO_PYINIT_EXPORT
8546 #define __Pyx_PyMODINIT_FUNC void
8547 #else
8548 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
8549 #endif
8550 #else
8551 #ifdef CYTHON_NO_PYINIT_EXPORT
8552 #define __Pyx_PyMODINIT_FUNC PyObject *
8553 #else
8554 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
8555 #endif
8556 #endif
8557 
8558 
8559 #if PY_MAJOR_VERSION < 3
8560 __Pyx_PyMODINIT_FUNC initprimitives(void) CYTHON_SMALL_CODE; /*proto*/
initprimitives(void)8561 __Pyx_PyMODINIT_FUNC initprimitives(void)
8562 #else
8563 __Pyx_PyMODINIT_FUNC PyInit_primitives(void) CYTHON_SMALL_CODE; /*proto*/
8564 __Pyx_PyMODINIT_FUNC PyInit_primitives(void)
8565 #if CYTHON_PEP489_MULTI_PHASE_INIT
8566 {
8567   return PyModuleDef_Init(&__pyx_moduledef);
8568 }
8569 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
8570     #if PY_VERSION_HEX >= 0x030700A1
8571     static PY_INT64_T main_interpreter_id = -1;
8572     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
8573     if (main_interpreter_id == -1) {
8574         main_interpreter_id = current_id;
8575         return (unlikely(current_id == -1)) ? -1 : 0;
8576     } else if (unlikely(main_interpreter_id != current_id))
8577     #else
8578     static PyInterpreterState *main_interpreter = NULL;
8579     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
8580     if (!main_interpreter) {
8581         main_interpreter = current_interpreter;
8582     } else if (unlikely(main_interpreter != current_interpreter))
8583     #endif
8584     {
8585         PyErr_SetString(
8586             PyExc_ImportError,
8587             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
8588         return -1;
8589     }
8590     return 0;
8591 }
8592 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) {
8593     PyObject *value = PyObject_GetAttrString(spec, from_name);
8594     int result = 0;
8595     if (likely(value)) {
8596         if (allow_none || value != Py_None) {
8597             result = PyDict_SetItemString(moddict, to_name, value);
8598         }
8599         Py_DECREF(value);
8600     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
8601         PyErr_Clear();
8602     } else {
8603         result = -1;
8604     }
8605     return result;
8606 }
8607 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
8608     PyObject *module = NULL, *moddict, *modname;
8609     if (__Pyx_check_single_interpreter())
8610         return NULL;
8611     if (__pyx_m)
8612         return __Pyx_NewRef(__pyx_m);
8613     modname = PyObject_GetAttrString(spec, "name");
8614     if (unlikely(!modname)) goto bad;
8615     module = PyModule_NewObject(modname);
8616     Py_DECREF(modname);
8617     if (unlikely(!module)) goto bad;
8618     moddict = PyModule_GetDict(module);
8619     if (unlikely(!moddict)) goto bad;
8620     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
8621     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
8622     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
8623     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
8624     return module;
8625 bad:
8626     Py_XDECREF(module);
8627     return NULL;
8628 }
8629 
8630 
8631 static CYTHON_SMALL_CODE int __pyx_pymod_exec_primitives(PyObject *__pyx_pyinit_module)
8632 #endif
8633 #endif
8634 {
8635   PyObject *__pyx_t_1 = NULL;
8636   PyObject *__pyx_t_2 = NULL;
8637   __pyx_t_5numpy_float64_t __pyx_t_3;
8638   __Pyx_RefNannyDeclarations
8639   #if CYTHON_PEP489_MULTI_PHASE_INIT
8640   if (__pyx_m) {
8641     if (__pyx_m == __pyx_pyinit_module) return 0;
8642     PyErr_SetString(PyExc_RuntimeError, "Module 'primitives' has already been imported. Re-initialisation is not supported.");
8643     return -1;
8644   }
8645   #elif PY_MAJOR_VERSION >= 3
8646   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
8647   #endif
8648   #if CYTHON_REFNANNY
8649 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
8650 if (!__Pyx_RefNanny) {
8651   PyErr_Clear();
8652   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
8653   if (!__Pyx_RefNanny)
8654       Py_FatalError("failed to import 'refnanny' module");
8655 }
8656 #endif
8657   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_primitives(void)", 0);
8658   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8659   #ifdef __Pxy_PyFrame_Initialize_Offsets
8660   __Pxy_PyFrame_Initialize_Offsets();
8661   #endif
8662   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
8663   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
8664   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
8665   #ifdef __Pyx_CyFunction_USED
8666   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8667   #endif
8668   #ifdef __Pyx_FusedFunction_USED
8669   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8670   #endif
8671   #ifdef __Pyx_Coroutine_USED
8672   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8673   #endif
8674   #ifdef __Pyx_Generator_USED
8675   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8676   #endif
8677   #ifdef __Pyx_AsyncGen_USED
8678   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8679   #endif
8680   #ifdef __Pyx_StopAsyncIteration_USED
8681   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8682   #endif
8683   /*--- Library function declarations ---*/
8684   /*--- Threads initialization code ---*/
8685   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
8686   #ifdef WITH_THREAD /* Python build with threading support? */
8687   PyEval_InitThreads();
8688   #endif
8689   #endif
8690   /*--- Module creation code ---*/
8691   #if CYTHON_PEP489_MULTI_PHASE_INIT
8692   __pyx_m = __pyx_pyinit_module;
8693   Py_INCREF(__pyx_m);
8694   #else
8695   #if PY_MAJOR_VERSION < 3
8696   __pyx_m = Py_InitModule4("primitives", __pyx_methods, __pyx_k_This_file_contains_definitions, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
8697   #else
8698   __pyx_m = PyModule_Create(&__pyx_moduledef);
8699   #endif
8700   if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
8701   #endif
8702   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
8703   Py_INCREF(__pyx_d);
8704   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
8705   Py_INCREF(__pyx_b);
8706   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
8707   Py_INCREF(__pyx_cython_runtime);
8708   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
8709   /*--- Initialize various global constants etc. ---*/
8710   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8711   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
8712   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8713   #endif
8714   if (__pyx_module_is_main_yt__utilities__lib__primitives) {
8715     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8716   }
8717   #if PY_MAJOR_VERSION >= 3
8718   {
8719     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
8720     if (!PyDict_GetItemString(modules, "yt.utilities.lib.primitives")) {
8721       if (unlikely(PyDict_SetItemString(modules, "yt.utilities.lib.primitives", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
8722     }
8723   }
8724   #endif
8725   /*--- Builtin init code ---*/
8726   if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error;
8727   /*--- Constants init code ---*/
8728   if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error;
8729   /*--- Global type/function init code ---*/
8730   (void)__Pyx_modinit_global_init_code();
8731   (void)__Pyx_modinit_variable_export_code();
8732   if (unlikely(__Pyx_modinit_function_export_code() != 0)) goto __pyx_L1_error;
8733   (void)__Pyx_modinit_type_init_code();
8734   if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
8735   (void)__Pyx_modinit_variable_import_code();
8736   (void)__Pyx_modinit_function_import_code();
8737   /*--- Execution code ---*/
8738   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
8739   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8740   #endif
8741 
8742   /* "yt/utilities/lib/primitives.pyx":17
8743  * cimport cython
8744  *
8745  * import numpy as np             # <<<<<<<<<<<<<<
8746  *
8747  * cimport cython.floating
8748  */
8749   __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
8750   __Pyx_GOTREF(__pyx_t_1);
8751   if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
8752   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8753 
8754   /* "yt/utilities/lib/primitives.pyx":26
8755  *
8756  *
8757  * cdef np.float64_t DETERMINANT_EPS = 1.0e-10             # <<<<<<<<<<<<<<
8758  * cdef np.float64_t INF = np.inf
8759  *
8760  */
8761   __pyx_v_2yt_9utilities_3lib_10primitives_DETERMINANT_EPS = 1.0e-10;
8762 
8763   /* "yt/utilities/lib/primitives.pyx":27
8764  *
8765  * cdef np.float64_t DETERMINANT_EPS = 1.0e-10
8766  * cdef np.float64_t INF = np.inf             # <<<<<<<<<<<<<<
8767  *
8768  * cdef extern from "platform_dep.h" nogil:
8769  */
8770   __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
8771   __Pyx_GOTREF(__pyx_t_1);
8772   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_inf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
8773   __Pyx_GOTREF(__pyx_t_2);
8774   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8775   __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == ((npy_float64)-1)) && PyErr_Occurred())) __PYX_ERR(0, 27, __pyx_L1_error)
8776   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8777   __pyx_v_2yt_9utilities_3lib_10primitives_INF = __pyx_t_3;
8778 
8779   /* "yt/utilities/lib/primitives.pyx":1
8780  * # distutils: libraries = STD_LIBS             # <<<<<<<<<<<<<<
8781  * """
8782  *
8783  */
8784   __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
8785   __Pyx_GOTREF(__pyx_t_2);
8786   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
8787   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8788 
8789   /* "vec3_ops.pxd":59
8790  * @cython.wraparound(False)
8791  * @cython.cdivision(True)
8792  * cdef inline cython.floating L2_norm(const cython.floating[3] a) nogil:             # <<<<<<<<<<<<<<
8793  *     return sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2])
8794  */
8795 
8796   /*--- Wrapped vars code ---*/
8797 
8798   goto __pyx_L0;
8799   __pyx_L1_error:;
8800   __Pyx_XDECREF(__pyx_t_1);
8801   __Pyx_XDECREF(__pyx_t_2);
8802   if (__pyx_m) {
8803     if (__pyx_d) {
8804       __Pyx_AddTraceback("init yt.utilities.lib.primitives", __pyx_clineno, __pyx_lineno, __pyx_filename);
8805     }
8806     Py_CLEAR(__pyx_m);
8807   } else if (!PyErr_Occurred()) {
8808     PyErr_SetString(PyExc_ImportError, "init yt.utilities.lib.primitives");
8809   }
8810   __pyx_L0:;
8811   __Pyx_RefNannyFinishContext();
8812   #if CYTHON_PEP489_MULTI_PHASE_INIT
8813   return (__pyx_m != NULL) ? 0 : -1;
8814   #elif PY_MAJOR_VERSION >= 3
8815   return __pyx_m;
8816   #else
8817   return;
8818   #endif
8819 }
8820 
8821 /* --- Runtime support code --- */
8822 /* Refnanny */
8823 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)8824 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
8825     PyObject *m = NULL, *p = NULL;
8826     void *r = NULL;
8827     m = PyImport_ImportModule(modname);
8828     if (!m) goto end;
8829     p = PyObject_GetAttrString(m, "RefNannyAPI");
8830     if (!p) goto end;
8831     r = PyLong_AsVoidPtr(p);
8832 end:
8833     Py_XDECREF(p);
8834     Py_XDECREF(m);
8835     return (__Pyx_RefNannyAPIStruct *)r;
8836 }
8837 #endif
8838 
8839 /* PyObjectGetAttrStr */
8840 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)8841 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
8842     PyTypeObject* tp = Py_TYPE(obj);
8843     if (likely(tp->tp_getattro))
8844         return tp->tp_getattro(obj, attr_name);
8845 #if PY_MAJOR_VERSION < 3
8846     if (likely(tp->tp_getattr))
8847         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
8848 #endif
8849     return PyObject_GetAttr(obj, attr_name);
8850 }
8851 #endif
8852 
8853 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)8854 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
8855     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
8856     if (unlikely(!result)) {
8857         PyErr_Format(PyExc_NameError,
8858 #if PY_MAJOR_VERSION >= 3
8859             "name '%U' is not defined", name);
8860 #else
8861             "name '%.200s' is not defined", PyString_AS_STRING(name));
8862 #endif
8863     }
8864     return result;
8865 }
8866 
8867 /* PyObjectCall */
8868 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)8869 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
8870     PyObject *result;
8871     ternaryfunc call = func->ob_type->tp_call;
8872     if (unlikely(!call))
8873         return PyObject_Call(func, arg, kw);
8874     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
8875         return NULL;
8876     result = (*call)(func, arg, kw);
8877     Py_LeaveRecursiveCall();
8878     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
8879         PyErr_SetString(
8880             PyExc_SystemError,
8881             "NULL result without error in PyObject_Call");
8882     }
8883     return result;
8884 }
8885 #endif
8886 
8887 /* PyErrFetchRestore */
8888 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)8889 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
8890     PyObject *tmp_type, *tmp_value, *tmp_tb;
8891     tmp_type = tstate->curexc_type;
8892     tmp_value = tstate->curexc_value;
8893     tmp_tb = tstate->curexc_traceback;
8894     tstate->curexc_type = type;
8895     tstate->curexc_value = value;
8896     tstate->curexc_traceback = tb;
8897     Py_XDECREF(tmp_type);
8898     Py_XDECREF(tmp_value);
8899     Py_XDECREF(tmp_tb);
8900 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)8901 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
8902     *type = tstate->curexc_type;
8903     *value = tstate->curexc_value;
8904     *tb = tstate->curexc_traceback;
8905     tstate->curexc_type = 0;
8906     tstate->curexc_value = 0;
8907     tstate->curexc_traceback = 0;
8908 }
8909 #endif
8910 
8911 /* RaiseException */
8912 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)8913 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
8914                         CYTHON_UNUSED PyObject *cause) {
8915     __Pyx_PyThreadState_declare
8916     Py_XINCREF(type);
8917     if (!value || value == Py_None)
8918         value = NULL;
8919     else
8920         Py_INCREF(value);
8921     if (!tb || tb == Py_None)
8922         tb = NULL;
8923     else {
8924         Py_INCREF(tb);
8925         if (!PyTraceBack_Check(tb)) {
8926             PyErr_SetString(PyExc_TypeError,
8927                 "raise: arg 3 must be a traceback or None");
8928             goto raise_error;
8929         }
8930     }
8931     if (PyType_Check(type)) {
8932 #if CYTHON_COMPILING_IN_PYPY
8933         if (!value) {
8934             Py_INCREF(Py_None);
8935             value = Py_None;
8936         }
8937 #endif
8938         PyErr_NormalizeException(&type, &value, &tb);
8939     } else {
8940         if (value) {
8941             PyErr_SetString(PyExc_TypeError,
8942                 "instance exception may not have a separate value");
8943             goto raise_error;
8944         }
8945         value = type;
8946         type = (PyObject*) Py_TYPE(type);
8947         Py_INCREF(type);
8948         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
8949             PyErr_SetString(PyExc_TypeError,
8950                 "raise: exception class must be a subclass of BaseException");
8951             goto raise_error;
8952         }
8953     }
8954     __Pyx_PyThreadState_assign
8955     __Pyx_ErrRestore(type, value, tb);
8956     return;
8957 raise_error:
8958     Py_XDECREF(value);
8959     Py_XDECREF(type);
8960     Py_XDECREF(tb);
8961     return;
8962 }
8963 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)8964 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
8965     PyObject* owned_instance = NULL;
8966     if (tb == Py_None) {
8967         tb = 0;
8968     } else if (tb && !PyTraceBack_Check(tb)) {
8969         PyErr_SetString(PyExc_TypeError,
8970             "raise: arg 3 must be a traceback or None");
8971         goto bad;
8972     }
8973     if (value == Py_None)
8974         value = 0;
8975     if (PyExceptionInstance_Check(type)) {
8976         if (value) {
8977             PyErr_SetString(PyExc_TypeError,
8978                 "instance exception may not have a separate value");
8979             goto bad;
8980         }
8981         value = type;
8982         type = (PyObject*) Py_TYPE(value);
8983     } else if (PyExceptionClass_Check(type)) {
8984         PyObject *instance_class = NULL;
8985         if (value && PyExceptionInstance_Check(value)) {
8986             instance_class = (PyObject*) Py_TYPE(value);
8987             if (instance_class != type) {
8988                 int is_subclass = PyObject_IsSubclass(instance_class, type);
8989                 if (!is_subclass) {
8990                     instance_class = NULL;
8991                 } else if (unlikely(is_subclass == -1)) {
8992                     goto bad;
8993                 } else {
8994                     type = instance_class;
8995                 }
8996             }
8997         }
8998         if (!instance_class) {
8999             PyObject *args;
9000             if (!value)
9001                 args = PyTuple_New(0);
9002             else if (PyTuple_Check(value)) {
9003                 Py_INCREF(value);
9004                 args = value;
9005             } else
9006                 args = PyTuple_Pack(1, value);
9007             if (!args)
9008                 goto bad;
9009             owned_instance = PyObject_Call(type, args, NULL);
9010             Py_DECREF(args);
9011             if (!owned_instance)
9012                 goto bad;
9013             value = owned_instance;
9014             if (!PyExceptionInstance_Check(value)) {
9015                 PyErr_Format(PyExc_TypeError,
9016                              "calling %R should have returned an instance of "
9017                              "BaseException, not %R",
9018                              type, Py_TYPE(value));
9019                 goto bad;
9020             }
9021         }
9022     } else {
9023         PyErr_SetString(PyExc_TypeError,
9024             "raise: exception class must be a subclass of BaseException");
9025         goto bad;
9026     }
9027     if (cause) {
9028         PyObject *fixed_cause;
9029         if (cause == Py_None) {
9030             fixed_cause = NULL;
9031         } else if (PyExceptionClass_Check(cause)) {
9032             fixed_cause = PyObject_CallObject(cause, NULL);
9033             if (fixed_cause == NULL)
9034                 goto bad;
9035         } else if (PyExceptionInstance_Check(cause)) {
9036             fixed_cause = cause;
9037             Py_INCREF(fixed_cause);
9038         } else {
9039             PyErr_SetString(PyExc_TypeError,
9040                             "exception causes must derive from "
9041                             "BaseException");
9042             goto bad;
9043         }
9044         PyException_SetCause(value, fixed_cause);
9045     }
9046     PyErr_SetObject(type, value);
9047     if (tb) {
9048 #if CYTHON_COMPILING_IN_PYPY
9049         PyObject *tmp_type, *tmp_value, *tmp_tb;
9050         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
9051         Py_INCREF(tb);
9052         PyErr_Restore(tmp_type, tmp_value, tb);
9053         Py_XDECREF(tmp_tb);
9054 #else
9055         PyThreadState *tstate = __Pyx_PyThreadState_Current;
9056         PyObject* tmp_tb = tstate->curexc_traceback;
9057         if (tb != tmp_tb) {
9058             Py_INCREF(tb);
9059             tstate->curexc_traceback = tb;
9060             Py_XDECREF(tmp_tb);
9061         }
9062 #endif
9063     }
9064 bad:
9065     Py_XDECREF(owned_instance);
9066     return;
9067 }
9068 #endif
9069 
9070 /* PyCFunctionFastCall */
9071 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)9072 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
9073     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
9074     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
9075     PyObject *self = PyCFunction_GET_SELF(func);
9076     int flags = PyCFunction_GET_FLAGS(func);
9077     assert(PyCFunction_Check(func));
9078     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
9079     assert(nargs >= 0);
9080     assert(nargs == 0 || args != NULL);
9081     /* _PyCFunction_FastCallDict() must not be called with an exception set,
9082        because it may clear it (directly or indirectly) and so the
9083        caller loses its exception */
9084     assert(!PyErr_Occurred());
9085     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
9086         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
9087     } else {
9088         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
9089     }
9090 }
9091 #endif
9092 
9093 /* PyFunctionFastCall */
9094 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)9095 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
9096                                                PyObject *globals) {
9097     PyFrameObject *f;
9098     PyThreadState *tstate = __Pyx_PyThreadState_Current;
9099     PyObject **fastlocals;
9100     Py_ssize_t i;
9101     PyObject *result;
9102     assert(globals != NULL);
9103     /* XXX Perhaps we should create a specialized
9104        PyFrame_New() that doesn't take locals, but does
9105        take builtins without sanity checking them.
9106        */
9107     assert(tstate != NULL);
9108     f = PyFrame_New(tstate, co, globals, NULL);
9109     if (f == NULL) {
9110         return NULL;
9111     }
9112     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
9113     for (i = 0; i < na; i++) {
9114         Py_INCREF(*args);
9115         fastlocals[i] = *args++;
9116     }
9117     result = PyEval_EvalFrameEx(f,0);
9118     ++tstate->recursion_depth;
9119     Py_DECREF(f);
9120     --tstate->recursion_depth;
9121     return result;
9122 }
9123 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)9124 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
9125     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
9126     PyObject *globals = PyFunction_GET_GLOBALS(func);
9127     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
9128     PyObject *closure;
9129 #if PY_MAJOR_VERSION >= 3
9130     PyObject *kwdefs;
9131 #endif
9132     PyObject *kwtuple, **k;
9133     PyObject **d;
9134     Py_ssize_t nd;
9135     Py_ssize_t nk;
9136     PyObject *result;
9137     assert(kwargs == NULL || PyDict_Check(kwargs));
9138     nk = kwargs ? PyDict_Size(kwargs) : 0;
9139     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
9140         return NULL;
9141     }
9142     if (
9143 #if PY_MAJOR_VERSION >= 3
9144             co->co_kwonlyargcount == 0 &&
9145 #endif
9146             likely(kwargs == NULL || nk == 0) &&
9147             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
9148         if (argdefs == NULL && co->co_argcount == nargs) {
9149             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
9150             goto done;
9151         }
9152         else if (nargs == 0 && argdefs != NULL
9153                  && co->co_argcount == Py_SIZE(argdefs)) {
9154             /* function called with no arguments, but all parameters have
9155                a default value: use default values as arguments .*/
9156             args = &PyTuple_GET_ITEM(argdefs, 0);
9157             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
9158             goto done;
9159         }
9160     }
9161     if (kwargs != NULL) {
9162         Py_ssize_t pos, i;
9163         kwtuple = PyTuple_New(2 * nk);
9164         if (kwtuple == NULL) {
9165             result = NULL;
9166             goto done;
9167         }
9168         k = &PyTuple_GET_ITEM(kwtuple, 0);
9169         pos = i = 0;
9170         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
9171             Py_INCREF(k[i]);
9172             Py_INCREF(k[i+1]);
9173             i += 2;
9174         }
9175         nk = i / 2;
9176     }
9177     else {
9178         kwtuple = NULL;
9179         k = NULL;
9180     }
9181     closure = PyFunction_GET_CLOSURE(func);
9182 #if PY_MAJOR_VERSION >= 3
9183     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
9184 #endif
9185     if (argdefs != NULL) {
9186         d = &PyTuple_GET_ITEM(argdefs, 0);
9187         nd = Py_SIZE(argdefs);
9188     }
9189     else {
9190         d = NULL;
9191         nd = 0;
9192     }
9193 #if PY_MAJOR_VERSION >= 3
9194     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
9195                                args, (int)nargs,
9196                                k, (int)nk,
9197                                d, (int)nd, kwdefs, closure);
9198 #else
9199     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
9200                                args, (int)nargs,
9201                                k, (int)nk,
9202                                d, (int)nd, closure);
9203 #endif
9204     Py_XDECREF(kwtuple);
9205 done:
9206     Py_LeaveRecursiveCall();
9207     return result;
9208 }
9209 #endif
9210 #endif
9211 
9212 /* PyObjectCallMethO */
9213 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)9214 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
9215     PyObject *self, *result;
9216     PyCFunction cfunc;
9217     cfunc = PyCFunction_GET_FUNCTION(func);
9218     self = PyCFunction_GET_SELF(func);
9219     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
9220         return NULL;
9221     result = cfunc(self, arg);
9222     Py_LeaveRecursiveCall();
9223     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
9224         PyErr_SetString(
9225             PyExc_SystemError,
9226             "NULL result without error in PyObject_Call");
9227     }
9228     return result;
9229 }
9230 #endif
9231 
9232 /* PyObjectCallOneArg */
9233 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)9234 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
9235     PyObject *result;
9236     PyObject *args = PyTuple_New(1);
9237     if (unlikely(!args)) return NULL;
9238     Py_INCREF(arg);
9239     PyTuple_SET_ITEM(args, 0, arg);
9240     result = __Pyx_PyObject_Call(func, args, NULL);
9241     Py_DECREF(args);
9242     return result;
9243 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)9244 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
9245 #if CYTHON_FAST_PYCALL
9246     if (PyFunction_Check(func)) {
9247         return __Pyx_PyFunction_FastCall(func, &arg, 1);
9248     }
9249 #endif
9250     if (likely(PyCFunction_Check(func))) {
9251         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
9252             return __Pyx_PyObject_CallMethO(func, arg);
9253 #if CYTHON_FAST_PYCCALL
9254         } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
9255             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
9256 #endif
9257         }
9258     }
9259     return __Pyx__PyObject_CallOneArg(func, arg);
9260 }
9261 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)9262 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
9263     PyObject *result;
9264     PyObject *args = PyTuple_Pack(1, arg);
9265     if (unlikely(!args)) return NULL;
9266     result = __Pyx_PyObject_Call(func, args, NULL);
9267     Py_DECREF(args);
9268     return result;
9269 }
9270 #endif
9271 
9272 /* DictGetItem */
9273 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
__Pyx_PyDict_GetItem(PyObject * d,PyObject * key)9274 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
9275     PyObject *value;
9276     value = PyDict_GetItemWithError(d, key);
9277     if (unlikely(!value)) {
9278         if (!PyErr_Occurred()) {
9279             if (unlikely(PyTuple_Check(key))) {
9280                 PyObject* args = PyTuple_Pack(1, key);
9281                 if (likely(args)) {
9282                     PyErr_SetObject(PyExc_KeyError, args);
9283                     Py_DECREF(args);
9284                 }
9285             } else {
9286                 PyErr_SetObject(PyExc_KeyError, key);
9287             }
9288         }
9289         return NULL;
9290     }
9291     Py_INCREF(value);
9292     return value;
9293 }
9294 #endif
9295 
9296 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)9297 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
9298     PyErr_Format(PyExc_ValueError,
9299                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
9300 }
9301 
9302 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)9303 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
9304     PyErr_Format(PyExc_ValueError,
9305                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
9306                  index, (index == 1) ? "" : "s");
9307 }
9308 
9309 /* RaiseNoneIterError */
__Pyx_RaiseNoneNotIterableError(void)9310 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
9311     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
9312 }
9313 
9314 /* ExtTypeTest */
__Pyx_TypeTest(PyObject * obj,PyTypeObject * type)9315 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
9316     if (unlikely(!type)) {
9317         PyErr_SetString(PyExc_SystemError, "Missing type object");
9318         return 0;
9319     }
9320     if (likely(__Pyx_TypeCheck(obj, type)))
9321         return 1;
9322     PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
9323                  Py_TYPE(obj)->tp_name, type->tp_name);
9324     return 0;
9325 }
9326 
9327 /* GetTopmostException */
9328 #if CYTHON_USE_EXC_INFO_STACK
9329 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)9330 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
9331 {
9332     _PyErr_StackItem *exc_info = tstate->exc_info;
9333     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
9334            exc_info->previous_item != NULL)
9335     {
9336         exc_info = exc_info->previous_item;
9337     }
9338     return exc_info;
9339 }
9340 #endif
9341 
9342 /* SaveResetException */
9343 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)9344 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
9345     #if CYTHON_USE_EXC_INFO_STACK
9346     _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
9347     *type = exc_info->exc_type;
9348     *value = exc_info->exc_value;
9349     *tb = exc_info->exc_traceback;
9350     #else
9351     *type = tstate->exc_type;
9352     *value = tstate->exc_value;
9353     *tb = tstate->exc_traceback;
9354     #endif
9355     Py_XINCREF(*type);
9356     Py_XINCREF(*value);
9357     Py_XINCREF(*tb);
9358 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)9359 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
9360     PyObject *tmp_type, *tmp_value, *tmp_tb;
9361     #if CYTHON_USE_EXC_INFO_STACK
9362     _PyErr_StackItem *exc_info = tstate->exc_info;
9363     tmp_type = exc_info->exc_type;
9364     tmp_value = exc_info->exc_value;
9365     tmp_tb = exc_info->exc_traceback;
9366     exc_info->exc_type = type;
9367     exc_info->exc_value = value;
9368     exc_info->exc_traceback = tb;
9369     #else
9370     tmp_type = tstate->exc_type;
9371     tmp_value = tstate->exc_value;
9372     tmp_tb = tstate->exc_traceback;
9373     tstate->exc_type = type;
9374     tstate->exc_value = value;
9375     tstate->exc_traceback = tb;
9376     #endif
9377     Py_XDECREF(tmp_type);
9378     Py_XDECREF(tmp_value);
9379     Py_XDECREF(tmp_tb);
9380 }
9381 #endif
9382 
9383 /* PyErrExceptionMatches */
9384 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)9385 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
9386     Py_ssize_t i, n;
9387     n = PyTuple_GET_SIZE(tuple);
9388 #if PY_MAJOR_VERSION >= 3
9389     for (i=0; i<n; i++) {
9390         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
9391     }
9392 #endif
9393     for (i=0; i<n; i++) {
9394         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
9395     }
9396     return 0;
9397 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)9398 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
9399     PyObject *exc_type = tstate->curexc_type;
9400     if (exc_type == err) return 1;
9401     if (unlikely(!exc_type)) return 0;
9402     if (unlikely(PyTuple_Check(err)))
9403         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
9404     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
9405 }
9406 #endif
9407 
9408 /* GetException */
9409 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)9410 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
9411 #else
9412 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
9413 #endif
9414 {
9415     PyObject *local_type, *local_value, *local_tb;
9416 #if CYTHON_FAST_THREAD_STATE
9417     PyObject *tmp_type, *tmp_value, *tmp_tb;
9418     local_type = tstate->curexc_type;
9419     local_value = tstate->curexc_value;
9420     local_tb = tstate->curexc_traceback;
9421     tstate->curexc_type = 0;
9422     tstate->curexc_value = 0;
9423     tstate->curexc_traceback = 0;
9424 #else
9425     PyErr_Fetch(&local_type, &local_value, &local_tb);
9426 #endif
9427     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
9428 #if CYTHON_FAST_THREAD_STATE
9429     if (unlikely(tstate->curexc_type))
9430 #else
9431     if (unlikely(PyErr_Occurred()))
9432 #endif
9433         goto bad;
9434     #if PY_MAJOR_VERSION >= 3
9435     if (local_tb) {
9436         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
9437             goto bad;
9438     }
9439     #endif
9440     Py_XINCREF(local_tb);
9441     Py_XINCREF(local_type);
9442     Py_XINCREF(local_value);
9443     *type = local_type;
9444     *value = local_value;
9445     *tb = local_tb;
9446 #if CYTHON_FAST_THREAD_STATE
9447     #if CYTHON_USE_EXC_INFO_STACK
9448     {
9449         _PyErr_StackItem *exc_info = tstate->exc_info;
9450         tmp_type = exc_info->exc_type;
9451         tmp_value = exc_info->exc_value;
9452         tmp_tb = exc_info->exc_traceback;
9453         exc_info->exc_type = local_type;
9454         exc_info->exc_value = local_value;
9455         exc_info->exc_traceback = local_tb;
9456     }
9457     #else
9458     tmp_type = tstate->exc_type;
9459     tmp_value = tstate->exc_value;
9460     tmp_tb = tstate->exc_traceback;
9461     tstate->exc_type = local_type;
9462     tstate->exc_value = local_value;
9463     tstate->exc_traceback = local_tb;
9464     #endif
9465     Py_XDECREF(tmp_type);
9466     Py_XDECREF(tmp_value);
9467     Py_XDECREF(tmp_tb);
9468 #else
9469     PyErr_SetExcInfo(local_type, local_value, local_tb);
9470 #endif
9471     return 0;
9472 bad:
9473     *type = 0;
9474     *value = 0;
9475     *tb = 0;
9476     Py_XDECREF(local_type);
9477     Py_XDECREF(local_value);
9478     Py_XDECREF(local_tb);
9479     return -1;
9480 }
9481 
9482 /* TypeImport */
9483 #ifndef __PYX_HAVE_RT_ImportType
9484 #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)9485 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
9486     size_t size, enum __Pyx_ImportType_CheckSize check_size)
9487 {
9488     PyObject *result = 0;
9489     char warning[200];
9490     Py_ssize_t basicsize;
9491 #ifdef Py_LIMITED_API
9492     PyObject *py_basicsize;
9493 #endif
9494     result = PyObject_GetAttrString(module, class_name);
9495     if (!result)
9496         goto bad;
9497     if (!PyType_Check(result)) {
9498         PyErr_Format(PyExc_TypeError,
9499             "%.200s.%.200s is not a type object",
9500             module_name, class_name);
9501         goto bad;
9502     }
9503 #ifndef Py_LIMITED_API
9504     basicsize = ((PyTypeObject *)result)->tp_basicsize;
9505 #else
9506     py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
9507     if (!py_basicsize)
9508         goto bad;
9509     basicsize = PyLong_AsSsize_t(py_basicsize);
9510     Py_DECREF(py_basicsize);
9511     py_basicsize = 0;
9512     if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
9513         goto bad;
9514 #endif
9515     if ((size_t)basicsize < size) {
9516         PyErr_Format(PyExc_ValueError,
9517             "%.200s.%.200s size changed, may indicate binary incompatibility. "
9518             "Expected %zd from C header, got %zd from PyObject",
9519             module_name, class_name, size, basicsize);
9520         goto bad;
9521     }
9522     if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
9523         PyErr_Format(PyExc_ValueError,
9524             "%.200s.%.200s size changed, may indicate binary incompatibility. "
9525             "Expected %zd from C header, got %zd from PyObject",
9526             module_name, class_name, size, basicsize);
9527         goto bad;
9528     }
9529     else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
9530         PyOS_snprintf(warning, sizeof(warning),
9531             "%s.%s size changed, may indicate binary incompatibility. "
9532             "Expected %zd from C header, got %zd from PyObject",
9533             module_name, class_name, size, basicsize);
9534         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
9535     }
9536     return (PyTypeObject *)result;
9537 bad:
9538     Py_XDECREF(result);
9539     return NULL;
9540 }
9541 #endif
9542 
9543 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)9544 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
9545     PyObject *empty_list = 0;
9546     PyObject *module = 0;
9547     PyObject *global_dict = 0;
9548     PyObject *empty_dict = 0;
9549     PyObject *list;
9550     #if PY_MAJOR_VERSION < 3
9551     PyObject *py_import;
9552     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
9553     if (!py_import)
9554         goto bad;
9555     #endif
9556     if (from_list)
9557         list = from_list;
9558     else {
9559         empty_list = PyList_New(0);
9560         if (!empty_list)
9561             goto bad;
9562         list = empty_list;
9563     }
9564     global_dict = PyModule_GetDict(__pyx_m);
9565     if (!global_dict)
9566         goto bad;
9567     empty_dict = PyDict_New();
9568     if (!empty_dict)
9569         goto bad;
9570     {
9571         #if PY_MAJOR_VERSION >= 3
9572         if (level == -1) {
9573             if (strchr(__Pyx_MODULE_NAME, '.')) {
9574                 module = PyImport_ImportModuleLevelObject(
9575                     name, global_dict, empty_dict, list, 1);
9576                 if (!module) {
9577                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
9578                         goto bad;
9579                     PyErr_Clear();
9580                 }
9581             }
9582             level = 0;
9583         }
9584         #endif
9585         if (!module) {
9586             #if PY_MAJOR_VERSION < 3
9587             PyObject *py_level = PyInt_FromLong(level);
9588             if (!py_level)
9589                 goto bad;
9590             module = PyObject_CallFunctionObjArgs(py_import,
9591                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
9592             Py_DECREF(py_level);
9593             #else
9594             module = PyImport_ImportModuleLevelObject(
9595                 name, global_dict, empty_dict, list, level);
9596             #endif
9597         }
9598     }
9599 bad:
9600     #if PY_MAJOR_VERSION < 3
9601     Py_XDECREF(py_import);
9602     #endif
9603     Py_XDECREF(empty_list);
9604     Py_XDECREF(empty_dict);
9605     return module;
9606 }
9607 
9608 /* PyDictVersioning */
9609 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)9610 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
9611     PyObject *dict = Py_TYPE(obj)->tp_dict;
9612     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
9613 }
__Pyx_get_object_dict_version(PyObject * obj)9614 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
9615     PyObject **dictptr = NULL;
9616     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
9617     if (offset) {
9618 #if CYTHON_COMPILING_IN_CPYTHON
9619         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
9620 #else
9621         dictptr = _PyObject_GetDictPtr(obj);
9622 #endif
9623     }
9624     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
9625 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)9626 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
9627     PyObject *dict = Py_TYPE(obj)->tp_dict;
9628     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
9629         return 0;
9630     return obj_dict_version == __Pyx_get_object_dict_version(obj);
9631 }
9632 #endif
9633 
9634 /* GetModuleGlobalName */
9635 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)9636 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
9637 #else
9638 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
9639 #endif
9640 {
9641     PyObject *result;
9642 #if !CYTHON_AVOID_BORROWED_REFS
9643 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
9644     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
9645     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
9646     if (likely(result)) {
9647         return __Pyx_NewRef(result);
9648     } else if (unlikely(PyErr_Occurred())) {
9649         return NULL;
9650     }
9651 #else
9652     result = PyDict_GetItem(__pyx_d, name);
9653     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
9654     if (likely(result)) {
9655         return __Pyx_NewRef(result);
9656     }
9657 #endif
9658 #else
9659     result = PyObject_GetItem(__pyx_d, name);
9660     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
9661     if (likely(result)) {
9662         return __Pyx_NewRef(result);
9663     }
9664     PyErr_Clear();
9665 #endif
9666     return __Pyx_GetBuiltinName(name);
9667 }
9668 
9669 /* CLineInTraceback */
9670 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(PyThreadState * tstate,int c_line)9671 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
9672     PyObject *use_cline;
9673     PyObject *ptype, *pvalue, *ptraceback;
9674 #if CYTHON_COMPILING_IN_CPYTHON
9675     PyObject **cython_runtime_dict;
9676 #endif
9677     if (unlikely(!__pyx_cython_runtime)) {
9678         return c_line;
9679     }
9680     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
9681 #if CYTHON_COMPILING_IN_CPYTHON
9682     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
9683     if (likely(cython_runtime_dict)) {
9684         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
9685             use_cline, *cython_runtime_dict,
9686             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
9687     } else
9688 #endif
9689     {
9690       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
9691       if (use_cline_obj) {
9692         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
9693         Py_DECREF(use_cline_obj);
9694       } else {
9695         PyErr_Clear();
9696         use_cline = NULL;
9697       }
9698     }
9699     if (!use_cline) {
9700         c_line = 0;
9701         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
9702     }
9703     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
9704         c_line = 0;
9705     }
9706     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
9707     return c_line;
9708 }
9709 #endif
9710 
9711 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)9712 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
9713     int start = 0, mid = 0, end = count - 1;
9714     if (end >= 0 && code_line > entries[end].code_line) {
9715         return count;
9716     }
9717     while (start < end) {
9718         mid = start + (end - start) / 2;
9719         if (code_line < entries[mid].code_line) {
9720             end = mid;
9721         } else if (code_line > entries[mid].code_line) {
9722              start = mid + 1;
9723         } else {
9724             return mid;
9725         }
9726     }
9727     if (code_line <= entries[mid].code_line) {
9728         return mid;
9729     } else {
9730         return mid + 1;
9731     }
9732 }
__pyx_find_code_object(int code_line)9733 static PyCodeObject *__pyx_find_code_object(int code_line) {
9734     PyCodeObject* code_object;
9735     int pos;
9736     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
9737         return NULL;
9738     }
9739     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
9740     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
9741         return NULL;
9742     }
9743     code_object = __pyx_code_cache.entries[pos].code_object;
9744     Py_INCREF(code_object);
9745     return code_object;
9746 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)9747 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
9748     int pos, i;
9749     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
9750     if (unlikely(!code_line)) {
9751         return;
9752     }
9753     if (unlikely(!entries)) {
9754         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
9755         if (likely(entries)) {
9756             __pyx_code_cache.entries = entries;
9757             __pyx_code_cache.max_count = 64;
9758             __pyx_code_cache.count = 1;
9759             entries[0].code_line = code_line;
9760             entries[0].code_object = code_object;
9761             Py_INCREF(code_object);
9762         }
9763         return;
9764     }
9765     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
9766     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
9767         PyCodeObject* tmp = entries[pos].code_object;
9768         entries[pos].code_object = code_object;
9769         Py_DECREF(tmp);
9770         return;
9771     }
9772     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
9773         int new_max = __pyx_code_cache.max_count + 64;
9774         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
9775             __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
9776         if (unlikely(!entries)) {
9777             return;
9778         }
9779         __pyx_code_cache.entries = entries;
9780         __pyx_code_cache.max_count = new_max;
9781     }
9782     for (i=__pyx_code_cache.count; i>pos; i--) {
9783         entries[i] = entries[i-1];
9784     }
9785     entries[pos].code_line = code_line;
9786     entries[pos].code_object = code_object;
9787     __pyx_code_cache.count++;
9788     Py_INCREF(code_object);
9789 }
9790 
9791 /* AddTraceback */
9792 #include "compile.h"
9793 #include "frameobject.h"
9794 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)9795 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
9796             const char *funcname, int c_line,
9797             int py_line, const char *filename) {
9798     PyCodeObject *py_code = 0;
9799     PyObject *py_srcfile = 0;
9800     PyObject *py_funcname = 0;
9801     #if PY_MAJOR_VERSION < 3
9802     py_srcfile = PyString_FromString(filename);
9803     #else
9804     py_srcfile = PyUnicode_FromString(filename);
9805     #endif
9806     if (!py_srcfile) goto bad;
9807     if (c_line) {
9808         #if PY_MAJOR_VERSION < 3
9809         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
9810         #else
9811         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
9812         #endif
9813     }
9814     else {
9815         #if PY_MAJOR_VERSION < 3
9816         py_funcname = PyString_FromString(funcname);
9817         #else
9818         py_funcname = PyUnicode_FromString(funcname);
9819         #endif
9820     }
9821     if (!py_funcname) goto bad;
9822     py_code = __Pyx_PyCode_New(
9823         0,
9824         0,
9825         0,
9826         0,
9827         0,
9828         __pyx_empty_bytes, /*PyObject *code,*/
9829         __pyx_empty_tuple, /*PyObject *consts,*/
9830         __pyx_empty_tuple, /*PyObject *names,*/
9831         __pyx_empty_tuple, /*PyObject *varnames,*/
9832         __pyx_empty_tuple, /*PyObject *freevars,*/
9833         __pyx_empty_tuple, /*PyObject *cellvars,*/
9834         py_srcfile,   /*PyObject *filename,*/
9835         py_funcname,  /*PyObject *name,*/
9836         py_line,
9837         __pyx_empty_bytes  /*PyObject *lnotab*/
9838     );
9839     Py_DECREF(py_srcfile);
9840     Py_DECREF(py_funcname);
9841     return py_code;
9842 bad:
9843     Py_XDECREF(py_srcfile);
9844     Py_XDECREF(py_funcname);
9845     return NULL;
9846 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)9847 static void __Pyx_AddTraceback(const char *funcname, int c_line,
9848                                int py_line, const char *filename) {
9849     PyCodeObject *py_code = 0;
9850     PyFrameObject *py_frame = 0;
9851     PyThreadState *tstate = __Pyx_PyThreadState_Current;
9852     if (c_line) {
9853         c_line = __Pyx_CLineForTraceback(tstate, c_line);
9854     }
9855     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
9856     if (!py_code) {
9857         py_code = __Pyx_CreateCodeObjectForTraceback(
9858             funcname, c_line, py_line, filename);
9859         if (!py_code) goto bad;
9860         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
9861     }
9862     py_frame = PyFrame_New(
9863         tstate,            /*PyThreadState *tstate,*/
9864         py_code,           /*PyCodeObject *code,*/
9865         __pyx_d,    /*PyObject *globals,*/
9866         0                  /*PyObject *locals*/
9867     );
9868     if (!py_frame) goto bad;
9869     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
9870     PyTraceBack_Here(py_frame);
9871 bad:
9872     Py_XDECREF(py_code);
9873     Py_XDECREF(py_frame);
9874 }
9875 
9876 /* CIntFromPyVerify */
9877 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
9878     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
9879 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
9880     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
9881 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
9882     {\
9883         func_type value = func_value;\
9884         if (sizeof(target_type) < sizeof(func_type)) {\
9885             if (unlikely(value != (func_type) (target_type) value)) {\
9886                 func_type zero = 0;\
9887                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
9888                     return (target_type) -1;\
9889                 if (is_unsigned && unlikely(value < zero))\
9890                     goto raise_neg_overflow;\
9891                 else\
9892                     goto raise_overflow;\
9893             }\
9894         }\
9895         return (target_type) value;\
9896     }
9897 
9898 /* CIntToPy */
__Pyx_PyInt_From_npy_int64(npy_int64 value)9899 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int64(npy_int64 value) {
9900     const npy_int64 neg_one = (npy_int64) ((npy_int64) 0 - (npy_int64) 1), const_zero = (npy_int64) 0;
9901     const int is_unsigned = neg_one > const_zero;
9902     if (is_unsigned) {
9903         if (sizeof(npy_int64) < sizeof(long)) {
9904             return PyInt_FromLong((long) value);
9905         } else if (sizeof(npy_int64) <= sizeof(unsigned long)) {
9906             return PyLong_FromUnsignedLong((unsigned long) value);
9907 #ifdef HAVE_LONG_LONG
9908         } else if (sizeof(npy_int64) <= sizeof(unsigned PY_LONG_LONG)) {
9909             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
9910 #endif
9911         }
9912     } else {
9913         if (sizeof(npy_int64) <= sizeof(long)) {
9914             return PyInt_FromLong((long) value);
9915 #ifdef HAVE_LONG_LONG
9916         } else if (sizeof(npy_int64) <= sizeof(PY_LONG_LONG)) {
9917             return PyLong_FromLongLong((PY_LONG_LONG) value);
9918 #endif
9919         }
9920     }
9921     {
9922         int one = 1; int little = (int)*(unsigned char *)&one;
9923         unsigned char *bytes = (unsigned char *)&value;
9924         return _PyLong_FromByteArray(bytes, sizeof(npy_int64),
9925                                      little, !is_unsigned);
9926     }
9927 }
9928 
9929 /* Declarations */
9930 #if CYTHON_CCOMPLEX
9931   #ifdef __cplusplus
__pyx_t_float_complex_from_parts(float x,float y)9932     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
9933       return ::std::complex< float >(x, y);
9934     }
9935   #else
__pyx_t_float_complex_from_parts(float x,float y)9936     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
9937       return x + y*(__pyx_t_float_complex)_Complex_I;
9938     }
9939   #endif
9940 #else
__pyx_t_float_complex_from_parts(float x,float y)9941     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
9942       __pyx_t_float_complex z;
9943       z.real = x;
9944       z.imag = y;
9945       return z;
9946     }
9947 #endif
9948 
9949 /* Arithmetic */
9950 #if CYTHON_CCOMPLEX
9951 #else
__Pyx_c_eq_float(__pyx_t_float_complex a,__pyx_t_float_complex b)9952     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
9953        return (a.real == b.real) && (a.imag == b.imag);
9954     }
__Pyx_c_sum_float(__pyx_t_float_complex a,__pyx_t_float_complex b)9955     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
9956         __pyx_t_float_complex z;
9957         z.real = a.real + b.real;
9958         z.imag = a.imag + b.imag;
9959         return z;
9960     }
__Pyx_c_diff_float(__pyx_t_float_complex a,__pyx_t_float_complex b)9961     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
9962         __pyx_t_float_complex z;
9963         z.real = a.real - b.real;
9964         z.imag = a.imag - b.imag;
9965         return z;
9966     }
__Pyx_c_prod_float(__pyx_t_float_complex a,__pyx_t_float_complex b)9967     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
9968         __pyx_t_float_complex z;
9969         z.real = a.real * b.real - a.imag * b.imag;
9970         z.imag = a.real * b.imag + a.imag * b.real;
9971         return z;
9972     }
9973     #if 1
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)9974     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
9975         if (b.imag == 0) {
9976             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
9977         } else if (fabsf(b.real) >= fabsf(b.imag)) {
9978             if (b.real == 0 && b.imag == 0) {
9979                 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
9980             } else {
9981                 float r = b.imag / b.real;
9982                 float s = (float)(1.0) / (b.real + b.imag * r);
9983                 return __pyx_t_float_complex_from_parts(
9984                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
9985             }
9986         } else {
9987             float r = b.real / b.imag;
9988             float s = (float)(1.0) / (b.imag + b.real * r);
9989             return __pyx_t_float_complex_from_parts(
9990                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
9991         }
9992     }
9993     #else
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)9994     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
9995         if (b.imag == 0) {
9996             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
9997         } else {
9998             float denom = b.real * b.real + b.imag * b.imag;
9999             return __pyx_t_float_complex_from_parts(
10000                 (a.real * b.real + a.imag * b.imag) / denom,
10001                 (a.imag * b.real - a.real * b.imag) / denom);
10002         }
10003     }
10004     #endif
__Pyx_c_neg_float(__pyx_t_float_complex a)10005     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
10006         __pyx_t_float_complex z;
10007         z.real = -a.real;
10008         z.imag = -a.imag;
10009         return z;
10010     }
__Pyx_c_is_zero_float(__pyx_t_float_complex a)10011     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
10012        return (a.real == 0) && (a.imag == 0);
10013     }
__Pyx_c_conj_float(__pyx_t_float_complex a)10014     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
10015         __pyx_t_float_complex z;
10016         z.real =  a.real;
10017         z.imag = -a.imag;
10018         return z;
10019     }
10020     #if 1
__Pyx_c_abs_float(__pyx_t_float_complex z)10021         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
10022           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
10023             return sqrtf(z.real*z.real + z.imag*z.imag);
10024           #else
10025             return hypotf(z.real, z.imag);
10026           #endif
10027         }
__Pyx_c_pow_float(__pyx_t_float_complex a,__pyx_t_float_complex b)10028         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
10029             __pyx_t_float_complex z;
10030             float r, lnr, theta, z_r, z_theta;
10031             if (b.imag == 0 && b.real == (int)b.real) {
10032                 if (b.real < 0) {
10033                     float denom = a.real * a.real + a.imag * a.imag;
10034                     a.real = a.real / denom;
10035                     a.imag = -a.imag / denom;
10036                     b.real = -b.real;
10037                 }
10038                 switch ((int)b.real) {
10039                     case 0:
10040                         z.real = 1;
10041                         z.imag = 0;
10042                         return z;
10043                     case 1:
10044                         return a;
10045                     case 2:
10046                         z = __Pyx_c_prod_float(a, a);
10047                         return __Pyx_c_prod_float(a, a);
10048                     case 3:
10049                         z = __Pyx_c_prod_float(a, a);
10050                         return __Pyx_c_prod_float(z, a);
10051                     case 4:
10052                         z = __Pyx_c_prod_float(a, a);
10053                         return __Pyx_c_prod_float(z, z);
10054                 }
10055             }
10056             if (a.imag == 0) {
10057                 if (a.real == 0) {
10058                     return a;
10059                 } else if (b.imag == 0) {
10060                     z.real = powf(a.real, b.real);
10061                     z.imag = 0;
10062                     return z;
10063                 } else if (a.real > 0) {
10064                     r = a.real;
10065                     theta = 0;
10066                 } else {
10067                     r = -a.real;
10068                     theta = atan2f(0.0, -1.0);
10069                 }
10070             } else {
10071                 r = __Pyx_c_abs_float(a);
10072                 theta = atan2f(a.imag, a.real);
10073             }
10074             lnr = logf(r);
10075             z_r = expf(lnr * b.real - theta * b.imag);
10076             z_theta = theta * b.real + lnr * b.imag;
10077             z.real = z_r * cosf(z_theta);
10078             z.imag = z_r * sinf(z_theta);
10079             return z;
10080         }
10081     #endif
10082 #endif
10083 
10084 /* Declarations */
10085 #if CYTHON_CCOMPLEX
10086   #ifdef __cplusplus
__pyx_t_double_complex_from_parts(double x,double y)10087     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
10088       return ::std::complex< double >(x, y);
10089     }
10090   #else
__pyx_t_double_complex_from_parts(double x,double y)10091     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
10092       return x + y*(__pyx_t_double_complex)_Complex_I;
10093     }
10094   #endif
10095 #else
__pyx_t_double_complex_from_parts(double x,double y)10096     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
10097       __pyx_t_double_complex z;
10098       z.real = x;
10099       z.imag = y;
10100       return z;
10101     }
10102 #endif
10103 
10104 /* Arithmetic */
10105 #if CYTHON_CCOMPLEX
10106 #else
__Pyx_c_eq_double(__pyx_t_double_complex a,__pyx_t_double_complex b)10107     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
10108        return (a.real == b.real) && (a.imag == b.imag);
10109     }
__Pyx_c_sum_double(__pyx_t_double_complex a,__pyx_t_double_complex b)10110     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
10111         __pyx_t_double_complex z;
10112         z.real = a.real + b.real;
10113         z.imag = a.imag + b.imag;
10114         return z;
10115     }
__Pyx_c_diff_double(__pyx_t_double_complex a,__pyx_t_double_complex b)10116     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
10117         __pyx_t_double_complex z;
10118         z.real = a.real - b.real;
10119         z.imag = a.imag - b.imag;
10120         return z;
10121     }
__Pyx_c_prod_double(__pyx_t_double_complex a,__pyx_t_double_complex b)10122     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
10123         __pyx_t_double_complex z;
10124         z.real = a.real * b.real - a.imag * b.imag;
10125         z.imag = a.real * b.imag + a.imag * b.real;
10126         return z;
10127     }
10128     #if 1
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)10129     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
10130         if (b.imag == 0) {
10131             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
10132         } else if (fabs(b.real) >= fabs(b.imag)) {
10133             if (b.real == 0 && b.imag == 0) {
10134                 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
10135             } else {
10136                 double r = b.imag / b.real;
10137                 double s = (double)(1.0) / (b.real + b.imag * r);
10138                 return __pyx_t_double_complex_from_parts(
10139                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
10140             }
10141         } else {
10142             double r = b.real / b.imag;
10143             double s = (double)(1.0) / (b.imag + b.real * r);
10144             return __pyx_t_double_complex_from_parts(
10145                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
10146         }
10147     }
10148     #else
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)10149     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
10150         if (b.imag == 0) {
10151             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
10152         } else {
10153             double denom = b.real * b.real + b.imag * b.imag;
10154             return __pyx_t_double_complex_from_parts(
10155                 (a.real * b.real + a.imag * b.imag) / denom,
10156                 (a.imag * b.real - a.real * b.imag) / denom);
10157         }
10158     }
10159     #endif
__Pyx_c_neg_double(__pyx_t_double_complex a)10160     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
10161         __pyx_t_double_complex z;
10162         z.real = -a.real;
10163         z.imag = -a.imag;
10164         return z;
10165     }
__Pyx_c_is_zero_double(__pyx_t_double_complex a)10166     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
10167        return (a.real == 0) && (a.imag == 0);
10168     }
__Pyx_c_conj_double(__pyx_t_double_complex a)10169     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
10170         __pyx_t_double_complex z;
10171         z.real =  a.real;
10172         z.imag = -a.imag;
10173         return z;
10174     }
10175     #if 1
__Pyx_c_abs_double(__pyx_t_double_complex z)10176         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
10177           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
10178             return sqrt(z.real*z.real + z.imag*z.imag);
10179           #else
10180             return hypot(z.real, z.imag);
10181           #endif
10182         }
__Pyx_c_pow_double(__pyx_t_double_complex a,__pyx_t_double_complex b)10183         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
10184             __pyx_t_double_complex z;
10185             double r, lnr, theta, z_r, z_theta;
10186             if (b.imag == 0 && b.real == (int)b.real) {
10187                 if (b.real < 0) {
10188                     double denom = a.real * a.real + a.imag * a.imag;
10189                     a.real = a.real / denom;
10190                     a.imag = -a.imag / denom;
10191                     b.real = -b.real;
10192                 }
10193                 switch ((int)b.real) {
10194                     case 0:
10195                         z.real = 1;
10196                         z.imag = 0;
10197                         return z;
10198                     case 1:
10199                         return a;
10200                     case 2:
10201                         z = __Pyx_c_prod_double(a, a);
10202                         return __Pyx_c_prod_double(a, a);
10203                     case 3:
10204                         z = __Pyx_c_prod_double(a, a);
10205                         return __Pyx_c_prod_double(z, a);
10206                     case 4:
10207                         z = __Pyx_c_prod_double(a, a);
10208                         return __Pyx_c_prod_double(z, z);
10209                 }
10210             }
10211             if (a.imag == 0) {
10212                 if (a.real == 0) {
10213                     return a;
10214                 } else if (b.imag == 0) {
10215                     z.real = pow(a.real, b.real);
10216                     z.imag = 0;
10217                     return z;
10218                 } else if (a.real > 0) {
10219                     r = a.real;
10220                     theta = 0;
10221                 } else {
10222                     r = -a.real;
10223                     theta = atan2(0.0, -1.0);
10224                 }
10225             } else {
10226                 r = __Pyx_c_abs_double(a);
10227                 theta = atan2(a.imag, a.real);
10228             }
10229             lnr = log(r);
10230             z_r = exp(lnr * b.real - theta * b.imag);
10231             z_theta = theta * b.real + lnr * b.imag;
10232             z.real = z_r * cos(z_theta);
10233             z.imag = z_r * sin(z_theta);
10234             return z;
10235         }
10236     #endif
10237 #endif
10238 
10239 /* CIntToPy */
__Pyx_PyInt_From_int(int value)10240 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
10241     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
10242     const int is_unsigned = neg_one > const_zero;
10243     if (is_unsigned) {
10244         if (sizeof(int) < sizeof(long)) {
10245             return PyInt_FromLong((long) value);
10246         } else if (sizeof(int) <= sizeof(unsigned long)) {
10247             return PyLong_FromUnsignedLong((unsigned long) value);
10248 #ifdef HAVE_LONG_LONG
10249         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
10250             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
10251 #endif
10252         }
10253     } else {
10254         if (sizeof(int) <= sizeof(long)) {
10255             return PyInt_FromLong((long) value);
10256 #ifdef HAVE_LONG_LONG
10257         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
10258             return PyLong_FromLongLong((PY_LONG_LONG) value);
10259 #endif
10260         }
10261     }
10262     {
10263         int one = 1; int little = (int)*(unsigned char *)&one;
10264         unsigned char *bytes = (unsigned char *)&value;
10265         return _PyLong_FromByteArray(bytes, sizeof(int),
10266                                      little, !is_unsigned);
10267     }
10268 }
10269 
10270 /* CIntToPy */
__Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value)10271 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
10272     const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0;
10273     const int is_unsigned = neg_one > const_zero;
10274     if (is_unsigned) {
10275         if (sizeof(enum NPY_TYPES) < sizeof(long)) {
10276             return PyInt_FromLong((long) value);
10277         } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
10278             return PyLong_FromUnsignedLong((unsigned long) value);
10279 #ifdef HAVE_LONG_LONG
10280         } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
10281             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
10282 #endif
10283         }
10284     } else {
10285         if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
10286             return PyInt_FromLong((long) value);
10287 #ifdef HAVE_LONG_LONG
10288         } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
10289             return PyLong_FromLongLong((PY_LONG_LONG) value);
10290 #endif
10291         }
10292     }
10293     {
10294         int one = 1; int little = (int)*(unsigned char *)&one;
10295         unsigned char *bytes = (unsigned char *)&value;
10296         return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
10297                                      little, !is_unsigned);
10298     }
10299 }
10300 
10301 /* CIntFromPy */
__Pyx_PyInt_As_npy_int64(PyObject * x)10302 static CYTHON_INLINE npy_int64 __Pyx_PyInt_As_npy_int64(PyObject *x) {
10303     const npy_int64 neg_one = (npy_int64) ((npy_int64) 0 - (npy_int64) 1), const_zero = (npy_int64) 0;
10304     const int is_unsigned = neg_one > const_zero;
10305 #if PY_MAJOR_VERSION < 3
10306     if (likely(PyInt_Check(x))) {
10307         if (sizeof(npy_int64) < sizeof(long)) {
10308             __PYX_VERIFY_RETURN_INT(npy_int64, long, PyInt_AS_LONG(x))
10309         } else {
10310             long val = PyInt_AS_LONG(x);
10311             if (is_unsigned && unlikely(val < 0)) {
10312                 goto raise_neg_overflow;
10313             }
10314             return (npy_int64) val;
10315         }
10316     } else
10317 #endif
10318     if (likely(PyLong_Check(x))) {
10319         if (is_unsigned) {
10320 #if CYTHON_USE_PYLONG_INTERNALS
10321             const digit* digits = ((PyLongObject*)x)->ob_digit;
10322             switch (Py_SIZE(x)) {
10323                 case  0: return (npy_int64) 0;
10324                 case  1: __PYX_VERIFY_RETURN_INT(npy_int64, digit, digits[0])
10325                 case 2:
10326                     if (8 * sizeof(npy_int64) > 1 * PyLong_SHIFT) {
10327                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10328                             __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10329                         } else if (8 * sizeof(npy_int64) >= 2 * PyLong_SHIFT) {
10330                             return (npy_int64) (((((npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0]));
10331                         }
10332                     }
10333                     break;
10334                 case 3:
10335                     if (8 * sizeof(npy_int64) > 2 * PyLong_SHIFT) {
10336                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10337                             __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10338                         } else if (8 * sizeof(npy_int64) >= 3 * PyLong_SHIFT) {
10339                             return (npy_int64) (((((((npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0]));
10340                         }
10341                     }
10342                     break;
10343                 case 4:
10344                     if (8 * sizeof(npy_int64) > 3 * PyLong_SHIFT) {
10345                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10346                             __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])))
10347                         } else if (8 * sizeof(npy_int64) >= 4 * PyLong_SHIFT) {
10348                             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]));
10349                         }
10350                     }
10351                     break;
10352             }
10353 #endif
10354 #if CYTHON_COMPILING_IN_CPYTHON
10355             if (unlikely(Py_SIZE(x) < 0)) {
10356                 goto raise_neg_overflow;
10357             }
10358 #else
10359             {
10360                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
10361                 if (unlikely(result < 0))
10362                     return (npy_int64) -1;
10363                 if (unlikely(result == 1))
10364                     goto raise_neg_overflow;
10365             }
10366 #endif
10367             if (sizeof(npy_int64) <= sizeof(unsigned long)) {
10368                 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, unsigned long, PyLong_AsUnsignedLong(x))
10369 #ifdef HAVE_LONG_LONG
10370             } else if (sizeof(npy_int64) <= sizeof(unsigned PY_LONG_LONG)) {
10371                 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
10372 #endif
10373             }
10374         } else {
10375 #if CYTHON_USE_PYLONG_INTERNALS
10376             const digit* digits = ((PyLongObject*)x)->ob_digit;
10377             switch (Py_SIZE(x)) {
10378                 case  0: return (npy_int64) 0;
10379                 case -1: __PYX_VERIFY_RETURN_INT(npy_int64, sdigit, (sdigit) (-(sdigit)digits[0]))
10380                 case  1: __PYX_VERIFY_RETURN_INT(npy_int64,  digit, +digits[0])
10381                 case -2:
10382                     if (8 * sizeof(npy_int64) - 1 > 1 * PyLong_SHIFT) {
10383                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10384                             __PYX_VERIFY_RETURN_INT(npy_int64, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10385                         } else if (8 * sizeof(npy_int64) - 1 > 2 * PyLong_SHIFT) {
10386                             return (npy_int64) (((npy_int64)-1)*(((((npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
10387                         }
10388                     }
10389                     break;
10390                 case 2:
10391                     if (8 * sizeof(npy_int64) > 1 * PyLong_SHIFT) {
10392                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10393                             __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10394                         } else if (8 * sizeof(npy_int64) - 1 > 2 * PyLong_SHIFT) {
10395                             return (npy_int64) ((((((npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
10396                         }
10397                     }
10398                     break;
10399                 case -3:
10400                     if (8 * sizeof(npy_int64) - 1 > 2 * PyLong_SHIFT) {
10401                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10402                             __PYX_VERIFY_RETURN_INT(npy_int64, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10403                         } else if (8 * sizeof(npy_int64) - 1 > 3 * PyLong_SHIFT) {
10404                             return (npy_int64) (((npy_int64)-1)*(((((((npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
10405                         }
10406                     }
10407                     break;
10408                 case 3:
10409                     if (8 * sizeof(npy_int64) > 2 * PyLong_SHIFT) {
10410                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10411                             __PYX_VERIFY_RETURN_INT(npy_int64, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10412                         } else if (8 * sizeof(npy_int64) - 1 > 3 * PyLong_SHIFT) {
10413                             return (npy_int64) ((((((((npy_int64)digits[2]) << PyLong_SHIFT) | (npy_int64)digits[1]) << PyLong_SHIFT) | (npy_int64)digits[0])));
10414                         }
10415                     }
10416                     break;
10417                 case -4:
10418                     if (8 * sizeof(npy_int64) - 1 > 3 * PyLong_SHIFT) {
10419                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10420                             __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])))
10421                         } else if (8 * sizeof(npy_int64) - 1 > 4 * PyLong_SHIFT) {
10422                             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])));
10423                         }
10424                     }
10425                     break;
10426                 case 4:
10427                     if (8 * sizeof(npy_int64) > 3 * PyLong_SHIFT) {
10428                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10429                             __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])))
10430                         } else if (8 * sizeof(npy_int64) - 1 > 4 * PyLong_SHIFT) {
10431                             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])));
10432                         }
10433                     }
10434                     break;
10435             }
10436 #endif
10437             if (sizeof(npy_int64) <= sizeof(long)) {
10438                 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, long, PyLong_AsLong(x))
10439 #ifdef HAVE_LONG_LONG
10440             } else if (sizeof(npy_int64) <= sizeof(PY_LONG_LONG)) {
10441                 __PYX_VERIFY_RETURN_INT_EXC(npy_int64, PY_LONG_LONG, PyLong_AsLongLong(x))
10442 #endif
10443             }
10444         }
10445         {
10446 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
10447             PyErr_SetString(PyExc_RuntimeError,
10448                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
10449 #else
10450             npy_int64 val;
10451             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
10452  #if PY_MAJOR_VERSION < 3
10453             if (likely(v) && !PyLong_Check(v)) {
10454                 PyObject *tmp = v;
10455                 v = PyNumber_Long(tmp);
10456                 Py_DECREF(tmp);
10457             }
10458  #endif
10459             if (likely(v)) {
10460                 int one = 1; int is_little = (int)*(unsigned char *)&one;
10461                 unsigned char *bytes = (unsigned char *)&val;
10462                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
10463                                               bytes, sizeof(val),
10464                                               is_little, !is_unsigned);
10465                 Py_DECREF(v);
10466                 if (likely(!ret))
10467                     return val;
10468             }
10469 #endif
10470             return (npy_int64) -1;
10471         }
10472     } else {
10473         npy_int64 val;
10474         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
10475         if (!tmp) return (npy_int64) -1;
10476         val = __Pyx_PyInt_As_npy_int64(tmp);
10477         Py_DECREF(tmp);
10478         return val;
10479     }
10480 raise_overflow:
10481     PyErr_SetString(PyExc_OverflowError,
10482         "value too large to convert to npy_int64");
10483     return (npy_int64) -1;
10484 raise_neg_overflow:
10485     PyErr_SetString(PyExc_OverflowError,
10486         "can't convert negative value to npy_int64");
10487     return (npy_int64) -1;
10488 }
10489 
10490 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)10491 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
10492     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
10493     const int is_unsigned = neg_one > const_zero;
10494 #if PY_MAJOR_VERSION < 3
10495     if (likely(PyInt_Check(x))) {
10496         if (sizeof(int) < sizeof(long)) {
10497             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
10498         } else {
10499             long val = PyInt_AS_LONG(x);
10500             if (is_unsigned && unlikely(val < 0)) {
10501                 goto raise_neg_overflow;
10502             }
10503             return (int) val;
10504         }
10505     } else
10506 #endif
10507     if (likely(PyLong_Check(x))) {
10508         if (is_unsigned) {
10509 #if CYTHON_USE_PYLONG_INTERNALS
10510             const digit* digits = ((PyLongObject*)x)->ob_digit;
10511             switch (Py_SIZE(x)) {
10512                 case  0: return (int) 0;
10513                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
10514                 case 2:
10515                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
10516                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10517                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10518                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
10519                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
10520                         }
10521                     }
10522                     break;
10523                 case 3:
10524                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
10525                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10526                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10527                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
10528                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
10529                         }
10530                     }
10531                     break;
10532                 case 4:
10533                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
10534                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10535                             __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])))
10536                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
10537                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
10538                         }
10539                     }
10540                     break;
10541             }
10542 #endif
10543 #if CYTHON_COMPILING_IN_CPYTHON
10544             if (unlikely(Py_SIZE(x) < 0)) {
10545                 goto raise_neg_overflow;
10546             }
10547 #else
10548             {
10549                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
10550                 if (unlikely(result < 0))
10551                     return (int) -1;
10552                 if (unlikely(result == 1))
10553                     goto raise_neg_overflow;
10554             }
10555 #endif
10556             if (sizeof(int) <= sizeof(unsigned long)) {
10557                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
10558 #ifdef HAVE_LONG_LONG
10559             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
10560                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
10561 #endif
10562             }
10563         } else {
10564 #if CYTHON_USE_PYLONG_INTERNALS
10565             const digit* digits = ((PyLongObject*)x)->ob_digit;
10566             switch (Py_SIZE(x)) {
10567                 case  0: return (int) 0;
10568                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
10569                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
10570                 case -2:
10571                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
10572                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10573                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10574                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
10575                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
10576                         }
10577                     }
10578                     break;
10579                 case 2:
10580                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
10581                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10582                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10583                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
10584                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
10585                         }
10586                     }
10587                     break;
10588                 case -3:
10589                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
10590                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10591                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10592                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
10593                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
10594                         }
10595                     }
10596                     break;
10597                 case 3:
10598                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
10599                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10600                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10601                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
10602                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
10603                         }
10604                     }
10605                     break;
10606                 case -4:
10607                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
10608                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10609                             __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])))
10610                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
10611                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
10612                         }
10613                     }
10614                     break;
10615                 case 4:
10616                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
10617                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10618                             __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])))
10619                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
10620                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
10621                         }
10622                     }
10623                     break;
10624             }
10625 #endif
10626             if (sizeof(int) <= sizeof(long)) {
10627                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
10628 #ifdef HAVE_LONG_LONG
10629             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
10630                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
10631 #endif
10632             }
10633         }
10634         {
10635 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
10636             PyErr_SetString(PyExc_RuntimeError,
10637                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
10638 #else
10639             int val;
10640             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
10641  #if PY_MAJOR_VERSION < 3
10642             if (likely(v) && !PyLong_Check(v)) {
10643                 PyObject *tmp = v;
10644                 v = PyNumber_Long(tmp);
10645                 Py_DECREF(tmp);
10646             }
10647  #endif
10648             if (likely(v)) {
10649                 int one = 1; int is_little = (int)*(unsigned char *)&one;
10650                 unsigned char *bytes = (unsigned char *)&val;
10651                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
10652                                               bytes, sizeof(val),
10653                                               is_little, !is_unsigned);
10654                 Py_DECREF(v);
10655                 if (likely(!ret))
10656                     return val;
10657             }
10658 #endif
10659             return (int) -1;
10660         }
10661     } else {
10662         int val;
10663         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
10664         if (!tmp) return (int) -1;
10665         val = __Pyx_PyInt_As_int(tmp);
10666         Py_DECREF(tmp);
10667         return val;
10668     }
10669 raise_overflow:
10670     PyErr_SetString(PyExc_OverflowError,
10671         "value too large to convert to int");
10672     return (int) -1;
10673 raise_neg_overflow:
10674     PyErr_SetString(PyExc_OverflowError,
10675         "can't convert negative value to int");
10676     return (int) -1;
10677 }
10678 
10679 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)10680 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
10681     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
10682     const int is_unsigned = neg_one > const_zero;
10683 #if PY_MAJOR_VERSION < 3
10684     if (likely(PyInt_Check(x))) {
10685         if (sizeof(long) < sizeof(long)) {
10686             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
10687         } else {
10688             long val = PyInt_AS_LONG(x);
10689             if (is_unsigned && unlikely(val < 0)) {
10690                 goto raise_neg_overflow;
10691             }
10692             return (long) val;
10693         }
10694     } else
10695 #endif
10696     if (likely(PyLong_Check(x))) {
10697         if (is_unsigned) {
10698 #if CYTHON_USE_PYLONG_INTERNALS
10699             const digit* digits = ((PyLongObject*)x)->ob_digit;
10700             switch (Py_SIZE(x)) {
10701                 case  0: return (long) 0;
10702                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
10703                 case 2:
10704                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
10705                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10706                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10707                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
10708                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
10709                         }
10710                     }
10711                     break;
10712                 case 3:
10713                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
10714                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10715                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10716                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
10717                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
10718                         }
10719                     }
10720                     break;
10721                 case 4:
10722                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
10723                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10724                             __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])))
10725                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
10726                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
10727                         }
10728                     }
10729                     break;
10730             }
10731 #endif
10732 #if CYTHON_COMPILING_IN_CPYTHON
10733             if (unlikely(Py_SIZE(x) < 0)) {
10734                 goto raise_neg_overflow;
10735             }
10736 #else
10737             {
10738                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
10739                 if (unlikely(result < 0))
10740                     return (long) -1;
10741                 if (unlikely(result == 1))
10742                     goto raise_neg_overflow;
10743             }
10744 #endif
10745             if (sizeof(long) <= sizeof(unsigned long)) {
10746                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
10747 #ifdef HAVE_LONG_LONG
10748             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
10749                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
10750 #endif
10751             }
10752         } else {
10753 #if CYTHON_USE_PYLONG_INTERNALS
10754             const digit* digits = ((PyLongObject*)x)->ob_digit;
10755             switch (Py_SIZE(x)) {
10756                 case  0: return (long) 0;
10757                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
10758                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
10759                 case -2:
10760                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
10761                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10762                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10763                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
10764                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10765                         }
10766                     }
10767                     break;
10768                 case 2:
10769                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
10770                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10771                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10772                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
10773                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10774                         }
10775                     }
10776                     break;
10777                 case -3:
10778                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
10779                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10780                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10781                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
10782                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10783                         }
10784                     }
10785                     break;
10786                 case 3:
10787                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
10788                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10789                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10790                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
10791                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10792                         }
10793                     }
10794                     break;
10795                 case -4:
10796                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
10797                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10798                             __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])))
10799                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
10800                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10801                         }
10802                     }
10803                     break;
10804                 case 4:
10805                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
10806                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10807                             __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])))
10808                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
10809                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10810                         }
10811                     }
10812                     break;
10813             }
10814 #endif
10815             if (sizeof(long) <= sizeof(long)) {
10816                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
10817 #ifdef HAVE_LONG_LONG
10818             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
10819                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
10820 #endif
10821             }
10822         }
10823         {
10824 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
10825             PyErr_SetString(PyExc_RuntimeError,
10826                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
10827 #else
10828             long val;
10829             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
10830  #if PY_MAJOR_VERSION < 3
10831             if (likely(v) && !PyLong_Check(v)) {
10832                 PyObject *tmp = v;
10833                 v = PyNumber_Long(tmp);
10834                 Py_DECREF(tmp);
10835             }
10836  #endif
10837             if (likely(v)) {
10838                 int one = 1; int is_little = (int)*(unsigned char *)&one;
10839                 unsigned char *bytes = (unsigned char *)&val;
10840                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
10841                                               bytes, sizeof(val),
10842                                               is_little, !is_unsigned);
10843                 Py_DECREF(v);
10844                 if (likely(!ret))
10845                     return val;
10846             }
10847 #endif
10848             return (long) -1;
10849         }
10850     } else {
10851         long val;
10852         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
10853         if (!tmp) return (long) -1;
10854         val = __Pyx_PyInt_As_long(tmp);
10855         Py_DECREF(tmp);
10856         return val;
10857     }
10858 raise_overflow:
10859     PyErr_SetString(PyExc_OverflowError,
10860         "value too large to convert to long");
10861     return (long) -1;
10862 raise_neg_overflow:
10863     PyErr_SetString(PyExc_OverflowError,
10864         "can't convert negative value to long");
10865     return (long) -1;
10866 }
10867 
10868 /* CIntToPy */
__Pyx_PyInt_From_long(long value)10869 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
10870     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
10871     const int is_unsigned = neg_one > const_zero;
10872     if (is_unsigned) {
10873         if (sizeof(long) < sizeof(long)) {
10874             return PyInt_FromLong((long) value);
10875         } else if (sizeof(long) <= sizeof(unsigned long)) {
10876             return PyLong_FromUnsignedLong((unsigned long) value);
10877 #ifdef HAVE_LONG_LONG
10878         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
10879             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
10880 #endif
10881         }
10882     } else {
10883         if (sizeof(long) <= sizeof(long)) {
10884             return PyInt_FromLong((long) value);
10885 #ifdef HAVE_LONG_LONG
10886         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
10887             return PyLong_FromLongLong((PY_LONG_LONG) value);
10888 #endif
10889         }
10890     }
10891     {
10892         int one = 1; int little = (int)*(unsigned char *)&one;
10893         unsigned char *bytes = (unsigned char *)&value;
10894         return _PyLong_FromByteArray(bytes, sizeof(long),
10895                                      little, !is_unsigned);
10896     }
10897 }
10898 
10899 /* FastTypeChecks */
10900 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)10901 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
10902     while (a) {
10903         a = a->tp_base;
10904         if (a == b)
10905             return 1;
10906     }
10907     return b == &PyBaseObject_Type;
10908 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)10909 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
10910     PyObject *mro;
10911     if (a == b) return 1;
10912     mro = a->tp_mro;
10913     if (likely(mro)) {
10914         Py_ssize_t i, n;
10915         n = PyTuple_GET_SIZE(mro);
10916         for (i = 0; i < n; i++) {
10917             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
10918                 return 1;
10919         }
10920         return 0;
10921     }
10922     return __Pyx_InBases(a, b);
10923 }
10924 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)10925 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
10926     PyObject *exception, *value, *tb;
10927     int res;
10928     __Pyx_PyThreadState_declare
10929     __Pyx_PyThreadState_assign
10930     __Pyx_ErrFetch(&exception, &value, &tb);
10931     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
10932     if (unlikely(res == -1)) {
10933         PyErr_WriteUnraisable(err);
10934         res = 0;
10935     }
10936     if (!res) {
10937         res = PyObject_IsSubclass(err, exc_type2);
10938         if (unlikely(res == -1)) {
10939             PyErr_WriteUnraisable(err);
10940             res = 0;
10941         }
10942     }
10943     __Pyx_ErrRestore(exception, value, tb);
10944     return res;
10945 }
10946 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)10947 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
10948     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
10949     if (!res) {
10950         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
10951     }
10952     return res;
10953 }
10954 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)10955 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
10956     Py_ssize_t i, n;
10957     assert(PyExceptionClass_Check(exc_type));
10958     n = PyTuple_GET_SIZE(tuple);
10959 #if PY_MAJOR_VERSION >= 3
10960     for (i=0; i<n; i++) {
10961         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
10962     }
10963 #endif
10964     for (i=0; i<n; i++) {
10965         PyObject *t = PyTuple_GET_ITEM(tuple, i);
10966         #if PY_MAJOR_VERSION < 3
10967         if (likely(exc_type == t)) return 1;
10968         #endif
10969         if (likely(PyExceptionClass_Check(t))) {
10970             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
10971         } else {
10972         }
10973     }
10974     return 0;
10975 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)10976 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
10977     if (likely(err == exc_type)) return 1;
10978     if (likely(PyExceptionClass_Check(err))) {
10979         if (likely(PyExceptionClass_Check(exc_type))) {
10980             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
10981         } else if (likely(PyTuple_Check(exc_type))) {
10982             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
10983         } else {
10984         }
10985     }
10986     return PyErr_GivenExceptionMatches(err, exc_type);
10987 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)10988 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
10989     assert(PyExceptionClass_Check(exc_type1));
10990     assert(PyExceptionClass_Check(exc_type2));
10991     if (likely(err == exc_type1 || err == exc_type2)) return 1;
10992     if (likely(PyExceptionClass_Check(err))) {
10993         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
10994     }
10995     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
10996 }
10997 #endif
10998 
10999 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)11000 static int __Pyx_check_binary_version(void) {
11001     char ctversion[4], rtversion[4];
11002     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
11003     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
11004     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
11005         char message[200];
11006         PyOS_snprintf(message, sizeof(message),
11007                       "compiletime version %s of module '%.100s' "
11008                       "does not match runtime version %s",
11009                       ctversion, __Pyx_MODULE_NAME, rtversion);
11010         return PyErr_WarnEx(NULL, message, 1);
11011     }
11012     return 0;
11013 }
11014 
11015 /* FunctionExport */
__Pyx_ExportFunction(const char * name,void (* f)(void),const char * sig)11016 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
11017     PyObject *d = 0;
11018     PyObject *cobj = 0;
11019     union {
11020         void (*fp)(void);
11021         void *p;
11022     } tmp;
11023     d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
11024     if (!d) {
11025         PyErr_Clear();
11026         d = PyDict_New();
11027         if (!d)
11028             goto bad;
11029         Py_INCREF(d);
11030         if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
11031             goto bad;
11032     }
11033     tmp.fp = f;
11034 #if PY_VERSION_HEX >= 0x02070000
11035     cobj = PyCapsule_New(tmp.p, sig, 0);
11036 #else
11037     cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
11038 #endif
11039     if (!cobj)
11040         goto bad;
11041     if (PyDict_SetItemString(d, name, cobj) < 0)
11042         goto bad;
11043     Py_DECREF(cobj);
11044     Py_DECREF(d);
11045     return 0;
11046 bad:
11047     Py_XDECREF(cobj);
11048     Py_XDECREF(d);
11049     return -1;
11050 }
11051 
11052 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)11053 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
11054     while (t->p) {
11055         #if PY_MAJOR_VERSION < 3
11056         if (t->is_unicode) {
11057             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
11058         } else if (t->intern) {
11059             *t->p = PyString_InternFromString(t->s);
11060         } else {
11061             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
11062         }
11063         #else
11064         if (t->is_unicode | t->is_str) {
11065             if (t->intern) {
11066                 *t->p = PyUnicode_InternFromString(t->s);
11067             } else if (t->encoding) {
11068                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
11069             } else {
11070                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
11071             }
11072         } else {
11073             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
11074         }
11075         #endif
11076         if (!*t->p)
11077             return -1;
11078         if (PyObject_Hash(*t->p) == -1)
11079             return -1;
11080         ++t;
11081     }
11082     return 0;
11083 }
11084 
__Pyx_PyUnicode_FromString(const char * c_str)11085 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
11086     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
11087 }
__Pyx_PyObject_AsString(PyObject * o)11088 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
11089     Py_ssize_t ignore;
11090     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
11091 }
11092 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
11093 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)11094 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
11095     char* defenc_c;
11096     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
11097     if (!defenc) return NULL;
11098     defenc_c = PyBytes_AS_STRING(defenc);
11099 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
11100     {
11101         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
11102         char* c;
11103         for (c = defenc_c; c < end; c++) {
11104             if ((unsigned char) (*c) >= 128) {
11105                 PyUnicode_AsASCIIString(o);
11106                 return NULL;
11107             }
11108         }
11109     }
11110 #endif
11111     *length = PyBytes_GET_SIZE(defenc);
11112     return defenc_c;
11113 }
11114 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)11115 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
11116     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
11117 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
11118     if (likely(PyUnicode_IS_ASCII(o))) {
11119         *length = PyUnicode_GET_LENGTH(o);
11120         return PyUnicode_AsUTF8(o);
11121     } else {
11122         PyUnicode_AsASCIIString(o);
11123         return NULL;
11124     }
11125 #else
11126     return PyUnicode_AsUTF8AndSize(o, length);
11127 #endif
11128 }
11129 #endif
11130 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)11131 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
11132 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
11133     if (
11134 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
11135             __Pyx_sys_getdefaultencoding_not_ascii &&
11136 #endif
11137             PyUnicode_Check(o)) {
11138         return __Pyx_PyUnicode_AsStringAndSize(o, length);
11139     } else
11140 #endif
11141 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
11142     if (PyByteArray_Check(o)) {
11143         *length = PyByteArray_GET_SIZE(o);
11144         return PyByteArray_AS_STRING(o);
11145     } else
11146 #endif
11147     {
11148         char* result;
11149         int r = PyBytes_AsStringAndSize(o, &result, length);
11150         if (unlikely(r < 0)) {
11151             return NULL;
11152         } else {
11153             return result;
11154         }
11155     }
11156 }
__Pyx_PyObject_IsTrue(PyObject * x)11157 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
11158    int is_true = x == Py_True;
11159    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
11160    else return PyObject_IsTrue(x);
11161 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)11162 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
11163     int retval;
11164     if (unlikely(!x)) return -1;
11165     retval = __Pyx_PyObject_IsTrue(x);
11166     Py_DECREF(x);
11167     return retval;
11168 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)11169 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
11170 #if PY_MAJOR_VERSION >= 3
11171     if (PyLong_Check(result)) {
11172         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
11173                 "__int__ returned non-int (type %.200s).  "
11174                 "The ability to return an instance of a strict subclass of int "
11175                 "is deprecated, and may be removed in a future version of Python.",
11176                 Py_TYPE(result)->tp_name)) {
11177             Py_DECREF(result);
11178             return NULL;
11179         }
11180         return result;
11181     }
11182 #endif
11183     PyErr_Format(PyExc_TypeError,
11184                  "__%.4s__ returned non-%.4s (type %.200s)",
11185                  type_name, type_name, Py_TYPE(result)->tp_name);
11186     Py_DECREF(result);
11187     return NULL;
11188 }
__Pyx_PyNumber_IntOrLong(PyObject * x)11189 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
11190 #if CYTHON_USE_TYPE_SLOTS
11191   PyNumberMethods *m;
11192 #endif
11193   const char *name = NULL;
11194   PyObject *res = NULL;
11195 #if PY_MAJOR_VERSION < 3
11196   if (likely(PyInt_Check(x) || PyLong_Check(x)))
11197 #else
11198   if (likely(PyLong_Check(x)))
11199 #endif
11200     return __Pyx_NewRef(x);
11201 #if CYTHON_USE_TYPE_SLOTS
11202   m = Py_TYPE(x)->tp_as_number;
11203   #if PY_MAJOR_VERSION < 3
11204   if (m && m->nb_int) {
11205     name = "int";
11206     res = m->nb_int(x);
11207   }
11208   else if (m && m->nb_long) {
11209     name = "long";
11210     res = m->nb_long(x);
11211   }
11212   #else
11213   if (likely(m && m->nb_int)) {
11214     name = "int";
11215     res = m->nb_int(x);
11216   }
11217   #endif
11218 #else
11219   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
11220     res = PyNumber_Int(x);
11221   }
11222 #endif
11223   if (likely(res)) {
11224 #if PY_MAJOR_VERSION < 3
11225     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
11226 #else
11227     if (unlikely(!PyLong_CheckExact(res))) {
11228 #endif
11229         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
11230     }
11231   }
11232   else if (!PyErr_Occurred()) {
11233     PyErr_SetString(PyExc_TypeError,
11234                     "an integer is required");
11235   }
11236   return res;
11237 }
11238 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
11239   Py_ssize_t ival;
11240   PyObject *x;
11241 #if PY_MAJOR_VERSION < 3
11242   if (likely(PyInt_CheckExact(b))) {
11243     if (sizeof(Py_ssize_t) >= sizeof(long))
11244         return PyInt_AS_LONG(b);
11245     else
11246         return PyInt_AsSsize_t(b);
11247   }
11248 #endif
11249   if (likely(PyLong_CheckExact(b))) {
11250     #if CYTHON_USE_PYLONG_INTERNALS
11251     const digit* digits = ((PyLongObject*)b)->ob_digit;
11252     const Py_ssize_t size = Py_SIZE(b);
11253     if (likely(__Pyx_sst_abs(size) <= 1)) {
11254         ival = likely(size) ? digits[0] : 0;
11255         if (size == -1) ival = -ival;
11256         return ival;
11257     } else {
11258       switch (size) {
11259          case 2:
11260            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
11261              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
11262            }
11263            break;
11264          case -2:
11265            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
11266              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
11267            }
11268            break;
11269          case 3:
11270            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
11271              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
11272            }
11273            break;
11274          case -3:
11275            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
11276              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
11277            }
11278            break;
11279          case 4:
11280            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
11281              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]));
11282            }
11283            break;
11284          case -4:
11285            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
11286              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]));
11287            }
11288            break;
11289       }
11290     }
11291     #endif
11292     return PyLong_AsSsize_t(b);
11293   }
11294   x = PyNumber_Index(b);
11295   if (!x) return -1;
11296   ival = PyInt_AsSsize_t(x);
11297   Py_DECREF(x);
11298   return ival;
11299 }
11300 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
11301   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
11302 }
11303 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
11304     return PyInt_FromSize_t(ival);
11305 }
11306 
11307 
11308 #endif /* Py_PYTHON_H */
11309