1 /* Generated by Cython 0.29.23 */
2 
3 #ifndef PY_SSIZE_T_CLEAN
4 #define PY_SSIZE_T_CLEAN
5 #endif /* PY_SSIZE_T_CLEAN */
6 #include "Python.h"
7 #ifndef Py_PYTHON_H
8     #error Python headers needed to compile C extensions, please install development version of Python.
9 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
10     #error Cython requires Python 2.6+ or Python 3.3+.
11 #else
12 #define CYTHON_ABI "0_29_23"
13 #define CYTHON_HEX_VERSION 0x001D17F0
14 #define CYTHON_FUTURE_DIVISION 1
15 #include <stddef.h>
16 #ifndef offsetof
17   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
18 #endif
19 #if !defined(WIN32) && !defined(MS_WINDOWS)
20   #ifndef __stdcall
21     #define __stdcall
22   #endif
23   #ifndef __cdecl
24     #define __cdecl
25   #endif
26   #ifndef __fastcall
27     #define __fastcall
28   #endif
29 #endif
30 #ifndef DL_IMPORT
31   #define DL_IMPORT(t) t
32 #endif
33 #ifndef DL_EXPORT
34   #define DL_EXPORT(t) t
35 #endif
36 #define __PYX_COMMA ,
37 #ifndef HAVE_LONG_LONG
38   #if PY_VERSION_HEX >= 0x02070000
39     #define HAVE_LONG_LONG
40   #endif
41 #endif
42 #ifndef PY_LONG_LONG
43   #define PY_LONG_LONG LONG_LONG
44 #endif
45 #ifndef Py_HUGE_VAL
46   #define Py_HUGE_VAL HUGE_VAL
47 #endif
48 #ifdef PYPY_VERSION
49   #define CYTHON_COMPILING_IN_PYPY 1
50   #define CYTHON_COMPILING_IN_PYSTON 0
51   #define CYTHON_COMPILING_IN_CPYTHON 0
52   #undef CYTHON_USE_TYPE_SLOTS
53   #define CYTHON_USE_TYPE_SLOTS 0
54   #undef CYTHON_USE_PYTYPE_LOOKUP
55   #define CYTHON_USE_PYTYPE_LOOKUP 0
56   #if PY_VERSION_HEX < 0x03050000
57     #undef CYTHON_USE_ASYNC_SLOTS
58     #define CYTHON_USE_ASYNC_SLOTS 0
59   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
60     #define CYTHON_USE_ASYNC_SLOTS 1
61   #endif
62   #undef CYTHON_USE_PYLIST_INTERNALS
63   #define CYTHON_USE_PYLIST_INTERNALS 0
64   #undef CYTHON_USE_UNICODE_INTERNALS
65   #define CYTHON_USE_UNICODE_INTERNALS 0
66   #undef CYTHON_USE_UNICODE_WRITER
67   #define CYTHON_USE_UNICODE_WRITER 0
68   #undef CYTHON_USE_PYLONG_INTERNALS
69   #define CYTHON_USE_PYLONG_INTERNALS 0
70   #undef CYTHON_AVOID_BORROWED_REFS
71   #define CYTHON_AVOID_BORROWED_REFS 1
72   #undef CYTHON_ASSUME_SAFE_MACROS
73   #define CYTHON_ASSUME_SAFE_MACROS 0
74   #undef CYTHON_UNPACK_METHODS
75   #define CYTHON_UNPACK_METHODS 0
76   #undef CYTHON_FAST_THREAD_STATE
77   #define CYTHON_FAST_THREAD_STATE 0
78   #undef CYTHON_FAST_PYCALL
79   #define CYTHON_FAST_PYCALL 0
80   #undef CYTHON_PEP489_MULTI_PHASE_INIT
81   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
82   #undef CYTHON_USE_TP_FINALIZE
83   #define CYTHON_USE_TP_FINALIZE 0
84   #undef CYTHON_USE_DICT_VERSIONS
85   #define CYTHON_USE_DICT_VERSIONS 0
86   #undef CYTHON_USE_EXC_INFO_STACK
87   #define CYTHON_USE_EXC_INFO_STACK 0
88 #elif defined(PYSTON_VERSION)
89   #define CYTHON_COMPILING_IN_PYPY 0
90   #define CYTHON_COMPILING_IN_PYSTON 1
91   #define CYTHON_COMPILING_IN_CPYTHON 0
92   #ifndef CYTHON_USE_TYPE_SLOTS
93     #define CYTHON_USE_TYPE_SLOTS 1
94   #endif
95   #undef CYTHON_USE_PYTYPE_LOOKUP
96   #define CYTHON_USE_PYTYPE_LOOKUP 0
97   #undef CYTHON_USE_ASYNC_SLOTS
98   #define CYTHON_USE_ASYNC_SLOTS 0
99   #undef CYTHON_USE_PYLIST_INTERNALS
100   #define CYTHON_USE_PYLIST_INTERNALS 0
101   #ifndef CYTHON_USE_UNICODE_INTERNALS
102     #define CYTHON_USE_UNICODE_INTERNALS 1
103   #endif
104   #undef CYTHON_USE_UNICODE_WRITER
105   #define CYTHON_USE_UNICODE_WRITER 0
106   #undef CYTHON_USE_PYLONG_INTERNALS
107   #define CYTHON_USE_PYLONG_INTERNALS 0
108   #ifndef CYTHON_AVOID_BORROWED_REFS
109     #define CYTHON_AVOID_BORROWED_REFS 0
110   #endif
111   #ifndef CYTHON_ASSUME_SAFE_MACROS
112     #define CYTHON_ASSUME_SAFE_MACROS 1
113   #endif
114   #ifndef CYTHON_UNPACK_METHODS
115     #define CYTHON_UNPACK_METHODS 1
116   #endif
117   #undef CYTHON_FAST_THREAD_STATE
118   #define CYTHON_FAST_THREAD_STATE 0
119   #undef CYTHON_FAST_PYCALL
120   #define CYTHON_FAST_PYCALL 0
121   #undef CYTHON_PEP489_MULTI_PHASE_INIT
122   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
123   #undef CYTHON_USE_TP_FINALIZE
124   #define CYTHON_USE_TP_FINALIZE 0
125   #undef CYTHON_USE_DICT_VERSIONS
126   #define CYTHON_USE_DICT_VERSIONS 0
127   #undef CYTHON_USE_EXC_INFO_STACK
128   #define CYTHON_USE_EXC_INFO_STACK 0
129 #else
130   #define CYTHON_COMPILING_IN_PYPY 0
131   #define CYTHON_COMPILING_IN_PYSTON 0
132   #define CYTHON_COMPILING_IN_CPYTHON 1
133   #ifndef CYTHON_USE_TYPE_SLOTS
134     #define CYTHON_USE_TYPE_SLOTS 1
135   #endif
136   #if PY_VERSION_HEX < 0x02070000
137     #undef CYTHON_USE_PYTYPE_LOOKUP
138     #define CYTHON_USE_PYTYPE_LOOKUP 0
139   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
140     #define CYTHON_USE_PYTYPE_LOOKUP 1
141   #endif
142   #if PY_MAJOR_VERSION < 3
143     #undef CYTHON_USE_ASYNC_SLOTS
144     #define CYTHON_USE_ASYNC_SLOTS 0
145   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
146     #define CYTHON_USE_ASYNC_SLOTS 1
147   #endif
148   #if PY_VERSION_HEX < 0x02070000
149     #undef CYTHON_USE_PYLONG_INTERNALS
150     #define CYTHON_USE_PYLONG_INTERNALS 0
151   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
152     #define CYTHON_USE_PYLONG_INTERNALS 1
153   #endif
154   #ifndef CYTHON_USE_PYLIST_INTERNALS
155     #define CYTHON_USE_PYLIST_INTERNALS 1
156   #endif
157   #ifndef CYTHON_USE_UNICODE_INTERNALS
158     #define CYTHON_USE_UNICODE_INTERNALS 1
159   #endif
160   #if PY_VERSION_HEX < 0x030300F0
161     #undef CYTHON_USE_UNICODE_WRITER
162     #define CYTHON_USE_UNICODE_WRITER 0
163   #elif !defined(CYTHON_USE_UNICODE_WRITER)
164     #define CYTHON_USE_UNICODE_WRITER 1
165   #endif
166   #ifndef CYTHON_AVOID_BORROWED_REFS
167     #define CYTHON_AVOID_BORROWED_REFS 0
168   #endif
169   #ifndef CYTHON_ASSUME_SAFE_MACROS
170     #define CYTHON_ASSUME_SAFE_MACROS 1
171   #endif
172   #ifndef CYTHON_UNPACK_METHODS
173     #define CYTHON_UNPACK_METHODS 1
174   #endif
175   #ifndef CYTHON_FAST_THREAD_STATE
176     #define CYTHON_FAST_THREAD_STATE 1
177   #endif
178   #ifndef CYTHON_FAST_PYCALL
179     #define CYTHON_FAST_PYCALL 1
180   #endif
181   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
182     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
183   #endif
184   #ifndef CYTHON_USE_TP_FINALIZE
185     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
186   #endif
187   #ifndef CYTHON_USE_DICT_VERSIONS
188     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
189   #endif
190   #ifndef CYTHON_USE_EXC_INFO_STACK
191     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
192   #endif
193 #endif
194 #if !defined(CYTHON_FAST_PYCCALL)
195 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
196 #endif
197 #if CYTHON_USE_PYLONG_INTERNALS
198   #include "longintrepr.h"
199   #undef SHIFT
200   #undef BASE
201   #undef MASK
202   #ifdef SIZEOF_VOID_P
203     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
204   #endif
205 #endif
206 #ifndef __has_attribute
207   #define __has_attribute(x) 0
208 #endif
209 #ifndef __has_cpp_attribute
210   #define __has_cpp_attribute(x) 0
211 #endif
212 #ifndef CYTHON_RESTRICT
213   #if defined(__GNUC__)
214     #define CYTHON_RESTRICT __restrict__
215   #elif defined(_MSC_VER) && _MSC_VER >= 1400
216     #define CYTHON_RESTRICT __restrict
217   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
218     #define CYTHON_RESTRICT restrict
219   #else
220     #define CYTHON_RESTRICT
221   #endif
222 #endif
223 #ifndef CYTHON_UNUSED
224 # if defined(__GNUC__)
225 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
226 #     define CYTHON_UNUSED __attribute__ ((__unused__))
227 #   else
228 #     define CYTHON_UNUSED
229 #   endif
230 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
231 #   define CYTHON_UNUSED __attribute__ ((__unused__))
232 # else
233 #   define CYTHON_UNUSED
234 # endif
235 #endif
236 #ifndef CYTHON_MAYBE_UNUSED_VAR
237 #  if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)238      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
239 #  else
240 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
241 #  endif
242 #endif
243 #ifndef CYTHON_NCP_UNUSED
244 # if CYTHON_COMPILING_IN_CPYTHON
245 #  define CYTHON_NCP_UNUSED
246 # else
247 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
248 # endif
249 #endif
250 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
251 #ifdef _MSC_VER
252     #ifndef _MSC_STDINT_H_
253         #if _MSC_VER < 1300
254            typedef unsigned char     uint8_t;
255            typedef unsigned int      uint32_t;
256         #else
257            typedef unsigned __int8   uint8_t;
258            typedef unsigned __int32  uint32_t;
259         #endif
260     #endif
261 #else
262    #include <stdint.h>
263 #endif
264 #ifndef CYTHON_FALLTHROUGH
265   #if defined(__cplusplus) && __cplusplus >= 201103L
266     #if __has_cpp_attribute(fallthrough)
267       #define CYTHON_FALLTHROUGH [[fallthrough]]
268     #elif __has_cpp_attribute(clang::fallthrough)
269       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
270     #elif __has_cpp_attribute(gnu::fallthrough)
271       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
272     #endif
273   #endif
274   #ifndef CYTHON_FALLTHROUGH
275     #if __has_attribute(fallthrough)
276       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
277     #else
278       #define CYTHON_FALLTHROUGH
279     #endif
280   #endif
281   #if defined(__clang__ ) && defined(__apple_build_version__)
282     #if __apple_build_version__ < 7000000
283       #undef  CYTHON_FALLTHROUGH
284       #define CYTHON_FALLTHROUGH
285     #endif
286   #endif
287 #endif
288 
289 #ifndef CYTHON_INLINE
290   #if defined(__clang__)
291     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
292   #elif defined(__GNUC__)
293     #define CYTHON_INLINE __inline__
294   #elif defined(_MSC_VER)
295     #define CYTHON_INLINE __inline
296   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
297     #define CYTHON_INLINE inline
298   #else
299     #define CYTHON_INLINE
300   #endif
301 #endif
302 
303 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
304   #define Py_OptimizeFlag 0
305 #endif
306 #define __PYX_BUILD_PY_SSIZE_T "n"
307 #define CYTHON_FORMAT_SSIZE_T "z"
308 #if PY_MAJOR_VERSION < 3
309   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
310   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
311           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
312   #define __Pyx_DefaultClassType PyClass_Type
313 #else
314   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
315 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
316   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
317           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
318 #else
319   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
320           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
321 #endif
322   #define __Pyx_DefaultClassType PyType_Type
323 #endif
324 #ifndef Py_TPFLAGS_CHECKTYPES
325   #define Py_TPFLAGS_CHECKTYPES 0
326 #endif
327 #ifndef Py_TPFLAGS_HAVE_INDEX
328   #define Py_TPFLAGS_HAVE_INDEX 0
329 #endif
330 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
331   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
332 #endif
333 #ifndef Py_TPFLAGS_HAVE_FINALIZE
334   #define Py_TPFLAGS_HAVE_FINALIZE 0
335 #endif
336 #ifndef METH_STACKLESS
337   #define METH_STACKLESS 0
338 #endif
339 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
340   #ifndef METH_FASTCALL
341      #define METH_FASTCALL 0x80
342   #endif
343   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
344   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
345                                                           Py_ssize_t nargs, PyObject *kwnames);
346 #else
347   #define __Pyx_PyCFunctionFast _PyCFunctionFast
348   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
349 #endif
350 #if CYTHON_FAST_PYCCALL
351 #define __Pyx_PyFastCFunction_Check(func)\
352     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
353 #else
354 #define __Pyx_PyFastCFunction_Check(func) 0
355 #endif
356 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
357   #define PyObject_Malloc(s)   PyMem_Malloc(s)
358   #define PyObject_Free(p)     PyMem_Free(p)
359   #define PyObject_Realloc(p)  PyMem_Realloc(p)
360 #endif
361 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
362   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
363   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
364   #define PyMem_RawFree(p)             PyMem_Free(p)
365 #endif
366 #if CYTHON_COMPILING_IN_PYSTON
367   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
368   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
369 #else
370   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
371   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
372 #endif
373 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
374   #define __Pyx_PyThreadState_Current PyThreadState_GET()
375 #elif PY_VERSION_HEX >= 0x03060000
376   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
377 #elif PY_VERSION_HEX >= 0x03000000
378   #define __Pyx_PyThreadState_Current PyThreadState_GET()
379 #else
380   #define __Pyx_PyThreadState_Current _PyThreadState_Current
381 #endif
382 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
383 #include "pythread.h"
384 #define Py_tss_NEEDS_INIT 0
385 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)386 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
387   *key = PyThread_create_key();
388   return 0;
389 }
PyThread_tss_alloc(void)390 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
391   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
392   *key = Py_tss_NEEDS_INIT;
393   return key;
394 }
PyThread_tss_free(Py_tss_t * key)395 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
396   PyObject_Free(key);
397 }
PyThread_tss_is_created(Py_tss_t * key)398 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
399   return *key != Py_tss_NEEDS_INIT;
400 }
PyThread_tss_delete(Py_tss_t * key)401 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
402   PyThread_delete_key(*key);
403   *key = Py_tss_NEEDS_INIT;
404 }
PyThread_tss_set(Py_tss_t * key,void * value)405 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
406   return PyThread_set_key_value(*key, value);
407 }
PyThread_tss_get(Py_tss_t * key)408 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
409   return PyThread_get_key_value(*key);
410 }
411 #endif
412 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
413 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
414 #else
415 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
416 #endif
417 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
418   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
419   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
420 #else
421   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
422   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
423 #endif
424 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
425 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
426 #else
427 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
428 #endif
429 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
430   #define CYTHON_PEP393_ENABLED 1
431   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
432                                               0 : _PyUnicode_Ready((PyObject *)(op)))
433   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
434   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
435   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
436   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
437   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
438   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
439   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
440   #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
441   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
442   #else
443   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
444   #endif
445 #else
446   #define CYTHON_PEP393_ENABLED 0
447   #define PyUnicode_1BYTE_KIND  1
448   #define PyUnicode_2BYTE_KIND  2
449   #define PyUnicode_4BYTE_KIND  4
450   #define __Pyx_PyUnicode_READY(op)       (0)
451   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
452   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
453   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
454   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
455   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
456   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
457   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
458   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
459 #endif
460 #if CYTHON_COMPILING_IN_PYPY
461   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
462   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
463 #else
464   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
465   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
466       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
467 #endif
468 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
469   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
470 #endif
471 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
472   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
473 #endif
474 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
475   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
476 #endif
477 #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))
478 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
479 #if PY_MAJOR_VERSION >= 3
480   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
481 #else
482   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
483 #endif
484 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
485   #define PyObject_ASCII(o)            PyObject_Repr(o)
486 #endif
487 #if PY_MAJOR_VERSION >= 3
488   #define PyBaseString_Type            PyUnicode_Type
489   #define PyStringObject               PyUnicodeObject
490   #define PyString_Type                PyUnicode_Type
491   #define PyString_Check               PyUnicode_Check
492   #define PyString_CheckExact          PyUnicode_CheckExact
493 #ifndef PyObject_Unicode
494   #define PyObject_Unicode             PyObject_Str
495 #endif
496 #endif
497 #if PY_MAJOR_VERSION >= 3
498   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
499   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
500 #else
501   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
502   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
503 #endif
504 #ifndef PySet_CheckExact
505   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
506 #endif
507 #if PY_VERSION_HEX >= 0x030900A4
508   #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
509   #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
510 #else
511   #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
512   #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
513 #endif
514 #if CYTHON_ASSUME_SAFE_MACROS
515   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
516 #else
517   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
518 #endif
519 #if PY_MAJOR_VERSION >= 3
520   #define PyIntObject                  PyLongObject
521   #define PyInt_Type                   PyLong_Type
522   #define PyInt_Check(op)              PyLong_Check(op)
523   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
524   #define PyInt_FromString             PyLong_FromString
525   #define PyInt_FromUnicode            PyLong_FromUnicode
526   #define PyInt_FromLong               PyLong_FromLong
527   #define PyInt_FromSize_t             PyLong_FromSize_t
528   #define PyInt_FromSsize_t            PyLong_FromSsize_t
529   #define PyInt_AsLong                 PyLong_AsLong
530   #define PyInt_AS_LONG                PyLong_AS_LONG
531   #define PyInt_AsSsize_t              PyLong_AsSsize_t
532   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
533   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
534   #define PyNumber_Int                 PyNumber_Long
535 #endif
536 #if PY_MAJOR_VERSION >= 3
537   #define PyBoolObject                 PyLongObject
538 #endif
539 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
540   #ifndef PyUnicode_InternFromString
541     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
542   #endif
543 #endif
544 #if PY_VERSION_HEX < 0x030200A4
545   typedef long Py_hash_t;
546   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
547   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
548 #else
549   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
550   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
551 #endif
552 #if PY_MAJOR_VERSION >= 3
553   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
554 #else
555   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
556 #endif
557 #if CYTHON_USE_ASYNC_SLOTS
558   #if PY_VERSION_HEX >= 0x030500B1
559     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
560     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
561   #else
562     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
563   #endif
564 #else
565   #define __Pyx_PyType_AsAsync(obj) NULL
566 #endif
567 #ifndef __Pyx_PyAsyncMethodsStruct
568     typedef struct {
569         unaryfunc am_await;
570         unaryfunc am_aiter;
571         unaryfunc am_anext;
572     } __Pyx_PyAsyncMethodsStruct;
573 #endif
574 
575 #if defined(WIN32) || defined(MS_WINDOWS)
576   #define _USE_MATH_DEFINES
577 #endif
578 #include <math.h>
579 #ifdef NAN
580 #define __PYX_NAN() ((float) NAN)
581 #else
__PYX_NAN()582 static CYTHON_INLINE float __PYX_NAN() {
583   float value;
584   memset(&value, 0xFF, sizeof(value));
585   return value;
586 }
587 #endif
588 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
589 #define __Pyx_truncl trunc
590 #else
591 #define __Pyx_truncl truncl
592 #endif
593 
594 #define __PYX_MARK_ERR_POS(f_index, lineno) \
595     { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
596 #define __PYX_ERR(f_index, lineno, Ln_error) \
597     { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
598 
599 #ifndef __PYX_EXTERN_C
600   #ifdef __cplusplus
601     #define __PYX_EXTERN_C extern "C"
602   #else
603     #define __PYX_EXTERN_C extern
604   #endif
605 #endif
606 
607 #define __PYX_HAVE__dipy__tracking__localtrack
608 #define __PYX_HAVE_API__dipy__tracking__localtrack
609 /* Early includes */
610 #include <string.h>
611 #include <stdio.h>
612 #include "numpy/arrayobject.h"
613 #include "numpy/ndarrayobject.h"
614 #include "numpy/ndarraytypes.h"
615 #include "numpy/arrayscalars.h"
616 #include "numpy/ufuncobject.h"
617 
618     /* NumPy API declarations from "numpy/__init__.pxd" */
619 
620 #include "dpy_math.h"
621 #include "pythread.h"
622 #include <stdlib.h>
623 #include "pystate.h"
624 #ifdef _OPENMP
625 #include <omp.h>
626 #endif /* _OPENMP */
627 
628 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
629 #define CYTHON_WITHOUT_ASSERTIONS
630 #endif
631 
632 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
633                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
634 
635 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
636 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
637 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
638 #define __PYX_DEFAULT_STRING_ENCODING ""
639 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
640 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
641 #define __Pyx_uchar_cast(c) ((unsigned char)c)
642 #define __Pyx_long_cast(x) ((long)x)
643 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
644     (sizeof(type) < sizeof(Py_ssize_t))  ||\
645     (sizeof(type) > sizeof(Py_ssize_t) &&\
646           likely(v < (type)PY_SSIZE_T_MAX ||\
647                  v == (type)PY_SSIZE_T_MAX)  &&\
648           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
649                                 v == (type)PY_SSIZE_T_MIN)))  ||\
650     (sizeof(type) == sizeof(Py_ssize_t) &&\
651           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
652                                v == (type)PY_SSIZE_T_MAX)))  )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)653 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
654     return (size_t) i < (size_t) limit;
655 }
656 #if defined (__cplusplus) && __cplusplus >= 201103L
657     #include <cstdlib>
658     #define __Pyx_sst_abs(value) std::abs(value)
659 #elif SIZEOF_INT >= SIZEOF_SIZE_T
660     #define __Pyx_sst_abs(value) abs(value)
661 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
662     #define __Pyx_sst_abs(value) labs(value)
663 #elif defined (_MSC_VER)
664     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
665 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
666     #define __Pyx_sst_abs(value) llabs(value)
667 #elif defined (__GNUC__)
668     #define __Pyx_sst_abs(value) __builtin_llabs(value)
669 #else
670     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
671 #endif
672 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
673 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
674 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
675 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
676 #define __Pyx_PyBytes_FromString        PyBytes_FromString
677 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
678 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
679 #if PY_MAJOR_VERSION < 3
680     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
681     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
682 #else
683     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
684     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
685 #endif
686 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
687 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
688 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
689 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
690 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
691 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
692 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
693 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
694 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
695 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
696 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
697 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
698 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
699 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
700 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
701 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)702 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
703     const Py_UNICODE *u_end = u;
704     while (*u_end++) ;
705     return (size_t)(u_end - u - 1);
706 }
707 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
708 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
709 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
710 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
711 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
712 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
713 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
714 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
715 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
716 #define __Pyx_PySequence_Tuple(obj)\
717     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
718 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
719 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
720 #if CYTHON_ASSUME_SAFE_MACROS
721 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
722 #else
723 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
724 #endif
725 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
726 #if PY_MAJOR_VERSION >= 3
727 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
728 #else
729 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
730 #endif
731 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
732 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
733 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)734 static int __Pyx_init_sys_getdefaultencoding_params(void) {
735     PyObject* sys;
736     PyObject* default_encoding = NULL;
737     PyObject* ascii_chars_u = NULL;
738     PyObject* ascii_chars_b = NULL;
739     const char* default_encoding_c;
740     sys = PyImport_ImportModule("sys");
741     if (!sys) goto bad;
742     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
743     Py_DECREF(sys);
744     if (!default_encoding) goto bad;
745     default_encoding_c = PyBytes_AsString(default_encoding);
746     if (!default_encoding_c) goto bad;
747     if (strcmp(default_encoding_c, "ascii") == 0) {
748         __Pyx_sys_getdefaultencoding_not_ascii = 0;
749     } else {
750         char ascii_chars[128];
751         int c;
752         for (c = 0; c < 128; c++) {
753             ascii_chars[c] = c;
754         }
755         __Pyx_sys_getdefaultencoding_not_ascii = 1;
756         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
757         if (!ascii_chars_u) goto bad;
758         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
759         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
760             PyErr_Format(
761                 PyExc_ValueError,
762                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
763                 default_encoding_c);
764             goto bad;
765         }
766         Py_DECREF(ascii_chars_u);
767         Py_DECREF(ascii_chars_b);
768     }
769     Py_DECREF(default_encoding);
770     return 0;
771 bad:
772     Py_XDECREF(default_encoding);
773     Py_XDECREF(ascii_chars_u);
774     Py_XDECREF(ascii_chars_b);
775     return -1;
776 }
777 #endif
778 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
779 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
780 #else
781 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
782 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
783 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)784 static int __Pyx_init_sys_getdefaultencoding_params(void) {
785     PyObject* sys;
786     PyObject* default_encoding = NULL;
787     char* default_encoding_c;
788     sys = PyImport_ImportModule("sys");
789     if (!sys) goto bad;
790     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
791     Py_DECREF(sys);
792     if (!default_encoding) goto bad;
793     default_encoding_c = PyBytes_AsString(default_encoding);
794     if (!default_encoding_c) goto bad;
795     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
796     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
797     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
798     Py_DECREF(default_encoding);
799     return 0;
800 bad:
801     Py_XDECREF(default_encoding);
802     return -1;
803 }
804 #endif
805 #endif
806 
807 
808 /* Test for GCC > 2.95 */
809 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
810   #define likely(x)   __builtin_expect(!!(x), 1)
811   #define unlikely(x) __builtin_expect(!!(x), 0)
812 #else /* !__GNUC__ or GCC < 2.95 */
813   #define likely(x)   (x)
814   #define unlikely(x) (x)
815 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)816 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
817 
818 static PyObject *__pyx_m = NULL;
819 static PyObject *__pyx_d;
820 static PyObject *__pyx_b;
821 static PyObject *__pyx_cython_runtime = NULL;
822 static PyObject *__pyx_empty_tuple;
823 static PyObject *__pyx_empty_bytes;
824 static PyObject *__pyx_empty_unicode;
825 static int __pyx_lineno;
826 static int __pyx_clineno = 0;
827 static const char * __pyx_cfilenm= __FILE__;
828 static const char *__pyx_filename;
829 
830 /* Header.proto */
831 #if !defined(CYTHON_CCOMPLEX)
832   #if defined(__cplusplus)
833     #define CYTHON_CCOMPLEX 1
834   #elif defined(_Complex_I)
835     #define CYTHON_CCOMPLEX 1
836   #else
837     #define CYTHON_CCOMPLEX 0
838   #endif
839 #endif
840 #if CYTHON_CCOMPLEX
841   #ifdef __cplusplus
842     #include <complex>
843   #else
844     #include <complex.h>
845   #endif
846 #endif
847 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
848   #undef _Complex_I
849   #define _Complex_I 1.0fj
850 #endif
851 
852 
853 static const char *__pyx_f[] = {
854   "dipy/tracking/localtrack.pyx",
855   "__init__.pxd",
856   "stringsource",
857   "type.pxd",
858   "dipy/tracking/direction_getter.pxd",
859   "dipy/tracking/stopping_criterion.pxd",
860 };
861 /* MemviewSliceStruct.proto */
862 struct __pyx_memoryview_obj;
863 typedef struct {
864   struct __pyx_memoryview_obj *memview;
865   char *data;
866   Py_ssize_t shape[8];
867   Py_ssize_t strides[8];
868   Py_ssize_t suboffsets[8];
869 } __Pyx_memviewslice;
870 #define __Pyx_MemoryView_Len(m)  (m.shape[0])
871 
872 /* Atomics.proto */
873 #include <pythread.h>
874 #ifndef CYTHON_ATOMICS
875     #define CYTHON_ATOMICS 1
876 #endif
877 #define __pyx_atomic_int_type int
878 #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
879                     (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
880                     !defined(__i386__)
881     #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
882     #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
883     #ifdef __PYX_DEBUG_ATOMICS
884         #warning "Using GNU atomics"
885     #endif
886 #elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
887     #include <Windows.h>
888     #undef __pyx_atomic_int_type
889     #define __pyx_atomic_int_type LONG
890     #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
891     #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
892     #ifdef __PYX_DEBUG_ATOMICS
893         #pragma message ("Using MSVC atomics")
894     #endif
895 #elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
896     #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
897     #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
898     #ifdef __PYX_DEBUG_ATOMICS
899         #warning "Using Intel atomics"
900     #endif
901 #else
902     #undef CYTHON_ATOMICS
903     #define CYTHON_ATOMICS 0
904     #ifdef __PYX_DEBUG_ATOMICS
905         #warning "Not using atomics"
906     #endif
907 #endif
908 typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
909 #if CYTHON_ATOMICS
910     #define __pyx_add_acquisition_count(memview)\
911              __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
912     #define __pyx_sub_acquisition_count(memview)\
913             __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
914 #else
915     #define __pyx_add_acquisition_count(memview)\
916             __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
917     #define __pyx_sub_acquisition_count(memview)\
918             __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
919 #endif
920 
921 /* ForceInitThreads.proto */
922 #ifndef __PYX_FORCE_INIT_THREADS
923   #define __PYX_FORCE_INIT_THREADS 0
924 #endif
925 
926 /* NoFastGil.proto */
927 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
928 #define __Pyx_PyGILState_Release PyGILState_Release
929 #define __Pyx_FastGIL_Remember()
930 #define __Pyx_FastGIL_Forget()
931 #define __Pyx_FastGilFuncInit()
932 
933 /* BufferFormatStructs.proto */
934 #define IS_UNSIGNED(type) (((type) -1) > 0)
935 struct __Pyx_StructField_;
936 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
937 typedef struct {
938   const char* name;
939   struct __Pyx_StructField_* fields;
940   size_t size;
941   size_t arraysize[8];
942   int ndim;
943   char typegroup;
944   char is_unsigned;
945   int flags;
946 } __Pyx_TypeInfo;
947 typedef struct __Pyx_StructField_ {
948   __Pyx_TypeInfo* type;
949   const char* name;
950   size_t offset;
951 } __Pyx_StructField;
952 typedef struct {
953   __Pyx_StructField* field;
954   size_t parent_offset;
955 } __Pyx_BufFmt_StackElem;
956 typedef struct {
957   __Pyx_StructField root;
958   __Pyx_BufFmt_StackElem* head;
959   size_t fmt_offset;
960   size_t new_count, enc_count;
961   size_t struct_alignment;
962   int is_complex;
963   char enc_type;
964   char new_packmode;
965   char enc_packmode;
966   char is_valid_array;
967 } __Pyx_BufFmt_Context;
968 
969 
970 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":690
971  * # in Cython to enable them only on the right systems.
972  *
973  * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
974  * ctypedef npy_int16      int16_t
975  * ctypedef npy_int32      int32_t
976  */
977 typedef npy_int8 __pyx_t_5numpy_int8_t;
978 
979 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":691
980  *
981  * ctypedef npy_int8       int8_t
982  * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
983  * ctypedef npy_int32      int32_t
984  * ctypedef npy_int64      int64_t
985  */
986 typedef npy_int16 __pyx_t_5numpy_int16_t;
987 
988 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":692
989  * ctypedef npy_int8       int8_t
990  * ctypedef npy_int16      int16_t
991  * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
992  * ctypedef npy_int64      int64_t
993  * #ctypedef npy_int96      int96_t
994  */
995 typedef npy_int32 __pyx_t_5numpy_int32_t;
996 
997 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":693
998  * ctypedef npy_int16      int16_t
999  * ctypedef npy_int32      int32_t
1000  * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
1001  * #ctypedef npy_int96      int96_t
1002  * #ctypedef npy_int128     int128_t
1003  */
1004 typedef npy_int64 __pyx_t_5numpy_int64_t;
1005 
1006 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":697
1007  * #ctypedef npy_int128     int128_t
1008  *
1009  * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
1010  * ctypedef npy_uint16     uint16_t
1011  * ctypedef npy_uint32     uint32_t
1012  */
1013 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1014 
1015 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":698
1016  *
1017  * ctypedef npy_uint8      uint8_t
1018  * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
1019  * ctypedef npy_uint32     uint32_t
1020  * ctypedef npy_uint64     uint64_t
1021  */
1022 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1023 
1024 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":699
1025  * ctypedef npy_uint8      uint8_t
1026  * ctypedef npy_uint16     uint16_t
1027  * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
1028  * ctypedef npy_uint64     uint64_t
1029  * #ctypedef npy_uint96     uint96_t
1030  */
1031 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1032 
1033 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":700
1034  * ctypedef npy_uint16     uint16_t
1035  * ctypedef npy_uint32     uint32_t
1036  * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
1037  * #ctypedef npy_uint96     uint96_t
1038  * #ctypedef npy_uint128    uint128_t
1039  */
1040 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1041 
1042 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":704
1043  * #ctypedef npy_uint128    uint128_t
1044  *
1045  * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
1046  * ctypedef npy_float64    float64_t
1047  * #ctypedef npy_float80    float80_t
1048  */
1049 typedef npy_float32 __pyx_t_5numpy_float32_t;
1050 
1051 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":705
1052  *
1053  * ctypedef npy_float32    float32_t
1054  * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
1055  * #ctypedef npy_float80    float80_t
1056  * #ctypedef npy_float128   float128_t
1057  */
1058 typedef npy_float64 __pyx_t_5numpy_float64_t;
1059 
1060 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":714
1061  * # The int types are mapped a bit surprising --
1062  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1063  * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
1064  * ctypedef npy_longlong   long_t
1065  * ctypedef npy_longlong   longlong_t
1066  */
1067 typedef npy_long __pyx_t_5numpy_int_t;
1068 
1069 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":715
1070  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1071  * ctypedef npy_long       int_t
1072  * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
1073  * ctypedef npy_longlong   longlong_t
1074  *
1075  */
1076 typedef npy_longlong __pyx_t_5numpy_long_t;
1077 
1078 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":716
1079  * ctypedef npy_long       int_t
1080  * ctypedef npy_longlong   long_t
1081  * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
1082  *
1083  * ctypedef npy_ulong      uint_t
1084  */
1085 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1086 
1087 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":718
1088  * ctypedef npy_longlong   longlong_t
1089  *
1090  * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
1091  * ctypedef npy_ulonglong  ulong_t
1092  * ctypedef npy_ulonglong  ulonglong_t
1093  */
1094 typedef npy_ulong __pyx_t_5numpy_uint_t;
1095 
1096 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":719
1097  *
1098  * ctypedef npy_ulong      uint_t
1099  * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
1100  * ctypedef npy_ulonglong  ulonglong_t
1101  *
1102  */
1103 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1104 
1105 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":720
1106  * ctypedef npy_ulong      uint_t
1107  * ctypedef npy_ulonglong  ulong_t
1108  * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
1109  *
1110  * ctypedef npy_intp       intp_t
1111  */
1112 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1113 
1114 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":722
1115  * ctypedef npy_ulonglong  ulonglong_t
1116  *
1117  * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
1118  * ctypedef npy_uintp      uintp_t
1119  *
1120  */
1121 typedef npy_intp __pyx_t_5numpy_intp_t;
1122 
1123 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":723
1124  *
1125  * ctypedef npy_intp       intp_t
1126  * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
1127  *
1128  * ctypedef npy_double     float_t
1129  */
1130 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1131 
1132 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":725
1133  * ctypedef npy_uintp      uintp_t
1134  *
1135  * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
1136  * ctypedef npy_double     double_t
1137  * ctypedef npy_longdouble longdouble_t
1138  */
1139 typedef npy_double __pyx_t_5numpy_float_t;
1140 
1141 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":726
1142  *
1143  * ctypedef npy_double     float_t
1144  * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
1145  * ctypedef npy_longdouble longdouble_t
1146  *
1147  */
1148 typedef npy_double __pyx_t_5numpy_double_t;
1149 
1150 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":727
1151  * ctypedef npy_double     float_t
1152  * ctypedef npy_double     double_t
1153  * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
1154  *
1155  * ctypedef npy_cfloat      cfloat_t
1156  */
1157 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1158 /* Declarations.proto */
1159 #if CYTHON_CCOMPLEX
1160   #ifdef __cplusplus
1161     typedef ::std::complex< float > __pyx_t_float_complex;
1162   #else
1163     typedef float _Complex __pyx_t_float_complex;
1164   #endif
1165 #else
1166     typedef struct { float real, imag; } __pyx_t_float_complex;
1167 #endif
1168 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1169 
1170 /* Declarations.proto */
1171 #if CYTHON_CCOMPLEX
1172   #ifdef __cplusplus
1173     typedef ::std::complex< double > __pyx_t_double_complex;
1174   #else
1175     typedef double _Complex __pyx_t_double_complex;
1176   #endif
1177 #else
1178     typedef struct { double real, imag; } __pyx_t_double_complex;
1179 #endif
1180 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1181 
1182 
1183 /*--- Type declarations ---*/
1184 struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter;
1185 struct __pyx_obj_4dipy_8tracking_18stopping_criterion_StoppingCriterion;
1186 struct __pyx_obj_4dipy_8tracking_18stopping_criterion_BinaryStoppingCriterion;
1187 struct __pyx_obj_4dipy_8tracking_18stopping_criterion_ThresholdStoppingCriterion;
1188 struct __pyx_obj_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion;
1189 struct __pyx_obj_4dipy_8tracking_18stopping_criterion_ActStoppingCriterion;
1190 struct __pyx_obj_4dipy_8tracking_18stopping_criterion_CmcStoppingCriterion;
1191 struct __pyx_array_obj;
1192 struct __pyx_MemviewEnum_obj;
1193 struct __pyx_memoryview_obj;
1194 struct __pyx_memoryviewslice_obj;
1195 
1196 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":729
1197  * ctypedef npy_longdouble longdouble_t
1198  *
1199  * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
1200  * ctypedef npy_cdouble     cdouble_t
1201  * ctypedef npy_clongdouble clongdouble_t
1202  */
1203 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1204 
1205 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":730
1206  *
1207  * ctypedef npy_cfloat      cfloat_t
1208  * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
1209  * ctypedef npy_clongdouble clongdouble_t
1210  *
1211  */
1212 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1213 
1214 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":731
1215  * ctypedef npy_cfloat      cfloat_t
1216  * ctypedef npy_cdouble     cdouble_t
1217  * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
1218  *
1219  * ctypedef npy_cdouble     complex_t
1220  */
1221 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1222 
1223 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":733
1224  * ctypedef npy_clongdouble clongdouble_t
1225  *
1226  * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
1227  *
1228  * cdef inline object PyArray_MultiIterNew1(a):
1229  */
1230 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1231 
1232 /* "stopping_criterion.pxd":2
1233  *
1234  * cpdef enum StreamlineStatus:             # <<<<<<<<<<<<<<
1235  *     PYERROR = -2
1236  *     OUTSIDEIMAGE = -1
1237  */
1238 enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus {
1239   __pyx_e_4dipy_8tracking_18stopping_criterion_PYERROR = -2L,
1240   __pyx_e_4dipy_8tracking_18stopping_criterion_OUTSIDEIMAGE = -1L,
1241   __pyx_e_4dipy_8tracking_18stopping_criterion_INVALIDPOINT = 0,
1242   __pyx_e_4dipy_8tracking_18stopping_criterion_TRACKPOINT = 1,
1243   __pyx_e_4dipy_8tracking_18stopping_criterion_ENDPOINT = 2
1244 };
1245 struct __pyx_opt_args_4dipy_4core_13interpolation_trilinear_interpolate4d;
1246 
1247 /* "dipy/core/interpolation.pxd":6
1248  *
1249  * cpdef trilinear_interpolate4d(
1250  *     double[:, :, :, :] data,             # <<<<<<<<<<<<<<
1251  *     double[:] point,
1252  *     cnp.ndarray out=*)
1253  */
1254 struct __pyx_opt_args_4dipy_4core_13interpolation_trilinear_interpolate4d {
1255   int __pyx_n;
1256   PyArrayObject *out;
1257 };
1258 
1259 /* "direction_getter.pxd":4
1260  * cimport numpy as np
1261  *
1262  * cdef class DirectionGetter:             # <<<<<<<<<<<<<<
1263  *
1264  *     cpdef np.ndarray[np.float_t, ndim=2] initial_direction(
1265  */
1266 struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter {
1267   PyObject_HEAD
1268   struct __pyx_vtabstruct_4dipy_8tracking_16direction_getter_DirectionGetter *__pyx_vtab;
1269 };
1270 
1271 
1272 /* "stopping_criterion.pxd":10
1273  *
1274  *
1275  * cdef class StoppingCriterion:             # <<<<<<<<<<<<<<
1276  *     cdef:
1277  *         double interp_out_double[1]
1278  */
1279 struct __pyx_obj_4dipy_8tracking_18stopping_criterion_StoppingCriterion {
1280   PyObject_HEAD
1281   struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_StoppingCriterion *__pyx_vtab;
1282   double interp_out_double[1];
1283   __Pyx_memviewslice interp_out_view;
1284 };
1285 
1286 
1287 /* "stopping_criterion.pxd":18
1288  *
1289  *
1290  * cdef class BinaryStoppingCriterion(StoppingCriterion):             # <<<<<<<<<<<<<<
1291  *     cdef:
1292  *         unsigned char [:, :, :] mask
1293  */
1294 struct __pyx_obj_4dipy_8tracking_18stopping_criterion_BinaryStoppingCriterion {
1295   struct __pyx_obj_4dipy_8tracking_18stopping_criterion_StoppingCriterion __pyx_base;
1296   __Pyx_memviewslice mask;
1297 };
1298 
1299 
1300 /* "stopping_criterion.pxd":24
1301  *
1302  *
1303  * cdef class ThresholdStoppingCriterion(StoppingCriterion):             # <<<<<<<<<<<<<<
1304  *     cdef:
1305  *         double threshold
1306  */
1307 struct __pyx_obj_4dipy_8tracking_18stopping_criterion_ThresholdStoppingCriterion {
1308   struct __pyx_obj_4dipy_8tracking_18stopping_criterion_StoppingCriterion __pyx_base;
1309   double threshold;
1310   __Pyx_memviewslice metric_map;
1311 };
1312 
1313 
1314 /* "stopping_criterion.pxd":31
1315  *
1316  *
1317  * cdef class AnatomicalStoppingCriterion(StoppingCriterion):             # <<<<<<<<<<<<<<
1318  *     cdef:
1319  *         double[:, :, :] include_map, exclude_map
1320  */
1321 struct __pyx_obj_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion {
1322   struct __pyx_obj_4dipy_8tracking_18stopping_criterion_StoppingCriterion __pyx_base;
1323   __Pyx_memviewslice include_map;
1324   __Pyx_memviewslice exclude_map;
1325 };
1326 
1327 
1328 /* "stopping_criterion.pxd":41
1329  *
1330  *
1331  * cdef class ActStoppingCriterion(AnatomicalStoppingCriterion):             # <<<<<<<<<<<<<<
1332  *     pass
1333  *
1334  */
1335 struct __pyx_obj_4dipy_8tracking_18stopping_criterion_ActStoppingCriterion {
1336   struct __pyx_obj_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion __pyx_base;
1337 };
1338 
1339 
1340 /* "stopping_criterion.pxd":45
1341  *
1342  *
1343  * cdef class CmcStoppingCriterion(AnatomicalStoppingCriterion):             # <<<<<<<<<<<<<<
1344  *     cdef:
1345  *         double step_size
1346  */
1347 struct __pyx_obj_4dipy_8tracking_18stopping_criterion_CmcStoppingCriterion {
1348   struct __pyx_obj_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion __pyx_base;
1349   double step_size;
1350   double average_voxel_size;
1351   double correction_factor;
1352 };
1353 
1354 
1355 /* "View.MemoryView":105
1356  *
1357  * @cname("__pyx_array")
1358  * cdef class array:             # <<<<<<<<<<<<<<
1359  *
1360  *     cdef:
1361  */
1362 struct __pyx_array_obj {
1363   PyObject_HEAD
1364   struct __pyx_vtabstruct_array *__pyx_vtab;
1365   char *data;
1366   Py_ssize_t len;
1367   char *format;
1368   int ndim;
1369   Py_ssize_t *_shape;
1370   Py_ssize_t *_strides;
1371   Py_ssize_t itemsize;
1372   PyObject *mode;
1373   PyObject *_format;
1374   void (*callback_free_data)(void *);
1375   int free_data;
1376   int dtype_is_object;
1377 };
1378 
1379 
1380 /* "View.MemoryView":279
1381  *
1382  * @cname('__pyx_MemviewEnum')
1383  * cdef class Enum(object):             # <<<<<<<<<<<<<<
1384  *     cdef object name
1385  *     def __init__(self, name):
1386  */
1387 struct __pyx_MemviewEnum_obj {
1388   PyObject_HEAD
1389   PyObject *name;
1390 };
1391 
1392 
1393 /* "View.MemoryView":330
1394  *
1395  * @cname('__pyx_memoryview')
1396  * cdef class memoryview(object):             # <<<<<<<<<<<<<<
1397  *
1398  *     cdef object obj
1399  */
1400 struct __pyx_memoryview_obj {
1401   PyObject_HEAD
1402   struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1403   PyObject *obj;
1404   PyObject *_size;
1405   PyObject *_array_interface;
1406   PyThread_type_lock lock;
1407   __pyx_atomic_int acquisition_count[2];
1408   __pyx_atomic_int *acquisition_count_aligned_p;
1409   Py_buffer view;
1410   int flags;
1411   int dtype_is_object;
1412   __Pyx_TypeInfo *typeinfo;
1413 };
1414 
1415 
1416 /* "View.MemoryView":965
1417  *
1418  * @cname('__pyx_memoryviewslice')
1419  * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
1420  *     "Internal class for passing memoryview slices to Python"
1421  *
1422  */
1423 struct __pyx_memoryviewslice_obj {
1424   struct __pyx_memoryview_obj __pyx_base;
1425   __Pyx_memviewslice from_slice;
1426   PyObject *from_object;
1427   PyObject *(*to_object_func)(char *);
1428   int (*to_dtype_func)(char *, PyObject *);
1429 };
1430 
1431 
1432 
1433 /* "direction_getter.pxd":4
1434  * cimport numpy as np
1435  *
1436  * cdef class DirectionGetter:             # <<<<<<<<<<<<<<
1437  *
1438  *     cpdef np.ndarray[np.float_t, ndim=2] initial_direction(
1439  */
1440 
1441 struct __pyx_vtabstruct_4dipy_8tracking_16direction_getter_DirectionGetter {
1442   PyArrayObject *(*initial_direction)(struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter *, __Pyx_memviewslice, int __pyx_skip_dispatch);
1443   int (*get_direction)(struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter *, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch);
1444   int (*get_direction_c)(struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter *, double *, double *);
1445 };
1446 static struct __pyx_vtabstruct_4dipy_8tracking_16direction_getter_DirectionGetter *__pyx_vtabptr_4dipy_8tracking_16direction_getter_DirectionGetter;
1447 
1448 
1449 /* "stopping_criterion.pxd":10
1450  *
1451  *
1452  * cdef class StoppingCriterion:             # <<<<<<<<<<<<<<
1453  *     cdef:
1454  *         double interp_out_double[1]
1455  */
1456 
1457 struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_StoppingCriterion {
1458   enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus (*check_point)(struct __pyx_obj_4dipy_8tracking_18stopping_criterion_StoppingCriterion *, __Pyx_memviewslice, int __pyx_skip_dispatch);
1459   enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus (*check_point_c)(struct __pyx_obj_4dipy_8tracking_18stopping_criterion_StoppingCriterion *, double *);
1460 };
1461 static struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_StoppingCriterion *__pyx_vtabptr_4dipy_8tracking_18stopping_criterion_StoppingCriterion;
1462 
1463 
1464 /* "stopping_criterion.pxd":18
1465  *
1466  *
1467  * cdef class BinaryStoppingCriterion(StoppingCriterion):             # <<<<<<<<<<<<<<
1468  *     cdef:
1469  *         unsigned char [:, :, :] mask
1470  */
1471 
1472 struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_BinaryStoppingCriterion {
1473   struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_StoppingCriterion __pyx_base;
1474 };
1475 static struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_BinaryStoppingCriterion *__pyx_vtabptr_4dipy_8tracking_18stopping_criterion_BinaryStoppingCriterion;
1476 
1477 
1478 /* "stopping_criterion.pxd":24
1479  *
1480  *
1481  * cdef class ThresholdStoppingCriterion(StoppingCriterion):             # <<<<<<<<<<<<<<
1482  *     cdef:
1483  *         double threshold
1484  */
1485 
1486 struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_ThresholdStoppingCriterion {
1487   struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_StoppingCriterion __pyx_base;
1488 };
1489 static struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_ThresholdStoppingCriterion *__pyx_vtabptr_4dipy_8tracking_18stopping_criterion_ThresholdStoppingCriterion;
1490 
1491 
1492 /* "stopping_criterion.pxd":31
1493  *
1494  *
1495  * cdef class AnatomicalStoppingCriterion(StoppingCriterion):             # <<<<<<<<<<<<<<
1496  *     cdef:
1497  *         double[:, :, :] include_map, exclude_map
1498  */
1499 
1500 struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion {
1501   struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_StoppingCriterion __pyx_base;
1502   double (*get_exclude)(struct __pyx_obj_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion *, __Pyx_memviewslice, int __pyx_skip_dispatch);
1503   PyObject *(*get_exclude_c)(struct __pyx_obj_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion *, double *);
1504   double (*get_include)(struct __pyx_obj_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion *, __Pyx_memviewslice, int __pyx_skip_dispatch);
1505   PyObject *(*get_include_c)(struct __pyx_obj_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion *, double *);
1506 };
1507 static struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion *__pyx_vtabptr_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion;
1508 
1509 
1510 /* "stopping_criterion.pxd":41
1511  *
1512  *
1513  * cdef class ActStoppingCriterion(AnatomicalStoppingCriterion):             # <<<<<<<<<<<<<<
1514  *     pass
1515  *
1516  */
1517 
1518 struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_ActStoppingCriterion {
1519   struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion __pyx_base;
1520 };
1521 static struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_ActStoppingCriterion *__pyx_vtabptr_4dipy_8tracking_18stopping_criterion_ActStoppingCriterion;
1522 
1523 
1524 /* "stopping_criterion.pxd":45
1525  *
1526  *
1527  * cdef class CmcStoppingCriterion(AnatomicalStoppingCriterion):             # <<<<<<<<<<<<<<
1528  *     cdef:
1529  *         double step_size
1530  */
1531 
1532 struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_CmcStoppingCriterion {
1533   struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion __pyx_base;
1534 };
1535 static struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_CmcStoppingCriterion *__pyx_vtabptr_4dipy_8tracking_18stopping_criterion_CmcStoppingCriterion;
1536 
1537 
1538 /* "View.MemoryView":105
1539  *
1540  * @cname("__pyx_array")
1541  * cdef class array:             # <<<<<<<<<<<<<<
1542  *
1543  *     cdef:
1544  */
1545 
1546 struct __pyx_vtabstruct_array {
1547   PyObject *(*get_memview)(struct __pyx_array_obj *);
1548 };
1549 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1550 
1551 
1552 /* "View.MemoryView":330
1553  *
1554  * @cname('__pyx_memoryview')
1555  * cdef class memoryview(object):             # <<<<<<<<<<<<<<
1556  *
1557  *     cdef object obj
1558  */
1559 
1560 struct __pyx_vtabstruct_memoryview {
1561   char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
1562   PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
1563   PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1564   PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
1565   PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1566   PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
1567   PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
1568 };
1569 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1570 
1571 
1572 /* "View.MemoryView":965
1573  *
1574  * @cname('__pyx_memoryviewslice')
1575  * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
1576  *     "Internal class for passing memoryview slices to Python"
1577  *
1578  */
1579 
1580 struct __pyx_vtabstruct__memoryviewslice {
1581   struct __pyx_vtabstruct_memoryview __pyx_base;
1582 };
1583 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1584 
1585 /* --- Runtime support code (head) --- */
1586 /* Refnanny.proto */
1587 #ifndef CYTHON_REFNANNY
1588   #define CYTHON_REFNANNY 0
1589 #endif
1590 #if CYTHON_REFNANNY
1591   typedef struct {
1592     void (*INCREF)(void*, PyObject*, int);
1593     void (*DECREF)(void*, PyObject*, int);
1594     void (*GOTREF)(void*, PyObject*, int);
1595     void (*GIVEREF)(void*, PyObject*, int);
1596     void* (*SetupContext)(const char*, int, const char*);
1597     void (*FinishContext)(void**);
1598   } __Pyx_RefNannyAPIStruct;
1599   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1600   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1601   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1602 #ifdef WITH_THREAD
1603   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1604           if (acquire_gil) {\
1605               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1606               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1607               PyGILState_Release(__pyx_gilstate_save);\
1608           } else {\
1609               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1610           }
1611 #else
1612   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1613           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1614 #endif
1615   #define __Pyx_RefNannyFinishContext()\
1616           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1617   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1618   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1619   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1620   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1621   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1622   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1623   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1624   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1625 #else
1626   #define __Pyx_RefNannyDeclarations
1627   #define __Pyx_RefNannySetupContext(name, acquire_gil)
1628   #define __Pyx_RefNannyFinishContext()
1629   #define __Pyx_INCREF(r) Py_INCREF(r)
1630   #define __Pyx_DECREF(r) Py_DECREF(r)
1631   #define __Pyx_GOTREF(r)
1632   #define __Pyx_GIVEREF(r)
1633   #define __Pyx_XINCREF(r) Py_XINCREF(r)
1634   #define __Pyx_XDECREF(r) Py_XDECREF(r)
1635   #define __Pyx_XGOTREF(r)
1636   #define __Pyx_XGIVEREF(r)
1637 #endif
1638 #define __Pyx_XDECREF_SET(r, v) do {\
1639         PyObject *tmp = (PyObject *) r;\
1640         r = v; __Pyx_XDECREF(tmp);\
1641     } while (0)
1642 #define __Pyx_DECREF_SET(r, v) do {\
1643         PyObject *tmp = (PyObject *) r;\
1644         r = v; __Pyx_DECREF(tmp);\
1645     } while (0)
1646 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1647 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1648 
1649 /* PyObjectGetAttrStr.proto */
1650 #if CYTHON_USE_TYPE_SLOTS
1651 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1652 #else
1653 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1654 #endif
1655 
1656 /* GetBuiltinName.proto */
1657 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1658 
1659 /* RaiseArgTupleInvalid.proto */
1660 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1661     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1662 
1663 /* RaiseDoubleKeywords.proto */
1664 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1665 
1666 /* ParseKeywords.proto */
1667 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1668     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1669     const char* function_name);
1670 
1671 /* ArgTypeTest.proto */
1672 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1673     ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1674         __Pyx__ArgTypeTest(obj, type, name, exact))
1675 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1676 
1677 /* PyObjectCall.proto */
1678 #if CYTHON_COMPILING_IN_CPYTHON
1679 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1680 #else
1681 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1682 #endif
1683 
1684 /* PyThreadStateGet.proto */
1685 #if CYTHON_FAST_THREAD_STATE
1686 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
1687 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
1688 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
1689 #else
1690 #define __Pyx_PyThreadState_declare
1691 #define __Pyx_PyThreadState_assign
1692 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
1693 #endif
1694 
1695 /* PyErrFetchRestore.proto */
1696 #if CYTHON_FAST_THREAD_STATE
1697 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1698 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1699 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1700 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1701 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1702 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1703 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1704 #if CYTHON_COMPILING_IN_CPYTHON
1705 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1706 #else
1707 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1708 #endif
1709 #else
1710 #define __Pyx_PyErr_Clear() PyErr_Clear()
1711 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1712 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
1713 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
1714 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
1715 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
1716 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
1717 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
1718 #endif
1719 
1720 /* RaiseException.proto */
1721 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1722 
1723 /* BufferIndexError.proto */
1724 static void __Pyx_RaiseBufferIndexError(int axis);
1725 
1726 /* MemviewSliceInit.proto */
1727 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
1728 #define __Pyx_MEMVIEW_DIRECT   1
1729 #define __Pyx_MEMVIEW_PTR      2
1730 #define __Pyx_MEMVIEW_FULL     4
1731 #define __Pyx_MEMVIEW_CONTIG   8
1732 #define __Pyx_MEMVIEW_STRIDED  16
1733 #define __Pyx_MEMVIEW_FOLLOW   32
1734 #define __Pyx_IS_C_CONTIG 1
1735 #define __Pyx_IS_F_CONTIG 2
1736 static int __Pyx_init_memviewslice(
1737                 struct __pyx_memoryview_obj *memview,
1738                 int ndim,
1739                 __Pyx_memviewslice *memviewslice,
1740                 int memview_is_new_reference);
1741 static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
1742     __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1743 static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
1744     __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1745 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
1746 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
1747 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
1748 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
1749 static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
1750 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
1751 
1752 /* PyIntBinop.proto */
1753 #if !CYTHON_COMPILING_IN_PYPY
1754 static PyObject* __Pyx_PyInt_SubtractCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1755 #else
1756 #define __Pyx_PyInt_SubtractCObj(op1, op2, intval, inplace, zerodivision_check)\
1757     (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
1758 #endif
1759 
1760 /* PyDictVersioning.proto */
1761 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1762 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1763 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1764 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1765     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1766     (cache_var) = (value);
1767 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1768     static PY_UINT64_T __pyx_dict_version = 0;\
1769     static PyObject *__pyx_dict_cached_value = NULL;\
1770     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1771         (VAR) = __pyx_dict_cached_value;\
1772     } else {\
1773         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1774         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1775     }\
1776 }
1777 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1778 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1779 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1780 #else
1781 #define __PYX_GET_DICT_VERSION(dict)  (0)
1782 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1783 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1784 #endif
1785 
1786 /* GetModuleGlobalName.proto */
1787 #if CYTHON_USE_DICT_VERSIONS
1788 #define __Pyx_GetModuleGlobalName(var, name)  {\
1789     static PY_UINT64_T __pyx_dict_version = 0;\
1790     static PyObject *__pyx_dict_cached_value = NULL;\
1791     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1792         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1793         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1794 }
1795 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1796     PY_UINT64_T __pyx_dict_version;\
1797     PyObject *__pyx_dict_cached_value;\
1798     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1799 }
1800 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1801 #else
1802 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1803 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1804 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1805 #endif
1806 
1807 /* PyFunctionFastCall.proto */
1808 #if CYTHON_FAST_PYCALL
1809 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1810     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1811 #if 1 || PY_VERSION_HEX < 0x030600B1
1812 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1813 #else
1814 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1815 #endif
1816 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1817     (sizeof(char [1 - 2*!(cond)]) - 1)
1818 #ifndef Py_MEMBER_SIZE
1819 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1820 #endif
1821   static size_t __pyx_pyframe_localsplus_offset = 0;
1822   #include "frameobject.h"
1823   #define __Pxy_PyFrame_Initialize_Offsets()\
1824     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1825      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1826   #define __Pyx_PyFrame_GetLocalsplus(frame)\
1827     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1828 #endif
1829 
1830 /* PyObjectCallMethO.proto */
1831 #if CYTHON_COMPILING_IN_CPYTHON
1832 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1833 #endif
1834 
1835 /* PyObjectCallNoArg.proto */
1836 #if CYTHON_COMPILING_IN_CPYTHON
1837 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1838 #else
1839 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1840 #endif
1841 
1842 /* PyCFunctionFastCall.proto */
1843 #if CYTHON_FAST_PYCCALL
1844 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1845 #else
1846 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1847 #endif
1848 
1849 /* PyObjectCallOneArg.proto */
1850 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1851 
1852 /* GetTopmostException.proto */
1853 #if CYTHON_USE_EXC_INFO_STACK
1854 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1855 #endif
1856 
1857 /* SaveResetException.proto */
1858 #if CYTHON_FAST_THREAD_STATE
1859 #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1860 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1861 #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1862 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1863 #else
1864 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1865 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1866 #endif
1867 
1868 /* PyErrExceptionMatches.proto */
1869 #if CYTHON_FAST_THREAD_STATE
1870 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1871 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1872 #else
1873 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1874 #endif
1875 
1876 /* GetException.proto */
1877 #if CYTHON_FAST_THREAD_STATE
1878 #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
1879 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1880 #else
1881 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1882 #endif
1883 
1884 /* PyObjectCall2Args.proto */
1885 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1886 
1887 /* IncludeStringH.proto */
1888 #include <string.h>
1889 
1890 /* BytesEquals.proto */
1891 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1892 
1893 /* UnicodeEquals.proto */
1894 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1895 
1896 /* StrEquals.proto */
1897 #if PY_MAJOR_VERSION >= 3
1898 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1899 #else
1900 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1901 #endif
1902 
1903 /* None.proto */
1904 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
1905 
1906 /* UnaryNegOverflows.proto */
1907 #define UNARY_NEG_WOULD_OVERFLOW(x)\
1908         (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1909 
1910 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1911 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
1912 /* GetAttr.proto */
1913 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1914 
1915 /* GetItemInt.proto */
1916 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1917     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1918     __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1919     (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1920                __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1921 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1922     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1923     __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1924     (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1925 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1926                                                               int wraparound, int boundscheck);
1927 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1928     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1929     __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1930     (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1931 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1932                                                               int wraparound, int boundscheck);
1933 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1934 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1935                                                      int is_list, int wraparound, int boundscheck);
1936 
1937 /* ObjectGetItem.proto */
1938 #if CYTHON_USE_TYPE_SLOTS
1939 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1940 #else
1941 #define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
1942 #endif
1943 
1944 /* decode_c_string_utf16.proto */
__Pyx_PyUnicode_DecodeUTF16(const char * s,Py_ssize_t size,const char * errors)1945 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
1946     int byteorder = 0;
1947     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1948 }
__Pyx_PyUnicode_DecodeUTF16LE(const char * s,Py_ssize_t size,const char * errors)1949 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
1950     int byteorder = -1;
1951     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1952 }
__Pyx_PyUnicode_DecodeUTF16BE(const char * s,Py_ssize_t size,const char * errors)1953 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
1954     int byteorder = 1;
1955     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1956 }
1957 
1958 /* decode_c_string.proto */
1959 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
1960          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
1961          const char* encoding, const char* errors,
1962          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
1963 
1964 /* GetAttr3.proto */
1965 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1966 
1967 /* RaiseTooManyValuesToUnpack.proto */
1968 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1969 
1970 /* RaiseNeedMoreValuesToUnpack.proto */
1971 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1972 
1973 /* RaiseNoneIterError.proto */
1974 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1975 
1976 /* ExtTypeTest.proto */
1977 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1978 
1979 /* SwapException.proto */
1980 #if CYTHON_FAST_THREAD_STATE
1981 #define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1982 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1983 #else
1984 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1985 #endif
1986 
1987 /* Import.proto */
1988 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1989 
1990 /* FastTypeChecks.proto */
1991 #if CYTHON_COMPILING_IN_CPYTHON
1992 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1993 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1994 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1995 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1996 #else
1997 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1998 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1999 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
2000 #endif
2001 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
2002 
2003 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
2004 /* ListCompAppend.proto */
2005 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_ListComp_Append(PyObject * list,PyObject * x)2006 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
2007     PyListObject* L = (PyListObject*) list;
2008     Py_ssize_t len = Py_SIZE(list);
2009     if (likely(L->allocated > len)) {
2010         Py_INCREF(x);
2011         PyList_SET_ITEM(list, len, x);
2012         __Pyx_SET_SIZE(list, len + 1);
2013         return 0;
2014     }
2015     return PyList_Append(list, x);
2016 }
2017 #else
2018 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
2019 #endif
2020 
2021 /* PyIntBinop.proto */
2022 #if !CYTHON_COMPILING_IN_PYPY
2023 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
2024 #else
2025 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
2026     (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
2027 #endif
2028 
2029 /* ListExtend.proto */
__Pyx_PyList_Extend(PyObject * L,PyObject * v)2030 static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
2031 #if CYTHON_COMPILING_IN_CPYTHON
2032     PyObject* none = _PyList_Extend((PyListObject*)L, v);
2033     if (unlikely(!none))
2034         return -1;
2035     Py_DECREF(none);
2036     return 0;
2037 #else
2038     return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
2039 #endif
2040 }
2041 
2042 /* ListAppend.proto */
2043 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_PyList_Append(PyObject * list,PyObject * x)2044 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
2045     PyListObject* L = (PyListObject*) list;
2046     Py_ssize_t len = Py_SIZE(list);
2047     if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
2048         Py_INCREF(x);
2049         PyList_SET_ITEM(list, len, x);
2050         __Pyx_SET_SIZE(list, len + 1);
2051         return 0;
2052     }
2053     return PyList_Append(list, x);
2054 }
2055 #else
2056 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
2057 #endif
2058 
2059 /* None.proto */
2060 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
2061 
2062 /* None.proto */
2063 static CYTHON_INLINE long __Pyx_div_long(long, long);
2064 
2065 /* ImportFrom.proto */
2066 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
2067 
2068 /* HasAttr.proto */
2069 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
2070 
2071 /* PyObject_GenericGetAttrNoDict.proto */
2072 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2073 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
2074 #else
2075 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
2076 #endif
2077 
2078 /* PyObject_GenericGetAttr.proto */
2079 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2080 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
2081 #else
2082 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
2083 #endif
2084 
2085 /* SetVTable.proto */
2086 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
2087 
2088 /* PyObjectGetAttrStrNoError.proto */
2089 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
2090 
2091 /* SetupReduce.proto */
2092 static int __Pyx_setup_reduce(PyObject* type_obj);
2093 
2094 /* TypeImport.proto */
2095 #ifndef __PYX_HAVE_RT_ImportType_proto
2096 #define __PYX_HAVE_RT_ImportType_proto
2097 enum __Pyx_ImportType_CheckSize {
2098    __Pyx_ImportType_CheckSize_Error = 0,
2099    __Pyx_ImportType_CheckSize_Warn = 1,
2100    __Pyx_ImportType_CheckSize_Ignore = 2
2101 };
2102 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
2103 #endif
2104 
2105 /* GetVTable.proto */
2106 static void* __Pyx_GetVtable(PyObject *dict);
2107 
2108 /* CLineInTraceback.proto */
2109 #ifdef CYTHON_CLINE_IN_TRACEBACK
2110 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
2111 #else
2112 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
2113 #endif
2114 
2115 /* CodeObjectCache.proto */
2116 typedef struct {
2117     PyCodeObject* code_object;
2118     int code_line;
2119 } __Pyx_CodeObjectCacheEntry;
2120 struct __Pyx_CodeObjectCache {
2121     int count;
2122     int max_count;
2123     __Pyx_CodeObjectCacheEntry* entries;
2124 };
2125 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
2126 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
2127 static PyCodeObject *__pyx_find_code_object(int code_line);
2128 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
2129 
2130 /* AddTraceback.proto */
2131 static void __Pyx_AddTraceback(const char *funcname, int c_line,
2132                                int py_line, const char *filename);
2133 
2134 #if PY_MAJOR_VERSION < 3
2135     static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
2136     static void __Pyx_ReleaseBuffer(Py_buffer *view);
2137 #else
2138     #define __Pyx_GetBuffer PyObject_GetBuffer
2139     #define __Pyx_ReleaseBuffer PyBuffer_Release
2140 #endif
2141 
2142 
2143 /* BufferStructDeclare.proto */
2144 typedef struct {
2145   Py_ssize_t shape, strides, suboffsets;
2146 } __Pyx_Buf_DimInfo;
2147 typedef struct {
2148   size_t refcount;
2149   Py_buffer pybuffer;
2150 } __Pyx_Buffer;
2151 typedef struct {
2152   __Pyx_Buffer *rcbuffer;
2153   char *data;
2154   __Pyx_Buf_DimInfo diminfo[8];
2155 } __Pyx_LocalBuf_ND;
2156 
2157 /* MemviewSliceIsContig.proto */
2158 static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);
2159 
2160 /* OverlappingSlices.proto */
2161 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
2162                                 __Pyx_memviewslice *slice2,
2163                                 int ndim, size_t itemsize);
2164 
2165 /* Capsule.proto */
2166 static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
2167 
2168 /* IsLittleEndian.proto */
2169 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
2170 
2171 /* BufferFormatCheck.proto */
2172 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
2173 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
2174                               __Pyx_BufFmt_StackElem* stack,
2175                               __Pyx_TypeInfo* type);
2176 
2177 /* TypeInfoCompare.proto */
2178 static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
2179 
2180 /* MemviewSliceValidateAndInit.proto */
2181 static int __Pyx_ValidateAndInit_memviewslice(
2182                 int *axes_specs,
2183                 int c_or_f_flag,
2184                 int buf_flags,
2185                 int ndim,
2186                 __Pyx_TypeInfo *dtype,
2187                 __Pyx_BufFmt_StackElem stack[],
2188                 __Pyx_memviewslice *memviewslice,
2189                 PyObject *original_obj);
2190 
2191 /* ObjectToMemviewSlice.proto */
2192 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float_t(PyObject *, int writable_flag);
2193 
2194 /* ObjectToMemviewSlice.proto */
2195 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float_t(PyObject *, int writable_flag);
2196 
2197 /* GCCDiagnostics.proto */
2198 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
2199 #define __Pyx_HAS_GCC_DIAGNOSTIC
2200 #endif
2201 
2202 /* ObjectToMemviewSlice.proto */
2203 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_nn___pyx_t_5numpy_float_t(PyObject *, int writable_flag);
2204 
2205 /* ObjectToMemviewSlice.proto */
2206 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_int_t(PyObject *, int writable_flag);
2207 
2208 /* RealImag.proto */
2209 #if CYTHON_CCOMPLEX
2210   #ifdef __cplusplus
2211     #define __Pyx_CREAL(z) ((z).real())
2212     #define __Pyx_CIMAG(z) ((z).imag())
2213   #else
2214     #define __Pyx_CREAL(z) (__real__(z))
2215     #define __Pyx_CIMAG(z) (__imag__(z))
2216   #endif
2217 #else
2218     #define __Pyx_CREAL(z) ((z).real)
2219     #define __Pyx_CIMAG(z) ((z).imag)
2220 #endif
2221 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
2222         && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
2223     #define __Pyx_SET_CREAL(z,x) ((z).real(x))
2224     #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
2225 #else
2226     #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
2227     #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
2228 #endif
2229 
2230 /* Arithmetic.proto */
2231 #if CYTHON_CCOMPLEX
2232     #define __Pyx_c_eq_float(a, b)   ((a)==(b))
2233     #define __Pyx_c_sum_float(a, b)  ((a)+(b))
2234     #define __Pyx_c_diff_float(a, b) ((a)-(b))
2235     #define __Pyx_c_prod_float(a, b) ((a)*(b))
2236     #define __Pyx_c_quot_float(a, b) ((a)/(b))
2237     #define __Pyx_c_neg_float(a)     (-(a))
2238   #ifdef __cplusplus
2239     #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
2240     #define __Pyx_c_conj_float(z)    (::std::conj(z))
2241     #if 1
2242         #define __Pyx_c_abs_float(z)     (::std::abs(z))
2243         #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
2244     #endif
2245   #else
2246     #define __Pyx_c_is_zero_float(z) ((z)==0)
2247     #define __Pyx_c_conj_float(z)    (conjf(z))
2248     #if 1
2249         #define __Pyx_c_abs_float(z)     (cabsf(z))
2250         #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
2251     #endif
2252  #endif
2253 #else
2254     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
2255     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
2256     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
2257     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
2258     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
2259     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
2260     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
2261     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
2262     #if 1
2263         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
2264         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
2265     #endif
2266 #endif
2267 
2268 /* Arithmetic.proto */
2269 #if CYTHON_CCOMPLEX
2270     #define __Pyx_c_eq_double(a, b)   ((a)==(b))
2271     #define __Pyx_c_sum_double(a, b)  ((a)+(b))
2272     #define __Pyx_c_diff_double(a, b) ((a)-(b))
2273     #define __Pyx_c_prod_double(a, b) ((a)*(b))
2274     #define __Pyx_c_quot_double(a, b) ((a)/(b))
2275     #define __Pyx_c_neg_double(a)     (-(a))
2276   #ifdef __cplusplus
2277     #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
2278     #define __Pyx_c_conj_double(z)    (::std::conj(z))
2279     #if 1
2280         #define __Pyx_c_abs_double(z)     (::std::abs(z))
2281         #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
2282     #endif
2283   #else
2284     #define __Pyx_c_is_zero_double(z) ((z)==0)
2285     #define __Pyx_c_conj_double(z)    (conj(z))
2286     #if 1
2287         #define __Pyx_c_abs_double(z)     (cabs(z))
2288         #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
2289     #endif
2290  #endif
2291 #else
2292     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
2293     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
2294     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
2295     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
2296     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
2297     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
2298     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
2299     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
2300     #if 1
2301         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
2302         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
2303     #endif
2304 #endif
2305 
2306 /* MemviewSliceCopyTemplate.proto */
2307 static __Pyx_memviewslice
2308 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
2309                                  const char *mode, int ndim,
2310                                  size_t sizeof_dtype, int contig_flag,
2311                                  int dtype_is_object);
2312 
2313 /* CIntFromPy.proto */
2314 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
2315 
2316 /* CIntFromPy.proto */
2317 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
2318 
2319 /* CIntFromPy.proto */
2320 static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *);
2321 
2322 /* CIntToPy.proto */
2323 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);
2324 
2325 /* CIntToPy.proto */
2326 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus(enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus value);
2327 
2328 /* CIntToPy.proto */
2329 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
2330 
2331 /* CIntToPy.proto */
2332 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_long(npy_long value);
2333 
2334 /* CIntToPy.proto */
2335 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
2336 
2337 /* CIntFromPy.proto */
2338 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
2339 
2340 /* CheckBinaryVersion.proto */
2341 static int __Pyx_check_binary_version(void);
2342 
2343 /* FunctionImport.proto */
2344 static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig);
2345 
2346 /* InitStrings.proto */
2347 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2348 
2349 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
2350 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
2351 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
2352 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
2353 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/
2354 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
2355 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2356 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2357 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2358 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2359 
2360 /* Module declarations from 'cython.view' */
2361 
2362 /* Module declarations from 'cython' */
2363 
2364 /* Module declarations from 'cpython.buffer' */
2365 
2366 /* Module declarations from 'libc.string' */
2367 
2368 /* Module declarations from 'libc.stdio' */
2369 
2370 /* Module declarations from '__builtin__' */
2371 
2372 /* Module declarations from 'cpython.type' */
2373 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2374 
2375 /* Module declarations from 'cpython' */
2376 
2377 /* Module declarations from 'cpython.object' */
2378 
2379 /* Module declarations from 'cpython.ref' */
2380 
2381 /* Module declarations from 'cpython.mem' */
2382 
2383 /* Module declarations from 'numpy' */
2384 
2385 /* Module declarations from 'numpy' */
2386 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
2387 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
2388 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
2389 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
2390 static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
2391 static PyTypeObject *__pyx_ptype_5numpy_number = 0;
2392 static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
2393 static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
2394 static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
2395 static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
2396 static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
2397 static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
2398 static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
2399 static PyTypeObject *__pyx_ptype_5numpy_character = 0;
2400 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
2401 
2402 /* Module declarations from 'dipy.tracking.direction_getter' */
2403 static PyTypeObject *__pyx_ptype_4dipy_8tracking_16direction_getter_DirectionGetter = 0;
2404 
2405 /* Module declarations from 'dipy.tracking.stopping_criterion' */
2406 static PyTypeObject *__pyx_ptype_4dipy_8tracking_18stopping_criterion_StoppingCriterion = 0;
2407 static PyTypeObject *__pyx_ptype_4dipy_8tracking_18stopping_criterion_BinaryStoppingCriterion = 0;
2408 static PyTypeObject *__pyx_ptype_4dipy_8tracking_18stopping_criterion_ThresholdStoppingCriterion = 0;
2409 static PyTypeObject *__pyx_ptype_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion = 0;
2410 static PyTypeObject *__pyx_ptype_4dipy_8tracking_18stopping_criterion_ActStoppingCriterion = 0;
2411 static PyTypeObject *__pyx_ptype_4dipy_8tracking_18stopping_criterion_CmcStoppingCriterion = 0;
2412 
2413 /* Module declarations from 'dipy.align.fused_types' */
2414 
2415 /* Module declarations from 'dipy.core.interpolation' */
2416 static int (*__pyx_f_4dipy_4core_13interpolation_trilinear_interpolate4d_c)(__Pyx_memviewslice, double *, __Pyx_memviewslice); /*proto*/
2417 
2418 /* Module declarations from 'dipy.utils.fast_numpy' */
2419 static int (*__pyx_f_4dipy_5utils_10fast_numpy_where_to_insert)(__pyx_t_5numpy_float_t *, __pyx_t_5numpy_float_t, int); /*proto*/
2420 static void (*__pyx_f_4dipy_5utils_10fast_numpy_cumsum)(__pyx_t_5numpy_float_t *, __pyx_t_5numpy_float_t *, int); /*proto*/
2421 static void (*__pyx_f_4dipy_5utils_10fast_numpy_copy_point)(double *, double *); /*proto*/
2422 
2423 /* Module declarations from 'dipy.tracking.localtrack' */
2424 static PyTypeObject *__pyx_array_type = 0;
2425 static PyTypeObject *__pyx_MemviewEnum_type = 0;
2426 static PyTypeObject *__pyx_memoryview_type = 0;
2427 static PyTypeObject *__pyx_memoryviewslice_type = 0;
2428 static PyObject *generic = 0;
2429 static PyObject *strided = 0;
2430 static PyObject *indirect = 0;
2431 static PyObject *contiguous = 0;
2432 static PyObject *indirect_contiguous = 0;
2433 static int __pyx_memoryview_thread_locks_used;
2434 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2435 static CYTHON_INLINE double __pyx_f_4dipy_8tracking_10localtrack_stepsize(double, double); /*proto*/
2436 static void __pyx_f_4dipy_8tracking_10localtrack_step_to_boundary(double *, double *, double); /*proto*/
2437 static void __pyx_f_4dipy_8tracking_10localtrack_fixed_step(double *, double *, double); /*proto*/
2438 static int __pyx_f_4dipy_8tracking_10localtrack__local_tracker(struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter *, struct __pyx_obj_4dipy_8tracking_18stopping_criterion_StoppingCriterion *, double *, double *, double *, __Pyx_memviewslice, double, int, enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus *); /*proto*/
2439 static PyObject *__pyx_f_4dipy_8tracking_10localtrack__pft_tracker(struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter *, struct __pyx_obj_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion *, double *, double *, double *, __Pyx_memviewslice, __Pyx_memviewslice, double, enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus *, int, int, int, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
2440 static PyObject *__pyx_f_4dipy_8tracking_10localtrack__pft(__Pyx_memviewslice, int, __Pyx_memviewslice, struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter *, struct __pyx_obj_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion *, double *, double, enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus *, int, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
2441 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
2442 static void *__pyx_align_pointer(void *, size_t); /*proto*/
2443 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
2444 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
2445 static PyObject *_unellipsify(PyObject *, int); /*proto*/
2446 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
2447 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
2448 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
2449 static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
2450 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
2451 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
2452 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2453 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2454 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
2455 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2456 static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
2457 static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
2458 static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
2459 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
2460 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
2461 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
2462 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
2463 static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
2464 static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
2465 static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
2466 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
2467 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
2468 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
2469 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2470 static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2471 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
2472 static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
2473 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
2474 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float_t = { "float_t", NULL, sizeof(__pyx_t_5numpy_float_t), { 0 }, 0, 'R', 0, 0 };
2475 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int_t = { "int_t", NULL, sizeof(__pyx_t_5numpy_int_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int_t), 0 };
2476 #define __Pyx_MODULE_NAME "dipy.tracking.localtrack"
2477 extern int __pyx_module_is_main_dipy__tracking__localtrack;
2478 int __pyx_module_is_main_dipy__tracking__localtrack = 0;
2479 
2480 /* Implementation of 'dipy.tracking.localtrack' */
2481 static PyObject *__pyx_builtin_range;
2482 static PyObject *__pyx_builtin_ValueError;
2483 static PyObject *__pyx_builtin_ImportError;
2484 static PyObject *__pyx_builtin_MemoryError;
2485 static PyObject *__pyx_builtin_enumerate;
2486 static PyObject *__pyx_builtin_TypeError;
2487 static PyObject *__pyx_builtin_Ellipsis;
2488 static PyObject *__pyx_builtin_id;
2489 static PyObject *__pyx_builtin_IndexError;
2490 static const char __pyx_k_O[] = "O";
2491 static const char __pyx_k_c[] = "c";
2492 static const char __pyx_k_i[] = "i";
2493 static const char __pyx_k_dg[] = "dg";
2494 static const char __pyx_k_id[] = "id";
2495 static const char __pyx_k_np[] = "np";
2496 static const char __pyx_k_sc[] = "sc";
2497 static const char __pyx_k_vs[] = "vs";
2498 static const char __pyx_k_dir[] = "dir";
2499 static const char __pyx_k_new[] = "__new__";
2500 static const char __pyx_k_obj[] = "obj";
2501 static const char __pyx_k_base[] = "base";
2502 static const char __pyx_k_dict[] = "__dict__";
2503 static const char __pyx_k_main[] = "__main__";
2504 static const char __pyx_k_mode[] = "mode";
2505 static const char __pyx_k_name[] = "name";
2506 static const char __pyx_k_ndim[] = "ndim";
2507 static const char __pyx_k_pack[] = "pack";
2508 static const char __pyx_k_seed[] = "seed";
2509 static const char __pyx_k_size[] = "size";
2510 static const char __pyx_k_step[] = "step";
2511 static const char __pyx_k_stop[] = "stop";
2512 static const char __pyx_k_test[] = "__test__";
2513 static const char __pyx_k_ASCII[] = "ASCII";
2514 static const char __pyx_k_class[] = "__class__";
2515 static const char __pyx_k_error[] = "error";
2516 static const char __pyx_k_flags[] = "flags";
2517 static const char __pyx_k_numpy[] = "numpy";
2518 static const char __pyx_k_range[] = "range";
2519 static const char __pyx_k_shape[] = "shape";
2520 static const char __pyx_k_start[] = "start";
2521 static const char __pyx_k_encode[] = "encode";
2522 static const char __pyx_k_format[] = "format";
2523 static const char __pyx_k_import[] = "__import__";
2524 static const char __pyx_k_name_2[] = "__name__";
2525 static const char __pyx_k_pickle[] = "pickle";
2526 static const char __pyx_k_random[] = "random";
2527 static const char __pyx_k_reduce[] = "__reduce__";
2528 static const char __pyx_k_struct[] = "struct";
2529 static const char __pyx_k_unpack[] = "unpack";
2530 static const char __pyx_k_update[] = "update";
2531 static const char __pyx_k_fortran[] = "fortran";
2532 static const char __pyx_k_memview[] = "memview";
2533 static const char __pyx_k_Ellipsis[] = "Ellipsis";
2534 static const char __pyx_k_getstate[] = "__getstate__";
2535 static const char __pyx_k_itemsize[] = "itemsize";
2536 static const char __pyx_k_pyx_type[] = "__pyx_type";
2537 static const char __pyx_k_seed_pos[] = "seed_pos";
2538 static const char __pyx_k_setstate[] = "__setstate__";
2539 static const char __pyx_k_TypeError[] = "TypeError";
2540 static const char __pyx_k_enumerate[] = "enumerate";
2541 static const char __pyx_k_fixedstep[] = "fixedstep";
2542 static const char __pyx_k_pyx_state[] = "__pyx_state";
2543 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
2544 static const char __pyx_k_step_size[] = "step_size";
2545 static const char __pyx_k_IndexError[] = "IndexError";
2546 static const char __pyx_k_ValueError[] = "ValueError";
2547 static const char __pyx_k_directions[] = "directions";
2548 static const char __pyx_k_first_step[] = "first_step";
2549 static const char __pyx_k_pyx_result[] = "__pyx_result";
2550 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
2551 static const char __pyx_k_streamline[] = "streamline";
2552 static const char __pyx_k_voxel_size[] = "voxel_size";
2553 static const char __pyx_k_ImportError[] = "ImportError";
2554 static const char __pyx_k_MemoryError[] = "MemoryError";
2555 static const char __pyx_k_PickleError[] = "PickleError";
2556 static const char __pyx_k_pft_tracker[] = "pft_tracker";
2557 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
2558 static const char __pyx_k_stringsource[] = "stringsource";
2559 static const char __pyx_k_local_tracker[] = "local_tracker";
2560 static const char __pyx_k_particle_dirs[] = "particle_dirs";
2561 static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
2562 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
2563 static const char __pyx_k_stream_status[] = "stream_status";
2564 static const char __pyx_k_particle_count[] = "particle_count";
2565 static const char __pyx_k_particle_paths[] = "particle_paths";
2566 static const char __pyx_k_particle_steps[] = "particle_steps";
2567 static const char __pyx_k_pft_max_trials[] = "pft_max_trials";
2568 static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
2569 static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
2570 static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
2571 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
2572 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
2573 static const char __pyx_k_particle_weights[] = "particle_weights";
2574 static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
2575 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2576 static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
2577 static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
2578 static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
2579 static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
2580 static const char __pyx_k_pft_max_nbr_back_steps[] = "pft_max_nbr_back_steps";
2581 static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
2582 static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
2583 static const char __pyx_k_pft_max_nbr_front_steps[] = "pft_max_nbr_front_steps";
2584 static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
2585 static const char __pyx_k_dipy_tracking_localtrack[] = "dipy.tracking.localtrack";
2586 static const char __pyx_k_particle_stream_statuses[] = "particle_stream_statuses";
2587 static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
2588 static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
2589 static const char __pyx_k_dipy_tracking_localtrack_pyx[] = "dipy/tracking/localtrack.pyx";
2590 static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
2591 static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
2592 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
2593 static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
2594 static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
2595 static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
2596 static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
2597 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
2598 static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))";
2599 static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
2600 static const char __pyx_k_Invalid_input_parameter_dimensio[] = "Invalid input parameter dimensions.";
2601 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
2602 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
2603 static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
2604 static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
2605 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
2606 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
2607 static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
2608 static PyObject *__pyx_n_s_ASCII;
2609 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
2610 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
2611 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
2612 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
2613 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
2614 static PyObject *__pyx_n_s_Ellipsis;
2615 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
2616 static PyObject *__pyx_n_s_ImportError;
2617 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
2618 static PyObject *__pyx_n_s_IndexError;
2619 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
2620 static PyObject *__pyx_kp_u_Invalid_input_parameter_dimensio;
2621 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
2622 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
2623 static PyObject *__pyx_n_s_MemoryError;
2624 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
2625 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
2626 static PyObject *__pyx_n_b_O;
2627 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
2628 static PyObject *__pyx_n_s_PickleError;
2629 static PyObject *__pyx_n_s_TypeError;
2630 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
2631 static PyObject *__pyx_n_s_ValueError;
2632 static PyObject *__pyx_n_s_View_MemoryView;
2633 static PyObject *__pyx_n_s_allocate_buffer;
2634 static PyObject *__pyx_n_s_base;
2635 static PyObject *__pyx_n_s_c;
2636 static PyObject *__pyx_n_u_c;
2637 static PyObject *__pyx_n_s_class;
2638 static PyObject *__pyx_n_s_cline_in_traceback;
2639 static PyObject *__pyx_kp_s_contiguous_and_direct;
2640 static PyObject *__pyx_kp_s_contiguous_and_indirect;
2641 static PyObject *__pyx_n_s_dg;
2642 static PyObject *__pyx_n_s_dict;
2643 static PyObject *__pyx_n_s_dipy_tracking_localtrack;
2644 static PyObject *__pyx_kp_s_dipy_tracking_localtrack_pyx;
2645 static PyObject *__pyx_n_s_dir;
2646 static PyObject *__pyx_n_s_directions;
2647 static PyObject *__pyx_n_s_dtype_is_object;
2648 static PyObject *__pyx_n_s_encode;
2649 static PyObject *__pyx_n_s_enumerate;
2650 static PyObject *__pyx_n_s_error;
2651 static PyObject *__pyx_n_s_first_step;
2652 static PyObject *__pyx_n_s_fixedstep;
2653 static PyObject *__pyx_n_s_flags;
2654 static PyObject *__pyx_n_s_format;
2655 static PyObject *__pyx_n_s_fortran;
2656 static PyObject *__pyx_n_u_fortran;
2657 static PyObject *__pyx_n_s_getstate;
2658 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
2659 static PyObject *__pyx_n_s_i;
2660 static PyObject *__pyx_n_s_id;
2661 static PyObject *__pyx_n_s_import;
2662 static PyObject *__pyx_n_s_itemsize;
2663 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
2664 static PyObject *__pyx_n_s_local_tracker;
2665 static PyObject *__pyx_n_s_main;
2666 static PyObject *__pyx_n_s_memview;
2667 static PyObject *__pyx_n_s_mode;
2668 static PyObject *__pyx_n_s_name;
2669 static PyObject *__pyx_n_s_name_2;
2670 static PyObject *__pyx_n_s_ndim;
2671 static PyObject *__pyx_n_s_new;
2672 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2673 static PyObject *__pyx_n_s_np;
2674 static PyObject *__pyx_n_s_numpy;
2675 static PyObject *__pyx_kp_u_numpy_core_multiarray_failed_to;
2676 static PyObject *__pyx_kp_u_numpy_core_umath_failed_to_impor;
2677 static PyObject *__pyx_n_s_obj;
2678 static PyObject *__pyx_n_s_pack;
2679 static PyObject *__pyx_n_s_particle_count;
2680 static PyObject *__pyx_n_s_particle_dirs;
2681 static PyObject *__pyx_n_s_particle_paths;
2682 static PyObject *__pyx_n_s_particle_steps;
2683 static PyObject *__pyx_n_s_particle_stream_statuses;
2684 static PyObject *__pyx_n_s_particle_weights;
2685 static PyObject *__pyx_n_s_pft_max_nbr_back_steps;
2686 static PyObject *__pyx_n_s_pft_max_nbr_front_steps;
2687 static PyObject *__pyx_n_s_pft_max_trials;
2688 static PyObject *__pyx_n_s_pft_tracker;
2689 static PyObject *__pyx_n_s_pickle;
2690 static PyObject *__pyx_n_s_pyx_PickleError;
2691 static PyObject *__pyx_n_s_pyx_checksum;
2692 static PyObject *__pyx_n_s_pyx_getbuffer;
2693 static PyObject *__pyx_n_s_pyx_result;
2694 static PyObject *__pyx_n_s_pyx_state;
2695 static PyObject *__pyx_n_s_pyx_type;
2696 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
2697 static PyObject *__pyx_n_s_pyx_vtable;
2698 static PyObject *__pyx_n_s_random;
2699 static PyObject *__pyx_n_s_range;
2700 static PyObject *__pyx_n_s_reduce;
2701 static PyObject *__pyx_n_s_reduce_cython;
2702 static PyObject *__pyx_n_s_reduce_ex;
2703 static PyObject *__pyx_n_s_sc;
2704 static PyObject *__pyx_n_s_seed;
2705 static PyObject *__pyx_n_s_seed_pos;
2706 static PyObject *__pyx_n_s_setstate;
2707 static PyObject *__pyx_n_s_setstate_cython;
2708 static PyObject *__pyx_n_s_shape;
2709 static PyObject *__pyx_n_s_size;
2710 static PyObject *__pyx_n_s_start;
2711 static PyObject *__pyx_n_s_step;
2712 static PyObject *__pyx_n_s_step_size;
2713 static PyObject *__pyx_n_s_stop;
2714 static PyObject *__pyx_n_s_stream_status;
2715 static PyObject *__pyx_n_s_streamline;
2716 static PyObject *__pyx_kp_s_strided_and_direct;
2717 static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
2718 static PyObject *__pyx_kp_s_strided_and_indirect;
2719 static PyObject *__pyx_kp_s_stringsource;
2720 static PyObject *__pyx_n_s_struct;
2721 static PyObject *__pyx_n_s_test;
2722 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
2723 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
2724 static PyObject *__pyx_n_s_unpack;
2725 static PyObject *__pyx_n_s_update;
2726 static PyObject *__pyx_n_s_voxel_size;
2727 static PyObject *__pyx_n_s_vs;
2728 static PyObject *__pyx_pf_4dipy_8tracking_10localtrack_local_tracker(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter *__pyx_v_dg, struct __pyx_obj_4dipy_8tracking_18stopping_criterion_StoppingCriterion *__pyx_v_sc, __Pyx_memviewslice __pyx_v_seed_pos, __Pyx_memviewslice __pyx_v_first_step, __Pyx_memviewslice __pyx_v_voxel_size, __Pyx_memviewslice __pyx_v_streamline, double __pyx_v_step_size, int __pyx_v_fixedstep); /* proto */
2729 static PyObject *__pyx_pf_4dipy_8tracking_10localtrack_2pft_tracker(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter *__pyx_v_dg, struct __pyx_obj_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion *__pyx_v_sc, __Pyx_memviewslice __pyx_v_seed_pos, __Pyx_memviewslice __pyx_v_first_step, __Pyx_memviewslice __pyx_v_voxel_size, __Pyx_memviewslice __pyx_v_streamline, __Pyx_memviewslice __pyx_v_directions, double __pyx_v_step_size, int __pyx_v_pft_max_nbr_back_steps, int __pyx_v_pft_max_nbr_front_steps, int __pyx_v_pft_max_trials, int __pyx_v_particle_count, __Pyx_memviewslice __pyx_v_particle_paths, __Pyx_memviewslice __pyx_v_particle_dirs, __Pyx_memviewslice __pyx_v_particle_weights, __Pyx_memviewslice __pyx_v_particle_steps, __Pyx_memviewslice __pyx_v_particle_stream_statuses); /* proto */
2730 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */
2731 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
2732 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2733 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2734 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2735 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
2736 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
2737 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */
2738 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
2739 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2740 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
2741 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2742 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2743 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
2744 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */
2745 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2746 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
2747 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
2748 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
2749 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2750 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2751 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2752 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2753 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2754 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2755 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2756 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2757 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2758 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2759 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2760 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2761 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2762 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2763 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2764 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2765 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2766 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2767 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2768 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2769 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2770 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2771 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
2772 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2773 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2774 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2775 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2776 static PyObject *__pyx_int_0;
2777 static PyObject *__pyx_int_1;
2778 static PyObject *__pyx_int_184977713;
2779 static PyObject *__pyx_int_neg_1;
2780 static PyObject *__pyx_tuple_;
2781 static PyObject *__pyx_tuple__2;
2782 static PyObject *__pyx_tuple__3;
2783 static PyObject *__pyx_tuple__4;
2784 static PyObject *__pyx_tuple__5;
2785 static PyObject *__pyx_tuple__6;
2786 static PyObject *__pyx_tuple__7;
2787 static PyObject *__pyx_tuple__8;
2788 static PyObject *__pyx_tuple__9;
2789 static PyObject *__pyx_slice__18;
2790 static PyObject *__pyx_tuple__10;
2791 static PyObject *__pyx_tuple__11;
2792 static PyObject *__pyx_tuple__12;
2793 static PyObject *__pyx_tuple__13;
2794 static PyObject *__pyx_tuple__14;
2795 static PyObject *__pyx_tuple__15;
2796 static PyObject *__pyx_tuple__16;
2797 static PyObject *__pyx_tuple__17;
2798 static PyObject *__pyx_tuple__19;
2799 static PyObject *__pyx_tuple__20;
2800 static PyObject *__pyx_tuple__21;
2801 static PyObject *__pyx_tuple__22;
2802 static PyObject *__pyx_tuple__24;
2803 static PyObject *__pyx_tuple__26;
2804 static PyObject *__pyx_tuple__27;
2805 static PyObject *__pyx_tuple__28;
2806 static PyObject *__pyx_tuple__29;
2807 static PyObject *__pyx_tuple__30;
2808 static PyObject *__pyx_tuple__31;
2809 static PyObject *__pyx_codeobj__23;
2810 static PyObject *__pyx_codeobj__25;
2811 static PyObject *__pyx_codeobj__32;
2812 /* Late includes */
2813 
2814 /* "dipy/tracking/localtrack.pyx":22
2815  *
2816  * @cython.cdivision(True)
2817  * cdef inline double stepsize(double point, double increment) nogil:             # <<<<<<<<<<<<<<
2818  *     """Compute the step size to the closest boundary in units of increment."""
2819  *     cdef:
2820  */
2821 
__pyx_f_4dipy_8tracking_10localtrack_stepsize(double __pyx_v_point,double __pyx_v_increment)2822 static CYTHON_INLINE double __pyx_f_4dipy_8tracking_10localtrack_stepsize(double __pyx_v_point, double __pyx_v_increment) {
2823   double __pyx_v_dist;
2824   double __pyx_r;
2825   int __pyx_t_1;
2826 
2827   /* "dipy/tracking/localtrack.pyx":26
2828  *     cdef:
2829  *         double dist
2830  *     dist = dpy_rint(point) + .5 - dpy_signbit(increment) - point             # <<<<<<<<<<<<<<
2831  *     if dist == 0:
2832  *         # Point is on an edge, return step size to next edge.  This is most
2833  */
2834   __pyx_v_dist = (((dpy_rint(__pyx_v_point) + .5) - dpy_signbit(__pyx_v_increment)) - __pyx_v_point);
2835 
2836   /* "dipy/tracking/localtrack.pyx":27
2837  *         double dist
2838  *     dist = dpy_rint(point) + .5 - dpy_signbit(increment) - point
2839  *     if dist == 0:             # <<<<<<<<<<<<<<
2840  *         # Point is on an edge, return step size to next edge.  This is most
2841  *         # likely to come up if overstep is set to 0.
2842  */
2843   __pyx_t_1 = ((__pyx_v_dist == 0.0) != 0);
2844   if (__pyx_t_1) {
2845 
2846     /* "dipy/tracking/localtrack.pyx":30
2847  *         # Point is on an edge, return step size to next edge.  This is most
2848  *         # likely to come up if overstep is set to 0.
2849  *         return 1. / fabs(increment)             # <<<<<<<<<<<<<<
2850  *     else:
2851  *         return dist / increment
2852  */
2853     __pyx_r = (1. / fabs(__pyx_v_increment));
2854     goto __pyx_L0;
2855 
2856     /* "dipy/tracking/localtrack.pyx":27
2857  *         double dist
2858  *     dist = dpy_rint(point) + .5 - dpy_signbit(increment) - point
2859  *     if dist == 0:             # <<<<<<<<<<<<<<
2860  *         # Point is on an edge, return step size to next edge.  This is most
2861  *         # likely to come up if overstep is set to 0.
2862  */
2863   }
2864 
2865   /* "dipy/tracking/localtrack.pyx":32
2866  *         return 1. / fabs(increment)
2867  *     else:
2868  *         return dist / increment             # <<<<<<<<<<<<<<
2869  *
2870  *
2871  */
2872   /*else*/ {
2873     __pyx_r = (__pyx_v_dist / __pyx_v_increment);
2874     goto __pyx_L0;
2875   }
2876 
2877   /* "dipy/tracking/localtrack.pyx":22
2878  *
2879  * @cython.cdivision(True)
2880  * cdef inline double stepsize(double point, double increment) nogil:             # <<<<<<<<<<<<<<
2881  *     """Compute the step size to the closest boundary in units of increment."""
2882  *     cdef:
2883  */
2884 
2885   /* function exit code */
2886   __pyx_L0:;
2887   return __pyx_r;
2888 }
2889 
2890 /* "dipy/tracking/localtrack.pyx":35
2891  *
2892  *
2893  * cdef void step_to_boundary(double * point, double * direction,             # <<<<<<<<<<<<<<
2894  *                            double overstep) nogil:
2895  *     """Takes a step from point in along direction just past a voxel boundary.
2896  */
2897 
__pyx_f_4dipy_8tracking_10localtrack_step_to_boundary(double * __pyx_v_point,double * __pyx_v_direction,double __pyx_v_overstep)2898 static void __pyx_f_4dipy_8tracking_10localtrack_step_to_boundary(double *__pyx_v_point, double *__pyx_v_direction, double __pyx_v_overstep) {
2899   double __pyx_v_step_sizes[3];
2900   double __pyx_v_smallest_step;
2901   long __pyx_v_i;
2902   long __pyx_t_1;
2903   int __pyx_t_2;
2904   long __pyx_t_3;
2905 
2906   /* "dipy/tracking/localtrack.pyx":56
2907  *         double smallest_step
2908  *
2909  *     for i in range(3):             # <<<<<<<<<<<<<<
2910  *         step_sizes[i] = stepsize(point[i], direction[i])
2911  *
2912  */
2913   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
2914     __pyx_v_i = __pyx_t_1;
2915 
2916     /* "dipy/tracking/localtrack.pyx":57
2917  *
2918  *     for i in range(3):
2919  *         step_sizes[i] = stepsize(point[i], direction[i])             # <<<<<<<<<<<<<<
2920  *
2921  *     smallest_step = step_sizes[0]
2922  */
2923     (__pyx_v_step_sizes[__pyx_v_i]) = __pyx_f_4dipy_8tracking_10localtrack_stepsize((__pyx_v_point[__pyx_v_i]), (__pyx_v_direction[__pyx_v_i]));
2924   }
2925 
2926   /* "dipy/tracking/localtrack.pyx":59
2927  *         step_sizes[i] = stepsize(point[i], direction[i])
2928  *
2929  *     smallest_step = step_sizes[0]             # <<<<<<<<<<<<<<
2930  *     for i in range(1, 3):
2931  *         if step_sizes[i] < smallest_step:
2932  */
2933   __pyx_v_smallest_step = (__pyx_v_step_sizes[0]);
2934 
2935   /* "dipy/tracking/localtrack.pyx":60
2936  *
2937  *     smallest_step = step_sizes[0]
2938  *     for i in range(1, 3):             # <<<<<<<<<<<<<<
2939  *         if step_sizes[i] < smallest_step:
2940  *             smallest_step = step_sizes[i]
2941  */
2942   for (__pyx_t_1 = 1; __pyx_t_1 < 3; __pyx_t_1+=1) {
2943     __pyx_v_i = __pyx_t_1;
2944 
2945     /* "dipy/tracking/localtrack.pyx":61
2946  *     smallest_step = step_sizes[0]
2947  *     for i in range(1, 3):
2948  *         if step_sizes[i] < smallest_step:             # <<<<<<<<<<<<<<
2949  *             smallest_step = step_sizes[i]
2950  *
2951  */
2952     __pyx_t_2 = (((__pyx_v_step_sizes[__pyx_v_i]) < __pyx_v_smallest_step) != 0);
2953     if (__pyx_t_2) {
2954 
2955       /* "dipy/tracking/localtrack.pyx":62
2956  *     for i in range(1, 3):
2957  *         if step_sizes[i] < smallest_step:
2958  *             smallest_step = step_sizes[i]             # <<<<<<<<<<<<<<
2959  *
2960  *     smallest_step += overstep
2961  */
2962       __pyx_v_smallest_step = (__pyx_v_step_sizes[__pyx_v_i]);
2963 
2964       /* "dipy/tracking/localtrack.pyx":61
2965  *     smallest_step = step_sizes[0]
2966  *     for i in range(1, 3):
2967  *         if step_sizes[i] < smallest_step:             # <<<<<<<<<<<<<<
2968  *             smallest_step = step_sizes[i]
2969  *
2970  */
2971     }
2972   }
2973 
2974   /* "dipy/tracking/localtrack.pyx":64
2975  *             smallest_step = step_sizes[i]
2976  *
2977  *     smallest_step += overstep             # <<<<<<<<<<<<<<
2978  *     for i in range(3):
2979  *         point[i] += smallest_step * direction[i]
2980  */
2981   __pyx_v_smallest_step = (__pyx_v_smallest_step + __pyx_v_overstep);
2982 
2983   /* "dipy/tracking/localtrack.pyx":65
2984  *
2985  *     smallest_step += overstep
2986  *     for i in range(3):             # <<<<<<<<<<<<<<
2987  *         point[i] += smallest_step * direction[i]
2988  *
2989  */
2990   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
2991     __pyx_v_i = __pyx_t_1;
2992 
2993     /* "dipy/tracking/localtrack.pyx":66
2994  *     smallest_step += overstep
2995  *     for i in range(3):
2996  *         point[i] += smallest_step * direction[i]             # <<<<<<<<<<<<<<
2997  *
2998  *
2999  */
3000     __pyx_t_3 = __pyx_v_i;
3001     (__pyx_v_point[__pyx_t_3]) = ((__pyx_v_point[__pyx_t_3]) + (__pyx_v_smallest_step * (__pyx_v_direction[__pyx_v_i])));
3002   }
3003 
3004   /* "dipy/tracking/localtrack.pyx":35
3005  *
3006  *
3007  * cdef void step_to_boundary(double * point, double * direction,             # <<<<<<<<<<<<<<
3008  *                            double overstep) nogil:
3009  *     """Takes a step from point in along direction just past a voxel boundary.
3010  */
3011 
3012   /* function exit code */
3013 }
3014 
3015 /* "dipy/tracking/localtrack.pyx":69
3016  *
3017  *
3018  * cdef void fixed_step(double * point, double * direction, double step_size) nogil:             # <<<<<<<<<<<<<<
3019  *     """Updates point by stepping in direction.
3020  *
3021  */
3022 
__pyx_f_4dipy_8tracking_10localtrack_fixed_step(double * __pyx_v_point,double * __pyx_v_direction,double __pyx_v_step_size)3023 static void __pyx_f_4dipy_8tracking_10localtrack_fixed_step(double *__pyx_v_point, double *__pyx_v_direction, double __pyx_v_step_size) {
3024   long __pyx_v_i;
3025   long __pyx_t_1;
3026   long __pyx_t_2;
3027 
3028   /* "dipy/tracking/localtrack.pyx":82
3029  *
3030  *     """
3031  *     for i in range(3):             # <<<<<<<<<<<<<<
3032  *         point[i] += direction[i] * step_size
3033  *
3034  */
3035   for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
3036     __pyx_v_i = __pyx_t_1;
3037 
3038     /* "dipy/tracking/localtrack.pyx":83
3039  *     """
3040  *     for i in range(3):
3041  *         point[i] += direction[i] * step_size             # <<<<<<<<<<<<<<
3042  *
3043  *
3044  */
3045     __pyx_t_2 = __pyx_v_i;
3046     (__pyx_v_point[__pyx_t_2]) = ((__pyx_v_point[__pyx_t_2]) + ((__pyx_v_direction[__pyx_v_i]) * __pyx_v_step_size));
3047   }
3048 
3049   /* "dipy/tracking/localtrack.pyx":69
3050  *
3051  *
3052  * cdef void fixed_step(double * point, double * direction, double step_size) nogil:             # <<<<<<<<<<<<<<
3053  *     """Updates point by stepping in direction.
3054  *
3055  */
3056 
3057   /* function exit code */
3058 }
3059 
3060 /* "dipy/tracking/localtrack.pyx":86
3061  *
3062  *
3063  * def local_tracker(             # <<<<<<<<<<<<<<
3064  *         DirectionGetter dg,
3065  *         StoppingCriterion sc,
3066  */
3067 
3068 /* Python wrapper */
3069 static PyObject *__pyx_pw_4dipy_8tracking_10localtrack_1local_tracker(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3070 static char __pyx_doc_4dipy_8tracking_10localtrack_local_tracker[] = "Tracks one direction from a seed.\n\n    This function is the main workhorse of the ``LocalTracking`` class defined\n    in ``dipy.tracking.local_tracking``.\n\n    Parameters\n    ----------\n    dg : DirectionGetter\n        Used to choosing tracking directions.\n    sc : StoppingCriterion\n        Used to check the streamline status (e.g. endpoint) along path.\n    seed_pos : array, float, 1d, (3,)\n        First point of the (partial) streamline.\n    first_step : array, float, 1d, (3,)\n        Initial seeding direction. Used as ``prev_dir`` for selecting the step\n        direction from the seed point.\n    voxel_size : array, float, 1d, (3,)\n        Size of voxels in the data set.\n    streamline : array, float, 2d, (N, 3)\n        Output of tracking will be put into this array. The length of this\n        array, ``N``, will set the maximum allowable length of the streamline.\n    step_size : float\n        Size of tracking steps in mm if ``fixed_step``.\n    fixedstep : bool\n        If true, a fixed step_size is used, otherwise a variable step size is\n        used.\n\n    Returns\n    -------\n    end : int\n        Length of the tracked streamline\n    stream_status : StreamlineStatus\n        Ending state of the streamlines as determined by the StoppingCriterion.\n    ";
3071 static PyMethodDef __pyx_mdef_4dipy_8tracking_10localtrack_1local_tracker = {"local_tracker", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4dipy_8tracking_10localtrack_1local_tracker, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dipy_8tracking_10localtrack_local_tracker};
__pyx_pw_4dipy_8tracking_10localtrack_1local_tracker(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3072 static PyObject *__pyx_pw_4dipy_8tracking_10localtrack_1local_tracker(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3073   struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter *__pyx_v_dg = 0;
3074   struct __pyx_obj_4dipy_8tracking_18stopping_criterion_StoppingCriterion *__pyx_v_sc = 0;
3075   __Pyx_memviewslice __pyx_v_seed_pos = { 0, 0, { 0 }, { 0 }, { 0 } };
3076   __Pyx_memviewslice __pyx_v_first_step = { 0, 0, { 0 }, { 0 }, { 0 } };
3077   __Pyx_memviewslice __pyx_v_voxel_size = { 0, 0, { 0 }, { 0 }, { 0 } };
3078   __Pyx_memviewslice __pyx_v_streamline = { 0, 0, { 0 }, { 0 }, { 0 } };
3079   double __pyx_v_step_size;
3080   int __pyx_v_fixedstep;
3081   int __pyx_lineno = 0;
3082   const char *__pyx_filename = NULL;
3083   int __pyx_clineno = 0;
3084   PyObject *__pyx_r = 0;
3085   __Pyx_RefNannyDeclarations
3086   __Pyx_RefNannySetupContext("local_tracker (wrapper)", 0);
3087   {
3088     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dg,&__pyx_n_s_sc,&__pyx_n_s_seed_pos,&__pyx_n_s_first_step,&__pyx_n_s_voxel_size,&__pyx_n_s_streamline,&__pyx_n_s_step_size,&__pyx_n_s_fixedstep,0};
3089     PyObject* values[8] = {0,0,0,0,0,0,0,0};
3090     if (unlikely(__pyx_kwds)) {
3091       Py_ssize_t kw_args;
3092       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3093       switch (pos_args) {
3094         case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3095         CYTHON_FALLTHROUGH;
3096         case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3097         CYTHON_FALLTHROUGH;
3098         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3099         CYTHON_FALLTHROUGH;
3100         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3101         CYTHON_FALLTHROUGH;
3102         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3103         CYTHON_FALLTHROUGH;
3104         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3105         CYTHON_FALLTHROUGH;
3106         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3107         CYTHON_FALLTHROUGH;
3108         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3109         CYTHON_FALLTHROUGH;
3110         case  0: break;
3111         default: goto __pyx_L5_argtuple_error;
3112       }
3113       kw_args = PyDict_Size(__pyx_kwds);
3114       switch (pos_args) {
3115         case  0:
3116         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dg)) != 0)) kw_args--;
3117         else goto __pyx_L5_argtuple_error;
3118         CYTHON_FALLTHROUGH;
3119         case  1:
3120         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sc)) != 0)) kw_args--;
3121         else {
3122           __Pyx_RaiseArgtupleInvalid("local_tracker", 1, 8, 8, 1); __PYX_ERR(0, 86, __pyx_L3_error)
3123         }
3124         CYTHON_FALLTHROUGH;
3125         case  2:
3126         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seed_pos)) != 0)) kw_args--;
3127         else {
3128           __Pyx_RaiseArgtupleInvalid("local_tracker", 1, 8, 8, 2); __PYX_ERR(0, 86, __pyx_L3_error)
3129         }
3130         CYTHON_FALLTHROUGH;
3131         case  3:
3132         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_first_step)) != 0)) kw_args--;
3133         else {
3134           __Pyx_RaiseArgtupleInvalid("local_tracker", 1, 8, 8, 3); __PYX_ERR(0, 86, __pyx_L3_error)
3135         }
3136         CYTHON_FALLTHROUGH;
3137         case  4:
3138         if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_voxel_size)) != 0)) kw_args--;
3139         else {
3140           __Pyx_RaiseArgtupleInvalid("local_tracker", 1, 8, 8, 4); __PYX_ERR(0, 86, __pyx_L3_error)
3141         }
3142         CYTHON_FALLTHROUGH;
3143         case  5:
3144         if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_streamline)) != 0)) kw_args--;
3145         else {
3146           __Pyx_RaiseArgtupleInvalid("local_tracker", 1, 8, 8, 5); __PYX_ERR(0, 86, __pyx_L3_error)
3147         }
3148         CYTHON_FALLTHROUGH;
3149         case  6:
3150         if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_step_size)) != 0)) kw_args--;
3151         else {
3152           __Pyx_RaiseArgtupleInvalid("local_tracker", 1, 8, 8, 6); __PYX_ERR(0, 86, __pyx_L3_error)
3153         }
3154         CYTHON_FALLTHROUGH;
3155         case  7:
3156         if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fixedstep)) != 0)) kw_args--;
3157         else {
3158           __Pyx_RaiseArgtupleInvalid("local_tracker", 1, 8, 8, 7); __PYX_ERR(0, 86, __pyx_L3_error)
3159         }
3160       }
3161       if (unlikely(kw_args > 0)) {
3162         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "local_tracker") < 0)) __PYX_ERR(0, 86, __pyx_L3_error)
3163       }
3164     } else if (PyTuple_GET_SIZE(__pyx_args) != 8) {
3165       goto __pyx_L5_argtuple_error;
3166     } else {
3167       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3168       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3169       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3170       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3171       values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3172       values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3173       values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3174       values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3175     }
3176     __pyx_v_dg = ((struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter *)values[0]);
3177     __pyx_v_sc = ((struct __pyx_obj_4dipy_8tracking_18stopping_criterion_StoppingCriterion *)values[1]);
3178     __pyx_v_seed_pos = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_seed_pos.memview)) __PYX_ERR(0, 89, __pyx_L3_error)
3179     __pyx_v_first_step = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float_t(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_first_step.memview)) __PYX_ERR(0, 90, __pyx_L3_error)
3180     __pyx_v_voxel_size = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float_t(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_voxel_size.memview)) __PYX_ERR(0, 91, __pyx_L3_error)
3181     __pyx_v_streamline = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float_t(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_streamline.memview)) __PYX_ERR(0, 92, __pyx_L3_error)
3182     __pyx_v_step_size = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_step_size == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 93, __pyx_L3_error)
3183     __pyx_v_fixedstep = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_fixedstep == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 94, __pyx_L3_error)
3184   }
3185   goto __pyx_L4_argument_unpacking_done;
3186   __pyx_L5_argtuple_error:;
3187   __Pyx_RaiseArgtupleInvalid("local_tracker", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 86, __pyx_L3_error)
3188   __pyx_L3_error:;
3189   __Pyx_AddTraceback("dipy.tracking.localtrack.local_tracker", __pyx_clineno, __pyx_lineno, __pyx_filename);
3190   __Pyx_RefNannyFinishContext();
3191   return NULL;
3192   __pyx_L4_argument_unpacking_done:;
3193   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dg), __pyx_ptype_4dipy_8tracking_16direction_getter_DirectionGetter, 1, "dg", 0))) __PYX_ERR(0, 87, __pyx_L1_error)
3194   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sc), __pyx_ptype_4dipy_8tracking_18stopping_criterion_StoppingCriterion, 1, "sc", 0))) __PYX_ERR(0, 88, __pyx_L1_error)
3195   __pyx_r = __pyx_pf_4dipy_8tracking_10localtrack_local_tracker(__pyx_self, __pyx_v_dg, __pyx_v_sc, __pyx_v_seed_pos, __pyx_v_first_step, __pyx_v_voxel_size, __pyx_v_streamline, __pyx_v_step_size, __pyx_v_fixedstep);
3196 
3197   /* function exit code */
3198   goto __pyx_L0;
3199   __pyx_L1_error:;
3200   __pyx_r = NULL;
3201   __pyx_L0:;
3202   __Pyx_RefNannyFinishContext();
3203   return __pyx_r;
3204 }
3205 
__pyx_pf_4dipy_8tracking_10localtrack_local_tracker(CYTHON_UNUSED PyObject * __pyx_self,struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter * __pyx_v_dg,struct __pyx_obj_4dipy_8tracking_18stopping_criterion_StoppingCriterion * __pyx_v_sc,__Pyx_memviewslice __pyx_v_seed_pos,__Pyx_memviewslice __pyx_v_first_step,__Pyx_memviewslice __pyx_v_voxel_size,__Pyx_memviewslice __pyx_v_streamline,double __pyx_v_step_size,int __pyx_v_fixedstep)3206 static PyObject *__pyx_pf_4dipy_8tracking_10localtrack_local_tracker(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter *__pyx_v_dg, struct __pyx_obj_4dipy_8tracking_18stopping_criterion_StoppingCriterion *__pyx_v_sc, __Pyx_memviewslice __pyx_v_seed_pos, __Pyx_memviewslice __pyx_v_first_step, __Pyx_memviewslice __pyx_v_voxel_size, __Pyx_memviewslice __pyx_v_streamline, double __pyx_v_step_size, int __pyx_v_fixedstep) {
3207   npy_intp __pyx_v_i;
3208   enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus __pyx_v_stream_status;
3209   double __pyx_v_dir[3];
3210   double __pyx_v_vs[3];
3211   double __pyx_v_seed[3];
3212   PyObject *__pyx_r = NULL;
3213   __Pyx_RefNannyDeclarations
3214   int __pyx_t_1;
3215   int __pyx_t_2;
3216   PyObject *__pyx_t_3 = NULL;
3217   npy_intp __pyx_t_4;
3218   Py_ssize_t __pyx_t_5;
3219   int __pyx_t_6;
3220   PyObject *__pyx_t_7 = NULL;
3221   PyObject *__pyx_t_8 = NULL;
3222   int __pyx_lineno = 0;
3223   const char *__pyx_filename = NULL;
3224   int __pyx_clineno = 0;
3225   __Pyx_RefNannySetupContext("local_tracker", 0);
3226 
3227   /* "dipy/tracking/localtrack.pyx":136
3228  *         double seed[3]
3229  *
3230  *     if (seed_pos.shape[0] != 3 or first_step.shape[0] != 3 or             # <<<<<<<<<<<<<<
3231  *             voxel_size.shape[0] != 3 or streamline.shape[1] != 3):
3232  *         raise ValueError('Invalid input parameter dimensions.')
3233  */
3234   __pyx_t_2 = (((__pyx_v_seed_pos.shape[0]) != 3) != 0);
3235   if (!__pyx_t_2) {
3236   } else {
3237     __pyx_t_1 = __pyx_t_2;
3238     goto __pyx_L4_bool_binop_done;
3239   }
3240   __pyx_t_2 = (((__pyx_v_first_step.shape[0]) != 3) != 0);
3241   if (!__pyx_t_2) {
3242   } else {
3243     __pyx_t_1 = __pyx_t_2;
3244     goto __pyx_L4_bool_binop_done;
3245   }
3246 
3247   /* "dipy/tracking/localtrack.pyx":137
3248  *
3249  *     if (seed_pos.shape[0] != 3 or first_step.shape[0] != 3 or
3250  *             voxel_size.shape[0] != 3 or streamline.shape[1] != 3):             # <<<<<<<<<<<<<<
3251  *         raise ValueError('Invalid input parameter dimensions.')
3252  *
3253  */
3254   __pyx_t_2 = (((__pyx_v_voxel_size.shape[0]) != 3) != 0);
3255   if (!__pyx_t_2) {
3256   } else {
3257     __pyx_t_1 = __pyx_t_2;
3258     goto __pyx_L4_bool_binop_done;
3259   }
3260   __pyx_t_2 = (((__pyx_v_streamline.shape[1]) != 3) != 0);
3261   __pyx_t_1 = __pyx_t_2;
3262   __pyx_L4_bool_binop_done:;
3263 
3264   /* "dipy/tracking/localtrack.pyx":136
3265  *         double seed[3]
3266  *
3267  *     if (seed_pos.shape[0] != 3 or first_step.shape[0] != 3 or             # <<<<<<<<<<<<<<
3268  *             voxel_size.shape[0] != 3 or streamline.shape[1] != 3):
3269  *         raise ValueError('Invalid input parameter dimensions.')
3270  */
3271   if (unlikely(__pyx_t_1)) {
3272 
3273     /* "dipy/tracking/localtrack.pyx":138
3274  *     if (seed_pos.shape[0] != 3 or first_step.shape[0] != 3 or
3275  *             voxel_size.shape[0] != 3 or streamline.shape[1] != 3):
3276  *         raise ValueError('Invalid input parameter dimensions.')             # <<<<<<<<<<<<<<
3277  *
3278  *     for i in range(3):
3279  */
3280     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 138, __pyx_L1_error)
3281     __Pyx_GOTREF(__pyx_t_3);
3282     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
3283     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3284     __PYX_ERR(0, 138, __pyx_L1_error)
3285 
3286     /* "dipy/tracking/localtrack.pyx":136
3287  *         double seed[3]
3288  *
3289  *     if (seed_pos.shape[0] != 3 or first_step.shape[0] != 3 or             # <<<<<<<<<<<<<<
3290  *             voxel_size.shape[0] != 3 or streamline.shape[1] != 3):
3291  *         raise ValueError('Invalid input parameter dimensions.')
3292  */
3293   }
3294 
3295   /* "dipy/tracking/localtrack.pyx":140
3296  *         raise ValueError('Invalid input parameter dimensions.')
3297  *
3298  *     for i in range(3):             # <<<<<<<<<<<<<<
3299  *         dir[i] = first_step[i]
3300  *         vs[i] = voxel_size[i]
3301  */
3302   for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) {
3303     __pyx_v_i = __pyx_t_4;
3304 
3305     /* "dipy/tracking/localtrack.pyx":141
3306  *
3307  *     for i in range(3):
3308  *         dir[i] = first_step[i]             # <<<<<<<<<<<<<<
3309  *         vs[i] = voxel_size[i]
3310  *         seed[i] = seed_pos[i]
3311  */
3312     __pyx_t_5 = __pyx_v_i;
3313     __pyx_t_6 = -1;
3314     if (__pyx_t_5 < 0) {
3315       __pyx_t_5 += __pyx_v_first_step.shape[0];
3316       if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
3317     } else if (unlikely(__pyx_t_5 >= __pyx_v_first_step.shape[0])) __pyx_t_6 = 0;
3318     if (unlikely(__pyx_t_6 != -1)) {
3319       __Pyx_RaiseBufferIndexError(__pyx_t_6);
3320       __PYX_ERR(0, 141, __pyx_L1_error)
3321     }
3322     (__pyx_v_dir[__pyx_v_i]) = (*((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_first_step.data + __pyx_t_5 * __pyx_v_first_step.strides[0]) )));
3323 
3324     /* "dipy/tracking/localtrack.pyx":142
3325  *     for i in range(3):
3326  *         dir[i] = first_step[i]
3327  *         vs[i] = voxel_size[i]             # <<<<<<<<<<<<<<
3328  *         seed[i] = seed_pos[i]
3329  *
3330  */
3331     __pyx_t_5 = __pyx_v_i;
3332     __pyx_t_6 = -1;
3333     if (__pyx_t_5 < 0) {
3334       __pyx_t_5 += __pyx_v_voxel_size.shape[0];
3335       if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
3336     } else if (unlikely(__pyx_t_5 >= __pyx_v_voxel_size.shape[0])) __pyx_t_6 = 0;
3337     if (unlikely(__pyx_t_6 != -1)) {
3338       __Pyx_RaiseBufferIndexError(__pyx_t_6);
3339       __PYX_ERR(0, 142, __pyx_L1_error)
3340     }
3341     (__pyx_v_vs[__pyx_v_i]) = (*((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_voxel_size.data + __pyx_t_5 * __pyx_v_voxel_size.strides[0]) )));
3342 
3343     /* "dipy/tracking/localtrack.pyx":143
3344  *         dir[i] = first_step[i]
3345  *         vs[i] = voxel_size[i]
3346  *         seed[i] = seed_pos[i]             # <<<<<<<<<<<<<<
3347  *
3348  *     i = _local_tracker(dg, sc, seed, dir, vs, streamline,
3349  */
3350     __pyx_t_5 = __pyx_v_i;
3351     __pyx_t_6 = -1;
3352     if (__pyx_t_5 < 0) {
3353       __pyx_t_5 += __pyx_v_seed_pos.shape[0];
3354       if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
3355     } else if (unlikely(__pyx_t_5 >= __pyx_v_seed_pos.shape[0])) __pyx_t_6 = 0;
3356     if (unlikely(__pyx_t_6 != -1)) {
3357       __Pyx_RaiseBufferIndexError(__pyx_t_6);
3358       __PYX_ERR(0, 143, __pyx_L1_error)
3359     }
3360     (__pyx_v_seed[__pyx_v_i]) = (*((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_seed_pos.data + __pyx_t_5 * __pyx_v_seed_pos.strides[0]) )));
3361   }
3362 
3363   /* "dipy/tracking/localtrack.pyx":145
3364  *         seed[i] = seed_pos[i]
3365  *
3366  *     i = _local_tracker(dg, sc, seed, dir, vs, streamline,             # <<<<<<<<<<<<<<
3367  *                        step_size, fixedstep, &stream_status)
3368  *     return i, stream_status
3369  */
3370   __pyx_v_i = __pyx_f_4dipy_8tracking_10localtrack__local_tracker(__pyx_v_dg, __pyx_v_sc, __pyx_v_seed, __pyx_v_dir, __pyx_v_vs, __pyx_v_streamline, __pyx_v_step_size, __pyx_v_fixedstep, (&__pyx_v_stream_status));
3371 
3372   /* "dipy/tracking/localtrack.pyx":147
3373  *     i = _local_tracker(dg, sc, seed, dir, vs, streamline,
3374  *                        step_size, fixedstep, &stream_status)
3375  *     return i, stream_status             # <<<<<<<<<<<<<<
3376  *
3377  *
3378  */
3379   __Pyx_XDECREF(__pyx_r);
3380   __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 147, __pyx_L1_error)
3381   __Pyx_GOTREF(__pyx_t_3);
3382   __pyx_t_7 = __Pyx_PyInt_From_enum____pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus(__pyx_v_stream_status); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 147, __pyx_L1_error)
3383   __Pyx_GOTREF(__pyx_t_7);
3384   __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 147, __pyx_L1_error)
3385   __Pyx_GOTREF(__pyx_t_8);
3386   __Pyx_GIVEREF(__pyx_t_3);
3387   PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3);
3388   __Pyx_GIVEREF(__pyx_t_7);
3389   PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
3390   __pyx_t_3 = 0;
3391   __pyx_t_7 = 0;
3392   __pyx_r = __pyx_t_8;
3393   __pyx_t_8 = 0;
3394   goto __pyx_L0;
3395 
3396   /* "dipy/tracking/localtrack.pyx":86
3397  *
3398  *
3399  * def local_tracker(             # <<<<<<<<<<<<<<
3400  *         DirectionGetter dg,
3401  *         StoppingCriterion sc,
3402  */
3403 
3404   /* function exit code */
3405   __pyx_L1_error:;
3406   __Pyx_XDECREF(__pyx_t_3);
3407   __Pyx_XDECREF(__pyx_t_7);
3408   __Pyx_XDECREF(__pyx_t_8);
3409   __Pyx_AddTraceback("dipy.tracking.localtrack.local_tracker", __pyx_clineno, __pyx_lineno, __pyx_filename);
3410   __pyx_r = NULL;
3411   __pyx_L0:;
3412   __PYX_XDEC_MEMVIEW(&__pyx_v_seed_pos, 1);
3413   __PYX_XDEC_MEMVIEW(&__pyx_v_first_step, 1);
3414   __PYX_XDEC_MEMVIEW(&__pyx_v_voxel_size, 1);
3415   __PYX_XDEC_MEMVIEW(&__pyx_v_streamline, 1);
3416   __Pyx_XGIVEREF(__pyx_r);
3417   __Pyx_RefNannyFinishContext();
3418   return __pyx_r;
3419 }
3420 
3421 /* "dipy/tracking/localtrack.pyx":153
3422  * @cython.wraparound(False)
3423  * @cython.cdivision(True)
3424  * cdef int _local_tracker(DirectionGetter dg,             # <<<<<<<<<<<<<<
3425  *                         StoppingCriterion sc,
3426  *                         double* seed,
3427  */
3428 
__pyx_f_4dipy_8tracking_10localtrack__local_tracker(struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter * __pyx_v_dg,struct __pyx_obj_4dipy_8tracking_18stopping_criterion_StoppingCriterion * __pyx_v_sc,double * __pyx_v_seed,double * __pyx_v_dir,double * __pyx_v_voxel_size,__Pyx_memviewslice __pyx_v_streamline,double __pyx_v_step_size,int __pyx_v_fixedstep,enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus * __pyx_v_stream_status)3429 static int __pyx_f_4dipy_8tracking_10localtrack__local_tracker(struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter *__pyx_v_dg, struct __pyx_obj_4dipy_8tracking_18stopping_criterion_StoppingCriterion *__pyx_v_sc, double *__pyx_v_seed, double *__pyx_v_dir, double *__pyx_v_voxel_size, __Pyx_memviewslice __pyx_v_streamline, double __pyx_v_step_size, int __pyx_v_fixedstep, enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus *__pyx_v_stream_status) {
3430   npy_intp __pyx_v_i;
3431   npy_intp __pyx_v_len_streamlines;
3432   double __pyx_v_point[3];
3433   double __pyx_v_voxdir[3];
3434   void (*__pyx_v_step)(double *, double *, double);
3435   long __pyx_v_j;
3436   int __pyx_r;
3437   __Pyx_RefNannyDeclarations
3438   int __pyx_t_1;
3439   Py_ssize_t __pyx_t_2;
3440   Py_ssize_t __pyx_t_3;
3441   npy_intp __pyx_t_4;
3442   npy_intp __pyx_t_5;
3443   npy_intp __pyx_t_6;
3444   long __pyx_t_7;
3445   int __pyx_t_8;
3446   __Pyx_RefNannySetupContext("_local_tracker", 0);
3447 
3448   /* "dipy/tracking/localtrack.pyx":164
3449  *     cdef:
3450  *         cnp.npy_intp i
3451  *         cnp.npy_intp len_streamlines = streamline.shape[0]             # <<<<<<<<<<<<<<
3452  *         double point[3]
3453  *         double voxdir[3]
3454  */
3455   __pyx_v_len_streamlines = (__pyx_v_streamline.shape[0]);
3456 
3457   /* "dipy/tracking/localtrack.pyx":169
3458  *         void (*step)(double*, double*, double) nogil
3459  *
3460  *     if fixedstep:             # <<<<<<<<<<<<<<
3461  *         step = fixed_step
3462  *     else:
3463  */
3464   __pyx_t_1 = (__pyx_v_fixedstep != 0);
3465   if (__pyx_t_1) {
3466 
3467     /* "dipy/tracking/localtrack.pyx":170
3468  *
3469  *     if fixedstep:
3470  *         step = fixed_step             # <<<<<<<<<<<<<<
3471  *     else:
3472  *         step = step_to_boundary
3473  */
3474     __pyx_v_step = __pyx_f_4dipy_8tracking_10localtrack_fixed_step;
3475 
3476     /* "dipy/tracking/localtrack.pyx":169
3477  *         void (*step)(double*, double*, double) nogil
3478  *
3479  *     if fixedstep:             # <<<<<<<<<<<<<<
3480  *         step = fixed_step
3481  *     else:
3482  */
3483     goto __pyx_L3;
3484   }
3485 
3486   /* "dipy/tracking/localtrack.pyx":172
3487  *         step = fixed_step
3488  *     else:
3489  *         step = step_to_boundary             # <<<<<<<<<<<<<<
3490  *
3491  *     copy_point(seed, point)
3492  */
3493   /*else*/ {
3494     __pyx_v_step = __pyx_f_4dipy_8tracking_10localtrack_step_to_boundary;
3495   }
3496   __pyx_L3:;
3497 
3498   /* "dipy/tracking/localtrack.pyx":174
3499  *         step = step_to_boundary
3500  *
3501  *     copy_point(seed, point)             # <<<<<<<<<<<<<<
3502  *     copy_point(seed, &streamline[0,0])
3503  *
3504  */
3505   __pyx_f_4dipy_5utils_10fast_numpy_copy_point(__pyx_v_seed, __pyx_v_point);
3506 
3507   /* "dipy/tracking/localtrack.pyx":175
3508  *
3509  *     copy_point(seed, point)
3510  *     copy_point(seed, &streamline[0,0])             # <<<<<<<<<<<<<<
3511  *
3512  *     stream_status[0] = TRACKPOINT
3513  */
3514   __pyx_t_2 = 0;
3515   __pyx_t_3 = 0;
3516   __pyx_f_4dipy_5utils_10fast_numpy_copy_point(__pyx_v_seed, (&(*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_streamline.data + __pyx_t_2 * __pyx_v_streamline.strides[0]) ) + __pyx_t_3 * __pyx_v_streamline.strides[1]) )))));
3517 
3518   /* "dipy/tracking/localtrack.pyx":177
3519  *     copy_point(seed, &streamline[0,0])
3520  *
3521  *     stream_status[0] = TRACKPOINT             # <<<<<<<<<<<<<<
3522  *     for i in range(1, len_streamlines):
3523  *         if dg.get_direction_c(point, dir):
3524  */
3525   (__pyx_v_stream_status[0]) = __pyx_e_4dipy_8tracking_18stopping_criterion_TRACKPOINT;
3526 
3527   /* "dipy/tracking/localtrack.pyx":178
3528  *
3529  *     stream_status[0] = TRACKPOINT
3530  *     for i in range(1, len_streamlines):             # <<<<<<<<<<<<<<
3531  *         if dg.get_direction_c(point, dir):
3532  *             break
3533  */
3534   __pyx_t_4 = __pyx_v_len_streamlines;
3535   __pyx_t_5 = __pyx_t_4;
3536   for (__pyx_t_6 = 1; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
3537     __pyx_v_i = __pyx_t_6;
3538 
3539     /* "dipy/tracking/localtrack.pyx":179
3540  *     stream_status[0] = TRACKPOINT
3541  *     for i in range(1, len_streamlines):
3542  *         if dg.get_direction_c(point, dir):             # <<<<<<<<<<<<<<
3543  *             break
3544  *         for j in range(3):
3545  */
3546     __pyx_t_1 = (((struct __pyx_vtabstruct_4dipy_8tracking_16direction_getter_DirectionGetter *)__pyx_v_dg->__pyx_vtab)->get_direction_c(__pyx_v_dg, __pyx_v_point, __pyx_v_dir) != 0);
3547     if (__pyx_t_1) {
3548 
3549       /* "dipy/tracking/localtrack.pyx":180
3550  *     for i in range(1, len_streamlines):
3551  *         if dg.get_direction_c(point, dir):
3552  *             break             # <<<<<<<<<<<<<<
3553  *         for j in range(3):
3554  *             voxdir[j] = dir[j] / voxel_size[j]
3555  */
3556       goto __pyx_L5_break;
3557 
3558       /* "dipy/tracking/localtrack.pyx":179
3559  *     stream_status[0] = TRACKPOINT
3560  *     for i in range(1, len_streamlines):
3561  *         if dg.get_direction_c(point, dir):             # <<<<<<<<<<<<<<
3562  *             break
3563  *         for j in range(3):
3564  */
3565     }
3566 
3567     /* "dipy/tracking/localtrack.pyx":181
3568  *         if dg.get_direction_c(point, dir):
3569  *             break
3570  *         for j in range(3):             # <<<<<<<<<<<<<<
3571  *             voxdir[j] = dir[j] / voxel_size[j]
3572  *         step(point, voxdir, step_size)
3573  */
3574     for (__pyx_t_7 = 0; __pyx_t_7 < 3; __pyx_t_7+=1) {
3575       __pyx_v_j = __pyx_t_7;
3576 
3577       /* "dipy/tracking/localtrack.pyx":182
3578  *             break
3579  *         for j in range(3):
3580  *             voxdir[j] = dir[j] / voxel_size[j]             # <<<<<<<<<<<<<<
3581  *         step(point, voxdir, step_size)
3582  *         copy_point(point, &streamline[i, 0])
3583  */
3584       (__pyx_v_voxdir[__pyx_v_j]) = ((__pyx_v_dir[__pyx_v_j]) / (__pyx_v_voxel_size[__pyx_v_j]));
3585     }
3586 
3587     /* "dipy/tracking/localtrack.pyx":183
3588  *         for j in range(3):
3589  *             voxdir[j] = dir[j] / voxel_size[j]
3590  *         step(point, voxdir, step_size)             # <<<<<<<<<<<<<<
3591  *         copy_point(point, &streamline[i, 0])
3592  *         stream_status[0] = sc.check_point_c(point)
3593  */
3594     __pyx_v_step(__pyx_v_point, __pyx_v_voxdir, __pyx_v_step_size);
3595 
3596     /* "dipy/tracking/localtrack.pyx":184
3597  *             voxdir[j] = dir[j] / voxel_size[j]
3598  *         step(point, voxdir, step_size)
3599  *         copy_point(point, &streamline[i, 0])             # <<<<<<<<<<<<<<
3600  *         stream_status[0] = sc.check_point_c(point)
3601  *         if stream_status[0] == TRACKPOINT:
3602  */
3603     __pyx_t_3 = __pyx_v_i;
3604     __pyx_t_2 = 0;
3605     __pyx_f_4dipy_5utils_10fast_numpy_copy_point(__pyx_v_point, (&(*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_streamline.data + __pyx_t_3 * __pyx_v_streamline.strides[0]) ) + __pyx_t_2 * __pyx_v_streamline.strides[1]) )))));
3606 
3607     /* "dipy/tracking/localtrack.pyx":185
3608  *         step(point, voxdir, step_size)
3609  *         copy_point(point, &streamline[i, 0])
3610  *         stream_status[0] = sc.check_point_c(point)             # <<<<<<<<<<<<<<
3611  *         if stream_status[0] == TRACKPOINT:
3612  *             continue
3613  */
3614     (__pyx_v_stream_status[0]) = ((struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_StoppingCriterion *)__pyx_v_sc->__pyx_vtab)->check_point_c(__pyx_v_sc, __pyx_v_point);
3615 
3616     /* "dipy/tracking/localtrack.pyx":186
3617  *         copy_point(point, &streamline[i, 0])
3618  *         stream_status[0] = sc.check_point_c(point)
3619  *         if stream_status[0] == TRACKPOINT:             # <<<<<<<<<<<<<<
3620  *             continue
3621  *         elif (stream_status[0] == ENDPOINT or
3622  */
3623     __pyx_t_1 = (((__pyx_v_stream_status[0]) == __pyx_e_4dipy_8tracking_18stopping_criterion_TRACKPOINT) != 0);
3624     if (__pyx_t_1) {
3625 
3626       /* "dipy/tracking/localtrack.pyx":187
3627  *         stream_status[0] = sc.check_point_c(point)
3628  *         if stream_status[0] == TRACKPOINT:
3629  *             continue             # <<<<<<<<<<<<<<
3630  *         elif (stream_status[0] == ENDPOINT or
3631  *               stream_status[0] == INVALIDPOINT or
3632  */
3633       goto __pyx_L4_continue;
3634 
3635       /* "dipy/tracking/localtrack.pyx":186
3636  *         copy_point(point, &streamline[i, 0])
3637  *         stream_status[0] = sc.check_point_c(point)
3638  *         if stream_status[0] == TRACKPOINT:             # <<<<<<<<<<<<<<
3639  *             continue
3640  *         elif (stream_status[0] == ENDPOINT or
3641  */
3642     }
3643 
3644     /* "dipy/tracking/localtrack.pyx":188
3645  *         if stream_status[0] == TRACKPOINT:
3646  *             continue
3647  *         elif (stream_status[0] == ENDPOINT or             # <<<<<<<<<<<<<<
3648  *               stream_status[0] == INVALIDPOINT or
3649  *               stream_status[0] == OUTSIDEIMAGE):
3650  */
3651     __pyx_t_8 = (((__pyx_v_stream_status[0]) == __pyx_e_4dipy_8tracking_18stopping_criterion_ENDPOINT) != 0);
3652     if (!__pyx_t_8) {
3653     } else {
3654       __pyx_t_1 = __pyx_t_8;
3655       goto __pyx_L10_bool_binop_done;
3656     }
3657 
3658     /* "dipy/tracking/localtrack.pyx":189
3659  *             continue
3660  *         elif (stream_status[0] == ENDPOINT or
3661  *               stream_status[0] == INVALIDPOINT or             # <<<<<<<<<<<<<<
3662  *               stream_status[0] == OUTSIDEIMAGE):
3663  *             break
3664  */
3665     __pyx_t_8 = (((__pyx_v_stream_status[0]) == __pyx_e_4dipy_8tracking_18stopping_criterion_INVALIDPOINT) != 0);
3666     if (!__pyx_t_8) {
3667     } else {
3668       __pyx_t_1 = __pyx_t_8;
3669       goto __pyx_L10_bool_binop_done;
3670     }
3671 
3672     /* "dipy/tracking/localtrack.pyx":190
3673  *         elif (stream_status[0] == ENDPOINT or
3674  *               stream_status[0] == INVALIDPOINT or
3675  *               stream_status[0] == OUTSIDEIMAGE):             # <<<<<<<<<<<<<<
3676  *             break
3677  *     else:
3678  */
3679     __pyx_t_8 = (((__pyx_v_stream_status[0]) == __pyx_e_4dipy_8tracking_18stopping_criterion_OUTSIDEIMAGE) != 0);
3680     __pyx_t_1 = __pyx_t_8;
3681     __pyx_L10_bool_binop_done:;
3682 
3683     /* "dipy/tracking/localtrack.pyx":188
3684  *         if stream_status[0] == TRACKPOINT:
3685  *             continue
3686  *         elif (stream_status[0] == ENDPOINT or             # <<<<<<<<<<<<<<
3687  *               stream_status[0] == INVALIDPOINT or
3688  *               stream_status[0] == OUTSIDEIMAGE):
3689  */
3690     if (__pyx_t_1) {
3691 
3692       /* "dipy/tracking/localtrack.pyx":191
3693  *               stream_status[0] == INVALIDPOINT or
3694  *               stream_status[0] == OUTSIDEIMAGE):
3695  *             break             # <<<<<<<<<<<<<<
3696  *     else:
3697  *         # maximum length of streamline has been reached, return everything
3698  */
3699       goto __pyx_L5_break;
3700 
3701       /* "dipy/tracking/localtrack.pyx":188
3702  *         if stream_status[0] == TRACKPOINT:
3703  *             continue
3704  *         elif (stream_status[0] == ENDPOINT or             # <<<<<<<<<<<<<<
3705  *               stream_status[0] == INVALIDPOINT or
3706  *               stream_status[0] == OUTSIDEIMAGE):
3707  */
3708     }
3709     __pyx_L4_continue:;
3710   }
3711   /*else*/ {
3712 
3713     /* "dipy/tracking/localtrack.pyx":194
3714  *     else:
3715  *         # maximum length of streamline has been reached, return everything
3716  *         i = streamline.shape[0]             # <<<<<<<<<<<<<<
3717  *     return i
3718  *
3719  */
3720     __pyx_v_i = (__pyx_v_streamline.shape[0]);
3721   }
3722   __pyx_L5_break:;
3723 
3724   /* "dipy/tracking/localtrack.pyx":195
3725  *         # maximum length of streamline has been reached, return everything
3726  *         i = streamline.shape[0]
3727  *     return i             # <<<<<<<<<<<<<<
3728  *
3729  *
3730  */
3731   __pyx_r = __pyx_v_i;
3732   goto __pyx_L0;
3733 
3734   /* "dipy/tracking/localtrack.pyx":153
3735  * @cython.wraparound(False)
3736  * @cython.cdivision(True)
3737  * cdef int _local_tracker(DirectionGetter dg,             # <<<<<<<<<<<<<<
3738  *                         StoppingCriterion sc,
3739  *                         double* seed,
3740  */
3741 
3742   /* function exit code */
3743   __pyx_L0:;
3744   __Pyx_RefNannyFinishContext();
3745   return __pyx_r;
3746 }
3747 
3748 /* "dipy/tracking/localtrack.pyx":198
3749  *
3750  *
3751  * def pft_tracker(             # <<<<<<<<<<<<<<
3752  *         DirectionGetter dg,
3753  *         AnatomicalStoppingCriterion sc,
3754  */
3755 
3756 /* Python wrapper */
3757 static PyObject *__pyx_pw_4dipy_8tracking_10localtrack_3pft_tracker(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3758 static char __pyx_doc_4dipy_8tracking_10localtrack_2pft_tracker[] = "Tracks one direction from a seed using the particle filtering algorithm.\n\n    This function is the main workhorse of the ``ParticleFilteringTracking``\n    class defined in ``dipy.tracking.local_tracking``.\n\n    Parameters\n    ----------\n    dg : DirectionGetter\n        Used to choosing tracking directions.\n    sc : AnatomicalStoppingCriterion\n        Used to check the streamline status (e.g. endpoint) along path.\n    seed_pos : array, float, 1d, (3,)\n        First point of the (partial) streamline.\n    first_step : array, float, 1d, (3,)\n        Initial seeding direction. Used as ``prev_dir`` for selecting the step\n        direction from the seed point.\n    voxel_size : array, float, 1d, (3,)\n        Size of voxels in the data set.\n    streamline : array, float, 2d, (N, 3)\n        Output of tracking will be put into this array. The length of this\n        array, ``N``, will set the maximum allowable length of the streamline.\n    directions : array, float, 2d, (N, 3)\n        Output of tracking directions will be put into this array. The length\n        of this array, ``N``, will set the maximum allowable length of the\n        streamline.\n    step_size : float\n        Size of tracking steps in mm if ``fixed_step``.\n    pft_max_nbr_back_steps : int\n        Number of tracking steps to back track before starting the particle\n        filtering tractography.\n    pft_max_nbr_front_steps : int\n        Number of additional tracking steps to track.\n    pft_max_trials : int\n        Maximum number of trials for the particle filtering tractography\n        (Prevents infinite loops).\n    particle_count : int\n        Number of particles to use in the particle filter.\n    particle_paths : array, float, 4d, (2, particle_count, pft_max_steps, 3)\n        Temporary array for paths followed by all particles.\n    particle_dirs : array, float, 4d, (2, particle_count, pft_max_steps, 3)\n        Temporary array for directions followed by particles.\n    pa""rticle_weights : array, float, 1d (particle_count)\n        Temporary array for the weights of particles.\n    particle_steps : array, float, (2, particle_count)\n        Temporary array for the number of steps of particles.\n    particle_stream_statuses : array, float, (2, particle_count)\n        Temporary array for the stream status of particles.\n\n    Returns\n    -------\n    end : int\n        Length of the tracked streamline\n    stream_status : StreamlineStatus\n        Ending state of the streamlines as determined by the StoppingCriterion.\n\n    ";
3759 static PyMethodDef __pyx_mdef_4dipy_8tracking_10localtrack_3pft_tracker = {"pft_tracker", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4dipy_8tracking_10localtrack_3pft_tracker, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dipy_8tracking_10localtrack_2pft_tracker};
__pyx_pw_4dipy_8tracking_10localtrack_3pft_tracker(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3760 static PyObject *__pyx_pw_4dipy_8tracking_10localtrack_3pft_tracker(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3761   struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter *__pyx_v_dg = 0;
3762   struct __pyx_obj_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion *__pyx_v_sc = 0;
3763   __Pyx_memviewslice __pyx_v_seed_pos = { 0, 0, { 0 }, { 0 }, { 0 } };
3764   __Pyx_memviewslice __pyx_v_first_step = { 0, 0, { 0 }, { 0 }, { 0 } };
3765   __Pyx_memviewslice __pyx_v_voxel_size = { 0, 0, { 0 }, { 0 }, { 0 } };
3766   __Pyx_memviewslice __pyx_v_streamline = { 0, 0, { 0 }, { 0 }, { 0 } };
3767   __Pyx_memviewslice __pyx_v_directions = { 0, 0, { 0 }, { 0 }, { 0 } };
3768   double __pyx_v_step_size;
3769   int __pyx_v_pft_max_nbr_back_steps;
3770   int __pyx_v_pft_max_nbr_front_steps;
3771   int __pyx_v_pft_max_trials;
3772   int __pyx_v_particle_count;
3773   __Pyx_memviewslice __pyx_v_particle_paths = { 0, 0, { 0 }, { 0 }, { 0 } };
3774   __Pyx_memviewslice __pyx_v_particle_dirs = { 0, 0, { 0 }, { 0 }, { 0 } };
3775   __Pyx_memviewslice __pyx_v_particle_weights = { 0, 0, { 0 }, { 0 }, { 0 } };
3776   __Pyx_memviewslice __pyx_v_particle_steps = { 0, 0, { 0 }, { 0 }, { 0 } };
3777   __Pyx_memviewslice __pyx_v_particle_stream_statuses = { 0, 0, { 0 }, { 0 }, { 0 } };
3778   int __pyx_lineno = 0;
3779   const char *__pyx_filename = NULL;
3780   int __pyx_clineno = 0;
3781   PyObject *__pyx_r = 0;
3782   __Pyx_RefNannyDeclarations
3783   __Pyx_RefNannySetupContext("pft_tracker (wrapper)", 0);
3784   {
3785     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dg,&__pyx_n_s_sc,&__pyx_n_s_seed_pos,&__pyx_n_s_first_step,&__pyx_n_s_voxel_size,&__pyx_n_s_streamline,&__pyx_n_s_directions,&__pyx_n_s_step_size,&__pyx_n_s_pft_max_nbr_back_steps,&__pyx_n_s_pft_max_nbr_front_steps,&__pyx_n_s_pft_max_trials,&__pyx_n_s_particle_count,&__pyx_n_s_particle_paths,&__pyx_n_s_particle_dirs,&__pyx_n_s_particle_weights,&__pyx_n_s_particle_steps,&__pyx_n_s_particle_stream_statuses,0};
3786     PyObject* values[17] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
3787     if (unlikely(__pyx_kwds)) {
3788       Py_ssize_t kw_args;
3789       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3790       switch (pos_args) {
3791         case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
3792         CYTHON_FALLTHROUGH;
3793         case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
3794         CYTHON_FALLTHROUGH;
3795         case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
3796         CYTHON_FALLTHROUGH;
3797         case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
3798         CYTHON_FALLTHROUGH;
3799         case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
3800         CYTHON_FALLTHROUGH;
3801         case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
3802         CYTHON_FALLTHROUGH;
3803         case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
3804         CYTHON_FALLTHROUGH;
3805         case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
3806         CYTHON_FALLTHROUGH;
3807         case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3808         CYTHON_FALLTHROUGH;
3809         case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3810         CYTHON_FALLTHROUGH;
3811         case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3812         CYTHON_FALLTHROUGH;
3813         case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3814         CYTHON_FALLTHROUGH;
3815         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3816         CYTHON_FALLTHROUGH;
3817         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3818         CYTHON_FALLTHROUGH;
3819         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3820         CYTHON_FALLTHROUGH;
3821         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3822         CYTHON_FALLTHROUGH;
3823         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3824         CYTHON_FALLTHROUGH;
3825         case  0: break;
3826         default: goto __pyx_L5_argtuple_error;
3827       }
3828       kw_args = PyDict_Size(__pyx_kwds);
3829       switch (pos_args) {
3830         case  0:
3831         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dg)) != 0)) kw_args--;
3832         else goto __pyx_L5_argtuple_error;
3833         CYTHON_FALLTHROUGH;
3834         case  1:
3835         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sc)) != 0)) kw_args--;
3836         else {
3837           __Pyx_RaiseArgtupleInvalid("pft_tracker", 1, 17, 17, 1); __PYX_ERR(0, 198, __pyx_L3_error)
3838         }
3839         CYTHON_FALLTHROUGH;
3840         case  2:
3841         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seed_pos)) != 0)) kw_args--;
3842         else {
3843           __Pyx_RaiseArgtupleInvalid("pft_tracker", 1, 17, 17, 2); __PYX_ERR(0, 198, __pyx_L3_error)
3844         }
3845         CYTHON_FALLTHROUGH;
3846         case  3:
3847         if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_first_step)) != 0)) kw_args--;
3848         else {
3849           __Pyx_RaiseArgtupleInvalid("pft_tracker", 1, 17, 17, 3); __PYX_ERR(0, 198, __pyx_L3_error)
3850         }
3851         CYTHON_FALLTHROUGH;
3852         case  4:
3853         if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_voxel_size)) != 0)) kw_args--;
3854         else {
3855           __Pyx_RaiseArgtupleInvalid("pft_tracker", 1, 17, 17, 4); __PYX_ERR(0, 198, __pyx_L3_error)
3856         }
3857         CYTHON_FALLTHROUGH;
3858         case  5:
3859         if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_streamline)) != 0)) kw_args--;
3860         else {
3861           __Pyx_RaiseArgtupleInvalid("pft_tracker", 1, 17, 17, 5); __PYX_ERR(0, 198, __pyx_L3_error)
3862         }
3863         CYTHON_FALLTHROUGH;
3864         case  6:
3865         if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_directions)) != 0)) kw_args--;
3866         else {
3867           __Pyx_RaiseArgtupleInvalid("pft_tracker", 1, 17, 17, 6); __PYX_ERR(0, 198, __pyx_L3_error)
3868         }
3869         CYTHON_FALLTHROUGH;
3870         case  7:
3871         if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_step_size)) != 0)) kw_args--;
3872         else {
3873           __Pyx_RaiseArgtupleInvalid("pft_tracker", 1, 17, 17, 7); __PYX_ERR(0, 198, __pyx_L3_error)
3874         }
3875         CYTHON_FALLTHROUGH;
3876         case  8:
3877         if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pft_max_nbr_back_steps)) != 0)) kw_args--;
3878         else {
3879           __Pyx_RaiseArgtupleInvalid("pft_tracker", 1, 17, 17, 8); __PYX_ERR(0, 198, __pyx_L3_error)
3880         }
3881         CYTHON_FALLTHROUGH;
3882         case  9:
3883         if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pft_max_nbr_front_steps)) != 0)) kw_args--;
3884         else {
3885           __Pyx_RaiseArgtupleInvalid("pft_tracker", 1, 17, 17, 9); __PYX_ERR(0, 198, __pyx_L3_error)
3886         }
3887         CYTHON_FALLTHROUGH;
3888         case 10:
3889         if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pft_max_trials)) != 0)) kw_args--;
3890         else {
3891           __Pyx_RaiseArgtupleInvalid("pft_tracker", 1, 17, 17, 10); __PYX_ERR(0, 198, __pyx_L3_error)
3892         }
3893         CYTHON_FALLTHROUGH;
3894         case 11:
3895         if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_particle_count)) != 0)) kw_args--;
3896         else {
3897           __Pyx_RaiseArgtupleInvalid("pft_tracker", 1, 17, 17, 11); __PYX_ERR(0, 198, __pyx_L3_error)
3898         }
3899         CYTHON_FALLTHROUGH;
3900         case 12:
3901         if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_particle_paths)) != 0)) kw_args--;
3902         else {
3903           __Pyx_RaiseArgtupleInvalid("pft_tracker", 1, 17, 17, 12); __PYX_ERR(0, 198, __pyx_L3_error)
3904         }
3905         CYTHON_FALLTHROUGH;
3906         case 13:
3907         if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_particle_dirs)) != 0)) kw_args--;
3908         else {
3909           __Pyx_RaiseArgtupleInvalid("pft_tracker", 1, 17, 17, 13); __PYX_ERR(0, 198, __pyx_L3_error)
3910         }
3911         CYTHON_FALLTHROUGH;
3912         case 14:
3913         if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_particle_weights)) != 0)) kw_args--;
3914         else {
3915           __Pyx_RaiseArgtupleInvalid("pft_tracker", 1, 17, 17, 14); __PYX_ERR(0, 198, __pyx_L3_error)
3916         }
3917         CYTHON_FALLTHROUGH;
3918         case 15:
3919         if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_particle_steps)) != 0)) kw_args--;
3920         else {
3921           __Pyx_RaiseArgtupleInvalid("pft_tracker", 1, 17, 17, 15); __PYX_ERR(0, 198, __pyx_L3_error)
3922         }
3923         CYTHON_FALLTHROUGH;
3924         case 16:
3925         if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_particle_stream_statuses)) != 0)) kw_args--;
3926         else {
3927           __Pyx_RaiseArgtupleInvalid("pft_tracker", 1, 17, 17, 16); __PYX_ERR(0, 198, __pyx_L3_error)
3928         }
3929       }
3930       if (unlikely(kw_args > 0)) {
3931         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pft_tracker") < 0)) __PYX_ERR(0, 198, __pyx_L3_error)
3932       }
3933     } else if (PyTuple_GET_SIZE(__pyx_args) != 17) {
3934       goto __pyx_L5_argtuple_error;
3935     } else {
3936       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3937       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3938       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3939       values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3940       values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3941       values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3942       values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3943       values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3944       values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3945       values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
3946       values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
3947       values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
3948       values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
3949       values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
3950       values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
3951       values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
3952       values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
3953     }
3954     __pyx_v_dg = ((struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter *)values[0]);
3955     __pyx_v_sc = ((struct __pyx_obj_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion *)values[1]);
3956     __pyx_v_seed_pos = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float_t(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_seed_pos.memview)) __PYX_ERR(0, 201, __pyx_L3_error)
3957     __pyx_v_first_step = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float_t(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_first_step.memview)) __PYX_ERR(0, 202, __pyx_L3_error)
3958     __pyx_v_voxel_size = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float_t(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_voxel_size.memview)) __PYX_ERR(0, 203, __pyx_L3_error)
3959     __pyx_v_streamline = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float_t(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_streamline.memview)) __PYX_ERR(0, 204, __pyx_L3_error)
3960     __pyx_v_directions = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float_t(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_directions.memview)) __PYX_ERR(0, 205, __pyx_L3_error)
3961     __pyx_v_step_size = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_step_size == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 206, __pyx_L3_error)
3962     __pyx_v_pft_max_nbr_back_steps = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_pft_max_nbr_back_steps == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 207, __pyx_L3_error)
3963     __pyx_v_pft_max_nbr_front_steps = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_pft_max_nbr_front_steps == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 208, __pyx_L3_error)
3964     __pyx_v_pft_max_trials = __Pyx_PyInt_As_int(values[10]); if (unlikely((__pyx_v_pft_max_trials == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L3_error)
3965     __pyx_v_particle_count = __Pyx_PyInt_As_int(values[11]); if (unlikely((__pyx_v_particle_count == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 210, __pyx_L3_error)
3966     __pyx_v_particle_paths = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_nn___pyx_t_5numpy_float_t(values[12], PyBUF_WRITABLE); if (unlikely(!__pyx_v_particle_paths.memview)) __PYX_ERR(0, 211, __pyx_L3_error)
3967     __pyx_v_particle_dirs = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_nn___pyx_t_5numpy_float_t(values[13], PyBUF_WRITABLE); if (unlikely(!__pyx_v_particle_dirs.memview)) __PYX_ERR(0, 212, __pyx_L3_error)
3968     __pyx_v_particle_weights = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float_t(values[14], PyBUF_WRITABLE); if (unlikely(!__pyx_v_particle_weights.memview)) __PYX_ERR(0, 213, __pyx_L3_error)
3969     __pyx_v_particle_steps = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_int_t(values[15], PyBUF_WRITABLE); if (unlikely(!__pyx_v_particle_steps.memview)) __PYX_ERR(0, 214, __pyx_L3_error)
3970     __pyx_v_particle_stream_statuses = __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_int_t(values[16], PyBUF_WRITABLE); if (unlikely(!__pyx_v_particle_stream_statuses.memview)) __PYX_ERR(0, 215, __pyx_L3_error)
3971   }
3972   goto __pyx_L4_argument_unpacking_done;
3973   __pyx_L5_argtuple_error:;
3974   __Pyx_RaiseArgtupleInvalid("pft_tracker", 1, 17, 17, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 198, __pyx_L3_error)
3975   __pyx_L3_error:;
3976   __Pyx_AddTraceback("dipy.tracking.localtrack.pft_tracker", __pyx_clineno, __pyx_lineno, __pyx_filename);
3977   __Pyx_RefNannyFinishContext();
3978   return NULL;
3979   __pyx_L4_argument_unpacking_done:;
3980   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dg), __pyx_ptype_4dipy_8tracking_16direction_getter_DirectionGetter, 1, "dg", 0))) __PYX_ERR(0, 199, __pyx_L1_error)
3981   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sc), __pyx_ptype_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion, 1, "sc", 0))) __PYX_ERR(0, 200, __pyx_L1_error)
3982   __pyx_r = __pyx_pf_4dipy_8tracking_10localtrack_2pft_tracker(__pyx_self, __pyx_v_dg, __pyx_v_sc, __pyx_v_seed_pos, __pyx_v_first_step, __pyx_v_voxel_size, __pyx_v_streamline, __pyx_v_directions, __pyx_v_step_size, __pyx_v_pft_max_nbr_back_steps, __pyx_v_pft_max_nbr_front_steps, __pyx_v_pft_max_trials, __pyx_v_particle_count, __pyx_v_particle_paths, __pyx_v_particle_dirs, __pyx_v_particle_weights, __pyx_v_particle_steps, __pyx_v_particle_stream_statuses);
3983 
3984   /* function exit code */
3985   goto __pyx_L0;
3986   __pyx_L1_error:;
3987   __pyx_r = NULL;
3988   __pyx_L0:;
3989   __Pyx_RefNannyFinishContext();
3990   return __pyx_r;
3991 }
3992 
__pyx_pf_4dipy_8tracking_10localtrack_2pft_tracker(CYTHON_UNUSED PyObject * __pyx_self,struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter * __pyx_v_dg,struct __pyx_obj_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion * __pyx_v_sc,__Pyx_memviewslice __pyx_v_seed_pos,__Pyx_memviewslice __pyx_v_first_step,__Pyx_memviewslice __pyx_v_voxel_size,__Pyx_memviewslice __pyx_v_streamline,__Pyx_memviewslice __pyx_v_directions,double __pyx_v_step_size,int __pyx_v_pft_max_nbr_back_steps,int __pyx_v_pft_max_nbr_front_steps,int __pyx_v_pft_max_trials,int __pyx_v_particle_count,__Pyx_memviewslice __pyx_v_particle_paths,__Pyx_memviewslice __pyx_v_particle_dirs,__Pyx_memviewslice __pyx_v_particle_weights,__Pyx_memviewslice __pyx_v_particle_steps,__Pyx_memviewslice __pyx_v_particle_stream_statuses)3993 static PyObject *__pyx_pf_4dipy_8tracking_10localtrack_2pft_tracker(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter *__pyx_v_dg, struct __pyx_obj_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion *__pyx_v_sc, __Pyx_memviewslice __pyx_v_seed_pos, __Pyx_memviewslice __pyx_v_first_step, __Pyx_memviewslice __pyx_v_voxel_size, __Pyx_memviewslice __pyx_v_streamline, __Pyx_memviewslice __pyx_v_directions, double __pyx_v_step_size, int __pyx_v_pft_max_nbr_back_steps, int __pyx_v_pft_max_nbr_front_steps, int __pyx_v_pft_max_trials, int __pyx_v_particle_count, __Pyx_memviewslice __pyx_v_particle_paths, __Pyx_memviewslice __pyx_v_particle_dirs, __Pyx_memviewslice __pyx_v_particle_weights, __Pyx_memviewslice __pyx_v_particle_steps, __Pyx_memviewslice __pyx_v_particle_stream_statuses) {
3994   npy_intp __pyx_v_i;
3995   enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus __pyx_v_stream_status;
3996   double __pyx_v_dir[3];
3997   double __pyx_v_vs[3];
3998   double __pyx_v_seed[3];
3999   PyObject *__pyx_r = NULL;
4000   __Pyx_RefNannyDeclarations
4001   int __pyx_t_1;
4002   int __pyx_t_2;
4003   PyObject *__pyx_t_3 = NULL;
4004   npy_intp __pyx_t_4;
4005   Py_ssize_t __pyx_t_5;
4006   int __pyx_t_6;
4007   PyObject *__pyx_t_7 = NULL;
4008   PyObject *__pyx_t_8 = NULL;
4009   int __pyx_lineno = 0;
4010   const char *__pyx_filename = NULL;
4011   int __pyx_clineno = 0;
4012   __Pyx_RefNannySetupContext("pft_tracker", 0);
4013 
4014   /* "dipy/tracking/localtrack.pyx":279
4015  *         double seed[3]
4016  *
4017  *     if (seed_pos.shape[0] != 3 or first_step.shape[0] != 3 or             # <<<<<<<<<<<<<<
4018  *             voxel_size.shape[0] != 3 or streamline.shape[1] != 3):
4019  *         raise ValueError('Invalid input parameter dimensions.')
4020  */
4021   __pyx_t_2 = (((__pyx_v_seed_pos.shape[0]) != 3) != 0);
4022   if (!__pyx_t_2) {
4023   } else {
4024     __pyx_t_1 = __pyx_t_2;
4025     goto __pyx_L4_bool_binop_done;
4026   }
4027   __pyx_t_2 = (((__pyx_v_first_step.shape[0]) != 3) != 0);
4028   if (!__pyx_t_2) {
4029   } else {
4030     __pyx_t_1 = __pyx_t_2;
4031     goto __pyx_L4_bool_binop_done;
4032   }
4033 
4034   /* "dipy/tracking/localtrack.pyx":280
4035  *
4036  *     if (seed_pos.shape[0] != 3 or first_step.shape[0] != 3 or
4037  *             voxel_size.shape[0] != 3 or streamline.shape[1] != 3):             # <<<<<<<<<<<<<<
4038  *         raise ValueError('Invalid input parameter dimensions.')
4039  *
4040  */
4041   __pyx_t_2 = (((__pyx_v_voxel_size.shape[0]) != 3) != 0);
4042   if (!__pyx_t_2) {
4043   } else {
4044     __pyx_t_1 = __pyx_t_2;
4045     goto __pyx_L4_bool_binop_done;
4046   }
4047   __pyx_t_2 = (((__pyx_v_streamline.shape[1]) != 3) != 0);
4048   __pyx_t_1 = __pyx_t_2;
4049   __pyx_L4_bool_binop_done:;
4050 
4051   /* "dipy/tracking/localtrack.pyx":279
4052  *         double seed[3]
4053  *
4054  *     if (seed_pos.shape[0] != 3 or first_step.shape[0] != 3 or             # <<<<<<<<<<<<<<
4055  *             voxel_size.shape[0] != 3 or streamline.shape[1] != 3):
4056  *         raise ValueError('Invalid input parameter dimensions.')
4057  */
4058   if (unlikely(__pyx_t_1)) {
4059 
4060     /* "dipy/tracking/localtrack.pyx":281
4061  *     if (seed_pos.shape[0] != 3 or first_step.shape[0] != 3 or
4062  *             voxel_size.shape[0] != 3 or streamline.shape[1] != 3):
4063  *         raise ValueError('Invalid input parameter dimensions.')             # <<<<<<<<<<<<<<
4064  *
4065  *     for i in range(3):
4066  */
4067     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 281, __pyx_L1_error)
4068     __Pyx_GOTREF(__pyx_t_3);
4069     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
4070     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4071     __PYX_ERR(0, 281, __pyx_L1_error)
4072 
4073     /* "dipy/tracking/localtrack.pyx":279
4074  *         double seed[3]
4075  *
4076  *     if (seed_pos.shape[0] != 3 or first_step.shape[0] != 3 or             # <<<<<<<<<<<<<<
4077  *             voxel_size.shape[0] != 3 or streamline.shape[1] != 3):
4078  *         raise ValueError('Invalid input parameter dimensions.')
4079  */
4080   }
4081 
4082   /* "dipy/tracking/localtrack.pyx":283
4083  *         raise ValueError('Invalid input parameter dimensions.')
4084  *
4085  *     for i in range(3):             # <<<<<<<<<<<<<<
4086  *         dir[i] = first_step[i]
4087  *         vs[i] = voxel_size[i]
4088  */
4089   for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) {
4090     __pyx_v_i = __pyx_t_4;
4091 
4092     /* "dipy/tracking/localtrack.pyx":284
4093  *
4094  *     for i in range(3):
4095  *         dir[i] = first_step[i]             # <<<<<<<<<<<<<<
4096  *         vs[i] = voxel_size[i]
4097  *         seed[i] = seed_pos[i]
4098  */
4099     __pyx_t_5 = __pyx_v_i;
4100     __pyx_t_6 = -1;
4101     if (__pyx_t_5 < 0) {
4102       __pyx_t_5 += __pyx_v_first_step.shape[0];
4103       if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
4104     } else if (unlikely(__pyx_t_5 >= __pyx_v_first_step.shape[0])) __pyx_t_6 = 0;
4105     if (unlikely(__pyx_t_6 != -1)) {
4106       __Pyx_RaiseBufferIndexError(__pyx_t_6);
4107       __PYX_ERR(0, 284, __pyx_L1_error)
4108     }
4109     (__pyx_v_dir[__pyx_v_i]) = (*((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_first_step.data + __pyx_t_5 * __pyx_v_first_step.strides[0]) )));
4110 
4111     /* "dipy/tracking/localtrack.pyx":285
4112  *     for i in range(3):
4113  *         dir[i] = first_step[i]
4114  *         vs[i] = voxel_size[i]             # <<<<<<<<<<<<<<
4115  *         seed[i] = seed_pos[i]
4116  *
4117  */
4118     __pyx_t_5 = __pyx_v_i;
4119     __pyx_t_6 = -1;
4120     if (__pyx_t_5 < 0) {
4121       __pyx_t_5 += __pyx_v_voxel_size.shape[0];
4122       if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
4123     } else if (unlikely(__pyx_t_5 >= __pyx_v_voxel_size.shape[0])) __pyx_t_6 = 0;
4124     if (unlikely(__pyx_t_6 != -1)) {
4125       __Pyx_RaiseBufferIndexError(__pyx_t_6);
4126       __PYX_ERR(0, 285, __pyx_L1_error)
4127     }
4128     (__pyx_v_vs[__pyx_v_i]) = (*((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_voxel_size.data + __pyx_t_5 * __pyx_v_voxel_size.strides[0]) )));
4129 
4130     /* "dipy/tracking/localtrack.pyx":286
4131  *         dir[i] = first_step[i]
4132  *         vs[i] = voxel_size[i]
4133  *         seed[i] = seed_pos[i]             # <<<<<<<<<<<<<<
4134  *
4135  *     i = _pft_tracker(dg, sc, seed, dir, vs, streamline,
4136  */
4137     __pyx_t_5 = __pyx_v_i;
4138     __pyx_t_6 = -1;
4139     if (__pyx_t_5 < 0) {
4140       __pyx_t_5 += __pyx_v_seed_pos.shape[0];
4141       if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
4142     } else if (unlikely(__pyx_t_5 >= __pyx_v_seed_pos.shape[0])) __pyx_t_6 = 0;
4143     if (unlikely(__pyx_t_6 != -1)) {
4144       __Pyx_RaiseBufferIndexError(__pyx_t_6);
4145       __PYX_ERR(0, 286, __pyx_L1_error)
4146     }
4147     (__pyx_v_seed[__pyx_v_i]) = (*((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_seed_pos.data + __pyx_t_5 * __pyx_v_seed_pos.strides[0]) )));
4148   }
4149 
4150   /* "dipy/tracking/localtrack.pyx":288
4151  *         seed[i] = seed_pos[i]
4152  *
4153  *     i = _pft_tracker(dg, sc, seed, dir, vs, streamline,             # <<<<<<<<<<<<<<
4154  *                      directions, step_size, &stream_status,
4155  *                      pft_max_nbr_back_steps, pft_max_nbr_front_steps,
4156  */
4157   __pyx_t_3 = __pyx_f_4dipy_8tracking_10localtrack__pft_tracker(__pyx_v_dg, __pyx_v_sc, __pyx_v_seed, __pyx_v_dir, __pyx_v_vs, __pyx_v_streamline, __pyx_v_directions, __pyx_v_step_size, (&__pyx_v_stream_status), __pyx_v_pft_max_nbr_back_steps, __pyx_v_pft_max_nbr_front_steps, __pyx_v_pft_max_trials, __pyx_v_particle_count, __pyx_v_particle_paths, __pyx_v_particle_dirs, __pyx_v_particle_weights, __pyx_v_particle_steps, __pyx_v_particle_stream_statuses); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 288, __pyx_L1_error)
4158   __Pyx_GOTREF(__pyx_t_3);
4159   __pyx_t_4 = __Pyx_PyInt_As_Py_intptr_t(__pyx_t_3); if (unlikely((__pyx_t_4 == ((npy_intp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 288, __pyx_L1_error)
4160   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4161   __pyx_v_i = __pyx_t_4;
4162 
4163   /* "dipy/tracking/localtrack.pyx":294
4164  *                      particle_dirs, particle_weights, particle_steps,
4165  *                      particle_stream_statuses)
4166  *     return i, stream_status             # <<<<<<<<<<<<<<
4167  *
4168  *
4169  */
4170   __Pyx_XDECREF(__pyx_r);
4171   __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 294, __pyx_L1_error)
4172   __Pyx_GOTREF(__pyx_t_3);
4173   __pyx_t_7 = __Pyx_PyInt_From_enum____pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus(__pyx_v_stream_status); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 294, __pyx_L1_error)
4174   __Pyx_GOTREF(__pyx_t_7);
4175   __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 294, __pyx_L1_error)
4176   __Pyx_GOTREF(__pyx_t_8);
4177   __Pyx_GIVEREF(__pyx_t_3);
4178   PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3);
4179   __Pyx_GIVEREF(__pyx_t_7);
4180   PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
4181   __pyx_t_3 = 0;
4182   __pyx_t_7 = 0;
4183   __pyx_r = __pyx_t_8;
4184   __pyx_t_8 = 0;
4185   goto __pyx_L0;
4186 
4187   /* "dipy/tracking/localtrack.pyx":198
4188  *
4189  *
4190  * def pft_tracker(             # <<<<<<<<<<<<<<
4191  *         DirectionGetter dg,
4192  *         AnatomicalStoppingCriterion sc,
4193  */
4194 
4195   /* function exit code */
4196   __pyx_L1_error:;
4197   __Pyx_XDECREF(__pyx_t_3);
4198   __Pyx_XDECREF(__pyx_t_7);
4199   __Pyx_XDECREF(__pyx_t_8);
4200   __Pyx_AddTraceback("dipy.tracking.localtrack.pft_tracker", __pyx_clineno, __pyx_lineno, __pyx_filename);
4201   __pyx_r = NULL;
4202   __pyx_L0:;
4203   __PYX_XDEC_MEMVIEW(&__pyx_v_seed_pos, 1);
4204   __PYX_XDEC_MEMVIEW(&__pyx_v_first_step, 1);
4205   __PYX_XDEC_MEMVIEW(&__pyx_v_voxel_size, 1);
4206   __PYX_XDEC_MEMVIEW(&__pyx_v_streamline, 1);
4207   __PYX_XDEC_MEMVIEW(&__pyx_v_directions, 1);
4208   __PYX_XDEC_MEMVIEW(&__pyx_v_particle_paths, 1);
4209   __PYX_XDEC_MEMVIEW(&__pyx_v_particle_dirs, 1);
4210   __PYX_XDEC_MEMVIEW(&__pyx_v_particle_weights, 1);
4211   __PYX_XDEC_MEMVIEW(&__pyx_v_particle_steps, 1);
4212   __PYX_XDEC_MEMVIEW(&__pyx_v_particle_stream_statuses, 1);
4213   __Pyx_XGIVEREF(__pyx_r);
4214   __Pyx_RefNannyFinishContext();
4215   return __pyx_r;
4216 }
4217 
4218 /* "dipy/tracking/localtrack.pyx":300
4219  * @cython.wraparound(False)
4220  * @cython.cdivision(True)
4221  * cdef _pft_tracker(DirectionGetter dg,             # <<<<<<<<<<<<<<
4222  *                   AnatomicalStoppingCriterion sc,
4223  *                   double* seed,
4224  */
4225 
__pyx_f_4dipy_8tracking_10localtrack__pft_tracker(struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter * __pyx_v_dg,struct __pyx_obj_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion * __pyx_v_sc,double * __pyx_v_seed,double * __pyx_v_dir,double * __pyx_v_voxel_size,__Pyx_memviewslice __pyx_v_streamline,__Pyx_memviewslice __pyx_v_directions,double __pyx_v_step_size,enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus * __pyx_v_stream_status,int __pyx_v_pft_max_nbr_back_steps,int __pyx_v_pft_max_nbr_front_steps,int __pyx_v_pft_max_trials,int __pyx_v_particle_count,__Pyx_memviewslice __pyx_v_particle_paths,__Pyx_memviewslice __pyx_v_particle_dirs,__Pyx_memviewslice __pyx_v_particle_weights,__Pyx_memviewslice __pyx_v_particle_steps,__Pyx_memviewslice __pyx_v_particle_stream_statuses)4226 static PyObject *__pyx_f_4dipy_8tracking_10localtrack__pft_tracker(struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter *__pyx_v_dg, struct __pyx_obj_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion *__pyx_v_sc, double *__pyx_v_seed, double *__pyx_v_dir, double *__pyx_v_voxel_size, __Pyx_memviewslice __pyx_v_streamline, __Pyx_memviewslice __pyx_v_directions, double __pyx_v_step_size, enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus *__pyx_v_stream_status, int __pyx_v_pft_max_nbr_back_steps, int __pyx_v_pft_max_nbr_front_steps, int __pyx_v_pft_max_trials, int __pyx_v_particle_count, __Pyx_memviewslice __pyx_v_particle_paths, __Pyx_memviewslice __pyx_v_particle_dirs, __Pyx_memviewslice __pyx_v_particle_weights, __Pyx_memviewslice __pyx_v_particle_steps, __Pyx_memviewslice __pyx_v_particle_stream_statuses) {
4227   int __pyx_v_i;
4228   int __pyx_v_pft_trial;
4229   int __pyx_v_back_steps;
4230   int __pyx_v_front_steps;
4231   int __pyx_v_strl_array_len;
4232   double __pyx_v_point[3];
4233   double __pyx_v_voxdir[3];
4234   long __pyx_v_j;
4235   PyObject *__pyx_r = NULL;
4236   __Pyx_RefNannyDeclarations
4237   Py_ssize_t __pyx_t_1;
4238   Py_ssize_t __pyx_t_2;
4239   int __pyx_t_3;
4240   long __pyx_t_4;
4241   int __pyx_t_5;
4242   int __pyx_t_6;
4243   long __pyx_t_7;
4244   PyObject *__pyx_t_8 = NULL;
4245   int __pyx_lineno = 0;
4246   const char *__pyx_filename = NULL;
4247   int __pyx_clineno = 0;
4248   __Pyx_RefNannySetupContext("_pft_tracker", 0);
4249 
4250   /* "dipy/tracking/localtrack.pyx":325
4251  *         void (*step)(double* , double*, double) nogil
4252  *
4253  *     copy_point(seed, point)             # <<<<<<<<<<<<<<
4254  *     copy_point(seed, &streamline[0,0])
4255  *     copy_point(dir, &directions[0, 0])
4256  */
4257   __pyx_f_4dipy_5utils_10fast_numpy_copy_point(__pyx_v_seed, __pyx_v_point);
4258 
4259   /* "dipy/tracking/localtrack.pyx":326
4260  *
4261  *     copy_point(seed, point)
4262  *     copy_point(seed, &streamline[0,0])             # <<<<<<<<<<<<<<
4263  *     copy_point(dir, &directions[0, 0])
4264  *
4265  */
4266   __pyx_t_1 = 0;
4267   __pyx_t_2 = 0;
4268   __pyx_f_4dipy_5utils_10fast_numpy_copy_point(__pyx_v_seed, (&(*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_streamline.data + __pyx_t_1 * __pyx_v_streamline.strides[0]) ) + __pyx_t_2 * __pyx_v_streamline.strides[1]) )))));
4269 
4270   /* "dipy/tracking/localtrack.pyx":327
4271  *     copy_point(seed, point)
4272  *     copy_point(seed, &streamline[0,0])
4273  *     copy_point(dir, &directions[0, 0])             # <<<<<<<<<<<<<<
4274  *
4275  *     stream_status[0] = TRACKPOINT
4276  */
4277   __pyx_t_2 = 0;
4278   __pyx_t_1 = 0;
4279   __pyx_f_4dipy_5utils_10fast_numpy_copy_point(__pyx_v_dir, (&(*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_directions.data + __pyx_t_2 * __pyx_v_directions.strides[0]) ) + __pyx_t_1 * __pyx_v_directions.strides[1]) )))));
4280 
4281   /* "dipy/tracking/localtrack.pyx":329
4282  *     copy_point(dir, &directions[0, 0])
4283  *
4284  *     stream_status[0] = TRACKPOINT             # <<<<<<<<<<<<<<
4285  *     pft_trial = 0
4286  *     i = 1
4287  */
4288   (__pyx_v_stream_status[0]) = __pyx_e_4dipy_8tracking_18stopping_criterion_TRACKPOINT;
4289 
4290   /* "dipy/tracking/localtrack.pyx":330
4291  *
4292  *     stream_status[0] = TRACKPOINT
4293  *     pft_trial = 0             # <<<<<<<<<<<<<<
4294  *     i = 1
4295  *     strl_array_len = streamline.shape[0]
4296  */
4297   __pyx_v_pft_trial = 0;
4298 
4299   /* "dipy/tracking/localtrack.pyx":331
4300  *     stream_status[0] = TRACKPOINT
4301  *     pft_trial = 0
4302  *     i = 1             # <<<<<<<<<<<<<<
4303  *     strl_array_len = streamline.shape[0]
4304  *     while i < strl_array_len:
4305  */
4306   __pyx_v_i = 1;
4307 
4308   /* "dipy/tracking/localtrack.pyx":332
4309  *     pft_trial = 0
4310  *     i = 1
4311  *     strl_array_len = streamline.shape[0]             # <<<<<<<<<<<<<<
4312  *     while i < strl_array_len:
4313  *         if dg.get_direction_c(point, dir):
4314  */
4315   __pyx_v_strl_array_len = (__pyx_v_streamline.shape[0]);
4316 
4317   /* "dipy/tracking/localtrack.pyx":333
4318  *     i = 1
4319  *     strl_array_len = streamline.shape[0]
4320  *     while i < strl_array_len:             # <<<<<<<<<<<<<<
4321  *         if dg.get_direction_c(point, dir):
4322  *             # no valid diffusion direction to follow
4323  */
4324   while (1) {
4325     __pyx_t_3 = ((__pyx_v_i < __pyx_v_strl_array_len) != 0);
4326     if (!__pyx_t_3) break;
4327 
4328     /* "dipy/tracking/localtrack.pyx":334
4329  *     strl_array_len = streamline.shape[0]
4330  *     while i < strl_array_len:
4331  *         if dg.get_direction_c(point, dir):             # <<<<<<<<<<<<<<
4332  *             # no valid diffusion direction to follow
4333  *             stream_status[0] = INVALIDPOINT
4334  */
4335     __pyx_t_3 = (((struct __pyx_vtabstruct_4dipy_8tracking_16direction_getter_DirectionGetter *)__pyx_v_dg->__pyx_vtab)->get_direction_c(__pyx_v_dg, __pyx_v_point, __pyx_v_dir) != 0);
4336     if (__pyx_t_3) {
4337 
4338       /* "dipy/tracking/localtrack.pyx":336
4339  *         if dg.get_direction_c(point, dir):
4340  *             # no valid diffusion direction to follow
4341  *             stream_status[0] = INVALIDPOINT             # <<<<<<<<<<<<<<
4342  *         else:
4343  *             for j in range(3):
4344  */
4345       (__pyx_v_stream_status[0]) = __pyx_e_4dipy_8tracking_18stopping_criterion_INVALIDPOINT;
4346 
4347       /* "dipy/tracking/localtrack.pyx":334
4348  *     strl_array_len = streamline.shape[0]
4349  *     while i < strl_array_len:
4350  *         if dg.get_direction_c(point, dir):             # <<<<<<<<<<<<<<
4351  *             # no valid diffusion direction to follow
4352  *             stream_status[0] = INVALIDPOINT
4353  */
4354       goto __pyx_L5;
4355     }
4356 
4357     /* "dipy/tracking/localtrack.pyx":338
4358  *             stream_status[0] = INVALIDPOINT
4359  *         else:
4360  *             for j in range(3):             # <<<<<<<<<<<<<<
4361  *                 voxdir[j] = dir[j] / voxel_size[j]
4362  *
4363  */
4364     /*else*/ {
4365       for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) {
4366         __pyx_v_j = __pyx_t_4;
4367 
4368         /* "dipy/tracking/localtrack.pyx":339
4369  *         else:
4370  *             for j in range(3):
4371  *                 voxdir[j] = dir[j] / voxel_size[j]             # <<<<<<<<<<<<<<
4372  *
4373  *             fixed_step(point, voxdir, step_size)
4374  */
4375         (__pyx_v_voxdir[__pyx_v_j]) = ((__pyx_v_dir[__pyx_v_j]) / (__pyx_v_voxel_size[__pyx_v_j]));
4376       }
4377 
4378       /* "dipy/tracking/localtrack.pyx":341
4379  *                 voxdir[j] = dir[j] / voxel_size[j]
4380  *
4381  *             fixed_step(point, voxdir, step_size)             # <<<<<<<<<<<<<<
4382  *             copy_point(point, &streamline[i, 0])
4383  *             copy_point(dir, &directions[i, 0])
4384  */
4385       __pyx_f_4dipy_8tracking_10localtrack_fixed_step(__pyx_v_point, __pyx_v_voxdir, __pyx_v_step_size);
4386 
4387       /* "dipy/tracking/localtrack.pyx":342
4388  *
4389  *             fixed_step(point, voxdir, step_size)
4390  *             copy_point(point, &streamline[i, 0])             # <<<<<<<<<<<<<<
4391  *             copy_point(dir, &directions[i, 0])
4392  *             stream_status[0] = sc.check_point_c(point)
4393  */
4394       __pyx_t_1 = __pyx_v_i;
4395       __pyx_t_2 = 0;
4396       __pyx_f_4dipy_5utils_10fast_numpy_copy_point(__pyx_v_point, (&(*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_streamline.data + __pyx_t_1 * __pyx_v_streamline.strides[0]) ) + __pyx_t_2 * __pyx_v_streamline.strides[1]) )))));
4397 
4398       /* "dipy/tracking/localtrack.pyx":343
4399  *             fixed_step(point, voxdir, step_size)
4400  *             copy_point(point, &streamline[i, 0])
4401  *             copy_point(dir, &directions[i, 0])             # <<<<<<<<<<<<<<
4402  *             stream_status[0] = sc.check_point_c(point)
4403  *             i += 1
4404  */
4405       __pyx_t_2 = __pyx_v_i;
4406       __pyx_t_1 = 0;
4407       __pyx_f_4dipy_5utils_10fast_numpy_copy_point(__pyx_v_dir, (&(*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_directions.data + __pyx_t_2 * __pyx_v_directions.strides[0]) ) + __pyx_t_1 * __pyx_v_directions.strides[1]) )))));
4408 
4409       /* "dipy/tracking/localtrack.pyx":344
4410  *             copy_point(point, &streamline[i, 0])
4411  *             copy_point(dir, &directions[i, 0])
4412  *             stream_status[0] = sc.check_point_c(point)             # <<<<<<<<<<<<<<
4413  *             i += 1
4414  *         if stream_status[0] == TRACKPOINT:
4415  */
4416       (__pyx_v_stream_status[0]) = ((struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion *)__pyx_v_sc->__pyx_base.__pyx_vtab)->__pyx_base.check_point_c(((struct __pyx_obj_4dipy_8tracking_18stopping_criterion_StoppingCriterion *)__pyx_v_sc), __pyx_v_point);
4417 
4418       /* "dipy/tracking/localtrack.pyx":345
4419  *             copy_point(dir, &directions[i, 0])
4420  *             stream_status[0] = sc.check_point_c(point)
4421  *             i += 1             # <<<<<<<<<<<<<<
4422  *         if stream_status[0] == TRACKPOINT:
4423  *             # The tracking continues normally
4424  */
4425       __pyx_v_i = (__pyx_v_i + 1);
4426     }
4427     __pyx_L5:;
4428 
4429     /* "dipy/tracking/localtrack.pyx":346
4430  *             stream_status[0] = sc.check_point_c(point)
4431  *             i += 1
4432  *         if stream_status[0] == TRACKPOINT:             # <<<<<<<<<<<<<<
4433  *             # The tracking continues normally
4434  *             continue
4435  */
4436     __pyx_t_3 = (((__pyx_v_stream_status[0]) == __pyx_e_4dipy_8tracking_18stopping_criterion_TRACKPOINT) != 0);
4437     if (__pyx_t_3) {
4438 
4439       /* "dipy/tracking/localtrack.pyx":348
4440  *         if stream_status[0] == TRACKPOINT:
4441  *             # The tracking continues normally
4442  *             continue             # <<<<<<<<<<<<<<
4443  *         elif stream_status[0] == INVALIDPOINT:
4444  *             if pft_trial < pft_max_trials and i > 1:
4445  */
4446       goto __pyx_L3_continue;
4447 
4448       /* "dipy/tracking/localtrack.pyx":346
4449  *             stream_status[0] = sc.check_point_c(point)
4450  *             i += 1
4451  *         if stream_status[0] == TRACKPOINT:             # <<<<<<<<<<<<<<
4452  *             # The tracking continues normally
4453  *             continue
4454  */
4455     }
4456 
4457     /* "dipy/tracking/localtrack.pyx":349
4458  *             # The tracking continues normally
4459  *             continue
4460  *         elif stream_status[0] == INVALIDPOINT:             # <<<<<<<<<<<<<<
4461  *             if pft_trial < pft_max_trials and i > 1:
4462  *                 back_steps = min(i - 1, pft_max_nbr_back_steps)
4463  */
4464     __pyx_t_3 = (((__pyx_v_stream_status[0]) == __pyx_e_4dipy_8tracking_18stopping_criterion_INVALIDPOINT) != 0);
4465     if (__pyx_t_3) {
4466 
4467       /* "dipy/tracking/localtrack.pyx":350
4468  *             continue
4469  *         elif stream_status[0] == INVALIDPOINT:
4470  *             if pft_trial < pft_max_trials and i > 1:             # <<<<<<<<<<<<<<
4471  *                 back_steps = min(i - 1, pft_max_nbr_back_steps)
4472  *                 front_steps = min(strl_array_len - i - back_steps - 1,
4473  */
4474       __pyx_t_5 = ((__pyx_v_pft_trial < __pyx_v_pft_max_trials) != 0);
4475       if (__pyx_t_5) {
4476       } else {
4477         __pyx_t_3 = __pyx_t_5;
4478         goto __pyx_L10_bool_binop_done;
4479       }
4480       __pyx_t_5 = ((__pyx_v_i > 1) != 0);
4481       __pyx_t_3 = __pyx_t_5;
4482       __pyx_L10_bool_binop_done:;
4483       if (__pyx_t_3) {
4484 
4485         /* "dipy/tracking/localtrack.pyx":351
4486  *         elif stream_status[0] == INVALIDPOINT:
4487  *             if pft_trial < pft_max_trials and i > 1:
4488  *                 back_steps = min(i - 1, pft_max_nbr_back_steps)             # <<<<<<<<<<<<<<
4489  *                 front_steps = min(strl_array_len - i - back_steps - 1,
4490  *                                   pft_max_nbr_front_steps)
4491  */
4492         __pyx_t_6 = __pyx_v_pft_max_nbr_back_steps;
4493         __pyx_t_4 = (__pyx_v_i - 1);
4494         if (((__pyx_t_6 < __pyx_t_4) != 0)) {
4495           __pyx_t_7 = __pyx_t_6;
4496         } else {
4497           __pyx_t_7 = __pyx_t_4;
4498         }
4499         __pyx_v_back_steps = __pyx_t_7;
4500 
4501         /* "dipy/tracking/localtrack.pyx":353
4502  *                 back_steps = min(i - 1, pft_max_nbr_back_steps)
4503  *                 front_steps = min(strl_array_len - i - back_steps - 1,
4504  *                                   pft_max_nbr_front_steps)             # <<<<<<<<<<<<<<
4505  *                 front_steps = max(0, front_steps)
4506  *                 i = _pft(streamline, i - back_steps, directions, dg, sc,
4507  */
4508         __pyx_t_6 = __pyx_v_pft_max_nbr_front_steps;
4509 
4510         /* "dipy/tracking/localtrack.pyx":352
4511  *             if pft_trial < pft_max_trials and i > 1:
4512  *                 back_steps = min(i - 1, pft_max_nbr_back_steps)
4513  *                 front_steps = min(strl_array_len - i - back_steps - 1,             # <<<<<<<<<<<<<<
4514  *                                   pft_max_nbr_front_steps)
4515  *                 front_steps = max(0, front_steps)
4516  */
4517         __pyx_t_7 = (((__pyx_v_strl_array_len - __pyx_v_i) - __pyx_v_back_steps) - 1);
4518 
4519         /* "dipy/tracking/localtrack.pyx":353
4520  *                 back_steps = min(i - 1, pft_max_nbr_back_steps)
4521  *                 front_steps = min(strl_array_len - i - back_steps - 1,
4522  *                                   pft_max_nbr_front_steps)             # <<<<<<<<<<<<<<
4523  *                 front_steps = max(0, front_steps)
4524  *                 i = _pft(streamline, i - back_steps, directions, dg, sc,
4525  */
4526         if (((__pyx_t_6 < __pyx_t_7) != 0)) {
4527           __pyx_t_4 = __pyx_t_6;
4528         } else {
4529           __pyx_t_4 = __pyx_t_7;
4530         }
4531         __pyx_v_front_steps = __pyx_t_4;
4532 
4533         /* "dipy/tracking/localtrack.pyx":354
4534  *                 front_steps = min(strl_array_len - i - back_steps - 1,
4535  *                                   pft_max_nbr_front_steps)
4536  *                 front_steps = max(0, front_steps)             # <<<<<<<<<<<<<<
4537  *                 i = _pft(streamline, i - back_steps, directions, dg, sc,
4538  *                          voxel_size, step_size, stream_status,
4539  */
4540         __pyx_t_6 = __pyx_v_front_steps;
4541         __pyx_t_4 = 0;
4542         if (((__pyx_t_6 > __pyx_t_4) != 0)) {
4543           __pyx_t_7 = __pyx_t_6;
4544         } else {
4545           __pyx_t_7 = __pyx_t_4;
4546         }
4547         __pyx_v_front_steps = __pyx_t_7;
4548 
4549         /* "dipy/tracking/localtrack.pyx":355
4550  *                                   pft_max_nbr_front_steps)
4551  *                 front_steps = max(0, front_steps)
4552  *                 i = _pft(streamline, i - back_steps, directions, dg, sc,             # <<<<<<<<<<<<<<
4553  *                          voxel_size, step_size, stream_status,
4554  *                          back_steps + front_steps, particle_count,
4555  */
4556         __pyx_t_8 = __pyx_f_4dipy_8tracking_10localtrack__pft(__pyx_v_streamline, (__pyx_v_i - __pyx_v_back_steps), __pyx_v_directions, __pyx_v_dg, __pyx_v_sc, __pyx_v_voxel_size, __pyx_v_step_size, __pyx_v_stream_status, (__pyx_v_back_steps + __pyx_v_front_steps), __pyx_v_particle_count, __pyx_v_particle_paths, __pyx_v_particle_dirs, __pyx_v_particle_weights, __pyx_v_particle_steps, __pyx_v_particle_stream_statuses); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 355, __pyx_L1_error)
4557         __Pyx_GOTREF(__pyx_t_8);
4558         __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 355, __pyx_L1_error)
4559         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4560         __pyx_v_i = __pyx_t_6;
4561 
4562         /* "dipy/tracking/localtrack.pyx":360
4563  *                          particle_paths, particle_dirs, particle_weights,
4564  *                          particle_steps, particle_stream_statuses)
4565  *                 pft_trial += 1             # <<<<<<<<<<<<<<
4566  *                 # update the current point with the PFT results
4567  *                 copy_point(&streamline[i-1, 0], point)
4568  */
4569         __pyx_v_pft_trial = (__pyx_v_pft_trial + 1);
4570 
4571         /* "dipy/tracking/localtrack.pyx":362
4572  *                 pft_trial += 1
4573  *                 # update the current point with the PFT results
4574  *                 copy_point(&streamline[i-1, 0], point)             # <<<<<<<<<<<<<<
4575  *                 copy_point(&directions[i-1, 0], dir)
4576  *
4577  */
4578         __pyx_t_1 = (__pyx_v_i - 1);
4579         __pyx_t_2 = 0;
4580         __pyx_f_4dipy_5utils_10fast_numpy_copy_point((&(*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_streamline.data + __pyx_t_1 * __pyx_v_streamline.strides[0]) ) + __pyx_t_2 * __pyx_v_streamline.strides[1]) )))), __pyx_v_point);
4581 
4582         /* "dipy/tracking/localtrack.pyx":363
4583  *                 # update the current point with the PFT results
4584  *                 copy_point(&streamline[i-1, 0], point)
4585  *                 copy_point(&directions[i-1, 0], dir)             # <<<<<<<<<<<<<<
4586  *
4587  *                 if stream_status[0] != TRACKPOINT:
4588  */
4589         __pyx_t_2 = (__pyx_v_i - 1);
4590         __pyx_t_1 = 0;
4591         __pyx_f_4dipy_5utils_10fast_numpy_copy_point((&(*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_directions.data + __pyx_t_2 * __pyx_v_directions.strides[0]) ) + __pyx_t_1 * __pyx_v_directions.strides[1]) )))), __pyx_v_dir);
4592 
4593         /* "dipy/tracking/localtrack.pyx":365
4594  *                 copy_point(&directions[i-1, 0], dir)
4595  *
4596  *                 if stream_status[0] != TRACKPOINT:             # <<<<<<<<<<<<<<
4597  *                     # The tracking stops. PFT returned a valid stopping point
4598  *                     # (ENDPOINT, OUTSIDEIMAGE) or failed to find one
4599  */
4600         __pyx_t_3 = (((__pyx_v_stream_status[0]) != __pyx_e_4dipy_8tracking_18stopping_criterion_TRACKPOINT) != 0);
4601         if (__pyx_t_3) {
4602 
4603           /* "dipy/tracking/localtrack.pyx":369
4604  *                     # (ENDPOINT, OUTSIDEIMAGE) or failed to find one
4605  *                     # (INVALIDPOINT, PYERROR)
4606  *                     break             # <<<<<<<<<<<<<<
4607  *             else:
4608  *                 # PFT was run more times than `pft_max_trials` without finding
4609  */
4610           goto __pyx_L4_break;
4611 
4612           /* "dipy/tracking/localtrack.pyx":365
4613  *                 copy_point(&directions[i-1, 0], dir)
4614  *
4615  *                 if stream_status[0] != TRACKPOINT:             # <<<<<<<<<<<<<<
4616  *                     # The tracking stops. PFT returned a valid stopping point
4617  *                     # (ENDPOINT, OUTSIDEIMAGE) or failed to find one
4618  */
4619         }
4620 
4621         /* "dipy/tracking/localtrack.pyx":350
4622  *             continue
4623  *         elif stream_status[0] == INVALIDPOINT:
4624  *             if pft_trial < pft_max_trials and i > 1:             # <<<<<<<<<<<<<<
4625  *                 back_steps = min(i - 1, pft_max_nbr_back_steps)
4626  *                 front_steps = min(strl_array_len - i - back_steps - 1,
4627  */
4628         goto __pyx_L9;
4629       }
4630 
4631       /* "dipy/tracking/localtrack.pyx":373
4632  *                 # PFT was run more times than `pft_max_trials` without finding
4633  *                 # a valid stopping point. The tracking stops with INVALIDPOINT.
4634  *                 break             # <<<<<<<<<<<<<<
4635  *         else:
4636  *             # The tracking stops with a valid point (ENDPOINT, OUTSIDEIMAGE)
4637  */
4638       /*else*/ {
4639         goto __pyx_L4_break;
4640       }
4641       __pyx_L9:;
4642 
4643       /* "dipy/tracking/localtrack.pyx":349
4644  *             # The tracking continues normally
4645  *             continue
4646  *         elif stream_status[0] == INVALIDPOINT:             # <<<<<<<<<<<<<<
4647  *             if pft_trial < pft_max_trials and i > 1:
4648  *                 back_steps = min(i - 1, pft_max_nbr_back_steps)
4649  */
4650       goto __pyx_L8;
4651     }
4652 
4653     /* "dipy/tracking/localtrack.pyx":377
4654  *             # The tracking stops with a valid point (ENDPOINT, OUTSIDEIMAGE)
4655  *             # or an invalid point (PYERROR)
4656  *             break             # <<<<<<<<<<<<<<
4657  *
4658  *     if stream_status[0] == OUTSIDEIMAGE or stream_status[0] == PYERROR:
4659  */
4660     /*else*/ {
4661       goto __pyx_L4_break;
4662     }
4663     __pyx_L8:;
4664     __pyx_L3_continue:;
4665   }
4666   __pyx_L4_break:;
4667 
4668   /* "dipy/tracking/localtrack.pyx":379
4669  *             break
4670  *
4671  *     if stream_status[0] == OUTSIDEIMAGE or stream_status[0] == PYERROR:             # <<<<<<<<<<<<<<
4672  *         i -= 1
4673  *     return i
4674  */
4675   __pyx_t_5 = (((__pyx_v_stream_status[0]) == __pyx_e_4dipy_8tracking_18stopping_criterion_OUTSIDEIMAGE) != 0);
4676   if (!__pyx_t_5) {
4677   } else {
4678     __pyx_t_3 = __pyx_t_5;
4679     goto __pyx_L14_bool_binop_done;
4680   }
4681   __pyx_t_5 = (((__pyx_v_stream_status[0]) == __pyx_e_4dipy_8tracking_18stopping_criterion_PYERROR) != 0);
4682   __pyx_t_3 = __pyx_t_5;
4683   __pyx_L14_bool_binop_done:;
4684   if (__pyx_t_3) {
4685 
4686     /* "dipy/tracking/localtrack.pyx":380
4687  *
4688  *     if stream_status[0] == OUTSIDEIMAGE or stream_status[0] == PYERROR:
4689  *         i -= 1             # <<<<<<<<<<<<<<
4690  *     return i
4691  *
4692  */
4693     __pyx_v_i = (__pyx_v_i - 1);
4694 
4695     /* "dipy/tracking/localtrack.pyx":379
4696  *             break
4697  *
4698  *     if stream_status[0] == OUTSIDEIMAGE or stream_status[0] == PYERROR:             # <<<<<<<<<<<<<<
4699  *         i -= 1
4700  *     return i
4701  */
4702   }
4703 
4704   /* "dipy/tracking/localtrack.pyx":381
4705  *     if stream_status[0] == OUTSIDEIMAGE or stream_status[0] == PYERROR:
4706  *         i -= 1
4707  *     return i             # <<<<<<<<<<<<<<
4708  *
4709  *
4710  */
4711   __Pyx_XDECREF(__pyx_r);
4712   __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 381, __pyx_L1_error)
4713   __Pyx_GOTREF(__pyx_t_8);
4714   __pyx_r = __pyx_t_8;
4715   __pyx_t_8 = 0;
4716   goto __pyx_L0;
4717 
4718   /* "dipy/tracking/localtrack.pyx":300
4719  * @cython.wraparound(False)
4720  * @cython.cdivision(True)
4721  * cdef _pft_tracker(DirectionGetter dg,             # <<<<<<<<<<<<<<
4722  *                   AnatomicalStoppingCriterion sc,
4723  *                   double* seed,
4724  */
4725 
4726   /* function exit code */
4727   __pyx_L1_error:;
4728   __Pyx_XDECREF(__pyx_t_8);
4729   __Pyx_AddTraceback("dipy.tracking.localtrack._pft_tracker", __pyx_clineno, __pyx_lineno, __pyx_filename);
4730   __pyx_r = 0;
4731   __pyx_L0:;
4732   __Pyx_XGIVEREF(__pyx_r);
4733   __Pyx_RefNannyFinishContext();
4734   return __pyx_r;
4735 }
4736 
4737 /* "dipy/tracking/localtrack.pyx":387
4738  * @cython.wraparound(False)
4739  * @cython.cdivision(True)
4740  * cdef _pft(cnp.float_t[:, :] streamline,             # <<<<<<<<<<<<<<
4741  *           int streamline_i,
4742  *           cnp.float_t[:, :] directions,
4743  */
4744 
__pyx_f_4dipy_8tracking_10localtrack__pft(__Pyx_memviewslice __pyx_v_streamline,int __pyx_v_streamline_i,__Pyx_memviewslice __pyx_v_directions,struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter * __pyx_v_dg,struct __pyx_obj_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion * __pyx_v_sc,double * __pyx_v_voxel_size,double __pyx_v_step_size,enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus * __pyx_v_stream_status,int __pyx_v_pft_nbr_steps,int __pyx_v_particle_count,__Pyx_memviewslice __pyx_v_particle_paths,__Pyx_memviewslice __pyx_v_particle_dirs,__Pyx_memviewslice __pyx_v_particle_weights,__Pyx_memviewslice __pyx_v_particle_steps,__Pyx_memviewslice __pyx_v_particle_stream_statuses)4745 static PyObject *__pyx_f_4dipy_8tracking_10localtrack__pft(__Pyx_memviewslice __pyx_v_streamline, int __pyx_v_streamline_i, __Pyx_memviewslice __pyx_v_directions, struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter *__pyx_v_dg, struct __pyx_obj_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion *__pyx_v_sc, double *__pyx_v_voxel_size, double __pyx_v_step_size, enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus *__pyx_v_stream_status, int __pyx_v_pft_nbr_steps, int __pyx_v_particle_count, __Pyx_memviewslice __pyx_v_particle_paths, __Pyx_memviewslice __pyx_v_particle_dirs, __Pyx_memviewslice __pyx_v_particle_weights, __Pyx_memviewslice __pyx_v_particle_steps, __Pyx_memviewslice __pyx_v_particle_stream_statuses) {
4746   double __pyx_v_sum_weights;
4747   double __pyx_v_sum_squared;
4748   double __pyx_v_N_effective;
4749   double __pyx_v_rdm_sample;
4750   double __pyx_v_point[3];
4751   double __pyx_v_dir[3];
4752   double __pyx_v_voxdir[3];
4753   double __pyx_v_eps;
4754   int __pyx_v_s;
4755   int __pyx_v_p;
4756   int __pyx_v_j;
4757   int __pyx_v_pp;
4758   int __pyx_v_ss;
4759   int __pyx_v_p_source;
4760   PyObject *__pyx_r = NULL;
4761   __Pyx_RefNannyDeclarations
4762   int __pyx_t_1;
4763   PyObject *__pyx_t_2 = NULL;
4764   int __pyx_t_3;
4765   int __pyx_t_4;
4766   int __pyx_t_5;
4767   Py_ssize_t __pyx_t_6;
4768   Py_ssize_t __pyx_t_7;
4769   Py_ssize_t __pyx_t_8;
4770   Py_ssize_t __pyx_t_9;
4771   Py_ssize_t __pyx_t_10;
4772   Py_ssize_t __pyx_t_11;
4773   int __pyx_t_12;
4774   int __pyx_t_13;
4775   int __pyx_t_14;
4776   int __pyx_t_15;
4777   PyObject *__pyx_t_16 = NULL;
4778   __pyx_t_5numpy_float_t __pyx_t_17;
4779   int __pyx_t_18;
4780   int __pyx_t_19;
4781   int __pyx_t_20;
4782   Py_ssize_t __pyx_t_21;
4783   Py_ssize_t __pyx_t_22;
4784   PyObject *__pyx_t_23 = NULL;
4785   double __pyx_t_24;
4786   __pyx_t_5numpy_int_t __pyx_t_25;
4787   __pyx_t_5numpy_int_t __pyx_t_26;
4788   int __pyx_lineno = 0;
4789   const char *__pyx_filename = NULL;
4790   int __pyx_clineno = 0;
4791   __Pyx_RefNannySetupContext("_pft", 0);
4792 
4793   /* "dipy/tracking/localtrack.pyx":407
4794  *         double dir[3]
4795  *         double voxdir[3]
4796  *         double eps = 1e-16             # <<<<<<<<<<<<<<
4797  *         int s, p, j
4798  *
4799  */
4800   __pyx_v_eps = 1e-16;
4801 
4802   /* "dipy/tracking/localtrack.pyx":410
4803  *         int s, p, j
4804  *
4805  *     if pft_nbr_steps <= 0:             # <<<<<<<<<<<<<<
4806  *         return streamline_i
4807  *
4808  */
4809   __pyx_t_1 = ((__pyx_v_pft_nbr_steps <= 0) != 0);
4810   if (__pyx_t_1) {
4811 
4812     /* "dipy/tracking/localtrack.pyx":411
4813  *
4814  *     if pft_nbr_steps <= 0:
4815  *         return streamline_i             # <<<<<<<<<<<<<<
4816  *
4817  *     for p in range(particle_count):
4818  */
4819     __Pyx_XDECREF(__pyx_r);
4820     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_streamline_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 411, __pyx_L1_error)
4821     __Pyx_GOTREF(__pyx_t_2);
4822     __pyx_r = __pyx_t_2;
4823     __pyx_t_2 = 0;
4824     goto __pyx_L0;
4825 
4826     /* "dipy/tracking/localtrack.pyx":410
4827  *         int s, p, j
4828  *
4829  *     if pft_nbr_steps <= 0:             # <<<<<<<<<<<<<<
4830  *         return streamline_i
4831  *
4832  */
4833   }
4834 
4835   /* "dipy/tracking/localtrack.pyx":413
4836  *         return streamline_i
4837  *
4838  *     for p in range(particle_count):             # <<<<<<<<<<<<<<
4839  *         copy_point(&streamline[streamline_i, 0], &particle_paths[0, p, 0, 0])
4840  *         copy_point(&directions[streamline_i, 0], &particle_dirs[0, p, 0, 0])
4841  */
4842   __pyx_t_3 = __pyx_v_particle_count;
4843   __pyx_t_4 = __pyx_t_3;
4844   for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
4845     __pyx_v_p = __pyx_t_5;
4846 
4847     /* "dipy/tracking/localtrack.pyx":414
4848  *
4849  *     for p in range(particle_count):
4850  *         copy_point(&streamline[streamline_i, 0], &particle_paths[0, p, 0, 0])             # <<<<<<<<<<<<<<
4851  *         copy_point(&directions[streamline_i, 0], &particle_dirs[0, p, 0, 0])
4852  *         particle_weights[p] = 1. / particle_count
4853  */
4854     __pyx_t_6 = __pyx_v_streamline_i;
4855     __pyx_t_7 = 0;
4856     __pyx_t_8 = 0;
4857     __pyx_t_9 = __pyx_v_p;
4858     __pyx_t_10 = 0;
4859     __pyx_t_11 = 0;
4860     __pyx_f_4dipy_5utils_10fast_numpy_copy_point((&(*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_streamline.data + __pyx_t_6 * __pyx_v_streamline.strides[0]) ) + __pyx_t_7 * __pyx_v_streamline.strides[1]) )))), (&(*((__pyx_t_5numpy_float_t *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_paths.data + __pyx_t_8 * __pyx_v_particle_paths.strides[0]) ) + __pyx_t_9 * __pyx_v_particle_paths.strides[1]) ) + __pyx_t_10 * __pyx_v_particle_paths.strides[2]) ) + __pyx_t_11 * __pyx_v_particle_paths.strides[3]) )))));
4861 
4862     /* "dipy/tracking/localtrack.pyx":415
4863  *     for p in range(particle_count):
4864  *         copy_point(&streamline[streamline_i, 0], &particle_paths[0, p, 0, 0])
4865  *         copy_point(&directions[streamline_i, 0], &particle_dirs[0, p, 0, 0])             # <<<<<<<<<<<<<<
4866  *         particle_weights[p] = 1. / particle_count
4867  *         particle_stream_statuses[0, p] = TRACKPOINT
4868  */
4869     __pyx_t_11 = __pyx_v_streamline_i;
4870     __pyx_t_10 = 0;
4871     __pyx_t_9 = 0;
4872     __pyx_t_8 = __pyx_v_p;
4873     __pyx_t_7 = 0;
4874     __pyx_t_6 = 0;
4875     __pyx_f_4dipy_5utils_10fast_numpy_copy_point((&(*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_directions.data + __pyx_t_11 * __pyx_v_directions.strides[0]) ) + __pyx_t_10 * __pyx_v_directions.strides[1]) )))), (&(*((__pyx_t_5numpy_float_t *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_dirs.data + __pyx_t_9 * __pyx_v_particle_dirs.strides[0]) ) + __pyx_t_8 * __pyx_v_particle_dirs.strides[1]) ) + __pyx_t_7 * __pyx_v_particle_dirs.strides[2]) ) + __pyx_t_6 * __pyx_v_particle_dirs.strides[3]) )))));
4876 
4877     /* "dipy/tracking/localtrack.pyx":416
4878  *         copy_point(&streamline[streamline_i, 0], &particle_paths[0, p, 0, 0])
4879  *         copy_point(&directions[streamline_i, 0], &particle_dirs[0, p, 0, 0])
4880  *         particle_weights[p] = 1. / particle_count             # <<<<<<<<<<<<<<
4881  *         particle_stream_statuses[0, p] = TRACKPOINT
4882  *         particle_steps[0, p] = 0
4883  */
4884     __pyx_t_6 = __pyx_v_p;
4885     *((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_particle_weights.data + __pyx_t_6 * __pyx_v_particle_weights.strides[0]) )) = (1. / ((double)__pyx_v_particle_count));
4886 
4887     /* "dipy/tracking/localtrack.pyx":417
4888  *         copy_point(&directions[streamline_i, 0], &particle_dirs[0, p, 0, 0])
4889  *         particle_weights[p] = 1. / particle_count
4890  *         particle_stream_statuses[0, p] = TRACKPOINT             # <<<<<<<<<<<<<<
4891  *         particle_steps[0, p] = 0
4892  *
4893  */
4894     __pyx_t_6 = 0;
4895     __pyx_t_7 = __pyx_v_p;
4896     *((__pyx_t_5numpy_int_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_stream_statuses.data + __pyx_t_6 * __pyx_v_particle_stream_statuses.strides[0]) ) + __pyx_t_7 * __pyx_v_particle_stream_statuses.strides[1]) )) = __pyx_e_4dipy_8tracking_18stopping_criterion_TRACKPOINT;
4897 
4898     /* "dipy/tracking/localtrack.pyx":418
4899  *         particle_weights[p] = 1. / particle_count
4900  *         particle_stream_statuses[0, p] = TRACKPOINT
4901  *         particle_steps[0, p] = 0             # <<<<<<<<<<<<<<
4902  *
4903  *     for s in range(pft_nbr_steps):
4904  */
4905     __pyx_t_7 = 0;
4906     __pyx_t_6 = __pyx_v_p;
4907     *((__pyx_t_5numpy_int_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_steps.data + __pyx_t_7 * __pyx_v_particle_steps.strides[0]) ) + __pyx_t_6 * __pyx_v_particle_steps.strides[1]) )) = 0;
4908   }
4909 
4910   /* "dipy/tracking/localtrack.pyx":420
4911  *         particle_steps[0, p] = 0
4912  *
4913  *     for s in range(pft_nbr_steps):             # <<<<<<<<<<<<<<
4914  *         for p in range(particle_count):
4915  *             if particle_stream_statuses[0, p] != TRACKPOINT:
4916  */
4917   __pyx_t_3 = __pyx_v_pft_nbr_steps;
4918   __pyx_t_4 = __pyx_t_3;
4919   for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
4920     __pyx_v_s = __pyx_t_5;
4921 
4922     /* "dipy/tracking/localtrack.pyx":421
4923  *
4924  *     for s in range(pft_nbr_steps):
4925  *         for p in range(particle_count):             # <<<<<<<<<<<<<<
4926  *             if particle_stream_statuses[0, p] != TRACKPOINT:
4927  *                 for j in range(3):
4928  */
4929     __pyx_t_12 = __pyx_v_particle_count;
4930     __pyx_t_13 = __pyx_t_12;
4931     for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
4932       __pyx_v_p = __pyx_t_14;
4933 
4934       /* "dipy/tracking/localtrack.pyx":422
4935  *     for s in range(pft_nbr_steps):
4936  *         for p in range(particle_count):
4937  *             if particle_stream_statuses[0, p] != TRACKPOINT:             # <<<<<<<<<<<<<<
4938  *                 for j in range(3):
4939  *                     particle_paths[0, p, s, j] = 0
4940  */
4941       __pyx_t_6 = 0;
4942       __pyx_t_7 = __pyx_v_p;
4943       __pyx_t_1 = (((*((__pyx_t_5numpy_int_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_stream_statuses.data + __pyx_t_6 * __pyx_v_particle_stream_statuses.strides[0]) ) + __pyx_t_7 * __pyx_v_particle_stream_statuses.strides[1]) ))) != __pyx_e_4dipy_8tracking_18stopping_criterion_TRACKPOINT) != 0);
4944       if (__pyx_t_1) {
4945 
4946         /* "dipy/tracking/localtrack.pyx":423
4947  *         for p in range(particle_count):
4948  *             if particle_stream_statuses[0, p] != TRACKPOINT:
4949  *                 for j in range(3):             # <<<<<<<<<<<<<<
4950  *                     particle_paths[0, p, s, j] = 0
4951  *                     particle_dirs[0, p, s, j] = 0
4952  */
4953         for (__pyx_t_15 = 0; __pyx_t_15 < 3; __pyx_t_15+=1) {
4954           __pyx_v_j = __pyx_t_15;
4955 
4956           /* "dipy/tracking/localtrack.pyx":424
4957  *             if particle_stream_statuses[0, p] != TRACKPOINT:
4958  *                 for j in range(3):
4959  *                     particle_paths[0, p, s, j] = 0             # <<<<<<<<<<<<<<
4960  *                     particle_dirs[0, p, s, j] = 0
4961  *                 continue  # move to the next particle
4962  */
4963           __pyx_t_7 = 0;
4964           __pyx_t_6 = __pyx_v_p;
4965           __pyx_t_8 = __pyx_v_s;
4966           __pyx_t_9 = __pyx_v_j;
4967           *((__pyx_t_5numpy_float_t *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_paths.data + __pyx_t_7 * __pyx_v_particle_paths.strides[0]) ) + __pyx_t_6 * __pyx_v_particle_paths.strides[1]) ) + __pyx_t_8 * __pyx_v_particle_paths.strides[2]) ) + __pyx_t_9 * __pyx_v_particle_paths.strides[3]) )) = 0.0;
4968 
4969           /* "dipy/tracking/localtrack.pyx":425
4970  *                 for j in range(3):
4971  *                     particle_paths[0, p, s, j] = 0
4972  *                     particle_dirs[0, p, s, j] = 0             # <<<<<<<<<<<<<<
4973  *                 continue  # move to the next particle
4974  *             copy_point(&particle_paths[0, p, s, 0], point)
4975  */
4976           __pyx_t_9 = 0;
4977           __pyx_t_8 = __pyx_v_p;
4978           __pyx_t_6 = __pyx_v_s;
4979           __pyx_t_7 = __pyx_v_j;
4980           *((__pyx_t_5numpy_float_t *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_dirs.data + __pyx_t_9 * __pyx_v_particle_dirs.strides[0]) ) + __pyx_t_8 * __pyx_v_particle_dirs.strides[1]) ) + __pyx_t_6 * __pyx_v_particle_dirs.strides[2]) ) + __pyx_t_7 * __pyx_v_particle_dirs.strides[3]) )) = 0.0;
4981         }
4982 
4983         /* "dipy/tracking/localtrack.pyx":426
4984  *                     particle_paths[0, p, s, j] = 0
4985  *                     particle_dirs[0, p, s, j] = 0
4986  *                 continue  # move to the next particle             # <<<<<<<<<<<<<<
4987  *             copy_point(&particle_paths[0, p, s, 0], point)
4988  *             copy_point(&particle_dirs[0, p, s, 0], dir)
4989  */
4990         goto __pyx_L8_continue;
4991 
4992         /* "dipy/tracking/localtrack.pyx":422
4993  *     for s in range(pft_nbr_steps):
4994  *         for p in range(particle_count):
4995  *             if particle_stream_statuses[0, p] != TRACKPOINT:             # <<<<<<<<<<<<<<
4996  *                 for j in range(3):
4997  *                     particle_paths[0, p, s, j] = 0
4998  */
4999       }
5000 
5001       /* "dipy/tracking/localtrack.pyx":427
5002  *                     particle_dirs[0, p, s, j] = 0
5003  *                 continue  # move to the next particle
5004  *             copy_point(&particle_paths[0, p, s, 0], point)             # <<<<<<<<<<<<<<
5005  *             copy_point(&particle_dirs[0, p, s, 0], dir)
5006  *
5007  */
5008       __pyx_t_7 = 0;
5009       __pyx_t_6 = __pyx_v_p;
5010       __pyx_t_8 = __pyx_v_s;
5011       __pyx_t_9 = 0;
5012       __pyx_f_4dipy_5utils_10fast_numpy_copy_point((&(*((__pyx_t_5numpy_float_t *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_paths.data + __pyx_t_7 * __pyx_v_particle_paths.strides[0]) ) + __pyx_t_6 * __pyx_v_particle_paths.strides[1]) ) + __pyx_t_8 * __pyx_v_particle_paths.strides[2]) ) + __pyx_t_9 * __pyx_v_particle_paths.strides[3]) )))), __pyx_v_point);
5013 
5014       /* "dipy/tracking/localtrack.pyx":428
5015  *                 continue  # move to the next particle
5016  *             copy_point(&particle_paths[0, p, s, 0], point)
5017  *             copy_point(&particle_dirs[0, p, s, 0], dir)             # <<<<<<<<<<<<<<
5018  *
5019  *             if dg.get_direction_c(point, dir):
5020  */
5021       __pyx_t_9 = 0;
5022       __pyx_t_8 = __pyx_v_p;
5023       __pyx_t_6 = __pyx_v_s;
5024       __pyx_t_7 = 0;
5025       __pyx_f_4dipy_5utils_10fast_numpy_copy_point((&(*((__pyx_t_5numpy_float_t *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_dirs.data + __pyx_t_9 * __pyx_v_particle_dirs.strides[0]) ) + __pyx_t_8 * __pyx_v_particle_dirs.strides[1]) ) + __pyx_t_6 * __pyx_v_particle_dirs.strides[2]) ) + __pyx_t_7 * __pyx_v_particle_dirs.strides[3]) )))), __pyx_v_dir);
5026 
5027       /* "dipy/tracking/localtrack.pyx":430
5028  *             copy_point(&particle_dirs[0, p, s, 0], dir)
5029  *
5030  *             if dg.get_direction_c(point, dir):             # <<<<<<<<<<<<<<
5031  *                 particle_stream_statuses[0, p] = INVALIDPOINT
5032  *                 particle_weights[p] = 0
5033  */
5034       __pyx_t_1 = (((struct __pyx_vtabstruct_4dipy_8tracking_16direction_getter_DirectionGetter *)__pyx_v_dg->__pyx_vtab)->get_direction_c(__pyx_v_dg, __pyx_v_point, __pyx_v_dir) != 0);
5035       if (__pyx_t_1) {
5036 
5037         /* "dipy/tracking/localtrack.pyx":431
5038  *
5039  *             if dg.get_direction_c(point, dir):
5040  *                 particle_stream_statuses[0, p] = INVALIDPOINT             # <<<<<<<<<<<<<<
5041  *                 particle_weights[p] = 0
5042  *             else:
5043  */
5044         __pyx_t_7 = 0;
5045         __pyx_t_6 = __pyx_v_p;
5046         *((__pyx_t_5numpy_int_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_stream_statuses.data + __pyx_t_7 * __pyx_v_particle_stream_statuses.strides[0]) ) + __pyx_t_6 * __pyx_v_particle_stream_statuses.strides[1]) )) = __pyx_e_4dipy_8tracking_18stopping_criterion_INVALIDPOINT;
5047 
5048         /* "dipy/tracking/localtrack.pyx":432
5049  *             if dg.get_direction_c(point, dir):
5050  *                 particle_stream_statuses[0, p] = INVALIDPOINT
5051  *                 particle_weights[p] = 0             # <<<<<<<<<<<<<<
5052  *             else:
5053  *                 for j in range(3):
5054  */
5055         __pyx_t_6 = __pyx_v_p;
5056         *((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_particle_weights.data + __pyx_t_6 * __pyx_v_particle_weights.strides[0]) )) = 0.0;
5057 
5058         /* "dipy/tracking/localtrack.pyx":430
5059  *             copy_point(&particle_dirs[0, p, s, 0], dir)
5060  *
5061  *             if dg.get_direction_c(point, dir):             # <<<<<<<<<<<<<<
5062  *                 particle_stream_statuses[0, p] = INVALIDPOINT
5063  *                 particle_weights[p] = 0
5064  */
5065         goto __pyx_L13;
5066       }
5067 
5068       /* "dipy/tracking/localtrack.pyx":434
5069  *                 particle_weights[p] = 0
5070  *             else:
5071  *                 for j in range(3):             # <<<<<<<<<<<<<<
5072  *                     voxdir[j] = dir[j] / voxel_size[j]
5073  *                 fixed_step(point, voxdir, step_size)
5074  */
5075       /*else*/ {
5076         for (__pyx_t_15 = 0; __pyx_t_15 < 3; __pyx_t_15+=1) {
5077           __pyx_v_j = __pyx_t_15;
5078 
5079           /* "dipy/tracking/localtrack.pyx":435
5080  *             else:
5081  *                 for j in range(3):
5082  *                     voxdir[j] = dir[j] / voxel_size[j]             # <<<<<<<<<<<<<<
5083  *                 fixed_step(point, voxdir, step_size)
5084  *                 copy_point(point, &particle_paths[0, p, s + 1, 0])
5085  */
5086           (__pyx_v_voxdir[__pyx_v_j]) = ((__pyx_v_dir[__pyx_v_j]) / (__pyx_v_voxel_size[__pyx_v_j]));
5087         }
5088 
5089         /* "dipy/tracking/localtrack.pyx":436
5090  *                 for j in range(3):
5091  *                     voxdir[j] = dir[j] / voxel_size[j]
5092  *                 fixed_step(point, voxdir, step_size)             # <<<<<<<<<<<<<<
5093  *                 copy_point(point, &particle_paths[0, p, s + 1, 0])
5094  *                 copy_point(dir, &particle_dirs[0, p, s + 1, 0])
5095  */
5096         __pyx_f_4dipy_8tracking_10localtrack_fixed_step(__pyx_v_point, __pyx_v_voxdir, __pyx_v_step_size);
5097 
5098         /* "dipy/tracking/localtrack.pyx":437
5099  *                     voxdir[j] = dir[j] / voxel_size[j]
5100  *                 fixed_step(point, voxdir, step_size)
5101  *                 copy_point(point, &particle_paths[0, p, s + 1, 0])             # <<<<<<<<<<<<<<
5102  *                 copy_point(dir, &particle_dirs[0, p, s + 1, 0])
5103  *                 particle_stream_statuses[0, p] = sc.check_point_c(point)
5104  */
5105         __pyx_t_6 = 0;
5106         __pyx_t_7 = __pyx_v_p;
5107         __pyx_t_8 = (__pyx_v_s + 1);
5108         __pyx_t_9 = 0;
5109         __pyx_f_4dipy_5utils_10fast_numpy_copy_point(__pyx_v_point, (&(*((__pyx_t_5numpy_float_t *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_paths.data + __pyx_t_6 * __pyx_v_particle_paths.strides[0]) ) + __pyx_t_7 * __pyx_v_particle_paths.strides[1]) ) + __pyx_t_8 * __pyx_v_particle_paths.strides[2]) ) + __pyx_t_9 * __pyx_v_particle_paths.strides[3]) )))));
5110 
5111         /* "dipy/tracking/localtrack.pyx":438
5112  *                 fixed_step(point, voxdir, step_size)
5113  *                 copy_point(point, &particle_paths[0, p, s + 1, 0])
5114  *                 copy_point(dir, &particle_dirs[0, p, s + 1, 0])             # <<<<<<<<<<<<<<
5115  *                 particle_stream_statuses[0, p] = sc.check_point_c(point)
5116  *                 particle_steps[0, p] = s + 1
5117  */
5118         __pyx_t_9 = 0;
5119         __pyx_t_8 = __pyx_v_p;
5120         __pyx_t_7 = (__pyx_v_s + 1);
5121         __pyx_t_6 = 0;
5122         __pyx_f_4dipy_5utils_10fast_numpy_copy_point(__pyx_v_dir, (&(*((__pyx_t_5numpy_float_t *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_dirs.data + __pyx_t_9 * __pyx_v_particle_dirs.strides[0]) ) + __pyx_t_8 * __pyx_v_particle_dirs.strides[1]) ) + __pyx_t_7 * __pyx_v_particle_dirs.strides[2]) ) + __pyx_t_6 * __pyx_v_particle_dirs.strides[3]) )))));
5123 
5124         /* "dipy/tracking/localtrack.pyx":439
5125  *                 copy_point(point, &particle_paths[0, p, s + 1, 0])
5126  *                 copy_point(dir, &particle_dirs[0, p, s + 1, 0])
5127  *                 particle_stream_statuses[0, p] = sc.check_point_c(point)             # <<<<<<<<<<<<<<
5128  *                 particle_steps[0, p] = s + 1
5129  *                 particle_weights[p] *= 1 - sc.get_exclude_c(point)
5130  */
5131         __pyx_t_6 = 0;
5132         __pyx_t_7 = __pyx_v_p;
5133         *((__pyx_t_5numpy_int_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_stream_statuses.data + __pyx_t_6 * __pyx_v_particle_stream_statuses.strides[0]) ) + __pyx_t_7 * __pyx_v_particle_stream_statuses.strides[1]) )) = ((struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion *)__pyx_v_sc->__pyx_base.__pyx_vtab)->__pyx_base.check_point_c(((struct __pyx_obj_4dipy_8tracking_18stopping_criterion_StoppingCriterion *)__pyx_v_sc), __pyx_v_point);
5134 
5135         /* "dipy/tracking/localtrack.pyx":440
5136  *                 copy_point(dir, &particle_dirs[0, p, s + 1, 0])
5137  *                 particle_stream_statuses[0, p] = sc.check_point_c(point)
5138  *                 particle_steps[0, p] = s + 1             # <<<<<<<<<<<<<<
5139  *                 particle_weights[p] *= 1 - sc.get_exclude_c(point)
5140  *                 if particle_weights[p] < eps:
5141  */
5142         __pyx_t_7 = 0;
5143         __pyx_t_6 = __pyx_v_p;
5144         *((__pyx_t_5numpy_int_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_steps.data + __pyx_t_7 * __pyx_v_particle_steps.strides[0]) ) + __pyx_t_6 * __pyx_v_particle_steps.strides[1]) )) = (__pyx_v_s + 1);
5145 
5146         /* "dipy/tracking/localtrack.pyx":441
5147  *                 particle_stream_statuses[0, p] = sc.check_point_c(point)
5148  *                 particle_steps[0, p] = s + 1
5149  *                 particle_weights[p] *= 1 - sc.get_exclude_c(point)             # <<<<<<<<<<<<<<
5150  *                 if particle_weights[p] < eps:
5151  *                     particle_weights[p] = 0
5152  */
5153         __pyx_t_2 = ((struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion *)__pyx_v_sc->__pyx_base.__pyx_vtab)->get_exclude_c(__pyx_v_sc, __pyx_v_point); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 441, __pyx_L1_error)
5154         __Pyx_GOTREF(__pyx_t_2);
5155         __pyx_t_16 = __Pyx_PyInt_SubtractCObj(__pyx_int_1, __pyx_t_2, 1, 0, 0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 441, __pyx_L1_error)
5156         __Pyx_GOTREF(__pyx_t_16);
5157         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5158         __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_16); if (unlikely((__pyx_t_17 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 441, __pyx_L1_error)
5159         __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
5160         __pyx_t_6 = __pyx_v_p;
5161         *((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_particle_weights.data + __pyx_t_6 * __pyx_v_particle_weights.strides[0]) )) *= __pyx_t_17;
5162 
5163         /* "dipy/tracking/localtrack.pyx":442
5164  *                 particle_steps[0, p] = s + 1
5165  *                 particle_weights[p] *= 1 - sc.get_exclude_c(point)
5166  *                 if particle_weights[p] < eps:             # <<<<<<<<<<<<<<
5167  *                     particle_weights[p] = 0
5168  *                 if (particle_stream_statuses[0, p] == INVALIDPOINT and
5169  */
5170         __pyx_t_6 = __pyx_v_p;
5171         __pyx_t_1 = (((*((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_particle_weights.data + __pyx_t_6 * __pyx_v_particle_weights.strides[0]) ))) < __pyx_v_eps) != 0);
5172         if (__pyx_t_1) {
5173 
5174           /* "dipy/tracking/localtrack.pyx":443
5175  *                 particle_weights[p] *= 1 - sc.get_exclude_c(point)
5176  *                 if particle_weights[p] < eps:
5177  *                     particle_weights[p] = 0             # <<<<<<<<<<<<<<
5178  *                 if (particle_stream_statuses[0, p] == INVALIDPOINT and
5179  *                         particle_weights[p] > 0):
5180  */
5181           __pyx_t_6 = __pyx_v_p;
5182           *((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_particle_weights.data + __pyx_t_6 * __pyx_v_particle_weights.strides[0]) )) = 0.0;
5183 
5184           /* "dipy/tracking/localtrack.pyx":442
5185  *                 particle_steps[0, p] = s + 1
5186  *                 particle_weights[p] *= 1 - sc.get_exclude_c(point)
5187  *                 if particle_weights[p] < eps:             # <<<<<<<<<<<<<<
5188  *                     particle_weights[p] = 0
5189  *                 if (particle_stream_statuses[0, p] == INVALIDPOINT and
5190  */
5191         }
5192 
5193         /* "dipy/tracking/localtrack.pyx":444
5194  *                 if particle_weights[p] < eps:
5195  *                     particle_weights[p] = 0
5196  *                 if (particle_stream_statuses[0, p] == INVALIDPOINT and             # <<<<<<<<<<<<<<
5197  *                         particle_weights[p] > 0):
5198  *                     particle_stream_statuses[0, p] = TRACKPOINT
5199  */
5200         __pyx_t_6 = 0;
5201         __pyx_t_7 = __pyx_v_p;
5202         __pyx_t_18 = (((*((__pyx_t_5numpy_int_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_stream_statuses.data + __pyx_t_6 * __pyx_v_particle_stream_statuses.strides[0]) ) + __pyx_t_7 * __pyx_v_particle_stream_statuses.strides[1]) ))) == __pyx_e_4dipy_8tracking_18stopping_criterion_INVALIDPOINT) != 0);
5203         if (__pyx_t_18) {
5204         } else {
5205           __pyx_t_1 = __pyx_t_18;
5206           goto __pyx_L18_bool_binop_done;
5207         }
5208 
5209         /* "dipy/tracking/localtrack.pyx":445
5210  *                     particle_weights[p] = 0
5211  *                 if (particle_stream_statuses[0, p] == INVALIDPOINT and
5212  *                         particle_weights[p] > 0):             # <<<<<<<<<<<<<<
5213  *                     particle_stream_statuses[0, p] = TRACKPOINT
5214  *
5215  */
5216         __pyx_t_7 = __pyx_v_p;
5217         __pyx_t_18 = (((*((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_particle_weights.data + __pyx_t_7 * __pyx_v_particle_weights.strides[0]) ))) > 0.0) != 0);
5218         __pyx_t_1 = __pyx_t_18;
5219         __pyx_L18_bool_binop_done:;
5220 
5221         /* "dipy/tracking/localtrack.pyx":444
5222  *                 if particle_weights[p] < eps:
5223  *                     particle_weights[p] = 0
5224  *                 if (particle_stream_statuses[0, p] == INVALIDPOINT and             # <<<<<<<<<<<<<<
5225  *                         particle_weights[p] > 0):
5226  *                     particle_stream_statuses[0, p] = TRACKPOINT
5227  */
5228         if (__pyx_t_1) {
5229 
5230           /* "dipy/tracking/localtrack.pyx":446
5231  *                 if (particle_stream_statuses[0, p] == INVALIDPOINT and
5232  *                         particle_weights[p] > 0):
5233  *                     particle_stream_statuses[0, p] = TRACKPOINT             # <<<<<<<<<<<<<<
5234  *
5235  *         sum_weights = 0
5236  */
5237           __pyx_t_7 = 0;
5238           __pyx_t_6 = __pyx_v_p;
5239           *((__pyx_t_5numpy_int_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_stream_statuses.data + __pyx_t_7 * __pyx_v_particle_stream_statuses.strides[0]) ) + __pyx_t_6 * __pyx_v_particle_stream_statuses.strides[1]) )) = __pyx_e_4dipy_8tracking_18stopping_criterion_TRACKPOINT;
5240 
5241           /* "dipy/tracking/localtrack.pyx":444
5242  *                 if particle_weights[p] < eps:
5243  *                     particle_weights[p] = 0
5244  *                 if (particle_stream_statuses[0, p] == INVALIDPOINT and             # <<<<<<<<<<<<<<
5245  *                         particle_weights[p] > 0):
5246  *                     particle_stream_statuses[0, p] = TRACKPOINT
5247  */
5248         }
5249       }
5250       __pyx_L13:;
5251       __pyx_L8_continue:;
5252     }
5253 
5254     /* "dipy/tracking/localtrack.pyx":448
5255  *                     particle_stream_statuses[0, p] = TRACKPOINT
5256  *
5257  *         sum_weights = 0             # <<<<<<<<<<<<<<
5258  *         for p in range(particle_count):
5259  *             sum_weights += particle_weights[p]
5260  */
5261     __pyx_v_sum_weights = 0.0;
5262 
5263     /* "dipy/tracking/localtrack.pyx":449
5264  *
5265  *         sum_weights = 0
5266  *         for p in range(particle_count):             # <<<<<<<<<<<<<<
5267  *             sum_weights += particle_weights[p]
5268  *
5269  */
5270     __pyx_t_12 = __pyx_v_particle_count;
5271     __pyx_t_13 = __pyx_t_12;
5272     for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
5273       __pyx_v_p = __pyx_t_14;
5274 
5275       /* "dipy/tracking/localtrack.pyx":450
5276  *         sum_weights = 0
5277  *         for p in range(particle_count):
5278  *             sum_weights += particle_weights[p]             # <<<<<<<<<<<<<<
5279  *
5280  *         if sum_weights > 0:
5281  */
5282       __pyx_t_6 = __pyx_v_p;
5283       __pyx_v_sum_weights = (__pyx_v_sum_weights + (*((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_particle_weights.data + __pyx_t_6 * __pyx_v_particle_weights.strides[0]) ))));
5284     }
5285 
5286     /* "dipy/tracking/localtrack.pyx":452
5287  *             sum_weights += particle_weights[p]
5288  *
5289  *         if sum_weights > 0:             # <<<<<<<<<<<<<<
5290  *             sum_squared = 0
5291  *             for p in range(particle_count):
5292  */
5293     __pyx_t_1 = ((__pyx_v_sum_weights > 0.0) != 0);
5294     if (__pyx_t_1) {
5295 
5296       /* "dipy/tracking/localtrack.pyx":453
5297  *
5298  *         if sum_weights > 0:
5299  *             sum_squared = 0             # <<<<<<<<<<<<<<
5300  *             for p in range(particle_count):
5301  *                 particle_weights[p] = particle_weights[p] / sum_weights
5302  */
5303       __pyx_v_sum_squared = 0.0;
5304 
5305       /* "dipy/tracking/localtrack.pyx":454
5306  *         if sum_weights > 0:
5307  *             sum_squared = 0
5308  *             for p in range(particle_count):             # <<<<<<<<<<<<<<
5309  *                 particle_weights[p] = particle_weights[p] / sum_weights
5310  *                 sum_squared += particle_weights[p] * particle_weights[p]
5311  */
5312       __pyx_t_12 = __pyx_v_particle_count;
5313       __pyx_t_13 = __pyx_t_12;
5314       for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
5315         __pyx_v_p = __pyx_t_14;
5316 
5317         /* "dipy/tracking/localtrack.pyx":455
5318  *             sum_squared = 0
5319  *             for p in range(particle_count):
5320  *                 particle_weights[p] = particle_weights[p] / sum_weights             # <<<<<<<<<<<<<<
5321  *                 sum_squared += particle_weights[p] * particle_weights[p]
5322  *
5323  */
5324         __pyx_t_6 = __pyx_v_p;
5325         __pyx_t_7 = __pyx_v_p;
5326         *((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_particle_weights.data + __pyx_t_7 * __pyx_v_particle_weights.strides[0]) )) = ((*((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_particle_weights.data + __pyx_t_6 * __pyx_v_particle_weights.strides[0]) ))) / ((__pyx_t_5numpy_float_t)__pyx_v_sum_weights));
5327 
5328         /* "dipy/tracking/localtrack.pyx":456
5329  *             for p in range(particle_count):
5330  *                 particle_weights[p] = particle_weights[p] / sum_weights
5331  *                 sum_squared += particle_weights[p] * particle_weights[p]             # <<<<<<<<<<<<<<
5332  *
5333  *             # Resample the particles if the weights are too uneven.
5334  */
5335         __pyx_t_6 = __pyx_v_p;
5336         __pyx_t_7 = __pyx_v_p;
5337         __pyx_v_sum_squared = (__pyx_v_sum_squared + ((*((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_particle_weights.data + __pyx_t_6 * __pyx_v_particle_weights.strides[0]) ))) * (*((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_particle_weights.data + __pyx_t_7 * __pyx_v_particle_weights.strides[0]) )))));
5338       }
5339 
5340       /* "dipy/tracking/localtrack.pyx":461
5341  *             # Particles with negligible weights are replaced by duplicates of
5342  *             # those with high weights through resampling
5343  *             N_effective = 1. / sum_squared             # <<<<<<<<<<<<<<
5344  *             if N_effective < particle_count / 10.:
5345  *                 # copy data in the temp arrays
5346  */
5347       __pyx_v_N_effective = (1. / __pyx_v_sum_squared);
5348 
5349       /* "dipy/tracking/localtrack.pyx":462
5350  *             # those with high weights through resampling
5351  *             N_effective = 1. / sum_squared
5352  *             if N_effective < particle_count / 10.:             # <<<<<<<<<<<<<<
5353  *                 # copy data in the temp arrays
5354  *                 for pp in range(particle_count):
5355  */
5356       __pyx_t_1 = ((__pyx_v_N_effective < (((double)__pyx_v_particle_count) / 10.)) != 0);
5357       if (__pyx_t_1) {
5358 
5359         /* "dipy/tracking/localtrack.pyx":464
5360  *             if N_effective < particle_count / 10.:
5361  *                 # copy data in the temp arrays
5362  *                 for pp in range(particle_count):             # <<<<<<<<<<<<<<
5363  *                     for ss in range(pft_nbr_steps):
5364  *                         copy_point(&particle_paths[0, pp, ss, 0],
5365  */
5366         __pyx_t_12 = __pyx_v_particle_count;
5367         __pyx_t_13 = __pyx_t_12;
5368         for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
5369           __pyx_v_pp = __pyx_t_14;
5370 
5371           /* "dipy/tracking/localtrack.pyx":465
5372  *                 # copy data in the temp arrays
5373  *                 for pp in range(particle_count):
5374  *                     for ss in range(pft_nbr_steps):             # <<<<<<<<<<<<<<
5375  *                         copy_point(&particle_paths[0, pp, ss, 0],
5376  *                                   &particle_paths[1, pp, ss, 0])
5377  */
5378           __pyx_t_15 = __pyx_v_pft_nbr_steps;
5379           __pyx_t_19 = __pyx_t_15;
5380           for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
5381             __pyx_v_ss = __pyx_t_20;
5382 
5383             /* "dipy/tracking/localtrack.pyx":466
5384  *                 for pp in range(particle_count):
5385  *                     for ss in range(pft_nbr_steps):
5386  *                         copy_point(&particle_paths[0, pp, ss, 0],             # <<<<<<<<<<<<<<
5387  *                                   &particle_paths[1, pp, ss, 0])
5388  *                         copy_point(&particle_dirs[0, pp, ss, 0],
5389  */
5390             __pyx_t_7 = 0;
5391             __pyx_t_6 = __pyx_v_pp;
5392             __pyx_t_8 = __pyx_v_ss;
5393             __pyx_t_9 = 0;
5394 
5395             /* "dipy/tracking/localtrack.pyx":467
5396  *                     for ss in range(pft_nbr_steps):
5397  *                         copy_point(&particle_paths[0, pp, ss, 0],
5398  *                                   &particle_paths[1, pp, ss, 0])             # <<<<<<<<<<<<<<
5399  *                         copy_point(&particle_dirs[0, pp, ss, 0],
5400  *                                   &particle_dirs[1, pp, ss, 0])
5401  */
5402             __pyx_t_10 = 1;
5403             __pyx_t_11 = __pyx_v_pp;
5404             __pyx_t_21 = __pyx_v_ss;
5405             __pyx_t_22 = 0;
5406 
5407             /* "dipy/tracking/localtrack.pyx":466
5408  *                 for pp in range(particle_count):
5409  *                     for ss in range(pft_nbr_steps):
5410  *                         copy_point(&particle_paths[0, pp, ss, 0],             # <<<<<<<<<<<<<<
5411  *                                   &particle_paths[1, pp, ss, 0])
5412  *                         copy_point(&particle_dirs[0, pp, ss, 0],
5413  */
5414             __pyx_f_4dipy_5utils_10fast_numpy_copy_point((&(*((__pyx_t_5numpy_float_t *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_paths.data + __pyx_t_7 * __pyx_v_particle_paths.strides[0]) ) + __pyx_t_6 * __pyx_v_particle_paths.strides[1]) ) + __pyx_t_8 * __pyx_v_particle_paths.strides[2]) ) + __pyx_t_9 * __pyx_v_particle_paths.strides[3]) )))), (&(*((__pyx_t_5numpy_float_t *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_paths.data + __pyx_t_10 * __pyx_v_particle_paths.strides[0]) ) + __pyx_t_11 * __pyx_v_particle_paths.strides[1]) ) + __pyx_t_21 * __pyx_v_particle_paths.strides[2]) ) + __pyx_t_22 * __pyx_v_particle_paths.strides[3]) )))));
5415 
5416             /* "dipy/tracking/localtrack.pyx":468
5417  *                         copy_point(&particle_paths[0, pp, ss, 0],
5418  *                                   &particle_paths[1, pp, ss, 0])
5419  *                         copy_point(&particle_dirs[0, pp, ss, 0],             # <<<<<<<<<<<<<<
5420  *                                   &particle_dirs[1, pp, ss, 0])
5421  *                     particle_stream_statuses[1, pp] = \
5422  */
5423             __pyx_t_22 = 0;
5424             __pyx_t_21 = __pyx_v_pp;
5425             __pyx_t_11 = __pyx_v_ss;
5426             __pyx_t_10 = 0;
5427 
5428             /* "dipy/tracking/localtrack.pyx":469
5429  *                                   &particle_paths[1, pp, ss, 0])
5430  *                         copy_point(&particle_dirs[0, pp, ss, 0],
5431  *                                   &particle_dirs[1, pp, ss, 0])             # <<<<<<<<<<<<<<
5432  *                     particle_stream_statuses[1, pp] = \
5433  *                             particle_stream_statuses[0, pp]
5434  */
5435             __pyx_t_9 = 1;
5436             __pyx_t_8 = __pyx_v_pp;
5437             __pyx_t_6 = __pyx_v_ss;
5438             __pyx_t_7 = 0;
5439 
5440             /* "dipy/tracking/localtrack.pyx":468
5441  *                         copy_point(&particle_paths[0, pp, ss, 0],
5442  *                                   &particle_paths[1, pp, ss, 0])
5443  *                         copy_point(&particle_dirs[0, pp, ss, 0],             # <<<<<<<<<<<<<<
5444  *                                   &particle_dirs[1, pp, ss, 0])
5445  *                     particle_stream_statuses[1, pp] = \
5446  */
5447             __pyx_f_4dipy_5utils_10fast_numpy_copy_point((&(*((__pyx_t_5numpy_float_t *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_dirs.data + __pyx_t_22 * __pyx_v_particle_dirs.strides[0]) ) + __pyx_t_21 * __pyx_v_particle_dirs.strides[1]) ) + __pyx_t_11 * __pyx_v_particle_dirs.strides[2]) ) + __pyx_t_10 * __pyx_v_particle_dirs.strides[3]) )))), (&(*((__pyx_t_5numpy_float_t *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_dirs.data + __pyx_t_9 * __pyx_v_particle_dirs.strides[0]) ) + __pyx_t_8 * __pyx_v_particle_dirs.strides[1]) ) + __pyx_t_6 * __pyx_v_particle_dirs.strides[2]) ) + __pyx_t_7 * __pyx_v_particle_dirs.strides[3]) )))));
5448           }
5449 
5450           /* "dipy/tracking/localtrack.pyx":471
5451  *                                   &particle_dirs[1, pp, ss, 0])
5452  *                     particle_stream_statuses[1, pp] = \
5453  *                             particle_stream_statuses[0, pp]             # <<<<<<<<<<<<<<
5454  *                     particle_steps[1, pp] = particle_steps[0, pp]
5455  *
5456  */
5457           __pyx_t_7 = 0;
5458           __pyx_t_6 = __pyx_v_pp;
5459 
5460           /* "dipy/tracking/localtrack.pyx":470
5461  *                         copy_point(&particle_dirs[0, pp, ss, 0],
5462  *                                   &particle_dirs[1, pp, ss, 0])
5463  *                     particle_stream_statuses[1, pp] = \             # <<<<<<<<<<<<<<
5464  *                             particle_stream_statuses[0, pp]
5465  *                     particle_steps[1, pp] = particle_steps[0, pp]
5466  */
5467           __pyx_t_8 = 1;
5468           __pyx_t_9 = __pyx_v_pp;
5469           *((__pyx_t_5numpy_int_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_stream_statuses.data + __pyx_t_8 * __pyx_v_particle_stream_statuses.strides[0]) ) + __pyx_t_9 * __pyx_v_particle_stream_statuses.strides[1]) )) = (*((__pyx_t_5numpy_int_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_stream_statuses.data + __pyx_t_7 * __pyx_v_particle_stream_statuses.strides[0]) ) + __pyx_t_6 * __pyx_v_particle_stream_statuses.strides[1]) )));
5470 
5471           /* "dipy/tracking/localtrack.pyx":472
5472  *                     particle_stream_statuses[1, pp] = \
5473  *                             particle_stream_statuses[0, pp]
5474  *                     particle_steps[1, pp] = particle_steps[0, pp]             # <<<<<<<<<<<<<<
5475  *
5476  *                 # sample N new particle
5477  */
5478           __pyx_t_6 = 0;
5479           __pyx_t_7 = __pyx_v_pp;
5480           __pyx_t_9 = 1;
5481           __pyx_t_8 = __pyx_v_pp;
5482           *((__pyx_t_5numpy_int_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_steps.data + __pyx_t_9 * __pyx_v_particle_steps.strides[0]) ) + __pyx_t_8 * __pyx_v_particle_steps.strides[1]) )) = (*((__pyx_t_5numpy_int_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_steps.data + __pyx_t_6 * __pyx_v_particle_steps.strides[0]) ) + __pyx_t_7 * __pyx_v_particle_steps.strides[1]) )));
5483         }
5484 
5485         /* "dipy/tracking/localtrack.pyx":475
5486  *
5487  *                 # sample N new particle
5488  *                 cumsum(&particle_weights[0],             # <<<<<<<<<<<<<<
5489  *                        &particle_weights[0],
5490  *                        particle_count)
5491  */
5492         __pyx_t_7 = 0;
5493 
5494         /* "dipy/tracking/localtrack.pyx":476
5495  *                 # sample N new particle
5496  *                 cumsum(&particle_weights[0],
5497  *                        &particle_weights[0],             # <<<<<<<<<<<<<<
5498  *                        particle_count)
5499  *                 for pp in range(particle_count):
5500  */
5501         __pyx_t_6 = 0;
5502 
5503         /* "dipy/tracking/localtrack.pyx":475
5504  *
5505  *                 # sample N new particle
5506  *                 cumsum(&particle_weights[0],             # <<<<<<<<<<<<<<
5507  *                        &particle_weights[0],
5508  *                        particle_count)
5509  */
5510         __pyx_f_4dipy_5utils_10fast_numpy_cumsum((&(*((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_particle_weights.data + __pyx_t_7 * __pyx_v_particle_weights.strides[0]) )))), (&(*((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_particle_weights.data + __pyx_t_6 * __pyx_v_particle_weights.strides[0]) )))), __pyx_v_particle_count);
5511 
5512         /* "dipy/tracking/localtrack.pyx":478
5513  *                        &particle_weights[0],
5514  *                        particle_count)
5515  *                 for pp in range(particle_count):             # <<<<<<<<<<<<<<
5516  *                     rdm_sample = random() * particle_weights[particle_count - 1]
5517  *                     p_source = where_to_insert(&particle_weights[0],
5518  */
5519         __pyx_t_12 = __pyx_v_particle_count;
5520         __pyx_t_13 = __pyx_t_12;
5521         for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
5522           __pyx_v_pp = __pyx_t_14;
5523 
5524           /* "dipy/tracking/localtrack.pyx":479
5525  *                        particle_count)
5526  *                 for pp in range(particle_count):
5527  *                     rdm_sample = random() * particle_weights[particle_count - 1]             # <<<<<<<<<<<<<<
5528  *                     p_source = where_to_insert(&particle_weights[0],
5529  *                                                rdm_sample,
5530  */
5531           __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_random); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 479, __pyx_L1_error)
5532           __Pyx_GOTREF(__pyx_t_2);
5533           __pyx_t_23 = NULL;
5534           if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
5535             __pyx_t_23 = PyMethod_GET_SELF(__pyx_t_2);
5536             if (likely(__pyx_t_23)) {
5537               PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5538               __Pyx_INCREF(__pyx_t_23);
5539               __Pyx_INCREF(function);
5540               __Pyx_DECREF_SET(__pyx_t_2, function);
5541             }
5542           }
5543           __pyx_t_16 = (__pyx_t_23) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_23) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
5544           __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
5545           if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 479, __pyx_L1_error)
5546           __Pyx_GOTREF(__pyx_t_16);
5547           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5548           __pyx_t_6 = (__pyx_v_particle_count - 1);
5549           __pyx_t_2 = PyFloat_FromDouble((*((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_particle_weights.data + __pyx_t_6 * __pyx_v_particle_weights.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 479, __pyx_L1_error)
5550           __Pyx_GOTREF(__pyx_t_2);
5551           __pyx_t_23 = PyNumber_Multiply(__pyx_t_16, __pyx_t_2); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 479, __pyx_L1_error)
5552           __Pyx_GOTREF(__pyx_t_23);
5553           __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
5554           __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5555           __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_23); if (unlikely((__pyx_t_24 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 479, __pyx_L1_error)
5556           __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
5557           __pyx_v_rdm_sample = __pyx_t_24;
5558 
5559           /* "dipy/tracking/localtrack.pyx":480
5560  *                 for pp in range(particle_count):
5561  *                     rdm_sample = random() * particle_weights[particle_count - 1]
5562  *                     p_source = where_to_insert(&particle_weights[0],             # <<<<<<<<<<<<<<
5563  *                                                rdm_sample,
5564  *                                                particle_count)
5565  */
5566           __pyx_t_6 = 0;
5567 
5568           /* "dipy/tracking/localtrack.pyx":482
5569  *                     p_source = where_to_insert(&particle_weights[0],
5570  *                                                rdm_sample,
5571  *                                                particle_count)             # <<<<<<<<<<<<<<
5572  *                     for ss in range(pft_nbr_steps):
5573  *                         copy_point(&particle_paths[1, p_source, ss, 0],
5574  */
5575           __pyx_v_p_source = __pyx_f_4dipy_5utils_10fast_numpy_where_to_insert((&(*((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_particle_weights.data + __pyx_t_6 * __pyx_v_particle_weights.strides[0]) )))), __pyx_v_rdm_sample, __pyx_v_particle_count);
5576 
5577           /* "dipy/tracking/localtrack.pyx":483
5578  *                                                rdm_sample,
5579  *                                                particle_count)
5580  *                     for ss in range(pft_nbr_steps):             # <<<<<<<<<<<<<<
5581  *                         copy_point(&particle_paths[1, p_source, ss, 0],
5582  *                                   &particle_paths[0, pp, ss, 0])
5583  */
5584           __pyx_t_15 = __pyx_v_pft_nbr_steps;
5585           __pyx_t_19 = __pyx_t_15;
5586           for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
5587             __pyx_v_ss = __pyx_t_20;
5588 
5589             /* "dipy/tracking/localtrack.pyx":484
5590  *                                                particle_count)
5591  *                     for ss in range(pft_nbr_steps):
5592  *                         copy_point(&particle_paths[1, p_source, ss, 0],             # <<<<<<<<<<<<<<
5593  *                                   &particle_paths[0, pp, ss, 0])
5594  *                         copy_point(&particle_dirs[1, p_source, ss, 0],
5595  */
5596             __pyx_t_6 = 1;
5597             __pyx_t_7 = __pyx_v_p_source;
5598             __pyx_t_8 = __pyx_v_ss;
5599             __pyx_t_9 = 0;
5600 
5601             /* "dipy/tracking/localtrack.pyx":485
5602  *                     for ss in range(pft_nbr_steps):
5603  *                         copy_point(&particle_paths[1, p_source, ss, 0],
5604  *                                   &particle_paths[0, pp, ss, 0])             # <<<<<<<<<<<<<<
5605  *                         copy_point(&particle_dirs[1, p_source, ss, 0],
5606  *                                   &particle_dirs[0, pp, ss, 0])
5607  */
5608             __pyx_t_10 = 0;
5609             __pyx_t_11 = __pyx_v_pp;
5610             __pyx_t_21 = __pyx_v_ss;
5611             __pyx_t_22 = 0;
5612 
5613             /* "dipy/tracking/localtrack.pyx":484
5614  *                                                particle_count)
5615  *                     for ss in range(pft_nbr_steps):
5616  *                         copy_point(&particle_paths[1, p_source, ss, 0],             # <<<<<<<<<<<<<<
5617  *                                   &particle_paths[0, pp, ss, 0])
5618  *                         copy_point(&particle_dirs[1, p_source, ss, 0],
5619  */
5620             __pyx_f_4dipy_5utils_10fast_numpy_copy_point((&(*((__pyx_t_5numpy_float_t *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_paths.data + __pyx_t_6 * __pyx_v_particle_paths.strides[0]) ) + __pyx_t_7 * __pyx_v_particle_paths.strides[1]) ) + __pyx_t_8 * __pyx_v_particle_paths.strides[2]) ) + __pyx_t_9 * __pyx_v_particle_paths.strides[3]) )))), (&(*((__pyx_t_5numpy_float_t *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_paths.data + __pyx_t_10 * __pyx_v_particle_paths.strides[0]) ) + __pyx_t_11 * __pyx_v_particle_paths.strides[1]) ) + __pyx_t_21 * __pyx_v_particle_paths.strides[2]) ) + __pyx_t_22 * __pyx_v_particle_paths.strides[3]) )))));
5621 
5622             /* "dipy/tracking/localtrack.pyx":486
5623  *                         copy_point(&particle_paths[1, p_source, ss, 0],
5624  *                                   &particle_paths[0, pp, ss, 0])
5625  *                         copy_point(&particle_dirs[1, p_source, ss, 0],             # <<<<<<<<<<<<<<
5626  *                                   &particle_dirs[0, pp, ss, 0])
5627  *                     particle_stream_statuses[0, pp] = \
5628  */
5629             __pyx_t_22 = 1;
5630             __pyx_t_21 = __pyx_v_p_source;
5631             __pyx_t_11 = __pyx_v_ss;
5632             __pyx_t_10 = 0;
5633 
5634             /* "dipy/tracking/localtrack.pyx":487
5635  *                                   &particle_paths[0, pp, ss, 0])
5636  *                         copy_point(&particle_dirs[1, p_source, ss, 0],
5637  *                                   &particle_dirs[0, pp, ss, 0])             # <<<<<<<<<<<<<<
5638  *                     particle_stream_statuses[0, pp] = \
5639  *                             particle_stream_statuses[1, p_source]
5640  */
5641             __pyx_t_9 = 0;
5642             __pyx_t_8 = __pyx_v_pp;
5643             __pyx_t_7 = __pyx_v_ss;
5644             __pyx_t_6 = 0;
5645 
5646             /* "dipy/tracking/localtrack.pyx":486
5647  *                         copy_point(&particle_paths[1, p_source, ss, 0],
5648  *                                   &particle_paths[0, pp, ss, 0])
5649  *                         copy_point(&particle_dirs[1, p_source, ss, 0],             # <<<<<<<<<<<<<<
5650  *                                   &particle_dirs[0, pp, ss, 0])
5651  *                     particle_stream_statuses[0, pp] = \
5652  */
5653             __pyx_f_4dipy_5utils_10fast_numpy_copy_point((&(*((__pyx_t_5numpy_float_t *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_dirs.data + __pyx_t_22 * __pyx_v_particle_dirs.strides[0]) ) + __pyx_t_21 * __pyx_v_particle_dirs.strides[1]) ) + __pyx_t_11 * __pyx_v_particle_dirs.strides[2]) ) + __pyx_t_10 * __pyx_v_particle_dirs.strides[3]) )))), (&(*((__pyx_t_5numpy_float_t *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_dirs.data + __pyx_t_9 * __pyx_v_particle_dirs.strides[0]) ) + __pyx_t_8 * __pyx_v_particle_dirs.strides[1]) ) + __pyx_t_7 * __pyx_v_particle_dirs.strides[2]) ) + __pyx_t_6 * __pyx_v_particle_dirs.strides[3]) )))));
5654           }
5655 
5656           /* "dipy/tracking/localtrack.pyx":489
5657  *                                   &particle_dirs[0, pp, ss, 0])
5658  *                     particle_stream_statuses[0, pp] = \
5659  *                             particle_stream_statuses[1, p_source]             # <<<<<<<<<<<<<<
5660  *                     particle_steps[0, pp] = particle_steps[1, p_source]
5661  *                 for pp in range(particle_count):
5662  */
5663           __pyx_t_6 = 1;
5664           __pyx_t_7 = __pyx_v_p_source;
5665 
5666           /* "dipy/tracking/localtrack.pyx":488
5667  *                         copy_point(&particle_dirs[1, p_source, ss, 0],
5668  *                                   &particle_dirs[0, pp, ss, 0])
5669  *                     particle_stream_statuses[0, pp] = \             # <<<<<<<<<<<<<<
5670  *                             particle_stream_statuses[1, p_source]
5671  *                     particle_steps[0, pp] = particle_steps[1, p_source]
5672  */
5673           __pyx_t_8 = 0;
5674           __pyx_t_9 = __pyx_v_pp;
5675           *((__pyx_t_5numpy_int_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_stream_statuses.data + __pyx_t_8 * __pyx_v_particle_stream_statuses.strides[0]) ) + __pyx_t_9 * __pyx_v_particle_stream_statuses.strides[1]) )) = (*((__pyx_t_5numpy_int_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_stream_statuses.data + __pyx_t_6 * __pyx_v_particle_stream_statuses.strides[0]) ) + __pyx_t_7 * __pyx_v_particle_stream_statuses.strides[1]) )));
5676 
5677           /* "dipy/tracking/localtrack.pyx":490
5678  *                     particle_stream_statuses[0, pp] = \
5679  *                             particle_stream_statuses[1, p_source]
5680  *                     particle_steps[0, pp] = particle_steps[1, p_source]             # <<<<<<<<<<<<<<
5681  *                 for pp in range(particle_count):
5682  *                     particle_weights[pp] = 1. / particle_count
5683  */
5684           __pyx_t_7 = 1;
5685           __pyx_t_6 = __pyx_v_p_source;
5686           __pyx_t_9 = 0;
5687           __pyx_t_8 = __pyx_v_pp;
5688           *((__pyx_t_5numpy_int_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_steps.data + __pyx_t_9 * __pyx_v_particle_steps.strides[0]) ) + __pyx_t_8 * __pyx_v_particle_steps.strides[1]) )) = (*((__pyx_t_5numpy_int_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_steps.data + __pyx_t_7 * __pyx_v_particle_steps.strides[0]) ) + __pyx_t_6 * __pyx_v_particle_steps.strides[1]) )));
5689         }
5690 
5691         /* "dipy/tracking/localtrack.pyx":491
5692  *                             particle_stream_statuses[1, p_source]
5693  *                     particle_steps[0, pp] = particle_steps[1, p_source]
5694  *                 for pp in range(particle_count):             # <<<<<<<<<<<<<<
5695  *                     particle_weights[pp] = 1. / particle_count
5696  *
5697  */
5698         __pyx_t_12 = __pyx_v_particle_count;
5699         __pyx_t_13 = __pyx_t_12;
5700         for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
5701           __pyx_v_pp = __pyx_t_14;
5702 
5703           /* "dipy/tracking/localtrack.pyx":492
5704  *                     particle_steps[0, pp] = particle_steps[1, p_source]
5705  *                 for pp in range(particle_count):
5706  *                     particle_weights[pp] = 1. / particle_count             # <<<<<<<<<<<<<<
5707  *
5708  *     # update the streamline with the trajectory of one particle
5709  */
5710           __pyx_t_6 = __pyx_v_pp;
5711           *((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_particle_weights.data + __pyx_t_6 * __pyx_v_particle_weights.strides[0]) )) = (1. / ((double)__pyx_v_particle_count));
5712         }
5713 
5714         /* "dipy/tracking/localtrack.pyx":462
5715  *             # those with high weights through resampling
5716  *             N_effective = 1. / sum_squared
5717  *             if N_effective < particle_count / 10.:             # <<<<<<<<<<<<<<
5718  *                 # copy data in the temp arrays
5719  *                 for pp in range(particle_count):
5720  */
5721       }
5722 
5723       /* "dipy/tracking/localtrack.pyx":452
5724  *             sum_weights += particle_weights[p]
5725  *
5726  *         if sum_weights > 0:             # <<<<<<<<<<<<<<
5727  *             sum_squared = 0
5728  *             for p in range(particle_count):
5729  */
5730     }
5731   }
5732 
5733   /* "dipy/tracking/localtrack.pyx":495
5734  *
5735  *     # update the streamline with the trajectory of one particle
5736  *     cumsum(&particle_weights[0],             # <<<<<<<<<<<<<<
5737  *            &particle_weights[0],
5738  *            particle_count)
5739  */
5740   __pyx_t_6 = 0;
5741 
5742   /* "dipy/tracking/localtrack.pyx":496
5743  *     # update the streamline with the trajectory of one particle
5744  *     cumsum(&particle_weights[0],
5745  *            &particle_weights[0],             # <<<<<<<<<<<<<<
5746  *            particle_count)
5747  *     if particle_weights[particle_count - 1] > 0:
5748  */
5749   __pyx_t_7 = 0;
5750 
5751   /* "dipy/tracking/localtrack.pyx":495
5752  *
5753  *     # update the streamline with the trajectory of one particle
5754  *     cumsum(&particle_weights[0],             # <<<<<<<<<<<<<<
5755  *            &particle_weights[0],
5756  *            particle_count)
5757  */
5758   __pyx_f_4dipy_5utils_10fast_numpy_cumsum((&(*((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_particle_weights.data + __pyx_t_6 * __pyx_v_particle_weights.strides[0]) )))), (&(*((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_particle_weights.data + __pyx_t_7 * __pyx_v_particle_weights.strides[0]) )))), __pyx_v_particle_count);
5759 
5760   /* "dipy/tracking/localtrack.pyx":498
5761  *            &particle_weights[0],
5762  *            particle_count)
5763  *     if particle_weights[particle_count - 1] > 0:             # <<<<<<<<<<<<<<
5764  *         rdm_sample = random() * particle_weights[particle_count - 1]
5765  *         p = where_to_insert(&particle_weights[0], rdm_sample, particle_count)
5766  */
5767   __pyx_t_7 = (__pyx_v_particle_count - 1);
5768   __pyx_t_1 = (((*((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_particle_weights.data + __pyx_t_7 * __pyx_v_particle_weights.strides[0]) ))) > 0.0) != 0);
5769   if (__pyx_t_1) {
5770 
5771     /* "dipy/tracking/localtrack.pyx":499
5772  *            particle_count)
5773  *     if particle_weights[particle_count - 1] > 0:
5774  *         rdm_sample = random() * particle_weights[particle_count - 1]             # <<<<<<<<<<<<<<
5775  *         p = where_to_insert(&particle_weights[0], rdm_sample, particle_count)
5776  *     else:
5777  */
5778     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_random); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 499, __pyx_L1_error)
5779     __Pyx_GOTREF(__pyx_t_2);
5780     __pyx_t_16 = NULL;
5781     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
5782       __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_2);
5783       if (likely(__pyx_t_16)) {
5784         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5785         __Pyx_INCREF(__pyx_t_16);
5786         __Pyx_INCREF(function);
5787         __Pyx_DECREF_SET(__pyx_t_2, function);
5788       }
5789     }
5790     __pyx_t_23 = (__pyx_t_16) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_16) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
5791     __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
5792     if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 499, __pyx_L1_error)
5793     __Pyx_GOTREF(__pyx_t_23);
5794     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5795     __pyx_t_7 = (__pyx_v_particle_count - 1);
5796     __pyx_t_2 = PyFloat_FromDouble((*((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_particle_weights.data + __pyx_t_7 * __pyx_v_particle_weights.strides[0]) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 499, __pyx_L1_error)
5797     __Pyx_GOTREF(__pyx_t_2);
5798     __pyx_t_16 = PyNumber_Multiply(__pyx_t_23, __pyx_t_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 499, __pyx_L1_error)
5799     __Pyx_GOTREF(__pyx_t_16);
5800     __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
5801     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5802     __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_16); if (unlikely((__pyx_t_24 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 499, __pyx_L1_error)
5803     __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
5804     __pyx_v_rdm_sample = __pyx_t_24;
5805 
5806     /* "dipy/tracking/localtrack.pyx":500
5807  *     if particle_weights[particle_count - 1] > 0:
5808  *         rdm_sample = random() * particle_weights[particle_count - 1]
5809  *         p = where_to_insert(&particle_weights[0], rdm_sample, particle_count)             # <<<<<<<<<<<<<<
5810  *     else:
5811  *         p = 0
5812  */
5813     __pyx_t_7 = 0;
5814     __pyx_v_p = __pyx_f_4dipy_5utils_10fast_numpy_where_to_insert((&(*((__pyx_t_5numpy_float_t *) ( /* dim=0 */ (__pyx_v_particle_weights.data + __pyx_t_7 * __pyx_v_particle_weights.strides[0]) )))), __pyx_v_rdm_sample, __pyx_v_particle_count);
5815 
5816     /* "dipy/tracking/localtrack.pyx":498
5817  *            &particle_weights[0],
5818  *            particle_count)
5819  *     if particle_weights[particle_count - 1] > 0:             # <<<<<<<<<<<<<<
5820  *         rdm_sample = random() * particle_weights[particle_count - 1]
5821  *         p = where_to_insert(&particle_weights[0], rdm_sample, particle_count)
5822  */
5823     goto __pyx_L36;
5824   }
5825 
5826   /* "dipy/tracking/localtrack.pyx":502
5827  *         p = where_to_insert(&particle_weights[0], rdm_sample, particle_count)
5828  *     else:
5829  *         p = 0             # <<<<<<<<<<<<<<
5830  *
5831  *     for s in range(1, particle_steps[0, p]):
5832  */
5833   /*else*/ {
5834     __pyx_v_p = 0;
5835   }
5836   __pyx_L36:;
5837 
5838   /* "dipy/tracking/localtrack.pyx":504
5839  *         p = 0
5840  *
5841  *     for s in range(1, particle_steps[0, p]):             # <<<<<<<<<<<<<<
5842  *         copy_point(&particle_paths[0, p, s, 0],
5843  *                    &streamline[streamline_i + s, 0])
5844  */
5845   __pyx_t_7 = 0;
5846   __pyx_t_6 = __pyx_v_p;
5847   __pyx_t_25 = (*((__pyx_t_5numpy_int_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_steps.data + __pyx_t_7 * __pyx_v_particle_steps.strides[0]) ) + __pyx_t_6 * __pyx_v_particle_steps.strides[1]) )));
5848   __pyx_t_26 = __pyx_t_25;
5849   for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_26; __pyx_t_3+=1) {
5850     __pyx_v_s = __pyx_t_3;
5851 
5852     /* "dipy/tracking/localtrack.pyx":505
5853  *
5854  *     for s in range(1, particle_steps[0, p]):
5855  *         copy_point(&particle_paths[0, p, s, 0],             # <<<<<<<<<<<<<<
5856  *                    &streamline[streamline_i + s, 0])
5857  *         copy_point(&particle_dirs[0, p, s, 0], &directions[streamline_i + s, 0])
5858  */
5859     __pyx_t_6 = 0;
5860     __pyx_t_7 = __pyx_v_p;
5861     __pyx_t_8 = __pyx_v_s;
5862     __pyx_t_9 = 0;
5863 
5864     /* "dipy/tracking/localtrack.pyx":506
5865  *     for s in range(1, particle_steps[0, p]):
5866  *         copy_point(&particle_paths[0, p, s, 0],
5867  *                    &streamline[streamline_i + s, 0])             # <<<<<<<<<<<<<<
5868  *         copy_point(&particle_dirs[0, p, s, 0], &directions[streamline_i + s, 0])
5869  *     stream_status[0] = <StreamlineStatus> particle_stream_statuses[0, p]
5870  */
5871     __pyx_t_10 = (__pyx_v_streamline_i + __pyx_v_s);
5872     __pyx_t_11 = 0;
5873 
5874     /* "dipy/tracking/localtrack.pyx":505
5875  *
5876  *     for s in range(1, particle_steps[0, p]):
5877  *         copy_point(&particle_paths[0, p, s, 0],             # <<<<<<<<<<<<<<
5878  *                    &streamline[streamline_i + s, 0])
5879  *         copy_point(&particle_dirs[0, p, s, 0], &directions[streamline_i + s, 0])
5880  */
5881     __pyx_f_4dipy_5utils_10fast_numpy_copy_point((&(*((__pyx_t_5numpy_float_t *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_paths.data + __pyx_t_6 * __pyx_v_particle_paths.strides[0]) ) + __pyx_t_7 * __pyx_v_particle_paths.strides[1]) ) + __pyx_t_8 * __pyx_v_particle_paths.strides[2]) ) + __pyx_t_9 * __pyx_v_particle_paths.strides[3]) )))), (&(*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_streamline.data + __pyx_t_10 * __pyx_v_streamline.strides[0]) ) + __pyx_t_11 * __pyx_v_streamline.strides[1]) )))));
5882 
5883     /* "dipy/tracking/localtrack.pyx":507
5884  *         copy_point(&particle_paths[0, p, s, 0],
5885  *                    &streamline[streamline_i + s, 0])
5886  *         copy_point(&particle_dirs[0, p, s, 0], &directions[streamline_i + s, 0])             # <<<<<<<<<<<<<<
5887  *     stream_status[0] = <StreamlineStatus> particle_stream_statuses[0, p]
5888  *     return streamline_i + particle_steps[0, p]
5889  */
5890     __pyx_t_11 = 0;
5891     __pyx_t_10 = __pyx_v_p;
5892     __pyx_t_9 = __pyx_v_s;
5893     __pyx_t_8 = 0;
5894     __pyx_t_7 = (__pyx_v_streamline_i + __pyx_v_s);
5895     __pyx_t_6 = 0;
5896     __pyx_f_4dipy_5utils_10fast_numpy_copy_point((&(*((__pyx_t_5numpy_float_t *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_dirs.data + __pyx_t_11 * __pyx_v_particle_dirs.strides[0]) ) + __pyx_t_10 * __pyx_v_particle_dirs.strides[1]) ) + __pyx_t_9 * __pyx_v_particle_dirs.strides[2]) ) + __pyx_t_8 * __pyx_v_particle_dirs.strides[3]) )))), (&(*((__pyx_t_5numpy_float_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_directions.data + __pyx_t_7 * __pyx_v_directions.strides[0]) ) + __pyx_t_6 * __pyx_v_directions.strides[1]) )))));
5897   }
5898 
5899   /* "dipy/tracking/localtrack.pyx":508
5900  *                    &streamline[streamline_i + s, 0])
5901  *         copy_point(&particle_dirs[0, p, s, 0], &directions[streamline_i + s, 0])
5902  *     stream_status[0] = <StreamlineStatus> particle_stream_statuses[0, p]             # <<<<<<<<<<<<<<
5903  *     return streamline_i + particle_steps[0, p]
5904  */
5905   __pyx_t_6 = 0;
5906   __pyx_t_7 = __pyx_v_p;
5907   (__pyx_v_stream_status[0]) = ((enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus)(*((__pyx_t_5numpy_int_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_stream_statuses.data + __pyx_t_6 * __pyx_v_particle_stream_statuses.strides[0]) ) + __pyx_t_7 * __pyx_v_particle_stream_statuses.strides[1]) ))));
5908 
5909   /* "dipy/tracking/localtrack.pyx":509
5910  *         copy_point(&particle_dirs[0, p, s, 0], &directions[streamline_i + s, 0])
5911  *     stream_status[0] = <StreamlineStatus> particle_stream_statuses[0, p]
5912  *     return streamline_i + particle_steps[0, p]             # <<<<<<<<<<<<<<
5913  */
5914   __Pyx_XDECREF(__pyx_r);
5915   __pyx_t_7 = 0;
5916   __pyx_t_6 = __pyx_v_p;
5917   __pyx_t_16 = __Pyx_PyInt_From_npy_long((__pyx_v_streamline_i + (*((__pyx_t_5numpy_int_t *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_particle_steps.data + __pyx_t_7 * __pyx_v_particle_steps.strides[0]) ) + __pyx_t_6 * __pyx_v_particle_steps.strides[1]) ))))); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 509, __pyx_L1_error)
5918   __Pyx_GOTREF(__pyx_t_16);
5919   __pyx_r = __pyx_t_16;
5920   __pyx_t_16 = 0;
5921   goto __pyx_L0;
5922 
5923   /* "dipy/tracking/localtrack.pyx":387
5924  * @cython.wraparound(False)
5925  * @cython.cdivision(True)
5926  * cdef _pft(cnp.float_t[:, :] streamline,             # <<<<<<<<<<<<<<
5927  *           int streamline_i,
5928  *           cnp.float_t[:, :] directions,
5929  */
5930 
5931   /* function exit code */
5932   __pyx_L1_error:;
5933   __Pyx_XDECREF(__pyx_t_2);
5934   __Pyx_XDECREF(__pyx_t_16);
5935   __Pyx_XDECREF(__pyx_t_23);
5936   __Pyx_AddTraceback("dipy.tracking.localtrack._pft", __pyx_clineno, __pyx_lineno, __pyx_filename);
5937   __pyx_r = 0;
5938   __pyx_L0:;
5939   __Pyx_XGIVEREF(__pyx_r);
5940   __Pyx_RefNannyFinishContext();
5941   return __pyx_r;
5942 }
5943 
5944 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":735
5945  * ctypedef npy_cdouble     complex_t
5946  *
5947  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
5948  *     return PyArray_MultiIterNew(1, <void*>a)
5949  *
5950  */
5951 
__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject * __pyx_v_a)5952 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
5953   PyObject *__pyx_r = NULL;
5954   __Pyx_RefNannyDeclarations
5955   PyObject *__pyx_t_1 = NULL;
5956   int __pyx_lineno = 0;
5957   const char *__pyx_filename = NULL;
5958   int __pyx_clineno = 0;
5959   __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
5960 
5961   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":736
5962  *
5963  * cdef inline object PyArray_MultiIterNew1(a):
5964  *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
5965  *
5966  * cdef inline object PyArray_MultiIterNew2(a, b):
5967  */
5968   __Pyx_XDECREF(__pyx_r);
5969   __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 736, __pyx_L1_error)
5970   __Pyx_GOTREF(__pyx_t_1);
5971   __pyx_r = __pyx_t_1;
5972   __pyx_t_1 = 0;
5973   goto __pyx_L0;
5974 
5975   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":735
5976  * ctypedef npy_cdouble     complex_t
5977  *
5978  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
5979  *     return PyArray_MultiIterNew(1, <void*>a)
5980  *
5981  */
5982 
5983   /* function exit code */
5984   __pyx_L1_error:;
5985   __Pyx_XDECREF(__pyx_t_1);
5986   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
5987   __pyx_r = 0;
5988   __pyx_L0:;
5989   __Pyx_XGIVEREF(__pyx_r);
5990   __Pyx_RefNannyFinishContext();
5991   return __pyx_r;
5992 }
5993 
5994 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":738
5995  *     return PyArray_MultiIterNew(1, <void*>a)
5996  *
5997  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
5998  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
5999  *
6000  */
6001 
__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject * __pyx_v_a,PyObject * __pyx_v_b)6002 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
6003   PyObject *__pyx_r = NULL;
6004   __Pyx_RefNannyDeclarations
6005   PyObject *__pyx_t_1 = NULL;
6006   int __pyx_lineno = 0;
6007   const char *__pyx_filename = NULL;
6008   int __pyx_clineno = 0;
6009   __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
6010 
6011   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":739
6012  *
6013  * cdef inline object PyArray_MultiIterNew2(a, b):
6014  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
6015  *
6016  * cdef inline object PyArray_MultiIterNew3(a, b, c):
6017  */
6018   __Pyx_XDECREF(__pyx_r);
6019   __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 739, __pyx_L1_error)
6020   __Pyx_GOTREF(__pyx_t_1);
6021   __pyx_r = __pyx_t_1;
6022   __pyx_t_1 = 0;
6023   goto __pyx_L0;
6024 
6025   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":738
6026  *     return PyArray_MultiIterNew(1, <void*>a)
6027  *
6028  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
6029  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6030  *
6031  */
6032 
6033   /* function exit code */
6034   __pyx_L1_error:;
6035   __Pyx_XDECREF(__pyx_t_1);
6036   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
6037   __pyx_r = 0;
6038   __pyx_L0:;
6039   __Pyx_XGIVEREF(__pyx_r);
6040   __Pyx_RefNannyFinishContext();
6041   return __pyx_r;
6042 }
6043 
6044 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":741
6045  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6046  *
6047  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
6048  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6049  *
6050  */
6051 
__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c)6052 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
6053   PyObject *__pyx_r = NULL;
6054   __Pyx_RefNannyDeclarations
6055   PyObject *__pyx_t_1 = NULL;
6056   int __pyx_lineno = 0;
6057   const char *__pyx_filename = NULL;
6058   int __pyx_clineno = 0;
6059   __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
6060 
6061   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":742
6062  *
6063  * cdef inline object PyArray_MultiIterNew3(a, b, c):
6064  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
6065  *
6066  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
6067  */
6068   __Pyx_XDECREF(__pyx_r);
6069   __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, 742, __pyx_L1_error)
6070   __Pyx_GOTREF(__pyx_t_1);
6071   __pyx_r = __pyx_t_1;
6072   __pyx_t_1 = 0;
6073   goto __pyx_L0;
6074 
6075   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":741
6076  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6077  *
6078  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
6079  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6080  *
6081  */
6082 
6083   /* function exit code */
6084   __pyx_L1_error:;
6085   __Pyx_XDECREF(__pyx_t_1);
6086   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
6087   __pyx_r = 0;
6088   __pyx_L0:;
6089   __Pyx_XGIVEREF(__pyx_r);
6090   __Pyx_RefNannyFinishContext();
6091   return __pyx_r;
6092 }
6093 
6094 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":744
6095  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6096  *
6097  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
6098  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6099  *
6100  */
6101 
__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c,PyObject * __pyx_v_d)6102 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) {
6103   PyObject *__pyx_r = NULL;
6104   __Pyx_RefNannyDeclarations
6105   PyObject *__pyx_t_1 = NULL;
6106   int __pyx_lineno = 0;
6107   const char *__pyx_filename = NULL;
6108   int __pyx_clineno = 0;
6109   __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
6110 
6111   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":745
6112  *
6113  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
6114  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
6115  *
6116  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
6117  */
6118   __Pyx_XDECREF(__pyx_r);
6119   __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, 745, __pyx_L1_error)
6120   __Pyx_GOTREF(__pyx_t_1);
6121   __pyx_r = __pyx_t_1;
6122   __pyx_t_1 = 0;
6123   goto __pyx_L0;
6124 
6125   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":744
6126  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6127  *
6128  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
6129  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6130  *
6131  */
6132 
6133   /* function exit code */
6134   __pyx_L1_error:;
6135   __Pyx_XDECREF(__pyx_t_1);
6136   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
6137   __pyx_r = 0;
6138   __pyx_L0:;
6139   __Pyx_XGIVEREF(__pyx_r);
6140   __Pyx_RefNannyFinishContext();
6141   return __pyx_r;
6142 }
6143 
6144 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":747
6145  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6146  *
6147  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
6148  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6149  *
6150  */
6151 
__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)6152 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) {
6153   PyObject *__pyx_r = NULL;
6154   __Pyx_RefNannyDeclarations
6155   PyObject *__pyx_t_1 = NULL;
6156   int __pyx_lineno = 0;
6157   const char *__pyx_filename = NULL;
6158   int __pyx_clineno = 0;
6159   __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
6160 
6161   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":748
6162  *
6163  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
6164  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
6165  *
6166  * cdef inline tuple PyDataType_SHAPE(dtype d):
6167  */
6168   __Pyx_XDECREF(__pyx_r);
6169   __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, 748, __pyx_L1_error)
6170   __Pyx_GOTREF(__pyx_t_1);
6171   __pyx_r = __pyx_t_1;
6172   __pyx_t_1 = 0;
6173   goto __pyx_L0;
6174 
6175   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":747
6176  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6177  *
6178  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
6179  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6180  *
6181  */
6182 
6183   /* function exit code */
6184   __pyx_L1_error:;
6185   __Pyx_XDECREF(__pyx_t_1);
6186   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
6187   __pyx_r = 0;
6188   __pyx_L0:;
6189   __Pyx_XGIVEREF(__pyx_r);
6190   __Pyx_RefNannyFinishContext();
6191   return __pyx_r;
6192 }
6193 
6194 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":750
6195  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6196  *
6197  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
6198  *     if PyDataType_HASSUBARRAY(d):
6199  *         return <tuple>d.subarray.shape
6200  */
6201 
__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr * __pyx_v_d)6202 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
6203   PyObject *__pyx_r = NULL;
6204   __Pyx_RefNannyDeclarations
6205   int __pyx_t_1;
6206   __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
6207 
6208   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":751
6209  *
6210  * cdef inline tuple PyDataType_SHAPE(dtype d):
6211  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
6212  *         return <tuple>d.subarray.shape
6213  *     else:
6214  */
6215   __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
6216   if (__pyx_t_1) {
6217 
6218     /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":752
6219  * cdef inline tuple PyDataType_SHAPE(dtype d):
6220  *     if PyDataType_HASSUBARRAY(d):
6221  *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
6222  *     else:
6223  *         return ()
6224  */
6225     __Pyx_XDECREF(__pyx_r);
6226     __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
6227     __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
6228     goto __pyx_L0;
6229 
6230     /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":751
6231  *
6232  * cdef inline tuple PyDataType_SHAPE(dtype d):
6233  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
6234  *         return <tuple>d.subarray.shape
6235  *     else:
6236  */
6237   }
6238 
6239   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":754
6240  *         return <tuple>d.subarray.shape
6241  *     else:
6242  *         return ()             # <<<<<<<<<<<<<<
6243  *
6244  *
6245  */
6246   /*else*/ {
6247     __Pyx_XDECREF(__pyx_r);
6248     __Pyx_INCREF(__pyx_empty_tuple);
6249     __pyx_r = __pyx_empty_tuple;
6250     goto __pyx_L0;
6251   }
6252 
6253   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":750
6254  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6255  *
6256  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
6257  *     if PyDataType_HASSUBARRAY(d):
6258  *         return <tuple>d.subarray.shape
6259  */
6260 
6261   /* function exit code */
6262   __pyx_L0:;
6263   __Pyx_XGIVEREF(__pyx_r);
6264   __Pyx_RefNannyFinishContext();
6265   return __pyx_r;
6266 }
6267 
6268 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":931
6269  *     int _import_umath() except -1
6270  *
6271  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
6272  *     Py_INCREF(base) # important to do this before stealing the reference below!
6273  *     PyArray_SetBaseObject(arr, base)
6274  */
6275 
__pyx_f_5numpy_set_array_base(PyArrayObject * __pyx_v_arr,PyObject * __pyx_v_base)6276 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
6277   __Pyx_RefNannyDeclarations
6278   __Pyx_RefNannySetupContext("set_array_base", 0);
6279 
6280   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":932
6281  *
6282  * cdef inline void set_array_base(ndarray arr, object base):
6283  *     Py_INCREF(base) # important to do this before stealing the reference below!             # <<<<<<<<<<<<<<
6284  *     PyArray_SetBaseObject(arr, base)
6285  *
6286  */
6287   Py_INCREF(__pyx_v_base);
6288 
6289   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":933
6290  * cdef inline void set_array_base(ndarray arr, object base):
6291  *     Py_INCREF(base) # important to do this before stealing the reference below!
6292  *     PyArray_SetBaseObject(arr, base)             # <<<<<<<<<<<<<<
6293  *
6294  * cdef inline object get_array_base(ndarray arr):
6295  */
6296   (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
6297 
6298   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":931
6299  *     int _import_umath() except -1
6300  *
6301  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
6302  *     Py_INCREF(base) # important to do this before stealing the reference below!
6303  *     PyArray_SetBaseObject(arr, base)
6304  */
6305 
6306   /* function exit code */
6307   __Pyx_RefNannyFinishContext();
6308 }
6309 
6310 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":935
6311  *     PyArray_SetBaseObject(arr, base)
6312  *
6313  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
6314  *     base = PyArray_BASE(arr)
6315  *     if base is NULL:
6316  */
6317 
__pyx_f_5numpy_get_array_base(PyArrayObject * __pyx_v_arr)6318 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
6319   PyObject *__pyx_v_base;
6320   PyObject *__pyx_r = NULL;
6321   __Pyx_RefNannyDeclarations
6322   int __pyx_t_1;
6323   __Pyx_RefNannySetupContext("get_array_base", 0);
6324 
6325   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":936
6326  *
6327  * cdef inline object get_array_base(ndarray arr):
6328  *     base = PyArray_BASE(arr)             # <<<<<<<<<<<<<<
6329  *     if base is NULL:
6330  *         return None
6331  */
6332   __pyx_v_base = PyArray_BASE(__pyx_v_arr);
6333 
6334   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":937
6335  * cdef inline object get_array_base(ndarray arr):
6336  *     base = PyArray_BASE(arr)
6337  *     if base is NULL:             # <<<<<<<<<<<<<<
6338  *         return None
6339  *     return <object>base
6340  */
6341   __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
6342   if (__pyx_t_1) {
6343 
6344     /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":938
6345  *     base = PyArray_BASE(arr)
6346  *     if base is NULL:
6347  *         return None             # <<<<<<<<<<<<<<
6348  *     return <object>base
6349  *
6350  */
6351     __Pyx_XDECREF(__pyx_r);
6352     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6353     goto __pyx_L0;
6354 
6355     /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":937
6356  * cdef inline object get_array_base(ndarray arr):
6357  *     base = PyArray_BASE(arr)
6358  *     if base is NULL:             # <<<<<<<<<<<<<<
6359  *         return None
6360  *     return <object>base
6361  */
6362   }
6363 
6364   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":939
6365  *     if base is NULL:
6366  *         return None
6367  *     return <object>base             # <<<<<<<<<<<<<<
6368  *
6369  * # Versions of the import_* functions which are more suitable for
6370  */
6371   __Pyx_XDECREF(__pyx_r);
6372   __Pyx_INCREF(((PyObject *)__pyx_v_base));
6373   __pyx_r = ((PyObject *)__pyx_v_base);
6374   goto __pyx_L0;
6375 
6376   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":935
6377  *     PyArray_SetBaseObject(arr, base)
6378  *
6379  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
6380  *     base = PyArray_BASE(arr)
6381  *     if base is NULL:
6382  */
6383 
6384   /* function exit code */
6385   __pyx_L0:;
6386   __Pyx_XGIVEREF(__pyx_r);
6387   __Pyx_RefNannyFinishContext();
6388   return __pyx_r;
6389 }
6390 
6391 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":943
6392  * # Versions of the import_* functions which are more suitable for
6393  * # Cython code.
6394  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
6395  *     try:
6396  *         __pyx_import_array()
6397  */
6398 
__pyx_f_5numpy_import_array(void)6399 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
6400   int __pyx_r;
6401   __Pyx_RefNannyDeclarations
6402   PyObject *__pyx_t_1 = NULL;
6403   PyObject *__pyx_t_2 = NULL;
6404   PyObject *__pyx_t_3 = NULL;
6405   int __pyx_t_4;
6406   PyObject *__pyx_t_5 = NULL;
6407   PyObject *__pyx_t_6 = NULL;
6408   PyObject *__pyx_t_7 = NULL;
6409   PyObject *__pyx_t_8 = NULL;
6410   int __pyx_lineno = 0;
6411   const char *__pyx_filename = NULL;
6412   int __pyx_clineno = 0;
6413   __Pyx_RefNannySetupContext("import_array", 0);
6414 
6415   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":944
6416  * # Cython code.
6417  * cdef inline int import_array() except -1:
6418  *     try:             # <<<<<<<<<<<<<<
6419  *         __pyx_import_array()
6420  *     except Exception:
6421  */
6422   {
6423     __Pyx_PyThreadState_declare
6424     __Pyx_PyThreadState_assign
6425     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
6426     __Pyx_XGOTREF(__pyx_t_1);
6427     __Pyx_XGOTREF(__pyx_t_2);
6428     __Pyx_XGOTREF(__pyx_t_3);
6429     /*try:*/ {
6430 
6431       /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":945
6432  * cdef inline int import_array() except -1:
6433  *     try:
6434  *         __pyx_import_array()             # <<<<<<<<<<<<<<
6435  *     except Exception:
6436  *         raise ImportError("numpy.core.multiarray failed to import")
6437  */
6438       __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 945, __pyx_L3_error)
6439 
6440       /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":944
6441  * # Cython code.
6442  * cdef inline int import_array() except -1:
6443  *     try:             # <<<<<<<<<<<<<<
6444  *         __pyx_import_array()
6445  *     except Exception:
6446  */
6447     }
6448     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6449     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6450     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6451     goto __pyx_L8_try_end;
6452     __pyx_L3_error:;
6453 
6454     /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":946
6455  *     try:
6456  *         __pyx_import_array()
6457  *     except Exception:             # <<<<<<<<<<<<<<
6458  *         raise ImportError("numpy.core.multiarray failed to import")
6459  *
6460  */
6461     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
6462     if (__pyx_t_4) {
6463       __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
6464       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 946, __pyx_L5_except_error)
6465       __Pyx_GOTREF(__pyx_t_5);
6466       __Pyx_GOTREF(__pyx_t_6);
6467       __Pyx_GOTREF(__pyx_t_7);
6468 
6469       /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":947
6470  *         __pyx_import_array()
6471  *     except Exception:
6472  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
6473  *
6474  * cdef inline int import_umath() except -1:
6475  */
6476       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 947, __pyx_L5_except_error)
6477       __Pyx_GOTREF(__pyx_t_8);
6478       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
6479       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6480       __PYX_ERR(1, 947, __pyx_L5_except_error)
6481     }
6482     goto __pyx_L5_except_error;
6483     __pyx_L5_except_error:;
6484 
6485     /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":944
6486  * # Cython code.
6487  * cdef inline int import_array() except -1:
6488  *     try:             # <<<<<<<<<<<<<<
6489  *         __pyx_import_array()
6490  *     except Exception:
6491  */
6492     __Pyx_XGIVEREF(__pyx_t_1);
6493     __Pyx_XGIVEREF(__pyx_t_2);
6494     __Pyx_XGIVEREF(__pyx_t_3);
6495     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
6496     goto __pyx_L1_error;
6497     __pyx_L8_try_end:;
6498   }
6499 
6500   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":943
6501  * # Versions of the import_* functions which are more suitable for
6502  * # Cython code.
6503  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
6504  *     try:
6505  *         __pyx_import_array()
6506  */
6507 
6508   /* function exit code */
6509   __pyx_r = 0;
6510   goto __pyx_L0;
6511   __pyx_L1_error:;
6512   __Pyx_XDECREF(__pyx_t_5);
6513   __Pyx_XDECREF(__pyx_t_6);
6514   __Pyx_XDECREF(__pyx_t_7);
6515   __Pyx_XDECREF(__pyx_t_8);
6516   __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
6517   __pyx_r = -1;
6518   __pyx_L0:;
6519   __Pyx_RefNannyFinishContext();
6520   return __pyx_r;
6521 }
6522 
6523 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":949
6524  *         raise ImportError("numpy.core.multiarray failed to import")
6525  *
6526  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
6527  *     try:
6528  *         _import_umath()
6529  */
6530 
__pyx_f_5numpy_import_umath(void)6531 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
6532   int __pyx_r;
6533   __Pyx_RefNannyDeclarations
6534   PyObject *__pyx_t_1 = NULL;
6535   PyObject *__pyx_t_2 = NULL;
6536   PyObject *__pyx_t_3 = NULL;
6537   int __pyx_t_4;
6538   PyObject *__pyx_t_5 = NULL;
6539   PyObject *__pyx_t_6 = NULL;
6540   PyObject *__pyx_t_7 = NULL;
6541   PyObject *__pyx_t_8 = NULL;
6542   int __pyx_lineno = 0;
6543   const char *__pyx_filename = NULL;
6544   int __pyx_clineno = 0;
6545   __Pyx_RefNannySetupContext("import_umath", 0);
6546 
6547   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":950
6548  *
6549  * cdef inline int import_umath() except -1:
6550  *     try:             # <<<<<<<<<<<<<<
6551  *         _import_umath()
6552  *     except Exception:
6553  */
6554   {
6555     __Pyx_PyThreadState_declare
6556     __Pyx_PyThreadState_assign
6557     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
6558     __Pyx_XGOTREF(__pyx_t_1);
6559     __Pyx_XGOTREF(__pyx_t_2);
6560     __Pyx_XGOTREF(__pyx_t_3);
6561     /*try:*/ {
6562 
6563       /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":951
6564  * cdef inline int import_umath() except -1:
6565  *     try:
6566  *         _import_umath()             # <<<<<<<<<<<<<<
6567  *     except Exception:
6568  *         raise ImportError("numpy.core.umath failed to import")
6569  */
6570       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 951, __pyx_L3_error)
6571 
6572       /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":950
6573  *
6574  * cdef inline int import_umath() except -1:
6575  *     try:             # <<<<<<<<<<<<<<
6576  *         _import_umath()
6577  *     except Exception:
6578  */
6579     }
6580     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6581     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6582     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6583     goto __pyx_L8_try_end;
6584     __pyx_L3_error:;
6585 
6586     /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":952
6587  *     try:
6588  *         _import_umath()
6589  *     except Exception:             # <<<<<<<<<<<<<<
6590  *         raise ImportError("numpy.core.umath failed to import")
6591  *
6592  */
6593     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
6594     if (__pyx_t_4) {
6595       __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
6596       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 952, __pyx_L5_except_error)
6597       __Pyx_GOTREF(__pyx_t_5);
6598       __Pyx_GOTREF(__pyx_t_6);
6599       __Pyx_GOTREF(__pyx_t_7);
6600 
6601       /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":953
6602  *         _import_umath()
6603  *     except Exception:
6604  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
6605  *
6606  * cdef inline int import_ufunc() except -1:
6607  */
6608       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 953, __pyx_L5_except_error)
6609       __Pyx_GOTREF(__pyx_t_8);
6610       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
6611       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6612       __PYX_ERR(1, 953, __pyx_L5_except_error)
6613     }
6614     goto __pyx_L5_except_error;
6615     __pyx_L5_except_error:;
6616 
6617     /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":950
6618  *
6619  * cdef inline int import_umath() except -1:
6620  *     try:             # <<<<<<<<<<<<<<
6621  *         _import_umath()
6622  *     except Exception:
6623  */
6624     __Pyx_XGIVEREF(__pyx_t_1);
6625     __Pyx_XGIVEREF(__pyx_t_2);
6626     __Pyx_XGIVEREF(__pyx_t_3);
6627     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
6628     goto __pyx_L1_error;
6629     __pyx_L8_try_end:;
6630   }
6631 
6632   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":949
6633  *         raise ImportError("numpy.core.multiarray failed to import")
6634  *
6635  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
6636  *     try:
6637  *         _import_umath()
6638  */
6639 
6640   /* function exit code */
6641   __pyx_r = 0;
6642   goto __pyx_L0;
6643   __pyx_L1_error:;
6644   __Pyx_XDECREF(__pyx_t_5);
6645   __Pyx_XDECREF(__pyx_t_6);
6646   __Pyx_XDECREF(__pyx_t_7);
6647   __Pyx_XDECREF(__pyx_t_8);
6648   __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
6649   __pyx_r = -1;
6650   __pyx_L0:;
6651   __Pyx_RefNannyFinishContext();
6652   return __pyx_r;
6653 }
6654 
6655 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":955
6656  *         raise ImportError("numpy.core.umath failed to import")
6657  *
6658  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
6659  *     try:
6660  *         _import_umath()
6661  */
6662 
__pyx_f_5numpy_import_ufunc(void)6663 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
6664   int __pyx_r;
6665   __Pyx_RefNannyDeclarations
6666   PyObject *__pyx_t_1 = NULL;
6667   PyObject *__pyx_t_2 = NULL;
6668   PyObject *__pyx_t_3 = NULL;
6669   int __pyx_t_4;
6670   PyObject *__pyx_t_5 = NULL;
6671   PyObject *__pyx_t_6 = NULL;
6672   PyObject *__pyx_t_7 = NULL;
6673   PyObject *__pyx_t_8 = NULL;
6674   int __pyx_lineno = 0;
6675   const char *__pyx_filename = NULL;
6676   int __pyx_clineno = 0;
6677   __Pyx_RefNannySetupContext("import_ufunc", 0);
6678 
6679   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":956
6680  *
6681  * cdef inline int import_ufunc() except -1:
6682  *     try:             # <<<<<<<<<<<<<<
6683  *         _import_umath()
6684  *     except Exception:
6685  */
6686   {
6687     __Pyx_PyThreadState_declare
6688     __Pyx_PyThreadState_assign
6689     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
6690     __Pyx_XGOTREF(__pyx_t_1);
6691     __Pyx_XGOTREF(__pyx_t_2);
6692     __Pyx_XGOTREF(__pyx_t_3);
6693     /*try:*/ {
6694 
6695       /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":957
6696  * cdef inline int import_ufunc() except -1:
6697  *     try:
6698  *         _import_umath()             # <<<<<<<<<<<<<<
6699  *     except Exception:
6700  *         raise ImportError("numpy.core.umath failed to import")
6701  */
6702       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 957, __pyx_L3_error)
6703 
6704       /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":956
6705  *
6706  * cdef inline int import_ufunc() except -1:
6707  *     try:             # <<<<<<<<<<<<<<
6708  *         _import_umath()
6709  *     except Exception:
6710  */
6711     }
6712     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6713     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6714     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6715     goto __pyx_L8_try_end;
6716     __pyx_L3_error:;
6717 
6718     /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":958
6719  *     try:
6720  *         _import_umath()
6721  *     except Exception:             # <<<<<<<<<<<<<<
6722  *         raise ImportError("numpy.core.umath failed to import")
6723  *
6724  */
6725     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
6726     if (__pyx_t_4) {
6727       __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
6728       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 958, __pyx_L5_except_error)
6729       __Pyx_GOTREF(__pyx_t_5);
6730       __Pyx_GOTREF(__pyx_t_6);
6731       __Pyx_GOTREF(__pyx_t_7);
6732 
6733       /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":959
6734  *         _import_umath()
6735  *     except Exception:
6736  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
6737  *
6738  * cdef extern from *:
6739  */
6740       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 959, __pyx_L5_except_error)
6741       __Pyx_GOTREF(__pyx_t_8);
6742       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
6743       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6744       __PYX_ERR(1, 959, __pyx_L5_except_error)
6745     }
6746     goto __pyx_L5_except_error;
6747     __pyx_L5_except_error:;
6748 
6749     /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":956
6750  *
6751  * cdef inline int import_ufunc() except -1:
6752  *     try:             # <<<<<<<<<<<<<<
6753  *         _import_umath()
6754  *     except Exception:
6755  */
6756     __Pyx_XGIVEREF(__pyx_t_1);
6757     __Pyx_XGIVEREF(__pyx_t_2);
6758     __Pyx_XGIVEREF(__pyx_t_3);
6759     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
6760     goto __pyx_L1_error;
6761     __pyx_L8_try_end:;
6762   }
6763 
6764   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":955
6765  *         raise ImportError("numpy.core.umath failed to import")
6766  *
6767  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
6768  *     try:
6769  *         _import_umath()
6770  */
6771 
6772   /* function exit code */
6773   __pyx_r = 0;
6774   goto __pyx_L0;
6775   __pyx_L1_error:;
6776   __Pyx_XDECREF(__pyx_t_5);
6777   __Pyx_XDECREF(__pyx_t_6);
6778   __Pyx_XDECREF(__pyx_t_7);
6779   __Pyx_XDECREF(__pyx_t_8);
6780   __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
6781   __pyx_r = -1;
6782   __pyx_L0:;
6783   __Pyx_RefNannyFinishContext();
6784   return __pyx_r;
6785 }
6786 
6787 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":969
6788  *
6789  *
6790  * cdef inline bint is_timedelta64_object(object obj):             # <<<<<<<<<<<<<<
6791  *     """
6792  *     Cython equivalent of `isinstance(obj, np.timedelta64)`
6793  */
6794 
__pyx_f_5numpy_is_timedelta64_object(PyObject * __pyx_v_obj)6795 static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
6796   int __pyx_r;
6797   __Pyx_RefNannyDeclarations
6798   __Pyx_RefNannySetupContext("is_timedelta64_object", 0);
6799 
6800   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":981
6801  *     bool
6802  *     """
6803  *     return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type)             # <<<<<<<<<<<<<<
6804  *
6805  *
6806  */
6807   __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
6808   goto __pyx_L0;
6809 
6810   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":969
6811  *
6812  *
6813  * cdef inline bint is_timedelta64_object(object obj):             # <<<<<<<<<<<<<<
6814  *     """
6815  *     Cython equivalent of `isinstance(obj, np.timedelta64)`
6816  */
6817 
6818   /* function exit code */
6819   __pyx_L0:;
6820   __Pyx_RefNannyFinishContext();
6821   return __pyx_r;
6822 }
6823 
6824 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":984
6825  *
6826  *
6827  * cdef inline bint is_datetime64_object(object obj):             # <<<<<<<<<<<<<<
6828  *     """
6829  *     Cython equivalent of `isinstance(obj, np.datetime64)`
6830  */
6831 
__pyx_f_5numpy_is_datetime64_object(PyObject * __pyx_v_obj)6832 static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
6833   int __pyx_r;
6834   __Pyx_RefNannyDeclarations
6835   __Pyx_RefNannySetupContext("is_datetime64_object", 0);
6836 
6837   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":996
6838  *     bool
6839  *     """
6840  *     return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type)             # <<<<<<<<<<<<<<
6841  *
6842  *
6843  */
6844   __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
6845   goto __pyx_L0;
6846 
6847   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":984
6848  *
6849  *
6850  * cdef inline bint is_datetime64_object(object obj):             # <<<<<<<<<<<<<<
6851  *     """
6852  *     Cython equivalent of `isinstance(obj, np.datetime64)`
6853  */
6854 
6855   /* function exit code */
6856   __pyx_L0:;
6857   __Pyx_RefNannyFinishContext();
6858   return __pyx_r;
6859 }
6860 
6861 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":999
6862  *
6863  *
6864  * cdef inline npy_datetime get_datetime64_value(object obj) nogil:             # <<<<<<<<<<<<<<
6865  *     """
6866  *     returns the int64 value underlying scalar numpy datetime64 object
6867  */
6868 
__pyx_f_5numpy_get_datetime64_value(PyObject * __pyx_v_obj)6869 static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
6870   npy_datetime __pyx_r;
6871 
6872   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":1006
6873  *     also needed.  That can be found using `get_datetime64_unit`.
6874  *     """
6875  *     return (<PyDatetimeScalarObject*>obj).obval             # <<<<<<<<<<<<<<
6876  *
6877  *
6878  */
6879   __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
6880   goto __pyx_L0;
6881 
6882   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":999
6883  *
6884  *
6885  * cdef inline npy_datetime get_datetime64_value(object obj) nogil:             # <<<<<<<<<<<<<<
6886  *     """
6887  *     returns the int64 value underlying scalar numpy datetime64 object
6888  */
6889 
6890   /* function exit code */
6891   __pyx_L0:;
6892   return __pyx_r;
6893 }
6894 
6895 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":1009
6896  *
6897  *
6898  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:             # <<<<<<<<<<<<<<
6899  *     """
6900  *     returns the int64 value underlying scalar numpy timedelta64 object
6901  */
6902 
__pyx_f_5numpy_get_timedelta64_value(PyObject * __pyx_v_obj)6903 static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
6904   npy_timedelta __pyx_r;
6905 
6906   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":1013
6907  *     returns the int64 value underlying scalar numpy timedelta64 object
6908  *     """
6909  *     return (<PyTimedeltaScalarObject*>obj).obval             # <<<<<<<<<<<<<<
6910  *
6911  *
6912  */
6913   __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
6914   goto __pyx_L0;
6915 
6916   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":1009
6917  *
6918  *
6919  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:             # <<<<<<<<<<<<<<
6920  *     """
6921  *     returns the int64 value underlying scalar numpy timedelta64 object
6922  */
6923 
6924   /* function exit code */
6925   __pyx_L0:;
6926   return __pyx_r;
6927 }
6928 
6929 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":1016
6930  *
6931  *
6932  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:             # <<<<<<<<<<<<<<
6933  *     """
6934  *     returns the unit part of the dtype for a numpy datetime64 object.
6935  */
6936 
__pyx_f_5numpy_get_datetime64_unit(PyObject * __pyx_v_obj)6937 static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
6938   NPY_DATETIMEUNIT __pyx_r;
6939 
6940   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":1020
6941  *     returns the unit part of the dtype for a numpy datetime64 object.
6942  *     """
6943  *     return <NPY_DATETIMEUNIT>(<PyDatetimeScalarObject*>obj).obmeta.base             # <<<<<<<<<<<<<<
6944  */
6945   __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
6946   goto __pyx_L0;
6947 
6948   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":1016
6949  *
6950  *
6951  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:             # <<<<<<<<<<<<<<
6952  *     """
6953  *     returns the unit part of the dtype for a numpy datetime64 object.
6954  */
6955 
6956   /* function exit code */
6957   __pyx_L0:;
6958   return __pyx_r;
6959 }
6960 
6961 /* "View.MemoryView":122
6962  *         cdef bint dtype_is_object
6963  *
6964  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
6965  *                   mode="c", bint allocate_buffer=True):
6966  *
6967  */
6968 
6969 /* Python wrapper */
6970 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_array___cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)6971 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6972   PyObject *__pyx_v_shape = 0;
6973   Py_ssize_t __pyx_v_itemsize;
6974   PyObject *__pyx_v_format = 0;
6975   PyObject *__pyx_v_mode = 0;
6976   int __pyx_v_allocate_buffer;
6977   int __pyx_lineno = 0;
6978   const char *__pyx_filename = NULL;
6979   int __pyx_clineno = 0;
6980   int __pyx_r;
6981   __Pyx_RefNannyDeclarations
6982   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
6983   {
6984     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0};
6985     PyObject* values[5] = {0,0,0,0,0};
6986     values[3] = ((PyObject *)__pyx_n_s_c);
6987     if (unlikely(__pyx_kwds)) {
6988       Py_ssize_t kw_args;
6989       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6990       switch (pos_args) {
6991         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6992         CYTHON_FALLTHROUGH;
6993         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6994         CYTHON_FALLTHROUGH;
6995         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6996         CYTHON_FALLTHROUGH;
6997         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6998         CYTHON_FALLTHROUGH;
6999         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7000         CYTHON_FALLTHROUGH;
7001         case  0: break;
7002         default: goto __pyx_L5_argtuple_error;
7003       }
7004       kw_args = PyDict_Size(__pyx_kwds);
7005       switch (pos_args) {
7006         case  0:
7007         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
7008         else goto __pyx_L5_argtuple_error;
7009         CYTHON_FALLTHROUGH;
7010         case  1:
7011         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
7012         else {
7013           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 122, __pyx_L3_error)
7014         }
7015         CYTHON_FALLTHROUGH;
7016         case  2:
7017         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
7018         else {
7019           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 122, __pyx_L3_error)
7020         }
7021         CYTHON_FALLTHROUGH;
7022         case  3:
7023         if (kw_args > 0) {
7024           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
7025           if (value) { values[3] = value; kw_args--; }
7026         }
7027         CYTHON_FALLTHROUGH;
7028         case  4:
7029         if (kw_args > 0) {
7030           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
7031           if (value) { values[4] = value; kw_args--; }
7032         }
7033       }
7034       if (unlikely(kw_args > 0)) {
7035         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 122, __pyx_L3_error)
7036       }
7037     } else {
7038       switch (PyTuple_GET_SIZE(__pyx_args)) {
7039         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7040         CYTHON_FALLTHROUGH;
7041         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7042         CYTHON_FALLTHROUGH;
7043         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7044         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7045         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7046         break;
7047         default: goto __pyx_L5_argtuple_error;
7048       }
7049     }
7050     __pyx_v_shape = ((PyObject*)values[0]);
7051     __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 122, __pyx_L3_error)
7052     __pyx_v_format = values[2];
7053     __pyx_v_mode = values[3];
7054     if (values[4]) {
7055       __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 123, __pyx_L3_error)
7056     } else {
7057 
7058       /* "View.MemoryView":123
7059  *
7060  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
7061  *                   mode="c", bint allocate_buffer=True):             # <<<<<<<<<<<<<<
7062  *
7063  *         cdef int idx
7064  */
7065       __pyx_v_allocate_buffer = ((int)1);
7066     }
7067   }
7068   goto __pyx_L4_argument_unpacking_done;
7069   __pyx_L5_argtuple_error:;
7070   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 122, __pyx_L3_error)
7071   __pyx_L3_error:;
7072   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7073   __Pyx_RefNannyFinishContext();
7074   return -1;
7075   __pyx_L4_argument_unpacking_done:;
7076   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 122, __pyx_L1_error)
7077   if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
7078     PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 122, __pyx_L1_error)
7079   }
7080   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer);
7081 
7082   /* "View.MemoryView":122
7083  *         cdef bint dtype_is_object
7084  *
7085  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
7086  *                   mode="c", bint allocate_buffer=True):
7087  *
7088  */
7089 
7090   /* function exit code */
7091   goto __pyx_L0;
7092   __pyx_L1_error:;
7093   __pyx_r = -1;
7094   __pyx_L0:;
7095   __Pyx_RefNannyFinishContext();
7096   return __pyx_r;
7097 }
7098 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_shape,Py_ssize_t __pyx_v_itemsize,PyObject * __pyx_v_format,PyObject * __pyx_v_mode,int __pyx_v_allocate_buffer)7099 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) {
7100   int __pyx_v_idx;
7101   Py_ssize_t __pyx_v_i;
7102   Py_ssize_t __pyx_v_dim;
7103   PyObject **__pyx_v_p;
7104   char __pyx_v_order;
7105   int __pyx_r;
7106   __Pyx_RefNannyDeclarations
7107   Py_ssize_t __pyx_t_1;
7108   int __pyx_t_2;
7109   PyObject *__pyx_t_3 = NULL;
7110   int __pyx_t_4;
7111   PyObject *__pyx_t_5 = NULL;
7112   PyObject *__pyx_t_6 = NULL;
7113   char *__pyx_t_7;
7114   int __pyx_t_8;
7115   Py_ssize_t __pyx_t_9;
7116   PyObject *__pyx_t_10 = NULL;
7117   Py_ssize_t __pyx_t_11;
7118   int __pyx_lineno = 0;
7119   const char *__pyx_filename = NULL;
7120   int __pyx_clineno = 0;
7121   __Pyx_RefNannySetupContext("__cinit__", 0);
7122   __Pyx_INCREF(__pyx_v_format);
7123 
7124   /* "View.MemoryView":129
7125  *         cdef PyObject **p
7126  *
7127  *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
7128  *         self.itemsize = itemsize
7129  *
7130  */
7131   if (unlikely(__pyx_v_shape == Py_None)) {
7132     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
7133     __PYX_ERR(2, 129, __pyx_L1_error)
7134   }
7135   __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 129, __pyx_L1_error)
7136   __pyx_v_self->ndim = ((int)__pyx_t_1);
7137 
7138   /* "View.MemoryView":130
7139  *
7140  *         self.ndim = <int> len(shape)
7141  *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
7142  *
7143  *         if not self.ndim:
7144  */
7145   __pyx_v_self->itemsize = __pyx_v_itemsize;
7146 
7147   /* "View.MemoryView":132
7148  *         self.itemsize = itemsize
7149  *
7150  *         if not self.ndim:             # <<<<<<<<<<<<<<
7151  *             raise ValueError("Empty shape tuple for cython.array")
7152  *
7153  */
7154   __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
7155   if (unlikely(__pyx_t_2)) {
7156 
7157     /* "View.MemoryView":133
7158  *
7159  *         if not self.ndim:
7160  *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
7161  *
7162  *         if itemsize <= 0:
7163  */
7164     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 133, __pyx_L1_error)
7165     __Pyx_GOTREF(__pyx_t_3);
7166     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7167     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7168     __PYX_ERR(2, 133, __pyx_L1_error)
7169 
7170     /* "View.MemoryView":132
7171  *         self.itemsize = itemsize
7172  *
7173  *         if not self.ndim:             # <<<<<<<<<<<<<<
7174  *             raise ValueError("Empty shape tuple for cython.array")
7175  *
7176  */
7177   }
7178 
7179   /* "View.MemoryView":135
7180  *             raise ValueError("Empty shape tuple for cython.array")
7181  *
7182  *         if itemsize <= 0:             # <<<<<<<<<<<<<<
7183  *             raise ValueError("itemsize <= 0 for cython.array")
7184  *
7185  */
7186   __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
7187   if (unlikely(__pyx_t_2)) {
7188 
7189     /* "View.MemoryView":136
7190  *
7191  *         if itemsize <= 0:
7192  *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
7193  *
7194  *         if not isinstance(format, bytes):
7195  */
7196     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 136, __pyx_L1_error)
7197     __Pyx_GOTREF(__pyx_t_3);
7198     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7199     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7200     __PYX_ERR(2, 136, __pyx_L1_error)
7201 
7202     /* "View.MemoryView":135
7203  *             raise ValueError("Empty shape tuple for cython.array")
7204  *
7205  *         if itemsize <= 0:             # <<<<<<<<<<<<<<
7206  *             raise ValueError("itemsize <= 0 for cython.array")
7207  *
7208  */
7209   }
7210 
7211   /* "View.MemoryView":138
7212  *             raise ValueError("itemsize <= 0 for cython.array")
7213  *
7214  *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
7215  *             format = format.encode('ASCII')
7216  *         self._format = format  # keep a reference to the byte string
7217  */
7218   __pyx_t_2 = PyBytes_Check(__pyx_v_format);
7219   __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
7220   if (__pyx_t_4) {
7221 
7222     /* "View.MemoryView":139
7223  *
7224  *         if not isinstance(format, bytes):
7225  *             format = format.encode('ASCII')             # <<<<<<<<<<<<<<
7226  *         self._format = format  # keep a reference to the byte string
7227  *         self.format = self._format
7228  */
7229     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 139, __pyx_L1_error)
7230     __Pyx_GOTREF(__pyx_t_5);
7231     __pyx_t_6 = NULL;
7232     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
7233       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
7234       if (likely(__pyx_t_6)) {
7235         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7236         __Pyx_INCREF(__pyx_t_6);
7237         __Pyx_INCREF(function);
7238         __Pyx_DECREF_SET(__pyx_t_5, function);
7239       }
7240     }
7241     __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII);
7242     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7243     if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 139, __pyx_L1_error)
7244     __Pyx_GOTREF(__pyx_t_3);
7245     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7246     __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
7247     __pyx_t_3 = 0;
7248 
7249     /* "View.MemoryView":138
7250  *             raise ValueError("itemsize <= 0 for cython.array")
7251  *
7252  *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
7253  *             format = format.encode('ASCII')
7254  *         self._format = format  # keep a reference to the byte string
7255  */
7256   }
7257 
7258   /* "View.MemoryView":140
7259  *         if not isinstance(format, bytes):
7260  *             format = format.encode('ASCII')
7261  *         self._format = format  # keep a reference to the byte string             # <<<<<<<<<<<<<<
7262  *         self.format = self._format
7263  *
7264  */
7265   if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(2, 140, __pyx_L1_error)
7266   __pyx_t_3 = __pyx_v_format;
7267   __Pyx_INCREF(__pyx_t_3);
7268   __Pyx_GIVEREF(__pyx_t_3);
7269   __Pyx_GOTREF(__pyx_v_self->_format);
7270   __Pyx_DECREF(__pyx_v_self->_format);
7271   __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
7272   __pyx_t_3 = 0;
7273 
7274   /* "View.MemoryView":141
7275  *             format = format.encode('ASCII')
7276  *         self._format = format  # keep a reference to the byte string
7277  *         self.format = self._format             # <<<<<<<<<<<<<<
7278  *
7279  *
7280  */
7281   if (unlikely(__pyx_v_self->_format == Py_None)) {
7282     PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
7283     __PYX_ERR(2, 141, __pyx_L1_error)
7284   }
7285   __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 141, __pyx_L1_error)
7286   __pyx_v_self->format = __pyx_t_7;
7287 
7288   /* "View.MemoryView":144
7289  *
7290  *
7291  *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)             # <<<<<<<<<<<<<<
7292  *         self._strides = self._shape + self.ndim
7293  *
7294  */
7295   __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
7296 
7297   /* "View.MemoryView":145
7298  *
7299  *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
7300  *         self._strides = self._shape + self.ndim             # <<<<<<<<<<<<<<
7301  *
7302  *         if not self._shape:
7303  */
7304   __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
7305 
7306   /* "View.MemoryView":147
7307  *         self._strides = self._shape + self.ndim
7308  *
7309  *         if not self._shape:             # <<<<<<<<<<<<<<
7310  *             raise MemoryError("unable to allocate shape and strides.")
7311  *
7312  */
7313   __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
7314   if (unlikely(__pyx_t_4)) {
7315 
7316     /* "View.MemoryView":148
7317  *
7318  *         if not self._shape:
7319  *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
7320  *
7321  *
7322  */
7323     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 148, __pyx_L1_error)
7324     __Pyx_GOTREF(__pyx_t_3);
7325     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7326     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7327     __PYX_ERR(2, 148, __pyx_L1_error)
7328 
7329     /* "View.MemoryView":147
7330  *         self._strides = self._shape + self.ndim
7331  *
7332  *         if not self._shape:             # <<<<<<<<<<<<<<
7333  *             raise MemoryError("unable to allocate shape and strides.")
7334  *
7335  */
7336   }
7337 
7338   /* "View.MemoryView":151
7339  *
7340  *
7341  *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
7342  *             if dim <= 0:
7343  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
7344  */
7345   __pyx_t_8 = 0;
7346   __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
7347   for (;;) {
7348     if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
7349     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7350     __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(2, 151, __pyx_L1_error)
7351     #else
7352     __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 151, __pyx_L1_error)
7353     __Pyx_GOTREF(__pyx_t_5);
7354     #endif
7355     __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 151, __pyx_L1_error)
7356     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7357     __pyx_v_dim = __pyx_t_9;
7358     __pyx_v_idx = __pyx_t_8;
7359     __pyx_t_8 = (__pyx_t_8 + 1);
7360 
7361     /* "View.MemoryView":152
7362  *
7363  *         for idx, dim in enumerate(shape):
7364  *             if dim <= 0:             # <<<<<<<<<<<<<<
7365  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
7366  *             self._shape[idx] = dim
7367  */
7368     __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
7369     if (unlikely(__pyx_t_4)) {
7370 
7371       /* "View.MemoryView":153
7372  *         for idx, dim in enumerate(shape):
7373  *             if dim <= 0:
7374  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))             # <<<<<<<<<<<<<<
7375  *             self._shape[idx] = dim
7376  *
7377  */
7378       __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 153, __pyx_L1_error)
7379       __Pyx_GOTREF(__pyx_t_5);
7380       __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error)
7381       __Pyx_GOTREF(__pyx_t_6);
7382       __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
7383       __Pyx_GOTREF(__pyx_t_10);
7384       __Pyx_GIVEREF(__pyx_t_5);
7385       PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
7386       __Pyx_GIVEREF(__pyx_t_6);
7387       PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
7388       __pyx_t_5 = 0;
7389       __pyx_t_6 = 0;
7390       __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error)
7391       __Pyx_GOTREF(__pyx_t_6);
7392       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7393       __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
7394       __Pyx_GOTREF(__pyx_t_10);
7395       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7396       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
7397       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7398       __PYX_ERR(2, 153, __pyx_L1_error)
7399 
7400       /* "View.MemoryView":152
7401  *
7402  *         for idx, dim in enumerate(shape):
7403  *             if dim <= 0:             # <<<<<<<<<<<<<<
7404  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
7405  *             self._shape[idx] = dim
7406  */
7407     }
7408 
7409     /* "View.MemoryView":154
7410  *             if dim <= 0:
7411  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
7412  *             self._shape[idx] = dim             # <<<<<<<<<<<<<<
7413  *
7414  *         cdef char order
7415  */
7416     (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
7417 
7418     /* "View.MemoryView":151
7419  *
7420  *
7421  *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
7422  *             if dim <= 0:
7423  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
7424  */
7425   }
7426   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7427 
7428   /* "View.MemoryView":157
7429  *
7430  *         cdef char order
7431  *         if mode == 'fortran':             # <<<<<<<<<<<<<<
7432  *             order = b'F'
7433  *             self.mode = u'fortran'
7434  */
7435   __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 157, __pyx_L1_error)
7436   if (__pyx_t_4) {
7437 
7438     /* "View.MemoryView":158
7439  *         cdef char order
7440  *         if mode == 'fortran':
7441  *             order = b'F'             # <<<<<<<<<<<<<<
7442  *             self.mode = u'fortran'
7443  *         elif mode == 'c':
7444  */
7445     __pyx_v_order = 'F';
7446 
7447     /* "View.MemoryView":159
7448  *         if mode == 'fortran':
7449  *             order = b'F'
7450  *             self.mode = u'fortran'             # <<<<<<<<<<<<<<
7451  *         elif mode == 'c':
7452  *             order = b'C'
7453  */
7454     __Pyx_INCREF(__pyx_n_u_fortran);
7455     __Pyx_GIVEREF(__pyx_n_u_fortran);
7456     __Pyx_GOTREF(__pyx_v_self->mode);
7457     __Pyx_DECREF(__pyx_v_self->mode);
7458     __pyx_v_self->mode = __pyx_n_u_fortran;
7459 
7460     /* "View.MemoryView":157
7461  *
7462  *         cdef char order
7463  *         if mode == 'fortran':             # <<<<<<<<<<<<<<
7464  *             order = b'F'
7465  *             self.mode = u'fortran'
7466  */
7467     goto __pyx_L10;
7468   }
7469 
7470   /* "View.MemoryView":160
7471  *             order = b'F'
7472  *             self.mode = u'fortran'
7473  *         elif mode == 'c':             # <<<<<<<<<<<<<<
7474  *             order = b'C'
7475  *             self.mode = u'c'
7476  */
7477   __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 160, __pyx_L1_error)
7478   if (likely(__pyx_t_4)) {
7479 
7480     /* "View.MemoryView":161
7481  *             self.mode = u'fortran'
7482  *         elif mode == 'c':
7483  *             order = b'C'             # <<<<<<<<<<<<<<
7484  *             self.mode = u'c'
7485  *         else:
7486  */
7487     __pyx_v_order = 'C';
7488 
7489     /* "View.MemoryView":162
7490  *         elif mode == 'c':
7491  *             order = b'C'
7492  *             self.mode = u'c'             # <<<<<<<<<<<<<<
7493  *         else:
7494  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
7495  */
7496     __Pyx_INCREF(__pyx_n_u_c);
7497     __Pyx_GIVEREF(__pyx_n_u_c);
7498     __Pyx_GOTREF(__pyx_v_self->mode);
7499     __Pyx_DECREF(__pyx_v_self->mode);
7500     __pyx_v_self->mode = __pyx_n_u_c;
7501 
7502     /* "View.MemoryView":160
7503  *             order = b'F'
7504  *             self.mode = u'fortran'
7505  *         elif mode == 'c':             # <<<<<<<<<<<<<<
7506  *             order = b'C'
7507  *             self.mode = u'c'
7508  */
7509     goto __pyx_L10;
7510   }
7511 
7512   /* "View.MemoryView":164
7513  *             self.mode = u'c'
7514  *         else:
7515  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)             # <<<<<<<<<<<<<<
7516  *
7517  *         self.len = fill_contig_strides_array(self._shape, self._strides,
7518  */
7519   /*else*/ {
7520     __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 164, __pyx_L1_error)
7521     __Pyx_GOTREF(__pyx_t_3);
7522     __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 164, __pyx_L1_error)
7523     __Pyx_GOTREF(__pyx_t_10);
7524     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7525     __Pyx_Raise(__pyx_t_10, 0, 0, 0);
7526     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7527     __PYX_ERR(2, 164, __pyx_L1_error)
7528   }
7529   __pyx_L10:;
7530 
7531   /* "View.MemoryView":166
7532  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
7533  *
7534  *         self.len = fill_contig_strides_array(self._shape, self._strides,             # <<<<<<<<<<<<<<
7535  *                                              itemsize, self.ndim, order)
7536  *
7537  */
7538   __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order);
7539 
7540   /* "View.MemoryView":169
7541  *                                              itemsize, self.ndim, order)
7542  *
7543  *         self.free_data = allocate_buffer             # <<<<<<<<<<<<<<
7544  *         self.dtype_is_object = format == b'O'
7545  *         if allocate_buffer:
7546  */
7547   __pyx_v_self->free_data = __pyx_v_allocate_buffer;
7548 
7549   /* "View.MemoryView":170
7550  *
7551  *         self.free_data = allocate_buffer
7552  *         self.dtype_is_object = format == b'O'             # <<<<<<<<<<<<<<
7553  *         if allocate_buffer:
7554  *
7555  */
7556   __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 170, __pyx_L1_error)
7557   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 170, __pyx_L1_error)
7558   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7559   __pyx_v_self->dtype_is_object = __pyx_t_4;
7560 
7561   /* "View.MemoryView":171
7562  *         self.free_data = allocate_buffer
7563  *         self.dtype_is_object = format == b'O'
7564  *         if allocate_buffer:             # <<<<<<<<<<<<<<
7565  *
7566  *
7567  */
7568   __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
7569   if (__pyx_t_4) {
7570 
7571     /* "View.MemoryView":174
7572  *
7573  *
7574  *             self.data = <char *>malloc(self.len)             # <<<<<<<<<<<<<<
7575  *             if not self.data:
7576  *                 raise MemoryError("unable to allocate array data.")
7577  */
7578     __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
7579 
7580     /* "View.MemoryView":175
7581  *
7582  *             self.data = <char *>malloc(self.len)
7583  *             if not self.data:             # <<<<<<<<<<<<<<
7584  *                 raise MemoryError("unable to allocate array data.")
7585  *
7586  */
7587     __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
7588     if (unlikely(__pyx_t_4)) {
7589 
7590       /* "View.MemoryView":176
7591  *             self.data = <char *>malloc(self.len)
7592  *             if not self.data:
7593  *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
7594  *
7595  *             if self.dtype_is_object:
7596  */
7597       __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 176, __pyx_L1_error)
7598       __Pyx_GOTREF(__pyx_t_10);
7599       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
7600       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7601       __PYX_ERR(2, 176, __pyx_L1_error)
7602 
7603       /* "View.MemoryView":175
7604  *
7605  *             self.data = <char *>malloc(self.len)
7606  *             if not self.data:             # <<<<<<<<<<<<<<
7607  *                 raise MemoryError("unable to allocate array data.")
7608  *
7609  */
7610     }
7611 
7612     /* "View.MemoryView":178
7613  *                 raise MemoryError("unable to allocate array data.")
7614  *
7615  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
7616  *                 p = <PyObject **> self.data
7617  *                 for i in range(self.len / itemsize):
7618  */
7619     __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
7620     if (__pyx_t_4) {
7621 
7622       /* "View.MemoryView":179
7623  *
7624  *             if self.dtype_is_object:
7625  *                 p = <PyObject **> self.data             # <<<<<<<<<<<<<<
7626  *                 for i in range(self.len / itemsize):
7627  *                     p[i] = Py_None
7628  */
7629       __pyx_v_p = ((PyObject **)__pyx_v_self->data);
7630 
7631       /* "View.MemoryView":180
7632  *             if self.dtype_is_object:
7633  *                 p = <PyObject **> self.data
7634  *                 for i in range(self.len / itemsize):             # <<<<<<<<<<<<<<
7635  *                     p[i] = Py_None
7636  *                     Py_INCREF(Py_None)
7637  */
7638       if (unlikely(__pyx_v_itemsize == 0)) {
7639         PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
7640         __PYX_ERR(2, 180, __pyx_L1_error)
7641       }
7642       else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
7643         PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
7644         __PYX_ERR(2, 180, __pyx_L1_error)
7645       }
7646       __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
7647       __pyx_t_9 = __pyx_t_1;
7648       for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
7649         __pyx_v_i = __pyx_t_11;
7650 
7651         /* "View.MemoryView":181
7652  *                 p = <PyObject **> self.data
7653  *                 for i in range(self.len / itemsize):
7654  *                     p[i] = Py_None             # <<<<<<<<<<<<<<
7655  *                     Py_INCREF(Py_None)
7656  *
7657  */
7658         (__pyx_v_p[__pyx_v_i]) = Py_None;
7659 
7660         /* "View.MemoryView":182
7661  *                 for i in range(self.len / itemsize):
7662  *                     p[i] = Py_None
7663  *                     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
7664  *
7665  *     @cname('getbuffer')
7666  */
7667         Py_INCREF(Py_None);
7668       }
7669 
7670       /* "View.MemoryView":178
7671  *                 raise MemoryError("unable to allocate array data.")
7672  *
7673  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
7674  *                 p = <PyObject **> self.data
7675  *                 for i in range(self.len / itemsize):
7676  */
7677     }
7678 
7679     /* "View.MemoryView":171
7680  *         self.free_data = allocate_buffer
7681  *         self.dtype_is_object = format == b'O'
7682  *         if allocate_buffer:             # <<<<<<<<<<<<<<
7683  *
7684  *
7685  */
7686   }
7687 
7688   /* "View.MemoryView":122
7689  *         cdef bint dtype_is_object
7690  *
7691  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
7692  *                   mode="c", bint allocate_buffer=True):
7693  *
7694  */
7695 
7696   /* function exit code */
7697   __pyx_r = 0;
7698   goto __pyx_L0;
7699   __pyx_L1_error:;
7700   __Pyx_XDECREF(__pyx_t_3);
7701   __Pyx_XDECREF(__pyx_t_5);
7702   __Pyx_XDECREF(__pyx_t_6);
7703   __Pyx_XDECREF(__pyx_t_10);
7704   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7705   __pyx_r = -1;
7706   __pyx_L0:;
7707   __Pyx_XDECREF(__pyx_v_format);
7708   __Pyx_RefNannyFinishContext();
7709   return __pyx_r;
7710 }
7711 
7712 /* "View.MemoryView":185
7713  *
7714  *     @cname('getbuffer')
7715  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
7716  *         cdef int bufmode = -1
7717  *         if self.mode == u"c":
7718  */
7719 
7720 /* Python wrapper */
7721 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
__pyx_array_getbuffer(PyObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)7722 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
7723   int __pyx_r;
7724   __Pyx_RefNannyDeclarations
7725   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
7726   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
7727 
7728   /* function exit code */
7729   __Pyx_RefNannyFinishContext();
7730   return __pyx_r;
7731 }
7732 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)7733 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
7734   int __pyx_v_bufmode;
7735   int __pyx_r;
7736   __Pyx_RefNannyDeclarations
7737   int __pyx_t_1;
7738   int __pyx_t_2;
7739   PyObject *__pyx_t_3 = NULL;
7740   char *__pyx_t_4;
7741   Py_ssize_t __pyx_t_5;
7742   int __pyx_t_6;
7743   Py_ssize_t *__pyx_t_7;
7744   int __pyx_lineno = 0;
7745   const char *__pyx_filename = NULL;
7746   int __pyx_clineno = 0;
7747   if (__pyx_v_info == NULL) {
7748     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
7749     return -1;
7750   }
7751   __Pyx_RefNannySetupContext("__getbuffer__", 0);
7752   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
7753   __Pyx_GIVEREF(__pyx_v_info->obj);
7754 
7755   /* "View.MemoryView":186
7756  *     @cname('getbuffer')
7757  *     def __getbuffer__(self, Py_buffer *info, int flags):
7758  *         cdef int bufmode = -1             # <<<<<<<<<<<<<<
7759  *         if self.mode == u"c":
7760  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7761  */
7762   __pyx_v_bufmode = -1;
7763 
7764   /* "View.MemoryView":187
7765  *     def __getbuffer__(self, Py_buffer *info, int flags):
7766  *         cdef int bufmode = -1
7767  *         if self.mode == u"c":             # <<<<<<<<<<<<<<
7768  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7769  *         elif self.mode == u"fortran":
7770  */
7771   __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 187, __pyx_L1_error)
7772   __pyx_t_2 = (__pyx_t_1 != 0);
7773   if (__pyx_t_2) {
7774 
7775     /* "View.MemoryView":188
7776  *         cdef int bufmode = -1
7777  *         if self.mode == u"c":
7778  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
7779  *         elif self.mode == u"fortran":
7780  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7781  */
7782     __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
7783 
7784     /* "View.MemoryView":187
7785  *     def __getbuffer__(self, Py_buffer *info, int flags):
7786  *         cdef int bufmode = -1
7787  *         if self.mode == u"c":             # <<<<<<<<<<<<<<
7788  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7789  *         elif self.mode == u"fortran":
7790  */
7791     goto __pyx_L3;
7792   }
7793 
7794   /* "View.MemoryView":189
7795  *         if self.mode == u"c":
7796  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7797  *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
7798  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7799  *         if not (flags & bufmode):
7800  */
7801   __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 189, __pyx_L1_error)
7802   __pyx_t_1 = (__pyx_t_2 != 0);
7803   if (__pyx_t_1) {
7804 
7805     /* "View.MemoryView":190
7806  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7807  *         elif self.mode == u"fortran":
7808  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
7809  *         if not (flags & bufmode):
7810  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
7811  */
7812     __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
7813 
7814     /* "View.MemoryView":189
7815  *         if self.mode == u"c":
7816  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7817  *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
7818  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7819  *         if not (flags & bufmode):
7820  */
7821   }
7822   __pyx_L3:;
7823 
7824   /* "View.MemoryView":191
7825  *         elif self.mode == u"fortran":
7826  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7827  *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
7828  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
7829  *         info.buf = self.data
7830  */
7831   __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
7832   if (unlikely(__pyx_t_1)) {
7833 
7834     /* "View.MemoryView":192
7835  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7836  *         if not (flags & bufmode):
7837  *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
7838  *         info.buf = self.data
7839  *         info.len = self.len
7840  */
7841     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 192, __pyx_L1_error)
7842     __Pyx_GOTREF(__pyx_t_3);
7843     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7844     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7845     __PYX_ERR(2, 192, __pyx_L1_error)
7846 
7847     /* "View.MemoryView":191
7848  *         elif self.mode == u"fortran":
7849  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
7850  *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
7851  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
7852  *         info.buf = self.data
7853  */
7854   }
7855 
7856   /* "View.MemoryView":193
7857  *         if not (flags & bufmode):
7858  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
7859  *         info.buf = self.data             # <<<<<<<<<<<<<<
7860  *         info.len = self.len
7861  *         info.ndim = self.ndim
7862  */
7863   __pyx_t_4 = __pyx_v_self->data;
7864   __pyx_v_info->buf = __pyx_t_4;
7865 
7866   /* "View.MemoryView":194
7867  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
7868  *         info.buf = self.data
7869  *         info.len = self.len             # <<<<<<<<<<<<<<
7870  *         info.ndim = self.ndim
7871  *         info.shape = self._shape
7872  */
7873   __pyx_t_5 = __pyx_v_self->len;
7874   __pyx_v_info->len = __pyx_t_5;
7875 
7876   /* "View.MemoryView":195
7877  *         info.buf = self.data
7878  *         info.len = self.len
7879  *         info.ndim = self.ndim             # <<<<<<<<<<<<<<
7880  *         info.shape = self._shape
7881  *         info.strides = self._strides
7882  */
7883   __pyx_t_6 = __pyx_v_self->ndim;
7884   __pyx_v_info->ndim = __pyx_t_6;
7885 
7886   /* "View.MemoryView":196
7887  *         info.len = self.len
7888  *         info.ndim = self.ndim
7889  *         info.shape = self._shape             # <<<<<<<<<<<<<<
7890  *         info.strides = self._strides
7891  *         info.suboffsets = NULL
7892  */
7893   __pyx_t_7 = __pyx_v_self->_shape;
7894   __pyx_v_info->shape = __pyx_t_7;
7895 
7896   /* "View.MemoryView":197
7897  *         info.ndim = self.ndim
7898  *         info.shape = self._shape
7899  *         info.strides = self._strides             # <<<<<<<<<<<<<<
7900  *         info.suboffsets = NULL
7901  *         info.itemsize = self.itemsize
7902  */
7903   __pyx_t_7 = __pyx_v_self->_strides;
7904   __pyx_v_info->strides = __pyx_t_7;
7905 
7906   /* "View.MemoryView":198
7907  *         info.shape = self._shape
7908  *         info.strides = self._strides
7909  *         info.suboffsets = NULL             # <<<<<<<<<<<<<<
7910  *         info.itemsize = self.itemsize
7911  *         info.readonly = 0
7912  */
7913   __pyx_v_info->suboffsets = NULL;
7914 
7915   /* "View.MemoryView":199
7916  *         info.strides = self._strides
7917  *         info.suboffsets = NULL
7918  *         info.itemsize = self.itemsize             # <<<<<<<<<<<<<<
7919  *         info.readonly = 0
7920  *
7921  */
7922   __pyx_t_5 = __pyx_v_self->itemsize;
7923   __pyx_v_info->itemsize = __pyx_t_5;
7924 
7925   /* "View.MemoryView":200
7926  *         info.suboffsets = NULL
7927  *         info.itemsize = self.itemsize
7928  *         info.readonly = 0             # <<<<<<<<<<<<<<
7929  *
7930  *         if flags & PyBUF_FORMAT:
7931  */
7932   __pyx_v_info->readonly = 0;
7933 
7934   /* "View.MemoryView":202
7935  *         info.readonly = 0
7936  *
7937  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
7938  *             info.format = self.format
7939  *         else:
7940  */
7941   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
7942   if (__pyx_t_1) {
7943 
7944     /* "View.MemoryView":203
7945  *
7946  *         if flags & PyBUF_FORMAT:
7947  *             info.format = self.format             # <<<<<<<<<<<<<<
7948  *         else:
7949  *             info.format = NULL
7950  */
7951     __pyx_t_4 = __pyx_v_self->format;
7952     __pyx_v_info->format = __pyx_t_4;
7953 
7954     /* "View.MemoryView":202
7955  *         info.readonly = 0
7956  *
7957  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
7958  *             info.format = self.format
7959  *         else:
7960  */
7961     goto __pyx_L5;
7962   }
7963 
7964   /* "View.MemoryView":205
7965  *             info.format = self.format
7966  *         else:
7967  *             info.format = NULL             # <<<<<<<<<<<<<<
7968  *
7969  *         info.obj = self
7970  */
7971   /*else*/ {
7972     __pyx_v_info->format = NULL;
7973   }
7974   __pyx_L5:;
7975 
7976   /* "View.MemoryView":207
7977  *             info.format = NULL
7978  *
7979  *         info.obj = self             # <<<<<<<<<<<<<<
7980  *
7981  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
7982  */
7983   __Pyx_INCREF(((PyObject *)__pyx_v_self));
7984   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
7985   __Pyx_GOTREF(__pyx_v_info->obj);
7986   __Pyx_DECREF(__pyx_v_info->obj);
7987   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
7988 
7989   /* "View.MemoryView":185
7990  *
7991  *     @cname('getbuffer')
7992  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
7993  *         cdef int bufmode = -1
7994  *         if self.mode == u"c":
7995  */
7996 
7997   /* function exit code */
7998   __pyx_r = 0;
7999   goto __pyx_L0;
8000   __pyx_L1_error:;
8001   __Pyx_XDECREF(__pyx_t_3);
8002   __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8003   __pyx_r = -1;
8004   if (__pyx_v_info->obj != NULL) {
8005     __Pyx_GOTREF(__pyx_v_info->obj);
8006     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
8007   }
8008   goto __pyx_L2;
8009   __pyx_L0:;
8010   if (__pyx_v_info->obj == Py_None) {
8011     __Pyx_GOTREF(__pyx_v_info->obj);
8012     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
8013   }
8014   __pyx_L2:;
8015   __Pyx_RefNannyFinishContext();
8016   return __pyx_r;
8017 }
8018 
8019 /* "View.MemoryView":211
8020  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
8021  *
8022  *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
8023  *         if self.callback_free_data != NULL:
8024  *             self.callback_free_data(self.data)
8025  */
8026 
8027 /* Python wrapper */
8028 static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_array___dealloc__(PyObject * __pyx_v_self)8029 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
8030   __Pyx_RefNannyDeclarations
8031   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
8032   __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));
8033 
8034   /* function exit code */
8035   __Pyx_RefNannyFinishContext();
8036 }
8037 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj * __pyx_v_self)8038 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
8039   __Pyx_RefNannyDeclarations
8040   int __pyx_t_1;
8041   __Pyx_RefNannySetupContext("__dealloc__", 0);
8042 
8043   /* "View.MemoryView":212
8044  *
8045  *     def __dealloc__(array self):
8046  *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
8047  *             self.callback_free_data(self.data)
8048  *         elif self.free_data:
8049  */
8050   __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
8051   if (__pyx_t_1) {
8052 
8053     /* "View.MemoryView":213
8054  *     def __dealloc__(array self):
8055  *         if self.callback_free_data != NULL:
8056  *             self.callback_free_data(self.data)             # <<<<<<<<<<<<<<
8057  *         elif self.free_data:
8058  *             if self.dtype_is_object:
8059  */
8060     __pyx_v_self->callback_free_data(__pyx_v_self->data);
8061 
8062     /* "View.MemoryView":212
8063  *
8064  *     def __dealloc__(array self):
8065  *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
8066  *             self.callback_free_data(self.data)
8067  *         elif self.free_data:
8068  */
8069     goto __pyx_L3;
8070   }
8071 
8072   /* "View.MemoryView":214
8073  *         if self.callback_free_data != NULL:
8074  *             self.callback_free_data(self.data)
8075  *         elif self.free_data:             # <<<<<<<<<<<<<<
8076  *             if self.dtype_is_object:
8077  *                 refcount_objects_in_slice(self.data, self._shape,
8078  */
8079   __pyx_t_1 = (__pyx_v_self->free_data != 0);
8080   if (__pyx_t_1) {
8081 
8082     /* "View.MemoryView":215
8083  *             self.callback_free_data(self.data)
8084  *         elif self.free_data:
8085  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
8086  *                 refcount_objects_in_slice(self.data, self._shape,
8087  *                                           self._strides, self.ndim, False)
8088  */
8089     __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
8090     if (__pyx_t_1) {
8091 
8092       /* "View.MemoryView":216
8093  *         elif self.free_data:
8094  *             if self.dtype_is_object:
8095  *                 refcount_objects_in_slice(self.data, self._shape,             # <<<<<<<<<<<<<<
8096  *                                           self._strides, self.ndim, False)
8097  *             free(self.data)
8098  */
8099       __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
8100 
8101       /* "View.MemoryView":215
8102  *             self.callback_free_data(self.data)
8103  *         elif self.free_data:
8104  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
8105  *                 refcount_objects_in_slice(self.data, self._shape,
8106  *                                           self._strides, self.ndim, False)
8107  */
8108     }
8109 
8110     /* "View.MemoryView":218
8111  *                 refcount_objects_in_slice(self.data, self._shape,
8112  *                                           self._strides, self.ndim, False)
8113  *             free(self.data)             # <<<<<<<<<<<<<<
8114  *         PyObject_Free(self._shape)
8115  *
8116  */
8117     free(__pyx_v_self->data);
8118 
8119     /* "View.MemoryView":214
8120  *         if self.callback_free_data != NULL:
8121  *             self.callback_free_data(self.data)
8122  *         elif self.free_data:             # <<<<<<<<<<<<<<
8123  *             if self.dtype_is_object:
8124  *                 refcount_objects_in_slice(self.data, self._shape,
8125  */
8126   }
8127   __pyx_L3:;
8128 
8129   /* "View.MemoryView":219
8130  *                                           self._strides, self.ndim, False)
8131  *             free(self.data)
8132  *         PyObject_Free(self._shape)             # <<<<<<<<<<<<<<
8133  *
8134  *     @property
8135  */
8136   PyObject_Free(__pyx_v_self->_shape);
8137 
8138   /* "View.MemoryView":211
8139  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
8140  *
8141  *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
8142  *         if self.callback_free_data != NULL:
8143  *             self.callback_free_data(self.data)
8144  */
8145 
8146   /* function exit code */
8147   __Pyx_RefNannyFinishContext();
8148 }
8149 
8150 /* "View.MemoryView":222
8151  *
8152  *     @property
8153  *     def memview(self):             # <<<<<<<<<<<<<<
8154  *         return self.get_memview()
8155  *
8156  */
8157 
8158 /* Python wrapper */
8159 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject * __pyx_v_self)8160 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
8161   PyObject *__pyx_r = 0;
8162   __Pyx_RefNannyDeclarations
8163   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
8164   __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));
8165 
8166   /* function exit code */
8167   __Pyx_RefNannyFinishContext();
8168   return __pyx_r;
8169 }
8170 
__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj * __pyx_v_self)8171 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
8172   PyObject *__pyx_r = NULL;
8173   __Pyx_RefNannyDeclarations
8174   PyObject *__pyx_t_1 = NULL;
8175   int __pyx_lineno = 0;
8176   const char *__pyx_filename = NULL;
8177   int __pyx_clineno = 0;
8178   __Pyx_RefNannySetupContext("__get__", 0);
8179 
8180   /* "View.MemoryView":223
8181  *     @property
8182  *     def memview(self):
8183  *         return self.get_memview()             # <<<<<<<<<<<<<<
8184  *
8185  *     @cname('get_memview')
8186  */
8187   __Pyx_XDECREF(__pyx_r);
8188   __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 223, __pyx_L1_error)
8189   __Pyx_GOTREF(__pyx_t_1);
8190   __pyx_r = __pyx_t_1;
8191   __pyx_t_1 = 0;
8192   goto __pyx_L0;
8193 
8194   /* "View.MemoryView":222
8195  *
8196  *     @property
8197  *     def memview(self):             # <<<<<<<<<<<<<<
8198  *         return self.get_memview()
8199  *
8200  */
8201 
8202   /* function exit code */
8203   __pyx_L1_error:;
8204   __Pyx_XDECREF(__pyx_t_1);
8205   __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8206   __pyx_r = NULL;
8207   __pyx_L0:;
8208   __Pyx_XGIVEREF(__pyx_r);
8209   __Pyx_RefNannyFinishContext();
8210   return __pyx_r;
8211 }
8212 
8213 /* "View.MemoryView":226
8214  *
8215  *     @cname('get_memview')
8216  *     cdef get_memview(self):             # <<<<<<<<<<<<<<
8217  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
8218  *         return  memoryview(self, flags, self.dtype_is_object)
8219  */
8220 
__pyx_array_get_memview(struct __pyx_array_obj * __pyx_v_self)8221 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
8222   int __pyx_v_flags;
8223   PyObject *__pyx_r = NULL;
8224   __Pyx_RefNannyDeclarations
8225   PyObject *__pyx_t_1 = NULL;
8226   PyObject *__pyx_t_2 = NULL;
8227   PyObject *__pyx_t_3 = NULL;
8228   int __pyx_lineno = 0;
8229   const char *__pyx_filename = NULL;
8230   int __pyx_clineno = 0;
8231   __Pyx_RefNannySetupContext("get_memview", 0);
8232 
8233   /* "View.MemoryView":227
8234  *     @cname('get_memview')
8235  *     cdef get_memview(self):
8236  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE             # <<<<<<<<<<<<<<
8237  *         return  memoryview(self, flags, self.dtype_is_object)
8238  *
8239  */
8240   __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
8241 
8242   /* "View.MemoryView":228
8243  *     cdef get_memview(self):
8244  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
8245  *         return  memoryview(self, flags, self.dtype_is_object)             # <<<<<<<<<<<<<<
8246  *
8247  *     def __len__(self):
8248  */
8249   __Pyx_XDECREF(__pyx_r);
8250   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __pyx_L1_error)
8251   __Pyx_GOTREF(__pyx_t_1);
8252   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error)
8253   __Pyx_GOTREF(__pyx_t_2);
8254   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 228, __pyx_L1_error)
8255   __Pyx_GOTREF(__pyx_t_3);
8256   __Pyx_INCREF(((PyObject *)__pyx_v_self));
8257   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
8258   PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
8259   __Pyx_GIVEREF(__pyx_t_1);
8260   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
8261   __Pyx_GIVEREF(__pyx_t_2);
8262   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
8263   __pyx_t_1 = 0;
8264   __pyx_t_2 = 0;
8265   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error)
8266   __Pyx_GOTREF(__pyx_t_2);
8267   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8268   __pyx_r = __pyx_t_2;
8269   __pyx_t_2 = 0;
8270   goto __pyx_L0;
8271 
8272   /* "View.MemoryView":226
8273  *
8274  *     @cname('get_memview')
8275  *     cdef get_memview(self):             # <<<<<<<<<<<<<<
8276  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
8277  *         return  memoryview(self, flags, self.dtype_is_object)
8278  */
8279 
8280   /* function exit code */
8281   __pyx_L1_error:;
8282   __Pyx_XDECREF(__pyx_t_1);
8283   __Pyx_XDECREF(__pyx_t_2);
8284   __Pyx_XDECREF(__pyx_t_3);
8285   __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
8286   __pyx_r = 0;
8287   __pyx_L0:;
8288   __Pyx_XGIVEREF(__pyx_r);
8289   __Pyx_RefNannyFinishContext();
8290   return __pyx_r;
8291 }
8292 
8293 /* "View.MemoryView":230
8294  *         return  memoryview(self, flags, self.dtype_is_object)
8295  *
8296  *     def __len__(self):             # <<<<<<<<<<<<<<
8297  *         return self._shape[0]
8298  *
8299  */
8300 
8301 /* Python wrapper */
8302 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
__pyx_array___len__(PyObject * __pyx_v_self)8303 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
8304   Py_ssize_t __pyx_r;
8305   __Pyx_RefNannyDeclarations
8306   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
8307   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));
8308 
8309   /* function exit code */
8310   __Pyx_RefNannyFinishContext();
8311   return __pyx_r;
8312 }
8313 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj * __pyx_v_self)8314 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
8315   Py_ssize_t __pyx_r;
8316   __Pyx_RefNannyDeclarations
8317   __Pyx_RefNannySetupContext("__len__", 0);
8318 
8319   /* "View.MemoryView":231
8320  *
8321  *     def __len__(self):
8322  *         return self._shape[0]             # <<<<<<<<<<<<<<
8323  *
8324  *     def __getattr__(self, attr):
8325  */
8326   __pyx_r = (__pyx_v_self->_shape[0]);
8327   goto __pyx_L0;
8328 
8329   /* "View.MemoryView":230
8330  *         return  memoryview(self, flags, self.dtype_is_object)
8331  *
8332  *     def __len__(self):             # <<<<<<<<<<<<<<
8333  *         return self._shape[0]
8334  *
8335  */
8336 
8337   /* function exit code */
8338   __pyx_L0:;
8339   __Pyx_RefNannyFinishContext();
8340   return __pyx_r;
8341 }
8342 
8343 /* "View.MemoryView":233
8344  *         return self._shape[0]
8345  *
8346  *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
8347  *         return getattr(self.memview, attr)
8348  *
8349  */
8350 
8351 /* Python wrapper */
8352 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
__pyx_array___getattr__(PyObject * __pyx_v_self,PyObject * __pyx_v_attr)8353 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
8354   PyObject *__pyx_r = 0;
8355   __Pyx_RefNannyDeclarations
8356   __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
8357   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
8358 
8359   /* function exit code */
8360   __Pyx_RefNannyFinishContext();
8361   return __pyx_r;
8362 }
8363 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_attr)8364 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
8365   PyObject *__pyx_r = NULL;
8366   __Pyx_RefNannyDeclarations
8367   PyObject *__pyx_t_1 = NULL;
8368   PyObject *__pyx_t_2 = NULL;
8369   int __pyx_lineno = 0;
8370   const char *__pyx_filename = NULL;
8371   int __pyx_clineno = 0;
8372   __Pyx_RefNannySetupContext("__getattr__", 0);
8373 
8374   /* "View.MemoryView":234
8375  *
8376  *     def __getattr__(self, attr):
8377  *         return getattr(self.memview, attr)             # <<<<<<<<<<<<<<
8378  *
8379  *     def __getitem__(self, item):
8380  */
8381   __Pyx_XDECREF(__pyx_r);
8382   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 234, __pyx_L1_error)
8383   __Pyx_GOTREF(__pyx_t_1);
8384   __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 234, __pyx_L1_error)
8385   __Pyx_GOTREF(__pyx_t_2);
8386   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8387   __pyx_r = __pyx_t_2;
8388   __pyx_t_2 = 0;
8389   goto __pyx_L0;
8390 
8391   /* "View.MemoryView":233
8392  *         return self._shape[0]
8393  *
8394  *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
8395  *         return getattr(self.memview, attr)
8396  *
8397  */
8398 
8399   /* function exit code */
8400   __pyx_L1_error:;
8401   __Pyx_XDECREF(__pyx_t_1);
8402   __Pyx_XDECREF(__pyx_t_2);
8403   __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8404   __pyx_r = NULL;
8405   __pyx_L0:;
8406   __Pyx_XGIVEREF(__pyx_r);
8407   __Pyx_RefNannyFinishContext();
8408   return __pyx_r;
8409 }
8410 
8411 /* "View.MemoryView":236
8412  *         return getattr(self.memview, attr)
8413  *
8414  *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
8415  *         return self.memview[item]
8416  *
8417  */
8418 
8419 /* Python wrapper */
8420 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
__pyx_array___getitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_item)8421 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
8422   PyObject *__pyx_r = 0;
8423   __Pyx_RefNannyDeclarations
8424   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
8425   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
8426 
8427   /* function exit code */
8428   __Pyx_RefNannyFinishContext();
8429   return __pyx_r;
8430 }
8431 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_item)8432 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
8433   PyObject *__pyx_r = NULL;
8434   __Pyx_RefNannyDeclarations
8435   PyObject *__pyx_t_1 = NULL;
8436   PyObject *__pyx_t_2 = NULL;
8437   int __pyx_lineno = 0;
8438   const char *__pyx_filename = NULL;
8439   int __pyx_clineno = 0;
8440   __Pyx_RefNannySetupContext("__getitem__", 0);
8441 
8442   /* "View.MemoryView":237
8443  *
8444  *     def __getitem__(self, item):
8445  *         return self.memview[item]             # <<<<<<<<<<<<<<
8446  *
8447  *     def __setitem__(self, item, value):
8448  */
8449   __Pyx_XDECREF(__pyx_r);
8450   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 237, __pyx_L1_error)
8451   __Pyx_GOTREF(__pyx_t_1);
8452   __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 237, __pyx_L1_error)
8453   __Pyx_GOTREF(__pyx_t_2);
8454   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8455   __pyx_r = __pyx_t_2;
8456   __pyx_t_2 = 0;
8457   goto __pyx_L0;
8458 
8459   /* "View.MemoryView":236
8460  *         return getattr(self.memview, attr)
8461  *
8462  *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
8463  *         return self.memview[item]
8464  *
8465  */
8466 
8467   /* function exit code */
8468   __pyx_L1_error:;
8469   __Pyx_XDECREF(__pyx_t_1);
8470   __Pyx_XDECREF(__pyx_t_2);
8471   __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8472   __pyx_r = NULL;
8473   __pyx_L0:;
8474   __Pyx_XGIVEREF(__pyx_r);
8475   __Pyx_RefNannyFinishContext();
8476   return __pyx_r;
8477 }
8478 
8479 /* "View.MemoryView":239
8480  *         return self.memview[item]
8481  *
8482  *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
8483  *         self.memview[item] = value
8484  *
8485  */
8486 
8487 /* Python wrapper */
8488 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
__pyx_array___setitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_item,PyObject * __pyx_v_value)8489 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
8490   int __pyx_r;
8491   __Pyx_RefNannyDeclarations
8492   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
8493   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));
8494 
8495   /* function exit code */
8496   __Pyx_RefNannyFinishContext();
8497   return __pyx_r;
8498 }
8499 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_item,PyObject * __pyx_v_value)8500 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
8501   int __pyx_r;
8502   __Pyx_RefNannyDeclarations
8503   PyObject *__pyx_t_1 = NULL;
8504   int __pyx_lineno = 0;
8505   const char *__pyx_filename = NULL;
8506   int __pyx_clineno = 0;
8507   __Pyx_RefNannySetupContext("__setitem__", 0);
8508 
8509   /* "View.MemoryView":240
8510  *
8511  *     def __setitem__(self, item, value):
8512  *         self.memview[item] = value             # <<<<<<<<<<<<<<
8513  *
8514  *
8515  */
8516   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 240, __pyx_L1_error)
8517   __Pyx_GOTREF(__pyx_t_1);
8518   if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 240, __pyx_L1_error)
8519   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8520 
8521   /* "View.MemoryView":239
8522  *         return self.memview[item]
8523  *
8524  *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
8525  *         self.memview[item] = value
8526  *
8527  */
8528 
8529   /* function exit code */
8530   __pyx_r = 0;
8531   goto __pyx_L0;
8532   __pyx_L1_error:;
8533   __Pyx_XDECREF(__pyx_t_1);
8534   __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8535   __pyx_r = -1;
8536   __pyx_L0:;
8537   __Pyx_RefNannyFinishContext();
8538   return __pyx_r;
8539 }
8540 
8541 /* "(tree fragment)":1
8542  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
8543  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8544  * def __setstate_cython__(self, __pyx_state):
8545  */
8546 
8547 /* Python wrapper */
8548 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_array_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)8549 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8550   PyObject *__pyx_r = 0;
8551   __Pyx_RefNannyDeclarations
8552   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
8553   __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));
8554 
8555   /* function exit code */
8556   __Pyx_RefNannyFinishContext();
8557   return __pyx_r;
8558 }
8559 
__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj * __pyx_v_self)8560 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
8561   PyObject *__pyx_r = NULL;
8562   __Pyx_RefNannyDeclarations
8563   PyObject *__pyx_t_1 = NULL;
8564   int __pyx_lineno = 0;
8565   const char *__pyx_filename = NULL;
8566   int __pyx_clineno = 0;
8567   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
8568 
8569   /* "(tree fragment)":2
8570  * def __reduce_cython__(self):
8571  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
8572  * def __setstate_cython__(self, __pyx_state):
8573  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8574  */
8575   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
8576   __Pyx_GOTREF(__pyx_t_1);
8577   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8578   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8579   __PYX_ERR(2, 2, __pyx_L1_error)
8580 
8581   /* "(tree fragment)":1
8582  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
8583  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8584  * def __setstate_cython__(self, __pyx_state):
8585  */
8586 
8587   /* function exit code */
8588   __pyx_L1_error:;
8589   __Pyx_XDECREF(__pyx_t_1);
8590   __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8591   __pyx_r = NULL;
8592   __Pyx_XGIVEREF(__pyx_r);
8593   __Pyx_RefNannyFinishContext();
8594   return __pyx_r;
8595 }
8596 
8597 /* "(tree fragment)":3
8598  * def __reduce_cython__(self):
8599  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8600  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
8601  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8602  */
8603 
8604 /* Python wrapper */
8605 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_array_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)8606 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8607   PyObject *__pyx_r = 0;
8608   __Pyx_RefNannyDeclarations
8609   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
8610   __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
8611 
8612   /* function exit code */
8613   __Pyx_RefNannyFinishContext();
8614   return __pyx_r;
8615 }
8616 
__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)8617 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
8618   PyObject *__pyx_r = NULL;
8619   __Pyx_RefNannyDeclarations
8620   PyObject *__pyx_t_1 = NULL;
8621   int __pyx_lineno = 0;
8622   const char *__pyx_filename = NULL;
8623   int __pyx_clineno = 0;
8624   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
8625 
8626   /* "(tree fragment)":4
8627  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8628  * def __setstate_cython__(self, __pyx_state):
8629  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
8630  */
8631   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
8632   __Pyx_GOTREF(__pyx_t_1);
8633   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8634   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8635   __PYX_ERR(2, 4, __pyx_L1_error)
8636 
8637   /* "(tree fragment)":3
8638  * def __reduce_cython__(self):
8639  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8640  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
8641  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8642  */
8643 
8644   /* function exit code */
8645   __pyx_L1_error:;
8646   __Pyx_XDECREF(__pyx_t_1);
8647   __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8648   __pyx_r = NULL;
8649   __Pyx_XGIVEREF(__pyx_r);
8650   __Pyx_RefNannyFinishContext();
8651   return __pyx_r;
8652 }
8653 
8654 /* "View.MemoryView":244
8655  *
8656  * @cname("__pyx_array_new")
8657  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
8658  *                           char *mode, char *buf):
8659  *     cdef array result
8660  */
8661 
__pyx_array_new(PyObject * __pyx_v_shape,Py_ssize_t __pyx_v_itemsize,char * __pyx_v_format,char * __pyx_v_mode,char * __pyx_v_buf)8662 static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) {
8663   struct __pyx_array_obj *__pyx_v_result = 0;
8664   struct __pyx_array_obj *__pyx_r = NULL;
8665   __Pyx_RefNannyDeclarations
8666   int __pyx_t_1;
8667   PyObject *__pyx_t_2 = NULL;
8668   PyObject *__pyx_t_3 = NULL;
8669   PyObject *__pyx_t_4 = NULL;
8670   PyObject *__pyx_t_5 = NULL;
8671   int __pyx_lineno = 0;
8672   const char *__pyx_filename = NULL;
8673   int __pyx_clineno = 0;
8674   __Pyx_RefNannySetupContext("array_cwrapper", 0);
8675 
8676   /* "View.MemoryView":248
8677  *     cdef array result
8678  *
8679  *     if buf == NULL:             # <<<<<<<<<<<<<<
8680  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
8681  *     else:
8682  */
8683   __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
8684   if (__pyx_t_1) {
8685 
8686     /* "View.MemoryView":249
8687  *
8688  *     if buf == NULL:
8689  *         result = array(shape, itemsize, format, mode.decode('ASCII'))             # <<<<<<<<<<<<<<
8690  *     else:
8691  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
8692  */
8693     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 249, __pyx_L1_error)
8694     __Pyx_GOTREF(__pyx_t_2);
8695     __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 249, __pyx_L1_error)
8696     __Pyx_GOTREF(__pyx_t_3);
8697     __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error)
8698     __Pyx_GOTREF(__pyx_t_4);
8699     __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 249, __pyx_L1_error)
8700     __Pyx_GOTREF(__pyx_t_5);
8701     __Pyx_INCREF(__pyx_v_shape);
8702     __Pyx_GIVEREF(__pyx_v_shape);
8703     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
8704     __Pyx_GIVEREF(__pyx_t_2);
8705     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
8706     __Pyx_GIVEREF(__pyx_t_3);
8707     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
8708     __Pyx_GIVEREF(__pyx_t_4);
8709     PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
8710     __pyx_t_2 = 0;
8711     __pyx_t_3 = 0;
8712     __pyx_t_4 = 0;
8713     __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error)
8714     __Pyx_GOTREF(__pyx_t_4);
8715     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8716     __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
8717     __pyx_t_4 = 0;
8718 
8719     /* "View.MemoryView":248
8720  *     cdef array result
8721  *
8722  *     if buf == NULL:             # <<<<<<<<<<<<<<
8723  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
8724  *     else:
8725  */
8726     goto __pyx_L3;
8727   }
8728 
8729   /* "View.MemoryView":251
8730  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
8731  *     else:
8732  *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
8733  *                        allocate_buffer=False)
8734  *         result.data = buf
8735  */
8736   /*else*/ {
8737     __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 251, __pyx_L1_error)
8738     __Pyx_GOTREF(__pyx_t_4);
8739     __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error)
8740     __Pyx_GOTREF(__pyx_t_5);
8741     __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 251, __pyx_L1_error)
8742     __Pyx_GOTREF(__pyx_t_3);
8743     __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 251, __pyx_L1_error)
8744     __Pyx_GOTREF(__pyx_t_2);
8745     __Pyx_INCREF(__pyx_v_shape);
8746     __Pyx_GIVEREF(__pyx_v_shape);
8747     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
8748     __Pyx_GIVEREF(__pyx_t_4);
8749     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
8750     __Pyx_GIVEREF(__pyx_t_5);
8751     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
8752     __Pyx_GIVEREF(__pyx_t_3);
8753     PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
8754     __pyx_t_4 = 0;
8755     __pyx_t_5 = 0;
8756     __pyx_t_3 = 0;
8757 
8758     /* "View.MemoryView":252
8759  *     else:
8760  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
8761  *                        allocate_buffer=False)             # <<<<<<<<<<<<<<
8762  *         result.data = buf
8763  *
8764  */
8765     __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error)
8766     __Pyx_GOTREF(__pyx_t_3);
8767     if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 252, __pyx_L1_error)
8768 
8769     /* "View.MemoryView":251
8770  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
8771  *     else:
8772  *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
8773  *                        allocate_buffer=False)
8774  *         result.data = buf
8775  */
8776     __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error)
8777     __Pyx_GOTREF(__pyx_t_5);
8778     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8779     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8780     __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
8781     __pyx_t_5 = 0;
8782 
8783     /* "View.MemoryView":253
8784  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
8785  *                        allocate_buffer=False)
8786  *         result.data = buf             # <<<<<<<<<<<<<<
8787  *
8788  *     return result
8789  */
8790     __pyx_v_result->data = __pyx_v_buf;
8791   }
8792   __pyx_L3:;
8793 
8794   /* "View.MemoryView":255
8795  *         result.data = buf
8796  *
8797  *     return result             # <<<<<<<<<<<<<<
8798  *
8799  *
8800  */
8801   __Pyx_XDECREF(((PyObject *)__pyx_r));
8802   __Pyx_INCREF(((PyObject *)__pyx_v_result));
8803   __pyx_r = __pyx_v_result;
8804   goto __pyx_L0;
8805 
8806   /* "View.MemoryView":244
8807  *
8808  * @cname("__pyx_array_new")
8809  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
8810  *                           char *mode, char *buf):
8811  *     cdef array result
8812  */
8813 
8814   /* function exit code */
8815   __pyx_L1_error:;
8816   __Pyx_XDECREF(__pyx_t_2);
8817   __Pyx_XDECREF(__pyx_t_3);
8818   __Pyx_XDECREF(__pyx_t_4);
8819   __Pyx_XDECREF(__pyx_t_5);
8820   __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
8821   __pyx_r = 0;
8822   __pyx_L0:;
8823   __Pyx_XDECREF((PyObject *)__pyx_v_result);
8824   __Pyx_XGIVEREF((PyObject *)__pyx_r);
8825   __Pyx_RefNannyFinishContext();
8826   return __pyx_r;
8827 }
8828 
8829 /* "View.MemoryView":281
8830  * cdef class Enum(object):
8831  *     cdef object name
8832  *     def __init__(self, name):             # <<<<<<<<<<<<<<
8833  *         self.name = name
8834  *     def __repr__(self):
8835  */
8836 
8837 /* Python wrapper */
8838 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_MemviewEnum___init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)8839 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8840   PyObject *__pyx_v_name = 0;
8841   int __pyx_lineno = 0;
8842   const char *__pyx_filename = NULL;
8843   int __pyx_clineno = 0;
8844   int __pyx_r;
8845   __Pyx_RefNannyDeclarations
8846   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
8847   {
8848     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
8849     PyObject* values[1] = {0};
8850     if (unlikely(__pyx_kwds)) {
8851       Py_ssize_t kw_args;
8852       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8853       switch (pos_args) {
8854         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8855         CYTHON_FALLTHROUGH;
8856         case  0: break;
8857         default: goto __pyx_L5_argtuple_error;
8858       }
8859       kw_args = PyDict_Size(__pyx_kwds);
8860       switch (pos_args) {
8861         case  0:
8862         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
8863         else goto __pyx_L5_argtuple_error;
8864       }
8865       if (unlikely(kw_args > 0)) {
8866         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 281, __pyx_L3_error)
8867       }
8868     } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
8869       goto __pyx_L5_argtuple_error;
8870     } else {
8871       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8872     }
8873     __pyx_v_name = values[0];
8874   }
8875   goto __pyx_L4_argument_unpacking_done;
8876   __pyx_L5_argtuple_error:;
8877   __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 281, __pyx_L3_error)
8878   __pyx_L3_error:;
8879   __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8880   __Pyx_RefNannyFinishContext();
8881   return -1;
8882   __pyx_L4_argument_unpacking_done:;
8883   __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
8884 
8885   /* function exit code */
8886   __Pyx_RefNannyFinishContext();
8887   return __pyx_r;
8888 }
8889 
__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj * __pyx_v_self,PyObject * __pyx_v_name)8890 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
8891   int __pyx_r;
8892   __Pyx_RefNannyDeclarations
8893   __Pyx_RefNannySetupContext("__init__", 0);
8894 
8895   /* "View.MemoryView":282
8896  *     cdef object name
8897  *     def __init__(self, name):
8898  *         self.name = name             # <<<<<<<<<<<<<<
8899  *     def __repr__(self):
8900  *         return self.name
8901  */
8902   __Pyx_INCREF(__pyx_v_name);
8903   __Pyx_GIVEREF(__pyx_v_name);
8904   __Pyx_GOTREF(__pyx_v_self->name);
8905   __Pyx_DECREF(__pyx_v_self->name);
8906   __pyx_v_self->name = __pyx_v_name;
8907 
8908   /* "View.MemoryView":281
8909  * cdef class Enum(object):
8910  *     cdef object name
8911  *     def __init__(self, name):             # <<<<<<<<<<<<<<
8912  *         self.name = name
8913  *     def __repr__(self):
8914  */
8915 
8916   /* function exit code */
8917   __pyx_r = 0;
8918   __Pyx_RefNannyFinishContext();
8919   return __pyx_r;
8920 }
8921 
8922 /* "View.MemoryView":283
8923  *     def __init__(self, name):
8924  *         self.name = name
8925  *     def __repr__(self):             # <<<<<<<<<<<<<<
8926  *         return self.name
8927  *
8928  */
8929 
8930 /* Python wrapper */
8931 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_MemviewEnum___repr__(PyObject * __pyx_v_self)8932 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
8933   PyObject *__pyx_r = 0;
8934   __Pyx_RefNannyDeclarations
8935   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
8936   __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
8937 
8938   /* function exit code */
8939   __Pyx_RefNannyFinishContext();
8940   return __pyx_r;
8941 }
8942 
__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj * __pyx_v_self)8943 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
8944   PyObject *__pyx_r = NULL;
8945   __Pyx_RefNannyDeclarations
8946   __Pyx_RefNannySetupContext("__repr__", 0);
8947 
8948   /* "View.MemoryView":284
8949  *         self.name = name
8950  *     def __repr__(self):
8951  *         return self.name             # <<<<<<<<<<<<<<
8952  *
8953  * cdef generic = Enum("<strided and direct or indirect>")
8954  */
8955   __Pyx_XDECREF(__pyx_r);
8956   __Pyx_INCREF(__pyx_v_self->name);
8957   __pyx_r = __pyx_v_self->name;
8958   goto __pyx_L0;
8959 
8960   /* "View.MemoryView":283
8961  *     def __init__(self, name):
8962  *         self.name = name
8963  *     def __repr__(self):             # <<<<<<<<<<<<<<
8964  *         return self.name
8965  *
8966  */
8967 
8968   /* function exit code */
8969   __pyx_L0:;
8970   __Pyx_XGIVEREF(__pyx_r);
8971   __Pyx_RefNannyFinishContext();
8972   return __pyx_r;
8973 }
8974 
8975 /* "(tree fragment)":1
8976  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
8977  *     cdef tuple state
8978  *     cdef object _dict
8979  */
8980 
8981 /* Python wrapper */
8982 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)8983 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8984   PyObject *__pyx_r = 0;
8985   __Pyx_RefNannyDeclarations
8986   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
8987   __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
8988 
8989   /* function exit code */
8990   __Pyx_RefNannyFinishContext();
8991   return __pyx_r;
8992 }
8993 
__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj * __pyx_v_self)8994 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
8995   PyObject *__pyx_v_state = 0;
8996   PyObject *__pyx_v__dict = 0;
8997   int __pyx_v_use_setstate;
8998   PyObject *__pyx_r = NULL;
8999   __Pyx_RefNannyDeclarations
9000   PyObject *__pyx_t_1 = NULL;
9001   int __pyx_t_2;
9002   int __pyx_t_3;
9003   PyObject *__pyx_t_4 = NULL;
9004   PyObject *__pyx_t_5 = NULL;
9005   int __pyx_lineno = 0;
9006   const char *__pyx_filename = NULL;
9007   int __pyx_clineno = 0;
9008   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
9009 
9010   /* "(tree fragment)":5
9011  *     cdef object _dict
9012  *     cdef bint use_setstate
9013  *     state = (self.name,)             # <<<<<<<<<<<<<<
9014  *     _dict = getattr(self, '__dict__', None)
9015  *     if _dict is not None:
9016  */
9017   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
9018   __Pyx_GOTREF(__pyx_t_1);
9019   __Pyx_INCREF(__pyx_v_self->name);
9020   __Pyx_GIVEREF(__pyx_v_self->name);
9021   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
9022   __pyx_v_state = ((PyObject*)__pyx_t_1);
9023   __pyx_t_1 = 0;
9024 
9025   /* "(tree fragment)":6
9026  *     cdef bint use_setstate
9027  *     state = (self.name,)
9028  *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
9029  *     if _dict is not None:
9030  *         state += (_dict,)
9031  */
9032   __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error)
9033   __Pyx_GOTREF(__pyx_t_1);
9034   __pyx_v__dict = __pyx_t_1;
9035   __pyx_t_1 = 0;
9036 
9037   /* "(tree fragment)":7
9038  *     state = (self.name,)
9039  *     _dict = getattr(self, '__dict__', None)
9040  *     if _dict is not None:             # <<<<<<<<<<<<<<
9041  *         state += (_dict,)
9042  *         use_setstate = True
9043  */
9044   __pyx_t_2 = (__pyx_v__dict != Py_None);
9045   __pyx_t_3 = (__pyx_t_2 != 0);
9046   if (__pyx_t_3) {
9047 
9048     /* "(tree fragment)":8
9049  *     _dict = getattr(self, '__dict__', None)
9050  *     if _dict is not None:
9051  *         state += (_dict,)             # <<<<<<<<<<<<<<
9052  *         use_setstate = True
9053  *     else:
9054  */
9055     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error)
9056     __Pyx_GOTREF(__pyx_t_1);
9057     __Pyx_INCREF(__pyx_v__dict);
9058     __Pyx_GIVEREF(__pyx_v__dict);
9059     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
9060     __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error)
9061     __Pyx_GOTREF(__pyx_t_4);
9062     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9063     __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
9064     __pyx_t_4 = 0;
9065 
9066     /* "(tree fragment)":9
9067  *     if _dict is not None:
9068  *         state += (_dict,)
9069  *         use_setstate = True             # <<<<<<<<<<<<<<
9070  *     else:
9071  *         use_setstate = self.name is not None
9072  */
9073     __pyx_v_use_setstate = 1;
9074 
9075     /* "(tree fragment)":7
9076  *     state = (self.name,)
9077  *     _dict = getattr(self, '__dict__', None)
9078  *     if _dict is not None:             # <<<<<<<<<<<<<<
9079  *         state += (_dict,)
9080  *         use_setstate = True
9081  */
9082     goto __pyx_L3;
9083   }
9084 
9085   /* "(tree fragment)":11
9086  *         use_setstate = True
9087  *     else:
9088  *         use_setstate = self.name is not None             # <<<<<<<<<<<<<<
9089  *     if use_setstate:
9090  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
9091  */
9092   /*else*/ {
9093     __pyx_t_3 = (__pyx_v_self->name != Py_None);
9094     __pyx_v_use_setstate = __pyx_t_3;
9095   }
9096   __pyx_L3:;
9097 
9098   /* "(tree fragment)":12
9099  *     else:
9100  *         use_setstate = self.name is not None
9101  *     if use_setstate:             # <<<<<<<<<<<<<<
9102  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
9103  *     else:
9104  */
9105   __pyx_t_3 = (__pyx_v_use_setstate != 0);
9106   if (__pyx_t_3) {
9107 
9108     /* "(tree fragment)":13
9109  *         use_setstate = self.name is not None
9110  *     if use_setstate:
9111  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state             # <<<<<<<<<<<<<<
9112  *     else:
9113  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
9114  */
9115     __Pyx_XDECREF(__pyx_r);
9116     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error)
9117     __Pyx_GOTREF(__pyx_t_4);
9118     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error)
9119     __Pyx_GOTREF(__pyx_t_1);
9120     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9121     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9122     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9123     __Pyx_INCREF(__pyx_int_184977713);
9124     __Pyx_GIVEREF(__pyx_int_184977713);
9125     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
9126     __Pyx_INCREF(Py_None);
9127     __Pyx_GIVEREF(Py_None);
9128     PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
9129     __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error)
9130     __Pyx_GOTREF(__pyx_t_5);
9131     __Pyx_GIVEREF(__pyx_t_4);
9132     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
9133     __Pyx_GIVEREF(__pyx_t_1);
9134     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
9135     __Pyx_INCREF(__pyx_v_state);
9136     __Pyx_GIVEREF(__pyx_v_state);
9137     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
9138     __pyx_t_4 = 0;
9139     __pyx_t_1 = 0;
9140     __pyx_r = __pyx_t_5;
9141     __pyx_t_5 = 0;
9142     goto __pyx_L0;
9143 
9144     /* "(tree fragment)":12
9145  *     else:
9146  *         use_setstate = self.name is not None
9147  *     if use_setstate:             # <<<<<<<<<<<<<<
9148  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
9149  *     else:
9150  */
9151   }
9152 
9153   /* "(tree fragment)":15
9154  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
9155  *     else:
9156  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)             # <<<<<<<<<<<<<<
9157  * def __setstate_cython__(self, __pyx_state):
9158  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
9159  */
9160   /*else*/ {
9161     __Pyx_XDECREF(__pyx_r);
9162     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error)
9163     __Pyx_GOTREF(__pyx_t_5);
9164     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error)
9165     __Pyx_GOTREF(__pyx_t_1);
9166     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9167     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9168     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9169     __Pyx_INCREF(__pyx_int_184977713);
9170     __Pyx_GIVEREF(__pyx_int_184977713);
9171     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
9172     __Pyx_INCREF(__pyx_v_state);
9173     __Pyx_GIVEREF(__pyx_v_state);
9174     PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
9175     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error)
9176     __Pyx_GOTREF(__pyx_t_4);
9177     __Pyx_GIVEREF(__pyx_t_5);
9178     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
9179     __Pyx_GIVEREF(__pyx_t_1);
9180     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
9181     __pyx_t_5 = 0;
9182     __pyx_t_1 = 0;
9183     __pyx_r = __pyx_t_4;
9184     __pyx_t_4 = 0;
9185     goto __pyx_L0;
9186   }
9187 
9188   /* "(tree fragment)":1
9189  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
9190  *     cdef tuple state
9191  *     cdef object _dict
9192  */
9193 
9194   /* function exit code */
9195   __pyx_L1_error:;
9196   __Pyx_XDECREF(__pyx_t_1);
9197   __Pyx_XDECREF(__pyx_t_4);
9198   __Pyx_XDECREF(__pyx_t_5);
9199   __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9200   __pyx_r = NULL;
9201   __pyx_L0:;
9202   __Pyx_XDECREF(__pyx_v_state);
9203   __Pyx_XDECREF(__pyx_v__dict);
9204   __Pyx_XGIVEREF(__pyx_r);
9205   __Pyx_RefNannyFinishContext();
9206   return __pyx_r;
9207 }
9208 
9209 /* "(tree fragment)":16
9210  *     else:
9211  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
9212  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
9213  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
9214  */
9215 
9216 /* Python wrapper */
9217 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)9218 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
9219   PyObject *__pyx_r = 0;
9220   __Pyx_RefNannyDeclarations
9221   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
9222   __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
9223 
9224   /* function exit code */
9225   __Pyx_RefNannyFinishContext();
9226   return __pyx_r;
9227 }
9228 
__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj * __pyx_v_self,PyObject * __pyx_v___pyx_state)9229 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
9230   PyObject *__pyx_r = NULL;
9231   __Pyx_RefNannyDeclarations
9232   PyObject *__pyx_t_1 = NULL;
9233   int __pyx_lineno = 0;
9234   const char *__pyx_filename = NULL;
9235   int __pyx_clineno = 0;
9236   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
9237 
9238   /* "(tree fragment)":17
9239  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
9240  * def __setstate_cython__(self, __pyx_state):
9241  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
9242  */
9243   if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 17, __pyx_L1_error)
9244   __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error)
9245   __Pyx_GOTREF(__pyx_t_1);
9246   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9247 
9248   /* "(tree fragment)":16
9249  *     else:
9250  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
9251  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
9252  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
9253  */
9254 
9255   /* function exit code */
9256   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9257   goto __pyx_L0;
9258   __pyx_L1_error:;
9259   __Pyx_XDECREF(__pyx_t_1);
9260   __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9261   __pyx_r = NULL;
9262   __pyx_L0:;
9263   __Pyx_XGIVEREF(__pyx_r);
9264   __Pyx_RefNannyFinishContext();
9265   return __pyx_r;
9266 }
9267 
9268 /* "View.MemoryView":298
9269  *
9270  * @cname('__pyx_align_pointer')
9271  * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
9272  *     "Align pointer memory on a given boundary"
9273  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
9274  */
9275 
__pyx_align_pointer(void * __pyx_v_memory,size_t __pyx_v_alignment)9276 static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
9277   Py_intptr_t __pyx_v_aligned_p;
9278   size_t __pyx_v_offset;
9279   void *__pyx_r;
9280   int __pyx_t_1;
9281 
9282   /* "View.MemoryView":300
9283  * cdef void *align_pointer(void *memory, size_t alignment) nogil:
9284  *     "Align pointer memory on a given boundary"
9285  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory             # <<<<<<<<<<<<<<
9286  *     cdef size_t offset
9287  *
9288  */
9289   __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
9290 
9291   /* "View.MemoryView":304
9292  *
9293  *     with cython.cdivision(True):
9294  *         offset = aligned_p % alignment             # <<<<<<<<<<<<<<
9295  *
9296  *     if offset > 0:
9297  */
9298   __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
9299 
9300   /* "View.MemoryView":306
9301  *         offset = aligned_p % alignment
9302  *
9303  *     if offset > 0:             # <<<<<<<<<<<<<<
9304  *         aligned_p += alignment - offset
9305  *
9306  */
9307   __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
9308   if (__pyx_t_1) {
9309 
9310     /* "View.MemoryView":307
9311  *
9312  *     if offset > 0:
9313  *         aligned_p += alignment - offset             # <<<<<<<<<<<<<<
9314  *
9315  *     return <void *> aligned_p
9316  */
9317     __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
9318 
9319     /* "View.MemoryView":306
9320  *         offset = aligned_p % alignment
9321  *
9322  *     if offset > 0:             # <<<<<<<<<<<<<<
9323  *         aligned_p += alignment - offset
9324  *
9325  */
9326   }
9327 
9328   /* "View.MemoryView":309
9329  *         aligned_p += alignment - offset
9330  *
9331  *     return <void *> aligned_p             # <<<<<<<<<<<<<<
9332  *
9333  *
9334  */
9335   __pyx_r = ((void *)__pyx_v_aligned_p);
9336   goto __pyx_L0;
9337 
9338   /* "View.MemoryView":298
9339  *
9340  * @cname('__pyx_align_pointer')
9341  * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
9342  *     "Align pointer memory on a given boundary"
9343  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
9344  */
9345 
9346   /* function exit code */
9347   __pyx_L0:;
9348   return __pyx_r;
9349 }
9350 
9351 /* "View.MemoryView":345
9352  *     cdef __Pyx_TypeInfo *typeinfo
9353  *
9354  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
9355  *         self.obj = obj
9356  *         self.flags = flags
9357  */
9358 
9359 /* Python wrapper */
9360 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_memoryview___cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)9361 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9362   PyObject *__pyx_v_obj = 0;
9363   int __pyx_v_flags;
9364   int __pyx_v_dtype_is_object;
9365   int __pyx_lineno = 0;
9366   const char *__pyx_filename = NULL;
9367   int __pyx_clineno = 0;
9368   int __pyx_r;
9369   __Pyx_RefNannyDeclarations
9370   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
9371   {
9372     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
9373     PyObject* values[3] = {0,0,0};
9374     if (unlikely(__pyx_kwds)) {
9375       Py_ssize_t kw_args;
9376       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9377       switch (pos_args) {
9378         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9379         CYTHON_FALLTHROUGH;
9380         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9381         CYTHON_FALLTHROUGH;
9382         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9383         CYTHON_FALLTHROUGH;
9384         case  0: break;
9385         default: goto __pyx_L5_argtuple_error;
9386       }
9387       kw_args = PyDict_Size(__pyx_kwds);
9388       switch (pos_args) {
9389         case  0:
9390         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
9391         else goto __pyx_L5_argtuple_error;
9392         CYTHON_FALLTHROUGH;
9393         case  1:
9394         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
9395         else {
9396           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 345, __pyx_L3_error)
9397         }
9398         CYTHON_FALLTHROUGH;
9399         case  2:
9400         if (kw_args > 0) {
9401           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
9402           if (value) { values[2] = value; kw_args--; }
9403         }
9404       }
9405       if (unlikely(kw_args > 0)) {
9406         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 345, __pyx_L3_error)
9407       }
9408     } else {
9409       switch (PyTuple_GET_SIZE(__pyx_args)) {
9410         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9411         CYTHON_FALLTHROUGH;
9412         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9413         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9414         break;
9415         default: goto __pyx_L5_argtuple_error;
9416       }
9417     }
9418     __pyx_v_obj = values[0];
9419     __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __pyx_L3_error)
9420     if (values[2]) {
9421       __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __pyx_L3_error)
9422     } else {
9423       __pyx_v_dtype_is_object = ((int)0);
9424     }
9425   }
9426   goto __pyx_L4_argument_unpacking_done;
9427   __pyx_L5_argtuple_error:;
9428   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 345, __pyx_L3_error)
9429   __pyx_L3_error:;
9430   __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9431   __Pyx_RefNannyFinishContext();
9432   return -1;
9433   __pyx_L4_argument_unpacking_done:;
9434   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);
9435 
9436   /* function exit code */
9437   __Pyx_RefNannyFinishContext();
9438   return __pyx_r;
9439 }
9440 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_obj,int __pyx_v_flags,int __pyx_v_dtype_is_object)9441 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) {
9442   int __pyx_r;
9443   __Pyx_RefNannyDeclarations
9444   int __pyx_t_1;
9445   int __pyx_t_2;
9446   int __pyx_t_3;
9447   int __pyx_t_4;
9448   int __pyx_lineno = 0;
9449   const char *__pyx_filename = NULL;
9450   int __pyx_clineno = 0;
9451   __Pyx_RefNannySetupContext("__cinit__", 0);
9452 
9453   /* "View.MemoryView":346
9454  *
9455  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
9456  *         self.obj = obj             # <<<<<<<<<<<<<<
9457  *         self.flags = flags
9458  *         if type(self) is memoryview or obj is not None:
9459  */
9460   __Pyx_INCREF(__pyx_v_obj);
9461   __Pyx_GIVEREF(__pyx_v_obj);
9462   __Pyx_GOTREF(__pyx_v_self->obj);
9463   __Pyx_DECREF(__pyx_v_self->obj);
9464   __pyx_v_self->obj = __pyx_v_obj;
9465 
9466   /* "View.MemoryView":347
9467  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
9468  *         self.obj = obj
9469  *         self.flags = flags             # <<<<<<<<<<<<<<
9470  *         if type(self) is memoryview or obj is not None:
9471  *             __Pyx_GetBuffer(obj, &self.view, flags)
9472  */
9473   __pyx_v_self->flags = __pyx_v_flags;
9474 
9475   /* "View.MemoryView":348
9476  *         self.obj = obj
9477  *         self.flags = flags
9478  *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
9479  *             __Pyx_GetBuffer(obj, &self.view, flags)
9480  *             if <PyObject *> self.view.obj == NULL:
9481  */
9482   __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
9483   __pyx_t_3 = (__pyx_t_2 != 0);
9484   if (!__pyx_t_3) {
9485   } else {
9486     __pyx_t_1 = __pyx_t_3;
9487     goto __pyx_L4_bool_binop_done;
9488   }
9489   __pyx_t_3 = (__pyx_v_obj != Py_None);
9490   __pyx_t_2 = (__pyx_t_3 != 0);
9491   __pyx_t_1 = __pyx_t_2;
9492   __pyx_L4_bool_binop_done:;
9493   if (__pyx_t_1) {
9494 
9495     /* "View.MemoryView":349
9496  *         self.flags = flags
9497  *         if type(self) is memoryview or obj is not None:
9498  *             __Pyx_GetBuffer(obj, &self.view, flags)             # <<<<<<<<<<<<<<
9499  *             if <PyObject *> self.view.obj == NULL:
9500  *                 (<__pyx_buffer *> &self.view).obj = Py_None
9501  */
9502     __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 349, __pyx_L1_error)
9503 
9504     /* "View.MemoryView":350
9505  *         if type(self) is memoryview or obj is not None:
9506  *             __Pyx_GetBuffer(obj, &self.view, flags)
9507  *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
9508  *                 (<__pyx_buffer *> &self.view).obj = Py_None
9509  *                 Py_INCREF(Py_None)
9510  */
9511     __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
9512     if (__pyx_t_1) {
9513 
9514       /* "View.MemoryView":351
9515  *             __Pyx_GetBuffer(obj, &self.view, flags)
9516  *             if <PyObject *> self.view.obj == NULL:
9517  *                 (<__pyx_buffer *> &self.view).obj = Py_None             # <<<<<<<<<<<<<<
9518  *                 Py_INCREF(Py_None)
9519  *
9520  */
9521       ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
9522 
9523       /* "View.MemoryView":352
9524  *             if <PyObject *> self.view.obj == NULL:
9525  *                 (<__pyx_buffer *> &self.view).obj = Py_None
9526  *                 Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
9527  *
9528  *         global __pyx_memoryview_thread_locks_used
9529  */
9530       Py_INCREF(Py_None);
9531 
9532       /* "View.MemoryView":350
9533  *         if type(self) is memoryview or obj is not None:
9534  *             __Pyx_GetBuffer(obj, &self.view, flags)
9535  *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
9536  *                 (<__pyx_buffer *> &self.view).obj = Py_None
9537  *                 Py_INCREF(Py_None)
9538  */
9539     }
9540 
9541     /* "View.MemoryView":348
9542  *         self.obj = obj
9543  *         self.flags = flags
9544  *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
9545  *             __Pyx_GetBuffer(obj, &self.view, flags)
9546  *             if <PyObject *> self.view.obj == NULL:
9547  */
9548   }
9549 
9550   /* "View.MemoryView":355
9551  *
9552  *         global __pyx_memoryview_thread_locks_used
9553  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
9554  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
9555  *             __pyx_memoryview_thread_locks_used += 1
9556  */
9557   __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
9558   if (__pyx_t_1) {
9559 
9560     /* "View.MemoryView":356
9561  *         global __pyx_memoryview_thread_locks_used
9562  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
9563  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]             # <<<<<<<<<<<<<<
9564  *             __pyx_memoryview_thread_locks_used += 1
9565  *         if self.lock is NULL:
9566  */
9567     __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
9568 
9569     /* "View.MemoryView":357
9570  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
9571  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
9572  *             __pyx_memoryview_thread_locks_used += 1             # <<<<<<<<<<<<<<
9573  *         if self.lock is NULL:
9574  *             self.lock = PyThread_allocate_lock()
9575  */
9576     __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
9577 
9578     /* "View.MemoryView":355
9579  *
9580  *         global __pyx_memoryview_thread_locks_used
9581  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
9582  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
9583  *             __pyx_memoryview_thread_locks_used += 1
9584  */
9585   }
9586 
9587   /* "View.MemoryView":358
9588  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
9589  *             __pyx_memoryview_thread_locks_used += 1
9590  *         if self.lock is NULL:             # <<<<<<<<<<<<<<
9591  *             self.lock = PyThread_allocate_lock()
9592  *             if self.lock is NULL:
9593  */
9594   __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
9595   if (__pyx_t_1) {
9596 
9597     /* "View.MemoryView":359
9598  *             __pyx_memoryview_thread_locks_used += 1
9599  *         if self.lock is NULL:
9600  *             self.lock = PyThread_allocate_lock()             # <<<<<<<<<<<<<<
9601  *             if self.lock is NULL:
9602  *                 raise MemoryError
9603  */
9604     __pyx_v_self->lock = PyThread_allocate_lock();
9605 
9606     /* "View.MemoryView":360
9607  *         if self.lock is NULL:
9608  *             self.lock = PyThread_allocate_lock()
9609  *             if self.lock is NULL:             # <<<<<<<<<<<<<<
9610  *                 raise MemoryError
9611  *
9612  */
9613     __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
9614     if (unlikely(__pyx_t_1)) {
9615 
9616       /* "View.MemoryView":361
9617  *             self.lock = PyThread_allocate_lock()
9618  *             if self.lock is NULL:
9619  *                 raise MemoryError             # <<<<<<<<<<<<<<
9620  *
9621  *         if flags & PyBUF_FORMAT:
9622  */
9623       PyErr_NoMemory(); __PYX_ERR(2, 361, __pyx_L1_error)
9624 
9625       /* "View.MemoryView":360
9626  *         if self.lock is NULL:
9627  *             self.lock = PyThread_allocate_lock()
9628  *             if self.lock is NULL:             # <<<<<<<<<<<<<<
9629  *                 raise MemoryError
9630  *
9631  */
9632     }
9633 
9634     /* "View.MemoryView":358
9635  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
9636  *             __pyx_memoryview_thread_locks_used += 1
9637  *         if self.lock is NULL:             # <<<<<<<<<<<<<<
9638  *             self.lock = PyThread_allocate_lock()
9639  *             if self.lock is NULL:
9640  */
9641   }
9642 
9643   /* "View.MemoryView":363
9644  *                 raise MemoryError
9645  *
9646  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
9647  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
9648  *         else:
9649  */
9650   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
9651   if (__pyx_t_1) {
9652 
9653     /* "View.MemoryView":364
9654  *
9655  *         if flags & PyBUF_FORMAT:
9656  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')             # <<<<<<<<<<<<<<
9657  *         else:
9658  *             self.dtype_is_object = dtype_is_object
9659  */
9660     __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
9661     if (__pyx_t_2) {
9662     } else {
9663       __pyx_t_1 = __pyx_t_2;
9664       goto __pyx_L11_bool_binop_done;
9665     }
9666     __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
9667     __pyx_t_1 = __pyx_t_2;
9668     __pyx_L11_bool_binop_done:;
9669     __pyx_v_self->dtype_is_object = __pyx_t_1;
9670 
9671     /* "View.MemoryView":363
9672  *                 raise MemoryError
9673  *
9674  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
9675  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
9676  *         else:
9677  */
9678     goto __pyx_L10;
9679   }
9680 
9681   /* "View.MemoryView":366
9682  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
9683  *         else:
9684  *             self.dtype_is_object = dtype_is_object             # <<<<<<<<<<<<<<
9685  *
9686  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
9687  */
9688   /*else*/ {
9689     __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
9690   }
9691   __pyx_L10:;
9692 
9693   /* "View.MemoryView":368
9694  *             self.dtype_is_object = dtype_is_object
9695  *
9696  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(             # <<<<<<<<<<<<<<
9697  *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
9698  *         self.typeinfo = NULL
9699  */
9700   __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));
9701 
9702   /* "View.MemoryView":370
9703  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
9704  *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
9705  *         self.typeinfo = NULL             # <<<<<<<<<<<<<<
9706  *
9707  *     def __dealloc__(memoryview self):
9708  */
9709   __pyx_v_self->typeinfo = NULL;
9710 
9711   /* "View.MemoryView":345
9712  *     cdef __Pyx_TypeInfo *typeinfo
9713  *
9714  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
9715  *         self.obj = obj
9716  *         self.flags = flags
9717  */
9718 
9719   /* function exit code */
9720   __pyx_r = 0;
9721   goto __pyx_L0;
9722   __pyx_L1_error:;
9723   __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9724   __pyx_r = -1;
9725   __pyx_L0:;
9726   __Pyx_RefNannyFinishContext();
9727   return __pyx_r;
9728 }
9729 
9730 /* "View.MemoryView":372
9731  *         self.typeinfo = NULL
9732  *
9733  *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
9734  *         if self.obj is not None:
9735  *             __Pyx_ReleaseBuffer(&self.view)
9736  */
9737 
9738 /* Python wrapper */
9739 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___dealloc__(PyObject * __pyx_v_self)9740 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
9741   __Pyx_RefNannyDeclarations
9742   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
9743   __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));
9744 
9745   /* function exit code */
9746   __Pyx_RefNannyFinishContext();
9747 }
9748 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj * __pyx_v_self)9749 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
9750   int __pyx_v_i;
9751   __Pyx_RefNannyDeclarations
9752   int __pyx_t_1;
9753   int __pyx_t_2;
9754   int __pyx_t_3;
9755   int __pyx_t_4;
9756   int __pyx_t_5;
9757   PyThread_type_lock __pyx_t_6;
9758   PyThread_type_lock __pyx_t_7;
9759   __Pyx_RefNannySetupContext("__dealloc__", 0);
9760 
9761   /* "View.MemoryView":373
9762  *
9763  *     def __dealloc__(memoryview self):
9764  *         if self.obj is not None:             # <<<<<<<<<<<<<<
9765  *             __Pyx_ReleaseBuffer(&self.view)
9766  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
9767  */
9768   __pyx_t_1 = (__pyx_v_self->obj != Py_None);
9769   __pyx_t_2 = (__pyx_t_1 != 0);
9770   if (__pyx_t_2) {
9771 
9772     /* "View.MemoryView":374
9773  *     def __dealloc__(memoryview self):
9774  *         if self.obj is not None:
9775  *             __Pyx_ReleaseBuffer(&self.view)             # <<<<<<<<<<<<<<
9776  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
9777  *
9778  */
9779     __Pyx_ReleaseBuffer((&__pyx_v_self->view));
9780 
9781     /* "View.MemoryView":373
9782  *
9783  *     def __dealloc__(memoryview self):
9784  *         if self.obj is not None:             # <<<<<<<<<<<<<<
9785  *             __Pyx_ReleaseBuffer(&self.view)
9786  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
9787  */
9788     goto __pyx_L3;
9789   }
9790 
9791   /* "View.MemoryView":375
9792  *         if self.obj is not None:
9793  *             __Pyx_ReleaseBuffer(&self.view)
9794  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
9795  *
9796  *             (<__pyx_buffer *> &self.view).obj = NULL
9797  */
9798   __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
9799   if (__pyx_t_2) {
9800 
9801     /* "View.MemoryView":377
9802  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
9803  *
9804  *             (<__pyx_buffer *> &self.view).obj = NULL             # <<<<<<<<<<<<<<
9805  *             Py_DECREF(Py_None)
9806  *
9807  */
9808     ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
9809 
9810     /* "View.MemoryView":378
9811  *
9812  *             (<__pyx_buffer *> &self.view).obj = NULL
9813  *             Py_DECREF(Py_None)             # <<<<<<<<<<<<<<
9814  *
9815  *         cdef int i
9816  */
9817     Py_DECREF(Py_None);
9818 
9819     /* "View.MemoryView":375
9820  *         if self.obj is not None:
9821  *             __Pyx_ReleaseBuffer(&self.view)
9822  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
9823  *
9824  *             (<__pyx_buffer *> &self.view).obj = NULL
9825  */
9826   }
9827   __pyx_L3:;
9828 
9829   /* "View.MemoryView":382
9830  *         cdef int i
9831  *         global __pyx_memoryview_thread_locks_used
9832  *         if self.lock != NULL:             # <<<<<<<<<<<<<<
9833  *             for i in range(__pyx_memoryview_thread_locks_used):
9834  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
9835  */
9836   __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
9837   if (__pyx_t_2) {
9838 
9839     /* "View.MemoryView":383
9840  *         global __pyx_memoryview_thread_locks_used
9841  *         if self.lock != NULL:
9842  *             for i in range(__pyx_memoryview_thread_locks_used):             # <<<<<<<<<<<<<<
9843  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
9844  *                     __pyx_memoryview_thread_locks_used -= 1
9845  */
9846     __pyx_t_3 = __pyx_memoryview_thread_locks_used;
9847     __pyx_t_4 = __pyx_t_3;
9848     for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
9849       __pyx_v_i = __pyx_t_5;
9850 
9851       /* "View.MemoryView":384
9852  *         if self.lock != NULL:
9853  *             for i in range(__pyx_memoryview_thread_locks_used):
9854  *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
9855  *                     __pyx_memoryview_thread_locks_used -= 1
9856  *                     if i != __pyx_memoryview_thread_locks_used:
9857  */
9858       __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
9859       if (__pyx_t_2) {
9860 
9861         /* "View.MemoryView":385
9862  *             for i in range(__pyx_memoryview_thread_locks_used):
9863  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
9864  *                     __pyx_memoryview_thread_locks_used -= 1             # <<<<<<<<<<<<<<
9865  *                     if i != __pyx_memoryview_thread_locks_used:
9866  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
9867  */
9868         __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
9869 
9870         /* "View.MemoryView":386
9871  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
9872  *                     __pyx_memoryview_thread_locks_used -= 1
9873  *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
9874  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
9875  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
9876  */
9877         __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
9878         if (__pyx_t_2) {
9879 
9880           /* "View.MemoryView":388
9881  *                     if i != __pyx_memoryview_thread_locks_used:
9882  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
9883  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])             # <<<<<<<<<<<<<<
9884  *                     break
9885  *             else:
9886  */
9887           __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
9888           __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
9889 
9890           /* "View.MemoryView":387
9891  *                     __pyx_memoryview_thread_locks_used -= 1
9892  *                     if i != __pyx_memoryview_thread_locks_used:
9893  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (             # <<<<<<<<<<<<<<
9894  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
9895  *                     break
9896  */
9897           (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
9898           (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
9899 
9900           /* "View.MemoryView":386
9901  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
9902  *                     __pyx_memoryview_thread_locks_used -= 1
9903  *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
9904  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
9905  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
9906  */
9907         }
9908 
9909         /* "View.MemoryView":389
9910  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
9911  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
9912  *                     break             # <<<<<<<<<<<<<<
9913  *             else:
9914  *                 PyThread_free_lock(self.lock)
9915  */
9916         goto __pyx_L6_break;
9917 
9918         /* "View.MemoryView":384
9919  *         if self.lock != NULL:
9920  *             for i in range(__pyx_memoryview_thread_locks_used):
9921  *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
9922  *                     __pyx_memoryview_thread_locks_used -= 1
9923  *                     if i != __pyx_memoryview_thread_locks_used:
9924  */
9925       }
9926     }
9927     /*else*/ {
9928 
9929       /* "View.MemoryView":391
9930  *                     break
9931  *             else:
9932  *                 PyThread_free_lock(self.lock)             # <<<<<<<<<<<<<<
9933  *
9934  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
9935  */
9936       PyThread_free_lock(__pyx_v_self->lock);
9937     }
9938     __pyx_L6_break:;
9939 
9940     /* "View.MemoryView":382
9941  *         cdef int i
9942  *         global __pyx_memoryview_thread_locks_used
9943  *         if self.lock != NULL:             # <<<<<<<<<<<<<<
9944  *             for i in range(__pyx_memoryview_thread_locks_used):
9945  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
9946  */
9947   }
9948 
9949   /* "View.MemoryView":372
9950  *         self.typeinfo = NULL
9951  *
9952  *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
9953  *         if self.obj is not None:
9954  *             __Pyx_ReleaseBuffer(&self.view)
9955  */
9956 
9957   /* function exit code */
9958   __Pyx_RefNannyFinishContext();
9959 }
9960 
9961 /* "View.MemoryView":393
9962  *                 PyThread_free_lock(self.lock)
9963  *
9964  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
9965  *         cdef Py_ssize_t dim
9966  *         cdef char *itemp = <char *> self.view.buf
9967  */
9968 
__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index)9969 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
9970   Py_ssize_t __pyx_v_dim;
9971   char *__pyx_v_itemp;
9972   PyObject *__pyx_v_idx = NULL;
9973   char *__pyx_r;
9974   __Pyx_RefNannyDeclarations
9975   Py_ssize_t __pyx_t_1;
9976   PyObject *__pyx_t_2 = NULL;
9977   Py_ssize_t __pyx_t_3;
9978   PyObject *(*__pyx_t_4)(PyObject *);
9979   PyObject *__pyx_t_5 = NULL;
9980   Py_ssize_t __pyx_t_6;
9981   char *__pyx_t_7;
9982   int __pyx_lineno = 0;
9983   const char *__pyx_filename = NULL;
9984   int __pyx_clineno = 0;
9985   __Pyx_RefNannySetupContext("get_item_pointer", 0);
9986 
9987   /* "View.MemoryView":395
9988  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
9989  *         cdef Py_ssize_t dim
9990  *         cdef char *itemp = <char *> self.view.buf             # <<<<<<<<<<<<<<
9991  *
9992  *         for dim, idx in enumerate(index):
9993  */
9994   __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
9995 
9996   /* "View.MemoryView":397
9997  *         cdef char *itemp = <char *> self.view.buf
9998  *
9999  *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
10000  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
10001  *
10002  */
10003   __pyx_t_1 = 0;
10004   if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
10005     __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
10006     __pyx_t_4 = NULL;
10007   } else {
10008     __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 397, __pyx_L1_error)
10009     __Pyx_GOTREF(__pyx_t_2);
10010     __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 397, __pyx_L1_error)
10011   }
10012   for (;;) {
10013     if (likely(!__pyx_t_4)) {
10014       if (likely(PyList_CheckExact(__pyx_t_2))) {
10015         if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
10016         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10017         __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 397, __pyx_L1_error)
10018         #else
10019         __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 397, __pyx_L1_error)
10020         __Pyx_GOTREF(__pyx_t_5);
10021         #endif
10022       } else {
10023         if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
10024         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10025         __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 397, __pyx_L1_error)
10026         #else
10027         __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 397, __pyx_L1_error)
10028         __Pyx_GOTREF(__pyx_t_5);
10029         #endif
10030       }
10031     } else {
10032       __pyx_t_5 = __pyx_t_4(__pyx_t_2);
10033       if (unlikely(!__pyx_t_5)) {
10034         PyObject* exc_type = PyErr_Occurred();
10035         if (exc_type) {
10036           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
10037           else __PYX_ERR(2, 397, __pyx_L1_error)
10038         }
10039         break;
10040       }
10041       __Pyx_GOTREF(__pyx_t_5);
10042     }
10043     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
10044     __pyx_t_5 = 0;
10045     __pyx_v_dim = __pyx_t_1;
10046     __pyx_t_1 = (__pyx_t_1 + 1);
10047 
10048     /* "View.MemoryView":398
10049  *
10050  *         for dim, idx in enumerate(index):
10051  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)             # <<<<<<<<<<<<<<
10052  *
10053  *         return itemp
10054  */
10055     __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 398, __pyx_L1_error)
10056     __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(2, 398, __pyx_L1_error)
10057     __pyx_v_itemp = __pyx_t_7;
10058 
10059     /* "View.MemoryView":397
10060  *         cdef char *itemp = <char *> self.view.buf
10061  *
10062  *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
10063  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
10064  *
10065  */
10066   }
10067   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10068 
10069   /* "View.MemoryView":400
10070  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
10071  *
10072  *         return itemp             # <<<<<<<<<<<<<<
10073  *
10074  *
10075  */
10076   __pyx_r = __pyx_v_itemp;
10077   goto __pyx_L0;
10078 
10079   /* "View.MemoryView":393
10080  *                 PyThread_free_lock(self.lock)
10081  *
10082  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
10083  *         cdef Py_ssize_t dim
10084  *         cdef char *itemp = <char *> self.view.buf
10085  */
10086 
10087   /* function exit code */
10088   __pyx_L1_error:;
10089   __Pyx_XDECREF(__pyx_t_2);
10090   __Pyx_XDECREF(__pyx_t_5);
10091   __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
10092   __pyx_r = NULL;
10093   __pyx_L0:;
10094   __Pyx_XDECREF(__pyx_v_idx);
10095   __Pyx_RefNannyFinishContext();
10096   return __pyx_r;
10097 }
10098 
10099 /* "View.MemoryView":403
10100  *
10101  *
10102  *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
10103  *         if index is Ellipsis:
10104  *             return self
10105  */
10106 
10107 /* Python wrapper */
10108 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
__pyx_memoryview___getitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_index)10109 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
10110   PyObject *__pyx_r = 0;
10111   __Pyx_RefNannyDeclarations
10112   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
10113   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
10114 
10115   /* function exit code */
10116   __Pyx_RefNannyFinishContext();
10117   return __pyx_r;
10118 }
10119 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index)10120 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
10121   PyObject *__pyx_v_have_slices = NULL;
10122   PyObject *__pyx_v_indices = NULL;
10123   char *__pyx_v_itemp;
10124   PyObject *__pyx_r = NULL;
10125   __Pyx_RefNannyDeclarations
10126   int __pyx_t_1;
10127   int __pyx_t_2;
10128   PyObject *__pyx_t_3 = NULL;
10129   PyObject *__pyx_t_4 = NULL;
10130   PyObject *__pyx_t_5 = NULL;
10131   char *__pyx_t_6;
10132   int __pyx_lineno = 0;
10133   const char *__pyx_filename = NULL;
10134   int __pyx_clineno = 0;
10135   __Pyx_RefNannySetupContext("__getitem__", 0);
10136 
10137   /* "View.MemoryView":404
10138  *
10139  *     def __getitem__(memoryview self, object index):
10140  *         if index is Ellipsis:             # <<<<<<<<<<<<<<
10141  *             return self
10142  *
10143  */
10144   __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
10145   __pyx_t_2 = (__pyx_t_1 != 0);
10146   if (__pyx_t_2) {
10147 
10148     /* "View.MemoryView":405
10149  *     def __getitem__(memoryview self, object index):
10150  *         if index is Ellipsis:
10151  *             return self             # <<<<<<<<<<<<<<
10152  *
10153  *         have_slices, indices = _unellipsify(index, self.view.ndim)
10154  */
10155     __Pyx_XDECREF(__pyx_r);
10156     __Pyx_INCREF(((PyObject *)__pyx_v_self));
10157     __pyx_r = ((PyObject *)__pyx_v_self);
10158     goto __pyx_L0;
10159 
10160     /* "View.MemoryView":404
10161  *
10162  *     def __getitem__(memoryview self, object index):
10163  *         if index is Ellipsis:             # <<<<<<<<<<<<<<
10164  *             return self
10165  *
10166  */
10167   }
10168 
10169   /* "View.MemoryView":407
10170  *             return self
10171  *
10172  *         have_slices, indices = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
10173  *
10174  *         cdef char *itemp
10175  */
10176   __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 407, __pyx_L1_error)
10177   __Pyx_GOTREF(__pyx_t_3);
10178   if (likely(__pyx_t_3 != Py_None)) {
10179     PyObject* sequence = __pyx_t_3;
10180     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
10181     if (unlikely(size != 2)) {
10182       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
10183       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
10184       __PYX_ERR(2, 407, __pyx_L1_error)
10185     }
10186     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10187     __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
10188     __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
10189     __Pyx_INCREF(__pyx_t_4);
10190     __Pyx_INCREF(__pyx_t_5);
10191     #else
10192     __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 407, __pyx_L1_error)
10193     __Pyx_GOTREF(__pyx_t_4);
10194     __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 407, __pyx_L1_error)
10195     __Pyx_GOTREF(__pyx_t_5);
10196     #endif
10197     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10198   } else {
10199     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 407, __pyx_L1_error)
10200   }
10201   __pyx_v_have_slices = __pyx_t_4;
10202   __pyx_t_4 = 0;
10203   __pyx_v_indices = __pyx_t_5;
10204   __pyx_t_5 = 0;
10205 
10206   /* "View.MemoryView":410
10207  *
10208  *         cdef char *itemp
10209  *         if have_slices:             # <<<<<<<<<<<<<<
10210  *             return memview_slice(self, indices)
10211  *         else:
10212  */
10213   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 410, __pyx_L1_error)
10214   if (__pyx_t_2) {
10215 
10216     /* "View.MemoryView":411
10217  *         cdef char *itemp
10218  *         if have_slices:
10219  *             return memview_slice(self, indices)             # <<<<<<<<<<<<<<
10220  *         else:
10221  *             itemp = self.get_item_pointer(indices)
10222  */
10223     __Pyx_XDECREF(__pyx_r);
10224     __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 411, __pyx_L1_error)
10225     __Pyx_GOTREF(__pyx_t_3);
10226     __pyx_r = __pyx_t_3;
10227     __pyx_t_3 = 0;
10228     goto __pyx_L0;
10229 
10230     /* "View.MemoryView":410
10231  *
10232  *         cdef char *itemp
10233  *         if have_slices:             # <<<<<<<<<<<<<<
10234  *             return memview_slice(self, indices)
10235  *         else:
10236  */
10237   }
10238 
10239   /* "View.MemoryView":413
10240  *             return memview_slice(self, indices)
10241  *         else:
10242  *             itemp = self.get_item_pointer(indices)             # <<<<<<<<<<<<<<
10243  *             return self.convert_item_to_object(itemp)
10244  *
10245  */
10246   /*else*/ {
10247     __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(2, 413, __pyx_L1_error)
10248     __pyx_v_itemp = __pyx_t_6;
10249 
10250     /* "View.MemoryView":414
10251  *         else:
10252  *             itemp = self.get_item_pointer(indices)
10253  *             return self.convert_item_to_object(itemp)             # <<<<<<<<<<<<<<
10254  *
10255  *     def __setitem__(memoryview self, object index, object value):
10256  */
10257     __Pyx_XDECREF(__pyx_r);
10258     __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 414, __pyx_L1_error)
10259     __Pyx_GOTREF(__pyx_t_3);
10260     __pyx_r = __pyx_t_3;
10261     __pyx_t_3 = 0;
10262     goto __pyx_L0;
10263   }
10264 
10265   /* "View.MemoryView":403
10266  *
10267  *
10268  *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
10269  *         if index is Ellipsis:
10270  *             return self
10271  */
10272 
10273   /* function exit code */
10274   __pyx_L1_error:;
10275   __Pyx_XDECREF(__pyx_t_3);
10276   __Pyx_XDECREF(__pyx_t_4);
10277   __Pyx_XDECREF(__pyx_t_5);
10278   __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10279   __pyx_r = NULL;
10280   __pyx_L0:;
10281   __Pyx_XDECREF(__pyx_v_have_slices);
10282   __Pyx_XDECREF(__pyx_v_indices);
10283   __Pyx_XGIVEREF(__pyx_r);
10284   __Pyx_RefNannyFinishContext();
10285   return __pyx_r;
10286 }
10287 
10288 /* "View.MemoryView":416
10289  *             return self.convert_item_to_object(itemp)
10290  *
10291  *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
10292  *         if self.view.readonly:
10293  *             raise TypeError("Cannot assign to read-only memoryview")
10294  */
10295 
10296 /* Python wrapper */
10297 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
__pyx_memoryview___setitem__(PyObject * __pyx_v_self,PyObject * __pyx_v_index,PyObject * __pyx_v_value)10298 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
10299   int __pyx_r;
10300   __Pyx_RefNannyDeclarations
10301   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
10302   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));
10303 
10304   /* function exit code */
10305   __Pyx_RefNannyFinishContext();
10306   return __pyx_r;
10307 }
10308 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index,PyObject * __pyx_v_value)10309 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
10310   PyObject *__pyx_v_have_slices = NULL;
10311   PyObject *__pyx_v_obj = NULL;
10312   int __pyx_r;
10313   __Pyx_RefNannyDeclarations
10314   int __pyx_t_1;
10315   PyObject *__pyx_t_2 = NULL;
10316   PyObject *__pyx_t_3 = NULL;
10317   PyObject *__pyx_t_4 = NULL;
10318   int __pyx_lineno = 0;
10319   const char *__pyx_filename = NULL;
10320   int __pyx_clineno = 0;
10321   __Pyx_RefNannySetupContext("__setitem__", 0);
10322   __Pyx_INCREF(__pyx_v_index);
10323 
10324   /* "View.MemoryView":417
10325  *
10326  *     def __setitem__(memoryview self, object index, object value):
10327  *         if self.view.readonly:             # <<<<<<<<<<<<<<
10328  *             raise TypeError("Cannot assign to read-only memoryview")
10329  *
10330  */
10331   __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
10332   if (unlikely(__pyx_t_1)) {
10333 
10334     /* "View.MemoryView":418
10335  *     def __setitem__(memoryview self, object index, object value):
10336  *         if self.view.readonly:
10337  *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
10338  *
10339  *         have_slices, index = _unellipsify(index, self.view.ndim)
10340  */
10341     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 418, __pyx_L1_error)
10342     __Pyx_GOTREF(__pyx_t_2);
10343     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
10344     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10345     __PYX_ERR(2, 418, __pyx_L1_error)
10346 
10347     /* "View.MemoryView":417
10348  *
10349  *     def __setitem__(memoryview self, object index, object value):
10350  *         if self.view.readonly:             # <<<<<<<<<<<<<<
10351  *             raise TypeError("Cannot assign to read-only memoryview")
10352  *
10353  */
10354   }
10355 
10356   /* "View.MemoryView":420
10357  *             raise TypeError("Cannot assign to read-only memoryview")
10358  *
10359  *         have_slices, index = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
10360  *
10361  *         if have_slices:
10362  */
10363   __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error)
10364   __Pyx_GOTREF(__pyx_t_2);
10365   if (likely(__pyx_t_2 != Py_None)) {
10366     PyObject* sequence = __pyx_t_2;
10367     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
10368     if (unlikely(size != 2)) {
10369       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
10370       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
10371       __PYX_ERR(2, 420, __pyx_L1_error)
10372     }
10373     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10374     __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
10375     __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
10376     __Pyx_INCREF(__pyx_t_3);
10377     __Pyx_INCREF(__pyx_t_4);
10378     #else
10379     __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 420, __pyx_L1_error)
10380     __Pyx_GOTREF(__pyx_t_3);
10381     __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 420, __pyx_L1_error)
10382     __Pyx_GOTREF(__pyx_t_4);
10383     #endif
10384     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10385   } else {
10386     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 420, __pyx_L1_error)
10387   }
10388   __pyx_v_have_slices = __pyx_t_3;
10389   __pyx_t_3 = 0;
10390   __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
10391   __pyx_t_4 = 0;
10392 
10393   /* "View.MemoryView":422
10394  *         have_slices, index = _unellipsify(index, self.view.ndim)
10395  *
10396  *         if have_slices:             # <<<<<<<<<<<<<<
10397  *             obj = self.is_slice(value)
10398  *             if obj:
10399  */
10400   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 422, __pyx_L1_error)
10401   if (__pyx_t_1) {
10402 
10403     /* "View.MemoryView":423
10404  *
10405  *         if have_slices:
10406  *             obj = self.is_slice(value)             # <<<<<<<<<<<<<<
10407  *             if obj:
10408  *                 self.setitem_slice_assignment(self[index], obj)
10409  */
10410     __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 423, __pyx_L1_error)
10411     __Pyx_GOTREF(__pyx_t_2);
10412     __pyx_v_obj = __pyx_t_2;
10413     __pyx_t_2 = 0;
10414 
10415     /* "View.MemoryView":424
10416  *         if have_slices:
10417  *             obj = self.is_slice(value)
10418  *             if obj:             # <<<<<<<<<<<<<<
10419  *                 self.setitem_slice_assignment(self[index], obj)
10420  *             else:
10421  */
10422     __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error)
10423     if (__pyx_t_1) {
10424 
10425       /* "View.MemoryView":425
10426  *             obj = self.is_slice(value)
10427  *             if obj:
10428  *                 self.setitem_slice_assignment(self[index], obj)             # <<<<<<<<<<<<<<
10429  *             else:
10430  *                 self.setitem_slice_assign_scalar(self[index], value)
10431  */
10432       __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 425, __pyx_L1_error)
10433       __Pyx_GOTREF(__pyx_t_2);
10434       __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 425, __pyx_L1_error)
10435       __Pyx_GOTREF(__pyx_t_4);
10436       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10437       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10438 
10439       /* "View.MemoryView":424
10440  *         if have_slices:
10441  *             obj = self.is_slice(value)
10442  *             if obj:             # <<<<<<<<<<<<<<
10443  *                 self.setitem_slice_assignment(self[index], obj)
10444  *             else:
10445  */
10446       goto __pyx_L5;
10447     }
10448 
10449     /* "View.MemoryView":427
10450  *                 self.setitem_slice_assignment(self[index], obj)
10451  *             else:
10452  *                 self.setitem_slice_assign_scalar(self[index], value)             # <<<<<<<<<<<<<<
10453  *         else:
10454  *             self.setitem_indexed(index, value)
10455  */
10456     /*else*/ {
10457       __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 427, __pyx_L1_error)
10458       __Pyx_GOTREF(__pyx_t_4);
10459       if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 427, __pyx_L1_error)
10460       __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 427, __pyx_L1_error)
10461       __Pyx_GOTREF(__pyx_t_2);
10462       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10463       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10464     }
10465     __pyx_L5:;
10466 
10467     /* "View.MemoryView":422
10468  *         have_slices, index = _unellipsify(index, self.view.ndim)
10469  *
10470  *         if have_slices:             # <<<<<<<<<<<<<<
10471  *             obj = self.is_slice(value)
10472  *             if obj:
10473  */
10474     goto __pyx_L4;
10475   }
10476 
10477   /* "View.MemoryView":429
10478  *                 self.setitem_slice_assign_scalar(self[index], value)
10479  *         else:
10480  *             self.setitem_indexed(index, value)             # <<<<<<<<<<<<<<
10481  *
10482  *     cdef is_slice(self, obj):
10483  */
10484   /*else*/ {
10485     __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 429, __pyx_L1_error)
10486     __Pyx_GOTREF(__pyx_t_2);
10487     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10488   }
10489   __pyx_L4:;
10490 
10491   /* "View.MemoryView":416
10492  *             return self.convert_item_to_object(itemp)
10493  *
10494  *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
10495  *         if self.view.readonly:
10496  *             raise TypeError("Cannot assign to read-only memoryview")
10497  */
10498 
10499   /* function exit code */
10500   __pyx_r = 0;
10501   goto __pyx_L0;
10502   __pyx_L1_error:;
10503   __Pyx_XDECREF(__pyx_t_2);
10504   __Pyx_XDECREF(__pyx_t_3);
10505   __Pyx_XDECREF(__pyx_t_4);
10506   __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10507   __pyx_r = -1;
10508   __pyx_L0:;
10509   __Pyx_XDECREF(__pyx_v_have_slices);
10510   __Pyx_XDECREF(__pyx_v_obj);
10511   __Pyx_XDECREF(__pyx_v_index);
10512   __Pyx_RefNannyFinishContext();
10513   return __pyx_r;
10514 }
10515 
10516 /* "View.MemoryView":431
10517  *             self.setitem_indexed(index, value)
10518  *
10519  *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
10520  *         if not isinstance(obj, memoryview):
10521  *             try:
10522  */
10523 
__pyx_memoryview_is_slice(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_obj)10524 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
10525   PyObject *__pyx_r = NULL;
10526   __Pyx_RefNannyDeclarations
10527   int __pyx_t_1;
10528   int __pyx_t_2;
10529   PyObject *__pyx_t_3 = NULL;
10530   PyObject *__pyx_t_4 = NULL;
10531   PyObject *__pyx_t_5 = NULL;
10532   PyObject *__pyx_t_6 = NULL;
10533   PyObject *__pyx_t_7 = NULL;
10534   PyObject *__pyx_t_8 = NULL;
10535   int __pyx_t_9;
10536   int __pyx_lineno = 0;
10537   const char *__pyx_filename = NULL;
10538   int __pyx_clineno = 0;
10539   __Pyx_RefNannySetupContext("is_slice", 0);
10540   __Pyx_INCREF(__pyx_v_obj);
10541 
10542   /* "View.MemoryView":432
10543  *
10544  *     cdef is_slice(self, obj):
10545  *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
10546  *             try:
10547  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10548  */
10549   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
10550   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
10551   if (__pyx_t_2) {
10552 
10553     /* "View.MemoryView":433
10554  *     cdef is_slice(self, obj):
10555  *         if not isinstance(obj, memoryview):
10556  *             try:             # <<<<<<<<<<<<<<
10557  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10558  *                                  self.dtype_is_object)
10559  */
10560     {
10561       __Pyx_PyThreadState_declare
10562       __Pyx_PyThreadState_assign
10563       __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
10564       __Pyx_XGOTREF(__pyx_t_3);
10565       __Pyx_XGOTREF(__pyx_t_4);
10566       __Pyx_XGOTREF(__pyx_t_5);
10567       /*try:*/ {
10568 
10569         /* "View.MemoryView":434
10570  *         if not isinstance(obj, memoryview):
10571  *             try:
10572  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
10573  *                                  self.dtype_is_object)
10574  *             except TypeError:
10575  */
10576         __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 434, __pyx_L4_error)
10577         __Pyx_GOTREF(__pyx_t_6);
10578 
10579         /* "View.MemoryView":435
10580  *             try:
10581  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10582  *                                  self.dtype_is_object)             # <<<<<<<<<<<<<<
10583  *             except TypeError:
10584  *                 return None
10585  */
10586         __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 435, __pyx_L4_error)
10587         __Pyx_GOTREF(__pyx_t_7);
10588 
10589         /* "View.MemoryView":434
10590  *         if not isinstance(obj, memoryview):
10591  *             try:
10592  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
10593  *                                  self.dtype_is_object)
10594  *             except TypeError:
10595  */
10596         __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 434, __pyx_L4_error)
10597         __Pyx_GOTREF(__pyx_t_8);
10598         __Pyx_INCREF(__pyx_v_obj);
10599         __Pyx_GIVEREF(__pyx_v_obj);
10600         PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
10601         __Pyx_GIVEREF(__pyx_t_6);
10602         PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
10603         __Pyx_GIVEREF(__pyx_t_7);
10604         PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
10605         __pyx_t_6 = 0;
10606         __pyx_t_7 = 0;
10607         __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 434, __pyx_L4_error)
10608         __Pyx_GOTREF(__pyx_t_7);
10609         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10610         __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
10611         __pyx_t_7 = 0;
10612 
10613         /* "View.MemoryView":433
10614  *     cdef is_slice(self, obj):
10615  *         if not isinstance(obj, memoryview):
10616  *             try:             # <<<<<<<<<<<<<<
10617  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10618  *                                  self.dtype_is_object)
10619  */
10620       }
10621       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10622       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
10623       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10624       goto __pyx_L9_try_end;
10625       __pyx_L4_error:;
10626       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
10627       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
10628       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
10629 
10630       /* "View.MemoryView":436
10631  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10632  *                                  self.dtype_is_object)
10633  *             except TypeError:             # <<<<<<<<<<<<<<
10634  *                 return None
10635  *
10636  */
10637       __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
10638       if (__pyx_t_9) {
10639         __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
10640         if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 436, __pyx_L6_except_error)
10641         __Pyx_GOTREF(__pyx_t_7);
10642         __Pyx_GOTREF(__pyx_t_8);
10643         __Pyx_GOTREF(__pyx_t_6);
10644 
10645         /* "View.MemoryView":437
10646  *                                  self.dtype_is_object)
10647  *             except TypeError:
10648  *                 return None             # <<<<<<<<<<<<<<
10649  *
10650  *         return obj
10651  */
10652         __Pyx_XDECREF(__pyx_r);
10653         __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10654         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10655         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10656         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10657         goto __pyx_L7_except_return;
10658       }
10659       goto __pyx_L6_except_error;
10660       __pyx_L6_except_error:;
10661 
10662       /* "View.MemoryView":433
10663  *     cdef is_slice(self, obj):
10664  *         if not isinstance(obj, memoryview):
10665  *             try:             # <<<<<<<<<<<<<<
10666  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10667  *                                  self.dtype_is_object)
10668  */
10669       __Pyx_XGIVEREF(__pyx_t_3);
10670       __Pyx_XGIVEREF(__pyx_t_4);
10671       __Pyx_XGIVEREF(__pyx_t_5);
10672       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
10673       goto __pyx_L1_error;
10674       __pyx_L7_except_return:;
10675       __Pyx_XGIVEREF(__pyx_t_3);
10676       __Pyx_XGIVEREF(__pyx_t_4);
10677       __Pyx_XGIVEREF(__pyx_t_5);
10678       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
10679       goto __pyx_L0;
10680       __pyx_L9_try_end:;
10681     }
10682 
10683     /* "View.MemoryView":432
10684  *
10685  *     cdef is_slice(self, obj):
10686  *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
10687  *             try:
10688  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10689  */
10690   }
10691 
10692   /* "View.MemoryView":439
10693  *                 return None
10694  *
10695  *         return obj             # <<<<<<<<<<<<<<
10696  *
10697  *     cdef setitem_slice_assignment(self, dst, src):
10698  */
10699   __Pyx_XDECREF(__pyx_r);
10700   __Pyx_INCREF(__pyx_v_obj);
10701   __pyx_r = __pyx_v_obj;
10702   goto __pyx_L0;
10703 
10704   /* "View.MemoryView":431
10705  *             self.setitem_indexed(index, value)
10706  *
10707  *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
10708  *         if not isinstance(obj, memoryview):
10709  *             try:
10710  */
10711 
10712   /* function exit code */
10713   __pyx_L1_error:;
10714   __Pyx_XDECREF(__pyx_t_6);
10715   __Pyx_XDECREF(__pyx_t_7);
10716   __Pyx_XDECREF(__pyx_t_8);
10717   __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
10718   __pyx_r = 0;
10719   __pyx_L0:;
10720   __Pyx_XDECREF(__pyx_v_obj);
10721   __Pyx_XGIVEREF(__pyx_r);
10722   __Pyx_RefNannyFinishContext();
10723   return __pyx_r;
10724 }
10725 
10726 /* "View.MemoryView":441
10727  *         return obj
10728  *
10729  *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
10730  *         cdef __Pyx_memviewslice dst_slice
10731  *         cdef __Pyx_memviewslice src_slice
10732  */
10733 
__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_dst,PyObject * __pyx_v_src)10734 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
10735   __Pyx_memviewslice __pyx_v_dst_slice;
10736   __Pyx_memviewslice __pyx_v_src_slice;
10737   PyObject *__pyx_r = NULL;
10738   __Pyx_RefNannyDeclarations
10739   __Pyx_memviewslice *__pyx_t_1;
10740   __Pyx_memviewslice *__pyx_t_2;
10741   PyObject *__pyx_t_3 = NULL;
10742   int __pyx_t_4;
10743   int __pyx_t_5;
10744   int __pyx_t_6;
10745   int __pyx_lineno = 0;
10746   const char *__pyx_filename = NULL;
10747   int __pyx_clineno = 0;
10748   __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
10749 
10750   /* "View.MemoryView":445
10751  *         cdef __Pyx_memviewslice src_slice
10752  *
10753  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
10754  *                                  get_slice_from_memview(dst, &dst_slice)[0],
10755  *                                  src.ndim, dst.ndim, self.dtype_is_object)
10756  */
10757   if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 445, __pyx_L1_error)
10758   __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 445, __pyx_L1_error)
10759 
10760   /* "View.MemoryView":446
10761  *
10762  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
10763  *                                  get_slice_from_memview(dst, &dst_slice)[0],             # <<<<<<<<<<<<<<
10764  *                                  src.ndim, dst.ndim, self.dtype_is_object)
10765  *
10766  */
10767   if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 446, __pyx_L1_error)
10768   __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 446, __pyx_L1_error)
10769 
10770   /* "View.MemoryView":447
10771  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
10772  *                                  get_slice_from_memview(dst, &dst_slice)[0],
10773  *                                  src.ndim, dst.ndim, self.dtype_is_object)             # <<<<<<<<<<<<<<
10774  *
10775  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
10776  */
10777   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 447, __pyx_L1_error)
10778   __Pyx_GOTREF(__pyx_t_3);
10779   __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 447, __pyx_L1_error)
10780   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10781   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 447, __pyx_L1_error)
10782   __Pyx_GOTREF(__pyx_t_3);
10783   __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 447, __pyx_L1_error)
10784   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10785 
10786   /* "View.MemoryView":445
10787  *         cdef __Pyx_memviewslice src_slice
10788  *
10789  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
10790  *                                  get_slice_from_memview(dst, &dst_slice)[0],
10791  *                                  src.ndim, dst.ndim, self.dtype_is_object)
10792  */
10793   __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 445, __pyx_L1_error)
10794 
10795   /* "View.MemoryView":441
10796  *         return obj
10797  *
10798  *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
10799  *         cdef __Pyx_memviewslice dst_slice
10800  *         cdef __Pyx_memviewslice src_slice
10801  */
10802 
10803   /* function exit code */
10804   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10805   goto __pyx_L0;
10806   __pyx_L1_error:;
10807   __Pyx_XDECREF(__pyx_t_3);
10808   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
10809   __pyx_r = 0;
10810   __pyx_L0:;
10811   __Pyx_XGIVEREF(__pyx_r);
10812   __Pyx_RefNannyFinishContext();
10813   return __pyx_r;
10814 }
10815 
10816 /* "View.MemoryView":449
10817  *                                  src.ndim, dst.ndim, self.dtype_is_object)
10818  *
10819  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
10820  *         cdef int array[128]
10821  *         cdef void *tmp = NULL
10822  */
10823 
__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj * __pyx_v_self,struct __pyx_memoryview_obj * __pyx_v_dst,PyObject * __pyx_v_value)10824 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
10825   int __pyx_v_array[0x80];
10826   void *__pyx_v_tmp;
10827   void *__pyx_v_item;
10828   __Pyx_memviewslice *__pyx_v_dst_slice;
10829   __Pyx_memviewslice __pyx_v_tmp_slice;
10830   PyObject *__pyx_r = NULL;
10831   __Pyx_RefNannyDeclarations
10832   __Pyx_memviewslice *__pyx_t_1;
10833   int __pyx_t_2;
10834   PyObject *__pyx_t_3 = NULL;
10835   int __pyx_t_4;
10836   int __pyx_t_5;
10837   char const *__pyx_t_6;
10838   PyObject *__pyx_t_7 = NULL;
10839   PyObject *__pyx_t_8 = NULL;
10840   PyObject *__pyx_t_9 = NULL;
10841   PyObject *__pyx_t_10 = NULL;
10842   PyObject *__pyx_t_11 = NULL;
10843   PyObject *__pyx_t_12 = NULL;
10844   int __pyx_lineno = 0;
10845   const char *__pyx_filename = NULL;
10846   int __pyx_clineno = 0;
10847   __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);
10848 
10849   /* "View.MemoryView":451
10850  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
10851  *         cdef int array[128]
10852  *         cdef void *tmp = NULL             # <<<<<<<<<<<<<<
10853  *         cdef void *item
10854  *
10855  */
10856   __pyx_v_tmp = NULL;
10857 
10858   /* "View.MemoryView":456
10859  *         cdef __Pyx_memviewslice *dst_slice
10860  *         cdef __Pyx_memviewslice tmp_slice
10861  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)             # <<<<<<<<<<<<<<
10862  *
10863  *         if <size_t>self.view.itemsize > sizeof(array):
10864  */
10865   __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 456, __pyx_L1_error)
10866   __pyx_v_dst_slice = __pyx_t_1;
10867 
10868   /* "View.MemoryView":458
10869  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
10870  *
10871  *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
10872  *             tmp = PyMem_Malloc(self.view.itemsize)
10873  *             if tmp == NULL:
10874  */
10875   __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
10876   if (__pyx_t_2) {
10877 
10878     /* "View.MemoryView":459
10879  *
10880  *         if <size_t>self.view.itemsize > sizeof(array):
10881  *             tmp = PyMem_Malloc(self.view.itemsize)             # <<<<<<<<<<<<<<
10882  *             if tmp == NULL:
10883  *                 raise MemoryError
10884  */
10885     __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
10886 
10887     /* "View.MemoryView":460
10888  *         if <size_t>self.view.itemsize > sizeof(array):
10889  *             tmp = PyMem_Malloc(self.view.itemsize)
10890  *             if tmp == NULL:             # <<<<<<<<<<<<<<
10891  *                 raise MemoryError
10892  *             item = tmp
10893  */
10894     __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
10895     if (unlikely(__pyx_t_2)) {
10896 
10897       /* "View.MemoryView":461
10898  *             tmp = PyMem_Malloc(self.view.itemsize)
10899  *             if tmp == NULL:
10900  *                 raise MemoryError             # <<<<<<<<<<<<<<
10901  *             item = tmp
10902  *         else:
10903  */
10904       PyErr_NoMemory(); __PYX_ERR(2, 461, __pyx_L1_error)
10905 
10906       /* "View.MemoryView":460
10907  *         if <size_t>self.view.itemsize > sizeof(array):
10908  *             tmp = PyMem_Malloc(self.view.itemsize)
10909  *             if tmp == NULL:             # <<<<<<<<<<<<<<
10910  *                 raise MemoryError
10911  *             item = tmp
10912  */
10913     }
10914 
10915     /* "View.MemoryView":462
10916  *             if tmp == NULL:
10917  *                 raise MemoryError
10918  *             item = tmp             # <<<<<<<<<<<<<<
10919  *         else:
10920  *             item = <void *> array
10921  */
10922     __pyx_v_item = __pyx_v_tmp;
10923 
10924     /* "View.MemoryView":458
10925  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
10926  *
10927  *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
10928  *             tmp = PyMem_Malloc(self.view.itemsize)
10929  *             if tmp == NULL:
10930  */
10931     goto __pyx_L3;
10932   }
10933 
10934   /* "View.MemoryView":464
10935  *             item = tmp
10936  *         else:
10937  *             item = <void *> array             # <<<<<<<<<<<<<<
10938  *
10939  *         try:
10940  */
10941   /*else*/ {
10942     __pyx_v_item = ((void *)__pyx_v_array);
10943   }
10944   __pyx_L3:;
10945 
10946   /* "View.MemoryView":466
10947  *             item = <void *> array
10948  *
10949  *         try:             # <<<<<<<<<<<<<<
10950  *             if self.dtype_is_object:
10951  *                 (<PyObject **> item)[0] = <PyObject *> value
10952  */
10953   /*try:*/ {
10954 
10955     /* "View.MemoryView":467
10956  *
10957  *         try:
10958  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
10959  *                 (<PyObject **> item)[0] = <PyObject *> value
10960  *             else:
10961  */
10962     __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
10963     if (__pyx_t_2) {
10964 
10965       /* "View.MemoryView":468
10966  *         try:
10967  *             if self.dtype_is_object:
10968  *                 (<PyObject **> item)[0] = <PyObject *> value             # <<<<<<<<<<<<<<
10969  *             else:
10970  *                 self.assign_item_from_object(<char *> item, value)
10971  */
10972       (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
10973 
10974       /* "View.MemoryView":467
10975  *
10976  *         try:
10977  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
10978  *                 (<PyObject **> item)[0] = <PyObject *> value
10979  *             else:
10980  */
10981       goto __pyx_L8;
10982     }
10983 
10984     /* "View.MemoryView":470
10985  *                 (<PyObject **> item)[0] = <PyObject *> value
10986  *             else:
10987  *                 self.assign_item_from_object(<char *> item, value)             # <<<<<<<<<<<<<<
10988  *
10989  *
10990  */
10991     /*else*/ {
10992       __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 470, __pyx_L6_error)
10993       __Pyx_GOTREF(__pyx_t_3);
10994       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10995     }
10996     __pyx_L8:;
10997 
10998     /* "View.MemoryView":474
10999  *
11000  *
11001  *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
11002  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
11003  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
11004  */
11005     __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
11006     if (__pyx_t_2) {
11007 
11008       /* "View.MemoryView":475
11009  *
11010  *             if self.view.suboffsets != NULL:
11011  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)             # <<<<<<<<<<<<<<
11012  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
11013  *                                 item, self.dtype_is_object)
11014  */
11015       __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 475, __pyx_L6_error)
11016       __Pyx_GOTREF(__pyx_t_3);
11017       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11018 
11019       /* "View.MemoryView":474
11020  *
11021  *
11022  *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
11023  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
11024  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
11025  */
11026     }
11027 
11028     /* "View.MemoryView":476
11029  *             if self.view.suboffsets != NULL:
11030  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
11031  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,             # <<<<<<<<<<<<<<
11032  *                                 item, self.dtype_is_object)
11033  *         finally:
11034  */
11035     __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object);
11036   }
11037 
11038   /* "View.MemoryView":479
11039  *                                 item, self.dtype_is_object)
11040  *         finally:
11041  *             PyMem_Free(tmp)             # <<<<<<<<<<<<<<
11042  *
11043  *     cdef setitem_indexed(self, index, value):
11044  */
11045   /*finally:*/ {
11046     /*normal exit:*/{
11047       PyMem_Free(__pyx_v_tmp);
11048       goto __pyx_L7;
11049     }
11050     __pyx_L6_error:;
11051     /*exception exit:*/{
11052       __Pyx_PyThreadState_declare
11053       __Pyx_PyThreadState_assign
11054       __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
11055       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11056       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
11057       if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
11058       __Pyx_XGOTREF(__pyx_t_7);
11059       __Pyx_XGOTREF(__pyx_t_8);
11060       __Pyx_XGOTREF(__pyx_t_9);
11061       __Pyx_XGOTREF(__pyx_t_10);
11062       __Pyx_XGOTREF(__pyx_t_11);
11063       __Pyx_XGOTREF(__pyx_t_12);
11064       __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
11065       {
11066         PyMem_Free(__pyx_v_tmp);
11067       }
11068       if (PY_MAJOR_VERSION >= 3) {
11069         __Pyx_XGIVEREF(__pyx_t_10);
11070         __Pyx_XGIVEREF(__pyx_t_11);
11071         __Pyx_XGIVEREF(__pyx_t_12);
11072         __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
11073       }
11074       __Pyx_XGIVEREF(__pyx_t_7);
11075       __Pyx_XGIVEREF(__pyx_t_8);
11076       __Pyx_XGIVEREF(__pyx_t_9);
11077       __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
11078       __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
11079       __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
11080       goto __pyx_L1_error;
11081     }
11082     __pyx_L7:;
11083   }
11084 
11085   /* "View.MemoryView":449
11086  *                                  src.ndim, dst.ndim, self.dtype_is_object)
11087  *
11088  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
11089  *         cdef int array[128]
11090  *         cdef void *tmp = NULL
11091  */
11092 
11093   /* function exit code */
11094   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11095   goto __pyx_L0;
11096   __pyx_L1_error:;
11097   __Pyx_XDECREF(__pyx_t_3);
11098   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
11099   __pyx_r = 0;
11100   __pyx_L0:;
11101   __Pyx_XGIVEREF(__pyx_r);
11102   __Pyx_RefNannyFinishContext();
11103   return __pyx_r;
11104 }
11105 
11106 /* "View.MemoryView":481
11107  *             PyMem_Free(tmp)
11108  *
11109  *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
11110  *         cdef char *itemp = self.get_item_pointer(index)
11111  *         self.assign_item_from_object(itemp, value)
11112  */
11113 
__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index,PyObject * __pyx_v_value)11114 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
11115   char *__pyx_v_itemp;
11116   PyObject *__pyx_r = NULL;
11117   __Pyx_RefNannyDeclarations
11118   char *__pyx_t_1;
11119   PyObject *__pyx_t_2 = NULL;
11120   int __pyx_lineno = 0;
11121   const char *__pyx_filename = NULL;
11122   int __pyx_clineno = 0;
11123   __Pyx_RefNannySetupContext("setitem_indexed", 0);
11124 
11125   /* "View.MemoryView":482
11126  *
11127  *     cdef setitem_indexed(self, index, value):
11128  *         cdef char *itemp = self.get_item_pointer(index)             # <<<<<<<<<<<<<<
11129  *         self.assign_item_from_object(itemp, value)
11130  *
11131  */
11132   __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(2, 482, __pyx_L1_error)
11133   __pyx_v_itemp = __pyx_t_1;
11134 
11135   /* "View.MemoryView":483
11136  *     cdef setitem_indexed(self, index, value):
11137  *         cdef char *itemp = self.get_item_pointer(index)
11138  *         self.assign_item_from_object(itemp, value)             # <<<<<<<<<<<<<<
11139  *
11140  *     cdef convert_item_to_object(self, char *itemp):
11141  */
11142   __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 483, __pyx_L1_error)
11143   __Pyx_GOTREF(__pyx_t_2);
11144   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11145 
11146   /* "View.MemoryView":481
11147  *             PyMem_Free(tmp)
11148  *
11149  *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
11150  *         cdef char *itemp = self.get_item_pointer(index)
11151  *         self.assign_item_from_object(itemp, value)
11152  */
11153 
11154   /* function exit code */
11155   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11156   goto __pyx_L0;
11157   __pyx_L1_error:;
11158   __Pyx_XDECREF(__pyx_t_2);
11159   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
11160   __pyx_r = 0;
11161   __pyx_L0:;
11162   __Pyx_XGIVEREF(__pyx_r);
11163   __Pyx_RefNannyFinishContext();
11164   return __pyx_r;
11165 }
11166 
11167 /* "View.MemoryView":485
11168  *         self.assign_item_from_object(itemp, value)
11169  *
11170  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
11171  *         """Only used if instantiated manually by the user, or if Cython doesn't
11172  *         know how to convert the type"""
11173  */
11174 
__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj * __pyx_v_self,char * __pyx_v_itemp)11175 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
11176   PyObject *__pyx_v_struct = NULL;
11177   PyObject *__pyx_v_bytesitem = 0;
11178   PyObject *__pyx_v_result = NULL;
11179   PyObject *__pyx_r = NULL;
11180   __Pyx_RefNannyDeclarations
11181   PyObject *__pyx_t_1 = NULL;
11182   PyObject *__pyx_t_2 = NULL;
11183   PyObject *__pyx_t_3 = NULL;
11184   PyObject *__pyx_t_4 = NULL;
11185   PyObject *__pyx_t_5 = NULL;
11186   PyObject *__pyx_t_6 = NULL;
11187   PyObject *__pyx_t_7 = NULL;
11188   int __pyx_t_8;
11189   PyObject *__pyx_t_9 = NULL;
11190   size_t __pyx_t_10;
11191   int __pyx_t_11;
11192   int __pyx_lineno = 0;
11193   const char *__pyx_filename = NULL;
11194   int __pyx_clineno = 0;
11195   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
11196 
11197   /* "View.MemoryView":488
11198  *         """Only used if instantiated manually by the user, or if Cython doesn't
11199  *         know how to convert the type"""
11200  *         import struct             # <<<<<<<<<<<<<<
11201  *         cdef bytes bytesitem
11202  *
11203  */
11204   __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 488, __pyx_L1_error)
11205   __Pyx_GOTREF(__pyx_t_1);
11206   __pyx_v_struct = __pyx_t_1;
11207   __pyx_t_1 = 0;
11208 
11209   /* "View.MemoryView":491
11210  *         cdef bytes bytesitem
11211  *
11212  *         bytesitem = itemp[:self.view.itemsize]             # <<<<<<<<<<<<<<
11213  *         try:
11214  *             result = struct.unpack(self.view.format, bytesitem)
11215  */
11216   __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 491, __pyx_L1_error)
11217   __Pyx_GOTREF(__pyx_t_1);
11218   __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
11219   __pyx_t_1 = 0;
11220 
11221   /* "View.MemoryView":492
11222  *
11223  *         bytesitem = itemp[:self.view.itemsize]
11224  *         try:             # <<<<<<<<<<<<<<
11225  *             result = struct.unpack(self.view.format, bytesitem)
11226  *         except struct.error:
11227  */
11228   {
11229     __Pyx_PyThreadState_declare
11230     __Pyx_PyThreadState_assign
11231     __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
11232     __Pyx_XGOTREF(__pyx_t_2);
11233     __Pyx_XGOTREF(__pyx_t_3);
11234     __Pyx_XGOTREF(__pyx_t_4);
11235     /*try:*/ {
11236 
11237       /* "View.MemoryView":493
11238  *         bytesitem = itemp[:self.view.itemsize]
11239  *         try:
11240  *             result = struct.unpack(self.view.format, bytesitem)             # <<<<<<<<<<<<<<
11241  *         except struct.error:
11242  *             raise ValueError("Unable to convert item to object")
11243  */
11244       __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 493, __pyx_L3_error)
11245       __Pyx_GOTREF(__pyx_t_5);
11246       __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 493, __pyx_L3_error)
11247       __Pyx_GOTREF(__pyx_t_6);
11248       __pyx_t_7 = NULL;
11249       __pyx_t_8 = 0;
11250       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
11251         __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
11252         if (likely(__pyx_t_7)) {
11253           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
11254           __Pyx_INCREF(__pyx_t_7);
11255           __Pyx_INCREF(function);
11256           __Pyx_DECREF_SET(__pyx_t_5, function);
11257           __pyx_t_8 = 1;
11258         }
11259       }
11260       #if CYTHON_FAST_PYCALL
11261       if (PyFunction_Check(__pyx_t_5)) {
11262         PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
11263         __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error)
11264         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11265         __Pyx_GOTREF(__pyx_t_1);
11266         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11267       } else
11268       #endif
11269       #if CYTHON_FAST_PYCCALL
11270       if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
11271         PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
11272         __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error)
11273         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11274         __Pyx_GOTREF(__pyx_t_1);
11275         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11276       } else
11277       #endif
11278       {
11279         __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 493, __pyx_L3_error)
11280         __Pyx_GOTREF(__pyx_t_9);
11281         if (__pyx_t_7) {
11282           __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
11283         }
11284         __Pyx_GIVEREF(__pyx_t_6);
11285         PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
11286         __Pyx_INCREF(__pyx_v_bytesitem);
11287         __Pyx_GIVEREF(__pyx_v_bytesitem);
11288         PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
11289         __pyx_t_6 = 0;
11290         __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error)
11291         __Pyx_GOTREF(__pyx_t_1);
11292         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
11293       }
11294       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11295       __pyx_v_result = __pyx_t_1;
11296       __pyx_t_1 = 0;
11297 
11298       /* "View.MemoryView":492
11299  *
11300  *         bytesitem = itemp[:self.view.itemsize]
11301  *         try:             # <<<<<<<<<<<<<<
11302  *             result = struct.unpack(self.view.format, bytesitem)
11303  *         except struct.error:
11304  */
11305     }
11306 
11307     /* "View.MemoryView":497
11308  *             raise ValueError("Unable to convert item to object")
11309  *         else:
11310  *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
11311  *                 return result[0]
11312  *             return result
11313  */
11314     /*else:*/ {
11315       __pyx_t_10 = strlen(__pyx_v_self->view.format);
11316       __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
11317       if (__pyx_t_11) {
11318 
11319         /* "View.MemoryView":498
11320  *         else:
11321  *             if len(self.view.format) == 1:
11322  *                 return result[0]             # <<<<<<<<<<<<<<
11323  *             return result
11324  *
11325  */
11326         __Pyx_XDECREF(__pyx_r);
11327         __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 498, __pyx_L5_except_error)
11328         __Pyx_GOTREF(__pyx_t_1);
11329         __pyx_r = __pyx_t_1;
11330         __pyx_t_1 = 0;
11331         goto __pyx_L6_except_return;
11332 
11333         /* "View.MemoryView":497
11334  *             raise ValueError("Unable to convert item to object")
11335  *         else:
11336  *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
11337  *                 return result[0]
11338  *             return result
11339  */
11340       }
11341 
11342       /* "View.MemoryView":499
11343  *             if len(self.view.format) == 1:
11344  *                 return result[0]
11345  *             return result             # <<<<<<<<<<<<<<
11346  *
11347  *     cdef assign_item_from_object(self, char *itemp, object value):
11348  */
11349       __Pyx_XDECREF(__pyx_r);
11350       __Pyx_INCREF(__pyx_v_result);
11351       __pyx_r = __pyx_v_result;
11352       goto __pyx_L6_except_return;
11353     }
11354     __pyx_L3_error:;
11355     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
11356     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11357     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
11358     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11359     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
11360 
11361     /* "View.MemoryView":494
11362  *         try:
11363  *             result = struct.unpack(self.view.format, bytesitem)
11364  *         except struct.error:             # <<<<<<<<<<<<<<
11365  *             raise ValueError("Unable to convert item to object")
11366  *         else:
11367  */
11368     __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
11369     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 494, __pyx_L5_except_error)
11370     __Pyx_GOTREF(__pyx_t_6);
11371     __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
11372     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11373     __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
11374     __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
11375     if (__pyx_t_8) {
11376       __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
11377       if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 494, __pyx_L5_except_error)
11378       __Pyx_GOTREF(__pyx_t_9);
11379       __Pyx_GOTREF(__pyx_t_5);
11380       __Pyx_GOTREF(__pyx_t_1);
11381 
11382       /* "View.MemoryView":495
11383  *             result = struct.unpack(self.view.format, bytesitem)
11384  *         except struct.error:
11385  *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
11386  *         else:
11387  *             if len(self.view.format) == 1:
11388  */
11389       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __pyx_L5_except_error)
11390       __Pyx_GOTREF(__pyx_t_6);
11391       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
11392       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11393       __PYX_ERR(2, 495, __pyx_L5_except_error)
11394     }
11395     goto __pyx_L5_except_error;
11396     __pyx_L5_except_error:;
11397 
11398     /* "View.MemoryView":492
11399  *
11400  *         bytesitem = itemp[:self.view.itemsize]
11401  *         try:             # <<<<<<<<<<<<<<
11402  *             result = struct.unpack(self.view.format, bytesitem)
11403  *         except struct.error:
11404  */
11405     __Pyx_XGIVEREF(__pyx_t_2);
11406     __Pyx_XGIVEREF(__pyx_t_3);
11407     __Pyx_XGIVEREF(__pyx_t_4);
11408     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
11409     goto __pyx_L1_error;
11410     __pyx_L6_except_return:;
11411     __Pyx_XGIVEREF(__pyx_t_2);
11412     __Pyx_XGIVEREF(__pyx_t_3);
11413     __Pyx_XGIVEREF(__pyx_t_4);
11414     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
11415     goto __pyx_L0;
11416   }
11417 
11418   /* "View.MemoryView":485
11419  *         self.assign_item_from_object(itemp, value)
11420  *
11421  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
11422  *         """Only used if instantiated manually by the user, or if Cython doesn't
11423  *         know how to convert the type"""
11424  */
11425 
11426   /* function exit code */
11427   __pyx_L1_error:;
11428   __Pyx_XDECREF(__pyx_t_1);
11429   __Pyx_XDECREF(__pyx_t_5);
11430   __Pyx_XDECREF(__pyx_t_6);
11431   __Pyx_XDECREF(__pyx_t_7);
11432   __Pyx_XDECREF(__pyx_t_9);
11433   __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
11434   __pyx_r = 0;
11435   __pyx_L0:;
11436   __Pyx_XDECREF(__pyx_v_struct);
11437   __Pyx_XDECREF(__pyx_v_bytesitem);
11438   __Pyx_XDECREF(__pyx_v_result);
11439   __Pyx_XGIVEREF(__pyx_r);
11440   __Pyx_RefNannyFinishContext();
11441   return __pyx_r;
11442 }
11443 
11444 /* "View.MemoryView":501
11445  *             return result
11446  *
11447  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
11448  *         """Only used if instantiated manually by the user, or if Cython doesn't
11449  *         know how to convert the type"""
11450  */
11451 
__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj * __pyx_v_self,char * __pyx_v_itemp,PyObject * __pyx_v_value)11452 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
11453   PyObject *__pyx_v_struct = NULL;
11454   char __pyx_v_c;
11455   PyObject *__pyx_v_bytesvalue = 0;
11456   Py_ssize_t __pyx_v_i;
11457   PyObject *__pyx_r = NULL;
11458   __Pyx_RefNannyDeclarations
11459   PyObject *__pyx_t_1 = NULL;
11460   int __pyx_t_2;
11461   int __pyx_t_3;
11462   PyObject *__pyx_t_4 = NULL;
11463   PyObject *__pyx_t_5 = NULL;
11464   PyObject *__pyx_t_6 = NULL;
11465   int __pyx_t_7;
11466   PyObject *__pyx_t_8 = NULL;
11467   Py_ssize_t __pyx_t_9;
11468   PyObject *__pyx_t_10 = NULL;
11469   char *__pyx_t_11;
11470   char *__pyx_t_12;
11471   char *__pyx_t_13;
11472   char *__pyx_t_14;
11473   int __pyx_lineno = 0;
11474   const char *__pyx_filename = NULL;
11475   int __pyx_clineno = 0;
11476   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
11477 
11478   /* "View.MemoryView":504
11479  *         """Only used if instantiated manually by the user, or if Cython doesn't
11480  *         know how to convert the type"""
11481  *         import struct             # <<<<<<<<<<<<<<
11482  *         cdef char c
11483  *         cdef bytes bytesvalue
11484  */
11485   __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 504, __pyx_L1_error)
11486   __Pyx_GOTREF(__pyx_t_1);
11487   __pyx_v_struct = __pyx_t_1;
11488   __pyx_t_1 = 0;
11489 
11490   /* "View.MemoryView":509
11491  *         cdef Py_ssize_t i
11492  *
11493  *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
11494  *             bytesvalue = struct.pack(self.view.format, *value)
11495  *         else:
11496  */
11497   __pyx_t_2 = PyTuple_Check(__pyx_v_value);
11498   __pyx_t_3 = (__pyx_t_2 != 0);
11499   if (__pyx_t_3) {
11500 
11501     /* "View.MemoryView":510
11502  *
11503  *         if isinstance(value, tuple):
11504  *             bytesvalue = struct.pack(self.view.format, *value)             # <<<<<<<<<<<<<<
11505  *         else:
11506  *             bytesvalue = struct.pack(self.view.format, value)
11507  */
11508     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 510, __pyx_L1_error)
11509     __Pyx_GOTREF(__pyx_t_1);
11510     __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
11511     __Pyx_GOTREF(__pyx_t_4);
11512     __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 510, __pyx_L1_error)
11513     __Pyx_GOTREF(__pyx_t_5);
11514     __Pyx_GIVEREF(__pyx_t_4);
11515     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
11516     __pyx_t_4 = 0;
11517     __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
11518     __Pyx_GOTREF(__pyx_t_4);
11519     __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 510, __pyx_L1_error)
11520     __Pyx_GOTREF(__pyx_t_6);
11521     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11522     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11523     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
11524     __Pyx_GOTREF(__pyx_t_4);
11525     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11526     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11527     if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 510, __pyx_L1_error)
11528     __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
11529     __pyx_t_4 = 0;
11530 
11531     /* "View.MemoryView":509
11532  *         cdef Py_ssize_t i
11533  *
11534  *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
11535  *             bytesvalue = struct.pack(self.view.format, *value)
11536  *         else:
11537  */
11538     goto __pyx_L3;
11539   }
11540 
11541   /* "View.MemoryView":512
11542  *             bytesvalue = struct.pack(self.view.format, *value)
11543  *         else:
11544  *             bytesvalue = struct.pack(self.view.format, value)             # <<<<<<<<<<<<<<
11545  *
11546  *         for i, c in enumerate(bytesvalue):
11547  */
11548   /*else*/ {
11549     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 512, __pyx_L1_error)
11550     __Pyx_GOTREF(__pyx_t_6);
11551     __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error)
11552     __Pyx_GOTREF(__pyx_t_1);
11553     __pyx_t_5 = NULL;
11554     __pyx_t_7 = 0;
11555     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
11556       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
11557       if (likely(__pyx_t_5)) {
11558         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
11559         __Pyx_INCREF(__pyx_t_5);
11560         __Pyx_INCREF(function);
11561         __Pyx_DECREF_SET(__pyx_t_6, function);
11562         __pyx_t_7 = 1;
11563       }
11564     }
11565     #if CYTHON_FAST_PYCALL
11566     if (PyFunction_Check(__pyx_t_6)) {
11567       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
11568       __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
11569       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11570       __Pyx_GOTREF(__pyx_t_4);
11571       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11572     } else
11573     #endif
11574     #if CYTHON_FAST_PYCCALL
11575     if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
11576       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
11577       __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
11578       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11579       __Pyx_GOTREF(__pyx_t_4);
11580       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11581     } else
11582     #endif
11583     {
11584       __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 512, __pyx_L1_error)
11585       __Pyx_GOTREF(__pyx_t_8);
11586       if (__pyx_t_5) {
11587         __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
11588       }
11589       __Pyx_GIVEREF(__pyx_t_1);
11590       PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
11591       __Pyx_INCREF(__pyx_v_value);
11592       __Pyx_GIVEREF(__pyx_v_value);
11593       PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
11594       __pyx_t_1 = 0;
11595       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
11596       __Pyx_GOTREF(__pyx_t_4);
11597       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11598     }
11599     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11600     if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 512, __pyx_L1_error)
11601     __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
11602     __pyx_t_4 = 0;
11603   }
11604   __pyx_L3:;
11605 
11606   /* "View.MemoryView":514
11607  *             bytesvalue = struct.pack(self.view.format, value)
11608  *
11609  *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
11610  *             itemp[i] = c
11611  *
11612  */
11613   __pyx_t_9 = 0;
11614   if (unlikely(__pyx_v_bytesvalue == Py_None)) {
11615     PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
11616     __PYX_ERR(2, 514, __pyx_L1_error)
11617   }
11618   __Pyx_INCREF(__pyx_v_bytesvalue);
11619   __pyx_t_10 = __pyx_v_bytesvalue;
11620   __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
11621   __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
11622   for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
11623     __pyx_t_11 = __pyx_t_14;
11624     __pyx_v_c = (__pyx_t_11[0]);
11625 
11626     /* "View.MemoryView":515
11627  *
11628  *         for i, c in enumerate(bytesvalue):
11629  *             itemp[i] = c             # <<<<<<<<<<<<<<
11630  *
11631  *     @cname('getbuffer')
11632  */
11633     __pyx_v_i = __pyx_t_9;
11634 
11635     /* "View.MemoryView":514
11636  *             bytesvalue = struct.pack(self.view.format, value)
11637  *
11638  *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
11639  *             itemp[i] = c
11640  *
11641  */
11642     __pyx_t_9 = (__pyx_t_9 + 1);
11643 
11644     /* "View.MemoryView":515
11645  *
11646  *         for i, c in enumerate(bytesvalue):
11647  *             itemp[i] = c             # <<<<<<<<<<<<<<
11648  *
11649  *     @cname('getbuffer')
11650  */
11651     (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
11652   }
11653   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
11654 
11655   /* "View.MemoryView":501
11656  *             return result
11657  *
11658  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
11659  *         """Only used if instantiated manually by the user, or if Cython doesn't
11660  *         know how to convert the type"""
11661  */
11662 
11663   /* function exit code */
11664   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11665   goto __pyx_L0;
11666   __pyx_L1_error:;
11667   __Pyx_XDECREF(__pyx_t_1);
11668   __Pyx_XDECREF(__pyx_t_4);
11669   __Pyx_XDECREF(__pyx_t_5);
11670   __Pyx_XDECREF(__pyx_t_6);
11671   __Pyx_XDECREF(__pyx_t_8);
11672   __Pyx_XDECREF(__pyx_t_10);
11673   __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
11674   __pyx_r = 0;
11675   __pyx_L0:;
11676   __Pyx_XDECREF(__pyx_v_struct);
11677   __Pyx_XDECREF(__pyx_v_bytesvalue);
11678   __Pyx_XGIVEREF(__pyx_r);
11679   __Pyx_RefNannyFinishContext();
11680   return __pyx_r;
11681 }
11682 
11683 /* "View.MemoryView":518
11684  *
11685  *     @cname('getbuffer')
11686  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
11687  *         if flags & PyBUF_WRITABLE and self.view.readonly:
11688  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
11689  */
11690 
11691 /* Python wrapper */
11692 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
__pyx_memoryview_getbuffer(PyObject * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)11693 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
11694   int __pyx_r;
11695   __Pyx_RefNannyDeclarations
11696   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
11697   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
11698 
11699   /* function exit code */
11700   __Pyx_RefNannyFinishContext();
11701   return __pyx_r;
11702 }
11703 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj * __pyx_v_self,Py_buffer * __pyx_v_info,int __pyx_v_flags)11704 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
11705   int __pyx_r;
11706   __Pyx_RefNannyDeclarations
11707   int __pyx_t_1;
11708   int __pyx_t_2;
11709   PyObject *__pyx_t_3 = NULL;
11710   Py_ssize_t *__pyx_t_4;
11711   char *__pyx_t_5;
11712   void *__pyx_t_6;
11713   int __pyx_t_7;
11714   Py_ssize_t __pyx_t_8;
11715   int __pyx_lineno = 0;
11716   const char *__pyx_filename = NULL;
11717   int __pyx_clineno = 0;
11718   if (__pyx_v_info == NULL) {
11719     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
11720     return -1;
11721   }
11722   __Pyx_RefNannySetupContext("__getbuffer__", 0);
11723   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
11724   __Pyx_GIVEREF(__pyx_v_info->obj);
11725 
11726   /* "View.MemoryView":519
11727  *     @cname('getbuffer')
11728  *     def __getbuffer__(self, Py_buffer *info, int flags):
11729  *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
11730  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
11731  *
11732  */
11733   __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
11734   if (__pyx_t_2) {
11735   } else {
11736     __pyx_t_1 = __pyx_t_2;
11737     goto __pyx_L4_bool_binop_done;
11738   }
11739   __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
11740   __pyx_t_1 = __pyx_t_2;
11741   __pyx_L4_bool_binop_done:;
11742   if (unlikely(__pyx_t_1)) {
11743 
11744     /* "View.MemoryView":520
11745  *     def __getbuffer__(self, Py_buffer *info, int flags):
11746  *         if flags & PyBUF_WRITABLE and self.view.readonly:
11747  *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
11748  *
11749  *         if flags & PyBUF_ND:
11750  */
11751     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 520, __pyx_L1_error)
11752     __Pyx_GOTREF(__pyx_t_3);
11753     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
11754     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11755     __PYX_ERR(2, 520, __pyx_L1_error)
11756 
11757     /* "View.MemoryView":519
11758  *     @cname('getbuffer')
11759  *     def __getbuffer__(self, Py_buffer *info, int flags):
11760  *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
11761  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
11762  *
11763  */
11764   }
11765 
11766   /* "View.MemoryView":522
11767  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
11768  *
11769  *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
11770  *             info.shape = self.view.shape
11771  *         else:
11772  */
11773   __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
11774   if (__pyx_t_1) {
11775 
11776     /* "View.MemoryView":523
11777  *
11778  *         if flags & PyBUF_ND:
11779  *             info.shape = self.view.shape             # <<<<<<<<<<<<<<
11780  *         else:
11781  *             info.shape = NULL
11782  */
11783     __pyx_t_4 = __pyx_v_self->view.shape;
11784     __pyx_v_info->shape = __pyx_t_4;
11785 
11786     /* "View.MemoryView":522
11787  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
11788  *
11789  *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
11790  *             info.shape = self.view.shape
11791  *         else:
11792  */
11793     goto __pyx_L6;
11794   }
11795 
11796   /* "View.MemoryView":525
11797  *             info.shape = self.view.shape
11798  *         else:
11799  *             info.shape = NULL             # <<<<<<<<<<<<<<
11800  *
11801  *         if flags & PyBUF_STRIDES:
11802  */
11803   /*else*/ {
11804     __pyx_v_info->shape = NULL;
11805   }
11806   __pyx_L6:;
11807 
11808   /* "View.MemoryView":527
11809  *             info.shape = NULL
11810  *
11811  *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
11812  *             info.strides = self.view.strides
11813  *         else:
11814  */
11815   __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
11816   if (__pyx_t_1) {
11817 
11818     /* "View.MemoryView":528
11819  *
11820  *         if flags & PyBUF_STRIDES:
11821  *             info.strides = self.view.strides             # <<<<<<<<<<<<<<
11822  *         else:
11823  *             info.strides = NULL
11824  */
11825     __pyx_t_4 = __pyx_v_self->view.strides;
11826     __pyx_v_info->strides = __pyx_t_4;
11827 
11828     /* "View.MemoryView":527
11829  *             info.shape = NULL
11830  *
11831  *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
11832  *             info.strides = self.view.strides
11833  *         else:
11834  */
11835     goto __pyx_L7;
11836   }
11837 
11838   /* "View.MemoryView":530
11839  *             info.strides = self.view.strides
11840  *         else:
11841  *             info.strides = NULL             # <<<<<<<<<<<<<<
11842  *
11843  *         if flags & PyBUF_INDIRECT:
11844  */
11845   /*else*/ {
11846     __pyx_v_info->strides = NULL;
11847   }
11848   __pyx_L7:;
11849 
11850   /* "View.MemoryView":532
11851  *             info.strides = NULL
11852  *
11853  *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
11854  *             info.suboffsets = self.view.suboffsets
11855  *         else:
11856  */
11857   __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
11858   if (__pyx_t_1) {
11859 
11860     /* "View.MemoryView":533
11861  *
11862  *         if flags & PyBUF_INDIRECT:
11863  *             info.suboffsets = self.view.suboffsets             # <<<<<<<<<<<<<<
11864  *         else:
11865  *             info.suboffsets = NULL
11866  */
11867     __pyx_t_4 = __pyx_v_self->view.suboffsets;
11868     __pyx_v_info->suboffsets = __pyx_t_4;
11869 
11870     /* "View.MemoryView":532
11871  *             info.strides = NULL
11872  *
11873  *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
11874  *             info.suboffsets = self.view.suboffsets
11875  *         else:
11876  */
11877     goto __pyx_L8;
11878   }
11879 
11880   /* "View.MemoryView":535
11881  *             info.suboffsets = self.view.suboffsets
11882  *         else:
11883  *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
11884  *
11885  *         if flags & PyBUF_FORMAT:
11886  */
11887   /*else*/ {
11888     __pyx_v_info->suboffsets = NULL;
11889   }
11890   __pyx_L8:;
11891 
11892   /* "View.MemoryView":537
11893  *             info.suboffsets = NULL
11894  *
11895  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
11896  *             info.format = self.view.format
11897  *         else:
11898  */
11899   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
11900   if (__pyx_t_1) {
11901 
11902     /* "View.MemoryView":538
11903  *
11904  *         if flags & PyBUF_FORMAT:
11905  *             info.format = self.view.format             # <<<<<<<<<<<<<<
11906  *         else:
11907  *             info.format = NULL
11908  */
11909     __pyx_t_5 = __pyx_v_self->view.format;
11910     __pyx_v_info->format = __pyx_t_5;
11911 
11912     /* "View.MemoryView":537
11913  *             info.suboffsets = NULL
11914  *
11915  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
11916  *             info.format = self.view.format
11917  *         else:
11918  */
11919     goto __pyx_L9;
11920   }
11921 
11922   /* "View.MemoryView":540
11923  *             info.format = self.view.format
11924  *         else:
11925  *             info.format = NULL             # <<<<<<<<<<<<<<
11926  *
11927  *         info.buf = self.view.buf
11928  */
11929   /*else*/ {
11930     __pyx_v_info->format = NULL;
11931   }
11932   __pyx_L9:;
11933 
11934   /* "View.MemoryView":542
11935  *             info.format = NULL
11936  *
11937  *         info.buf = self.view.buf             # <<<<<<<<<<<<<<
11938  *         info.ndim = self.view.ndim
11939  *         info.itemsize = self.view.itemsize
11940  */
11941   __pyx_t_6 = __pyx_v_self->view.buf;
11942   __pyx_v_info->buf = __pyx_t_6;
11943 
11944   /* "View.MemoryView":543
11945  *
11946  *         info.buf = self.view.buf
11947  *         info.ndim = self.view.ndim             # <<<<<<<<<<<<<<
11948  *         info.itemsize = self.view.itemsize
11949  *         info.len = self.view.len
11950  */
11951   __pyx_t_7 = __pyx_v_self->view.ndim;
11952   __pyx_v_info->ndim = __pyx_t_7;
11953 
11954   /* "View.MemoryView":544
11955  *         info.buf = self.view.buf
11956  *         info.ndim = self.view.ndim
11957  *         info.itemsize = self.view.itemsize             # <<<<<<<<<<<<<<
11958  *         info.len = self.view.len
11959  *         info.readonly = self.view.readonly
11960  */
11961   __pyx_t_8 = __pyx_v_self->view.itemsize;
11962   __pyx_v_info->itemsize = __pyx_t_8;
11963 
11964   /* "View.MemoryView":545
11965  *         info.ndim = self.view.ndim
11966  *         info.itemsize = self.view.itemsize
11967  *         info.len = self.view.len             # <<<<<<<<<<<<<<
11968  *         info.readonly = self.view.readonly
11969  *         info.obj = self
11970  */
11971   __pyx_t_8 = __pyx_v_self->view.len;
11972   __pyx_v_info->len = __pyx_t_8;
11973 
11974   /* "View.MemoryView":546
11975  *         info.itemsize = self.view.itemsize
11976  *         info.len = self.view.len
11977  *         info.readonly = self.view.readonly             # <<<<<<<<<<<<<<
11978  *         info.obj = self
11979  *
11980  */
11981   __pyx_t_1 = __pyx_v_self->view.readonly;
11982   __pyx_v_info->readonly = __pyx_t_1;
11983 
11984   /* "View.MemoryView":547
11985  *         info.len = self.view.len
11986  *         info.readonly = self.view.readonly
11987  *         info.obj = self             # <<<<<<<<<<<<<<
11988  *
11989  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
11990  */
11991   __Pyx_INCREF(((PyObject *)__pyx_v_self));
11992   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
11993   __Pyx_GOTREF(__pyx_v_info->obj);
11994   __Pyx_DECREF(__pyx_v_info->obj);
11995   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
11996 
11997   /* "View.MemoryView":518
11998  *
11999  *     @cname('getbuffer')
12000  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
12001  *         if flags & PyBUF_WRITABLE and self.view.readonly:
12002  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
12003  */
12004 
12005   /* function exit code */
12006   __pyx_r = 0;
12007   goto __pyx_L0;
12008   __pyx_L1_error:;
12009   __Pyx_XDECREF(__pyx_t_3);
12010   __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12011   __pyx_r = -1;
12012   if (__pyx_v_info->obj != NULL) {
12013     __Pyx_GOTREF(__pyx_v_info->obj);
12014     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
12015   }
12016   goto __pyx_L2;
12017   __pyx_L0:;
12018   if (__pyx_v_info->obj == Py_None) {
12019     __Pyx_GOTREF(__pyx_v_info->obj);
12020     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
12021   }
12022   __pyx_L2:;
12023   __Pyx_RefNannyFinishContext();
12024   return __pyx_r;
12025 }
12026 
12027 /* "View.MemoryView":553
12028  *
12029  *     @property
12030  *     def T(self):             # <<<<<<<<<<<<<<
12031  *         cdef _memoryviewslice result = memoryview_copy(self)
12032  *         transpose_memslice(&result.from_slice)
12033  */
12034 
12035 /* Python wrapper */
12036 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject * __pyx_v_self)12037 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
12038   PyObject *__pyx_r = 0;
12039   __Pyx_RefNannyDeclarations
12040   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12041   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12042 
12043   /* function exit code */
12044   __Pyx_RefNannyFinishContext();
12045   return __pyx_r;
12046 }
12047 
__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj * __pyx_v_self)12048 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12049   struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
12050   PyObject *__pyx_r = NULL;
12051   __Pyx_RefNannyDeclarations
12052   PyObject *__pyx_t_1 = NULL;
12053   int __pyx_t_2;
12054   int __pyx_lineno = 0;
12055   const char *__pyx_filename = NULL;
12056   int __pyx_clineno = 0;
12057   __Pyx_RefNannySetupContext("__get__", 0);
12058 
12059   /* "View.MemoryView":554
12060  *     @property
12061  *     def T(self):
12062  *         cdef _memoryviewslice result = memoryview_copy(self)             # <<<<<<<<<<<<<<
12063  *         transpose_memslice(&result.from_slice)
12064  *         return result
12065  */
12066   __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 554, __pyx_L1_error)
12067   __Pyx_GOTREF(__pyx_t_1);
12068   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 554, __pyx_L1_error)
12069   __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
12070   __pyx_t_1 = 0;
12071 
12072   /* "View.MemoryView":555
12073  *     def T(self):
12074  *         cdef _memoryviewslice result = memoryview_copy(self)
12075  *         transpose_memslice(&result.from_slice)             # <<<<<<<<<<<<<<
12076  *         return result
12077  *
12078  */
12079   __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 555, __pyx_L1_error)
12080 
12081   /* "View.MemoryView":556
12082  *         cdef _memoryviewslice result = memoryview_copy(self)
12083  *         transpose_memslice(&result.from_slice)
12084  *         return result             # <<<<<<<<<<<<<<
12085  *
12086  *     @property
12087  */
12088   __Pyx_XDECREF(__pyx_r);
12089   __Pyx_INCREF(((PyObject *)__pyx_v_result));
12090   __pyx_r = ((PyObject *)__pyx_v_result);
12091   goto __pyx_L0;
12092 
12093   /* "View.MemoryView":553
12094  *
12095  *     @property
12096  *     def T(self):             # <<<<<<<<<<<<<<
12097  *         cdef _memoryviewslice result = memoryview_copy(self)
12098  *         transpose_memslice(&result.from_slice)
12099  */
12100 
12101   /* function exit code */
12102   __pyx_L1_error:;
12103   __Pyx_XDECREF(__pyx_t_1);
12104   __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12105   __pyx_r = NULL;
12106   __pyx_L0:;
12107   __Pyx_XDECREF((PyObject *)__pyx_v_result);
12108   __Pyx_XGIVEREF(__pyx_r);
12109   __Pyx_RefNannyFinishContext();
12110   return __pyx_r;
12111 }
12112 
12113 /* "View.MemoryView":559
12114  *
12115  *     @property
12116  *     def base(self):             # <<<<<<<<<<<<<<
12117  *         return self.obj
12118  *
12119  */
12120 
12121 /* Python wrapper */
12122 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject * __pyx_v_self)12123 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
12124   PyObject *__pyx_r = 0;
12125   __Pyx_RefNannyDeclarations
12126   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12127   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12128 
12129   /* function exit code */
12130   __Pyx_RefNannyFinishContext();
12131   return __pyx_r;
12132 }
12133 
__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj * __pyx_v_self)12134 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12135   PyObject *__pyx_r = NULL;
12136   __Pyx_RefNannyDeclarations
12137   __Pyx_RefNannySetupContext("__get__", 0);
12138 
12139   /* "View.MemoryView":560
12140  *     @property
12141  *     def base(self):
12142  *         return self.obj             # <<<<<<<<<<<<<<
12143  *
12144  *     @property
12145  */
12146   __Pyx_XDECREF(__pyx_r);
12147   __Pyx_INCREF(__pyx_v_self->obj);
12148   __pyx_r = __pyx_v_self->obj;
12149   goto __pyx_L0;
12150 
12151   /* "View.MemoryView":559
12152  *
12153  *     @property
12154  *     def base(self):             # <<<<<<<<<<<<<<
12155  *         return self.obj
12156  *
12157  */
12158 
12159   /* function exit code */
12160   __pyx_L0:;
12161   __Pyx_XGIVEREF(__pyx_r);
12162   __Pyx_RefNannyFinishContext();
12163   return __pyx_r;
12164 }
12165 
12166 /* "View.MemoryView":563
12167  *
12168  *     @property
12169  *     def shape(self):             # <<<<<<<<<<<<<<
12170  *         return tuple([length for length in self.view.shape[:self.view.ndim]])
12171  *
12172  */
12173 
12174 /* Python wrapper */
12175 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject * __pyx_v_self)12176 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
12177   PyObject *__pyx_r = 0;
12178   __Pyx_RefNannyDeclarations
12179   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12180   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12181 
12182   /* function exit code */
12183   __Pyx_RefNannyFinishContext();
12184   return __pyx_r;
12185 }
12186 
__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj * __pyx_v_self)12187 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12188   Py_ssize_t __pyx_v_length;
12189   PyObject *__pyx_r = NULL;
12190   __Pyx_RefNannyDeclarations
12191   PyObject *__pyx_t_1 = NULL;
12192   Py_ssize_t *__pyx_t_2;
12193   Py_ssize_t *__pyx_t_3;
12194   Py_ssize_t *__pyx_t_4;
12195   PyObject *__pyx_t_5 = NULL;
12196   int __pyx_lineno = 0;
12197   const char *__pyx_filename = NULL;
12198   int __pyx_clineno = 0;
12199   __Pyx_RefNannySetupContext("__get__", 0);
12200 
12201   /* "View.MemoryView":564
12202  *     @property
12203  *     def shape(self):
12204  *         return tuple([length for length in self.view.shape[:self.view.ndim]])             # <<<<<<<<<<<<<<
12205  *
12206  *     @property
12207  */
12208   __Pyx_XDECREF(__pyx_r);
12209   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 564, __pyx_L1_error)
12210   __Pyx_GOTREF(__pyx_t_1);
12211   __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
12212   for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
12213     __pyx_t_2 = __pyx_t_4;
12214     __pyx_v_length = (__pyx_t_2[0]);
12215     __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error)
12216     __Pyx_GOTREF(__pyx_t_5);
12217     if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 564, __pyx_L1_error)
12218     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12219   }
12220   __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error)
12221   __Pyx_GOTREF(__pyx_t_5);
12222   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12223   __pyx_r = __pyx_t_5;
12224   __pyx_t_5 = 0;
12225   goto __pyx_L0;
12226 
12227   /* "View.MemoryView":563
12228  *
12229  *     @property
12230  *     def shape(self):             # <<<<<<<<<<<<<<
12231  *         return tuple([length for length in self.view.shape[:self.view.ndim]])
12232  *
12233  */
12234 
12235   /* function exit code */
12236   __pyx_L1_error:;
12237   __Pyx_XDECREF(__pyx_t_1);
12238   __Pyx_XDECREF(__pyx_t_5);
12239   __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12240   __pyx_r = NULL;
12241   __pyx_L0:;
12242   __Pyx_XGIVEREF(__pyx_r);
12243   __Pyx_RefNannyFinishContext();
12244   return __pyx_r;
12245 }
12246 
12247 /* "View.MemoryView":567
12248  *
12249  *     @property
12250  *     def strides(self):             # <<<<<<<<<<<<<<
12251  *         if self.view.strides == NULL:
12252  *
12253  */
12254 
12255 /* Python wrapper */
12256 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject * __pyx_v_self)12257 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
12258   PyObject *__pyx_r = 0;
12259   __Pyx_RefNannyDeclarations
12260   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12261   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12262 
12263   /* function exit code */
12264   __Pyx_RefNannyFinishContext();
12265   return __pyx_r;
12266 }
12267 
__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj * __pyx_v_self)12268 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12269   Py_ssize_t __pyx_v_stride;
12270   PyObject *__pyx_r = NULL;
12271   __Pyx_RefNannyDeclarations
12272   int __pyx_t_1;
12273   PyObject *__pyx_t_2 = NULL;
12274   Py_ssize_t *__pyx_t_3;
12275   Py_ssize_t *__pyx_t_4;
12276   Py_ssize_t *__pyx_t_5;
12277   PyObject *__pyx_t_6 = NULL;
12278   int __pyx_lineno = 0;
12279   const char *__pyx_filename = NULL;
12280   int __pyx_clineno = 0;
12281   __Pyx_RefNannySetupContext("__get__", 0);
12282 
12283   /* "View.MemoryView":568
12284  *     @property
12285  *     def strides(self):
12286  *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
12287  *
12288  *             raise ValueError("Buffer view does not expose strides")
12289  */
12290   __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
12291   if (unlikely(__pyx_t_1)) {
12292 
12293     /* "View.MemoryView":570
12294  *         if self.view.strides == NULL:
12295  *
12296  *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
12297  *
12298  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
12299  */
12300     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 570, __pyx_L1_error)
12301     __Pyx_GOTREF(__pyx_t_2);
12302     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
12303     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12304     __PYX_ERR(2, 570, __pyx_L1_error)
12305 
12306     /* "View.MemoryView":568
12307  *     @property
12308  *     def strides(self):
12309  *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
12310  *
12311  *             raise ValueError("Buffer view does not expose strides")
12312  */
12313   }
12314 
12315   /* "View.MemoryView":572
12316  *             raise ValueError("Buffer view does not expose strides")
12317  *
12318  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])             # <<<<<<<<<<<<<<
12319  *
12320  *     @property
12321  */
12322   __Pyx_XDECREF(__pyx_r);
12323   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error)
12324   __Pyx_GOTREF(__pyx_t_2);
12325   __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
12326   for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
12327     __pyx_t_3 = __pyx_t_5;
12328     __pyx_v_stride = (__pyx_t_3[0]);
12329     __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error)
12330     __Pyx_GOTREF(__pyx_t_6);
12331     if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 572, __pyx_L1_error)
12332     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12333   }
12334   __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error)
12335   __Pyx_GOTREF(__pyx_t_6);
12336   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12337   __pyx_r = __pyx_t_6;
12338   __pyx_t_6 = 0;
12339   goto __pyx_L0;
12340 
12341   /* "View.MemoryView":567
12342  *
12343  *     @property
12344  *     def strides(self):             # <<<<<<<<<<<<<<
12345  *         if self.view.strides == NULL:
12346  *
12347  */
12348 
12349   /* function exit code */
12350   __pyx_L1_error:;
12351   __Pyx_XDECREF(__pyx_t_2);
12352   __Pyx_XDECREF(__pyx_t_6);
12353   __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12354   __pyx_r = NULL;
12355   __pyx_L0:;
12356   __Pyx_XGIVEREF(__pyx_r);
12357   __Pyx_RefNannyFinishContext();
12358   return __pyx_r;
12359 }
12360 
12361 /* "View.MemoryView":575
12362  *
12363  *     @property
12364  *     def suboffsets(self):             # <<<<<<<<<<<<<<
12365  *         if self.view.suboffsets == NULL:
12366  *             return (-1,) * self.view.ndim
12367  */
12368 
12369 /* Python wrapper */
12370 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject * __pyx_v_self)12371 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
12372   PyObject *__pyx_r = 0;
12373   __Pyx_RefNannyDeclarations
12374   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12375   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12376 
12377   /* function exit code */
12378   __Pyx_RefNannyFinishContext();
12379   return __pyx_r;
12380 }
12381 
__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj * __pyx_v_self)12382 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12383   Py_ssize_t __pyx_v_suboffset;
12384   PyObject *__pyx_r = NULL;
12385   __Pyx_RefNannyDeclarations
12386   int __pyx_t_1;
12387   PyObject *__pyx_t_2 = NULL;
12388   PyObject *__pyx_t_3 = NULL;
12389   Py_ssize_t *__pyx_t_4;
12390   Py_ssize_t *__pyx_t_5;
12391   Py_ssize_t *__pyx_t_6;
12392   int __pyx_lineno = 0;
12393   const char *__pyx_filename = NULL;
12394   int __pyx_clineno = 0;
12395   __Pyx_RefNannySetupContext("__get__", 0);
12396 
12397   /* "View.MemoryView":576
12398  *     @property
12399  *     def suboffsets(self):
12400  *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
12401  *             return (-1,) * self.view.ndim
12402  *
12403  */
12404   __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
12405   if (__pyx_t_1) {
12406 
12407     /* "View.MemoryView":577
12408  *     def suboffsets(self):
12409  *         if self.view.suboffsets == NULL:
12410  *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
12411  *
12412  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
12413  */
12414     __Pyx_XDECREF(__pyx_r);
12415     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 577, __pyx_L1_error)
12416     __Pyx_GOTREF(__pyx_t_2);
12417     __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__15, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 577, __pyx_L1_error)
12418     __Pyx_GOTREF(__pyx_t_3);
12419     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12420     __pyx_r = __pyx_t_3;
12421     __pyx_t_3 = 0;
12422     goto __pyx_L0;
12423 
12424     /* "View.MemoryView":576
12425  *     @property
12426  *     def suboffsets(self):
12427  *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
12428  *             return (-1,) * self.view.ndim
12429  *
12430  */
12431   }
12432 
12433   /* "View.MemoryView":579
12434  *             return (-1,) * self.view.ndim
12435  *
12436  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])             # <<<<<<<<<<<<<<
12437  *
12438  *     @property
12439  */
12440   __Pyx_XDECREF(__pyx_r);
12441   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error)
12442   __Pyx_GOTREF(__pyx_t_3);
12443   __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
12444   for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
12445     __pyx_t_4 = __pyx_t_6;
12446     __pyx_v_suboffset = (__pyx_t_4[0]);
12447     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
12448     __Pyx_GOTREF(__pyx_t_2);
12449     if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 579, __pyx_L1_error)
12450     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12451   }
12452   __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
12453   __Pyx_GOTREF(__pyx_t_2);
12454   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12455   __pyx_r = __pyx_t_2;
12456   __pyx_t_2 = 0;
12457   goto __pyx_L0;
12458 
12459   /* "View.MemoryView":575
12460  *
12461  *     @property
12462  *     def suboffsets(self):             # <<<<<<<<<<<<<<
12463  *         if self.view.suboffsets == NULL:
12464  *             return (-1,) * self.view.ndim
12465  */
12466 
12467   /* function exit code */
12468   __pyx_L1_error:;
12469   __Pyx_XDECREF(__pyx_t_2);
12470   __Pyx_XDECREF(__pyx_t_3);
12471   __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12472   __pyx_r = NULL;
12473   __pyx_L0:;
12474   __Pyx_XGIVEREF(__pyx_r);
12475   __Pyx_RefNannyFinishContext();
12476   return __pyx_r;
12477 }
12478 
12479 /* "View.MemoryView":582
12480  *
12481  *     @property
12482  *     def ndim(self):             # <<<<<<<<<<<<<<
12483  *         return self.view.ndim
12484  *
12485  */
12486 
12487 /* Python wrapper */
12488 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject * __pyx_v_self)12489 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
12490   PyObject *__pyx_r = 0;
12491   __Pyx_RefNannyDeclarations
12492   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12493   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12494 
12495   /* function exit code */
12496   __Pyx_RefNannyFinishContext();
12497   return __pyx_r;
12498 }
12499 
__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj * __pyx_v_self)12500 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12501   PyObject *__pyx_r = NULL;
12502   __Pyx_RefNannyDeclarations
12503   PyObject *__pyx_t_1 = NULL;
12504   int __pyx_lineno = 0;
12505   const char *__pyx_filename = NULL;
12506   int __pyx_clineno = 0;
12507   __Pyx_RefNannySetupContext("__get__", 0);
12508 
12509   /* "View.MemoryView":583
12510  *     @property
12511  *     def ndim(self):
12512  *         return self.view.ndim             # <<<<<<<<<<<<<<
12513  *
12514  *     @property
12515  */
12516   __Pyx_XDECREF(__pyx_r);
12517   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 583, __pyx_L1_error)
12518   __Pyx_GOTREF(__pyx_t_1);
12519   __pyx_r = __pyx_t_1;
12520   __pyx_t_1 = 0;
12521   goto __pyx_L0;
12522 
12523   /* "View.MemoryView":582
12524  *
12525  *     @property
12526  *     def ndim(self):             # <<<<<<<<<<<<<<
12527  *         return self.view.ndim
12528  *
12529  */
12530 
12531   /* function exit code */
12532   __pyx_L1_error:;
12533   __Pyx_XDECREF(__pyx_t_1);
12534   __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12535   __pyx_r = NULL;
12536   __pyx_L0:;
12537   __Pyx_XGIVEREF(__pyx_r);
12538   __Pyx_RefNannyFinishContext();
12539   return __pyx_r;
12540 }
12541 
12542 /* "View.MemoryView":586
12543  *
12544  *     @property
12545  *     def itemsize(self):             # <<<<<<<<<<<<<<
12546  *         return self.view.itemsize
12547  *
12548  */
12549 
12550 /* Python wrapper */
12551 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject * __pyx_v_self)12552 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
12553   PyObject *__pyx_r = 0;
12554   __Pyx_RefNannyDeclarations
12555   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12556   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12557 
12558   /* function exit code */
12559   __Pyx_RefNannyFinishContext();
12560   return __pyx_r;
12561 }
12562 
__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj * __pyx_v_self)12563 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12564   PyObject *__pyx_r = NULL;
12565   __Pyx_RefNannyDeclarations
12566   PyObject *__pyx_t_1 = NULL;
12567   int __pyx_lineno = 0;
12568   const char *__pyx_filename = NULL;
12569   int __pyx_clineno = 0;
12570   __Pyx_RefNannySetupContext("__get__", 0);
12571 
12572   /* "View.MemoryView":587
12573  *     @property
12574  *     def itemsize(self):
12575  *         return self.view.itemsize             # <<<<<<<<<<<<<<
12576  *
12577  *     @property
12578  */
12579   __Pyx_XDECREF(__pyx_r);
12580   __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 587, __pyx_L1_error)
12581   __Pyx_GOTREF(__pyx_t_1);
12582   __pyx_r = __pyx_t_1;
12583   __pyx_t_1 = 0;
12584   goto __pyx_L0;
12585 
12586   /* "View.MemoryView":586
12587  *
12588  *     @property
12589  *     def itemsize(self):             # <<<<<<<<<<<<<<
12590  *         return self.view.itemsize
12591  *
12592  */
12593 
12594   /* function exit code */
12595   __pyx_L1_error:;
12596   __Pyx_XDECREF(__pyx_t_1);
12597   __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12598   __pyx_r = NULL;
12599   __pyx_L0:;
12600   __Pyx_XGIVEREF(__pyx_r);
12601   __Pyx_RefNannyFinishContext();
12602   return __pyx_r;
12603 }
12604 
12605 /* "View.MemoryView":590
12606  *
12607  *     @property
12608  *     def nbytes(self):             # <<<<<<<<<<<<<<
12609  *         return self.size * self.view.itemsize
12610  *
12611  */
12612 
12613 /* Python wrapper */
12614 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject * __pyx_v_self)12615 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
12616   PyObject *__pyx_r = 0;
12617   __Pyx_RefNannyDeclarations
12618   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12619   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12620 
12621   /* function exit code */
12622   __Pyx_RefNannyFinishContext();
12623   return __pyx_r;
12624 }
12625 
__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj * __pyx_v_self)12626 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12627   PyObject *__pyx_r = NULL;
12628   __Pyx_RefNannyDeclarations
12629   PyObject *__pyx_t_1 = NULL;
12630   PyObject *__pyx_t_2 = NULL;
12631   PyObject *__pyx_t_3 = NULL;
12632   int __pyx_lineno = 0;
12633   const char *__pyx_filename = NULL;
12634   int __pyx_clineno = 0;
12635   __Pyx_RefNannySetupContext("__get__", 0);
12636 
12637   /* "View.MemoryView":591
12638  *     @property
12639  *     def nbytes(self):
12640  *         return self.size * self.view.itemsize             # <<<<<<<<<<<<<<
12641  *
12642  *     @property
12643  */
12644   __Pyx_XDECREF(__pyx_r);
12645   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 591, __pyx_L1_error)
12646   __Pyx_GOTREF(__pyx_t_1);
12647   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 591, __pyx_L1_error)
12648   __Pyx_GOTREF(__pyx_t_2);
12649   __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 591, __pyx_L1_error)
12650   __Pyx_GOTREF(__pyx_t_3);
12651   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12652   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12653   __pyx_r = __pyx_t_3;
12654   __pyx_t_3 = 0;
12655   goto __pyx_L0;
12656 
12657   /* "View.MemoryView":590
12658  *
12659  *     @property
12660  *     def nbytes(self):             # <<<<<<<<<<<<<<
12661  *         return self.size * self.view.itemsize
12662  *
12663  */
12664 
12665   /* function exit code */
12666   __pyx_L1_error:;
12667   __Pyx_XDECREF(__pyx_t_1);
12668   __Pyx_XDECREF(__pyx_t_2);
12669   __Pyx_XDECREF(__pyx_t_3);
12670   __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12671   __pyx_r = NULL;
12672   __pyx_L0:;
12673   __Pyx_XGIVEREF(__pyx_r);
12674   __Pyx_RefNannyFinishContext();
12675   return __pyx_r;
12676 }
12677 
12678 /* "View.MemoryView":594
12679  *
12680  *     @property
12681  *     def size(self):             # <<<<<<<<<<<<<<
12682  *         if self._size is None:
12683  *             result = 1
12684  */
12685 
12686 /* Python wrapper */
12687 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject * __pyx_v_self)12688 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
12689   PyObject *__pyx_r = 0;
12690   __Pyx_RefNannyDeclarations
12691   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12692   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12693 
12694   /* function exit code */
12695   __Pyx_RefNannyFinishContext();
12696   return __pyx_r;
12697 }
12698 
__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj * __pyx_v_self)12699 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12700   PyObject *__pyx_v_result = NULL;
12701   PyObject *__pyx_v_length = NULL;
12702   PyObject *__pyx_r = NULL;
12703   __Pyx_RefNannyDeclarations
12704   int __pyx_t_1;
12705   int __pyx_t_2;
12706   Py_ssize_t *__pyx_t_3;
12707   Py_ssize_t *__pyx_t_4;
12708   Py_ssize_t *__pyx_t_5;
12709   PyObject *__pyx_t_6 = NULL;
12710   int __pyx_lineno = 0;
12711   const char *__pyx_filename = NULL;
12712   int __pyx_clineno = 0;
12713   __Pyx_RefNannySetupContext("__get__", 0);
12714 
12715   /* "View.MemoryView":595
12716  *     @property
12717  *     def size(self):
12718  *         if self._size is None:             # <<<<<<<<<<<<<<
12719  *             result = 1
12720  *
12721  */
12722   __pyx_t_1 = (__pyx_v_self->_size == Py_None);
12723   __pyx_t_2 = (__pyx_t_1 != 0);
12724   if (__pyx_t_2) {
12725 
12726     /* "View.MemoryView":596
12727  *     def size(self):
12728  *         if self._size is None:
12729  *             result = 1             # <<<<<<<<<<<<<<
12730  *
12731  *             for length in self.view.shape[:self.view.ndim]:
12732  */
12733     __Pyx_INCREF(__pyx_int_1);
12734     __pyx_v_result = __pyx_int_1;
12735 
12736     /* "View.MemoryView":598
12737  *             result = 1
12738  *
12739  *             for length in self.view.shape[:self.view.ndim]:             # <<<<<<<<<<<<<<
12740  *                 result *= length
12741  *
12742  */
12743     __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
12744     for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
12745       __pyx_t_3 = __pyx_t_5;
12746       __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 598, __pyx_L1_error)
12747       __Pyx_GOTREF(__pyx_t_6);
12748       __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
12749       __pyx_t_6 = 0;
12750 
12751       /* "View.MemoryView":599
12752  *
12753  *             for length in self.view.shape[:self.view.ndim]:
12754  *                 result *= length             # <<<<<<<<<<<<<<
12755  *
12756  *             self._size = result
12757  */
12758       __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 599, __pyx_L1_error)
12759       __Pyx_GOTREF(__pyx_t_6);
12760       __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
12761       __pyx_t_6 = 0;
12762     }
12763 
12764     /* "View.MemoryView":601
12765  *                 result *= length
12766  *
12767  *             self._size = result             # <<<<<<<<<<<<<<
12768  *
12769  *         return self._size
12770  */
12771     __Pyx_INCREF(__pyx_v_result);
12772     __Pyx_GIVEREF(__pyx_v_result);
12773     __Pyx_GOTREF(__pyx_v_self->_size);
12774     __Pyx_DECREF(__pyx_v_self->_size);
12775     __pyx_v_self->_size = __pyx_v_result;
12776 
12777     /* "View.MemoryView":595
12778  *     @property
12779  *     def size(self):
12780  *         if self._size is None:             # <<<<<<<<<<<<<<
12781  *             result = 1
12782  *
12783  */
12784   }
12785 
12786   /* "View.MemoryView":603
12787  *             self._size = result
12788  *
12789  *         return self._size             # <<<<<<<<<<<<<<
12790  *
12791  *     def __len__(self):
12792  */
12793   __Pyx_XDECREF(__pyx_r);
12794   __Pyx_INCREF(__pyx_v_self->_size);
12795   __pyx_r = __pyx_v_self->_size;
12796   goto __pyx_L0;
12797 
12798   /* "View.MemoryView":594
12799  *
12800  *     @property
12801  *     def size(self):             # <<<<<<<<<<<<<<
12802  *         if self._size is None:
12803  *             result = 1
12804  */
12805 
12806   /* function exit code */
12807   __pyx_L1_error:;
12808   __Pyx_XDECREF(__pyx_t_6);
12809   __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12810   __pyx_r = NULL;
12811   __pyx_L0:;
12812   __Pyx_XDECREF(__pyx_v_result);
12813   __Pyx_XDECREF(__pyx_v_length);
12814   __Pyx_XGIVEREF(__pyx_r);
12815   __Pyx_RefNannyFinishContext();
12816   return __pyx_r;
12817 }
12818 
12819 /* "View.MemoryView":605
12820  *         return self._size
12821  *
12822  *     def __len__(self):             # <<<<<<<<<<<<<<
12823  *         if self.view.ndim >= 1:
12824  *             return self.view.shape[0]
12825  */
12826 
12827 /* Python wrapper */
12828 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___len__(PyObject * __pyx_v_self)12829 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
12830   Py_ssize_t __pyx_r;
12831   __Pyx_RefNannyDeclarations
12832   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
12833   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12834 
12835   /* function exit code */
12836   __Pyx_RefNannyFinishContext();
12837   return __pyx_r;
12838 }
12839 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj * __pyx_v_self)12840 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
12841   Py_ssize_t __pyx_r;
12842   __Pyx_RefNannyDeclarations
12843   int __pyx_t_1;
12844   __Pyx_RefNannySetupContext("__len__", 0);
12845 
12846   /* "View.MemoryView":606
12847  *
12848  *     def __len__(self):
12849  *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
12850  *             return self.view.shape[0]
12851  *
12852  */
12853   __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
12854   if (__pyx_t_1) {
12855 
12856     /* "View.MemoryView":607
12857  *     def __len__(self):
12858  *         if self.view.ndim >= 1:
12859  *             return self.view.shape[0]             # <<<<<<<<<<<<<<
12860  *
12861  *         return 0
12862  */
12863     __pyx_r = (__pyx_v_self->view.shape[0]);
12864     goto __pyx_L0;
12865 
12866     /* "View.MemoryView":606
12867  *
12868  *     def __len__(self):
12869  *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
12870  *             return self.view.shape[0]
12871  *
12872  */
12873   }
12874 
12875   /* "View.MemoryView":609
12876  *             return self.view.shape[0]
12877  *
12878  *         return 0             # <<<<<<<<<<<<<<
12879  *
12880  *     def __repr__(self):
12881  */
12882   __pyx_r = 0;
12883   goto __pyx_L0;
12884 
12885   /* "View.MemoryView":605
12886  *         return self._size
12887  *
12888  *     def __len__(self):             # <<<<<<<<<<<<<<
12889  *         if self.view.ndim >= 1:
12890  *             return self.view.shape[0]
12891  */
12892 
12893   /* function exit code */
12894   __pyx_L0:;
12895   __Pyx_RefNannyFinishContext();
12896   return __pyx_r;
12897 }
12898 
12899 /* "View.MemoryView":611
12900  *         return 0
12901  *
12902  *     def __repr__(self):             # <<<<<<<<<<<<<<
12903  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
12904  *                                                id(self))
12905  */
12906 
12907 /* Python wrapper */
12908 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___repr__(PyObject * __pyx_v_self)12909 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
12910   PyObject *__pyx_r = 0;
12911   __Pyx_RefNannyDeclarations
12912   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
12913   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12914 
12915   /* function exit code */
12916   __Pyx_RefNannyFinishContext();
12917   return __pyx_r;
12918 }
12919 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj * __pyx_v_self)12920 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
12921   PyObject *__pyx_r = NULL;
12922   __Pyx_RefNannyDeclarations
12923   PyObject *__pyx_t_1 = NULL;
12924   PyObject *__pyx_t_2 = NULL;
12925   PyObject *__pyx_t_3 = NULL;
12926   int __pyx_lineno = 0;
12927   const char *__pyx_filename = NULL;
12928   int __pyx_clineno = 0;
12929   __Pyx_RefNannySetupContext("__repr__", 0);
12930 
12931   /* "View.MemoryView":612
12932  *
12933  *     def __repr__(self):
12934  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
12935  *                                                id(self))
12936  *
12937  */
12938   __Pyx_XDECREF(__pyx_r);
12939   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error)
12940   __Pyx_GOTREF(__pyx_t_1);
12941   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __pyx_L1_error)
12942   __Pyx_GOTREF(__pyx_t_2);
12943   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12944   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error)
12945   __Pyx_GOTREF(__pyx_t_1);
12946   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12947 
12948   /* "View.MemoryView":613
12949  *     def __repr__(self):
12950  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
12951  *                                                id(self))             # <<<<<<<<<<<<<<
12952  *
12953  *     def __str__(self):
12954  */
12955   __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 613, __pyx_L1_error)
12956   __Pyx_GOTREF(__pyx_t_2);
12957 
12958   /* "View.MemoryView":612
12959  *
12960  *     def __repr__(self):
12961  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
12962  *                                                id(self))
12963  *
12964  */
12965   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 612, __pyx_L1_error)
12966   __Pyx_GOTREF(__pyx_t_3);
12967   __Pyx_GIVEREF(__pyx_t_1);
12968   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
12969   __Pyx_GIVEREF(__pyx_t_2);
12970   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
12971   __pyx_t_1 = 0;
12972   __pyx_t_2 = 0;
12973   __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __pyx_L1_error)
12974   __Pyx_GOTREF(__pyx_t_2);
12975   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12976   __pyx_r = __pyx_t_2;
12977   __pyx_t_2 = 0;
12978   goto __pyx_L0;
12979 
12980   /* "View.MemoryView":611
12981  *         return 0
12982  *
12983  *     def __repr__(self):             # <<<<<<<<<<<<<<
12984  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
12985  *                                                id(self))
12986  */
12987 
12988   /* function exit code */
12989   __pyx_L1_error:;
12990   __Pyx_XDECREF(__pyx_t_1);
12991   __Pyx_XDECREF(__pyx_t_2);
12992   __Pyx_XDECREF(__pyx_t_3);
12993   __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12994   __pyx_r = NULL;
12995   __pyx_L0:;
12996   __Pyx_XGIVEREF(__pyx_r);
12997   __Pyx_RefNannyFinishContext();
12998   return __pyx_r;
12999 }
13000 
13001 /* "View.MemoryView":615
13002  *                                                id(self))
13003  *
13004  *     def __str__(self):             # <<<<<<<<<<<<<<
13005  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
13006  *
13007  */
13008 
13009 /* Python wrapper */
13010 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___str__(PyObject * __pyx_v_self)13011 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
13012   PyObject *__pyx_r = 0;
13013   __Pyx_RefNannyDeclarations
13014   __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
13015   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));
13016 
13017   /* function exit code */
13018   __Pyx_RefNannyFinishContext();
13019   return __pyx_r;
13020 }
13021 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj * __pyx_v_self)13022 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
13023   PyObject *__pyx_r = NULL;
13024   __Pyx_RefNannyDeclarations
13025   PyObject *__pyx_t_1 = NULL;
13026   PyObject *__pyx_t_2 = NULL;
13027   int __pyx_lineno = 0;
13028   const char *__pyx_filename = NULL;
13029   int __pyx_clineno = 0;
13030   __Pyx_RefNannySetupContext("__str__", 0);
13031 
13032   /* "View.MemoryView":616
13033  *
13034  *     def __str__(self):
13035  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)             # <<<<<<<<<<<<<<
13036  *
13037  *
13038  */
13039   __Pyx_XDECREF(__pyx_r);
13040   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
13041   __Pyx_GOTREF(__pyx_t_1);
13042   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __pyx_L1_error)
13043   __Pyx_GOTREF(__pyx_t_2);
13044   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13045   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
13046   __Pyx_GOTREF(__pyx_t_1);
13047   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13048   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __pyx_L1_error)
13049   __Pyx_GOTREF(__pyx_t_2);
13050   __Pyx_GIVEREF(__pyx_t_1);
13051   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
13052   __pyx_t_1 = 0;
13053   __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
13054   __Pyx_GOTREF(__pyx_t_1);
13055   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13056   __pyx_r = __pyx_t_1;
13057   __pyx_t_1 = 0;
13058   goto __pyx_L0;
13059 
13060   /* "View.MemoryView":615
13061  *                                                id(self))
13062  *
13063  *     def __str__(self):             # <<<<<<<<<<<<<<
13064  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
13065  *
13066  */
13067 
13068   /* function exit code */
13069   __pyx_L1_error:;
13070   __Pyx_XDECREF(__pyx_t_1);
13071   __Pyx_XDECREF(__pyx_t_2);
13072   __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13073   __pyx_r = NULL;
13074   __pyx_L0:;
13075   __Pyx_XGIVEREF(__pyx_r);
13076   __Pyx_RefNannyFinishContext();
13077   return __pyx_r;
13078 }
13079 
13080 /* "View.MemoryView":619
13081  *
13082  *
13083  *     def is_c_contig(self):             # <<<<<<<<<<<<<<
13084  *         cdef __Pyx_memviewslice *mslice
13085  *         cdef __Pyx_memviewslice tmp
13086  */
13087 
13088 /* Python wrapper */
13089 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_is_c_contig(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)13090 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13091   PyObject *__pyx_r = 0;
13092   __Pyx_RefNannyDeclarations
13093   __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
13094   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
13095 
13096   /* function exit code */
13097   __Pyx_RefNannyFinishContext();
13098   return __pyx_r;
13099 }
13100 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj * __pyx_v_self)13101 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
13102   __Pyx_memviewslice *__pyx_v_mslice;
13103   __Pyx_memviewslice __pyx_v_tmp;
13104   PyObject *__pyx_r = NULL;
13105   __Pyx_RefNannyDeclarations
13106   __Pyx_memviewslice *__pyx_t_1;
13107   PyObject *__pyx_t_2 = NULL;
13108   int __pyx_lineno = 0;
13109   const char *__pyx_filename = NULL;
13110   int __pyx_clineno = 0;
13111   __Pyx_RefNannySetupContext("is_c_contig", 0);
13112 
13113   /* "View.MemoryView":622
13114  *         cdef __Pyx_memviewslice *mslice
13115  *         cdef __Pyx_memviewslice tmp
13116  *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
13117  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
13118  *
13119  */
13120   __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 622, __pyx_L1_error)
13121   __pyx_v_mslice = __pyx_t_1;
13122 
13123   /* "View.MemoryView":623
13124  *         cdef __Pyx_memviewslice tmp
13125  *         mslice = get_slice_from_memview(self, &tmp)
13126  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)             # <<<<<<<<<<<<<<
13127  *
13128  *     def is_f_contig(self):
13129  */
13130   __Pyx_XDECREF(__pyx_r);
13131   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 623, __pyx_L1_error)
13132   __Pyx_GOTREF(__pyx_t_2);
13133   __pyx_r = __pyx_t_2;
13134   __pyx_t_2 = 0;
13135   goto __pyx_L0;
13136 
13137   /* "View.MemoryView":619
13138  *
13139  *
13140  *     def is_c_contig(self):             # <<<<<<<<<<<<<<
13141  *         cdef __Pyx_memviewslice *mslice
13142  *         cdef __Pyx_memviewslice tmp
13143  */
13144 
13145   /* function exit code */
13146   __pyx_L1_error:;
13147   __Pyx_XDECREF(__pyx_t_2);
13148   __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
13149   __pyx_r = NULL;
13150   __pyx_L0:;
13151   __Pyx_XGIVEREF(__pyx_r);
13152   __Pyx_RefNannyFinishContext();
13153   return __pyx_r;
13154 }
13155 
13156 /* "View.MemoryView":625
13157  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
13158  *
13159  *     def is_f_contig(self):             # <<<<<<<<<<<<<<
13160  *         cdef __Pyx_memviewslice *mslice
13161  *         cdef __Pyx_memviewslice tmp
13162  */
13163 
13164 /* Python wrapper */
13165 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_is_f_contig(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)13166 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13167   PyObject *__pyx_r = 0;
13168   __Pyx_RefNannyDeclarations
13169   __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
13170   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
13171 
13172   /* function exit code */
13173   __Pyx_RefNannyFinishContext();
13174   return __pyx_r;
13175 }
13176 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj * __pyx_v_self)13177 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
13178   __Pyx_memviewslice *__pyx_v_mslice;
13179   __Pyx_memviewslice __pyx_v_tmp;
13180   PyObject *__pyx_r = NULL;
13181   __Pyx_RefNannyDeclarations
13182   __Pyx_memviewslice *__pyx_t_1;
13183   PyObject *__pyx_t_2 = NULL;
13184   int __pyx_lineno = 0;
13185   const char *__pyx_filename = NULL;
13186   int __pyx_clineno = 0;
13187   __Pyx_RefNannySetupContext("is_f_contig", 0);
13188 
13189   /* "View.MemoryView":628
13190  *         cdef __Pyx_memviewslice *mslice
13191  *         cdef __Pyx_memviewslice tmp
13192  *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
13193  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
13194  *
13195  */
13196   __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 628, __pyx_L1_error)
13197   __pyx_v_mslice = __pyx_t_1;
13198 
13199   /* "View.MemoryView":629
13200  *         cdef __Pyx_memviewslice tmp
13201  *         mslice = get_slice_from_memview(self, &tmp)
13202  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)             # <<<<<<<<<<<<<<
13203  *
13204  *     def copy(self):
13205  */
13206   __Pyx_XDECREF(__pyx_r);
13207   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 629, __pyx_L1_error)
13208   __Pyx_GOTREF(__pyx_t_2);
13209   __pyx_r = __pyx_t_2;
13210   __pyx_t_2 = 0;
13211   goto __pyx_L0;
13212 
13213   /* "View.MemoryView":625
13214  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
13215  *
13216  *     def is_f_contig(self):             # <<<<<<<<<<<<<<
13217  *         cdef __Pyx_memviewslice *mslice
13218  *         cdef __Pyx_memviewslice tmp
13219  */
13220 
13221   /* function exit code */
13222   __pyx_L1_error:;
13223   __Pyx_XDECREF(__pyx_t_2);
13224   __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
13225   __pyx_r = NULL;
13226   __pyx_L0:;
13227   __Pyx_XGIVEREF(__pyx_r);
13228   __Pyx_RefNannyFinishContext();
13229   return __pyx_r;
13230 }
13231 
13232 /* "View.MemoryView":631
13233  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
13234  *
13235  *     def copy(self):             # <<<<<<<<<<<<<<
13236  *         cdef __Pyx_memviewslice mslice
13237  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
13238  */
13239 
13240 /* Python wrapper */
13241 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_copy(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)13242 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13243   PyObject *__pyx_r = 0;
13244   __Pyx_RefNannyDeclarations
13245   __Pyx_RefNannySetupContext("copy (wrapper)", 0);
13246   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));
13247 
13248   /* function exit code */
13249   __Pyx_RefNannyFinishContext();
13250   return __pyx_r;
13251 }
13252 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj * __pyx_v_self)13253 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
13254   __Pyx_memviewslice __pyx_v_mslice;
13255   int __pyx_v_flags;
13256   PyObject *__pyx_r = NULL;
13257   __Pyx_RefNannyDeclarations
13258   __Pyx_memviewslice __pyx_t_1;
13259   PyObject *__pyx_t_2 = NULL;
13260   int __pyx_lineno = 0;
13261   const char *__pyx_filename = NULL;
13262   int __pyx_clineno = 0;
13263   __Pyx_RefNannySetupContext("copy", 0);
13264 
13265   /* "View.MemoryView":633
13266  *     def copy(self):
13267  *         cdef __Pyx_memviewslice mslice
13268  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS             # <<<<<<<<<<<<<<
13269  *
13270  *         slice_copy(self, &mslice)
13271  */
13272   __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
13273 
13274   /* "View.MemoryView":635
13275  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
13276  *
13277  *         slice_copy(self, &mslice)             # <<<<<<<<<<<<<<
13278  *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
13279  *                                    self.view.itemsize,
13280  */
13281   __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
13282 
13283   /* "View.MemoryView":636
13284  *
13285  *         slice_copy(self, &mslice)
13286  *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,             # <<<<<<<<<<<<<<
13287  *                                    self.view.itemsize,
13288  *                                    flags|PyBUF_C_CONTIGUOUS,
13289  */
13290   __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 636, __pyx_L1_error)
13291   __pyx_v_mslice = __pyx_t_1;
13292 
13293   /* "View.MemoryView":641
13294  *                                    self.dtype_is_object)
13295  *
13296  *         return memoryview_copy_from_slice(self, &mslice)             # <<<<<<<<<<<<<<
13297  *
13298  *     def copy_fortran(self):
13299  */
13300   __Pyx_XDECREF(__pyx_r);
13301   __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 641, __pyx_L1_error)
13302   __Pyx_GOTREF(__pyx_t_2);
13303   __pyx_r = __pyx_t_2;
13304   __pyx_t_2 = 0;
13305   goto __pyx_L0;
13306 
13307   /* "View.MemoryView":631
13308  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
13309  *
13310  *     def copy(self):             # <<<<<<<<<<<<<<
13311  *         cdef __Pyx_memviewslice mslice
13312  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
13313  */
13314 
13315   /* function exit code */
13316   __pyx_L1_error:;
13317   __Pyx_XDECREF(__pyx_t_2);
13318   __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
13319   __pyx_r = NULL;
13320   __pyx_L0:;
13321   __Pyx_XGIVEREF(__pyx_r);
13322   __Pyx_RefNannyFinishContext();
13323   return __pyx_r;
13324 }
13325 
13326 /* "View.MemoryView":643
13327  *         return memoryview_copy_from_slice(self, &mslice)
13328  *
13329  *     def copy_fortran(self):             # <<<<<<<<<<<<<<
13330  *         cdef __Pyx_memviewslice src, dst
13331  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
13332  */
13333 
13334 /* Python wrapper */
13335 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_memoryview_copy_fortran(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)13336 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13337   PyObject *__pyx_r = 0;
13338   __Pyx_RefNannyDeclarations
13339   __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
13340   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));
13341 
13342   /* function exit code */
13343   __Pyx_RefNannyFinishContext();
13344   return __pyx_r;
13345 }
13346 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj * __pyx_v_self)13347 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
13348   __Pyx_memviewslice __pyx_v_src;
13349   __Pyx_memviewslice __pyx_v_dst;
13350   int __pyx_v_flags;
13351   PyObject *__pyx_r = NULL;
13352   __Pyx_RefNannyDeclarations
13353   __Pyx_memviewslice __pyx_t_1;
13354   PyObject *__pyx_t_2 = NULL;
13355   int __pyx_lineno = 0;
13356   const char *__pyx_filename = NULL;
13357   int __pyx_clineno = 0;
13358   __Pyx_RefNannySetupContext("copy_fortran", 0);
13359 
13360   /* "View.MemoryView":645
13361  *     def copy_fortran(self):
13362  *         cdef __Pyx_memviewslice src, dst
13363  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS             # <<<<<<<<<<<<<<
13364  *
13365  *         slice_copy(self, &src)
13366  */
13367   __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
13368 
13369   /* "View.MemoryView":647
13370  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
13371  *
13372  *         slice_copy(self, &src)             # <<<<<<<<<<<<<<
13373  *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,
13374  *                                 self.view.itemsize,
13375  */
13376   __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
13377 
13378   /* "View.MemoryView":648
13379  *
13380  *         slice_copy(self, &src)
13381  *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,             # <<<<<<<<<<<<<<
13382  *                                 self.view.itemsize,
13383  *                                 flags|PyBUF_F_CONTIGUOUS,
13384  */
13385   __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 648, __pyx_L1_error)
13386   __pyx_v_dst = __pyx_t_1;
13387 
13388   /* "View.MemoryView":653
13389  *                                 self.dtype_is_object)
13390  *
13391  *         return memoryview_copy_from_slice(self, &dst)             # <<<<<<<<<<<<<<
13392  *
13393  *
13394  */
13395   __Pyx_XDECREF(__pyx_r);
13396   __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 653, __pyx_L1_error)
13397   __Pyx_GOTREF(__pyx_t_2);
13398   __pyx_r = __pyx_t_2;
13399   __pyx_t_2 = 0;
13400   goto __pyx_L0;
13401 
13402   /* "View.MemoryView":643
13403  *         return memoryview_copy_from_slice(self, &mslice)
13404  *
13405  *     def copy_fortran(self):             # <<<<<<<<<<<<<<
13406  *         cdef __Pyx_memviewslice src, dst
13407  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
13408  */
13409 
13410   /* function exit code */
13411   __pyx_L1_error:;
13412   __Pyx_XDECREF(__pyx_t_2);
13413   __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
13414   __pyx_r = NULL;
13415   __pyx_L0:;
13416   __Pyx_XGIVEREF(__pyx_r);
13417   __Pyx_RefNannyFinishContext();
13418   return __pyx_r;
13419 }
13420 
13421 /* "(tree fragment)":1
13422  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
13423  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13424  * def __setstate_cython__(self, __pyx_state):
13425  */
13426 
13427 /* Python wrapper */
13428 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)13429 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13430   PyObject *__pyx_r = 0;
13431   __Pyx_RefNannyDeclarations
13432   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
13433   __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));
13434 
13435   /* function exit code */
13436   __Pyx_RefNannyFinishContext();
13437   return __pyx_r;
13438 }
13439 
__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj * __pyx_v_self)13440 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
13441   PyObject *__pyx_r = NULL;
13442   __Pyx_RefNannyDeclarations
13443   PyObject *__pyx_t_1 = NULL;
13444   int __pyx_lineno = 0;
13445   const char *__pyx_filename = NULL;
13446   int __pyx_clineno = 0;
13447   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
13448 
13449   /* "(tree fragment)":2
13450  * def __reduce_cython__(self):
13451  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
13452  * def __setstate_cython__(self, __pyx_state):
13453  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13454  */
13455   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
13456   __Pyx_GOTREF(__pyx_t_1);
13457   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
13458   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13459   __PYX_ERR(2, 2, __pyx_L1_error)
13460 
13461   /* "(tree fragment)":1
13462  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
13463  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13464  * def __setstate_cython__(self, __pyx_state):
13465  */
13466 
13467   /* function exit code */
13468   __pyx_L1_error:;
13469   __Pyx_XDECREF(__pyx_t_1);
13470   __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13471   __pyx_r = NULL;
13472   __Pyx_XGIVEREF(__pyx_r);
13473   __Pyx_RefNannyFinishContext();
13474   return __pyx_r;
13475 }
13476 
13477 /* "(tree fragment)":3
13478  * def __reduce_cython__(self):
13479  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13480  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
13481  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13482  */
13483 
13484 /* Python wrapper */
13485 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)13486 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
13487   PyObject *__pyx_r = 0;
13488   __Pyx_RefNannyDeclarations
13489   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
13490   __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
13491 
13492   /* function exit code */
13493   __Pyx_RefNannyFinishContext();
13494   return __pyx_r;
13495 }
13496 
__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)13497 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
13498   PyObject *__pyx_r = NULL;
13499   __Pyx_RefNannyDeclarations
13500   PyObject *__pyx_t_1 = NULL;
13501   int __pyx_lineno = 0;
13502   const char *__pyx_filename = NULL;
13503   int __pyx_clineno = 0;
13504   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
13505 
13506   /* "(tree fragment)":4
13507  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13508  * def __setstate_cython__(self, __pyx_state):
13509  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
13510  */
13511   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
13512   __Pyx_GOTREF(__pyx_t_1);
13513   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
13514   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13515   __PYX_ERR(2, 4, __pyx_L1_error)
13516 
13517   /* "(tree fragment)":3
13518  * def __reduce_cython__(self):
13519  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13520  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
13521  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13522  */
13523 
13524   /* function exit code */
13525   __pyx_L1_error:;
13526   __Pyx_XDECREF(__pyx_t_1);
13527   __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13528   __pyx_r = NULL;
13529   __Pyx_XGIVEREF(__pyx_r);
13530   __Pyx_RefNannyFinishContext();
13531   return __pyx_r;
13532 }
13533 
13534 /* "View.MemoryView":657
13535  *
13536  * @cname('__pyx_memoryview_new')
13537  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
13538  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
13539  *     result.typeinfo = typeinfo
13540  */
13541 
__pyx_memoryview_new(PyObject * __pyx_v_o,int __pyx_v_flags,int __pyx_v_dtype_is_object,__Pyx_TypeInfo * __pyx_v_typeinfo)13542 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
13543   struct __pyx_memoryview_obj *__pyx_v_result = 0;
13544   PyObject *__pyx_r = NULL;
13545   __Pyx_RefNannyDeclarations
13546   PyObject *__pyx_t_1 = NULL;
13547   PyObject *__pyx_t_2 = NULL;
13548   PyObject *__pyx_t_3 = NULL;
13549   int __pyx_lineno = 0;
13550   const char *__pyx_filename = NULL;
13551   int __pyx_clineno = 0;
13552   __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);
13553 
13554   /* "View.MemoryView":658
13555  * @cname('__pyx_memoryview_new')
13556  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
13557  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)             # <<<<<<<<<<<<<<
13558  *     result.typeinfo = typeinfo
13559  *     return result
13560  */
13561   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 658, __pyx_L1_error)
13562   __Pyx_GOTREF(__pyx_t_1);
13563   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error)
13564   __Pyx_GOTREF(__pyx_t_2);
13565   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 658, __pyx_L1_error)
13566   __Pyx_GOTREF(__pyx_t_3);
13567   __Pyx_INCREF(__pyx_v_o);
13568   __Pyx_GIVEREF(__pyx_v_o);
13569   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
13570   __Pyx_GIVEREF(__pyx_t_1);
13571   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
13572   __Pyx_GIVEREF(__pyx_t_2);
13573   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
13574   __pyx_t_1 = 0;
13575   __pyx_t_2 = 0;
13576   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error)
13577   __Pyx_GOTREF(__pyx_t_2);
13578   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13579   __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
13580   __pyx_t_2 = 0;
13581 
13582   /* "View.MemoryView":659
13583  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
13584  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
13585  *     result.typeinfo = typeinfo             # <<<<<<<<<<<<<<
13586  *     return result
13587  *
13588  */
13589   __pyx_v_result->typeinfo = __pyx_v_typeinfo;
13590 
13591   /* "View.MemoryView":660
13592  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
13593  *     result.typeinfo = typeinfo
13594  *     return result             # <<<<<<<<<<<<<<
13595  *
13596  * @cname('__pyx_memoryview_check')
13597  */
13598   __Pyx_XDECREF(__pyx_r);
13599   __Pyx_INCREF(((PyObject *)__pyx_v_result));
13600   __pyx_r = ((PyObject *)__pyx_v_result);
13601   goto __pyx_L0;
13602 
13603   /* "View.MemoryView":657
13604  *
13605  * @cname('__pyx_memoryview_new')
13606  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
13607  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
13608  *     result.typeinfo = typeinfo
13609  */
13610 
13611   /* function exit code */
13612   __pyx_L1_error:;
13613   __Pyx_XDECREF(__pyx_t_1);
13614   __Pyx_XDECREF(__pyx_t_2);
13615   __Pyx_XDECREF(__pyx_t_3);
13616   __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
13617   __pyx_r = 0;
13618   __pyx_L0:;
13619   __Pyx_XDECREF((PyObject *)__pyx_v_result);
13620   __Pyx_XGIVEREF(__pyx_r);
13621   __Pyx_RefNannyFinishContext();
13622   return __pyx_r;
13623 }
13624 
13625 /* "View.MemoryView":663
13626  *
13627  * @cname('__pyx_memoryview_check')
13628  * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
13629  *     return isinstance(o, memoryview)
13630  *
13631  */
13632 
__pyx_memoryview_check(PyObject * __pyx_v_o)13633 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
13634   int __pyx_r;
13635   __Pyx_RefNannyDeclarations
13636   int __pyx_t_1;
13637   __Pyx_RefNannySetupContext("memoryview_check", 0);
13638 
13639   /* "View.MemoryView":664
13640  * @cname('__pyx_memoryview_check')
13641  * cdef inline bint memoryview_check(object o):
13642  *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
13643  *
13644  * cdef tuple _unellipsify(object index, int ndim):
13645  */
13646   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
13647   __pyx_r = __pyx_t_1;
13648   goto __pyx_L0;
13649 
13650   /* "View.MemoryView":663
13651  *
13652  * @cname('__pyx_memoryview_check')
13653  * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
13654  *     return isinstance(o, memoryview)
13655  *
13656  */
13657 
13658   /* function exit code */
13659   __pyx_L0:;
13660   __Pyx_RefNannyFinishContext();
13661   return __pyx_r;
13662 }
13663 
13664 /* "View.MemoryView":666
13665  *     return isinstance(o, memoryview)
13666  *
13667  * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
13668  *     """
13669  *     Replace all ellipses with full slices and fill incomplete indices with
13670  */
13671 
_unellipsify(PyObject * __pyx_v_index,int __pyx_v_ndim)13672 static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
13673   PyObject *__pyx_v_tup = NULL;
13674   PyObject *__pyx_v_result = NULL;
13675   int __pyx_v_have_slices;
13676   int __pyx_v_seen_ellipsis;
13677   CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
13678   PyObject *__pyx_v_item = NULL;
13679   Py_ssize_t __pyx_v_nslices;
13680   PyObject *__pyx_r = NULL;
13681   __Pyx_RefNannyDeclarations
13682   int __pyx_t_1;
13683   int __pyx_t_2;
13684   PyObject *__pyx_t_3 = NULL;
13685   PyObject *__pyx_t_4 = NULL;
13686   Py_ssize_t __pyx_t_5;
13687   PyObject *(*__pyx_t_6)(PyObject *);
13688   PyObject *__pyx_t_7 = NULL;
13689   Py_ssize_t __pyx_t_8;
13690   int __pyx_t_9;
13691   int __pyx_t_10;
13692   PyObject *__pyx_t_11 = NULL;
13693   int __pyx_lineno = 0;
13694   const char *__pyx_filename = NULL;
13695   int __pyx_clineno = 0;
13696   __Pyx_RefNannySetupContext("_unellipsify", 0);
13697 
13698   /* "View.MemoryView":671
13699  *     full slices.
13700  *     """
13701  *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
13702  *         tup = (index,)
13703  *     else:
13704  */
13705   __pyx_t_1 = PyTuple_Check(__pyx_v_index);
13706   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
13707   if (__pyx_t_2) {
13708 
13709     /* "View.MemoryView":672
13710  *     """
13711  *     if not isinstance(index, tuple):
13712  *         tup = (index,)             # <<<<<<<<<<<<<<
13713  *     else:
13714  *         tup = index
13715  */
13716     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 672, __pyx_L1_error)
13717     __Pyx_GOTREF(__pyx_t_3);
13718     __Pyx_INCREF(__pyx_v_index);
13719     __Pyx_GIVEREF(__pyx_v_index);
13720     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
13721     __pyx_v_tup = __pyx_t_3;
13722     __pyx_t_3 = 0;
13723 
13724     /* "View.MemoryView":671
13725  *     full slices.
13726  *     """
13727  *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
13728  *         tup = (index,)
13729  *     else:
13730  */
13731     goto __pyx_L3;
13732   }
13733 
13734   /* "View.MemoryView":674
13735  *         tup = (index,)
13736  *     else:
13737  *         tup = index             # <<<<<<<<<<<<<<
13738  *
13739  *     result = []
13740  */
13741   /*else*/ {
13742     __Pyx_INCREF(__pyx_v_index);
13743     __pyx_v_tup = __pyx_v_index;
13744   }
13745   __pyx_L3:;
13746 
13747   /* "View.MemoryView":676
13748  *         tup = index
13749  *
13750  *     result = []             # <<<<<<<<<<<<<<
13751  *     have_slices = False
13752  *     seen_ellipsis = False
13753  */
13754   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 676, __pyx_L1_error)
13755   __Pyx_GOTREF(__pyx_t_3);
13756   __pyx_v_result = ((PyObject*)__pyx_t_3);
13757   __pyx_t_3 = 0;
13758 
13759   /* "View.MemoryView":677
13760  *
13761  *     result = []
13762  *     have_slices = False             # <<<<<<<<<<<<<<
13763  *     seen_ellipsis = False
13764  *     for idx, item in enumerate(tup):
13765  */
13766   __pyx_v_have_slices = 0;
13767 
13768   /* "View.MemoryView":678
13769  *     result = []
13770  *     have_slices = False
13771  *     seen_ellipsis = False             # <<<<<<<<<<<<<<
13772  *     for idx, item in enumerate(tup):
13773  *         if item is Ellipsis:
13774  */
13775   __pyx_v_seen_ellipsis = 0;
13776 
13777   /* "View.MemoryView":679
13778  *     have_slices = False
13779  *     seen_ellipsis = False
13780  *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
13781  *         if item is Ellipsis:
13782  *             if not seen_ellipsis:
13783  */
13784   __Pyx_INCREF(__pyx_int_0);
13785   __pyx_t_3 = __pyx_int_0;
13786   if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
13787     __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
13788     __pyx_t_6 = NULL;
13789   } else {
13790     __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 679, __pyx_L1_error)
13791     __Pyx_GOTREF(__pyx_t_4);
13792     __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 679, __pyx_L1_error)
13793   }
13794   for (;;) {
13795     if (likely(!__pyx_t_6)) {
13796       if (likely(PyList_CheckExact(__pyx_t_4))) {
13797         if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
13798         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13799         __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 679, __pyx_L1_error)
13800         #else
13801         __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
13802         __Pyx_GOTREF(__pyx_t_7);
13803         #endif
13804       } else {
13805         if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
13806         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13807         __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 679, __pyx_L1_error)
13808         #else
13809         __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
13810         __Pyx_GOTREF(__pyx_t_7);
13811         #endif
13812       }
13813     } else {
13814       __pyx_t_7 = __pyx_t_6(__pyx_t_4);
13815       if (unlikely(!__pyx_t_7)) {
13816         PyObject* exc_type = PyErr_Occurred();
13817         if (exc_type) {
13818           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
13819           else __PYX_ERR(2, 679, __pyx_L1_error)
13820         }
13821         break;
13822       }
13823       __Pyx_GOTREF(__pyx_t_7);
13824     }
13825     __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
13826     __pyx_t_7 = 0;
13827     __Pyx_INCREF(__pyx_t_3);
13828     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
13829     __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
13830     __Pyx_GOTREF(__pyx_t_7);
13831     __Pyx_DECREF(__pyx_t_3);
13832     __pyx_t_3 = __pyx_t_7;
13833     __pyx_t_7 = 0;
13834 
13835     /* "View.MemoryView":680
13836  *     seen_ellipsis = False
13837  *     for idx, item in enumerate(tup):
13838  *         if item is Ellipsis:             # <<<<<<<<<<<<<<
13839  *             if not seen_ellipsis:
13840  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
13841  */
13842     __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
13843     __pyx_t_1 = (__pyx_t_2 != 0);
13844     if (__pyx_t_1) {
13845 
13846       /* "View.MemoryView":681
13847  *     for idx, item in enumerate(tup):
13848  *         if item is Ellipsis:
13849  *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
13850  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
13851  *                 seen_ellipsis = True
13852  */
13853       __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
13854       if (__pyx_t_1) {
13855 
13856         /* "View.MemoryView":682
13857  *         if item is Ellipsis:
13858  *             if not seen_ellipsis:
13859  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
13860  *                 seen_ellipsis = True
13861  *             else:
13862  */
13863         __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 682, __pyx_L1_error)
13864         __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 682, __pyx_L1_error)
13865         __Pyx_GOTREF(__pyx_t_7);
13866         { Py_ssize_t __pyx_temp;
13867           for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
13868             __Pyx_INCREF(__pyx_slice__18);
13869             __Pyx_GIVEREF(__pyx_slice__18);
13870             PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__18);
13871           }
13872         }
13873         __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 682, __pyx_L1_error)
13874         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13875 
13876         /* "View.MemoryView":683
13877  *             if not seen_ellipsis:
13878  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
13879  *                 seen_ellipsis = True             # <<<<<<<<<<<<<<
13880  *             else:
13881  *                 result.append(slice(None))
13882  */
13883         __pyx_v_seen_ellipsis = 1;
13884 
13885         /* "View.MemoryView":681
13886  *     for idx, item in enumerate(tup):
13887  *         if item is Ellipsis:
13888  *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
13889  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
13890  *                 seen_ellipsis = True
13891  */
13892         goto __pyx_L7;
13893       }
13894 
13895       /* "View.MemoryView":685
13896  *                 seen_ellipsis = True
13897  *             else:
13898  *                 result.append(slice(None))             # <<<<<<<<<<<<<<
13899  *             have_slices = True
13900  *         else:
13901  */
13902       /*else*/ {
13903         __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__18); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 685, __pyx_L1_error)
13904       }
13905       __pyx_L7:;
13906 
13907       /* "View.MemoryView":686
13908  *             else:
13909  *                 result.append(slice(None))
13910  *             have_slices = True             # <<<<<<<<<<<<<<
13911  *         else:
13912  *             if not isinstance(item, slice) and not PyIndex_Check(item):
13913  */
13914       __pyx_v_have_slices = 1;
13915 
13916       /* "View.MemoryView":680
13917  *     seen_ellipsis = False
13918  *     for idx, item in enumerate(tup):
13919  *         if item is Ellipsis:             # <<<<<<<<<<<<<<
13920  *             if not seen_ellipsis:
13921  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
13922  */
13923       goto __pyx_L6;
13924     }
13925 
13926     /* "View.MemoryView":688
13927  *             have_slices = True
13928  *         else:
13929  *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
13930  *                 raise TypeError("Cannot index with type '%s'" % type(item))
13931  *
13932  */
13933     /*else*/ {
13934       __pyx_t_2 = PySlice_Check(__pyx_v_item);
13935       __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
13936       if (__pyx_t_10) {
13937       } else {
13938         __pyx_t_1 = __pyx_t_10;
13939         goto __pyx_L9_bool_binop_done;
13940       }
13941       __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
13942       __pyx_t_1 = __pyx_t_10;
13943       __pyx_L9_bool_binop_done:;
13944       if (unlikely(__pyx_t_1)) {
13945 
13946         /* "View.MemoryView":689
13947  *         else:
13948  *             if not isinstance(item, slice) and not PyIndex_Check(item):
13949  *                 raise TypeError("Cannot index with type '%s'" % type(item))             # <<<<<<<<<<<<<<
13950  *
13951  *             have_slices = have_slices or isinstance(item, slice)
13952  */
13953         __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 689, __pyx_L1_error)
13954         __Pyx_GOTREF(__pyx_t_7);
13955         __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 689, __pyx_L1_error)
13956         __Pyx_GOTREF(__pyx_t_11);
13957         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13958         __Pyx_Raise(__pyx_t_11, 0, 0, 0);
13959         __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
13960         __PYX_ERR(2, 689, __pyx_L1_error)
13961 
13962         /* "View.MemoryView":688
13963  *             have_slices = True
13964  *         else:
13965  *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
13966  *                 raise TypeError("Cannot index with type '%s'" % type(item))
13967  *
13968  */
13969       }
13970 
13971       /* "View.MemoryView":691
13972  *                 raise TypeError("Cannot index with type '%s'" % type(item))
13973  *
13974  *             have_slices = have_slices or isinstance(item, slice)             # <<<<<<<<<<<<<<
13975  *             result.append(item)
13976  *
13977  */
13978       __pyx_t_10 = (__pyx_v_have_slices != 0);
13979       if (!__pyx_t_10) {
13980       } else {
13981         __pyx_t_1 = __pyx_t_10;
13982         goto __pyx_L11_bool_binop_done;
13983       }
13984       __pyx_t_10 = PySlice_Check(__pyx_v_item);
13985       __pyx_t_2 = (__pyx_t_10 != 0);
13986       __pyx_t_1 = __pyx_t_2;
13987       __pyx_L11_bool_binop_done:;
13988       __pyx_v_have_slices = __pyx_t_1;
13989 
13990       /* "View.MemoryView":692
13991  *
13992  *             have_slices = have_slices or isinstance(item, slice)
13993  *             result.append(item)             # <<<<<<<<<<<<<<
13994  *
13995  *     nslices = ndim - len(result)
13996  */
13997       __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 692, __pyx_L1_error)
13998     }
13999     __pyx_L6:;
14000 
14001     /* "View.MemoryView":679
14002  *     have_slices = False
14003  *     seen_ellipsis = False
14004  *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
14005  *         if item is Ellipsis:
14006  *             if not seen_ellipsis:
14007  */
14008   }
14009   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14010   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14011 
14012   /* "View.MemoryView":694
14013  *             result.append(item)
14014  *
14015  *     nslices = ndim - len(result)             # <<<<<<<<<<<<<<
14016  *     if nslices:
14017  *         result.extend([slice(None)] * nslices)
14018  */
14019   __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 694, __pyx_L1_error)
14020   __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
14021 
14022   /* "View.MemoryView":695
14023  *
14024  *     nslices = ndim - len(result)
14025  *     if nslices:             # <<<<<<<<<<<<<<
14026  *         result.extend([slice(None)] * nslices)
14027  *
14028  */
14029   __pyx_t_1 = (__pyx_v_nslices != 0);
14030   if (__pyx_t_1) {
14031 
14032     /* "View.MemoryView":696
14033  *     nslices = ndim - len(result)
14034  *     if nslices:
14035  *         result.extend([slice(None)] * nslices)             # <<<<<<<<<<<<<<
14036  *
14037  *     return have_slices or nslices, tuple(result)
14038  */
14039     __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 696, __pyx_L1_error)
14040     __Pyx_GOTREF(__pyx_t_3);
14041     { Py_ssize_t __pyx_temp;
14042       for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
14043         __Pyx_INCREF(__pyx_slice__18);
14044         __Pyx_GIVEREF(__pyx_slice__18);
14045         PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__18);
14046       }
14047     }
14048     __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 696, __pyx_L1_error)
14049     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14050 
14051     /* "View.MemoryView":695
14052  *
14053  *     nslices = ndim - len(result)
14054  *     if nslices:             # <<<<<<<<<<<<<<
14055  *         result.extend([slice(None)] * nslices)
14056  *
14057  */
14058   }
14059 
14060   /* "View.MemoryView":698
14061  *         result.extend([slice(None)] * nslices)
14062  *
14063  *     return have_slices or nslices, tuple(result)             # <<<<<<<<<<<<<<
14064  *
14065  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
14066  */
14067   __Pyx_XDECREF(__pyx_r);
14068   if (!__pyx_v_have_slices) {
14069   } else {
14070     __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
14071     __Pyx_GOTREF(__pyx_t_4);
14072     __pyx_t_3 = __pyx_t_4;
14073     __pyx_t_4 = 0;
14074     goto __pyx_L14_bool_binop_done;
14075   }
14076   __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
14077   __Pyx_GOTREF(__pyx_t_4);
14078   __pyx_t_3 = __pyx_t_4;
14079   __pyx_t_4 = 0;
14080   __pyx_L14_bool_binop_done:;
14081   __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
14082   __Pyx_GOTREF(__pyx_t_4);
14083   __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 698, __pyx_L1_error)
14084   __Pyx_GOTREF(__pyx_t_11);
14085   __Pyx_GIVEREF(__pyx_t_3);
14086   PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
14087   __Pyx_GIVEREF(__pyx_t_4);
14088   PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
14089   __pyx_t_3 = 0;
14090   __pyx_t_4 = 0;
14091   __pyx_r = ((PyObject*)__pyx_t_11);
14092   __pyx_t_11 = 0;
14093   goto __pyx_L0;
14094 
14095   /* "View.MemoryView":666
14096  *     return isinstance(o, memoryview)
14097  *
14098  * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
14099  *     """
14100  *     Replace all ellipses with full slices and fill incomplete indices with
14101  */
14102 
14103   /* function exit code */
14104   __pyx_L1_error:;
14105   __Pyx_XDECREF(__pyx_t_3);
14106   __Pyx_XDECREF(__pyx_t_4);
14107   __Pyx_XDECREF(__pyx_t_7);
14108   __Pyx_XDECREF(__pyx_t_11);
14109   __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
14110   __pyx_r = 0;
14111   __pyx_L0:;
14112   __Pyx_XDECREF(__pyx_v_tup);
14113   __Pyx_XDECREF(__pyx_v_result);
14114   __Pyx_XDECREF(__pyx_v_idx);
14115   __Pyx_XDECREF(__pyx_v_item);
14116   __Pyx_XGIVEREF(__pyx_r);
14117   __Pyx_RefNannyFinishContext();
14118   return __pyx_r;
14119 }
14120 
14121 /* "View.MemoryView":700
14122  *     return have_slices or nslices, tuple(result)
14123  *
14124  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
14125  *     for suboffset in suboffsets[:ndim]:
14126  *         if suboffset >= 0:
14127  */
14128 
assert_direct_dimensions(Py_ssize_t * __pyx_v_suboffsets,int __pyx_v_ndim)14129 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
14130   Py_ssize_t __pyx_v_suboffset;
14131   PyObject *__pyx_r = NULL;
14132   __Pyx_RefNannyDeclarations
14133   Py_ssize_t *__pyx_t_1;
14134   Py_ssize_t *__pyx_t_2;
14135   Py_ssize_t *__pyx_t_3;
14136   int __pyx_t_4;
14137   PyObject *__pyx_t_5 = NULL;
14138   int __pyx_lineno = 0;
14139   const char *__pyx_filename = NULL;
14140   int __pyx_clineno = 0;
14141   __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);
14142 
14143   /* "View.MemoryView":701
14144  *
14145  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
14146  *     for suboffset in suboffsets[:ndim]:             # <<<<<<<<<<<<<<
14147  *         if suboffset >= 0:
14148  *             raise ValueError("Indirect dimensions not supported")
14149  */
14150   __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
14151   for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
14152     __pyx_t_1 = __pyx_t_3;
14153     __pyx_v_suboffset = (__pyx_t_1[0]);
14154 
14155     /* "View.MemoryView":702
14156  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
14157  *     for suboffset in suboffsets[:ndim]:
14158  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
14159  *             raise ValueError("Indirect dimensions not supported")
14160  *
14161  */
14162     __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
14163     if (unlikely(__pyx_t_4)) {
14164 
14165       /* "View.MemoryView":703
14166  *     for suboffset in suboffsets[:ndim]:
14167  *         if suboffset >= 0:
14168  *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
14169  *
14170  *
14171  */
14172       __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 703, __pyx_L1_error)
14173       __Pyx_GOTREF(__pyx_t_5);
14174       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
14175       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14176       __PYX_ERR(2, 703, __pyx_L1_error)
14177 
14178       /* "View.MemoryView":702
14179  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
14180  *     for suboffset in suboffsets[:ndim]:
14181  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
14182  *             raise ValueError("Indirect dimensions not supported")
14183  *
14184  */
14185     }
14186   }
14187 
14188   /* "View.MemoryView":700
14189  *     return have_slices or nslices, tuple(result)
14190  *
14191  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
14192  *     for suboffset in suboffsets[:ndim]:
14193  *         if suboffset >= 0:
14194  */
14195 
14196   /* function exit code */
14197   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14198   goto __pyx_L0;
14199   __pyx_L1_error:;
14200   __Pyx_XDECREF(__pyx_t_5);
14201   __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
14202   __pyx_r = 0;
14203   __pyx_L0:;
14204   __Pyx_XGIVEREF(__pyx_r);
14205   __Pyx_RefNannyFinishContext();
14206   return __pyx_r;
14207 }
14208 
14209 /* "View.MemoryView":710
14210  *
14211  * @cname('__pyx_memview_slice')
14212  * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
14213  *     cdef int new_ndim = 0, suboffset_dim = -1, dim
14214  *     cdef bint negative_step
14215  */
14216 
__pyx_memview_slice(struct __pyx_memoryview_obj * __pyx_v_memview,PyObject * __pyx_v_indices)14217 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
14218   int __pyx_v_new_ndim;
14219   int __pyx_v_suboffset_dim;
14220   int __pyx_v_dim;
14221   __Pyx_memviewslice __pyx_v_src;
14222   __Pyx_memviewslice __pyx_v_dst;
14223   __Pyx_memviewslice *__pyx_v_p_src;
14224   struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
14225   __Pyx_memviewslice *__pyx_v_p_dst;
14226   int *__pyx_v_p_suboffset_dim;
14227   Py_ssize_t __pyx_v_start;
14228   Py_ssize_t __pyx_v_stop;
14229   Py_ssize_t __pyx_v_step;
14230   int __pyx_v_have_start;
14231   int __pyx_v_have_stop;
14232   int __pyx_v_have_step;
14233   PyObject *__pyx_v_index = NULL;
14234   struct __pyx_memoryview_obj *__pyx_r = NULL;
14235   __Pyx_RefNannyDeclarations
14236   int __pyx_t_1;
14237   int __pyx_t_2;
14238   PyObject *__pyx_t_3 = NULL;
14239   struct __pyx_memoryview_obj *__pyx_t_4;
14240   char *__pyx_t_5;
14241   int __pyx_t_6;
14242   Py_ssize_t __pyx_t_7;
14243   PyObject *(*__pyx_t_8)(PyObject *);
14244   PyObject *__pyx_t_9 = NULL;
14245   Py_ssize_t __pyx_t_10;
14246   int __pyx_t_11;
14247   Py_ssize_t __pyx_t_12;
14248   int __pyx_lineno = 0;
14249   const char *__pyx_filename = NULL;
14250   int __pyx_clineno = 0;
14251   __Pyx_RefNannySetupContext("memview_slice", 0);
14252 
14253   /* "View.MemoryView":711
14254  * @cname('__pyx_memview_slice')
14255  * cdef memoryview memview_slice(memoryview memview, object indices):
14256  *     cdef int new_ndim = 0, suboffset_dim = -1, dim             # <<<<<<<<<<<<<<
14257  *     cdef bint negative_step
14258  *     cdef __Pyx_memviewslice src, dst
14259  */
14260   __pyx_v_new_ndim = 0;
14261   __pyx_v_suboffset_dim = -1;
14262 
14263   /* "View.MemoryView":718
14264  *
14265  *
14266  *     memset(&dst, 0, sizeof(dst))             # <<<<<<<<<<<<<<
14267  *
14268  *     cdef _memoryviewslice memviewsliceobj
14269  */
14270   (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));
14271 
14272   /* "View.MemoryView":722
14273  *     cdef _memoryviewslice memviewsliceobj
14274  *
14275  *     assert memview.view.ndim > 0             # <<<<<<<<<<<<<<
14276  *
14277  *     if isinstance(memview, _memoryviewslice):
14278  */
14279   #ifndef CYTHON_WITHOUT_ASSERTIONS
14280   if (unlikely(!Py_OptimizeFlag)) {
14281     if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
14282       PyErr_SetNone(PyExc_AssertionError);
14283       __PYX_ERR(2, 722, __pyx_L1_error)
14284     }
14285   }
14286   #endif
14287 
14288   /* "View.MemoryView":724
14289  *     assert memview.view.ndim > 0
14290  *
14291  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
14292  *         memviewsliceobj = memview
14293  *         p_src = &memviewsliceobj.from_slice
14294  */
14295   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
14296   __pyx_t_2 = (__pyx_t_1 != 0);
14297   if (__pyx_t_2) {
14298 
14299     /* "View.MemoryView":725
14300  *
14301  *     if isinstance(memview, _memoryviewslice):
14302  *         memviewsliceobj = memview             # <<<<<<<<<<<<<<
14303  *         p_src = &memviewsliceobj.from_slice
14304  *     else:
14305  */
14306     if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 725, __pyx_L1_error)
14307     __pyx_t_3 = ((PyObject *)__pyx_v_memview);
14308     __Pyx_INCREF(__pyx_t_3);
14309     __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
14310     __pyx_t_3 = 0;
14311 
14312     /* "View.MemoryView":726
14313  *     if isinstance(memview, _memoryviewslice):
14314  *         memviewsliceobj = memview
14315  *         p_src = &memviewsliceobj.from_slice             # <<<<<<<<<<<<<<
14316  *     else:
14317  *         slice_copy(memview, &src)
14318  */
14319     __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
14320 
14321     /* "View.MemoryView":724
14322  *     assert memview.view.ndim > 0
14323  *
14324  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
14325  *         memviewsliceobj = memview
14326  *         p_src = &memviewsliceobj.from_slice
14327  */
14328     goto __pyx_L3;
14329   }
14330 
14331   /* "View.MemoryView":728
14332  *         p_src = &memviewsliceobj.from_slice
14333  *     else:
14334  *         slice_copy(memview, &src)             # <<<<<<<<<<<<<<
14335  *         p_src = &src
14336  *
14337  */
14338   /*else*/ {
14339     __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
14340 
14341     /* "View.MemoryView":729
14342  *     else:
14343  *         slice_copy(memview, &src)
14344  *         p_src = &src             # <<<<<<<<<<<<<<
14345  *
14346  *
14347  */
14348     __pyx_v_p_src = (&__pyx_v_src);
14349   }
14350   __pyx_L3:;
14351 
14352   /* "View.MemoryView":735
14353  *
14354  *
14355  *     dst.memview = p_src.memview             # <<<<<<<<<<<<<<
14356  *     dst.data = p_src.data
14357  *
14358  */
14359   __pyx_t_4 = __pyx_v_p_src->memview;
14360   __pyx_v_dst.memview = __pyx_t_4;
14361 
14362   /* "View.MemoryView":736
14363  *
14364  *     dst.memview = p_src.memview
14365  *     dst.data = p_src.data             # <<<<<<<<<<<<<<
14366  *
14367  *
14368  */
14369   __pyx_t_5 = __pyx_v_p_src->data;
14370   __pyx_v_dst.data = __pyx_t_5;
14371 
14372   /* "View.MemoryView":741
14373  *
14374  *
14375  *     cdef __Pyx_memviewslice *p_dst = &dst             # <<<<<<<<<<<<<<
14376  *     cdef int *p_suboffset_dim = &suboffset_dim
14377  *     cdef Py_ssize_t start, stop, step
14378  */
14379   __pyx_v_p_dst = (&__pyx_v_dst);
14380 
14381   /* "View.MemoryView":742
14382  *
14383  *     cdef __Pyx_memviewslice *p_dst = &dst
14384  *     cdef int *p_suboffset_dim = &suboffset_dim             # <<<<<<<<<<<<<<
14385  *     cdef Py_ssize_t start, stop, step
14386  *     cdef bint have_start, have_stop, have_step
14387  */
14388   __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
14389 
14390   /* "View.MemoryView":746
14391  *     cdef bint have_start, have_stop, have_step
14392  *
14393  *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
14394  *         if PyIndex_Check(index):
14395  *             slice_memviewslice(
14396  */
14397   __pyx_t_6 = 0;
14398   if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
14399     __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
14400     __pyx_t_8 = NULL;
14401   } else {
14402     __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 746, __pyx_L1_error)
14403     __Pyx_GOTREF(__pyx_t_3);
14404     __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 746, __pyx_L1_error)
14405   }
14406   for (;;) {
14407     if (likely(!__pyx_t_8)) {
14408       if (likely(PyList_CheckExact(__pyx_t_3))) {
14409         if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
14410         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14411         __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 746, __pyx_L1_error)
14412         #else
14413         __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 746, __pyx_L1_error)
14414         __Pyx_GOTREF(__pyx_t_9);
14415         #endif
14416       } else {
14417         if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
14418         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14419         __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 746, __pyx_L1_error)
14420         #else
14421         __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 746, __pyx_L1_error)
14422         __Pyx_GOTREF(__pyx_t_9);
14423         #endif
14424       }
14425     } else {
14426       __pyx_t_9 = __pyx_t_8(__pyx_t_3);
14427       if (unlikely(!__pyx_t_9)) {
14428         PyObject* exc_type = PyErr_Occurred();
14429         if (exc_type) {
14430           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
14431           else __PYX_ERR(2, 746, __pyx_L1_error)
14432         }
14433         break;
14434       }
14435       __Pyx_GOTREF(__pyx_t_9);
14436     }
14437     __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
14438     __pyx_t_9 = 0;
14439     __pyx_v_dim = __pyx_t_6;
14440     __pyx_t_6 = (__pyx_t_6 + 1);
14441 
14442     /* "View.MemoryView":747
14443  *
14444  *     for dim, index in enumerate(indices):
14445  *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
14446  *             slice_memviewslice(
14447  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
14448  */
14449     __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
14450     if (__pyx_t_2) {
14451 
14452       /* "View.MemoryView":751
14453  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
14454  *                 dim, new_ndim, p_suboffset_dim,
14455  *                 index, 0, 0, # start, stop, step             # <<<<<<<<<<<<<<
14456  *                 0, 0, 0, # have_{start,stop,step}
14457  *                 False)
14458  */
14459       __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 751, __pyx_L1_error)
14460 
14461       /* "View.MemoryView":748
14462  *     for dim, index in enumerate(indices):
14463  *         if PyIndex_Check(index):
14464  *             slice_memviewslice(             # <<<<<<<<<<<<<<
14465  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
14466  *                 dim, new_ndim, p_suboffset_dim,
14467  */
14468       __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 748, __pyx_L1_error)
14469 
14470       /* "View.MemoryView":747
14471  *
14472  *     for dim, index in enumerate(indices):
14473  *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
14474  *             slice_memviewslice(
14475  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
14476  */
14477       goto __pyx_L6;
14478     }
14479 
14480     /* "View.MemoryView":754
14481  *                 0, 0, 0, # have_{start,stop,step}
14482  *                 False)
14483  *         elif index is None:             # <<<<<<<<<<<<<<
14484  *             p_dst.shape[new_ndim] = 1
14485  *             p_dst.strides[new_ndim] = 0
14486  */
14487     __pyx_t_2 = (__pyx_v_index == Py_None);
14488     __pyx_t_1 = (__pyx_t_2 != 0);
14489     if (__pyx_t_1) {
14490 
14491       /* "View.MemoryView":755
14492  *                 False)
14493  *         elif index is None:
14494  *             p_dst.shape[new_ndim] = 1             # <<<<<<<<<<<<<<
14495  *             p_dst.strides[new_ndim] = 0
14496  *             p_dst.suboffsets[new_ndim] = -1
14497  */
14498       (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
14499 
14500       /* "View.MemoryView":756
14501  *         elif index is None:
14502  *             p_dst.shape[new_ndim] = 1
14503  *             p_dst.strides[new_ndim] = 0             # <<<<<<<<<<<<<<
14504  *             p_dst.suboffsets[new_ndim] = -1
14505  *             new_ndim += 1
14506  */
14507       (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
14508 
14509       /* "View.MemoryView":757
14510  *             p_dst.shape[new_ndim] = 1
14511  *             p_dst.strides[new_ndim] = 0
14512  *             p_dst.suboffsets[new_ndim] = -1             # <<<<<<<<<<<<<<
14513  *             new_ndim += 1
14514  *         else:
14515  */
14516       (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
14517 
14518       /* "View.MemoryView":758
14519  *             p_dst.strides[new_ndim] = 0
14520  *             p_dst.suboffsets[new_ndim] = -1
14521  *             new_ndim += 1             # <<<<<<<<<<<<<<
14522  *         else:
14523  *             start = index.start or 0
14524  */
14525       __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
14526 
14527       /* "View.MemoryView":754
14528  *                 0, 0, 0, # have_{start,stop,step}
14529  *                 False)
14530  *         elif index is None:             # <<<<<<<<<<<<<<
14531  *             p_dst.shape[new_ndim] = 1
14532  *             p_dst.strides[new_ndim] = 0
14533  */
14534       goto __pyx_L6;
14535     }
14536 
14537     /* "View.MemoryView":760
14538  *             new_ndim += 1
14539  *         else:
14540  *             start = index.start or 0             # <<<<<<<<<<<<<<
14541  *             stop = index.stop or 0
14542  *             step = index.step or 0
14543  */
14544     /*else*/ {
14545       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 760, __pyx_L1_error)
14546       __Pyx_GOTREF(__pyx_t_9);
14547       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 760, __pyx_L1_error)
14548       if (!__pyx_t_1) {
14549         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14550       } else {
14551         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 760, __pyx_L1_error)
14552         __pyx_t_10 = __pyx_t_12;
14553         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14554         goto __pyx_L7_bool_binop_done;
14555       }
14556       __pyx_t_10 = 0;
14557       __pyx_L7_bool_binop_done:;
14558       __pyx_v_start = __pyx_t_10;
14559 
14560       /* "View.MemoryView":761
14561  *         else:
14562  *             start = index.start or 0
14563  *             stop = index.stop or 0             # <<<<<<<<<<<<<<
14564  *             step = index.step or 0
14565  *
14566  */
14567       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 761, __pyx_L1_error)
14568       __Pyx_GOTREF(__pyx_t_9);
14569       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 761, __pyx_L1_error)
14570       if (!__pyx_t_1) {
14571         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14572       } else {
14573         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 761, __pyx_L1_error)
14574         __pyx_t_10 = __pyx_t_12;
14575         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14576         goto __pyx_L9_bool_binop_done;
14577       }
14578       __pyx_t_10 = 0;
14579       __pyx_L9_bool_binop_done:;
14580       __pyx_v_stop = __pyx_t_10;
14581 
14582       /* "View.MemoryView":762
14583  *             start = index.start or 0
14584  *             stop = index.stop or 0
14585  *             step = index.step or 0             # <<<<<<<<<<<<<<
14586  *
14587  *             have_start = index.start is not None
14588  */
14589       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 762, __pyx_L1_error)
14590       __Pyx_GOTREF(__pyx_t_9);
14591       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error)
14592       if (!__pyx_t_1) {
14593         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14594       } else {
14595         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 762, __pyx_L1_error)
14596         __pyx_t_10 = __pyx_t_12;
14597         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14598         goto __pyx_L11_bool_binop_done;
14599       }
14600       __pyx_t_10 = 0;
14601       __pyx_L11_bool_binop_done:;
14602       __pyx_v_step = __pyx_t_10;
14603 
14604       /* "View.MemoryView":764
14605  *             step = index.step or 0
14606  *
14607  *             have_start = index.start is not None             # <<<<<<<<<<<<<<
14608  *             have_stop = index.stop is not None
14609  *             have_step = index.step is not None
14610  */
14611       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 764, __pyx_L1_error)
14612       __Pyx_GOTREF(__pyx_t_9);
14613       __pyx_t_1 = (__pyx_t_9 != Py_None);
14614       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14615       __pyx_v_have_start = __pyx_t_1;
14616 
14617       /* "View.MemoryView":765
14618  *
14619  *             have_start = index.start is not None
14620  *             have_stop = index.stop is not None             # <<<<<<<<<<<<<<
14621  *             have_step = index.step is not None
14622  *
14623  */
14624       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 765, __pyx_L1_error)
14625       __Pyx_GOTREF(__pyx_t_9);
14626       __pyx_t_1 = (__pyx_t_9 != Py_None);
14627       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14628       __pyx_v_have_stop = __pyx_t_1;
14629 
14630       /* "View.MemoryView":766
14631  *             have_start = index.start is not None
14632  *             have_stop = index.stop is not None
14633  *             have_step = index.step is not None             # <<<<<<<<<<<<<<
14634  *
14635  *             slice_memviewslice(
14636  */
14637       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 766, __pyx_L1_error)
14638       __Pyx_GOTREF(__pyx_t_9);
14639       __pyx_t_1 = (__pyx_t_9 != Py_None);
14640       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14641       __pyx_v_have_step = __pyx_t_1;
14642 
14643       /* "View.MemoryView":768
14644  *             have_step = index.step is not None
14645  *
14646  *             slice_memviewslice(             # <<<<<<<<<<<<<<
14647  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
14648  *                 dim, new_ndim, p_suboffset_dim,
14649  */
14650       __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 768, __pyx_L1_error)
14651 
14652       /* "View.MemoryView":774
14653  *                 have_start, have_stop, have_step,
14654  *                 True)
14655  *             new_ndim += 1             # <<<<<<<<<<<<<<
14656  *
14657  *     if isinstance(memview, _memoryviewslice):
14658  */
14659       __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
14660     }
14661     __pyx_L6:;
14662 
14663     /* "View.MemoryView":746
14664  *     cdef bint have_start, have_stop, have_step
14665  *
14666  *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
14667  *         if PyIndex_Check(index):
14668  *             slice_memviewslice(
14669  */
14670   }
14671   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14672 
14673   /* "View.MemoryView":776
14674  *             new_ndim += 1
14675  *
14676  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
14677  *         return memoryview_fromslice(dst, new_ndim,
14678  *                                     memviewsliceobj.to_object_func,
14679  */
14680   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
14681   __pyx_t_2 = (__pyx_t_1 != 0);
14682   if (__pyx_t_2) {
14683 
14684     /* "View.MemoryView":777
14685  *
14686  *     if isinstance(memview, _memoryviewslice):
14687  *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
14688  *                                     memviewsliceobj.to_object_func,
14689  *                                     memviewsliceobj.to_dtype_func,
14690  */
14691     __Pyx_XDECREF(((PyObject *)__pyx_r));
14692 
14693     /* "View.MemoryView":778
14694  *     if isinstance(memview, _memoryviewslice):
14695  *         return memoryview_fromslice(dst, new_ndim,
14696  *                                     memviewsliceobj.to_object_func,             # <<<<<<<<<<<<<<
14697  *                                     memviewsliceobj.to_dtype_func,
14698  *                                     memview.dtype_is_object)
14699  */
14700     if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 778, __pyx_L1_error) }
14701 
14702     /* "View.MemoryView":779
14703  *         return memoryview_fromslice(dst, new_ndim,
14704  *                                     memviewsliceobj.to_object_func,
14705  *                                     memviewsliceobj.to_dtype_func,             # <<<<<<<<<<<<<<
14706  *                                     memview.dtype_is_object)
14707  *     else:
14708  */
14709     if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 779, __pyx_L1_error) }
14710 
14711     /* "View.MemoryView":777
14712  *
14713  *     if isinstance(memview, _memoryviewslice):
14714  *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
14715  *                                     memviewsliceobj.to_object_func,
14716  *                                     memviewsliceobj.to_dtype_func,
14717  */
14718     __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 777, __pyx_L1_error)
14719     __Pyx_GOTREF(__pyx_t_3);
14720     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 777, __pyx_L1_error)
14721     __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
14722     __pyx_t_3 = 0;
14723     goto __pyx_L0;
14724 
14725     /* "View.MemoryView":776
14726  *             new_ndim += 1
14727  *
14728  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
14729  *         return memoryview_fromslice(dst, new_ndim,
14730  *                                     memviewsliceobj.to_object_func,
14731  */
14732   }
14733 
14734   /* "View.MemoryView":782
14735  *                                     memview.dtype_is_object)
14736  *     else:
14737  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
14738  *                                     memview.dtype_is_object)
14739  *
14740  */
14741   /*else*/ {
14742     __Pyx_XDECREF(((PyObject *)__pyx_r));
14743 
14744     /* "View.MemoryView":783
14745  *     else:
14746  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
14747  *                                     memview.dtype_is_object)             # <<<<<<<<<<<<<<
14748  *
14749  *
14750  */
14751     __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 782, __pyx_L1_error)
14752     __Pyx_GOTREF(__pyx_t_3);
14753 
14754     /* "View.MemoryView":782
14755  *                                     memview.dtype_is_object)
14756  *     else:
14757  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
14758  *                                     memview.dtype_is_object)
14759  *
14760  */
14761     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 782, __pyx_L1_error)
14762     __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
14763     __pyx_t_3 = 0;
14764     goto __pyx_L0;
14765   }
14766 
14767   /* "View.MemoryView":710
14768  *
14769  * @cname('__pyx_memview_slice')
14770  * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
14771  *     cdef int new_ndim = 0, suboffset_dim = -1, dim
14772  *     cdef bint negative_step
14773  */
14774 
14775   /* function exit code */
14776   __pyx_L1_error:;
14777   __Pyx_XDECREF(__pyx_t_3);
14778   __Pyx_XDECREF(__pyx_t_9);
14779   __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
14780   __pyx_r = 0;
14781   __pyx_L0:;
14782   __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
14783   __Pyx_XDECREF(__pyx_v_index);
14784   __Pyx_XGIVEREF((PyObject *)__pyx_r);
14785   __Pyx_RefNannyFinishContext();
14786   return __pyx_r;
14787 }
14788 
14789 /* "View.MemoryView":807
14790  *
14791  * @cname('__pyx_memoryview_slice_memviewslice')
14792  * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
14793  *         __Pyx_memviewslice *dst,
14794  *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
14795  */
14796 
__pyx_memoryview_slice_memviewslice(__Pyx_memviewslice * __pyx_v_dst,Py_ssize_t __pyx_v_shape,Py_ssize_t __pyx_v_stride,Py_ssize_t __pyx_v_suboffset,int __pyx_v_dim,int __pyx_v_new_ndim,int * __pyx_v_suboffset_dim,Py_ssize_t __pyx_v_start,Py_ssize_t __pyx_v_stop,Py_ssize_t __pyx_v_step,int __pyx_v_have_start,int __pyx_v_have_stop,int __pyx_v_have_step,int __pyx_v_is_slice)14797 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) {
14798   Py_ssize_t __pyx_v_new_shape;
14799   int __pyx_v_negative_step;
14800   int __pyx_r;
14801   int __pyx_t_1;
14802   int __pyx_t_2;
14803   int __pyx_t_3;
14804   int __pyx_lineno = 0;
14805   const char *__pyx_filename = NULL;
14806   int __pyx_clineno = 0;
14807 
14808   /* "View.MemoryView":827
14809  *     cdef bint negative_step
14810  *
14811  *     if not is_slice:             # <<<<<<<<<<<<<<
14812  *
14813  *         if start < 0:
14814  */
14815   __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
14816   if (__pyx_t_1) {
14817 
14818     /* "View.MemoryView":829
14819  *     if not is_slice:
14820  *
14821  *         if start < 0:             # <<<<<<<<<<<<<<
14822  *             start += shape
14823  *         if not 0 <= start < shape:
14824  */
14825     __pyx_t_1 = ((__pyx_v_start < 0) != 0);
14826     if (__pyx_t_1) {
14827 
14828       /* "View.MemoryView":830
14829  *
14830  *         if start < 0:
14831  *             start += shape             # <<<<<<<<<<<<<<
14832  *         if not 0 <= start < shape:
14833  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
14834  */
14835       __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
14836 
14837       /* "View.MemoryView":829
14838  *     if not is_slice:
14839  *
14840  *         if start < 0:             # <<<<<<<<<<<<<<
14841  *             start += shape
14842  *         if not 0 <= start < shape:
14843  */
14844     }
14845 
14846     /* "View.MemoryView":831
14847  *         if start < 0:
14848  *             start += shape
14849  *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
14850  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
14851  *     else:
14852  */
14853     __pyx_t_1 = (0 <= __pyx_v_start);
14854     if (__pyx_t_1) {
14855       __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
14856     }
14857     __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
14858     if (__pyx_t_2) {
14859 
14860       /* "View.MemoryView":832
14861  *             start += shape
14862  *         if not 0 <= start < shape:
14863  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)             # <<<<<<<<<<<<<<
14864  *     else:
14865  *
14866  */
14867       __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 832, __pyx_L1_error)
14868 
14869       /* "View.MemoryView":831
14870  *         if start < 0:
14871  *             start += shape
14872  *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
14873  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
14874  *     else:
14875  */
14876     }
14877 
14878     /* "View.MemoryView":827
14879  *     cdef bint negative_step
14880  *
14881  *     if not is_slice:             # <<<<<<<<<<<<<<
14882  *
14883  *         if start < 0:
14884  */
14885     goto __pyx_L3;
14886   }
14887 
14888   /* "View.MemoryView":835
14889  *     else:
14890  *
14891  *         negative_step = have_step != 0 and step < 0             # <<<<<<<<<<<<<<
14892  *
14893  *         if have_step and step == 0:
14894  */
14895   /*else*/ {
14896     __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
14897     if (__pyx_t_1) {
14898     } else {
14899       __pyx_t_2 = __pyx_t_1;
14900       goto __pyx_L6_bool_binop_done;
14901     }
14902     __pyx_t_1 = ((__pyx_v_step < 0) != 0);
14903     __pyx_t_2 = __pyx_t_1;
14904     __pyx_L6_bool_binop_done:;
14905     __pyx_v_negative_step = __pyx_t_2;
14906 
14907     /* "View.MemoryView":837
14908  *         negative_step = have_step != 0 and step < 0
14909  *
14910  *         if have_step and step == 0:             # <<<<<<<<<<<<<<
14911  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
14912  *
14913  */
14914     __pyx_t_1 = (__pyx_v_have_step != 0);
14915     if (__pyx_t_1) {
14916     } else {
14917       __pyx_t_2 = __pyx_t_1;
14918       goto __pyx_L9_bool_binop_done;
14919     }
14920     __pyx_t_1 = ((__pyx_v_step == 0) != 0);
14921     __pyx_t_2 = __pyx_t_1;
14922     __pyx_L9_bool_binop_done:;
14923     if (__pyx_t_2) {
14924 
14925       /* "View.MemoryView":838
14926  *
14927  *         if have_step and step == 0:
14928  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)             # <<<<<<<<<<<<<<
14929  *
14930  *
14931  */
14932       __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 838, __pyx_L1_error)
14933 
14934       /* "View.MemoryView":837
14935  *         negative_step = have_step != 0 and step < 0
14936  *
14937  *         if have_step and step == 0:             # <<<<<<<<<<<<<<
14938  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
14939  *
14940  */
14941     }
14942 
14943     /* "View.MemoryView":841
14944  *
14945  *
14946  *         if have_start:             # <<<<<<<<<<<<<<
14947  *             if start < 0:
14948  *                 start += shape
14949  */
14950     __pyx_t_2 = (__pyx_v_have_start != 0);
14951     if (__pyx_t_2) {
14952 
14953       /* "View.MemoryView":842
14954  *
14955  *         if have_start:
14956  *             if start < 0:             # <<<<<<<<<<<<<<
14957  *                 start += shape
14958  *                 if start < 0:
14959  */
14960       __pyx_t_2 = ((__pyx_v_start < 0) != 0);
14961       if (__pyx_t_2) {
14962 
14963         /* "View.MemoryView":843
14964  *         if have_start:
14965  *             if start < 0:
14966  *                 start += shape             # <<<<<<<<<<<<<<
14967  *                 if start < 0:
14968  *                     start = 0
14969  */
14970         __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
14971 
14972         /* "View.MemoryView":844
14973  *             if start < 0:
14974  *                 start += shape
14975  *                 if start < 0:             # <<<<<<<<<<<<<<
14976  *                     start = 0
14977  *             elif start >= shape:
14978  */
14979         __pyx_t_2 = ((__pyx_v_start < 0) != 0);
14980         if (__pyx_t_2) {
14981 
14982           /* "View.MemoryView":845
14983  *                 start += shape
14984  *                 if start < 0:
14985  *                     start = 0             # <<<<<<<<<<<<<<
14986  *             elif start >= shape:
14987  *                 if negative_step:
14988  */
14989           __pyx_v_start = 0;
14990 
14991           /* "View.MemoryView":844
14992  *             if start < 0:
14993  *                 start += shape
14994  *                 if start < 0:             # <<<<<<<<<<<<<<
14995  *                     start = 0
14996  *             elif start >= shape:
14997  */
14998         }
14999 
15000         /* "View.MemoryView":842
15001  *
15002  *         if have_start:
15003  *             if start < 0:             # <<<<<<<<<<<<<<
15004  *                 start += shape
15005  *                 if start < 0:
15006  */
15007         goto __pyx_L12;
15008       }
15009 
15010       /* "View.MemoryView":846
15011  *                 if start < 0:
15012  *                     start = 0
15013  *             elif start >= shape:             # <<<<<<<<<<<<<<
15014  *                 if negative_step:
15015  *                     start = shape - 1
15016  */
15017       __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
15018       if (__pyx_t_2) {
15019 
15020         /* "View.MemoryView":847
15021  *                     start = 0
15022  *             elif start >= shape:
15023  *                 if negative_step:             # <<<<<<<<<<<<<<
15024  *                     start = shape - 1
15025  *                 else:
15026  */
15027         __pyx_t_2 = (__pyx_v_negative_step != 0);
15028         if (__pyx_t_2) {
15029 
15030           /* "View.MemoryView":848
15031  *             elif start >= shape:
15032  *                 if negative_step:
15033  *                     start = shape - 1             # <<<<<<<<<<<<<<
15034  *                 else:
15035  *                     start = shape
15036  */
15037           __pyx_v_start = (__pyx_v_shape - 1);
15038 
15039           /* "View.MemoryView":847
15040  *                     start = 0
15041  *             elif start >= shape:
15042  *                 if negative_step:             # <<<<<<<<<<<<<<
15043  *                     start = shape - 1
15044  *                 else:
15045  */
15046           goto __pyx_L14;
15047         }
15048 
15049         /* "View.MemoryView":850
15050  *                     start = shape - 1
15051  *                 else:
15052  *                     start = shape             # <<<<<<<<<<<<<<
15053  *         else:
15054  *             if negative_step:
15055  */
15056         /*else*/ {
15057           __pyx_v_start = __pyx_v_shape;
15058         }
15059         __pyx_L14:;
15060 
15061         /* "View.MemoryView":846
15062  *                 if start < 0:
15063  *                     start = 0
15064  *             elif start >= shape:             # <<<<<<<<<<<<<<
15065  *                 if negative_step:
15066  *                     start = shape - 1
15067  */
15068       }
15069       __pyx_L12:;
15070 
15071       /* "View.MemoryView":841
15072  *
15073  *
15074  *         if have_start:             # <<<<<<<<<<<<<<
15075  *             if start < 0:
15076  *                 start += shape
15077  */
15078       goto __pyx_L11;
15079     }
15080 
15081     /* "View.MemoryView":852
15082  *                     start = shape
15083  *         else:
15084  *             if negative_step:             # <<<<<<<<<<<<<<
15085  *                 start = shape - 1
15086  *             else:
15087  */
15088     /*else*/ {
15089       __pyx_t_2 = (__pyx_v_negative_step != 0);
15090       if (__pyx_t_2) {
15091 
15092         /* "View.MemoryView":853
15093  *         else:
15094  *             if negative_step:
15095  *                 start = shape - 1             # <<<<<<<<<<<<<<
15096  *             else:
15097  *                 start = 0
15098  */
15099         __pyx_v_start = (__pyx_v_shape - 1);
15100 
15101         /* "View.MemoryView":852
15102  *                     start = shape
15103  *         else:
15104  *             if negative_step:             # <<<<<<<<<<<<<<
15105  *                 start = shape - 1
15106  *             else:
15107  */
15108         goto __pyx_L15;
15109       }
15110 
15111       /* "View.MemoryView":855
15112  *                 start = shape - 1
15113  *             else:
15114  *                 start = 0             # <<<<<<<<<<<<<<
15115  *
15116  *         if have_stop:
15117  */
15118       /*else*/ {
15119         __pyx_v_start = 0;
15120       }
15121       __pyx_L15:;
15122     }
15123     __pyx_L11:;
15124 
15125     /* "View.MemoryView":857
15126  *                 start = 0
15127  *
15128  *         if have_stop:             # <<<<<<<<<<<<<<
15129  *             if stop < 0:
15130  *                 stop += shape
15131  */
15132     __pyx_t_2 = (__pyx_v_have_stop != 0);
15133     if (__pyx_t_2) {
15134 
15135       /* "View.MemoryView":858
15136  *
15137  *         if have_stop:
15138  *             if stop < 0:             # <<<<<<<<<<<<<<
15139  *                 stop += shape
15140  *                 if stop < 0:
15141  */
15142       __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
15143       if (__pyx_t_2) {
15144 
15145         /* "View.MemoryView":859
15146  *         if have_stop:
15147  *             if stop < 0:
15148  *                 stop += shape             # <<<<<<<<<<<<<<
15149  *                 if stop < 0:
15150  *                     stop = 0
15151  */
15152         __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
15153 
15154         /* "View.MemoryView":860
15155  *             if stop < 0:
15156  *                 stop += shape
15157  *                 if stop < 0:             # <<<<<<<<<<<<<<
15158  *                     stop = 0
15159  *             elif stop > shape:
15160  */
15161         __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
15162         if (__pyx_t_2) {
15163 
15164           /* "View.MemoryView":861
15165  *                 stop += shape
15166  *                 if stop < 0:
15167  *                     stop = 0             # <<<<<<<<<<<<<<
15168  *             elif stop > shape:
15169  *                 stop = shape
15170  */
15171           __pyx_v_stop = 0;
15172 
15173           /* "View.MemoryView":860
15174  *             if stop < 0:
15175  *                 stop += shape
15176  *                 if stop < 0:             # <<<<<<<<<<<<<<
15177  *                     stop = 0
15178  *             elif stop > shape:
15179  */
15180         }
15181 
15182         /* "View.MemoryView":858
15183  *
15184  *         if have_stop:
15185  *             if stop < 0:             # <<<<<<<<<<<<<<
15186  *                 stop += shape
15187  *                 if stop < 0:
15188  */
15189         goto __pyx_L17;
15190       }
15191 
15192       /* "View.MemoryView":862
15193  *                 if stop < 0:
15194  *                     stop = 0
15195  *             elif stop > shape:             # <<<<<<<<<<<<<<
15196  *                 stop = shape
15197  *         else:
15198  */
15199       __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
15200       if (__pyx_t_2) {
15201 
15202         /* "View.MemoryView":863
15203  *                     stop = 0
15204  *             elif stop > shape:
15205  *                 stop = shape             # <<<<<<<<<<<<<<
15206  *         else:
15207  *             if negative_step:
15208  */
15209         __pyx_v_stop = __pyx_v_shape;
15210 
15211         /* "View.MemoryView":862
15212  *                 if stop < 0:
15213  *                     stop = 0
15214  *             elif stop > shape:             # <<<<<<<<<<<<<<
15215  *                 stop = shape
15216  *         else:
15217  */
15218       }
15219       __pyx_L17:;
15220 
15221       /* "View.MemoryView":857
15222  *                 start = 0
15223  *
15224  *         if have_stop:             # <<<<<<<<<<<<<<
15225  *             if stop < 0:
15226  *                 stop += shape
15227  */
15228       goto __pyx_L16;
15229     }
15230 
15231     /* "View.MemoryView":865
15232  *                 stop = shape
15233  *         else:
15234  *             if negative_step:             # <<<<<<<<<<<<<<
15235  *                 stop = -1
15236  *             else:
15237  */
15238     /*else*/ {
15239       __pyx_t_2 = (__pyx_v_negative_step != 0);
15240       if (__pyx_t_2) {
15241 
15242         /* "View.MemoryView":866
15243  *         else:
15244  *             if negative_step:
15245  *                 stop = -1             # <<<<<<<<<<<<<<
15246  *             else:
15247  *                 stop = shape
15248  */
15249         __pyx_v_stop = -1L;
15250 
15251         /* "View.MemoryView":865
15252  *                 stop = shape
15253  *         else:
15254  *             if negative_step:             # <<<<<<<<<<<<<<
15255  *                 stop = -1
15256  *             else:
15257  */
15258         goto __pyx_L19;
15259       }
15260 
15261       /* "View.MemoryView":868
15262  *                 stop = -1
15263  *             else:
15264  *                 stop = shape             # <<<<<<<<<<<<<<
15265  *
15266  *         if not have_step:
15267  */
15268       /*else*/ {
15269         __pyx_v_stop = __pyx_v_shape;
15270       }
15271       __pyx_L19:;
15272     }
15273     __pyx_L16:;
15274 
15275     /* "View.MemoryView":870
15276  *                 stop = shape
15277  *
15278  *         if not have_step:             # <<<<<<<<<<<<<<
15279  *             step = 1
15280  *
15281  */
15282     __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
15283     if (__pyx_t_2) {
15284 
15285       /* "View.MemoryView":871
15286  *
15287  *         if not have_step:
15288  *             step = 1             # <<<<<<<<<<<<<<
15289  *
15290  *
15291  */
15292       __pyx_v_step = 1;
15293 
15294       /* "View.MemoryView":870
15295  *                 stop = shape
15296  *
15297  *         if not have_step:             # <<<<<<<<<<<<<<
15298  *             step = 1
15299  *
15300  */
15301     }
15302 
15303     /* "View.MemoryView":875
15304  *
15305  *         with cython.cdivision(True):
15306  *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
15307  *
15308  *             if (stop - start) - step * new_shape:
15309  */
15310     __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
15311 
15312     /* "View.MemoryView":877
15313  *             new_shape = (stop - start) // step
15314  *
15315  *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
15316  *                 new_shape += 1
15317  *
15318  */
15319     __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
15320     if (__pyx_t_2) {
15321 
15322       /* "View.MemoryView":878
15323  *
15324  *             if (stop - start) - step * new_shape:
15325  *                 new_shape += 1             # <<<<<<<<<<<<<<
15326  *
15327  *         if new_shape < 0:
15328  */
15329       __pyx_v_new_shape = (__pyx_v_new_shape + 1);
15330 
15331       /* "View.MemoryView":877
15332  *             new_shape = (stop - start) // step
15333  *
15334  *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
15335  *                 new_shape += 1
15336  *
15337  */
15338     }
15339 
15340     /* "View.MemoryView":880
15341  *                 new_shape += 1
15342  *
15343  *         if new_shape < 0:             # <<<<<<<<<<<<<<
15344  *             new_shape = 0
15345  *
15346  */
15347     __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
15348     if (__pyx_t_2) {
15349 
15350       /* "View.MemoryView":881
15351  *
15352  *         if new_shape < 0:
15353  *             new_shape = 0             # <<<<<<<<<<<<<<
15354  *
15355  *
15356  */
15357       __pyx_v_new_shape = 0;
15358 
15359       /* "View.MemoryView":880
15360  *                 new_shape += 1
15361  *
15362  *         if new_shape < 0:             # <<<<<<<<<<<<<<
15363  *             new_shape = 0
15364  *
15365  */
15366     }
15367 
15368     /* "View.MemoryView":884
15369  *
15370  *
15371  *         dst.strides[new_ndim] = stride * step             # <<<<<<<<<<<<<<
15372  *         dst.shape[new_ndim] = new_shape
15373  *         dst.suboffsets[new_ndim] = suboffset
15374  */
15375     (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
15376 
15377     /* "View.MemoryView":885
15378  *
15379  *         dst.strides[new_ndim] = stride * step
15380  *         dst.shape[new_ndim] = new_shape             # <<<<<<<<<<<<<<
15381  *         dst.suboffsets[new_ndim] = suboffset
15382  *
15383  */
15384     (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
15385 
15386     /* "View.MemoryView":886
15387  *         dst.strides[new_ndim] = stride * step
15388  *         dst.shape[new_ndim] = new_shape
15389  *         dst.suboffsets[new_ndim] = suboffset             # <<<<<<<<<<<<<<
15390  *
15391  *
15392  */
15393     (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
15394   }
15395   __pyx_L3:;
15396 
15397   /* "View.MemoryView":889
15398  *
15399  *
15400  *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
15401  *         dst.data += start * stride
15402  *     else:
15403  */
15404   __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
15405   if (__pyx_t_2) {
15406 
15407     /* "View.MemoryView":890
15408  *
15409  *     if suboffset_dim[0] < 0:
15410  *         dst.data += start * stride             # <<<<<<<<<<<<<<
15411  *     else:
15412  *         dst.suboffsets[suboffset_dim[0]] += start * stride
15413  */
15414     __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
15415 
15416     /* "View.MemoryView":889
15417  *
15418  *
15419  *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
15420  *         dst.data += start * stride
15421  *     else:
15422  */
15423     goto __pyx_L23;
15424   }
15425 
15426   /* "View.MemoryView":892
15427  *         dst.data += start * stride
15428  *     else:
15429  *         dst.suboffsets[suboffset_dim[0]] += start * stride             # <<<<<<<<<<<<<<
15430  *
15431  *     if suboffset >= 0:
15432  */
15433   /*else*/ {
15434     __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
15435     (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
15436   }
15437   __pyx_L23:;
15438 
15439   /* "View.MemoryView":894
15440  *         dst.suboffsets[suboffset_dim[0]] += start * stride
15441  *
15442  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
15443  *         if not is_slice:
15444  *             if new_ndim == 0:
15445  */
15446   __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
15447   if (__pyx_t_2) {
15448 
15449     /* "View.MemoryView":895
15450  *
15451  *     if suboffset >= 0:
15452  *         if not is_slice:             # <<<<<<<<<<<<<<
15453  *             if new_ndim == 0:
15454  *                 dst.data = (<char **> dst.data)[0] + suboffset
15455  */
15456     __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
15457     if (__pyx_t_2) {
15458 
15459       /* "View.MemoryView":896
15460  *     if suboffset >= 0:
15461  *         if not is_slice:
15462  *             if new_ndim == 0:             # <<<<<<<<<<<<<<
15463  *                 dst.data = (<char **> dst.data)[0] + suboffset
15464  *             else:
15465  */
15466       __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
15467       if (__pyx_t_2) {
15468 
15469         /* "View.MemoryView":897
15470  *         if not is_slice:
15471  *             if new_ndim == 0:
15472  *                 dst.data = (<char **> dst.data)[0] + suboffset             # <<<<<<<<<<<<<<
15473  *             else:
15474  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
15475  */
15476         __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
15477 
15478         /* "View.MemoryView":896
15479  *     if suboffset >= 0:
15480  *         if not is_slice:
15481  *             if new_ndim == 0:             # <<<<<<<<<<<<<<
15482  *                 dst.data = (<char **> dst.data)[0] + suboffset
15483  *             else:
15484  */
15485         goto __pyx_L26;
15486       }
15487 
15488       /* "View.MemoryView":899
15489  *                 dst.data = (<char **> dst.data)[0] + suboffset
15490  *             else:
15491  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "             # <<<<<<<<<<<<<<
15492  *                                      "must be indexed and not sliced", dim)
15493  *         else:
15494  */
15495       /*else*/ {
15496 
15497         /* "View.MemoryView":900
15498  *             else:
15499  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
15500  *                                      "must be indexed and not sliced", dim)             # <<<<<<<<<<<<<<
15501  *         else:
15502  *             suboffset_dim[0] = new_ndim
15503  */
15504         __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 899, __pyx_L1_error)
15505       }
15506       __pyx_L26:;
15507 
15508       /* "View.MemoryView":895
15509  *
15510  *     if suboffset >= 0:
15511  *         if not is_slice:             # <<<<<<<<<<<<<<
15512  *             if new_ndim == 0:
15513  *                 dst.data = (<char **> dst.data)[0] + suboffset
15514  */
15515       goto __pyx_L25;
15516     }
15517 
15518     /* "View.MemoryView":902
15519  *                                      "must be indexed and not sliced", dim)
15520  *         else:
15521  *             suboffset_dim[0] = new_ndim             # <<<<<<<<<<<<<<
15522  *
15523  *     return 0
15524  */
15525     /*else*/ {
15526       (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
15527     }
15528     __pyx_L25:;
15529 
15530     /* "View.MemoryView":894
15531  *         dst.suboffsets[suboffset_dim[0]] += start * stride
15532  *
15533  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
15534  *         if not is_slice:
15535  *             if new_ndim == 0:
15536  */
15537   }
15538 
15539   /* "View.MemoryView":904
15540  *             suboffset_dim[0] = new_ndim
15541  *
15542  *     return 0             # <<<<<<<<<<<<<<
15543  *
15544  *
15545  */
15546   __pyx_r = 0;
15547   goto __pyx_L0;
15548 
15549   /* "View.MemoryView":807
15550  *
15551  * @cname('__pyx_memoryview_slice_memviewslice')
15552  * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
15553  *         __Pyx_memviewslice *dst,
15554  *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
15555  */
15556 
15557   /* function exit code */
15558   __pyx_L1_error:;
15559   {
15560     #ifdef WITH_THREAD
15561     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
15562     #endif
15563     __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
15564     #ifdef WITH_THREAD
15565     __Pyx_PyGILState_Release(__pyx_gilstate_save);
15566     #endif
15567   }
15568   __pyx_r = -1;
15569   __pyx_L0:;
15570   return __pyx_r;
15571 }
15572 
15573 /* "View.MemoryView":910
15574  *
15575  * @cname('__pyx_pybuffer_index')
15576  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
15577  *                           Py_ssize_t dim) except NULL:
15578  *     cdef Py_ssize_t shape, stride, suboffset = -1
15579  */
15580 
__pyx_pybuffer_index(Py_buffer * __pyx_v_view,char * __pyx_v_bufp,Py_ssize_t __pyx_v_index,Py_ssize_t __pyx_v_dim)15581 static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
15582   Py_ssize_t __pyx_v_shape;
15583   Py_ssize_t __pyx_v_stride;
15584   Py_ssize_t __pyx_v_suboffset;
15585   Py_ssize_t __pyx_v_itemsize;
15586   char *__pyx_v_resultp;
15587   char *__pyx_r;
15588   __Pyx_RefNannyDeclarations
15589   Py_ssize_t __pyx_t_1;
15590   int __pyx_t_2;
15591   PyObject *__pyx_t_3 = NULL;
15592   PyObject *__pyx_t_4 = NULL;
15593   int __pyx_lineno = 0;
15594   const char *__pyx_filename = NULL;
15595   int __pyx_clineno = 0;
15596   __Pyx_RefNannySetupContext("pybuffer_index", 0);
15597 
15598   /* "View.MemoryView":912
15599  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
15600  *                           Py_ssize_t dim) except NULL:
15601  *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
15602  *     cdef Py_ssize_t itemsize = view.itemsize
15603  *     cdef char *resultp
15604  */
15605   __pyx_v_suboffset = -1L;
15606 
15607   /* "View.MemoryView":913
15608  *                           Py_ssize_t dim) except NULL:
15609  *     cdef Py_ssize_t shape, stride, suboffset = -1
15610  *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
15611  *     cdef char *resultp
15612  *
15613  */
15614   __pyx_t_1 = __pyx_v_view->itemsize;
15615   __pyx_v_itemsize = __pyx_t_1;
15616 
15617   /* "View.MemoryView":916
15618  *     cdef char *resultp
15619  *
15620  *     if view.ndim == 0:             # <<<<<<<<<<<<<<
15621  *         shape = view.len / itemsize
15622  *         stride = itemsize
15623  */
15624   __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
15625   if (__pyx_t_2) {
15626 
15627     /* "View.MemoryView":917
15628  *
15629  *     if view.ndim == 0:
15630  *         shape = view.len / itemsize             # <<<<<<<<<<<<<<
15631  *         stride = itemsize
15632  *     else:
15633  */
15634     if (unlikely(__pyx_v_itemsize == 0)) {
15635       PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
15636       __PYX_ERR(2, 917, __pyx_L1_error)
15637     }
15638     else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
15639       PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
15640       __PYX_ERR(2, 917, __pyx_L1_error)
15641     }
15642     __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
15643 
15644     /* "View.MemoryView":918
15645  *     if view.ndim == 0:
15646  *         shape = view.len / itemsize
15647  *         stride = itemsize             # <<<<<<<<<<<<<<
15648  *     else:
15649  *         shape = view.shape[dim]
15650  */
15651     __pyx_v_stride = __pyx_v_itemsize;
15652 
15653     /* "View.MemoryView":916
15654  *     cdef char *resultp
15655  *
15656  *     if view.ndim == 0:             # <<<<<<<<<<<<<<
15657  *         shape = view.len / itemsize
15658  *         stride = itemsize
15659  */
15660     goto __pyx_L3;
15661   }
15662 
15663   /* "View.MemoryView":920
15664  *         stride = itemsize
15665  *     else:
15666  *         shape = view.shape[dim]             # <<<<<<<<<<<<<<
15667  *         stride = view.strides[dim]
15668  *         if view.suboffsets != NULL:
15669  */
15670   /*else*/ {
15671     __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
15672 
15673     /* "View.MemoryView":921
15674  *     else:
15675  *         shape = view.shape[dim]
15676  *         stride = view.strides[dim]             # <<<<<<<<<<<<<<
15677  *         if view.suboffsets != NULL:
15678  *             suboffset = view.suboffsets[dim]
15679  */
15680     __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
15681 
15682     /* "View.MemoryView":922
15683  *         shape = view.shape[dim]
15684  *         stride = view.strides[dim]
15685  *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
15686  *             suboffset = view.suboffsets[dim]
15687  *
15688  */
15689     __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
15690     if (__pyx_t_2) {
15691 
15692       /* "View.MemoryView":923
15693  *         stride = view.strides[dim]
15694  *         if view.suboffsets != NULL:
15695  *             suboffset = view.suboffsets[dim]             # <<<<<<<<<<<<<<
15696  *
15697  *     if index < 0:
15698  */
15699       __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
15700 
15701       /* "View.MemoryView":922
15702  *         shape = view.shape[dim]
15703  *         stride = view.strides[dim]
15704  *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
15705  *             suboffset = view.suboffsets[dim]
15706  *
15707  */
15708     }
15709   }
15710   __pyx_L3:;
15711 
15712   /* "View.MemoryView":925
15713  *             suboffset = view.suboffsets[dim]
15714  *
15715  *     if index < 0:             # <<<<<<<<<<<<<<
15716  *         index += view.shape[dim]
15717  *         if index < 0:
15718  */
15719   __pyx_t_2 = ((__pyx_v_index < 0) != 0);
15720   if (__pyx_t_2) {
15721 
15722     /* "View.MemoryView":926
15723  *
15724  *     if index < 0:
15725  *         index += view.shape[dim]             # <<<<<<<<<<<<<<
15726  *         if index < 0:
15727  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15728  */
15729     __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
15730 
15731     /* "View.MemoryView":927
15732  *     if index < 0:
15733  *         index += view.shape[dim]
15734  *         if index < 0:             # <<<<<<<<<<<<<<
15735  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15736  *
15737  */
15738     __pyx_t_2 = ((__pyx_v_index < 0) != 0);
15739     if (unlikely(__pyx_t_2)) {
15740 
15741       /* "View.MemoryView":928
15742  *         index += view.shape[dim]
15743  *         if index < 0:
15744  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
15745  *
15746  *     if index >= shape:
15747  */
15748       __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error)
15749       __Pyx_GOTREF(__pyx_t_3);
15750       __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 928, __pyx_L1_error)
15751       __Pyx_GOTREF(__pyx_t_4);
15752       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15753       __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error)
15754       __Pyx_GOTREF(__pyx_t_3);
15755       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15756       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15757       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15758       __PYX_ERR(2, 928, __pyx_L1_error)
15759 
15760       /* "View.MemoryView":927
15761  *     if index < 0:
15762  *         index += view.shape[dim]
15763  *         if index < 0:             # <<<<<<<<<<<<<<
15764  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15765  *
15766  */
15767     }
15768 
15769     /* "View.MemoryView":925
15770  *             suboffset = view.suboffsets[dim]
15771  *
15772  *     if index < 0:             # <<<<<<<<<<<<<<
15773  *         index += view.shape[dim]
15774  *         if index < 0:
15775  */
15776   }
15777 
15778   /* "View.MemoryView":930
15779  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15780  *
15781  *     if index >= shape:             # <<<<<<<<<<<<<<
15782  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15783  *
15784  */
15785   __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
15786   if (unlikely(__pyx_t_2)) {
15787 
15788     /* "View.MemoryView":931
15789  *
15790  *     if index >= shape:
15791  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
15792  *
15793  *     resultp = bufp + index * stride
15794  */
15795     __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error)
15796     __Pyx_GOTREF(__pyx_t_3);
15797     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 931, __pyx_L1_error)
15798     __Pyx_GOTREF(__pyx_t_4);
15799     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15800     __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error)
15801     __Pyx_GOTREF(__pyx_t_3);
15802     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15803     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15804     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15805     __PYX_ERR(2, 931, __pyx_L1_error)
15806 
15807     /* "View.MemoryView":930
15808  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15809  *
15810  *     if index >= shape:             # <<<<<<<<<<<<<<
15811  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15812  *
15813  */
15814   }
15815 
15816   /* "View.MemoryView":933
15817  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
15818  *
15819  *     resultp = bufp + index * stride             # <<<<<<<<<<<<<<
15820  *     if suboffset >= 0:
15821  *         resultp = (<char **> resultp)[0] + suboffset
15822  */
15823   __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
15824 
15825   /* "View.MemoryView":934
15826  *
15827  *     resultp = bufp + index * stride
15828  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
15829  *         resultp = (<char **> resultp)[0] + suboffset
15830  *
15831  */
15832   __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
15833   if (__pyx_t_2) {
15834 
15835     /* "View.MemoryView":935
15836  *     resultp = bufp + index * stride
15837  *     if suboffset >= 0:
15838  *         resultp = (<char **> resultp)[0] + suboffset             # <<<<<<<<<<<<<<
15839  *
15840  *     return resultp
15841  */
15842     __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
15843 
15844     /* "View.MemoryView":934
15845  *
15846  *     resultp = bufp + index * stride
15847  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
15848  *         resultp = (<char **> resultp)[0] + suboffset
15849  *
15850  */
15851   }
15852 
15853   /* "View.MemoryView":937
15854  *         resultp = (<char **> resultp)[0] + suboffset
15855  *
15856  *     return resultp             # <<<<<<<<<<<<<<
15857  *
15858  *
15859  */
15860   __pyx_r = __pyx_v_resultp;
15861   goto __pyx_L0;
15862 
15863   /* "View.MemoryView":910
15864  *
15865  * @cname('__pyx_pybuffer_index')
15866  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
15867  *                           Py_ssize_t dim) except NULL:
15868  *     cdef Py_ssize_t shape, stride, suboffset = -1
15869  */
15870 
15871   /* function exit code */
15872   __pyx_L1_error:;
15873   __Pyx_XDECREF(__pyx_t_3);
15874   __Pyx_XDECREF(__pyx_t_4);
15875   __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
15876   __pyx_r = NULL;
15877   __pyx_L0:;
15878   __Pyx_RefNannyFinishContext();
15879   return __pyx_r;
15880 }
15881 
15882 /* "View.MemoryView":943
15883  *
15884  * @cname('__pyx_memslice_transpose')
15885  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
15886  *     cdef int ndim = memslice.memview.view.ndim
15887  *
15888  */
15889 
__pyx_memslice_transpose(__Pyx_memviewslice * __pyx_v_memslice)15890 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
15891   int __pyx_v_ndim;
15892   Py_ssize_t *__pyx_v_shape;
15893   Py_ssize_t *__pyx_v_strides;
15894   int __pyx_v_i;
15895   int __pyx_v_j;
15896   int __pyx_r;
15897   int __pyx_t_1;
15898   Py_ssize_t *__pyx_t_2;
15899   long __pyx_t_3;
15900   long __pyx_t_4;
15901   Py_ssize_t __pyx_t_5;
15902   Py_ssize_t __pyx_t_6;
15903   int __pyx_t_7;
15904   int __pyx_t_8;
15905   int __pyx_t_9;
15906   int __pyx_lineno = 0;
15907   const char *__pyx_filename = NULL;
15908   int __pyx_clineno = 0;
15909 
15910   /* "View.MemoryView":944
15911  * @cname('__pyx_memslice_transpose')
15912  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
15913  *     cdef int ndim = memslice.memview.view.ndim             # <<<<<<<<<<<<<<
15914  *
15915  *     cdef Py_ssize_t *shape = memslice.shape
15916  */
15917   __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
15918   __pyx_v_ndim = __pyx_t_1;
15919 
15920   /* "View.MemoryView":946
15921  *     cdef int ndim = memslice.memview.view.ndim
15922  *
15923  *     cdef Py_ssize_t *shape = memslice.shape             # <<<<<<<<<<<<<<
15924  *     cdef Py_ssize_t *strides = memslice.strides
15925  *
15926  */
15927   __pyx_t_2 = __pyx_v_memslice->shape;
15928   __pyx_v_shape = __pyx_t_2;
15929 
15930   /* "View.MemoryView":947
15931  *
15932  *     cdef Py_ssize_t *shape = memslice.shape
15933  *     cdef Py_ssize_t *strides = memslice.strides             # <<<<<<<<<<<<<<
15934  *
15935  *
15936  */
15937   __pyx_t_2 = __pyx_v_memslice->strides;
15938   __pyx_v_strides = __pyx_t_2;
15939 
15940   /* "View.MemoryView":951
15941  *
15942  *     cdef int i, j
15943  *     for i in range(ndim / 2):             # <<<<<<<<<<<<<<
15944  *         j = ndim - 1 - i
15945  *         strides[i], strides[j] = strides[j], strides[i]
15946  */
15947   __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
15948   __pyx_t_4 = __pyx_t_3;
15949   for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
15950     __pyx_v_i = __pyx_t_1;
15951 
15952     /* "View.MemoryView":952
15953  *     cdef int i, j
15954  *     for i in range(ndim / 2):
15955  *         j = ndim - 1 - i             # <<<<<<<<<<<<<<
15956  *         strides[i], strides[j] = strides[j], strides[i]
15957  *         shape[i], shape[j] = shape[j], shape[i]
15958  */
15959     __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
15960 
15961     /* "View.MemoryView":953
15962  *     for i in range(ndim / 2):
15963  *         j = ndim - 1 - i
15964  *         strides[i], strides[j] = strides[j], strides[i]             # <<<<<<<<<<<<<<
15965  *         shape[i], shape[j] = shape[j], shape[i]
15966  *
15967  */
15968     __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
15969     __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
15970     (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
15971     (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
15972 
15973     /* "View.MemoryView":954
15974  *         j = ndim - 1 - i
15975  *         strides[i], strides[j] = strides[j], strides[i]
15976  *         shape[i], shape[j] = shape[j], shape[i]             # <<<<<<<<<<<<<<
15977  *
15978  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
15979  */
15980     __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
15981     __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
15982     (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
15983     (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
15984 
15985     /* "View.MemoryView":956
15986  *         shape[i], shape[j] = shape[j], shape[i]
15987  *
15988  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
15989  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
15990  *
15991  */
15992     __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
15993     if (!__pyx_t_8) {
15994     } else {
15995       __pyx_t_7 = __pyx_t_8;
15996       goto __pyx_L6_bool_binop_done;
15997     }
15998     __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
15999     __pyx_t_7 = __pyx_t_8;
16000     __pyx_L6_bool_binop_done:;
16001     if (__pyx_t_7) {
16002 
16003       /* "View.MemoryView":957
16004  *
16005  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
16006  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")             # <<<<<<<<<<<<<<
16007  *
16008  *     return 1
16009  */
16010       __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 957, __pyx_L1_error)
16011 
16012       /* "View.MemoryView":956
16013  *         shape[i], shape[j] = shape[j], shape[i]
16014  *
16015  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
16016  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
16017  *
16018  */
16019     }
16020   }
16021 
16022   /* "View.MemoryView":959
16023  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
16024  *
16025  *     return 1             # <<<<<<<<<<<<<<
16026  *
16027  *
16028  */
16029   __pyx_r = 1;
16030   goto __pyx_L0;
16031 
16032   /* "View.MemoryView":943
16033  *
16034  * @cname('__pyx_memslice_transpose')
16035  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
16036  *     cdef int ndim = memslice.memview.view.ndim
16037  *
16038  */
16039 
16040   /* function exit code */
16041   __pyx_L1_error:;
16042   {
16043     #ifdef WITH_THREAD
16044     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16045     #endif
16046     __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
16047     #ifdef WITH_THREAD
16048     __Pyx_PyGILState_Release(__pyx_gilstate_save);
16049     #endif
16050   }
16051   __pyx_r = 0;
16052   __pyx_L0:;
16053   return __pyx_r;
16054 }
16055 
16056 /* "View.MemoryView":976
16057  *     cdef int (*to_dtype_func)(char *, object) except 0
16058  *
16059  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
16060  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
16061  *
16062  */
16063 
16064 /* Python wrapper */
16065 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryviewslice___dealloc__(PyObject * __pyx_v_self)16066 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
16067   __Pyx_RefNannyDeclarations
16068   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
16069   __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
16070 
16071   /* function exit code */
16072   __Pyx_RefNannyFinishContext();
16073 }
16074 
__pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj * __pyx_v_self)16075 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
16076   __Pyx_RefNannyDeclarations
16077   __Pyx_RefNannySetupContext("__dealloc__", 0);
16078 
16079   /* "View.MemoryView":977
16080  *
16081  *     def __dealloc__(self):
16082  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)             # <<<<<<<<<<<<<<
16083  *
16084  *     cdef convert_item_to_object(self, char *itemp):
16085  */
16086   __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
16087 
16088   /* "View.MemoryView":976
16089  *     cdef int (*to_dtype_func)(char *, object) except 0
16090  *
16091  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
16092  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
16093  *
16094  */
16095 
16096   /* function exit code */
16097   __Pyx_RefNannyFinishContext();
16098 }
16099 
16100 /* "View.MemoryView":979
16101  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
16102  *
16103  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
16104  *         if self.to_object_func != NULL:
16105  *             return self.to_object_func(itemp)
16106  */
16107 
__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj * __pyx_v_self,char * __pyx_v_itemp)16108 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
16109   PyObject *__pyx_r = NULL;
16110   __Pyx_RefNannyDeclarations
16111   int __pyx_t_1;
16112   PyObject *__pyx_t_2 = NULL;
16113   int __pyx_lineno = 0;
16114   const char *__pyx_filename = NULL;
16115   int __pyx_clineno = 0;
16116   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
16117 
16118   /* "View.MemoryView":980
16119  *
16120  *     cdef convert_item_to_object(self, char *itemp):
16121  *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
16122  *             return self.to_object_func(itemp)
16123  *         else:
16124  */
16125   __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
16126   if (__pyx_t_1) {
16127 
16128     /* "View.MemoryView":981
16129  *     cdef convert_item_to_object(self, char *itemp):
16130  *         if self.to_object_func != NULL:
16131  *             return self.to_object_func(itemp)             # <<<<<<<<<<<<<<
16132  *         else:
16133  *             return memoryview.convert_item_to_object(self, itemp)
16134  */
16135     __Pyx_XDECREF(__pyx_r);
16136     __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 981, __pyx_L1_error)
16137     __Pyx_GOTREF(__pyx_t_2);
16138     __pyx_r = __pyx_t_2;
16139     __pyx_t_2 = 0;
16140     goto __pyx_L0;
16141 
16142     /* "View.MemoryView":980
16143  *
16144  *     cdef convert_item_to_object(self, char *itemp):
16145  *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
16146  *             return self.to_object_func(itemp)
16147  *         else:
16148  */
16149   }
16150 
16151   /* "View.MemoryView":983
16152  *             return self.to_object_func(itemp)
16153  *         else:
16154  *             return memoryview.convert_item_to_object(self, itemp)             # <<<<<<<<<<<<<<
16155  *
16156  *     cdef assign_item_from_object(self, char *itemp, object value):
16157  */
16158   /*else*/ {
16159     __Pyx_XDECREF(__pyx_r);
16160     __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 983, __pyx_L1_error)
16161     __Pyx_GOTREF(__pyx_t_2);
16162     __pyx_r = __pyx_t_2;
16163     __pyx_t_2 = 0;
16164     goto __pyx_L0;
16165   }
16166 
16167   /* "View.MemoryView":979
16168  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
16169  *
16170  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
16171  *         if self.to_object_func != NULL:
16172  *             return self.to_object_func(itemp)
16173  */
16174 
16175   /* function exit code */
16176   __pyx_L1_error:;
16177   __Pyx_XDECREF(__pyx_t_2);
16178   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
16179   __pyx_r = 0;
16180   __pyx_L0:;
16181   __Pyx_XGIVEREF(__pyx_r);
16182   __Pyx_RefNannyFinishContext();
16183   return __pyx_r;
16184 }
16185 
16186 /* "View.MemoryView":985
16187  *             return memoryview.convert_item_to_object(self, itemp)
16188  *
16189  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
16190  *         if self.to_dtype_func != NULL:
16191  *             self.to_dtype_func(itemp, value)
16192  */
16193 
__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj * __pyx_v_self,char * __pyx_v_itemp,PyObject * __pyx_v_value)16194 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
16195   PyObject *__pyx_r = NULL;
16196   __Pyx_RefNannyDeclarations
16197   int __pyx_t_1;
16198   int __pyx_t_2;
16199   PyObject *__pyx_t_3 = NULL;
16200   int __pyx_lineno = 0;
16201   const char *__pyx_filename = NULL;
16202   int __pyx_clineno = 0;
16203   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
16204 
16205   /* "View.MemoryView":986
16206  *
16207  *     cdef assign_item_from_object(self, char *itemp, object value):
16208  *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
16209  *             self.to_dtype_func(itemp, value)
16210  *         else:
16211  */
16212   __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
16213   if (__pyx_t_1) {
16214 
16215     /* "View.MemoryView":987
16216  *     cdef assign_item_from_object(self, char *itemp, object value):
16217  *         if self.to_dtype_func != NULL:
16218  *             self.to_dtype_func(itemp, value)             # <<<<<<<<<<<<<<
16219  *         else:
16220  *             memoryview.assign_item_from_object(self, itemp, value)
16221  */
16222     __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 987, __pyx_L1_error)
16223 
16224     /* "View.MemoryView":986
16225  *
16226  *     cdef assign_item_from_object(self, char *itemp, object value):
16227  *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
16228  *             self.to_dtype_func(itemp, value)
16229  *         else:
16230  */
16231     goto __pyx_L3;
16232   }
16233 
16234   /* "View.MemoryView":989
16235  *             self.to_dtype_func(itemp, value)
16236  *         else:
16237  *             memoryview.assign_item_from_object(self, itemp, value)             # <<<<<<<<<<<<<<
16238  *
16239  *     @property
16240  */
16241   /*else*/ {
16242     __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 989, __pyx_L1_error)
16243     __Pyx_GOTREF(__pyx_t_3);
16244     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16245   }
16246   __pyx_L3:;
16247 
16248   /* "View.MemoryView":985
16249  *             return memoryview.convert_item_to_object(self, itemp)
16250  *
16251  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
16252  *         if self.to_dtype_func != NULL:
16253  *             self.to_dtype_func(itemp, value)
16254  */
16255 
16256   /* function exit code */
16257   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16258   goto __pyx_L0;
16259   __pyx_L1_error:;
16260   __Pyx_XDECREF(__pyx_t_3);
16261   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
16262   __pyx_r = 0;
16263   __pyx_L0:;
16264   __Pyx_XGIVEREF(__pyx_r);
16265   __Pyx_RefNannyFinishContext();
16266   return __pyx_r;
16267 }
16268 
16269 /* "View.MemoryView":992
16270  *
16271  *     @property
16272  *     def base(self):             # <<<<<<<<<<<<<<
16273  *         return self.from_object
16274  *
16275  */
16276 
16277 /* Python wrapper */
16278 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject * __pyx_v_self)16279 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
16280   PyObject *__pyx_r = 0;
16281   __Pyx_RefNannyDeclarations
16282   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
16283   __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
16284 
16285   /* function exit code */
16286   __Pyx_RefNannyFinishContext();
16287   return __pyx_r;
16288 }
16289 
__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj * __pyx_v_self)16290 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
16291   PyObject *__pyx_r = NULL;
16292   __Pyx_RefNannyDeclarations
16293   __Pyx_RefNannySetupContext("__get__", 0);
16294 
16295   /* "View.MemoryView":993
16296  *     @property
16297  *     def base(self):
16298  *         return self.from_object             # <<<<<<<<<<<<<<
16299  *
16300  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
16301  */
16302   __Pyx_XDECREF(__pyx_r);
16303   __Pyx_INCREF(__pyx_v_self->from_object);
16304   __pyx_r = __pyx_v_self->from_object;
16305   goto __pyx_L0;
16306 
16307   /* "View.MemoryView":992
16308  *
16309  *     @property
16310  *     def base(self):             # <<<<<<<<<<<<<<
16311  *         return self.from_object
16312  *
16313  */
16314 
16315   /* function exit code */
16316   __pyx_L0:;
16317   __Pyx_XGIVEREF(__pyx_r);
16318   __Pyx_RefNannyFinishContext();
16319   return __pyx_r;
16320 }
16321 
16322 /* "(tree fragment)":1
16323  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
16324  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16325  * def __setstate_cython__(self, __pyx_state):
16326  */
16327 
16328 /* Python wrapper */
16329 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)16330 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
16331   PyObject *__pyx_r = 0;
16332   __Pyx_RefNannyDeclarations
16333   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
16334   __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
16335 
16336   /* function exit code */
16337   __Pyx_RefNannyFinishContext();
16338   return __pyx_r;
16339 }
16340 
__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj * __pyx_v_self)16341 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
16342   PyObject *__pyx_r = NULL;
16343   __Pyx_RefNannyDeclarations
16344   PyObject *__pyx_t_1 = NULL;
16345   int __pyx_lineno = 0;
16346   const char *__pyx_filename = NULL;
16347   int __pyx_clineno = 0;
16348   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
16349 
16350   /* "(tree fragment)":2
16351  * def __reduce_cython__(self):
16352  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
16353  * def __setstate_cython__(self, __pyx_state):
16354  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16355  */
16356   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
16357   __Pyx_GOTREF(__pyx_t_1);
16358   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16359   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16360   __PYX_ERR(2, 2, __pyx_L1_error)
16361 
16362   /* "(tree fragment)":1
16363  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
16364  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16365  * def __setstate_cython__(self, __pyx_state):
16366  */
16367 
16368   /* function exit code */
16369   __pyx_L1_error:;
16370   __Pyx_XDECREF(__pyx_t_1);
16371   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16372   __pyx_r = NULL;
16373   __Pyx_XGIVEREF(__pyx_r);
16374   __Pyx_RefNannyFinishContext();
16375   return __pyx_r;
16376 }
16377 
16378 /* "(tree fragment)":3
16379  * def __reduce_cython__(self):
16380  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16381  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
16382  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16383  */
16384 
16385 /* Python wrapper */
16386 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)16387 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
16388   PyObject *__pyx_r = 0;
16389   __Pyx_RefNannyDeclarations
16390   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
16391   __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
16392 
16393   /* function exit code */
16394   __Pyx_RefNannyFinishContext();
16395   return __pyx_r;
16396 }
16397 
__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)16398 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
16399   PyObject *__pyx_r = NULL;
16400   __Pyx_RefNannyDeclarations
16401   PyObject *__pyx_t_1 = NULL;
16402   int __pyx_lineno = 0;
16403   const char *__pyx_filename = NULL;
16404   int __pyx_clineno = 0;
16405   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
16406 
16407   /* "(tree fragment)":4
16408  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16409  * def __setstate_cython__(self, __pyx_state):
16410  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
16411  */
16412   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
16413   __Pyx_GOTREF(__pyx_t_1);
16414   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16415   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16416   __PYX_ERR(2, 4, __pyx_L1_error)
16417 
16418   /* "(tree fragment)":3
16419  * def __reduce_cython__(self):
16420  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16421  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
16422  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16423  */
16424 
16425   /* function exit code */
16426   __pyx_L1_error:;
16427   __Pyx_XDECREF(__pyx_t_1);
16428   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16429   __pyx_r = NULL;
16430   __Pyx_XGIVEREF(__pyx_r);
16431   __Pyx_RefNannyFinishContext();
16432   return __pyx_r;
16433 }
16434 
16435 /* "View.MemoryView":999
16436  *
16437  * @cname('__pyx_memoryview_fromslice')
16438  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
16439  *                           int ndim,
16440  *                           object (*to_object_func)(char *),
16441  */
16442 
__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice,int __pyx_v_ndim,PyObject * (* __pyx_v_to_object_func)(char *),int (* __pyx_v_to_dtype_func)(char *,PyObject *),int __pyx_v_dtype_is_object)16443 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) {
16444   struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
16445   Py_ssize_t __pyx_v_suboffset;
16446   PyObject *__pyx_v_length = NULL;
16447   PyObject *__pyx_r = NULL;
16448   __Pyx_RefNannyDeclarations
16449   int __pyx_t_1;
16450   PyObject *__pyx_t_2 = NULL;
16451   PyObject *__pyx_t_3 = NULL;
16452   __Pyx_TypeInfo *__pyx_t_4;
16453   Py_buffer __pyx_t_5;
16454   Py_ssize_t *__pyx_t_6;
16455   Py_ssize_t *__pyx_t_7;
16456   Py_ssize_t *__pyx_t_8;
16457   Py_ssize_t __pyx_t_9;
16458   int __pyx_lineno = 0;
16459   const char *__pyx_filename = NULL;
16460   int __pyx_clineno = 0;
16461   __Pyx_RefNannySetupContext("memoryview_fromslice", 0);
16462 
16463   /* "View.MemoryView":1007
16464  *     cdef _memoryviewslice result
16465  *
16466  *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
16467  *         return None
16468  *
16469  */
16470   __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
16471   if (__pyx_t_1) {
16472 
16473     /* "View.MemoryView":1008
16474  *
16475  *     if <PyObject *> memviewslice.memview == Py_None:
16476  *         return None             # <<<<<<<<<<<<<<
16477  *
16478  *
16479  */
16480     __Pyx_XDECREF(__pyx_r);
16481     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16482     goto __pyx_L0;
16483 
16484     /* "View.MemoryView":1007
16485  *     cdef _memoryviewslice result
16486  *
16487  *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
16488  *         return None
16489  *
16490  */
16491   }
16492 
16493   /* "View.MemoryView":1013
16494  *
16495  *
16496  *     result = _memoryviewslice(None, 0, dtype_is_object)             # <<<<<<<<<<<<<<
16497  *
16498  *     result.from_slice = memviewslice
16499  */
16500   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error)
16501   __Pyx_GOTREF(__pyx_t_2);
16502   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1013, __pyx_L1_error)
16503   __Pyx_GOTREF(__pyx_t_3);
16504   __Pyx_INCREF(Py_None);
16505   __Pyx_GIVEREF(Py_None);
16506   PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
16507   __Pyx_INCREF(__pyx_int_0);
16508   __Pyx_GIVEREF(__pyx_int_0);
16509   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
16510   __Pyx_GIVEREF(__pyx_t_2);
16511   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
16512   __pyx_t_2 = 0;
16513   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error)
16514   __Pyx_GOTREF(__pyx_t_2);
16515   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16516   __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
16517   __pyx_t_2 = 0;
16518 
16519   /* "View.MemoryView":1015
16520  *     result = _memoryviewslice(None, 0, dtype_is_object)
16521  *
16522  *     result.from_slice = memviewslice             # <<<<<<<<<<<<<<
16523  *     __PYX_INC_MEMVIEW(&memviewslice, 1)
16524  *
16525  */
16526   __pyx_v_result->from_slice = __pyx_v_memviewslice;
16527 
16528   /* "View.MemoryView":1016
16529  *
16530  *     result.from_slice = memviewslice
16531  *     __PYX_INC_MEMVIEW(&memviewslice, 1)             # <<<<<<<<<<<<<<
16532  *
16533  *     result.from_object = (<memoryview> memviewslice.memview).base
16534  */
16535   __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
16536 
16537   /* "View.MemoryView":1018
16538  *     __PYX_INC_MEMVIEW(&memviewslice, 1)
16539  *
16540  *     result.from_object = (<memoryview> memviewslice.memview).base             # <<<<<<<<<<<<<<
16541  *     result.typeinfo = memviewslice.memview.typeinfo
16542  *
16543  */
16544   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1018, __pyx_L1_error)
16545   __Pyx_GOTREF(__pyx_t_2);
16546   __Pyx_GIVEREF(__pyx_t_2);
16547   __Pyx_GOTREF(__pyx_v_result->from_object);
16548   __Pyx_DECREF(__pyx_v_result->from_object);
16549   __pyx_v_result->from_object = __pyx_t_2;
16550   __pyx_t_2 = 0;
16551 
16552   /* "View.MemoryView":1019
16553  *
16554  *     result.from_object = (<memoryview> memviewslice.memview).base
16555  *     result.typeinfo = memviewslice.memview.typeinfo             # <<<<<<<<<<<<<<
16556  *
16557  *     result.view = memviewslice.memview.view
16558  */
16559   __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
16560   __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
16561 
16562   /* "View.MemoryView":1021
16563  *     result.typeinfo = memviewslice.memview.typeinfo
16564  *
16565  *     result.view = memviewslice.memview.view             # <<<<<<<<<<<<<<
16566  *     result.view.buf = <void *> memviewslice.data
16567  *     result.view.ndim = ndim
16568  */
16569   __pyx_t_5 = __pyx_v_memviewslice.memview->view;
16570   __pyx_v_result->__pyx_base.view = __pyx_t_5;
16571 
16572   /* "View.MemoryView":1022
16573  *
16574  *     result.view = memviewslice.memview.view
16575  *     result.view.buf = <void *> memviewslice.data             # <<<<<<<<<<<<<<
16576  *     result.view.ndim = ndim
16577  *     (<__pyx_buffer *> &result.view).obj = Py_None
16578  */
16579   __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
16580 
16581   /* "View.MemoryView":1023
16582  *     result.view = memviewslice.memview.view
16583  *     result.view.buf = <void *> memviewslice.data
16584  *     result.view.ndim = ndim             # <<<<<<<<<<<<<<
16585  *     (<__pyx_buffer *> &result.view).obj = Py_None
16586  *     Py_INCREF(Py_None)
16587  */
16588   __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
16589 
16590   /* "View.MemoryView":1024
16591  *     result.view.buf = <void *> memviewslice.data
16592  *     result.view.ndim = ndim
16593  *     (<__pyx_buffer *> &result.view).obj = Py_None             # <<<<<<<<<<<<<<
16594  *     Py_INCREF(Py_None)
16595  *
16596  */
16597   ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
16598 
16599   /* "View.MemoryView":1025
16600  *     result.view.ndim = ndim
16601  *     (<__pyx_buffer *> &result.view).obj = Py_None
16602  *     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
16603  *
16604  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
16605  */
16606   Py_INCREF(Py_None);
16607 
16608   /* "View.MemoryView":1027
16609  *     Py_INCREF(Py_None)
16610  *
16611  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
16612  *         result.flags = PyBUF_RECORDS
16613  *     else:
16614  */
16615   __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
16616   if (__pyx_t_1) {
16617 
16618     /* "View.MemoryView":1028
16619  *
16620  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
16621  *         result.flags = PyBUF_RECORDS             # <<<<<<<<<<<<<<
16622  *     else:
16623  *         result.flags = PyBUF_RECORDS_RO
16624  */
16625     __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
16626 
16627     /* "View.MemoryView":1027
16628  *     Py_INCREF(Py_None)
16629  *
16630  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
16631  *         result.flags = PyBUF_RECORDS
16632  *     else:
16633  */
16634     goto __pyx_L4;
16635   }
16636 
16637   /* "View.MemoryView":1030
16638  *         result.flags = PyBUF_RECORDS
16639  *     else:
16640  *         result.flags = PyBUF_RECORDS_RO             # <<<<<<<<<<<<<<
16641  *
16642  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
16643  */
16644   /*else*/ {
16645     __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
16646   }
16647   __pyx_L4:;
16648 
16649   /* "View.MemoryView":1032
16650  *         result.flags = PyBUF_RECORDS_RO
16651  *
16652  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape             # <<<<<<<<<<<<<<
16653  *     result.view.strides = <Py_ssize_t *> result.from_slice.strides
16654  *
16655  */
16656   __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
16657 
16658   /* "View.MemoryView":1033
16659  *
16660  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
16661  *     result.view.strides = <Py_ssize_t *> result.from_slice.strides             # <<<<<<<<<<<<<<
16662  *
16663  *
16664  */
16665   __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
16666 
16667   /* "View.MemoryView":1036
16668  *
16669  *
16670  *     result.view.suboffsets = NULL             # <<<<<<<<<<<<<<
16671  *     for suboffset in result.from_slice.suboffsets[:ndim]:
16672  *         if suboffset >= 0:
16673  */
16674   __pyx_v_result->__pyx_base.view.suboffsets = NULL;
16675 
16676   /* "View.MemoryView":1037
16677  *
16678  *     result.view.suboffsets = NULL
16679  *     for suboffset in result.from_slice.suboffsets[:ndim]:             # <<<<<<<<<<<<<<
16680  *         if suboffset >= 0:
16681  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
16682  */
16683   __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
16684   for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
16685     __pyx_t_6 = __pyx_t_8;
16686     __pyx_v_suboffset = (__pyx_t_6[0]);
16687 
16688     /* "View.MemoryView":1038
16689  *     result.view.suboffsets = NULL
16690  *     for suboffset in result.from_slice.suboffsets[:ndim]:
16691  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
16692  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
16693  *             break
16694  */
16695     __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
16696     if (__pyx_t_1) {
16697 
16698       /* "View.MemoryView":1039
16699  *     for suboffset in result.from_slice.suboffsets[:ndim]:
16700  *         if suboffset >= 0:
16701  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets             # <<<<<<<<<<<<<<
16702  *             break
16703  *
16704  */
16705       __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
16706 
16707       /* "View.MemoryView":1040
16708  *         if suboffset >= 0:
16709  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
16710  *             break             # <<<<<<<<<<<<<<
16711  *
16712  *     result.view.len = result.view.itemsize
16713  */
16714       goto __pyx_L6_break;
16715 
16716       /* "View.MemoryView":1038
16717  *     result.view.suboffsets = NULL
16718  *     for suboffset in result.from_slice.suboffsets[:ndim]:
16719  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
16720  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
16721  *             break
16722  */
16723     }
16724   }
16725   __pyx_L6_break:;
16726 
16727   /* "View.MemoryView":1042
16728  *             break
16729  *
16730  *     result.view.len = result.view.itemsize             # <<<<<<<<<<<<<<
16731  *     for length in result.view.shape[:ndim]:
16732  *         result.view.len *= length
16733  */
16734   __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
16735   __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
16736 
16737   /* "View.MemoryView":1043
16738  *
16739  *     result.view.len = result.view.itemsize
16740  *     for length in result.view.shape[:ndim]:             # <<<<<<<<<<<<<<
16741  *         result.view.len *= length
16742  *
16743  */
16744   __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
16745   for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
16746     __pyx_t_6 = __pyx_t_8;
16747     __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1043, __pyx_L1_error)
16748     __Pyx_GOTREF(__pyx_t_2);
16749     __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
16750     __pyx_t_2 = 0;
16751 
16752     /* "View.MemoryView":1044
16753  *     result.view.len = result.view.itemsize
16754  *     for length in result.view.shape[:ndim]:
16755  *         result.view.len *= length             # <<<<<<<<<<<<<<
16756  *
16757  *     result.to_object_func = to_object_func
16758  */
16759     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1044, __pyx_L1_error)
16760     __Pyx_GOTREF(__pyx_t_2);
16761     __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1044, __pyx_L1_error)
16762     __Pyx_GOTREF(__pyx_t_3);
16763     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16764     __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1044, __pyx_L1_error)
16765     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16766     __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
16767   }
16768 
16769   /* "View.MemoryView":1046
16770  *         result.view.len *= length
16771  *
16772  *     result.to_object_func = to_object_func             # <<<<<<<<<<<<<<
16773  *     result.to_dtype_func = to_dtype_func
16774  *
16775  */
16776   __pyx_v_result->to_object_func = __pyx_v_to_object_func;
16777 
16778   /* "View.MemoryView":1047
16779  *
16780  *     result.to_object_func = to_object_func
16781  *     result.to_dtype_func = to_dtype_func             # <<<<<<<<<<<<<<
16782  *
16783  *     return result
16784  */
16785   __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
16786 
16787   /* "View.MemoryView":1049
16788  *     result.to_dtype_func = to_dtype_func
16789  *
16790  *     return result             # <<<<<<<<<<<<<<
16791  *
16792  * @cname('__pyx_memoryview_get_slice_from_memoryview')
16793  */
16794   __Pyx_XDECREF(__pyx_r);
16795   __Pyx_INCREF(((PyObject *)__pyx_v_result));
16796   __pyx_r = ((PyObject *)__pyx_v_result);
16797   goto __pyx_L0;
16798 
16799   /* "View.MemoryView":999
16800  *
16801  * @cname('__pyx_memoryview_fromslice')
16802  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
16803  *                           int ndim,
16804  *                           object (*to_object_func)(char *),
16805  */
16806 
16807   /* function exit code */
16808   __pyx_L1_error:;
16809   __Pyx_XDECREF(__pyx_t_2);
16810   __Pyx_XDECREF(__pyx_t_3);
16811   __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
16812   __pyx_r = 0;
16813   __pyx_L0:;
16814   __Pyx_XDECREF((PyObject *)__pyx_v_result);
16815   __Pyx_XDECREF(__pyx_v_length);
16816   __Pyx_XGIVEREF(__pyx_r);
16817   __Pyx_RefNannyFinishContext();
16818   return __pyx_r;
16819 }
16820 
16821 /* "View.MemoryView":1052
16822  *
16823  * @cname('__pyx_memoryview_get_slice_from_memoryview')
16824  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
16825  *                                                    __Pyx_memviewslice *mslice) except NULL:
16826  *     cdef _memoryviewslice obj
16827  */
16828 
__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_mslice)16829 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
16830   struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
16831   __Pyx_memviewslice *__pyx_r;
16832   __Pyx_RefNannyDeclarations
16833   int __pyx_t_1;
16834   int __pyx_t_2;
16835   PyObject *__pyx_t_3 = NULL;
16836   int __pyx_lineno = 0;
16837   const char *__pyx_filename = NULL;
16838   int __pyx_clineno = 0;
16839   __Pyx_RefNannySetupContext("get_slice_from_memview", 0);
16840 
16841   /* "View.MemoryView":1055
16842  *                                                    __Pyx_memviewslice *mslice) except NULL:
16843  *     cdef _memoryviewslice obj
16844  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
16845  *         obj = memview
16846  *         return &obj.from_slice
16847  */
16848   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
16849   __pyx_t_2 = (__pyx_t_1 != 0);
16850   if (__pyx_t_2) {
16851 
16852     /* "View.MemoryView":1056
16853  *     cdef _memoryviewslice obj
16854  *     if isinstance(memview, _memoryviewslice):
16855  *         obj = memview             # <<<<<<<<<<<<<<
16856  *         return &obj.from_slice
16857  *     else:
16858  */
16859     if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1056, __pyx_L1_error)
16860     __pyx_t_3 = ((PyObject *)__pyx_v_memview);
16861     __Pyx_INCREF(__pyx_t_3);
16862     __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
16863     __pyx_t_3 = 0;
16864 
16865     /* "View.MemoryView":1057
16866  *     if isinstance(memview, _memoryviewslice):
16867  *         obj = memview
16868  *         return &obj.from_slice             # <<<<<<<<<<<<<<
16869  *     else:
16870  *         slice_copy(memview, mslice)
16871  */
16872     __pyx_r = (&__pyx_v_obj->from_slice);
16873     goto __pyx_L0;
16874 
16875     /* "View.MemoryView":1055
16876  *                                                    __Pyx_memviewslice *mslice) except NULL:
16877  *     cdef _memoryviewslice obj
16878  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
16879  *         obj = memview
16880  *         return &obj.from_slice
16881  */
16882   }
16883 
16884   /* "View.MemoryView":1059
16885  *         return &obj.from_slice
16886  *     else:
16887  *         slice_copy(memview, mslice)             # <<<<<<<<<<<<<<
16888  *         return mslice
16889  *
16890  */
16891   /*else*/ {
16892     __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
16893 
16894     /* "View.MemoryView":1060
16895  *     else:
16896  *         slice_copy(memview, mslice)
16897  *         return mslice             # <<<<<<<<<<<<<<
16898  *
16899  * @cname('__pyx_memoryview_slice_copy')
16900  */
16901     __pyx_r = __pyx_v_mslice;
16902     goto __pyx_L0;
16903   }
16904 
16905   /* "View.MemoryView":1052
16906  *
16907  * @cname('__pyx_memoryview_get_slice_from_memoryview')
16908  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
16909  *                                                    __Pyx_memviewslice *mslice) except NULL:
16910  *     cdef _memoryviewslice obj
16911  */
16912 
16913   /* function exit code */
16914   __pyx_L1_error:;
16915   __Pyx_XDECREF(__pyx_t_3);
16916   __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
16917   __pyx_r = NULL;
16918   __pyx_L0:;
16919   __Pyx_XDECREF((PyObject *)__pyx_v_obj);
16920   __Pyx_RefNannyFinishContext();
16921   return __pyx_r;
16922 }
16923 
16924 /* "View.MemoryView":1063
16925  *
16926  * @cname('__pyx_memoryview_slice_copy')
16927  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
16928  *     cdef int dim
16929  *     cdef (Py_ssize_t*) shape, strides, suboffsets
16930  */
16931 
__pyx_memoryview_slice_copy(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_dst)16932 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
16933   int __pyx_v_dim;
16934   Py_ssize_t *__pyx_v_shape;
16935   Py_ssize_t *__pyx_v_strides;
16936   Py_ssize_t *__pyx_v_suboffsets;
16937   __Pyx_RefNannyDeclarations
16938   Py_ssize_t *__pyx_t_1;
16939   int __pyx_t_2;
16940   int __pyx_t_3;
16941   int __pyx_t_4;
16942   Py_ssize_t __pyx_t_5;
16943   __Pyx_RefNannySetupContext("slice_copy", 0);
16944 
16945   /* "View.MemoryView":1067
16946  *     cdef (Py_ssize_t*) shape, strides, suboffsets
16947  *
16948  *     shape = memview.view.shape             # <<<<<<<<<<<<<<
16949  *     strides = memview.view.strides
16950  *     suboffsets = memview.view.suboffsets
16951  */
16952   __pyx_t_1 = __pyx_v_memview->view.shape;
16953   __pyx_v_shape = __pyx_t_1;
16954 
16955   /* "View.MemoryView":1068
16956  *
16957  *     shape = memview.view.shape
16958  *     strides = memview.view.strides             # <<<<<<<<<<<<<<
16959  *     suboffsets = memview.view.suboffsets
16960  *
16961  */
16962   __pyx_t_1 = __pyx_v_memview->view.strides;
16963   __pyx_v_strides = __pyx_t_1;
16964 
16965   /* "View.MemoryView":1069
16966  *     shape = memview.view.shape
16967  *     strides = memview.view.strides
16968  *     suboffsets = memview.view.suboffsets             # <<<<<<<<<<<<<<
16969  *
16970  *     dst.memview = <__pyx_memoryview *> memview
16971  */
16972   __pyx_t_1 = __pyx_v_memview->view.suboffsets;
16973   __pyx_v_suboffsets = __pyx_t_1;
16974 
16975   /* "View.MemoryView":1071
16976  *     suboffsets = memview.view.suboffsets
16977  *
16978  *     dst.memview = <__pyx_memoryview *> memview             # <<<<<<<<<<<<<<
16979  *     dst.data = <char *> memview.view.buf
16980  *
16981  */
16982   __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);
16983 
16984   /* "View.MemoryView":1072
16985  *
16986  *     dst.memview = <__pyx_memoryview *> memview
16987  *     dst.data = <char *> memview.view.buf             # <<<<<<<<<<<<<<
16988  *
16989  *     for dim in range(memview.view.ndim):
16990  */
16991   __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);
16992 
16993   /* "View.MemoryView":1074
16994  *     dst.data = <char *> memview.view.buf
16995  *
16996  *     for dim in range(memview.view.ndim):             # <<<<<<<<<<<<<<
16997  *         dst.shape[dim] = shape[dim]
16998  *         dst.strides[dim] = strides[dim]
16999  */
17000   __pyx_t_2 = __pyx_v_memview->view.ndim;
17001   __pyx_t_3 = __pyx_t_2;
17002   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17003     __pyx_v_dim = __pyx_t_4;
17004 
17005     /* "View.MemoryView":1075
17006  *
17007  *     for dim in range(memview.view.ndim):
17008  *         dst.shape[dim] = shape[dim]             # <<<<<<<<<<<<<<
17009  *         dst.strides[dim] = strides[dim]
17010  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
17011  */
17012     (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
17013 
17014     /* "View.MemoryView":1076
17015  *     for dim in range(memview.view.ndim):
17016  *         dst.shape[dim] = shape[dim]
17017  *         dst.strides[dim] = strides[dim]             # <<<<<<<<<<<<<<
17018  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
17019  *
17020  */
17021     (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
17022 
17023     /* "View.MemoryView":1077
17024  *         dst.shape[dim] = shape[dim]
17025  *         dst.strides[dim] = strides[dim]
17026  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1             # <<<<<<<<<<<<<<
17027  *
17028  * @cname('__pyx_memoryview_copy_object')
17029  */
17030     if ((__pyx_v_suboffsets != 0)) {
17031       __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
17032     } else {
17033       __pyx_t_5 = -1L;
17034     }
17035     (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
17036   }
17037 
17038   /* "View.MemoryView":1063
17039  *
17040  * @cname('__pyx_memoryview_slice_copy')
17041  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
17042  *     cdef int dim
17043  *     cdef (Py_ssize_t*) shape, strides, suboffsets
17044  */
17045 
17046   /* function exit code */
17047   __Pyx_RefNannyFinishContext();
17048 }
17049 
17050 /* "View.MemoryView":1080
17051  *
17052  * @cname('__pyx_memoryview_copy_object')
17053  * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
17054  *     "Create a new memoryview object"
17055  *     cdef __Pyx_memviewslice memviewslice
17056  */
17057 
__pyx_memoryview_copy_object(struct __pyx_memoryview_obj * __pyx_v_memview)17058 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
17059   __Pyx_memviewslice __pyx_v_memviewslice;
17060   PyObject *__pyx_r = NULL;
17061   __Pyx_RefNannyDeclarations
17062   PyObject *__pyx_t_1 = NULL;
17063   int __pyx_lineno = 0;
17064   const char *__pyx_filename = NULL;
17065   int __pyx_clineno = 0;
17066   __Pyx_RefNannySetupContext("memoryview_copy", 0);
17067 
17068   /* "View.MemoryView":1083
17069  *     "Create a new memoryview object"
17070  *     cdef __Pyx_memviewslice memviewslice
17071  *     slice_copy(memview, &memviewslice)             # <<<<<<<<<<<<<<
17072  *     return memoryview_copy_from_slice(memview, &memviewslice)
17073  *
17074  */
17075   __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
17076 
17077   /* "View.MemoryView":1084
17078  *     cdef __Pyx_memviewslice memviewslice
17079  *     slice_copy(memview, &memviewslice)
17080  *     return memoryview_copy_from_slice(memview, &memviewslice)             # <<<<<<<<<<<<<<
17081  *
17082  * @cname('__pyx_memoryview_copy_object_from_slice')
17083  */
17084   __Pyx_XDECREF(__pyx_r);
17085   __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1084, __pyx_L1_error)
17086   __Pyx_GOTREF(__pyx_t_1);
17087   __pyx_r = __pyx_t_1;
17088   __pyx_t_1 = 0;
17089   goto __pyx_L0;
17090 
17091   /* "View.MemoryView":1080
17092  *
17093  * @cname('__pyx_memoryview_copy_object')
17094  * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
17095  *     "Create a new memoryview object"
17096  *     cdef __Pyx_memviewslice memviewslice
17097  */
17098 
17099   /* function exit code */
17100   __pyx_L1_error:;
17101   __Pyx_XDECREF(__pyx_t_1);
17102   __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
17103   __pyx_r = 0;
17104   __pyx_L0:;
17105   __Pyx_XGIVEREF(__pyx_r);
17106   __Pyx_RefNannyFinishContext();
17107   return __pyx_r;
17108 }
17109 
17110 /* "View.MemoryView":1087
17111  *
17112  * @cname('__pyx_memoryview_copy_object_from_slice')
17113  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
17114  *     """
17115  *     Create a new memoryview object from a given memoryview object and slice.
17116  */
17117 
__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_memviewslice)17118 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
17119   PyObject *(*__pyx_v_to_object_func)(char *);
17120   int (*__pyx_v_to_dtype_func)(char *, PyObject *);
17121   PyObject *__pyx_r = NULL;
17122   __Pyx_RefNannyDeclarations
17123   int __pyx_t_1;
17124   int __pyx_t_2;
17125   PyObject *(*__pyx_t_3)(char *);
17126   int (*__pyx_t_4)(char *, PyObject *);
17127   PyObject *__pyx_t_5 = NULL;
17128   int __pyx_lineno = 0;
17129   const char *__pyx_filename = NULL;
17130   int __pyx_clineno = 0;
17131   __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);
17132 
17133   /* "View.MemoryView":1094
17134  *     cdef int (*to_dtype_func)(char *, object) except 0
17135  *
17136  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
17137  *         to_object_func = (<_memoryviewslice> memview).to_object_func
17138  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
17139  */
17140   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
17141   __pyx_t_2 = (__pyx_t_1 != 0);
17142   if (__pyx_t_2) {
17143 
17144     /* "View.MemoryView":1095
17145  *
17146  *     if isinstance(memview, _memoryviewslice):
17147  *         to_object_func = (<_memoryviewslice> memview).to_object_func             # <<<<<<<<<<<<<<
17148  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
17149  *     else:
17150  */
17151     __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
17152     __pyx_v_to_object_func = __pyx_t_3;
17153 
17154     /* "View.MemoryView":1096
17155  *     if isinstance(memview, _memoryviewslice):
17156  *         to_object_func = (<_memoryviewslice> memview).to_object_func
17157  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func             # <<<<<<<<<<<<<<
17158  *     else:
17159  *         to_object_func = NULL
17160  */
17161     __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
17162     __pyx_v_to_dtype_func = __pyx_t_4;
17163 
17164     /* "View.MemoryView":1094
17165  *     cdef int (*to_dtype_func)(char *, object) except 0
17166  *
17167  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
17168  *         to_object_func = (<_memoryviewslice> memview).to_object_func
17169  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
17170  */
17171     goto __pyx_L3;
17172   }
17173 
17174   /* "View.MemoryView":1098
17175  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
17176  *     else:
17177  *         to_object_func = NULL             # <<<<<<<<<<<<<<
17178  *         to_dtype_func = NULL
17179  *
17180  */
17181   /*else*/ {
17182     __pyx_v_to_object_func = NULL;
17183 
17184     /* "View.MemoryView":1099
17185  *     else:
17186  *         to_object_func = NULL
17187  *         to_dtype_func = NULL             # <<<<<<<<<<<<<<
17188  *
17189  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
17190  */
17191     __pyx_v_to_dtype_func = NULL;
17192   }
17193   __pyx_L3:;
17194 
17195   /* "View.MemoryView":1101
17196  *         to_dtype_func = NULL
17197  *
17198  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,             # <<<<<<<<<<<<<<
17199  *                                 to_object_func, to_dtype_func,
17200  *                                 memview.dtype_is_object)
17201  */
17202   __Pyx_XDECREF(__pyx_r);
17203 
17204   /* "View.MemoryView":1103
17205  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
17206  *                                 to_object_func, to_dtype_func,
17207  *                                 memview.dtype_is_object)             # <<<<<<<<<<<<<<
17208  *
17209  *
17210  */
17211   __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1101, __pyx_L1_error)
17212   __Pyx_GOTREF(__pyx_t_5);
17213   __pyx_r = __pyx_t_5;
17214   __pyx_t_5 = 0;
17215   goto __pyx_L0;
17216 
17217   /* "View.MemoryView":1087
17218  *
17219  * @cname('__pyx_memoryview_copy_object_from_slice')
17220  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
17221  *     """
17222  *     Create a new memoryview object from a given memoryview object and slice.
17223  */
17224 
17225   /* function exit code */
17226   __pyx_L1_error:;
17227   __Pyx_XDECREF(__pyx_t_5);
17228   __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
17229   __pyx_r = 0;
17230   __pyx_L0:;
17231   __Pyx_XGIVEREF(__pyx_r);
17232   __Pyx_RefNannyFinishContext();
17233   return __pyx_r;
17234 }
17235 
17236 /* "View.MemoryView":1109
17237  *
17238  *
17239  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
17240  *     if arg < 0:
17241  *         return -arg
17242  */
17243 
abs_py_ssize_t(Py_ssize_t __pyx_v_arg)17244 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
17245   Py_ssize_t __pyx_r;
17246   int __pyx_t_1;
17247 
17248   /* "View.MemoryView":1110
17249  *
17250  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
17251  *     if arg < 0:             # <<<<<<<<<<<<<<
17252  *         return -arg
17253  *     else:
17254  */
17255   __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
17256   if (__pyx_t_1) {
17257 
17258     /* "View.MemoryView":1111
17259  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
17260  *     if arg < 0:
17261  *         return -arg             # <<<<<<<<<<<<<<
17262  *     else:
17263  *         return arg
17264  */
17265     __pyx_r = (-__pyx_v_arg);
17266     goto __pyx_L0;
17267 
17268     /* "View.MemoryView":1110
17269  *
17270  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
17271  *     if arg < 0:             # <<<<<<<<<<<<<<
17272  *         return -arg
17273  *     else:
17274  */
17275   }
17276 
17277   /* "View.MemoryView":1113
17278  *         return -arg
17279  *     else:
17280  *         return arg             # <<<<<<<<<<<<<<
17281  *
17282  * @cname('__pyx_get_best_slice_order')
17283  */
17284   /*else*/ {
17285     __pyx_r = __pyx_v_arg;
17286     goto __pyx_L0;
17287   }
17288 
17289   /* "View.MemoryView":1109
17290  *
17291  *
17292  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
17293  *     if arg < 0:
17294  *         return -arg
17295  */
17296 
17297   /* function exit code */
17298   __pyx_L0:;
17299   return __pyx_r;
17300 }
17301 
17302 /* "View.MemoryView":1116
17303  *
17304  * @cname('__pyx_get_best_slice_order')
17305  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
17306  *     """
17307  *     Figure out the best memory access order for a given slice.
17308  */
17309 
__pyx_get_best_slice_order(__Pyx_memviewslice * __pyx_v_mslice,int __pyx_v_ndim)17310 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
17311   int __pyx_v_i;
17312   Py_ssize_t __pyx_v_c_stride;
17313   Py_ssize_t __pyx_v_f_stride;
17314   char __pyx_r;
17315   int __pyx_t_1;
17316   int __pyx_t_2;
17317   int __pyx_t_3;
17318   int __pyx_t_4;
17319 
17320   /* "View.MemoryView":1121
17321  *     """
17322  *     cdef int i
17323  *     cdef Py_ssize_t c_stride = 0             # <<<<<<<<<<<<<<
17324  *     cdef Py_ssize_t f_stride = 0
17325  *
17326  */
17327   __pyx_v_c_stride = 0;
17328 
17329   /* "View.MemoryView":1122
17330  *     cdef int i
17331  *     cdef Py_ssize_t c_stride = 0
17332  *     cdef Py_ssize_t f_stride = 0             # <<<<<<<<<<<<<<
17333  *
17334  *     for i in range(ndim - 1, -1, -1):
17335  */
17336   __pyx_v_f_stride = 0;
17337 
17338   /* "View.MemoryView":1124
17339  *     cdef Py_ssize_t f_stride = 0
17340  *
17341  *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
17342  *         if mslice.shape[i] > 1:
17343  *             c_stride = mslice.strides[i]
17344  */
17345   for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
17346     __pyx_v_i = __pyx_t_1;
17347 
17348     /* "View.MemoryView":1125
17349  *
17350  *     for i in range(ndim - 1, -1, -1):
17351  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
17352  *             c_stride = mslice.strides[i]
17353  *             break
17354  */
17355     __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
17356     if (__pyx_t_2) {
17357 
17358       /* "View.MemoryView":1126
17359  *     for i in range(ndim - 1, -1, -1):
17360  *         if mslice.shape[i] > 1:
17361  *             c_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
17362  *             break
17363  *
17364  */
17365       __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
17366 
17367       /* "View.MemoryView":1127
17368  *         if mslice.shape[i] > 1:
17369  *             c_stride = mslice.strides[i]
17370  *             break             # <<<<<<<<<<<<<<
17371  *
17372  *     for i in range(ndim):
17373  */
17374       goto __pyx_L4_break;
17375 
17376       /* "View.MemoryView":1125
17377  *
17378  *     for i in range(ndim - 1, -1, -1):
17379  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
17380  *             c_stride = mslice.strides[i]
17381  *             break
17382  */
17383     }
17384   }
17385   __pyx_L4_break:;
17386 
17387   /* "View.MemoryView":1129
17388  *             break
17389  *
17390  *     for i in range(ndim):             # <<<<<<<<<<<<<<
17391  *         if mslice.shape[i] > 1:
17392  *             f_stride = mslice.strides[i]
17393  */
17394   __pyx_t_1 = __pyx_v_ndim;
17395   __pyx_t_3 = __pyx_t_1;
17396   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17397     __pyx_v_i = __pyx_t_4;
17398 
17399     /* "View.MemoryView":1130
17400  *
17401  *     for i in range(ndim):
17402  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
17403  *             f_stride = mslice.strides[i]
17404  *             break
17405  */
17406     __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
17407     if (__pyx_t_2) {
17408 
17409       /* "View.MemoryView":1131
17410  *     for i in range(ndim):
17411  *         if mslice.shape[i] > 1:
17412  *             f_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
17413  *             break
17414  *
17415  */
17416       __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
17417 
17418       /* "View.MemoryView":1132
17419  *         if mslice.shape[i] > 1:
17420  *             f_stride = mslice.strides[i]
17421  *             break             # <<<<<<<<<<<<<<
17422  *
17423  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
17424  */
17425       goto __pyx_L7_break;
17426 
17427       /* "View.MemoryView":1130
17428  *
17429  *     for i in range(ndim):
17430  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
17431  *             f_stride = mslice.strides[i]
17432  *             break
17433  */
17434     }
17435   }
17436   __pyx_L7_break:;
17437 
17438   /* "View.MemoryView":1134
17439  *             break
17440  *
17441  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
17442  *         return 'C'
17443  *     else:
17444  */
17445   __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
17446   if (__pyx_t_2) {
17447 
17448     /* "View.MemoryView":1135
17449  *
17450  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
17451  *         return 'C'             # <<<<<<<<<<<<<<
17452  *     else:
17453  *         return 'F'
17454  */
17455     __pyx_r = 'C';
17456     goto __pyx_L0;
17457 
17458     /* "View.MemoryView":1134
17459  *             break
17460  *
17461  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
17462  *         return 'C'
17463  *     else:
17464  */
17465   }
17466 
17467   /* "View.MemoryView":1137
17468  *         return 'C'
17469  *     else:
17470  *         return 'F'             # <<<<<<<<<<<<<<
17471  *
17472  * @cython.cdivision(True)
17473  */
17474   /*else*/ {
17475     __pyx_r = 'F';
17476     goto __pyx_L0;
17477   }
17478 
17479   /* "View.MemoryView":1116
17480  *
17481  * @cname('__pyx_get_best_slice_order')
17482  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
17483  *     """
17484  *     Figure out the best memory access order for a given slice.
17485  */
17486 
17487   /* function exit code */
17488   __pyx_L0:;
17489   return __pyx_r;
17490 }
17491 
17492 /* "View.MemoryView":1140
17493  *
17494  * @cython.cdivision(True)
17495  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
17496  *                                    char *dst_data, Py_ssize_t *dst_strides,
17497  *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
17498  */
17499 
_copy_strided_to_strided(char * __pyx_v_src_data,Py_ssize_t * __pyx_v_src_strides,char * __pyx_v_dst_data,Py_ssize_t * __pyx_v_dst_strides,Py_ssize_t * __pyx_v_src_shape,Py_ssize_t * __pyx_v_dst_shape,int __pyx_v_ndim,size_t __pyx_v_itemsize)17500 static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
17501   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
17502   CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
17503   Py_ssize_t __pyx_v_dst_extent;
17504   Py_ssize_t __pyx_v_src_stride;
17505   Py_ssize_t __pyx_v_dst_stride;
17506   int __pyx_t_1;
17507   int __pyx_t_2;
17508   int __pyx_t_3;
17509   Py_ssize_t __pyx_t_4;
17510   Py_ssize_t __pyx_t_5;
17511   Py_ssize_t __pyx_t_6;
17512 
17513   /* "View.MemoryView":1147
17514  *
17515  *     cdef Py_ssize_t i
17516  *     cdef Py_ssize_t src_extent = src_shape[0]             # <<<<<<<<<<<<<<
17517  *     cdef Py_ssize_t dst_extent = dst_shape[0]
17518  *     cdef Py_ssize_t src_stride = src_strides[0]
17519  */
17520   __pyx_v_src_extent = (__pyx_v_src_shape[0]);
17521 
17522   /* "View.MemoryView":1148
17523  *     cdef Py_ssize_t i
17524  *     cdef Py_ssize_t src_extent = src_shape[0]
17525  *     cdef Py_ssize_t dst_extent = dst_shape[0]             # <<<<<<<<<<<<<<
17526  *     cdef Py_ssize_t src_stride = src_strides[0]
17527  *     cdef Py_ssize_t dst_stride = dst_strides[0]
17528  */
17529   __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
17530 
17531   /* "View.MemoryView":1149
17532  *     cdef Py_ssize_t src_extent = src_shape[0]
17533  *     cdef Py_ssize_t dst_extent = dst_shape[0]
17534  *     cdef Py_ssize_t src_stride = src_strides[0]             # <<<<<<<<<<<<<<
17535  *     cdef Py_ssize_t dst_stride = dst_strides[0]
17536  *
17537  */
17538   __pyx_v_src_stride = (__pyx_v_src_strides[0]);
17539 
17540   /* "View.MemoryView":1150
17541  *     cdef Py_ssize_t dst_extent = dst_shape[0]
17542  *     cdef Py_ssize_t src_stride = src_strides[0]
17543  *     cdef Py_ssize_t dst_stride = dst_strides[0]             # <<<<<<<<<<<<<<
17544  *
17545  *     if ndim == 1:
17546  */
17547   __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
17548 
17549   /* "View.MemoryView":1152
17550  *     cdef Py_ssize_t dst_stride = dst_strides[0]
17551  *
17552  *     if ndim == 1:             # <<<<<<<<<<<<<<
17553  *        if (src_stride > 0 and dst_stride > 0 and
17554  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17555  */
17556   __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
17557   if (__pyx_t_1) {
17558 
17559     /* "View.MemoryView":1153
17560  *
17561  *     if ndim == 1:
17562  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
17563  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17564  *            memcpy(dst_data, src_data, itemsize * dst_extent)
17565  */
17566     __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
17567     if (__pyx_t_2) {
17568     } else {
17569       __pyx_t_1 = __pyx_t_2;
17570       goto __pyx_L5_bool_binop_done;
17571     }
17572     __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
17573     if (__pyx_t_2) {
17574     } else {
17575       __pyx_t_1 = __pyx_t_2;
17576       goto __pyx_L5_bool_binop_done;
17577     }
17578 
17579     /* "View.MemoryView":1154
17580  *     if ndim == 1:
17581  *        if (src_stride > 0 and dst_stride > 0 and
17582  *            <size_t> src_stride == itemsize == <size_t> dst_stride):             # <<<<<<<<<<<<<<
17583  *            memcpy(dst_data, src_data, itemsize * dst_extent)
17584  *        else:
17585  */
17586     __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
17587     if (__pyx_t_2) {
17588       __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
17589     }
17590     __pyx_t_3 = (__pyx_t_2 != 0);
17591     __pyx_t_1 = __pyx_t_3;
17592     __pyx_L5_bool_binop_done:;
17593 
17594     /* "View.MemoryView":1153
17595  *
17596  *     if ndim == 1:
17597  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
17598  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17599  *            memcpy(dst_data, src_data, itemsize * dst_extent)
17600  */
17601     if (__pyx_t_1) {
17602 
17603       /* "View.MemoryView":1155
17604  *        if (src_stride > 0 and dst_stride > 0 and
17605  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17606  *            memcpy(dst_data, src_data, itemsize * dst_extent)             # <<<<<<<<<<<<<<
17607  *        else:
17608  *            for i in range(dst_extent):
17609  */
17610       (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
17611 
17612       /* "View.MemoryView":1153
17613  *
17614  *     if ndim == 1:
17615  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
17616  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17617  *            memcpy(dst_data, src_data, itemsize * dst_extent)
17618  */
17619       goto __pyx_L4;
17620     }
17621 
17622     /* "View.MemoryView":1157
17623  *            memcpy(dst_data, src_data, itemsize * dst_extent)
17624  *        else:
17625  *            for i in range(dst_extent):             # <<<<<<<<<<<<<<
17626  *                memcpy(dst_data, src_data, itemsize)
17627  *                src_data += src_stride
17628  */
17629     /*else*/ {
17630       __pyx_t_4 = __pyx_v_dst_extent;
17631       __pyx_t_5 = __pyx_t_4;
17632       for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
17633         __pyx_v_i = __pyx_t_6;
17634 
17635         /* "View.MemoryView":1158
17636  *        else:
17637  *            for i in range(dst_extent):
17638  *                memcpy(dst_data, src_data, itemsize)             # <<<<<<<<<<<<<<
17639  *                src_data += src_stride
17640  *                dst_data += dst_stride
17641  */
17642         (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
17643 
17644         /* "View.MemoryView":1159
17645  *            for i in range(dst_extent):
17646  *                memcpy(dst_data, src_data, itemsize)
17647  *                src_data += src_stride             # <<<<<<<<<<<<<<
17648  *                dst_data += dst_stride
17649  *     else:
17650  */
17651         __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
17652 
17653         /* "View.MemoryView":1160
17654  *                memcpy(dst_data, src_data, itemsize)
17655  *                src_data += src_stride
17656  *                dst_data += dst_stride             # <<<<<<<<<<<<<<
17657  *     else:
17658  *         for i in range(dst_extent):
17659  */
17660         __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
17661       }
17662     }
17663     __pyx_L4:;
17664 
17665     /* "View.MemoryView":1152
17666  *     cdef Py_ssize_t dst_stride = dst_strides[0]
17667  *
17668  *     if ndim == 1:             # <<<<<<<<<<<<<<
17669  *        if (src_stride > 0 and dst_stride > 0 and
17670  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17671  */
17672     goto __pyx_L3;
17673   }
17674 
17675   /* "View.MemoryView":1162
17676  *                dst_data += dst_stride
17677  *     else:
17678  *         for i in range(dst_extent):             # <<<<<<<<<<<<<<
17679  *             _copy_strided_to_strided(src_data, src_strides + 1,
17680  *                                      dst_data, dst_strides + 1,
17681  */
17682   /*else*/ {
17683     __pyx_t_4 = __pyx_v_dst_extent;
17684     __pyx_t_5 = __pyx_t_4;
17685     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
17686       __pyx_v_i = __pyx_t_6;
17687 
17688       /* "View.MemoryView":1163
17689  *     else:
17690  *         for i in range(dst_extent):
17691  *             _copy_strided_to_strided(src_data, src_strides + 1,             # <<<<<<<<<<<<<<
17692  *                                      dst_data, dst_strides + 1,
17693  *                                      src_shape + 1, dst_shape + 1,
17694  */
17695       _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize);
17696 
17697       /* "View.MemoryView":1167
17698  *                                      src_shape + 1, dst_shape + 1,
17699  *                                      ndim - 1, itemsize)
17700  *             src_data += src_stride             # <<<<<<<<<<<<<<
17701  *             dst_data += dst_stride
17702  *
17703  */
17704       __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
17705 
17706       /* "View.MemoryView":1168
17707  *                                      ndim - 1, itemsize)
17708  *             src_data += src_stride
17709  *             dst_data += dst_stride             # <<<<<<<<<<<<<<
17710  *
17711  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
17712  */
17713       __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
17714     }
17715   }
17716   __pyx_L3:;
17717 
17718   /* "View.MemoryView":1140
17719  *
17720  * @cython.cdivision(True)
17721  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
17722  *                                    char *dst_data, Py_ssize_t *dst_strides,
17723  *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
17724  */
17725 
17726   /* function exit code */
17727 }
17728 
17729 /* "View.MemoryView":1170
17730  *             dst_data += dst_stride
17731  *
17732  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
17733  *                                   __Pyx_memviewslice *dst,
17734  *                                   int ndim, size_t itemsize) nogil:
17735  */
17736 
copy_strided_to_strided(__Pyx_memviewslice * __pyx_v_src,__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_ndim,size_t __pyx_v_itemsize)17737 static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
17738 
17739   /* "View.MemoryView":1173
17740  *                                   __Pyx_memviewslice *dst,
17741  *                                   int ndim, size_t itemsize) nogil:
17742  *     _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides,             # <<<<<<<<<<<<<<
17743  *                              src.shape, dst.shape, ndim, itemsize)
17744  *
17745  */
17746   _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize);
17747 
17748   /* "View.MemoryView":1170
17749  *             dst_data += dst_stride
17750  *
17751  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
17752  *                                   __Pyx_memviewslice *dst,
17753  *                                   int ndim, size_t itemsize) nogil:
17754  */
17755 
17756   /* function exit code */
17757 }
17758 
17759 /* "View.MemoryView":1177
17760  *
17761  * @cname('__pyx_memoryview_slice_get_size')
17762  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
17763  *     "Return the size of the memory occupied by the slice in number of bytes"
17764  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
17765  */
17766 
__pyx_memoryview_slice_get_size(__Pyx_memviewslice * __pyx_v_src,int __pyx_v_ndim)17767 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
17768   Py_ssize_t __pyx_v_shape;
17769   Py_ssize_t __pyx_v_size;
17770   Py_ssize_t __pyx_r;
17771   Py_ssize_t __pyx_t_1;
17772   Py_ssize_t *__pyx_t_2;
17773   Py_ssize_t *__pyx_t_3;
17774   Py_ssize_t *__pyx_t_4;
17775 
17776   /* "View.MemoryView":1179
17777  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:
17778  *     "Return the size of the memory occupied by the slice in number of bytes"
17779  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize             # <<<<<<<<<<<<<<
17780  *
17781  *     for shape in src.shape[:ndim]:
17782  */
17783   __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
17784   __pyx_v_size = __pyx_t_1;
17785 
17786   /* "View.MemoryView":1181
17787  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
17788  *
17789  *     for shape in src.shape[:ndim]:             # <<<<<<<<<<<<<<
17790  *         size *= shape
17791  *
17792  */
17793   __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
17794   for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
17795     __pyx_t_2 = __pyx_t_4;
17796     __pyx_v_shape = (__pyx_t_2[0]);
17797 
17798     /* "View.MemoryView":1182
17799  *
17800  *     for shape in src.shape[:ndim]:
17801  *         size *= shape             # <<<<<<<<<<<<<<
17802  *
17803  *     return size
17804  */
17805     __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
17806   }
17807 
17808   /* "View.MemoryView":1184
17809  *         size *= shape
17810  *
17811  *     return size             # <<<<<<<<<<<<<<
17812  *
17813  * @cname('__pyx_fill_contig_strides_array')
17814  */
17815   __pyx_r = __pyx_v_size;
17816   goto __pyx_L0;
17817 
17818   /* "View.MemoryView":1177
17819  *
17820  * @cname('__pyx_memoryview_slice_get_size')
17821  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
17822  *     "Return the size of the memory occupied by the slice in number of bytes"
17823  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
17824  */
17825 
17826   /* function exit code */
17827   __pyx_L0:;
17828   return __pyx_r;
17829 }
17830 
17831 /* "View.MemoryView":1187
17832  *
17833  * @cname('__pyx_fill_contig_strides_array')
17834  * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
17835  *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
17836  *                 int ndim, char order) nogil:
17837  */
17838 
__pyx_fill_contig_strides_array(Py_ssize_t * __pyx_v_shape,Py_ssize_t * __pyx_v_strides,Py_ssize_t __pyx_v_stride,int __pyx_v_ndim,char __pyx_v_order)17839 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) {
17840   int __pyx_v_idx;
17841   Py_ssize_t __pyx_r;
17842   int __pyx_t_1;
17843   int __pyx_t_2;
17844   int __pyx_t_3;
17845   int __pyx_t_4;
17846 
17847   /* "View.MemoryView":1196
17848  *     cdef int idx
17849  *
17850  *     if order == 'F':             # <<<<<<<<<<<<<<
17851  *         for idx in range(ndim):
17852  *             strides[idx] = stride
17853  */
17854   __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
17855   if (__pyx_t_1) {
17856 
17857     /* "View.MemoryView":1197
17858  *
17859  *     if order == 'F':
17860  *         for idx in range(ndim):             # <<<<<<<<<<<<<<
17861  *             strides[idx] = stride
17862  *             stride *= shape[idx]
17863  */
17864     __pyx_t_2 = __pyx_v_ndim;
17865     __pyx_t_3 = __pyx_t_2;
17866     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17867       __pyx_v_idx = __pyx_t_4;
17868 
17869       /* "View.MemoryView":1198
17870  *     if order == 'F':
17871  *         for idx in range(ndim):
17872  *             strides[idx] = stride             # <<<<<<<<<<<<<<
17873  *             stride *= shape[idx]
17874  *     else:
17875  */
17876       (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
17877 
17878       /* "View.MemoryView":1199
17879  *         for idx in range(ndim):
17880  *             strides[idx] = stride
17881  *             stride *= shape[idx]             # <<<<<<<<<<<<<<
17882  *     else:
17883  *         for idx in range(ndim - 1, -1, -1):
17884  */
17885       __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
17886     }
17887 
17888     /* "View.MemoryView":1196
17889  *     cdef int idx
17890  *
17891  *     if order == 'F':             # <<<<<<<<<<<<<<
17892  *         for idx in range(ndim):
17893  *             strides[idx] = stride
17894  */
17895     goto __pyx_L3;
17896   }
17897 
17898   /* "View.MemoryView":1201
17899  *             stride *= shape[idx]
17900  *     else:
17901  *         for idx in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
17902  *             strides[idx] = stride
17903  *             stride *= shape[idx]
17904  */
17905   /*else*/ {
17906     for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
17907       __pyx_v_idx = __pyx_t_2;
17908 
17909       /* "View.MemoryView":1202
17910  *     else:
17911  *         for idx in range(ndim - 1, -1, -1):
17912  *             strides[idx] = stride             # <<<<<<<<<<<<<<
17913  *             stride *= shape[idx]
17914  *
17915  */
17916       (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
17917 
17918       /* "View.MemoryView":1203
17919  *         for idx in range(ndim - 1, -1, -1):
17920  *             strides[idx] = stride
17921  *             stride *= shape[idx]             # <<<<<<<<<<<<<<
17922  *
17923  *     return stride
17924  */
17925       __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
17926     }
17927   }
17928   __pyx_L3:;
17929 
17930   /* "View.MemoryView":1205
17931  *             stride *= shape[idx]
17932  *
17933  *     return stride             # <<<<<<<<<<<<<<
17934  *
17935  * @cname('__pyx_memoryview_copy_data_to_temp')
17936  */
17937   __pyx_r = __pyx_v_stride;
17938   goto __pyx_L0;
17939 
17940   /* "View.MemoryView":1187
17941  *
17942  * @cname('__pyx_fill_contig_strides_array')
17943  * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
17944  *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
17945  *                 int ndim, char order) nogil:
17946  */
17947 
17948   /* function exit code */
17949   __pyx_L0:;
17950   return __pyx_r;
17951 }
17952 
17953 /* "View.MemoryView":1208
17954  *
17955  * @cname('__pyx_memoryview_copy_data_to_temp')
17956  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
17957  *                              __Pyx_memviewslice *tmpslice,
17958  *                              char order,
17959  */
17960 
__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice * __pyx_v_src,__Pyx_memviewslice * __pyx_v_tmpslice,char __pyx_v_order,int __pyx_v_ndim)17961 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) {
17962   int __pyx_v_i;
17963   void *__pyx_v_result;
17964   size_t __pyx_v_itemsize;
17965   size_t __pyx_v_size;
17966   void *__pyx_r;
17967   Py_ssize_t __pyx_t_1;
17968   int __pyx_t_2;
17969   int __pyx_t_3;
17970   struct __pyx_memoryview_obj *__pyx_t_4;
17971   int __pyx_t_5;
17972   int __pyx_t_6;
17973   int __pyx_lineno = 0;
17974   const char *__pyx_filename = NULL;
17975   int __pyx_clineno = 0;
17976 
17977   /* "View.MemoryView":1219
17978  *     cdef void *result
17979  *
17980  *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
17981  *     cdef size_t size = slice_get_size(src, ndim)
17982  *
17983  */
17984   __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
17985   __pyx_v_itemsize = __pyx_t_1;
17986 
17987   /* "View.MemoryView":1220
17988  *
17989  *     cdef size_t itemsize = src.memview.view.itemsize
17990  *     cdef size_t size = slice_get_size(src, ndim)             # <<<<<<<<<<<<<<
17991  *
17992  *     result = malloc(size)
17993  */
17994   __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
17995 
17996   /* "View.MemoryView":1222
17997  *     cdef size_t size = slice_get_size(src, ndim)
17998  *
17999  *     result = malloc(size)             # <<<<<<<<<<<<<<
18000  *     if not result:
18001  *         _err(MemoryError, NULL)
18002  */
18003   __pyx_v_result = malloc(__pyx_v_size);
18004 
18005   /* "View.MemoryView":1223
18006  *
18007  *     result = malloc(size)
18008  *     if not result:             # <<<<<<<<<<<<<<
18009  *         _err(MemoryError, NULL)
18010  *
18011  */
18012   __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
18013   if (__pyx_t_2) {
18014 
18015     /* "View.MemoryView":1224
18016  *     result = malloc(size)
18017  *     if not result:
18018  *         _err(MemoryError, NULL)             # <<<<<<<<<<<<<<
18019  *
18020  *
18021  */
18022     __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1224, __pyx_L1_error)
18023 
18024     /* "View.MemoryView":1223
18025  *
18026  *     result = malloc(size)
18027  *     if not result:             # <<<<<<<<<<<<<<
18028  *         _err(MemoryError, NULL)
18029  *
18030  */
18031   }
18032 
18033   /* "View.MemoryView":1227
18034  *
18035  *
18036  *     tmpslice.data = <char *> result             # <<<<<<<<<<<<<<
18037  *     tmpslice.memview = src.memview
18038  *     for i in range(ndim):
18039  */
18040   __pyx_v_tmpslice->data = ((char *)__pyx_v_result);
18041 
18042   /* "View.MemoryView":1228
18043  *
18044  *     tmpslice.data = <char *> result
18045  *     tmpslice.memview = src.memview             # <<<<<<<<<<<<<<
18046  *     for i in range(ndim):
18047  *         tmpslice.shape[i] = src.shape[i]
18048  */
18049   __pyx_t_4 = __pyx_v_src->memview;
18050   __pyx_v_tmpslice->memview = __pyx_t_4;
18051 
18052   /* "View.MemoryView":1229
18053  *     tmpslice.data = <char *> result
18054  *     tmpslice.memview = src.memview
18055  *     for i in range(ndim):             # <<<<<<<<<<<<<<
18056  *         tmpslice.shape[i] = src.shape[i]
18057  *         tmpslice.suboffsets[i] = -1
18058  */
18059   __pyx_t_3 = __pyx_v_ndim;
18060   __pyx_t_5 = __pyx_t_3;
18061   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18062     __pyx_v_i = __pyx_t_6;
18063 
18064     /* "View.MemoryView":1230
18065  *     tmpslice.memview = src.memview
18066  *     for i in range(ndim):
18067  *         tmpslice.shape[i] = src.shape[i]             # <<<<<<<<<<<<<<
18068  *         tmpslice.suboffsets[i] = -1
18069  *
18070  */
18071     (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
18072 
18073     /* "View.MemoryView":1231
18074  *     for i in range(ndim):
18075  *         tmpslice.shape[i] = src.shape[i]
18076  *         tmpslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
18077  *
18078  *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
18079  */
18080     (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
18081   }
18082 
18083   /* "View.MemoryView":1233
18084  *         tmpslice.suboffsets[i] = -1
18085  *
18086  *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,             # <<<<<<<<<<<<<<
18087  *                               ndim, order)
18088  *
18089  */
18090   (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order));
18091 
18092   /* "View.MemoryView":1237
18093  *
18094  *
18095  *     for i in range(ndim):             # <<<<<<<<<<<<<<
18096  *         if tmpslice.shape[i] == 1:
18097  *             tmpslice.strides[i] = 0
18098  */
18099   __pyx_t_3 = __pyx_v_ndim;
18100   __pyx_t_5 = __pyx_t_3;
18101   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18102     __pyx_v_i = __pyx_t_6;
18103 
18104     /* "View.MemoryView":1238
18105  *
18106  *     for i in range(ndim):
18107  *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
18108  *             tmpslice.strides[i] = 0
18109  *
18110  */
18111     __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
18112     if (__pyx_t_2) {
18113 
18114       /* "View.MemoryView":1239
18115  *     for i in range(ndim):
18116  *         if tmpslice.shape[i] == 1:
18117  *             tmpslice.strides[i] = 0             # <<<<<<<<<<<<<<
18118  *
18119  *     if slice_is_contig(src[0], order, ndim):
18120  */
18121       (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
18122 
18123       /* "View.MemoryView":1238
18124  *
18125  *     for i in range(ndim):
18126  *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
18127  *             tmpslice.strides[i] = 0
18128  *
18129  */
18130     }
18131   }
18132 
18133   /* "View.MemoryView":1241
18134  *             tmpslice.strides[i] = 0
18135  *
18136  *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
18137  *         memcpy(result, src.data, size)
18138  *     else:
18139  */
18140   __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
18141   if (__pyx_t_2) {
18142 
18143     /* "View.MemoryView":1242
18144  *
18145  *     if slice_is_contig(src[0], order, ndim):
18146  *         memcpy(result, src.data, size)             # <<<<<<<<<<<<<<
18147  *     else:
18148  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
18149  */
18150     (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
18151 
18152     /* "View.MemoryView":1241
18153  *             tmpslice.strides[i] = 0
18154  *
18155  *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
18156  *         memcpy(result, src.data, size)
18157  *     else:
18158  */
18159     goto __pyx_L9;
18160   }
18161 
18162   /* "View.MemoryView":1244
18163  *         memcpy(result, src.data, size)
18164  *     else:
18165  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)             # <<<<<<<<<<<<<<
18166  *
18167  *     return result
18168  */
18169   /*else*/ {
18170     copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
18171   }
18172   __pyx_L9:;
18173 
18174   /* "View.MemoryView":1246
18175  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
18176  *
18177  *     return result             # <<<<<<<<<<<<<<
18178  *
18179  *
18180  */
18181   __pyx_r = __pyx_v_result;
18182   goto __pyx_L0;
18183 
18184   /* "View.MemoryView":1208
18185  *
18186  * @cname('__pyx_memoryview_copy_data_to_temp')
18187  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
18188  *                              __Pyx_memviewslice *tmpslice,
18189  *                              char order,
18190  */
18191 
18192   /* function exit code */
18193   __pyx_L1_error:;
18194   {
18195     #ifdef WITH_THREAD
18196     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18197     #endif
18198     __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
18199     #ifdef WITH_THREAD
18200     __Pyx_PyGILState_Release(__pyx_gilstate_save);
18201     #endif
18202   }
18203   __pyx_r = NULL;
18204   __pyx_L0:;
18205   return __pyx_r;
18206 }
18207 
18208 /* "View.MemoryView":1251
18209  *
18210  * @cname('__pyx_memoryview_err_extents')
18211  * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
18212  *                              Py_ssize_t extent2) except -1 with gil:
18213  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
18214  */
18215 
__pyx_memoryview_err_extents(int __pyx_v_i,Py_ssize_t __pyx_v_extent1,Py_ssize_t __pyx_v_extent2)18216 static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
18217   int __pyx_r;
18218   __Pyx_RefNannyDeclarations
18219   PyObject *__pyx_t_1 = NULL;
18220   PyObject *__pyx_t_2 = NULL;
18221   PyObject *__pyx_t_3 = NULL;
18222   PyObject *__pyx_t_4 = NULL;
18223   int __pyx_lineno = 0;
18224   const char *__pyx_filename = NULL;
18225   int __pyx_clineno = 0;
18226   #ifdef WITH_THREAD
18227   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18228   #endif
18229   __Pyx_RefNannySetupContext("_err_extents", 0);
18230 
18231   /* "View.MemoryView":1254
18232  *                              Py_ssize_t extent2) except -1 with gil:
18233  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
18234  *                                                         (i, extent1, extent2))             # <<<<<<<<<<<<<<
18235  *
18236  * @cname('__pyx_memoryview_err_dim')
18237  */
18238   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1254, __pyx_L1_error)
18239   __Pyx_GOTREF(__pyx_t_1);
18240   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1254, __pyx_L1_error)
18241   __Pyx_GOTREF(__pyx_t_2);
18242   __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1254, __pyx_L1_error)
18243   __Pyx_GOTREF(__pyx_t_3);
18244   __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1254, __pyx_L1_error)
18245   __Pyx_GOTREF(__pyx_t_4);
18246   __Pyx_GIVEREF(__pyx_t_1);
18247   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
18248   __Pyx_GIVEREF(__pyx_t_2);
18249   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
18250   __Pyx_GIVEREF(__pyx_t_3);
18251   PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
18252   __pyx_t_1 = 0;
18253   __pyx_t_2 = 0;
18254   __pyx_t_3 = 0;
18255 
18256   /* "View.MemoryView":1253
18257  * cdef int _err_extents(int i, Py_ssize_t extent1,
18258  *                              Py_ssize_t extent2) except -1 with gil:
18259  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %             # <<<<<<<<<<<<<<
18260  *                                                         (i, extent1, extent2))
18261  *
18262  */
18263   __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1253, __pyx_L1_error)
18264   __Pyx_GOTREF(__pyx_t_3);
18265   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18266   __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1253, __pyx_L1_error)
18267   __Pyx_GOTREF(__pyx_t_4);
18268   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18269   __Pyx_Raise(__pyx_t_4, 0, 0, 0);
18270   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18271   __PYX_ERR(2, 1253, __pyx_L1_error)
18272 
18273   /* "View.MemoryView":1251
18274  *
18275  * @cname('__pyx_memoryview_err_extents')
18276  * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
18277  *                              Py_ssize_t extent2) except -1 with gil:
18278  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
18279  */
18280 
18281   /* function exit code */
18282   __pyx_L1_error:;
18283   __Pyx_XDECREF(__pyx_t_1);
18284   __Pyx_XDECREF(__pyx_t_2);
18285   __Pyx_XDECREF(__pyx_t_3);
18286   __Pyx_XDECREF(__pyx_t_4);
18287   __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
18288   __pyx_r = -1;
18289   __Pyx_RefNannyFinishContext();
18290   #ifdef WITH_THREAD
18291   __Pyx_PyGILState_Release(__pyx_gilstate_save);
18292   #endif
18293   return __pyx_r;
18294 }
18295 
18296 /* "View.MemoryView":1257
18297  *
18298  * @cname('__pyx_memoryview_err_dim')
18299  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
18300  *     raise error(msg.decode('ascii') % dim)
18301  *
18302  */
18303 
__pyx_memoryview_err_dim(PyObject * __pyx_v_error,char * __pyx_v_msg,int __pyx_v_dim)18304 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
18305   int __pyx_r;
18306   __Pyx_RefNannyDeclarations
18307   PyObject *__pyx_t_1 = NULL;
18308   PyObject *__pyx_t_2 = NULL;
18309   PyObject *__pyx_t_3 = NULL;
18310   PyObject *__pyx_t_4 = NULL;
18311   int __pyx_lineno = 0;
18312   const char *__pyx_filename = NULL;
18313   int __pyx_clineno = 0;
18314   #ifdef WITH_THREAD
18315   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18316   #endif
18317   __Pyx_RefNannySetupContext("_err_dim", 0);
18318   __Pyx_INCREF(__pyx_v_error);
18319 
18320   /* "View.MemoryView":1258
18321  * @cname('__pyx_memoryview_err_dim')
18322  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
18323  *     raise error(msg.decode('ascii') % dim)             # <<<<<<<<<<<<<<
18324  *
18325  * @cname('__pyx_memoryview_err')
18326  */
18327   __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1258, __pyx_L1_error)
18328   __Pyx_GOTREF(__pyx_t_2);
18329   __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1258, __pyx_L1_error)
18330   __Pyx_GOTREF(__pyx_t_3);
18331   __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1258, __pyx_L1_error)
18332   __Pyx_GOTREF(__pyx_t_4);
18333   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18334   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18335   __Pyx_INCREF(__pyx_v_error);
18336   __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
18337   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
18338     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
18339     if (likely(__pyx_t_2)) {
18340       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
18341       __Pyx_INCREF(__pyx_t_2);
18342       __Pyx_INCREF(function);
18343       __Pyx_DECREF_SET(__pyx_t_3, function);
18344     }
18345   }
18346   __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
18347   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
18348   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18349   if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1258, __pyx_L1_error)
18350   __Pyx_GOTREF(__pyx_t_1);
18351   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18352   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
18353   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18354   __PYX_ERR(2, 1258, __pyx_L1_error)
18355 
18356   /* "View.MemoryView":1257
18357  *
18358  * @cname('__pyx_memoryview_err_dim')
18359  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
18360  *     raise error(msg.decode('ascii') % dim)
18361  *
18362  */
18363 
18364   /* function exit code */
18365   __pyx_L1_error:;
18366   __Pyx_XDECREF(__pyx_t_1);
18367   __Pyx_XDECREF(__pyx_t_2);
18368   __Pyx_XDECREF(__pyx_t_3);
18369   __Pyx_XDECREF(__pyx_t_4);
18370   __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
18371   __pyx_r = -1;
18372   __Pyx_XDECREF(__pyx_v_error);
18373   __Pyx_RefNannyFinishContext();
18374   #ifdef WITH_THREAD
18375   __Pyx_PyGILState_Release(__pyx_gilstate_save);
18376   #endif
18377   return __pyx_r;
18378 }
18379 
18380 /* "View.MemoryView":1261
18381  *
18382  * @cname('__pyx_memoryview_err')
18383  * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
18384  *     if msg != NULL:
18385  *         raise error(msg.decode('ascii'))
18386  */
18387 
__pyx_memoryview_err(PyObject * __pyx_v_error,char * __pyx_v_msg)18388 static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
18389   int __pyx_r;
18390   __Pyx_RefNannyDeclarations
18391   int __pyx_t_1;
18392   PyObject *__pyx_t_2 = NULL;
18393   PyObject *__pyx_t_3 = NULL;
18394   PyObject *__pyx_t_4 = NULL;
18395   PyObject *__pyx_t_5 = NULL;
18396   int __pyx_lineno = 0;
18397   const char *__pyx_filename = NULL;
18398   int __pyx_clineno = 0;
18399   #ifdef WITH_THREAD
18400   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18401   #endif
18402   __Pyx_RefNannySetupContext("_err", 0);
18403   __Pyx_INCREF(__pyx_v_error);
18404 
18405   /* "View.MemoryView":1262
18406  * @cname('__pyx_memoryview_err')
18407  * cdef int _err(object error, char *msg) except -1 with gil:
18408  *     if msg != NULL:             # <<<<<<<<<<<<<<
18409  *         raise error(msg.decode('ascii'))
18410  *     else:
18411  */
18412   __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
18413   if (unlikely(__pyx_t_1)) {
18414 
18415     /* "View.MemoryView":1263
18416  * cdef int _err(object error, char *msg) except -1 with gil:
18417  *     if msg != NULL:
18418  *         raise error(msg.decode('ascii'))             # <<<<<<<<<<<<<<
18419  *     else:
18420  *         raise error
18421  */
18422     __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1263, __pyx_L1_error)
18423     __Pyx_GOTREF(__pyx_t_3);
18424     __Pyx_INCREF(__pyx_v_error);
18425     __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
18426     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
18427       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
18428       if (likely(__pyx_t_5)) {
18429         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
18430         __Pyx_INCREF(__pyx_t_5);
18431         __Pyx_INCREF(function);
18432         __Pyx_DECREF_SET(__pyx_t_4, function);
18433       }
18434     }
18435     __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
18436     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
18437     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18438     if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1263, __pyx_L1_error)
18439     __Pyx_GOTREF(__pyx_t_2);
18440     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18441     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
18442     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18443     __PYX_ERR(2, 1263, __pyx_L1_error)
18444 
18445     /* "View.MemoryView":1262
18446  * @cname('__pyx_memoryview_err')
18447  * cdef int _err(object error, char *msg) except -1 with gil:
18448  *     if msg != NULL:             # <<<<<<<<<<<<<<
18449  *         raise error(msg.decode('ascii'))
18450  *     else:
18451  */
18452   }
18453 
18454   /* "View.MemoryView":1265
18455  *         raise error(msg.decode('ascii'))
18456  *     else:
18457  *         raise error             # <<<<<<<<<<<<<<
18458  *
18459  * @cname('__pyx_memoryview_copy_contents')
18460  */
18461   /*else*/ {
18462     __Pyx_Raise(__pyx_v_error, 0, 0, 0);
18463     __PYX_ERR(2, 1265, __pyx_L1_error)
18464   }
18465 
18466   /* "View.MemoryView":1261
18467  *
18468  * @cname('__pyx_memoryview_err')
18469  * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
18470  *     if msg != NULL:
18471  *         raise error(msg.decode('ascii'))
18472  */
18473 
18474   /* function exit code */
18475   __pyx_L1_error:;
18476   __Pyx_XDECREF(__pyx_t_2);
18477   __Pyx_XDECREF(__pyx_t_3);
18478   __Pyx_XDECREF(__pyx_t_4);
18479   __Pyx_XDECREF(__pyx_t_5);
18480   __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
18481   __pyx_r = -1;
18482   __Pyx_XDECREF(__pyx_v_error);
18483   __Pyx_RefNannyFinishContext();
18484   #ifdef WITH_THREAD
18485   __Pyx_PyGILState_Release(__pyx_gilstate_save);
18486   #endif
18487   return __pyx_r;
18488 }
18489 
18490 /* "View.MemoryView":1268
18491  *
18492  * @cname('__pyx_memoryview_copy_contents')
18493  * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
18494  *                                   __Pyx_memviewslice dst,
18495  *                                   int src_ndim, int dst_ndim,
18496  */
18497 
__pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src,__Pyx_memviewslice __pyx_v_dst,int __pyx_v_src_ndim,int __pyx_v_dst_ndim,int __pyx_v_dtype_is_object)18498 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) {
18499   void *__pyx_v_tmpdata;
18500   size_t __pyx_v_itemsize;
18501   int __pyx_v_i;
18502   char __pyx_v_order;
18503   int __pyx_v_broadcasting;
18504   int __pyx_v_direct_copy;
18505   __Pyx_memviewslice __pyx_v_tmp;
18506   int __pyx_v_ndim;
18507   int __pyx_r;
18508   Py_ssize_t __pyx_t_1;
18509   int __pyx_t_2;
18510   int __pyx_t_3;
18511   int __pyx_t_4;
18512   int __pyx_t_5;
18513   int __pyx_t_6;
18514   void *__pyx_t_7;
18515   int __pyx_t_8;
18516   int __pyx_lineno = 0;
18517   const char *__pyx_filename = NULL;
18518   int __pyx_clineno = 0;
18519 
18520   /* "View.MemoryView":1276
18521  *     Check for overlapping memory and verify the shapes.
18522  *     """
18523  *     cdef void *tmpdata = NULL             # <<<<<<<<<<<<<<
18524  *     cdef size_t itemsize = src.memview.view.itemsize
18525  *     cdef int i
18526  */
18527   __pyx_v_tmpdata = NULL;
18528 
18529   /* "View.MemoryView":1277
18530  *     """
18531  *     cdef void *tmpdata = NULL
18532  *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
18533  *     cdef int i
18534  *     cdef char order = get_best_order(&src, src_ndim)
18535  */
18536   __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
18537   __pyx_v_itemsize = __pyx_t_1;
18538 
18539   /* "View.MemoryView":1279
18540  *     cdef size_t itemsize = src.memview.view.itemsize
18541  *     cdef int i
18542  *     cdef char order = get_best_order(&src, src_ndim)             # <<<<<<<<<<<<<<
18543  *     cdef bint broadcasting = False
18544  *     cdef bint direct_copy = False
18545  */
18546   __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
18547 
18548   /* "View.MemoryView":1280
18549  *     cdef int i
18550  *     cdef char order = get_best_order(&src, src_ndim)
18551  *     cdef bint broadcasting = False             # <<<<<<<<<<<<<<
18552  *     cdef bint direct_copy = False
18553  *     cdef __Pyx_memviewslice tmp
18554  */
18555   __pyx_v_broadcasting = 0;
18556 
18557   /* "View.MemoryView":1281
18558  *     cdef char order = get_best_order(&src, src_ndim)
18559  *     cdef bint broadcasting = False
18560  *     cdef bint direct_copy = False             # <<<<<<<<<<<<<<
18561  *     cdef __Pyx_memviewslice tmp
18562  *
18563  */
18564   __pyx_v_direct_copy = 0;
18565 
18566   /* "View.MemoryView":1284
18567  *     cdef __Pyx_memviewslice tmp
18568  *
18569  *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
18570  *         broadcast_leading(&src, src_ndim, dst_ndim)
18571  *     elif dst_ndim < src_ndim:
18572  */
18573   __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
18574   if (__pyx_t_2) {
18575 
18576     /* "View.MemoryView":1285
18577  *
18578  *     if src_ndim < dst_ndim:
18579  *         broadcast_leading(&src, src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
18580  *     elif dst_ndim < src_ndim:
18581  *         broadcast_leading(&dst, dst_ndim, src_ndim)
18582  */
18583     __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
18584 
18585     /* "View.MemoryView":1284
18586  *     cdef __Pyx_memviewslice tmp
18587  *
18588  *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
18589  *         broadcast_leading(&src, src_ndim, dst_ndim)
18590  *     elif dst_ndim < src_ndim:
18591  */
18592     goto __pyx_L3;
18593   }
18594 
18595   /* "View.MemoryView":1286
18596  *     if src_ndim < dst_ndim:
18597  *         broadcast_leading(&src, src_ndim, dst_ndim)
18598  *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
18599  *         broadcast_leading(&dst, dst_ndim, src_ndim)
18600  *
18601  */
18602   __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
18603   if (__pyx_t_2) {
18604 
18605     /* "View.MemoryView":1287
18606  *         broadcast_leading(&src, src_ndim, dst_ndim)
18607  *     elif dst_ndim < src_ndim:
18608  *         broadcast_leading(&dst, dst_ndim, src_ndim)             # <<<<<<<<<<<<<<
18609  *
18610  *     cdef int ndim = max(src_ndim, dst_ndim)
18611  */
18612     __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
18613 
18614     /* "View.MemoryView":1286
18615  *     if src_ndim < dst_ndim:
18616  *         broadcast_leading(&src, src_ndim, dst_ndim)
18617  *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
18618  *         broadcast_leading(&dst, dst_ndim, src_ndim)
18619  *
18620  */
18621   }
18622   __pyx_L3:;
18623 
18624   /* "View.MemoryView":1289
18625  *         broadcast_leading(&dst, dst_ndim, src_ndim)
18626  *
18627  *     cdef int ndim = max(src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
18628  *
18629  *     for i in range(ndim):
18630  */
18631   __pyx_t_3 = __pyx_v_dst_ndim;
18632   __pyx_t_4 = __pyx_v_src_ndim;
18633   if (((__pyx_t_3 > __pyx_t_4) != 0)) {
18634     __pyx_t_5 = __pyx_t_3;
18635   } else {
18636     __pyx_t_5 = __pyx_t_4;
18637   }
18638   __pyx_v_ndim = __pyx_t_5;
18639 
18640   /* "View.MemoryView":1291
18641  *     cdef int ndim = max(src_ndim, dst_ndim)
18642  *
18643  *     for i in range(ndim):             # <<<<<<<<<<<<<<
18644  *         if src.shape[i] != dst.shape[i]:
18645  *             if src.shape[i] == 1:
18646  */
18647   __pyx_t_5 = __pyx_v_ndim;
18648   __pyx_t_3 = __pyx_t_5;
18649   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18650     __pyx_v_i = __pyx_t_4;
18651 
18652     /* "View.MemoryView":1292
18653  *
18654  *     for i in range(ndim):
18655  *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
18656  *             if src.shape[i] == 1:
18657  *                 broadcasting = True
18658  */
18659     __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
18660     if (__pyx_t_2) {
18661 
18662       /* "View.MemoryView":1293
18663  *     for i in range(ndim):
18664  *         if src.shape[i] != dst.shape[i]:
18665  *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
18666  *                 broadcasting = True
18667  *                 src.strides[i] = 0
18668  */
18669       __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
18670       if (__pyx_t_2) {
18671 
18672         /* "View.MemoryView":1294
18673  *         if src.shape[i] != dst.shape[i]:
18674  *             if src.shape[i] == 1:
18675  *                 broadcasting = True             # <<<<<<<<<<<<<<
18676  *                 src.strides[i] = 0
18677  *             else:
18678  */
18679         __pyx_v_broadcasting = 1;
18680 
18681         /* "View.MemoryView":1295
18682  *             if src.shape[i] == 1:
18683  *                 broadcasting = True
18684  *                 src.strides[i] = 0             # <<<<<<<<<<<<<<
18685  *             else:
18686  *                 _err_extents(i, dst.shape[i], src.shape[i])
18687  */
18688         (__pyx_v_src.strides[__pyx_v_i]) = 0;
18689 
18690         /* "View.MemoryView":1293
18691  *     for i in range(ndim):
18692  *         if src.shape[i] != dst.shape[i]:
18693  *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
18694  *                 broadcasting = True
18695  *                 src.strides[i] = 0
18696  */
18697         goto __pyx_L7;
18698       }
18699 
18700       /* "View.MemoryView":1297
18701  *                 src.strides[i] = 0
18702  *             else:
18703  *                 _err_extents(i, dst.shape[i], src.shape[i])             # <<<<<<<<<<<<<<
18704  *
18705  *         if src.suboffsets[i] >= 0:
18706  */
18707       /*else*/ {
18708         __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1297, __pyx_L1_error)
18709       }
18710       __pyx_L7:;
18711 
18712       /* "View.MemoryView":1292
18713  *
18714  *     for i in range(ndim):
18715  *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
18716  *             if src.shape[i] == 1:
18717  *                 broadcasting = True
18718  */
18719     }
18720 
18721     /* "View.MemoryView":1299
18722  *                 _err_extents(i, dst.shape[i], src.shape[i])
18723  *
18724  *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
18725  *             _err_dim(ValueError, "Dimension %d is not direct", i)
18726  *
18727  */
18728     __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
18729     if (__pyx_t_2) {
18730 
18731       /* "View.MemoryView":1300
18732  *
18733  *         if src.suboffsets[i] >= 0:
18734  *             _err_dim(ValueError, "Dimension %d is not direct", i)             # <<<<<<<<<<<<<<
18735  *
18736  *     if slices_overlap(&src, &dst, ndim, itemsize):
18737  */
18738       __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1300, __pyx_L1_error)
18739 
18740       /* "View.MemoryView":1299
18741  *                 _err_extents(i, dst.shape[i], src.shape[i])
18742  *
18743  *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
18744  *             _err_dim(ValueError, "Dimension %d is not direct", i)
18745  *
18746  */
18747     }
18748   }
18749 
18750   /* "View.MemoryView":1302
18751  *             _err_dim(ValueError, "Dimension %d is not direct", i)
18752  *
18753  *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
18754  *
18755  *         if not slice_is_contig(src, order, ndim):
18756  */
18757   __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
18758   if (__pyx_t_2) {
18759 
18760     /* "View.MemoryView":1304
18761  *     if slices_overlap(&src, &dst, ndim, itemsize):
18762  *
18763  *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
18764  *             order = get_best_order(&dst, ndim)
18765  *
18766  */
18767     __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
18768     if (__pyx_t_2) {
18769 
18770       /* "View.MemoryView":1305
18771  *
18772  *         if not slice_is_contig(src, order, ndim):
18773  *             order = get_best_order(&dst, ndim)             # <<<<<<<<<<<<<<
18774  *
18775  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
18776  */
18777       __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
18778 
18779       /* "View.MemoryView":1304
18780  *     if slices_overlap(&src, &dst, ndim, itemsize):
18781  *
18782  *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
18783  *             order = get_best_order(&dst, ndim)
18784  *
18785  */
18786     }
18787 
18788     /* "View.MemoryView":1307
18789  *             order = get_best_order(&dst, ndim)
18790  *
18791  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)             # <<<<<<<<<<<<<<
18792  *         src = tmp
18793  *
18794  */
18795     __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1307, __pyx_L1_error)
18796     __pyx_v_tmpdata = __pyx_t_7;
18797 
18798     /* "View.MemoryView":1308
18799  *
18800  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
18801  *         src = tmp             # <<<<<<<<<<<<<<
18802  *
18803  *     if not broadcasting:
18804  */
18805     __pyx_v_src = __pyx_v_tmp;
18806 
18807     /* "View.MemoryView":1302
18808  *             _err_dim(ValueError, "Dimension %d is not direct", i)
18809  *
18810  *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
18811  *
18812  *         if not slice_is_contig(src, order, ndim):
18813  */
18814   }
18815 
18816   /* "View.MemoryView":1310
18817  *         src = tmp
18818  *
18819  *     if not broadcasting:             # <<<<<<<<<<<<<<
18820  *
18821  *
18822  */
18823   __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
18824   if (__pyx_t_2) {
18825 
18826     /* "View.MemoryView":1313
18827  *
18828  *
18829  *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
18830  *             direct_copy = slice_is_contig(dst, 'C', ndim)
18831  *         elif slice_is_contig(src, 'F', ndim):
18832  */
18833     __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
18834     if (__pyx_t_2) {
18835 
18836       /* "View.MemoryView":1314
18837  *
18838  *         if slice_is_contig(src, 'C', ndim):
18839  *             direct_copy = slice_is_contig(dst, 'C', ndim)             # <<<<<<<<<<<<<<
18840  *         elif slice_is_contig(src, 'F', ndim):
18841  *             direct_copy = slice_is_contig(dst, 'F', ndim)
18842  */
18843       __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);
18844 
18845       /* "View.MemoryView":1313
18846  *
18847  *
18848  *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
18849  *             direct_copy = slice_is_contig(dst, 'C', ndim)
18850  *         elif slice_is_contig(src, 'F', ndim):
18851  */
18852       goto __pyx_L12;
18853     }
18854 
18855     /* "View.MemoryView":1315
18856  *         if slice_is_contig(src, 'C', ndim):
18857  *             direct_copy = slice_is_contig(dst, 'C', ndim)
18858  *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
18859  *             direct_copy = slice_is_contig(dst, 'F', ndim)
18860  *
18861  */
18862     __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
18863     if (__pyx_t_2) {
18864 
18865       /* "View.MemoryView":1316
18866  *             direct_copy = slice_is_contig(dst, 'C', ndim)
18867  *         elif slice_is_contig(src, 'F', ndim):
18868  *             direct_copy = slice_is_contig(dst, 'F', ndim)             # <<<<<<<<<<<<<<
18869  *
18870  *         if direct_copy:
18871  */
18872       __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);
18873 
18874       /* "View.MemoryView":1315
18875  *         if slice_is_contig(src, 'C', ndim):
18876  *             direct_copy = slice_is_contig(dst, 'C', ndim)
18877  *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
18878  *             direct_copy = slice_is_contig(dst, 'F', ndim)
18879  *
18880  */
18881     }
18882     __pyx_L12:;
18883 
18884     /* "View.MemoryView":1318
18885  *             direct_copy = slice_is_contig(dst, 'F', ndim)
18886  *
18887  *         if direct_copy:             # <<<<<<<<<<<<<<
18888  *
18889  *             refcount_copying(&dst, dtype_is_object, ndim, False)
18890  */
18891     __pyx_t_2 = (__pyx_v_direct_copy != 0);
18892     if (__pyx_t_2) {
18893 
18894       /* "View.MemoryView":1320
18895  *         if direct_copy:
18896  *
18897  *             refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
18898  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
18899  *             refcount_copying(&dst, dtype_is_object, ndim, True)
18900  */
18901       __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
18902 
18903       /* "View.MemoryView":1321
18904  *
18905  *             refcount_copying(&dst, dtype_is_object, ndim, False)
18906  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))             # <<<<<<<<<<<<<<
18907  *             refcount_copying(&dst, dtype_is_object, ndim, True)
18908  *             free(tmpdata)
18909  */
18910       (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
18911 
18912       /* "View.MemoryView":1322
18913  *             refcount_copying(&dst, dtype_is_object, ndim, False)
18914  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
18915  *             refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
18916  *             free(tmpdata)
18917  *             return 0
18918  */
18919       __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
18920 
18921       /* "View.MemoryView":1323
18922  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
18923  *             refcount_copying(&dst, dtype_is_object, ndim, True)
18924  *             free(tmpdata)             # <<<<<<<<<<<<<<
18925  *             return 0
18926  *
18927  */
18928       free(__pyx_v_tmpdata);
18929 
18930       /* "View.MemoryView":1324
18931  *             refcount_copying(&dst, dtype_is_object, ndim, True)
18932  *             free(tmpdata)
18933  *             return 0             # <<<<<<<<<<<<<<
18934  *
18935  *     if order == 'F' == get_best_order(&dst, ndim):
18936  */
18937       __pyx_r = 0;
18938       goto __pyx_L0;
18939 
18940       /* "View.MemoryView":1318
18941  *             direct_copy = slice_is_contig(dst, 'F', ndim)
18942  *
18943  *         if direct_copy:             # <<<<<<<<<<<<<<
18944  *
18945  *             refcount_copying(&dst, dtype_is_object, ndim, False)
18946  */
18947     }
18948 
18949     /* "View.MemoryView":1310
18950  *         src = tmp
18951  *
18952  *     if not broadcasting:             # <<<<<<<<<<<<<<
18953  *
18954  *
18955  */
18956   }
18957 
18958   /* "View.MemoryView":1326
18959  *             return 0
18960  *
18961  *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
18962  *
18963  *
18964  */
18965   __pyx_t_2 = (__pyx_v_order == 'F');
18966   if (__pyx_t_2) {
18967     __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
18968   }
18969   __pyx_t_8 = (__pyx_t_2 != 0);
18970   if (__pyx_t_8) {
18971 
18972     /* "View.MemoryView":1329
18973  *
18974  *
18975  *         transpose_memslice(&src)             # <<<<<<<<<<<<<<
18976  *         transpose_memslice(&dst)
18977  *
18978  */
18979     __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1329, __pyx_L1_error)
18980 
18981     /* "View.MemoryView":1330
18982  *
18983  *         transpose_memslice(&src)
18984  *         transpose_memslice(&dst)             # <<<<<<<<<<<<<<
18985  *
18986  *     refcount_copying(&dst, dtype_is_object, ndim, False)
18987  */
18988     __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1330, __pyx_L1_error)
18989 
18990     /* "View.MemoryView":1326
18991  *             return 0
18992  *
18993  *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
18994  *
18995  *
18996  */
18997   }
18998 
18999   /* "View.MemoryView":1332
19000  *         transpose_memslice(&dst)
19001  *
19002  *     refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
19003  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
19004  *     refcount_copying(&dst, dtype_is_object, ndim, True)
19005  */
19006   __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
19007 
19008   /* "View.MemoryView":1333
19009  *
19010  *     refcount_copying(&dst, dtype_is_object, ndim, False)
19011  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)             # <<<<<<<<<<<<<<
19012  *     refcount_copying(&dst, dtype_is_object, ndim, True)
19013  *
19014  */
19015   copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
19016 
19017   /* "View.MemoryView":1334
19018  *     refcount_copying(&dst, dtype_is_object, ndim, False)
19019  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
19020  *     refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
19021  *
19022  *     free(tmpdata)
19023  */
19024   __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
19025 
19026   /* "View.MemoryView":1336
19027  *     refcount_copying(&dst, dtype_is_object, ndim, True)
19028  *
19029  *     free(tmpdata)             # <<<<<<<<<<<<<<
19030  *     return 0
19031  *
19032  */
19033   free(__pyx_v_tmpdata);
19034 
19035   /* "View.MemoryView":1337
19036  *
19037  *     free(tmpdata)
19038  *     return 0             # <<<<<<<<<<<<<<
19039  *
19040  * @cname('__pyx_memoryview_broadcast_leading')
19041  */
19042   __pyx_r = 0;
19043   goto __pyx_L0;
19044 
19045   /* "View.MemoryView":1268
19046  *
19047  * @cname('__pyx_memoryview_copy_contents')
19048  * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
19049  *                                   __Pyx_memviewslice dst,
19050  *                                   int src_ndim, int dst_ndim,
19051  */
19052 
19053   /* function exit code */
19054   __pyx_L1_error:;
19055   {
19056     #ifdef WITH_THREAD
19057     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19058     #endif
19059     __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
19060     #ifdef WITH_THREAD
19061     __Pyx_PyGILState_Release(__pyx_gilstate_save);
19062     #endif
19063   }
19064   __pyx_r = -1;
19065   __pyx_L0:;
19066   return __pyx_r;
19067 }
19068 
19069 /* "View.MemoryView":1340
19070  *
19071  * @cname('__pyx_memoryview_broadcast_leading')
19072  * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
19073  *                             int ndim,
19074  *                             int ndim_other) nogil:
19075  */
19076 
__pyx_memoryview_broadcast_leading(__Pyx_memviewslice * __pyx_v_mslice,int __pyx_v_ndim,int __pyx_v_ndim_other)19077 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
19078   int __pyx_v_i;
19079   int __pyx_v_offset;
19080   int __pyx_t_1;
19081   int __pyx_t_2;
19082   int __pyx_t_3;
19083 
19084   /* "View.MemoryView":1344
19085  *                             int ndim_other) nogil:
19086  *     cdef int i
19087  *     cdef int offset = ndim_other - ndim             # <<<<<<<<<<<<<<
19088  *
19089  *     for i in range(ndim - 1, -1, -1):
19090  */
19091   __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
19092 
19093   /* "View.MemoryView":1346
19094  *     cdef int offset = ndim_other - ndim
19095  *
19096  *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
19097  *         mslice.shape[i + offset] = mslice.shape[i]
19098  *         mslice.strides[i + offset] = mslice.strides[i]
19099  */
19100   for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
19101     __pyx_v_i = __pyx_t_1;
19102 
19103     /* "View.MemoryView":1347
19104  *
19105  *     for i in range(ndim - 1, -1, -1):
19106  *         mslice.shape[i + offset] = mslice.shape[i]             # <<<<<<<<<<<<<<
19107  *         mslice.strides[i + offset] = mslice.strides[i]
19108  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
19109  */
19110     (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
19111 
19112     /* "View.MemoryView":1348
19113  *     for i in range(ndim - 1, -1, -1):
19114  *         mslice.shape[i + offset] = mslice.shape[i]
19115  *         mslice.strides[i + offset] = mslice.strides[i]             # <<<<<<<<<<<<<<
19116  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
19117  *
19118  */
19119     (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
19120 
19121     /* "View.MemoryView":1349
19122  *         mslice.shape[i + offset] = mslice.shape[i]
19123  *         mslice.strides[i + offset] = mslice.strides[i]
19124  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]             # <<<<<<<<<<<<<<
19125  *
19126  *     for i in range(offset):
19127  */
19128     (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
19129   }
19130 
19131   /* "View.MemoryView":1351
19132  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
19133  *
19134  *     for i in range(offset):             # <<<<<<<<<<<<<<
19135  *         mslice.shape[i] = 1
19136  *         mslice.strides[i] = mslice.strides[0]
19137  */
19138   __pyx_t_1 = __pyx_v_offset;
19139   __pyx_t_2 = __pyx_t_1;
19140   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
19141     __pyx_v_i = __pyx_t_3;
19142 
19143     /* "View.MemoryView":1352
19144  *
19145  *     for i in range(offset):
19146  *         mslice.shape[i] = 1             # <<<<<<<<<<<<<<
19147  *         mslice.strides[i] = mslice.strides[0]
19148  *         mslice.suboffsets[i] = -1
19149  */
19150     (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
19151 
19152     /* "View.MemoryView":1353
19153  *     for i in range(offset):
19154  *         mslice.shape[i] = 1
19155  *         mslice.strides[i] = mslice.strides[0]             # <<<<<<<<<<<<<<
19156  *         mslice.suboffsets[i] = -1
19157  *
19158  */
19159     (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
19160 
19161     /* "View.MemoryView":1354
19162  *         mslice.shape[i] = 1
19163  *         mslice.strides[i] = mslice.strides[0]
19164  *         mslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
19165  *
19166  *
19167  */
19168     (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
19169   }
19170 
19171   /* "View.MemoryView":1340
19172  *
19173  * @cname('__pyx_memoryview_broadcast_leading')
19174  * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
19175  *                             int ndim,
19176  *                             int ndim_other) nogil:
19177  */
19178 
19179   /* function exit code */
19180 }
19181 
19182 /* "View.MemoryView":1362
19183  *
19184  * @cname('__pyx_memoryview_refcount_copying')
19185  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
19186  *                            int ndim, bint inc) nogil:
19187  *
19188  */
19189 
__pyx_memoryview_refcount_copying(__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_dtype_is_object,int __pyx_v_ndim,int __pyx_v_inc)19190 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
19191   int __pyx_t_1;
19192 
19193   /* "View.MemoryView":1366
19194  *
19195  *
19196  *     if dtype_is_object:             # <<<<<<<<<<<<<<
19197  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
19198  *                                            dst.strides, ndim, inc)
19199  */
19200   __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
19201   if (__pyx_t_1) {
19202 
19203     /* "View.MemoryView":1367
19204  *
19205  *     if dtype_is_object:
19206  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,             # <<<<<<<<<<<<<<
19207  *                                            dst.strides, ndim, inc)
19208  *
19209  */
19210     __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc);
19211 
19212     /* "View.MemoryView":1366
19213  *
19214  *
19215  *     if dtype_is_object:             # <<<<<<<<<<<<<<
19216  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
19217  *                                            dst.strides, ndim, inc)
19218  */
19219   }
19220 
19221   /* "View.MemoryView":1362
19222  *
19223  * @cname('__pyx_memoryview_refcount_copying')
19224  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
19225  *                            int ndim, bint inc) nogil:
19226  *
19227  */
19228 
19229   /* function exit code */
19230 }
19231 
19232 /* "View.MemoryView":1371
19233  *
19234  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
19235  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
19236  *                                              Py_ssize_t *strides, int ndim,
19237  *                                              bint inc) with gil:
19238  */
19239 
__pyx_memoryview_refcount_objects_in_slice_with_gil(char * __pyx_v_data,Py_ssize_t * __pyx_v_shape,Py_ssize_t * __pyx_v_strides,int __pyx_v_ndim,int __pyx_v_inc)19240 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
19241   __Pyx_RefNannyDeclarations
19242   #ifdef WITH_THREAD
19243   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19244   #endif
19245   __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);
19246 
19247   /* "View.MemoryView":1374
19248  *                                              Py_ssize_t *strides, int ndim,
19249  *                                              bint inc) with gil:
19250  *     refcount_objects_in_slice(data, shape, strides, ndim, inc)             # <<<<<<<<<<<<<<
19251  *
19252  * @cname('__pyx_memoryview_refcount_objects_in_slice')
19253  */
19254   __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
19255 
19256   /* "View.MemoryView":1371
19257  *
19258  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
19259  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
19260  *                                              Py_ssize_t *strides, int ndim,
19261  *                                              bint inc) with gil:
19262  */
19263 
19264   /* function exit code */
19265   __Pyx_RefNannyFinishContext();
19266   #ifdef WITH_THREAD
19267   __Pyx_PyGILState_Release(__pyx_gilstate_save);
19268   #endif
19269 }
19270 
19271 /* "View.MemoryView":1377
19272  *
19273  * @cname('__pyx_memoryview_refcount_objects_in_slice')
19274  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
19275  *                                     Py_ssize_t *strides, int ndim, bint inc):
19276  *     cdef Py_ssize_t i
19277  */
19278 
__pyx_memoryview_refcount_objects_in_slice(char * __pyx_v_data,Py_ssize_t * __pyx_v_shape,Py_ssize_t * __pyx_v_strides,int __pyx_v_ndim,int __pyx_v_inc)19279 static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
19280   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
19281   __Pyx_RefNannyDeclarations
19282   Py_ssize_t __pyx_t_1;
19283   Py_ssize_t __pyx_t_2;
19284   Py_ssize_t __pyx_t_3;
19285   int __pyx_t_4;
19286   __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);
19287 
19288   /* "View.MemoryView":1381
19289  *     cdef Py_ssize_t i
19290  *
19291  *     for i in range(shape[0]):             # <<<<<<<<<<<<<<
19292  *         if ndim == 1:
19293  *             if inc:
19294  */
19295   __pyx_t_1 = (__pyx_v_shape[0]);
19296   __pyx_t_2 = __pyx_t_1;
19297   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
19298     __pyx_v_i = __pyx_t_3;
19299 
19300     /* "View.MemoryView":1382
19301  *
19302  *     for i in range(shape[0]):
19303  *         if ndim == 1:             # <<<<<<<<<<<<<<
19304  *             if inc:
19305  *                 Py_INCREF((<PyObject **> data)[0])
19306  */
19307     __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
19308     if (__pyx_t_4) {
19309 
19310       /* "View.MemoryView":1383
19311  *     for i in range(shape[0]):
19312  *         if ndim == 1:
19313  *             if inc:             # <<<<<<<<<<<<<<
19314  *                 Py_INCREF((<PyObject **> data)[0])
19315  *             else:
19316  */
19317       __pyx_t_4 = (__pyx_v_inc != 0);
19318       if (__pyx_t_4) {
19319 
19320         /* "View.MemoryView":1384
19321  *         if ndim == 1:
19322  *             if inc:
19323  *                 Py_INCREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
19324  *             else:
19325  *                 Py_DECREF((<PyObject **> data)[0])
19326  */
19327         Py_INCREF((((PyObject **)__pyx_v_data)[0]));
19328 
19329         /* "View.MemoryView":1383
19330  *     for i in range(shape[0]):
19331  *         if ndim == 1:
19332  *             if inc:             # <<<<<<<<<<<<<<
19333  *                 Py_INCREF((<PyObject **> data)[0])
19334  *             else:
19335  */
19336         goto __pyx_L6;
19337       }
19338 
19339       /* "View.MemoryView":1386
19340  *                 Py_INCREF((<PyObject **> data)[0])
19341  *             else:
19342  *                 Py_DECREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
19343  *         else:
19344  *             refcount_objects_in_slice(data, shape + 1, strides + 1,
19345  */
19346       /*else*/ {
19347         Py_DECREF((((PyObject **)__pyx_v_data)[0]));
19348       }
19349       __pyx_L6:;
19350 
19351       /* "View.MemoryView":1382
19352  *
19353  *     for i in range(shape[0]):
19354  *         if ndim == 1:             # <<<<<<<<<<<<<<
19355  *             if inc:
19356  *                 Py_INCREF((<PyObject **> data)[0])
19357  */
19358       goto __pyx_L5;
19359     }
19360 
19361     /* "View.MemoryView":1388
19362  *                 Py_DECREF((<PyObject **> data)[0])
19363  *         else:
19364  *             refcount_objects_in_slice(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
19365  *                                       ndim - 1, inc)
19366  *
19367  */
19368     /*else*/ {
19369 
19370       /* "View.MemoryView":1389
19371  *         else:
19372  *             refcount_objects_in_slice(data, shape + 1, strides + 1,
19373  *                                       ndim - 1, inc)             # <<<<<<<<<<<<<<
19374  *
19375  *         data += strides[0]
19376  */
19377       __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
19378     }
19379     __pyx_L5:;
19380 
19381     /* "View.MemoryView":1391
19382  *                                       ndim - 1, inc)
19383  *
19384  *         data += strides[0]             # <<<<<<<<<<<<<<
19385  *
19386  *
19387  */
19388     __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
19389   }
19390 
19391   /* "View.MemoryView":1377
19392  *
19393  * @cname('__pyx_memoryview_refcount_objects_in_slice')
19394  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
19395  *                                     Py_ssize_t *strides, int ndim, bint inc):
19396  *     cdef Py_ssize_t i
19397  */
19398 
19399   /* function exit code */
19400   __Pyx_RefNannyFinishContext();
19401 }
19402 
19403 /* "View.MemoryView":1397
19404  *
19405  * @cname('__pyx_memoryview_slice_assign_scalar')
19406  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
19407  *                               size_t itemsize, void *item,
19408  *                               bint dtype_is_object) nogil:
19409  */
19410 
__pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_ndim,size_t __pyx_v_itemsize,void * __pyx_v_item,int __pyx_v_dtype_is_object)19411 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) {
19412 
19413   /* "View.MemoryView":1400
19414  *                               size_t itemsize, void *item,
19415  *                               bint dtype_is_object) nogil:
19416  *     refcount_copying(dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
19417  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
19418  *                          itemsize, item)
19419  */
19420   __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
19421 
19422   /* "View.MemoryView":1401
19423  *                               bint dtype_is_object) nogil:
19424  *     refcount_copying(dst, dtype_is_object, ndim, False)
19425  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,             # <<<<<<<<<<<<<<
19426  *                          itemsize, item)
19427  *     refcount_copying(dst, dtype_is_object, ndim, True)
19428  */
19429   __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item);
19430 
19431   /* "View.MemoryView":1403
19432  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
19433  *                          itemsize, item)
19434  *     refcount_copying(dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
19435  *
19436  *
19437  */
19438   __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
19439 
19440   /* "View.MemoryView":1397
19441  *
19442  * @cname('__pyx_memoryview_slice_assign_scalar')
19443  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
19444  *                               size_t itemsize, void *item,
19445  *                               bint dtype_is_object) nogil:
19446  */
19447 
19448   /* function exit code */
19449 }
19450 
19451 /* "View.MemoryView":1407
19452  *
19453  * @cname('__pyx_memoryview__slice_assign_scalar')
19454  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
19455  *                               Py_ssize_t *strides, int ndim,
19456  *                               size_t itemsize, void *item) nogil:
19457  */
19458 
__pyx_memoryview__slice_assign_scalar(char * __pyx_v_data,Py_ssize_t * __pyx_v_shape,Py_ssize_t * __pyx_v_strides,int __pyx_v_ndim,size_t __pyx_v_itemsize,void * __pyx_v_item)19459 static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) {
19460   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
19461   Py_ssize_t __pyx_v_stride;
19462   Py_ssize_t __pyx_v_extent;
19463   int __pyx_t_1;
19464   Py_ssize_t __pyx_t_2;
19465   Py_ssize_t __pyx_t_3;
19466   Py_ssize_t __pyx_t_4;
19467 
19468   /* "View.MemoryView":1411
19469  *                               size_t itemsize, void *item) nogil:
19470  *     cdef Py_ssize_t i
19471  *     cdef Py_ssize_t stride = strides[0]             # <<<<<<<<<<<<<<
19472  *     cdef Py_ssize_t extent = shape[0]
19473  *
19474  */
19475   __pyx_v_stride = (__pyx_v_strides[0]);
19476 
19477   /* "View.MemoryView":1412
19478  *     cdef Py_ssize_t i
19479  *     cdef Py_ssize_t stride = strides[0]
19480  *     cdef Py_ssize_t extent = shape[0]             # <<<<<<<<<<<<<<
19481  *
19482  *     if ndim == 1:
19483  */
19484   __pyx_v_extent = (__pyx_v_shape[0]);
19485 
19486   /* "View.MemoryView":1414
19487  *     cdef Py_ssize_t extent = shape[0]
19488  *
19489  *     if ndim == 1:             # <<<<<<<<<<<<<<
19490  *         for i in range(extent):
19491  *             memcpy(data, item, itemsize)
19492  */
19493   __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
19494   if (__pyx_t_1) {
19495 
19496     /* "View.MemoryView":1415
19497  *
19498  *     if ndim == 1:
19499  *         for i in range(extent):             # <<<<<<<<<<<<<<
19500  *             memcpy(data, item, itemsize)
19501  *             data += stride
19502  */
19503     __pyx_t_2 = __pyx_v_extent;
19504     __pyx_t_3 = __pyx_t_2;
19505     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19506       __pyx_v_i = __pyx_t_4;
19507 
19508       /* "View.MemoryView":1416
19509  *     if ndim == 1:
19510  *         for i in range(extent):
19511  *             memcpy(data, item, itemsize)             # <<<<<<<<<<<<<<
19512  *             data += stride
19513  *     else:
19514  */
19515       (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
19516 
19517       /* "View.MemoryView":1417
19518  *         for i in range(extent):
19519  *             memcpy(data, item, itemsize)
19520  *             data += stride             # <<<<<<<<<<<<<<
19521  *     else:
19522  *         for i in range(extent):
19523  */
19524       __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
19525     }
19526 
19527     /* "View.MemoryView":1414
19528  *     cdef Py_ssize_t extent = shape[0]
19529  *
19530  *     if ndim == 1:             # <<<<<<<<<<<<<<
19531  *         for i in range(extent):
19532  *             memcpy(data, item, itemsize)
19533  */
19534     goto __pyx_L3;
19535   }
19536 
19537   /* "View.MemoryView":1419
19538  *             data += stride
19539  *     else:
19540  *         for i in range(extent):             # <<<<<<<<<<<<<<
19541  *             _slice_assign_scalar(data, shape + 1, strides + 1,
19542  *                                 ndim - 1, itemsize, item)
19543  */
19544   /*else*/ {
19545     __pyx_t_2 = __pyx_v_extent;
19546     __pyx_t_3 = __pyx_t_2;
19547     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19548       __pyx_v_i = __pyx_t_4;
19549 
19550       /* "View.MemoryView":1420
19551  *     else:
19552  *         for i in range(extent):
19553  *             _slice_assign_scalar(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
19554  *                                 ndim - 1, itemsize, item)
19555  *             data += stride
19556  */
19557       __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item);
19558 
19559       /* "View.MemoryView":1422
19560  *             _slice_assign_scalar(data, shape + 1, strides + 1,
19561  *                                 ndim - 1, itemsize, item)
19562  *             data += stride             # <<<<<<<<<<<<<<
19563  *
19564  *
19565  */
19566       __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
19567     }
19568   }
19569   __pyx_L3:;
19570 
19571   /* "View.MemoryView":1407
19572  *
19573  * @cname('__pyx_memoryview__slice_assign_scalar')
19574  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
19575  *                               Py_ssize_t *strides, int ndim,
19576  *                               size_t itemsize, void *item) nogil:
19577  */
19578 
19579   /* function exit code */
19580 }
19581 
19582 /* "(tree fragment)":1
19583  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
19584  *     cdef object __pyx_PickleError
19585  *     cdef object __pyx_result
19586  */
19587 
19588 /* Python wrapper */
19589 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
19590 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)19591 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
19592   PyObject *__pyx_v___pyx_type = 0;
19593   long __pyx_v___pyx_checksum;
19594   PyObject *__pyx_v___pyx_state = 0;
19595   int __pyx_lineno = 0;
19596   const char *__pyx_filename = NULL;
19597   int __pyx_clineno = 0;
19598   PyObject *__pyx_r = 0;
19599   __Pyx_RefNannyDeclarations
19600   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
19601   {
19602     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
19603     PyObject* values[3] = {0,0,0};
19604     if (unlikely(__pyx_kwds)) {
19605       Py_ssize_t kw_args;
19606       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19607       switch (pos_args) {
19608         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19609         CYTHON_FALLTHROUGH;
19610         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19611         CYTHON_FALLTHROUGH;
19612         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19613         CYTHON_FALLTHROUGH;
19614         case  0: break;
19615         default: goto __pyx_L5_argtuple_error;
19616       }
19617       kw_args = PyDict_Size(__pyx_kwds);
19618       switch (pos_args) {
19619         case  0:
19620         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
19621         else goto __pyx_L5_argtuple_error;
19622         CYTHON_FALLTHROUGH;
19623         case  1:
19624         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
19625         else {
19626           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error)
19627         }
19628         CYTHON_FALLTHROUGH;
19629         case  2:
19630         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
19631         else {
19632           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error)
19633         }
19634       }
19635       if (unlikely(kw_args > 0)) {
19636         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error)
19637       }
19638     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
19639       goto __pyx_L5_argtuple_error;
19640     } else {
19641       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19642       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19643       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19644     }
19645     __pyx_v___pyx_type = values[0];
19646     __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error)
19647     __pyx_v___pyx_state = values[2];
19648   }
19649   goto __pyx_L4_argument_unpacking_done;
19650   __pyx_L5_argtuple_error:;
19651   __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error)
19652   __pyx_L3_error:;
19653   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
19654   __Pyx_RefNannyFinishContext();
19655   return NULL;
19656   __pyx_L4_argument_unpacking_done:;
19657   __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
19658 
19659   /* function exit code */
19660   __Pyx_RefNannyFinishContext();
19661   return __pyx_r;
19662 }
19663 
__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v___pyx_type,long __pyx_v___pyx_checksum,PyObject * __pyx_v___pyx_state)19664 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
19665   PyObject *__pyx_v___pyx_PickleError = 0;
19666   PyObject *__pyx_v___pyx_result = 0;
19667   PyObject *__pyx_r = NULL;
19668   __Pyx_RefNannyDeclarations
19669   int __pyx_t_1;
19670   PyObject *__pyx_t_2 = NULL;
19671   PyObject *__pyx_t_3 = NULL;
19672   PyObject *__pyx_t_4 = NULL;
19673   PyObject *__pyx_t_5 = NULL;
19674   int __pyx_t_6;
19675   int __pyx_lineno = 0;
19676   const char *__pyx_filename = NULL;
19677   int __pyx_clineno = 0;
19678   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);
19679 
19680   /* "(tree fragment)":4
19681  *     cdef object __pyx_PickleError
19682  *     cdef object __pyx_result
19683  *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
19684  *         from pickle import PickleError as __pyx_PickleError
19685  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
19686  */
19687   __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
19688   if (__pyx_t_1) {
19689 
19690     /* "(tree fragment)":5
19691  *     cdef object __pyx_result
19692  *     if __pyx_checksum != 0xb068931:
19693  *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
19694  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
19695  *     __pyx_result = Enum.__new__(__pyx_type)
19696  */
19697     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
19698     __Pyx_GOTREF(__pyx_t_2);
19699     __Pyx_INCREF(__pyx_n_s_PickleError);
19700     __Pyx_GIVEREF(__pyx_n_s_PickleError);
19701     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
19702     __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
19703     __Pyx_GOTREF(__pyx_t_3);
19704     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19705     __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
19706     __Pyx_GOTREF(__pyx_t_2);
19707     __Pyx_INCREF(__pyx_t_2);
19708     __pyx_v___pyx_PickleError = __pyx_t_2;
19709     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19710     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19711 
19712     /* "(tree fragment)":6
19713  *     if __pyx_checksum != 0xb068931:
19714  *         from pickle import PickleError as __pyx_PickleError
19715  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)             # <<<<<<<<<<<<<<
19716  *     __pyx_result = Enum.__new__(__pyx_type)
19717  *     if __pyx_state is not None:
19718  */
19719     __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 6, __pyx_L1_error)
19720     __Pyx_GOTREF(__pyx_t_2);
19721     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error)
19722     __Pyx_GOTREF(__pyx_t_4);
19723     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19724     __Pyx_INCREF(__pyx_v___pyx_PickleError);
19725     __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
19726     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
19727       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
19728       if (likely(__pyx_t_5)) {
19729         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
19730         __Pyx_INCREF(__pyx_t_5);
19731         __Pyx_INCREF(function);
19732         __Pyx_DECREF_SET(__pyx_t_2, function);
19733       }
19734     }
19735     __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
19736     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
19737     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19738     if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 6, __pyx_L1_error)
19739     __Pyx_GOTREF(__pyx_t_3);
19740     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19741     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
19742     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19743     __PYX_ERR(2, 6, __pyx_L1_error)
19744 
19745     /* "(tree fragment)":4
19746  *     cdef object __pyx_PickleError
19747  *     cdef object __pyx_result
19748  *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
19749  *         from pickle import PickleError as __pyx_PickleError
19750  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
19751  */
19752   }
19753 
19754   /* "(tree fragment)":7
19755  *         from pickle import PickleError as __pyx_PickleError
19756  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
19757  *     __pyx_result = Enum.__new__(__pyx_type)             # <<<<<<<<<<<<<<
19758  *     if __pyx_state is not None:
19759  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
19760  */
19761   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 7, __pyx_L1_error)
19762   __Pyx_GOTREF(__pyx_t_2);
19763   __pyx_t_4 = NULL;
19764   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
19765     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
19766     if (likely(__pyx_t_4)) {
19767       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
19768       __Pyx_INCREF(__pyx_t_4);
19769       __Pyx_INCREF(function);
19770       __Pyx_DECREF_SET(__pyx_t_2, function);
19771     }
19772   }
19773   __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
19774   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
19775   if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error)
19776   __Pyx_GOTREF(__pyx_t_3);
19777   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19778   __pyx_v___pyx_result = __pyx_t_3;
19779   __pyx_t_3 = 0;
19780 
19781   /* "(tree fragment)":8
19782  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
19783  *     __pyx_result = Enum.__new__(__pyx_type)
19784  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
19785  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
19786  *     return __pyx_result
19787  */
19788   __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
19789   __pyx_t_6 = (__pyx_t_1 != 0);
19790   if (__pyx_t_6) {
19791 
19792     /* "(tree fragment)":9
19793  *     __pyx_result = Enum.__new__(__pyx_type)
19794  *     if __pyx_state is not None:
19795  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
19796  *     return __pyx_result
19797  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
19798  */
19799     if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 9, __pyx_L1_error)
19800     __pyx_t_3 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 9, __pyx_L1_error)
19801     __Pyx_GOTREF(__pyx_t_3);
19802     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19803 
19804     /* "(tree fragment)":8
19805  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
19806  *     __pyx_result = Enum.__new__(__pyx_type)
19807  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
19808  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
19809  *     return __pyx_result
19810  */
19811   }
19812 
19813   /* "(tree fragment)":10
19814  *     if __pyx_state is not None:
19815  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
19816  *     return __pyx_result             # <<<<<<<<<<<<<<
19817  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
19818  *     __pyx_result.name = __pyx_state[0]
19819  */
19820   __Pyx_XDECREF(__pyx_r);
19821   __Pyx_INCREF(__pyx_v___pyx_result);
19822   __pyx_r = __pyx_v___pyx_result;
19823   goto __pyx_L0;
19824 
19825   /* "(tree fragment)":1
19826  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
19827  *     cdef object __pyx_PickleError
19828  *     cdef object __pyx_result
19829  */
19830 
19831   /* function exit code */
19832   __pyx_L1_error:;
19833   __Pyx_XDECREF(__pyx_t_2);
19834   __Pyx_XDECREF(__pyx_t_3);
19835   __Pyx_XDECREF(__pyx_t_4);
19836   __Pyx_XDECREF(__pyx_t_5);
19837   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
19838   __pyx_r = NULL;
19839   __pyx_L0:;
19840   __Pyx_XDECREF(__pyx_v___pyx_PickleError);
19841   __Pyx_XDECREF(__pyx_v___pyx_result);
19842   __Pyx_XGIVEREF(__pyx_r);
19843   __Pyx_RefNannyFinishContext();
19844   return __pyx_r;
19845 }
19846 
19847 /* "(tree fragment)":11
19848  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
19849  *     return __pyx_result
19850  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
19851  *     __pyx_result.name = __pyx_state[0]
19852  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
19853  */
19854 
__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)19855 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
19856   PyObject *__pyx_r = NULL;
19857   __Pyx_RefNannyDeclarations
19858   PyObject *__pyx_t_1 = NULL;
19859   int __pyx_t_2;
19860   Py_ssize_t __pyx_t_3;
19861   int __pyx_t_4;
19862   int __pyx_t_5;
19863   PyObject *__pyx_t_6 = NULL;
19864   PyObject *__pyx_t_7 = NULL;
19865   PyObject *__pyx_t_8 = NULL;
19866   int __pyx_lineno = 0;
19867   const char *__pyx_filename = NULL;
19868   int __pyx_clineno = 0;
19869   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);
19870 
19871   /* "(tree fragment)":12
19872  *     return __pyx_result
19873  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
19874  *     __pyx_result.name = __pyx_state[0]             # <<<<<<<<<<<<<<
19875  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
19876  *         __pyx_result.__dict__.update(__pyx_state[1])
19877  */
19878   if (unlikely(__pyx_v___pyx_state == Py_None)) {
19879     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
19880     __PYX_ERR(2, 12, __pyx_L1_error)
19881   }
19882   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
19883   __Pyx_GOTREF(__pyx_t_1);
19884   __Pyx_GIVEREF(__pyx_t_1);
19885   __Pyx_GOTREF(__pyx_v___pyx_result->name);
19886   __Pyx_DECREF(__pyx_v___pyx_result->name);
19887   __pyx_v___pyx_result->name = __pyx_t_1;
19888   __pyx_t_1 = 0;
19889 
19890   /* "(tree fragment)":13
19891  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
19892  *     __pyx_result.name = __pyx_state[0]
19893  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
19894  *         __pyx_result.__dict__.update(__pyx_state[1])
19895  */
19896   if (unlikely(__pyx_v___pyx_state == Py_None)) {
19897     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
19898     __PYX_ERR(2, 13, __pyx_L1_error)
19899   }
19900   __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
19901   __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
19902   if (__pyx_t_4) {
19903   } else {
19904     __pyx_t_2 = __pyx_t_4;
19905     goto __pyx_L4_bool_binop_done;
19906   }
19907   __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
19908   __pyx_t_5 = (__pyx_t_4 != 0);
19909   __pyx_t_2 = __pyx_t_5;
19910   __pyx_L4_bool_binop_done:;
19911   if (__pyx_t_2) {
19912 
19913     /* "(tree fragment)":14
19914  *     __pyx_result.name = __pyx_state[0]
19915  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
19916  *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
19917  */
19918     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error)
19919     __Pyx_GOTREF(__pyx_t_6);
19920     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 14, __pyx_L1_error)
19921     __Pyx_GOTREF(__pyx_t_7);
19922     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
19923     if (unlikely(__pyx_v___pyx_state == Py_None)) {
19924       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
19925       __PYX_ERR(2, 14, __pyx_L1_error)
19926     }
19927     __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error)
19928     __Pyx_GOTREF(__pyx_t_6);
19929     __pyx_t_8 = NULL;
19930     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
19931       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
19932       if (likely(__pyx_t_8)) {
19933         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
19934         __Pyx_INCREF(__pyx_t_8);
19935         __Pyx_INCREF(function);
19936         __Pyx_DECREF_SET(__pyx_t_7, function);
19937       }
19938     }
19939     __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
19940     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
19941     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
19942     if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error)
19943     __Pyx_GOTREF(__pyx_t_1);
19944     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
19945     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19946 
19947     /* "(tree fragment)":13
19948  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
19949  *     __pyx_result.name = __pyx_state[0]
19950  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
19951  *         __pyx_result.__dict__.update(__pyx_state[1])
19952  */
19953   }
19954 
19955   /* "(tree fragment)":11
19956  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
19957  *     return __pyx_result
19958  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
19959  *     __pyx_result.name = __pyx_state[0]
19960  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
19961  */
19962 
19963   /* function exit code */
19964   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19965   goto __pyx_L0;
19966   __pyx_L1_error:;
19967   __Pyx_XDECREF(__pyx_t_1);
19968   __Pyx_XDECREF(__pyx_t_6);
19969   __Pyx_XDECREF(__pyx_t_7);
19970   __Pyx_XDECREF(__pyx_t_8);
19971   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
19972   __pyx_r = 0;
19973   __pyx_L0:;
19974   __Pyx_XGIVEREF(__pyx_r);
19975   __Pyx_RefNannyFinishContext();
19976   return __pyx_r;
19977 }
19978 static struct __pyx_vtabstruct_array __pyx_vtable_array;
19979 
__pyx_tp_new_array(PyTypeObject * t,PyObject * a,PyObject * k)19980 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
19981   struct __pyx_array_obj *p;
19982   PyObject *o;
19983   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
19984     o = (*t->tp_alloc)(t, 0);
19985   } else {
19986     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
19987   }
19988   if (unlikely(!o)) return 0;
19989   p = ((struct __pyx_array_obj *)o);
19990   p->__pyx_vtab = __pyx_vtabptr_array;
19991   p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
19992   p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
19993   if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
19994   return o;
19995   bad:
19996   Py_DECREF(o); o = 0;
19997   return NULL;
19998 }
19999 
__pyx_tp_dealloc_array(PyObject * o)20000 static void __pyx_tp_dealloc_array(PyObject *o) {
20001   struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
20002   #if CYTHON_USE_TP_FINALIZE
20003   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
20004     if (PyObject_CallFinalizerFromDealloc(o)) return;
20005   }
20006   #endif
20007   {
20008     PyObject *etype, *eval, *etb;
20009     PyErr_Fetch(&etype, &eval, &etb);
20010     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
20011     __pyx_array___dealloc__(o);
20012     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
20013     PyErr_Restore(etype, eval, etb);
20014   }
20015   Py_CLEAR(p->mode);
20016   Py_CLEAR(p->_format);
20017   (*Py_TYPE(o)->tp_free)(o);
20018 }
__pyx_sq_item_array(PyObject * o,Py_ssize_t i)20019 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
20020   PyObject *r;
20021   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
20022   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
20023   Py_DECREF(x);
20024   return r;
20025 }
20026 
__pyx_mp_ass_subscript_array(PyObject * o,PyObject * i,PyObject * v)20027 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
20028   if (v) {
20029     return __pyx_array___setitem__(o, i, v);
20030   }
20031   else {
20032     PyErr_Format(PyExc_NotImplementedError,
20033       "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
20034     return -1;
20035   }
20036 }
20037 
__pyx_tp_getattro_array(PyObject * o,PyObject * n)20038 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
20039   PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
20040   if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
20041     PyErr_Clear();
20042     v = __pyx_array___getattr__(o, n);
20043   }
20044   return v;
20045 }
20046 
__pyx_getprop___pyx_array_memview(PyObject * o,CYTHON_UNUSED void * x)20047 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
20048   return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
20049 }
20050 
20051 static PyMethodDef __pyx_methods_array[] = {
20052   {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
20053   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
20054   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
20055   {0, 0, 0, 0}
20056 };
20057 
20058 static struct PyGetSetDef __pyx_getsets_array[] = {
20059   {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
20060   {0, 0, 0, 0, 0}
20061 };
20062 
20063 static PySequenceMethods __pyx_tp_as_sequence_array = {
20064   __pyx_array___len__, /*sq_length*/
20065   0, /*sq_concat*/
20066   0, /*sq_repeat*/
20067   __pyx_sq_item_array, /*sq_item*/
20068   0, /*sq_slice*/
20069   0, /*sq_ass_item*/
20070   0, /*sq_ass_slice*/
20071   0, /*sq_contains*/
20072   0, /*sq_inplace_concat*/
20073   0, /*sq_inplace_repeat*/
20074 };
20075 
20076 static PyMappingMethods __pyx_tp_as_mapping_array = {
20077   __pyx_array___len__, /*mp_length*/
20078   __pyx_array___getitem__, /*mp_subscript*/
20079   __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
20080 };
20081 
20082 static PyBufferProcs __pyx_tp_as_buffer_array = {
20083   #if PY_MAJOR_VERSION < 3
20084   0, /*bf_getreadbuffer*/
20085   #endif
20086   #if PY_MAJOR_VERSION < 3
20087   0, /*bf_getwritebuffer*/
20088   #endif
20089   #if PY_MAJOR_VERSION < 3
20090   0, /*bf_getsegcount*/
20091   #endif
20092   #if PY_MAJOR_VERSION < 3
20093   0, /*bf_getcharbuffer*/
20094   #endif
20095   __pyx_array_getbuffer, /*bf_getbuffer*/
20096   0, /*bf_releasebuffer*/
20097 };
20098 
20099 static PyTypeObject __pyx_type___pyx_array = {
20100   PyVarObject_HEAD_INIT(0, 0)
20101   "dipy.tracking.localtrack.array", /*tp_name*/
20102   sizeof(struct __pyx_array_obj), /*tp_basicsize*/
20103   0, /*tp_itemsize*/
20104   __pyx_tp_dealloc_array, /*tp_dealloc*/
20105   #if PY_VERSION_HEX < 0x030800b4
20106   0, /*tp_print*/
20107   #endif
20108   #if PY_VERSION_HEX >= 0x030800b4
20109   0, /*tp_vectorcall_offset*/
20110   #endif
20111   0, /*tp_getattr*/
20112   0, /*tp_setattr*/
20113   #if PY_MAJOR_VERSION < 3
20114   0, /*tp_compare*/
20115   #endif
20116   #if PY_MAJOR_VERSION >= 3
20117   0, /*tp_as_async*/
20118   #endif
20119   0, /*tp_repr*/
20120   0, /*tp_as_number*/
20121   &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
20122   &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
20123   0, /*tp_hash*/
20124   0, /*tp_call*/
20125   0, /*tp_str*/
20126   __pyx_tp_getattro_array, /*tp_getattro*/
20127   0, /*tp_setattro*/
20128   &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
20129   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
20130   0, /*tp_doc*/
20131   0, /*tp_traverse*/
20132   0, /*tp_clear*/
20133   0, /*tp_richcompare*/
20134   0, /*tp_weaklistoffset*/
20135   0, /*tp_iter*/
20136   0, /*tp_iternext*/
20137   __pyx_methods_array, /*tp_methods*/
20138   0, /*tp_members*/
20139   __pyx_getsets_array, /*tp_getset*/
20140   0, /*tp_base*/
20141   0, /*tp_dict*/
20142   0, /*tp_descr_get*/
20143   0, /*tp_descr_set*/
20144   0, /*tp_dictoffset*/
20145   0, /*tp_init*/
20146   0, /*tp_alloc*/
20147   __pyx_tp_new_array, /*tp_new*/
20148   0, /*tp_free*/
20149   0, /*tp_is_gc*/
20150   0, /*tp_bases*/
20151   0, /*tp_mro*/
20152   0, /*tp_cache*/
20153   0, /*tp_subclasses*/
20154   0, /*tp_weaklist*/
20155   0, /*tp_del*/
20156   0, /*tp_version_tag*/
20157   #if PY_VERSION_HEX >= 0x030400a1
20158   0, /*tp_finalize*/
20159   #endif
20160   #if PY_VERSION_HEX >= 0x030800b1
20161   0, /*tp_vectorcall*/
20162   #endif
20163   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20164   0, /*tp_print*/
20165   #endif
20166 };
20167 
__pyx_tp_new_Enum(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)20168 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
20169   struct __pyx_MemviewEnum_obj *p;
20170   PyObject *o;
20171   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20172     o = (*t->tp_alloc)(t, 0);
20173   } else {
20174     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20175   }
20176   if (unlikely(!o)) return 0;
20177   p = ((struct __pyx_MemviewEnum_obj *)o);
20178   p->name = Py_None; Py_INCREF(Py_None);
20179   return o;
20180 }
20181 
__pyx_tp_dealloc_Enum(PyObject * o)20182 static void __pyx_tp_dealloc_Enum(PyObject *o) {
20183   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
20184   #if CYTHON_USE_TP_FINALIZE
20185   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
20186     if (PyObject_CallFinalizerFromDealloc(o)) return;
20187   }
20188   #endif
20189   PyObject_GC_UnTrack(o);
20190   Py_CLEAR(p->name);
20191   (*Py_TYPE(o)->tp_free)(o);
20192 }
20193 
__pyx_tp_traverse_Enum(PyObject * o,visitproc v,void * a)20194 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
20195   int e;
20196   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
20197   if (p->name) {
20198     e = (*v)(p->name, a); if (e) return e;
20199   }
20200   return 0;
20201 }
20202 
__pyx_tp_clear_Enum(PyObject * o)20203 static int __pyx_tp_clear_Enum(PyObject *o) {
20204   PyObject* tmp;
20205   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
20206   tmp = ((PyObject*)p->name);
20207   p->name = Py_None; Py_INCREF(Py_None);
20208   Py_XDECREF(tmp);
20209   return 0;
20210 }
20211 
20212 static PyMethodDef __pyx_methods_Enum[] = {
20213   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
20214   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
20215   {0, 0, 0, 0}
20216 };
20217 
20218 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
20219   PyVarObject_HEAD_INIT(0, 0)
20220   "dipy.tracking.localtrack.Enum", /*tp_name*/
20221   sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
20222   0, /*tp_itemsize*/
20223   __pyx_tp_dealloc_Enum, /*tp_dealloc*/
20224   #if PY_VERSION_HEX < 0x030800b4
20225   0, /*tp_print*/
20226   #endif
20227   #if PY_VERSION_HEX >= 0x030800b4
20228   0, /*tp_vectorcall_offset*/
20229   #endif
20230   0, /*tp_getattr*/
20231   0, /*tp_setattr*/
20232   #if PY_MAJOR_VERSION < 3
20233   0, /*tp_compare*/
20234   #endif
20235   #if PY_MAJOR_VERSION >= 3
20236   0, /*tp_as_async*/
20237   #endif
20238   __pyx_MemviewEnum___repr__, /*tp_repr*/
20239   0, /*tp_as_number*/
20240   0, /*tp_as_sequence*/
20241   0, /*tp_as_mapping*/
20242   0, /*tp_hash*/
20243   0, /*tp_call*/
20244   0, /*tp_str*/
20245   0, /*tp_getattro*/
20246   0, /*tp_setattro*/
20247   0, /*tp_as_buffer*/
20248   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
20249   0, /*tp_doc*/
20250   __pyx_tp_traverse_Enum, /*tp_traverse*/
20251   __pyx_tp_clear_Enum, /*tp_clear*/
20252   0, /*tp_richcompare*/
20253   0, /*tp_weaklistoffset*/
20254   0, /*tp_iter*/
20255   0, /*tp_iternext*/
20256   __pyx_methods_Enum, /*tp_methods*/
20257   0, /*tp_members*/
20258   0, /*tp_getset*/
20259   0, /*tp_base*/
20260   0, /*tp_dict*/
20261   0, /*tp_descr_get*/
20262   0, /*tp_descr_set*/
20263   0, /*tp_dictoffset*/
20264   __pyx_MemviewEnum___init__, /*tp_init*/
20265   0, /*tp_alloc*/
20266   __pyx_tp_new_Enum, /*tp_new*/
20267   0, /*tp_free*/
20268   0, /*tp_is_gc*/
20269   0, /*tp_bases*/
20270   0, /*tp_mro*/
20271   0, /*tp_cache*/
20272   0, /*tp_subclasses*/
20273   0, /*tp_weaklist*/
20274   0, /*tp_del*/
20275   0, /*tp_version_tag*/
20276   #if PY_VERSION_HEX >= 0x030400a1
20277   0, /*tp_finalize*/
20278   #endif
20279   #if PY_VERSION_HEX >= 0x030800b1
20280   0, /*tp_vectorcall*/
20281   #endif
20282   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20283   0, /*tp_print*/
20284   #endif
20285 };
20286 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
20287 
__pyx_tp_new_memoryview(PyTypeObject * t,PyObject * a,PyObject * k)20288 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
20289   struct __pyx_memoryview_obj *p;
20290   PyObject *o;
20291   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20292     o = (*t->tp_alloc)(t, 0);
20293   } else {
20294     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20295   }
20296   if (unlikely(!o)) return 0;
20297   p = ((struct __pyx_memoryview_obj *)o);
20298   p->__pyx_vtab = __pyx_vtabptr_memoryview;
20299   p->obj = Py_None; Py_INCREF(Py_None);
20300   p->_size = Py_None; Py_INCREF(Py_None);
20301   p->_array_interface = Py_None; Py_INCREF(Py_None);
20302   p->view.obj = NULL;
20303   if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
20304   return o;
20305   bad:
20306   Py_DECREF(o); o = 0;
20307   return NULL;
20308 }
20309 
__pyx_tp_dealloc_memoryview(PyObject * o)20310 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
20311   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
20312   #if CYTHON_USE_TP_FINALIZE
20313   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
20314     if (PyObject_CallFinalizerFromDealloc(o)) return;
20315   }
20316   #endif
20317   PyObject_GC_UnTrack(o);
20318   {
20319     PyObject *etype, *eval, *etb;
20320     PyErr_Fetch(&etype, &eval, &etb);
20321     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
20322     __pyx_memoryview___dealloc__(o);
20323     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
20324     PyErr_Restore(etype, eval, etb);
20325   }
20326   Py_CLEAR(p->obj);
20327   Py_CLEAR(p->_size);
20328   Py_CLEAR(p->_array_interface);
20329   (*Py_TYPE(o)->tp_free)(o);
20330 }
20331 
__pyx_tp_traverse_memoryview(PyObject * o,visitproc v,void * a)20332 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
20333   int e;
20334   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
20335   if (p->obj) {
20336     e = (*v)(p->obj, a); if (e) return e;
20337   }
20338   if (p->_size) {
20339     e = (*v)(p->_size, a); if (e) return e;
20340   }
20341   if (p->_array_interface) {
20342     e = (*v)(p->_array_interface, a); if (e) return e;
20343   }
20344   if (p->view.obj) {
20345     e = (*v)(p->view.obj, a); if (e) return e;
20346   }
20347   return 0;
20348 }
20349 
__pyx_tp_clear_memoryview(PyObject * o)20350 static int __pyx_tp_clear_memoryview(PyObject *o) {
20351   PyObject* tmp;
20352   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
20353   tmp = ((PyObject*)p->obj);
20354   p->obj = Py_None; Py_INCREF(Py_None);
20355   Py_XDECREF(tmp);
20356   tmp = ((PyObject*)p->_size);
20357   p->_size = Py_None; Py_INCREF(Py_None);
20358   Py_XDECREF(tmp);
20359   tmp = ((PyObject*)p->_array_interface);
20360   p->_array_interface = Py_None; Py_INCREF(Py_None);
20361   Py_XDECREF(tmp);
20362   Py_CLEAR(p->view.obj);
20363   return 0;
20364 }
__pyx_sq_item_memoryview(PyObject * o,Py_ssize_t i)20365 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
20366   PyObject *r;
20367   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
20368   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
20369   Py_DECREF(x);
20370   return r;
20371 }
20372 
__pyx_mp_ass_subscript_memoryview(PyObject * o,PyObject * i,PyObject * v)20373 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
20374   if (v) {
20375     return __pyx_memoryview___setitem__(o, i, v);
20376   }
20377   else {
20378     PyErr_Format(PyExc_NotImplementedError,
20379       "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
20380     return -1;
20381   }
20382 }
20383 
__pyx_getprop___pyx_memoryview_T(PyObject * o,CYTHON_UNUSED void * x)20384 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
20385   return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
20386 }
20387 
__pyx_getprop___pyx_memoryview_base(PyObject * o,CYTHON_UNUSED void * x)20388 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
20389   return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
20390 }
20391 
__pyx_getprop___pyx_memoryview_shape(PyObject * o,CYTHON_UNUSED void * x)20392 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
20393   return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
20394 }
20395 
__pyx_getprop___pyx_memoryview_strides(PyObject * o,CYTHON_UNUSED void * x)20396 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
20397   return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
20398 }
20399 
__pyx_getprop___pyx_memoryview_suboffsets(PyObject * o,CYTHON_UNUSED void * x)20400 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
20401   return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
20402 }
20403 
__pyx_getprop___pyx_memoryview_ndim(PyObject * o,CYTHON_UNUSED void * x)20404 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
20405   return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
20406 }
20407 
__pyx_getprop___pyx_memoryview_itemsize(PyObject * o,CYTHON_UNUSED void * x)20408 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
20409   return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
20410 }
20411 
__pyx_getprop___pyx_memoryview_nbytes(PyObject * o,CYTHON_UNUSED void * x)20412 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
20413   return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
20414 }
20415 
__pyx_getprop___pyx_memoryview_size(PyObject * o,CYTHON_UNUSED void * x)20416 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
20417   return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
20418 }
20419 
20420 static PyMethodDef __pyx_methods_memoryview[] = {
20421   {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
20422   {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
20423   {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
20424   {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
20425   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
20426   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
20427   {0, 0, 0, 0}
20428 };
20429 
20430 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
20431   {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
20432   {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
20433   {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
20434   {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
20435   {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
20436   {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
20437   {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
20438   {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
20439   {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
20440   {0, 0, 0, 0, 0}
20441 };
20442 
20443 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
20444   __pyx_memoryview___len__, /*sq_length*/
20445   0, /*sq_concat*/
20446   0, /*sq_repeat*/
20447   __pyx_sq_item_memoryview, /*sq_item*/
20448   0, /*sq_slice*/
20449   0, /*sq_ass_item*/
20450   0, /*sq_ass_slice*/
20451   0, /*sq_contains*/
20452   0, /*sq_inplace_concat*/
20453   0, /*sq_inplace_repeat*/
20454 };
20455 
20456 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
20457   __pyx_memoryview___len__, /*mp_length*/
20458   __pyx_memoryview___getitem__, /*mp_subscript*/
20459   __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
20460 };
20461 
20462 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
20463   #if PY_MAJOR_VERSION < 3
20464   0, /*bf_getreadbuffer*/
20465   #endif
20466   #if PY_MAJOR_VERSION < 3
20467   0, /*bf_getwritebuffer*/
20468   #endif
20469   #if PY_MAJOR_VERSION < 3
20470   0, /*bf_getsegcount*/
20471   #endif
20472   #if PY_MAJOR_VERSION < 3
20473   0, /*bf_getcharbuffer*/
20474   #endif
20475   __pyx_memoryview_getbuffer, /*bf_getbuffer*/
20476   0, /*bf_releasebuffer*/
20477 };
20478 
20479 static PyTypeObject __pyx_type___pyx_memoryview = {
20480   PyVarObject_HEAD_INIT(0, 0)
20481   "dipy.tracking.localtrack.memoryview", /*tp_name*/
20482   sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
20483   0, /*tp_itemsize*/
20484   __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
20485   #if PY_VERSION_HEX < 0x030800b4
20486   0, /*tp_print*/
20487   #endif
20488   #if PY_VERSION_HEX >= 0x030800b4
20489   0, /*tp_vectorcall_offset*/
20490   #endif
20491   0, /*tp_getattr*/
20492   0, /*tp_setattr*/
20493   #if PY_MAJOR_VERSION < 3
20494   0, /*tp_compare*/
20495   #endif
20496   #if PY_MAJOR_VERSION >= 3
20497   0, /*tp_as_async*/
20498   #endif
20499   __pyx_memoryview___repr__, /*tp_repr*/
20500   0, /*tp_as_number*/
20501   &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
20502   &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
20503   0, /*tp_hash*/
20504   0, /*tp_call*/
20505   __pyx_memoryview___str__, /*tp_str*/
20506   0, /*tp_getattro*/
20507   0, /*tp_setattro*/
20508   &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
20509   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
20510   0, /*tp_doc*/
20511   __pyx_tp_traverse_memoryview, /*tp_traverse*/
20512   __pyx_tp_clear_memoryview, /*tp_clear*/
20513   0, /*tp_richcompare*/
20514   0, /*tp_weaklistoffset*/
20515   0, /*tp_iter*/
20516   0, /*tp_iternext*/
20517   __pyx_methods_memoryview, /*tp_methods*/
20518   0, /*tp_members*/
20519   __pyx_getsets_memoryview, /*tp_getset*/
20520   0, /*tp_base*/
20521   0, /*tp_dict*/
20522   0, /*tp_descr_get*/
20523   0, /*tp_descr_set*/
20524   0, /*tp_dictoffset*/
20525   0, /*tp_init*/
20526   0, /*tp_alloc*/
20527   __pyx_tp_new_memoryview, /*tp_new*/
20528   0, /*tp_free*/
20529   0, /*tp_is_gc*/
20530   0, /*tp_bases*/
20531   0, /*tp_mro*/
20532   0, /*tp_cache*/
20533   0, /*tp_subclasses*/
20534   0, /*tp_weaklist*/
20535   0, /*tp_del*/
20536   0, /*tp_version_tag*/
20537   #if PY_VERSION_HEX >= 0x030400a1
20538   0, /*tp_finalize*/
20539   #endif
20540   #if PY_VERSION_HEX >= 0x030800b1
20541   0, /*tp_vectorcall*/
20542   #endif
20543   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20544   0, /*tp_print*/
20545   #endif
20546 };
20547 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
20548 
__pyx_tp_new__memoryviewslice(PyTypeObject * t,PyObject * a,PyObject * k)20549 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
20550   struct __pyx_memoryviewslice_obj *p;
20551   PyObject *o = __pyx_tp_new_memoryview(t, a, k);
20552   if (unlikely(!o)) return 0;
20553   p = ((struct __pyx_memoryviewslice_obj *)o);
20554   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
20555   p->from_object = Py_None; Py_INCREF(Py_None);
20556   p->from_slice.memview = NULL;
20557   return o;
20558 }
20559 
__pyx_tp_dealloc__memoryviewslice(PyObject * o)20560 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
20561   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
20562   #if CYTHON_USE_TP_FINALIZE
20563   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
20564     if (PyObject_CallFinalizerFromDealloc(o)) return;
20565   }
20566   #endif
20567   PyObject_GC_UnTrack(o);
20568   {
20569     PyObject *etype, *eval, *etb;
20570     PyErr_Fetch(&etype, &eval, &etb);
20571     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
20572     __pyx_memoryviewslice___dealloc__(o);
20573     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
20574     PyErr_Restore(etype, eval, etb);
20575   }
20576   Py_CLEAR(p->from_object);
20577   PyObject_GC_Track(o);
20578   __pyx_tp_dealloc_memoryview(o);
20579 }
20580 
__pyx_tp_traverse__memoryviewslice(PyObject * o,visitproc v,void * a)20581 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
20582   int e;
20583   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
20584   e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
20585   if (p->from_object) {
20586     e = (*v)(p->from_object, a); if (e) return e;
20587   }
20588   return 0;
20589 }
20590 
__pyx_tp_clear__memoryviewslice(PyObject * o)20591 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
20592   PyObject* tmp;
20593   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
20594   __pyx_tp_clear_memoryview(o);
20595   tmp = ((PyObject*)p->from_object);
20596   p->from_object = Py_None; Py_INCREF(Py_None);
20597   Py_XDECREF(tmp);
20598   __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
20599   return 0;
20600 }
20601 
__pyx_getprop___pyx_memoryviewslice_base(PyObject * o,CYTHON_UNUSED void * x)20602 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
20603   return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
20604 }
20605 
20606 static PyMethodDef __pyx_methods__memoryviewslice[] = {
20607   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
20608   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
20609   {0, 0, 0, 0}
20610 };
20611 
20612 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
20613   {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
20614   {0, 0, 0, 0, 0}
20615 };
20616 
20617 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
20618   PyVarObject_HEAD_INIT(0, 0)
20619   "dipy.tracking.localtrack._memoryviewslice", /*tp_name*/
20620   sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
20621   0, /*tp_itemsize*/
20622   __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
20623   #if PY_VERSION_HEX < 0x030800b4
20624   0, /*tp_print*/
20625   #endif
20626   #if PY_VERSION_HEX >= 0x030800b4
20627   0, /*tp_vectorcall_offset*/
20628   #endif
20629   0, /*tp_getattr*/
20630   0, /*tp_setattr*/
20631   #if PY_MAJOR_VERSION < 3
20632   0, /*tp_compare*/
20633   #endif
20634   #if PY_MAJOR_VERSION >= 3
20635   0, /*tp_as_async*/
20636   #endif
20637   #if CYTHON_COMPILING_IN_PYPY
20638   __pyx_memoryview___repr__, /*tp_repr*/
20639   #else
20640   0, /*tp_repr*/
20641   #endif
20642   0, /*tp_as_number*/
20643   0, /*tp_as_sequence*/
20644   0, /*tp_as_mapping*/
20645   0, /*tp_hash*/
20646   0, /*tp_call*/
20647   #if CYTHON_COMPILING_IN_PYPY
20648   __pyx_memoryview___str__, /*tp_str*/
20649   #else
20650   0, /*tp_str*/
20651   #endif
20652   0, /*tp_getattro*/
20653   0, /*tp_setattro*/
20654   0, /*tp_as_buffer*/
20655   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
20656   "Internal class for passing memoryview slices to Python", /*tp_doc*/
20657   __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
20658   __pyx_tp_clear__memoryviewslice, /*tp_clear*/
20659   0, /*tp_richcompare*/
20660   0, /*tp_weaklistoffset*/
20661   0, /*tp_iter*/
20662   0, /*tp_iternext*/
20663   __pyx_methods__memoryviewslice, /*tp_methods*/
20664   0, /*tp_members*/
20665   __pyx_getsets__memoryviewslice, /*tp_getset*/
20666   0, /*tp_base*/
20667   0, /*tp_dict*/
20668   0, /*tp_descr_get*/
20669   0, /*tp_descr_set*/
20670   0, /*tp_dictoffset*/
20671   0, /*tp_init*/
20672   0, /*tp_alloc*/
20673   __pyx_tp_new__memoryviewslice, /*tp_new*/
20674   0, /*tp_free*/
20675   0, /*tp_is_gc*/
20676   0, /*tp_bases*/
20677   0, /*tp_mro*/
20678   0, /*tp_cache*/
20679   0, /*tp_subclasses*/
20680   0, /*tp_weaklist*/
20681   0, /*tp_del*/
20682   0, /*tp_version_tag*/
20683   #if PY_VERSION_HEX >= 0x030400a1
20684   0, /*tp_finalize*/
20685   #endif
20686   #if PY_VERSION_HEX >= 0x030800b1
20687   0, /*tp_vectorcall*/
20688   #endif
20689   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20690   0, /*tp_print*/
20691   #endif
20692 };
20693 
20694 static PyMethodDef __pyx_methods[] = {
20695   {0, 0, 0, 0}
20696 };
20697 
20698 #if PY_MAJOR_VERSION >= 3
20699 #if CYTHON_PEP489_MULTI_PHASE_INIT
20700 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
20701 static int __pyx_pymod_exec_localtrack(PyObject* module); /*proto*/
20702 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
20703   {Py_mod_create, (void*)__pyx_pymod_create},
20704   {Py_mod_exec, (void*)__pyx_pymod_exec_localtrack},
20705   {0, NULL}
20706 };
20707 #endif
20708 
20709 static struct PyModuleDef __pyx_moduledef = {
20710     PyModuleDef_HEAD_INIT,
20711     "localtrack",
20712     0, /* m_doc */
20713   #if CYTHON_PEP489_MULTI_PHASE_INIT
20714     0, /* m_size */
20715   #else
20716     -1, /* m_size */
20717   #endif
20718     __pyx_methods /* m_methods */,
20719   #if CYTHON_PEP489_MULTI_PHASE_INIT
20720     __pyx_moduledef_slots, /* m_slots */
20721   #else
20722     NULL, /* m_reload */
20723   #endif
20724     NULL, /* m_traverse */
20725     NULL, /* m_clear */
20726     NULL /* m_free */
20727 };
20728 #endif
20729 #ifndef CYTHON_SMALL_CODE
20730 #if defined(__clang__)
20731     #define CYTHON_SMALL_CODE
20732 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
20733     #define CYTHON_SMALL_CODE __attribute__((cold))
20734 #else
20735     #define CYTHON_SMALL_CODE
20736 #endif
20737 #endif
20738 
20739 static __Pyx_StringTabEntry __pyx_string_tab[] = {
20740   {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
20741   {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0},
20742   {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0},
20743   {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0},
20744   {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0},
20745   {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s, sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0},
20746   {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
20747   {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0},
20748   {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
20749   {&__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_k_Incompatible_checksums_s_vs_0xb0, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xb0), 0, 0, 1, 0},
20750   {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
20751   {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
20752   {&__pyx_kp_u_Invalid_input_parameter_dimensio, __pyx_k_Invalid_input_parameter_dimensio, sizeof(__pyx_k_Invalid_input_parameter_dimensio), 0, 1, 0, 0},
20753   {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0},
20754   {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d, sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0},
20755   {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
20756   {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0},
20757   {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
20758   {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
20759   {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0},
20760   {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
20761   {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
20762   {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0},
20763   {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
20764   {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
20765   {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
20766   {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
20767   {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
20768   {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
20769   {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
20770   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
20771   {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
20772   {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
20773   {&__pyx_n_s_dg, __pyx_k_dg, sizeof(__pyx_k_dg), 0, 0, 1, 1},
20774   {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
20775   {&__pyx_n_s_dipy_tracking_localtrack, __pyx_k_dipy_tracking_localtrack, sizeof(__pyx_k_dipy_tracking_localtrack), 0, 0, 1, 1},
20776   {&__pyx_kp_s_dipy_tracking_localtrack_pyx, __pyx_k_dipy_tracking_localtrack_pyx, sizeof(__pyx_k_dipy_tracking_localtrack_pyx), 0, 0, 1, 0},
20777   {&__pyx_n_s_dir, __pyx_k_dir, sizeof(__pyx_k_dir), 0, 0, 1, 1},
20778   {&__pyx_n_s_directions, __pyx_k_directions, sizeof(__pyx_k_directions), 0, 0, 1, 1},
20779   {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
20780   {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
20781   {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
20782   {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
20783   {&__pyx_n_s_first_step, __pyx_k_first_step, sizeof(__pyx_k_first_step), 0, 0, 1, 1},
20784   {&__pyx_n_s_fixedstep, __pyx_k_fixedstep, sizeof(__pyx_k_fixedstep), 0, 0, 1, 1},
20785   {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
20786   {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
20787   {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
20788   {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
20789   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
20790   {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0},
20791   {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
20792   {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
20793   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
20794   {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
20795   {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0},
20796   {&__pyx_n_s_local_tracker, __pyx_k_local_tracker, sizeof(__pyx_k_local_tracker), 0, 0, 1, 1},
20797   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
20798   {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
20799   {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
20800   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
20801   {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
20802   {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
20803   {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
20804   {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
20805   {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
20806   {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
20807   {&__pyx_kp_u_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 1, 0, 0},
20808   {&__pyx_kp_u_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 1, 0, 0},
20809   {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
20810   {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
20811   {&__pyx_n_s_particle_count, __pyx_k_particle_count, sizeof(__pyx_k_particle_count), 0, 0, 1, 1},
20812   {&__pyx_n_s_particle_dirs, __pyx_k_particle_dirs, sizeof(__pyx_k_particle_dirs), 0, 0, 1, 1},
20813   {&__pyx_n_s_particle_paths, __pyx_k_particle_paths, sizeof(__pyx_k_particle_paths), 0, 0, 1, 1},
20814   {&__pyx_n_s_particle_steps, __pyx_k_particle_steps, sizeof(__pyx_k_particle_steps), 0, 0, 1, 1},
20815   {&__pyx_n_s_particle_stream_statuses, __pyx_k_particle_stream_statuses, sizeof(__pyx_k_particle_stream_statuses), 0, 0, 1, 1},
20816   {&__pyx_n_s_particle_weights, __pyx_k_particle_weights, sizeof(__pyx_k_particle_weights), 0, 0, 1, 1},
20817   {&__pyx_n_s_pft_max_nbr_back_steps, __pyx_k_pft_max_nbr_back_steps, sizeof(__pyx_k_pft_max_nbr_back_steps), 0, 0, 1, 1},
20818   {&__pyx_n_s_pft_max_nbr_front_steps, __pyx_k_pft_max_nbr_front_steps, sizeof(__pyx_k_pft_max_nbr_front_steps), 0, 0, 1, 1},
20819   {&__pyx_n_s_pft_max_trials, __pyx_k_pft_max_trials, sizeof(__pyx_k_pft_max_trials), 0, 0, 1, 1},
20820   {&__pyx_n_s_pft_tracker, __pyx_k_pft_tracker, sizeof(__pyx_k_pft_tracker), 0, 0, 1, 1},
20821   {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
20822   {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
20823   {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
20824   {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
20825   {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
20826   {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
20827   {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
20828   {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
20829   {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
20830   {&__pyx_n_s_random, __pyx_k_random, sizeof(__pyx_k_random), 0, 0, 1, 1},
20831   {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
20832   {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
20833   {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
20834   {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
20835   {&__pyx_n_s_sc, __pyx_k_sc, sizeof(__pyx_k_sc), 0, 0, 1, 1},
20836   {&__pyx_n_s_seed, __pyx_k_seed, sizeof(__pyx_k_seed), 0, 0, 1, 1},
20837   {&__pyx_n_s_seed_pos, __pyx_k_seed_pos, sizeof(__pyx_k_seed_pos), 0, 0, 1, 1},
20838   {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
20839   {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
20840   {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
20841   {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
20842   {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
20843   {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
20844   {&__pyx_n_s_step_size, __pyx_k_step_size, sizeof(__pyx_k_step_size), 0, 0, 1, 1},
20845   {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
20846   {&__pyx_n_s_stream_status, __pyx_k_stream_status, sizeof(__pyx_k_stream_status), 0, 0, 1, 1},
20847   {&__pyx_n_s_streamline, __pyx_k_streamline, sizeof(__pyx_k_streamline), 0, 0, 1, 1},
20848   {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
20849   {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0},
20850   {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
20851   {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
20852   {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
20853   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
20854   {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0},
20855   {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0},
20856   {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
20857   {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
20858   {&__pyx_n_s_voxel_size, __pyx_k_voxel_size, sizeof(__pyx_k_voxel_size), 0, 0, 1, 1},
20859   {&__pyx_n_s_vs, __pyx_k_vs, sizeof(__pyx_k_vs), 0, 0, 1, 1},
20860   {0, 0, 0, 0, 0, 0, 0}
20861 };
__Pyx_InitCachedBuiltins(void)20862 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
20863   __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 56, __pyx_L1_error)
20864   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 138, __pyx_L1_error)
20865   __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 947, __pyx_L1_error)
20866   __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 148, __pyx_L1_error)
20867   __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 151, __pyx_L1_error)
20868   __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error)
20869   __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 404, __pyx_L1_error)
20870   __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 613, __pyx_L1_error)
20871   __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 832, __pyx_L1_error)
20872   return 0;
20873   __pyx_L1_error:;
20874   return -1;
20875 }
20876 
__Pyx_InitCachedConstants(void)20877 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
20878   __Pyx_RefNannyDeclarations
20879   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
20880 
20881   /* "dipy/tracking/localtrack.pyx":138
20882  *     if (seed_pos.shape[0] != 3 or first_step.shape[0] != 3 or
20883  *             voxel_size.shape[0] != 3 or streamline.shape[1] != 3):
20884  *         raise ValueError('Invalid input parameter dimensions.')             # <<<<<<<<<<<<<<
20885  *
20886  *     for i in range(3):
20887  */
20888   __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Invalid_input_parameter_dimensio); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 138, __pyx_L1_error)
20889   __Pyx_GOTREF(__pyx_tuple_);
20890   __Pyx_GIVEREF(__pyx_tuple_);
20891 
20892   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":947
20893  *         __pyx_import_array()
20894  *     except Exception:
20895  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
20896  *
20897  * cdef inline int import_umath() except -1:
20898  */
20899   __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 947, __pyx_L1_error)
20900   __Pyx_GOTREF(__pyx_tuple__2);
20901   __Pyx_GIVEREF(__pyx_tuple__2);
20902 
20903   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":953
20904  *         _import_umath()
20905  *     except Exception:
20906  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
20907  *
20908  * cdef inline int import_ufunc() except -1:
20909  */
20910   __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 953, __pyx_L1_error)
20911   __Pyx_GOTREF(__pyx_tuple__3);
20912   __Pyx_GIVEREF(__pyx_tuple__3);
20913 
20914   /* "View.MemoryView":133
20915  *
20916  *         if not self.ndim:
20917  *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
20918  *
20919  *         if itemsize <= 0:
20920  */
20921   __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(2, 133, __pyx_L1_error)
20922   __Pyx_GOTREF(__pyx_tuple__4);
20923   __Pyx_GIVEREF(__pyx_tuple__4);
20924 
20925   /* "View.MemoryView":136
20926  *
20927  *         if itemsize <= 0:
20928  *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
20929  *
20930  *         if not isinstance(format, bytes):
20931  */
20932   __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(2, 136, __pyx_L1_error)
20933   __Pyx_GOTREF(__pyx_tuple__5);
20934   __Pyx_GIVEREF(__pyx_tuple__5);
20935 
20936   /* "View.MemoryView":148
20937  *
20938  *         if not self._shape:
20939  *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
20940  *
20941  *
20942  */
20943   __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 148, __pyx_L1_error)
20944   __Pyx_GOTREF(__pyx_tuple__6);
20945   __Pyx_GIVEREF(__pyx_tuple__6);
20946 
20947   /* "View.MemoryView":176
20948  *             self.data = <char *>malloc(self.len)
20949  *             if not self.data:
20950  *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
20951  *
20952  *             if self.dtype_is_object:
20953  */
20954   __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(2, 176, __pyx_L1_error)
20955   __Pyx_GOTREF(__pyx_tuple__7);
20956   __Pyx_GIVEREF(__pyx_tuple__7);
20957 
20958   /* "View.MemoryView":192
20959  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
20960  *         if not (flags & bufmode):
20961  *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
20962  *         info.buf = self.data
20963  *         info.len = self.len
20964  */
20965   __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 192, __pyx_L1_error)
20966   __Pyx_GOTREF(__pyx_tuple__8);
20967   __Pyx_GIVEREF(__pyx_tuple__8);
20968 
20969   /* "(tree fragment)":2
20970  * def __reduce_cython__(self):
20971  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
20972  * def __setstate_cython__(self, __pyx_state):
20973  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20974  */
20975   __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 2, __pyx_L1_error)
20976   __Pyx_GOTREF(__pyx_tuple__9);
20977   __Pyx_GIVEREF(__pyx_tuple__9);
20978 
20979   /* "(tree fragment)":4
20980  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20981  * def __setstate_cython__(self, __pyx_state):
20982  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
20983  */
20984   __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 4, __pyx_L1_error)
20985   __Pyx_GOTREF(__pyx_tuple__10);
20986   __Pyx_GIVEREF(__pyx_tuple__10);
20987 
20988   /* "View.MemoryView":418
20989  *     def __setitem__(memoryview self, object index, object value):
20990  *         if self.view.readonly:
20991  *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
20992  *
20993  *         have_slices, index = _unellipsify(index, self.view.ndim)
20994  */
20995   __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 418, __pyx_L1_error)
20996   __Pyx_GOTREF(__pyx_tuple__11);
20997   __Pyx_GIVEREF(__pyx_tuple__11);
20998 
20999   /* "View.MemoryView":495
21000  *             result = struct.unpack(self.view.format, bytesitem)
21001  *         except struct.error:
21002  *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
21003  *         else:
21004  *             if len(self.view.format) == 1:
21005  */
21006   __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 495, __pyx_L1_error)
21007   __Pyx_GOTREF(__pyx_tuple__12);
21008   __Pyx_GIVEREF(__pyx_tuple__12);
21009 
21010   /* "View.MemoryView":520
21011  *     def __getbuffer__(self, Py_buffer *info, int flags):
21012  *         if flags & PyBUF_WRITABLE and self.view.readonly:
21013  *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
21014  *
21015  *         if flags & PyBUF_ND:
21016  */
21017   __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 520, __pyx_L1_error)
21018   __Pyx_GOTREF(__pyx_tuple__13);
21019   __Pyx_GIVEREF(__pyx_tuple__13);
21020 
21021   /* "View.MemoryView":570
21022  *         if self.view.strides == NULL:
21023  *
21024  *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
21025  *
21026  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
21027  */
21028   __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 570, __pyx_L1_error)
21029   __Pyx_GOTREF(__pyx_tuple__14);
21030   __Pyx_GIVEREF(__pyx_tuple__14);
21031 
21032   /* "View.MemoryView":577
21033  *     def suboffsets(self):
21034  *         if self.view.suboffsets == NULL:
21035  *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
21036  *
21037  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
21038  */
21039   __pyx_tuple__15 = PyTuple_New(1); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 577, __pyx_L1_error)
21040   __Pyx_GOTREF(__pyx_tuple__15);
21041   __Pyx_INCREF(__pyx_int_neg_1);
21042   __Pyx_GIVEREF(__pyx_int_neg_1);
21043   PyTuple_SET_ITEM(__pyx_tuple__15, 0, __pyx_int_neg_1);
21044   __Pyx_GIVEREF(__pyx_tuple__15);
21045 
21046   /* "(tree fragment)":2
21047  * def __reduce_cython__(self):
21048  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
21049  * def __setstate_cython__(self, __pyx_state):
21050  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21051  */
21052   __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 2, __pyx_L1_error)
21053   __Pyx_GOTREF(__pyx_tuple__16);
21054   __Pyx_GIVEREF(__pyx_tuple__16);
21055 
21056   /* "(tree fragment)":4
21057  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21058  * def __setstate_cython__(self, __pyx_state):
21059  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
21060  */
21061   __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 4, __pyx_L1_error)
21062   __Pyx_GOTREF(__pyx_tuple__17);
21063   __Pyx_GIVEREF(__pyx_tuple__17);
21064 
21065   /* "View.MemoryView":682
21066  *         if item is Ellipsis:
21067  *             if not seen_ellipsis:
21068  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
21069  *                 seen_ellipsis = True
21070  *             else:
21071  */
21072   __pyx_slice__18 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__18)) __PYX_ERR(2, 682, __pyx_L1_error)
21073   __Pyx_GOTREF(__pyx_slice__18);
21074   __Pyx_GIVEREF(__pyx_slice__18);
21075 
21076   /* "View.MemoryView":703
21077  *     for suboffset in suboffsets[:ndim]:
21078  *         if suboffset >= 0:
21079  *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
21080  *
21081  *
21082  */
21083   __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 703, __pyx_L1_error)
21084   __Pyx_GOTREF(__pyx_tuple__19);
21085   __Pyx_GIVEREF(__pyx_tuple__19);
21086 
21087   /* "(tree fragment)":2
21088  * def __reduce_cython__(self):
21089  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
21090  * def __setstate_cython__(self, __pyx_state):
21091  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21092  */
21093   __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 2, __pyx_L1_error)
21094   __Pyx_GOTREF(__pyx_tuple__20);
21095   __Pyx_GIVEREF(__pyx_tuple__20);
21096 
21097   /* "(tree fragment)":4
21098  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21099  * def __setstate_cython__(self, __pyx_state):
21100  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
21101  */
21102   __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 4, __pyx_L1_error)
21103   __Pyx_GOTREF(__pyx_tuple__21);
21104   __Pyx_GIVEREF(__pyx_tuple__21);
21105 
21106   /* "dipy/tracking/localtrack.pyx":86
21107  *
21108  *
21109  * def local_tracker(             # <<<<<<<<<<<<<<
21110  *         DirectionGetter dg,
21111  *         StoppingCriterion sc,
21112  */
21113   __pyx_tuple__22 = PyTuple_Pack(13, __pyx_n_s_dg, __pyx_n_s_sc, __pyx_n_s_seed_pos, __pyx_n_s_first_step, __pyx_n_s_voxel_size, __pyx_n_s_streamline, __pyx_n_s_step_size, __pyx_n_s_fixedstep, __pyx_n_s_i, __pyx_n_s_stream_status, __pyx_n_s_dir, __pyx_n_s_vs, __pyx_n_s_seed); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 86, __pyx_L1_error)
21114   __Pyx_GOTREF(__pyx_tuple__22);
21115   __Pyx_GIVEREF(__pyx_tuple__22);
21116   __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(8, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dipy_tracking_localtrack_pyx, __pyx_n_s_local_tracker, 86, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 86, __pyx_L1_error)
21117 
21118   /* "dipy/tracking/localtrack.pyx":198
21119  *
21120  *
21121  * def pft_tracker(             # <<<<<<<<<<<<<<
21122  *         DirectionGetter dg,
21123  *         AnatomicalStoppingCriterion sc,
21124  */
21125   __pyx_tuple__24 = PyTuple_Pack(22, __pyx_n_s_dg, __pyx_n_s_sc, __pyx_n_s_seed_pos, __pyx_n_s_first_step, __pyx_n_s_voxel_size, __pyx_n_s_streamline, __pyx_n_s_directions, __pyx_n_s_step_size, __pyx_n_s_pft_max_nbr_back_steps, __pyx_n_s_pft_max_nbr_front_steps, __pyx_n_s_pft_max_trials, __pyx_n_s_particle_count, __pyx_n_s_particle_paths, __pyx_n_s_particle_dirs, __pyx_n_s_particle_weights, __pyx_n_s_particle_steps, __pyx_n_s_particle_stream_statuses, __pyx_n_s_i, __pyx_n_s_stream_status, __pyx_n_s_dir, __pyx_n_s_vs, __pyx_n_s_seed); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 198, __pyx_L1_error)
21126   __Pyx_GOTREF(__pyx_tuple__24);
21127   __Pyx_GIVEREF(__pyx_tuple__24);
21128   __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(17, 0, 22, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dipy_tracking_localtrack_pyx, __pyx_n_s_pft_tracker, 198, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 198, __pyx_L1_error)
21129 
21130   /* "View.MemoryView":286
21131  *         return self.name
21132  *
21133  * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
21134  * cdef strided = Enum("<strided and direct>") # default
21135  * cdef indirect = Enum("<strided and indirect>")
21136  */
21137   __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(2, 286, __pyx_L1_error)
21138   __Pyx_GOTREF(__pyx_tuple__26);
21139   __Pyx_GIVEREF(__pyx_tuple__26);
21140 
21141   /* "View.MemoryView":287
21142  *
21143  * cdef generic = Enum("<strided and direct or indirect>")
21144  * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
21145  * cdef indirect = Enum("<strided and indirect>")
21146  *
21147  */
21148   __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(2, 287, __pyx_L1_error)
21149   __Pyx_GOTREF(__pyx_tuple__27);
21150   __Pyx_GIVEREF(__pyx_tuple__27);
21151 
21152   /* "View.MemoryView":288
21153  * cdef generic = Enum("<strided and direct or indirect>")
21154  * cdef strided = Enum("<strided and direct>") # default
21155  * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
21156  *
21157  *
21158  */
21159   __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(2, 288, __pyx_L1_error)
21160   __Pyx_GOTREF(__pyx_tuple__28);
21161   __Pyx_GIVEREF(__pyx_tuple__28);
21162 
21163   /* "View.MemoryView":291
21164  *
21165  *
21166  * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
21167  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
21168  *
21169  */
21170   __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(2, 291, __pyx_L1_error)
21171   __Pyx_GOTREF(__pyx_tuple__29);
21172   __Pyx_GIVEREF(__pyx_tuple__29);
21173 
21174   /* "View.MemoryView":292
21175  *
21176  * cdef contiguous = Enum("<contiguous and direct>")
21177  * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
21178  *
21179  *
21180  */
21181   __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(2, 292, __pyx_L1_error)
21182   __Pyx_GOTREF(__pyx_tuple__30);
21183   __Pyx_GIVEREF(__pyx_tuple__30);
21184 
21185   /* "(tree fragment)":1
21186  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
21187  *     cdef object __pyx_PickleError
21188  *     cdef object __pyx_result
21189  */
21190   __pyx_tuple__31 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(2, 1, __pyx_L1_error)
21191   __Pyx_GOTREF(__pyx_tuple__31);
21192   __Pyx_GIVEREF(__pyx_tuple__31);
21193   __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(2, 1, __pyx_L1_error)
21194   __Pyx_RefNannyFinishContext();
21195   return 0;
21196   __pyx_L1_error:;
21197   __Pyx_RefNannyFinishContext();
21198   return -1;
21199 }
21200 
__Pyx_InitGlobals(void)21201 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
21202   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 2, __pyx_L1_error);
21203   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 2, __pyx_L1_error)
21204   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 2, __pyx_L1_error)
21205   __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 2, __pyx_L1_error)
21206   __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 2, __pyx_L1_error)
21207   return 0;
21208   __pyx_L1_error:;
21209   return -1;
21210 }
21211 
21212 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
21213 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
21214 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
21215 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
21216 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
21217 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
21218 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
21219 
__Pyx_modinit_global_init_code(void)21220 static int __Pyx_modinit_global_init_code(void) {
21221   __Pyx_RefNannyDeclarations
21222   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
21223   /*--- Global init code ---*/
21224   generic = Py_None; Py_INCREF(Py_None);
21225   strided = Py_None; Py_INCREF(Py_None);
21226   indirect = Py_None; Py_INCREF(Py_None);
21227   contiguous = Py_None; Py_INCREF(Py_None);
21228   indirect_contiguous = Py_None; Py_INCREF(Py_None);
21229   __Pyx_RefNannyFinishContext();
21230   return 0;
21231 }
21232 
__Pyx_modinit_variable_export_code(void)21233 static int __Pyx_modinit_variable_export_code(void) {
21234   __Pyx_RefNannyDeclarations
21235   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
21236   /*--- Variable export code ---*/
21237   __Pyx_RefNannyFinishContext();
21238   return 0;
21239 }
21240 
__Pyx_modinit_function_export_code(void)21241 static int __Pyx_modinit_function_export_code(void) {
21242   __Pyx_RefNannyDeclarations
21243   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
21244   /*--- Function export code ---*/
21245   __Pyx_RefNannyFinishContext();
21246   return 0;
21247 }
21248 
__Pyx_modinit_type_init_code(void)21249 static int __Pyx_modinit_type_init_code(void) {
21250   __Pyx_RefNannyDeclarations
21251   int __pyx_lineno = 0;
21252   const char *__pyx_filename = NULL;
21253   int __pyx_clineno = 0;
21254   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
21255   /*--- Type init code ---*/
21256   __pyx_vtabptr_array = &__pyx_vtable_array;
21257   __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
21258   if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
21259   #if PY_VERSION_HEX < 0x030800B1
21260   __pyx_type___pyx_array.tp_print = 0;
21261   #endif
21262   if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
21263   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
21264   __pyx_array_type = &__pyx_type___pyx_array;
21265   if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
21266   #if PY_VERSION_HEX < 0x030800B1
21267   __pyx_type___pyx_MemviewEnum.tp_print = 0;
21268   #endif
21269   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
21270     __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21271   }
21272   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
21273   __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
21274   __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
21275   __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
21276   __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
21277   __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
21278   __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
21279   __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
21280   __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
21281   __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
21282   if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
21283   #if PY_VERSION_HEX < 0x030800B1
21284   __pyx_type___pyx_memoryview.tp_print = 0;
21285   #endif
21286   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
21287     __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21288   }
21289   if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
21290   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
21291   __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
21292   __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
21293   __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
21294   __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
21295   __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
21296   __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
21297   if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
21298   #if PY_VERSION_HEX < 0x030800B1
21299   __pyx_type___pyx_memoryviewslice.tp_print = 0;
21300   #endif
21301   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
21302     __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21303   }
21304   if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
21305   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
21306   __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
21307   __Pyx_RefNannyFinishContext();
21308   return 0;
21309   __pyx_L1_error:;
21310   __Pyx_RefNannyFinishContext();
21311   return -1;
21312 }
21313 
__Pyx_modinit_type_import_code(void)21314 static int __Pyx_modinit_type_import_code(void) {
21315   __Pyx_RefNannyDeclarations
21316   PyObject *__pyx_t_1 = NULL;
21317   int __pyx_lineno = 0;
21318   const char *__pyx_filename = NULL;
21319   int __pyx_clineno = 0;
21320   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
21321   /*--- Type import code ---*/
21322   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
21323   __Pyx_GOTREF(__pyx_t_1);
21324   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
21325   #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
21326   sizeof(PyTypeObject),
21327   #else
21328   sizeof(PyHeapTypeObject),
21329   #endif
21330   __Pyx_ImportType_CheckSize_Warn);
21331    if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
21332   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21333   __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 200, __pyx_L1_error)
21334   __Pyx_GOTREF(__pyx_t_1);
21335   __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
21336    if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 200, __pyx_L1_error)
21337   __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
21338    if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 223, __pyx_L1_error)
21339   __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
21340    if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 227, __pyx_L1_error)
21341   __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
21342    if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 239, __pyx_L1_error)
21343   __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21344    if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 771, __pyx_L1_error)
21345   __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21346    if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 773, __pyx_L1_error)
21347   __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21348    if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 775, __pyx_L1_error)
21349   __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21350    if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 777, __pyx_L1_error)
21351   __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21352    if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 779, __pyx_L1_error)
21353   __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21354    if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 781, __pyx_L1_error)
21355   __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21356    if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 783, __pyx_L1_error)
21357   __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21358    if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 785, __pyx_L1_error)
21359   __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21360    if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 787, __pyx_L1_error)
21361   __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21362    if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 789, __pyx_L1_error)
21363   __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
21364    if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 827, __pyx_L1_error)
21365   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21366   __pyx_t_1 = PyImport_ImportModule("dipy.tracking.direction_getter"); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4, __pyx_L1_error)
21367   __Pyx_GOTREF(__pyx_t_1);
21368   __pyx_ptype_4dipy_8tracking_16direction_getter_DirectionGetter = __Pyx_ImportType(__pyx_t_1, "dipy.tracking.direction_getter", "DirectionGetter", sizeof(struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter), __Pyx_ImportType_CheckSize_Warn);
21369    if (!__pyx_ptype_4dipy_8tracking_16direction_getter_DirectionGetter) __PYX_ERR(4, 4, __pyx_L1_error)
21370   __pyx_vtabptr_4dipy_8tracking_16direction_getter_DirectionGetter = (struct __pyx_vtabstruct_4dipy_8tracking_16direction_getter_DirectionGetter*)__Pyx_GetVtable(__pyx_ptype_4dipy_8tracking_16direction_getter_DirectionGetter->tp_dict); if (unlikely(!__pyx_vtabptr_4dipy_8tracking_16direction_getter_DirectionGetter)) __PYX_ERR(4, 4, __pyx_L1_error)
21371   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21372   __pyx_t_1 = PyImport_ImportModule("dipy.tracking.stopping_criterion"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 10, __pyx_L1_error)
21373   __Pyx_GOTREF(__pyx_t_1);
21374   __pyx_ptype_4dipy_8tracking_18stopping_criterion_StoppingCriterion = __Pyx_ImportType(__pyx_t_1, "dipy.tracking.stopping_criterion", "StoppingCriterion", sizeof(struct __pyx_obj_4dipy_8tracking_18stopping_criterion_StoppingCriterion), __Pyx_ImportType_CheckSize_Warn);
21375    if (!__pyx_ptype_4dipy_8tracking_18stopping_criterion_StoppingCriterion) __PYX_ERR(5, 10, __pyx_L1_error)
21376   __pyx_vtabptr_4dipy_8tracking_18stopping_criterion_StoppingCriterion = (struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_StoppingCriterion*)__Pyx_GetVtable(__pyx_ptype_4dipy_8tracking_18stopping_criterion_StoppingCriterion->tp_dict); if (unlikely(!__pyx_vtabptr_4dipy_8tracking_18stopping_criterion_StoppingCriterion)) __PYX_ERR(5, 10, __pyx_L1_error)
21377   __pyx_ptype_4dipy_8tracking_18stopping_criterion_BinaryStoppingCriterion = __Pyx_ImportType(__pyx_t_1, "dipy.tracking.stopping_criterion", "BinaryStoppingCriterion", sizeof(struct __pyx_obj_4dipy_8tracking_18stopping_criterion_BinaryStoppingCriterion), __Pyx_ImportType_CheckSize_Warn);
21378    if (!__pyx_ptype_4dipy_8tracking_18stopping_criterion_BinaryStoppingCriterion) __PYX_ERR(5, 18, __pyx_L1_error)
21379   __pyx_vtabptr_4dipy_8tracking_18stopping_criterion_BinaryStoppingCriterion = (struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_BinaryStoppingCriterion*)__Pyx_GetVtable(__pyx_ptype_4dipy_8tracking_18stopping_criterion_BinaryStoppingCriterion->tp_dict); if (unlikely(!__pyx_vtabptr_4dipy_8tracking_18stopping_criterion_BinaryStoppingCriterion)) __PYX_ERR(5, 18, __pyx_L1_error)
21380   __pyx_ptype_4dipy_8tracking_18stopping_criterion_ThresholdStoppingCriterion = __Pyx_ImportType(__pyx_t_1, "dipy.tracking.stopping_criterion", "ThresholdStoppingCriterion", sizeof(struct __pyx_obj_4dipy_8tracking_18stopping_criterion_ThresholdStoppingCriterion), __Pyx_ImportType_CheckSize_Warn);
21381    if (!__pyx_ptype_4dipy_8tracking_18stopping_criterion_ThresholdStoppingCriterion) __PYX_ERR(5, 24, __pyx_L1_error)
21382   __pyx_vtabptr_4dipy_8tracking_18stopping_criterion_ThresholdStoppingCriterion = (struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_ThresholdStoppingCriterion*)__Pyx_GetVtable(__pyx_ptype_4dipy_8tracking_18stopping_criterion_ThresholdStoppingCriterion->tp_dict); if (unlikely(!__pyx_vtabptr_4dipy_8tracking_18stopping_criterion_ThresholdStoppingCriterion)) __PYX_ERR(5, 24, __pyx_L1_error)
21383   __pyx_ptype_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion = __Pyx_ImportType(__pyx_t_1, "dipy.tracking.stopping_criterion", "AnatomicalStoppingCriterion", sizeof(struct __pyx_obj_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion), __Pyx_ImportType_CheckSize_Warn);
21384    if (!__pyx_ptype_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion) __PYX_ERR(5, 31, __pyx_L1_error)
21385   __pyx_vtabptr_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion = (struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion*)__Pyx_GetVtable(__pyx_ptype_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion->tp_dict); if (unlikely(!__pyx_vtabptr_4dipy_8tracking_18stopping_criterion_AnatomicalStoppingCriterion)) __PYX_ERR(5, 31, __pyx_L1_error)
21386   __pyx_ptype_4dipy_8tracking_18stopping_criterion_ActStoppingCriterion = __Pyx_ImportType(__pyx_t_1, "dipy.tracking.stopping_criterion", "ActStoppingCriterion", sizeof(struct __pyx_obj_4dipy_8tracking_18stopping_criterion_ActStoppingCriterion), __Pyx_ImportType_CheckSize_Warn);
21387    if (!__pyx_ptype_4dipy_8tracking_18stopping_criterion_ActStoppingCriterion) __PYX_ERR(5, 41, __pyx_L1_error)
21388   __pyx_vtabptr_4dipy_8tracking_18stopping_criterion_ActStoppingCriterion = (struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_ActStoppingCriterion*)__Pyx_GetVtable(__pyx_ptype_4dipy_8tracking_18stopping_criterion_ActStoppingCriterion->tp_dict); if (unlikely(!__pyx_vtabptr_4dipy_8tracking_18stopping_criterion_ActStoppingCriterion)) __PYX_ERR(5, 41, __pyx_L1_error)
21389   __pyx_ptype_4dipy_8tracking_18stopping_criterion_CmcStoppingCriterion = __Pyx_ImportType(__pyx_t_1, "dipy.tracking.stopping_criterion", "CmcStoppingCriterion", sizeof(struct __pyx_obj_4dipy_8tracking_18stopping_criterion_CmcStoppingCriterion), __Pyx_ImportType_CheckSize_Warn);
21390    if (!__pyx_ptype_4dipy_8tracking_18stopping_criterion_CmcStoppingCriterion) __PYX_ERR(5, 45, __pyx_L1_error)
21391   __pyx_vtabptr_4dipy_8tracking_18stopping_criterion_CmcStoppingCriterion = (struct __pyx_vtabstruct_4dipy_8tracking_18stopping_criterion_CmcStoppingCriterion*)__Pyx_GetVtable(__pyx_ptype_4dipy_8tracking_18stopping_criterion_CmcStoppingCriterion->tp_dict); if (unlikely(!__pyx_vtabptr_4dipy_8tracking_18stopping_criterion_CmcStoppingCriterion)) __PYX_ERR(5, 45, __pyx_L1_error)
21392   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21393   __Pyx_RefNannyFinishContext();
21394   return 0;
21395   __pyx_L1_error:;
21396   __Pyx_XDECREF(__pyx_t_1);
21397   __Pyx_RefNannyFinishContext();
21398   return -1;
21399 }
21400 
__Pyx_modinit_variable_import_code(void)21401 static int __Pyx_modinit_variable_import_code(void) {
21402   __Pyx_RefNannyDeclarations
21403   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
21404   /*--- Variable import code ---*/
21405   __Pyx_RefNannyFinishContext();
21406   return 0;
21407 }
21408 
__Pyx_modinit_function_import_code(void)21409 static int __Pyx_modinit_function_import_code(void) {
21410   __Pyx_RefNannyDeclarations
21411   PyObject *__pyx_t_1 = NULL;
21412   int __pyx_lineno = 0;
21413   const char *__pyx_filename = NULL;
21414   int __pyx_clineno = 0;
21415   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
21416   /*--- Function import code ---*/
21417   __pyx_t_1 = PyImport_ImportModule("dipy.core.interpolation"); if (!__pyx_t_1) __PYX_ERR(0, 2, __pyx_L1_error)
21418   __Pyx_GOTREF(__pyx_t_1);
21419   if (__Pyx_ImportFunction(__pyx_t_1, "trilinear_interpolate4d_c", (void (**)(void))&__pyx_f_4dipy_4core_13interpolation_trilinear_interpolate4d_c, "int (__Pyx_memviewslice, double *, __Pyx_memviewslice)") < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21420   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21421   __pyx_t_1 = PyImport_ImportModule("dipy.utils.fast_numpy"); if (!__pyx_t_1) __PYX_ERR(0, 2, __pyx_L1_error)
21422   __Pyx_GOTREF(__pyx_t_1);
21423   if (__Pyx_ImportFunction(__pyx_t_1, "where_to_insert", (void (**)(void))&__pyx_f_4dipy_5utils_10fast_numpy_where_to_insert, "int (__pyx_t_5numpy_float_t *, __pyx_t_5numpy_float_t, int)") < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21424   if (__Pyx_ImportFunction(__pyx_t_1, "cumsum", (void (**)(void))&__pyx_f_4dipy_5utils_10fast_numpy_cumsum, "void (__pyx_t_5numpy_float_t *, __pyx_t_5numpy_float_t *, int)") < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21425   if (__Pyx_ImportFunction(__pyx_t_1, "copy_point", (void (**)(void))&__pyx_f_4dipy_5utils_10fast_numpy_copy_point, "void (double *, double *)") < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21426   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21427   __Pyx_RefNannyFinishContext();
21428   return 0;
21429   __pyx_L1_error:;
21430   __Pyx_XDECREF(__pyx_t_1);
21431   __Pyx_RefNannyFinishContext();
21432   return -1;
21433 }
21434 
21435 
21436 #ifndef CYTHON_NO_PYINIT_EXPORT
21437 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
21438 #elif PY_MAJOR_VERSION < 3
21439 #ifdef __cplusplus
21440 #define __Pyx_PyMODINIT_FUNC extern "C" void
21441 #else
21442 #define __Pyx_PyMODINIT_FUNC void
21443 #endif
21444 #else
21445 #ifdef __cplusplus
21446 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
21447 #else
21448 #define __Pyx_PyMODINIT_FUNC PyObject *
21449 #endif
21450 #endif
21451 
21452 
21453 #if PY_MAJOR_VERSION < 3
21454 __Pyx_PyMODINIT_FUNC initlocaltrack(void) CYTHON_SMALL_CODE; /*proto*/
initlocaltrack(void)21455 __Pyx_PyMODINIT_FUNC initlocaltrack(void)
21456 #else
21457 __Pyx_PyMODINIT_FUNC PyInit_localtrack(void) CYTHON_SMALL_CODE; /*proto*/
21458 __Pyx_PyMODINIT_FUNC PyInit_localtrack(void)
21459 #if CYTHON_PEP489_MULTI_PHASE_INIT
21460 {
21461   return PyModuleDef_Init(&__pyx_moduledef);
21462 }
21463 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
21464     #if PY_VERSION_HEX >= 0x030700A1
21465     static PY_INT64_T main_interpreter_id = -1;
21466     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
21467     if (main_interpreter_id == -1) {
21468         main_interpreter_id = current_id;
21469         return (unlikely(current_id == -1)) ? -1 : 0;
21470     } else if (unlikely(main_interpreter_id != current_id))
21471     #else
21472     static PyInterpreterState *main_interpreter = NULL;
21473     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
21474     if (!main_interpreter) {
21475         main_interpreter = current_interpreter;
21476     } else if (unlikely(main_interpreter != current_interpreter))
21477     #endif
21478     {
21479         PyErr_SetString(
21480             PyExc_ImportError,
21481             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
21482         return -1;
21483     }
21484     return 0;
21485 }
21486 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) {
21487     PyObject *value = PyObject_GetAttrString(spec, from_name);
21488     int result = 0;
21489     if (likely(value)) {
21490         if (allow_none || value != Py_None) {
21491             result = PyDict_SetItemString(moddict, to_name, value);
21492         }
21493         Py_DECREF(value);
21494     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
21495         PyErr_Clear();
21496     } else {
21497         result = -1;
21498     }
21499     return result;
21500 }
21501 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
21502     PyObject *module = NULL, *moddict, *modname;
21503     if (__Pyx_check_single_interpreter())
21504         return NULL;
21505     if (__pyx_m)
21506         return __Pyx_NewRef(__pyx_m);
21507     modname = PyObject_GetAttrString(spec, "name");
21508     if (unlikely(!modname)) goto bad;
21509     module = PyModule_NewObject(modname);
21510     Py_DECREF(modname);
21511     if (unlikely(!module)) goto bad;
21512     moddict = PyModule_GetDict(module);
21513     if (unlikely(!moddict)) goto bad;
21514     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
21515     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
21516     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
21517     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
21518     return module;
21519 bad:
21520     Py_XDECREF(module);
21521     return NULL;
21522 }
21523 
21524 
21525 static CYTHON_SMALL_CODE int __pyx_pymod_exec_localtrack(PyObject *__pyx_pyinit_module)
21526 #endif
21527 #endif
21528 {
21529   PyObject *__pyx_t_1 = NULL;
21530   PyObject *__pyx_t_2 = NULL;
21531   static PyThread_type_lock __pyx_t_3[8];
21532   int __pyx_lineno = 0;
21533   const char *__pyx_filename = NULL;
21534   int __pyx_clineno = 0;
21535   __Pyx_RefNannyDeclarations
21536   #if CYTHON_PEP489_MULTI_PHASE_INIT
21537   if (__pyx_m) {
21538     if (__pyx_m == __pyx_pyinit_module) return 0;
21539     PyErr_SetString(PyExc_RuntimeError, "Module 'localtrack' has already been imported. Re-initialisation is not supported.");
21540     return -1;
21541   }
21542   #elif PY_MAJOR_VERSION >= 3
21543   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
21544   #endif
21545   #if CYTHON_REFNANNY
21546 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
21547 if (!__Pyx_RefNanny) {
21548   PyErr_Clear();
21549   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
21550   if (!__Pyx_RefNanny)
21551       Py_FatalError("failed to import 'refnanny' module");
21552 }
21553 #endif
21554   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_localtrack(void)", 0);
21555   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21556   #ifdef __Pxy_PyFrame_Initialize_Offsets
21557   __Pxy_PyFrame_Initialize_Offsets();
21558   #endif
21559   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 2, __pyx_L1_error)
21560   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 2, __pyx_L1_error)
21561   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 2, __pyx_L1_error)
21562   #ifdef __Pyx_CyFunction_USED
21563   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21564   #endif
21565   #ifdef __Pyx_FusedFunction_USED
21566   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21567   #endif
21568   #ifdef __Pyx_Coroutine_USED
21569   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21570   #endif
21571   #ifdef __Pyx_Generator_USED
21572   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21573   #endif
21574   #ifdef __Pyx_AsyncGen_USED
21575   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21576   #endif
21577   #ifdef __Pyx_StopAsyncIteration_USED
21578   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21579   #endif
21580   /*--- Library function declarations ---*/
21581   /*--- Threads initialization code ---*/
21582   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
21583   #ifdef WITH_THREAD /* Python build with threading support? */
21584   PyEval_InitThreads();
21585   #endif
21586   #endif
21587   /*--- Module creation code ---*/
21588   #if CYTHON_PEP489_MULTI_PHASE_INIT
21589   __pyx_m = __pyx_pyinit_module;
21590   Py_INCREF(__pyx_m);
21591   #else
21592   #if PY_MAJOR_VERSION < 3
21593   __pyx_m = Py_InitModule4("localtrack", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
21594   #else
21595   __pyx_m = PyModule_Create(&__pyx_moduledef);
21596   #endif
21597   if (unlikely(!__pyx_m)) __PYX_ERR(0, 2, __pyx_L1_error)
21598   #endif
21599   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 2, __pyx_L1_error)
21600   Py_INCREF(__pyx_d);
21601   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 2, __pyx_L1_error)
21602   Py_INCREF(__pyx_b);
21603   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 2, __pyx_L1_error)
21604   Py_INCREF(__pyx_cython_runtime);
21605   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 2, __pyx_L1_error);
21606   /*--- Initialize various global constants etc. ---*/
21607   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21608   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
21609   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21610   #endif
21611   if (__pyx_module_is_main_dipy__tracking__localtrack) {
21612     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21613   }
21614   #if PY_MAJOR_VERSION >= 3
21615   {
21616     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 2, __pyx_L1_error)
21617     if (!PyDict_GetItemString(modules, "dipy.tracking.localtrack")) {
21618       if (unlikely(PyDict_SetItemString(modules, "dipy.tracking.localtrack", __pyx_m) < 0)) __PYX_ERR(0, 2, __pyx_L1_error)
21619     }
21620   }
21621   #endif
21622   /*--- Builtin init code ---*/
21623   if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21624   /*--- Constants init code ---*/
21625   if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21626   /*--- Global type/function init code ---*/
21627   (void)__Pyx_modinit_global_init_code();
21628   (void)__Pyx_modinit_variable_export_code();
21629   (void)__Pyx_modinit_function_export_code();
21630   if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 2, __pyx_L1_error)
21631   if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 2, __pyx_L1_error)
21632   (void)__Pyx_modinit_variable_import_code();
21633   if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(0, 2, __pyx_L1_error)
21634   /*--- Execution code ---*/
21635   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
21636   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21637   #endif
21638 
21639   /* "dipy/tracking/localtrack.pyx":2
21640  *
21641  * from random import random             # <<<<<<<<<<<<<<
21642  *
21643  * cimport cython
21644  */
21645   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
21646   __Pyx_GOTREF(__pyx_t_1);
21647   __Pyx_INCREF(__pyx_n_s_random);
21648   __Pyx_GIVEREF(__pyx_n_s_random);
21649   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_random);
21650   __pyx_t_2 = __Pyx_Import(__pyx_n_s_random, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error)
21651   __Pyx_GOTREF(__pyx_t_2);
21652   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21653   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_random); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
21654   __Pyx_GOTREF(__pyx_t_1);
21655   if (PyDict_SetItem(__pyx_d, __pyx_n_s_random, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21656   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21657   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21658 
21659   /* "dipy/tracking/localtrack.pyx":6
21660  * cimport cython
21661  * cimport numpy as cnp
21662  * import numpy as np             # <<<<<<<<<<<<<<
21663  * from .direction_getter cimport DirectionGetter
21664  * from .stopping_criterion cimport(
21665  */
21666   __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
21667   __Pyx_GOTREF(__pyx_t_2);
21668   if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_2) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
21669   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21670 
21671   /* "dipy/tracking/localtrack.pyx":86
21672  *
21673  *
21674  * def local_tracker(             # <<<<<<<<<<<<<<
21675  *         DirectionGetter dg,
21676  *         StoppingCriterion sc,
21677  */
21678   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_4dipy_8tracking_10localtrack_1local_tracker, NULL, __pyx_n_s_dipy_tracking_localtrack); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error)
21679   __Pyx_GOTREF(__pyx_t_2);
21680   if (PyDict_SetItem(__pyx_d, __pyx_n_s_local_tracker, __pyx_t_2) < 0) __PYX_ERR(0, 86, __pyx_L1_error)
21681   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21682 
21683   /* "dipy/tracking/localtrack.pyx":198
21684  *
21685  *
21686  * def pft_tracker(             # <<<<<<<<<<<<<<
21687  *         DirectionGetter dg,
21688  *         AnatomicalStoppingCriterion sc,
21689  */
21690   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_4dipy_8tracking_10localtrack_3pft_tracker, NULL, __pyx_n_s_dipy_tracking_localtrack); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 198, __pyx_L1_error)
21691   __Pyx_GOTREF(__pyx_t_2);
21692   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pft_tracker, __pyx_t_2) < 0) __PYX_ERR(0, 198, __pyx_L1_error)
21693   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21694 
21695   /* "dipy/tracking/localtrack.pyx":2
21696  *
21697  * from random import random             # <<<<<<<<<<<<<<
21698  *
21699  * cimport cython
21700  */
21701   __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error)
21702   __Pyx_GOTREF(__pyx_t_2);
21703   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
21704   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21705 
21706   /* "View.MemoryView":209
21707  *         info.obj = self
21708  *
21709  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
21710  *
21711  *     def __dealloc__(array self):
21712  */
21713   __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 209, __pyx_L1_error)
21714   __Pyx_GOTREF(__pyx_t_2);
21715   if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 209, __pyx_L1_error)
21716   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21717   PyType_Modified(__pyx_array_type);
21718 
21719   /* "View.MemoryView":286
21720  *         return self.name
21721  *
21722  * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
21723  * cdef strided = Enum("<strided and direct>") # default
21724  * cdef indirect = Enum("<strided and indirect>")
21725  */
21726   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 286, __pyx_L1_error)
21727   __Pyx_GOTREF(__pyx_t_2);
21728   __Pyx_XGOTREF(generic);
21729   __Pyx_DECREF_SET(generic, __pyx_t_2);
21730   __Pyx_GIVEREF(__pyx_t_2);
21731   __pyx_t_2 = 0;
21732 
21733   /* "View.MemoryView":287
21734  *
21735  * cdef generic = Enum("<strided and direct or indirect>")
21736  * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
21737  * cdef indirect = Enum("<strided and indirect>")
21738  *
21739  */
21740   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 287, __pyx_L1_error)
21741   __Pyx_GOTREF(__pyx_t_2);
21742   __Pyx_XGOTREF(strided);
21743   __Pyx_DECREF_SET(strided, __pyx_t_2);
21744   __Pyx_GIVEREF(__pyx_t_2);
21745   __pyx_t_2 = 0;
21746 
21747   /* "View.MemoryView":288
21748  * cdef generic = Enum("<strided and direct or indirect>")
21749  * cdef strided = Enum("<strided and direct>") # default
21750  * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
21751  *
21752  *
21753  */
21754   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 288, __pyx_L1_error)
21755   __Pyx_GOTREF(__pyx_t_2);
21756   __Pyx_XGOTREF(indirect);
21757   __Pyx_DECREF_SET(indirect, __pyx_t_2);
21758   __Pyx_GIVEREF(__pyx_t_2);
21759   __pyx_t_2 = 0;
21760 
21761   /* "View.MemoryView":291
21762  *
21763  *
21764  * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
21765  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
21766  *
21767  */
21768   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 291, __pyx_L1_error)
21769   __Pyx_GOTREF(__pyx_t_2);
21770   __Pyx_XGOTREF(contiguous);
21771   __Pyx_DECREF_SET(contiguous, __pyx_t_2);
21772   __Pyx_GIVEREF(__pyx_t_2);
21773   __pyx_t_2 = 0;
21774 
21775   /* "View.MemoryView":292
21776  *
21777  * cdef contiguous = Enum("<contiguous and direct>")
21778  * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
21779  *
21780  *
21781  */
21782   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 292, __pyx_L1_error)
21783   __Pyx_GOTREF(__pyx_t_2);
21784   __Pyx_XGOTREF(indirect_contiguous);
21785   __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_2);
21786   __Pyx_GIVEREF(__pyx_t_2);
21787   __pyx_t_2 = 0;
21788 
21789   /* "View.MemoryView":316
21790  *
21791  * DEF THREAD_LOCKS_PREALLOCATED = 8
21792  * cdef int __pyx_memoryview_thread_locks_used = 0             # <<<<<<<<<<<<<<
21793  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
21794  *     PyThread_allocate_lock(),
21795  */
21796   __pyx_memoryview_thread_locks_used = 0;
21797 
21798   /* "View.MemoryView":317
21799  * DEF THREAD_LOCKS_PREALLOCATED = 8
21800  * cdef int __pyx_memoryview_thread_locks_used = 0
21801  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [             # <<<<<<<<<<<<<<
21802  *     PyThread_allocate_lock(),
21803  *     PyThread_allocate_lock(),
21804  */
21805   __pyx_t_3[0] = PyThread_allocate_lock();
21806   __pyx_t_3[1] = PyThread_allocate_lock();
21807   __pyx_t_3[2] = PyThread_allocate_lock();
21808   __pyx_t_3[3] = PyThread_allocate_lock();
21809   __pyx_t_3[4] = PyThread_allocate_lock();
21810   __pyx_t_3[5] = PyThread_allocate_lock();
21811   __pyx_t_3[6] = PyThread_allocate_lock();
21812   __pyx_t_3[7] = PyThread_allocate_lock();
21813   memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_3, sizeof(__pyx_memoryview_thread_locks[0]) * (8));
21814 
21815   /* "View.MemoryView":549
21816  *         info.obj = self
21817  *
21818  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
21819  *
21820  *
21821  */
21822   __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 549, __pyx_L1_error)
21823   __Pyx_GOTREF(__pyx_t_2);
21824   if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 549, __pyx_L1_error)
21825   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21826   PyType_Modified(__pyx_memoryview_type);
21827 
21828   /* "View.MemoryView":995
21829  *         return self.from_object
21830  *
21831  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
21832  *
21833  *
21834  */
21835   __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 995, __pyx_L1_error)
21836   __Pyx_GOTREF(__pyx_t_2);
21837   if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(2, 995, __pyx_L1_error)
21838   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21839   PyType_Modified(__pyx_memoryviewslice_type);
21840 
21841   /* "(tree fragment)":1
21842  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
21843  *     cdef object __pyx_PickleError
21844  *     cdef object __pyx_result
21845  */
21846   __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1, __pyx_L1_error)
21847   __Pyx_GOTREF(__pyx_t_2);
21848   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_2) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
21849   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21850 
21851   /* "(tree fragment)":11
21852  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
21853  *     return __pyx_result
21854  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
21855  *     __pyx_result.name = __pyx_state[0]
21856  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
21857  */
21858 
21859   /*--- Wrapped vars code ---*/
21860 
21861   goto __pyx_L0;
21862   __pyx_L1_error:;
21863   __Pyx_XDECREF(__pyx_t_1);
21864   __Pyx_XDECREF(__pyx_t_2);
21865   if (__pyx_m) {
21866     if (__pyx_d) {
21867       __Pyx_AddTraceback("init dipy.tracking.localtrack", __pyx_clineno, __pyx_lineno, __pyx_filename);
21868     }
21869     Py_CLEAR(__pyx_m);
21870   } else if (!PyErr_Occurred()) {
21871     PyErr_SetString(PyExc_ImportError, "init dipy.tracking.localtrack");
21872   }
21873   __pyx_L0:;
21874   __Pyx_RefNannyFinishContext();
21875   #if CYTHON_PEP489_MULTI_PHASE_INIT
21876   return (__pyx_m != NULL) ? 0 : -1;
21877   #elif PY_MAJOR_VERSION >= 3
21878   return __pyx_m;
21879   #else
21880   return;
21881   #endif
21882 }
21883 
21884 /* --- Runtime support code --- */
21885 /* Refnanny */
21886 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)21887 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
21888     PyObject *m = NULL, *p = NULL;
21889     void *r = NULL;
21890     m = PyImport_ImportModule(modname);
21891     if (!m) goto end;
21892     p = PyObject_GetAttrString(m, "RefNannyAPI");
21893     if (!p) goto end;
21894     r = PyLong_AsVoidPtr(p);
21895 end:
21896     Py_XDECREF(p);
21897     Py_XDECREF(m);
21898     return (__Pyx_RefNannyAPIStruct *)r;
21899 }
21900 #endif
21901 
21902 /* PyObjectGetAttrStr */
21903 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)21904 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
21905     PyTypeObject* tp = Py_TYPE(obj);
21906     if (likely(tp->tp_getattro))
21907         return tp->tp_getattro(obj, attr_name);
21908 #if PY_MAJOR_VERSION < 3
21909     if (likely(tp->tp_getattr))
21910         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
21911 #endif
21912     return PyObject_GetAttr(obj, attr_name);
21913 }
21914 #endif
21915 
21916 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)21917 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
21918     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
21919     if (unlikely(!result)) {
21920         PyErr_Format(PyExc_NameError,
21921 #if PY_MAJOR_VERSION >= 3
21922             "name '%U' is not defined", name);
21923 #else
21924             "name '%.200s' is not defined", PyString_AS_STRING(name));
21925 #endif
21926     }
21927     return result;
21928 }
21929 
21930 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)21931 static void __Pyx_RaiseArgtupleInvalid(
21932     const char* func_name,
21933     int exact,
21934     Py_ssize_t num_min,
21935     Py_ssize_t num_max,
21936     Py_ssize_t num_found)
21937 {
21938     Py_ssize_t num_expected;
21939     const char *more_or_less;
21940     if (num_found < num_min) {
21941         num_expected = num_min;
21942         more_or_less = "at least";
21943     } else {
21944         num_expected = num_max;
21945         more_or_less = "at most";
21946     }
21947     if (exact) {
21948         more_or_less = "exactly";
21949     }
21950     PyErr_Format(PyExc_TypeError,
21951                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
21952                  func_name, more_or_less, num_expected,
21953                  (num_expected == 1) ? "" : "s", num_found);
21954 }
21955 
21956 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)21957 static void __Pyx_RaiseDoubleKeywordsError(
21958     const char* func_name,
21959     PyObject* kw_name)
21960 {
21961     PyErr_Format(PyExc_TypeError,
21962         #if PY_MAJOR_VERSION >= 3
21963         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
21964         #else
21965         "%s() got multiple values for keyword argument '%s'", func_name,
21966         PyString_AsString(kw_name));
21967         #endif
21968 }
21969 
21970 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)21971 static int __Pyx_ParseOptionalKeywords(
21972     PyObject *kwds,
21973     PyObject **argnames[],
21974     PyObject *kwds2,
21975     PyObject *values[],
21976     Py_ssize_t num_pos_args,
21977     const char* function_name)
21978 {
21979     PyObject *key = 0, *value = 0;
21980     Py_ssize_t pos = 0;
21981     PyObject*** name;
21982     PyObject*** first_kw_arg = argnames + num_pos_args;
21983     while (PyDict_Next(kwds, &pos, &key, &value)) {
21984         name = first_kw_arg;
21985         while (*name && (**name != key)) name++;
21986         if (*name) {
21987             values[name-argnames] = value;
21988             continue;
21989         }
21990         name = first_kw_arg;
21991         #if PY_MAJOR_VERSION < 3
21992         if (likely(PyString_Check(key))) {
21993             while (*name) {
21994                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
21995                         && _PyString_Eq(**name, key)) {
21996                     values[name-argnames] = value;
21997                     break;
21998                 }
21999                 name++;
22000             }
22001             if (*name) continue;
22002             else {
22003                 PyObject*** argname = argnames;
22004                 while (argname != first_kw_arg) {
22005                     if ((**argname == key) || (
22006                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
22007                              && _PyString_Eq(**argname, key))) {
22008                         goto arg_passed_twice;
22009                     }
22010                     argname++;
22011                 }
22012             }
22013         } else
22014         #endif
22015         if (likely(PyUnicode_Check(key))) {
22016             while (*name) {
22017                 int cmp = (**name == key) ? 0 :
22018                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
22019                     (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
22020                 #endif
22021                     PyUnicode_Compare(**name, key);
22022                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
22023                 if (cmp == 0) {
22024                     values[name-argnames] = value;
22025                     break;
22026                 }
22027                 name++;
22028             }
22029             if (*name) continue;
22030             else {
22031                 PyObject*** argname = argnames;
22032                 while (argname != first_kw_arg) {
22033                     int cmp = (**argname == key) ? 0 :
22034                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
22035                         (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
22036                     #endif
22037                         PyUnicode_Compare(**argname, key);
22038                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
22039                     if (cmp == 0) goto arg_passed_twice;
22040                     argname++;
22041                 }
22042             }
22043         } else
22044             goto invalid_keyword_type;
22045         if (kwds2) {
22046             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
22047         } else {
22048             goto invalid_keyword;
22049         }
22050     }
22051     return 0;
22052 arg_passed_twice:
22053     __Pyx_RaiseDoubleKeywordsError(function_name, key);
22054     goto bad;
22055 invalid_keyword_type:
22056     PyErr_Format(PyExc_TypeError,
22057         "%.200s() keywords must be strings", function_name);
22058     goto bad;
22059 invalid_keyword:
22060     PyErr_Format(PyExc_TypeError,
22061     #if PY_MAJOR_VERSION < 3
22062         "%.200s() got an unexpected keyword argument '%.200s'",
22063         function_name, PyString_AsString(key));
22064     #else
22065         "%s() got an unexpected keyword argument '%U'",
22066         function_name, key);
22067     #endif
22068 bad:
22069     return -1;
22070 }
22071 
22072 /* ArgTypeTest */
__Pyx__ArgTypeTest(PyObject * obj,PyTypeObject * type,const char * name,int exact)22073 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
22074 {
22075     if (unlikely(!type)) {
22076         PyErr_SetString(PyExc_SystemError, "Missing type object");
22077         return 0;
22078     }
22079     else if (exact) {
22080         #if PY_MAJOR_VERSION == 2
22081         if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
22082         #endif
22083     }
22084     else {
22085         if (likely(__Pyx_TypeCheck(obj, type))) return 1;
22086     }
22087     PyErr_Format(PyExc_TypeError,
22088         "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
22089         name, type->tp_name, Py_TYPE(obj)->tp_name);
22090     return 0;
22091 }
22092 
22093 /* PyObjectCall */
22094 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)22095 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
22096     PyObject *result;
22097     ternaryfunc call = func->ob_type->tp_call;
22098     if (unlikely(!call))
22099         return PyObject_Call(func, arg, kw);
22100     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
22101         return NULL;
22102     result = (*call)(func, arg, kw);
22103     Py_LeaveRecursiveCall();
22104     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
22105         PyErr_SetString(
22106             PyExc_SystemError,
22107             "NULL result without error in PyObject_Call");
22108     }
22109     return result;
22110 }
22111 #endif
22112 
22113 /* PyErrFetchRestore */
22114 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)22115 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
22116     PyObject *tmp_type, *tmp_value, *tmp_tb;
22117     tmp_type = tstate->curexc_type;
22118     tmp_value = tstate->curexc_value;
22119     tmp_tb = tstate->curexc_traceback;
22120     tstate->curexc_type = type;
22121     tstate->curexc_value = value;
22122     tstate->curexc_traceback = tb;
22123     Py_XDECREF(tmp_type);
22124     Py_XDECREF(tmp_value);
22125     Py_XDECREF(tmp_tb);
22126 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)22127 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
22128     *type = tstate->curexc_type;
22129     *value = tstate->curexc_value;
22130     *tb = tstate->curexc_traceback;
22131     tstate->curexc_type = 0;
22132     tstate->curexc_value = 0;
22133     tstate->curexc_traceback = 0;
22134 }
22135 #endif
22136 
22137 /* RaiseException */
22138 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)22139 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
22140                         CYTHON_UNUSED PyObject *cause) {
22141     __Pyx_PyThreadState_declare
22142     Py_XINCREF(type);
22143     if (!value || value == Py_None)
22144         value = NULL;
22145     else
22146         Py_INCREF(value);
22147     if (!tb || tb == Py_None)
22148         tb = NULL;
22149     else {
22150         Py_INCREF(tb);
22151         if (!PyTraceBack_Check(tb)) {
22152             PyErr_SetString(PyExc_TypeError,
22153                 "raise: arg 3 must be a traceback or None");
22154             goto raise_error;
22155         }
22156     }
22157     if (PyType_Check(type)) {
22158 #if CYTHON_COMPILING_IN_PYPY
22159         if (!value) {
22160             Py_INCREF(Py_None);
22161             value = Py_None;
22162         }
22163 #endif
22164         PyErr_NormalizeException(&type, &value, &tb);
22165     } else {
22166         if (value) {
22167             PyErr_SetString(PyExc_TypeError,
22168                 "instance exception may not have a separate value");
22169             goto raise_error;
22170         }
22171         value = type;
22172         type = (PyObject*) Py_TYPE(type);
22173         Py_INCREF(type);
22174         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
22175             PyErr_SetString(PyExc_TypeError,
22176                 "raise: exception class must be a subclass of BaseException");
22177             goto raise_error;
22178         }
22179     }
22180     __Pyx_PyThreadState_assign
22181     __Pyx_ErrRestore(type, value, tb);
22182     return;
22183 raise_error:
22184     Py_XDECREF(value);
22185     Py_XDECREF(type);
22186     Py_XDECREF(tb);
22187     return;
22188 }
22189 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)22190 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
22191     PyObject* owned_instance = NULL;
22192     if (tb == Py_None) {
22193         tb = 0;
22194     } else if (tb && !PyTraceBack_Check(tb)) {
22195         PyErr_SetString(PyExc_TypeError,
22196             "raise: arg 3 must be a traceback or None");
22197         goto bad;
22198     }
22199     if (value == Py_None)
22200         value = 0;
22201     if (PyExceptionInstance_Check(type)) {
22202         if (value) {
22203             PyErr_SetString(PyExc_TypeError,
22204                 "instance exception may not have a separate value");
22205             goto bad;
22206         }
22207         value = type;
22208         type = (PyObject*) Py_TYPE(value);
22209     } else if (PyExceptionClass_Check(type)) {
22210         PyObject *instance_class = NULL;
22211         if (value && PyExceptionInstance_Check(value)) {
22212             instance_class = (PyObject*) Py_TYPE(value);
22213             if (instance_class != type) {
22214                 int is_subclass = PyObject_IsSubclass(instance_class, type);
22215                 if (!is_subclass) {
22216                     instance_class = NULL;
22217                 } else if (unlikely(is_subclass == -1)) {
22218                     goto bad;
22219                 } else {
22220                     type = instance_class;
22221                 }
22222             }
22223         }
22224         if (!instance_class) {
22225             PyObject *args;
22226             if (!value)
22227                 args = PyTuple_New(0);
22228             else if (PyTuple_Check(value)) {
22229                 Py_INCREF(value);
22230                 args = value;
22231             } else
22232                 args = PyTuple_Pack(1, value);
22233             if (!args)
22234                 goto bad;
22235             owned_instance = PyObject_Call(type, args, NULL);
22236             Py_DECREF(args);
22237             if (!owned_instance)
22238                 goto bad;
22239             value = owned_instance;
22240             if (!PyExceptionInstance_Check(value)) {
22241                 PyErr_Format(PyExc_TypeError,
22242                              "calling %R should have returned an instance of "
22243                              "BaseException, not %R",
22244                              type, Py_TYPE(value));
22245                 goto bad;
22246             }
22247         }
22248     } else {
22249         PyErr_SetString(PyExc_TypeError,
22250             "raise: exception class must be a subclass of BaseException");
22251         goto bad;
22252     }
22253     if (cause) {
22254         PyObject *fixed_cause;
22255         if (cause == Py_None) {
22256             fixed_cause = NULL;
22257         } else if (PyExceptionClass_Check(cause)) {
22258             fixed_cause = PyObject_CallObject(cause, NULL);
22259             if (fixed_cause == NULL)
22260                 goto bad;
22261         } else if (PyExceptionInstance_Check(cause)) {
22262             fixed_cause = cause;
22263             Py_INCREF(fixed_cause);
22264         } else {
22265             PyErr_SetString(PyExc_TypeError,
22266                             "exception causes must derive from "
22267                             "BaseException");
22268             goto bad;
22269         }
22270         PyException_SetCause(value, fixed_cause);
22271     }
22272     PyErr_SetObject(type, value);
22273     if (tb) {
22274 #if CYTHON_COMPILING_IN_PYPY
22275         PyObject *tmp_type, *tmp_value, *tmp_tb;
22276         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
22277         Py_INCREF(tb);
22278         PyErr_Restore(tmp_type, tmp_value, tb);
22279         Py_XDECREF(tmp_tb);
22280 #else
22281         PyThreadState *tstate = __Pyx_PyThreadState_Current;
22282         PyObject* tmp_tb = tstate->curexc_traceback;
22283         if (tb != tmp_tb) {
22284             Py_INCREF(tb);
22285             tstate->curexc_traceback = tb;
22286             Py_XDECREF(tmp_tb);
22287         }
22288 #endif
22289     }
22290 bad:
22291     Py_XDECREF(owned_instance);
22292     return;
22293 }
22294 #endif
22295 
22296 /* BufferIndexError */
__Pyx_RaiseBufferIndexError(int axis)22297 static void __Pyx_RaiseBufferIndexError(int axis) {
22298   PyErr_Format(PyExc_IndexError,
22299      "Out of bounds on buffer access (axis %d)", axis);
22300 }
22301 
22302 /* MemviewSliceInit */
22303 static int
__Pyx_init_memviewslice(struct __pyx_memoryview_obj * memview,int ndim,__Pyx_memviewslice * memviewslice,int memview_is_new_reference)22304 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
22305                         int ndim,
22306                         __Pyx_memviewslice *memviewslice,
22307                         int memview_is_new_reference)
22308 {
22309     __Pyx_RefNannyDeclarations
22310     int i, retval=-1;
22311     Py_buffer *buf = &memview->view;
22312     __Pyx_RefNannySetupContext("init_memviewslice", 0);
22313     if (unlikely(memviewslice->memview || memviewslice->data)) {
22314         PyErr_SetString(PyExc_ValueError,
22315             "memviewslice is already initialized!");
22316         goto fail;
22317     }
22318     if (buf->strides) {
22319         for (i = 0; i < ndim; i++) {
22320             memviewslice->strides[i] = buf->strides[i];
22321         }
22322     } else {
22323         Py_ssize_t stride = buf->itemsize;
22324         for (i = ndim - 1; i >= 0; i--) {
22325             memviewslice->strides[i] = stride;
22326             stride *= buf->shape[i];
22327         }
22328     }
22329     for (i = 0; i < ndim; i++) {
22330         memviewslice->shape[i]   = buf->shape[i];
22331         if (buf->suboffsets) {
22332             memviewslice->suboffsets[i] = buf->suboffsets[i];
22333         } else {
22334             memviewslice->suboffsets[i] = -1;
22335         }
22336     }
22337     memviewslice->memview = memview;
22338     memviewslice->data = (char *)buf->buf;
22339     if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
22340         Py_INCREF(memview);
22341     }
22342     retval = 0;
22343     goto no_fail;
22344 fail:
22345     memviewslice->memview = 0;
22346     memviewslice->data = 0;
22347     retval = -1;
22348 no_fail:
22349     __Pyx_RefNannyFinishContext();
22350     return retval;
22351 }
22352 #ifndef Py_NO_RETURN
22353 #define Py_NO_RETURN
22354 #endif
__pyx_fatalerror(const char * fmt,...)22355 static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
22356     va_list vargs;
22357     char msg[200];
22358 #ifdef HAVE_STDARG_PROTOTYPES
22359     va_start(vargs, fmt);
22360 #else
22361     va_start(vargs);
22362 #endif
22363     vsnprintf(msg, 200, fmt, vargs);
22364     va_end(vargs);
22365     Py_FatalError(msg);
22366 }
22367 static CYTHON_INLINE int
__pyx_add_acquisition_count_locked(__pyx_atomic_int * acquisition_count,PyThread_type_lock lock)22368 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
22369                                    PyThread_type_lock lock)
22370 {
22371     int result;
22372     PyThread_acquire_lock(lock, 1);
22373     result = (*acquisition_count)++;
22374     PyThread_release_lock(lock);
22375     return result;
22376 }
22377 static CYTHON_INLINE int
__pyx_sub_acquisition_count_locked(__pyx_atomic_int * acquisition_count,PyThread_type_lock lock)22378 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
22379                                    PyThread_type_lock lock)
22380 {
22381     int result;
22382     PyThread_acquire_lock(lock, 1);
22383     result = (*acquisition_count)--;
22384     PyThread_release_lock(lock);
22385     return result;
22386 }
22387 static CYTHON_INLINE void
__Pyx_INC_MEMVIEW(__Pyx_memviewslice * memslice,int have_gil,int lineno)22388 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
22389 {
22390     int first_time;
22391     struct __pyx_memoryview_obj *memview = memslice->memview;
22392     if (unlikely(!memview || (PyObject *) memview == Py_None))
22393         return;
22394     if (unlikely(__pyx_get_slice_count(memview) < 0))
22395         __pyx_fatalerror("Acquisition count is %d (line %d)",
22396                          __pyx_get_slice_count(memview), lineno);
22397     first_time = __pyx_add_acquisition_count(memview) == 0;
22398     if (unlikely(first_time)) {
22399         if (have_gil) {
22400             Py_INCREF((PyObject *) memview);
22401         } else {
22402             PyGILState_STATE _gilstate = PyGILState_Ensure();
22403             Py_INCREF((PyObject *) memview);
22404             PyGILState_Release(_gilstate);
22405         }
22406     }
22407 }
__Pyx_XDEC_MEMVIEW(__Pyx_memviewslice * memslice,int have_gil,int lineno)22408 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
22409                                              int have_gil, int lineno) {
22410     int last_time;
22411     struct __pyx_memoryview_obj *memview = memslice->memview;
22412     if (unlikely(!memview || (PyObject *) memview == Py_None)) {
22413         memslice->memview = NULL;
22414         return;
22415     }
22416     if (unlikely(__pyx_get_slice_count(memview) <= 0))
22417         __pyx_fatalerror("Acquisition count is %d (line %d)",
22418                          __pyx_get_slice_count(memview), lineno);
22419     last_time = __pyx_sub_acquisition_count(memview) == 1;
22420     memslice->data = NULL;
22421     if (unlikely(last_time)) {
22422         if (have_gil) {
22423             Py_CLEAR(memslice->memview);
22424         } else {
22425             PyGILState_STATE _gilstate = PyGILState_Ensure();
22426             Py_CLEAR(memslice->memview);
22427             PyGILState_Release(_gilstate);
22428         }
22429     } else {
22430         memslice->memview = NULL;
22431     }
22432 }
22433 
22434 /* PyIntBinop */
22435 #if !CYTHON_COMPILING_IN_PYPY
__Pyx_PyInt_SubtractCObj(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,int inplace,int zerodivision_check)22436 static PyObject* __Pyx_PyInt_SubtractCObj(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
22437     (void)inplace;
22438     (void)zerodivision_check;
22439     #if PY_MAJOR_VERSION < 3
22440     if (likely(PyInt_CheckExact(op2))) {
22441         const long a = intval;
22442         long x;
22443         long b = PyInt_AS_LONG(op2);
22444             x = (long)((unsigned long)a - b);
22445             if (likely((x^a) >= 0 || (x^~b) >= 0))
22446                 return PyInt_FromLong(x);
22447             return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
22448     }
22449     #endif
22450     #if CYTHON_USE_PYLONG_INTERNALS
22451     if (likely(PyLong_CheckExact(op2))) {
22452         const long a = intval;
22453         long b, x;
22454 #ifdef HAVE_LONG_LONG
22455         const PY_LONG_LONG lla = intval;
22456         PY_LONG_LONG llb, llx;
22457 #endif
22458         const digit* digits = ((PyLongObject*)op2)->ob_digit;
22459         const Py_ssize_t size = Py_SIZE(op2);
22460         if (likely(__Pyx_sst_abs(size) <= 1)) {
22461             b = likely(size) ? digits[0] : 0;
22462             if (size == -1) b = -b;
22463         } else {
22464             switch (size) {
22465                 case -2:
22466                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
22467                         b = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
22468                         break;
22469 #ifdef HAVE_LONG_LONG
22470                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
22471                         llb = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
22472                         goto long_long;
22473 #endif
22474                     }
22475                     CYTHON_FALLTHROUGH;
22476                 case 2:
22477                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
22478                         b = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
22479                         break;
22480 #ifdef HAVE_LONG_LONG
22481                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
22482                         llb = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
22483                         goto long_long;
22484 #endif
22485                     }
22486                     CYTHON_FALLTHROUGH;
22487                 case -3:
22488                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
22489                         b = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
22490                         break;
22491 #ifdef HAVE_LONG_LONG
22492                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
22493                         llb = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
22494                         goto long_long;
22495 #endif
22496                     }
22497                     CYTHON_FALLTHROUGH;
22498                 case 3:
22499                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
22500                         b = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
22501                         break;
22502 #ifdef HAVE_LONG_LONG
22503                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
22504                         llb = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
22505                         goto long_long;
22506 #endif
22507                     }
22508                     CYTHON_FALLTHROUGH;
22509                 case -4:
22510                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
22511                         b = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
22512                         break;
22513 #ifdef HAVE_LONG_LONG
22514                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
22515                         llb = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
22516                         goto long_long;
22517 #endif
22518                     }
22519                     CYTHON_FALLTHROUGH;
22520                 case 4:
22521                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
22522                         b = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
22523                         break;
22524 #ifdef HAVE_LONG_LONG
22525                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
22526                         llb = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
22527                         goto long_long;
22528 #endif
22529                     }
22530                     CYTHON_FALLTHROUGH;
22531                 default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
22532             }
22533         }
22534                 x = a - b;
22535             return PyLong_FromLong(x);
22536 #ifdef HAVE_LONG_LONG
22537         long_long:
22538                 llx = lla - llb;
22539             return PyLong_FromLongLong(llx);
22540 #endif
22541 
22542 
22543     }
22544     #endif
22545     if (PyFloat_CheckExact(op2)) {
22546         const long a = intval;
22547         double b = PyFloat_AS_DOUBLE(op2);
22548             double result;
22549             PyFPE_START_PROTECT("subtract", return NULL)
22550             result = ((double)a) - (double)b;
22551             PyFPE_END_PROTECT(result)
22552             return PyFloat_FromDouble(result);
22553     }
22554     return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
22555 }
22556 #endif
22557 
22558 /* PyDictVersioning */
22559 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)22560 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
22561     PyObject *dict = Py_TYPE(obj)->tp_dict;
22562     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
22563 }
__Pyx_get_object_dict_version(PyObject * obj)22564 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
22565     PyObject **dictptr = NULL;
22566     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
22567     if (offset) {
22568 #if CYTHON_COMPILING_IN_CPYTHON
22569         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
22570 #else
22571         dictptr = _PyObject_GetDictPtr(obj);
22572 #endif
22573     }
22574     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
22575 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)22576 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
22577     PyObject *dict = Py_TYPE(obj)->tp_dict;
22578     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
22579         return 0;
22580     return obj_dict_version == __Pyx_get_object_dict_version(obj);
22581 }
22582 #endif
22583 
22584 /* GetModuleGlobalName */
22585 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)22586 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
22587 #else
22588 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
22589 #endif
22590 {
22591     PyObject *result;
22592 #if !CYTHON_AVOID_BORROWED_REFS
22593 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
22594     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
22595     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
22596     if (likely(result)) {
22597         return __Pyx_NewRef(result);
22598     } else if (unlikely(PyErr_Occurred())) {
22599         return NULL;
22600     }
22601 #else
22602     result = PyDict_GetItem(__pyx_d, name);
22603     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
22604     if (likely(result)) {
22605         return __Pyx_NewRef(result);
22606     }
22607 #endif
22608 #else
22609     result = PyObject_GetItem(__pyx_d, name);
22610     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
22611     if (likely(result)) {
22612         return __Pyx_NewRef(result);
22613     }
22614     PyErr_Clear();
22615 #endif
22616     return __Pyx_GetBuiltinName(name);
22617 }
22618 
22619 /* PyFunctionFastCall */
22620 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)22621 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
22622                                                PyObject *globals) {
22623     PyFrameObject *f;
22624     PyThreadState *tstate = __Pyx_PyThreadState_Current;
22625     PyObject **fastlocals;
22626     Py_ssize_t i;
22627     PyObject *result;
22628     assert(globals != NULL);
22629     /* XXX Perhaps we should create a specialized
22630        PyFrame_New() that doesn't take locals, but does
22631        take builtins without sanity checking them.
22632        */
22633     assert(tstate != NULL);
22634     f = PyFrame_New(tstate, co, globals, NULL);
22635     if (f == NULL) {
22636         return NULL;
22637     }
22638     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
22639     for (i = 0; i < na; i++) {
22640         Py_INCREF(*args);
22641         fastlocals[i] = *args++;
22642     }
22643     result = PyEval_EvalFrameEx(f,0);
22644     ++tstate->recursion_depth;
22645     Py_DECREF(f);
22646     --tstate->recursion_depth;
22647     return result;
22648 }
22649 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)22650 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
22651     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
22652     PyObject *globals = PyFunction_GET_GLOBALS(func);
22653     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
22654     PyObject *closure;
22655 #if PY_MAJOR_VERSION >= 3
22656     PyObject *kwdefs;
22657 #endif
22658     PyObject *kwtuple, **k;
22659     PyObject **d;
22660     Py_ssize_t nd;
22661     Py_ssize_t nk;
22662     PyObject *result;
22663     assert(kwargs == NULL || PyDict_Check(kwargs));
22664     nk = kwargs ? PyDict_Size(kwargs) : 0;
22665     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
22666         return NULL;
22667     }
22668     if (
22669 #if PY_MAJOR_VERSION >= 3
22670             co->co_kwonlyargcount == 0 &&
22671 #endif
22672             likely(kwargs == NULL || nk == 0) &&
22673             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
22674         if (argdefs == NULL && co->co_argcount == nargs) {
22675             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
22676             goto done;
22677         }
22678         else if (nargs == 0 && argdefs != NULL
22679                  && co->co_argcount == Py_SIZE(argdefs)) {
22680             /* function called with no arguments, but all parameters have
22681                a default value: use default values as arguments .*/
22682             args = &PyTuple_GET_ITEM(argdefs, 0);
22683             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
22684             goto done;
22685         }
22686     }
22687     if (kwargs != NULL) {
22688         Py_ssize_t pos, i;
22689         kwtuple = PyTuple_New(2 * nk);
22690         if (kwtuple == NULL) {
22691             result = NULL;
22692             goto done;
22693         }
22694         k = &PyTuple_GET_ITEM(kwtuple, 0);
22695         pos = i = 0;
22696         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
22697             Py_INCREF(k[i]);
22698             Py_INCREF(k[i+1]);
22699             i += 2;
22700         }
22701         nk = i / 2;
22702     }
22703     else {
22704         kwtuple = NULL;
22705         k = NULL;
22706     }
22707     closure = PyFunction_GET_CLOSURE(func);
22708 #if PY_MAJOR_VERSION >= 3
22709     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
22710 #endif
22711     if (argdefs != NULL) {
22712         d = &PyTuple_GET_ITEM(argdefs, 0);
22713         nd = Py_SIZE(argdefs);
22714     }
22715     else {
22716         d = NULL;
22717         nd = 0;
22718     }
22719 #if PY_MAJOR_VERSION >= 3
22720     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
22721                                args, (int)nargs,
22722                                k, (int)nk,
22723                                d, (int)nd, kwdefs, closure);
22724 #else
22725     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
22726                                args, (int)nargs,
22727                                k, (int)nk,
22728                                d, (int)nd, closure);
22729 #endif
22730     Py_XDECREF(kwtuple);
22731 done:
22732     Py_LeaveRecursiveCall();
22733     return result;
22734 }
22735 #endif
22736 #endif
22737 
22738 /* PyObjectCallMethO */
22739 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)22740 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
22741     PyObject *self, *result;
22742     PyCFunction cfunc;
22743     cfunc = PyCFunction_GET_FUNCTION(func);
22744     self = PyCFunction_GET_SELF(func);
22745     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
22746         return NULL;
22747     result = cfunc(self, arg);
22748     Py_LeaveRecursiveCall();
22749     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
22750         PyErr_SetString(
22751             PyExc_SystemError,
22752             "NULL result without error in PyObject_Call");
22753     }
22754     return result;
22755 }
22756 #endif
22757 
22758 /* PyObjectCallNoArg */
22759 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallNoArg(PyObject * func)22760 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
22761 #if CYTHON_FAST_PYCALL
22762     if (PyFunction_Check(func)) {
22763         return __Pyx_PyFunction_FastCall(func, NULL, 0);
22764     }
22765 #endif
22766 #ifdef __Pyx_CyFunction_USED
22767     if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
22768 #else
22769     if (likely(PyCFunction_Check(func)))
22770 #endif
22771     {
22772         if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
22773             return __Pyx_PyObject_CallMethO(func, NULL);
22774         }
22775     }
22776     return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
22777 }
22778 #endif
22779 
22780 /* PyCFunctionFastCall */
22781 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)22782 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
22783     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
22784     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
22785     PyObject *self = PyCFunction_GET_SELF(func);
22786     int flags = PyCFunction_GET_FLAGS(func);
22787     assert(PyCFunction_Check(func));
22788     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
22789     assert(nargs >= 0);
22790     assert(nargs == 0 || args != NULL);
22791     /* _PyCFunction_FastCallDict() must not be called with an exception set,
22792        because it may clear it (directly or indirectly) and so the
22793        caller loses its exception */
22794     assert(!PyErr_Occurred());
22795     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
22796         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
22797     } else {
22798         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
22799     }
22800 }
22801 #endif
22802 
22803 /* PyObjectCallOneArg */
22804 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)22805 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
22806     PyObject *result;
22807     PyObject *args = PyTuple_New(1);
22808     if (unlikely(!args)) return NULL;
22809     Py_INCREF(arg);
22810     PyTuple_SET_ITEM(args, 0, arg);
22811     result = __Pyx_PyObject_Call(func, args, NULL);
22812     Py_DECREF(args);
22813     return result;
22814 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)22815 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
22816 #if CYTHON_FAST_PYCALL
22817     if (PyFunction_Check(func)) {
22818         return __Pyx_PyFunction_FastCall(func, &arg, 1);
22819     }
22820 #endif
22821     if (likely(PyCFunction_Check(func))) {
22822         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
22823             return __Pyx_PyObject_CallMethO(func, arg);
22824 #if CYTHON_FAST_PYCCALL
22825         } else if (__Pyx_PyFastCFunction_Check(func)) {
22826             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
22827 #endif
22828         }
22829     }
22830     return __Pyx__PyObject_CallOneArg(func, arg);
22831 }
22832 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)22833 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
22834     PyObject *result;
22835     PyObject *args = PyTuple_Pack(1, arg);
22836     if (unlikely(!args)) return NULL;
22837     result = __Pyx_PyObject_Call(func, args, NULL);
22838     Py_DECREF(args);
22839     return result;
22840 }
22841 #endif
22842 
22843 /* GetTopmostException */
22844 #if CYTHON_USE_EXC_INFO_STACK
22845 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)22846 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
22847 {
22848     _PyErr_StackItem *exc_info = tstate->exc_info;
22849     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
22850            exc_info->previous_item != NULL)
22851     {
22852         exc_info = exc_info->previous_item;
22853     }
22854     return exc_info;
22855 }
22856 #endif
22857 
22858 /* SaveResetException */
22859 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)22860 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
22861     #if CYTHON_USE_EXC_INFO_STACK
22862     _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
22863     *type = exc_info->exc_type;
22864     *value = exc_info->exc_value;
22865     *tb = exc_info->exc_traceback;
22866     #else
22867     *type = tstate->exc_type;
22868     *value = tstate->exc_value;
22869     *tb = tstate->exc_traceback;
22870     #endif
22871     Py_XINCREF(*type);
22872     Py_XINCREF(*value);
22873     Py_XINCREF(*tb);
22874 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)22875 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
22876     PyObject *tmp_type, *tmp_value, *tmp_tb;
22877     #if CYTHON_USE_EXC_INFO_STACK
22878     _PyErr_StackItem *exc_info = tstate->exc_info;
22879     tmp_type = exc_info->exc_type;
22880     tmp_value = exc_info->exc_value;
22881     tmp_tb = exc_info->exc_traceback;
22882     exc_info->exc_type = type;
22883     exc_info->exc_value = value;
22884     exc_info->exc_traceback = tb;
22885     #else
22886     tmp_type = tstate->exc_type;
22887     tmp_value = tstate->exc_value;
22888     tmp_tb = tstate->exc_traceback;
22889     tstate->exc_type = type;
22890     tstate->exc_value = value;
22891     tstate->exc_traceback = tb;
22892     #endif
22893     Py_XDECREF(tmp_type);
22894     Py_XDECREF(tmp_value);
22895     Py_XDECREF(tmp_tb);
22896 }
22897 #endif
22898 
22899 /* PyErrExceptionMatches */
22900 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)22901 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
22902     Py_ssize_t i, n;
22903     n = PyTuple_GET_SIZE(tuple);
22904 #if PY_MAJOR_VERSION >= 3
22905     for (i=0; i<n; i++) {
22906         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
22907     }
22908 #endif
22909     for (i=0; i<n; i++) {
22910         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
22911     }
22912     return 0;
22913 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)22914 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
22915     PyObject *exc_type = tstate->curexc_type;
22916     if (exc_type == err) return 1;
22917     if (unlikely(!exc_type)) return 0;
22918     if (unlikely(PyTuple_Check(err)))
22919         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
22920     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
22921 }
22922 #endif
22923 
22924 /* GetException */
22925 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)22926 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
22927 #else
22928 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
22929 #endif
22930 {
22931     PyObject *local_type, *local_value, *local_tb;
22932 #if CYTHON_FAST_THREAD_STATE
22933     PyObject *tmp_type, *tmp_value, *tmp_tb;
22934     local_type = tstate->curexc_type;
22935     local_value = tstate->curexc_value;
22936     local_tb = tstate->curexc_traceback;
22937     tstate->curexc_type = 0;
22938     tstate->curexc_value = 0;
22939     tstate->curexc_traceback = 0;
22940 #else
22941     PyErr_Fetch(&local_type, &local_value, &local_tb);
22942 #endif
22943     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
22944 #if CYTHON_FAST_THREAD_STATE
22945     if (unlikely(tstate->curexc_type))
22946 #else
22947     if (unlikely(PyErr_Occurred()))
22948 #endif
22949         goto bad;
22950     #if PY_MAJOR_VERSION >= 3
22951     if (local_tb) {
22952         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
22953             goto bad;
22954     }
22955     #endif
22956     Py_XINCREF(local_tb);
22957     Py_XINCREF(local_type);
22958     Py_XINCREF(local_value);
22959     *type = local_type;
22960     *value = local_value;
22961     *tb = local_tb;
22962 #if CYTHON_FAST_THREAD_STATE
22963     #if CYTHON_USE_EXC_INFO_STACK
22964     {
22965         _PyErr_StackItem *exc_info = tstate->exc_info;
22966         tmp_type = exc_info->exc_type;
22967         tmp_value = exc_info->exc_value;
22968         tmp_tb = exc_info->exc_traceback;
22969         exc_info->exc_type = local_type;
22970         exc_info->exc_value = local_value;
22971         exc_info->exc_traceback = local_tb;
22972     }
22973     #else
22974     tmp_type = tstate->exc_type;
22975     tmp_value = tstate->exc_value;
22976     tmp_tb = tstate->exc_traceback;
22977     tstate->exc_type = local_type;
22978     tstate->exc_value = local_value;
22979     tstate->exc_traceback = local_tb;
22980     #endif
22981     Py_XDECREF(tmp_type);
22982     Py_XDECREF(tmp_value);
22983     Py_XDECREF(tmp_tb);
22984 #else
22985     PyErr_SetExcInfo(local_type, local_value, local_tb);
22986 #endif
22987     return 0;
22988 bad:
22989     *type = 0;
22990     *value = 0;
22991     *tb = 0;
22992     Py_XDECREF(local_type);
22993     Py_XDECREF(local_value);
22994     Py_XDECREF(local_tb);
22995     return -1;
22996 }
22997 
22998 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)22999 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
23000     PyObject *args, *result = NULL;
23001     #if CYTHON_FAST_PYCALL
23002     if (PyFunction_Check(function)) {
23003         PyObject *args[2] = {arg1, arg2};
23004         return __Pyx_PyFunction_FastCall(function, args, 2);
23005     }
23006     #endif
23007     #if CYTHON_FAST_PYCCALL
23008     if (__Pyx_PyFastCFunction_Check(function)) {
23009         PyObject *args[2] = {arg1, arg2};
23010         return __Pyx_PyCFunction_FastCall(function, args, 2);
23011     }
23012     #endif
23013     args = PyTuple_New(2);
23014     if (unlikely(!args)) goto done;
23015     Py_INCREF(arg1);
23016     PyTuple_SET_ITEM(args, 0, arg1);
23017     Py_INCREF(arg2);
23018     PyTuple_SET_ITEM(args, 1, arg2);
23019     Py_INCREF(function);
23020     result = __Pyx_PyObject_Call(function, args, NULL);
23021     Py_DECREF(args);
23022     Py_DECREF(function);
23023 done:
23024     return result;
23025 }
23026 
23027 /* BytesEquals */
__Pyx_PyBytes_Equals(PyObject * s1,PyObject * s2,int equals)23028 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
23029 #if CYTHON_COMPILING_IN_PYPY
23030     return PyObject_RichCompareBool(s1, s2, equals);
23031 #else
23032     if (s1 == s2) {
23033         return (equals == Py_EQ);
23034     } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
23035         const char *ps1, *ps2;
23036         Py_ssize_t length = PyBytes_GET_SIZE(s1);
23037         if (length != PyBytes_GET_SIZE(s2))
23038             return (equals == Py_NE);
23039         ps1 = PyBytes_AS_STRING(s1);
23040         ps2 = PyBytes_AS_STRING(s2);
23041         if (ps1[0] != ps2[0]) {
23042             return (equals == Py_NE);
23043         } else if (length == 1) {
23044             return (equals == Py_EQ);
23045         } else {
23046             int result;
23047 #if CYTHON_USE_UNICODE_INTERNALS
23048             Py_hash_t hash1, hash2;
23049             hash1 = ((PyBytesObject*)s1)->ob_shash;
23050             hash2 = ((PyBytesObject*)s2)->ob_shash;
23051             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
23052                 return (equals == Py_NE);
23053             }
23054 #endif
23055             result = memcmp(ps1, ps2, (size_t)length);
23056             return (equals == Py_EQ) ? (result == 0) : (result != 0);
23057         }
23058     } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
23059         return (equals == Py_NE);
23060     } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
23061         return (equals == Py_NE);
23062     } else {
23063         int result;
23064         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
23065         if (!py_result)
23066             return -1;
23067         result = __Pyx_PyObject_IsTrue(py_result);
23068         Py_DECREF(py_result);
23069         return result;
23070     }
23071 #endif
23072 }
23073 
23074 /* UnicodeEquals */
__Pyx_PyUnicode_Equals(PyObject * s1,PyObject * s2,int equals)23075 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
23076 #if CYTHON_COMPILING_IN_PYPY
23077     return PyObject_RichCompareBool(s1, s2, equals);
23078 #else
23079 #if PY_MAJOR_VERSION < 3
23080     PyObject* owned_ref = NULL;
23081 #endif
23082     int s1_is_unicode, s2_is_unicode;
23083     if (s1 == s2) {
23084         goto return_eq;
23085     }
23086     s1_is_unicode = PyUnicode_CheckExact(s1);
23087     s2_is_unicode = PyUnicode_CheckExact(s2);
23088 #if PY_MAJOR_VERSION < 3
23089     if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
23090         owned_ref = PyUnicode_FromObject(s2);
23091         if (unlikely(!owned_ref))
23092             return -1;
23093         s2 = owned_ref;
23094         s2_is_unicode = 1;
23095     } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
23096         owned_ref = PyUnicode_FromObject(s1);
23097         if (unlikely(!owned_ref))
23098             return -1;
23099         s1 = owned_ref;
23100         s1_is_unicode = 1;
23101     } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
23102         return __Pyx_PyBytes_Equals(s1, s2, equals);
23103     }
23104 #endif
23105     if (s1_is_unicode & s2_is_unicode) {
23106         Py_ssize_t length;
23107         int kind;
23108         void *data1, *data2;
23109         if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
23110             return -1;
23111         length = __Pyx_PyUnicode_GET_LENGTH(s1);
23112         if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
23113             goto return_ne;
23114         }
23115 #if CYTHON_USE_UNICODE_INTERNALS
23116         {
23117             Py_hash_t hash1, hash2;
23118         #if CYTHON_PEP393_ENABLED
23119             hash1 = ((PyASCIIObject*)s1)->hash;
23120             hash2 = ((PyASCIIObject*)s2)->hash;
23121         #else
23122             hash1 = ((PyUnicodeObject*)s1)->hash;
23123             hash2 = ((PyUnicodeObject*)s2)->hash;
23124         #endif
23125             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
23126                 goto return_ne;
23127             }
23128         }
23129 #endif
23130         kind = __Pyx_PyUnicode_KIND(s1);
23131         if (kind != __Pyx_PyUnicode_KIND(s2)) {
23132             goto return_ne;
23133         }
23134         data1 = __Pyx_PyUnicode_DATA(s1);
23135         data2 = __Pyx_PyUnicode_DATA(s2);
23136         if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
23137             goto return_ne;
23138         } else if (length == 1) {
23139             goto return_eq;
23140         } else {
23141             int result = memcmp(data1, data2, (size_t)(length * kind));
23142             #if PY_MAJOR_VERSION < 3
23143             Py_XDECREF(owned_ref);
23144             #endif
23145             return (equals == Py_EQ) ? (result == 0) : (result != 0);
23146         }
23147     } else if ((s1 == Py_None) & s2_is_unicode) {
23148         goto return_ne;
23149     } else if ((s2 == Py_None) & s1_is_unicode) {
23150         goto return_ne;
23151     } else {
23152         int result;
23153         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
23154         #if PY_MAJOR_VERSION < 3
23155         Py_XDECREF(owned_ref);
23156         #endif
23157         if (!py_result)
23158             return -1;
23159         result = __Pyx_PyObject_IsTrue(py_result);
23160         Py_DECREF(py_result);
23161         return result;
23162     }
23163 return_eq:
23164     #if PY_MAJOR_VERSION < 3
23165     Py_XDECREF(owned_ref);
23166     #endif
23167     return (equals == Py_EQ);
23168 return_ne:
23169     #if PY_MAJOR_VERSION < 3
23170     Py_XDECREF(owned_ref);
23171     #endif
23172     return (equals == Py_NE);
23173 #endif
23174 }
23175 
23176 /* None */
__Pyx_div_Py_ssize_t(Py_ssize_t a,Py_ssize_t b)23177 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
23178     Py_ssize_t q = a / b;
23179     Py_ssize_t r = a - q*b;
23180     q -= ((r != 0) & ((r ^ b) < 0));
23181     return q;
23182 }
23183 
23184 /* GetAttr */
__Pyx_GetAttr(PyObject * o,PyObject * n)23185 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
23186 #if CYTHON_USE_TYPE_SLOTS
23187 #if PY_MAJOR_VERSION >= 3
23188     if (likely(PyUnicode_Check(n)))
23189 #else
23190     if (likely(PyString_Check(n)))
23191 #endif
23192         return __Pyx_PyObject_GetAttrStr(o, n);
23193 #endif
23194     return PyObject_GetAttr(o, n);
23195 }
23196 
23197 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)23198 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
23199     PyObject *r;
23200     if (!j) return NULL;
23201     r = PyObject_GetItem(o, j);
23202     Py_DECREF(j);
23203     return r;
23204 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)23205 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
23206                                                               CYTHON_NCP_UNUSED int wraparound,
23207                                                               CYTHON_NCP_UNUSED int boundscheck) {
23208 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
23209     Py_ssize_t wrapped_i = i;
23210     if (wraparound & unlikely(i < 0)) {
23211         wrapped_i += PyList_GET_SIZE(o);
23212     }
23213     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
23214         PyObject *r = PyList_GET_ITEM(o, wrapped_i);
23215         Py_INCREF(r);
23216         return r;
23217     }
23218     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23219 #else
23220     return PySequence_GetItem(o, i);
23221 #endif
23222 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)23223 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
23224                                                               CYTHON_NCP_UNUSED int wraparound,
23225                                                               CYTHON_NCP_UNUSED int boundscheck) {
23226 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
23227     Py_ssize_t wrapped_i = i;
23228     if (wraparound & unlikely(i < 0)) {
23229         wrapped_i += PyTuple_GET_SIZE(o);
23230     }
23231     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
23232         PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
23233         Py_INCREF(r);
23234         return r;
23235     }
23236     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23237 #else
23238     return PySequence_GetItem(o, i);
23239 #endif
23240 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)23241 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
23242                                                      CYTHON_NCP_UNUSED int wraparound,
23243                                                      CYTHON_NCP_UNUSED int boundscheck) {
23244 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
23245     if (is_list || PyList_CheckExact(o)) {
23246         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
23247         if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
23248             PyObject *r = PyList_GET_ITEM(o, n);
23249             Py_INCREF(r);
23250             return r;
23251         }
23252     }
23253     else if (PyTuple_CheckExact(o)) {
23254         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
23255         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
23256             PyObject *r = PyTuple_GET_ITEM(o, n);
23257             Py_INCREF(r);
23258             return r;
23259         }
23260     } else {
23261         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
23262         if (likely(m && m->sq_item)) {
23263             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
23264                 Py_ssize_t l = m->sq_length(o);
23265                 if (likely(l >= 0)) {
23266                     i += l;
23267                 } else {
23268                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
23269                         return NULL;
23270                     PyErr_Clear();
23271                 }
23272             }
23273             return m->sq_item(o, i);
23274         }
23275     }
23276 #else
23277     if (is_list || PySequence_Check(o)) {
23278         return PySequence_GetItem(o, i);
23279     }
23280 #endif
23281     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23282 }
23283 
23284 /* ObjectGetItem */
23285 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetIndex(PyObject * obj,PyObject * index)23286 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
23287     PyObject *runerr;
23288     Py_ssize_t key_value;
23289     PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
23290     if (unlikely(!(m && m->sq_item))) {
23291         PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
23292         return NULL;
23293     }
23294     key_value = __Pyx_PyIndex_AsSsize_t(index);
23295     if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
23296         return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
23297     }
23298     if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
23299         PyErr_Clear();
23300         PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
23301     }
23302     return NULL;
23303 }
__Pyx_PyObject_GetItem(PyObject * obj,PyObject * key)23304 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
23305     PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
23306     if (likely(m && m->mp_subscript)) {
23307         return m->mp_subscript(obj, key);
23308     }
23309     return __Pyx_PyObject_GetIndex(obj, key);
23310 }
23311 #endif
23312 
23313 /* decode_c_string */
__Pyx_decode_c_string(const char * cstring,Py_ssize_t start,Py_ssize_t stop,const char * encoding,const char * errors,PyObject * (* decode_func)(const char * s,Py_ssize_t size,const char * errors))23314 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
23315          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
23316          const char* encoding, const char* errors,
23317          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
23318     Py_ssize_t length;
23319     if (unlikely((start < 0) | (stop < 0))) {
23320         size_t slen = strlen(cstring);
23321         if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
23322             PyErr_SetString(PyExc_OverflowError,
23323                             "c-string too long to convert to Python");
23324             return NULL;
23325         }
23326         length = (Py_ssize_t) slen;
23327         if (start < 0) {
23328             start += length;
23329             if (start < 0)
23330                 start = 0;
23331         }
23332         if (stop < 0)
23333             stop += length;
23334     }
23335     if (unlikely(stop <= start))
23336         return __Pyx_NewRef(__pyx_empty_unicode);
23337     length = stop - start;
23338     cstring += start;
23339     if (decode_func) {
23340         return decode_func(cstring, length, errors);
23341     } else {
23342         return PyUnicode_Decode(cstring, length, encoding, errors);
23343     }
23344 }
23345 
23346 /* GetAttr3 */
__Pyx_GetAttr3Default(PyObject * d)23347 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
23348     __Pyx_PyThreadState_declare
23349     __Pyx_PyThreadState_assign
23350     if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
23351         return NULL;
23352     __Pyx_PyErr_Clear();
23353     Py_INCREF(d);
23354     return d;
23355 }
__Pyx_GetAttr3(PyObject * o,PyObject * n,PyObject * d)23356 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
23357     PyObject *r = __Pyx_GetAttr(o, n);
23358     return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
23359 }
23360 
23361 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)23362 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
23363     PyErr_Format(PyExc_ValueError,
23364                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
23365 }
23366 
23367 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)23368 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
23369     PyErr_Format(PyExc_ValueError,
23370                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
23371                  index, (index == 1) ? "" : "s");
23372 }
23373 
23374 /* RaiseNoneIterError */
__Pyx_RaiseNoneNotIterableError(void)23375 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
23376     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
23377 }
23378 
23379 /* ExtTypeTest */
__Pyx_TypeTest(PyObject * obj,PyTypeObject * type)23380 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
23381     if (unlikely(!type)) {
23382         PyErr_SetString(PyExc_SystemError, "Missing type object");
23383         return 0;
23384     }
23385     if (likely(__Pyx_TypeCheck(obj, type)))
23386         return 1;
23387     PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
23388                  Py_TYPE(obj)->tp_name, type->tp_name);
23389     return 0;
23390 }
23391 
23392 /* SwapException */
23393 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSwap(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)23394 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
23395     PyObject *tmp_type, *tmp_value, *tmp_tb;
23396     #if CYTHON_USE_EXC_INFO_STACK
23397     _PyErr_StackItem *exc_info = tstate->exc_info;
23398     tmp_type = exc_info->exc_type;
23399     tmp_value = exc_info->exc_value;
23400     tmp_tb = exc_info->exc_traceback;
23401     exc_info->exc_type = *type;
23402     exc_info->exc_value = *value;
23403     exc_info->exc_traceback = *tb;
23404     #else
23405     tmp_type = tstate->exc_type;
23406     tmp_value = tstate->exc_value;
23407     tmp_tb = tstate->exc_traceback;
23408     tstate->exc_type = *type;
23409     tstate->exc_value = *value;
23410     tstate->exc_traceback = *tb;
23411     #endif
23412     *type = tmp_type;
23413     *value = tmp_value;
23414     *tb = tmp_tb;
23415 }
23416 #else
__Pyx_ExceptionSwap(PyObject ** type,PyObject ** value,PyObject ** tb)23417 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
23418     PyObject *tmp_type, *tmp_value, *tmp_tb;
23419     PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
23420     PyErr_SetExcInfo(*type, *value, *tb);
23421     *type = tmp_type;
23422     *value = tmp_value;
23423     *tb = tmp_tb;
23424 }
23425 #endif
23426 
23427 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)23428 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
23429     PyObject *empty_list = 0;
23430     PyObject *module = 0;
23431     PyObject *global_dict = 0;
23432     PyObject *empty_dict = 0;
23433     PyObject *list;
23434     #if PY_MAJOR_VERSION < 3
23435     PyObject *py_import;
23436     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
23437     if (!py_import)
23438         goto bad;
23439     #endif
23440     if (from_list)
23441         list = from_list;
23442     else {
23443         empty_list = PyList_New(0);
23444         if (!empty_list)
23445             goto bad;
23446         list = empty_list;
23447     }
23448     global_dict = PyModule_GetDict(__pyx_m);
23449     if (!global_dict)
23450         goto bad;
23451     empty_dict = PyDict_New();
23452     if (!empty_dict)
23453         goto bad;
23454     {
23455         #if PY_MAJOR_VERSION >= 3
23456         if (level == -1) {
23457             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
23458                 module = PyImport_ImportModuleLevelObject(
23459                     name, global_dict, empty_dict, list, 1);
23460                 if (!module) {
23461                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
23462                         goto bad;
23463                     PyErr_Clear();
23464                 }
23465             }
23466             level = 0;
23467         }
23468         #endif
23469         if (!module) {
23470             #if PY_MAJOR_VERSION < 3
23471             PyObject *py_level = PyInt_FromLong(level);
23472             if (!py_level)
23473                 goto bad;
23474             module = PyObject_CallFunctionObjArgs(py_import,
23475                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
23476             Py_DECREF(py_level);
23477             #else
23478             module = PyImport_ImportModuleLevelObject(
23479                 name, global_dict, empty_dict, list, level);
23480             #endif
23481         }
23482     }
23483 bad:
23484     #if PY_MAJOR_VERSION < 3
23485     Py_XDECREF(py_import);
23486     #endif
23487     Py_XDECREF(empty_list);
23488     Py_XDECREF(empty_dict);
23489     return module;
23490 }
23491 
23492 /* FastTypeChecks */
23493 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)23494 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
23495     while (a) {
23496         a = a->tp_base;
23497         if (a == b)
23498             return 1;
23499     }
23500     return b == &PyBaseObject_Type;
23501 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)23502 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
23503     PyObject *mro;
23504     if (a == b) return 1;
23505     mro = a->tp_mro;
23506     if (likely(mro)) {
23507         Py_ssize_t i, n;
23508         n = PyTuple_GET_SIZE(mro);
23509         for (i = 0; i < n; i++) {
23510             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
23511                 return 1;
23512         }
23513         return 0;
23514     }
23515     return __Pyx_InBases(a, b);
23516 }
23517 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)23518 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
23519     PyObject *exception, *value, *tb;
23520     int res;
23521     __Pyx_PyThreadState_declare
23522     __Pyx_PyThreadState_assign
23523     __Pyx_ErrFetch(&exception, &value, &tb);
23524     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
23525     if (unlikely(res == -1)) {
23526         PyErr_WriteUnraisable(err);
23527         res = 0;
23528     }
23529     if (!res) {
23530         res = PyObject_IsSubclass(err, exc_type2);
23531         if (unlikely(res == -1)) {
23532             PyErr_WriteUnraisable(err);
23533             res = 0;
23534         }
23535     }
23536     __Pyx_ErrRestore(exception, value, tb);
23537     return res;
23538 }
23539 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)23540 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
23541     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
23542     if (!res) {
23543         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
23544     }
23545     return res;
23546 }
23547 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)23548 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
23549     Py_ssize_t i, n;
23550     assert(PyExceptionClass_Check(exc_type));
23551     n = PyTuple_GET_SIZE(tuple);
23552 #if PY_MAJOR_VERSION >= 3
23553     for (i=0; i<n; i++) {
23554         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
23555     }
23556 #endif
23557     for (i=0; i<n; i++) {
23558         PyObject *t = PyTuple_GET_ITEM(tuple, i);
23559         #if PY_MAJOR_VERSION < 3
23560         if (likely(exc_type == t)) return 1;
23561         #endif
23562         if (likely(PyExceptionClass_Check(t))) {
23563             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
23564         } else {
23565         }
23566     }
23567     return 0;
23568 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)23569 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
23570     if (likely(err == exc_type)) return 1;
23571     if (likely(PyExceptionClass_Check(err))) {
23572         if (likely(PyExceptionClass_Check(exc_type))) {
23573             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
23574         } else if (likely(PyTuple_Check(exc_type))) {
23575             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
23576         } else {
23577         }
23578     }
23579     return PyErr_GivenExceptionMatches(err, exc_type);
23580 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)23581 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
23582     assert(PyExceptionClass_Check(exc_type1));
23583     assert(PyExceptionClass_Check(exc_type2));
23584     if (likely(err == exc_type1 || err == exc_type2)) return 1;
23585     if (likely(PyExceptionClass_Check(err))) {
23586         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
23587     }
23588     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
23589 }
23590 #endif
23591 
23592 /* PyIntBinop */
23593 #if !CYTHON_COMPILING_IN_PYPY
__Pyx_PyInt_AddObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,int inplace,int zerodivision_check)23594 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
23595     (void)inplace;
23596     (void)zerodivision_check;
23597     #if PY_MAJOR_VERSION < 3
23598     if (likely(PyInt_CheckExact(op1))) {
23599         const long b = intval;
23600         long x;
23601         long a = PyInt_AS_LONG(op1);
23602             x = (long)((unsigned long)a + b);
23603             if (likely((x^a) >= 0 || (x^b) >= 0))
23604                 return PyInt_FromLong(x);
23605             return PyLong_Type.tp_as_number->nb_add(op1, op2);
23606     }
23607     #endif
23608     #if CYTHON_USE_PYLONG_INTERNALS
23609     if (likely(PyLong_CheckExact(op1))) {
23610         const long b = intval;
23611         long a, x;
23612 #ifdef HAVE_LONG_LONG
23613         const PY_LONG_LONG llb = intval;
23614         PY_LONG_LONG lla, llx;
23615 #endif
23616         const digit* digits = ((PyLongObject*)op1)->ob_digit;
23617         const Py_ssize_t size = Py_SIZE(op1);
23618         if (likely(__Pyx_sst_abs(size) <= 1)) {
23619             a = likely(size) ? digits[0] : 0;
23620             if (size == -1) a = -a;
23621         } else {
23622             switch (size) {
23623                 case -2:
23624                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
23625                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23626                         break;
23627 #ifdef HAVE_LONG_LONG
23628                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
23629                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
23630                         goto long_long;
23631 #endif
23632                     }
23633                     CYTHON_FALLTHROUGH;
23634                 case 2:
23635                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
23636                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23637                         break;
23638 #ifdef HAVE_LONG_LONG
23639                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
23640                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
23641                         goto long_long;
23642 #endif
23643                     }
23644                     CYTHON_FALLTHROUGH;
23645                 case -3:
23646                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
23647                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23648                         break;
23649 #ifdef HAVE_LONG_LONG
23650                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
23651                         lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
23652                         goto long_long;
23653 #endif
23654                     }
23655                     CYTHON_FALLTHROUGH;
23656                 case 3:
23657                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
23658                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23659                         break;
23660 #ifdef HAVE_LONG_LONG
23661                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
23662                         lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
23663                         goto long_long;
23664 #endif
23665                     }
23666                     CYTHON_FALLTHROUGH;
23667                 case -4:
23668                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
23669                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23670                         break;
23671 #ifdef HAVE_LONG_LONG
23672                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
23673                         lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
23674                         goto long_long;
23675 #endif
23676                     }
23677                     CYTHON_FALLTHROUGH;
23678                 case 4:
23679                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
23680                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
23681                         break;
23682 #ifdef HAVE_LONG_LONG
23683                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
23684                         lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
23685                         goto long_long;
23686 #endif
23687                     }
23688                     CYTHON_FALLTHROUGH;
23689                 default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
23690             }
23691         }
23692                 x = a + b;
23693             return PyLong_FromLong(x);
23694 #ifdef HAVE_LONG_LONG
23695         long_long:
23696                 llx = lla + llb;
23697             return PyLong_FromLongLong(llx);
23698 #endif
23699 
23700 
23701     }
23702     #endif
23703     if (PyFloat_CheckExact(op1)) {
23704         const long b = intval;
23705         double a = PyFloat_AS_DOUBLE(op1);
23706             double result;
23707             PyFPE_START_PROTECT("add", return NULL)
23708             result = ((double)a) + (double)b;
23709             PyFPE_END_PROTECT(result)
23710             return PyFloat_FromDouble(result);
23711     }
23712     return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
23713 }
23714 #endif
23715 
23716 /* None */
__Pyx_RaiseUnboundLocalError(const char * varname)23717 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
23718     PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
23719 }
23720 
23721 /* None */
__Pyx_div_long(long a,long b)23722 static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
23723     long q = a / b;
23724     long r = a - q*b;
23725     q -= ((r != 0) & ((r ^ b) < 0));
23726     return q;
23727 }
23728 
23729 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)23730 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
23731     PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
23732     if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
23733         PyErr_Format(PyExc_ImportError,
23734         #if PY_MAJOR_VERSION < 3
23735             "cannot import name %.230s", PyString_AS_STRING(name));
23736         #else
23737             "cannot import name %S", name);
23738         #endif
23739     }
23740     return value;
23741 }
23742 
23743 /* HasAttr */
__Pyx_HasAttr(PyObject * o,PyObject * n)23744 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
23745     PyObject *r;
23746     if (unlikely(!__Pyx_PyBaseString_Check(n))) {
23747         PyErr_SetString(PyExc_TypeError,
23748                         "hasattr(): attribute name must be string");
23749         return -1;
23750     }
23751     r = __Pyx_GetAttr(o, n);
23752     if (unlikely(!r)) {
23753         PyErr_Clear();
23754         return 0;
23755     } else {
23756         Py_DECREF(r);
23757         return 1;
23758     }
23759 }
23760 
23761 /* PyObject_GenericGetAttrNoDict */
23762 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)23763 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
23764     PyErr_Format(PyExc_AttributeError,
23765 #if PY_MAJOR_VERSION >= 3
23766                  "'%.50s' object has no attribute '%U'",
23767                  tp->tp_name, attr_name);
23768 #else
23769                  "'%.50s' object has no attribute '%.400s'",
23770                  tp->tp_name, PyString_AS_STRING(attr_name));
23771 #endif
23772     return NULL;
23773 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)23774 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
23775     PyObject *descr;
23776     PyTypeObject *tp = Py_TYPE(obj);
23777     if (unlikely(!PyString_Check(attr_name))) {
23778         return PyObject_GenericGetAttr(obj, attr_name);
23779     }
23780     assert(!tp->tp_dictoffset);
23781     descr = _PyType_Lookup(tp, attr_name);
23782     if (unlikely(!descr)) {
23783         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
23784     }
23785     Py_INCREF(descr);
23786     #if PY_MAJOR_VERSION < 3
23787     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
23788     #endif
23789     {
23790         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
23791         if (unlikely(f)) {
23792             PyObject *res = f(descr, obj, (PyObject *)tp);
23793             Py_DECREF(descr);
23794             return res;
23795         }
23796     }
23797     return descr;
23798 }
23799 #endif
23800 
23801 /* PyObject_GenericGetAttr */
23802 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)23803 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
23804     if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
23805         return PyObject_GenericGetAttr(obj, attr_name);
23806     }
23807     return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
23808 }
23809 #endif
23810 
23811 /* SetVTable */
__Pyx_SetVtable(PyObject * dict,void * vtable)23812 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
23813 #if PY_VERSION_HEX >= 0x02070000
23814     PyObject *ob = PyCapsule_New(vtable, 0, 0);
23815 #else
23816     PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
23817 #endif
23818     if (!ob)
23819         goto bad;
23820     if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
23821         goto bad;
23822     Py_DECREF(ob);
23823     return 0;
23824 bad:
23825     Py_XDECREF(ob);
23826     return -1;
23827 }
23828 
23829 /* PyObjectGetAttrStrNoError */
__Pyx_PyObject_GetAttrStr_ClearAttributeError(void)23830 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
23831     __Pyx_PyThreadState_declare
23832     __Pyx_PyThreadState_assign
23833     if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
23834         __Pyx_PyErr_Clear();
23835 }
__Pyx_PyObject_GetAttrStrNoError(PyObject * obj,PyObject * attr_name)23836 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
23837     PyObject *result;
23838 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
23839     PyTypeObject* tp = Py_TYPE(obj);
23840     if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
23841         return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
23842     }
23843 #endif
23844     result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
23845     if (unlikely(!result)) {
23846         __Pyx_PyObject_GetAttrStr_ClearAttributeError();
23847     }
23848     return result;
23849 }
23850 
23851 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)23852 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
23853   int ret;
23854   PyObject *name_attr;
23855   name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
23856   if (likely(name_attr)) {
23857       ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
23858   } else {
23859       ret = -1;
23860   }
23861   if (unlikely(ret < 0)) {
23862       PyErr_Clear();
23863       ret = 0;
23864   }
23865   Py_XDECREF(name_attr);
23866   return ret;
23867 }
__Pyx_setup_reduce(PyObject * type_obj)23868 static int __Pyx_setup_reduce(PyObject* type_obj) {
23869     int ret = 0;
23870     PyObject *object_reduce = NULL;
23871     PyObject *object_reduce_ex = NULL;
23872     PyObject *reduce = NULL;
23873     PyObject *reduce_ex = NULL;
23874     PyObject *reduce_cython = NULL;
23875     PyObject *setstate = NULL;
23876     PyObject *setstate_cython = NULL;
23877 #if CYTHON_USE_PYTYPE_LOOKUP
23878     if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
23879 #else
23880     if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
23881 #endif
23882 #if CYTHON_USE_PYTYPE_LOOKUP
23883     object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
23884 #else
23885     object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
23886 #endif
23887     reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
23888     if (reduce_ex == object_reduce_ex) {
23889 #if CYTHON_USE_PYTYPE_LOOKUP
23890         object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
23891 #else
23892         object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
23893 #endif
23894         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
23895         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
23896             reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
23897             if (likely(reduce_cython)) {
23898                 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
23899                 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
23900             } else if (reduce == object_reduce || PyErr_Occurred()) {
23901                 goto __PYX_BAD;
23902             }
23903             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
23904             if (!setstate) PyErr_Clear();
23905             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
23906                 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
23907                 if (likely(setstate_cython)) {
23908                     ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
23909                     ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
23910                 } else if (!setstate || PyErr_Occurred()) {
23911                     goto __PYX_BAD;
23912                 }
23913             }
23914             PyType_Modified((PyTypeObject*)type_obj);
23915         }
23916     }
23917     goto __PYX_GOOD;
23918 __PYX_BAD:
23919     if (!PyErr_Occurred())
23920         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
23921     ret = -1;
23922 __PYX_GOOD:
23923 #if !CYTHON_USE_PYTYPE_LOOKUP
23924     Py_XDECREF(object_reduce);
23925     Py_XDECREF(object_reduce_ex);
23926 #endif
23927     Py_XDECREF(reduce);
23928     Py_XDECREF(reduce_ex);
23929     Py_XDECREF(reduce_cython);
23930     Py_XDECREF(setstate);
23931     Py_XDECREF(setstate_cython);
23932     return ret;
23933 }
23934 
23935 /* TypeImport */
23936 #ifndef __PYX_HAVE_RT_ImportType
23937 #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)23938 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
23939     size_t size, enum __Pyx_ImportType_CheckSize check_size)
23940 {
23941     PyObject *result = 0;
23942     char warning[200];
23943     Py_ssize_t basicsize;
23944 #ifdef Py_LIMITED_API
23945     PyObject *py_basicsize;
23946 #endif
23947     result = PyObject_GetAttrString(module, class_name);
23948     if (!result)
23949         goto bad;
23950     if (!PyType_Check(result)) {
23951         PyErr_Format(PyExc_TypeError,
23952             "%.200s.%.200s is not a type object",
23953             module_name, class_name);
23954         goto bad;
23955     }
23956 #ifndef Py_LIMITED_API
23957     basicsize = ((PyTypeObject *)result)->tp_basicsize;
23958 #else
23959     py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
23960     if (!py_basicsize)
23961         goto bad;
23962     basicsize = PyLong_AsSsize_t(py_basicsize);
23963     Py_DECREF(py_basicsize);
23964     py_basicsize = 0;
23965     if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
23966         goto bad;
23967 #endif
23968     if ((size_t)basicsize < size) {
23969         PyErr_Format(PyExc_ValueError,
23970             "%.200s.%.200s size changed, may indicate binary incompatibility. "
23971             "Expected %zd from C header, got %zd from PyObject",
23972             module_name, class_name, size, basicsize);
23973         goto bad;
23974     }
23975     if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
23976         PyErr_Format(PyExc_ValueError,
23977             "%.200s.%.200s size changed, may indicate binary incompatibility. "
23978             "Expected %zd from C header, got %zd from PyObject",
23979             module_name, class_name, size, basicsize);
23980         goto bad;
23981     }
23982     else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
23983         PyOS_snprintf(warning, sizeof(warning),
23984             "%s.%s size changed, may indicate binary incompatibility. "
23985             "Expected %zd from C header, got %zd from PyObject",
23986             module_name, class_name, size, basicsize);
23987         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
23988     }
23989     return (PyTypeObject *)result;
23990 bad:
23991     Py_XDECREF(result);
23992     return NULL;
23993 }
23994 #endif
23995 
23996 /* GetVTable */
__Pyx_GetVtable(PyObject * dict)23997 static void* __Pyx_GetVtable(PyObject *dict) {
23998     void* ptr;
23999     PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
24000     if (!ob)
24001         goto bad;
24002 #if PY_VERSION_HEX >= 0x02070000
24003     ptr = PyCapsule_GetPointer(ob, 0);
24004 #else
24005     ptr = PyCObject_AsVoidPtr(ob);
24006 #endif
24007     if (!ptr && !PyErr_Occurred())
24008         PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
24009     Py_DECREF(ob);
24010     return ptr;
24011 bad:
24012     Py_XDECREF(ob);
24013     return NULL;
24014 }
24015 
24016 /* CLineInTraceback */
24017 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)24018 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
24019     PyObject *use_cline;
24020     PyObject *ptype, *pvalue, *ptraceback;
24021 #if CYTHON_COMPILING_IN_CPYTHON
24022     PyObject **cython_runtime_dict;
24023 #endif
24024     if (unlikely(!__pyx_cython_runtime)) {
24025         return c_line;
24026     }
24027     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
24028 #if CYTHON_COMPILING_IN_CPYTHON
24029     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
24030     if (likely(cython_runtime_dict)) {
24031         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
24032             use_cline, *cython_runtime_dict,
24033             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
24034     } else
24035 #endif
24036     {
24037       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
24038       if (use_cline_obj) {
24039         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
24040         Py_DECREF(use_cline_obj);
24041       } else {
24042         PyErr_Clear();
24043         use_cline = NULL;
24044       }
24045     }
24046     if (!use_cline) {
24047         c_line = 0;
24048         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
24049     }
24050     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
24051         c_line = 0;
24052     }
24053     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
24054     return c_line;
24055 }
24056 #endif
24057 
24058 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)24059 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
24060     int start = 0, mid = 0, end = count - 1;
24061     if (end >= 0 && code_line > entries[end].code_line) {
24062         return count;
24063     }
24064     while (start < end) {
24065         mid = start + (end - start) / 2;
24066         if (code_line < entries[mid].code_line) {
24067             end = mid;
24068         } else if (code_line > entries[mid].code_line) {
24069              start = mid + 1;
24070         } else {
24071             return mid;
24072         }
24073     }
24074     if (code_line <= entries[mid].code_line) {
24075         return mid;
24076     } else {
24077         return mid + 1;
24078     }
24079 }
__pyx_find_code_object(int code_line)24080 static PyCodeObject *__pyx_find_code_object(int code_line) {
24081     PyCodeObject* code_object;
24082     int pos;
24083     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
24084         return NULL;
24085     }
24086     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
24087     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
24088         return NULL;
24089     }
24090     code_object = __pyx_code_cache.entries[pos].code_object;
24091     Py_INCREF(code_object);
24092     return code_object;
24093 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)24094 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
24095     int pos, i;
24096     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
24097     if (unlikely(!code_line)) {
24098         return;
24099     }
24100     if (unlikely(!entries)) {
24101         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
24102         if (likely(entries)) {
24103             __pyx_code_cache.entries = entries;
24104             __pyx_code_cache.max_count = 64;
24105             __pyx_code_cache.count = 1;
24106             entries[0].code_line = code_line;
24107             entries[0].code_object = code_object;
24108             Py_INCREF(code_object);
24109         }
24110         return;
24111     }
24112     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
24113     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
24114         PyCodeObject* tmp = entries[pos].code_object;
24115         entries[pos].code_object = code_object;
24116         Py_DECREF(tmp);
24117         return;
24118     }
24119     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
24120         int new_max = __pyx_code_cache.max_count + 64;
24121         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
24122             __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
24123         if (unlikely(!entries)) {
24124             return;
24125         }
24126         __pyx_code_cache.entries = entries;
24127         __pyx_code_cache.max_count = new_max;
24128     }
24129     for (i=__pyx_code_cache.count; i>pos; i--) {
24130         entries[i] = entries[i-1];
24131     }
24132     entries[pos].code_line = code_line;
24133     entries[pos].code_object = code_object;
24134     __pyx_code_cache.count++;
24135     Py_INCREF(code_object);
24136 }
24137 
24138 /* AddTraceback */
24139 #include "compile.h"
24140 #include "frameobject.h"
24141 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)24142 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
24143             const char *funcname, int c_line,
24144             int py_line, const char *filename) {
24145     PyCodeObject *py_code = 0;
24146     PyObject *py_srcfile = 0;
24147     PyObject *py_funcname = 0;
24148     #if PY_MAJOR_VERSION < 3
24149     py_srcfile = PyString_FromString(filename);
24150     #else
24151     py_srcfile = PyUnicode_FromString(filename);
24152     #endif
24153     if (!py_srcfile) goto bad;
24154     if (c_line) {
24155         #if PY_MAJOR_VERSION < 3
24156         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
24157         #else
24158         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
24159         #endif
24160     }
24161     else {
24162         #if PY_MAJOR_VERSION < 3
24163         py_funcname = PyString_FromString(funcname);
24164         #else
24165         py_funcname = PyUnicode_FromString(funcname);
24166         #endif
24167     }
24168     if (!py_funcname) goto bad;
24169     py_code = __Pyx_PyCode_New(
24170         0,
24171         0,
24172         0,
24173         0,
24174         0,
24175         __pyx_empty_bytes, /*PyObject *code,*/
24176         __pyx_empty_tuple, /*PyObject *consts,*/
24177         __pyx_empty_tuple, /*PyObject *names,*/
24178         __pyx_empty_tuple, /*PyObject *varnames,*/
24179         __pyx_empty_tuple, /*PyObject *freevars,*/
24180         __pyx_empty_tuple, /*PyObject *cellvars,*/
24181         py_srcfile,   /*PyObject *filename,*/
24182         py_funcname,  /*PyObject *name,*/
24183         py_line,
24184         __pyx_empty_bytes  /*PyObject *lnotab*/
24185     );
24186     Py_DECREF(py_srcfile);
24187     Py_DECREF(py_funcname);
24188     return py_code;
24189 bad:
24190     Py_XDECREF(py_srcfile);
24191     Py_XDECREF(py_funcname);
24192     return NULL;
24193 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)24194 static void __Pyx_AddTraceback(const char *funcname, int c_line,
24195                                int py_line, const char *filename) {
24196     PyCodeObject *py_code = 0;
24197     PyFrameObject *py_frame = 0;
24198     PyThreadState *tstate = __Pyx_PyThreadState_Current;
24199     if (c_line) {
24200         c_line = __Pyx_CLineForTraceback(tstate, c_line);
24201     }
24202     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
24203     if (!py_code) {
24204         py_code = __Pyx_CreateCodeObjectForTraceback(
24205             funcname, c_line, py_line, filename);
24206         if (!py_code) goto bad;
24207         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
24208     }
24209     py_frame = PyFrame_New(
24210         tstate,            /*PyThreadState *tstate,*/
24211         py_code,           /*PyCodeObject *code,*/
24212         __pyx_d,    /*PyObject *globals,*/
24213         0                  /*PyObject *locals*/
24214     );
24215     if (!py_frame) goto bad;
24216     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
24217     PyTraceBack_Here(py_frame);
24218 bad:
24219     Py_XDECREF(py_code);
24220     Py_XDECREF(py_frame);
24221 }
24222 
24223 #if PY_MAJOR_VERSION < 3
__Pyx_GetBuffer(PyObject * obj,Py_buffer * view,int flags)24224 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
24225     if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
24226         if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
24227         if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
24228     PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
24229     return -1;
24230 }
__Pyx_ReleaseBuffer(Py_buffer * view)24231 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
24232     PyObject *obj = view->obj;
24233     if (!obj) return;
24234     if (PyObject_CheckBuffer(obj)) {
24235         PyBuffer_Release(view);
24236         return;
24237     }
24238     if ((0)) {}
24239     view->obj = NULL;
24240     Py_DECREF(obj);
24241 }
24242 #endif
24243 
24244 
24245 /* MemviewSliceIsContig */
24246 static int
__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs,char order,int ndim)24247 __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
24248 {
24249     int i, index, step, start;
24250     Py_ssize_t itemsize = mvs.memview->view.itemsize;
24251     if (order == 'F') {
24252         step = 1;
24253         start = 0;
24254     } else {
24255         step = -1;
24256         start = ndim - 1;
24257     }
24258     for (i = 0; i < ndim; i++) {
24259         index = start + step * i;
24260         if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
24261             return 0;
24262         itemsize *= mvs.shape[index];
24263     }
24264     return 1;
24265 }
24266 
24267 /* OverlappingSlices */
24268 static void
__pyx_get_array_memory_extents(__Pyx_memviewslice * slice,void ** out_start,void ** out_end,int ndim,size_t itemsize)24269 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
24270                                void **out_start, void **out_end,
24271                                int ndim, size_t itemsize)
24272 {
24273     char *start, *end;
24274     int i;
24275     start = end = slice->data;
24276     for (i = 0; i < ndim; i++) {
24277         Py_ssize_t stride = slice->strides[i];
24278         Py_ssize_t extent = slice->shape[i];
24279         if (extent == 0) {
24280             *out_start = *out_end = start;
24281             return;
24282         } else {
24283             if (stride > 0)
24284                 end += stride * (extent - 1);
24285             else
24286                 start += stride * (extent - 1);
24287         }
24288     }
24289     *out_start = start;
24290     *out_end = end + itemsize;
24291 }
24292 static int
__pyx_slices_overlap(__Pyx_memviewslice * slice1,__Pyx_memviewslice * slice2,int ndim,size_t itemsize)24293 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
24294                      __Pyx_memviewslice *slice2,
24295                      int ndim, size_t itemsize)
24296 {
24297     void *start1, *end1, *start2, *end2;
24298     __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
24299     __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
24300     return (start1 < end2) && (start2 < end1);
24301 }
24302 
24303 /* Capsule */
24304 static CYTHON_INLINE PyObject *
__pyx_capsule_create(void * p,CYTHON_UNUSED const char * sig)24305 __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
24306 {
24307     PyObject *cobj;
24308 #if PY_VERSION_HEX >= 0x02070000
24309     cobj = PyCapsule_New(p, sig, NULL);
24310 #else
24311     cobj = PyCObject_FromVoidPtr(p, NULL);
24312 #endif
24313     return cobj;
24314 }
24315 
24316 /* IsLittleEndian */
__Pyx_Is_Little_Endian(void)24317 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
24318 {
24319   union {
24320     uint32_t u32;
24321     uint8_t u8[4];
24322   } S;
24323   S.u32 = 0x01020304;
24324   return S.u8[0] == 4;
24325 }
24326 
24327 /* BufferFormatCheck */
__Pyx_BufFmt_Init(__Pyx_BufFmt_Context * ctx,__Pyx_BufFmt_StackElem * stack,__Pyx_TypeInfo * type)24328 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
24329                               __Pyx_BufFmt_StackElem* stack,
24330                               __Pyx_TypeInfo* type) {
24331   stack[0].field = &ctx->root;
24332   stack[0].parent_offset = 0;
24333   ctx->root.type = type;
24334   ctx->root.name = "buffer dtype";
24335   ctx->root.offset = 0;
24336   ctx->head = stack;
24337   ctx->head->field = &ctx->root;
24338   ctx->fmt_offset = 0;
24339   ctx->head->parent_offset = 0;
24340   ctx->new_packmode = '@';
24341   ctx->enc_packmode = '@';
24342   ctx->new_count = 1;
24343   ctx->enc_count = 0;
24344   ctx->enc_type = 0;
24345   ctx->is_complex = 0;
24346   ctx->is_valid_array = 0;
24347   ctx->struct_alignment = 0;
24348   while (type->typegroup == 'S') {
24349     ++ctx->head;
24350     ctx->head->field = type->fields;
24351     ctx->head->parent_offset = 0;
24352     type = type->fields->type;
24353   }
24354 }
__Pyx_BufFmt_ParseNumber(const char ** ts)24355 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
24356     int count;
24357     const char* t = *ts;
24358     if (*t < '0' || *t > '9') {
24359       return -1;
24360     } else {
24361         count = *t++ - '0';
24362         while (*t >= '0' && *t <= '9') {
24363             count *= 10;
24364             count += *t++ - '0';
24365         }
24366     }
24367     *ts = t;
24368     return count;
24369 }
__Pyx_BufFmt_ExpectNumber(const char ** ts)24370 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
24371     int number = __Pyx_BufFmt_ParseNumber(ts);
24372     if (number == -1)
24373         PyErr_Format(PyExc_ValueError,\
24374                      "Does not understand character buffer dtype format string ('%c')", **ts);
24375     return number;
24376 }
__Pyx_BufFmt_RaiseUnexpectedChar(char ch)24377 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
24378   PyErr_Format(PyExc_ValueError,
24379                "Unexpected format string character: '%c'", ch);
24380 }
__Pyx_BufFmt_DescribeTypeChar(char ch,int is_complex)24381 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
24382   switch (ch) {
24383     case '?': return "'bool'";
24384     case 'c': return "'char'";
24385     case 'b': return "'signed char'";
24386     case 'B': return "'unsigned char'";
24387     case 'h': return "'short'";
24388     case 'H': return "'unsigned short'";
24389     case 'i': return "'int'";
24390     case 'I': return "'unsigned int'";
24391     case 'l': return "'long'";
24392     case 'L': return "'unsigned long'";
24393     case 'q': return "'long long'";
24394     case 'Q': return "'unsigned long long'";
24395     case 'f': return (is_complex ? "'complex float'" : "'float'");
24396     case 'd': return (is_complex ? "'complex double'" : "'double'");
24397     case 'g': return (is_complex ? "'complex long double'" : "'long double'");
24398     case 'T': return "a struct";
24399     case 'O': return "Python object";
24400     case 'P': return "a pointer";
24401     case 's': case 'p': return "a string";
24402     case 0: return "end";
24403     default: return "unparseable format string";
24404   }
24405 }
__Pyx_BufFmt_TypeCharToStandardSize(char ch,int is_complex)24406 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
24407   switch (ch) {
24408     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
24409     case 'h': case 'H': return 2;
24410     case 'i': case 'I': case 'l': case 'L': return 4;
24411     case 'q': case 'Q': return 8;
24412     case 'f': return (is_complex ? 8 : 4);
24413     case 'd': return (is_complex ? 16 : 8);
24414     case 'g': {
24415       PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
24416       return 0;
24417     }
24418     case 'O': case 'P': return sizeof(void*);
24419     default:
24420       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24421       return 0;
24422     }
24423 }
__Pyx_BufFmt_TypeCharToNativeSize(char ch,int is_complex)24424 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
24425   switch (ch) {
24426     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
24427     case 'h': case 'H': return sizeof(short);
24428     case 'i': case 'I': return sizeof(int);
24429     case 'l': case 'L': return sizeof(long);
24430     #ifdef HAVE_LONG_LONG
24431     case 'q': case 'Q': return sizeof(PY_LONG_LONG);
24432     #endif
24433     case 'f': return sizeof(float) * (is_complex ? 2 : 1);
24434     case 'd': return sizeof(double) * (is_complex ? 2 : 1);
24435     case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
24436     case 'O': case 'P': return sizeof(void*);
24437     default: {
24438       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24439       return 0;
24440     }
24441   }
24442 }
24443 typedef struct { char c; short x; } __Pyx_st_short;
24444 typedef struct { char c; int x; } __Pyx_st_int;
24445 typedef struct { char c; long x; } __Pyx_st_long;
24446 typedef struct { char c; float x; } __Pyx_st_float;
24447 typedef struct { char c; double x; } __Pyx_st_double;
24448 typedef struct { char c; long double x; } __Pyx_st_longdouble;
24449 typedef struct { char c; void *x; } __Pyx_st_void_p;
24450 #ifdef HAVE_LONG_LONG
24451 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
24452 #endif
__Pyx_BufFmt_TypeCharToAlignment(char ch,CYTHON_UNUSED int is_complex)24453 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
24454   switch (ch) {
24455     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
24456     case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
24457     case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
24458     case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
24459 #ifdef HAVE_LONG_LONG
24460     case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
24461 #endif
24462     case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
24463     case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
24464     case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
24465     case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
24466     default:
24467       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24468       return 0;
24469     }
24470 }
24471 /* These are for computing the padding at the end of the struct to align
24472    on the first member of the struct. This will probably the same as above,
24473    but we don't have any guarantees.
24474  */
24475 typedef struct { short x; char c; } __Pyx_pad_short;
24476 typedef struct { int x; char c; } __Pyx_pad_int;
24477 typedef struct { long x; char c; } __Pyx_pad_long;
24478 typedef struct { float x; char c; } __Pyx_pad_float;
24479 typedef struct { double x; char c; } __Pyx_pad_double;
24480 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
24481 typedef struct { void *x; char c; } __Pyx_pad_void_p;
24482 #ifdef HAVE_LONG_LONG
24483 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
24484 #endif
__Pyx_BufFmt_TypeCharToPadding(char ch,CYTHON_UNUSED int is_complex)24485 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
24486   switch (ch) {
24487     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
24488     case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
24489     case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
24490     case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
24491 #ifdef HAVE_LONG_LONG
24492     case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
24493 #endif
24494     case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
24495     case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
24496     case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
24497     case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
24498     default:
24499       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24500       return 0;
24501     }
24502 }
__Pyx_BufFmt_TypeCharToGroup(char ch,int is_complex)24503 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
24504   switch (ch) {
24505     case 'c':
24506         return 'H';
24507     case 'b': case 'h': case 'i':
24508     case 'l': case 'q': case 's': case 'p':
24509         return 'I';
24510     case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
24511         return 'U';
24512     case 'f': case 'd': case 'g':
24513         return (is_complex ? 'C' : 'R');
24514     case 'O':
24515         return 'O';
24516     case 'P':
24517         return 'P';
24518     default: {
24519       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24520       return 0;
24521     }
24522   }
24523 }
__Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context * ctx)24524 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
24525   if (ctx->head == NULL || ctx->head->field == &ctx->root) {
24526     const char* expected;
24527     const char* quote;
24528     if (ctx->head == NULL) {
24529       expected = "end";
24530       quote = "";
24531     } else {
24532       expected = ctx->head->field->type->name;
24533       quote = "'";
24534     }
24535     PyErr_Format(PyExc_ValueError,
24536                  "Buffer dtype mismatch, expected %s%s%s but got %s",
24537                  quote, expected, quote,
24538                  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
24539   } else {
24540     __Pyx_StructField* field = ctx->head->field;
24541     __Pyx_StructField* parent = (ctx->head - 1)->field;
24542     PyErr_Format(PyExc_ValueError,
24543                  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
24544                  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
24545                  parent->type->name, field->name);
24546   }
24547 }
__Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context * ctx)24548 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
24549   char group;
24550   size_t size, offset, arraysize = 1;
24551   if (ctx->enc_type == 0) return 0;
24552   if (ctx->head->field->type->arraysize[0]) {
24553     int i, ndim = 0;
24554     if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
24555         ctx->is_valid_array = ctx->head->field->type->ndim == 1;
24556         ndim = 1;
24557         if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
24558             PyErr_Format(PyExc_ValueError,
24559                          "Expected a dimension of size %zu, got %zu",
24560                          ctx->head->field->type->arraysize[0], ctx->enc_count);
24561             return -1;
24562         }
24563     }
24564     if (!ctx->is_valid_array) {
24565       PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
24566                    ctx->head->field->type->ndim, ndim);
24567       return -1;
24568     }
24569     for (i = 0; i < ctx->head->field->type->ndim; i++) {
24570       arraysize *= ctx->head->field->type->arraysize[i];
24571     }
24572     ctx->is_valid_array = 0;
24573     ctx->enc_count = 1;
24574   }
24575   group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
24576   do {
24577     __Pyx_StructField* field = ctx->head->field;
24578     __Pyx_TypeInfo* type = field->type;
24579     if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
24580       size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
24581     } else {
24582       size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
24583     }
24584     if (ctx->enc_packmode == '@') {
24585       size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
24586       size_t align_mod_offset;
24587       if (align_at == 0) return -1;
24588       align_mod_offset = ctx->fmt_offset % align_at;
24589       if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
24590       if (ctx->struct_alignment == 0)
24591           ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
24592                                                                  ctx->is_complex);
24593     }
24594     if (type->size != size || type->typegroup != group) {
24595       if (type->typegroup == 'C' && type->fields != NULL) {
24596         size_t parent_offset = ctx->head->parent_offset + field->offset;
24597         ++ctx->head;
24598         ctx->head->field = type->fields;
24599         ctx->head->parent_offset = parent_offset;
24600         continue;
24601       }
24602       if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
24603       } else {
24604           __Pyx_BufFmt_RaiseExpected(ctx);
24605           return -1;
24606       }
24607     }
24608     offset = ctx->head->parent_offset + field->offset;
24609     if (ctx->fmt_offset != offset) {
24610       PyErr_Format(PyExc_ValueError,
24611                    "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
24612                    (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
24613       return -1;
24614     }
24615     ctx->fmt_offset += size;
24616     if (arraysize)
24617       ctx->fmt_offset += (arraysize - 1) * size;
24618     --ctx->enc_count;
24619     while (1) {
24620       if (field == &ctx->root) {
24621         ctx->head = NULL;
24622         if (ctx->enc_count != 0) {
24623           __Pyx_BufFmt_RaiseExpected(ctx);
24624           return -1;
24625         }
24626         break;
24627       }
24628       ctx->head->field = ++field;
24629       if (field->type == NULL) {
24630         --ctx->head;
24631         field = ctx->head->field;
24632         continue;
24633       } else if (field->type->typegroup == 'S') {
24634         size_t parent_offset = ctx->head->parent_offset + field->offset;
24635         if (field->type->fields->type == NULL) continue;
24636         field = field->type->fields;
24637         ++ctx->head;
24638         ctx->head->field = field;
24639         ctx->head->parent_offset = parent_offset;
24640         break;
24641       } else {
24642         break;
24643       }
24644     }
24645   } while (ctx->enc_count);
24646   ctx->enc_type = 0;
24647   ctx->is_complex = 0;
24648   return 0;
24649 }
24650 static PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context * ctx,const char ** tsp)24651 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
24652 {
24653     const char *ts = *tsp;
24654     int i = 0, number, ndim;
24655     ++ts;
24656     if (ctx->new_count != 1) {
24657         PyErr_SetString(PyExc_ValueError,
24658                         "Cannot handle repeated arrays in format string");
24659         return NULL;
24660     }
24661     if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24662     ndim = ctx->head->field->type->ndim;
24663     while (*ts && *ts != ')') {
24664         switch (*ts) {
24665             case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
24666             default:  break;
24667         }
24668         number = __Pyx_BufFmt_ExpectNumber(&ts);
24669         if (number == -1) return NULL;
24670         if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
24671             return PyErr_Format(PyExc_ValueError,
24672                         "Expected a dimension of size %zu, got %d",
24673                         ctx->head->field->type->arraysize[i], number);
24674         if (*ts != ',' && *ts != ')')
24675             return PyErr_Format(PyExc_ValueError,
24676                                 "Expected a comma in format string, got '%c'", *ts);
24677         if (*ts == ',') ts++;
24678         i++;
24679     }
24680     if (i != ndim)
24681         return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
24682                             ctx->head->field->type->ndim, i);
24683     if (!*ts) {
24684         PyErr_SetString(PyExc_ValueError,
24685                         "Unexpected end of format string, expected ')'");
24686         return NULL;
24687     }
24688     ctx->is_valid_array = 1;
24689     ctx->new_count = 1;
24690     *tsp = ++ts;
24691     return Py_None;
24692 }
__Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context * ctx,const char * ts)24693 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
24694   int got_Z = 0;
24695   while (1) {
24696     switch(*ts) {
24697       case 0:
24698         if (ctx->enc_type != 0 && ctx->head == NULL) {
24699           __Pyx_BufFmt_RaiseExpected(ctx);
24700           return NULL;
24701         }
24702         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24703         if (ctx->head != NULL) {
24704           __Pyx_BufFmt_RaiseExpected(ctx);
24705           return NULL;
24706         }
24707         return ts;
24708       case ' ':
24709       case '\r':
24710       case '\n':
24711         ++ts;
24712         break;
24713       case '<':
24714         if (!__Pyx_Is_Little_Endian()) {
24715           PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
24716           return NULL;
24717         }
24718         ctx->new_packmode = '=';
24719         ++ts;
24720         break;
24721       case '>':
24722       case '!':
24723         if (__Pyx_Is_Little_Endian()) {
24724           PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
24725           return NULL;
24726         }
24727         ctx->new_packmode = '=';
24728         ++ts;
24729         break;
24730       case '=':
24731       case '@':
24732       case '^':
24733         ctx->new_packmode = *ts++;
24734         break;
24735       case 'T':
24736         {
24737           const char* ts_after_sub;
24738           size_t i, struct_count = ctx->new_count;
24739           size_t struct_alignment = ctx->struct_alignment;
24740           ctx->new_count = 1;
24741           ++ts;
24742           if (*ts != '{') {
24743             PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
24744             return NULL;
24745           }
24746           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24747           ctx->enc_type = 0;
24748           ctx->enc_count = 0;
24749           ctx->struct_alignment = 0;
24750           ++ts;
24751           ts_after_sub = ts;
24752           for (i = 0; i != struct_count; ++i) {
24753             ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
24754             if (!ts_after_sub) return NULL;
24755           }
24756           ts = ts_after_sub;
24757           if (struct_alignment) ctx->struct_alignment = struct_alignment;
24758         }
24759         break;
24760       case '}':
24761         {
24762           size_t alignment = ctx->struct_alignment;
24763           ++ts;
24764           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24765           ctx->enc_type = 0;
24766           if (alignment && ctx->fmt_offset % alignment) {
24767             ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
24768           }
24769         }
24770         return ts;
24771       case 'x':
24772         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24773         ctx->fmt_offset += ctx->new_count;
24774         ctx->new_count = 1;
24775         ctx->enc_count = 0;
24776         ctx->enc_type = 0;
24777         ctx->enc_packmode = ctx->new_packmode;
24778         ++ts;
24779         break;
24780       case 'Z':
24781         got_Z = 1;
24782         ++ts;
24783         if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
24784           __Pyx_BufFmt_RaiseUnexpectedChar('Z');
24785           return NULL;
24786         }
24787         CYTHON_FALLTHROUGH;
24788       case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
24789       case 'l': case 'L': case 'q': case 'Q':
24790       case 'f': case 'd': case 'g':
24791       case 'O': case 'p':
24792         if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
24793             (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
24794           ctx->enc_count += ctx->new_count;
24795           ctx->new_count = 1;
24796           got_Z = 0;
24797           ++ts;
24798           break;
24799         }
24800         CYTHON_FALLTHROUGH;
24801       case 's':
24802         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24803         ctx->enc_count = ctx->new_count;
24804         ctx->enc_packmode = ctx->new_packmode;
24805         ctx->enc_type = *ts;
24806         ctx->is_complex = got_Z;
24807         ++ts;
24808         ctx->new_count = 1;
24809         got_Z = 0;
24810         break;
24811       case ':':
24812         ++ts;
24813         while(*ts != ':') ++ts;
24814         ++ts;
24815         break;
24816       case '(':
24817         if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
24818         break;
24819       default:
24820         {
24821           int number = __Pyx_BufFmt_ExpectNumber(&ts);
24822           if (number == -1) return NULL;
24823           ctx->new_count = (size_t)number;
24824         }
24825     }
24826   }
24827 }
24828 
24829 /* TypeInfoCompare */
24830   static int
__pyx_typeinfo_cmp(__Pyx_TypeInfo * a,__Pyx_TypeInfo * b)24831 __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
24832 {
24833     int i;
24834     if (!a || !b)
24835         return 0;
24836     if (a == b)
24837         return 1;
24838     if (a->size != b->size || a->typegroup != b->typegroup ||
24839             a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
24840         if (a->typegroup == 'H' || b->typegroup == 'H') {
24841             return a->size == b->size;
24842         } else {
24843             return 0;
24844         }
24845     }
24846     if (a->ndim) {
24847         for (i = 0; i < a->ndim; i++)
24848             if (a->arraysize[i] != b->arraysize[i])
24849                 return 0;
24850     }
24851     if (a->typegroup == 'S') {
24852         if (a->flags != b->flags)
24853             return 0;
24854         if (a->fields || b->fields) {
24855             if (!(a->fields && b->fields))
24856                 return 0;
24857             for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
24858                 __Pyx_StructField *field_a = a->fields + i;
24859                 __Pyx_StructField *field_b = b->fields + i;
24860                 if (field_a->offset != field_b->offset ||
24861                     !__pyx_typeinfo_cmp(field_a->type, field_b->type))
24862                     return 0;
24863             }
24864             return !a->fields[i].type && !b->fields[i].type;
24865         }
24866     }
24867     return 1;
24868 }
24869 
24870 /* MemviewSliceValidateAndInit */
24871   static int
__pyx_check_strides(Py_buffer * buf,int dim,int ndim,int spec)24872 __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
24873 {
24874     if (buf->shape[dim] <= 1)
24875         return 1;
24876     if (buf->strides) {
24877         if (spec & __Pyx_MEMVIEW_CONTIG) {
24878             if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
24879                 if (unlikely(buf->strides[dim] != sizeof(void *))) {
24880                     PyErr_Format(PyExc_ValueError,
24881                                  "Buffer is not indirectly contiguous "
24882                                  "in dimension %d.", dim);
24883                     goto fail;
24884                 }
24885             } else if (unlikely(buf->strides[dim] != buf->itemsize)) {
24886                 PyErr_SetString(PyExc_ValueError,
24887                                 "Buffer and memoryview are not contiguous "
24888                                 "in the same dimension.");
24889                 goto fail;
24890             }
24891         }
24892         if (spec & __Pyx_MEMVIEW_FOLLOW) {
24893             Py_ssize_t stride = buf->strides[dim];
24894             if (stride < 0)
24895                 stride = -stride;
24896             if (unlikely(stride < buf->itemsize)) {
24897                 PyErr_SetString(PyExc_ValueError,
24898                                 "Buffer and memoryview are not contiguous "
24899                                 "in the same dimension.");
24900                 goto fail;
24901             }
24902         }
24903     } else {
24904         if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) {
24905             PyErr_Format(PyExc_ValueError,
24906                          "C-contiguous buffer is not contiguous in "
24907                          "dimension %d", dim);
24908             goto fail;
24909         } else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) {
24910             PyErr_Format(PyExc_ValueError,
24911                          "C-contiguous buffer is not indirect in "
24912                          "dimension %d", dim);
24913             goto fail;
24914         } else if (unlikely(buf->suboffsets)) {
24915             PyErr_SetString(PyExc_ValueError,
24916                             "Buffer exposes suboffsets but no strides");
24917             goto fail;
24918         }
24919     }
24920     return 1;
24921 fail:
24922     return 0;
24923 }
24924 static int
__pyx_check_suboffsets(Py_buffer * buf,int dim,CYTHON_UNUSED int ndim,int spec)24925 __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
24926 {
24927     if (spec & __Pyx_MEMVIEW_DIRECT) {
24928         if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) {
24929             PyErr_Format(PyExc_ValueError,
24930                          "Buffer not compatible with direct access "
24931                          "in dimension %d.", dim);
24932             goto fail;
24933         }
24934     }
24935     if (spec & __Pyx_MEMVIEW_PTR) {
24936         if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) {
24937             PyErr_Format(PyExc_ValueError,
24938                          "Buffer is not indirectly accessible "
24939                          "in dimension %d.", dim);
24940             goto fail;
24941         }
24942     }
24943     return 1;
24944 fail:
24945     return 0;
24946 }
24947 static int
__pyx_verify_contig(Py_buffer * buf,int ndim,int c_or_f_flag)24948 __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
24949 {
24950     int i;
24951     if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
24952         Py_ssize_t stride = 1;
24953         for (i = 0; i < ndim; i++) {
24954             if (unlikely(stride * buf->itemsize != buf->strides[i]  &&  buf->shape[i] > 1)) {
24955                 PyErr_SetString(PyExc_ValueError,
24956                     "Buffer not fortran contiguous.");
24957                 goto fail;
24958             }
24959             stride = stride * buf->shape[i];
24960         }
24961     } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
24962         Py_ssize_t stride = 1;
24963         for (i = ndim - 1; i >- 1; i--) {
24964             if (unlikely(stride * buf->itemsize != buf->strides[i]  &&  buf->shape[i] > 1)) {
24965                 PyErr_SetString(PyExc_ValueError,
24966                     "Buffer not C contiguous.");
24967                 goto fail;
24968             }
24969             stride = stride * buf->shape[i];
24970         }
24971     }
24972     return 1;
24973 fail:
24974     return 0;
24975 }
__Pyx_ValidateAndInit_memviewslice(int * axes_specs,int c_or_f_flag,int buf_flags,int ndim,__Pyx_TypeInfo * dtype,__Pyx_BufFmt_StackElem stack[],__Pyx_memviewslice * memviewslice,PyObject * original_obj)24976 static int __Pyx_ValidateAndInit_memviewslice(
24977                 int *axes_specs,
24978                 int c_or_f_flag,
24979                 int buf_flags,
24980                 int ndim,
24981                 __Pyx_TypeInfo *dtype,
24982                 __Pyx_BufFmt_StackElem stack[],
24983                 __Pyx_memviewslice *memviewslice,
24984                 PyObject *original_obj)
24985 {
24986     struct __pyx_memoryview_obj *memview, *new_memview;
24987     __Pyx_RefNannyDeclarations
24988     Py_buffer *buf;
24989     int i, spec = 0, retval = -1;
24990     __Pyx_BufFmt_Context ctx;
24991     int from_memoryview = __pyx_memoryview_check(original_obj);
24992     __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
24993     if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
24994                                                             original_obj)->typeinfo)) {
24995         memview = (struct __pyx_memoryview_obj *) original_obj;
24996         new_memview = NULL;
24997     } else {
24998         memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
24999                                             original_obj, buf_flags, 0, dtype);
25000         new_memview = memview;
25001         if (unlikely(!memview))
25002             goto fail;
25003     }
25004     buf = &memview->view;
25005     if (unlikely(buf->ndim != ndim)) {
25006         PyErr_Format(PyExc_ValueError,
25007                 "Buffer has wrong number of dimensions (expected %d, got %d)",
25008                 ndim, buf->ndim);
25009         goto fail;
25010     }
25011     if (new_memview) {
25012         __Pyx_BufFmt_Init(&ctx, stack, dtype);
25013         if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format))) goto fail;
25014     }
25015     if (unlikely((unsigned) buf->itemsize != dtype->size)) {
25016         PyErr_Format(PyExc_ValueError,
25017                      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
25018                      "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
25019                      buf->itemsize,
25020                      (buf->itemsize > 1) ? "s" : "",
25021                      dtype->name,
25022                      dtype->size,
25023                      (dtype->size > 1) ? "s" : "");
25024         goto fail;
25025     }
25026     if (buf->len > 0) {
25027         for (i = 0; i < ndim; i++) {
25028             spec = axes_specs[i];
25029             if (unlikely(!__pyx_check_strides(buf, i, ndim, spec)))
25030                 goto fail;
25031             if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
25032                 goto fail;
25033         }
25034         if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
25035             goto fail;
25036     }
25037     if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
25038                                          new_memview != NULL) == -1)) {
25039         goto fail;
25040     }
25041     retval = 0;
25042     goto no_fail;
25043 fail:
25044     Py_XDECREF(new_memview);
25045     retval = -1;
25046 no_fail:
25047     __Pyx_RefNannyFinishContext();
25048     return retval;
25049 }
25050 
25051 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float_t(PyObject * obj,int writable_flag)25052   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_float_t(PyObject *obj, int writable_flag) {
25053     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
25054     __Pyx_BufFmt_StackElem stack[1];
25055     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
25056     int retcode;
25057     if (obj == Py_None) {
25058         result.memview = (struct __pyx_memoryview_obj *) Py_None;
25059         return result;
25060     }
25061     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
25062                                                  PyBUF_RECORDS_RO | writable_flag, 1,
25063                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, stack,
25064                                                  &result, obj);
25065     if (unlikely(retcode == -1))
25066         goto __pyx_fail;
25067     return result;
25068 __pyx_fail:
25069     result.memview = NULL;
25070     result.data = NULL;
25071     return result;
25072 }
25073 
25074 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float_t(PyObject * obj,int writable_flag)25075   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_float_t(PyObject *obj, int writable_flag) {
25076     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
25077     __Pyx_BufFmt_StackElem stack[1];
25078     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
25079     int retcode;
25080     if (obj == Py_None) {
25081         result.memview = (struct __pyx_memoryview_obj *) Py_None;
25082         return result;
25083     }
25084     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
25085                                                  PyBUF_RECORDS_RO | writable_flag, 2,
25086                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, stack,
25087                                                  &result, obj);
25088     if (unlikely(retcode == -1))
25089         goto __pyx_fail;
25090     return result;
25091 __pyx_fail:
25092     result.memview = NULL;
25093     result.data = NULL;
25094     return result;
25095 }
25096 
25097 /* CIntFromPyVerify */
25098   #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
25099     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
25100 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
25101     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
25102 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
25103     {\
25104         func_type value = func_value;\
25105         if (sizeof(target_type) < sizeof(func_type)) {\
25106             if (unlikely(value != (func_type) (target_type) value)) {\
25107                 func_type zero = 0;\
25108                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
25109                     return (target_type) -1;\
25110                 if (is_unsigned && unlikely(value < zero))\
25111                     goto raise_neg_overflow;\
25112                 else\
25113                     goto raise_overflow;\
25114             }\
25115         }\
25116         return (target_type) value;\
25117     }
25118 
25119 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_nn___pyx_t_5numpy_float_t(PyObject * obj,int writable_flag)25120   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_nn___pyx_t_5numpy_float_t(PyObject *obj, int writable_flag) {
25121     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
25122     __Pyx_BufFmt_StackElem stack[1];
25123     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
25124     int retcode;
25125     if (obj == Py_None) {
25126         result.memview = (struct __pyx_memoryview_obj *) Py_None;
25127         return result;
25128     }
25129     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
25130                                                  PyBUF_RECORDS_RO | writable_flag, 4,
25131                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, stack,
25132                                                  &result, obj);
25133     if (unlikely(retcode == -1))
25134         goto __pyx_fail;
25135     return result;
25136 __pyx_fail:
25137     result.memview = NULL;
25138     result.data = NULL;
25139     return result;
25140 }
25141 
25142 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_int_t(PyObject * obj,int writable_flag)25143   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_nn___pyx_t_5numpy_int_t(PyObject *obj, int writable_flag) {
25144     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
25145     __Pyx_BufFmt_StackElem stack[1];
25146     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
25147     int retcode;
25148     if (obj == Py_None) {
25149         result.memview = (struct __pyx_memoryview_obj *) Py_None;
25150         return result;
25151     }
25152     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
25153                                                  PyBUF_RECORDS_RO | writable_flag, 2,
25154                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, stack,
25155                                                  &result, obj);
25156     if (unlikely(retcode == -1))
25157         goto __pyx_fail;
25158     return result;
25159 __pyx_fail:
25160     result.memview = NULL;
25161     result.data = NULL;
25162     return result;
25163 }
25164 
25165 /* Declarations */
25166   #if CYTHON_CCOMPLEX
25167   #ifdef __cplusplus
__pyx_t_float_complex_from_parts(float x,float y)25168     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
25169       return ::std::complex< float >(x, y);
25170     }
25171   #else
__pyx_t_float_complex_from_parts(float x,float y)25172     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
25173       return x + y*(__pyx_t_float_complex)_Complex_I;
25174     }
25175   #endif
25176 #else
__pyx_t_float_complex_from_parts(float x,float y)25177     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
25178       __pyx_t_float_complex z;
25179       z.real = x;
25180       z.imag = y;
25181       return z;
25182     }
25183 #endif
25184 
25185 /* Arithmetic */
25186   #if CYTHON_CCOMPLEX
25187 #else
__Pyx_c_eq_float(__pyx_t_float_complex a,__pyx_t_float_complex b)25188     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25189        return (a.real == b.real) && (a.imag == b.imag);
25190     }
__Pyx_c_sum_float(__pyx_t_float_complex a,__pyx_t_float_complex b)25191     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25192         __pyx_t_float_complex z;
25193         z.real = a.real + b.real;
25194         z.imag = a.imag + b.imag;
25195         return z;
25196     }
__Pyx_c_diff_float(__pyx_t_float_complex a,__pyx_t_float_complex b)25197     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25198         __pyx_t_float_complex z;
25199         z.real = a.real - b.real;
25200         z.imag = a.imag - b.imag;
25201         return z;
25202     }
__Pyx_c_prod_float(__pyx_t_float_complex a,__pyx_t_float_complex b)25203     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25204         __pyx_t_float_complex z;
25205         z.real = a.real * b.real - a.imag * b.imag;
25206         z.imag = a.real * b.imag + a.imag * b.real;
25207         return z;
25208     }
25209     #if 1
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)25210     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25211         if (b.imag == 0) {
25212             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
25213         } else if (fabsf(b.real) >= fabsf(b.imag)) {
25214             if (b.real == 0 && b.imag == 0) {
25215                 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
25216             } else {
25217                 float r = b.imag / b.real;
25218                 float s = (float)(1.0) / (b.real + b.imag * r);
25219                 return __pyx_t_float_complex_from_parts(
25220                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
25221             }
25222         } else {
25223             float r = b.real / b.imag;
25224             float s = (float)(1.0) / (b.imag + b.real * r);
25225             return __pyx_t_float_complex_from_parts(
25226                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
25227         }
25228     }
25229     #else
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)25230     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25231         if (b.imag == 0) {
25232             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
25233         } else {
25234             float denom = b.real * b.real + b.imag * b.imag;
25235             return __pyx_t_float_complex_from_parts(
25236                 (a.real * b.real + a.imag * b.imag) / denom,
25237                 (a.imag * b.real - a.real * b.imag) / denom);
25238         }
25239     }
25240     #endif
__Pyx_c_neg_float(__pyx_t_float_complex a)25241     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
25242         __pyx_t_float_complex z;
25243         z.real = -a.real;
25244         z.imag = -a.imag;
25245         return z;
25246     }
__Pyx_c_is_zero_float(__pyx_t_float_complex a)25247     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
25248        return (a.real == 0) && (a.imag == 0);
25249     }
__Pyx_c_conj_float(__pyx_t_float_complex a)25250     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
25251         __pyx_t_float_complex z;
25252         z.real =  a.real;
25253         z.imag = -a.imag;
25254         return z;
25255     }
25256     #if 1
__Pyx_c_abs_float(__pyx_t_float_complex z)25257         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
25258           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
25259             return sqrtf(z.real*z.real + z.imag*z.imag);
25260           #else
25261             return hypotf(z.real, z.imag);
25262           #endif
25263         }
__Pyx_c_pow_float(__pyx_t_float_complex a,__pyx_t_float_complex b)25264         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25265             __pyx_t_float_complex z;
25266             float r, lnr, theta, z_r, z_theta;
25267             if (b.imag == 0 && b.real == (int)b.real) {
25268                 if (b.real < 0) {
25269                     float denom = a.real * a.real + a.imag * a.imag;
25270                     a.real = a.real / denom;
25271                     a.imag = -a.imag / denom;
25272                     b.real = -b.real;
25273                 }
25274                 switch ((int)b.real) {
25275                     case 0:
25276                         z.real = 1;
25277                         z.imag = 0;
25278                         return z;
25279                     case 1:
25280                         return a;
25281                     case 2:
25282                         return __Pyx_c_prod_float(a, a);
25283                     case 3:
25284                         z = __Pyx_c_prod_float(a, a);
25285                         return __Pyx_c_prod_float(z, a);
25286                     case 4:
25287                         z = __Pyx_c_prod_float(a, a);
25288                         return __Pyx_c_prod_float(z, z);
25289                 }
25290             }
25291             if (a.imag == 0) {
25292                 if (a.real == 0) {
25293                     return a;
25294                 } else if (b.imag == 0) {
25295                     z.real = powf(a.real, b.real);
25296                     z.imag = 0;
25297                     return z;
25298                 } else if (a.real > 0) {
25299                     r = a.real;
25300                     theta = 0;
25301                 } else {
25302                     r = -a.real;
25303                     theta = atan2f(0.0, -1.0);
25304                 }
25305             } else {
25306                 r = __Pyx_c_abs_float(a);
25307                 theta = atan2f(a.imag, a.real);
25308             }
25309             lnr = logf(r);
25310             z_r = expf(lnr * b.real - theta * b.imag);
25311             z_theta = theta * b.real + lnr * b.imag;
25312             z.real = z_r * cosf(z_theta);
25313             z.imag = z_r * sinf(z_theta);
25314             return z;
25315         }
25316     #endif
25317 #endif
25318 
25319 /* Declarations */
25320   #if CYTHON_CCOMPLEX
25321   #ifdef __cplusplus
__pyx_t_double_complex_from_parts(double x,double y)25322     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
25323       return ::std::complex< double >(x, y);
25324     }
25325   #else
__pyx_t_double_complex_from_parts(double x,double y)25326     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
25327       return x + y*(__pyx_t_double_complex)_Complex_I;
25328     }
25329   #endif
25330 #else
__pyx_t_double_complex_from_parts(double x,double y)25331     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
25332       __pyx_t_double_complex z;
25333       z.real = x;
25334       z.imag = y;
25335       return z;
25336     }
25337 #endif
25338 
25339 /* Arithmetic */
25340   #if CYTHON_CCOMPLEX
25341 #else
__Pyx_c_eq_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25342     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25343        return (a.real == b.real) && (a.imag == b.imag);
25344     }
__Pyx_c_sum_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25345     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25346         __pyx_t_double_complex z;
25347         z.real = a.real + b.real;
25348         z.imag = a.imag + b.imag;
25349         return z;
25350     }
__Pyx_c_diff_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25351     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25352         __pyx_t_double_complex z;
25353         z.real = a.real - b.real;
25354         z.imag = a.imag - b.imag;
25355         return z;
25356     }
__Pyx_c_prod_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25357     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25358         __pyx_t_double_complex z;
25359         z.real = a.real * b.real - a.imag * b.imag;
25360         z.imag = a.real * b.imag + a.imag * b.real;
25361         return z;
25362     }
25363     #if 1
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25364     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25365         if (b.imag == 0) {
25366             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
25367         } else if (fabs(b.real) >= fabs(b.imag)) {
25368             if (b.real == 0 && b.imag == 0) {
25369                 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
25370             } else {
25371                 double r = b.imag / b.real;
25372                 double s = (double)(1.0) / (b.real + b.imag * r);
25373                 return __pyx_t_double_complex_from_parts(
25374                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
25375             }
25376         } else {
25377             double r = b.real / b.imag;
25378             double s = (double)(1.0) / (b.imag + b.real * r);
25379             return __pyx_t_double_complex_from_parts(
25380                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
25381         }
25382     }
25383     #else
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25384     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25385         if (b.imag == 0) {
25386             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
25387         } else {
25388             double denom = b.real * b.real + b.imag * b.imag;
25389             return __pyx_t_double_complex_from_parts(
25390                 (a.real * b.real + a.imag * b.imag) / denom,
25391                 (a.imag * b.real - a.real * b.imag) / denom);
25392         }
25393     }
25394     #endif
__Pyx_c_neg_double(__pyx_t_double_complex a)25395     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
25396         __pyx_t_double_complex z;
25397         z.real = -a.real;
25398         z.imag = -a.imag;
25399         return z;
25400     }
__Pyx_c_is_zero_double(__pyx_t_double_complex a)25401     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
25402        return (a.real == 0) && (a.imag == 0);
25403     }
__Pyx_c_conj_double(__pyx_t_double_complex a)25404     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
25405         __pyx_t_double_complex z;
25406         z.real =  a.real;
25407         z.imag = -a.imag;
25408         return z;
25409     }
25410     #if 1
__Pyx_c_abs_double(__pyx_t_double_complex z)25411         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
25412           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
25413             return sqrt(z.real*z.real + z.imag*z.imag);
25414           #else
25415             return hypot(z.real, z.imag);
25416           #endif
25417         }
__Pyx_c_pow_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25418         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25419             __pyx_t_double_complex z;
25420             double r, lnr, theta, z_r, z_theta;
25421             if (b.imag == 0 && b.real == (int)b.real) {
25422                 if (b.real < 0) {
25423                     double denom = a.real * a.real + a.imag * a.imag;
25424                     a.real = a.real / denom;
25425                     a.imag = -a.imag / denom;
25426                     b.real = -b.real;
25427                 }
25428                 switch ((int)b.real) {
25429                     case 0:
25430                         z.real = 1;
25431                         z.imag = 0;
25432                         return z;
25433                     case 1:
25434                         return a;
25435                     case 2:
25436                         return __Pyx_c_prod_double(a, a);
25437                     case 3:
25438                         z = __Pyx_c_prod_double(a, a);
25439                         return __Pyx_c_prod_double(z, a);
25440                     case 4:
25441                         z = __Pyx_c_prod_double(a, a);
25442                         return __Pyx_c_prod_double(z, z);
25443                 }
25444             }
25445             if (a.imag == 0) {
25446                 if (a.real == 0) {
25447                     return a;
25448                 } else if (b.imag == 0) {
25449                     z.real = pow(a.real, b.real);
25450                     z.imag = 0;
25451                     return z;
25452                 } else if (a.real > 0) {
25453                     r = a.real;
25454                     theta = 0;
25455                 } else {
25456                     r = -a.real;
25457                     theta = atan2(0.0, -1.0);
25458                 }
25459             } else {
25460                 r = __Pyx_c_abs_double(a);
25461                 theta = atan2(a.imag, a.real);
25462             }
25463             lnr = log(r);
25464             z_r = exp(lnr * b.real - theta * b.imag);
25465             z_theta = theta * b.real + lnr * b.imag;
25466             z.real = z_r * cos(z_theta);
25467             z.imag = z_r * sin(z_theta);
25468             return z;
25469         }
25470     #endif
25471 #endif
25472 
25473 /* MemviewSliceCopyTemplate */
25474   static __Pyx_memviewslice
__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice * from_mvs,const char * mode,int ndim,size_t sizeof_dtype,int contig_flag,int dtype_is_object)25475 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
25476                                  const char *mode, int ndim,
25477                                  size_t sizeof_dtype, int contig_flag,
25478                                  int dtype_is_object)
25479 {
25480     __Pyx_RefNannyDeclarations
25481     int i;
25482     __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
25483     struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
25484     Py_buffer *buf = &from_memview->view;
25485     PyObject *shape_tuple = NULL;
25486     PyObject *temp_int = NULL;
25487     struct __pyx_array_obj *array_obj = NULL;
25488     struct __pyx_memoryview_obj *memview_obj = NULL;
25489     __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
25490     for (i = 0; i < ndim; i++) {
25491         if (unlikely(from_mvs->suboffsets[i] >= 0)) {
25492             PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
25493                                            "indirect dimensions (axis %d)", i);
25494             goto fail;
25495         }
25496     }
25497     shape_tuple = PyTuple_New(ndim);
25498     if (unlikely(!shape_tuple)) {
25499         goto fail;
25500     }
25501     __Pyx_GOTREF(shape_tuple);
25502     for(i = 0; i < ndim; i++) {
25503         temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
25504         if(unlikely(!temp_int)) {
25505             goto fail;
25506         } else {
25507             PyTuple_SET_ITEM(shape_tuple, i, temp_int);
25508             temp_int = NULL;
25509         }
25510     }
25511     array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
25512     if (unlikely(!array_obj)) {
25513         goto fail;
25514     }
25515     __Pyx_GOTREF(array_obj);
25516     memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
25517                                     (PyObject *) array_obj, contig_flag,
25518                                     dtype_is_object,
25519                                     from_mvs->memview->typeinfo);
25520     if (unlikely(!memview_obj))
25521         goto fail;
25522     if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
25523         goto fail;
25524     if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
25525                                                 dtype_is_object) < 0))
25526         goto fail;
25527     goto no_fail;
25528 fail:
25529     __Pyx_XDECREF(new_mvs.memview);
25530     new_mvs.memview = NULL;
25531     new_mvs.data = NULL;
25532 no_fail:
25533     __Pyx_XDECREF(shape_tuple);
25534     __Pyx_XDECREF(temp_int);
25535     __Pyx_XDECREF(array_obj);
25536     __Pyx_RefNannyFinishContext();
25537     return new_mvs;
25538 }
25539 
25540 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)25541   static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
25542 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25543 #pragma GCC diagnostic push
25544 #pragma GCC diagnostic ignored "-Wconversion"
25545 #endif
25546     const int neg_one = (int) -1, const_zero = (int) 0;
25547 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25548 #pragma GCC diagnostic pop
25549 #endif
25550     const int is_unsigned = neg_one > const_zero;
25551 #if PY_MAJOR_VERSION < 3
25552     if (likely(PyInt_Check(x))) {
25553         if (sizeof(int) < sizeof(long)) {
25554             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
25555         } else {
25556             long val = PyInt_AS_LONG(x);
25557             if (is_unsigned && unlikely(val < 0)) {
25558                 goto raise_neg_overflow;
25559             }
25560             return (int) val;
25561         }
25562     } else
25563 #endif
25564     if (likely(PyLong_Check(x))) {
25565         if (is_unsigned) {
25566 #if CYTHON_USE_PYLONG_INTERNALS
25567             const digit* digits = ((PyLongObject*)x)->ob_digit;
25568             switch (Py_SIZE(x)) {
25569                 case  0: return (int) 0;
25570                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
25571                 case 2:
25572                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
25573                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25574                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25575                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
25576                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
25577                         }
25578                     }
25579                     break;
25580                 case 3:
25581                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
25582                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25583                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25584                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
25585                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
25586                         }
25587                     }
25588                     break;
25589                 case 4:
25590                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
25591                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25592                             __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])))
25593                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
25594                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
25595                         }
25596                     }
25597                     break;
25598             }
25599 #endif
25600 #if CYTHON_COMPILING_IN_CPYTHON
25601             if (unlikely(Py_SIZE(x) < 0)) {
25602                 goto raise_neg_overflow;
25603             }
25604 #else
25605             {
25606                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
25607                 if (unlikely(result < 0))
25608                     return (int) -1;
25609                 if (unlikely(result == 1))
25610                     goto raise_neg_overflow;
25611             }
25612 #endif
25613             if (sizeof(int) <= sizeof(unsigned long)) {
25614                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
25615 #ifdef HAVE_LONG_LONG
25616             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
25617                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
25618 #endif
25619             }
25620         } else {
25621 #if CYTHON_USE_PYLONG_INTERNALS
25622             const digit* digits = ((PyLongObject*)x)->ob_digit;
25623             switch (Py_SIZE(x)) {
25624                 case  0: return (int) 0;
25625                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
25626                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
25627                 case -2:
25628                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
25629                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25630                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25631                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
25632                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25633                         }
25634                     }
25635                     break;
25636                 case 2:
25637                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
25638                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25639                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25640                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
25641                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25642                         }
25643                     }
25644                     break;
25645                 case -3:
25646                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
25647                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25648                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25649                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
25650                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25651                         }
25652                     }
25653                     break;
25654                 case 3:
25655                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
25656                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25657                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25658                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
25659                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25660                         }
25661                     }
25662                     break;
25663                 case -4:
25664                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
25665                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25666                             __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])))
25667                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
25668                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25669                         }
25670                     }
25671                     break;
25672                 case 4:
25673                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
25674                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25675                             __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])))
25676                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
25677                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
25678                         }
25679                     }
25680                     break;
25681             }
25682 #endif
25683             if (sizeof(int) <= sizeof(long)) {
25684                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
25685 #ifdef HAVE_LONG_LONG
25686             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
25687                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
25688 #endif
25689             }
25690         }
25691         {
25692 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
25693             PyErr_SetString(PyExc_RuntimeError,
25694                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
25695 #else
25696             int val;
25697             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
25698  #if PY_MAJOR_VERSION < 3
25699             if (likely(v) && !PyLong_Check(v)) {
25700                 PyObject *tmp = v;
25701                 v = PyNumber_Long(tmp);
25702                 Py_DECREF(tmp);
25703             }
25704  #endif
25705             if (likely(v)) {
25706                 int one = 1; int is_little = (int)*(unsigned char *)&one;
25707                 unsigned char *bytes = (unsigned char *)&val;
25708                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
25709                                               bytes, sizeof(val),
25710                                               is_little, !is_unsigned);
25711                 Py_DECREF(v);
25712                 if (likely(!ret))
25713                     return val;
25714             }
25715 #endif
25716             return (int) -1;
25717         }
25718     } else {
25719         int val;
25720         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
25721         if (!tmp) return (int) -1;
25722         val = __Pyx_PyInt_As_int(tmp);
25723         Py_DECREF(tmp);
25724         return val;
25725     }
25726 raise_overflow:
25727     PyErr_SetString(PyExc_OverflowError,
25728         "value too large to convert to int");
25729     return (int) -1;
25730 raise_neg_overflow:
25731     PyErr_SetString(PyExc_OverflowError,
25732         "can't convert negative value to int");
25733     return (int) -1;
25734 }
25735 
25736 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)25737   static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
25738 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25739 #pragma GCC diagnostic push
25740 #pragma GCC diagnostic ignored "-Wconversion"
25741 #endif
25742     const long neg_one = (long) -1, const_zero = (long) 0;
25743 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25744 #pragma GCC diagnostic pop
25745 #endif
25746     const int is_unsigned = neg_one > const_zero;
25747 #if PY_MAJOR_VERSION < 3
25748     if (likely(PyInt_Check(x))) {
25749         if (sizeof(long) < sizeof(long)) {
25750             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
25751         } else {
25752             long val = PyInt_AS_LONG(x);
25753             if (is_unsigned && unlikely(val < 0)) {
25754                 goto raise_neg_overflow;
25755             }
25756             return (long) val;
25757         }
25758     } else
25759 #endif
25760     if (likely(PyLong_Check(x))) {
25761         if (is_unsigned) {
25762 #if CYTHON_USE_PYLONG_INTERNALS
25763             const digit* digits = ((PyLongObject*)x)->ob_digit;
25764             switch (Py_SIZE(x)) {
25765                 case  0: return (long) 0;
25766                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
25767                 case 2:
25768                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
25769                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25770                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25771                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
25772                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
25773                         }
25774                     }
25775                     break;
25776                 case 3:
25777                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
25778                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25779                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25780                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
25781                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
25782                         }
25783                     }
25784                     break;
25785                 case 4:
25786                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
25787                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25788                             __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])))
25789                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
25790                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
25791                         }
25792                     }
25793                     break;
25794             }
25795 #endif
25796 #if CYTHON_COMPILING_IN_CPYTHON
25797             if (unlikely(Py_SIZE(x) < 0)) {
25798                 goto raise_neg_overflow;
25799             }
25800 #else
25801             {
25802                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
25803                 if (unlikely(result < 0))
25804                     return (long) -1;
25805                 if (unlikely(result == 1))
25806                     goto raise_neg_overflow;
25807             }
25808 #endif
25809             if (sizeof(long) <= sizeof(unsigned long)) {
25810                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
25811 #ifdef HAVE_LONG_LONG
25812             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
25813                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
25814 #endif
25815             }
25816         } else {
25817 #if CYTHON_USE_PYLONG_INTERNALS
25818             const digit* digits = ((PyLongObject*)x)->ob_digit;
25819             switch (Py_SIZE(x)) {
25820                 case  0: return (long) 0;
25821                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
25822                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
25823                 case -2:
25824                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
25825                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25826                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25827                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
25828                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25829                         }
25830                     }
25831                     break;
25832                 case 2:
25833                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
25834                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25835                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25836                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
25837                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25838                         }
25839                     }
25840                     break;
25841                 case -3:
25842                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
25843                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25844                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25845                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
25846                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25847                         }
25848                     }
25849                     break;
25850                 case 3:
25851                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
25852                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25853                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25854                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
25855                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25856                         }
25857                     }
25858                     break;
25859                 case -4:
25860                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
25861                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25862                             __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])))
25863                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
25864                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25865                         }
25866                     }
25867                     break;
25868                 case 4:
25869                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
25870                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25871                             __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])))
25872                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
25873                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
25874                         }
25875                     }
25876                     break;
25877             }
25878 #endif
25879             if (sizeof(long) <= sizeof(long)) {
25880                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
25881 #ifdef HAVE_LONG_LONG
25882             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
25883                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
25884 #endif
25885             }
25886         }
25887         {
25888 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
25889             PyErr_SetString(PyExc_RuntimeError,
25890                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
25891 #else
25892             long val;
25893             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
25894  #if PY_MAJOR_VERSION < 3
25895             if (likely(v) && !PyLong_Check(v)) {
25896                 PyObject *tmp = v;
25897                 v = PyNumber_Long(tmp);
25898                 Py_DECREF(tmp);
25899             }
25900  #endif
25901             if (likely(v)) {
25902                 int one = 1; int is_little = (int)*(unsigned char *)&one;
25903                 unsigned char *bytes = (unsigned char *)&val;
25904                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
25905                                               bytes, sizeof(val),
25906                                               is_little, !is_unsigned);
25907                 Py_DECREF(v);
25908                 if (likely(!ret))
25909                     return val;
25910             }
25911 #endif
25912             return (long) -1;
25913         }
25914     } else {
25915         long val;
25916         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
25917         if (!tmp) return (long) -1;
25918         val = __Pyx_PyInt_As_long(tmp);
25919         Py_DECREF(tmp);
25920         return val;
25921     }
25922 raise_overflow:
25923     PyErr_SetString(PyExc_OverflowError,
25924         "value too large to convert to long");
25925     return (long) -1;
25926 raise_neg_overflow:
25927     PyErr_SetString(PyExc_OverflowError,
25928         "can't convert negative value to long");
25929     return (long) -1;
25930 }
25931 
25932 /* CIntFromPy */
__Pyx_PyInt_As_Py_intptr_t(PyObject * x)25933   static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *x) {
25934 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25935 #pragma GCC diagnostic push
25936 #pragma GCC diagnostic ignored "-Wconversion"
25937 #endif
25938     const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0;
25939 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
25940 #pragma GCC diagnostic pop
25941 #endif
25942     const int is_unsigned = neg_one > const_zero;
25943 #if PY_MAJOR_VERSION < 3
25944     if (likely(PyInt_Check(x))) {
25945         if (sizeof(Py_intptr_t) < sizeof(long)) {
25946             __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, PyInt_AS_LONG(x))
25947         } else {
25948             long val = PyInt_AS_LONG(x);
25949             if (is_unsigned && unlikely(val < 0)) {
25950                 goto raise_neg_overflow;
25951             }
25952             return (Py_intptr_t) val;
25953         }
25954     } else
25955 #endif
25956     if (likely(PyLong_Check(x))) {
25957         if (is_unsigned) {
25958 #if CYTHON_USE_PYLONG_INTERNALS
25959             const digit* digits = ((PyLongObject*)x)->ob_digit;
25960             switch (Py_SIZE(x)) {
25961                 case  0: return (Py_intptr_t) 0;
25962                 case  1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, digit, digits[0])
25963                 case 2:
25964                     if (8 * sizeof(Py_intptr_t) > 1 * PyLong_SHIFT) {
25965                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
25966                             __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25967                         } else if (8 * sizeof(Py_intptr_t) >= 2 * PyLong_SHIFT) {
25968                             return (Py_intptr_t) (((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
25969                         }
25970                     }
25971                     break;
25972                 case 3:
25973                     if (8 * sizeof(Py_intptr_t) > 2 * PyLong_SHIFT) {
25974                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
25975                             __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25976                         } else if (8 * sizeof(Py_intptr_t) >= 3 * PyLong_SHIFT) {
25977                             return (Py_intptr_t) (((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
25978                         }
25979                     }
25980                     break;
25981                 case 4:
25982                     if (8 * sizeof(Py_intptr_t) > 3 * PyLong_SHIFT) {
25983                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
25984                             __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
25985                         } else if (8 * sizeof(Py_intptr_t) >= 4 * PyLong_SHIFT) {
25986                             return (Py_intptr_t) (((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
25987                         }
25988                     }
25989                     break;
25990             }
25991 #endif
25992 #if CYTHON_COMPILING_IN_CPYTHON
25993             if (unlikely(Py_SIZE(x) < 0)) {
25994                 goto raise_neg_overflow;
25995             }
25996 #else
25997             {
25998                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
25999                 if (unlikely(result < 0))
26000                     return (Py_intptr_t) -1;
26001                 if (unlikely(result == 1))
26002                     goto raise_neg_overflow;
26003             }
26004 #endif
26005             if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
26006                 __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, unsigned long, PyLong_AsUnsignedLong(x))
26007 #ifdef HAVE_LONG_LONG
26008             } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
26009                 __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
26010 #endif
26011             }
26012         } else {
26013 #if CYTHON_USE_PYLONG_INTERNALS
26014             const digit* digits = ((PyLongObject*)x)->ob_digit;
26015             switch (Py_SIZE(x)) {
26016                 case  0: return (Py_intptr_t) 0;
26017                 case -1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, sdigit, (sdigit) (-(sdigit)digits[0]))
26018                 case  1: __PYX_VERIFY_RETURN_INT(Py_intptr_t,  digit, +digits[0])
26019                 case -2:
26020                     if (8 * sizeof(Py_intptr_t) - 1 > 1 * PyLong_SHIFT) {
26021                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26022                             __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26023                         } else if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
26024                             return (Py_intptr_t) (((Py_intptr_t)-1)*(((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26025                         }
26026                     }
26027                     break;
26028                 case 2:
26029                     if (8 * sizeof(Py_intptr_t) > 1 * PyLong_SHIFT) {
26030                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26031                             __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26032                         } else if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
26033                             return (Py_intptr_t) ((((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26034                         }
26035                     }
26036                     break;
26037                 case -3:
26038                     if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
26039                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26040                             __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26041                         } else if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
26042                             return (Py_intptr_t) (((Py_intptr_t)-1)*(((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26043                         }
26044                     }
26045                     break;
26046                 case 3:
26047                     if (8 * sizeof(Py_intptr_t) > 2 * PyLong_SHIFT) {
26048                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26049                             __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26050                         } else if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
26051                             return (Py_intptr_t) ((((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26052                         }
26053                     }
26054                     break;
26055                 case -4:
26056                     if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
26057                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26058                             __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26059                         } else if (8 * sizeof(Py_intptr_t) - 1 > 4 * PyLong_SHIFT) {
26060                             return (Py_intptr_t) (((Py_intptr_t)-1)*(((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26061                         }
26062                     }
26063                     break;
26064                 case 4:
26065                     if (8 * sizeof(Py_intptr_t) > 3 * PyLong_SHIFT) {
26066                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26067                             __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26068                         } else if (8 * sizeof(Py_intptr_t) - 1 > 4 * PyLong_SHIFT) {
26069                             return (Py_intptr_t) ((((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26070                         }
26071                     }
26072                     break;
26073             }
26074 #endif
26075             if (sizeof(Py_intptr_t) <= sizeof(long)) {
26076                 __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, long, PyLong_AsLong(x))
26077 #ifdef HAVE_LONG_LONG
26078             } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
26079                 __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, PY_LONG_LONG, PyLong_AsLongLong(x))
26080 #endif
26081             }
26082         }
26083         {
26084 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
26085             PyErr_SetString(PyExc_RuntimeError,
26086                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
26087 #else
26088             Py_intptr_t val;
26089             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
26090  #if PY_MAJOR_VERSION < 3
26091             if (likely(v) && !PyLong_Check(v)) {
26092                 PyObject *tmp = v;
26093                 v = PyNumber_Long(tmp);
26094                 Py_DECREF(tmp);
26095             }
26096  #endif
26097             if (likely(v)) {
26098                 int one = 1; int is_little = (int)*(unsigned char *)&one;
26099                 unsigned char *bytes = (unsigned char *)&val;
26100                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
26101                                               bytes, sizeof(val),
26102                                               is_little, !is_unsigned);
26103                 Py_DECREF(v);
26104                 if (likely(!ret))
26105                     return val;
26106             }
26107 #endif
26108             return (Py_intptr_t) -1;
26109         }
26110     } else {
26111         Py_intptr_t val;
26112         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
26113         if (!tmp) return (Py_intptr_t) -1;
26114         val = __Pyx_PyInt_As_Py_intptr_t(tmp);
26115         Py_DECREF(tmp);
26116         return val;
26117     }
26118 raise_overflow:
26119     PyErr_SetString(PyExc_OverflowError,
26120         "value too large to convert to Py_intptr_t");
26121     return (Py_intptr_t) -1;
26122 raise_neg_overflow:
26123     PyErr_SetString(PyExc_OverflowError,
26124         "can't convert negative value to Py_intptr_t");
26125     return (Py_intptr_t) -1;
26126 }
26127 
26128 /* CIntToPy */
__Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value)26129   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
26130 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26131 #pragma GCC diagnostic push
26132 #pragma GCC diagnostic ignored "-Wconversion"
26133 #endif
26134     const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0;
26135 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26136 #pragma GCC diagnostic pop
26137 #endif
26138     const int is_unsigned = neg_one > const_zero;
26139     if (is_unsigned) {
26140         if (sizeof(Py_intptr_t) < sizeof(long)) {
26141             return PyInt_FromLong((long) value);
26142         } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
26143             return PyLong_FromUnsignedLong((unsigned long) value);
26144 #ifdef HAVE_LONG_LONG
26145         } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
26146             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26147 #endif
26148         }
26149     } else {
26150         if (sizeof(Py_intptr_t) <= sizeof(long)) {
26151             return PyInt_FromLong((long) value);
26152 #ifdef HAVE_LONG_LONG
26153         } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
26154             return PyLong_FromLongLong((PY_LONG_LONG) value);
26155 #endif
26156         }
26157     }
26158     {
26159         int one = 1; int little = (int)*(unsigned char *)&one;
26160         unsigned char *bytes = (unsigned char *)&value;
26161         return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
26162                                      little, !is_unsigned);
26163     }
26164 }
26165 
26166 /* CIntToPy */
__Pyx_PyInt_From_enum____pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus(enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus value)26167   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum____pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus(enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus value) {
26168 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26169 #pragma GCC diagnostic push
26170 #pragma GCC diagnostic ignored "-Wconversion"
26171 #endif
26172     const enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus neg_one = (enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus) -1, const_zero = (enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus) 0;
26173 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26174 #pragma GCC diagnostic pop
26175 #endif
26176     const int is_unsigned = neg_one > const_zero;
26177     if (is_unsigned) {
26178         if (sizeof(enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus) < sizeof(long)) {
26179             return PyInt_FromLong((long) value);
26180         } else if (sizeof(enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus) <= sizeof(unsigned long)) {
26181             return PyLong_FromUnsignedLong((unsigned long) value);
26182 #ifdef HAVE_LONG_LONG
26183         } else if (sizeof(enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus) <= sizeof(unsigned PY_LONG_LONG)) {
26184             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26185 #endif
26186         }
26187     } else {
26188         if (sizeof(enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus) <= sizeof(long)) {
26189             return PyInt_FromLong((long) value);
26190 #ifdef HAVE_LONG_LONG
26191         } else if (sizeof(enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus) <= sizeof(PY_LONG_LONG)) {
26192             return PyLong_FromLongLong((PY_LONG_LONG) value);
26193 #endif
26194         }
26195     }
26196     {
26197         int one = 1; int little = (int)*(unsigned char *)&one;
26198         unsigned char *bytes = (unsigned char *)&value;
26199         return _PyLong_FromByteArray(bytes, sizeof(enum __pyx_t_4dipy_8tracking_18stopping_criterion_StreamlineStatus),
26200                                      little, !is_unsigned);
26201     }
26202 }
26203 
26204 /* CIntToPy */
__Pyx_PyInt_From_int(int value)26205   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
26206 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26207 #pragma GCC diagnostic push
26208 #pragma GCC diagnostic ignored "-Wconversion"
26209 #endif
26210     const int neg_one = (int) -1, const_zero = (int) 0;
26211 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26212 #pragma GCC diagnostic pop
26213 #endif
26214     const int is_unsigned = neg_one > const_zero;
26215     if (is_unsigned) {
26216         if (sizeof(int) < sizeof(long)) {
26217             return PyInt_FromLong((long) value);
26218         } else if (sizeof(int) <= sizeof(unsigned long)) {
26219             return PyLong_FromUnsignedLong((unsigned long) value);
26220 #ifdef HAVE_LONG_LONG
26221         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
26222             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26223 #endif
26224         }
26225     } else {
26226         if (sizeof(int) <= sizeof(long)) {
26227             return PyInt_FromLong((long) value);
26228 #ifdef HAVE_LONG_LONG
26229         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
26230             return PyLong_FromLongLong((PY_LONG_LONG) value);
26231 #endif
26232         }
26233     }
26234     {
26235         int one = 1; int little = (int)*(unsigned char *)&one;
26236         unsigned char *bytes = (unsigned char *)&value;
26237         return _PyLong_FromByteArray(bytes, sizeof(int),
26238                                      little, !is_unsigned);
26239     }
26240 }
26241 
26242 /* CIntToPy */
__Pyx_PyInt_From_npy_long(npy_long value)26243   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_long(npy_long value) {
26244 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26245 #pragma GCC diagnostic push
26246 #pragma GCC diagnostic ignored "-Wconversion"
26247 #endif
26248     const npy_long neg_one = (npy_long) -1, const_zero = (npy_long) 0;
26249 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26250 #pragma GCC diagnostic pop
26251 #endif
26252     const int is_unsigned = neg_one > const_zero;
26253     if (is_unsigned) {
26254         if (sizeof(npy_long) < sizeof(long)) {
26255             return PyInt_FromLong((long) value);
26256         } else if (sizeof(npy_long) <= sizeof(unsigned long)) {
26257             return PyLong_FromUnsignedLong((unsigned long) value);
26258 #ifdef HAVE_LONG_LONG
26259         } else if (sizeof(npy_long) <= sizeof(unsigned PY_LONG_LONG)) {
26260             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26261 #endif
26262         }
26263     } else {
26264         if (sizeof(npy_long) <= sizeof(long)) {
26265             return PyInt_FromLong((long) value);
26266 #ifdef HAVE_LONG_LONG
26267         } else if (sizeof(npy_long) <= sizeof(PY_LONG_LONG)) {
26268             return PyLong_FromLongLong((PY_LONG_LONG) value);
26269 #endif
26270         }
26271     }
26272     {
26273         int one = 1; int little = (int)*(unsigned char *)&one;
26274         unsigned char *bytes = (unsigned char *)&value;
26275         return _PyLong_FromByteArray(bytes, sizeof(npy_long),
26276                                      little, !is_unsigned);
26277     }
26278 }
26279 
26280 /* CIntToPy */
__Pyx_PyInt_From_long(long value)26281   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
26282 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26283 #pragma GCC diagnostic push
26284 #pragma GCC diagnostic ignored "-Wconversion"
26285 #endif
26286     const long neg_one = (long) -1, const_zero = (long) 0;
26287 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26288 #pragma GCC diagnostic pop
26289 #endif
26290     const int is_unsigned = neg_one > const_zero;
26291     if (is_unsigned) {
26292         if (sizeof(long) < sizeof(long)) {
26293             return PyInt_FromLong((long) value);
26294         } else if (sizeof(long) <= sizeof(unsigned long)) {
26295             return PyLong_FromUnsignedLong((unsigned long) value);
26296 #ifdef HAVE_LONG_LONG
26297         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
26298             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26299 #endif
26300         }
26301     } else {
26302         if (sizeof(long) <= sizeof(long)) {
26303             return PyInt_FromLong((long) value);
26304 #ifdef HAVE_LONG_LONG
26305         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
26306             return PyLong_FromLongLong((PY_LONG_LONG) value);
26307 #endif
26308         }
26309     }
26310     {
26311         int one = 1; int little = (int)*(unsigned char *)&one;
26312         unsigned char *bytes = (unsigned char *)&value;
26313         return _PyLong_FromByteArray(bytes, sizeof(long),
26314                                      little, !is_unsigned);
26315     }
26316 }
26317 
26318 /* CIntFromPy */
__Pyx_PyInt_As_char(PyObject * x)26319   static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
26320 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26321 #pragma GCC diagnostic push
26322 #pragma GCC diagnostic ignored "-Wconversion"
26323 #endif
26324     const char neg_one = (char) -1, const_zero = (char) 0;
26325 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26326 #pragma GCC diagnostic pop
26327 #endif
26328     const int is_unsigned = neg_one > const_zero;
26329 #if PY_MAJOR_VERSION < 3
26330     if (likely(PyInt_Check(x))) {
26331         if (sizeof(char) < sizeof(long)) {
26332             __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
26333         } else {
26334             long val = PyInt_AS_LONG(x);
26335             if (is_unsigned && unlikely(val < 0)) {
26336                 goto raise_neg_overflow;
26337             }
26338             return (char) val;
26339         }
26340     } else
26341 #endif
26342     if (likely(PyLong_Check(x))) {
26343         if (is_unsigned) {
26344 #if CYTHON_USE_PYLONG_INTERNALS
26345             const digit* digits = ((PyLongObject*)x)->ob_digit;
26346             switch (Py_SIZE(x)) {
26347                 case  0: return (char) 0;
26348                 case  1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
26349                 case 2:
26350                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
26351                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26352                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26353                         } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
26354                             return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
26355                         }
26356                     }
26357                     break;
26358                 case 3:
26359                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
26360                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26361                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26362                         } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
26363                             return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
26364                         }
26365                     }
26366                     break;
26367                 case 4:
26368                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
26369                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26370                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26371                         } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
26372                             return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
26373                         }
26374                     }
26375                     break;
26376             }
26377 #endif
26378 #if CYTHON_COMPILING_IN_CPYTHON
26379             if (unlikely(Py_SIZE(x) < 0)) {
26380                 goto raise_neg_overflow;
26381             }
26382 #else
26383             {
26384                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
26385                 if (unlikely(result < 0))
26386                     return (char) -1;
26387                 if (unlikely(result == 1))
26388                     goto raise_neg_overflow;
26389             }
26390 #endif
26391             if (sizeof(char) <= sizeof(unsigned long)) {
26392                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
26393 #ifdef HAVE_LONG_LONG
26394             } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
26395                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
26396 #endif
26397             }
26398         } else {
26399 #if CYTHON_USE_PYLONG_INTERNALS
26400             const digit* digits = ((PyLongObject*)x)->ob_digit;
26401             switch (Py_SIZE(x)) {
26402                 case  0: return (char) 0;
26403                 case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
26404                 case  1: __PYX_VERIFY_RETURN_INT(char,  digit, +digits[0])
26405                 case -2:
26406                     if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
26407                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26408                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26409                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
26410                             return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
26411                         }
26412                     }
26413                     break;
26414                 case 2:
26415                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
26416                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26417                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26418                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
26419                             return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
26420                         }
26421                     }
26422                     break;
26423                 case -3:
26424                     if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
26425                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26426                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26427                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
26428                             return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
26429                         }
26430                     }
26431                     break;
26432                 case 3:
26433                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
26434                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26435                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26436                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
26437                             return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
26438                         }
26439                     }
26440                     break;
26441                 case -4:
26442                     if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
26443                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26444                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26445                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
26446                             return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
26447                         }
26448                     }
26449                     break;
26450                 case 4:
26451                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
26452                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26453                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26454                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
26455                             return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
26456                         }
26457                     }
26458                     break;
26459             }
26460 #endif
26461             if (sizeof(char) <= sizeof(long)) {
26462                 __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
26463 #ifdef HAVE_LONG_LONG
26464             } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
26465                 __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
26466 #endif
26467             }
26468         }
26469         {
26470 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
26471             PyErr_SetString(PyExc_RuntimeError,
26472                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
26473 #else
26474             char val;
26475             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
26476  #if PY_MAJOR_VERSION < 3
26477             if (likely(v) && !PyLong_Check(v)) {
26478                 PyObject *tmp = v;
26479                 v = PyNumber_Long(tmp);
26480                 Py_DECREF(tmp);
26481             }
26482  #endif
26483             if (likely(v)) {
26484                 int one = 1; int is_little = (int)*(unsigned char *)&one;
26485                 unsigned char *bytes = (unsigned char *)&val;
26486                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
26487                                               bytes, sizeof(val),
26488                                               is_little, !is_unsigned);
26489                 Py_DECREF(v);
26490                 if (likely(!ret))
26491                     return val;
26492             }
26493 #endif
26494             return (char) -1;
26495         }
26496     } else {
26497         char val;
26498         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
26499         if (!tmp) return (char) -1;
26500         val = __Pyx_PyInt_As_char(tmp);
26501         Py_DECREF(tmp);
26502         return val;
26503     }
26504 raise_overflow:
26505     PyErr_SetString(PyExc_OverflowError,
26506         "value too large to convert to char");
26507     return (char) -1;
26508 raise_neg_overflow:
26509     PyErr_SetString(PyExc_OverflowError,
26510         "can't convert negative value to char");
26511     return (char) -1;
26512 }
26513 
26514 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)26515   static int __Pyx_check_binary_version(void) {
26516     char ctversion[4], rtversion[4];
26517     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
26518     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
26519     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
26520         char message[200];
26521         PyOS_snprintf(message, sizeof(message),
26522                       "compiletime version %s of module '%.100s' "
26523                       "does not match runtime version %s",
26524                       ctversion, __Pyx_MODULE_NAME, rtversion);
26525         return PyErr_WarnEx(NULL, message, 1);
26526     }
26527     return 0;
26528 }
26529 
26530 /* FunctionImport */
26531   #ifndef __PYX_HAVE_RT_ImportFunction
26532 #define __PYX_HAVE_RT_ImportFunction
__Pyx_ImportFunction(PyObject * module,const char * funcname,void (** f)(void),const char * sig)26533 static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
26534     PyObject *d = 0;
26535     PyObject *cobj = 0;
26536     union {
26537         void (*fp)(void);
26538         void *p;
26539     } tmp;
26540     d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
26541     if (!d)
26542         goto bad;
26543     cobj = PyDict_GetItemString(d, funcname);
26544     if (!cobj) {
26545         PyErr_Format(PyExc_ImportError,
26546             "%.200s does not export expected C function %.200s",
26547                 PyModule_GetName(module), funcname);
26548         goto bad;
26549     }
26550 #if PY_VERSION_HEX >= 0x02070000
26551     if (!PyCapsule_IsValid(cobj, sig)) {
26552         PyErr_Format(PyExc_TypeError,
26553             "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
26554              PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
26555         goto bad;
26556     }
26557     tmp.p = PyCapsule_GetPointer(cobj, sig);
26558 #else
26559     {const char *desc, *s1, *s2;
26560     desc = (const char *)PyCObject_GetDesc(cobj);
26561     if (!desc)
26562         goto bad;
26563     s1 = desc; s2 = sig;
26564     while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
26565     if (*s1 != *s2) {
26566         PyErr_Format(PyExc_TypeError,
26567             "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
26568              PyModule_GetName(module), funcname, sig, desc);
26569         goto bad;
26570     }
26571     tmp.p = PyCObject_AsVoidPtr(cobj);}
26572 #endif
26573     *f = tmp.fp;
26574     if (!(*f))
26575         goto bad;
26576     Py_DECREF(d);
26577     return 0;
26578 bad:
26579     Py_XDECREF(d);
26580     return -1;
26581 }
26582 #endif
26583 
26584 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)26585   static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
26586     while (t->p) {
26587         #if PY_MAJOR_VERSION < 3
26588         if (t->is_unicode) {
26589             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
26590         } else if (t->intern) {
26591             *t->p = PyString_InternFromString(t->s);
26592         } else {
26593             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
26594         }
26595         #else
26596         if (t->is_unicode | t->is_str) {
26597             if (t->intern) {
26598                 *t->p = PyUnicode_InternFromString(t->s);
26599             } else if (t->encoding) {
26600                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
26601             } else {
26602                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
26603             }
26604         } else {
26605             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
26606         }
26607         #endif
26608         if (!*t->p)
26609             return -1;
26610         if (PyObject_Hash(*t->p) == -1)
26611             return -1;
26612         ++t;
26613     }
26614     return 0;
26615 }
26616 
__Pyx_PyUnicode_FromString(const char * c_str)26617 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
26618     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
26619 }
__Pyx_PyObject_AsString(PyObject * o)26620 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
26621     Py_ssize_t ignore;
26622     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
26623 }
26624 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
26625 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)26626 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
26627     char* defenc_c;
26628     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
26629     if (!defenc) return NULL;
26630     defenc_c = PyBytes_AS_STRING(defenc);
26631 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
26632     {
26633         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
26634         char* c;
26635         for (c = defenc_c; c < end; c++) {
26636             if ((unsigned char) (*c) >= 128) {
26637                 PyUnicode_AsASCIIString(o);
26638                 return NULL;
26639             }
26640         }
26641     }
26642 #endif
26643     *length = PyBytes_GET_SIZE(defenc);
26644     return defenc_c;
26645 }
26646 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)26647 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
26648     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
26649 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
26650     if (likely(PyUnicode_IS_ASCII(o))) {
26651         *length = PyUnicode_GET_LENGTH(o);
26652         return PyUnicode_AsUTF8(o);
26653     } else {
26654         PyUnicode_AsASCIIString(o);
26655         return NULL;
26656     }
26657 #else
26658     return PyUnicode_AsUTF8AndSize(o, length);
26659 #endif
26660 }
26661 #endif
26662 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)26663 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
26664 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
26665     if (
26666 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
26667             __Pyx_sys_getdefaultencoding_not_ascii &&
26668 #endif
26669             PyUnicode_Check(o)) {
26670         return __Pyx_PyUnicode_AsStringAndSize(o, length);
26671     } else
26672 #endif
26673 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
26674     if (PyByteArray_Check(o)) {
26675         *length = PyByteArray_GET_SIZE(o);
26676         return PyByteArray_AS_STRING(o);
26677     } else
26678 #endif
26679     {
26680         char* result;
26681         int r = PyBytes_AsStringAndSize(o, &result, length);
26682         if (unlikely(r < 0)) {
26683             return NULL;
26684         } else {
26685             return result;
26686         }
26687     }
26688 }
__Pyx_PyObject_IsTrue(PyObject * x)26689 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
26690    int is_true = x == Py_True;
26691    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
26692    else return PyObject_IsTrue(x);
26693 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)26694 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
26695     int retval;
26696     if (unlikely(!x)) return -1;
26697     retval = __Pyx_PyObject_IsTrue(x);
26698     Py_DECREF(x);
26699     return retval;
26700 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)26701 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
26702 #if PY_MAJOR_VERSION >= 3
26703     if (PyLong_Check(result)) {
26704         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
26705                 "__int__ returned non-int (type %.200s).  "
26706                 "The ability to return an instance of a strict subclass of int "
26707                 "is deprecated, and may be removed in a future version of Python.",
26708                 Py_TYPE(result)->tp_name)) {
26709             Py_DECREF(result);
26710             return NULL;
26711         }
26712         return result;
26713     }
26714 #endif
26715     PyErr_Format(PyExc_TypeError,
26716                  "__%.4s__ returned non-%.4s (type %.200s)",
26717                  type_name, type_name, Py_TYPE(result)->tp_name);
26718     Py_DECREF(result);
26719     return NULL;
26720 }
__Pyx_PyNumber_IntOrLong(PyObject * x)26721 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
26722 #if CYTHON_USE_TYPE_SLOTS
26723   PyNumberMethods *m;
26724 #endif
26725   const char *name = NULL;
26726   PyObject *res = NULL;
26727 #if PY_MAJOR_VERSION < 3
26728   if (likely(PyInt_Check(x) || PyLong_Check(x)))
26729 #else
26730   if (likely(PyLong_Check(x)))
26731 #endif
26732     return __Pyx_NewRef(x);
26733 #if CYTHON_USE_TYPE_SLOTS
26734   m = Py_TYPE(x)->tp_as_number;
26735   #if PY_MAJOR_VERSION < 3
26736   if (m && m->nb_int) {
26737     name = "int";
26738     res = m->nb_int(x);
26739   }
26740   else if (m && m->nb_long) {
26741     name = "long";
26742     res = m->nb_long(x);
26743   }
26744   #else
26745   if (likely(m && m->nb_int)) {
26746     name = "int";
26747     res = m->nb_int(x);
26748   }
26749   #endif
26750 #else
26751   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
26752     res = PyNumber_Int(x);
26753   }
26754 #endif
26755   if (likely(res)) {
26756 #if PY_MAJOR_VERSION < 3
26757     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
26758 #else
26759     if (unlikely(!PyLong_CheckExact(res))) {
26760 #endif
26761         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
26762     }
26763   }
26764   else if (!PyErr_Occurred()) {
26765     PyErr_SetString(PyExc_TypeError,
26766                     "an integer is required");
26767   }
26768   return res;
26769 }
26770 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
26771   Py_ssize_t ival;
26772   PyObject *x;
26773 #if PY_MAJOR_VERSION < 3
26774   if (likely(PyInt_CheckExact(b))) {
26775     if (sizeof(Py_ssize_t) >= sizeof(long))
26776         return PyInt_AS_LONG(b);
26777     else
26778         return PyInt_AsSsize_t(b);
26779   }
26780 #endif
26781   if (likely(PyLong_CheckExact(b))) {
26782     #if CYTHON_USE_PYLONG_INTERNALS
26783     const digit* digits = ((PyLongObject*)b)->ob_digit;
26784     const Py_ssize_t size = Py_SIZE(b);
26785     if (likely(__Pyx_sst_abs(size) <= 1)) {
26786         ival = likely(size) ? digits[0] : 0;
26787         if (size == -1) ival = -ival;
26788         return ival;
26789     } else {
26790       switch (size) {
26791          case 2:
26792            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
26793              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26794            }
26795            break;
26796          case -2:
26797            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
26798              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26799            }
26800            break;
26801          case 3:
26802            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
26803              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26804            }
26805            break;
26806          case -3:
26807            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
26808              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
26809            }
26810            break;
26811          case 4:
26812            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
26813              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]));
26814            }
26815            break;
26816          case -4:
26817            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
26818              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]));
26819            }
26820            break;
26821       }
26822     }
26823     #endif
26824     return PyLong_AsSsize_t(b);
26825   }
26826   x = PyNumber_Index(b);
26827   if (!x) return -1;
26828   ival = PyInt_AsSsize_t(x);
26829   Py_DECREF(x);
26830   return ival;
26831 }
26832 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
26833   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
26834 }
26835 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
26836     return PyInt_FromSize_t(ival);
26837 }
26838 
26839 
26840 #endif /* Py_PYTHON_H */
26841