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__direction__probabilistic_direction_getter
608 #define __PYX_HAVE_API__dipy__direction__probabilistic_direction_getter
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 "pythread.h"
621 #include <stdlib.h>
622 #include "pystate.h"
623 #ifdef _OPENMP
624 #include <omp.h>
625 #endif /* _OPENMP */
626 
627 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
628 #define CYTHON_WITHOUT_ASSERTIONS
629 #endif
630 
631 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
632                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
633 
634 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
635 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
636 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
637 #define __PYX_DEFAULT_STRING_ENCODING ""
638 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
639 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
640 #define __Pyx_uchar_cast(c) ((unsigned char)c)
641 #define __Pyx_long_cast(x) ((long)x)
642 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
643     (sizeof(type) < sizeof(Py_ssize_t))  ||\
644     (sizeof(type) > sizeof(Py_ssize_t) &&\
645           likely(v < (type)PY_SSIZE_T_MAX ||\
646                  v == (type)PY_SSIZE_T_MAX)  &&\
647           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
648                                 v == (type)PY_SSIZE_T_MIN)))  ||\
649     (sizeof(type) == sizeof(Py_ssize_t) &&\
650           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
651                                v == (type)PY_SSIZE_T_MAX)))  )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)652 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
653     return (size_t) i < (size_t) limit;
654 }
655 #if defined (__cplusplus) && __cplusplus >= 201103L
656     #include <cstdlib>
657     #define __Pyx_sst_abs(value) std::abs(value)
658 #elif SIZEOF_INT >= SIZEOF_SIZE_T
659     #define __Pyx_sst_abs(value) abs(value)
660 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
661     #define __Pyx_sst_abs(value) labs(value)
662 #elif defined (_MSC_VER)
663     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
664 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
665     #define __Pyx_sst_abs(value) llabs(value)
666 #elif defined (__GNUC__)
667     #define __Pyx_sst_abs(value) __builtin_llabs(value)
668 #else
669     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
670 #endif
671 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
672 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
673 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
674 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
675 #define __Pyx_PyBytes_FromString        PyBytes_FromString
676 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
677 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
678 #if PY_MAJOR_VERSION < 3
679     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
680     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
681 #else
682     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
683     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
684 #endif
685 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
686 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
687 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
688 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
689 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
690 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
691 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
692 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
693 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
694 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
695 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
696 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
697 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
698 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
699 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
700 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)701 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
702     const Py_UNICODE *u_end = u;
703     while (*u_end++) ;
704     return (size_t)(u_end - u - 1);
705 }
706 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
707 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
708 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
709 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
710 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
711 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
712 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
713 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
714 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
715 #define __Pyx_PySequence_Tuple(obj)\
716     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
717 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
718 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
719 #if CYTHON_ASSUME_SAFE_MACROS
720 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
721 #else
722 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
723 #endif
724 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
725 #if PY_MAJOR_VERSION >= 3
726 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
727 #else
728 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
729 #endif
730 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
731 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
732 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)733 static int __Pyx_init_sys_getdefaultencoding_params(void) {
734     PyObject* sys;
735     PyObject* default_encoding = NULL;
736     PyObject* ascii_chars_u = NULL;
737     PyObject* ascii_chars_b = NULL;
738     const char* default_encoding_c;
739     sys = PyImport_ImportModule("sys");
740     if (!sys) goto bad;
741     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
742     Py_DECREF(sys);
743     if (!default_encoding) goto bad;
744     default_encoding_c = PyBytes_AsString(default_encoding);
745     if (!default_encoding_c) goto bad;
746     if (strcmp(default_encoding_c, "ascii") == 0) {
747         __Pyx_sys_getdefaultencoding_not_ascii = 0;
748     } else {
749         char ascii_chars[128];
750         int c;
751         for (c = 0; c < 128; c++) {
752             ascii_chars[c] = c;
753         }
754         __Pyx_sys_getdefaultencoding_not_ascii = 1;
755         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
756         if (!ascii_chars_u) goto bad;
757         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
758         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
759             PyErr_Format(
760                 PyExc_ValueError,
761                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
762                 default_encoding_c);
763             goto bad;
764         }
765         Py_DECREF(ascii_chars_u);
766         Py_DECREF(ascii_chars_b);
767     }
768     Py_DECREF(default_encoding);
769     return 0;
770 bad:
771     Py_XDECREF(default_encoding);
772     Py_XDECREF(ascii_chars_u);
773     Py_XDECREF(ascii_chars_b);
774     return -1;
775 }
776 #endif
777 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
778 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
779 #else
780 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
781 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
782 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)783 static int __Pyx_init_sys_getdefaultencoding_params(void) {
784     PyObject* sys;
785     PyObject* default_encoding = NULL;
786     char* default_encoding_c;
787     sys = PyImport_ImportModule("sys");
788     if (!sys) goto bad;
789     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
790     Py_DECREF(sys);
791     if (!default_encoding) goto bad;
792     default_encoding_c = PyBytes_AsString(default_encoding);
793     if (!default_encoding_c) goto bad;
794     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
795     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
796     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
797     Py_DECREF(default_encoding);
798     return 0;
799 bad:
800     Py_XDECREF(default_encoding);
801     return -1;
802 }
803 #endif
804 #endif
805 
806 
807 /* Test for GCC > 2.95 */
808 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
809   #define likely(x)   __builtin_expect(!!(x), 1)
810   #define unlikely(x) __builtin_expect(!!(x), 0)
811 #else /* !__GNUC__ or GCC < 2.95 */
812   #define likely(x)   (x)
813   #define unlikely(x) (x)
814 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)815 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
816 
817 static PyObject *__pyx_m = NULL;
818 static PyObject *__pyx_d;
819 static PyObject *__pyx_b;
820 static PyObject *__pyx_cython_runtime = NULL;
821 static PyObject *__pyx_empty_tuple;
822 static PyObject *__pyx_empty_bytes;
823 static PyObject *__pyx_empty_unicode;
824 static int __pyx_lineno;
825 static int __pyx_clineno = 0;
826 static const char * __pyx_cfilenm= __FILE__;
827 static const char *__pyx_filename;
828 
829 /* Header.proto */
830 #if !defined(CYTHON_CCOMPLEX)
831   #if defined(__cplusplus)
832     #define CYTHON_CCOMPLEX 1
833   #elif defined(_Complex_I)
834     #define CYTHON_CCOMPLEX 1
835   #else
836     #define CYTHON_CCOMPLEX 0
837   #endif
838 #endif
839 #if CYTHON_CCOMPLEX
840   #ifdef __cplusplus
841     #include <complex>
842   #else
843     #include <complex.h>
844   #endif
845 #endif
846 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
847   #undef _Complex_I
848   #define _Complex_I 1.0fj
849 #endif
850 
851 
852 static const char *__pyx_f[] = {
853   "dipy/direction/probabilistic_direction_getter.pyx",
854   "stringsource",
855   "__init__.pxd",
856   "type.pxd",
857   "dipy/direction/pmf.pxd",
858   "dipy/tracking/direction_getter.pxd",
859   "dipy/direction/closest_peak_direction_getter.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_9direction_3pmf_PmfGen;
1185 struct __pyx_obj_4dipy_9direction_3pmf_SimplePmfGen;
1186 struct __pyx_obj_4dipy_9direction_3pmf_SHCoeffPmfGen;
1187 struct __pyx_obj_4dipy_9direction_3pmf_BootPmfGen;
1188 struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter;
1189 struct __pyx_obj_4dipy_9direction_29closest_peak_direction_getter_BasePmfDirectionGetter;
1190 struct __pyx_obj_4dipy_9direction_29closest_peak_direction_getter_BaseDirectionGetter;
1191 struct __pyx_obj_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter;
1192 struct __pyx_obj_4dipy_9direction_29closest_peak_direction_getter_ClosestPeakDirectionGetter;
1193 struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter;
1194 struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter;
1195 struct __pyx_array_obj;
1196 struct __pyx_MemviewEnum_obj;
1197 struct __pyx_memoryview_obj;
1198 struct __pyx_memoryviewslice_obj;
1199 
1200 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":729
1201  * ctypedef npy_longdouble longdouble_t
1202  *
1203  * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
1204  * ctypedef npy_cdouble     cdouble_t
1205  * ctypedef npy_clongdouble clongdouble_t
1206  */
1207 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1208 
1209 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":730
1210  *
1211  * ctypedef npy_cfloat      cfloat_t
1212  * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
1213  * ctypedef npy_clongdouble clongdouble_t
1214  *
1215  */
1216 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1217 
1218 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":731
1219  * ctypedef npy_cfloat      cfloat_t
1220  * ctypedef npy_cdouble     cdouble_t
1221  * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
1222  *
1223  * ctypedef npy_cdouble     complex_t
1224  */
1225 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1226 
1227 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":733
1228  * ctypedef npy_clongdouble clongdouble_t
1229  *
1230  * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
1231  *
1232  * cdef inline object PyArray_MultiIterNew1(a):
1233  */
1234 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1235 
1236 /* "dipy/direction/pmf.pxd":3
1237  * cimport numpy as np
1238  *
1239  * cdef class PmfGen:             # <<<<<<<<<<<<<<
1240  *     cdef:
1241  *         double[:] pmf
1242  */
1243 struct __pyx_obj_4dipy_9direction_3pmf_PmfGen {
1244   PyObject_HEAD
1245   struct __pyx_vtabstruct_4dipy_9direction_3pmf_PmfGen *__pyx_vtab;
1246   __Pyx_memviewslice pmf;
1247   __Pyx_memviewslice data;
1248 };
1249 
1250 
1251 /* "dipy/direction/pmf.pxd":14
1252  *
1253  *
1254  * cdef class SimplePmfGen(PmfGen):             # <<<<<<<<<<<<<<
1255  *     pass
1256  *
1257  */
1258 struct __pyx_obj_4dipy_9direction_3pmf_SimplePmfGen {
1259   struct __pyx_obj_4dipy_9direction_3pmf_PmfGen __pyx_base;
1260 };
1261 
1262 
1263 /* "dipy/direction/pmf.pxd":18
1264  *
1265  *
1266  * cdef class SHCoeffPmfGen(PmfGen):             # <<<<<<<<<<<<<<
1267  *     cdef:
1268  *         double[:, :] B
1269  */
1270 struct __pyx_obj_4dipy_9direction_3pmf_SHCoeffPmfGen {
1271   struct __pyx_obj_4dipy_9direction_3pmf_PmfGen __pyx_base;
1272   __Pyx_memviewslice B;
1273   PyObject *sphere;
1274   __Pyx_memviewslice coeff;
1275 };
1276 
1277 
1278 /* "dipy/direction/pmf.pxd":26
1279  *
1280  *
1281  * cdef class BootPmfGen(PmfGen):             # <<<<<<<<<<<<<<
1282  *     cdef:
1283  *         int sh_order
1284  */
1285 struct __pyx_obj_4dipy_9direction_3pmf_BootPmfGen {
1286   struct __pyx_obj_4dipy_9direction_3pmf_PmfGen __pyx_base;
1287   int sh_order;
1288   __Pyx_memviewslice R;
1289   PyObject *sphere;
1290   PyObject *model;
1291   PyObject *H;
1292   PyArrayObject *vox_data;
1293   PyArrayObject *dwi_mask;
1294 };
1295 
1296 
1297 /* "dipy/tracking/direction_getter.pxd":4
1298  * cimport numpy as np
1299  *
1300  * cdef class DirectionGetter:             # <<<<<<<<<<<<<<
1301  *
1302  *     cpdef np.ndarray[np.float_t, ndim=2] initial_direction(
1303  */
1304 struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter {
1305   PyObject_HEAD
1306   struct __pyx_vtabstruct_4dipy_8tracking_16direction_getter_DirectionGetter *__pyx_vtab;
1307 };
1308 
1309 
1310 /* "dipy/direction/closest_peak_direction_getter.pxd":10
1311  *                       double* direction, double cos_similarity)
1312  *
1313  * cdef class BasePmfDirectionGetter(DirectionGetter):             # <<<<<<<<<<<<<<
1314  *
1315  *     cdef:
1316  */
1317 struct __pyx_obj_4dipy_9direction_29closest_peak_direction_getter_BasePmfDirectionGetter {
1318   struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter __pyx_base;
1319   PyObject *sphere;
1320   PyObject *_pf_kwargs;
1321   struct __pyx_obj_4dipy_9direction_3pmf_PmfGen *pmf_gen;
1322   double pmf_threshold;
1323   double cos_similarity;
1324 };
1325 
1326 
1327 /* "dipy/direction/closest_peak_direction_getter.pxd":37
1328  *         double* direction)
1329  *
1330  * cdef class BaseDirectionGetter(BasePmfDirectionGetter):             # <<<<<<<<<<<<<<
1331  *
1332  *     pass
1333  */
1334 struct __pyx_obj_4dipy_9direction_29closest_peak_direction_getter_BaseDirectionGetter {
1335   struct __pyx_obj_4dipy_9direction_29closest_peak_direction_getter_BasePmfDirectionGetter __pyx_base;
1336 };
1337 
1338 
1339 /* "dipy/direction/closest_peak_direction_getter.pxd":41
1340  *     pass
1341  *
1342  * cdef class PmfGenDirectionGetter(BasePmfDirectionGetter):             # <<<<<<<<<<<<<<
1343  *
1344  *     pass
1345  */
1346 struct __pyx_obj_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter {
1347   struct __pyx_obj_4dipy_9direction_29closest_peak_direction_getter_BasePmfDirectionGetter __pyx_base;
1348 };
1349 
1350 
1351 /* "dipy/direction/closest_peak_direction_getter.pxd":46
1352  *
1353  *
1354  * cdef class ClosestPeakDirectionGetter(PmfGenDirectionGetter):             # <<<<<<<<<<<<<<
1355  *
1356  *     pass
1357  */
1358 struct __pyx_obj_4dipy_9direction_29closest_peak_direction_getter_ClosestPeakDirectionGetter {
1359   struct __pyx_obj_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter __pyx_base;
1360 };
1361 
1362 
1363 /* "dipy/direction/probabilistic_direction_getter.pyx":21
1364  *
1365  *
1366  * cdef class ProbabilisticDirectionGetter(PmfGenDirectionGetter):             # <<<<<<<<<<<<<<
1367  *     """Randomly samples direction of a sphere based on probability mass
1368  *     function (pmf).
1369  */
1370 struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter {
1371   struct __pyx_obj_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter __pyx_base;
1372   __Pyx_memviewslice vertices;
1373   PyObject *_adj_matrix;
1374 };
1375 
1376 
1377 /* "dipy/direction/probabilistic_direction_getter.pyx":139
1378  *
1379  *
1380  * cdef class DeterministicMaximumDirectionGetter(ProbabilisticDirectionGetter):             # <<<<<<<<<<<<<<
1381  *     """Return direction of a sphere with the highest probability mass
1382  *     function (pmf).
1383  */
1384 struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter {
1385   struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter __pyx_base;
1386 };
1387 
1388 
1389 /* "View.MemoryView":105
1390  *
1391  * @cname("__pyx_array")
1392  * cdef class array:             # <<<<<<<<<<<<<<
1393  *
1394  *     cdef:
1395  */
1396 struct __pyx_array_obj {
1397   PyObject_HEAD
1398   struct __pyx_vtabstruct_array *__pyx_vtab;
1399   char *data;
1400   Py_ssize_t len;
1401   char *format;
1402   int ndim;
1403   Py_ssize_t *_shape;
1404   Py_ssize_t *_strides;
1405   Py_ssize_t itemsize;
1406   PyObject *mode;
1407   PyObject *_format;
1408   void (*callback_free_data)(void *);
1409   int free_data;
1410   int dtype_is_object;
1411 };
1412 
1413 
1414 /* "View.MemoryView":279
1415  *
1416  * @cname('__pyx_MemviewEnum')
1417  * cdef class Enum(object):             # <<<<<<<<<<<<<<
1418  *     cdef object name
1419  *     def __init__(self, name):
1420  */
1421 struct __pyx_MemviewEnum_obj {
1422   PyObject_HEAD
1423   PyObject *name;
1424 };
1425 
1426 
1427 /* "View.MemoryView":330
1428  *
1429  * @cname('__pyx_memoryview')
1430  * cdef class memoryview(object):             # <<<<<<<<<<<<<<
1431  *
1432  *     cdef object obj
1433  */
1434 struct __pyx_memoryview_obj {
1435   PyObject_HEAD
1436   struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1437   PyObject *obj;
1438   PyObject *_size;
1439   PyObject *_array_interface;
1440   PyThread_type_lock lock;
1441   __pyx_atomic_int acquisition_count[2];
1442   __pyx_atomic_int *acquisition_count_aligned_p;
1443   Py_buffer view;
1444   int flags;
1445   int dtype_is_object;
1446   __Pyx_TypeInfo *typeinfo;
1447 };
1448 
1449 
1450 /* "View.MemoryView":965
1451  *
1452  * @cname('__pyx_memoryviewslice')
1453  * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
1454  *     "Internal class for passing memoryview slices to Python"
1455  *
1456  */
1457 struct __pyx_memoryviewslice_obj {
1458   struct __pyx_memoryview_obj __pyx_base;
1459   __Pyx_memviewslice from_slice;
1460   PyObject *from_object;
1461   PyObject *(*to_object_func)(char *);
1462   int (*to_dtype_func)(char *, PyObject *);
1463 };
1464 
1465 
1466 
1467 /* "dipy/direction/pmf.pxd":3
1468  * cimport numpy as np
1469  *
1470  * cdef class PmfGen:             # <<<<<<<<<<<<<<
1471  *     cdef:
1472  *         double[:] pmf
1473  */
1474 
1475 struct __pyx_vtabstruct_4dipy_9direction_3pmf_PmfGen {
1476   __Pyx_memviewslice (*get_pmf)(struct __pyx_obj_4dipy_9direction_3pmf_PmfGen *, __Pyx_memviewslice, int __pyx_skip_dispatch);
1477   __Pyx_memviewslice (*get_pmf_c)(struct __pyx_obj_4dipy_9direction_3pmf_PmfGen *, double *);
1478   void (*__pyx___clear_pmf)(struct __pyx_obj_4dipy_9direction_3pmf_PmfGen *);
1479 };
1480 static struct __pyx_vtabstruct_4dipy_9direction_3pmf_PmfGen *__pyx_vtabptr_4dipy_9direction_3pmf_PmfGen;
1481 
1482 
1483 /* "dipy/direction/pmf.pxd":14
1484  *
1485  *
1486  * cdef class SimplePmfGen(PmfGen):             # <<<<<<<<<<<<<<
1487  *     pass
1488  *
1489  */
1490 
1491 struct __pyx_vtabstruct_4dipy_9direction_3pmf_SimplePmfGen {
1492   struct __pyx_vtabstruct_4dipy_9direction_3pmf_PmfGen __pyx_base;
1493 };
1494 static struct __pyx_vtabstruct_4dipy_9direction_3pmf_SimplePmfGen *__pyx_vtabptr_4dipy_9direction_3pmf_SimplePmfGen;
1495 
1496 
1497 /* "dipy/direction/pmf.pxd":18
1498  *
1499  *
1500  * cdef class SHCoeffPmfGen(PmfGen):             # <<<<<<<<<<<<<<
1501  *     cdef:
1502  *         double[:, :] B
1503  */
1504 
1505 struct __pyx_vtabstruct_4dipy_9direction_3pmf_SHCoeffPmfGen {
1506   struct __pyx_vtabstruct_4dipy_9direction_3pmf_PmfGen __pyx_base;
1507 };
1508 static struct __pyx_vtabstruct_4dipy_9direction_3pmf_SHCoeffPmfGen *__pyx_vtabptr_4dipy_9direction_3pmf_SHCoeffPmfGen;
1509 
1510 
1511 /* "dipy/direction/pmf.pxd":26
1512  *
1513  *
1514  * cdef class BootPmfGen(PmfGen):             # <<<<<<<<<<<<<<
1515  *     cdef:
1516  *         int sh_order
1517  */
1518 
1519 struct __pyx_vtabstruct_4dipy_9direction_3pmf_BootPmfGen {
1520   struct __pyx_vtabstruct_4dipy_9direction_3pmf_PmfGen __pyx_base;
1521   __Pyx_memviewslice (*get_pmf_no_boot)(struct __pyx_obj_4dipy_9direction_3pmf_BootPmfGen *, __Pyx_memviewslice, int __pyx_skip_dispatch);
1522   __Pyx_memviewslice (*get_pmf_no_boot_c)(struct __pyx_obj_4dipy_9direction_3pmf_BootPmfGen *, double *);
1523 };
1524 static struct __pyx_vtabstruct_4dipy_9direction_3pmf_BootPmfGen *__pyx_vtabptr_4dipy_9direction_3pmf_BootPmfGen;
1525 
1526 
1527 /* "dipy/tracking/direction_getter.pxd":4
1528  * cimport numpy as np
1529  *
1530  * cdef class DirectionGetter:             # <<<<<<<<<<<<<<
1531  *
1532  *     cpdef np.ndarray[np.float_t, ndim=2] initial_direction(
1533  */
1534 
1535 struct __pyx_vtabstruct_4dipy_8tracking_16direction_getter_DirectionGetter {
1536   PyArrayObject *(*initial_direction)(struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter *, __Pyx_memviewslice, int __pyx_skip_dispatch);
1537   int (*get_direction)(struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter *, __Pyx_memviewslice, __Pyx_memviewslice, int __pyx_skip_dispatch);
1538   int (*get_direction_c)(struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter *, double *, double *);
1539 };
1540 static struct __pyx_vtabstruct_4dipy_8tracking_16direction_getter_DirectionGetter *__pyx_vtabptr_4dipy_8tracking_16direction_getter_DirectionGetter;
1541 
1542 
1543 /* "dipy/direction/closest_peak_direction_getter.pxd":10
1544  *                       double* direction, double cos_similarity)
1545  *
1546  * cdef class BasePmfDirectionGetter(DirectionGetter):             # <<<<<<<<<<<<<<
1547  *
1548  *     cdef:
1549  */
1550 
1551 struct __pyx_vtabstruct_4dipy_9direction_29closest_peak_direction_getter_BasePmfDirectionGetter {
1552   struct __pyx_vtabstruct_4dipy_8tracking_16direction_getter_DirectionGetter __pyx_base;
1553   PyObject *(*_get_pmf)(struct __pyx_obj_4dipy_9direction_29closest_peak_direction_getter_BasePmfDirectionGetter *, double *);
1554 };
1555 static struct __pyx_vtabstruct_4dipy_9direction_29closest_peak_direction_getter_BasePmfDirectionGetter *__pyx_vtabptr_4dipy_9direction_29closest_peak_direction_getter_BasePmfDirectionGetter;
1556 
1557 
1558 /* "dipy/direction/closest_peak_direction_getter.pxd":37
1559  *         double* direction)
1560  *
1561  * cdef class BaseDirectionGetter(BasePmfDirectionGetter):             # <<<<<<<<<<<<<<
1562  *
1563  *     pass
1564  */
1565 
1566 struct __pyx_vtabstruct_4dipy_9direction_29closest_peak_direction_getter_BaseDirectionGetter {
1567   struct __pyx_vtabstruct_4dipy_9direction_29closest_peak_direction_getter_BasePmfDirectionGetter __pyx_base;
1568 };
1569 static struct __pyx_vtabstruct_4dipy_9direction_29closest_peak_direction_getter_BaseDirectionGetter *__pyx_vtabptr_4dipy_9direction_29closest_peak_direction_getter_BaseDirectionGetter;
1570 
1571 
1572 /* "dipy/direction/closest_peak_direction_getter.pxd":41
1573  *     pass
1574  *
1575  * cdef class PmfGenDirectionGetter(BasePmfDirectionGetter):             # <<<<<<<<<<<<<<
1576  *
1577  *     pass
1578  */
1579 
1580 struct __pyx_vtabstruct_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter {
1581   struct __pyx_vtabstruct_4dipy_9direction_29closest_peak_direction_getter_BasePmfDirectionGetter __pyx_base;
1582 };
1583 static struct __pyx_vtabstruct_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter *__pyx_vtabptr_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter;
1584 
1585 
1586 /* "dipy/direction/closest_peak_direction_getter.pxd":46
1587  *
1588  *
1589  * cdef class ClosestPeakDirectionGetter(PmfGenDirectionGetter):             # <<<<<<<<<<<<<<
1590  *
1591  *     pass
1592  */
1593 
1594 struct __pyx_vtabstruct_4dipy_9direction_29closest_peak_direction_getter_ClosestPeakDirectionGetter {
1595   struct __pyx_vtabstruct_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter __pyx_base;
1596 };
1597 static struct __pyx_vtabstruct_4dipy_9direction_29closest_peak_direction_getter_ClosestPeakDirectionGetter *__pyx_vtabptr_4dipy_9direction_29closest_peak_direction_getter_ClosestPeakDirectionGetter;
1598 
1599 
1600 /* "dipy/direction/probabilistic_direction_getter.pyx":21
1601  *
1602  *
1603  * cdef class ProbabilisticDirectionGetter(PmfGenDirectionGetter):             # <<<<<<<<<<<<<<
1604  *     """Randomly samples direction of a sphere based on probability mass
1605  *     function (pmf).
1606  */
1607 
1608 struct __pyx_vtabstruct_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter {
1609   struct __pyx_vtabstruct_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter __pyx_base;
1610 };
1611 static struct __pyx_vtabstruct_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *__pyx_vtabptr_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter;
1612 
1613 
1614 /* "dipy/direction/probabilistic_direction_getter.pyx":139
1615  *
1616  *
1617  * cdef class DeterministicMaximumDirectionGetter(ProbabilisticDirectionGetter):             # <<<<<<<<<<<<<<
1618  *     """Return direction of a sphere with the highest probability mass
1619  *     function (pmf).
1620  */
1621 
1622 struct __pyx_vtabstruct_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter {
1623   struct __pyx_vtabstruct_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter __pyx_base;
1624 };
1625 static struct __pyx_vtabstruct_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter *__pyx_vtabptr_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter;
1626 
1627 
1628 /* "View.MemoryView":105
1629  *
1630  * @cname("__pyx_array")
1631  * cdef class array:             # <<<<<<<<<<<<<<
1632  *
1633  *     cdef:
1634  */
1635 
1636 struct __pyx_vtabstruct_array {
1637   PyObject *(*get_memview)(struct __pyx_array_obj *);
1638 };
1639 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1640 
1641 
1642 /* "View.MemoryView":330
1643  *
1644  * @cname('__pyx_memoryview')
1645  * cdef class memoryview(object):             # <<<<<<<<<<<<<<
1646  *
1647  *     cdef object obj
1648  */
1649 
1650 struct __pyx_vtabstruct_memoryview {
1651   char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
1652   PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
1653   PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1654   PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
1655   PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1656   PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
1657   PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
1658 };
1659 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1660 
1661 
1662 /* "View.MemoryView":965
1663  *
1664  * @cname('__pyx_memoryviewslice')
1665  * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
1666  *     "Internal class for passing memoryview slices to Python"
1667  *
1668  */
1669 
1670 struct __pyx_vtabstruct__memoryviewslice {
1671   struct __pyx_vtabstruct_memoryview __pyx_base;
1672 };
1673 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1674 
1675 /* --- Runtime support code (head) --- */
1676 /* Refnanny.proto */
1677 #ifndef CYTHON_REFNANNY
1678   #define CYTHON_REFNANNY 0
1679 #endif
1680 #if CYTHON_REFNANNY
1681   typedef struct {
1682     void (*INCREF)(void*, PyObject*, int);
1683     void (*DECREF)(void*, PyObject*, int);
1684     void (*GOTREF)(void*, PyObject*, int);
1685     void (*GIVEREF)(void*, PyObject*, int);
1686     void* (*SetupContext)(const char*, int, const char*);
1687     void (*FinishContext)(void**);
1688   } __Pyx_RefNannyAPIStruct;
1689   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1690   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1691   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1692 #ifdef WITH_THREAD
1693   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1694           if (acquire_gil) {\
1695               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1696               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1697               PyGILState_Release(__pyx_gilstate_save);\
1698           } else {\
1699               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1700           }
1701 #else
1702   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1703           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1704 #endif
1705   #define __Pyx_RefNannyFinishContext()\
1706           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1707   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1708   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1709   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1710   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1711   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1712   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1713   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1714   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1715 #else
1716   #define __Pyx_RefNannyDeclarations
1717   #define __Pyx_RefNannySetupContext(name, acquire_gil)
1718   #define __Pyx_RefNannyFinishContext()
1719   #define __Pyx_INCREF(r) Py_INCREF(r)
1720   #define __Pyx_DECREF(r) Py_DECREF(r)
1721   #define __Pyx_GOTREF(r)
1722   #define __Pyx_GIVEREF(r)
1723   #define __Pyx_XINCREF(r) Py_XINCREF(r)
1724   #define __Pyx_XDECREF(r) Py_XDECREF(r)
1725   #define __Pyx_XGOTREF(r)
1726   #define __Pyx_XGIVEREF(r)
1727 #endif
1728 #define __Pyx_XDECREF_SET(r, v) do {\
1729         PyObject *tmp = (PyObject *) r;\
1730         r = v; __Pyx_XDECREF(tmp);\
1731     } while (0)
1732 #define __Pyx_DECREF_SET(r, v) do {\
1733         PyObject *tmp = (PyObject *) r;\
1734         r = v; __Pyx_DECREF(tmp);\
1735     } while (0)
1736 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1737 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1738 
1739 /* PyObjectGetAttrStr.proto */
1740 #if CYTHON_USE_TYPE_SLOTS
1741 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1742 #else
1743 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1744 #endif
1745 
1746 /* GetBuiltinName.proto */
1747 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1748 
1749 /* RaiseArgTupleInvalid.proto */
1750 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1751     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1752 
1753 /* RaiseDoubleKeywords.proto */
1754 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1755 
1756 /* ParseKeywords.proto */
1757 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1758     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1759     const char* function_name);
1760 
1761 /* PyObjectCall.proto */
1762 #if CYTHON_COMPILING_IN_CPYTHON
1763 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1764 #else
1765 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1766 #endif
1767 
1768 /* PyFunctionFastCall.proto */
1769 #if CYTHON_FAST_PYCALL
1770 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1771     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1772 #if 1 || PY_VERSION_HEX < 0x030600B1
1773 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1774 #else
1775 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1776 #endif
1777 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1778     (sizeof(char [1 - 2*!(cond)]) - 1)
1779 #ifndef Py_MEMBER_SIZE
1780 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1781 #endif
1782   static size_t __pyx_pyframe_localsplus_offset = 0;
1783   #include "frameobject.h"
1784   #define __Pxy_PyFrame_Initialize_Offsets()\
1785     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1786      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1787   #define __Pyx_PyFrame_GetLocalsplus(frame)\
1788     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1789 #endif
1790 
1791 /* PyObjectCallMethO.proto */
1792 #if CYTHON_COMPILING_IN_CPYTHON
1793 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1794 #endif
1795 
1796 /* PyObjectCallNoArg.proto */
1797 #if CYTHON_COMPILING_IN_CPYTHON
1798 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1799 #else
1800 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1801 #endif
1802 
1803 /* PyCFunctionFastCall.proto */
1804 #if CYTHON_FAST_PYCCALL
1805 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1806 #else
1807 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1808 #endif
1809 
1810 /* PyObjectCallOneArg.proto */
1811 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1812 
1813 /* MemviewSliceInit.proto */
1814 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
1815 #define __Pyx_MEMVIEW_DIRECT   1
1816 #define __Pyx_MEMVIEW_PTR      2
1817 #define __Pyx_MEMVIEW_FULL     4
1818 #define __Pyx_MEMVIEW_CONTIG   8
1819 #define __Pyx_MEMVIEW_STRIDED  16
1820 #define __Pyx_MEMVIEW_FOLLOW   32
1821 #define __Pyx_IS_C_CONTIG 1
1822 #define __Pyx_IS_F_CONTIG 2
1823 static int __Pyx_init_memviewslice(
1824                 struct __pyx_memoryview_obj *memview,
1825                 int ndim,
1826                 __Pyx_memviewslice *memviewslice,
1827                 int memview_is_new_reference);
1828 static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
1829     __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1830 static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
1831     __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1832 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
1833 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
1834 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
1835 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
1836 static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
1837 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
1838 
1839 /* PyDictVersioning.proto */
1840 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1841 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1842 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1843 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1844     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1845     (cache_var) = (value);
1846 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1847     static PY_UINT64_T __pyx_dict_version = 0;\
1848     static PyObject *__pyx_dict_cached_value = NULL;\
1849     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1850         (VAR) = __pyx_dict_cached_value;\
1851     } else {\
1852         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1853         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1854     }\
1855 }
1856 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1857 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1858 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1859 #else
1860 #define __PYX_GET_DICT_VERSION(dict)  (0)
1861 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1862 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1863 #endif
1864 
1865 /* GetModuleGlobalName.proto */
1866 #if CYTHON_USE_DICT_VERSIONS
1867 #define __Pyx_GetModuleGlobalName(var, name)  {\
1868     static PY_UINT64_T __pyx_dict_version = 0;\
1869     static PyObject *__pyx_dict_cached_value = NULL;\
1870     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1871         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1872         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1873 }
1874 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1875     PY_UINT64_T __pyx_dict_version;\
1876     PyObject *__pyx_dict_cached_value;\
1877     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1878 }
1879 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1880 #else
1881 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1882 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1883 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1884 #endif
1885 
1886 /* py_abs.proto */
1887 #if CYTHON_USE_PYLONG_INTERNALS
1888 static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
1889 #define __Pyx_PyNumber_Absolute(x)\
1890     ((likely(PyLong_CheckExact(x))) ?\
1891          (likely(Py_SIZE(x) >= 0) ? (Py_INCREF(x), (x)) : __Pyx_PyLong_AbsNeg(x)) :\
1892          PyNumber_Absolute(x))
1893 #else
1894 #define __Pyx_PyNumber_Absolute(x)  PyNumber_Absolute(x)
1895 #endif
1896 
1897 /* PyObjectCall2Args.proto */
1898 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1899 
1900 /* ListCompAppend.proto */
1901 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_ListComp_Append(PyObject * list,PyObject * x)1902 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1903     PyListObject* L = (PyListObject*) list;
1904     Py_ssize_t len = Py_SIZE(list);
1905     if (likely(L->allocated > len)) {
1906         Py_INCREF(x);
1907         PyList_SET_ITEM(list, len, x);
1908         __Pyx_SET_SIZE(list, len + 1);
1909         return 0;
1910     }
1911     return PyList_Append(list, x);
1912 }
1913 #else
1914 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1915 #endif
1916 
1917 /* UnpackUnboundCMethod.proto */
1918 typedef struct {
1919     PyObject *type;
1920     PyObject **method_name;
1921     PyCFunction func;
1922     PyObject *method;
1923     int flag;
1924 } __Pyx_CachedCFunction;
1925 
1926 /* CallUnboundCMethod1.proto */
1927 static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
1928 #if CYTHON_COMPILING_IN_CPYTHON
1929 static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
1930 #else
1931 #define __Pyx_CallUnboundCMethod1(cfunc, self, arg)  __Pyx__CallUnboundCMethod1(cfunc, self, arg)
1932 #endif
1933 
1934 /* DictGetItem.proto */
1935 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1936 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1937 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1938     (likely(PyDict_CheckExact(obj)) ?\
1939      __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1940 #else
1941 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1942 #define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
1943 #endif
1944 
1945 /* PyThreadStateGet.proto */
1946 #if CYTHON_FAST_THREAD_STATE
1947 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
1948 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
1949 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
1950 #else
1951 #define __Pyx_PyThreadState_declare
1952 #define __Pyx_PyThreadState_assign
1953 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
1954 #endif
1955 
1956 /* PyErrFetchRestore.proto */
1957 #if CYTHON_FAST_THREAD_STATE
1958 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1959 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1960 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1961 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1962 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1963 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1964 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1965 #if CYTHON_COMPILING_IN_CPYTHON
1966 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1967 #else
1968 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1969 #endif
1970 #else
1971 #define __Pyx_PyErr_Clear() PyErr_Clear()
1972 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1973 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
1974 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
1975 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
1976 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
1977 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
1978 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
1979 #endif
1980 
1981 /* WriteUnraisableException.proto */
1982 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1983                                   int lineno, const char *filename,
1984                                   int full_traceback, int nogil);
1985 
1986 /* PyErrExceptionMatches.proto */
1987 #if CYTHON_FAST_THREAD_STATE
1988 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1989 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1990 #else
1991 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1992 #endif
1993 
1994 /* GetAttr.proto */
1995 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1996 
1997 /* GetAttr3.proto */
1998 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1999 
2000 /* Import.proto */
2001 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
2002 
2003 /* ImportFrom.proto */
2004 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
2005 
2006 /* RaiseException.proto */
2007 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
2008 
2009 /* ExtTypeTest.proto */
2010 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
2011 
2012 /* HasAttr.proto */
2013 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
2014 
2015 /* GetTopmostException.proto */
2016 #if CYTHON_USE_EXC_INFO_STACK
2017 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
2018 #endif
2019 
2020 /* SaveResetException.proto */
2021 #if CYTHON_FAST_THREAD_STATE
2022 #define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
2023 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
2024 #define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
2025 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
2026 #else
2027 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
2028 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
2029 #endif
2030 
2031 /* GetException.proto */
2032 #if CYTHON_FAST_THREAD_STATE
2033 #define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
2034 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
2035 #else
2036 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
2037 #endif
2038 
2039 /* ArgTypeTest.proto */
2040 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
2041     ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
2042         __Pyx__ArgTypeTest(obj, type, name, exact))
2043 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
2044 
2045 /* IncludeStringH.proto */
2046 #include <string.h>
2047 
2048 /* BytesEquals.proto */
2049 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
2050 
2051 /* UnicodeEquals.proto */
2052 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
2053 
2054 /* StrEquals.proto */
2055 #if PY_MAJOR_VERSION >= 3
2056 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
2057 #else
2058 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
2059 #endif
2060 
2061 /* None.proto */
2062 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
2063 
2064 /* UnaryNegOverflows.proto */
2065 #define UNARY_NEG_WOULD_OVERFLOW(x)\
2066         (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
2067 
2068 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
2069 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
2070 /* GetItemInt.proto */
2071 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
2072     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
2073     __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
2074     (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
2075                __Pyx_GetItemInt_Generic(o, to_py_func(i))))
2076 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
2077     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
2078     __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
2079     (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
2080 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
2081                                                               int wraparound, int boundscheck);
2082 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
2083     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
2084     __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
2085     (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
2086 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
2087                                                               int wraparound, int boundscheck);
2088 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
2089 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
2090                                                      int is_list, int wraparound, int boundscheck);
2091 
2092 /* ObjectGetItem.proto */
2093 #if CYTHON_USE_TYPE_SLOTS
2094 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
2095 #else
2096 #define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
2097 #endif
2098 
2099 /* decode_c_string_utf16.proto */
__Pyx_PyUnicode_DecodeUTF16(const char * s,Py_ssize_t size,const char * errors)2100 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
2101     int byteorder = 0;
2102     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
2103 }
__Pyx_PyUnicode_DecodeUTF16LE(const char * s,Py_ssize_t size,const char * errors)2104 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
2105     int byteorder = -1;
2106     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
2107 }
__Pyx_PyUnicode_DecodeUTF16BE(const char * s,Py_ssize_t size,const char * errors)2108 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
2109     int byteorder = 1;
2110     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
2111 }
2112 
2113 /* decode_c_string.proto */
2114 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
2115          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
2116          const char* encoding, const char* errors,
2117          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
2118 
2119 /* RaiseTooManyValuesToUnpack.proto */
2120 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
2121 
2122 /* RaiseNeedMoreValuesToUnpack.proto */
2123 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
2124 
2125 /* RaiseNoneIterError.proto */
2126 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
2127 
2128 /* SwapException.proto */
2129 #if CYTHON_FAST_THREAD_STATE
2130 #define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
2131 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
2132 #else
2133 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
2134 #endif
2135 
2136 /* FastTypeChecks.proto */
2137 #if CYTHON_COMPILING_IN_CPYTHON
2138 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
2139 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
2140 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
2141 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
2142 #else
2143 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
2144 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
2145 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
2146 #endif
2147 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
2148 
2149 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
2150 /* PyIntBinop.proto */
2151 #if !CYTHON_COMPILING_IN_PYPY
2152 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
2153 #else
2154 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
2155     (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
2156 #endif
2157 
2158 /* ListExtend.proto */
__Pyx_PyList_Extend(PyObject * L,PyObject * v)2159 static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
2160 #if CYTHON_COMPILING_IN_CPYTHON
2161     PyObject* none = _PyList_Extend((PyListObject*)L, v);
2162     if (unlikely(!none))
2163         return -1;
2164     Py_DECREF(none);
2165     return 0;
2166 #else
2167     return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
2168 #endif
2169 }
2170 
2171 /* ListAppend.proto */
2172 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_PyList_Append(PyObject * list,PyObject * x)2173 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
2174     PyListObject* L = (PyListObject*) list;
2175     Py_ssize_t len = Py_SIZE(list);
2176     if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
2177         Py_INCREF(x);
2178         PyList_SET_ITEM(list, len, x);
2179         __Pyx_SET_SIZE(list, len + 1);
2180         return 0;
2181     }
2182     return PyList_Append(list, x);
2183 }
2184 #else
2185 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
2186 #endif
2187 
2188 /* None.proto */
2189 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
2190 
2191 /* None.proto */
2192 static CYTHON_INLINE long __Pyx_div_long(long, long);
2193 
2194 /* CallNextTpDealloc.proto */
2195 static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc);
2196 
2197 /* CallNextTpTraverse.proto */
2198 static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse);
2199 
2200 /* CallNextTpClear.proto */
2201 static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_dealloc);
2202 
2203 /* PyObject_GenericGetAttrNoDict.proto */
2204 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2205 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
2206 #else
2207 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
2208 #endif
2209 
2210 /* PyObject_GenericGetAttr.proto */
2211 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2212 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
2213 #else
2214 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
2215 #endif
2216 
2217 /* TypeImport.proto */
2218 #ifndef __PYX_HAVE_RT_ImportType_proto
2219 #define __PYX_HAVE_RT_ImportType_proto
2220 enum __Pyx_ImportType_CheckSize {
2221    __Pyx_ImportType_CheckSize_Error = 0,
2222    __Pyx_ImportType_CheckSize_Warn = 1,
2223    __Pyx_ImportType_CheckSize_Ignore = 2
2224 };
2225 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
2226 #endif
2227 
2228 /* GetVTable.proto */
2229 static void* __Pyx_GetVtable(PyObject *dict);
2230 
2231 /* SetVTable.proto */
2232 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
2233 
2234 /* PyObjectGetAttrStrNoError.proto */
2235 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
2236 
2237 /* SetupReduce.proto */
2238 static int __Pyx_setup_reduce(PyObject* type_obj);
2239 
2240 /* CLineInTraceback.proto */
2241 #ifdef CYTHON_CLINE_IN_TRACEBACK
2242 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
2243 #else
2244 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
2245 #endif
2246 
2247 /* CodeObjectCache.proto */
2248 typedef struct {
2249     PyCodeObject* code_object;
2250     int code_line;
2251 } __Pyx_CodeObjectCacheEntry;
2252 struct __Pyx_CodeObjectCache {
2253     int count;
2254     int max_count;
2255     __Pyx_CodeObjectCacheEntry* entries;
2256 };
2257 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
2258 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
2259 static PyCodeObject *__pyx_find_code_object(int code_line);
2260 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
2261 
2262 /* AddTraceback.proto */
2263 static void __Pyx_AddTraceback(const char *funcname, int c_line,
2264                                int py_line, const char *filename);
2265 
2266 #if PY_MAJOR_VERSION < 3
2267     static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
2268     static void __Pyx_ReleaseBuffer(Py_buffer *view);
2269 #else
2270     #define __Pyx_GetBuffer PyObject_GetBuffer
2271     #define __Pyx_ReleaseBuffer PyBuffer_Release
2272 #endif
2273 
2274 
2275 /* BufferStructDeclare.proto */
2276 typedef struct {
2277   Py_ssize_t shape, strides, suboffsets;
2278 } __Pyx_Buf_DimInfo;
2279 typedef struct {
2280   size_t refcount;
2281   Py_buffer pybuffer;
2282 } __Pyx_Buffer;
2283 typedef struct {
2284   __Pyx_Buffer *rcbuffer;
2285   char *data;
2286   __Pyx_Buf_DimInfo diminfo[8];
2287 } __Pyx_LocalBuf_ND;
2288 
2289 /* MemviewSliceIsContig.proto */
2290 static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);
2291 
2292 /* OverlappingSlices.proto */
2293 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
2294                                 __Pyx_memviewslice *slice2,
2295                                 int ndim, size_t itemsize);
2296 
2297 /* Capsule.proto */
2298 static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
2299 
2300 /* MemviewDtypeToObject.proto */
2301 static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp);
2302 static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj);
2303 
2304 /* IsLittleEndian.proto */
2305 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
2306 
2307 /* BufferFormatCheck.proto */
2308 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
2309 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
2310                               __Pyx_BufFmt_StackElem* stack,
2311                               __Pyx_TypeInfo* type);
2312 
2313 /* TypeInfoCompare.proto */
2314 static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
2315 
2316 /* MemviewSliceValidateAndInit.proto */
2317 static int __Pyx_ValidateAndInit_memviewslice(
2318                 int *axes_specs,
2319                 int c_or_f_flag,
2320                 int buf_flags,
2321                 int ndim,
2322                 __Pyx_TypeInfo *dtype,
2323                 __Pyx_BufFmt_StackElem stack[],
2324                 __Pyx_memviewslice *memviewslice,
2325                 PyObject *original_obj);
2326 
2327 /* ObjectToMemviewSlice.proto */
2328 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_double(PyObject *, int writable_flag);
2329 
2330 /* GCCDiagnostics.proto */
2331 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
2332 #define __Pyx_HAS_GCC_DIAGNOSTIC
2333 #endif
2334 
2335 /* RealImag.proto */
2336 #if CYTHON_CCOMPLEX
2337   #ifdef __cplusplus
2338     #define __Pyx_CREAL(z) ((z).real())
2339     #define __Pyx_CIMAG(z) ((z).imag())
2340   #else
2341     #define __Pyx_CREAL(z) (__real__(z))
2342     #define __Pyx_CIMAG(z) (__imag__(z))
2343   #endif
2344 #else
2345     #define __Pyx_CREAL(z) ((z).real)
2346     #define __Pyx_CIMAG(z) ((z).imag)
2347 #endif
2348 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
2349         && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
2350     #define __Pyx_SET_CREAL(z,x) ((z).real(x))
2351     #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
2352 #else
2353     #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
2354     #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
2355 #endif
2356 
2357 /* Arithmetic.proto */
2358 #if CYTHON_CCOMPLEX
2359     #define __Pyx_c_eq_float(a, b)   ((a)==(b))
2360     #define __Pyx_c_sum_float(a, b)  ((a)+(b))
2361     #define __Pyx_c_diff_float(a, b) ((a)-(b))
2362     #define __Pyx_c_prod_float(a, b) ((a)*(b))
2363     #define __Pyx_c_quot_float(a, b) ((a)/(b))
2364     #define __Pyx_c_neg_float(a)     (-(a))
2365   #ifdef __cplusplus
2366     #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
2367     #define __Pyx_c_conj_float(z)    (::std::conj(z))
2368     #if 1
2369         #define __Pyx_c_abs_float(z)     (::std::abs(z))
2370         #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
2371     #endif
2372   #else
2373     #define __Pyx_c_is_zero_float(z) ((z)==0)
2374     #define __Pyx_c_conj_float(z)    (conjf(z))
2375     #if 1
2376         #define __Pyx_c_abs_float(z)     (cabsf(z))
2377         #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
2378     #endif
2379  #endif
2380 #else
2381     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
2382     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
2383     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
2384     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
2385     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
2386     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
2387     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
2388     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
2389     #if 1
2390         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
2391         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
2392     #endif
2393 #endif
2394 
2395 /* Arithmetic.proto */
2396 #if CYTHON_CCOMPLEX
2397     #define __Pyx_c_eq_double(a, b)   ((a)==(b))
2398     #define __Pyx_c_sum_double(a, b)  ((a)+(b))
2399     #define __Pyx_c_diff_double(a, b) ((a)-(b))
2400     #define __Pyx_c_prod_double(a, b) ((a)*(b))
2401     #define __Pyx_c_quot_double(a, b) ((a)/(b))
2402     #define __Pyx_c_neg_double(a)     (-(a))
2403   #ifdef __cplusplus
2404     #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
2405     #define __Pyx_c_conj_double(z)    (::std::conj(z))
2406     #if 1
2407         #define __Pyx_c_abs_double(z)     (::std::abs(z))
2408         #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
2409     #endif
2410   #else
2411     #define __Pyx_c_is_zero_double(z) ((z)==0)
2412     #define __Pyx_c_conj_double(z)    (conj(z))
2413     #if 1
2414         #define __Pyx_c_abs_double(z)     (cabs(z))
2415         #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
2416     #endif
2417  #endif
2418 #else
2419     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
2420     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
2421     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
2422     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
2423     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
2424     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
2425     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
2426     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
2427     #if 1
2428         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
2429         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
2430     #endif
2431 #endif
2432 
2433 /* MemviewSliceCopyTemplate.proto */
2434 static __Pyx_memviewslice
2435 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
2436                                  const char *mode, int ndim,
2437                                  size_t sizeof_dtype, int contig_flag,
2438                                  int dtype_is_object);
2439 
2440 /* CIntFromPy.proto */
2441 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
2442 
2443 /* CIntFromPy.proto */
2444 static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *);
2445 
2446 /* CIntToPy.proto */
2447 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);
2448 
2449 /* CIntToPy.proto */
2450 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
2451 
2452 /* CIntFromPy.proto */
2453 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
2454 
2455 /* CIntToPy.proto */
2456 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
2457 
2458 /* CIntFromPy.proto */
2459 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
2460 
2461 /* ObjectToMemviewSlice.proto */
2462 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *, int writable_flag);
2463 
2464 /* ObjectToMemviewSlice.proto */
2465 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_uint8_t(PyObject *, int writable_flag);
2466 
2467 /* CheckBinaryVersion.proto */
2468 static int __Pyx_check_binary_version(void);
2469 
2470 /* FunctionImport.proto */
2471 static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig);
2472 
2473 /* InitStrings.proto */
2474 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2475 
2476 static int __pyx_f_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_get_direction_c(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *__pyx_v_self, double *__pyx_v_point, double *__pyx_v_direction); /* proto*/
2477 static int __pyx_f_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_get_direction_c(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter *__pyx_v_self, double *__pyx_v_point, double *__pyx_v_direction); /* proto*/
2478 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
2479 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
2480 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
2481 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
2482 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*/
2483 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
2484 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2485 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2486 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2487 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2488 
2489 /* Module declarations from 'cpython.buffer' */
2490 
2491 /* Module declarations from 'libc.string' */
2492 
2493 /* Module declarations from 'libc.stdio' */
2494 
2495 /* Module declarations from '__builtin__' */
2496 
2497 /* Module declarations from 'cpython.type' */
2498 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2499 
2500 /* Module declarations from 'cpython' */
2501 
2502 /* Module declarations from 'cpython.object' */
2503 
2504 /* Module declarations from 'cpython.ref' */
2505 
2506 /* Module declarations from 'cpython.mem' */
2507 
2508 /* Module declarations from 'numpy' */
2509 
2510 /* Module declarations from 'numpy' */
2511 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
2512 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
2513 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
2514 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
2515 static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
2516 static PyTypeObject *__pyx_ptype_5numpy_number = 0;
2517 static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
2518 static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
2519 static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
2520 static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
2521 static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
2522 static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
2523 static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
2524 static PyTypeObject *__pyx_ptype_5numpy_character = 0;
2525 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
2526 
2527 /* Module declarations from 'dipy.direction.pmf' */
2528 static PyTypeObject *__pyx_ptype_4dipy_9direction_3pmf_PmfGen = 0;
2529 static PyTypeObject *__pyx_ptype_4dipy_9direction_3pmf_SimplePmfGen = 0;
2530 static PyTypeObject *__pyx_ptype_4dipy_9direction_3pmf_SHCoeffPmfGen = 0;
2531 static PyTypeObject *__pyx_ptype_4dipy_9direction_3pmf_BootPmfGen = 0;
2532 
2533 /* Module declarations from 'dipy.tracking.direction_getter' */
2534 static PyTypeObject *__pyx_ptype_4dipy_8tracking_16direction_getter_DirectionGetter = 0;
2535 
2536 /* Module declarations from 'dipy.direction.closest_peak_direction_getter' */
2537 static PyTypeObject *__pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_BasePmfDirectionGetter = 0;
2538 static PyTypeObject *__pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_BaseDirectionGetter = 0;
2539 static PyTypeObject *__pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter = 0;
2540 static PyTypeObject *__pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_ClosestPeakDirectionGetter = 0;
2541 
2542 /* Module declarations from 'dipy.utils.fast_numpy' */
2543 static int (*__pyx_f_4dipy_5utils_10fast_numpy_where_to_insert)(__pyx_t_5numpy_float_t *, __pyx_t_5numpy_float_t, int); /*proto*/
2544 static void (*__pyx_f_4dipy_5utils_10fast_numpy_cumsum)(__pyx_t_5numpy_float_t *, __pyx_t_5numpy_float_t *, int); /*proto*/
2545 
2546 /* Module declarations from 'dipy.direction.probabilistic_direction_getter' */
2547 static PyTypeObject *__pyx_ptype_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter = 0;
2548 static PyTypeObject *__pyx_ptype_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter = 0;
2549 static PyTypeObject *__pyx_array_type = 0;
2550 static PyTypeObject *__pyx_MemviewEnum_type = 0;
2551 static PyTypeObject *__pyx_memoryview_type = 0;
2552 static PyTypeObject *__pyx_memoryviewslice_type = 0;
2553 static PyObject *generic = 0;
2554 static PyObject *strided = 0;
2555 static PyObject *indirect = 0;
2556 static PyObject *contiguous = 0;
2557 static PyObject *indirect_contiguous = 0;
2558 static int __pyx_memoryview_thread_locks_used;
2559 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2560 static PyObject *__pyx_f_4dipy_9direction_30probabilistic_direction_getter___pyx_unpickle_ProbabilisticDirectionGetter__set_state(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *, PyObject *); /*proto*/
2561 static PyObject *__pyx_f_4dipy_9direction_30probabilistic_direction_getter___pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter *, PyObject *); /*proto*/
2562 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
2563 static void *__pyx_align_pointer(void *, size_t); /*proto*/
2564 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
2565 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
2566 static PyObject *_unellipsify(PyObject *, int); /*proto*/
2567 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
2568 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
2569 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*/
2570 static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
2571 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
2572 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
2573 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2574 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2575 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
2576 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2577 static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
2578 static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
2579 static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
2580 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
2581 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
2582 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
2583 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
2584 static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
2585 static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
2586 static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
2587 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
2588 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
2589 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
2590 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2591 static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2592 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
2593 static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
2594 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
2595 static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 };
2596 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t = { "uint8_t", NULL, sizeof(__pyx_t_5numpy_uint8_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_uint8_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_uint8_t), 0 };
2597 #define __Pyx_MODULE_NAME "dipy.direction.probabilistic_direction_getter"
2598 extern int __pyx_module_is_main_dipy__direction__probabilistic_direction_getter;
2599 int __pyx_module_is_main_dipy__direction__probabilistic_direction_getter = 0;
2600 
2601 /* Implementation of 'dipy.direction.probabilistic_direction_getter' */
2602 static PyObject *__pyx_builtin_zip;
2603 static PyObject *__pyx_builtin_range;
2604 static PyObject *__pyx_builtin_ImportError;
2605 static PyObject *__pyx_builtin_ValueError;
2606 static PyObject *__pyx_builtin_MemoryError;
2607 static PyObject *__pyx_builtin_enumerate;
2608 static PyObject *__pyx_builtin_TypeError;
2609 static PyObject *__pyx_builtin_Ellipsis;
2610 static PyObject *__pyx_builtin_id;
2611 static PyObject *__pyx_builtin_IndexError;
2612 static const char __pyx_k_O[] = "O";
2613 static const char __pyx_k_T[] = "T";
2614 static const char __pyx_k_c[] = "c";
2615 static const char __pyx_k_id[] = "id";
2616 static const char __pyx_k_np[] = "np";
2617 static const char __pyx_k_dot[] = "dot";
2618 static const char __pyx_k_new[] = "__new__";
2619 static const char __pyx_k_obj[] = "obj";
2620 static const char __pyx_k_zip[] = "zip";
2621 static const char __pyx_k_base[] = "base";
2622 static const char __pyx_k_copy[] = "copy";
2623 static const char __pyx_k_dict[] = "__dict__";
2624 static const char __pyx_k_init[] = "__init__";
2625 static const char __pyx_k_main[] = "__main__";
2626 static const char __pyx_k_mode[] = "mode";
2627 static const char __pyx_k_name[] = "name";
2628 static const char __pyx_k_ndim[] = "ndim";
2629 static const char __pyx_k_pack[] = "pack";
2630 static const char __pyx_k_size[] = "size";
2631 static const char __pyx_k_step[] = "step";
2632 static const char __pyx_k_stop[] = "stop";
2633 static const char __pyx_k_test[] = "__test__";
2634 static const char __pyx_k_ASCII[] = "ASCII";
2635 static const char __pyx_k_class[] = "__class__";
2636 static const char __pyx_k_error[] = "error";
2637 static const char __pyx_k_flags[] = "flags";
2638 static const char __pyx_k_numpy[] = "numpy";
2639 static const char __pyx_k_range[] = "range";
2640 static const char __pyx_k_shape[] = "shape";
2641 static const char __pyx_k_start[] = "start";
2642 static const char __pyx_k_uint8[] = "uint8";
2643 static const char __pyx_k_astype[] = "astype";
2644 static const char __pyx_k_encode[] = "encode";
2645 static const char __pyx_k_format[] = "format";
2646 static const char __pyx_k_import[] = "__import__";
2647 static const char __pyx_k_name_2[] = "__name__";
2648 static const char __pyx_k_pickle[] = "pickle";
2649 static const char __pyx_k_random[] = "random";
2650 static const char __pyx_k_reduce[] = "__reduce__";
2651 static const char __pyx_k_sphere[] = "sphere";
2652 static const char __pyx_k_struct[] = "struct";
2653 static const char __pyx_k_unpack[] = "unpack";
2654 static const char __pyx_k_update[] = "update";
2655 static const char __pyx_k_fortran[] = "fortran";
2656 static const char __pyx_k_memview[] = "memview";
2657 static const char __pyx_k_pmf_gen[] = "pmf_gen";
2658 static const char __pyx_k_Ellipsis[] = "Ellipsis";
2659 static const char __pyx_k_getstate[] = "__getstate__";
2660 static const char __pyx_k_itemsize[] = "itemsize";
2661 static const char __pyx_k_pyx_type[] = "__pyx_type";
2662 static const char __pyx_k_setstate[] = "__setstate__";
2663 static const char __pyx_k_vertices[] = "vertices";
2664 static const char __pyx_k_TypeError[] = "TypeError";
2665 static const char __pyx_k_enumerate[] = "enumerate";
2666 static const char __pyx_k_max_angle[] = "max_angle";
2667 static const char __pyx_k_pyx_state[] = "__pyx_state";
2668 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
2669 static const char __pyx_k_IndexError[] = "IndexError";
2670 static const char __pyx_k_ValueError[] = "ValueError";
2671 static const char __pyx_k_pyx_result[] = "__pyx_result";
2672 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
2673 static const char __pyx_k_ImportError[] = "ImportError";
2674 static const char __pyx_k_MemoryError[] = "MemoryError";
2675 static const char __pyx_k_PickleError[] = "PickleError";
2676 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
2677 static const char __pyx_k_stringsource[] = "stringsource";
2678 static const char __pyx_k_pmf_threshold[] = "pmf_threshold";
2679 static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
2680 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
2681 static const char __pyx_k_cos_similarity[] = "cos_similarity";
2682 static const char __pyx_k_default_sphere[] = "default_sphere";
2683 static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
2684 static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
2685 static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
2686 static const char __pyx_k_peak_directions[] = "peak_directions";
2687 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
2688 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
2689 static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
2690 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2691 static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
2692 static const char __pyx_k_dipy_direction_peaks[] = "dipy.direction.peaks";
2693 static const char __pyx_k_set_adjacency_matrix[] = "_set_adjacency_matrix";
2694 static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
2695 static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
2696 static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
2697 static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
2698 static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
2699 static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
2700 static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
2701 static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
2702 static const char __pyx_k_ProbabilisticDirectionGetter[] = "ProbabilisticDirectionGetter";
2703 static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
2704 static const char __pyx_k_pyx_unpickle_DeterministicMaxi[] = "__pyx_unpickle_DeterministicMaximumDirectionGetter";
2705 static const char __pyx_k_pyx_unpickle_ProbabilisticDire[] = "__pyx_unpickle_ProbabilisticDirectionGetter";
2706 static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
2707 static const char __pyx_k_Implementation_of_a_probabilist[] = "\nImplementation of a probabilistic direction getter based on sampling from\ndiscrete distribution (pmf) at each step of the tracking.\n";
2708 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
2709 static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
2710 static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
2711 static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
2712 static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
2713 static const char __pyx_k_DeterministicMaximumDirectionGet[] = "DeterministicMaximumDirectionGetter";
2714 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
2715 static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))";
2716 static const char __pyx_k_Incompatible_checksums_s_vs_0xd8[] = "Incompatible checksums (%s vs 0xd86c5c3 = (_adj_matrix, _pf_kwargs, cos_similarity, pmf_gen, pmf_threshold, sphere, vertices))";
2717 static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
2718 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
2719 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
2720 static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
2721 static const char __pyx_k_dipy_direction_probabilistic_dir[] = "dipy.direction.probabilistic_direction_getter";
2722 static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
2723 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
2724 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
2725 static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
2726 static PyObject *__pyx_n_s_ASCII;
2727 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
2728 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
2729 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
2730 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
2731 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
2732 static PyObject *__pyx_n_s_DeterministicMaximumDirectionGet;
2733 static PyObject *__pyx_n_s_Ellipsis;
2734 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
2735 static PyObject *__pyx_n_s_ImportError;
2736 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
2737 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xd8;
2738 static PyObject *__pyx_n_s_IndexError;
2739 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
2740 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
2741 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
2742 static PyObject *__pyx_n_s_MemoryError;
2743 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
2744 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
2745 static PyObject *__pyx_n_b_O;
2746 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
2747 static PyObject *__pyx_n_s_PickleError;
2748 static PyObject *__pyx_n_s_ProbabilisticDirectionGetter;
2749 static PyObject *__pyx_n_s_T;
2750 static PyObject *__pyx_n_s_TypeError;
2751 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
2752 static PyObject *__pyx_n_s_ValueError;
2753 static PyObject *__pyx_n_s_View_MemoryView;
2754 static PyObject *__pyx_n_s_allocate_buffer;
2755 static PyObject *__pyx_n_s_astype;
2756 static PyObject *__pyx_n_s_base;
2757 static PyObject *__pyx_n_s_c;
2758 static PyObject *__pyx_n_u_c;
2759 static PyObject *__pyx_n_s_class;
2760 static PyObject *__pyx_n_s_cline_in_traceback;
2761 static PyObject *__pyx_kp_s_contiguous_and_direct;
2762 static PyObject *__pyx_kp_s_contiguous_and_indirect;
2763 static PyObject *__pyx_n_s_copy;
2764 static PyObject *__pyx_n_s_cos_similarity;
2765 static PyObject *__pyx_n_s_default_sphere;
2766 static PyObject *__pyx_n_s_dict;
2767 static PyObject *__pyx_n_s_dipy_direction_peaks;
2768 static PyObject *__pyx_n_s_dipy_direction_probabilistic_dir;
2769 static PyObject *__pyx_n_s_dot;
2770 static PyObject *__pyx_n_s_dtype_is_object;
2771 static PyObject *__pyx_n_s_encode;
2772 static PyObject *__pyx_n_s_enumerate;
2773 static PyObject *__pyx_n_s_error;
2774 static PyObject *__pyx_n_s_flags;
2775 static PyObject *__pyx_n_s_format;
2776 static PyObject *__pyx_n_s_fortran;
2777 static PyObject *__pyx_n_u_fortran;
2778 static PyObject *__pyx_n_s_getstate;
2779 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
2780 static PyObject *__pyx_n_s_id;
2781 static PyObject *__pyx_n_s_import;
2782 static PyObject *__pyx_n_s_init;
2783 static PyObject *__pyx_n_s_itemsize;
2784 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
2785 static PyObject *__pyx_n_s_main;
2786 static PyObject *__pyx_n_s_max_angle;
2787 static PyObject *__pyx_n_s_memview;
2788 static PyObject *__pyx_n_s_mode;
2789 static PyObject *__pyx_n_s_name;
2790 static PyObject *__pyx_n_s_name_2;
2791 static PyObject *__pyx_n_s_ndim;
2792 static PyObject *__pyx_n_s_new;
2793 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2794 static PyObject *__pyx_n_s_np;
2795 static PyObject *__pyx_n_s_numpy;
2796 static PyObject *__pyx_kp_u_numpy_core_multiarray_failed_to;
2797 static PyObject *__pyx_kp_u_numpy_core_umath_failed_to_impor;
2798 static PyObject *__pyx_n_s_obj;
2799 static PyObject *__pyx_n_s_pack;
2800 static PyObject *__pyx_n_s_peak_directions;
2801 static PyObject *__pyx_n_s_pickle;
2802 static PyObject *__pyx_n_s_pmf_gen;
2803 static PyObject *__pyx_n_s_pmf_threshold;
2804 static PyObject *__pyx_n_s_pyx_PickleError;
2805 static PyObject *__pyx_n_s_pyx_checksum;
2806 static PyObject *__pyx_n_s_pyx_getbuffer;
2807 static PyObject *__pyx_n_s_pyx_result;
2808 static PyObject *__pyx_n_s_pyx_state;
2809 static PyObject *__pyx_n_s_pyx_type;
2810 static PyObject *__pyx_n_s_pyx_unpickle_DeterministicMaxi;
2811 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
2812 static PyObject *__pyx_n_s_pyx_unpickle_ProbabilisticDire;
2813 static PyObject *__pyx_n_s_pyx_vtable;
2814 static PyObject *__pyx_n_s_random;
2815 static PyObject *__pyx_n_s_range;
2816 static PyObject *__pyx_n_s_reduce;
2817 static PyObject *__pyx_n_s_reduce_cython;
2818 static PyObject *__pyx_n_s_reduce_ex;
2819 static PyObject *__pyx_n_s_set_adjacency_matrix;
2820 static PyObject *__pyx_n_s_setstate;
2821 static PyObject *__pyx_n_s_setstate_cython;
2822 static PyObject *__pyx_n_s_shape;
2823 static PyObject *__pyx_n_s_size;
2824 static PyObject *__pyx_n_s_sphere;
2825 static PyObject *__pyx_n_s_start;
2826 static PyObject *__pyx_n_s_step;
2827 static PyObject *__pyx_n_s_stop;
2828 static PyObject *__pyx_kp_s_strided_and_direct;
2829 static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
2830 static PyObject *__pyx_kp_s_strided_and_indirect;
2831 static PyObject *__pyx_kp_s_stringsource;
2832 static PyObject *__pyx_n_s_struct;
2833 static PyObject *__pyx_n_s_test;
2834 static PyObject *__pyx_n_u_uint8;
2835 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
2836 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
2837 static PyObject *__pyx_n_s_unpack;
2838 static PyObject *__pyx_n_s_update;
2839 static PyObject *__pyx_n_s_vertices;
2840 static PyObject *__pyx_n_s_zip;
2841 static int __pyx_pf_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter___init__(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *__pyx_v_self, PyObject *__pyx_v_pmf_gen, PyObject *__pyx_v_max_angle, PyObject *__pyx_v_sphere, PyObject *__pyx_v_pmf_threshold, PyObject *__pyx_v_kwargs); /* proto */
2842 static PyObject *__pyx_pf_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_2_set_adjacency_matrix(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *__pyx_v_self, PyObject *__pyx_v_sphere, PyObject *__pyx_v_cos_similarity); /* proto */
2843 static PyObject *__pyx_pf_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_4__reduce_cython__(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *__pyx_v_self); /* proto */
2844 static PyObject *__pyx_pf_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_6__setstate_cython__(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
2845 static int __pyx_pf_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter___init__(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter *__pyx_v_self, PyObject *__pyx_v_pmf_gen, PyObject *__pyx_v_max_angle, PyObject *__pyx_v_sphere, PyObject *__pyx_v_pmf_threshold, PyObject *__pyx_v_kwargs); /* proto */
2846 static PyObject *__pyx_pf_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_2__reduce_cython__(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter *__pyx_v_self); /* proto */
2847 static PyObject *__pyx_pf_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_4__setstate_cython__(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
2848 static PyObject *__pyx_pf_4dipy_9direction_30probabilistic_direction_getter___pyx_unpickle_ProbabilisticDirectionGetter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
2849 static PyObject *__pyx_pf_4dipy_9direction_30probabilistic_direction_getter_2__pyx_unpickle_DeterministicMaximumDirectionGetter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
2850 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 */
2851 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 */
2852 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2853 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2854 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2855 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
2856 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
2857 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 */
2858 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
2859 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 */
2860 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
2861 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2862 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2863 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
2864 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 */
2865 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2866 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
2867 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 */
2868 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 */
2869 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2870 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2871 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2872 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2873 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2874 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2875 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2876 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2877 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2878 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2879 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2880 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2881 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2882 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2883 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2884 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2885 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2886 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 */
2887 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2888 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2889 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2890 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 */
2891 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 */
2892 static PyObject *__pyx_tp_new_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2893 static PyObject *__pyx_tp_new_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2894 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2895 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2896 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2897 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2898 static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_update = {0, &__pyx_n_s_update, 0, 0, 0};
2899 static PyObject *__pyx_float_0_1;
2900 static PyObject *__pyx_int_0;
2901 static PyObject *__pyx_int_1;
2902 static PyObject *__pyx_int_184977713;
2903 static PyObject *__pyx_int_226936259;
2904 static PyObject *__pyx_int_neg_1;
2905 static PyObject *__pyx_tuple_;
2906 static PyObject *__pyx_tuple__2;
2907 static PyObject *__pyx_tuple__3;
2908 static PyObject *__pyx_tuple__4;
2909 static PyObject *__pyx_tuple__5;
2910 static PyObject *__pyx_tuple__6;
2911 static PyObject *__pyx_tuple__7;
2912 static PyObject *__pyx_tuple__8;
2913 static PyObject *__pyx_tuple__9;
2914 static PyObject *__pyx_slice__17;
2915 static PyObject *__pyx_tuple__10;
2916 static PyObject *__pyx_tuple__11;
2917 static PyObject *__pyx_tuple__12;
2918 static PyObject *__pyx_tuple__13;
2919 static PyObject *__pyx_tuple__14;
2920 static PyObject *__pyx_tuple__15;
2921 static PyObject *__pyx_tuple__16;
2922 static PyObject *__pyx_tuple__18;
2923 static PyObject *__pyx_tuple__19;
2924 static PyObject *__pyx_tuple__20;
2925 static PyObject *__pyx_tuple__21;
2926 static PyObject *__pyx_tuple__23;
2927 static PyObject *__pyx_tuple__25;
2928 static PyObject *__pyx_tuple__26;
2929 static PyObject *__pyx_tuple__27;
2930 static PyObject *__pyx_tuple__28;
2931 static PyObject *__pyx_tuple__29;
2932 static PyObject *__pyx_tuple__30;
2933 static PyObject *__pyx_codeobj__22;
2934 static PyObject *__pyx_codeobj__24;
2935 static PyObject *__pyx_codeobj__31;
2936 /* Late includes */
2937 
2938 /* "dipy/direction/probabilistic_direction_getter.pyx":35
2939  *         dict _adj_matrix
2940  *
2941  *     def __init__(self, pmf_gen, max_angle, sphere=None, pmf_threshold=0.1,             # <<<<<<<<<<<<<<
2942  *                  **kwargs):
2943  *         """Direction getter from a pmf generator.
2944  */
2945 
2946 /* Python wrapper */
2947 static int __pyx_pw_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2948 static char __pyx_doc_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter___init__[] = "Direction getter from a pmf generator.\n\n        Parameters\n        ----------\n        pmf_gen : PmfGen\n            Used to get probability mass function for selecting tracking\n            directions.\n        max_angle : float, [0, 90]\n            The maximum allowed angle between incoming direction and new\n            direction.\n        sphere : Sphere\n            The set of directions to be used for tracking.\n        pmf_threshold : float [0., 1.]\n            Used to remove direction from the probability mass function for\n            selecting the tracking direction.\n        relative_peak_threshold : float in [0., 1.]\n            Used for extracting initial tracking directions. Passed to\n            peak_directions.\n        min_separation_angle : float in [0, 90]\n            Used for extracting initial tracking directions. Passed to\n            peak_directions.\n\n        See also\n        --------\n        dipy.direction.peaks.peak_directions\n\n        ";
2949 #if CYTHON_COMPILING_IN_CPYTHON
2950 struct wrapperbase __pyx_wrapperbase_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter___init__;
2951 #endif
__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_1__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)2952 static int __pyx_pw_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2953   PyObject *__pyx_v_pmf_gen = 0;
2954   PyObject *__pyx_v_max_angle = 0;
2955   PyObject *__pyx_v_sphere = 0;
2956   PyObject *__pyx_v_pmf_threshold = 0;
2957   PyObject *__pyx_v_kwargs = 0;
2958   int __pyx_lineno = 0;
2959   const char *__pyx_filename = NULL;
2960   int __pyx_clineno = 0;
2961   int __pyx_r;
2962   __Pyx_RefNannyDeclarations
2963   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
2964   __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
2965   __Pyx_GOTREF(__pyx_v_kwargs);
2966   {
2967     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pmf_gen,&__pyx_n_s_max_angle,&__pyx_n_s_sphere,&__pyx_n_s_pmf_threshold,0};
2968     PyObject* values[4] = {0,0,0,0};
2969     values[2] = ((PyObject *)Py_None);
2970     values[3] = ((PyObject *)__pyx_float_0_1);
2971     if (unlikely(__pyx_kwds)) {
2972       Py_ssize_t kw_args;
2973       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2974       switch (pos_args) {
2975         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2976         CYTHON_FALLTHROUGH;
2977         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2978         CYTHON_FALLTHROUGH;
2979         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2980         CYTHON_FALLTHROUGH;
2981         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2982         CYTHON_FALLTHROUGH;
2983         case  0: break;
2984         default: goto __pyx_L5_argtuple_error;
2985       }
2986       kw_args = PyDict_Size(__pyx_kwds);
2987       switch (pos_args) {
2988         case  0:
2989         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pmf_gen)) != 0)) kw_args--;
2990         else goto __pyx_L5_argtuple_error;
2991         CYTHON_FALLTHROUGH;
2992         case  1:
2993         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_angle)) != 0)) kw_args--;
2994         else {
2995           __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, 1); __PYX_ERR(0, 35, __pyx_L3_error)
2996         }
2997         CYTHON_FALLTHROUGH;
2998         case  2:
2999         if (kw_args > 0) {
3000           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sphere);
3001           if (value) { values[2] = value; kw_args--; }
3002         }
3003         CYTHON_FALLTHROUGH;
3004         case  3:
3005         if (kw_args > 0) {
3006           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pmf_threshold);
3007           if (value) { values[3] = value; kw_args--; }
3008         }
3009       }
3010       if (unlikely(kw_args > 0)) {
3011         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 35, __pyx_L3_error)
3012       }
3013     } else {
3014       switch (PyTuple_GET_SIZE(__pyx_args)) {
3015         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3016         CYTHON_FALLTHROUGH;
3017         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3018         CYTHON_FALLTHROUGH;
3019         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3020         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3021         break;
3022         default: goto __pyx_L5_argtuple_error;
3023       }
3024     }
3025     __pyx_v_pmf_gen = values[0];
3026     __pyx_v_max_angle = values[1];
3027     __pyx_v_sphere = values[2];
3028     __pyx_v_pmf_threshold = values[3];
3029   }
3030   goto __pyx_L4_argument_unpacking_done;
3031   __pyx_L5_argtuple_error:;
3032   __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 35, __pyx_L3_error)
3033   __pyx_L3_error:;
3034   __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
3035   __Pyx_AddTraceback("dipy.direction.probabilistic_direction_getter.ProbabilisticDirectionGetter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3036   __Pyx_RefNannyFinishContext();
3037   return -1;
3038   __pyx_L4_argument_unpacking_done:;
3039   __pyx_r = __pyx_pf_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter___init__(((struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *)__pyx_v_self), __pyx_v_pmf_gen, __pyx_v_max_angle, __pyx_v_sphere, __pyx_v_pmf_threshold, __pyx_v_kwargs);
3040 
3041   /* function exit code */
3042   __Pyx_XDECREF(__pyx_v_kwargs);
3043   __Pyx_RefNannyFinishContext();
3044   return __pyx_r;
3045 }
3046 
__pyx_pf_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter___init__(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter * __pyx_v_self,PyObject * __pyx_v_pmf_gen,PyObject * __pyx_v_max_angle,PyObject * __pyx_v_sphere,PyObject * __pyx_v_pmf_threshold,PyObject * __pyx_v_kwargs)3047 static int __pyx_pf_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter___init__(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *__pyx_v_self, PyObject *__pyx_v_pmf_gen, PyObject *__pyx_v_max_angle, PyObject *__pyx_v_sphere, PyObject *__pyx_v_pmf_threshold, PyObject *__pyx_v_kwargs) {
3048   int __pyx_r;
3049   __Pyx_RefNannyDeclarations
3050   PyObject *__pyx_t_1 = NULL;
3051   PyObject *__pyx_t_2 = NULL;
3052   PyObject *__pyx_t_3 = NULL;
3053   PyObject *__pyx_t_4 = NULL;
3054   __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
3055   int __pyx_t_6;
3056   PyObject *__pyx_t_7 = NULL;
3057   int __pyx_lineno = 0;
3058   const char *__pyx_filename = NULL;
3059   int __pyx_clineno = 0;
3060   __Pyx_RefNannySetupContext("__init__", 0);
3061 
3062   /* "dipy/direction/probabilistic_direction_getter.pyx":64
3063  *
3064  *         """
3065  *         PmfGenDirectionGetter.__init__(self, pmf_gen, max_angle, sphere,             # <<<<<<<<<<<<<<
3066  *                                        pmf_threshold, **kwargs)
3067  *         # The vertices need to be in a contiguous array
3068  */
3069   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error)
3070   __Pyx_GOTREF(__pyx_t_1);
3071 
3072   /* "dipy/direction/probabilistic_direction_getter.pyx":65
3073  *         """
3074  *         PmfGenDirectionGetter.__init__(self, pmf_gen, max_angle, sphere,
3075  *                                        pmf_threshold, **kwargs)             # <<<<<<<<<<<<<<
3076  *         # The vertices need to be in a contiguous array
3077  *         self.vertices = self.sphere.vertices.copy()
3078  */
3079   __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error)
3080   __Pyx_GOTREF(__pyx_t_2);
3081   __Pyx_INCREF(((PyObject *)__pyx_v_self));
3082   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
3083   PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
3084   __Pyx_INCREF(__pyx_v_pmf_gen);
3085   __Pyx_GIVEREF(__pyx_v_pmf_gen);
3086   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_pmf_gen);
3087   __Pyx_INCREF(__pyx_v_max_angle);
3088   __Pyx_GIVEREF(__pyx_v_max_angle);
3089   PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_max_angle);
3090   __Pyx_INCREF(__pyx_v_sphere);
3091   __Pyx_GIVEREF(__pyx_v_sphere);
3092   PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_sphere);
3093   __Pyx_INCREF(__pyx_v_pmf_threshold);
3094   __Pyx_GIVEREF(__pyx_v_pmf_threshold);
3095   PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_pmf_threshold);
3096 
3097   /* "dipy/direction/probabilistic_direction_getter.pyx":64
3098  *
3099  *         """
3100  *         PmfGenDirectionGetter.__init__(self, pmf_gen, max_angle, sphere,             # <<<<<<<<<<<<<<
3101  *                                        pmf_threshold, **kwargs)
3102  *         # The vertices need to be in a contiguous array
3103  */
3104   __pyx_t_3 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error)
3105   __Pyx_GOTREF(__pyx_t_3);
3106   __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error)
3107   __Pyx_GOTREF(__pyx_t_4);
3108   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3109   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3110   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3111   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3112 
3113   /* "dipy/direction/probabilistic_direction_getter.pyx":67
3114  *                                        pmf_threshold, **kwargs)
3115  *         # The vertices need to be in a contiguous array
3116  *         self.vertices = self.sphere.vertices.copy()             # <<<<<<<<<<<<<<
3117  *         self._set_adjacency_matrix(sphere, self.cos_similarity)
3118  *
3119  */
3120   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.__pyx_base.sphere, __pyx_n_s_vertices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __pyx_L1_error)
3121   __Pyx_GOTREF(__pyx_t_3);
3122   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error)
3123   __Pyx_GOTREF(__pyx_t_2);
3124   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3125   __pyx_t_3 = NULL;
3126   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3127     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3128     if (likely(__pyx_t_3)) {
3129       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3130       __Pyx_INCREF(__pyx_t_3);
3131       __Pyx_INCREF(function);
3132       __Pyx_DECREF_SET(__pyx_t_2, function);
3133     }
3134   }
3135   __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
3136   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3137   if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __pyx_L1_error)
3138   __Pyx_GOTREF(__pyx_t_4);
3139   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3140   __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 67, __pyx_L1_error)
3141   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3142   __PYX_XDEC_MEMVIEW(&__pyx_v_self->vertices, 0);
3143   __pyx_v_self->vertices = __pyx_t_5;
3144   __pyx_t_5.memview = NULL;
3145   __pyx_t_5.data = NULL;
3146 
3147   /* "dipy/direction/probabilistic_direction_getter.pyx":68
3148  *         # The vertices need to be in a contiguous array
3149  *         self.vertices = self.sphere.vertices.copy()
3150  *         self._set_adjacency_matrix(sphere, self.cos_similarity)             # <<<<<<<<<<<<<<
3151  *
3152  *     def _set_adjacency_matrix(self, sphere, cos_similarity):
3153  */
3154   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_adjacency_matrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error)
3155   __Pyx_GOTREF(__pyx_t_2);
3156   __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.cos_similarity); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
3157   __Pyx_GOTREF(__pyx_t_3);
3158   __pyx_t_1 = NULL;
3159   __pyx_t_6 = 0;
3160   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3161     __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
3162     if (likely(__pyx_t_1)) {
3163       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3164       __Pyx_INCREF(__pyx_t_1);
3165       __Pyx_INCREF(function);
3166       __Pyx_DECREF_SET(__pyx_t_2, function);
3167       __pyx_t_6 = 1;
3168     }
3169   }
3170   #if CYTHON_FAST_PYCALL
3171   if (PyFunction_Check(__pyx_t_2)) {
3172     PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_sphere, __pyx_t_3};
3173     __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error)
3174     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3175     __Pyx_GOTREF(__pyx_t_4);
3176     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3177   } else
3178   #endif
3179   #if CYTHON_FAST_PYCCALL
3180   if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
3181     PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_sphere, __pyx_t_3};
3182     __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error)
3183     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
3184     __Pyx_GOTREF(__pyx_t_4);
3185     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3186   } else
3187   #endif
3188   {
3189     __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 68, __pyx_L1_error)
3190     __Pyx_GOTREF(__pyx_t_7);
3191     if (__pyx_t_1) {
3192       __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); __pyx_t_1 = NULL;
3193     }
3194     __Pyx_INCREF(__pyx_v_sphere);
3195     __Pyx_GIVEREF(__pyx_v_sphere);
3196     PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_sphere);
3197     __Pyx_GIVEREF(__pyx_t_3);
3198     PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3);
3199     __pyx_t_3 = 0;
3200     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error)
3201     __Pyx_GOTREF(__pyx_t_4);
3202     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3203   }
3204   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3205   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3206 
3207   /* "dipy/direction/probabilistic_direction_getter.pyx":35
3208  *         dict _adj_matrix
3209  *
3210  *     def __init__(self, pmf_gen, max_angle, sphere=None, pmf_threshold=0.1,             # <<<<<<<<<<<<<<
3211  *                  **kwargs):
3212  *         """Direction getter from a pmf generator.
3213  */
3214 
3215   /* function exit code */
3216   __pyx_r = 0;
3217   goto __pyx_L0;
3218   __pyx_L1_error:;
3219   __Pyx_XDECREF(__pyx_t_1);
3220   __Pyx_XDECREF(__pyx_t_2);
3221   __Pyx_XDECREF(__pyx_t_3);
3222   __Pyx_XDECREF(__pyx_t_4);
3223   __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
3224   __Pyx_XDECREF(__pyx_t_7);
3225   __Pyx_AddTraceback("dipy.direction.probabilistic_direction_getter.ProbabilisticDirectionGetter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3226   __pyx_r = -1;
3227   __pyx_L0:;
3228   __Pyx_RefNannyFinishContext();
3229   return __pyx_r;
3230 }
3231 
3232 /* "dipy/direction/probabilistic_direction_getter.pyx":70
3233  *         self._set_adjacency_matrix(sphere, self.cos_similarity)
3234  *
3235  *     def _set_adjacency_matrix(self, sphere, cos_similarity):             # <<<<<<<<<<<<<<
3236  *         """Creates a dictionary where each key is a direction from sphere and
3237  *         each value is a boolean array indicating which directions are less than
3238  */
3239 
3240 /* Python wrapper */
3241 static PyObject *__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_3_set_adjacency_matrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3242 static char __pyx_doc_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_2_set_adjacency_matrix[] = "Creates a dictionary where each key is a direction from sphere and\n        each value is a boolean array indicating which directions are less than\n        max_angle degrees from the key";
__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_3_set_adjacency_matrix(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3243 static PyObject *__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_3_set_adjacency_matrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3244   PyObject *__pyx_v_sphere = 0;
3245   PyObject *__pyx_v_cos_similarity = 0;
3246   int __pyx_lineno = 0;
3247   const char *__pyx_filename = NULL;
3248   int __pyx_clineno = 0;
3249   PyObject *__pyx_r = 0;
3250   __Pyx_RefNannyDeclarations
3251   __Pyx_RefNannySetupContext("_set_adjacency_matrix (wrapper)", 0);
3252   {
3253     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sphere,&__pyx_n_s_cos_similarity,0};
3254     PyObject* values[2] = {0,0};
3255     if (unlikely(__pyx_kwds)) {
3256       Py_ssize_t kw_args;
3257       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3258       switch (pos_args) {
3259         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3260         CYTHON_FALLTHROUGH;
3261         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3262         CYTHON_FALLTHROUGH;
3263         case  0: break;
3264         default: goto __pyx_L5_argtuple_error;
3265       }
3266       kw_args = PyDict_Size(__pyx_kwds);
3267       switch (pos_args) {
3268         case  0:
3269         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sphere)) != 0)) kw_args--;
3270         else goto __pyx_L5_argtuple_error;
3271         CYTHON_FALLTHROUGH;
3272         case  1:
3273         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cos_similarity)) != 0)) kw_args--;
3274         else {
3275           __Pyx_RaiseArgtupleInvalid("_set_adjacency_matrix", 1, 2, 2, 1); __PYX_ERR(0, 70, __pyx_L3_error)
3276         }
3277       }
3278       if (unlikely(kw_args > 0)) {
3279         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_set_adjacency_matrix") < 0)) __PYX_ERR(0, 70, __pyx_L3_error)
3280       }
3281     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3282       goto __pyx_L5_argtuple_error;
3283     } else {
3284       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3285       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3286     }
3287     __pyx_v_sphere = values[0];
3288     __pyx_v_cos_similarity = values[1];
3289   }
3290   goto __pyx_L4_argument_unpacking_done;
3291   __pyx_L5_argtuple_error:;
3292   __Pyx_RaiseArgtupleInvalid("_set_adjacency_matrix", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 70, __pyx_L3_error)
3293   __pyx_L3_error:;
3294   __Pyx_AddTraceback("dipy.direction.probabilistic_direction_getter.ProbabilisticDirectionGetter._set_adjacency_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
3295   __Pyx_RefNannyFinishContext();
3296   return NULL;
3297   __pyx_L4_argument_unpacking_done:;
3298   __pyx_r = __pyx_pf_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_2_set_adjacency_matrix(((struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *)__pyx_v_self), __pyx_v_sphere, __pyx_v_cos_similarity);
3299 
3300   /* function exit code */
3301   __Pyx_RefNannyFinishContext();
3302   return __pyx_r;
3303 }
3304 
__pyx_pf_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_2_set_adjacency_matrix(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter * __pyx_v_self,PyObject * __pyx_v_sphere,PyObject * __pyx_v_cos_similarity)3305 static PyObject *__pyx_pf_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_2_set_adjacency_matrix(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *__pyx_v_self, PyObject *__pyx_v_sphere, PyObject *__pyx_v_cos_similarity) {
3306   PyObject *__pyx_v_matrix = NULL;
3307   PyObject *__pyx_v_keys = NULL;
3308   PyObject *__pyx_v_adj_matrix = NULL;
3309   PyObject *__pyx_7genexpr__pyx_v_v = NULL;
3310   PyObject *__pyx_8genexpr1__pyx_v_v = NULL;
3311   PyObject *__pyx_r = NULL;
3312   __Pyx_RefNannyDeclarations
3313   PyObject *__pyx_t_1 = NULL;
3314   PyObject *__pyx_t_2 = NULL;
3315   PyObject *__pyx_t_3 = NULL;
3316   PyObject *__pyx_t_4 = NULL;
3317   PyObject *__pyx_t_5 = NULL;
3318   int __pyx_t_6;
3319   PyObject *__pyx_t_7 = NULL;
3320   Py_ssize_t __pyx_t_8;
3321   PyObject *(*__pyx_t_9)(PyObject *);
3322   int __pyx_lineno = 0;
3323   const char *__pyx_filename = NULL;
3324   int __pyx_clineno = 0;
3325   __Pyx_RefNannySetupContext("_set_adjacency_matrix", 0);
3326 
3327   /* "dipy/direction/probabilistic_direction_getter.pyx":74
3328  *         each value is a boolean array indicating which directions are less than
3329  *         max_angle degrees from the key"""
3330  *         matrix = np.dot(sphere.vertices, sphere.vertices.T)             # <<<<<<<<<<<<<<
3331  *         matrix = (abs(matrix) >= cos_similarity).astype('uint8')
3332  *         keys = [tuple(v) for v in sphere.vertices]
3333  */
3334   __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error)
3335   __Pyx_GOTREF(__pyx_t_2);
3336   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dot); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error)
3337   __Pyx_GOTREF(__pyx_t_3);
3338   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3339   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sphere, __pyx_n_s_vertices); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error)
3340   __Pyx_GOTREF(__pyx_t_2);
3341   __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_sphere, __pyx_n_s_vertices); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 74, __pyx_L1_error)
3342   __Pyx_GOTREF(__pyx_t_4);
3343   __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_T); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 74, __pyx_L1_error)
3344   __Pyx_GOTREF(__pyx_t_5);
3345   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3346   __pyx_t_4 = NULL;
3347   __pyx_t_6 = 0;
3348   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
3349     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
3350     if (likely(__pyx_t_4)) {
3351       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3352       __Pyx_INCREF(__pyx_t_4);
3353       __Pyx_INCREF(function);
3354       __Pyx_DECREF_SET(__pyx_t_3, function);
3355       __pyx_t_6 = 1;
3356     }
3357   }
3358   #if CYTHON_FAST_PYCALL
3359   if (PyFunction_Check(__pyx_t_3)) {
3360     PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, __pyx_t_5};
3361     __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error)
3362     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3363     __Pyx_GOTREF(__pyx_t_1);
3364     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3365     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3366   } else
3367   #endif
3368   #if CYTHON_FAST_PYCCALL
3369   if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
3370     PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, __pyx_t_5};
3371     __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error)
3372     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3373     __Pyx_GOTREF(__pyx_t_1);
3374     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3375     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3376   } else
3377   #endif
3378   {
3379     __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 74, __pyx_L1_error)
3380     __Pyx_GOTREF(__pyx_t_7);
3381     if (__pyx_t_4) {
3382       __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
3383     }
3384     __Pyx_GIVEREF(__pyx_t_2);
3385     PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_2);
3386     __Pyx_GIVEREF(__pyx_t_5);
3387     PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_5);
3388     __pyx_t_2 = 0;
3389     __pyx_t_5 = 0;
3390     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error)
3391     __Pyx_GOTREF(__pyx_t_1);
3392     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3393   }
3394   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3395   __pyx_v_matrix = __pyx_t_1;
3396   __pyx_t_1 = 0;
3397 
3398   /* "dipy/direction/probabilistic_direction_getter.pyx":75
3399  *         max_angle degrees from the key"""
3400  *         matrix = np.dot(sphere.vertices, sphere.vertices.T)
3401  *         matrix = (abs(matrix) >= cos_similarity).astype('uint8')             # <<<<<<<<<<<<<<
3402  *         keys = [tuple(v) for v in sphere.vertices]
3403  *         adj_matrix = dict(zip(keys, matrix))
3404  */
3405   __pyx_t_3 = __Pyx_PyNumber_Absolute(__pyx_v_matrix); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error)
3406   __Pyx_GOTREF(__pyx_t_3);
3407   __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_v_cos_similarity, Py_GE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 75, __pyx_L1_error)
3408   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3409   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_astype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error)
3410   __Pyx_GOTREF(__pyx_t_3);
3411   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3412   __pyx_t_7 = NULL;
3413   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
3414     __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
3415     if (likely(__pyx_t_7)) {
3416       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3417       __Pyx_INCREF(__pyx_t_7);
3418       __Pyx_INCREF(function);
3419       __Pyx_DECREF_SET(__pyx_t_3, function);
3420     }
3421   }
3422   __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_7, __pyx_n_u_uint8) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_uint8);
3423   __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
3424   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
3425   __Pyx_GOTREF(__pyx_t_1);
3426   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3427   __Pyx_DECREF_SET(__pyx_v_matrix, __pyx_t_1);
3428   __pyx_t_1 = 0;
3429 
3430   /* "dipy/direction/probabilistic_direction_getter.pyx":76
3431  *         matrix = np.dot(sphere.vertices, sphere.vertices.T)
3432  *         matrix = (abs(matrix) >= cos_similarity).astype('uint8')
3433  *         keys = [tuple(v) for v in sphere.vertices]             # <<<<<<<<<<<<<<
3434  *         adj_matrix = dict(zip(keys, matrix))
3435  *         keys = [tuple(-v) for v in sphere.vertices]
3436  */
3437   { /* enter inner scope */
3438     __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L5_error)
3439     __Pyx_GOTREF(__pyx_t_1);
3440     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sphere, __pyx_n_s_vertices); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L5_error)
3441     __Pyx_GOTREF(__pyx_t_3);
3442     if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
3443       __pyx_t_7 = __pyx_t_3; __Pyx_INCREF(__pyx_t_7); __pyx_t_8 = 0;
3444       __pyx_t_9 = NULL;
3445     } else {
3446       __pyx_t_8 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 76, __pyx_L5_error)
3447       __Pyx_GOTREF(__pyx_t_7);
3448       __pyx_t_9 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 76, __pyx_L5_error)
3449     }
3450     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3451     for (;;) {
3452       if (likely(!__pyx_t_9)) {
3453         if (likely(PyList_CheckExact(__pyx_t_7))) {
3454           if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_7)) break;
3455           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3456           __pyx_t_3 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 76, __pyx_L5_error)
3457           #else
3458           __pyx_t_3 = PySequence_ITEM(__pyx_t_7, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L5_error)
3459           __Pyx_GOTREF(__pyx_t_3);
3460           #endif
3461         } else {
3462           if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
3463           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3464           __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 76, __pyx_L5_error)
3465           #else
3466           __pyx_t_3 = PySequence_ITEM(__pyx_t_7, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L5_error)
3467           __Pyx_GOTREF(__pyx_t_3);
3468           #endif
3469         }
3470       } else {
3471         __pyx_t_3 = __pyx_t_9(__pyx_t_7);
3472         if (unlikely(!__pyx_t_3)) {
3473           PyObject* exc_type = PyErr_Occurred();
3474           if (exc_type) {
3475             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3476             else __PYX_ERR(0, 76, __pyx_L5_error)
3477           }
3478           break;
3479         }
3480         __Pyx_GOTREF(__pyx_t_3);
3481       }
3482       __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_v, __pyx_t_3);
3483       __pyx_t_3 = 0;
3484       __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_7genexpr__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L5_error)
3485       __Pyx_GOTREF(__pyx_t_3);
3486       if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 76, __pyx_L5_error)
3487       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3488     }
3489     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3490     __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); __pyx_7genexpr__pyx_v_v = 0;
3491     goto __pyx_L8_exit_scope;
3492     __pyx_L5_error:;
3493     __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); __pyx_7genexpr__pyx_v_v = 0;
3494     goto __pyx_L1_error;
3495     __pyx_L8_exit_scope:;
3496   } /* exit inner scope */
3497   __pyx_v_keys = ((PyObject*)__pyx_t_1);
3498   __pyx_t_1 = 0;
3499 
3500   /* "dipy/direction/probabilistic_direction_getter.pyx":77
3501  *         matrix = (abs(matrix) >= cos_similarity).astype('uint8')
3502  *         keys = [tuple(v) for v in sphere.vertices]
3503  *         adj_matrix = dict(zip(keys, matrix))             # <<<<<<<<<<<<<<
3504  *         keys = [tuple(-v) for v in sphere.vertices]
3505  *         adj_matrix.update(zip(keys, matrix))
3506  */
3507   __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error)
3508   __Pyx_GOTREF(__pyx_t_1);
3509   __Pyx_INCREF(__pyx_v_keys);
3510   __Pyx_GIVEREF(__pyx_v_keys);
3511   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_keys);
3512   __Pyx_INCREF(__pyx_v_matrix);
3513   __Pyx_GIVEREF(__pyx_v_matrix);
3514   PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_matrix);
3515   __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 77, __pyx_L1_error)
3516   __Pyx_GOTREF(__pyx_t_7);
3517   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3518   __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyDict_Type)), __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error)
3519   __Pyx_GOTREF(__pyx_t_1);
3520   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3521   __pyx_v_adj_matrix = ((PyObject*)__pyx_t_1);
3522   __pyx_t_1 = 0;
3523 
3524   /* "dipy/direction/probabilistic_direction_getter.pyx":78
3525  *         keys = [tuple(v) for v in sphere.vertices]
3526  *         adj_matrix = dict(zip(keys, matrix))
3527  *         keys = [tuple(-v) for v in sphere.vertices]             # <<<<<<<<<<<<<<
3528  *         adj_matrix.update(zip(keys, matrix))
3529  *         self._adj_matrix = adj_matrix
3530  */
3531   { /* enter inner scope */
3532     __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L11_error)
3533     __Pyx_GOTREF(__pyx_t_1);
3534     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_sphere, __pyx_n_s_vertices); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 78, __pyx_L11_error)
3535     __Pyx_GOTREF(__pyx_t_7);
3536     if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) {
3537       __pyx_t_3 = __pyx_t_7; __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = 0;
3538       __pyx_t_9 = NULL;
3539     } else {
3540       __pyx_t_8 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L11_error)
3541       __Pyx_GOTREF(__pyx_t_3);
3542       __pyx_t_9 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 78, __pyx_L11_error)
3543     }
3544     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3545     for (;;) {
3546       if (likely(!__pyx_t_9)) {
3547         if (likely(PyList_CheckExact(__pyx_t_3))) {
3548           if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_3)) break;
3549           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3550           __pyx_t_7 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 78, __pyx_L11_error)
3551           #else
3552           __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 78, __pyx_L11_error)
3553           __Pyx_GOTREF(__pyx_t_7);
3554           #endif
3555         } else {
3556           if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
3557           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3558           __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 78, __pyx_L11_error)
3559           #else
3560           __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 78, __pyx_L11_error)
3561           __Pyx_GOTREF(__pyx_t_7);
3562           #endif
3563         }
3564       } else {
3565         __pyx_t_7 = __pyx_t_9(__pyx_t_3);
3566         if (unlikely(!__pyx_t_7)) {
3567           PyObject* exc_type = PyErr_Occurred();
3568           if (exc_type) {
3569             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3570             else __PYX_ERR(0, 78, __pyx_L11_error)
3571           }
3572           break;
3573         }
3574         __Pyx_GOTREF(__pyx_t_7);
3575       }
3576       __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_v, __pyx_t_7);
3577       __pyx_t_7 = 0;
3578       __pyx_t_7 = PyNumber_Negative(__pyx_8genexpr1__pyx_v_v); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 78, __pyx_L11_error)
3579       __Pyx_GOTREF(__pyx_t_7);
3580       __pyx_t_5 = __Pyx_PySequence_Tuple(__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L11_error)
3581       __Pyx_GOTREF(__pyx_t_5);
3582       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3583       if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 78, __pyx_L11_error)
3584       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3585     }
3586     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3587     __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_v); __pyx_8genexpr1__pyx_v_v = 0;
3588     goto __pyx_L14_exit_scope;
3589     __pyx_L11_error:;
3590     __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_v); __pyx_8genexpr1__pyx_v_v = 0;
3591     goto __pyx_L1_error;
3592     __pyx_L14_exit_scope:;
3593   } /* exit inner scope */
3594   __Pyx_DECREF_SET(__pyx_v_keys, ((PyObject*)__pyx_t_1));
3595   __pyx_t_1 = 0;
3596 
3597   /* "dipy/direction/probabilistic_direction_getter.pyx":79
3598  *         adj_matrix = dict(zip(keys, matrix))
3599  *         keys = [tuple(-v) for v in sphere.vertices]
3600  *         adj_matrix.update(zip(keys, matrix))             # <<<<<<<<<<<<<<
3601  *         self._adj_matrix = adj_matrix
3602  *
3603  */
3604   __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error)
3605   __Pyx_GOTREF(__pyx_t_1);
3606   __Pyx_INCREF(__pyx_v_keys);
3607   __Pyx_GIVEREF(__pyx_v_keys);
3608   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_keys);
3609   __Pyx_INCREF(__pyx_v_matrix);
3610   __Pyx_GIVEREF(__pyx_v_matrix);
3611   PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_matrix);
3612   __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error)
3613   __Pyx_GOTREF(__pyx_t_3);
3614   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3615   __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_update, __pyx_v_adj_matrix, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error)
3616   __Pyx_GOTREF(__pyx_t_1);
3617   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3618   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3619 
3620   /* "dipy/direction/probabilistic_direction_getter.pyx":80
3621  *         keys = [tuple(-v) for v in sphere.vertices]
3622  *         adj_matrix.update(zip(keys, matrix))
3623  *         self._adj_matrix = adj_matrix             # <<<<<<<<<<<<<<
3624  *
3625  *     cdef int get_direction_c(self, double* point, double* direction):
3626  */
3627   __Pyx_INCREF(__pyx_v_adj_matrix);
3628   __Pyx_GIVEREF(__pyx_v_adj_matrix);
3629   __Pyx_GOTREF(__pyx_v_self->_adj_matrix);
3630   __Pyx_DECREF(__pyx_v_self->_adj_matrix);
3631   __pyx_v_self->_adj_matrix = __pyx_v_adj_matrix;
3632 
3633   /* "dipy/direction/probabilistic_direction_getter.pyx":70
3634  *         self._set_adjacency_matrix(sphere, self.cos_similarity)
3635  *
3636  *     def _set_adjacency_matrix(self, sphere, cos_similarity):             # <<<<<<<<<<<<<<
3637  *         """Creates a dictionary where each key is a direction from sphere and
3638  *         each value is a boolean array indicating which directions are less than
3639  */
3640 
3641   /* function exit code */
3642   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3643   goto __pyx_L0;
3644   __pyx_L1_error:;
3645   __Pyx_XDECREF(__pyx_t_1);
3646   __Pyx_XDECREF(__pyx_t_2);
3647   __Pyx_XDECREF(__pyx_t_3);
3648   __Pyx_XDECREF(__pyx_t_4);
3649   __Pyx_XDECREF(__pyx_t_5);
3650   __Pyx_XDECREF(__pyx_t_7);
3651   __Pyx_AddTraceback("dipy.direction.probabilistic_direction_getter.ProbabilisticDirectionGetter._set_adjacency_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
3652   __pyx_r = NULL;
3653   __pyx_L0:;
3654   __Pyx_XDECREF(__pyx_v_matrix);
3655   __Pyx_XDECREF(__pyx_v_keys);
3656   __Pyx_XDECREF(__pyx_v_adj_matrix);
3657   __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v);
3658   __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_v);
3659   __Pyx_XGIVEREF(__pyx_r);
3660   __Pyx_RefNannyFinishContext();
3661   return __pyx_r;
3662 }
3663 
3664 /* "dipy/direction/probabilistic_direction_getter.pyx":82
3665  *         self._adj_matrix = adj_matrix
3666  *
3667  *     cdef int get_direction_c(self, double* point, double* direction):             # <<<<<<<<<<<<<<
3668  *         """Samples a pmf to updates ``direction`` array with a new direction.
3669  *
3670  */
3671 
__pyx_f_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_get_direction_c(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter * __pyx_v_self,double * __pyx_v_point,double * __pyx_v_direction)3672 static int __pyx_f_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_get_direction_c(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *__pyx_v_self, double *__pyx_v_point, double *__pyx_v_direction) {
3673   npy_intp __pyx_v_i;
3674   npy_intp __pyx_v_idx;
3675   npy_intp __pyx_v__len;
3676   __Pyx_memviewslice __pyx_v_newdir = { 0, 0, { 0 }, { 0 }, { 0 } };
3677   __Pyx_memviewslice __pyx_v_pmf = { 0, 0, { 0 }, { 0 }, { 0 } };
3678   double __pyx_v_last_cdf;
3679   double __pyx_v_random_sample;
3680   __Pyx_memviewslice __pyx_v_bool_array = { 0, 0, { 0 }, { 0 }, { 0 } };
3681   int __pyx_r;
3682   __Pyx_RefNannyDeclarations
3683   PyObject *__pyx_t_1 = NULL;
3684   __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
3685   PyObject *__pyx_t_3 = NULL;
3686   PyObject *__pyx_t_4 = NULL;
3687   PyObject *__pyx_t_5 = NULL;
3688   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
3689   npy_intp __pyx_t_7;
3690   npy_intp __pyx_t_8;
3691   npy_intp __pyx_t_9;
3692   Py_ssize_t __pyx_t_10;
3693   int __pyx_t_11;
3694   Py_ssize_t __pyx_t_12;
3695   double __pyx_t_13;
3696   Py_ssize_t __pyx_t_14;
3697   int __pyx_lineno = 0;
3698   const char *__pyx_filename = NULL;
3699   int __pyx_clineno = 0;
3700   __Pyx_RefNannySetupContext("get_direction_c", 0);
3701 
3702   /* "dipy/direction/probabilistic_direction_getter.pyx":105
3703  *             cnp.uint8_t[:] bool_array
3704  *
3705  *         pmf = self._get_pmf(point)             # <<<<<<<<<<<<<<
3706  *         _len = pmf.shape[0]
3707  *
3708  */
3709   __pyx_t_1 = ((struct __pyx_vtabstruct_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base._get_pmf(((struct __pyx_obj_4dipy_9direction_29closest_peak_direction_getter_BasePmfDirectionGetter *)__pyx_v_self), __pyx_v_point); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error)
3710   __Pyx_GOTREF(__pyx_t_1);
3711   __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 105, __pyx_L1_error)
3712   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3713   __pyx_v_pmf = __pyx_t_2;
3714   __pyx_t_2.memview = NULL;
3715   __pyx_t_2.data = NULL;
3716 
3717   /* "dipy/direction/probabilistic_direction_getter.pyx":106
3718  *
3719  *         pmf = self._get_pmf(point)
3720  *         _len = pmf.shape[0]             # <<<<<<<<<<<<<<
3721  *
3722  *         bool_array = self._adj_matrix[
3723  */
3724   __pyx_v__len = (__pyx_v_pmf.shape[0]);
3725 
3726   /* "dipy/direction/probabilistic_direction_getter.pyx":108
3727  *         _len = pmf.shape[0]
3728  *
3729  *         bool_array = self._adj_matrix[             # <<<<<<<<<<<<<<
3730  *             (direction[0], direction[1], direction[2])]
3731  *
3732  */
3733   if (unlikely(__pyx_v_self->_adj_matrix == Py_None)) {
3734     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3735     __PYX_ERR(0, 108, __pyx_L1_error)
3736   }
3737 
3738   /* "dipy/direction/probabilistic_direction_getter.pyx":109
3739  *
3740  *         bool_array = self._adj_matrix[
3741  *             (direction[0], direction[1], direction[2])]             # <<<<<<<<<<<<<<
3742  *
3743  *         for i in range(_len):
3744  */
3745   __pyx_t_1 = PyFloat_FromDouble((__pyx_v_direction[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error)
3746   __Pyx_GOTREF(__pyx_t_1);
3747   __pyx_t_3 = PyFloat_FromDouble((__pyx_v_direction[1])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 109, __pyx_L1_error)
3748   __Pyx_GOTREF(__pyx_t_3);
3749   __pyx_t_4 = PyFloat_FromDouble((__pyx_v_direction[2])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 109, __pyx_L1_error)
3750   __Pyx_GOTREF(__pyx_t_4);
3751   __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 109, __pyx_L1_error)
3752   __Pyx_GOTREF(__pyx_t_5);
3753   __Pyx_GIVEREF(__pyx_t_1);
3754   PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
3755   __Pyx_GIVEREF(__pyx_t_3);
3756   PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
3757   __Pyx_GIVEREF(__pyx_t_4);
3758   PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
3759   __pyx_t_1 = 0;
3760   __pyx_t_3 = 0;
3761   __pyx_t_4 = 0;
3762 
3763   /* "dipy/direction/probabilistic_direction_getter.pyx":108
3764  *         _len = pmf.shape[0]
3765  *
3766  *         bool_array = self._adj_matrix[             # <<<<<<<<<<<<<<
3767  *             (direction[0], direction[1], direction[2])]
3768  *
3769  */
3770   __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_self->_adj_matrix, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 108, __pyx_L1_error)
3771   __Pyx_GOTREF(__pyx_t_4);
3772   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3773   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_uint8_t(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 108, __pyx_L1_error)
3774   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3775   __pyx_v_bool_array = __pyx_t_6;
3776   __pyx_t_6.memview = NULL;
3777   __pyx_t_6.data = NULL;
3778 
3779   /* "dipy/direction/probabilistic_direction_getter.pyx":111
3780  *             (direction[0], direction[1], direction[2])]
3781  *
3782  *         for i in range(_len):             # <<<<<<<<<<<<<<
3783  *             if bool_array[i] == 0:
3784  *                 pmf[i] = 0.0
3785  */
3786   __pyx_t_7 = __pyx_v__len;
3787   __pyx_t_8 = __pyx_t_7;
3788   for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
3789     __pyx_v_i = __pyx_t_9;
3790 
3791     /* "dipy/direction/probabilistic_direction_getter.pyx":112
3792  *
3793  *         for i in range(_len):
3794  *             if bool_array[i] == 0:             # <<<<<<<<<<<<<<
3795  *                 pmf[i] = 0.0
3796  *         cumsum(&pmf[0], &pmf[0], _len)
3797  */
3798     __pyx_t_10 = __pyx_v_i;
3799     __pyx_t_11 = (((*((__pyx_t_5numpy_uint8_t *) ( /* dim=0 */ (__pyx_v_bool_array.data + __pyx_t_10 * __pyx_v_bool_array.strides[0]) ))) == 0) != 0);
3800     if (__pyx_t_11) {
3801 
3802       /* "dipy/direction/probabilistic_direction_getter.pyx":113
3803  *         for i in range(_len):
3804  *             if bool_array[i] == 0:
3805  *                 pmf[i] = 0.0             # <<<<<<<<<<<<<<
3806  *         cumsum(&pmf[0], &pmf[0], _len)
3807  *         last_cdf = pmf[_len - 1]
3808  */
3809       __pyx_t_10 = __pyx_v_i;
3810       *((double *) ( /* dim=0 */ (__pyx_v_pmf.data + __pyx_t_10 * __pyx_v_pmf.strides[0]) )) = 0.0;
3811 
3812       /* "dipy/direction/probabilistic_direction_getter.pyx":112
3813  *
3814  *         for i in range(_len):
3815  *             if bool_array[i] == 0:             # <<<<<<<<<<<<<<
3816  *                 pmf[i] = 0.0
3817  *         cumsum(&pmf[0], &pmf[0], _len)
3818  */
3819     }
3820   }
3821 
3822   /* "dipy/direction/probabilistic_direction_getter.pyx":114
3823  *             if bool_array[i] == 0:
3824  *                 pmf[i] = 0.0
3825  *         cumsum(&pmf[0], &pmf[0], _len)             # <<<<<<<<<<<<<<
3826  *         last_cdf = pmf[_len - 1]
3827  *
3828  */
3829   __pyx_t_10 = 0;
3830   __pyx_t_12 = 0;
3831   __pyx_f_4dipy_5utils_10fast_numpy_cumsum((&(*((double *) ( /* dim=0 */ (__pyx_v_pmf.data + __pyx_t_10 * __pyx_v_pmf.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_pmf.data + __pyx_t_12 * __pyx_v_pmf.strides[0]) )))), __pyx_v__len);
3832 
3833   /* "dipy/direction/probabilistic_direction_getter.pyx":115
3834  *                 pmf[i] = 0.0
3835  *         cumsum(&pmf[0], &pmf[0], _len)
3836  *         last_cdf = pmf[_len - 1]             # <<<<<<<<<<<<<<
3837  *
3838  *         if last_cdf == 0:
3839  */
3840   __pyx_t_12 = (__pyx_v__len - 1);
3841   __pyx_v_last_cdf = (*((double *) ( /* dim=0 */ (__pyx_v_pmf.data + __pyx_t_12 * __pyx_v_pmf.strides[0]) )));
3842 
3843   /* "dipy/direction/probabilistic_direction_getter.pyx":117
3844  *         last_cdf = pmf[_len - 1]
3845  *
3846  *         if last_cdf == 0:             # <<<<<<<<<<<<<<
3847  *             return 1
3848  *
3849  */
3850   __pyx_t_11 = ((__pyx_v_last_cdf == 0.0) != 0);
3851   if (__pyx_t_11) {
3852 
3853     /* "dipy/direction/probabilistic_direction_getter.pyx":118
3854  *
3855  *         if last_cdf == 0:
3856  *             return 1             # <<<<<<<<<<<<<<
3857  *
3858  *         random_sample = random() * last_cdf
3859  */
3860     __pyx_r = 1;
3861     goto __pyx_L0;
3862 
3863     /* "dipy/direction/probabilistic_direction_getter.pyx":117
3864  *         last_cdf = pmf[_len - 1]
3865  *
3866  *         if last_cdf == 0:             # <<<<<<<<<<<<<<
3867  *             return 1
3868  *
3869  */
3870   }
3871 
3872   /* "dipy/direction/probabilistic_direction_getter.pyx":120
3873  *             return 1
3874  *
3875  *         random_sample = random() * last_cdf             # <<<<<<<<<<<<<<
3876  *         idx = where_to_insert(&pmf[0], random_sample, _len)
3877  *
3878  */
3879   __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_random); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 120, __pyx_L1_error)
3880   __Pyx_GOTREF(__pyx_t_5);
3881   __pyx_t_3 = NULL;
3882   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
3883     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
3884     if (likely(__pyx_t_3)) {
3885       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
3886       __Pyx_INCREF(__pyx_t_3);
3887       __Pyx_INCREF(function);
3888       __Pyx_DECREF_SET(__pyx_t_5, function);
3889     }
3890   }
3891   __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
3892   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3893   if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 120, __pyx_L1_error)
3894   __Pyx_GOTREF(__pyx_t_4);
3895   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3896   __pyx_t_5 = PyFloat_FromDouble(__pyx_v_last_cdf); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 120, __pyx_L1_error)
3897   __Pyx_GOTREF(__pyx_t_5);
3898   __pyx_t_3 = PyNumber_Multiply(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error)
3899   __Pyx_GOTREF(__pyx_t_3);
3900   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3901   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3902   __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L1_error)
3903   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3904   __pyx_v_random_sample = __pyx_t_13;
3905 
3906   /* "dipy/direction/probabilistic_direction_getter.pyx":121
3907  *
3908  *         random_sample = random() * last_cdf
3909  *         idx = where_to_insert(&pmf[0], random_sample, _len)             # <<<<<<<<<<<<<<
3910  *
3911  *         newdir = self.vertices[idx, :]
3912  */
3913   __pyx_t_12 = 0;
3914   __pyx_v_idx = __pyx_f_4dipy_5utils_10fast_numpy_where_to_insert((&(*((double *) ( /* dim=0 */ (__pyx_v_pmf.data + __pyx_t_12 * __pyx_v_pmf.strides[0]) )))), __pyx_v_random_sample, __pyx_v__len);
3915 
3916   /* "dipy/direction/probabilistic_direction_getter.pyx":123
3917  *         idx = where_to_insert(&pmf[0], random_sample, _len)
3918  *
3919  *         newdir = self.vertices[idx, :]             # <<<<<<<<<<<<<<
3920  *         # Update direction and return 0 for error
3921  *         if direction[0] * newdir[0] \
3922  */
3923   __pyx_t_2.data = __pyx_v_self->vertices.data;
3924   __pyx_t_2.memview = __pyx_v_self->vertices.memview;
3925   __PYX_INC_MEMVIEW(&__pyx_t_2, 0);
3926   {
3927     Py_ssize_t __pyx_tmp_idx = __pyx_v_idx;
3928     Py_ssize_t __pyx_tmp_stride = __pyx_v_self->vertices.strides[0];
3929         __pyx_t_2.data += __pyx_tmp_idx * __pyx_tmp_stride;
3930 }
3931 
3932 __pyx_t_2.shape[0] = __pyx_v_self->vertices.shape[1];
3933 __pyx_t_2.strides[0] = __pyx_v_self->vertices.strides[1];
3934     __pyx_t_2.suboffsets[0] = -1;
3935 
3936 __pyx_v_newdir = __pyx_t_2;
3937   __pyx_t_2.memview = NULL;
3938   __pyx_t_2.data = NULL;
3939 
3940   /* "dipy/direction/probabilistic_direction_getter.pyx":125
3941  *         newdir = self.vertices[idx, :]
3942  *         # Update direction and return 0 for error
3943  *         if direction[0] * newdir[0] \             # <<<<<<<<<<<<<<
3944  *          + direction[1] * newdir[1] \
3945  *          + direction[2] * newdir[2] > 0:
3946  */
3947   __pyx_t_12 = 0;
3948 
3949   /* "dipy/direction/probabilistic_direction_getter.pyx":126
3950  *         # Update direction and return 0 for error
3951  *         if direction[0] * newdir[0] \
3952  *          + direction[1] * newdir[1] \             # <<<<<<<<<<<<<<
3953  *          + direction[2] * newdir[2] > 0:
3954  *
3955  */
3956   __pyx_t_10 = 1;
3957 
3958   /* "dipy/direction/probabilistic_direction_getter.pyx":127
3959  *         if direction[0] * newdir[0] \
3960  *          + direction[1] * newdir[1] \
3961  *          + direction[2] * newdir[2] > 0:             # <<<<<<<<<<<<<<
3962  *
3963  *             direction[0] = newdir[0]
3964  */
3965   __pyx_t_14 = 2;
3966   __pyx_t_11 = ((((((__pyx_v_direction[0]) * (*((double *) ( /* dim=0 */ (__pyx_v_newdir.data + __pyx_t_12 * __pyx_v_newdir.strides[0]) )))) + ((__pyx_v_direction[1]) * (*((double *) ( /* dim=0 */ (__pyx_v_newdir.data + __pyx_t_10 * __pyx_v_newdir.strides[0]) ))))) + ((__pyx_v_direction[2]) * (*((double *) ( /* dim=0 */ (__pyx_v_newdir.data + __pyx_t_14 * __pyx_v_newdir.strides[0]) ))))) > 0.0) != 0);
3967 
3968   /* "dipy/direction/probabilistic_direction_getter.pyx":125
3969  *         newdir = self.vertices[idx, :]
3970  *         # Update direction and return 0 for error
3971  *         if direction[0] * newdir[0] \             # <<<<<<<<<<<<<<
3972  *          + direction[1] * newdir[1] \
3973  *          + direction[2] * newdir[2] > 0:
3974  */
3975   if (__pyx_t_11) {
3976 
3977     /* "dipy/direction/probabilistic_direction_getter.pyx":129
3978  *          + direction[2] * newdir[2] > 0:
3979  *
3980  *             direction[0] = newdir[0]             # <<<<<<<<<<<<<<
3981  *             direction[1] = newdir[1]
3982  *             direction[2] = newdir[2]
3983  */
3984     __pyx_t_14 = 0;
3985     (__pyx_v_direction[0]) = (*((double *) ( /* dim=0 */ (__pyx_v_newdir.data + __pyx_t_14 * __pyx_v_newdir.strides[0]) )));
3986 
3987     /* "dipy/direction/probabilistic_direction_getter.pyx":130
3988  *
3989  *             direction[0] = newdir[0]
3990  *             direction[1] = newdir[1]             # <<<<<<<<<<<<<<
3991  *             direction[2] = newdir[2]
3992  *         else:
3993  */
3994     __pyx_t_14 = 1;
3995     (__pyx_v_direction[1]) = (*((double *) ( /* dim=0 */ (__pyx_v_newdir.data + __pyx_t_14 * __pyx_v_newdir.strides[0]) )));
3996 
3997     /* "dipy/direction/probabilistic_direction_getter.pyx":131
3998  *             direction[0] = newdir[0]
3999  *             direction[1] = newdir[1]
4000  *             direction[2] = newdir[2]             # <<<<<<<<<<<<<<
4001  *         else:
4002  *             direction[0] = -newdir[0]
4003  */
4004     __pyx_t_14 = 2;
4005     (__pyx_v_direction[2]) = (*((double *) ( /* dim=0 */ (__pyx_v_newdir.data + __pyx_t_14 * __pyx_v_newdir.strides[0]) )));
4006 
4007     /* "dipy/direction/probabilistic_direction_getter.pyx":125
4008  *         newdir = self.vertices[idx, :]
4009  *         # Update direction and return 0 for error
4010  *         if direction[0] * newdir[0] \             # <<<<<<<<<<<<<<
4011  *          + direction[1] * newdir[1] \
4012  *          + direction[2] * newdir[2] > 0:
4013  */
4014     goto __pyx_L7;
4015   }
4016 
4017   /* "dipy/direction/probabilistic_direction_getter.pyx":133
4018  *             direction[2] = newdir[2]
4019  *         else:
4020  *             direction[0] = -newdir[0]             # <<<<<<<<<<<<<<
4021  *             direction[1] = -newdir[1]
4022  *             direction[2] = -newdir[2]
4023  */
4024   /*else*/ {
4025     __pyx_t_14 = 0;
4026     (__pyx_v_direction[0]) = (-(*((double *) ( /* dim=0 */ (__pyx_v_newdir.data + __pyx_t_14 * __pyx_v_newdir.strides[0]) ))));
4027 
4028     /* "dipy/direction/probabilistic_direction_getter.pyx":134
4029  *         else:
4030  *             direction[0] = -newdir[0]
4031  *             direction[1] = -newdir[1]             # <<<<<<<<<<<<<<
4032  *             direction[2] = -newdir[2]
4033  *         return 0
4034  */
4035     __pyx_t_14 = 1;
4036     (__pyx_v_direction[1]) = (-(*((double *) ( /* dim=0 */ (__pyx_v_newdir.data + __pyx_t_14 * __pyx_v_newdir.strides[0]) ))));
4037 
4038     /* "dipy/direction/probabilistic_direction_getter.pyx":135
4039  *             direction[0] = -newdir[0]
4040  *             direction[1] = -newdir[1]
4041  *             direction[2] = -newdir[2]             # <<<<<<<<<<<<<<
4042  *         return 0
4043  *
4044  */
4045     __pyx_t_14 = 2;
4046     (__pyx_v_direction[2]) = (-(*((double *) ( /* dim=0 */ (__pyx_v_newdir.data + __pyx_t_14 * __pyx_v_newdir.strides[0]) ))));
4047   }
4048   __pyx_L7:;
4049 
4050   /* "dipy/direction/probabilistic_direction_getter.pyx":136
4051  *             direction[1] = -newdir[1]
4052  *             direction[2] = -newdir[2]
4053  *         return 0             # <<<<<<<<<<<<<<
4054  *
4055  *
4056  */
4057   __pyx_r = 0;
4058   goto __pyx_L0;
4059 
4060   /* "dipy/direction/probabilistic_direction_getter.pyx":82
4061  *         self._adj_matrix = adj_matrix
4062  *
4063  *     cdef int get_direction_c(self, double* point, double* direction):             # <<<<<<<<<<<<<<
4064  *         """Samples a pmf to updates ``direction`` array with a new direction.
4065  *
4066  */
4067 
4068   /* function exit code */
4069   __pyx_L1_error:;
4070   __Pyx_XDECREF(__pyx_t_1);
4071   __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
4072   __Pyx_XDECREF(__pyx_t_3);
4073   __Pyx_XDECREF(__pyx_t_4);
4074   __Pyx_XDECREF(__pyx_t_5);
4075   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
4076   __Pyx_WriteUnraisable("dipy.direction.probabilistic_direction_getter.ProbabilisticDirectionGetter.get_direction_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
4077   __pyx_r = 0;
4078   __pyx_L0:;
4079   __PYX_XDEC_MEMVIEW(&__pyx_v_newdir, 1);
4080   __PYX_XDEC_MEMVIEW(&__pyx_v_pmf, 1);
4081   __PYX_XDEC_MEMVIEW(&__pyx_v_bool_array, 1);
4082   __Pyx_RefNannyFinishContext();
4083   return __pyx_r;
4084 }
4085 
4086 /* "(tree fragment)":1
4087  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
4088  *     cdef tuple state
4089  *     cdef object _dict
4090  */
4091 
4092 /* Python wrapper */
4093 static PyObject *__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_5__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)4094 static PyObject *__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4095   PyObject *__pyx_r = 0;
4096   __Pyx_RefNannyDeclarations
4097   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
4098   __pyx_r = __pyx_pf_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_4__reduce_cython__(((struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *)__pyx_v_self));
4099 
4100   /* function exit code */
4101   __Pyx_RefNannyFinishContext();
4102   return __pyx_r;
4103 }
4104 
__pyx_pf_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_4__reduce_cython__(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter * __pyx_v_self)4105 static PyObject *__pyx_pf_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_4__reduce_cython__(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *__pyx_v_self) {
4106   PyObject *__pyx_v_state = 0;
4107   PyObject *__pyx_v__dict = 0;
4108   int __pyx_v_use_setstate;
4109   PyObject *__pyx_r = NULL;
4110   __Pyx_RefNannyDeclarations
4111   PyObject *__pyx_t_1 = NULL;
4112   PyObject *__pyx_t_2 = NULL;
4113   PyObject *__pyx_t_3 = NULL;
4114   PyObject *__pyx_t_4 = NULL;
4115   int __pyx_t_5;
4116   int __pyx_t_6;
4117   int __pyx_t_7;
4118   int __pyx_lineno = 0;
4119   const char *__pyx_filename = NULL;
4120   int __pyx_clineno = 0;
4121   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
4122 
4123   /* "(tree fragment)":5
4124  *     cdef object _dict
4125  *     cdef bint use_setstate
4126  *     state = (self._adj_matrix, self._pf_kwargs, self.cos_similarity, self.pmf_gen, self.pmf_threshold, self.sphere, self.vertices)             # <<<<<<<<<<<<<<
4127  *     _dict = getattr(self, '__dict__', None)
4128  *     if _dict is not None:
4129  */
4130   __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.cos_similarity); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
4131   __Pyx_GOTREF(__pyx_t_1);
4132   __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.pmf_threshold); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
4133   __Pyx_GOTREF(__pyx_t_2);
4134   __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_self->vertices, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
4135   __Pyx_GOTREF(__pyx_t_3);
4136   __pyx_t_4 = PyTuple_New(7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
4137   __Pyx_GOTREF(__pyx_t_4);
4138   __Pyx_INCREF(__pyx_v_self->_adj_matrix);
4139   __Pyx_GIVEREF(__pyx_v_self->_adj_matrix);
4140   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self->_adj_matrix);
4141   __Pyx_INCREF(__pyx_v_self->__pyx_base.__pyx_base._pf_kwargs);
4142   __Pyx_GIVEREF(__pyx_v_self->__pyx_base.__pyx_base._pf_kwargs);
4143   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self->__pyx_base.__pyx_base._pf_kwargs);
4144   __Pyx_GIVEREF(__pyx_t_1);
4145   PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1);
4146   __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.pmf_gen));
4147   __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.pmf_gen));
4148   PyTuple_SET_ITEM(__pyx_t_4, 3, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.pmf_gen));
4149   __Pyx_GIVEREF(__pyx_t_2);
4150   PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_2);
4151   __Pyx_INCREF(__pyx_v_self->__pyx_base.__pyx_base.sphere);
4152   __Pyx_GIVEREF(__pyx_v_self->__pyx_base.__pyx_base.sphere);
4153   PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_v_self->__pyx_base.__pyx_base.sphere);
4154   __Pyx_GIVEREF(__pyx_t_3);
4155   PyTuple_SET_ITEM(__pyx_t_4, 6, __pyx_t_3);
4156   __pyx_t_1 = 0;
4157   __pyx_t_2 = 0;
4158   __pyx_t_3 = 0;
4159   __pyx_v_state = ((PyObject*)__pyx_t_4);
4160   __pyx_t_4 = 0;
4161 
4162   /* "(tree fragment)":6
4163  *     cdef bint use_setstate
4164  *     state = (self._adj_matrix, self._pf_kwargs, self.cos_similarity, self.pmf_gen, self.pmf_threshold, self.sphere, self.vertices)
4165  *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
4166  *     if _dict is not None:
4167  *         state += (_dict,)
4168  */
4169   __pyx_t_4 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
4170   __Pyx_GOTREF(__pyx_t_4);
4171   __pyx_v__dict = __pyx_t_4;
4172   __pyx_t_4 = 0;
4173 
4174   /* "(tree fragment)":7
4175  *     state = (self._adj_matrix, self._pf_kwargs, self.cos_similarity, self.pmf_gen, self.pmf_threshold, self.sphere, self.vertices)
4176  *     _dict = getattr(self, '__dict__', None)
4177  *     if _dict is not None:             # <<<<<<<<<<<<<<
4178  *         state += (_dict,)
4179  *         use_setstate = True
4180  */
4181   __pyx_t_5 = (__pyx_v__dict != Py_None);
4182   __pyx_t_6 = (__pyx_t_5 != 0);
4183   if (__pyx_t_6) {
4184 
4185     /* "(tree fragment)":8
4186  *     _dict = getattr(self, '__dict__', None)
4187  *     if _dict is not None:
4188  *         state += (_dict,)             # <<<<<<<<<<<<<<
4189  *         use_setstate = True
4190  *     else:
4191  */
4192     __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
4193     __Pyx_GOTREF(__pyx_t_4);
4194     __Pyx_INCREF(__pyx_v__dict);
4195     __Pyx_GIVEREF(__pyx_v__dict);
4196     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v__dict);
4197     __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8, __pyx_L1_error)
4198     __Pyx_GOTREF(__pyx_t_3);
4199     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4200     __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3));
4201     __pyx_t_3 = 0;
4202 
4203     /* "(tree fragment)":9
4204  *     if _dict is not None:
4205  *         state += (_dict,)
4206  *         use_setstate = True             # <<<<<<<<<<<<<<
4207  *     else:
4208  *         use_setstate = self._adj_matrix is not None or self._pf_kwargs is not None or self.pmf_gen is not None or self.sphere is not None
4209  */
4210     __pyx_v_use_setstate = 1;
4211 
4212     /* "(tree fragment)":7
4213  *     state = (self._adj_matrix, self._pf_kwargs, self.cos_similarity, self.pmf_gen, self.pmf_threshold, self.sphere, self.vertices)
4214  *     _dict = getattr(self, '__dict__', None)
4215  *     if _dict is not None:             # <<<<<<<<<<<<<<
4216  *         state += (_dict,)
4217  *         use_setstate = True
4218  */
4219     goto __pyx_L3;
4220   }
4221 
4222   /* "(tree fragment)":11
4223  *         use_setstate = True
4224  *     else:
4225  *         use_setstate = self._adj_matrix is not None or self._pf_kwargs is not None or self.pmf_gen is not None or self.sphere is not None             # <<<<<<<<<<<<<<
4226  *     if use_setstate:
4227  *         return __pyx_unpickle_ProbabilisticDirectionGetter, (type(self), 0xd86c5c3, None), state
4228  */
4229   /*else*/ {
4230     __pyx_t_5 = (__pyx_v_self->_adj_matrix != ((PyObject*)Py_None));
4231     __pyx_t_7 = (__pyx_t_5 != 0);
4232     if (!__pyx_t_7) {
4233     } else {
4234       __pyx_t_6 = __pyx_t_7;
4235       goto __pyx_L4_bool_binop_done;
4236     }
4237     __pyx_t_7 = (__pyx_v_self->__pyx_base.__pyx_base._pf_kwargs != ((PyObject*)Py_None));
4238     __pyx_t_5 = (__pyx_t_7 != 0);
4239     if (!__pyx_t_5) {
4240     } else {
4241       __pyx_t_6 = __pyx_t_5;
4242       goto __pyx_L4_bool_binop_done;
4243     }
4244     __pyx_t_5 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.pmf_gen) != Py_None);
4245     __pyx_t_7 = (__pyx_t_5 != 0);
4246     if (!__pyx_t_7) {
4247     } else {
4248       __pyx_t_6 = __pyx_t_7;
4249       goto __pyx_L4_bool_binop_done;
4250     }
4251     __pyx_t_7 = (__pyx_v_self->__pyx_base.__pyx_base.sphere != Py_None);
4252     __pyx_t_5 = (__pyx_t_7 != 0);
4253     __pyx_t_6 = __pyx_t_5;
4254     __pyx_L4_bool_binop_done:;
4255     __pyx_v_use_setstate = __pyx_t_6;
4256   }
4257   __pyx_L3:;
4258 
4259   /* "(tree fragment)":12
4260  *     else:
4261  *         use_setstate = self._adj_matrix is not None or self._pf_kwargs is not None or self.pmf_gen is not None or self.sphere is not None
4262  *     if use_setstate:             # <<<<<<<<<<<<<<
4263  *         return __pyx_unpickle_ProbabilisticDirectionGetter, (type(self), 0xd86c5c3, None), state
4264  *     else:
4265  */
4266   __pyx_t_6 = (__pyx_v_use_setstate != 0);
4267   if (__pyx_t_6) {
4268 
4269     /* "(tree fragment)":13
4270  *         use_setstate = self._adj_matrix is not None or self._pf_kwargs is not None or self.pmf_gen is not None or self.sphere is not None
4271  *     if use_setstate:
4272  *         return __pyx_unpickle_ProbabilisticDirectionGetter, (type(self), 0xd86c5c3, None), state             # <<<<<<<<<<<<<<
4273  *     else:
4274  *         return __pyx_unpickle_ProbabilisticDirectionGetter, (type(self), 0xd86c5c3, state)
4275  */
4276     __Pyx_XDECREF(__pyx_r);
4277     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle_ProbabilisticDire); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error)
4278     __Pyx_GOTREF(__pyx_t_3);
4279     __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
4280     __Pyx_GOTREF(__pyx_t_4);
4281     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4282     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4283     PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4284     __Pyx_INCREF(__pyx_int_226936259);
4285     __Pyx_GIVEREF(__pyx_int_226936259);
4286     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_226936259);
4287     __Pyx_INCREF(Py_None);
4288     __Pyx_GIVEREF(Py_None);
4289     PyTuple_SET_ITEM(__pyx_t_4, 2, Py_None);
4290     __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error)
4291     __Pyx_GOTREF(__pyx_t_2);
4292     __Pyx_GIVEREF(__pyx_t_3);
4293     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
4294     __Pyx_GIVEREF(__pyx_t_4);
4295     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
4296     __Pyx_INCREF(__pyx_v_state);
4297     __Pyx_GIVEREF(__pyx_v_state);
4298     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_state);
4299     __pyx_t_3 = 0;
4300     __pyx_t_4 = 0;
4301     __pyx_r = __pyx_t_2;
4302     __pyx_t_2 = 0;
4303     goto __pyx_L0;
4304 
4305     /* "(tree fragment)":12
4306  *     else:
4307  *         use_setstate = self._adj_matrix is not None or self._pf_kwargs is not None or self.pmf_gen is not None or self.sphere is not None
4308  *     if use_setstate:             # <<<<<<<<<<<<<<
4309  *         return __pyx_unpickle_ProbabilisticDirectionGetter, (type(self), 0xd86c5c3, None), state
4310  *     else:
4311  */
4312   }
4313 
4314   /* "(tree fragment)":15
4315  *         return __pyx_unpickle_ProbabilisticDirectionGetter, (type(self), 0xd86c5c3, None), state
4316  *     else:
4317  *         return __pyx_unpickle_ProbabilisticDirectionGetter, (type(self), 0xd86c5c3, state)             # <<<<<<<<<<<<<<
4318  * def __setstate_cython__(self, __pyx_state):
4319  *     __pyx_unpickle_ProbabilisticDirectionGetter__set_state(self, __pyx_state)
4320  */
4321   /*else*/ {
4322     __Pyx_XDECREF(__pyx_r);
4323     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyx_unpickle_ProbabilisticDire); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error)
4324     __Pyx_GOTREF(__pyx_t_2);
4325     __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
4326     __Pyx_GOTREF(__pyx_t_4);
4327     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4328     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4329     PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
4330     __Pyx_INCREF(__pyx_int_226936259);
4331     __Pyx_GIVEREF(__pyx_int_226936259);
4332     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_226936259);
4333     __Pyx_INCREF(__pyx_v_state);
4334     __Pyx_GIVEREF(__pyx_v_state);
4335     PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state);
4336     __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error)
4337     __Pyx_GOTREF(__pyx_t_3);
4338     __Pyx_GIVEREF(__pyx_t_2);
4339     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
4340     __Pyx_GIVEREF(__pyx_t_4);
4341     PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
4342     __pyx_t_2 = 0;
4343     __pyx_t_4 = 0;
4344     __pyx_r = __pyx_t_3;
4345     __pyx_t_3 = 0;
4346     goto __pyx_L0;
4347   }
4348 
4349   /* "(tree fragment)":1
4350  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
4351  *     cdef tuple state
4352  *     cdef object _dict
4353  */
4354 
4355   /* function exit code */
4356   __pyx_L1_error:;
4357   __Pyx_XDECREF(__pyx_t_1);
4358   __Pyx_XDECREF(__pyx_t_2);
4359   __Pyx_XDECREF(__pyx_t_3);
4360   __Pyx_XDECREF(__pyx_t_4);
4361   __Pyx_AddTraceback("dipy.direction.probabilistic_direction_getter.ProbabilisticDirectionGetter.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4362   __pyx_r = NULL;
4363   __pyx_L0:;
4364   __Pyx_XDECREF(__pyx_v_state);
4365   __Pyx_XDECREF(__pyx_v__dict);
4366   __Pyx_XGIVEREF(__pyx_r);
4367   __Pyx_RefNannyFinishContext();
4368   return __pyx_r;
4369 }
4370 
4371 /* "(tree fragment)":16
4372  *     else:
4373  *         return __pyx_unpickle_ProbabilisticDirectionGetter, (type(self), 0xd86c5c3, state)
4374  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
4375  *     __pyx_unpickle_ProbabilisticDirectionGetter__set_state(self, __pyx_state)
4376  */
4377 
4378 /* Python wrapper */
4379 static PyObject *__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_7__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)4380 static PyObject *__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
4381   PyObject *__pyx_r = 0;
4382   __Pyx_RefNannyDeclarations
4383   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
4384   __pyx_r = __pyx_pf_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_6__setstate_cython__(((struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
4385 
4386   /* function exit code */
4387   __Pyx_RefNannyFinishContext();
4388   return __pyx_r;
4389 }
4390 
__pyx_pf_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_6__setstate_cython__(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter * __pyx_v_self,PyObject * __pyx_v___pyx_state)4391 static PyObject *__pyx_pf_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_6__setstate_cython__(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
4392   PyObject *__pyx_r = NULL;
4393   __Pyx_RefNannyDeclarations
4394   PyObject *__pyx_t_1 = NULL;
4395   int __pyx_lineno = 0;
4396   const char *__pyx_filename = NULL;
4397   int __pyx_clineno = 0;
4398   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
4399 
4400   /* "(tree fragment)":17
4401  *         return __pyx_unpickle_ProbabilisticDirectionGetter, (type(self), 0xd86c5c3, state)
4402  * def __setstate_cython__(self, __pyx_state):
4403  *     __pyx_unpickle_ProbabilisticDirectionGetter__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
4404  */
4405   if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
4406   __pyx_t_1 = __pyx_f_4dipy_9direction_30probabilistic_direction_getter___pyx_unpickle_ProbabilisticDirectionGetter__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
4407   __Pyx_GOTREF(__pyx_t_1);
4408   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4409 
4410   /* "(tree fragment)":16
4411  *     else:
4412  *         return __pyx_unpickle_ProbabilisticDirectionGetter, (type(self), 0xd86c5c3, state)
4413  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
4414  *     __pyx_unpickle_ProbabilisticDirectionGetter__set_state(self, __pyx_state)
4415  */
4416 
4417   /* function exit code */
4418   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4419   goto __pyx_L0;
4420   __pyx_L1_error:;
4421   __Pyx_XDECREF(__pyx_t_1);
4422   __Pyx_AddTraceback("dipy.direction.probabilistic_direction_getter.ProbabilisticDirectionGetter.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4423   __pyx_r = NULL;
4424   __pyx_L0:;
4425   __Pyx_XGIVEREF(__pyx_r);
4426   __Pyx_RefNannyFinishContext();
4427   return __pyx_r;
4428 }
4429 
4430 /* "dipy/direction/probabilistic_direction_getter.pyx":144
4431  *     """
4432  *
4433  *     def __init__(self, pmf_gen, max_angle, sphere=None, pmf_threshold=0.1,             # <<<<<<<<<<<<<<
4434  *                  **kwargs):
4435  *         ProbabilisticDirectionGetter.__init__(self, pmf_gen, max_angle, sphere,
4436  */
4437 
4438 /* Python wrapper */
4439 static int __pyx_pw_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_1__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4440 static int __pyx_pw_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4441   PyObject *__pyx_v_pmf_gen = 0;
4442   PyObject *__pyx_v_max_angle = 0;
4443   PyObject *__pyx_v_sphere = 0;
4444   PyObject *__pyx_v_pmf_threshold = 0;
4445   PyObject *__pyx_v_kwargs = 0;
4446   int __pyx_lineno = 0;
4447   const char *__pyx_filename = NULL;
4448   int __pyx_clineno = 0;
4449   int __pyx_r;
4450   __Pyx_RefNannyDeclarations
4451   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
4452   __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
4453   __Pyx_GOTREF(__pyx_v_kwargs);
4454   {
4455     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pmf_gen,&__pyx_n_s_max_angle,&__pyx_n_s_sphere,&__pyx_n_s_pmf_threshold,0};
4456     PyObject* values[4] = {0,0,0,0};
4457     values[2] = ((PyObject *)Py_None);
4458     values[3] = ((PyObject *)__pyx_float_0_1);
4459     if (unlikely(__pyx_kwds)) {
4460       Py_ssize_t kw_args;
4461       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4462       switch (pos_args) {
4463         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4464         CYTHON_FALLTHROUGH;
4465         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4466         CYTHON_FALLTHROUGH;
4467         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4468         CYTHON_FALLTHROUGH;
4469         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4470         CYTHON_FALLTHROUGH;
4471         case  0: break;
4472         default: goto __pyx_L5_argtuple_error;
4473       }
4474       kw_args = PyDict_Size(__pyx_kwds);
4475       switch (pos_args) {
4476         case  0:
4477         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pmf_gen)) != 0)) kw_args--;
4478         else goto __pyx_L5_argtuple_error;
4479         CYTHON_FALLTHROUGH;
4480         case  1:
4481         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_angle)) != 0)) kw_args--;
4482         else {
4483           __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, 1); __PYX_ERR(0, 144, __pyx_L3_error)
4484         }
4485         CYTHON_FALLTHROUGH;
4486         case  2:
4487         if (kw_args > 0) {
4488           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sphere);
4489           if (value) { values[2] = value; kw_args--; }
4490         }
4491         CYTHON_FALLTHROUGH;
4492         case  3:
4493         if (kw_args > 0) {
4494           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pmf_threshold);
4495           if (value) { values[3] = value; kw_args--; }
4496         }
4497       }
4498       if (unlikely(kw_args > 0)) {
4499         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 144, __pyx_L3_error)
4500       }
4501     } else {
4502       switch (PyTuple_GET_SIZE(__pyx_args)) {
4503         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4504         CYTHON_FALLTHROUGH;
4505         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4506         CYTHON_FALLTHROUGH;
4507         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4508         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4509         break;
4510         default: goto __pyx_L5_argtuple_error;
4511       }
4512     }
4513     __pyx_v_pmf_gen = values[0];
4514     __pyx_v_max_angle = values[1];
4515     __pyx_v_sphere = values[2];
4516     __pyx_v_pmf_threshold = values[3];
4517   }
4518   goto __pyx_L4_argument_unpacking_done;
4519   __pyx_L5_argtuple_error:;
4520   __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 144, __pyx_L3_error)
4521   __pyx_L3_error:;
4522   __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
4523   __Pyx_AddTraceback("dipy.direction.probabilistic_direction_getter.DeterministicMaximumDirectionGetter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4524   __Pyx_RefNannyFinishContext();
4525   return -1;
4526   __pyx_L4_argument_unpacking_done:;
4527   __pyx_r = __pyx_pf_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter___init__(((struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter *)__pyx_v_self), __pyx_v_pmf_gen, __pyx_v_max_angle, __pyx_v_sphere, __pyx_v_pmf_threshold, __pyx_v_kwargs);
4528 
4529   /* function exit code */
4530   __Pyx_XDECREF(__pyx_v_kwargs);
4531   __Pyx_RefNannyFinishContext();
4532   return __pyx_r;
4533 }
4534 
__pyx_pf_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter___init__(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter * __pyx_v_self,PyObject * __pyx_v_pmf_gen,PyObject * __pyx_v_max_angle,PyObject * __pyx_v_sphere,PyObject * __pyx_v_pmf_threshold,PyObject * __pyx_v_kwargs)4535 static int __pyx_pf_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter___init__(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter *__pyx_v_self, PyObject *__pyx_v_pmf_gen, PyObject *__pyx_v_max_angle, PyObject *__pyx_v_sphere, PyObject *__pyx_v_pmf_threshold, PyObject *__pyx_v_kwargs) {
4536   int __pyx_r;
4537   __Pyx_RefNannyDeclarations
4538   PyObject *__pyx_t_1 = NULL;
4539   PyObject *__pyx_t_2 = NULL;
4540   PyObject *__pyx_t_3 = NULL;
4541   PyObject *__pyx_t_4 = NULL;
4542   int __pyx_lineno = 0;
4543   const char *__pyx_filename = NULL;
4544   int __pyx_clineno = 0;
4545   __Pyx_RefNannySetupContext("__init__", 0);
4546 
4547   /* "dipy/direction/probabilistic_direction_getter.pyx":146
4548  *     def __init__(self, pmf_gen, max_angle, sphere=None, pmf_threshold=0.1,
4549  *                  **kwargs):
4550  *         ProbabilisticDirectionGetter.__init__(self, pmf_gen, max_angle, sphere,             # <<<<<<<<<<<<<<
4551  *                                               pmf_threshold, **kwargs)
4552  *
4553  */
4554   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter), __pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error)
4555   __Pyx_GOTREF(__pyx_t_1);
4556 
4557   /* "dipy/direction/probabilistic_direction_getter.pyx":147
4558  *                  **kwargs):
4559  *         ProbabilisticDirectionGetter.__init__(self, pmf_gen, max_angle, sphere,
4560  *                                               pmf_threshold, **kwargs)             # <<<<<<<<<<<<<<
4561  *
4562  *     cdef int get_direction_c(self, double* point, double* direction):
4563  */
4564   __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 146, __pyx_L1_error)
4565   __Pyx_GOTREF(__pyx_t_2);
4566   __Pyx_INCREF(((PyObject *)__pyx_v_self));
4567   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
4568   PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
4569   __Pyx_INCREF(__pyx_v_pmf_gen);
4570   __Pyx_GIVEREF(__pyx_v_pmf_gen);
4571   PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_pmf_gen);
4572   __Pyx_INCREF(__pyx_v_max_angle);
4573   __Pyx_GIVEREF(__pyx_v_max_angle);
4574   PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_max_angle);
4575   __Pyx_INCREF(__pyx_v_sphere);
4576   __Pyx_GIVEREF(__pyx_v_sphere);
4577   PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_sphere);
4578   __Pyx_INCREF(__pyx_v_pmf_threshold);
4579   __Pyx_GIVEREF(__pyx_v_pmf_threshold);
4580   PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_pmf_threshold);
4581 
4582   /* "dipy/direction/probabilistic_direction_getter.pyx":146
4583  *     def __init__(self, pmf_gen, max_angle, sphere=None, pmf_threshold=0.1,
4584  *                  **kwargs):
4585  *         ProbabilisticDirectionGetter.__init__(self, pmf_gen, max_angle, sphere,             # <<<<<<<<<<<<<<
4586  *                                               pmf_threshold, **kwargs)
4587  *
4588  */
4589   __pyx_t_3 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 147, __pyx_L1_error)
4590   __Pyx_GOTREF(__pyx_t_3);
4591   __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 146, __pyx_L1_error)
4592   __Pyx_GOTREF(__pyx_t_4);
4593   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4594   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4595   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4596   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4597 
4598   /* "dipy/direction/probabilistic_direction_getter.pyx":144
4599  *     """
4600  *
4601  *     def __init__(self, pmf_gen, max_angle, sphere=None, pmf_threshold=0.1,             # <<<<<<<<<<<<<<
4602  *                  **kwargs):
4603  *         ProbabilisticDirectionGetter.__init__(self, pmf_gen, max_angle, sphere,
4604  */
4605 
4606   /* function exit code */
4607   __pyx_r = 0;
4608   goto __pyx_L0;
4609   __pyx_L1_error:;
4610   __Pyx_XDECREF(__pyx_t_1);
4611   __Pyx_XDECREF(__pyx_t_2);
4612   __Pyx_XDECREF(__pyx_t_3);
4613   __Pyx_XDECREF(__pyx_t_4);
4614   __Pyx_AddTraceback("dipy.direction.probabilistic_direction_getter.DeterministicMaximumDirectionGetter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4615   __pyx_r = -1;
4616   __pyx_L0:;
4617   __Pyx_RefNannyFinishContext();
4618   return __pyx_r;
4619 }
4620 
4621 /* "dipy/direction/probabilistic_direction_getter.pyx":149
4622  *                                               pmf_threshold, **kwargs)
4623  *
4624  *     cdef int get_direction_c(self, double* point, double* direction):             # <<<<<<<<<<<<<<
4625  *         """Find direction with the highest pmf to updates ``direction`` array
4626  *         with a new direction.
4627  */
4628 
__pyx_f_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_get_direction_c(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter * __pyx_v_self,double * __pyx_v_point,double * __pyx_v_direction)4629 static int __pyx_f_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_get_direction_c(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter *__pyx_v_self, double *__pyx_v_point, double *__pyx_v_direction) {
4630   npy_intp __pyx_v__len;
4631   npy_intp __pyx_v_max_idx;
4632   __Pyx_memviewslice __pyx_v_newdir = { 0, 0, { 0 }, { 0 }, { 0 } };
4633   __Pyx_memviewslice __pyx_v_pmf = { 0, 0, { 0 }, { 0 }, { 0 } };
4634   double __pyx_v_max_value;
4635   __Pyx_memviewslice __pyx_v_bool_array = { 0, 0, { 0 }, { 0 }, { 0 } };
4636   npy_intp __pyx_v_i;
4637   int __pyx_r;
4638   __Pyx_RefNannyDeclarations
4639   PyObject *__pyx_t_1 = NULL;
4640   __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
4641   PyObject *__pyx_t_3 = NULL;
4642   PyObject *__pyx_t_4 = NULL;
4643   PyObject *__pyx_t_5 = NULL;
4644   __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
4645   npy_intp __pyx_t_7;
4646   npy_intp __pyx_t_8;
4647   npy_intp __pyx_t_9;
4648   int __pyx_t_10;
4649   Py_ssize_t __pyx_t_11;
4650   int __pyx_t_12;
4651   Py_ssize_t __pyx_t_13;
4652   Py_ssize_t __pyx_t_14;
4653   int __pyx_lineno = 0;
4654   const char *__pyx_filename = NULL;
4655   int __pyx_clineno = 0;
4656   __Pyx_RefNannySetupContext("get_direction_c", 0);
4657 
4658   /* "dipy/direction/probabilistic_direction_getter.pyx":170
4659  *             cnp.uint8_t[:] bool_array
4660  *
4661  *         pmf = self._get_pmf(point)             # <<<<<<<<<<<<<<
4662  *         _len = pmf.shape[0]
4663  *
4664  */
4665   __pyx_t_1 = ((struct __pyx_vtabstruct_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.__pyx_base._get_pmf(((struct __pyx_obj_4dipy_9direction_29closest_peak_direction_getter_BasePmfDirectionGetter *)__pyx_v_self), __pyx_v_point); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error)
4666   __Pyx_GOTREF(__pyx_t_1);
4667   __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 170, __pyx_L1_error)
4668   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4669   __pyx_v_pmf = __pyx_t_2;
4670   __pyx_t_2.memview = NULL;
4671   __pyx_t_2.data = NULL;
4672 
4673   /* "dipy/direction/probabilistic_direction_getter.pyx":171
4674  *
4675  *         pmf = self._get_pmf(point)
4676  *         _len = pmf.shape[0]             # <<<<<<<<<<<<<<
4677  *
4678  *         bool_array = self._adj_matrix[
4679  */
4680   __pyx_v__len = (__pyx_v_pmf.shape[0]);
4681 
4682   /* "dipy/direction/probabilistic_direction_getter.pyx":173
4683  *         _len = pmf.shape[0]
4684  *
4685  *         bool_array = self._adj_matrix[             # <<<<<<<<<<<<<<
4686  *             (direction[0], direction[1], direction[2])]
4687  *
4688  */
4689   if (unlikely(__pyx_v_self->__pyx_base._adj_matrix == Py_None)) {
4690     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4691     __PYX_ERR(0, 173, __pyx_L1_error)
4692   }
4693 
4694   /* "dipy/direction/probabilistic_direction_getter.pyx":174
4695  *
4696  *         bool_array = self._adj_matrix[
4697  *             (direction[0], direction[1], direction[2])]             # <<<<<<<<<<<<<<
4698  *
4699  *         max_idx = 0
4700  */
4701   __pyx_t_1 = PyFloat_FromDouble((__pyx_v_direction[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error)
4702   __Pyx_GOTREF(__pyx_t_1);
4703   __pyx_t_3 = PyFloat_FromDouble((__pyx_v_direction[1])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 174, __pyx_L1_error)
4704   __Pyx_GOTREF(__pyx_t_3);
4705   __pyx_t_4 = PyFloat_FromDouble((__pyx_v_direction[2])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 174, __pyx_L1_error)
4706   __Pyx_GOTREF(__pyx_t_4);
4707   __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 174, __pyx_L1_error)
4708   __Pyx_GOTREF(__pyx_t_5);
4709   __Pyx_GIVEREF(__pyx_t_1);
4710   PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
4711   __Pyx_GIVEREF(__pyx_t_3);
4712   PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
4713   __Pyx_GIVEREF(__pyx_t_4);
4714   PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
4715   __pyx_t_1 = 0;
4716   __pyx_t_3 = 0;
4717   __pyx_t_4 = 0;
4718 
4719   /* "dipy/direction/probabilistic_direction_getter.pyx":173
4720  *         _len = pmf.shape[0]
4721  *
4722  *         bool_array = self._adj_matrix[             # <<<<<<<<<<<<<<
4723  *             (direction[0], direction[1], direction[2])]
4724  *
4725  */
4726   __pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_self->__pyx_base._adj_matrix, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 173, __pyx_L1_error)
4727   __Pyx_GOTREF(__pyx_t_4);
4728   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4729   __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_uint8_t(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 173, __pyx_L1_error)
4730   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4731   __pyx_v_bool_array = __pyx_t_6;
4732   __pyx_t_6.memview = NULL;
4733   __pyx_t_6.data = NULL;
4734 
4735   /* "dipy/direction/probabilistic_direction_getter.pyx":176
4736  *             (direction[0], direction[1], direction[2])]
4737  *
4738  *         max_idx = 0             # <<<<<<<<<<<<<<
4739  *         max_value = 0.0
4740  *         for i in range(_len):
4741  */
4742   __pyx_v_max_idx = 0;
4743 
4744   /* "dipy/direction/probabilistic_direction_getter.pyx":177
4745  *
4746  *         max_idx = 0
4747  *         max_value = 0.0             # <<<<<<<<<<<<<<
4748  *         for i in range(_len):
4749  *             if bool_array[i] > 0 and pmf[i] > max_value:
4750  */
4751   __pyx_v_max_value = 0.0;
4752 
4753   /* "dipy/direction/probabilistic_direction_getter.pyx":178
4754  *         max_idx = 0
4755  *         max_value = 0.0
4756  *         for i in range(_len):             # <<<<<<<<<<<<<<
4757  *             if bool_array[i] > 0 and pmf[i] > max_value:
4758  *                 max_idx = i
4759  */
4760   __pyx_t_7 = __pyx_v__len;
4761   __pyx_t_8 = __pyx_t_7;
4762   for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
4763     __pyx_v_i = __pyx_t_9;
4764 
4765     /* "dipy/direction/probabilistic_direction_getter.pyx":179
4766  *         max_value = 0.0
4767  *         for i in range(_len):
4768  *             if bool_array[i] > 0 and pmf[i] > max_value:             # <<<<<<<<<<<<<<
4769  *                 max_idx = i
4770  *                 max_value = pmf[i]
4771  */
4772     __pyx_t_11 = __pyx_v_i;
4773     __pyx_t_12 = (((*((__pyx_t_5numpy_uint8_t *) ( /* dim=0 */ (__pyx_v_bool_array.data + __pyx_t_11 * __pyx_v_bool_array.strides[0]) ))) > 0) != 0);
4774     if (__pyx_t_12) {
4775     } else {
4776       __pyx_t_10 = __pyx_t_12;
4777       goto __pyx_L6_bool_binop_done;
4778     }
4779     __pyx_t_11 = __pyx_v_i;
4780     __pyx_t_12 = (((*((double *) ( /* dim=0 */ (__pyx_v_pmf.data + __pyx_t_11 * __pyx_v_pmf.strides[0]) ))) > __pyx_v_max_value) != 0);
4781     __pyx_t_10 = __pyx_t_12;
4782     __pyx_L6_bool_binop_done:;
4783     if (__pyx_t_10) {
4784 
4785       /* "dipy/direction/probabilistic_direction_getter.pyx":180
4786  *         for i in range(_len):
4787  *             if bool_array[i] > 0 and pmf[i] > max_value:
4788  *                 max_idx = i             # <<<<<<<<<<<<<<
4789  *                 max_value = pmf[i]
4790  *
4791  */
4792       __pyx_v_max_idx = __pyx_v_i;
4793 
4794       /* "dipy/direction/probabilistic_direction_getter.pyx":181
4795  *             if bool_array[i] > 0 and pmf[i] > max_value:
4796  *                 max_idx = i
4797  *                 max_value = pmf[i]             # <<<<<<<<<<<<<<
4798  *
4799  *         if max_value <= 0:
4800  */
4801       __pyx_t_11 = __pyx_v_i;
4802       __pyx_v_max_value = (*((double *) ( /* dim=0 */ (__pyx_v_pmf.data + __pyx_t_11 * __pyx_v_pmf.strides[0]) )));
4803 
4804       /* "dipy/direction/probabilistic_direction_getter.pyx":179
4805  *         max_value = 0.0
4806  *         for i in range(_len):
4807  *             if bool_array[i] > 0 and pmf[i] > max_value:             # <<<<<<<<<<<<<<
4808  *                 max_idx = i
4809  *                 max_value = pmf[i]
4810  */
4811     }
4812   }
4813 
4814   /* "dipy/direction/probabilistic_direction_getter.pyx":183
4815  *                 max_value = pmf[i]
4816  *
4817  *         if max_value <= 0:             # <<<<<<<<<<<<<<
4818  *             return 1
4819  *
4820  */
4821   __pyx_t_10 = ((__pyx_v_max_value <= 0.0) != 0);
4822   if (__pyx_t_10) {
4823 
4824     /* "dipy/direction/probabilistic_direction_getter.pyx":184
4825  *
4826  *         if max_value <= 0:
4827  *             return 1             # <<<<<<<<<<<<<<
4828  *
4829  *         newdir = self.vertices[max_idx]
4830  */
4831     __pyx_r = 1;
4832     goto __pyx_L0;
4833 
4834     /* "dipy/direction/probabilistic_direction_getter.pyx":183
4835  *                 max_value = pmf[i]
4836  *
4837  *         if max_value <= 0:             # <<<<<<<<<<<<<<
4838  *             return 1
4839  *
4840  */
4841   }
4842 
4843   /* "dipy/direction/probabilistic_direction_getter.pyx":186
4844  *             return 1
4845  *
4846  *         newdir = self.vertices[max_idx]             # <<<<<<<<<<<<<<
4847  *         # Update direction
4848  *         if direction[0] * newdir[0] \
4849  */
4850   __pyx_t_2.data = __pyx_v_self->__pyx_base.vertices.data;
4851   __pyx_t_2.memview = __pyx_v_self->__pyx_base.vertices.memview;
4852   __PYX_INC_MEMVIEW(&__pyx_t_2, 0);
4853   {
4854     Py_ssize_t __pyx_tmp_idx = __pyx_v_max_idx;
4855     Py_ssize_t __pyx_tmp_stride = __pyx_v_self->__pyx_base.vertices.strides[0];
4856         __pyx_t_2.data += __pyx_tmp_idx * __pyx_tmp_stride;
4857 }
4858 
4859 __pyx_t_2.shape[0] = __pyx_v_self->__pyx_base.vertices.shape[1];
4860 __pyx_t_2.strides[0] = __pyx_v_self->__pyx_base.vertices.strides[1];
4861     __pyx_t_2.suboffsets[0] = -1;
4862 
4863 __pyx_v_newdir = __pyx_t_2;
4864   __pyx_t_2.memview = NULL;
4865   __pyx_t_2.data = NULL;
4866 
4867   /* "dipy/direction/probabilistic_direction_getter.pyx":188
4868  *         newdir = self.vertices[max_idx]
4869  *         # Update direction
4870  *         if direction[0] * newdir[0] \             # <<<<<<<<<<<<<<
4871  *          + direction[1] * newdir[1] \
4872  *          + direction[2] * newdir[2] > 0:
4873  */
4874   __pyx_t_11 = 0;
4875 
4876   /* "dipy/direction/probabilistic_direction_getter.pyx":189
4877  *         # Update direction
4878  *         if direction[0] * newdir[0] \
4879  *          + direction[1] * newdir[1] \             # <<<<<<<<<<<<<<
4880  *          + direction[2] * newdir[2] > 0:
4881  *             direction[0] = newdir[0]
4882  */
4883   __pyx_t_13 = 1;
4884 
4885   /* "dipy/direction/probabilistic_direction_getter.pyx":190
4886  *         if direction[0] * newdir[0] \
4887  *          + direction[1] * newdir[1] \
4888  *          + direction[2] * newdir[2] > 0:             # <<<<<<<<<<<<<<
4889  *             direction[0] = newdir[0]
4890  *             direction[1] = newdir[1]
4891  */
4892   __pyx_t_14 = 2;
4893   __pyx_t_10 = ((((((__pyx_v_direction[0]) * (*((double *) ( /* dim=0 */ (__pyx_v_newdir.data + __pyx_t_11 * __pyx_v_newdir.strides[0]) )))) + ((__pyx_v_direction[1]) * (*((double *) ( /* dim=0 */ (__pyx_v_newdir.data + __pyx_t_13 * __pyx_v_newdir.strides[0]) ))))) + ((__pyx_v_direction[2]) * (*((double *) ( /* dim=0 */ (__pyx_v_newdir.data + __pyx_t_14 * __pyx_v_newdir.strides[0]) ))))) > 0.0) != 0);
4894 
4895   /* "dipy/direction/probabilistic_direction_getter.pyx":188
4896  *         newdir = self.vertices[max_idx]
4897  *         # Update direction
4898  *         if direction[0] * newdir[0] \             # <<<<<<<<<<<<<<
4899  *          + direction[1] * newdir[1] \
4900  *          + direction[2] * newdir[2] > 0:
4901  */
4902   if (__pyx_t_10) {
4903 
4904     /* "dipy/direction/probabilistic_direction_getter.pyx":191
4905  *          + direction[1] * newdir[1] \
4906  *          + direction[2] * newdir[2] > 0:
4907  *             direction[0] = newdir[0]             # <<<<<<<<<<<<<<
4908  *             direction[1] = newdir[1]
4909  *             direction[2] = newdir[2]
4910  */
4911     __pyx_t_14 = 0;
4912     (__pyx_v_direction[0]) = (*((double *) ( /* dim=0 */ (__pyx_v_newdir.data + __pyx_t_14 * __pyx_v_newdir.strides[0]) )));
4913 
4914     /* "dipy/direction/probabilistic_direction_getter.pyx":192
4915  *          + direction[2] * newdir[2] > 0:
4916  *             direction[0] = newdir[0]
4917  *             direction[1] = newdir[1]             # <<<<<<<<<<<<<<
4918  *             direction[2] = newdir[2]
4919  *         else:
4920  */
4921     __pyx_t_14 = 1;
4922     (__pyx_v_direction[1]) = (*((double *) ( /* dim=0 */ (__pyx_v_newdir.data + __pyx_t_14 * __pyx_v_newdir.strides[0]) )));
4923 
4924     /* "dipy/direction/probabilistic_direction_getter.pyx":193
4925  *             direction[0] = newdir[0]
4926  *             direction[1] = newdir[1]
4927  *             direction[2] = newdir[2]             # <<<<<<<<<<<<<<
4928  *         else:
4929  *             direction[0] = -newdir[0]
4930  */
4931     __pyx_t_14 = 2;
4932     (__pyx_v_direction[2]) = (*((double *) ( /* dim=0 */ (__pyx_v_newdir.data + __pyx_t_14 * __pyx_v_newdir.strides[0]) )));
4933 
4934     /* "dipy/direction/probabilistic_direction_getter.pyx":188
4935  *         newdir = self.vertices[max_idx]
4936  *         # Update direction
4937  *         if direction[0] * newdir[0] \             # <<<<<<<<<<<<<<
4938  *          + direction[1] * newdir[1] \
4939  *          + direction[2] * newdir[2] > 0:
4940  */
4941     goto __pyx_L9;
4942   }
4943 
4944   /* "dipy/direction/probabilistic_direction_getter.pyx":195
4945  *             direction[2] = newdir[2]
4946  *         else:
4947  *             direction[0] = -newdir[0]             # <<<<<<<<<<<<<<
4948  *             direction[1] = -newdir[1]
4949  *             direction[2] = -newdir[2]
4950  */
4951   /*else*/ {
4952     __pyx_t_14 = 0;
4953     (__pyx_v_direction[0]) = (-(*((double *) ( /* dim=0 */ (__pyx_v_newdir.data + __pyx_t_14 * __pyx_v_newdir.strides[0]) ))));
4954 
4955     /* "dipy/direction/probabilistic_direction_getter.pyx":196
4956  *         else:
4957  *             direction[0] = -newdir[0]
4958  *             direction[1] = -newdir[1]             # <<<<<<<<<<<<<<
4959  *             direction[2] = -newdir[2]
4960  *         return 0
4961  */
4962     __pyx_t_14 = 1;
4963     (__pyx_v_direction[1]) = (-(*((double *) ( /* dim=0 */ (__pyx_v_newdir.data + __pyx_t_14 * __pyx_v_newdir.strides[0]) ))));
4964 
4965     /* "dipy/direction/probabilistic_direction_getter.pyx":197
4966  *             direction[0] = -newdir[0]
4967  *             direction[1] = -newdir[1]
4968  *             direction[2] = -newdir[2]             # <<<<<<<<<<<<<<
4969  *         return 0
4970  */
4971     __pyx_t_14 = 2;
4972     (__pyx_v_direction[2]) = (-(*((double *) ( /* dim=0 */ (__pyx_v_newdir.data + __pyx_t_14 * __pyx_v_newdir.strides[0]) ))));
4973   }
4974   __pyx_L9:;
4975 
4976   /* "dipy/direction/probabilistic_direction_getter.pyx":198
4977  *             direction[1] = -newdir[1]
4978  *             direction[2] = -newdir[2]
4979  *         return 0             # <<<<<<<<<<<<<<
4980  */
4981   __pyx_r = 0;
4982   goto __pyx_L0;
4983 
4984   /* "dipy/direction/probabilistic_direction_getter.pyx":149
4985  *                                               pmf_threshold, **kwargs)
4986  *
4987  *     cdef int get_direction_c(self, double* point, double* direction):             # <<<<<<<<<<<<<<
4988  *         """Find direction with the highest pmf to updates ``direction`` array
4989  *         with a new direction.
4990  */
4991 
4992   /* function exit code */
4993   __pyx_L1_error:;
4994   __Pyx_XDECREF(__pyx_t_1);
4995   __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
4996   __Pyx_XDECREF(__pyx_t_3);
4997   __Pyx_XDECREF(__pyx_t_4);
4998   __Pyx_XDECREF(__pyx_t_5);
4999   __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
5000   __Pyx_WriteUnraisable("dipy.direction.probabilistic_direction_getter.DeterministicMaximumDirectionGetter.get_direction_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
5001   __pyx_r = 0;
5002   __pyx_L0:;
5003   __PYX_XDEC_MEMVIEW(&__pyx_v_newdir, 1);
5004   __PYX_XDEC_MEMVIEW(&__pyx_v_pmf, 1);
5005   __PYX_XDEC_MEMVIEW(&__pyx_v_bool_array, 1);
5006   __Pyx_RefNannyFinishContext();
5007   return __pyx_r;
5008 }
5009 
5010 /* "(tree fragment)":1
5011  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
5012  *     cdef tuple state
5013  *     cdef object _dict
5014  */
5015 
5016 /* Python wrapper */
5017 static PyObject *__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_3__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)5018 static PyObject *__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5019   PyObject *__pyx_r = 0;
5020   __Pyx_RefNannyDeclarations
5021   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
5022   __pyx_r = __pyx_pf_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_2__reduce_cython__(((struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter *)__pyx_v_self));
5023 
5024   /* function exit code */
5025   __Pyx_RefNannyFinishContext();
5026   return __pyx_r;
5027 }
5028 
__pyx_pf_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_2__reduce_cython__(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter * __pyx_v_self)5029 static PyObject *__pyx_pf_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_2__reduce_cython__(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter *__pyx_v_self) {
5030   PyObject *__pyx_v_state = 0;
5031   PyObject *__pyx_v__dict = 0;
5032   int __pyx_v_use_setstate;
5033   PyObject *__pyx_r = NULL;
5034   __Pyx_RefNannyDeclarations
5035   PyObject *__pyx_t_1 = NULL;
5036   PyObject *__pyx_t_2 = NULL;
5037   PyObject *__pyx_t_3 = NULL;
5038   PyObject *__pyx_t_4 = NULL;
5039   int __pyx_t_5;
5040   int __pyx_t_6;
5041   int __pyx_t_7;
5042   int __pyx_lineno = 0;
5043   const char *__pyx_filename = NULL;
5044   int __pyx_clineno = 0;
5045   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
5046 
5047   /* "(tree fragment)":5
5048  *     cdef object _dict
5049  *     cdef bint use_setstate
5050  *     state = (self._adj_matrix, self._pf_kwargs, self.cos_similarity, self.pmf_gen, self.pmf_threshold, self.sphere, self.vertices)             # <<<<<<<<<<<<<<
5051  *     _dict = getattr(self, '__dict__', None)
5052  *     if _dict is not None:
5053  */
5054   __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.cos_similarity); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
5055   __Pyx_GOTREF(__pyx_t_1);
5056   __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.pmf_threshold); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
5057   __Pyx_GOTREF(__pyx_t_2);
5058   __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_self->__pyx_base.vertices, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
5059   __Pyx_GOTREF(__pyx_t_3);
5060   __pyx_t_4 = PyTuple_New(7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
5061   __Pyx_GOTREF(__pyx_t_4);
5062   __Pyx_INCREF(__pyx_v_self->__pyx_base._adj_matrix);
5063   __Pyx_GIVEREF(__pyx_v_self->__pyx_base._adj_matrix);
5064   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self->__pyx_base._adj_matrix);
5065   __Pyx_INCREF(__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._pf_kwargs);
5066   __Pyx_GIVEREF(__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._pf_kwargs);
5067   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self->__pyx_base.__pyx_base.__pyx_base._pf_kwargs);
5068   __Pyx_GIVEREF(__pyx_t_1);
5069   PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1);
5070   __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.pmf_gen));
5071   __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.pmf_gen));
5072   PyTuple_SET_ITEM(__pyx_t_4, 3, ((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.pmf_gen));
5073   __Pyx_GIVEREF(__pyx_t_2);
5074   PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_2);
5075   __Pyx_INCREF(__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.sphere);
5076   __Pyx_GIVEREF(__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.sphere);
5077   PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_v_self->__pyx_base.__pyx_base.__pyx_base.sphere);
5078   __Pyx_GIVEREF(__pyx_t_3);
5079   PyTuple_SET_ITEM(__pyx_t_4, 6, __pyx_t_3);
5080   __pyx_t_1 = 0;
5081   __pyx_t_2 = 0;
5082   __pyx_t_3 = 0;
5083   __pyx_v_state = ((PyObject*)__pyx_t_4);
5084   __pyx_t_4 = 0;
5085 
5086   /* "(tree fragment)":6
5087  *     cdef bint use_setstate
5088  *     state = (self._adj_matrix, self._pf_kwargs, self.cos_similarity, self.pmf_gen, self.pmf_threshold, self.sphere, self.vertices)
5089  *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
5090  *     if _dict is not None:
5091  *         state += (_dict,)
5092  */
5093   __pyx_t_4 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
5094   __Pyx_GOTREF(__pyx_t_4);
5095   __pyx_v__dict = __pyx_t_4;
5096   __pyx_t_4 = 0;
5097 
5098   /* "(tree fragment)":7
5099  *     state = (self._adj_matrix, self._pf_kwargs, self.cos_similarity, self.pmf_gen, self.pmf_threshold, self.sphere, self.vertices)
5100  *     _dict = getattr(self, '__dict__', None)
5101  *     if _dict is not None:             # <<<<<<<<<<<<<<
5102  *         state += (_dict,)
5103  *         use_setstate = True
5104  */
5105   __pyx_t_5 = (__pyx_v__dict != Py_None);
5106   __pyx_t_6 = (__pyx_t_5 != 0);
5107   if (__pyx_t_6) {
5108 
5109     /* "(tree fragment)":8
5110  *     _dict = getattr(self, '__dict__', None)
5111  *     if _dict is not None:
5112  *         state += (_dict,)             # <<<<<<<<<<<<<<
5113  *         use_setstate = True
5114  *     else:
5115  */
5116     __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
5117     __Pyx_GOTREF(__pyx_t_4);
5118     __Pyx_INCREF(__pyx_v__dict);
5119     __Pyx_GIVEREF(__pyx_v__dict);
5120     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v__dict);
5121     __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8, __pyx_L1_error)
5122     __Pyx_GOTREF(__pyx_t_3);
5123     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5124     __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3));
5125     __pyx_t_3 = 0;
5126 
5127     /* "(tree fragment)":9
5128  *     if _dict is not None:
5129  *         state += (_dict,)
5130  *         use_setstate = True             # <<<<<<<<<<<<<<
5131  *     else:
5132  *         use_setstate = self._adj_matrix is not None or self._pf_kwargs is not None or self.pmf_gen is not None or self.sphere is not None
5133  */
5134     __pyx_v_use_setstate = 1;
5135 
5136     /* "(tree fragment)":7
5137  *     state = (self._adj_matrix, self._pf_kwargs, self.cos_similarity, self.pmf_gen, self.pmf_threshold, self.sphere, self.vertices)
5138  *     _dict = getattr(self, '__dict__', None)
5139  *     if _dict is not None:             # <<<<<<<<<<<<<<
5140  *         state += (_dict,)
5141  *         use_setstate = True
5142  */
5143     goto __pyx_L3;
5144   }
5145 
5146   /* "(tree fragment)":11
5147  *         use_setstate = True
5148  *     else:
5149  *         use_setstate = self._adj_matrix is not None or self._pf_kwargs is not None or self.pmf_gen is not None or self.sphere is not None             # <<<<<<<<<<<<<<
5150  *     if use_setstate:
5151  *         return __pyx_unpickle_DeterministicMaximumDirectionGetter, (type(self), 0xd86c5c3, None), state
5152  */
5153   /*else*/ {
5154     __pyx_t_5 = (__pyx_v_self->__pyx_base._adj_matrix != ((PyObject*)Py_None));
5155     __pyx_t_7 = (__pyx_t_5 != 0);
5156     if (!__pyx_t_7) {
5157     } else {
5158       __pyx_t_6 = __pyx_t_7;
5159       goto __pyx_L4_bool_binop_done;
5160     }
5161     __pyx_t_7 = (__pyx_v_self->__pyx_base.__pyx_base.__pyx_base._pf_kwargs != ((PyObject*)Py_None));
5162     __pyx_t_5 = (__pyx_t_7 != 0);
5163     if (!__pyx_t_5) {
5164     } else {
5165       __pyx_t_6 = __pyx_t_5;
5166       goto __pyx_L4_bool_binop_done;
5167     }
5168     __pyx_t_5 = (((PyObject *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.pmf_gen) != Py_None);
5169     __pyx_t_7 = (__pyx_t_5 != 0);
5170     if (!__pyx_t_7) {
5171     } else {
5172       __pyx_t_6 = __pyx_t_7;
5173       goto __pyx_L4_bool_binop_done;
5174     }
5175     __pyx_t_7 = (__pyx_v_self->__pyx_base.__pyx_base.__pyx_base.sphere != Py_None);
5176     __pyx_t_5 = (__pyx_t_7 != 0);
5177     __pyx_t_6 = __pyx_t_5;
5178     __pyx_L4_bool_binop_done:;
5179     __pyx_v_use_setstate = __pyx_t_6;
5180   }
5181   __pyx_L3:;
5182 
5183   /* "(tree fragment)":12
5184  *     else:
5185  *         use_setstate = self._adj_matrix is not None or self._pf_kwargs is not None or self.pmf_gen is not None or self.sphere is not None
5186  *     if use_setstate:             # <<<<<<<<<<<<<<
5187  *         return __pyx_unpickle_DeterministicMaximumDirectionGetter, (type(self), 0xd86c5c3, None), state
5188  *     else:
5189  */
5190   __pyx_t_6 = (__pyx_v_use_setstate != 0);
5191   if (__pyx_t_6) {
5192 
5193     /* "(tree fragment)":13
5194  *         use_setstate = self._adj_matrix is not None or self._pf_kwargs is not None or self.pmf_gen is not None or self.sphere is not None
5195  *     if use_setstate:
5196  *         return __pyx_unpickle_DeterministicMaximumDirectionGetter, (type(self), 0xd86c5c3, None), state             # <<<<<<<<<<<<<<
5197  *     else:
5198  *         return __pyx_unpickle_DeterministicMaximumDirectionGetter, (type(self), 0xd86c5c3, state)
5199  */
5200     __Pyx_XDECREF(__pyx_r);
5201     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle_DeterministicMaxi); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error)
5202     __Pyx_GOTREF(__pyx_t_3);
5203     __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
5204     __Pyx_GOTREF(__pyx_t_4);
5205     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
5206     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
5207     PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
5208     __Pyx_INCREF(__pyx_int_226936259);
5209     __Pyx_GIVEREF(__pyx_int_226936259);
5210     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_226936259);
5211     __Pyx_INCREF(Py_None);
5212     __Pyx_GIVEREF(Py_None);
5213     PyTuple_SET_ITEM(__pyx_t_4, 2, Py_None);
5214     __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error)
5215     __Pyx_GOTREF(__pyx_t_2);
5216     __Pyx_GIVEREF(__pyx_t_3);
5217     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
5218     __Pyx_GIVEREF(__pyx_t_4);
5219     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
5220     __Pyx_INCREF(__pyx_v_state);
5221     __Pyx_GIVEREF(__pyx_v_state);
5222     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_state);
5223     __pyx_t_3 = 0;
5224     __pyx_t_4 = 0;
5225     __pyx_r = __pyx_t_2;
5226     __pyx_t_2 = 0;
5227     goto __pyx_L0;
5228 
5229     /* "(tree fragment)":12
5230  *     else:
5231  *         use_setstate = self._adj_matrix is not None or self._pf_kwargs is not None or self.pmf_gen is not None or self.sphere is not None
5232  *     if use_setstate:             # <<<<<<<<<<<<<<
5233  *         return __pyx_unpickle_DeterministicMaximumDirectionGetter, (type(self), 0xd86c5c3, None), state
5234  *     else:
5235  */
5236   }
5237 
5238   /* "(tree fragment)":15
5239  *         return __pyx_unpickle_DeterministicMaximumDirectionGetter, (type(self), 0xd86c5c3, None), state
5240  *     else:
5241  *         return __pyx_unpickle_DeterministicMaximumDirectionGetter, (type(self), 0xd86c5c3, state)             # <<<<<<<<<<<<<<
5242  * def __setstate_cython__(self, __pyx_state):
5243  *     __pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(self, __pyx_state)
5244  */
5245   /*else*/ {
5246     __Pyx_XDECREF(__pyx_r);
5247     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyx_unpickle_DeterministicMaxi); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error)
5248     __Pyx_GOTREF(__pyx_t_2);
5249     __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
5250     __Pyx_GOTREF(__pyx_t_4);
5251     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
5252     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
5253     PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
5254     __Pyx_INCREF(__pyx_int_226936259);
5255     __Pyx_GIVEREF(__pyx_int_226936259);
5256     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_226936259);
5257     __Pyx_INCREF(__pyx_v_state);
5258     __Pyx_GIVEREF(__pyx_v_state);
5259     PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state);
5260     __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 15, __pyx_L1_error)
5261     __Pyx_GOTREF(__pyx_t_3);
5262     __Pyx_GIVEREF(__pyx_t_2);
5263     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
5264     __Pyx_GIVEREF(__pyx_t_4);
5265     PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
5266     __pyx_t_2 = 0;
5267     __pyx_t_4 = 0;
5268     __pyx_r = __pyx_t_3;
5269     __pyx_t_3 = 0;
5270     goto __pyx_L0;
5271   }
5272 
5273   /* "(tree fragment)":1
5274  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
5275  *     cdef tuple state
5276  *     cdef object _dict
5277  */
5278 
5279   /* function exit code */
5280   __pyx_L1_error:;
5281   __Pyx_XDECREF(__pyx_t_1);
5282   __Pyx_XDECREF(__pyx_t_2);
5283   __Pyx_XDECREF(__pyx_t_3);
5284   __Pyx_XDECREF(__pyx_t_4);
5285   __Pyx_AddTraceback("dipy.direction.probabilistic_direction_getter.DeterministicMaximumDirectionGetter.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5286   __pyx_r = NULL;
5287   __pyx_L0:;
5288   __Pyx_XDECREF(__pyx_v_state);
5289   __Pyx_XDECREF(__pyx_v__dict);
5290   __Pyx_XGIVEREF(__pyx_r);
5291   __Pyx_RefNannyFinishContext();
5292   return __pyx_r;
5293 }
5294 
5295 /* "(tree fragment)":16
5296  *     else:
5297  *         return __pyx_unpickle_DeterministicMaximumDirectionGetter, (type(self), 0xd86c5c3, state)
5298  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
5299  *     __pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(self, __pyx_state)
5300  */
5301 
5302 /* Python wrapper */
5303 static PyObject *__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_5__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)5304 static PyObject *__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
5305   PyObject *__pyx_r = 0;
5306   __Pyx_RefNannyDeclarations
5307   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
5308   __pyx_r = __pyx_pf_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_4__setstate_cython__(((struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
5309 
5310   /* function exit code */
5311   __Pyx_RefNannyFinishContext();
5312   return __pyx_r;
5313 }
5314 
__pyx_pf_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_4__setstate_cython__(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter * __pyx_v_self,PyObject * __pyx_v___pyx_state)5315 static PyObject *__pyx_pf_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_4__setstate_cython__(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
5316   PyObject *__pyx_r = NULL;
5317   __Pyx_RefNannyDeclarations
5318   PyObject *__pyx_t_1 = NULL;
5319   int __pyx_lineno = 0;
5320   const char *__pyx_filename = NULL;
5321   int __pyx_clineno = 0;
5322   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
5323 
5324   /* "(tree fragment)":17
5325  *         return __pyx_unpickle_DeterministicMaximumDirectionGetter, (type(self), 0xd86c5c3, state)
5326  * def __setstate_cython__(self, __pyx_state):
5327  *     __pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
5328  */
5329   if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
5330   __pyx_t_1 = __pyx_f_4dipy_9direction_30probabilistic_direction_getter___pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
5331   __Pyx_GOTREF(__pyx_t_1);
5332   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5333 
5334   /* "(tree fragment)":16
5335  *     else:
5336  *         return __pyx_unpickle_DeterministicMaximumDirectionGetter, (type(self), 0xd86c5c3, state)
5337  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
5338  *     __pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(self, __pyx_state)
5339  */
5340 
5341   /* function exit code */
5342   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5343   goto __pyx_L0;
5344   __pyx_L1_error:;
5345   __Pyx_XDECREF(__pyx_t_1);
5346   __Pyx_AddTraceback("dipy.direction.probabilistic_direction_getter.DeterministicMaximumDirectionGetter.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5347   __pyx_r = NULL;
5348   __pyx_L0:;
5349   __Pyx_XGIVEREF(__pyx_r);
5350   __Pyx_RefNannyFinishContext();
5351   return __pyx_r;
5352 }
5353 
5354 /* "(tree fragment)":1
5355  * def __pyx_unpickle_ProbabilisticDirectionGetter(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
5356  *     cdef object __pyx_PickleError
5357  *     cdef object __pyx_result
5358  */
5359 
5360 /* Python wrapper */
5361 static PyObject *__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_1__pyx_unpickle_ProbabilisticDirectionGetter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5362 static PyMethodDef __pyx_mdef_4dipy_9direction_30probabilistic_direction_getter_1__pyx_unpickle_ProbabilisticDirectionGetter = {"__pyx_unpickle_ProbabilisticDirectionGetter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_1__pyx_unpickle_ProbabilisticDirectionGetter, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_1__pyx_unpickle_ProbabilisticDirectionGetter(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)5363 static PyObject *__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_1__pyx_unpickle_ProbabilisticDirectionGetter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5364   PyObject *__pyx_v___pyx_type = 0;
5365   long __pyx_v___pyx_checksum;
5366   PyObject *__pyx_v___pyx_state = 0;
5367   int __pyx_lineno = 0;
5368   const char *__pyx_filename = NULL;
5369   int __pyx_clineno = 0;
5370   PyObject *__pyx_r = 0;
5371   __Pyx_RefNannyDeclarations
5372   __Pyx_RefNannySetupContext("__pyx_unpickle_ProbabilisticDirectionGetter (wrapper)", 0);
5373   {
5374     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
5375     PyObject* values[3] = {0,0,0};
5376     if (unlikely(__pyx_kwds)) {
5377       Py_ssize_t kw_args;
5378       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5379       switch (pos_args) {
5380         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5381         CYTHON_FALLTHROUGH;
5382         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5383         CYTHON_FALLTHROUGH;
5384         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5385         CYTHON_FALLTHROUGH;
5386         case  0: break;
5387         default: goto __pyx_L5_argtuple_error;
5388       }
5389       kw_args = PyDict_Size(__pyx_kwds);
5390       switch (pos_args) {
5391         case  0:
5392         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
5393         else goto __pyx_L5_argtuple_error;
5394         CYTHON_FALLTHROUGH;
5395         case  1:
5396         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
5397         else {
5398           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ProbabilisticDirectionGetter", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
5399         }
5400         CYTHON_FALLTHROUGH;
5401         case  2:
5402         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
5403         else {
5404           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ProbabilisticDirectionGetter", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
5405         }
5406       }
5407       if (unlikely(kw_args > 0)) {
5408         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_ProbabilisticDirectionGetter") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
5409       }
5410     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
5411       goto __pyx_L5_argtuple_error;
5412     } else {
5413       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5414       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5415       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5416     }
5417     __pyx_v___pyx_type = values[0];
5418     __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
5419     __pyx_v___pyx_state = values[2];
5420   }
5421   goto __pyx_L4_argument_unpacking_done;
5422   __pyx_L5_argtuple_error:;
5423   __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_ProbabilisticDirectionGetter", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
5424   __pyx_L3_error:;
5425   __Pyx_AddTraceback("dipy.direction.probabilistic_direction_getter.__pyx_unpickle_ProbabilisticDirectionGetter", __pyx_clineno, __pyx_lineno, __pyx_filename);
5426   __Pyx_RefNannyFinishContext();
5427   return NULL;
5428   __pyx_L4_argument_unpacking_done:;
5429   __pyx_r = __pyx_pf_4dipy_9direction_30probabilistic_direction_getter___pyx_unpickle_ProbabilisticDirectionGetter(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
5430 
5431   /* function exit code */
5432   __Pyx_RefNannyFinishContext();
5433   return __pyx_r;
5434 }
5435 
__pyx_pf_4dipy_9direction_30probabilistic_direction_getter___pyx_unpickle_ProbabilisticDirectionGetter(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v___pyx_type,long __pyx_v___pyx_checksum,PyObject * __pyx_v___pyx_state)5436 static PyObject *__pyx_pf_4dipy_9direction_30probabilistic_direction_getter___pyx_unpickle_ProbabilisticDirectionGetter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
5437   PyObject *__pyx_v___pyx_PickleError = 0;
5438   PyObject *__pyx_v___pyx_result = 0;
5439   PyObject *__pyx_r = NULL;
5440   __Pyx_RefNannyDeclarations
5441   int __pyx_t_1;
5442   PyObject *__pyx_t_2 = NULL;
5443   PyObject *__pyx_t_3 = NULL;
5444   PyObject *__pyx_t_4 = NULL;
5445   PyObject *__pyx_t_5 = NULL;
5446   int __pyx_t_6;
5447   int __pyx_lineno = 0;
5448   const char *__pyx_filename = NULL;
5449   int __pyx_clineno = 0;
5450   __Pyx_RefNannySetupContext("__pyx_unpickle_ProbabilisticDirectionGetter", 0);
5451 
5452   /* "(tree fragment)":4
5453  *     cdef object __pyx_PickleError
5454  *     cdef object __pyx_result
5455  *     if __pyx_checksum != 0xd86c5c3:             # <<<<<<<<<<<<<<
5456  *         from pickle import PickleError as __pyx_PickleError
5457  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd86c5c3 = (_adj_matrix, _pf_kwargs, cos_similarity, pmf_gen, pmf_threshold, sphere, vertices))" % __pyx_checksum)
5458  */
5459   __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd86c5c3) != 0);
5460   if (__pyx_t_1) {
5461 
5462     /* "(tree fragment)":5
5463  *     cdef object __pyx_result
5464  *     if __pyx_checksum != 0xd86c5c3:
5465  *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
5466  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd86c5c3 = (_adj_matrix, _pf_kwargs, cos_similarity, pmf_gen, pmf_threshold, sphere, vertices))" % __pyx_checksum)
5467  *     __pyx_result = ProbabilisticDirectionGetter.__new__(__pyx_type)
5468  */
5469     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
5470     __Pyx_GOTREF(__pyx_t_2);
5471     __Pyx_INCREF(__pyx_n_s_PickleError);
5472     __Pyx_GIVEREF(__pyx_n_s_PickleError);
5473     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
5474     __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
5475     __Pyx_GOTREF(__pyx_t_3);
5476     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5477     __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
5478     __Pyx_GOTREF(__pyx_t_2);
5479     __Pyx_INCREF(__pyx_t_2);
5480     __pyx_v___pyx_PickleError = __pyx_t_2;
5481     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5482     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5483 
5484     /* "(tree fragment)":6
5485  *     if __pyx_checksum != 0xd86c5c3:
5486  *         from pickle import PickleError as __pyx_PickleError
5487  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd86c5c3 = (_adj_matrix, _pf_kwargs, cos_similarity, pmf_gen, pmf_threshold, sphere, vertices))" % __pyx_checksum)             # <<<<<<<<<<<<<<
5488  *     __pyx_result = ProbabilisticDirectionGetter.__new__(__pyx_type)
5489  *     if __pyx_state is not None:
5490  */
5491     __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
5492     __Pyx_GOTREF(__pyx_t_2);
5493     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd8, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
5494     __Pyx_GOTREF(__pyx_t_4);
5495     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5496     __Pyx_INCREF(__pyx_v___pyx_PickleError);
5497     __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
5498     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
5499       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
5500       if (likely(__pyx_t_5)) {
5501         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5502         __Pyx_INCREF(__pyx_t_5);
5503         __Pyx_INCREF(function);
5504         __Pyx_DECREF_SET(__pyx_t_2, function);
5505       }
5506     }
5507     __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);
5508     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5509     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5510     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
5511     __Pyx_GOTREF(__pyx_t_3);
5512     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5513     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5514     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5515     __PYX_ERR(1, 6, __pyx_L1_error)
5516 
5517     /* "(tree fragment)":4
5518  *     cdef object __pyx_PickleError
5519  *     cdef object __pyx_result
5520  *     if __pyx_checksum != 0xd86c5c3:             # <<<<<<<<<<<<<<
5521  *         from pickle import PickleError as __pyx_PickleError
5522  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd86c5c3 = (_adj_matrix, _pf_kwargs, cos_similarity, pmf_gen, pmf_threshold, sphere, vertices))" % __pyx_checksum)
5523  */
5524   }
5525 
5526   /* "(tree fragment)":7
5527  *         from pickle import PickleError as __pyx_PickleError
5528  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd86c5c3 = (_adj_matrix, _pf_kwargs, cos_similarity, pmf_gen, pmf_threshold, sphere, vertices))" % __pyx_checksum)
5529  *     __pyx_result = ProbabilisticDirectionGetter.__new__(__pyx_type)             # <<<<<<<<<<<<<<
5530  *     if __pyx_state is not None:
5531  *         __pyx_unpickle_ProbabilisticDirectionGetter__set_state(<ProbabilisticDirectionGetter> __pyx_result, __pyx_state)
5532  */
5533   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
5534   __Pyx_GOTREF(__pyx_t_2);
5535   __pyx_t_4 = NULL;
5536   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5537     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
5538     if (likely(__pyx_t_4)) {
5539       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5540       __Pyx_INCREF(__pyx_t_4);
5541       __Pyx_INCREF(function);
5542       __Pyx_DECREF_SET(__pyx_t_2, function);
5543     }
5544   }
5545   __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);
5546   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5547   if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
5548   __Pyx_GOTREF(__pyx_t_3);
5549   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5550   __pyx_v___pyx_result = __pyx_t_3;
5551   __pyx_t_3 = 0;
5552 
5553   /* "(tree fragment)":8
5554  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd86c5c3 = (_adj_matrix, _pf_kwargs, cos_similarity, pmf_gen, pmf_threshold, sphere, vertices))" % __pyx_checksum)
5555  *     __pyx_result = ProbabilisticDirectionGetter.__new__(__pyx_type)
5556  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
5557  *         __pyx_unpickle_ProbabilisticDirectionGetter__set_state(<ProbabilisticDirectionGetter> __pyx_result, __pyx_state)
5558  *     return __pyx_result
5559  */
5560   __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
5561   __pyx_t_6 = (__pyx_t_1 != 0);
5562   if (__pyx_t_6) {
5563 
5564     /* "(tree fragment)":9
5565  *     __pyx_result = ProbabilisticDirectionGetter.__new__(__pyx_type)
5566  *     if __pyx_state is not None:
5567  *         __pyx_unpickle_ProbabilisticDirectionGetter__set_state(<ProbabilisticDirectionGetter> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
5568  *     return __pyx_result
5569  * cdef __pyx_unpickle_ProbabilisticDirectionGetter__set_state(ProbabilisticDirectionGetter __pyx_result, tuple __pyx_state):
5570  */
5571     if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
5572     __pyx_t_3 = __pyx_f_4dipy_9direction_30probabilistic_direction_getter___pyx_unpickle_ProbabilisticDirectionGetter__set_state(((struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
5573     __Pyx_GOTREF(__pyx_t_3);
5574     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5575 
5576     /* "(tree fragment)":8
5577  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd86c5c3 = (_adj_matrix, _pf_kwargs, cos_similarity, pmf_gen, pmf_threshold, sphere, vertices))" % __pyx_checksum)
5578  *     __pyx_result = ProbabilisticDirectionGetter.__new__(__pyx_type)
5579  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
5580  *         __pyx_unpickle_ProbabilisticDirectionGetter__set_state(<ProbabilisticDirectionGetter> __pyx_result, __pyx_state)
5581  *     return __pyx_result
5582  */
5583   }
5584 
5585   /* "(tree fragment)":10
5586  *     if __pyx_state is not None:
5587  *         __pyx_unpickle_ProbabilisticDirectionGetter__set_state(<ProbabilisticDirectionGetter> __pyx_result, __pyx_state)
5588  *     return __pyx_result             # <<<<<<<<<<<<<<
5589  * cdef __pyx_unpickle_ProbabilisticDirectionGetter__set_state(ProbabilisticDirectionGetter __pyx_result, tuple __pyx_state):
5590  *     __pyx_result._adj_matrix = __pyx_state[0]; __pyx_result._pf_kwargs = __pyx_state[1]; __pyx_result.cos_similarity = __pyx_state[2]; __pyx_result.pmf_gen = __pyx_state[3]; __pyx_result.pmf_threshold = __pyx_state[4]; __pyx_result.sphere = __pyx_state[5]; __pyx_result.vertices = __pyx_state[6]
5591  */
5592   __Pyx_XDECREF(__pyx_r);
5593   __Pyx_INCREF(__pyx_v___pyx_result);
5594   __pyx_r = __pyx_v___pyx_result;
5595   goto __pyx_L0;
5596 
5597   /* "(tree fragment)":1
5598  * def __pyx_unpickle_ProbabilisticDirectionGetter(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
5599  *     cdef object __pyx_PickleError
5600  *     cdef object __pyx_result
5601  */
5602 
5603   /* function exit code */
5604   __pyx_L1_error:;
5605   __Pyx_XDECREF(__pyx_t_2);
5606   __Pyx_XDECREF(__pyx_t_3);
5607   __Pyx_XDECREF(__pyx_t_4);
5608   __Pyx_XDECREF(__pyx_t_5);
5609   __Pyx_AddTraceback("dipy.direction.probabilistic_direction_getter.__pyx_unpickle_ProbabilisticDirectionGetter", __pyx_clineno, __pyx_lineno, __pyx_filename);
5610   __pyx_r = NULL;
5611   __pyx_L0:;
5612   __Pyx_XDECREF(__pyx_v___pyx_PickleError);
5613   __Pyx_XDECREF(__pyx_v___pyx_result);
5614   __Pyx_XGIVEREF(__pyx_r);
5615   __Pyx_RefNannyFinishContext();
5616   return __pyx_r;
5617 }
5618 
5619 /* "(tree fragment)":11
5620  *         __pyx_unpickle_ProbabilisticDirectionGetter__set_state(<ProbabilisticDirectionGetter> __pyx_result, __pyx_state)
5621  *     return __pyx_result
5622  * cdef __pyx_unpickle_ProbabilisticDirectionGetter__set_state(ProbabilisticDirectionGetter __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
5623  *     __pyx_result._adj_matrix = __pyx_state[0]; __pyx_result._pf_kwargs = __pyx_state[1]; __pyx_result.cos_similarity = __pyx_state[2]; __pyx_result.pmf_gen = __pyx_state[3]; __pyx_result.pmf_threshold = __pyx_state[4]; __pyx_result.sphere = __pyx_state[5]; __pyx_result.vertices = __pyx_state[6]
5624  *     if len(__pyx_state) > 7 and hasattr(__pyx_result, '__dict__'):
5625  */
5626 
__pyx_f_4dipy_9direction_30probabilistic_direction_getter___pyx_unpickle_ProbabilisticDirectionGetter__set_state(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)5627 static PyObject *__pyx_f_4dipy_9direction_30probabilistic_direction_getter___pyx_unpickle_ProbabilisticDirectionGetter__set_state(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
5628   PyObject *__pyx_r = NULL;
5629   __Pyx_RefNannyDeclarations
5630   PyObject *__pyx_t_1 = NULL;
5631   double __pyx_t_2;
5632   __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
5633   int __pyx_t_4;
5634   Py_ssize_t __pyx_t_5;
5635   int __pyx_t_6;
5636   int __pyx_t_7;
5637   PyObject *__pyx_t_8 = NULL;
5638   PyObject *__pyx_t_9 = NULL;
5639   int __pyx_lineno = 0;
5640   const char *__pyx_filename = NULL;
5641   int __pyx_clineno = 0;
5642   __Pyx_RefNannySetupContext("__pyx_unpickle_ProbabilisticDirectionGetter__set_state", 0);
5643 
5644   /* "(tree fragment)":12
5645  *     return __pyx_result
5646  * cdef __pyx_unpickle_ProbabilisticDirectionGetter__set_state(ProbabilisticDirectionGetter __pyx_result, tuple __pyx_state):
5647  *     __pyx_result._adj_matrix = __pyx_state[0]; __pyx_result._pf_kwargs = __pyx_state[1]; __pyx_result.cos_similarity = __pyx_state[2]; __pyx_result.pmf_gen = __pyx_state[3]; __pyx_result.pmf_threshold = __pyx_state[4]; __pyx_result.sphere = __pyx_state[5]; __pyx_result.vertices = __pyx_state[6]             # <<<<<<<<<<<<<<
5648  *     if len(__pyx_state) > 7 and hasattr(__pyx_result, '__dict__'):
5649  *         __pyx_result.__dict__.update(__pyx_state[7])
5650  */
5651   if (unlikely(__pyx_v___pyx_state == Py_None)) {
5652     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5653     __PYX_ERR(1, 12, __pyx_L1_error)
5654   }
5655   if (!(likely(PyDict_CheckExact(PyTuple_GET_ITEM(__pyx_v___pyx_state, 0)))||((PyTuple_GET_ITEM(__pyx_v___pyx_state, 0)) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(PyTuple_GET_ITEM(__pyx_v___pyx_state, 0))->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
5656   __pyx_t_1 = PyTuple_GET_ITEM(__pyx_v___pyx_state, 0);
5657   __Pyx_INCREF(__pyx_t_1);
5658   __Pyx_GIVEREF(__pyx_t_1);
5659   __Pyx_GOTREF(__pyx_v___pyx_result->_adj_matrix);
5660   __Pyx_DECREF(__pyx_v___pyx_result->_adj_matrix);
5661   __pyx_v___pyx_result->_adj_matrix = ((PyObject*)__pyx_t_1);
5662   __pyx_t_1 = 0;
5663   if (unlikely(__pyx_v___pyx_state == Py_None)) {
5664     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5665     __PYX_ERR(1, 12, __pyx_L1_error)
5666   }
5667   if (!(likely(PyDict_CheckExact(PyTuple_GET_ITEM(__pyx_v___pyx_state, 1)))||((PyTuple_GET_ITEM(__pyx_v___pyx_state, 1)) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(PyTuple_GET_ITEM(__pyx_v___pyx_state, 1))->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
5668   __pyx_t_1 = PyTuple_GET_ITEM(__pyx_v___pyx_state, 1);
5669   __Pyx_INCREF(__pyx_t_1);
5670   __Pyx_GIVEREF(__pyx_t_1);
5671   __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base._pf_kwargs);
5672   __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.__pyx_base._pf_kwargs);
5673   __pyx_v___pyx_result->__pyx_base.__pyx_base._pf_kwargs = ((PyObject*)__pyx_t_1);
5674   __pyx_t_1 = 0;
5675   if (unlikely(__pyx_v___pyx_state == Py_None)) {
5676     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5677     __PYX_ERR(1, 12, __pyx_L1_error)
5678   }
5679   __pyx_t_2 = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_v___pyx_state, 2)); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
5680   __pyx_v___pyx_result->__pyx_base.__pyx_base.cos_similarity = __pyx_t_2;
5681   if (unlikely(__pyx_v___pyx_state == Py_None)) {
5682     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5683     __PYX_ERR(1, 12, __pyx_L1_error)
5684   }
5685   if (!(likely(((PyTuple_GET_ITEM(__pyx_v___pyx_state, 3)) == Py_None) || likely(__Pyx_TypeTest(PyTuple_GET_ITEM(__pyx_v___pyx_state, 3), __pyx_ptype_4dipy_9direction_3pmf_PmfGen))))) __PYX_ERR(1, 12, __pyx_L1_error)
5686   __pyx_t_1 = PyTuple_GET_ITEM(__pyx_v___pyx_state, 3);
5687   __Pyx_INCREF(__pyx_t_1);
5688   __Pyx_GIVEREF(__pyx_t_1);
5689   __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.pmf_gen);
5690   __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.pmf_gen));
5691   __pyx_v___pyx_result->__pyx_base.__pyx_base.pmf_gen = ((struct __pyx_obj_4dipy_9direction_3pmf_PmfGen *)__pyx_t_1);
5692   __pyx_t_1 = 0;
5693   if (unlikely(__pyx_v___pyx_state == Py_None)) {
5694     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5695     __PYX_ERR(1, 12, __pyx_L1_error)
5696   }
5697   __pyx_t_2 = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_v___pyx_state, 4)); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
5698   __pyx_v___pyx_result->__pyx_base.__pyx_base.pmf_threshold = __pyx_t_2;
5699   if (unlikely(__pyx_v___pyx_state == Py_None)) {
5700     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5701     __PYX_ERR(1, 12, __pyx_L1_error)
5702   }
5703   __pyx_t_1 = PyTuple_GET_ITEM(__pyx_v___pyx_state, 5);
5704   __Pyx_INCREF(__pyx_t_1);
5705   __Pyx_GIVEREF(__pyx_t_1);
5706   __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.sphere);
5707   __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.sphere);
5708   __pyx_v___pyx_result->__pyx_base.__pyx_base.sphere = __pyx_t_1;
5709   __pyx_t_1 = 0;
5710   if (unlikely(__pyx_v___pyx_state == Py_None)) {
5711     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5712     __PYX_ERR(1, 12, __pyx_L1_error)
5713   }
5714   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(PyTuple_GET_ITEM(__pyx_v___pyx_state, 6), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(1, 12, __pyx_L1_error)
5715   __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->vertices, 0);
5716   __pyx_v___pyx_result->vertices = __pyx_t_3;
5717   __pyx_t_3.memview = NULL;
5718   __pyx_t_3.data = NULL;
5719 
5720   /* "(tree fragment)":13
5721  * cdef __pyx_unpickle_ProbabilisticDirectionGetter__set_state(ProbabilisticDirectionGetter __pyx_result, tuple __pyx_state):
5722  *     __pyx_result._adj_matrix = __pyx_state[0]; __pyx_result._pf_kwargs = __pyx_state[1]; __pyx_result.cos_similarity = __pyx_state[2]; __pyx_result.pmf_gen = __pyx_state[3]; __pyx_result.pmf_threshold = __pyx_state[4]; __pyx_result.sphere = __pyx_state[5]; __pyx_result.vertices = __pyx_state[6]
5723  *     if len(__pyx_state) > 7 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
5724  *         __pyx_result.__dict__.update(__pyx_state[7])
5725  */
5726   if (unlikely(__pyx_v___pyx_state == Py_None)) {
5727     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
5728     __PYX_ERR(1, 13, __pyx_L1_error)
5729   }
5730   __pyx_t_5 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
5731   __pyx_t_6 = ((__pyx_t_5 > 7) != 0);
5732   if (__pyx_t_6) {
5733   } else {
5734     __pyx_t_4 = __pyx_t_6;
5735     goto __pyx_L4_bool_binop_done;
5736   }
5737   __pyx_t_6 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
5738   __pyx_t_7 = (__pyx_t_6 != 0);
5739   __pyx_t_4 = __pyx_t_7;
5740   __pyx_L4_bool_binop_done:;
5741   if (__pyx_t_4) {
5742 
5743     /* "(tree fragment)":14
5744  *     __pyx_result._adj_matrix = __pyx_state[0]; __pyx_result._pf_kwargs = __pyx_state[1]; __pyx_result.cos_similarity = __pyx_state[2]; __pyx_result.pmf_gen = __pyx_state[3]; __pyx_result.pmf_threshold = __pyx_state[4]; __pyx_result.sphere = __pyx_state[5]; __pyx_result.vertices = __pyx_state[6]
5745  *     if len(__pyx_state) > 7 and hasattr(__pyx_result, '__dict__'):
5746  *         __pyx_result.__dict__.update(__pyx_state[7])             # <<<<<<<<<<<<<<
5747  */
5748     __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
5749     __Pyx_GOTREF(__pyx_t_8);
5750     __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_update); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 14, __pyx_L1_error)
5751     __Pyx_GOTREF(__pyx_t_9);
5752     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5753     if (unlikely(__pyx_v___pyx_state == Py_None)) {
5754       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5755       __PYX_ERR(1, 14, __pyx_L1_error)
5756     }
5757     __pyx_t_8 = NULL;
5758     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
5759       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
5760       if (likely(__pyx_t_8)) {
5761         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
5762         __Pyx_INCREF(__pyx_t_8);
5763         __Pyx_INCREF(function);
5764         __Pyx_DECREF_SET(__pyx_t_9, function);
5765       }
5766     }
5767     __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_8, PyTuple_GET_ITEM(__pyx_v___pyx_state, 7)) : __Pyx_PyObject_CallOneArg(__pyx_t_9, PyTuple_GET_ITEM(__pyx_v___pyx_state, 7));
5768     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
5769     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
5770     __Pyx_GOTREF(__pyx_t_1);
5771     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5772     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5773 
5774     /* "(tree fragment)":13
5775  * cdef __pyx_unpickle_ProbabilisticDirectionGetter__set_state(ProbabilisticDirectionGetter __pyx_result, tuple __pyx_state):
5776  *     __pyx_result._adj_matrix = __pyx_state[0]; __pyx_result._pf_kwargs = __pyx_state[1]; __pyx_result.cos_similarity = __pyx_state[2]; __pyx_result.pmf_gen = __pyx_state[3]; __pyx_result.pmf_threshold = __pyx_state[4]; __pyx_result.sphere = __pyx_state[5]; __pyx_result.vertices = __pyx_state[6]
5777  *     if len(__pyx_state) > 7 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
5778  *         __pyx_result.__dict__.update(__pyx_state[7])
5779  */
5780   }
5781 
5782   /* "(tree fragment)":11
5783  *         __pyx_unpickle_ProbabilisticDirectionGetter__set_state(<ProbabilisticDirectionGetter> __pyx_result, __pyx_state)
5784  *     return __pyx_result
5785  * cdef __pyx_unpickle_ProbabilisticDirectionGetter__set_state(ProbabilisticDirectionGetter __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
5786  *     __pyx_result._adj_matrix = __pyx_state[0]; __pyx_result._pf_kwargs = __pyx_state[1]; __pyx_result.cos_similarity = __pyx_state[2]; __pyx_result.pmf_gen = __pyx_state[3]; __pyx_result.pmf_threshold = __pyx_state[4]; __pyx_result.sphere = __pyx_state[5]; __pyx_result.vertices = __pyx_state[6]
5787  *     if len(__pyx_state) > 7 and hasattr(__pyx_result, '__dict__'):
5788  */
5789 
5790   /* function exit code */
5791   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5792   goto __pyx_L0;
5793   __pyx_L1_error:;
5794   __Pyx_XDECREF(__pyx_t_1);
5795   __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
5796   __Pyx_XDECREF(__pyx_t_8);
5797   __Pyx_XDECREF(__pyx_t_9);
5798   __Pyx_AddTraceback("dipy.direction.probabilistic_direction_getter.__pyx_unpickle_ProbabilisticDirectionGetter__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
5799   __pyx_r = 0;
5800   __pyx_L0:;
5801   __Pyx_XGIVEREF(__pyx_r);
5802   __Pyx_RefNannyFinishContext();
5803   return __pyx_r;
5804 }
5805 
5806 /* "(tree fragment)":1
5807  * def __pyx_unpickle_DeterministicMaximumDirectionGetter(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
5808  *     cdef object __pyx_PickleError
5809  *     cdef object __pyx_result
5810  */
5811 
5812 /* Python wrapper */
5813 static PyObject *__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_3__pyx_unpickle_DeterministicMaximumDirectionGetter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5814 static PyMethodDef __pyx_mdef_4dipy_9direction_30probabilistic_direction_getter_3__pyx_unpickle_DeterministicMaximumDirectionGetter = {"__pyx_unpickle_DeterministicMaximumDirectionGetter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_3__pyx_unpickle_DeterministicMaximumDirectionGetter, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_3__pyx_unpickle_DeterministicMaximumDirectionGetter(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)5815 static PyObject *__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_3__pyx_unpickle_DeterministicMaximumDirectionGetter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5816   PyObject *__pyx_v___pyx_type = 0;
5817   long __pyx_v___pyx_checksum;
5818   PyObject *__pyx_v___pyx_state = 0;
5819   int __pyx_lineno = 0;
5820   const char *__pyx_filename = NULL;
5821   int __pyx_clineno = 0;
5822   PyObject *__pyx_r = 0;
5823   __Pyx_RefNannyDeclarations
5824   __Pyx_RefNannySetupContext("__pyx_unpickle_DeterministicMaximumDirectionGetter (wrapper)", 0);
5825   {
5826     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
5827     PyObject* values[3] = {0,0,0};
5828     if (unlikely(__pyx_kwds)) {
5829       Py_ssize_t kw_args;
5830       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5831       switch (pos_args) {
5832         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5833         CYTHON_FALLTHROUGH;
5834         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5835         CYTHON_FALLTHROUGH;
5836         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5837         CYTHON_FALLTHROUGH;
5838         case  0: break;
5839         default: goto __pyx_L5_argtuple_error;
5840       }
5841       kw_args = PyDict_Size(__pyx_kwds);
5842       switch (pos_args) {
5843         case  0:
5844         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
5845         else goto __pyx_L5_argtuple_error;
5846         CYTHON_FALLTHROUGH;
5847         case  1:
5848         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
5849         else {
5850           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_DeterministicMaximumDirectionGetter", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
5851         }
5852         CYTHON_FALLTHROUGH;
5853         case  2:
5854         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
5855         else {
5856           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_DeterministicMaximumDirectionGetter", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
5857         }
5858       }
5859       if (unlikely(kw_args > 0)) {
5860         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_DeterministicMaximumDirectionGetter") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
5861       }
5862     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
5863       goto __pyx_L5_argtuple_error;
5864     } else {
5865       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5866       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5867       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5868     }
5869     __pyx_v___pyx_type = values[0];
5870     __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
5871     __pyx_v___pyx_state = values[2];
5872   }
5873   goto __pyx_L4_argument_unpacking_done;
5874   __pyx_L5_argtuple_error:;
5875   __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_DeterministicMaximumDirectionGetter", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
5876   __pyx_L3_error:;
5877   __Pyx_AddTraceback("dipy.direction.probabilistic_direction_getter.__pyx_unpickle_DeterministicMaximumDirectionGetter", __pyx_clineno, __pyx_lineno, __pyx_filename);
5878   __Pyx_RefNannyFinishContext();
5879   return NULL;
5880   __pyx_L4_argument_unpacking_done:;
5881   __pyx_r = __pyx_pf_4dipy_9direction_30probabilistic_direction_getter_2__pyx_unpickle_DeterministicMaximumDirectionGetter(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
5882 
5883   /* function exit code */
5884   __Pyx_RefNannyFinishContext();
5885   return __pyx_r;
5886 }
5887 
__pyx_pf_4dipy_9direction_30probabilistic_direction_getter_2__pyx_unpickle_DeterministicMaximumDirectionGetter(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v___pyx_type,long __pyx_v___pyx_checksum,PyObject * __pyx_v___pyx_state)5888 static PyObject *__pyx_pf_4dipy_9direction_30probabilistic_direction_getter_2__pyx_unpickle_DeterministicMaximumDirectionGetter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
5889   PyObject *__pyx_v___pyx_PickleError = 0;
5890   PyObject *__pyx_v___pyx_result = 0;
5891   PyObject *__pyx_r = NULL;
5892   __Pyx_RefNannyDeclarations
5893   int __pyx_t_1;
5894   PyObject *__pyx_t_2 = NULL;
5895   PyObject *__pyx_t_3 = NULL;
5896   PyObject *__pyx_t_4 = NULL;
5897   PyObject *__pyx_t_5 = NULL;
5898   int __pyx_t_6;
5899   int __pyx_lineno = 0;
5900   const char *__pyx_filename = NULL;
5901   int __pyx_clineno = 0;
5902   __Pyx_RefNannySetupContext("__pyx_unpickle_DeterministicMaximumDirectionGetter", 0);
5903 
5904   /* "(tree fragment)":4
5905  *     cdef object __pyx_PickleError
5906  *     cdef object __pyx_result
5907  *     if __pyx_checksum != 0xd86c5c3:             # <<<<<<<<<<<<<<
5908  *         from pickle import PickleError as __pyx_PickleError
5909  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd86c5c3 = (_adj_matrix, _pf_kwargs, cos_similarity, pmf_gen, pmf_threshold, sphere, vertices))" % __pyx_checksum)
5910  */
5911   __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd86c5c3) != 0);
5912   if (__pyx_t_1) {
5913 
5914     /* "(tree fragment)":5
5915  *     cdef object __pyx_result
5916  *     if __pyx_checksum != 0xd86c5c3:
5917  *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
5918  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd86c5c3 = (_adj_matrix, _pf_kwargs, cos_similarity, pmf_gen, pmf_threshold, sphere, vertices))" % __pyx_checksum)
5919  *     __pyx_result = DeterministicMaximumDirectionGetter.__new__(__pyx_type)
5920  */
5921     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
5922     __Pyx_GOTREF(__pyx_t_2);
5923     __Pyx_INCREF(__pyx_n_s_PickleError);
5924     __Pyx_GIVEREF(__pyx_n_s_PickleError);
5925     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
5926     __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
5927     __Pyx_GOTREF(__pyx_t_3);
5928     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5929     __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
5930     __Pyx_GOTREF(__pyx_t_2);
5931     __Pyx_INCREF(__pyx_t_2);
5932     __pyx_v___pyx_PickleError = __pyx_t_2;
5933     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5934     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5935 
5936     /* "(tree fragment)":6
5937  *     if __pyx_checksum != 0xd86c5c3:
5938  *         from pickle import PickleError as __pyx_PickleError
5939  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd86c5c3 = (_adj_matrix, _pf_kwargs, cos_similarity, pmf_gen, pmf_threshold, sphere, vertices))" % __pyx_checksum)             # <<<<<<<<<<<<<<
5940  *     __pyx_result = DeterministicMaximumDirectionGetter.__new__(__pyx_type)
5941  *     if __pyx_state is not None:
5942  */
5943     __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
5944     __Pyx_GOTREF(__pyx_t_2);
5945     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd8, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
5946     __Pyx_GOTREF(__pyx_t_4);
5947     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5948     __Pyx_INCREF(__pyx_v___pyx_PickleError);
5949     __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
5950     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
5951       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
5952       if (likely(__pyx_t_5)) {
5953         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5954         __Pyx_INCREF(__pyx_t_5);
5955         __Pyx_INCREF(function);
5956         __Pyx_DECREF_SET(__pyx_t_2, function);
5957       }
5958     }
5959     __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);
5960     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5961     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5962     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
5963     __Pyx_GOTREF(__pyx_t_3);
5964     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5965     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5966     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5967     __PYX_ERR(1, 6, __pyx_L1_error)
5968 
5969     /* "(tree fragment)":4
5970  *     cdef object __pyx_PickleError
5971  *     cdef object __pyx_result
5972  *     if __pyx_checksum != 0xd86c5c3:             # <<<<<<<<<<<<<<
5973  *         from pickle import PickleError as __pyx_PickleError
5974  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd86c5c3 = (_adj_matrix, _pf_kwargs, cos_similarity, pmf_gen, pmf_threshold, sphere, vertices))" % __pyx_checksum)
5975  */
5976   }
5977 
5978   /* "(tree fragment)":7
5979  *         from pickle import PickleError as __pyx_PickleError
5980  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd86c5c3 = (_adj_matrix, _pf_kwargs, cos_similarity, pmf_gen, pmf_threshold, sphere, vertices))" % __pyx_checksum)
5981  *     __pyx_result = DeterministicMaximumDirectionGetter.__new__(__pyx_type)             # <<<<<<<<<<<<<<
5982  *     if __pyx_state is not None:
5983  *         __pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(<DeterministicMaximumDirectionGetter> __pyx_result, __pyx_state)
5984  */
5985   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
5986   __Pyx_GOTREF(__pyx_t_2);
5987   __pyx_t_4 = NULL;
5988   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5989     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
5990     if (likely(__pyx_t_4)) {
5991       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5992       __Pyx_INCREF(__pyx_t_4);
5993       __Pyx_INCREF(function);
5994       __Pyx_DECREF_SET(__pyx_t_2, function);
5995     }
5996   }
5997   __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);
5998   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5999   if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
6000   __Pyx_GOTREF(__pyx_t_3);
6001   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6002   __pyx_v___pyx_result = __pyx_t_3;
6003   __pyx_t_3 = 0;
6004 
6005   /* "(tree fragment)":8
6006  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd86c5c3 = (_adj_matrix, _pf_kwargs, cos_similarity, pmf_gen, pmf_threshold, sphere, vertices))" % __pyx_checksum)
6007  *     __pyx_result = DeterministicMaximumDirectionGetter.__new__(__pyx_type)
6008  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
6009  *         __pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(<DeterministicMaximumDirectionGetter> __pyx_result, __pyx_state)
6010  *     return __pyx_result
6011  */
6012   __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
6013   __pyx_t_6 = (__pyx_t_1 != 0);
6014   if (__pyx_t_6) {
6015 
6016     /* "(tree fragment)":9
6017  *     __pyx_result = DeterministicMaximumDirectionGetter.__new__(__pyx_type)
6018  *     if __pyx_state is not None:
6019  *         __pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(<DeterministicMaximumDirectionGetter> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
6020  *     return __pyx_result
6021  * cdef __pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(DeterministicMaximumDirectionGetter __pyx_result, tuple __pyx_state):
6022  */
6023     if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
6024     __pyx_t_3 = __pyx_f_4dipy_9direction_30probabilistic_direction_getter___pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(((struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
6025     __Pyx_GOTREF(__pyx_t_3);
6026     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6027 
6028     /* "(tree fragment)":8
6029  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd86c5c3 = (_adj_matrix, _pf_kwargs, cos_similarity, pmf_gen, pmf_threshold, sphere, vertices))" % __pyx_checksum)
6030  *     __pyx_result = DeterministicMaximumDirectionGetter.__new__(__pyx_type)
6031  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
6032  *         __pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(<DeterministicMaximumDirectionGetter> __pyx_result, __pyx_state)
6033  *     return __pyx_result
6034  */
6035   }
6036 
6037   /* "(tree fragment)":10
6038  *     if __pyx_state is not None:
6039  *         __pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(<DeterministicMaximumDirectionGetter> __pyx_result, __pyx_state)
6040  *     return __pyx_result             # <<<<<<<<<<<<<<
6041  * cdef __pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(DeterministicMaximumDirectionGetter __pyx_result, tuple __pyx_state):
6042  *     __pyx_result._adj_matrix = __pyx_state[0]; __pyx_result._pf_kwargs = __pyx_state[1]; __pyx_result.cos_similarity = __pyx_state[2]; __pyx_result.pmf_gen = __pyx_state[3]; __pyx_result.pmf_threshold = __pyx_state[4]; __pyx_result.sphere = __pyx_state[5]; __pyx_result.vertices = __pyx_state[6]
6043  */
6044   __Pyx_XDECREF(__pyx_r);
6045   __Pyx_INCREF(__pyx_v___pyx_result);
6046   __pyx_r = __pyx_v___pyx_result;
6047   goto __pyx_L0;
6048 
6049   /* "(tree fragment)":1
6050  * def __pyx_unpickle_DeterministicMaximumDirectionGetter(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
6051  *     cdef object __pyx_PickleError
6052  *     cdef object __pyx_result
6053  */
6054 
6055   /* function exit code */
6056   __pyx_L1_error:;
6057   __Pyx_XDECREF(__pyx_t_2);
6058   __Pyx_XDECREF(__pyx_t_3);
6059   __Pyx_XDECREF(__pyx_t_4);
6060   __Pyx_XDECREF(__pyx_t_5);
6061   __Pyx_AddTraceback("dipy.direction.probabilistic_direction_getter.__pyx_unpickle_DeterministicMaximumDirectionGetter", __pyx_clineno, __pyx_lineno, __pyx_filename);
6062   __pyx_r = NULL;
6063   __pyx_L0:;
6064   __Pyx_XDECREF(__pyx_v___pyx_PickleError);
6065   __Pyx_XDECREF(__pyx_v___pyx_result);
6066   __Pyx_XGIVEREF(__pyx_r);
6067   __Pyx_RefNannyFinishContext();
6068   return __pyx_r;
6069 }
6070 
6071 /* "(tree fragment)":11
6072  *         __pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(<DeterministicMaximumDirectionGetter> __pyx_result, __pyx_state)
6073  *     return __pyx_result
6074  * cdef __pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(DeterministicMaximumDirectionGetter __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
6075  *     __pyx_result._adj_matrix = __pyx_state[0]; __pyx_result._pf_kwargs = __pyx_state[1]; __pyx_result.cos_similarity = __pyx_state[2]; __pyx_result.pmf_gen = __pyx_state[3]; __pyx_result.pmf_threshold = __pyx_state[4]; __pyx_result.sphere = __pyx_state[5]; __pyx_result.vertices = __pyx_state[6]
6076  *     if len(__pyx_state) > 7 and hasattr(__pyx_result, '__dict__'):
6077  */
6078 
__pyx_f_4dipy_9direction_30probabilistic_direction_getter___pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)6079 static PyObject *__pyx_f_4dipy_9direction_30probabilistic_direction_getter___pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
6080   PyObject *__pyx_r = NULL;
6081   __Pyx_RefNannyDeclarations
6082   PyObject *__pyx_t_1 = NULL;
6083   double __pyx_t_2;
6084   __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
6085   int __pyx_t_4;
6086   Py_ssize_t __pyx_t_5;
6087   int __pyx_t_6;
6088   int __pyx_t_7;
6089   PyObject *__pyx_t_8 = NULL;
6090   PyObject *__pyx_t_9 = NULL;
6091   int __pyx_lineno = 0;
6092   const char *__pyx_filename = NULL;
6093   int __pyx_clineno = 0;
6094   __Pyx_RefNannySetupContext("__pyx_unpickle_DeterministicMaximumDirectionGetter__set_state", 0);
6095 
6096   /* "(tree fragment)":12
6097  *     return __pyx_result
6098  * cdef __pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(DeterministicMaximumDirectionGetter __pyx_result, tuple __pyx_state):
6099  *     __pyx_result._adj_matrix = __pyx_state[0]; __pyx_result._pf_kwargs = __pyx_state[1]; __pyx_result.cos_similarity = __pyx_state[2]; __pyx_result.pmf_gen = __pyx_state[3]; __pyx_result.pmf_threshold = __pyx_state[4]; __pyx_result.sphere = __pyx_state[5]; __pyx_result.vertices = __pyx_state[6]             # <<<<<<<<<<<<<<
6100  *     if len(__pyx_state) > 7 and hasattr(__pyx_result, '__dict__'):
6101  *         __pyx_result.__dict__.update(__pyx_state[7])
6102  */
6103   if (unlikely(__pyx_v___pyx_state == Py_None)) {
6104     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6105     __PYX_ERR(1, 12, __pyx_L1_error)
6106   }
6107   if (!(likely(PyDict_CheckExact(PyTuple_GET_ITEM(__pyx_v___pyx_state, 0)))||((PyTuple_GET_ITEM(__pyx_v___pyx_state, 0)) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(PyTuple_GET_ITEM(__pyx_v___pyx_state, 0))->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
6108   __pyx_t_1 = PyTuple_GET_ITEM(__pyx_v___pyx_state, 0);
6109   __Pyx_INCREF(__pyx_t_1);
6110   __Pyx_GIVEREF(__pyx_t_1);
6111   __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base._adj_matrix);
6112   __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base._adj_matrix);
6113   __pyx_v___pyx_result->__pyx_base._adj_matrix = ((PyObject*)__pyx_t_1);
6114   __pyx_t_1 = 0;
6115   if (unlikely(__pyx_v___pyx_state == Py_None)) {
6116     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6117     __PYX_ERR(1, 12, __pyx_L1_error)
6118   }
6119   if (!(likely(PyDict_CheckExact(PyTuple_GET_ITEM(__pyx_v___pyx_state, 1)))||((PyTuple_GET_ITEM(__pyx_v___pyx_state, 1)) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(PyTuple_GET_ITEM(__pyx_v___pyx_state, 1))->tp_name), 0))) __PYX_ERR(1, 12, __pyx_L1_error)
6120   __pyx_t_1 = PyTuple_GET_ITEM(__pyx_v___pyx_state, 1);
6121   __Pyx_INCREF(__pyx_t_1);
6122   __Pyx_GIVEREF(__pyx_t_1);
6123   __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.__pyx_base._pf_kwargs);
6124   __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.__pyx_base._pf_kwargs);
6125   __pyx_v___pyx_result->__pyx_base.__pyx_base.__pyx_base._pf_kwargs = ((PyObject*)__pyx_t_1);
6126   __pyx_t_1 = 0;
6127   if (unlikely(__pyx_v___pyx_state == Py_None)) {
6128     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6129     __PYX_ERR(1, 12, __pyx_L1_error)
6130   }
6131   __pyx_t_2 = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_v___pyx_state, 2)); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
6132   __pyx_v___pyx_result->__pyx_base.__pyx_base.__pyx_base.cos_similarity = __pyx_t_2;
6133   if (unlikely(__pyx_v___pyx_state == Py_None)) {
6134     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6135     __PYX_ERR(1, 12, __pyx_L1_error)
6136   }
6137   if (!(likely(((PyTuple_GET_ITEM(__pyx_v___pyx_state, 3)) == Py_None) || likely(__Pyx_TypeTest(PyTuple_GET_ITEM(__pyx_v___pyx_state, 3), __pyx_ptype_4dipy_9direction_3pmf_PmfGen))))) __PYX_ERR(1, 12, __pyx_L1_error)
6138   __pyx_t_1 = PyTuple_GET_ITEM(__pyx_v___pyx_state, 3);
6139   __Pyx_INCREF(__pyx_t_1);
6140   __Pyx_GIVEREF(__pyx_t_1);
6141   __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.__pyx_base.pmf_gen);
6142   __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->__pyx_base.__pyx_base.__pyx_base.pmf_gen));
6143   __pyx_v___pyx_result->__pyx_base.__pyx_base.__pyx_base.pmf_gen = ((struct __pyx_obj_4dipy_9direction_3pmf_PmfGen *)__pyx_t_1);
6144   __pyx_t_1 = 0;
6145   if (unlikely(__pyx_v___pyx_state == Py_None)) {
6146     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6147     __PYX_ERR(1, 12, __pyx_L1_error)
6148   }
6149   __pyx_t_2 = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_v___pyx_state, 4)); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
6150   __pyx_v___pyx_result->__pyx_base.__pyx_base.__pyx_base.pmf_threshold = __pyx_t_2;
6151   if (unlikely(__pyx_v___pyx_state == Py_None)) {
6152     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6153     __PYX_ERR(1, 12, __pyx_L1_error)
6154   }
6155   __pyx_t_1 = PyTuple_GET_ITEM(__pyx_v___pyx_state, 5);
6156   __Pyx_INCREF(__pyx_t_1);
6157   __Pyx_GIVEREF(__pyx_t_1);
6158   __Pyx_GOTREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.__pyx_base.sphere);
6159   __Pyx_DECREF(__pyx_v___pyx_result->__pyx_base.__pyx_base.__pyx_base.sphere);
6160   __pyx_v___pyx_result->__pyx_base.__pyx_base.__pyx_base.sphere = __pyx_t_1;
6161   __pyx_t_1 = 0;
6162   if (unlikely(__pyx_v___pyx_state == Py_None)) {
6163     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6164     __PYX_ERR(1, 12, __pyx_L1_error)
6165   }
6166   __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(PyTuple_GET_ITEM(__pyx_v___pyx_state, 6), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(1, 12, __pyx_L1_error)
6167   __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->__pyx_base.vertices, 0);
6168   __pyx_v___pyx_result->__pyx_base.vertices = __pyx_t_3;
6169   __pyx_t_3.memview = NULL;
6170   __pyx_t_3.data = NULL;
6171 
6172   /* "(tree fragment)":13
6173  * cdef __pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(DeterministicMaximumDirectionGetter __pyx_result, tuple __pyx_state):
6174  *     __pyx_result._adj_matrix = __pyx_state[0]; __pyx_result._pf_kwargs = __pyx_state[1]; __pyx_result.cos_similarity = __pyx_state[2]; __pyx_result.pmf_gen = __pyx_state[3]; __pyx_result.pmf_threshold = __pyx_state[4]; __pyx_result.sphere = __pyx_state[5]; __pyx_result.vertices = __pyx_state[6]
6175  *     if len(__pyx_state) > 7 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
6176  *         __pyx_result.__dict__.update(__pyx_state[7])
6177  */
6178   if (unlikely(__pyx_v___pyx_state == Py_None)) {
6179     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
6180     __PYX_ERR(1, 13, __pyx_L1_error)
6181   }
6182   __pyx_t_5 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
6183   __pyx_t_6 = ((__pyx_t_5 > 7) != 0);
6184   if (__pyx_t_6) {
6185   } else {
6186     __pyx_t_4 = __pyx_t_6;
6187     goto __pyx_L4_bool_binop_done;
6188   }
6189   __pyx_t_6 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
6190   __pyx_t_7 = (__pyx_t_6 != 0);
6191   __pyx_t_4 = __pyx_t_7;
6192   __pyx_L4_bool_binop_done:;
6193   if (__pyx_t_4) {
6194 
6195     /* "(tree fragment)":14
6196  *     __pyx_result._adj_matrix = __pyx_state[0]; __pyx_result._pf_kwargs = __pyx_state[1]; __pyx_result.cos_similarity = __pyx_state[2]; __pyx_result.pmf_gen = __pyx_state[3]; __pyx_result.pmf_threshold = __pyx_state[4]; __pyx_result.sphere = __pyx_state[5]; __pyx_result.vertices = __pyx_state[6]
6197  *     if len(__pyx_state) > 7 and hasattr(__pyx_result, '__dict__'):
6198  *         __pyx_result.__dict__.update(__pyx_state[7])             # <<<<<<<<<<<<<<
6199  */
6200     __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 14, __pyx_L1_error)
6201     __Pyx_GOTREF(__pyx_t_8);
6202     __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_update); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 14, __pyx_L1_error)
6203     __Pyx_GOTREF(__pyx_t_9);
6204     __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6205     if (unlikely(__pyx_v___pyx_state == Py_None)) {
6206       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6207       __PYX_ERR(1, 14, __pyx_L1_error)
6208     }
6209     __pyx_t_8 = NULL;
6210     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
6211       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
6212       if (likely(__pyx_t_8)) {
6213         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
6214         __Pyx_INCREF(__pyx_t_8);
6215         __Pyx_INCREF(function);
6216         __Pyx_DECREF_SET(__pyx_t_9, function);
6217       }
6218     }
6219     __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_8, PyTuple_GET_ITEM(__pyx_v___pyx_state, 7)) : __Pyx_PyObject_CallOneArg(__pyx_t_9, PyTuple_GET_ITEM(__pyx_v___pyx_state, 7));
6220     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
6221     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
6222     __Pyx_GOTREF(__pyx_t_1);
6223     __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6224     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6225 
6226     /* "(tree fragment)":13
6227  * cdef __pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(DeterministicMaximumDirectionGetter __pyx_result, tuple __pyx_state):
6228  *     __pyx_result._adj_matrix = __pyx_state[0]; __pyx_result._pf_kwargs = __pyx_state[1]; __pyx_result.cos_similarity = __pyx_state[2]; __pyx_result.pmf_gen = __pyx_state[3]; __pyx_result.pmf_threshold = __pyx_state[4]; __pyx_result.sphere = __pyx_state[5]; __pyx_result.vertices = __pyx_state[6]
6229  *     if len(__pyx_state) > 7 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
6230  *         __pyx_result.__dict__.update(__pyx_state[7])
6231  */
6232   }
6233 
6234   /* "(tree fragment)":11
6235  *         __pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(<DeterministicMaximumDirectionGetter> __pyx_result, __pyx_state)
6236  *     return __pyx_result
6237  * cdef __pyx_unpickle_DeterministicMaximumDirectionGetter__set_state(DeterministicMaximumDirectionGetter __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
6238  *     __pyx_result._adj_matrix = __pyx_state[0]; __pyx_result._pf_kwargs = __pyx_state[1]; __pyx_result.cos_similarity = __pyx_state[2]; __pyx_result.pmf_gen = __pyx_state[3]; __pyx_result.pmf_threshold = __pyx_state[4]; __pyx_result.sphere = __pyx_state[5]; __pyx_result.vertices = __pyx_state[6]
6239  *     if len(__pyx_state) > 7 and hasattr(__pyx_result, '__dict__'):
6240  */
6241 
6242   /* function exit code */
6243   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6244   goto __pyx_L0;
6245   __pyx_L1_error:;
6246   __Pyx_XDECREF(__pyx_t_1);
6247   __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
6248   __Pyx_XDECREF(__pyx_t_8);
6249   __Pyx_XDECREF(__pyx_t_9);
6250   __Pyx_AddTraceback("dipy.direction.probabilistic_direction_getter.__pyx_unpickle_DeterministicMaximumDirectionGetter__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
6251   __pyx_r = 0;
6252   __pyx_L0:;
6253   __Pyx_XGIVEREF(__pyx_r);
6254   __Pyx_RefNannyFinishContext();
6255   return __pyx_r;
6256 }
6257 
6258 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":735
6259  * ctypedef npy_cdouble     complex_t
6260  *
6261  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
6262  *     return PyArray_MultiIterNew(1, <void*>a)
6263  *
6264  */
6265 
__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject * __pyx_v_a)6266 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
6267   PyObject *__pyx_r = NULL;
6268   __Pyx_RefNannyDeclarations
6269   PyObject *__pyx_t_1 = NULL;
6270   int __pyx_lineno = 0;
6271   const char *__pyx_filename = NULL;
6272   int __pyx_clineno = 0;
6273   __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
6274 
6275   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":736
6276  *
6277  * cdef inline object PyArray_MultiIterNew1(a):
6278  *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
6279  *
6280  * cdef inline object PyArray_MultiIterNew2(a, b):
6281  */
6282   __Pyx_XDECREF(__pyx_r);
6283   __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 736, __pyx_L1_error)
6284   __Pyx_GOTREF(__pyx_t_1);
6285   __pyx_r = __pyx_t_1;
6286   __pyx_t_1 = 0;
6287   goto __pyx_L0;
6288 
6289   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":735
6290  * ctypedef npy_cdouble     complex_t
6291  *
6292  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
6293  *     return PyArray_MultiIterNew(1, <void*>a)
6294  *
6295  */
6296 
6297   /* function exit code */
6298   __pyx_L1_error:;
6299   __Pyx_XDECREF(__pyx_t_1);
6300   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
6301   __pyx_r = 0;
6302   __pyx_L0:;
6303   __Pyx_XGIVEREF(__pyx_r);
6304   __Pyx_RefNannyFinishContext();
6305   return __pyx_r;
6306 }
6307 
6308 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":738
6309  *     return PyArray_MultiIterNew(1, <void*>a)
6310  *
6311  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
6312  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6313  *
6314  */
6315 
__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject * __pyx_v_a,PyObject * __pyx_v_b)6316 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
6317   PyObject *__pyx_r = NULL;
6318   __Pyx_RefNannyDeclarations
6319   PyObject *__pyx_t_1 = NULL;
6320   int __pyx_lineno = 0;
6321   const char *__pyx_filename = NULL;
6322   int __pyx_clineno = 0;
6323   __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
6324 
6325   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":739
6326  *
6327  * cdef inline object PyArray_MultiIterNew2(a, b):
6328  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
6329  *
6330  * cdef inline object PyArray_MultiIterNew3(a, b, c):
6331  */
6332   __Pyx_XDECREF(__pyx_r);
6333   __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 739, __pyx_L1_error)
6334   __Pyx_GOTREF(__pyx_t_1);
6335   __pyx_r = __pyx_t_1;
6336   __pyx_t_1 = 0;
6337   goto __pyx_L0;
6338 
6339   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":738
6340  *     return PyArray_MultiIterNew(1, <void*>a)
6341  *
6342  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
6343  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6344  *
6345  */
6346 
6347   /* function exit code */
6348   __pyx_L1_error:;
6349   __Pyx_XDECREF(__pyx_t_1);
6350   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
6351   __pyx_r = 0;
6352   __pyx_L0:;
6353   __Pyx_XGIVEREF(__pyx_r);
6354   __Pyx_RefNannyFinishContext();
6355   return __pyx_r;
6356 }
6357 
6358 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":741
6359  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6360  *
6361  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
6362  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6363  *
6364  */
6365 
__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c)6366 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
6367   PyObject *__pyx_r = NULL;
6368   __Pyx_RefNannyDeclarations
6369   PyObject *__pyx_t_1 = NULL;
6370   int __pyx_lineno = 0;
6371   const char *__pyx_filename = NULL;
6372   int __pyx_clineno = 0;
6373   __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
6374 
6375   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":742
6376  *
6377  * cdef inline object PyArray_MultiIterNew3(a, b, c):
6378  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
6379  *
6380  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
6381  */
6382   __Pyx_XDECREF(__pyx_r);
6383   __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 742, __pyx_L1_error)
6384   __Pyx_GOTREF(__pyx_t_1);
6385   __pyx_r = __pyx_t_1;
6386   __pyx_t_1 = 0;
6387   goto __pyx_L0;
6388 
6389   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":741
6390  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
6391  *
6392  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
6393  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6394  *
6395  */
6396 
6397   /* function exit code */
6398   __pyx_L1_error:;
6399   __Pyx_XDECREF(__pyx_t_1);
6400   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
6401   __pyx_r = 0;
6402   __pyx_L0:;
6403   __Pyx_XGIVEREF(__pyx_r);
6404   __Pyx_RefNannyFinishContext();
6405   return __pyx_r;
6406 }
6407 
6408 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":744
6409  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6410  *
6411  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
6412  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6413  *
6414  */
6415 
__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject * __pyx_v_a,PyObject * __pyx_v_b,PyObject * __pyx_v_c,PyObject * __pyx_v_d)6416 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) {
6417   PyObject *__pyx_r = NULL;
6418   __Pyx_RefNannyDeclarations
6419   PyObject *__pyx_t_1 = NULL;
6420   int __pyx_lineno = 0;
6421   const char *__pyx_filename = NULL;
6422   int __pyx_clineno = 0;
6423   __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
6424 
6425   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":745
6426  *
6427  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
6428  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
6429  *
6430  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
6431  */
6432   __Pyx_XDECREF(__pyx_r);
6433   __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 745, __pyx_L1_error)
6434   __Pyx_GOTREF(__pyx_t_1);
6435   __pyx_r = __pyx_t_1;
6436   __pyx_t_1 = 0;
6437   goto __pyx_L0;
6438 
6439   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":744
6440  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
6441  *
6442  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
6443  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6444  *
6445  */
6446 
6447   /* function exit code */
6448   __pyx_L1_error:;
6449   __Pyx_XDECREF(__pyx_t_1);
6450   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
6451   __pyx_r = 0;
6452   __pyx_L0:;
6453   __Pyx_XGIVEREF(__pyx_r);
6454   __Pyx_RefNannyFinishContext();
6455   return __pyx_r;
6456 }
6457 
6458 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":747
6459  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6460  *
6461  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
6462  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6463  *
6464  */
6465 
__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)6466 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) {
6467   PyObject *__pyx_r = NULL;
6468   __Pyx_RefNannyDeclarations
6469   PyObject *__pyx_t_1 = NULL;
6470   int __pyx_lineno = 0;
6471   const char *__pyx_filename = NULL;
6472   int __pyx_clineno = 0;
6473   __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
6474 
6475   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":748
6476  *
6477  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
6478  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
6479  *
6480  * cdef inline tuple PyDataType_SHAPE(dtype d):
6481  */
6482   __Pyx_XDECREF(__pyx_r);
6483   __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 748, __pyx_L1_error)
6484   __Pyx_GOTREF(__pyx_t_1);
6485   __pyx_r = __pyx_t_1;
6486   __pyx_t_1 = 0;
6487   goto __pyx_L0;
6488 
6489   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":747
6490  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
6491  *
6492  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
6493  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6494  *
6495  */
6496 
6497   /* function exit code */
6498   __pyx_L1_error:;
6499   __Pyx_XDECREF(__pyx_t_1);
6500   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
6501   __pyx_r = 0;
6502   __pyx_L0:;
6503   __Pyx_XGIVEREF(__pyx_r);
6504   __Pyx_RefNannyFinishContext();
6505   return __pyx_r;
6506 }
6507 
6508 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":750
6509  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6510  *
6511  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
6512  *     if PyDataType_HASSUBARRAY(d):
6513  *         return <tuple>d.subarray.shape
6514  */
6515 
__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr * __pyx_v_d)6516 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
6517   PyObject *__pyx_r = NULL;
6518   __Pyx_RefNannyDeclarations
6519   int __pyx_t_1;
6520   __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
6521 
6522   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":751
6523  *
6524  * cdef inline tuple PyDataType_SHAPE(dtype d):
6525  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
6526  *         return <tuple>d.subarray.shape
6527  *     else:
6528  */
6529   __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
6530   if (__pyx_t_1) {
6531 
6532     /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":752
6533  * cdef inline tuple PyDataType_SHAPE(dtype d):
6534  *     if PyDataType_HASSUBARRAY(d):
6535  *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
6536  *     else:
6537  *         return ()
6538  */
6539     __Pyx_XDECREF(__pyx_r);
6540     __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
6541     __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
6542     goto __pyx_L0;
6543 
6544     /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":751
6545  *
6546  * cdef inline tuple PyDataType_SHAPE(dtype d):
6547  *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
6548  *         return <tuple>d.subarray.shape
6549  *     else:
6550  */
6551   }
6552 
6553   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":754
6554  *         return <tuple>d.subarray.shape
6555  *     else:
6556  *         return ()             # <<<<<<<<<<<<<<
6557  *
6558  *
6559  */
6560   /*else*/ {
6561     __Pyx_XDECREF(__pyx_r);
6562     __Pyx_INCREF(__pyx_empty_tuple);
6563     __pyx_r = __pyx_empty_tuple;
6564     goto __pyx_L0;
6565   }
6566 
6567   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":750
6568  *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
6569  *
6570  * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
6571  *     if PyDataType_HASSUBARRAY(d):
6572  *         return <tuple>d.subarray.shape
6573  */
6574 
6575   /* function exit code */
6576   __pyx_L0:;
6577   __Pyx_XGIVEREF(__pyx_r);
6578   __Pyx_RefNannyFinishContext();
6579   return __pyx_r;
6580 }
6581 
6582 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":931
6583  *     int _import_umath() except -1
6584  *
6585  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
6586  *     Py_INCREF(base) # important to do this before stealing the reference below!
6587  *     PyArray_SetBaseObject(arr, base)
6588  */
6589 
__pyx_f_5numpy_set_array_base(PyArrayObject * __pyx_v_arr,PyObject * __pyx_v_base)6590 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
6591   __Pyx_RefNannyDeclarations
6592   __Pyx_RefNannySetupContext("set_array_base", 0);
6593 
6594   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":932
6595  *
6596  * cdef inline void set_array_base(ndarray arr, object base):
6597  *     Py_INCREF(base) # important to do this before stealing the reference below!             # <<<<<<<<<<<<<<
6598  *     PyArray_SetBaseObject(arr, base)
6599  *
6600  */
6601   Py_INCREF(__pyx_v_base);
6602 
6603   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":933
6604  * cdef inline void set_array_base(ndarray arr, object base):
6605  *     Py_INCREF(base) # important to do this before stealing the reference below!
6606  *     PyArray_SetBaseObject(arr, base)             # <<<<<<<<<<<<<<
6607  *
6608  * cdef inline object get_array_base(ndarray arr):
6609  */
6610   (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
6611 
6612   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":931
6613  *     int _import_umath() except -1
6614  *
6615  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
6616  *     Py_INCREF(base) # important to do this before stealing the reference below!
6617  *     PyArray_SetBaseObject(arr, base)
6618  */
6619 
6620   /* function exit code */
6621   __Pyx_RefNannyFinishContext();
6622 }
6623 
6624 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":935
6625  *     PyArray_SetBaseObject(arr, base)
6626  *
6627  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
6628  *     base = PyArray_BASE(arr)
6629  *     if base is NULL:
6630  */
6631 
__pyx_f_5numpy_get_array_base(PyArrayObject * __pyx_v_arr)6632 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
6633   PyObject *__pyx_v_base;
6634   PyObject *__pyx_r = NULL;
6635   __Pyx_RefNannyDeclarations
6636   int __pyx_t_1;
6637   __Pyx_RefNannySetupContext("get_array_base", 0);
6638 
6639   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":936
6640  *
6641  * cdef inline object get_array_base(ndarray arr):
6642  *     base = PyArray_BASE(arr)             # <<<<<<<<<<<<<<
6643  *     if base is NULL:
6644  *         return None
6645  */
6646   __pyx_v_base = PyArray_BASE(__pyx_v_arr);
6647 
6648   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":937
6649  * cdef inline object get_array_base(ndarray arr):
6650  *     base = PyArray_BASE(arr)
6651  *     if base is NULL:             # <<<<<<<<<<<<<<
6652  *         return None
6653  *     return <object>base
6654  */
6655   __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
6656   if (__pyx_t_1) {
6657 
6658     /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":938
6659  *     base = PyArray_BASE(arr)
6660  *     if base is NULL:
6661  *         return None             # <<<<<<<<<<<<<<
6662  *     return <object>base
6663  *
6664  */
6665     __Pyx_XDECREF(__pyx_r);
6666     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6667     goto __pyx_L0;
6668 
6669     /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":937
6670  * cdef inline object get_array_base(ndarray arr):
6671  *     base = PyArray_BASE(arr)
6672  *     if base is NULL:             # <<<<<<<<<<<<<<
6673  *         return None
6674  *     return <object>base
6675  */
6676   }
6677 
6678   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":939
6679  *     if base is NULL:
6680  *         return None
6681  *     return <object>base             # <<<<<<<<<<<<<<
6682  *
6683  * # Versions of the import_* functions which are more suitable for
6684  */
6685   __Pyx_XDECREF(__pyx_r);
6686   __Pyx_INCREF(((PyObject *)__pyx_v_base));
6687   __pyx_r = ((PyObject *)__pyx_v_base);
6688   goto __pyx_L0;
6689 
6690   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":935
6691  *     PyArray_SetBaseObject(arr, base)
6692  *
6693  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
6694  *     base = PyArray_BASE(arr)
6695  *     if base is NULL:
6696  */
6697 
6698   /* function exit code */
6699   __pyx_L0:;
6700   __Pyx_XGIVEREF(__pyx_r);
6701   __Pyx_RefNannyFinishContext();
6702   return __pyx_r;
6703 }
6704 
6705 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":943
6706  * # Versions of the import_* functions which are more suitable for
6707  * # Cython code.
6708  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
6709  *     try:
6710  *         __pyx_import_array()
6711  */
6712 
__pyx_f_5numpy_import_array(void)6713 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
6714   int __pyx_r;
6715   __Pyx_RefNannyDeclarations
6716   PyObject *__pyx_t_1 = NULL;
6717   PyObject *__pyx_t_2 = NULL;
6718   PyObject *__pyx_t_3 = NULL;
6719   int __pyx_t_4;
6720   PyObject *__pyx_t_5 = NULL;
6721   PyObject *__pyx_t_6 = NULL;
6722   PyObject *__pyx_t_7 = NULL;
6723   PyObject *__pyx_t_8 = NULL;
6724   int __pyx_lineno = 0;
6725   const char *__pyx_filename = NULL;
6726   int __pyx_clineno = 0;
6727   __Pyx_RefNannySetupContext("import_array", 0);
6728 
6729   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":944
6730  * # Cython code.
6731  * cdef inline int import_array() except -1:
6732  *     try:             # <<<<<<<<<<<<<<
6733  *         __pyx_import_array()
6734  *     except Exception:
6735  */
6736   {
6737     __Pyx_PyThreadState_declare
6738     __Pyx_PyThreadState_assign
6739     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
6740     __Pyx_XGOTREF(__pyx_t_1);
6741     __Pyx_XGOTREF(__pyx_t_2);
6742     __Pyx_XGOTREF(__pyx_t_3);
6743     /*try:*/ {
6744 
6745       /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":945
6746  * cdef inline int import_array() except -1:
6747  *     try:
6748  *         __pyx_import_array()             # <<<<<<<<<<<<<<
6749  *     except Exception:
6750  *         raise ImportError("numpy.core.multiarray failed to import")
6751  */
6752       __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 945, __pyx_L3_error)
6753 
6754       /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":944
6755  * # Cython code.
6756  * cdef inline int import_array() except -1:
6757  *     try:             # <<<<<<<<<<<<<<
6758  *         __pyx_import_array()
6759  *     except Exception:
6760  */
6761     }
6762     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6763     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6764     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6765     goto __pyx_L8_try_end;
6766     __pyx_L3_error:;
6767 
6768     /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":946
6769  *     try:
6770  *         __pyx_import_array()
6771  *     except Exception:             # <<<<<<<<<<<<<<
6772  *         raise ImportError("numpy.core.multiarray failed to import")
6773  *
6774  */
6775     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
6776     if (__pyx_t_4) {
6777       __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
6778       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 946, __pyx_L5_except_error)
6779       __Pyx_GOTREF(__pyx_t_5);
6780       __Pyx_GOTREF(__pyx_t_6);
6781       __Pyx_GOTREF(__pyx_t_7);
6782 
6783       /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":947
6784  *         __pyx_import_array()
6785  *     except Exception:
6786  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
6787  *
6788  * cdef inline int import_umath() except -1:
6789  */
6790       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 947, __pyx_L5_except_error)
6791       __Pyx_GOTREF(__pyx_t_8);
6792       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
6793       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6794       __PYX_ERR(2, 947, __pyx_L5_except_error)
6795     }
6796     goto __pyx_L5_except_error;
6797     __pyx_L5_except_error:;
6798 
6799     /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":944
6800  * # Cython code.
6801  * cdef inline int import_array() except -1:
6802  *     try:             # <<<<<<<<<<<<<<
6803  *         __pyx_import_array()
6804  *     except Exception:
6805  */
6806     __Pyx_XGIVEREF(__pyx_t_1);
6807     __Pyx_XGIVEREF(__pyx_t_2);
6808     __Pyx_XGIVEREF(__pyx_t_3);
6809     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
6810     goto __pyx_L1_error;
6811     __pyx_L8_try_end:;
6812   }
6813 
6814   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":943
6815  * # Versions of the import_* functions which are more suitable for
6816  * # Cython code.
6817  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
6818  *     try:
6819  *         __pyx_import_array()
6820  */
6821 
6822   /* function exit code */
6823   __pyx_r = 0;
6824   goto __pyx_L0;
6825   __pyx_L1_error:;
6826   __Pyx_XDECREF(__pyx_t_5);
6827   __Pyx_XDECREF(__pyx_t_6);
6828   __Pyx_XDECREF(__pyx_t_7);
6829   __Pyx_XDECREF(__pyx_t_8);
6830   __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
6831   __pyx_r = -1;
6832   __pyx_L0:;
6833   __Pyx_RefNannyFinishContext();
6834   return __pyx_r;
6835 }
6836 
6837 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":949
6838  *         raise ImportError("numpy.core.multiarray failed to import")
6839  *
6840  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
6841  *     try:
6842  *         _import_umath()
6843  */
6844 
__pyx_f_5numpy_import_umath(void)6845 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
6846   int __pyx_r;
6847   __Pyx_RefNannyDeclarations
6848   PyObject *__pyx_t_1 = NULL;
6849   PyObject *__pyx_t_2 = NULL;
6850   PyObject *__pyx_t_3 = NULL;
6851   int __pyx_t_4;
6852   PyObject *__pyx_t_5 = NULL;
6853   PyObject *__pyx_t_6 = NULL;
6854   PyObject *__pyx_t_7 = NULL;
6855   PyObject *__pyx_t_8 = NULL;
6856   int __pyx_lineno = 0;
6857   const char *__pyx_filename = NULL;
6858   int __pyx_clineno = 0;
6859   __Pyx_RefNannySetupContext("import_umath", 0);
6860 
6861   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":950
6862  *
6863  * cdef inline int import_umath() except -1:
6864  *     try:             # <<<<<<<<<<<<<<
6865  *         _import_umath()
6866  *     except Exception:
6867  */
6868   {
6869     __Pyx_PyThreadState_declare
6870     __Pyx_PyThreadState_assign
6871     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
6872     __Pyx_XGOTREF(__pyx_t_1);
6873     __Pyx_XGOTREF(__pyx_t_2);
6874     __Pyx_XGOTREF(__pyx_t_3);
6875     /*try:*/ {
6876 
6877       /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":951
6878  * cdef inline int import_umath() except -1:
6879  *     try:
6880  *         _import_umath()             # <<<<<<<<<<<<<<
6881  *     except Exception:
6882  *         raise ImportError("numpy.core.umath failed to import")
6883  */
6884       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 951, __pyx_L3_error)
6885 
6886       /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":950
6887  *
6888  * cdef inline int import_umath() except -1:
6889  *     try:             # <<<<<<<<<<<<<<
6890  *         _import_umath()
6891  *     except Exception:
6892  */
6893     }
6894     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
6895     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6896     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6897     goto __pyx_L8_try_end;
6898     __pyx_L3_error:;
6899 
6900     /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":952
6901  *     try:
6902  *         _import_umath()
6903  *     except Exception:             # <<<<<<<<<<<<<<
6904  *         raise ImportError("numpy.core.umath failed to import")
6905  *
6906  */
6907     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
6908     if (__pyx_t_4) {
6909       __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
6910       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 952, __pyx_L5_except_error)
6911       __Pyx_GOTREF(__pyx_t_5);
6912       __Pyx_GOTREF(__pyx_t_6);
6913       __Pyx_GOTREF(__pyx_t_7);
6914 
6915       /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":953
6916  *         _import_umath()
6917  *     except Exception:
6918  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
6919  *
6920  * cdef inline int import_ufunc() except -1:
6921  */
6922       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 953, __pyx_L5_except_error)
6923       __Pyx_GOTREF(__pyx_t_8);
6924       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
6925       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6926       __PYX_ERR(2, 953, __pyx_L5_except_error)
6927     }
6928     goto __pyx_L5_except_error;
6929     __pyx_L5_except_error:;
6930 
6931     /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":950
6932  *
6933  * cdef inline int import_umath() except -1:
6934  *     try:             # <<<<<<<<<<<<<<
6935  *         _import_umath()
6936  *     except Exception:
6937  */
6938     __Pyx_XGIVEREF(__pyx_t_1);
6939     __Pyx_XGIVEREF(__pyx_t_2);
6940     __Pyx_XGIVEREF(__pyx_t_3);
6941     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
6942     goto __pyx_L1_error;
6943     __pyx_L8_try_end:;
6944   }
6945 
6946   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":949
6947  *         raise ImportError("numpy.core.multiarray failed to import")
6948  *
6949  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
6950  *     try:
6951  *         _import_umath()
6952  */
6953 
6954   /* function exit code */
6955   __pyx_r = 0;
6956   goto __pyx_L0;
6957   __pyx_L1_error:;
6958   __Pyx_XDECREF(__pyx_t_5);
6959   __Pyx_XDECREF(__pyx_t_6);
6960   __Pyx_XDECREF(__pyx_t_7);
6961   __Pyx_XDECREF(__pyx_t_8);
6962   __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
6963   __pyx_r = -1;
6964   __pyx_L0:;
6965   __Pyx_RefNannyFinishContext();
6966   return __pyx_r;
6967 }
6968 
6969 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":955
6970  *         raise ImportError("numpy.core.umath failed to import")
6971  *
6972  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
6973  *     try:
6974  *         _import_umath()
6975  */
6976 
__pyx_f_5numpy_import_ufunc(void)6977 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
6978   int __pyx_r;
6979   __Pyx_RefNannyDeclarations
6980   PyObject *__pyx_t_1 = NULL;
6981   PyObject *__pyx_t_2 = NULL;
6982   PyObject *__pyx_t_3 = NULL;
6983   int __pyx_t_4;
6984   PyObject *__pyx_t_5 = NULL;
6985   PyObject *__pyx_t_6 = NULL;
6986   PyObject *__pyx_t_7 = NULL;
6987   PyObject *__pyx_t_8 = NULL;
6988   int __pyx_lineno = 0;
6989   const char *__pyx_filename = NULL;
6990   int __pyx_clineno = 0;
6991   __Pyx_RefNannySetupContext("import_ufunc", 0);
6992 
6993   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":956
6994  *
6995  * cdef inline int import_ufunc() except -1:
6996  *     try:             # <<<<<<<<<<<<<<
6997  *         _import_umath()
6998  *     except Exception:
6999  */
7000   {
7001     __Pyx_PyThreadState_declare
7002     __Pyx_PyThreadState_assign
7003     __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
7004     __Pyx_XGOTREF(__pyx_t_1);
7005     __Pyx_XGOTREF(__pyx_t_2);
7006     __Pyx_XGOTREF(__pyx_t_3);
7007     /*try:*/ {
7008 
7009       /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":957
7010  * cdef inline int import_ufunc() except -1:
7011  *     try:
7012  *         _import_umath()             # <<<<<<<<<<<<<<
7013  *     except Exception:
7014  *         raise ImportError("numpy.core.umath failed to import")
7015  */
7016       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 957, __pyx_L3_error)
7017 
7018       /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":956
7019  *
7020  * cdef inline int import_ufunc() except -1:
7021  *     try:             # <<<<<<<<<<<<<<
7022  *         _import_umath()
7023  *     except Exception:
7024  */
7025     }
7026     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7027     __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7028     __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7029     goto __pyx_L8_try_end;
7030     __pyx_L3_error:;
7031 
7032     /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":958
7033  *     try:
7034  *         _import_umath()
7035  *     except Exception:             # <<<<<<<<<<<<<<
7036  *         raise ImportError("numpy.core.umath failed to import")
7037  *
7038  */
7039     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7040     if (__pyx_t_4) {
7041       __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
7042       if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 958, __pyx_L5_except_error)
7043       __Pyx_GOTREF(__pyx_t_5);
7044       __Pyx_GOTREF(__pyx_t_6);
7045       __Pyx_GOTREF(__pyx_t_7);
7046 
7047       /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":959
7048  *         _import_umath()
7049  *     except Exception:
7050  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
7051  *
7052  * cdef extern from *:
7053  */
7054       __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 959, __pyx_L5_except_error)
7055       __Pyx_GOTREF(__pyx_t_8);
7056       __Pyx_Raise(__pyx_t_8, 0, 0, 0);
7057       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7058       __PYX_ERR(2, 959, __pyx_L5_except_error)
7059     }
7060     goto __pyx_L5_except_error;
7061     __pyx_L5_except_error:;
7062 
7063     /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":956
7064  *
7065  * cdef inline int import_ufunc() except -1:
7066  *     try:             # <<<<<<<<<<<<<<
7067  *         _import_umath()
7068  *     except Exception:
7069  */
7070     __Pyx_XGIVEREF(__pyx_t_1);
7071     __Pyx_XGIVEREF(__pyx_t_2);
7072     __Pyx_XGIVEREF(__pyx_t_3);
7073     __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7074     goto __pyx_L1_error;
7075     __pyx_L8_try_end:;
7076   }
7077 
7078   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":955
7079  *         raise ImportError("numpy.core.umath failed to import")
7080  *
7081  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
7082  *     try:
7083  *         _import_umath()
7084  */
7085 
7086   /* function exit code */
7087   __pyx_r = 0;
7088   goto __pyx_L0;
7089   __pyx_L1_error:;
7090   __Pyx_XDECREF(__pyx_t_5);
7091   __Pyx_XDECREF(__pyx_t_6);
7092   __Pyx_XDECREF(__pyx_t_7);
7093   __Pyx_XDECREF(__pyx_t_8);
7094   __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
7095   __pyx_r = -1;
7096   __pyx_L0:;
7097   __Pyx_RefNannyFinishContext();
7098   return __pyx_r;
7099 }
7100 
7101 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":969
7102  *
7103  *
7104  * cdef inline bint is_timedelta64_object(object obj):             # <<<<<<<<<<<<<<
7105  *     """
7106  *     Cython equivalent of `isinstance(obj, np.timedelta64)`
7107  */
7108 
__pyx_f_5numpy_is_timedelta64_object(PyObject * __pyx_v_obj)7109 static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
7110   int __pyx_r;
7111   __Pyx_RefNannyDeclarations
7112   __Pyx_RefNannySetupContext("is_timedelta64_object", 0);
7113 
7114   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":981
7115  *     bool
7116  *     """
7117  *     return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type)             # <<<<<<<<<<<<<<
7118  *
7119  *
7120  */
7121   __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
7122   goto __pyx_L0;
7123 
7124   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":969
7125  *
7126  *
7127  * cdef inline bint is_timedelta64_object(object obj):             # <<<<<<<<<<<<<<
7128  *     """
7129  *     Cython equivalent of `isinstance(obj, np.timedelta64)`
7130  */
7131 
7132   /* function exit code */
7133   __pyx_L0:;
7134   __Pyx_RefNannyFinishContext();
7135   return __pyx_r;
7136 }
7137 
7138 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":984
7139  *
7140  *
7141  * cdef inline bint is_datetime64_object(object obj):             # <<<<<<<<<<<<<<
7142  *     """
7143  *     Cython equivalent of `isinstance(obj, np.datetime64)`
7144  */
7145 
__pyx_f_5numpy_is_datetime64_object(PyObject * __pyx_v_obj)7146 static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
7147   int __pyx_r;
7148   __Pyx_RefNannyDeclarations
7149   __Pyx_RefNannySetupContext("is_datetime64_object", 0);
7150 
7151   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":996
7152  *     bool
7153  *     """
7154  *     return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type)             # <<<<<<<<<<<<<<
7155  *
7156  *
7157  */
7158   __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
7159   goto __pyx_L0;
7160 
7161   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":984
7162  *
7163  *
7164  * cdef inline bint is_datetime64_object(object obj):             # <<<<<<<<<<<<<<
7165  *     """
7166  *     Cython equivalent of `isinstance(obj, np.datetime64)`
7167  */
7168 
7169   /* function exit code */
7170   __pyx_L0:;
7171   __Pyx_RefNannyFinishContext();
7172   return __pyx_r;
7173 }
7174 
7175 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":999
7176  *
7177  *
7178  * cdef inline npy_datetime get_datetime64_value(object obj) nogil:             # <<<<<<<<<<<<<<
7179  *     """
7180  *     returns the int64 value underlying scalar numpy datetime64 object
7181  */
7182 
__pyx_f_5numpy_get_datetime64_value(PyObject * __pyx_v_obj)7183 static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
7184   npy_datetime __pyx_r;
7185 
7186   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":1006
7187  *     also needed.  That can be found using `get_datetime64_unit`.
7188  *     """
7189  *     return (<PyDatetimeScalarObject*>obj).obval             # <<<<<<<<<<<<<<
7190  *
7191  *
7192  */
7193   __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
7194   goto __pyx_L0;
7195 
7196   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":999
7197  *
7198  *
7199  * cdef inline npy_datetime get_datetime64_value(object obj) nogil:             # <<<<<<<<<<<<<<
7200  *     """
7201  *     returns the int64 value underlying scalar numpy datetime64 object
7202  */
7203 
7204   /* function exit code */
7205   __pyx_L0:;
7206   return __pyx_r;
7207 }
7208 
7209 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":1009
7210  *
7211  *
7212  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:             # <<<<<<<<<<<<<<
7213  *     """
7214  *     returns the int64 value underlying scalar numpy timedelta64 object
7215  */
7216 
__pyx_f_5numpy_get_timedelta64_value(PyObject * __pyx_v_obj)7217 static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
7218   npy_timedelta __pyx_r;
7219 
7220   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":1013
7221  *     returns the int64 value underlying scalar numpy timedelta64 object
7222  *     """
7223  *     return (<PyTimedeltaScalarObject*>obj).obval             # <<<<<<<<<<<<<<
7224  *
7225  *
7226  */
7227   __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
7228   goto __pyx_L0;
7229 
7230   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":1009
7231  *
7232  *
7233  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:             # <<<<<<<<<<<<<<
7234  *     """
7235  *     returns the int64 value underlying scalar numpy timedelta64 object
7236  */
7237 
7238   /* function exit code */
7239   __pyx_L0:;
7240   return __pyx_r;
7241 }
7242 
7243 /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":1016
7244  *
7245  *
7246  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:             # <<<<<<<<<<<<<<
7247  *     """
7248  *     returns the unit part of the dtype for a numpy datetime64 object.
7249  */
7250 
__pyx_f_5numpy_get_datetime64_unit(PyObject * __pyx_v_obj)7251 static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
7252   NPY_DATETIMEUNIT __pyx_r;
7253 
7254   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":1020
7255  *     returns the unit part of the dtype for a numpy datetime64 object.
7256  *     """
7257  *     return <NPY_DATETIMEUNIT>(<PyDatetimeScalarObject*>obj).obmeta.base             # <<<<<<<<<<<<<<
7258  */
7259   __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
7260   goto __pyx_L0;
7261 
7262   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":1016
7263  *
7264  *
7265  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:             # <<<<<<<<<<<<<<
7266  *     """
7267  *     returns the unit part of the dtype for a numpy datetime64 object.
7268  */
7269 
7270   /* function exit code */
7271   __pyx_L0:;
7272   return __pyx_r;
7273 }
7274 
7275 /* "View.MemoryView":122
7276  *         cdef bint dtype_is_object
7277  *
7278  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
7279  *                   mode="c", bint allocate_buffer=True):
7280  *
7281  */
7282 
7283 /* Python wrapper */
7284 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)7285 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7286   PyObject *__pyx_v_shape = 0;
7287   Py_ssize_t __pyx_v_itemsize;
7288   PyObject *__pyx_v_format = 0;
7289   PyObject *__pyx_v_mode = 0;
7290   int __pyx_v_allocate_buffer;
7291   int __pyx_lineno = 0;
7292   const char *__pyx_filename = NULL;
7293   int __pyx_clineno = 0;
7294   int __pyx_r;
7295   __Pyx_RefNannyDeclarations
7296   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
7297   {
7298     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};
7299     PyObject* values[5] = {0,0,0,0,0};
7300     values[3] = ((PyObject *)__pyx_n_s_c);
7301     if (unlikely(__pyx_kwds)) {
7302       Py_ssize_t kw_args;
7303       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7304       switch (pos_args) {
7305         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7306         CYTHON_FALLTHROUGH;
7307         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7308         CYTHON_FALLTHROUGH;
7309         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7310         CYTHON_FALLTHROUGH;
7311         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7312         CYTHON_FALLTHROUGH;
7313         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7314         CYTHON_FALLTHROUGH;
7315         case  0: break;
7316         default: goto __pyx_L5_argtuple_error;
7317       }
7318       kw_args = PyDict_Size(__pyx_kwds);
7319       switch (pos_args) {
7320         case  0:
7321         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
7322         else goto __pyx_L5_argtuple_error;
7323         CYTHON_FALLTHROUGH;
7324         case  1:
7325         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
7326         else {
7327           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(1, 122, __pyx_L3_error)
7328         }
7329         CYTHON_FALLTHROUGH;
7330         case  2:
7331         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
7332         else {
7333           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(1, 122, __pyx_L3_error)
7334         }
7335         CYTHON_FALLTHROUGH;
7336         case  3:
7337         if (kw_args > 0) {
7338           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
7339           if (value) { values[3] = value; kw_args--; }
7340         }
7341         CYTHON_FALLTHROUGH;
7342         case  4:
7343         if (kw_args > 0) {
7344           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
7345           if (value) { values[4] = value; kw_args--; }
7346         }
7347       }
7348       if (unlikely(kw_args > 0)) {
7349         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 122, __pyx_L3_error)
7350       }
7351     } else {
7352       switch (PyTuple_GET_SIZE(__pyx_args)) {
7353         case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7354         CYTHON_FALLTHROUGH;
7355         case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7356         CYTHON_FALLTHROUGH;
7357         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7358         values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7359         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7360         break;
7361         default: goto __pyx_L5_argtuple_error;
7362       }
7363     }
7364     __pyx_v_shape = ((PyObject*)values[0]);
7365     __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 122, __pyx_L3_error)
7366     __pyx_v_format = values[2];
7367     __pyx_v_mode = values[3];
7368     if (values[4]) {
7369       __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 123, __pyx_L3_error)
7370     } else {
7371 
7372       /* "View.MemoryView":123
7373  *
7374  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
7375  *                   mode="c", bint allocate_buffer=True):             # <<<<<<<<<<<<<<
7376  *
7377  *         cdef int idx
7378  */
7379       __pyx_v_allocate_buffer = ((int)1);
7380     }
7381   }
7382   goto __pyx_L4_argument_unpacking_done;
7383   __pyx_L5_argtuple_error:;
7384   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 122, __pyx_L3_error)
7385   __pyx_L3_error:;
7386   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7387   __Pyx_RefNannyFinishContext();
7388   return -1;
7389   __pyx_L4_argument_unpacking_done:;
7390   if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 122, __pyx_L1_error)
7391   if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
7392     PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 122, __pyx_L1_error)
7393   }
7394   __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);
7395 
7396   /* "View.MemoryView":122
7397  *         cdef bint dtype_is_object
7398  *
7399  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
7400  *                   mode="c", bint allocate_buffer=True):
7401  *
7402  */
7403 
7404   /* function exit code */
7405   goto __pyx_L0;
7406   __pyx_L1_error:;
7407   __pyx_r = -1;
7408   __pyx_L0:;
7409   __Pyx_RefNannyFinishContext();
7410   return __pyx_r;
7411 }
7412 
__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)7413 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) {
7414   int __pyx_v_idx;
7415   Py_ssize_t __pyx_v_i;
7416   Py_ssize_t __pyx_v_dim;
7417   PyObject **__pyx_v_p;
7418   char __pyx_v_order;
7419   int __pyx_r;
7420   __Pyx_RefNannyDeclarations
7421   Py_ssize_t __pyx_t_1;
7422   int __pyx_t_2;
7423   PyObject *__pyx_t_3 = NULL;
7424   int __pyx_t_4;
7425   PyObject *__pyx_t_5 = NULL;
7426   PyObject *__pyx_t_6 = NULL;
7427   char *__pyx_t_7;
7428   int __pyx_t_8;
7429   Py_ssize_t __pyx_t_9;
7430   PyObject *__pyx_t_10 = NULL;
7431   Py_ssize_t __pyx_t_11;
7432   int __pyx_lineno = 0;
7433   const char *__pyx_filename = NULL;
7434   int __pyx_clineno = 0;
7435   __Pyx_RefNannySetupContext("__cinit__", 0);
7436   __Pyx_INCREF(__pyx_v_format);
7437 
7438   /* "View.MemoryView":129
7439  *         cdef PyObject **p
7440  *
7441  *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
7442  *         self.itemsize = itemsize
7443  *
7444  */
7445   if (unlikely(__pyx_v_shape == Py_None)) {
7446     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
7447     __PYX_ERR(1, 129, __pyx_L1_error)
7448   }
7449   __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 129, __pyx_L1_error)
7450   __pyx_v_self->ndim = ((int)__pyx_t_1);
7451 
7452   /* "View.MemoryView":130
7453  *
7454  *         self.ndim = <int> len(shape)
7455  *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
7456  *
7457  *         if not self.ndim:
7458  */
7459   __pyx_v_self->itemsize = __pyx_v_itemsize;
7460 
7461   /* "View.MemoryView":132
7462  *         self.itemsize = itemsize
7463  *
7464  *         if not self.ndim:             # <<<<<<<<<<<<<<
7465  *             raise ValueError("Empty shape tuple for cython.array")
7466  *
7467  */
7468   __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
7469   if (unlikely(__pyx_t_2)) {
7470 
7471     /* "View.MemoryView":133
7472  *
7473  *         if not self.ndim:
7474  *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
7475  *
7476  *         if itemsize <= 0:
7477  */
7478     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 133, __pyx_L1_error)
7479     __Pyx_GOTREF(__pyx_t_3);
7480     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7481     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7482     __PYX_ERR(1, 133, __pyx_L1_error)
7483 
7484     /* "View.MemoryView":132
7485  *         self.itemsize = itemsize
7486  *
7487  *         if not self.ndim:             # <<<<<<<<<<<<<<
7488  *             raise ValueError("Empty shape tuple for cython.array")
7489  *
7490  */
7491   }
7492 
7493   /* "View.MemoryView":135
7494  *             raise ValueError("Empty shape tuple for cython.array")
7495  *
7496  *         if itemsize <= 0:             # <<<<<<<<<<<<<<
7497  *             raise ValueError("itemsize <= 0 for cython.array")
7498  *
7499  */
7500   __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
7501   if (unlikely(__pyx_t_2)) {
7502 
7503     /* "View.MemoryView":136
7504  *
7505  *         if itemsize <= 0:
7506  *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
7507  *
7508  *         if not isinstance(format, bytes):
7509  */
7510     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 136, __pyx_L1_error)
7511     __Pyx_GOTREF(__pyx_t_3);
7512     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7513     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7514     __PYX_ERR(1, 136, __pyx_L1_error)
7515 
7516     /* "View.MemoryView":135
7517  *             raise ValueError("Empty shape tuple for cython.array")
7518  *
7519  *         if itemsize <= 0:             # <<<<<<<<<<<<<<
7520  *             raise ValueError("itemsize <= 0 for cython.array")
7521  *
7522  */
7523   }
7524 
7525   /* "View.MemoryView":138
7526  *             raise ValueError("itemsize <= 0 for cython.array")
7527  *
7528  *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
7529  *             format = format.encode('ASCII')
7530  *         self._format = format  # keep a reference to the byte string
7531  */
7532   __pyx_t_2 = PyBytes_Check(__pyx_v_format);
7533   __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
7534   if (__pyx_t_4) {
7535 
7536     /* "View.MemoryView":139
7537  *
7538  *         if not isinstance(format, bytes):
7539  *             format = format.encode('ASCII')             # <<<<<<<<<<<<<<
7540  *         self._format = format  # keep a reference to the byte string
7541  *         self.format = self._format
7542  */
7543     __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 139, __pyx_L1_error)
7544     __Pyx_GOTREF(__pyx_t_5);
7545     __pyx_t_6 = NULL;
7546     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
7547       __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
7548       if (likely(__pyx_t_6)) {
7549         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7550         __Pyx_INCREF(__pyx_t_6);
7551         __Pyx_INCREF(function);
7552         __Pyx_DECREF_SET(__pyx_t_5, function);
7553       }
7554     }
7555     __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);
7556     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7557     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 139, __pyx_L1_error)
7558     __Pyx_GOTREF(__pyx_t_3);
7559     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7560     __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
7561     __pyx_t_3 = 0;
7562 
7563     /* "View.MemoryView":138
7564  *             raise ValueError("itemsize <= 0 for cython.array")
7565  *
7566  *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
7567  *             format = format.encode('ASCII')
7568  *         self._format = format  # keep a reference to the byte string
7569  */
7570   }
7571 
7572   /* "View.MemoryView":140
7573  *         if not isinstance(format, bytes):
7574  *             format = format.encode('ASCII')
7575  *         self._format = format  # keep a reference to the byte string             # <<<<<<<<<<<<<<
7576  *         self.format = self._format
7577  *
7578  */
7579   if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(1, 140, __pyx_L1_error)
7580   __pyx_t_3 = __pyx_v_format;
7581   __Pyx_INCREF(__pyx_t_3);
7582   __Pyx_GIVEREF(__pyx_t_3);
7583   __Pyx_GOTREF(__pyx_v_self->_format);
7584   __Pyx_DECREF(__pyx_v_self->_format);
7585   __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
7586   __pyx_t_3 = 0;
7587 
7588   /* "View.MemoryView":141
7589  *             format = format.encode('ASCII')
7590  *         self._format = format  # keep a reference to the byte string
7591  *         self.format = self._format             # <<<<<<<<<<<<<<
7592  *
7593  *
7594  */
7595   if (unlikely(__pyx_v_self->_format == Py_None)) {
7596     PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
7597     __PYX_ERR(1, 141, __pyx_L1_error)
7598   }
7599   __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 141, __pyx_L1_error)
7600   __pyx_v_self->format = __pyx_t_7;
7601 
7602   /* "View.MemoryView":144
7603  *
7604  *
7605  *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)             # <<<<<<<<<<<<<<
7606  *         self._strides = self._shape + self.ndim
7607  *
7608  */
7609   __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
7610 
7611   /* "View.MemoryView":145
7612  *
7613  *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
7614  *         self._strides = self._shape + self.ndim             # <<<<<<<<<<<<<<
7615  *
7616  *         if not self._shape:
7617  */
7618   __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
7619 
7620   /* "View.MemoryView":147
7621  *         self._strides = self._shape + self.ndim
7622  *
7623  *         if not self._shape:             # <<<<<<<<<<<<<<
7624  *             raise MemoryError("unable to allocate shape and strides.")
7625  *
7626  */
7627   __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
7628   if (unlikely(__pyx_t_4)) {
7629 
7630     /* "View.MemoryView":148
7631  *
7632  *         if not self._shape:
7633  *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
7634  *
7635  *
7636  */
7637     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 148, __pyx_L1_error)
7638     __Pyx_GOTREF(__pyx_t_3);
7639     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7640     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7641     __PYX_ERR(1, 148, __pyx_L1_error)
7642 
7643     /* "View.MemoryView":147
7644  *         self._strides = self._shape + self.ndim
7645  *
7646  *         if not self._shape:             # <<<<<<<<<<<<<<
7647  *             raise MemoryError("unable to allocate shape and strides.")
7648  *
7649  */
7650   }
7651 
7652   /* "View.MemoryView":151
7653  *
7654  *
7655  *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
7656  *             if dim <= 0:
7657  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
7658  */
7659   __pyx_t_8 = 0;
7660   __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
7661   for (;;) {
7662     if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
7663     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7664     __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(1, 151, __pyx_L1_error)
7665     #else
7666     __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 151, __pyx_L1_error)
7667     __Pyx_GOTREF(__pyx_t_5);
7668     #endif
7669     __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 151, __pyx_L1_error)
7670     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7671     __pyx_v_dim = __pyx_t_9;
7672     __pyx_v_idx = __pyx_t_8;
7673     __pyx_t_8 = (__pyx_t_8 + 1);
7674 
7675     /* "View.MemoryView":152
7676  *
7677  *         for idx, dim in enumerate(shape):
7678  *             if dim <= 0:             # <<<<<<<<<<<<<<
7679  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
7680  *             self._shape[idx] = dim
7681  */
7682     __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
7683     if (unlikely(__pyx_t_4)) {
7684 
7685       /* "View.MemoryView":153
7686  *         for idx, dim in enumerate(shape):
7687  *             if dim <= 0:
7688  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))             # <<<<<<<<<<<<<<
7689  *             self._shape[idx] = dim
7690  *
7691  */
7692       __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 153, __pyx_L1_error)
7693       __Pyx_GOTREF(__pyx_t_5);
7694       __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 153, __pyx_L1_error)
7695       __Pyx_GOTREF(__pyx_t_6);
7696       __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 153, __pyx_L1_error)
7697       __Pyx_GOTREF(__pyx_t_10);
7698       __Pyx_GIVEREF(__pyx_t_5);
7699       PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
7700       __Pyx_GIVEREF(__pyx_t_6);
7701       PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
7702       __pyx_t_5 = 0;
7703       __pyx_t_6 = 0;
7704       __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 153, __pyx_L1_error)
7705       __Pyx_GOTREF(__pyx_t_6);
7706       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7707       __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 153, __pyx_L1_error)
7708       __Pyx_GOTREF(__pyx_t_10);
7709       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7710       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
7711       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7712       __PYX_ERR(1, 153, __pyx_L1_error)
7713 
7714       /* "View.MemoryView":152
7715  *
7716  *         for idx, dim in enumerate(shape):
7717  *             if dim <= 0:             # <<<<<<<<<<<<<<
7718  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
7719  *             self._shape[idx] = dim
7720  */
7721     }
7722 
7723     /* "View.MemoryView":154
7724  *             if dim <= 0:
7725  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
7726  *             self._shape[idx] = dim             # <<<<<<<<<<<<<<
7727  *
7728  *         cdef char order
7729  */
7730     (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
7731 
7732     /* "View.MemoryView":151
7733  *
7734  *
7735  *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
7736  *             if dim <= 0:
7737  *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
7738  */
7739   }
7740   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7741 
7742   /* "View.MemoryView":157
7743  *
7744  *         cdef char order
7745  *         if mode == 'fortran':             # <<<<<<<<<<<<<<
7746  *             order = b'F'
7747  *             self.mode = u'fortran'
7748  */
7749   __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 157, __pyx_L1_error)
7750   if (__pyx_t_4) {
7751 
7752     /* "View.MemoryView":158
7753  *         cdef char order
7754  *         if mode == 'fortran':
7755  *             order = b'F'             # <<<<<<<<<<<<<<
7756  *             self.mode = u'fortran'
7757  *         elif mode == 'c':
7758  */
7759     __pyx_v_order = 'F';
7760 
7761     /* "View.MemoryView":159
7762  *         if mode == 'fortran':
7763  *             order = b'F'
7764  *             self.mode = u'fortran'             # <<<<<<<<<<<<<<
7765  *         elif mode == 'c':
7766  *             order = b'C'
7767  */
7768     __Pyx_INCREF(__pyx_n_u_fortran);
7769     __Pyx_GIVEREF(__pyx_n_u_fortran);
7770     __Pyx_GOTREF(__pyx_v_self->mode);
7771     __Pyx_DECREF(__pyx_v_self->mode);
7772     __pyx_v_self->mode = __pyx_n_u_fortran;
7773 
7774     /* "View.MemoryView":157
7775  *
7776  *         cdef char order
7777  *         if mode == 'fortran':             # <<<<<<<<<<<<<<
7778  *             order = b'F'
7779  *             self.mode = u'fortran'
7780  */
7781     goto __pyx_L10;
7782   }
7783 
7784   /* "View.MemoryView":160
7785  *             order = b'F'
7786  *             self.mode = u'fortran'
7787  *         elif mode == 'c':             # <<<<<<<<<<<<<<
7788  *             order = b'C'
7789  *             self.mode = u'c'
7790  */
7791   __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 160, __pyx_L1_error)
7792   if (likely(__pyx_t_4)) {
7793 
7794     /* "View.MemoryView":161
7795  *             self.mode = u'fortran'
7796  *         elif mode == 'c':
7797  *             order = b'C'             # <<<<<<<<<<<<<<
7798  *             self.mode = u'c'
7799  *         else:
7800  */
7801     __pyx_v_order = 'C';
7802 
7803     /* "View.MemoryView":162
7804  *         elif mode == 'c':
7805  *             order = b'C'
7806  *             self.mode = u'c'             # <<<<<<<<<<<<<<
7807  *         else:
7808  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
7809  */
7810     __Pyx_INCREF(__pyx_n_u_c);
7811     __Pyx_GIVEREF(__pyx_n_u_c);
7812     __Pyx_GOTREF(__pyx_v_self->mode);
7813     __Pyx_DECREF(__pyx_v_self->mode);
7814     __pyx_v_self->mode = __pyx_n_u_c;
7815 
7816     /* "View.MemoryView":160
7817  *             order = b'F'
7818  *             self.mode = u'fortran'
7819  *         elif mode == 'c':             # <<<<<<<<<<<<<<
7820  *             order = b'C'
7821  *             self.mode = u'c'
7822  */
7823     goto __pyx_L10;
7824   }
7825 
7826   /* "View.MemoryView":164
7827  *             self.mode = u'c'
7828  *         else:
7829  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)             # <<<<<<<<<<<<<<
7830  *
7831  *         self.len = fill_contig_strides_array(self._shape, self._strides,
7832  */
7833   /*else*/ {
7834     __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 164, __pyx_L1_error)
7835     __Pyx_GOTREF(__pyx_t_3);
7836     __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 164, __pyx_L1_error)
7837     __Pyx_GOTREF(__pyx_t_10);
7838     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7839     __Pyx_Raise(__pyx_t_10, 0, 0, 0);
7840     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7841     __PYX_ERR(1, 164, __pyx_L1_error)
7842   }
7843   __pyx_L10:;
7844 
7845   /* "View.MemoryView":166
7846  *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
7847  *
7848  *         self.len = fill_contig_strides_array(self._shape, self._strides,             # <<<<<<<<<<<<<<
7849  *                                              itemsize, self.ndim, order)
7850  *
7851  */
7852   __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);
7853 
7854   /* "View.MemoryView":169
7855  *                                              itemsize, self.ndim, order)
7856  *
7857  *         self.free_data = allocate_buffer             # <<<<<<<<<<<<<<
7858  *         self.dtype_is_object = format == b'O'
7859  *         if allocate_buffer:
7860  */
7861   __pyx_v_self->free_data = __pyx_v_allocate_buffer;
7862 
7863   /* "View.MemoryView":170
7864  *
7865  *         self.free_data = allocate_buffer
7866  *         self.dtype_is_object = format == b'O'             # <<<<<<<<<<<<<<
7867  *         if allocate_buffer:
7868  *
7869  */
7870   __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 170, __pyx_L1_error)
7871   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 170, __pyx_L1_error)
7872   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7873   __pyx_v_self->dtype_is_object = __pyx_t_4;
7874 
7875   /* "View.MemoryView":171
7876  *         self.free_data = allocate_buffer
7877  *         self.dtype_is_object = format == b'O'
7878  *         if allocate_buffer:             # <<<<<<<<<<<<<<
7879  *
7880  *
7881  */
7882   __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
7883   if (__pyx_t_4) {
7884 
7885     /* "View.MemoryView":174
7886  *
7887  *
7888  *             self.data = <char *>malloc(self.len)             # <<<<<<<<<<<<<<
7889  *             if not self.data:
7890  *                 raise MemoryError("unable to allocate array data.")
7891  */
7892     __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
7893 
7894     /* "View.MemoryView":175
7895  *
7896  *             self.data = <char *>malloc(self.len)
7897  *             if not self.data:             # <<<<<<<<<<<<<<
7898  *                 raise MemoryError("unable to allocate array data.")
7899  *
7900  */
7901     __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
7902     if (unlikely(__pyx_t_4)) {
7903 
7904       /* "View.MemoryView":176
7905  *             self.data = <char *>malloc(self.len)
7906  *             if not self.data:
7907  *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
7908  *
7909  *             if self.dtype_is_object:
7910  */
7911       __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 176, __pyx_L1_error)
7912       __Pyx_GOTREF(__pyx_t_10);
7913       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
7914       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7915       __PYX_ERR(1, 176, __pyx_L1_error)
7916 
7917       /* "View.MemoryView":175
7918  *
7919  *             self.data = <char *>malloc(self.len)
7920  *             if not self.data:             # <<<<<<<<<<<<<<
7921  *                 raise MemoryError("unable to allocate array data.")
7922  *
7923  */
7924     }
7925 
7926     /* "View.MemoryView":178
7927  *                 raise MemoryError("unable to allocate array data.")
7928  *
7929  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
7930  *                 p = <PyObject **> self.data
7931  *                 for i in range(self.len / itemsize):
7932  */
7933     __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
7934     if (__pyx_t_4) {
7935 
7936       /* "View.MemoryView":179
7937  *
7938  *             if self.dtype_is_object:
7939  *                 p = <PyObject **> self.data             # <<<<<<<<<<<<<<
7940  *                 for i in range(self.len / itemsize):
7941  *                     p[i] = Py_None
7942  */
7943       __pyx_v_p = ((PyObject **)__pyx_v_self->data);
7944 
7945       /* "View.MemoryView":180
7946  *             if self.dtype_is_object:
7947  *                 p = <PyObject **> self.data
7948  *                 for i in range(self.len / itemsize):             # <<<<<<<<<<<<<<
7949  *                     p[i] = Py_None
7950  *                     Py_INCREF(Py_None)
7951  */
7952       if (unlikely(__pyx_v_itemsize == 0)) {
7953         PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
7954         __PYX_ERR(1, 180, __pyx_L1_error)
7955       }
7956       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))) {
7957         PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
7958         __PYX_ERR(1, 180, __pyx_L1_error)
7959       }
7960       __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
7961       __pyx_t_9 = __pyx_t_1;
7962       for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
7963         __pyx_v_i = __pyx_t_11;
7964 
7965         /* "View.MemoryView":181
7966  *                 p = <PyObject **> self.data
7967  *                 for i in range(self.len / itemsize):
7968  *                     p[i] = Py_None             # <<<<<<<<<<<<<<
7969  *                     Py_INCREF(Py_None)
7970  *
7971  */
7972         (__pyx_v_p[__pyx_v_i]) = Py_None;
7973 
7974         /* "View.MemoryView":182
7975  *                 for i in range(self.len / itemsize):
7976  *                     p[i] = Py_None
7977  *                     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
7978  *
7979  *     @cname('getbuffer')
7980  */
7981         Py_INCREF(Py_None);
7982       }
7983 
7984       /* "View.MemoryView":178
7985  *                 raise MemoryError("unable to allocate array data.")
7986  *
7987  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
7988  *                 p = <PyObject **> self.data
7989  *                 for i in range(self.len / itemsize):
7990  */
7991     }
7992 
7993     /* "View.MemoryView":171
7994  *         self.free_data = allocate_buffer
7995  *         self.dtype_is_object = format == b'O'
7996  *         if allocate_buffer:             # <<<<<<<<<<<<<<
7997  *
7998  *
7999  */
8000   }
8001 
8002   /* "View.MemoryView":122
8003  *         cdef bint dtype_is_object
8004  *
8005  *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
8006  *                   mode="c", bint allocate_buffer=True):
8007  *
8008  */
8009 
8010   /* function exit code */
8011   __pyx_r = 0;
8012   goto __pyx_L0;
8013   __pyx_L1_error:;
8014   __Pyx_XDECREF(__pyx_t_3);
8015   __Pyx_XDECREF(__pyx_t_5);
8016   __Pyx_XDECREF(__pyx_t_6);
8017   __Pyx_XDECREF(__pyx_t_10);
8018   __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8019   __pyx_r = -1;
8020   __pyx_L0:;
8021   __Pyx_XDECREF(__pyx_v_format);
8022   __Pyx_RefNannyFinishContext();
8023   return __pyx_r;
8024 }
8025 
8026 /* "View.MemoryView":185
8027  *
8028  *     @cname('getbuffer')
8029  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
8030  *         cdef int bufmode = -1
8031  *         if self.mode == u"c":
8032  */
8033 
8034 /* Python wrapper */
8035 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)8036 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
8037   int __pyx_r;
8038   __Pyx_RefNannyDeclarations
8039   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
8040   __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));
8041 
8042   /* function exit code */
8043   __Pyx_RefNannyFinishContext();
8044   return __pyx_r;
8045 }
8046 
__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)8047 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) {
8048   int __pyx_v_bufmode;
8049   int __pyx_r;
8050   __Pyx_RefNannyDeclarations
8051   int __pyx_t_1;
8052   int __pyx_t_2;
8053   PyObject *__pyx_t_3 = NULL;
8054   char *__pyx_t_4;
8055   Py_ssize_t __pyx_t_5;
8056   int __pyx_t_6;
8057   Py_ssize_t *__pyx_t_7;
8058   int __pyx_lineno = 0;
8059   const char *__pyx_filename = NULL;
8060   int __pyx_clineno = 0;
8061   if (__pyx_v_info == NULL) {
8062     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
8063     return -1;
8064   }
8065   __Pyx_RefNannySetupContext("__getbuffer__", 0);
8066   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
8067   __Pyx_GIVEREF(__pyx_v_info->obj);
8068 
8069   /* "View.MemoryView":186
8070  *     @cname('getbuffer')
8071  *     def __getbuffer__(self, Py_buffer *info, int flags):
8072  *         cdef int bufmode = -1             # <<<<<<<<<<<<<<
8073  *         if self.mode == u"c":
8074  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
8075  */
8076   __pyx_v_bufmode = -1;
8077 
8078   /* "View.MemoryView":187
8079  *     def __getbuffer__(self, Py_buffer *info, int flags):
8080  *         cdef int bufmode = -1
8081  *         if self.mode == u"c":             # <<<<<<<<<<<<<<
8082  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
8083  *         elif self.mode == u"fortran":
8084  */
8085   __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 187, __pyx_L1_error)
8086   __pyx_t_2 = (__pyx_t_1 != 0);
8087   if (__pyx_t_2) {
8088 
8089     /* "View.MemoryView":188
8090  *         cdef int bufmode = -1
8091  *         if self.mode == u"c":
8092  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
8093  *         elif self.mode == u"fortran":
8094  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
8095  */
8096     __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
8097 
8098     /* "View.MemoryView":187
8099  *     def __getbuffer__(self, Py_buffer *info, int flags):
8100  *         cdef int bufmode = -1
8101  *         if self.mode == u"c":             # <<<<<<<<<<<<<<
8102  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
8103  *         elif self.mode == u"fortran":
8104  */
8105     goto __pyx_L3;
8106   }
8107 
8108   /* "View.MemoryView":189
8109  *         if self.mode == u"c":
8110  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
8111  *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
8112  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
8113  *         if not (flags & bufmode):
8114  */
8115   __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 189, __pyx_L1_error)
8116   __pyx_t_1 = (__pyx_t_2 != 0);
8117   if (__pyx_t_1) {
8118 
8119     /* "View.MemoryView":190
8120  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
8121  *         elif self.mode == u"fortran":
8122  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
8123  *         if not (flags & bufmode):
8124  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
8125  */
8126     __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
8127 
8128     /* "View.MemoryView":189
8129  *         if self.mode == u"c":
8130  *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
8131  *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
8132  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
8133  *         if not (flags & bufmode):
8134  */
8135   }
8136   __pyx_L3:;
8137 
8138   /* "View.MemoryView":191
8139  *         elif self.mode == u"fortran":
8140  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
8141  *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
8142  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
8143  *         info.buf = self.data
8144  */
8145   __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
8146   if (unlikely(__pyx_t_1)) {
8147 
8148     /* "View.MemoryView":192
8149  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
8150  *         if not (flags & bufmode):
8151  *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
8152  *         info.buf = self.data
8153  *         info.len = self.len
8154  */
8155     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 192, __pyx_L1_error)
8156     __Pyx_GOTREF(__pyx_t_3);
8157     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8158     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8159     __PYX_ERR(1, 192, __pyx_L1_error)
8160 
8161     /* "View.MemoryView":191
8162  *         elif self.mode == u"fortran":
8163  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
8164  *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
8165  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
8166  *         info.buf = self.data
8167  */
8168   }
8169 
8170   /* "View.MemoryView":193
8171  *         if not (flags & bufmode):
8172  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
8173  *         info.buf = self.data             # <<<<<<<<<<<<<<
8174  *         info.len = self.len
8175  *         info.ndim = self.ndim
8176  */
8177   __pyx_t_4 = __pyx_v_self->data;
8178   __pyx_v_info->buf = __pyx_t_4;
8179 
8180   /* "View.MemoryView":194
8181  *             raise ValueError("Can only create a buffer that is contiguous in memory.")
8182  *         info.buf = self.data
8183  *         info.len = self.len             # <<<<<<<<<<<<<<
8184  *         info.ndim = self.ndim
8185  *         info.shape = self._shape
8186  */
8187   __pyx_t_5 = __pyx_v_self->len;
8188   __pyx_v_info->len = __pyx_t_5;
8189 
8190   /* "View.MemoryView":195
8191  *         info.buf = self.data
8192  *         info.len = self.len
8193  *         info.ndim = self.ndim             # <<<<<<<<<<<<<<
8194  *         info.shape = self._shape
8195  *         info.strides = self._strides
8196  */
8197   __pyx_t_6 = __pyx_v_self->ndim;
8198   __pyx_v_info->ndim = __pyx_t_6;
8199 
8200   /* "View.MemoryView":196
8201  *         info.len = self.len
8202  *         info.ndim = self.ndim
8203  *         info.shape = self._shape             # <<<<<<<<<<<<<<
8204  *         info.strides = self._strides
8205  *         info.suboffsets = NULL
8206  */
8207   __pyx_t_7 = __pyx_v_self->_shape;
8208   __pyx_v_info->shape = __pyx_t_7;
8209 
8210   /* "View.MemoryView":197
8211  *         info.ndim = self.ndim
8212  *         info.shape = self._shape
8213  *         info.strides = self._strides             # <<<<<<<<<<<<<<
8214  *         info.suboffsets = NULL
8215  *         info.itemsize = self.itemsize
8216  */
8217   __pyx_t_7 = __pyx_v_self->_strides;
8218   __pyx_v_info->strides = __pyx_t_7;
8219 
8220   /* "View.MemoryView":198
8221  *         info.shape = self._shape
8222  *         info.strides = self._strides
8223  *         info.suboffsets = NULL             # <<<<<<<<<<<<<<
8224  *         info.itemsize = self.itemsize
8225  *         info.readonly = 0
8226  */
8227   __pyx_v_info->suboffsets = NULL;
8228 
8229   /* "View.MemoryView":199
8230  *         info.strides = self._strides
8231  *         info.suboffsets = NULL
8232  *         info.itemsize = self.itemsize             # <<<<<<<<<<<<<<
8233  *         info.readonly = 0
8234  *
8235  */
8236   __pyx_t_5 = __pyx_v_self->itemsize;
8237   __pyx_v_info->itemsize = __pyx_t_5;
8238 
8239   /* "View.MemoryView":200
8240  *         info.suboffsets = NULL
8241  *         info.itemsize = self.itemsize
8242  *         info.readonly = 0             # <<<<<<<<<<<<<<
8243  *
8244  *         if flags & PyBUF_FORMAT:
8245  */
8246   __pyx_v_info->readonly = 0;
8247 
8248   /* "View.MemoryView":202
8249  *         info.readonly = 0
8250  *
8251  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
8252  *             info.format = self.format
8253  *         else:
8254  */
8255   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
8256   if (__pyx_t_1) {
8257 
8258     /* "View.MemoryView":203
8259  *
8260  *         if flags & PyBUF_FORMAT:
8261  *             info.format = self.format             # <<<<<<<<<<<<<<
8262  *         else:
8263  *             info.format = NULL
8264  */
8265     __pyx_t_4 = __pyx_v_self->format;
8266     __pyx_v_info->format = __pyx_t_4;
8267 
8268     /* "View.MemoryView":202
8269  *         info.readonly = 0
8270  *
8271  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
8272  *             info.format = self.format
8273  *         else:
8274  */
8275     goto __pyx_L5;
8276   }
8277 
8278   /* "View.MemoryView":205
8279  *             info.format = self.format
8280  *         else:
8281  *             info.format = NULL             # <<<<<<<<<<<<<<
8282  *
8283  *         info.obj = self
8284  */
8285   /*else*/ {
8286     __pyx_v_info->format = NULL;
8287   }
8288   __pyx_L5:;
8289 
8290   /* "View.MemoryView":207
8291  *             info.format = NULL
8292  *
8293  *         info.obj = self             # <<<<<<<<<<<<<<
8294  *
8295  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
8296  */
8297   __Pyx_INCREF(((PyObject *)__pyx_v_self));
8298   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
8299   __Pyx_GOTREF(__pyx_v_info->obj);
8300   __Pyx_DECREF(__pyx_v_info->obj);
8301   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
8302 
8303   /* "View.MemoryView":185
8304  *
8305  *     @cname('getbuffer')
8306  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
8307  *         cdef int bufmode = -1
8308  *         if self.mode == u"c":
8309  */
8310 
8311   /* function exit code */
8312   __pyx_r = 0;
8313   goto __pyx_L0;
8314   __pyx_L1_error:;
8315   __Pyx_XDECREF(__pyx_t_3);
8316   __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8317   __pyx_r = -1;
8318   if (__pyx_v_info->obj != NULL) {
8319     __Pyx_GOTREF(__pyx_v_info->obj);
8320     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
8321   }
8322   goto __pyx_L2;
8323   __pyx_L0:;
8324   if (__pyx_v_info->obj == Py_None) {
8325     __Pyx_GOTREF(__pyx_v_info->obj);
8326     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
8327   }
8328   __pyx_L2:;
8329   __Pyx_RefNannyFinishContext();
8330   return __pyx_r;
8331 }
8332 
8333 /* "View.MemoryView":211
8334  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
8335  *
8336  *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
8337  *         if self.callback_free_data != NULL:
8338  *             self.callback_free_data(self.data)
8339  */
8340 
8341 /* Python wrapper */
8342 static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_array___dealloc__(PyObject * __pyx_v_self)8343 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
8344   __Pyx_RefNannyDeclarations
8345   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
8346   __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));
8347 
8348   /* function exit code */
8349   __Pyx_RefNannyFinishContext();
8350 }
8351 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj * __pyx_v_self)8352 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
8353   __Pyx_RefNannyDeclarations
8354   int __pyx_t_1;
8355   __Pyx_RefNannySetupContext("__dealloc__", 0);
8356 
8357   /* "View.MemoryView":212
8358  *
8359  *     def __dealloc__(array self):
8360  *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
8361  *             self.callback_free_data(self.data)
8362  *         elif self.free_data:
8363  */
8364   __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
8365   if (__pyx_t_1) {
8366 
8367     /* "View.MemoryView":213
8368  *     def __dealloc__(array self):
8369  *         if self.callback_free_data != NULL:
8370  *             self.callback_free_data(self.data)             # <<<<<<<<<<<<<<
8371  *         elif self.free_data:
8372  *             if self.dtype_is_object:
8373  */
8374     __pyx_v_self->callback_free_data(__pyx_v_self->data);
8375 
8376     /* "View.MemoryView":212
8377  *
8378  *     def __dealloc__(array self):
8379  *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
8380  *             self.callback_free_data(self.data)
8381  *         elif self.free_data:
8382  */
8383     goto __pyx_L3;
8384   }
8385 
8386   /* "View.MemoryView":214
8387  *         if self.callback_free_data != NULL:
8388  *             self.callback_free_data(self.data)
8389  *         elif self.free_data:             # <<<<<<<<<<<<<<
8390  *             if self.dtype_is_object:
8391  *                 refcount_objects_in_slice(self.data, self._shape,
8392  */
8393   __pyx_t_1 = (__pyx_v_self->free_data != 0);
8394   if (__pyx_t_1) {
8395 
8396     /* "View.MemoryView":215
8397  *             self.callback_free_data(self.data)
8398  *         elif self.free_data:
8399  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
8400  *                 refcount_objects_in_slice(self.data, self._shape,
8401  *                                           self._strides, self.ndim, False)
8402  */
8403     __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
8404     if (__pyx_t_1) {
8405 
8406       /* "View.MemoryView":216
8407  *         elif self.free_data:
8408  *             if self.dtype_is_object:
8409  *                 refcount_objects_in_slice(self.data, self._shape,             # <<<<<<<<<<<<<<
8410  *                                           self._strides, self.ndim, False)
8411  *             free(self.data)
8412  */
8413       __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
8414 
8415       /* "View.MemoryView":215
8416  *             self.callback_free_data(self.data)
8417  *         elif self.free_data:
8418  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
8419  *                 refcount_objects_in_slice(self.data, self._shape,
8420  *                                           self._strides, self.ndim, False)
8421  */
8422     }
8423 
8424     /* "View.MemoryView":218
8425  *                 refcount_objects_in_slice(self.data, self._shape,
8426  *                                           self._strides, self.ndim, False)
8427  *             free(self.data)             # <<<<<<<<<<<<<<
8428  *         PyObject_Free(self._shape)
8429  *
8430  */
8431     free(__pyx_v_self->data);
8432 
8433     /* "View.MemoryView":214
8434  *         if self.callback_free_data != NULL:
8435  *             self.callback_free_data(self.data)
8436  *         elif self.free_data:             # <<<<<<<<<<<<<<
8437  *             if self.dtype_is_object:
8438  *                 refcount_objects_in_slice(self.data, self._shape,
8439  */
8440   }
8441   __pyx_L3:;
8442 
8443   /* "View.MemoryView":219
8444  *                                           self._strides, self.ndim, False)
8445  *             free(self.data)
8446  *         PyObject_Free(self._shape)             # <<<<<<<<<<<<<<
8447  *
8448  *     @property
8449  */
8450   PyObject_Free(__pyx_v_self->_shape);
8451 
8452   /* "View.MemoryView":211
8453  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
8454  *
8455  *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
8456  *         if self.callback_free_data != NULL:
8457  *             self.callback_free_data(self.data)
8458  */
8459 
8460   /* function exit code */
8461   __Pyx_RefNannyFinishContext();
8462 }
8463 
8464 /* "View.MemoryView":222
8465  *
8466  *     @property
8467  *     def memview(self):             # <<<<<<<<<<<<<<
8468  *         return self.get_memview()
8469  *
8470  */
8471 
8472 /* Python wrapper */
8473 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)8474 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
8475   PyObject *__pyx_r = 0;
8476   __Pyx_RefNannyDeclarations
8477   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
8478   __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));
8479 
8480   /* function exit code */
8481   __Pyx_RefNannyFinishContext();
8482   return __pyx_r;
8483 }
8484 
__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj * __pyx_v_self)8485 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
8486   PyObject *__pyx_r = NULL;
8487   __Pyx_RefNannyDeclarations
8488   PyObject *__pyx_t_1 = NULL;
8489   int __pyx_lineno = 0;
8490   const char *__pyx_filename = NULL;
8491   int __pyx_clineno = 0;
8492   __Pyx_RefNannySetupContext("__get__", 0);
8493 
8494   /* "View.MemoryView":223
8495  *     @property
8496  *     def memview(self):
8497  *         return self.get_memview()             # <<<<<<<<<<<<<<
8498  *
8499  *     @cname('get_memview')
8500  */
8501   __Pyx_XDECREF(__pyx_r);
8502   __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 223, __pyx_L1_error)
8503   __Pyx_GOTREF(__pyx_t_1);
8504   __pyx_r = __pyx_t_1;
8505   __pyx_t_1 = 0;
8506   goto __pyx_L0;
8507 
8508   /* "View.MemoryView":222
8509  *
8510  *     @property
8511  *     def memview(self):             # <<<<<<<<<<<<<<
8512  *         return self.get_memview()
8513  *
8514  */
8515 
8516   /* function exit code */
8517   __pyx_L1_error:;
8518   __Pyx_XDECREF(__pyx_t_1);
8519   __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8520   __pyx_r = NULL;
8521   __pyx_L0:;
8522   __Pyx_XGIVEREF(__pyx_r);
8523   __Pyx_RefNannyFinishContext();
8524   return __pyx_r;
8525 }
8526 
8527 /* "View.MemoryView":226
8528  *
8529  *     @cname('get_memview')
8530  *     cdef get_memview(self):             # <<<<<<<<<<<<<<
8531  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
8532  *         return  memoryview(self, flags, self.dtype_is_object)
8533  */
8534 
__pyx_array_get_memview(struct __pyx_array_obj * __pyx_v_self)8535 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
8536   int __pyx_v_flags;
8537   PyObject *__pyx_r = NULL;
8538   __Pyx_RefNannyDeclarations
8539   PyObject *__pyx_t_1 = NULL;
8540   PyObject *__pyx_t_2 = NULL;
8541   PyObject *__pyx_t_3 = NULL;
8542   int __pyx_lineno = 0;
8543   const char *__pyx_filename = NULL;
8544   int __pyx_clineno = 0;
8545   __Pyx_RefNannySetupContext("get_memview", 0);
8546 
8547   /* "View.MemoryView":227
8548  *     @cname('get_memview')
8549  *     cdef get_memview(self):
8550  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE             # <<<<<<<<<<<<<<
8551  *         return  memoryview(self, flags, self.dtype_is_object)
8552  *
8553  */
8554   __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
8555 
8556   /* "View.MemoryView":228
8557  *     cdef get_memview(self):
8558  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
8559  *         return  memoryview(self, flags, self.dtype_is_object)             # <<<<<<<<<<<<<<
8560  *
8561  *     def __len__(self):
8562  */
8563   __Pyx_XDECREF(__pyx_r);
8564   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 228, __pyx_L1_error)
8565   __Pyx_GOTREF(__pyx_t_1);
8566   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error)
8567   __Pyx_GOTREF(__pyx_t_2);
8568   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 228, __pyx_L1_error)
8569   __Pyx_GOTREF(__pyx_t_3);
8570   __Pyx_INCREF(((PyObject *)__pyx_v_self));
8571   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
8572   PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
8573   __Pyx_GIVEREF(__pyx_t_1);
8574   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
8575   __Pyx_GIVEREF(__pyx_t_2);
8576   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
8577   __pyx_t_1 = 0;
8578   __pyx_t_2 = 0;
8579   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error)
8580   __Pyx_GOTREF(__pyx_t_2);
8581   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8582   __pyx_r = __pyx_t_2;
8583   __pyx_t_2 = 0;
8584   goto __pyx_L0;
8585 
8586   /* "View.MemoryView":226
8587  *
8588  *     @cname('get_memview')
8589  *     cdef get_memview(self):             # <<<<<<<<<<<<<<
8590  *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
8591  *         return  memoryview(self, flags, self.dtype_is_object)
8592  */
8593 
8594   /* function exit code */
8595   __pyx_L1_error:;
8596   __Pyx_XDECREF(__pyx_t_1);
8597   __Pyx_XDECREF(__pyx_t_2);
8598   __Pyx_XDECREF(__pyx_t_3);
8599   __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
8600   __pyx_r = 0;
8601   __pyx_L0:;
8602   __Pyx_XGIVEREF(__pyx_r);
8603   __Pyx_RefNannyFinishContext();
8604   return __pyx_r;
8605 }
8606 
8607 /* "View.MemoryView":230
8608  *         return  memoryview(self, flags, self.dtype_is_object)
8609  *
8610  *     def __len__(self):             # <<<<<<<<<<<<<<
8611  *         return self._shape[0]
8612  *
8613  */
8614 
8615 /* Python wrapper */
8616 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
__pyx_array___len__(PyObject * __pyx_v_self)8617 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
8618   Py_ssize_t __pyx_r;
8619   __Pyx_RefNannyDeclarations
8620   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
8621   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));
8622 
8623   /* function exit code */
8624   __Pyx_RefNannyFinishContext();
8625   return __pyx_r;
8626 }
8627 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj * __pyx_v_self)8628 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
8629   Py_ssize_t __pyx_r;
8630   __Pyx_RefNannyDeclarations
8631   __Pyx_RefNannySetupContext("__len__", 0);
8632 
8633   /* "View.MemoryView":231
8634  *
8635  *     def __len__(self):
8636  *         return self._shape[0]             # <<<<<<<<<<<<<<
8637  *
8638  *     def __getattr__(self, attr):
8639  */
8640   __pyx_r = (__pyx_v_self->_shape[0]);
8641   goto __pyx_L0;
8642 
8643   /* "View.MemoryView":230
8644  *         return  memoryview(self, flags, self.dtype_is_object)
8645  *
8646  *     def __len__(self):             # <<<<<<<<<<<<<<
8647  *         return self._shape[0]
8648  *
8649  */
8650 
8651   /* function exit code */
8652   __pyx_L0:;
8653   __Pyx_RefNannyFinishContext();
8654   return __pyx_r;
8655 }
8656 
8657 /* "View.MemoryView":233
8658  *         return self._shape[0]
8659  *
8660  *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
8661  *         return getattr(self.memview, attr)
8662  *
8663  */
8664 
8665 /* Python wrapper */
8666 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)8667 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
8668   PyObject *__pyx_r = 0;
8669   __Pyx_RefNannyDeclarations
8670   __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
8671   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
8672 
8673   /* function exit code */
8674   __Pyx_RefNannyFinishContext();
8675   return __pyx_r;
8676 }
8677 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_attr)8678 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
8679   PyObject *__pyx_r = NULL;
8680   __Pyx_RefNannyDeclarations
8681   PyObject *__pyx_t_1 = NULL;
8682   PyObject *__pyx_t_2 = NULL;
8683   int __pyx_lineno = 0;
8684   const char *__pyx_filename = NULL;
8685   int __pyx_clineno = 0;
8686   __Pyx_RefNannySetupContext("__getattr__", 0);
8687 
8688   /* "View.MemoryView":234
8689  *
8690  *     def __getattr__(self, attr):
8691  *         return getattr(self.memview, attr)             # <<<<<<<<<<<<<<
8692  *
8693  *     def __getitem__(self, item):
8694  */
8695   __Pyx_XDECREF(__pyx_r);
8696   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 234, __pyx_L1_error)
8697   __Pyx_GOTREF(__pyx_t_1);
8698   __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 234, __pyx_L1_error)
8699   __Pyx_GOTREF(__pyx_t_2);
8700   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8701   __pyx_r = __pyx_t_2;
8702   __pyx_t_2 = 0;
8703   goto __pyx_L0;
8704 
8705   /* "View.MemoryView":233
8706  *         return self._shape[0]
8707  *
8708  *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
8709  *         return getattr(self.memview, attr)
8710  *
8711  */
8712 
8713   /* function exit code */
8714   __pyx_L1_error:;
8715   __Pyx_XDECREF(__pyx_t_1);
8716   __Pyx_XDECREF(__pyx_t_2);
8717   __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8718   __pyx_r = NULL;
8719   __pyx_L0:;
8720   __Pyx_XGIVEREF(__pyx_r);
8721   __Pyx_RefNannyFinishContext();
8722   return __pyx_r;
8723 }
8724 
8725 /* "View.MemoryView":236
8726  *         return getattr(self.memview, attr)
8727  *
8728  *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
8729  *         return self.memview[item]
8730  *
8731  */
8732 
8733 /* Python wrapper */
8734 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)8735 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
8736   PyObject *__pyx_r = 0;
8737   __Pyx_RefNannyDeclarations
8738   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
8739   __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
8740 
8741   /* function exit code */
8742   __Pyx_RefNannyFinishContext();
8743   return __pyx_r;
8744 }
8745 
__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj * __pyx_v_self,PyObject * __pyx_v_item)8746 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
8747   PyObject *__pyx_r = NULL;
8748   __Pyx_RefNannyDeclarations
8749   PyObject *__pyx_t_1 = NULL;
8750   PyObject *__pyx_t_2 = NULL;
8751   int __pyx_lineno = 0;
8752   const char *__pyx_filename = NULL;
8753   int __pyx_clineno = 0;
8754   __Pyx_RefNannySetupContext("__getitem__", 0);
8755 
8756   /* "View.MemoryView":237
8757  *
8758  *     def __getitem__(self, item):
8759  *         return self.memview[item]             # <<<<<<<<<<<<<<
8760  *
8761  *     def __setitem__(self, item, value):
8762  */
8763   __Pyx_XDECREF(__pyx_r);
8764   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 237, __pyx_L1_error)
8765   __Pyx_GOTREF(__pyx_t_1);
8766   __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 237, __pyx_L1_error)
8767   __Pyx_GOTREF(__pyx_t_2);
8768   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8769   __pyx_r = __pyx_t_2;
8770   __pyx_t_2 = 0;
8771   goto __pyx_L0;
8772 
8773   /* "View.MemoryView":236
8774  *         return getattr(self.memview, attr)
8775  *
8776  *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
8777  *         return self.memview[item]
8778  *
8779  */
8780 
8781   /* function exit code */
8782   __pyx_L1_error:;
8783   __Pyx_XDECREF(__pyx_t_1);
8784   __Pyx_XDECREF(__pyx_t_2);
8785   __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8786   __pyx_r = NULL;
8787   __pyx_L0:;
8788   __Pyx_XGIVEREF(__pyx_r);
8789   __Pyx_RefNannyFinishContext();
8790   return __pyx_r;
8791 }
8792 
8793 /* "View.MemoryView":239
8794  *         return self.memview[item]
8795  *
8796  *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
8797  *         self.memview[item] = value
8798  *
8799  */
8800 
8801 /* Python wrapper */
8802 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)8803 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
8804   int __pyx_r;
8805   __Pyx_RefNannyDeclarations
8806   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
8807   __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));
8808 
8809   /* function exit code */
8810   __Pyx_RefNannyFinishContext();
8811   return __pyx_r;
8812 }
8813 
__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)8814 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) {
8815   int __pyx_r;
8816   __Pyx_RefNannyDeclarations
8817   PyObject *__pyx_t_1 = NULL;
8818   int __pyx_lineno = 0;
8819   const char *__pyx_filename = NULL;
8820   int __pyx_clineno = 0;
8821   __Pyx_RefNannySetupContext("__setitem__", 0);
8822 
8823   /* "View.MemoryView":240
8824  *
8825  *     def __setitem__(self, item, value):
8826  *         self.memview[item] = value             # <<<<<<<<<<<<<<
8827  *
8828  *
8829  */
8830   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 240, __pyx_L1_error)
8831   __Pyx_GOTREF(__pyx_t_1);
8832   if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(1, 240, __pyx_L1_error)
8833   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8834 
8835   /* "View.MemoryView":239
8836  *         return self.memview[item]
8837  *
8838  *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
8839  *         self.memview[item] = value
8840  *
8841  */
8842 
8843   /* function exit code */
8844   __pyx_r = 0;
8845   goto __pyx_L0;
8846   __pyx_L1_error:;
8847   __Pyx_XDECREF(__pyx_t_1);
8848   __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8849   __pyx_r = -1;
8850   __pyx_L0:;
8851   __Pyx_RefNannyFinishContext();
8852   return __pyx_r;
8853 }
8854 
8855 /* "(tree fragment)":1
8856  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
8857  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8858  * def __setstate_cython__(self, __pyx_state):
8859  */
8860 
8861 /* Python wrapper */
8862 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)8863 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8864   PyObject *__pyx_r = 0;
8865   __Pyx_RefNannyDeclarations
8866   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
8867   __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));
8868 
8869   /* function exit code */
8870   __Pyx_RefNannyFinishContext();
8871   return __pyx_r;
8872 }
8873 
__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj * __pyx_v_self)8874 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
8875   PyObject *__pyx_r = NULL;
8876   __Pyx_RefNannyDeclarations
8877   PyObject *__pyx_t_1 = NULL;
8878   int __pyx_lineno = 0;
8879   const char *__pyx_filename = NULL;
8880   int __pyx_clineno = 0;
8881   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
8882 
8883   /* "(tree fragment)":2
8884  * def __reduce_cython__(self):
8885  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
8886  * def __setstate_cython__(self, __pyx_state):
8887  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8888  */
8889   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
8890   __Pyx_GOTREF(__pyx_t_1);
8891   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8892   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8893   __PYX_ERR(1, 2, __pyx_L1_error)
8894 
8895   /* "(tree fragment)":1
8896  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
8897  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8898  * def __setstate_cython__(self, __pyx_state):
8899  */
8900 
8901   /* function exit code */
8902   __pyx_L1_error:;
8903   __Pyx_XDECREF(__pyx_t_1);
8904   __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8905   __pyx_r = NULL;
8906   __Pyx_XGIVEREF(__pyx_r);
8907   __Pyx_RefNannyFinishContext();
8908   return __pyx_r;
8909 }
8910 
8911 /* "(tree fragment)":3
8912  * def __reduce_cython__(self):
8913  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8914  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
8915  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8916  */
8917 
8918 /* Python wrapper */
8919 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)8920 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8921   PyObject *__pyx_r = 0;
8922   __Pyx_RefNannyDeclarations
8923   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
8924   __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
8925 
8926   /* function exit code */
8927   __Pyx_RefNannyFinishContext();
8928   return __pyx_r;
8929 }
8930 
__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)8931 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) {
8932   PyObject *__pyx_r = NULL;
8933   __Pyx_RefNannyDeclarations
8934   PyObject *__pyx_t_1 = NULL;
8935   int __pyx_lineno = 0;
8936   const char *__pyx_filename = NULL;
8937   int __pyx_clineno = 0;
8938   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
8939 
8940   /* "(tree fragment)":4
8941  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8942  * def __setstate_cython__(self, __pyx_state):
8943  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
8944  */
8945   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
8946   __Pyx_GOTREF(__pyx_t_1);
8947   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8948   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8949   __PYX_ERR(1, 4, __pyx_L1_error)
8950 
8951   /* "(tree fragment)":3
8952  * def __reduce_cython__(self):
8953  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8954  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
8955  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
8956  */
8957 
8958   /* function exit code */
8959   __pyx_L1_error:;
8960   __Pyx_XDECREF(__pyx_t_1);
8961   __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8962   __pyx_r = NULL;
8963   __Pyx_XGIVEREF(__pyx_r);
8964   __Pyx_RefNannyFinishContext();
8965   return __pyx_r;
8966 }
8967 
8968 /* "View.MemoryView":244
8969  *
8970  * @cname("__pyx_array_new")
8971  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
8972  *                           char *mode, char *buf):
8973  *     cdef array result
8974  */
8975 
__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)8976 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) {
8977   struct __pyx_array_obj *__pyx_v_result = 0;
8978   struct __pyx_array_obj *__pyx_r = NULL;
8979   __Pyx_RefNannyDeclarations
8980   int __pyx_t_1;
8981   PyObject *__pyx_t_2 = NULL;
8982   PyObject *__pyx_t_3 = NULL;
8983   PyObject *__pyx_t_4 = NULL;
8984   PyObject *__pyx_t_5 = NULL;
8985   int __pyx_lineno = 0;
8986   const char *__pyx_filename = NULL;
8987   int __pyx_clineno = 0;
8988   __Pyx_RefNannySetupContext("array_cwrapper", 0);
8989 
8990   /* "View.MemoryView":248
8991  *     cdef array result
8992  *
8993  *     if buf == NULL:             # <<<<<<<<<<<<<<
8994  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
8995  *     else:
8996  */
8997   __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
8998   if (__pyx_t_1) {
8999 
9000     /* "View.MemoryView":249
9001  *
9002  *     if buf == NULL:
9003  *         result = array(shape, itemsize, format, mode.decode('ASCII'))             # <<<<<<<<<<<<<<
9004  *     else:
9005  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
9006  */
9007     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 249, __pyx_L1_error)
9008     __Pyx_GOTREF(__pyx_t_2);
9009     __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 249, __pyx_L1_error)
9010     __Pyx_GOTREF(__pyx_t_3);
9011     __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 249, __pyx_L1_error)
9012     __Pyx_GOTREF(__pyx_t_4);
9013     __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 249, __pyx_L1_error)
9014     __Pyx_GOTREF(__pyx_t_5);
9015     __Pyx_INCREF(__pyx_v_shape);
9016     __Pyx_GIVEREF(__pyx_v_shape);
9017     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
9018     __Pyx_GIVEREF(__pyx_t_2);
9019     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
9020     __Pyx_GIVEREF(__pyx_t_3);
9021     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
9022     __Pyx_GIVEREF(__pyx_t_4);
9023     PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
9024     __pyx_t_2 = 0;
9025     __pyx_t_3 = 0;
9026     __pyx_t_4 = 0;
9027     __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 249, __pyx_L1_error)
9028     __Pyx_GOTREF(__pyx_t_4);
9029     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9030     __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
9031     __pyx_t_4 = 0;
9032 
9033     /* "View.MemoryView":248
9034  *     cdef array result
9035  *
9036  *     if buf == NULL:             # <<<<<<<<<<<<<<
9037  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
9038  *     else:
9039  */
9040     goto __pyx_L3;
9041   }
9042 
9043   /* "View.MemoryView":251
9044  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
9045  *     else:
9046  *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
9047  *                        allocate_buffer=False)
9048  *         result.data = buf
9049  */
9050   /*else*/ {
9051     __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 251, __pyx_L1_error)
9052     __Pyx_GOTREF(__pyx_t_4);
9053     __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error)
9054     __Pyx_GOTREF(__pyx_t_5);
9055     __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 251, __pyx_L1_error)
9056     __Pyx_GOTREF(__pyx_t_3);
9057     __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 251, __pyx_L1_error)
9058     __Pyx_GOTREF(__pyx_t_2);
9059     __Pyx_INCREF(__pyx_v_shape);
9060     __Pyx_GIVEREF(__pyx_v_shape);
9061     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
9062     __Pyx_GIVEREF(__pyx_t_4);
9063     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
9064     __Pyx_GIVEREF(__pyx_t_5);
9065     PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
9066     __Pyx_GIVEREF(__pyx_t_3);
9067     PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
9068     __pyx_t_4 = 0;
9069     __pyx_t_5 = 0;
9070     __pyx_t_3 = 0;
9071 
9072     /* "View.MemoryView":252
9073  *     else:
9074  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
9075  *                        allocate_buffer=False)             # <<<<<<<<<<<<<<
9076  *         result.data = buf
9077  *
9078  */
9079     __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 252, __pyx_L1_error)
9080     __Pyx_GOTREF(__pyx_t_3);
9081     if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(1, 252, __pyx_L1_error)
9082 
9083     /* "View.MemoryView":251
9084  *         result = array(shape, itemsize, format, mode.decode('ASCII'))
9085  *     else:
9086  *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
9087  *                        allocate_buffer=False)
9088  *         result.data = buf
9089  */
9090     __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error)
9091     __Pyx_GOTREF(__pyx_t_5);
9092     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9093     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9094     __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
9095     __pyx_t_5 = 0;
9096 
9097     /* "View.MemoryView":253
9098  *         result = array(shape, itemsize, format, mode.decode('ASCII'),
9099  *                        allocate_buffer=False)
9100  *         result.data = buf             # <<<<<<<<<<<<<<
9101  *
9102  *     return result
9103  */
9104     __pyx_v_result->data = __pyx_v_buf;
9105   }
9106   __pyx_L3:;
9107 
9108   /* "View.MemoryView":255
9109  *         result.data = buf
9110  *
9111  *     return result             # <<<<<<<<<<<<<<
9112  *
9113  *
9114  */
9115   __Pyx_XDECREF(((PyObject *)__pyx_r));
9116   __Pyx_INCREF(((PyObject *)__pyx_v_result));
9117   __pyx_r = __pyx_v_result;
9118   goto __pyx_L0;
9119 
9120   /* "View.MemoryView":244
9121  *
9122  * @cname("__pyx_array_new")
9123  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
9124  *                           char *mode, char *buf):
9125  *     cdef array result
9126  */
9127 
9128   /* function exit code */
9129   __pyx_L1_error:;
9130   __Pyx_XDECREF(__pyx_t_2);
9131   __Pyx_XDECREF(__pyx_t_3);
9132   __Pyx_XDECREF(__pyx_t_4);
9133   __Pyx_XDECREF(__pyx_t_5);
9134   __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
9135   __pyx_r = 0;
9136   __pyx_L0:;
9137   __Pyx_XDECREF((PyObject *)__pyx_v_result);
9138   __Pyx_XGIVEREF((PyObject *)__pyx_r);
9139   __Pyx_RefNannyFinishContext();
9140   return __pyx_r;
9141 }
9142 
9143 /* "View.MemoryView":281
9144  * cdef class Enum(object):
9145  *     cdef object name
9146  *     def __init__(self, name):             # <<<<<<<<<<<<<<
9147  *         self.name = name
9148  *     def __repr__(self):
9149  */
9150 
9151 /* Python wrapper */
9152 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)9153 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9154   PyObject *__pyx_v_name = 0;
9155   int __pyx_lineno = 0;
9156   const char *__pyx_filename = NULL;
9157   int __pyx_clineno = 0;
9158   int __pyx_r;
9159   __Pyx_RefNannyDeclarations
9160   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
9161   {
9162     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
9163     PyObject* values[1] = {0};
9164     if (unlikely(__pyx_kwds)) {
9165       Py_ssize_t kw_args;
9166       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9167       switch (pos_args) {
9168         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9169         CYTHON_FALLTHROUGH;
9170         case  0: break;
9171         default: goto __pyx_L5_argtuple_error;
9172       }
9173       kw_args = PyDict_Size(__pyx_kwds);
9174       switch (pos_args) {
9175         case  0:
9176         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
9177         else goto __pyx_L5_argtuple_error;
9178       }
9179       if (unlikely(kw_args > 0)) {
9180         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 281, __pyx_L3_error)
9181       }
9182     } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
9183       goto __pyx_L5_argtuple_error;
9184     } else {
9185       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9186     }
9187     __pyx_v_name = values[0];
9188   }
9189   goto __pyx_L4_argument_unpacking_done;
9190   __pyx_L5_argtuple_error:;
9191   __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 281, __pyx_L3_error)
9192   __pyx_L3_error:;
9193   __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9194   __Pyx_RefNannyFinishContext();
9195   return -1;
9196   __pyx_L4_argument_unpacking_done:;
9197   __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
9198 
9199   /* function exit code */
9200   __Pyx_RefNannyFinishContext();
9201   return __pyx_r;
9202 }
9203 
__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj * __pyx_v_self,PyObject * __pyx_v_name)9204 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
9205   int __pyx_r;
9206   __Pyx_RefNannyDeclarations
9207   __Pyx_RefNannySetupContext("__init__", 0);
9208 
9209   /* "View.MemoryView":282
9210  *     cdef object name
9211  *     def __init__(self, name):
9212  *         self.name = name             # <<<<<<<<<<<<<<
9213  *     def __repr__(self):
9214  *         return self.name
9215  */
9216   __Pyx_INCREF(__pyx_v_name);
9217   __Pyx_GIVEREF(__pyx_v_name);
9218   __Pyx_GOTREF(__pyx_v_self->name);
9219   __Pyx_DECREF(__pyx_v_self->name);
9220   __pyx_v_self->name = __pyx_v_name;
9221 
9222   /* "View.MemoryView":281
9223  * cdef class Enum(object):
9224  *     cdef object name
9225  *     def __init__(self, name):             # <<<<<<<<<<<<<<
9226  *         self.name = name
9227  *     def __repr__(self):
9228  */
9229 
9230   /* function exit code */
9231   __pyx_r = 0;
9232   __Pyx_RefNannyFinishContext();
9233   return __pyx_r;
9234 }
9235 
9236 /* "View.MemoryView":283
9237  *     def __init__(self, name):
9238  *         self.name = name
9239  *     def __repr__(self):             # <<<<<<<<<<<<<<
9240  *         return self.name
9241  *
9242  */
9243 
9244 /* Python wrapper */
9245 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_MemviewEnum___repr__(PyObject * __pyx_v_self)9246 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
9247   PyObject *__pyx_r = 0;
9248   __Pyx_RefNannyDeclarations
9249   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
9250   __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
9251 
9252   /* function exit code */
9253   __Pyx_RefNannyFinishContext();
9254   return __pyx_r;
9255 }
9256 
__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj * __pyx_v_self)9257 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
9258   PyObject *__pyx_r = NULL;
9259   __Pyx_RefNannyDeclarations
9260   __Pyx_RefNannySetupContext("__repr__", 0);
9261 
9262   /* "View.MemoryView":284
9263  *         self.name = name
9264  *     def __repr__(self):
9265  *         return self.name             # <<<<<<<<<<<<<<
9266  *
9267  * cdef generic = Enum("<strided and direct or indirect>")
9268  */
9269   __Pyx_XDECREF(__pyx_r);
9270   __Pyx_INCREF(__pyx_v_self->name);
9271   __pyx_r = __pyx_v_self->name;
9272   goto __pyx_L0;
9273 
9274   /* "View.MemoryView":283
9275  *     def __init__(self, name):
9276  *         self.name = name
9277  *     def __repr__(self):             # <<<<<<<<<<<<<<
9278  *         return self.name
9279  *
9280  */
9281 
9282   /* function exit code */
9283   __pyx_L0:;
9284   __Pyx_XGIVEREF(__pyx_r);
9285   __Pyx_RefNannyFinishContext();
9286   return __pyx_r;
9287 }
9288 
9289 /* "(tree fragment)":1
9290  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
9291  *     cdef tuple state
9292  *     cdef object _dict
9293  */
9294 
9295 /* Python wrapper */
9296 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)9297 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9298   PyObject *__pyx_r = 0;
9299   __Pyx_RefNannyDeclarations
9300   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
9301   __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
9302 
9303   /* function exit code */
9304   __Pyx_RefNannyFinishContext();
9305   return __pyx_r;
9306 }
9307 
__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj * __pyx_v_self)9308 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
9309   PyObject *__pyx_v_state = 0;
9310   PyObject *__pyx_v__dict = 0;
9311   int __pyx_v_use_setstate;
9312   PyObject *__pyx_r = NULL;
9313   __Pyx_RefNannyDeclarations
9314   PyObject *__pyx_t_1 = NULL;
9315   int __pyx_t_2;
9316   int __pyx_t_3;
9317   PyObject *__pyx_t_4 = NULL;
9318   PyObject *__pyx_t_5 = NULL;
9319   int __pyx_lineno = 0;
9320   const char *__pyx_filename = NULL;
9321   int __pyx_clineno = 0;
9322   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
9323 
9324   /* "(tree fragment)":5
9325  *     cdef object _dict
9326  *     cdef bint use_setstate
9327  *     state = (self.name,)             # <<<<<<<<<<<<<<
9328  *     _dict = getattr(self, '__dict__', None)
9329  *     if _dict is not None:
9330  */
9331   __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
9332   __Pyx_GOTREF(__pyx_t_1);
9333   __Pyx_INCREF(__pyx_v_self->name);
9334   __Pyx_GIVEREF(__pyx_v_self->name);
9335   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
9336   __pyx_v_state = ((PyObject*)__pyx_t_1);
9337   __pyx_t_1 = 0;
9338 
9339   /* "(tree fragment)":6
9340  *     cdef bint use_setstate
9341  *     state = (self.name,)
9342  *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
9343  *     if _dict is not None:
9344  *         state += (_dict,)
9345  */
9346   __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
9347   __Pyx_GOTREF(__pyx_t_1);
9348   __pyx_v__dict = __pyx_t_1;
9349   __pyx_t_1 = 0;
9350 
9351   /* "(tree fragment)":7
9352  *     state = (self.name,)
9353  *     _dict = getattr(self, '__dict__', None)
9354  *     if _dict is not None:             # <<<<<<<<<<<<<<
9355  *         state += (_dict,)
9356  *         use_setstate = True
9357  */
9358   __pyx_t_2 = (__pyx_v__dict != Py_None);
9359   __pyx_t_3 = (__pyx_t_2 != 0);
9360   if (__pyx_t_3) {
9361 
9362     /* "(tree fragment)":8
9363  *     _dict = getattr(self, '__dict__', None)
9364  *     if _dict is not None:
9365  *         state += (_dict,)             # <<<<<<<<<<<<<<
9366  *         use_setstate = True
9367  *     else:
9368  */
9369     __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
9370     __Pyx_GOTREF(__pyx_t_1);
9371     __Pyx_INCREF(__pyx_v__dict);
9372     __Pyx_GIVEREF(__pyx_v__dict);
9373     PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
9374     __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
9375     __Pyx_GOTREF(__pyx_t_4);
9376     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9377     __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
9378     __pyx_t_4 = 0;
9379 
9380     /* "(tree fragment)":9
9381  *     if _dict is not None:
9382  *         state += (_dict,)
9383  *         use_setstate = True             # <<<<<<<<<<<<<<
9384  *     else:
9385  *         use_setstate = self.name is not None
9386  */
9387     __pyx_v_use_setstate = 1;
9388 
9389     /* "(tree fragment)":7
9390  *     state = (self.name,)
9391  *     _dict = getattr(self, '__dict__', None)
9392  *     if _dict is not None:             # <<<<<<<<<<<<<<
9393  *         state += (_dict,)
9394  *         use_setstate = True
9395  */
9396     goto __pyx_L3;
9397   }
9398 
9399   /* "(tree fragment)":11
9400  *         use_setstate = True
9401  *     else:
9402  *         use_setstate = self.name is not None             # <<<<<<<<<<<<<<
9403  *     if use_setstate:
9404  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
9405  */
9406   /*else*/ {
9407     __pyx_t_3 = (__pyx_v_self->name != Py_None);
9408     __pyx_v_use_setstate = __pyx_t_3;
9409   }
9410   __pyx_L3:;
9411 
9412   /* "(tree fragment)":12
9413  *     else:
9414  *         use_setstate = self.name is not None
9415  *     if use_setstate:             # <<<<<<<<<<<<<<
9416  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
9417  *     else:
9418  */
9419   __pyx_t_3 = (__pyx_v_use_setstate != 0);
9420   if (__pyx_t_3) {
9421 
9422     /* "(tree fragment)":13
9423  *         use_setstate = self.name is not None
9424  *     if use_setstate:
9425  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state             # <<<<<<<<<<<<<<
9426  *     else:
9427  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
9428  */
9429     __Pyx_XDECREF(__pyx_r);
9430     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
9431     __Pyx_GOTREF(__pyx_t_4);
9432     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
9433     __Pyx_GOTREF(__pyx_t_1);
9434     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9435     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9436     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9437     __Pyx_INCREF(__pyx_int_184977713);
9438     __Pyx_GIVEREF(__pyx_int_184977713);
9439     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
9440     __Pyx_INCREF(Py_None);
9441     __Pyx_GIVEREF(Py_None);
9442     PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
9443     __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
9444     __Pyx_GOTREF(__pyx_t_5);
9445     __Pyx_GIVEREF(__pyx_t_4);
9446     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
9447     __Pyx_GIVEREF(__pyx_t_1);
9448     PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
9449     __Pyx_INCREF(__pyx_v_state);
9450     __Pyx_GIVEREF(__pyx_v_state);
9451     PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
9452     __pyx_t_4 = 0;
9453     __pyx_t_1 = 0;
9454     __pyx_r = __pyx_t_5;
9455     __pyx_t_5 = 0;
9456     goto __pyx_L0;
9457 
9458     /* "(tree fragment)":12
9459  *     else:
9460  *         use_setstate = self.name is not None
9461  *     if use_setstate:             # <<<<<<<<<<<<<<
9462  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
9463  *     else:
9464  */
9465   }
9466 
9467   /* "(tree fragment)":15
9468  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
9469  *     else:
9470  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)             # <<<<<<<<<<<<<<
9471  * def __setstate_cython__(self, __pyx_state):
9472  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
9473  */
9474   /*else*/ {
9475     __Pyx_XDECREF(__pyx_r);
9476     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
9477     __Pyx_GOTREF(__pyx_t_5);
9478     __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
9479     __Pyx_GOTREF(__pyx_t_1);
9480     __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9481     __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9482     PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
9483     __Pyx_INCREF(__pyx_int_184977713);
9484     __Pyx_GIVEREF(__pyx_int_184977713);
9485     PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
9486     __Pyx_INCREF(__pyx_v_state);
9487     __Pyx_GIVEREF(__pyx_v_state);
9488     PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
9489     __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
9490     __Pyx_GOTREF(__pyx_t_4);
9491     __Pyx_GIVEREF(__pyx_t_5);
9492     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
9493     __Pyx_GIVEREF(__pyx_t_1);
9494     PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
9495     __pyx_t_5 = 0;
9496     __pyx_t_1 = 0;
9497     __pyx_r = __pyx_t_4;
9498     __pyx_t_4 = 0;
9499     goto __pyx_L0;
9500   }
9501 
9502   /* "(tree fragment)":1
9503  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
9504  *     cdef tuple state
9505  *     cdef object _dict
9506  */
9507 
9508   /* function exit code */
9509   __pyx_L1_error:;
9510   __Pyx_XDECREF(__pyx_t_1);
9511   __Pyx_XDECREF(__pyx_t_4);
9512   __Pyx_XDECREF(__pyx_t_5);
9513   __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9514   __pyx_r = NULL;
9515   __pyx_L0:;
9516   __Pyx_XDECREF(__pyx_v_state);
9517   __Pyx_XDECREF(__pyx_v__dict);
9518   __Pyx_XGIVEREF(__pyx_r);
9519   __Pyx_RefNannyFinishContext();
9520   return __pyx_r;
9521 }
9522 
9523 /* "(tree fragment)":16
9524  *     else:
9525  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
9526  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
9527  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
9528  */
9529 
9530 /* Python wrapper */
9531 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)9532 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
9533   PyObject *__pyx_r = 0;
9534   __Pyx_RefNannyDeclarations
9535   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
9536   __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
9537 
9538   /* function exit code */
9539   __Pyx_RefNannyFinishContext();
9540   return __pyx_r;
9541 }
9542 
__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj * __pyx_v_self,PyObject * __pyx_v___pyx_state)9543 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
9544   PyObject *__pyx_r = NULL;
9545   __Pyx_RefNannyDeclarations
9546   PyObject *__pyx_t_1 = NULL;
9547   int __pyx_lineno = 0;
9548   const char *__pyx_filename = NULL;
9549   int __pyx_clineno = 0;
9550   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
9551 
9552   /* "(tree fragment)":17
9553  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
9554  * def __setstate_cython__(self, __pyx_state):
9555  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
9556  */
9557   if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
9558   __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
9559   __Pyx_GOTREF(__pyx_t_1);
9560   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9561 
9562   /* "(tree fragment)":16
9563  *     else:
9564  *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
9565  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
9566  *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
9567  */
9568 
9569   /* function exit code */
9570   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9571   goto __pyx_L0;
9572   __pyx_L1_error:;
9573   __Pyx_XDECREF(__pyx_t_1);
9574   __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9575   __pyx_r = NULL;
9576   __pyx_L0:;
9577   __Pyx_XGIVEREF(__pyx_r);
9578   __Pyx_RefNannyFinishContext();
9579   return __pyx_r;
9580 }
9581 
9582 /* "View.MemoryView":298
9583  *
9584  * @cname('__pyx_align_pointer')
9585  * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
9586  *     "Align pointer memory on a given boundary"
9587  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
9588  */
9589 
__pyx_align_pointer(void * __pyx_v_memory,size_t __pyx_v_alignment)9590 static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
9591   Py_intptr_t __pyx_v_aligned_p;
9592   size_t __pyx_v_offset;
9593   void *__pyx_r;
9594   int __pyx_t_1;
9595 
9596   /* "View.MemoryView":300
9597  * cdef void *align_pointer(void *memory, size_t alignment) nogil:
9598  *     "Align pointer memory on a given boundary"
9599  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory             # <<<<<<<<<<<<<<
9600  *     cdef size_t offset
9601  *
9602  */
9603   __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
9604 
9605   /* "View.MemoryView":304
9606  *
9607  *     with cython.cdivision(True):
9608  *         offset = aligned_p % alignment             # <<<<<<<<<<<<<<
9609  *
9610  *     if offset > 0:
9611  */
9612   __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
9613 
9614   /* "View.MemoryView":306
9615  *         offset = aligned_p % alignment
9616  *
9617  *     if offset > 0:             # <<<<<<<<<<<<<<
9618  *         aligned_p += alignment - offset
9619  *
9620  */
9621   __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
9622   if (__pyx_t_1) {
9623 
9624     /* "View.MemoryView":307
9625  *
9626  *     if offset > 0:
9627  *         aligned_p += alignment - offset             # <<<<<<<<<<<<<<
9628  *
9629  *     return <void *> aligned_p
9630  */
9631     __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
9632 
9633     /* "View.MemoryView":306
9634  *         offset = aligned_p % alignment
9635  *
9636  *     if offset > 0:             # <<<<<<<<<<<<<<
9637  *         aligned_p += alignment - offset
9638  *
9639  */
9640   }
9641 
9642   /* "View.MemoryView":309
9643  *         aligned_p += alignment - offset
9644  *
9645  *     return <void *> aligned_p             # <<<<<<<<<<<<<<
9646  *
9647  *
9648  */
9649   __pyx_r = ((void *)__pyx_v_aligned_p);
9650   goto __pyx_L0;
9651 
9652   /* "View.MemoryView":298
9653  *
9654  * @cname('__pyx_align_pointer')
9655  * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
9656  *     "Align pointer memory on a given boundary"
9657  *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
9658  */
9659 
9660   /* function exit code */
9661   __pyx_L0:;
9662   return __pyx_r;
9663 }
9664 
9665 /* "View.MemoryView":345
9666  *     cdef __Pyx_TypeInfo *typeinfo
9667  *
9668  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
9669  *         self.obj = obj
9670  *         self.flags = flags
9671  */
9672 
9673 /* Python wrapper */
9674 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)9675 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9676   PyObject *__pyx_v_obj = 0;
9677   int __pyx_v_flags;
9678   int __pyx_v_dtype_is_object;
9679   int __pyx_lineno = 0;
9680   const char *__pyx_filename = NULL;
9681   int __pyx_clineno = 0;
9682   int __pyx_r;
9683   __Pyx_RefNannyDeclarations
9684   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
9685   {
9686     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
9687     PyObject* values[3] = {0,0,0};
9688     if (unlikely(__pyx_kwds)) {
9689       Py_ssize_t kw_args;
9690       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9691       switch (pos_args) {
9692         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9693         CYTHON_FALLTHROUGH;
9694         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9695         CYTHON_FALLTHROUGH;
9696         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9697         CYTHON_FALLTHROUGH;
9698         case  0: break;
9699         default: goto __pyx_L5_argtuple_error;
9700       }
9701       kw_args = PyDict_Size(__pyx_kwds);
9702       switch (pos_args) {
9703         case  0:
9704         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
9705         else goto __pyx_L5_argtuple_error;
9706         CYTHON_FALLTHROUGH;
9707         case  1:
9708         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
9709         else {
9710           __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(1, 345, __pyx_L3_error)
9711         }
9712         CYTHON_FALLTHROUGH;
9713         case  2:
9714         if (kw_args > 0) {
9715           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
9716           if (value) { values[2] = value; kw_args--; }
9717         }
9718       }
9719       if (unlikely(kw_args > 0)) {
9720         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 345, __pyx_L3_error)
9721       }
9722     } else {
9723       switch (PyTuple_GET_SIZE(__pyx_args)) {
9724         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9725         CYTHON_FALLTHROUGH;
9726         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9727         values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9728         break;
9729         default: goto __pyx_L5_argtuple_error;
9730       }
9731     }
9732     __pyx_v_obj = values[0];
9733     __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 345, __pyx_L3_error)
9734     if (values[2]) {
9735       __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 345, __pyx_L3_error)
9736     } else {
9737       __pyx_v_dtype_is_object = ((int)0);
9738     }
9739   }
9740   goto __pyx_L4_argument_unpacking_done;
9741   __pyx_L5_argtuple_error:;
9742   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 345, __pyx_L3_error)
9743   __pyx_L3_error:;
9744   __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9745   __Pyx_RefNannyFinishContext();
9746   return -1;
9747   __pyx_L4_argument_unpacking_done:;
9748   __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);
9749 
9750   /* function exit code */
9751   __Pyx_RefNannyFinishContext();
9752   return __pyx_r;
9753 }
9754 
__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)9755 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) {
9756   int __pyx_r;
9757   __Pyx_RefNannyDeclarations
9758   int __pyx_t_1;
9759   int __pyx_t_2;
9760   int __pyx_t_3;
9761   int __pyx_t_4;
9762   int __pyx_lineno = 0;
9763   const char *__pyx_filename = NULL;
9764   int __pyx_clineno = 0;
9765   __Pyx_RefNannySetupContext("__cinit__", 0);
9766 
9767   /* "View.MemoryView":346
9768  *
9769  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
9770  *         self.obj = obj             # <<<<<<<<<<<<<<
9771  *         self.flags = flags
9772  *         if type(self) is memoryview or obj is not None:
9773  */
9774   __Pyx_INCREF(__pyx_v_obj);
9775   __Pyx_GIVEREF(__pyx_v_obj);
9776   __Pyx_GOTREF(__pyx_v_self->obj);
9777   __Pyx_DECREF(__pyx_v_self->obj);
9778   __pyx_v_self->obj = __pyx_v_obj;
9779 
9780   /* "View.MemoryView":347
9781  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
9782  *         self.obj = obj
9783  *         self.flags = flags             # <<<<<<<<<<<<<<
9784  *         if type(self) is memoryview or obj is not None:
9785  *             __Pyx_GetBuffer(obj, &self.view, flags)
9786  */
9787   __pyx_v_self->flags = __pyx_v_flags;
9788 
9789   /* "View.MemoryView":348
9790  *         self.obj = obj
9791  *         self.flags = flags
9792  *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
9793  *             __Pyx_GetBuffer(obj, &self.view, flags)
9794  *             if <PyObject *> self.view.obj == NULL:
9795  */
9796   __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
9797   __pyx_t_3 = (__pyx_t_2 != 0);
9798   if (!__pyx_t_3) {
9799   } else {
9800     __pyx_t_1 = __pyx_t_3;
9801     goto __pyx_L4_bool_binop_done;
9802   }
9803   __pyx_t_3 = (__pyx_v_obj != Py_None);
9804   __pyx_t_2 = (__pyx_t_3 != 0);
9805   __pyx_t_1 = __pyx_t_2;
9806   __pyx_L4_bool_binop_done:;
9807   if (__pyx_t_1) {
9808 
9809     /* "View.MemoryView":349
9810  *         self.flags = flags
9811  *         if type(self) is memoryview or obj is not None:
9812  *             __Pyx_GetBuffer(obj, &self.view, flags)             # <<<<<<<<<<<<<<
9813  *             if <PyObject *> self.view.obj == NULL:
9814  *                 (<__pyx_buffer *> &self.view).obj = Py_None
9815  */
9816     __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 349, __pyx_L1_error)
9817 
9818     /* "View.MemoryView":350
9819  *         if type(self) is memoryview or obj is not None:
9820  *             __Pyx_GetBuffer(obj, &self.view, flags)
9821  *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
9822  *                 (<__pyx_buffer *> &self.view).obj = Py_None
9823  *                 Py_INCREF(Py_None)
9824  */
9825     __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
9826     if (__pyx_t_1) {
9827 
9828       /* "View.MemoryView":351
9829  *             __Pyx_GetBuffer(obj, &self.view, flags)
9830  *             if <PyObject *> self.view.obj == NULL:
9831  *                 (<__pyx_buffer *> &self.view).obj = Py_None             # <<<<<<<<<<<<<<
9832  *                 Py_INCREF(Py_None)
9833  *
9834  */
9835       ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
9836 
9837       /* "View.MemoryView":352
9838  *             if <PyObject *> self.view.obj == NULL:
9839  *                 (<__pyx_buffer *> &self.view).obj = Py_None
9840  *                 Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
9841  *
9842  *         global __pyx_memoryview_thread_locks_used
9843  */
9844       Py_INCREF(Py_None);
9845 
9846       /* "View.MemoryView":350
9847  *         if type(self) is memoryview or obj is not None:
9848  *             __Pyx_GetBuffer(obj, &self.view, flags)
9849  *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
9850  *                 (<__pyx_buffer *> &self.view).obj = Py_None
9851  *                 Py_INCREF(Py_None)
9852  */
9853     }
9854 
9855     /* "View.MemoryView":348
9856  *         self.obj = obj
9857  *         self.flags = flags
9858  *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
9859  *             __Pyx_GetBuffer(obj, &self.view, flags)
9860  *             if <PyObject *> self.view.obj == NULL:
9861  */
9862   }
9863 
9864   /* "View.MemoryView":355
9865  *
9866  *         global __pyx_memoryview_thread_locks_used
9867  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
9868  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
9869  *             __pyx_memoryview_thread_locks_used += 1
9870  */
9871   __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
9872   if (__pyx_t_1) {
9873 
9874     /* "View.MemoryView":356
9875  *         global __pyx_memoryview_thread_locks_used
9876  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
9877  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]             # <<<<<<<<<<<<<<
9878  *             __pyx_memoryview_thread_locks_used += 1
9879  *         if self.lock is NULL:
9880  */
9881     __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
9882 
9883     /* "View.MemoryView":357
9884  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
9885  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
9886  *             __pyx_memoryview_thread_locks_used += 1             # <<<<<<<<<<<<<<
9887  *         if self.lock is NULL:
9888  *             self.lock = PyThread_allocate_lock()
9889  */
9890     __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
9891 
9892     /* "View.MemoryView":355
9893  *
9894  *         global __pyx_memoryview_thread_locks_used
9895  *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
9896  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
9897  *             __pyx_memoryview_thread_locks_used += 1
9898  */
9899   }
9900 
9901   /* "View.MemoryView":358
9902  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
9903  *             __pyx_memoryview_thread_locks_used += 1
9904  *         if self.lock is NULL:             # <<<<<<<<<<<<<<
9905  *             self.lock = PyThread_allocate_lock()
9906  *             if self.lock is NULL:
9907  */
9908   __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
9909   if (__pyx_t_1) {
9910 
9911     /* "View.MemoryView":359
9912  *             __pyx_memoryview_thread_locks_used += 1
9913  *         if self.lock is NULL:
9914  *             self.lock = PyThread_allocate_lock()             # <<<<<<<<<<<<<<
9915  *             if self.lock is NULL:
9916  *                 raise MemoryError
9917  */
9918     __pyx_v_self->lock = PyThread_allocate_lock();
9919 
9920     /* "View.MemoryView":360
9921  *         if self.lock is NULL:
9922  *             self.lock = PyThread_allocate_lock()
9923  *             if self.lock is NULL:             # <<<<<<<<<<<<<<
9924  *                 raise MemoryError
9925  *
9926  */
9927     __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
9928     if (unlikely(__pyx_t_1)) {
9929 
9930       /* "View.MemoryView":361
9931  *             self.lock = PyThread_allocate_lock()
9932  *             if self.lock is NULL:
9933  *                 raise MemoryError             # <<<<<<<<<<<<<<
9934  *
9935  *         if flags & PyBUF_FORMAT:
9936  */
9937       PyErr_NoMemory(); __PYX_ERR(1, 361, __pyx_L1_error)
9938 
9939       /* "View.MemoryView":360
9940  *         if self.lock is NULL:
9941  *             self.lock = PyThread_allocate_lock()
9942  *             if self.lock is NULL:             # <<<<<<<<<<<<<<
9943  *                 raise MemoryError
9944  *
9945  */
9946     }
9947 
9948     /* "View.MemoryView":358
9949  *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
9950  *             __pyx_memoryview_thread_locks_used += 1
9951  *         if self.lock is NULL:             # <<<<<<<<<<<<<<
9952  *             self.lock = PyThread_allocate_lock()
9953  *             if self.lock is NULL:
9954  */
9955   }
9956 
9957   /* "View.MemoryView":363
9958  *                 raise MemoryError
9959  *
9960  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
9961  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
9962  *         else:
9963  */
9964   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
9965   if (__pyx_t_1) {
9966 
9967     /* "View.MemoryView":364
9968  *
9969  *         if flags & PyBUF_FORMAT:
9970  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')             # <<<<<<<<<<<<<<
9971  *         else:
9972  *             self.dtype_is_object = dtype_is_object
9973  */
9974     __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
9975     if (__pyx_t_2) {
9976     } else {
9977       __pyx_t_1 = __pyx_t_2;
9978       goto __pyx_L11_bool_binop_done;
9979     }
9980     __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
9981     __pyx_t_1 = __pyx_t_2;
9982     __pyx_L11_bool_binop_done:;
9983     __pyx_v_self->dtype_is_object = __pyx_t_1;
9984 
9985     /* "View.MemoryView":363
9986  *                 raise MemoryError
9987  *
9988  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
9989  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
9990  *         else:
9991  */
9992     goto __pyx_L10;
9993   }
9994 
9995   /* "View.MemoryView":366
9996  *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
9997  *         else:
9998  *             self.dtype_is_object = dtype_is_object             # <<<<<<<<<<<<<<
9999  *
10000  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
10001  */
10002   /*else*/ {
10003     __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
10004   }
10005   __pyx_L10:;
10006 
10007   /* "View.MemoryView":368
10008  *             self.dtype_is_object = dtype_is_object
10009  *
10010  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(             # <<<<<<<<<<<<<<
10011  *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
10012  *         self.typeinfo = NULL
10013  */
10014   __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));
10015 
10016   /* "View.MemoryView":370
10017  *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
10018  *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
10019  *         self.typeinfo = NULL             # <<<<<<<<<<<<<<
10020  *
10021  *     def __dealloc__(memoryview self):
10022  */
10023   __pyx_v_self->typeinfo = NULL;
10024 
10025   /* "View.MemoryView":345
10026  *     cdef __Pyx_TypeInfo *typeinfo
10027  *
10028  *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
10029  *         self.obj = obj
10030  *         self.flags = flags
10031  */
10032 
10033   /* function exit code */
10034   __pyx_r = 0;
10035   goto __pyx_L0;
10036   __pyx_L1_error:;
10037   __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10038   __pyx_r = -1;
10039   __pyx_L0:;
10040   __Pyx_RefNannyFinishContext();
10041   return __pyx_r;
10042 }
10043 
10044 /* "View.MemoryView":372
10045  *         self.typeinfo = NULL
10046  *
10047  *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
10048  *         if self.obj is not None:
10049  *             __Pyx_ReleaseBuffer(&self.view)
10050  */
10051 
10052 /* Python wrapper */
10053 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___dealloc__(PyObject * __pyx_v_self)10054 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
10055   __Pyx_RefNannyDeclarations
10056   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
10057   __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));
10058 
10059   /* function exit code */
10060   __Pyx_RefNannyFinishContext();
10061 }
10062 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj * __pyx_v_self)10063 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
10064   int __pyx_v_i;
10065   __Pyx_RefNannyDeclarations
10066   int __pyx_t_1;
10067   int __pyx_t_2;
10068   int __pyx_t_3;
10069   int __pyx_t_4;
10070   int __pyx_t_5;
10071   PyThread_type_lock __pyx_t_6;
10072   PyThread_type_lock __pyx_t_7;
10073   __Pyx_RefNannySetupContext("__dealloc__", 0);
10074 
10075   /* "View.MemoryView":373
10076  *
10077  *     def __dealloc__(memoryview self):
10078  *         if self.obj is not None:             # <<<<<<<<<<<<<<
10079  *             __Pyx_ReleaseBuffer(&self.view)
10080  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
10081  */
10082   __pyx_t_1 = (__pyx_v_self->obj != Py_None);
10083   __pyx_t_2 = (__pyx_t_1 != 0);
10084   if (__pyx_t_2) {
10085 
10086     /* "View.MemoryView":374
10087  *     def __dealloc__(memoryview self):
10088  *         if self.obj is not None:
10089  *             __Pyx_ReleaseBuffer(&self.view)             # <<<<<<<<<<<<<<
10090  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
10091  *
10092  */
10093     __Pyx_ReleaseBuffer((&__pyx_v_self->view));
10094 
10095     /* "View.MemoryView":373
10096  *
10097  *     def __dealloc__(memoryview self):
10098  *         if self.obj is not None:             # <<<<<<<<<<<<<<
10099  *             __Pyx_ReleaseBuffer(&self.view)
10100  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
10101  */
10102     goto __pyx_L3;
10103   }
10104 
10105   /* "View.MemoryView":375
10106  *         if self.obj is not None:
10107  *             __Pyx_ReleaseBuffer(&self.view)
10108  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
10109  *
10110  *             (<__pyx_buffer *> &self.view).obj = NULL
10111  */
10112   __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
10113   if (__pyx_t_2) {
10114 
10115     /* "View.MemoryView":377
10116  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:
10117  *
10118  *             (<__pyx_buffer *> &self.view).obj = NULL             # <<<<<<<<<<<<<<
10119  *             Py_DECREF(Py_None)
10120  *
10121  */
10122     ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
10123 
10124     /* "View.MemoryView":378
10125  *
10126  *             (<__pyx_buffer *> &self.view).obj = NULL
10127  *             Py_DECREF(Py_None)             # <<<<<<<<<<<<<<
10128  *
10129  *         cdef int i
10130  */
10131     Py_DECREF(Py_None);
10132 
10133     /* "View.MemoryView":375
10134  *         if self.obj is not None:
10135  *             __Pyx_ReleaseBuffer(&self.view)
10136  *         elif (<__pyx_buffer *> &self.view).obj == Py_None:             # <<<<<<<<<<<<<<
10137  *
10138  *             (<__pyx_buffer *> &self.view).obj = NULL
10139  */
10140   }
10141   __pyx_L3:;
10142 
10143   /* "View.MemoryView":382
10144  *         cdef int i
10145  *         global __pyx_memoryview_thread_locks_used
10146  *         if self.lock != NULL:             # <<<<<<<<<<<<<<
10147  *             for i in range(__pyx_memoryview_thread_locks_used):
10148  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
10149  */
10150   __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
10151   if (__pyx_t_2) {
10152 
10153     /* "View.MemoryView":383
10154  *         global __pyx_memoryview_thread_locks_used
10155  *         if self.lock != NULL:
10156  *             for i in range(__pyx_memoryview_thread_locks_used):             # <<<<<<<<<<<<<<
10157  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
10158  *                     __pyx_memoryview_thread_locks_used -= 1
10159  */
10160     __pyx_t_3 = __pyx_memoryview_thread_locks_used;
10161     __pyx_t_4 = __pyx_t_3;
10162     for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
10163       __pyx_v_i = __pyx_t_5;
10164 
10165       /* "View.MemoryView":384
10166  *         if self.lock != NULL:
10167  *             for i in range(__pyx_memoryview_thread_locks_used):
10168  *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
10169  *                     __pyx_memoryview_thread_locks_used -= 1
10170  *                     if i != __pyx_memoryview_thread_locks_used:
10171  */
10172       __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
10173       if (__pyx_t_2) {
10174 
10175         /* "View.MemoryView":385
10176  *             for i in range(__pyx_memoryview_thread_locks_used):
10177  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
10178  *                     __pyx_memoryview_thread_locks_used -= 1             # <<<<<<<<<<<<<<
10179  *                     if i != __pyx_memoryview_thread_locks_used:
10180  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
10181  */
10182         __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
10183 
10184         /* "View.MemoryView":386
10185  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
10186  *                     __pyx_memoryview_thread_locks_used -= 1
10187  *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
10188  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
10189  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
10190  */
10191         __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
10192         if (__pyx_t_2) {
10193 
10194           /* "View.MemoryView":388
10195  *                     if i != __pyx_memoryview_thread_locks_used:
10196  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
10197  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])             # <<<<<<<<<<<<<<
10198  *                     break
10199  *             else:
10200  */
10201           __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
10202           __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
10203 
10204           /* "View.MemoryView":387
10205  *                     __pyx_memoryview_thread_locks_used -= 1
10206  *                     if i != __pyx_memoryview_thread_locks_used:
10207  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (             # <<<<<<<<<<<<<<
10208  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
10209  *                     break
10210  */
10211           (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
10212           (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
10213 
10214           /* "View.MemoryView":386
10215  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
10216  *                     __pyx_memoryview_thread_locks_used -= 1
10217  *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
10218  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
10219  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
10220  */
10221         }
10222 
10223         /* "View.MemoryView":389
10224  *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
10225  *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
10226  *                     break             # <<<<<<<<<<<<<<
10227  *             else:
10228  *                 PyThread_free_lock(self.lock)
10229  */
10230         goto __pyx_L6_break;
10231 
10232         /* "View.MemoryView":384
10233  *         if self.lock != NULL:
10234  *             for i in range(__pyx_memoryview_thread_locks_used):
10235  *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
10236  *                     __pyx_memoryview_thread_locks_used -= 1
10237  *                     if i != __pyx_memoryview_thread_locks_used:
10238  */
10239       }
10240     }
10241     /*else*/ {
10242 
10243       /* "View.MemoryView":391
10244  *                     break
10245  *             else:
10246  *                 PyThread_free_lock(self.lock)             # <<<<<<<<<<<<<<
10247  *
10248  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
10249  */
10250       PyThread_free_lock(__pyx_v_self->lock);
10251     }
10252     __pyx_L6_break:;
10253 
10254     /* "View.MemoryView":382
10255  *         cdef int i
10256  *         global __pyx_memoryview_thread_locks_used
10257  *         if self.lock != NULL:             # <<<<<<<<<<<<<<
10258  *             for i in range(__pyx_memoryview_thread_locks_used):
10259  *                 if __pyx_memoryview_thread_locks[i] is self.lock:
10260  */
10261   }
10262 
10263   /* "View.MemoryView":372
10264  *         self.typeinfo = NULL
10265  *
10266  *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
10267  *         if self.obj is not None:
10268  *             __Pyx_ReleaseBuffer(&self.view)
10269  */
10270 
10271   /* function exit code */
10272   __Pyx_RefNannyFinishContext();
10273 }
10274 
10275 /* "View.MemoryView":393
10276  *                 PyThread_free_lock(self.lock)
10277  *
10278  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
10279  *         cdef Py_ssize_t dim
10280  *         cdef char *itemp = <char *> self.view.buf
10281  */
10282 
__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index)10283 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
10284   Py_ssize_t __pyx_v_dim;
10285   char *__pyx_v_itemp;
10286   PyObject *__pyx_v_idx = NULL;
10287   char *__pyx_r;
10288   __Pyx_RefNannyDeclarations
10289   Py_ssize_t __pyx_t_1;
10290   PyObject *__pyx_t_2 = NULL;
10291   Py_ssize_t __pyx_t_3;
10292   PyObject *(*__pyx_t_4)(PyObject *);
10293   PyObject *__pyx_t_5 = NULL;
10294   Py_ssize_t __pyx_t_6;
10295   char *__pyx_t_7;
10296   int __pyx_lineno = 0;
10297   const char *__pyx_filename = NULL;
10298   int __pyx_clineno = 0;
10299   __Pyx_RefNannySetupContext("get_item_pointer", 0);
10300 
10301   /* "View.MemoryView":395
10302  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
10303  *         cdef Py_ssize_t dim
10304  *         cdef char *itemp = <char *> self.view.buf             # <<<<<<<<<<<<<<
10305  *
10306  *         for dim, idx in enumerate(index):
10307  */
10308   __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
10309 
10310   /* "View.MemoryView":397
10311  *         cdef char *itemp = <char *> self.view.buf
10312  *
10313  *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
10314  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
10315  *
10316  */
10317   __pyx_t_1 = 0;
10318   if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
10319     __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
10320     __pyx_t_4 = NULL;
10321   } else {
10322     __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 397, __pyx_L1_error)
10323     __Pyx_GOTREF(__pyx_t_2);
10324     __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 397, __pyx_L1_error)
10325   }
10326   for (;;) {
10327     if (likely(!__pyx_t_4)) {
10328       if (likely(PyList_CheckExact(__pyx_t_2))) {
10329         if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
10330         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10331         __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(1, 397, __pyx_L1_error)
10332         #else
10333         __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 397, __pyx_L1_error)
10334         __Pyx_GOTREF(__pyx_t_5);
10335         #endif
10336       } else {
10337         if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
10338         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10339         __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(1, 397, __pyx_L1_error)
10340         #else
10341         __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 397, __pyx_L1_error)
10342         __Pyx_GOTREF(__pyx_t_5);
10343         #endif
10344       }
10345     } else {
10346       __pyx_t_5 = __pyx_t_4(__pyx_t_2);
10347       if (unlikely(!__pyx_t_5)) {
10348         PyObject* exc_type = PyErr_Occurred();
10349         if (exc_type) {
10350           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
10351           else __PYX_ERR(1, 397, __pyx_L1_error)
10352         }
10353         break;
10354       }
10355       __Pyx_GOTREF(__pyx_t_5);
10356     }
10357     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
10358     __pyx_t_5 = 0;
10359     __pyx_v_dim = __pyx_t_1;
10360     __pyx_t_1 = (__pyx_t_1 + 1);
10361 
10362     /* "View.MemoryView":398
10363  *
10364  *         for dim, idx in enumerate(index):
10365  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)             # <<<<<<<<<<<<<<
10366  *
10367  *         return itemp
10368  */
10369     __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 398, __pyx_L1_error)
10370     __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(1, 398, __pyx_L1_error)
10371     __pyx_v_itemp = __pyx_t_7;
10372 
10373     /* "View.MemoryView":397
10374  *         cdef char *itemp = <char *> self.view.buf
10375  *
10376  *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
10377  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
10378  *
10379  */
10380   }
10381   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10382 
10383   /* "View.MemoryView":400
10384  *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
10385  *
10386  *         return itemp             # <<<<<<<<<<<<<<
10387  *
10388  *
10389  */
10390   __pyx_r = __pyx_v_itemp;
10391   goto __pyx_L0;
10392 
10393   /* "View.MemoryView":393
10394  *                 PyThread_free_lock(self.lock)
10395  *
10396  *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
10397  *         cdef Py_ssize_t dim
10398  *         cdef char *itemp = <char *> self.view.buf
10399  */
10400 
10401   /* function exit code */
10402   __pyx_L1_error:;
10403   __Pyx_XDECREF(__pyx_t_2);
10404   __Pyx_XDECREF(__pyx_t_5);
10405   __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
10406   __pyx_r = NULL;
10407   __pyx_L0:;
10408   __Pyx_XDECREF(__pyx_v_idx);
10409   __Pyx_RefNannyFinishContext();
10410   return __pyx_r;
10411 }
10412 
10413 /* "View.MemoryView":403
10414  *
10415  *
10416  *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
10417  *         if index is Ellipsis:
10418  *             return self
10419  */
10420 
10421 /* Python wrapper */
10422 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)10423 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
10424   PyObject *__pyx_r = 0;
10425   __Pyx_RefNannyDeclarations
10426   __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
10427   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
10428 
10429   /* function exit code */
10430   __Pyx_RefNannyFinishContext();
10431   return __pyx_r;
10432 }
10433 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index)10434 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
10435   PyObject *__pyx_v_have_slices = NULL;
10436   PyObject *__pyx_v_indices = NULL;
10437   char *__pyx_v_itemp;
10438   PyObject *__pyx_r = NULL;
10439   __Pyx_RefNannyDeclarations
10440   int __pyx_t_1;
10441   int __pyx_t_2;
10442   PyObject *__pyx_t_3 = NULL;
10443   PyObject *__pyx_t_4 = NULL;
10444   PyObject *__pyx_t_5 = NULL;
10445   char *__pyx_t_6;
10446   int __pyx_lineno = 0;
10447   const char *__pyx_filename = NULL;
10448   int __pyx_clineno = 0;
10449   __Pyx_RefNannySetupContext("__getitem__", 0);
10450 
10451   /* "View.MemoryView":404
10452  *
10453  *     def __getitem__(memoryview self, object index):
10454  *         if index is Ellipsis:             # <<<<<<<<<<<<<<
10455  *             return self
10456  *
10457  */
10458   __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
10459   __pyx_t_2 = (__pyx_t_1 != 0);
10460   if (__pyx_t_2) {
10461 
10462     /* "View.MemoryView":405
10463  *     def __getitem__(memoryview self, object index):
10464  *         if index is Ellipsis:
10465  *             return self             # <<<<<<<<<<<<<<
10466  *
10467  *         have_slices, indices = _unellipsify(index, self.view.ndim)
10468  */
10469     __Pyx_XDECREF(__pyx_r);
10470     __Pyx_INCREF(((PyObject *)__pyx_v_self));
10471     __pyx_r = ((PyObject *)__pyx_v_self);
10472     goto __pyx_L0;
10473 
10474     /* "View.MemoryView":404
10475  *
10476  *     def __getitem__(memoryview self, object index):
10477  *         if index is Ellipsis:             # <<<<<<<<<<<<<<
10478  *             return self
10479  *
10480  */
10481   }
10482 
10483   /* "View.MemoryView":407
10484  *             return self
10485  *
10486  *         have_slices, indices = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
10487  *
10488  *         cdef char *itemp
10489  */
10490   __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 407, __pyx_L1_error)
10491   __Pyx_GOTREF(__pyx_t_3);
10492   if (likely(__pyx_t_3 != Py_None)) {
10493     PyObject* sequence = __pyx_t_3;
10494     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
10495     if (unlikely(size != 2)) {
10496       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
10497       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
10498       __PYX_ERR(1, 407, __pyx_L1_error)
10499     }
10500     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10501     __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
10502     __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
10503     __Pyx_INCREF(__pyx_t_4);
10504     __Pyx_INCREF(__pyx_t_5);
10505     #else
10506     __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 407, __pyx_L1_error)
10507     __Pyx_GOTREF(__pyx_t_4);
10508     __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 407, __pyx_L1_error)
10509     __Pyx_GOTREF(__pyx_t_5);
10510     #endif
10511     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10512   } else {
10513     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 407, __pyx_L1_error)
10514   }
10515   __pyx_v_have_slices = __pyx_t_4;
10516   __pyx_t_4 = 0;
10517   __pyx_v_indices = __pyx_t_5;
10518   __pyx_t_5 = 0;
10519 
10520   /* "View.MemoryView":410
10521  *
10522  *         cdef char *itemp
10523  *         if have_slices:             # <<<<<<<<<<<<<<
10524  *             return memview_slice(self, indices)
10525  *         else:
10526  */
10527   __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 410, __pyx_L1_error)
10528   if (__pyx_t_2) {
10529 
10530     /* "View.MemoryView":411
10531  *         cdef char *itemp
10532  *         if have_slices:
10533  *             return memview_slice(self, indices)             # <<<<<<<<<<<<<<
10534  *         else:
10535  *             itemp = self.get_item_pointer(indices)
10536  */
10537     __Pyx_XDECREF(__pyx_r);
10538     __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 411, __pyx_L1_error)
10539     __Pyx_GOTREF(__pyx_t_3);
10540     __pyx_r = __pyx_t_3;
10541     __pyx_t_3 = 0;
10542     goto __pyx_L0;
10543 
10544     /* "View.MemoryView":410
10545  *
10546  *         cdef char *itemp
10547  *         if have_slices:             # <<<<<<<<<<<<<<
10548  *             return memview_slice(self, indices)
10549  *         else:
10550  */
10551   }
10552 
10553   /* "View.MemoryView":413
10554  *             return memview_slice(self, indices)
10555  *         else:
10556  *             itemp = self.get_item_pointer(indices)             # <<<<<<<<<<<<<<
10557  *             return self.convert_item_to_object(itemp)
10558  *
10559  */
10560   /*else*/ {
10561     __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(1, 413, __pyx_L1_error)
10562     __pyx_v_itemp = __pyx_t_6;
10563 
10564     /* "View.MemoryView":414
10565  *         else:
10566  *             itemp = self.get_item_pointer(indices)
10567  *             return self.convert_item_to_object(itemp)             # <<<<<<<<<<<<<<
10568  *
10569  *     def __setitem__(memoryview self, object index, object value):
10570  */
10571     __Pyx_XDECREF(__pyx_r);
10572     __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 414, __pyx_L1_error)
10573     __Pyx_GOTREF(__pyx_t_3);
10574     __pyx_r = __pyx_t_3;
10575     __pyx_t_3 = 0;
10576     goto __pyx_L0;
10577   }
10578 
10579   /* "View.MemoryView":403
10580  *
10581  *
10582  *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
10583  *         if index is Ellipsis:
10584  *             return self
10585  */
10586 
10587   /* function exit code */
10588   __pyx_L1_error:;
10589   __Pyx_XDECREF(__pyx_t_3);
10590   __Pyx_XDECREF(__pyx_t_4);
10591   __Pyx_XDECREF(__pyx_t_5);
10592   __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10593   __pyx_r = NULL;
10594   __pyx_L0:;
10595   __Pyx_XDECREF(__pyx_v_have_slices);
10596   __Pyx_XDECREF(__pyx_v_indices);
10597   __Pyx_XGIVEREF(__pyx_r);
10598   __Pyx_RefNannyFinishContext();
10599   return __pyx_r;
10600 }
10601 
10602 /* "View.MemoryView":416
10603  *             return self.convert_item_to_object(itemp)
10604  *
10605  *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
10606  *         if self.view.readonly:
10607  *             raise TypeError("Cannot assign to read-only memoryview")
10608  */
10609 
10610 /* Python wrapper */
10611 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)10612 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
10613   int __pyx_r;
10614   __Pyx_RefNannyDeclarations
10615   __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
10616   __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));
10617 
10618   /* function exit code */
10619   __Pyx_RefNannyFinishContext();
10620   return __pyx_r;
10621 }
10622 
__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)10623 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) {
10624   PyObject *__pyx_v_have_slices = NULL;
10625   PyObject *__pyx_v_obj = NULL;
10626   int __pyx_r;
10627   __Pyx_RefNannyDeclarations
10628   int __pyx_t_1;
10629   PyObject *__pyx_t_2 = NULL;
10630   PyObject *__pyx_t_3 = NULL;
10631   PyObject *__pyx_t_4 = NULL;
10632   int __pyx_lineno = 0;
10633   const char *__pyx_filename = NULL;
10634   int __pyx_clineno = 0;
10635   __Pyx_RefNannySetupContext("__setitem__", 0);
10636   __Pyx_INCREF(__pyx_v_index);
10637 
10638   /* "View.MemoryView":417
10639  *
10640  *     def __setitem__(memoryview self, object index, object value):
10641  *         if self.view.readonly:             # <<<<<<<<<<<<<<
10642  *             raise TypeError("Cannot assign to read-only memoryview")
10643  *
10644  */
10645   __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
10646   if (unlikely(__pyx_t_1)) {
10647 
10648     /* "View.MemoryView":418
10649  *     def __setitem__(memoryview self, object index, object value):
10650  *         if self.view.readonly:
10651  *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
10652  *
10653  *         have_slices, index = _unellipsify(index, self.view.ndim)
10654  */
10655     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 418, __pyx_L1_error)
10656     __Pyx_GOTREF(__pyx_t_2);
10657     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
10658     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10659     __PYX_ERR(1, 418, __pyx_L1_error)
10660 
10661     /* "View.MemoryView":417
10662  *
10663  *     def __setitem__(memoryview self, object index, object value):
10664  *         if self.view.readonly:             # <<<<<<<<<<<<<<
10665  *             raise TypeError("Cannot assign to read-only memoryview")
10666  *
10667  */
10668   }
10669 
10670   /* "View.MemoryView":420
10671  *             raise TypeError("Cannot assign to read-only memoryview")
10672  *
10673  *         have_slices, index = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
10674  *
10675  *         if have_slices:
10676  */
10677   __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 420, __pyx_L1_error)
10678   __Pyx_GOTREF(__pyx_t_2);
10679   if (likely(__pyx_t_2 != Py_None)) {
10680     PyObject* sequence = __pyx_t_2;
10681     Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
10682     if (unlikely(size != 2)) {
10683       if (size > 2) __Pyx_RaiseTooManyValuesError(2);
10684       else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
10685       __PYX_ERR(1, 420, __pyx_L1_error)
10686     }
10687     #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10688     __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
10689     __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
10690     __Pyx_INCREF(__pyx_t_3);
10691     __Pyx_INCREF(__pyx_t_4);
10692     #else
10693     __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 420, __pyx_L1_error)
10694     __Pyx_GOTREF(__pyx_t_3);
10695     __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 420, __pyx_L1_error)
10696     __Pyx_GOTREF(__pyx_t_4);
10697     #endif
10698     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10699   } else {
10700     __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 420, __pyx_L1_error)
10701   }
10702   __pyx_v_have_slices = __pyx_t_3;
10703   __pyx_t_3 = 0;
10704   __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
10705   __pyx_t_4 = 0;
10706 
10707   /* "View.MemoryView":422
10708  *         have_slices, index = _unellipsify(index, self.view.ndim)
10709  *
10710  *         if have_slices:             # <<<<<<<<<<<<<<
10711  *             obj = self.is_slice(value)
10712  *             if obj:
10713  */
10714   __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 422, __pyx_L1_error)
10715   if (__pyx_t_1) {
10716 
10717     /* "View.MemoryView":423
10718  *
10719  *         if have_slices:
10720  *             obj = self.is_slice(value)             # <<<<<<<<<<<<<<
10721  *             if obj:
10722  *                 self.setitem_slice_assignment(self[index], obj)
10723  */
10724     __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 423, __pyx_L1_error)
10725     __Pyx_GOTREF(__pyx_t_2);
10726     __pyx_v_obj = __pyx_t_2;
10727     __pyx_t_2 = 0;
10728 
10729     /* "View.MemoryView":424
10730  *         if have_slices:
10731  *             obj = self.is_slice(value)
10732  *             if obj:             # <<<<<<<<<<<<<<
10733  *                 self.setitem_slice_assignment(self[index], obj)
10734  *             else:
10735  */
10736     __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 424, __pyx_L1_error)
10737     if (__pyx_t_1) {
10738 
10739       /* "View.MemoryView":425
10740  *             obj = self.is_slice(value)
10741  *             if obj:
10742  *                 self.setitem_slice_assignment(self[index], obj)             # <<<<<<<<<<<<<<
10743  *             else:
10744  *                 self.setitem_slice_assign_scalar(self[index], value)
10745  */
10746       __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error)
10747       __Pyx_GOTREF(__pyx_t_2);
10748       __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 425, __pyx_L1_error)
10749       __Pyx_GOTREF(__pyx_t_4);
10750       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10751       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10752 
10753       /* "View.MemoryView":424
10754  *         if have_slices:
10755  *             obj = self.is_slice(value)
10756  *             if obj:             # <<<<<<<<<<<<<<
10757  *                 self.setitem_slice_assignment(self[index], obj)
10758  *             else:
10759  */
10760       goto __pyx_L5;
10761     }
10762 
10763     /* "View.MemoryView":427
10764  *                 self.setitem_slice_assignment(self[index], obj)
10765  *             else:
10766  *                 self.setitem_slice_assign_scalar(self[index], value)             # <<<<<<<<<<<<<<
10767  *         else:
10768  *             self.setitem_indexed(index, value)
10769  */
10770     /*else*/ {
10771       __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 427, __pyx_L1_error)
10772       __Pyx_GOTREF(__pyx_t_4);
10773       if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(1, 427, __pyx_L1_error)
10774       __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 427, __pyx_L1_error)
10775       __Pyx_GOTREF(__pyx_t_2);
10776       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10777       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10778     }
10779     __pyx_L5:;
10780 
10781     /* "View.MemoryView":422
10782  *         have_slices, index = _unellipsify(index, self.view.ndim)
10783  *
10784  *         if have_slices:             # <<<<<<<<<<<<<<
10785  *             obj = self.is_slice(value)
10786  *             if obj:
10787  */
10788     goto __pyx_L4;
10789   }
10790 
10791   /* "View.MemoryView":429
10792  *                 self.setitem_slice_assign_scalar(self[index], value)
10793  *         else:
10794  *             self.setitem_indexed(index, value)             # <<<<<<<<<<<<<<
10795  *
10796  *     cdef is_slice(self, obj):
10797  */
10798   /*else*/ {
10799     __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 429, __pyx_L1_error)
10800     __Pyx_GOTREF(__pyx_t_2);
10801     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10802   }
10803   __pyx_L4:;
10804 
10805   /* "View.MemoryView":416
10806  *             return self.convert_item_to_object(itemp)
10807  *
10808  *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
10809  *         if self.view.readonly:
10810  *             raise TypeError("Cannot assign to read-only memoryview")
10811  */
10812 
10813   /* function exit code */
10814   __pyx_r = 0;
10815   goto __pyx_L0;
10816   __pyx_L1_error:;
10817   __Pyx_XDECREF(__pyx_t_2);
10818   __Pyx_XDECREF(__pyx_t_3);
10819   __Pyx_XDECREF(__pyx_t_4);
10820   __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10821   __pyx_r = -1;
10822   __pyx_L0:;
10823   __Pyx_XDECREF(__pyx_v_have_slices);
10824   __Pyx_XDECREF(__pyx_v_obj);
10825   __Pyx_XDECREF(__pyx_v_index);
10826   __Pyx_RefNannyFinishContext();
10827   return __pyx_r;
10828 }
10829 
10830 /* "View.MemoryView":431
10831  *             self.setitem_indexed(index, value)
10832  *
10833  *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
10834  *         if not isinstance(obj, memoryview):
10835  *             try:
10836  */
10837 
__pyx_memoryview_is_slice(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_obj)10838 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
10839   PyObject *__pyx_r = NULL;
10840   __Pyx_RefNannyDeclarations
10841   int __pyx_t_1;
10842   int __pyx_t_2;
10843   PyObject *__pyx_t_3 = NULL;
10844   PyObject *__pyx_t_4 = NULL;
10845   PyObject *__pyx_t_5 = NULL;
10846   PyObject *__pyx_t_6 = NULL;
10847   PyObject *__pyx_t_7 = NULL;
10848   PyObject *__pyx_t_8 = NULL;
10849   int __pyx_t_9;
10850   int __pyx_lineno = 0;
10851   const char *__pyx_filename = NULL;
10852   int __pyx_clineno = 0;
10853   __Pyx_RefNannySetupContext("is_slice", 0);
10854   __Pyx_INCREF(__pyx_v_obj);
10855 
10856   /* "View.MemoryView":432
10857  *
10858  *     cdef is_slice(self, obj):
10859  *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
10860  *             try:
10861  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10862  */
10863   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
10864   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
10865   if (__pyx_t_2) {
10866 
10867     /* "View.MemoryView":433
10868  *     cdef is_slice(self, obj):
10869  *         if not isinstance(obj, memoryview):
10870  *             try:             # <<<<<<<<<<<<<<
10871  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10872  *                                  self.dtype_is_object)
10873  */
10874     {
10875       __Pyx_PyThreadState_declare
10876       __Pyx_PyThreadState_assign
10877       __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
10878       __Pyx_XGOTREF(__pyx_t_3);
10879       __Pyx_XGOTREF(__pyx_t_4);
10880       __Pyx_XGOTREF(__pyx_t_5);
10881       /*try:*/ {
10882 
10883         /* "View.MemoryView":434
10884  *         if not isinstance(obj, memoryview):
10885  *             try:
10886  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
10887  *                                  self.dtype_is_object)
10888  *             except TypeError:
10889  */
10890         __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 434, __pyx_L4_error)
10891         __Pyx_GOTREF(__pyx_t_6);
10892 
10893         /* "View.MemoryView":435
10894  *             try:
10895  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10896  *                                  self.dtype_is_object)             # <<<<<<<<<<<<<<
10897  *             except TypeError:
10898  *                 return None
10899  */
10900         __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 435, __pyx_L4_error)
10901         __Pyx_GOTREF(__pyx_t_7);
10902 
10903         /* "View.MemoryView":434
10904  *         if not isinstance(obj, memoryview):
10905  *             try:
10906  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
10907  *                                  self.dtype_is_object)
10908  *             except TypeError:
10909  */
10910         __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 434, __pyx_L4_error)
10911         __Pyx_GOTREF(__pyx_t_8);
10912         __Pyx_INCREF(__pyx_v_obj);
10913         __Pyx_GIVEREF(__pyx_v_obj);
10914         PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
10915         __Pyx_GIVEREF(__pyx_t_6);
10916         PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
10917         __Pyx_GIVEREF(__pyx_t_7);
10918         PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
10919         __pyx_t_6 = 0;
10920         __pyx_t_7 = 0;
10921         __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 434, __pyx_L4_error)
10922         __Pyx_GOTREF(__pyx_t_7);
10923         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10924         __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
10925         __pyx_t_7 = 0;
10926 
10927         /* "View.MemoryView":433
10928  *     cdef is_slice(self, obj):
10929  *         if not isinstance(obj, memoryview):
10930  *             try:             # <<<<<<<<<<<<<<
10931  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10932  *                                  self.dtype_is_object)
10933  */
10934       }
10935       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10936       __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
10937       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10938       goto __pyx_L9_try_end;
10939       __pyx_L4_error:;
10940       __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
10941       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
10942       __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
10943 
10944       /* "View.MemoryView":436
10945  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10946  *                                  self.dtype_is_object)
10947  *             except TypeError:             # <<<<<<<<<<<<<<
10948  *                 return None
10949  *
10950  */
10951       __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
10952       if (__pyx_t_9) {
10953         __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
10954         if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(1, 436, __pyx_L6_except_error)
10955         __Pyx_GOTREF(__pyx_t_7);
10956         __Pyx_GOTREF(__pyx_t_8);
10957         __Pyx_GOTREF(__pyx_t_6);
10958 
10959         /* "View.MemoryView":437
10960  *                                  self.dtype_is_object)
10961  *             except TypeError:
10962  *                 return None             # <<<<<<<<<<<<<<
10963  *
10964  *         return obj
10965  */
10966         __Pyx_XDECREF(__pyx_r);
10967         __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10968         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10969         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10970         __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10971         goto __pyx_L7_except_return;
10972       }
10973       goto __pyx_L6_except_error;
10974       __pyx_L6_except_error:;
10975 
10976       /* "View.MemoryView":433
10977  *     cdef is_slice(self, obj):
10978  *         if not isinstance(obj, memoryview):
10979  *             try:             # <<<<<<<<<<<<<<
10980  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
10981  *                                  self.dtype_is_object)
10982  */
10983       __Pyx_XGIVEREF(__pyx_t_3);
10984       __Pyx_XGIVEREF(__pyx_t_4);
10985       __Pyx_XGIVEREF(__pyx_t_5);
10986       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
10987       goto __pyx_L1_error;
10988       __pyx_L7_except_return:;
10989       __Pyx_XGIVEREF(__pyx_t_3);
10990       __Pyx_XGIVEREF(__pyx_t_4);
10991       __Pyx_XGIVEREF(__pyx_t_5);
10992       __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
10993       goto __pyx_L0;
10994       __pyx_L9_try_end:;
10995     }
10996 
10997     /* "View.MemoryView":432
10998  *
10999  *     cdef is_slice(self, obj):
11000  *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
11001  *             try:
11002  *                 obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
11003  */
11004   }
11005 
11006   /* "View.MemoryView":439
11007  *                 return None
11008  *
11009  *         return obj             # <<<<<<<<<<<<<<
11010  *
11011  *     cdef setitem_slice_assignment(self, dst, src):
11012  */
11013   __Pyx_XDECREF(__pyx_r);
11014   __Pyx_INCREF(__pyx_v_obj);
11015   __pyx_r = __pyx_v_obj;
11016   goto __pyx_L0;
11017 
11018   /* "View.MemoryView":431
11019  *             self.setitem_indexed(index, value)
11020  *
11021  *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
11022  *         if not isinstance(obj, memoryview):
11023  *             try:
11024  */
11025 
11026   /* function exit code */
11027   __pyx_L1_error:;
11028   __Pyx_XDECREF(__pyx_t_6);
11029   __Pyx_XDECREF(__pyx_t_7);
11030   __Pyx_XDECREF(__pyx_t_8);
11031   __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
11032   __pyx_r = 0;
11033   __pyx_L0:;
11034   __Pyx_XDECREF(__pyx_v_obj);
11035   __Pyx_XGIVEREF(__pyx_r);
11036   __Pyx_RefNannyFinishContext();
11037   return __pyx_r;
11038 }
11039 
11040 /* "View.MemoryView":441
11041  *         return obj
11042  *
11043  *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
11044  *         cdef __Pyx_memviewslice dst_slice
11045  *         cdef __Pyx_memviewslice src_slice
11046  */
11047 
__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_dst,PyObject * __pyx_v_src)11048 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
11049   __Pyx_memviewslice __pyx_v_dst_slice;
11050   __Pyx_memviewslice __pyx_v_src_slice;
11051   PyObject *__pyx_r = NULL;
11052   __Pyx_RefNannyDeclarations
11053   __Pyx_memviewslice *__pyx_t_1;
11054   __Pyx_memviewslice *__pyx_t_2;
11055   PyObject *__pyx_t_3 = NULL;
11056   int __pyx_t_4;
11057   int __pyx_t_5;
11058   int __pyx_t_6;
11059   int __pyx_lineno = 0;
11060   const char *__pyx_filename = NULL;
11061   int __pyx_clineno = 0;
11062   __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
11063 
11064   /* "View.MemoryView":445
11065  *         cdef __Pyx_memviewslice src_slice
11066  *
11067  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
11068  *                                  get_slice_from_memview(dst, &dst_slice)[0],
11069  *                                  src.ndim, dst.ndim, self.dtype_is_object)
11070  */
11071   if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(1, 445, __pyx_L1_error)
11072   __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(1, 445, __pyx_L1_error)
11073 
11074   /* "View.MemoryView":446
11075  *
11076  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
11077  *                                  get_slice_from_memview(dst, &dst_slice)[0],             # <<<<<<<<<<<<<<
11078  *                                  src.ndim, dst.ndim, self.dtype_is_object)
11079  *
11080  */
11081   if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(1, 446, __pyx_L1_error)
11082   __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(1, 446, __pyx_L1_error)
11083 
11084   /* "View.MemoryView":447
11085  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
11086  *                                  get_slice_from_memview(dst, &dst_slice)[0],
11087  *                                  src.ndim, dst.ndim, self.dtype_is_object)             # <<<<<<<<<<<<<<
11088  *
11089  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
11090  */
11091   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 447, __pyx_L1_error)
11092   __Pyx_GOTREF(__pyx_t_3);
11093   __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 447, __pyx_L1_error)
11094   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11095   __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 447, __pyx_L1_error)
11096   __Pyx_GOTREF(__pyx_t_3);
11097   __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 447, __pyx_L1_error)
11098   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11099 
11100   /* "View.MemoryView":445
11101  *         cdef __Pyx_memviewslice src_slice
11102  *
11103  *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
11104  *                                  get_slice_from_memview(dst, &dst_slice)[0],
11105  *                                  src.ndim, dst.ndim, self.dtype_is_object)
11106  */
11107   __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(1, 445, __pyx_L1_error)
11108 
11109   /* "View.MemoryView":441
11110  *         return obj
11111  *
11112  *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
11113  *         cdef __Pyx_memviewslice dst_slice
11114  *         cdef __Pyx_memviewslice src_slice
11115  */
11116 
11117   /* function exit code */
11118   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11119   goto __pyx_L0;
11120   __pyx_L1_error:;
11121   __Pyx_XDECREF(__pyx_t_3);
11122   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
11123   __pyx_r = 0;
11124   __pyx_L0:;
11125   __Pyx_XGIVEREF(__pyx_r);
11126   __Pyx_RefNannyFinishContext();
11127   return __pyx_r;
11128 }
11129 
11130 /* "View.MemoryView":449
11131  *                                  src.ndim, dst.ndim, self.dtype_is_object)
11132  *
11133  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
11134  *         cdef int array[128]
11135  *         cdef void *tmp = NULL
11136  */
11137 
__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj * __pyx_v_self,struct __pyx_memoryview_obj * __pyx_v_dst,PyObject * __pyx_v_value)11138 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) {
11139   int __pyx_v_array[0x80];
11140   void *__pyx_v_tmp;
11141   void *__pyx_v_item;
11142   __Pyx_memviewslice *__pyx_v_dst_slice;
11143   __Pyx_memviewslice __pyx_v_tmp_slice;
11144   PyObject *__pyx_r = NULL;
11145   __Pyx_RefNannyDeclarations
11146   __Pyx_memviewslice *__pyx_t_1;
11147   int __pyx_t_2;
11148   PyObject *__pyx_t_3 = NULL;
11149   int __pyx_t_4;
11150   int __pyx_t_5;
11151   char const *__pyx_t_6;
11152   PyObject *__pyx_t_7 = NULL;
11153   PyObject *__pyx_t_8 = NULL;
11154   PyObject *__pyx_t_9 = NULL;
11155   PyObject *__pyx_t_10 = NULL;
11156   PyObject *__pyx_t_11 = NULL;
11157   PyObject *__pyx_t_12 = NULL;
11158   int __pyx_lineno = 0;
11159   const char *__pyx_filename = NULL;
11160   int __pyx_clineno = 0;
11161   __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);
11162 
11163   /* "View.MemoryView":451
11164  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
11165  *         cdef int array[128]
11166  *         cdef void *tmp = NULL             # <<<<<<<<<<<<<<
11167  *         cdef void *item
11168  *
11169  */
11170   __pyx_v_tmp = NULL;
11171 
11172   /* "View.MemoryView":456
11173  *         cdef __Pyx_memviewslice *dst_slice
11174  *         cdef __Pyx_memviewslice tmp_slice
11175  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)             # <<<<<<<<<<<<<<
11176  *
11177  *         if <size_t>self.view.itemsize > sizeof(array):
11178  */
11179   __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(1, 456, __pyx_L1_error)
11180   __pyx_v_dst_slice = __pyx_t_1;
11181 
11182   /* "View.MemoryView":458
11183  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
11184  *
11185  *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
11186  *             tmp = PyMem_Malloc(self.view.itemsize)
11187  *             if tmp == NULL:
11188  */
11189   __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
11190   if (__pyx_t_2) {
11191 
11192     /* "View.MemoryView":459
11193  *
11194  *         if <size_t>self.view.itemsize > sizeof(array):
11195  *             tmp = PyMem_Malloc(self.view.itemsize)             # <<<<<<<<<<<<<<
11196  *             if tmp == NULL:
11197  *                 raise MemoryError
11198  */
11199     __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
11200 
11201     /* "View.MemoryView":460
11202  *         if <size_t>self.view.itemsize > sizeof(array):
11203  *             tmp = PyMem_Malloc(self.view.itemsize)
11204  *             if tmp == NULL:             # <<<<<<<<<<<<<<
11205  *                 raise MemoryError
11206  *             item = tmp
11207  */
11208     __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
11209     if (unlikely(__pyx_t_2)) {
11210 
11211       /* "View.MemoryView":461
11212  *             tmp = PyMem_Malloc(self.view.itemsize)
11213  *             if tmp == NULL:
11214  *                 raise MemoryError             # <<<<<<<<<<<<<<
11215  *             item = tmp
11216  *         else:
11217  */
11218       PyErr_NoMemory(); __PYX_ERR(1, 461, __pyx_L1_error)
11219 
11220       /* "View.MemoryView":460
11221  *         if <size_t>self.view.itemsize > sizeof(array):
11222  *             tmp = PyMem_Malloc(self.view.itemsize)
11223  *             if tmp == NULL:             # <<<<<<<<<<<<<<
11224  *                 raise MemoryError
11225  *             item = tmp
11226  */
11227     }
11228 
11229     /* "View.MemoryView":462
11230  *             if tmp == NULL:
11231  *                 raise MemoryError
11232  *             item = tmp             # <<<<<<<<<<<<<<
11233  *         else:
11234  *             item = <void *> array
11235  */
11236     __pyx_v_item = __pyx_v_tmp;
11237 
11238     /* "View.MemoryView":458
11239  *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
11240  *
11241  *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
11242  *             tmp = PyMem_Malloc(self.view.itemsize)
11243  *             if tmp == NULL:
11244  */
11245     goto __pyx_L3;
11246   }
11247 
11248   /* "View.MemoryView":464
11249  *             item = tmp
11250  *         else:
11251  *             item = <void *> array             # <<<<<<<<<<<<<<
11252  *
11253  *         try:
11254  */
11255   /*else*/ {
11256     __pyx_v_item = ((void *)__pyx_v_array);
11257   }
11258   __pyx_L3:;
11259 
11260   /* "View.MemoryView":466
11261  *             item = <void *> array
11262  *
11263  *         try:             # <<<<<<<<<<<<<<
11264  *             if self.dtype_is_object:
11265  *                 (<PyObject **> item)[0] = <PyObject *> value
11266  */
11267   /*try:*/ {
11268 
11269     /* "View.MemoryView":467
11270  *
11271  *         try:
11272  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
11273  *                 (<PyObject **> item)[0] = <PyObject *> value
11274  *             else:
11275  */
11276     __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
11277     if (__pyx_t_2) {
11278 
11279       /* "View.MemoryView":468
11280  *         try:
11281  *             if self.dtype_is_object:
11282  *                 (<PyObject **> item)[0] = <PyObject *> value             # <<<<<<<<<<<<<<
11283  *             else:
11284  *                 self.assign_item_from_object(<char *> item, value)
11285  */
11286       (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
11287 
11288       /* "View.MemoryView":467
11289  *
11290  *         try:
11291  *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
11292  *                 (<PyObject **> item)[0] = <PyObject *> value
11293  *             else:
11294  */
11295       goto __pyx_L8;
11296     }
11297 
11298     /* "View.MemoryView":470
11299  *                 (<PyObject **> item)[0] = <PyObject *> value
11300  *             else:
11301  *                 self.assign_item_from_object(<char *> item, value)             # <<<<<<<<<<<<<<
11302  *
11303  *
11304  */
11305     /*else*/ {
11306       __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(1, 470, __pyx_L6_error)
11307       __Pyx_GOTREF(__pyx_t_3);
11308       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11309     }
11310     __pyx_L8:;
11311 
11312     /* "View.MemoryView":474
11313  *
11314  *
11315  *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
11316  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
11317  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
11318  */
11319     __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
11320     if (__pyx_t_2) {
11321 
11322       /* "View.MemoryView":475
11323  *
11324  *             if self.view.suboffsets != NULL:
11325  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)             # <<<<<<<<<<<<<<
11326  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
11327  *                                 item, self.dtype_is_object)
11328  */
11329       __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 475, __pyx_L6_error)
11330       __Pyx_GOTREF(__pyx_t_3);
11331       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11332 
11333       /* "View.MemoryView":474
11334  *
11335  *
11336  *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
11337  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
11338  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
11339  */
11340     }
11341 
11342     /* "View.MemoryView":476
11343  *             if self.view.suboffsets != NULL:
11344  *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
11345  *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,             # <<<<<<<<<<<<<<
11346  *                                 item, self.dtype_is_object)
11347  *         finally:
11348  */
11349     __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);
11350   }
11351 
11352   /* "View.MemoryView":479
11353  *                                 item, self.dtype_is_object)
11354  *         finally:
11355  *             PyMem_Free(tmp)             # <<<<<<<<<<<<<<
11356  *
11357  *     cdef setitem_indexed(self, index, value):
11358  */
11359   /*finally:*/ {
11360     /*normal exit:*/{
11361       PyMem_Free(__pyx_v_tmp);
11362       goto __pyx_L7;
11363     }
11364     __pyx_L6_error:;
11365     /*exception exit:*/{
11366       __Pyx_PyThreadState_declare
11367       __Pyx_PyThreadState_assign
11368       __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
11369       __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11370       if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
11371       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);
11372       __Pyx_XGOTREF(__pyx_t_7);
11373       __Pyx_XGOTREF(__pyx_t_8);
11374       __Pyx_XGOTREF(__pyx_t_9);
11375       __Pyx_XGOTREF(__pyx_t_10);
11376       __Pyx_XGOTREF(__pyx_t_11);
11377       __Pyx_XGOTREF(__pyx_t_12);
11378       __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
11379       {
11380         PyMem_Free(__pyx_v_tmp);
11381       }
11382       if (PY_MAJOR_VERSION >= 3) {
11383         __Pyx_XGIVEREF(__pyx_t_10);
11384         __Pyx_XGIVEREF(__pyx_t_11);
11385         __Pyx_XGIVEREF(__pyx_t_12);
11386         __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
11387       }
11388       __Pyx_XGIVEREF(__pyx_t_7);
11389       __Pyx_XGIVEREF(__pyx_t_8);
11390       __Pyx_XGIVEREF(__pyx_t_9);
11391       __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
11392       __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
11393       __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
11394       goto __pyx_L1_error;
11395     }
11396     __pyx_L7:;
11397   }
11398 
11399   /* "View.MemoryView":449
11400  *                                  src.ndim, dst.ndim, self.dtype_is_object)
11401  *
11402  *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
11403  *         cdef int array[128]
11404  *         cdef void *tmp = NULL
11405  */
11406 
11407   /* function exit code */
11408   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11409   goto __pyx_L0;
11410   __pyx_L1_error:;
11411   __Pyx_XDECREF(__pyx_t_3);
11412   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
11413   __pyx_r = 0;
11414   __pyx_L0:;
11415   __Pyx_XGIVEREF(__pyx_r);
11416   __Pyx_RefNannyFinishContext();
11417   return __pyx_r;
11418 }
11419 
11420 /* "View.MemoryView":481
11421  *             PyMem_Free(tmp)
11422  *
11423  *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
11424  *         cdef char *itemp = self.get_item_pointer(index)
11425  *         self.assign_item_from_object(itemp, value)
11426  */
11427 
__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj * __pyx_v_self,PyObject * __pyx_v_index,PyObject * __pyx_v_value)11428 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
11429   char *__pyx_v_itemp;
11430   PyObject *__pyx_r = NULL;
11431   __Pyx_RefNannyDeclarations
11432   char *__pyx_t_1;
11433   PyObject *__pyx_t_2 = NULL;
11434   int __pyx_lineno = 0;
11435   const char *__pyx_filename = NULL;
11436   int __pyx_clineno = 0;
11437   __Pyx_RefNannySetupContext("setitem_indexed", 0);
11438 
11439   /* "View.MemoryView":482
11440  *
11441  *     cdef setitem_indexed(self, index, value):
11442  *         cdef char *itemp = self.get_item_pointer(index)             # <<<<<<<<<<<<<<
11443  *         self.assign_item_from_object(itemp, value)
11444  *
11445  */
11446   __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(1, 482, __pyx_L1_error)
11447   __pyx_v_itemp = __pyx_t_1;
11448 
11449   /* "View.MemoryView":483
11450  *     cdef setitem_indexed(self, index, value):
11451  *         cdef char *itemp = self.get_item_pointer(index)
11452  *         self.assign_item_from_object(itemp, value)             # <<<<<<<<<<<<<<
11453  *
11454  *     cdef convert_item_to_object(self, char *itemp):
11455  */
11456   __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 483, __pyx_L1_error)
11457   __Pyx_GOTREF(__pyx_t_2);
11458   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11459 
11460   /* "View.MemoryView":481
11461  *             PyMem_Free(tmp)
11462  *
11463  *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
11464  *         cdef char *itemp = self.get_item_pointer(index)
11465  *         self.assign_item_from_object(itemp, value)
11466  */
11467 
11468   /* function exit code */
11469   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11470   goto __pyx_L0;
11471   __pyx_L1_error:;
11472   __Pyx_XDECREF(__pyx_t_2);
11473   __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
11474   __pyx_r = 0;
11475   __pyx_L0:;
11476   __Pyx_XGIVEREF(__pyx_r);
11477   __Pyx_RefNannyFinishContext();
11478   return __pyx_r;
11479 }
11480 
11481 /* "View.MemoryView":485
11482  *         self.assign_item_from_object(itemp, value)
11483  *
11484  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
11485  *         """Only used if instantiated manually by the user, or if Cython doesn't
11486  *         know how to convert the type"""
11487  */
11488 
__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj * __pyx_v_self,char * __pyx_v_itemp)11489 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
11490   PyObject *__pyx_v_struct = NULL;
11491   PyObject *__pyx_v_bytesitem = 0;
11492   PyObject *__pyx_v_result = NULL;
11493   PyObject *__pyx_r = NULL;
11494   __Pyx_RefNannyDeclarations
11495   PyObject *__pyx_t_1 = NULL;
11496   PyObject *__pyx_t_2 = NULL;
11497   PyObject *__pyx_t_3 = NULL;
11498   PyObject *__pyx_t_4 = NULL;
11499   PyObject *__pyx_t_5 = NULL;
11500   PyObject *__pyx_t_6 = NULL;
11501   PyObject *__pyx_t_7 = NULL;
11502   int __pyx_t_8;
11503   PyObject *__pyx_t_9 = NULL;
11504   size_t __pyx_t_10;
11505   int __pyx_t_11;
11506   int __pyx_lineno = 0;
11507   const char *__pyx_filename = NULL;
11508   int __pyx_clineno = 0;
11509   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
11510 
11511   /* "View.MemoryView":488
11512  *         """Only used if instantiated manually by the user, or if Cython doesn't
11513  *         know how to convert the type"""
11514  *         import struct             # <<<<<<<<<<<<<<
11515  *         cdef bytes bytesitem
11516  *
11517  */
11518   __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 488, __pyx_L1_error)
11519   __Pyx_GOTREF(__pyx_t_1);
11520   __pyx_v_struct = __pyx_t_1;
11521   __pyx_t_1 = 0;
11522 
11523   /* "View.MemoryView":491
11524  *         cdef bytes bytesitem
11525  *
11526  *         bytesitem = itemp[:self.view.itemsize]             # <<<<<<<<<<<<<<
11527  *         try:
11528  *             result = struct.unpack(self.view.format, bytesitem)
11529  */
11530   __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 491, __pyx_L1_error)
11531   __Pyx_GOTREF(__pyx_t_1);
11532   __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
11533   __pyx_t_1 = 0;
11534 
11535   /* "View.MemoryView":492
11536  *
11537  *         bytesitem = itemp[:self.view.itemsize]
11538  *         try:             # <<<<<<<<<<<<<<
11539  *             result = struct.unpack(self.view.format, bytesitem)
11540  *         except struct.error:
11541  */
11542   {
11543     __Pyx_PyThreadState_declare
11544     __Pyx_PyThreadState_assign
11545     __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
11546     __Pyx_XGOTREF(__pyx_t_2);
11547     __Pyx_XGOTREF(__pyx_t_3);
11548     __Pyx_XGOTREF(__pyx_t_4);
11549     /*try:*/ {
11550 
11551       /* "View.MemoryView":493
11552  *         bytesitem = itemp[:self.view.itemsize]
11553  *         try:
11554  *             result = struct.unpack(self.view.format, bytesitem)             # <<<<<<<<<<<<<<
11555  *         except struct.error:
11556  *             raise ValueError("Unable to convert item to object")
11557  */
11558       __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 493, __pyx_L3_error)
11559       __Pyx_GOTREF(__pyx_t_5);
11560       __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 493, __pyx_L3_error)
11561       __Pyx_GOTREF(__pyx_t_6);
11562       __pyx_t_7 = NULL;
11563       __pyx_t_8 = 0;
11564       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
11565         __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
11566         if (likely(__pyx_t_7)) {
11567           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
11568           __Pyx_INCREF(__pyx_t_7);
11569           __Pyx_INCREF(function);
11570           __Pyx_DECREF_SET(__pyx_t_5, function);
11571           __pyx_t_8 = 1;
11572         }
11573       }
11574       #if CYTHON_FAST_PYCALL
11575       if (PyFunction_Check(__pyx_t_5)) {
11576         PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
11577         __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L3_error)
11578         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11579         __Pyx_GOTREF(__pyx_t_1);
11580         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11581       } else
11582       #endif
11583       #if CYTHON_FAST_PYCCALL
11584       if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
11585         PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
11586         __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L3_error)
11587         __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11588         __Pyx_GOTREF(__pyx_t_1);
11589         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11590       } else
11591       #endif
11592       {
11593         __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 493, __pyx_L3_error)
11594         __Pyx_GOTREF(__pyx_t_9);
11595         if (__pyx_t_7) {
11596           __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
11597         }
11598         __Pyx_GIVEREF(__pyx_t_6);
11599         PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
11600         __Pyx_INCREF(__pyx_v_bytesitem);
11601         __Pyx_GIVEREF(__pyx_v_bytesitem);
11602         PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
11603         __pyx_t_6 = 0;
11604         __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L3_error)
11605         __Pyx_GOTREF(__pyx_t_1);
11606         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
11607       }
11608       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11609       __pyx_v_result = __pyx_t_1;
11610       __pyx_t_1 = 0;
11611 
11612       /* "View.MemoryView":492
11613  *
11614  *         bytesitem = itemp[:self.view.itemsize]
11615  *         try:             # <<<<<<<<<<<<<<
11616  *             result = struct.unpack(self.view.format, bytesitem)
11617  *         except struct.error:
11618  */
11619     }
11620 
11621     /* "View.MemoryView":497
11622  *             raise ValueError("Unable to convert item to object")
11623  *         else:
11624  *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
11625  *                 return result[0]
11626  *             return result
11627  */
11628     /*else:*/ {
11629       __pyx_t_10 = strlen(__pyx_v_self->view.format);
11630       __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
11631       if (__pyx_t_11) {
11632 
11633         /* "View.MemoryView":498
11634  *         else:
11635  *             if len(self.view.format) == 1:
11636  *                 return result[0]             # <<<<<<<<<<<<<<
11637  *             return result
11638  *
11639  */
11640         __Pyx_XDECREF(__pyx_r);
11641         __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 498, __pyx_L5_except_error)
11642         __Pyx_GOTREF(__pyx_t_1);
11643         __pyx_r = __pyx_t_1;
11644         __pyx_t_1 = 0;
11645         goto __pyx_L6_except_return;
11646 
11647         /* "View.MemoryView":497
11648  *             raise ValueError("Unable to convert item to object")
11649  *         else:
11650  *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
11651  *                 return result[0]
11652  *             return result
11653  */
11654       }
11655 
11656       /* "View.MemoryView":499
11657  *             if len(self.view.format) == 1:
11658  *                 return result[0]
11659  *             return result             # <<<<<<<<<<<<<<
11660  *
11661  *     cdef assign_item_from_object(self, char *itemp, object value):
11662  */
11663       __Pyx_XDECREF(__pyx_r);
11664       __Pyx_INCREF(__pyx_v_result);
11665       __pyx_r = __pyx_v_result;
11666       goto __pyx_L6_except_return;
11667     }
11668     __pyx_L3_error:;
11669     __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
11670     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11671     __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
11672     __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11673     __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
11674 
11675     /* "View.MemoryView":494
11676  *         try:
11677  *             result = struct.unpack(self.view.format, bytesitem)
11678  *         except struct.error:             # <<<<<<<<<<<<<<
11679  *             raise ValueError("Unable to convert item to object")
11680  *         else:
11681  */
11682     __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
11683     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 494, __pyx_L5_except_error)
11684     __Pyx_GOTREF(__pyx_t_6);
11685     __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
11686     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11687     __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
11688     __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
11689     if (__pyx_t_8) {
11690       __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
11691       if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(1, 494, __pyx_L5_except_error)
11692       __Pyx_GOTREF(__pyx_t_9);
11693       __Pyx_GOTREF(__pyx_t_5);
11694       __Pyx_GOTREF(__pyx_t_1);
11695 
11696       /* "View.MemoryView":495
11697  *             result = struct.unpack(self.view.format, bytesitem)
11698  *         except struct.error:
11699  *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
11700  *         else:
11701  *             if len(self.view.format) == 1:
11702  */
11703       __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 495, __pyx_L5_except_error)
11704       __Pyx_GOTREF(__pyx_t_6);
11705       __Pyx_Raise(__pyx_t_6, 0, 0, 0);
11706       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11707       __PYX_ERR(1, 495, __pyx_L5_except_error)
11708     }
11709     goto __pyx_L5_except_error;
11710     __pyx_L5_except_error:;
11711 
11712     /* "View.MemoryView":492
11713  *
11714  *         bytesitem = itemp[:self.view.itemsize]
11715  *         try:             # <<<<<<<<<<<<<<
11716  *             result = struct.unpack(self.view.format, bytesitem)
11717  *         except struct.error:
11718  */
11719     __Pyx_XGIVEREF(__pyx_t_2);
11720     __Pyx_XGIVEREF(__pyx_t_3);
11721     __Pyx_XGIVEREF(__pyx_t_4);
11722     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
11723     goto __pyx_L1_error;
11724     __pyx_L6_except_return:;
11725     __Pyx_XGIVEREF(__pyx_t_2);
11726     __Pyx_XGIVEREF(__pyx_t_3);
11727     __Pyx_XGIVEREF(__pyx_t_4);
11728     __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
11729     goto __pyx_L0;
11730   }
11731 
11732   /* "View.MemoryView":485
11733  *         self.assign_item_from_object(itemp, value)
11734  *
11735  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
11736  *         """Only used if instantiated manually by the user, or if Cython doesn't
11737  *         know how to convert the type"""
11738  */
11739 
11740   /* function exit code */
11741   __pyx_L1_error:;
11742   __Pyx_XDECREF(__pyx_t_1);
11743   __Pyx_XDECREF(__pyx_t_5);
11744   __Pyx_XDECREF(__pyx_t_6);
11745   __Pyx_XDECREF(__pyx_t_7);
11746   __Pyx_XDECREF(__pyx_t_9);
11747   __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
11748   __pyx_r = 0;
11749   __pyx_L0:;
11750   __Pyx_XDECREF(__pyx_v_struct);
11751   __Pyx_XDECREF(__pyx_v_bytesitem);
11752   __Pyx_XDECREF(__pyx_v_result);
11753   __Pyx_XGIVEREF(__pyx_r);
11754   __Pyx_RefNannyFinishContext();
11755   return __pyx_r;
11756 }
11757 
11758 /* "View.MemoryView":501
11759  *             return result
11760  *
11761  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
11762  *         """Only used if instantiated manually by the user, or if Cython doesn't
11763  *         know how to convert the type"""
11764  */
11765 
__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj * __pyx_v_self,char * __pyx_v_itemp,PyObject * __pyx_v_value)11766 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
11767   PyObject *__pyx_v_struct = NULL;
11768   char __pyx_v_c;
11769   PyObject *__pyx_v_bytesvalue = 0;
11770   Py_ssize_t __pyx_v_i;
11771   PyObject *__pyx_r = NULL;
11772   __Pyx_RefNannyDeclarations
11773   PyObject *__pyx_t_1 = NULL;
11774   int __pyx_t_2;
11775   int __pyx_t_3;
11776   PyObject *__pyx_t_4 = NULL;
11777   PyObject *__pyx_t_5 = NULL;
11778   PyObject *__pyx_t_6 = NULL;
11779   int __pyx_t_7;
11780   PyObject *__pyx_t_8 = NULL;
11781   Py_ssize_t __pyx_t_9;
11782   PyObject *__pyx_t_10 = NULL;
11783   char *__pyx_t_11;
11784   char *__pyx_t_12;
11785   char *__pyx_t_13;
11786   char *__pyx_t_14;
11787   int __pyx_lineno = 0;
11788   const char *__pyx_filename = NULL;
11789   int __pyx_clineno = 0;
11790   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
11791 
11792   /* "View.MemoryView":504
11793  *         """Only used if instantiated manually by the user, or if Cython doesn't
11794  *         know how to convert the type"""
11795  *         import struct             # <<<<<<<<<<<<<<
11796  *         cdef char c
11797  *         cdef bytes bytesvalue
11798  */
11799   __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 504, __pyx_L1_error)
11800   __Pyx_GOTREF(__pyx_t_1);
11801   __pyx_v_struct = __pyx_t_1;
11802   __pyx_t_1 = 0;
11803 
11804   /* "View.MemoryView":509
11805  *         cdef Py_ssize_t i
11806  *
11807  *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
11808  *             bytesvalue = struct.pack(self.view.format, *value)
11809  *         else:
11810  */
11811   __pyx_t_2 = PyTuple_Check(__pyx_v_value);
11812   __pyx_t_3 = (__pyx_t_2 != 0);
11813   if (__pyx_t_3) {
11814 
11815     /* "View.MemoryView":510
11816  *
11817  *         if isinstance(value, tuple):
11818  *             bytesvalue = struct.pack(self.view.format, *value)             # <<<<<<<<<<<<<<
11819  *         else:
11820  *             bytesvalue = struct.pack(self.view.format, value)
11821  */
11822     __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 510, __pyx_L1_error)
11823     __Pyx_GOTREF(__pyx_t_1);
11824     __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
11825     __Pyx_GOTREF(__pyx_t_4);
11826     __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 510, __pyx_L1_error)
11827     __Pyx_GOTREF(__pyx_t_5);
11828     __Pyx_GIVEREF(__pyx_t_4);
11829     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
11830     __pyx_t_4 = 0;
11831     __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
11832     __Pyx_GOTREF(__pyx_t_4);
11833     __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 510, __pyx_L1_error)
11834     __Pyx_GOTREF(__pyx_t_6);
11835     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11836     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11837     __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
11838     __Pyx_GOTREF(__pyx_t_4);
11839     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11840     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11841     if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(1, 510, __pyx_L1_error)
11842     __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
11843     __pyx_t_4 = 0;
11844 
11845     /* "View.MemoryView":509
11846  *         cdef Py_ssize_t i
11847  *
11848  *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
11849  *             bytesvalue = struct.pack(self.view.format, *value)
11850  *         else:
11851  */
11852     goto __pyx_L3;
11853   }
11854 
11855   /* "View.MemoryView":512
11856  *             bytesvalue = struct.pack(self.view.format, *value)
11857  *         else:
11858  *             bytesvalue = struct.pack(self.view.format, value)             # <<<<<<<<<<<<<<
11859  *
11860  *         for i, c in enumerate(bytesvalue):
11861  */
11862   /*else*/ {
11863     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 512, __pyx_L1_error)
11864     __Pyx_GOTREF(__pyx_t_6);
11865     __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 512, __pyx_L1_error)
11866     __Pyx_GOTREF(__pyx_t_1);
11867     __pyx_t_5 = NULL;
11868     __pyx_t_7 = 0;
11869     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
11870       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
11871       if (likely(__pyx_t_5)) {
11872         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
11873         __Pyx_INCREF(__pyx_t_5);
11874         __Pyx_INCREF(function);
11875         __Pyx_DECREF_SET(__pyx_t_6, function);
11876         __pyx_t_7 = 1;
11877       }
11878     }
11879     #if CYTHON_FAST_PYCALL
11880     if (PyFunction_Check(__pyx_t_6)) {
11881       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
11882       __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
11883       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11884       __Pyx_GOTREF(__pyx_t_4);
11885       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11886     } else
11887     #endif
11888     #if CYTHON_FAST_PYCCALL
11889     if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
11890       PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
11891       __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
11892       __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11893       __Pyx_GOTREF(__pyx_t_4);
11894       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11895     } else
11896     #endif
11897     {
11898       __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 512, __pyx_L1_error)
11899       __Pyx_GOTREF(__pyx_t_8);
11900       if (__pyx_t_5) {
11901         __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
11902       }
11903       __Pyx_GIVEREF(__pyx_t_1);
11904       PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
11905       __Pyx_INCREF(__pyx_v_value);
11906       __Pyx_GIVEREF(__pyx_v_value);
11907       PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
11908       __pyx_t_1 = 0;
11909       __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
11910       __Pyx_GOTREF(__pyx_t_4);
11911       __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11912     }
11913     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11914     if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(1, 512, __pyx_L1_error)
11915     __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
11916     __pyx_t_4 = 0;
11917   }
11918   __pyx_L3:;
11919 
11920   /* "View.MemoryView":514
11921  *             bytesvalue = struct.pack(self.view.format, value)
11922  *
11923  *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
11924  *             itemp[i] = c
11925  *
11926  */
11927   __pyx_t_9 = 0;
11928   if (unlikely(__pyx_v_bytesvalue == Py_None)) {
11929     PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
11930     __PYX_ERR(1, 514, __pyx_L1_error)
11931   }
11932   __Pyx_INCREF(__pyx_v_bytesvalue);
11933   __pyx_t_10 = __pyx_v_bytesvalue;
11934   __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
11935   __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
11936   for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
11937     __pyx_t_11 = __pyx_t_14;
11938     __pyx_v_c = (__pyx_t_11[0]);
11939 
11940     /* "View.MemoryView":515
11941  *
11942  *         for i, c in enumerate(bytesvalue):
11943  *             itemp[i] = c             # <<<<<<<<<<<<<<
11944  *
11945  *     @cname('getbuffer')
11946  */
11947     __pyx_v_i = __pyx_t_9;
11948 
11949     /* "View.MemoryView":514
11950  *             bytesvalue = struct.pack(self.view.format, value)
11951  *
11952  *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
11953  *             itemp[i] = c
11954  *
11955  */
11956     __pyx_t_9 = (__pyx_t_9 + 1);
11957 
11958     /* "View.MemoryView":515
11959  *
11960  *         for i, c in enumerate(bytesvalue):
11961  *             itemp[i] = c             # <<<<<<<<<<<<<<
11962  *
11963  *     @cname('getbuffer')
11964  */
11965     (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
11966   }
11967   __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
11968 
11969   /* "View.MemoryView":501
11970  *             return result
11971  *
11972  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
11973  *         """Only used if instantiated manually by the user, or if Cython doesn't
11974  *         know how to convert the type"""
11975  */
11976 
11977   /* function exit code */
11978   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11979   goto __pyx_L0;
11980   __pyx_L1_error:;
11981   __Pyx_XDECREF(__pyx_t_1);
11982   __Pyx_XDECREF(__pyx_t_4);
11983   __Pyx_XDECREF(__pyx_t_5);
11984   __Pyx_XDECREF(__pyx_t_6);
11985   __Pyx_XDECREF(__pyx_t_8);
11986   __Pyx_XDECREF(__pyx_t_10);
11987   __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
11988   __pyx_r = 0;
11989   __pyx_L0:;
11990   __Pyx_XDECREF(__pyx_v_struct);
11991   __Pyx_XDECREF(__pyx_v_bytesvalue);
11992   __Pyx_XGIVEREF(__pyx_r);
11993   __Pyx_RefNannyFinishContext();
11994   return __pyx_r;
11995 }
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 /* Python wrapper */
12006 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)12007 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
12008   int __pyx_r;
12009   __Pyx_RefNannyDeclarations
12010   __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
12011   __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));
12012 
12013   /* function exit code */
12014   __Pyx_RefNannyFinishContext();
12015   return __pyx_r;
12016 }
12017 
__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)12018 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) {
12019   int __pyx_r;
12020   __Pyx_RefNannyDeclarations
12021   int __pyx_t_1;
12022   int __pyx_t_2;
12023   PyObject *__pyx_t_3 = NULL;
12024   Py_ssize_t *__pyx_t_4;
12025   char *__pyx_t_5;
12026   void *__pyx_t_6;
12027   int __pyx_t_7;
12028   Py_ssize_t __pyx_t_8;
12029   int __pyx_lineno = 0;
12030   const char *__pyx_filename = NULL;
12031   int __pyx_clineno = 0;
12032   if (__pyx_v_info == NULL) {
12033     PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
12034     return -1;
12035   }
12036   __Pyx_RefNannySetupContext("__getbuffer__", 0);
12037   __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
12038   __Pyx_GIVEREF(__pyx_v_info->obj);
12039 
12040   /* "View.MemoryView":519
12041  *     @cname('getbuffer')
12042  *     def __getbuffer__(self, Py_buffer *info, int flags):
12043  *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
12044  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
12045  *
12046  */
12047   __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
12048   if (__pyx_t_2) {
12049   } else {
12050     __pyx_t_1 = __pyx_t_2;
12051     goto __pyx_L4_bool_binop_done;
12052   }
12053   __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
12054   __pyx_t_1 = __pyx_t_2;
12055   __pyx_L4_bool_binop_done:;
12056   if (unlikely(__pyx_t_1)) {
12057 
12058     /* "View.MemoryView":520
12059  *     def __getbuffer__(self, Py_buffer *info, int flags):
12060  *         if flags & PyBUF_WRITABLE and self.view.readonly:
12061  *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
12062  *
12063  *         if flags & PyBUF_ND:
12064  */
12065     __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 520, __pyx_L1_error)
12066     __Pyx_GOTREF(__pyx_t_3);
12067     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
12068     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12069     __PYX_ERR(1, 520, __pyx_L1_error)
12070 
12071     /* "View.MemoryView":519
12072  *     @cname('getbuffer')
12073  *     def __getbuffer__(self, Py_buffer *info, int flags):
12074  *         if flags & PyBUF_WRITABLE and self.view.readonly:             # <<<<<<<<<<<<<<
12075  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
12076  *
12077  */
12078   }
12079 
12080   /* "View.MemoryView":522
12081  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
12082  *
12083  *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
12084  *             info.shape = self.view.shape
12085  *         else:
12086  */
12087   __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
12088   if (__pyx_t_1) {
12089 
12090     /* "View.MemoryView":523
12091  *
12092  *         if flags & PyBUF_ND:
12093  *             info.shape = self.view.shape             # <<<<<<<<<<<<<<
12094  *         else:
12095  *             info.shape = NULL
12096  */
12097     __pyx_t_4 = __pyx_v_self->view.shape;
12098     __pyx_v_info->shape = __pyx_t_4;
12099 
12100     /* "View.MemoryView":522
12101  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
12102  *
12103  *         if flags & PyBUF_ND:             # <<<<<<<<<<<<<<
12104  *             info.shape = self.view.shape
12105  *         else:
12106  */
12107     goto __pyx_L6;
12108   }
12109 
12110   /* "View.MemoryView":525
12111  *             info.shape = self.view.shape
12112  *         else:
12113  *             info.shape = NULL             # <<<<<<<<<<<<<<
12114  *
12115  *         if flags & PyBUF_STRIDES:
12116  */
12117   /*else*/ {
12118     __pyx_v_info->shape = NULL;
12119   }
12120   __pyx_L6:;
12121 
12122   /* "View.MemoryView":527
12123  *             info.shape = NULL
12124  *
12125  *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
12126  *             info.strides = self.view.strides
12127  *         else:
12128  */
12129   __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
12130   if (__pyx_t_1) {
12131 
12132     /* "View.MemoryView":528
12133  *
12134  *         if flags & PyBUF_STRIDES:
12135  *             info.strides = self.view.strides             # <<<<<<<<<<<<<<
12136  *         else:
12137  *             info.strides = NULL
12138  */
12139     __pyx_t_4 = __pyx_v_self->view.strides;
12140     __pyx_v_info->strides = __pyx_t_4;
12141 
12142     /* "View.MemoryView":527
12143  *             info.shape = NULL
12144  *
12145  *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
12146  *             info.strides = self.view.strides
12147  *         else:
12148  */
12149     goto __pyx_L7;
12150   }
12151 
12152   /* "View.MemoryView":530
12153  *             info.strides = self.view.strides
12154  *         else:
12155  *             info.strides = NULL             # <<<<<<<<<<<<<<
12156  *
12157  *         if flags & PyBUF_INDIRECT:
12158  */
12159   /*else*/ {
12160     __pyx_v_info->strides = NULL;
12161   }
12162   __pyx_L7:;
12163 
12164   /* "View.MemoryView":532
12165  *             info.strides = NULL
12166  *
12167  *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
12168  *             info.suboffsets = self.view.suboffsets
12169  *         else:
12170  */
12171   __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
12172   if (__pyx_t_1) {
12173 
12174     /* "View.MemoryView":533
12175  *
12176  *         if flags & PyBUF_INDIRECT:
12177  *             info.suboffsets = self.view.suboffsets             # <<<<<<<<<<<<<<
12178  *         else:
12179  *             info.suboffsets = NULL
12180  */
12181     __pyx_t_4 = __pyx_v_self->view.suboffsets;
12182     __pyx_v_info->suboffsets = __pyx_t_4;
12183 
12184     /* "View.MemoryView":532
12185  *             info.strides = NULL
12186  *
12187  *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
12188  *             info.suboffsets = self.view.suboffsets
12189  *         else:
12190  */
12191     goto __pyx_L8;
12192   }
12193 
12194   /* "View.MemoryView":535
12195  *             info.suboffsets = self.view.suboffsets
12196  *         else:
12197  *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
12198  *
12199  *         if flags & PyBUF_FORMAT:
12200  */
12201   /*else*/ {
12202     __pyx_v_info->suboffsets = NULL;
12203   }
12204   __pyx_L8:;
12205 
12206   /* "View.MemoryView":537
12207  *             info.suboffsets = NULL
12208  *
12209  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
12210  *             info.format = self.view.format
12211  *         else:
12212  */
12213   __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
12214   if (__pyx_t_1) {
12215 
12216     /* "View.MemoryView":538
12217  *
12218  *         if flags & PyBUF_FORMAT:
12219  *             info.format = self.view.format             # <<<<<<<<<<<<<<
12220  *         else:
12221  *             info.format = NULL
12222  */
12223     __pyx_t_5 = __pyx_v_self->view.format;
12224     __pyx_v_info->format = __pyx_t_5;
12225 
12226     /* "View.MemoryView":537
12227  *             info.suboffsets = NULL
12228  *
12229  *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
12230  *             info.format = self.view.format
12231  *         else:
12232  */
12233     goto __pyx_L9;
12234   }
12235 
12236   /* "View.MemoryView":540
12237  *             info.format = self.view.format
12238  *         else:
12239  *             info.format = NULL             # <<<<<<<<<<<<<<
12240  *
12241  *         info.buf = self.view.buf
12242  */
12243   /*else*/ {
12244     __pyx_v_info->format = NULL;
12245   }
12246   __pyx_L9:;
12247 
12248   /* "View.MemoryView":542
12249  *             info.format = NULL
12250  *
12251  *         info.buf = self.view.buf             # <<<<<<<<<<<<<<
12252  *         info.ndim = self.view.ndim
12253  *         info.itemsize = self.view.itemsize
12254  */
12255   __pyx_t_6 = __pyx_v_self->view.buf;
12256   __pyx_v_info->buf = __pyx_t_6;
12257 
12258   /* "View.MemoryView":543
12259  *
12260  *         info.buf = self.view.buf
12261  *         info.ndim = self.view.ndim             # <<<<<<<<<<<<<<
12262  *         info.itemsize = self.view.itemsize
12263  *         info.len = self.view.len
12264  */
12265   __pyx_t_7 = __pyx_v_self->view.ndim;
12266   __pyx_v_info->ndim = __pyx_t_7;
12267 
12268   /* "View.MemoryView":544
12269  *         info.buf = self.view.buf
12270  *         info.ndim = self.view.ndim
12271  *         info.itemsize = self.view.itemsize             # <<<<<<<<<<<<<<
12272  *         info.len = self.view.len
12273  *         info.readonly = self.view.readonly
12274  */
12275   __pyx_t_8 = __pyx_v_self->view.itemsize;
12276   __pyx_v_info->itemsize = __pyx_t_8;
12277 
12278   /* "View.MemoryView":545
12279  *         info.ndim = self.view.ndim
12280  *         info.itemsize = self.view.itemsize
12281  *         info.len = self.view.len             # <<<<<<<<<<<<<<
12282  *         info.readonly = self.view.readonly
12283  *         info.obj = self
12284  */
12285   __pyx_t_8 = __pyx_v_self->view.len;
12286   __pyx_v_info->len = __pyx_t_8;
12287 
12288   /* "View.MemoryView":546
12289  *         info.itemsize = self.view.itemsize
12290  *         info.len = self.view.len
12291  *         info.readonly = self.view.readonly             # <<<<<<<<<<<<<<
12292  *         info.obj = self
12293  *
12294  */
12295   __pyx_t_1 = __pyx_v_self->view.readonly;
12296   __pyx_v_info->readonly = __pyx_t_1;
12297 
12298   /* "View.MemoryView":547
12299  *         info.len = self.view.len
12300  *         info.readonly = self.view.readonly
12301  *         info.obj = self             # <<<<<<<<<<<<<<
12302  *
12303  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
12304  */
12305   __Pyx_INCREF(((PyObject *)__pyx_v_self));
12306   __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
12307   __Pyx_GOTREF(__pyx_v_info->obj);
12308   __Pyx_DECREF(__pyx_v_info->obj);
12309   __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
12310 
12311   /* "View.MemoryView":518
12312  *
12313  *     @cname('getbuffer')
12314  *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
12315  *         if flags & PyBUF_WRITABLE and self.view.readonly:
12316  *             raise ValueError("Cannot create writable memory view from read-only memoryview")
12317  */
12318 
12319   /* function exit code */
12320   __pyx_r = 0;
12321   goto __pyx_L0;
12322   __pyx_L1_error:;
12323   __Pyx_XDECREF(__pyx_t_3);
12324   __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12325   __pyx_r = -1;
12326   if (__pyx_v_info->obj != NULL) {
12327     __Pyx_GOTREF(__pyx_v_info->obj);
12328     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
12329   }
12330   goto __pyx_L2;
12331   __pyx_L0:;
12332   if (__pyx_v_info->obj == Py_None) {
12333     __Pyx_GOTREF(__pyx_v_info->obj);
12334     __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
12335   }
12336   __pyx_L2:;
12337   __Pyx_RefNannyFinishContext();
12338   return __pyx_r;
12339 }
12340 
12341 /* "View.MemoryView":553
12342  *
12343  *     @property
12344  *     def T(self):             # <<<<<<<<<<<<<<
12345  *         cdef _memoryviewslice result = memoryview_copy(self)
12346  *         transpose_memslice(&result.from_slice)
12347  */
12348 
12349 /* Python wrapper */
12350 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)12351 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
12352   PyObject *__pyx_r = 0;
12353   __Pyx_RefNannyDeclarations
12354   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12355   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12356 
12357   /* function exit code */
12358   __Pyx_RefNannyFinishContext();
12359   return __pyx_r;
12360 }
12361 
__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj * __pyx_v_self)12362 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12363   struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
12364   PyObject *__pyx_r = NULL;
12365   __Pyx_RefNannyDeclarations
12366   PyObject *__pyx_t_1 = NULL;
12367   int __pyx_t_2;
12368   int __pyx_lineno = 0;
12369   const char *__pyx_filename = NULL;
12370   int __pyx_clineno = 0;
12371   __Pyx_RefNannySetupContext("__get__", 0);
12372 
12373   /* "View.MemoryView":554
12374  *     @property
12375  *     def T(self):
12376  *         cdef _memoryviewslice result = memoryview_copy(self)             # <<<<<<<<<<<<<<
12377  *         transpose_memslice(&result.from_slice)
12378  *         return result
12379  */
12380   __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 554, __pyx_L1_error)
12381   __Pyx_GOTREF(__pyx_t_1);
12382   if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(1, 554, __pyx_L1_error)
12383   __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
12384   __pyx_t_1 = 0;
12385 
12386   /* "View.MemoryView":555
12387  *     def T(self):
12388  *         cdef _memoryviewslice result = memoryview_copy(self)
12389  *         transpose_memslice(&result.from_slice)             # <<<<<<<<<<<<<<
12390  *         return result
12391  *
12392  */
12393   __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 555, __pyx_L1_error)
12394 
12395   /* "View.MemoryView":556
12396  *         cdef _memoryviewslice result = memoryview_copy(self)
12397  *         transpose_memslice(&result.from_slice)
12398  *         return result             # <<<<<<<<<<<<<<
12399  *
12400  *     @property
12401  */
12402   __Pyx_XDECREF(__pyx_r);
12403   __Pyx_INCREF(((PyObject *)__pyx_v_result));
12404   __pyx_r = ((PyObject *)__pyx_v_result);
12405   goto __pyx_L0;
12406 
12407   /* "View.MemoryView":553
12408  *
12409  *     @property
12410  *     def T(self):             # <<<<<<<<<<<<<<
12411  *         cdef _memoryviewslice result = memoryview_copy(self)
12412  *         transpose_memslice(&result.from_slice)
12413  */
12414 
12415   /* function exit code */
12416   __pyx_L1_error:;
12417   __Pyx_XDECREF(__pyx_t_1);
12418   __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12419   __pyx_r = NULL;
12420   __pyx_L0:;
12421   __Pyx_XDECREF((PyObject *)__pyx_v_result);
12422   __Pyx_XGIVEREF(__pyx_r);
12423   __Pyx_RefNannyFinishContext();
12424   return __pyx_r;
12425 }
12426 
12427 /* "View.MemoryView":559
12428  *
12429  *     @property
12430  *     def base(self):             # <<<<<<<<<<<<<<
12431  *         return self.obj
12432  *
12433  */
12434 
12435 /* Python wrapper */
12436 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)12437 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
12438   PyObject *__pyx_r = 0;
12439   __Pyx_RefNannyDeclarations
12440   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12441   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12442 
12443   /* function exit code */
12444   __Pyx_RefNannyFinishContext();
12445   return __pyx_r;
12446 }
12447 
__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj * __pyx_v_self)12448 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12449   PyObject *__pyx_r = NULL;
12450   __Pyx_RefNannyDeclarations
12451   __Pyx_RefNannySetupContext("__get__", 0);
12452 
12453   /* "View.MemoryView":560
12454  *     @property
12455  *     def base(self):
12456  *         return self.obj             # <<<<<<<<<<<<<<
12457  *
12458  *     @property
12459  */
12460   __Pyx_XDECREF(__pyx_r);
12461   __Pyx_INCREF(__pyx_v_self->obj);
12462   __pyx_r = __pyx_v_self->obj;
12463   goto __pyx_L0;
12464 
12465   /* "View.MemoryView":559
12466  *
12467  *     @property
12468  *     def base(self):             # <<<<<<<<<<<<<<
12469  *         return self.obj
12470  *
12471  */
12472 
12473   /* function exit code */
12474   __pyx_L0:;
12475   __Pyx_XGIVEREF(__pyx_r);
12476   __Pyx_RefNannyFinishContext();
12477   return __pyx_r;
12478 }
12479 
12480 /* "View.MemoryView":563
12481  *
12482  *     @property
12483  *     def shape(self):             # <<<<<<<<<<<<<<
12484  *         return tuple([length for length in self.view.shape[:self.view.ndim]])
12485  *
12486  */
12487 
12488 /* Python wrapper */
12489 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)12490 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
12491   PyObject *__pyx_r = 0;
12492   __Pyx_RefNannyDeclarations
12493   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12494   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12495 
12496   /* function exit code */
12497   __Pyx_RefNannyFinishContext();
12498   return __pyx_r;
12499 }
12500 
__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj * __pyx_v_self)12501 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12502   Py_ssize_t __pyx_v_length;
12503   PyObject *__pyx_r = NULL;
12504   __Pyx_RefNannyDeclarations
12505   PyObject *__pyx_t_1 = NULL;
12506   Py_ssize_t *__pyx_t_2;
12507   Py_ssize_t *__pyx_t_3;
12508   Py_ssize_t *__pyx_t_4;
12509   PyObject *__pyx_t_5 = NULL;
12510   int __pyx_lineno = 0;
12511   const char *__pyx_filename = NULL;
12512   int __pyx_clineno = 0;
12513   __Pyx_RefNannySetupContext("__get__", 0);
12514 
12515   /* "View.MemoryView":564
12516  *     @property
12517  *     def shape(self):
12518  *         return tuple([length for length in self.view.shape[:self.view.ndim]])             # <<<<<<<<<<<<<<
12519  *
12520  *     @property
12521  */
12522   __Pyx_XDECREF(__pyx_r);
12523   __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 564, __pyx_L1_error)
12524   __Pyx_GOTREF(__pyx_t_1);
12525   __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
12526   for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
12527     __pyx_t_2 = __pyx_t_4;
12528     __pyx_v_length = (__pyx_t_2[0]);
12529     __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 564, __pyx_L1_error)
12530     __Pyx_GOTREF(__pyx_t_5);
12531     if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 564, __pyx_L1_error)
12532     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12533   }
12534   __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 564, __pyx_L1_error)
12535   __Pyx_GOTREF(__pyx_t_5);
12536   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12537   __pyx_r = __pyx_t_5;
12538   __pyx_t_5 = 0;
12539   goto __pyx_L0;
12540 
12541   /* "View.MemoryView":563
12542  *
12543  *     @property
12544  *     def shape(self):             # <<<<<<<<<<<<<<
12545  *         return tuple([length for length in self.view.shape[:self.view.ndim]])
12546  *
12547  */
12548 
12549   /* function exit code */
12550   __pyx_L1_error:;
12551   __Pyx_XDECREF(__pyx_t_1);
12552   __Pyx_XDECREF(__pyx_t_5);
12553   __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12554   __pyx_r = NULL;
12555   __pyx_L0:;
12556   __Pyx_XGIVEREF(__pyx_r);
12557   __Pyx_RefNannyFinishContext();
12558   return __pyx_r;
12559 }
12560 
12561 /* "View.MemoryView":567
12562  *
12563  *     @property
12564  *     def strides(self):             # <<<<<<<<<<<<<<
12565  *         if self.view.strides == NULL:
12566  *
12567  */
12568 
12569 /* Python wrapper */
12570 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)12571 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
12572   PyObject *__pyx_r = 0;
12573   __Pyx_RefNannyDeclarations
12574   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12575   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12576 
12577   /* function exit code */
12578   __Pyx_RefNannyFinishContext();
12579   return __pyx_r;
12580 }
12581 
__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj * __pyx_v_self)12582 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12583   Py_ssize_t __pyx_v_stride;
12584   PyObject *__pyx_r = NULL;
12585   __Pyx_RefNannyDeclarations
12586   int __pyx_t_1;
12587   PyObject *__pyx_t_2 = NULL;
12588   Py_ssize_t *__pyx_t_3;
12589   Py_ssize_t *__pyx_t_4;
12590   Py_ssize_t *__pyx_t_5;
12591   PyObject *__pyx_t_6 = NULL;
12592   int __pyx_lineno = 0;
12593   const char *__pyx_filename = NULL;
12594   int __pyx_clineno = 0;
12595   __Pyx_RefNannySetupContext("__get__", 0);
12596 
12597   /* "View.MemoryView":568
12598  *     @property
12599  *     def strides(self):
12600  *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
12601  *
12602  *             raise ValueError("Buffer view does not expose strides")
12603  */
12604   __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
12605   if (unlikely(__pyx_t_1)) {
12606 
12607     /* "View.MemoryView":570
12608  *         if self.view.strides == NULL:
12609  *
12610  *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
12611  *
12612  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
12613  */
12614     __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 570, __pyx_L1_error)
12615     __Pyx_GOTREF(__pyx_t_2);
12616     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
12617     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12618     __PYX_ERR(1, 570, __pyx_L1_error)
12619 
12620     /* "View.MemoryView":568
12621  *     @property
12622  *     def strides(self):
12623  *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
12624  *
12625  *             raise ValueError("Buffer view does not expose strides")
12626  */
12627   }
12628 
12629   /* "View.MemoryView":572
12630  *             raise ValueError("Buffer view does not expose strides")
12631  *
12632  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])             # <<<<<<<<<<<<<<
12633  *
12634  *     @property
12635  */
12636   __Pyx_XDECREF(__pyx_r);
12637   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 572, __pyx_L1_error)
12638   __Pyx_GOTREF(__pyx_t_2);
12639   __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
12640   for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
12641     __pyx_t_3 = __pyx_t_5;
12642     __pyx_v_stride = (__pyx_t_3[0]);
12643     __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 572, __pyx_L1_error)
12644     __Pyx_GOTREF(__pyx_t_6);
12645     if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 572, __pyx_L1_error)
12646     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12647   }
12648   __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 572, __pyx_L1_error)
12649   __Pyx_GOTREF(__pyx_t_6);
12650   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12651   __pyx_r = __pyx_t_6;
12652   __pyx_t_6 = 0;
12653   goto __pyx_L0;
12654 
12655   /* "View.MemoryView":567
12656  *
12657  *     @property
12658  *     def strides(self):             # <<<<<<<<<<<<<<
12659  *         if self.view.strides == NULL:
12660  *
12661  */
12662 
12663   /* function exit code */
12664   __pyx_L1_error:;
12665   __Pyx_XDECREF(__pyx_t_2);
12666   __Pyx_XDECREF(__pyx_t_6);
12667   __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12668   __pyx_r = NULL;
12669   __pyx_L0:;
12670   __Pyx_XGIVEREF(__pyx_r);
12671   __Pyx_RefNannyFinishContext();
12672   return __pyx_r;
12673 }
12674 
12675 /* "View.MemoryView":575
12676  *
12677  *     @property
12678  *     def suboffsets(self):             # <<<<<<<<<<<<<<
12679  *         if self.view.suboffsets == NULL:
12680  *             return (-1,) * self.view.ndim
12681  */
12682 
12683 /* Python wrapper */
12684 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)12685 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
12686   PyObject *__pyx_r = 0;
12687   __Pyx_RefNannyDeclarations
12688   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12689   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12690 
12691   /* function exit code */
12692   __Pyx_RefNannyFinishContext();
12693   return __pyx_r;
12694 }
12695 
__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj * __pyx_v_self)12696 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12697   Py_ssize_t __pyx_v_suboffset;
12698   PyObject *__pyx_r = NULL;
12699   __Pyx_RefNannyDeclarations
12700   int __pyx_t_1;
12701   PyObject *__pyx_t_2 = NULL;
12702   PyObject *__pyx_t_3 = NULL;
12703   Py_ssize_t *__pyx_t_4;
12704   Py_ssize_t *__pyx_t_5;
12705   Py_ssize_t *__pyx_t_6;
12706   int __pyx_lineno = 0;
12707   const char *__pyx_filename = NULL;
12708   int __pyx_clineno = 0;
12709   __Pyx_RefNannySetupContext("__get__", 0);
12710 
12711   /* "View.MemoryView":576
12712  *     @property
12713  *     def suboffsets(self):
12714  *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
12715  *             return (-1,) * self.view.ndim
12716  *
12717  */
12718   __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
12719   if (__pyx_t_1) {
12720 
12721     /* "View.MemoryView":577
12722  *     def suboffsets(self):
12723  *         if self.view.suboffsets == NULL:
12724  *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
12725  *
12726  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
12727  */
12728     __Pyx_XDECREF(__pyx_r);
12729     __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 577, __pyx_L1_error)
12730     __Pyx_GOTREF(__pyx_t_2);
12731     __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__14, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 577, __pyx_L1_error)
12732     __Pyx_GOTREF(__pyx_t_3);
12733     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12734     __pyx_r = __pyx_t_3;
12735     __pyx_t_3 = 0;
12736     goto __pyx_L0;
12737 
12738     /* "View.MemoryView":576
12739  *     @property
12740  *     def suboffsets(self):
12741  *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
12742  *             return (-1,) * self.view.ndim
12743  *
12744  */
12745   }
12746 
12747   /* "View.MemoryView":579
12748  *             return (-1,) * self.view.ndim
12749  *
12750  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])             # <<<<<<<<<<<<<<
12751  *
12752  *     @property
12753  */
12754   __Pyx_XDECREF(__pyx_r);
12755   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 579, __pyx_L1_error)
12756   __Pyx_GOTREF(__pyx_t_3);
12757   __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
12758   for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
12759     __pyx_t_4 = __pyx_t_6;
12760     __pyx_v_suboffset = (__pyx_t_4[0]);
12761     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 579, __pyx_L1_error)
12762     __Pyx_GOTREF(__pyx_t_2);
12763     if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(1, 579, __pyx_L1_error)
12764     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12765   }
12766   __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 579, __pyx_L1_error)
12767   __Pyx_GOTREF(__pyx_t_2);
12768   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12769   __pyx_r = __pyx_t_2;
12770   __pyx_t_2 = 0;
12771   goto __pyx_L0;
12772 
12773   /* "View.MemoryView":575
12774  *
12775  *     @property
12776  *     def suboffsets(self):             # <<<<<<<<<<<<<<
12777  *         if self.view.suboffsets == NULL:
12778  *             return (-1,) * self.view.ndim
12779  */
12780 
12781   /* function exit code */
12782   __pyx_L1_error:;
12783   __Pyx_XDECREF(__pyx_t_2);
12784   __Pyx_XDECREF(__pyx_t_3);
12785   __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12786   __pyx_r = NULL;
12787   __pyx_L0:;
12788   __Pyx_XGIVEREF(__pyx_r);
12789   __Pyx_RefNannyFinishContext();
12790   return __pyx_r;
12791 }
12792 
12793 /* "View.MemoryView":582
12794  *
12795  *     @property
12796  *     def ndim(self):             # <<<<<<<<<<<<<<
12797  *         return self.view.ndim
12798  *
12799  */
12800 
12801 /* Python wrapper */
12802 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)12803 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
12804   PyObject *__pyx_r = 0;
12805   __Pyx_RefNannyDeclarations
12806   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12807   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12808 
12809   /* function exit code */
12810   __Pyx_RefNannyFinishContext();
12811   return __pyx_r;
12812 }
12813 
__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj * __pyx_v_self)12814 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12815   PyObject *__pyx_r = NULL;
12816   __Pyx_RefNannyDeclarations
12817   PyObject *__pyx_t_1 = NULL;
12818   int __pyx_lineno = 0;
12819   const char *__pyx_filename = NULL;
12820   int __pyx_clineno = 0;
12821   __Pyx_RefNannySetupContext("__get__", 0);
12822 
12823   /* "View.MemoryView":583
12824  *     @property
12825  *     def ndim(self):
12826  *         return self.view.ndim             # <<<<<<<<<<<<<<
12827  *
12828  *     @property
12829  */
12830   __Pyx_XDECREF(__pyx_r);
12831   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 583, __pyx_L1_error)
12832   __Pyx_GOTREF(__pyx_t_1);
12833   __pyx_r = __pyx_t_1;
12834   __pyx_t_1 = 0;
12835   goto __pyx_L0;
12836 
12837   /* "View.MemoryView":582
12838  *
12839  *     @property
12840  *     def ndim(self):             # <<<<<<<<<<<<<<
12841  *         return self.view.ndim
12842  *
12843  */
12844 
12845   /* function exit code */
12846   __pyx_L1_error:;
12847   __Pyx_XDECREF(__pyx_t_1);
12848   __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12849   __pyx_r = NULL;
12850   __pyx_L0:;
12851   __Pyx_XGIVEREF(__pyx_r);
12852   __Pyx_RefNannyFinishContext();
12853   return __pyx_r;
12854 }
12855 
12856 /* "View.MemoryView":586
12857  *
12858  *     @property
12859  *     def itemsize(self):             # <<<<<<<<<<<<<<
12860  *         return self.view.itemsize
12861  *
12862  */
12863 
12864 /* Python wrapper */
12865 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)12866 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
12867   PyObject *__pyx_r = 0;
12868   __Pyx_RefNannyDeclarations
12869   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12870   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12871 
12872   /* function exit code */
12873   __Pyx_RefNannyFinishContext();
12874   return __pyx_r;
12875 }
12876 
__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj * __pyx_v_self)12877 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12878   PyObject *__pyx_r = NULL;
12879   __Pyx_RefNannyDeclarations
12880   PyObject *__pyx_t_1 = NULL;
12881   int __pyx_lineno = 0;
12882   const char *__pyx_filename = NULL;
12883   int __pyx_clineno = 0;
12884   __Pyx_RefNannySetupContext("__get__", 0);
12885 
12886   /* "View.MemoryView":587
12887  *     @property
12888  *     def itemsize(self):
12889  *         return self.view.itemsize             # <<<<<<<<<<<<<<
12890  *
12891  *     @property
12892  */
12893   __Pyx_XDECREF(__pyx_r);
12894   __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 587, __pyx_L1_error)
12895   __Pyx_GOTREF(__pyx_t_1);
12896   __pyx_r = __pyx_t_1;
12897   __pyx_t_1 = 0;
12898   goto __pyx_L0;
12899 
12900   /* "View.MemoryView":586
12901  *
12902  *     @property
12903  *     def itemsize(self):             # <<<<<<<<<<<<<<
12904  *         return self.view.itemsize
12905  *
12906  */
12907 
12908   /* function exit code */
12909   __pyx_L1_error:;
12910   __Pyx_XDECREF(__pyx_t_1);
12911   __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12912   __pyx_r = NULL;
12913   __pyx_L0:;
12914   __Pyx_XGIVEREF(__pyx_r);
12915   __Pyx_RefNannyFinishContext();
12916   return __pyx_r;
12917 }
12918 
12919 /* "View.MemoryView":590
12920  *
12921  *     @property
12922  *     def nbytes(self):             # <<<<<<<<<<<<<<
12923  *         return self.size * self.view.itemsize
12924  *
12925  */
12926 
12927 /* Python wrapper */
12928 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)12929 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
12930   PyObject *__pyx_r = 0;
12931   __Pyx_RefNannyDeclarations
12932   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
12933   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12934 
12935   /* function exit code */
12936   __Pyx_RefNannyFinishContext();
12937   return __pyx_r;
12938 }
12939 
__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj * __pyx_v_self)12940 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
12941   PyObject *__pyx_r = NULL;
12942   __Pyx_RefNannyDeclarations
12943   PyObject *__pyx_t_1 = NULL;
12944   PyObject *__pyx_t_2 = NULL;
12945   PyObject *__pyx_t_3 = NULL;
12946   int __pyx_lineno = 0;
12947   const char *__pyx_filename = NULL;
12948   int __pyx_clineno = 0;
12949   __Pyx_RefNannySetupContext("__get__", 0);
12950 
12951   /* "View.MemoryView":591
12952  *     @property
12953  *     def nbytes(self):
12954  *         return self.size * self.view.itemsize             # <<<<<<<<<<<<<<
12955  *
12956  *     @property
12957  */
12958   __Pyx_XDECREF(__pyx_r);
12959   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 591, __pyx_L1_error)
12960   __Pyx_GOTREF(__pyx_t_1);
12961   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 591, __pyx_L1_error)
12962   __Pyx_GOTREF(__pyx_t_2);
12963   __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 591, __pyx_L1_error)
12964   __Pyx_GOTREF(__pyx_t_3);
12965   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12966   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12967   __pyx_r = __pyx_t_3;
12968   __pyx_t_3 = 0;
12969   goto __pyx_L0;
12970 
12971   /* "View.MemoryView":590
12972  *
12973  *     @property
12974  *     def nbytes(self):             # <<<<<<<<<<<<<<
12975  *         return self.size * self.view.itemsize
12976  *
12977  */
12978 
12979   /* function exit code */
12980   __pyx_L1_error:;
12981   __Pyx_XDECREF(__pyx_t_1);
12982   __Pyx_XDECREF(__pyx_t_2);
12983   __Pyx_XDECREF(__pyx_t_3);
12984   __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12985   __pyx_r = NULL;
12986   __pyx_L0:;
12987   __Pyx_XGIVEREF(__pyx_r);
12988   __Pyx_RefNannyFinishContext();
12989   return __pyx_r;
12990 }
12991 
12992 /* "View.MemoryView":594
12993  *
12994  *     @property
12995  *     def size(self):             # <<<<<<<<<<<<<<
12996  *         if self._size is None:
12997  *             result = 1
12998  */
12999 
13000 /* Python wrapper */
13001 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)13002 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
13003   PyObject *__pyx_r = 0;
13004   __Pyx_RefNannyDeclarations
13005   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13006   __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
13007 
13008   /* function exit code */
13009   __Pyx_RefNannyFinishContext();
13010   return __pyx_r;
13011 }
13012 
__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj * __pyx_v_self)13013 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
13014   PyObject *__pyx_v_result = NULL;
13015   PyObject *__pyx_v_length = NULL;
13016   PyObject *__pyx_r = NULL;
13017   __Pyx_RefNannyDeclarations
13018   int __pyx_t_1;
13019   int __pyx_t_2;
13020   Py_ssize_t *__pyx_t_3;
13021   Py_ssize_t *__pyx_t_4;
13022   Py_ssize_t *__pyx_t_5;
13023   PyObject *__pyx_t_6 = NULL;
13024   int __pyx_lineno = 0;
13025   const char *__pyx_filename = NULL;
13026   int __pyx_clineno = 0;
13027   __Pyx_RefNannySetupContext("__get__", 0);
13028 
13029   /* "View.MemoryView":595
13030  *     @property
13031  *     def size(self):
13032  *         if self._size is None:             # <<<<<<<<<<<<<<
13033  *             result = 1
13034  *
13035  */
13036   __pyx_t_1 = (__pyx_v_self->_size == Py_None);
13037   __pyx_t_2 = (__pyx_t_1 != 0);
13038   if (__pyx_t_2) {
13039 
13040     /* "View.MemoryView":596
13041  *     def size(self):
13042  *         if self._size is None:
13043  *             result = 1             # <<<<<<<<<<<<<<
13044  *
13045  *             for length in self.view.shape[:self.view.ndim]:
13046  */
13047     __Pyx_INCREF(__pyx_int_1);
13048     __pyx_v_result = __pyx_int_1;
13049 
13050     /* "View.MemoryView":598
13051  *             result = 1
13052  *
13053  *             for length in self.view.shape[:self.view.ndim]:             # <<<<<<<<<<<<<<
13054  *                 result *= length
13055  *
13056  */
13057     __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
13058     for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
13059       __pyx_t_3 = __pyx_t_5;
13060       __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 598, __pyx_L1_error)
13061       __Pyx_GOTREF(__pyx_t_6);
13062       __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
13063       __pyx_t_6 = 0;
13064 
13065       /* "View.MemoryView":599
13066  *
13067  *             for length in self.view.shape[:self.view.ndim]:
13068  *                 result *= length             # <<<<<<<<<<<<<<
13069  *
13070  *             self._size = result
13071  */
13072       __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 599, __pyx_L1_error)
13073       __Pyx_GOTREF(__pyx_t_6);
13074       __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
13075       __pyx_t_6 = 0;
13076     }
13077 
13078     /* "View.MemoryView":601
13079  *                 result *= length
13080  *
13081  *             self._size = result             # <<<<<<<<<<<<<<
13082  *
13083  *         return self._size
13084  */
13085     __Pyx_INCREF(__pyx_v_result);
13086     __Pyx_GIVEREF(__pyx_v_result);
13087     __Pyx_GOTREF(__pyx_v_self->_size);
13088     __Pyx_DECREF(__pyx_v_self->_size);
13089     __pyx_v_self->_size = __pyx_v_result;
13090 
13091     /* "View.MemoryView":595
13092  *     @property
13093  *     def size(self):
13094  *         if self._size is None:             # <<<<<<<<<<<<<<
13095  *             result = 1
13096  *
13097  */
13098   }
13099 
13100   /* "View.MemoryView":603
13101  *             self._size = result
13102  *
13103  *         return self._size             # <<<<<<<<<<<<<<
13104  *
13105  *     def __len__(self):
13106  */
13107   __Pyx_XDECREF(__pyx_r);
13108   __Pyx_INCREF(__pyx_v_self->_size);
13109   __pyx_r = __pyx_v_self->_size;
13110   goto __pyx_L0;
13111 
13112   /* "View.MemoryView":594
13113  *
13114  *     @property
13115  *     def size(self):             # <<<<<<<<<<<<<<
13116  *         if self._size is None:
13117  *             result = 1
13118  */
13119 
13120   /* function exit code */
13121   __pyx_L1_error:;
13122   __Pyx_XDECREF(__pyx_t_6);
13123   __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13124   __pyx_r = NULL;
13125   __pyx_L0:;
13126   __Pyx_XDECREF(__pyx_v_result);
13127   __Pyx_XDECREF(__pyx_v_length);
13128   __Pyx_XGIVEREF(__pyx_r);
13129   __Pyx_RefNannyFinishContext();
13130   return __pyx_r;
13131 }
13132 
13133 /* "View.MemoryView":605
13134  *         return self._size
13135  *
13136  *     def __len__(self):             # <<<<<<<<<<<<<<
13137  *         if self.view.ndim >= 1:
13138  *             return self.view.shape[0]
13139  */
13140 
13141 /* Python wrapper */
13142 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___len__(PyObject * __pyx_v_self)13143 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
13144   Py_ssize_t __pyx_r;
13145   __Pyx_RefNannyDeclarations
13146   __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
13147   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));
13148 
13149   /* function exit code */
13150   __Pyx_RefNannyFinishContext();
13151   return __pyx_r;
13152 }
13153 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj * __pyx_v_self)13154 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
13155   Py_ssize_t __pyx_r;
13156   __Pyx_RefNannyDeclarations
13157   int __pyx_t_1;
13158   __Pyx_RefNannySetupContext("__len__", 0);
13159 
13160   /* "View.MemoryView":606
13161  *
13162  *     def __len__(self):
13163  *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
13164  *             return self.view.shape[0]
13165  *
13166  */
13167   __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
13168   if (__pyx_t_1) {
13169 
13170     /* "View.MemoryView":607
13171  *     def __len__(self):
13172  *         if self.view.ndim >= 1:
13173  *             return self.view.shape[0]             # <<<<<<<<<<<<<<
13174  *
13175  *         return 0
13176  */
13177     __pyx_r = (__pyx_v_self->view.shape[0]);
13178     goto __pyx_L0;
13179 
13180     /* "View.MemoryView":606
13181  *
13182  *     def __len__(self):
13183  *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
13184  *             return self.view.shape[0]
13185  *
13186  */
13187   }
13188 
13189   /* "View.MemoryView":609
13190  *             return self.view.shape[0]
13191  *
13192  *         return 0             # <<<<<<<<<<<<<<
13193  *
13194  *     def __repr__(self):
13195  */
13196   __pyx_r = 0;
13197   goto __pyx_L0;
13198 
13199   /* "View.MemoryView":605
13200  *         return self._size
13201  *
13202  *     def __len__(self):             # <<<<<<<<<<<<<<
13203  *         if self.view.ndim >= 1:
13204  *             return self.view.shape[0]
13205  */
13206 
13207   /* function exit code */
13208   __pyx_L0:;
13209   __Pyx_RefNannyFinishContext();
13210   return __pyx_r;
13211 }
13212 
13213 /* "View.MemoryView":611
13214  *         return 0
13215  *
13216  *     def __repr__(self):             # <<<<<<<<<<<<<<
13217  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
13218  *                                                id(self))
13219  */
13220 
13221 /* Python wrapper */
13222 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___repr__(PyObject * __pyx_v_self)13223 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
13224   PyObject *__pyx_r = 0;
13225   __Pyx_RefNannyDeclarations
13226   __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
13227   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));
13228 
13229   /* function exit code */
13230   __Pyx_RefNannyFinishContext();
13231   return __pyx_r;
13232 }
13233 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj * __pyx_v_self)13234 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
13235   PyObject *__pyx_r = NULL;
13236   __Pyx_RefNannyDeclarations
13237   PyObject *__pyx_t_1 = NULL;
13238   PyObject *__pyx_t_2 = NULL;
13239   PyObject *__pyx_t_3 = NULL;
13240   int __pyx_lineno = 0;
13241   const char *__pyx_filename = NULL;
13242   int __pyx_clineno = 0;
13243   __Pyx_RefNannySetupContext("__repr__", 0);
13244 
13245   /* "View.MemoryView":612
13246  *
13247  *     def __repr__(self):
13248  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
13249  *                                                id(self))
13250  *
13251  */
13252   __Pyx_XDECREF(__pyx_r);
13253   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
13254   __Pyx_GOTREF(__pyx_t_1);
13255   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
13256   __Pyx_GOTREF(__pyx_t_2);
13257   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13258   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
13259   __Pyx_GOTREF(__pyx_t_1);
13260   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13261 
13262   /* "View.MemoryView":613
13263  *     def __repr__(self):
13264  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
13265  *                                                id(self))             # <<<<<<<<<<<<<<
13266  *
13267  *     def __str__(self):
13268  */
13269   __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 613, __pyx_L1_error)
13270   __Pyx_GOTREF(__pyx_t_2);
13271 
13272   /* "View.MemoryView":612
13273  *
13274  *     def __repr__(self):
13275  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
13276  *                                                id(self))
13277  *
13278  */
13279   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 612, __pyx_L1_error)
13280   __Pyx_GOTREF(__pyx_t_3);
13281   __Pyx_GIVEREF(__pyx_t_1);
13282   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
13283   __Pyx_GIVEREF(__pyx_t_2);
13284   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
13285   __pyx_t_1 = 0;
13286   __pyx_t_2 = 0;
13287   __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
13288   __Pyx_GOTREF(__pyx_t_2);
13289   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13290   __pyx_r = __pyx_t_2;
13291   __pyx_t_2 = 0;
13292   goto __pyx_L0;
13293 
13294   /* "View.MemoryView":611
13295  *         return 0
13296  *
13297  *     def __repr__(self):             # <<<<<<<<<<<<<<
13298  *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
13299  *                                                id(self))
13300  */
13301 
13302   /* function exit code */
13303   __pyx_L1_error:;
13304   __Pyx_XDECREF(__pyx_t_1);
13305   __Pyx_XDECREF(__pyx_t_2);
13306   __Pyx_XDECREF(__pyx_t_3);
13307   __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13308   __pyx_r = NULL;
13309   __pyx_L0:;
13310   __Pyx_XGIVEREF(__pyx_r);
13311   __Pyx_RefNannyFinishContext();
13312   return __pyx_r;
13313 }
13314 
13315 /* "View.MemoryView":615
13316  *                                                id(self))
13317  *
13318  *     def __str__(self):             # <<<<<<<<<<<<<<
13319  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
13320  *
13321  */
13322 
13323 /* Python wrapper */
13324 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryview___str__(PyObject * __pyx_v_self)13325 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
13326   PyObject *__pyx_r = 0;
13327   __Pyx_RefNannyDeclarations
13328   __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
13329   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));
13330 
13331   /* function exit code */
13332   __Pyx_RefNannyFinishContext();
13333   return __pyx_r;
13334 }
13335 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj * __pyx_v_self)13336 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
13337   PyObject *__pyx_r = NULL;
13338   __Pyx_RefNannyDeclarations
13339   PyObject *__pyx_t_1 = NULL;
13340   PyObject *__pyx_t_2 = NULL;
13341   int __pyx_lineno = 0;
13342   const char *__pyx_filename = NULL;
13343   int __pyx_clineno = 0;
13344   __Pyx_RefNannySetupContext("__str__", 0);
13345 
13346   /* "View.MemoryView":616
13347  *
13348  *     def __str__(self):
13349  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)             # <<<<<<<<<<<<<<
13350  *
13351  *
13352  */
13353   __Pyx_XDECREF(__pyx_r);
13354   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
13355   __Pyx_GOTREF(__pyx_t_1);
13356   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 616, __pyx_L1_error)
13357   __Pyx_GOTREF(__pyx_t_2);
13358   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13359   __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
13360   __Pyx_GOTREF(__pyx_t_1);
13361   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13362   __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 616, __pyx_L1_error)
13363   __Pyx_GOTREF(__pyx_t_2);
13364   __Pyx_GIVEREF(__pyx_t_1);
13365   PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
13366   __pyx_t_1 = 0;
13367   __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
13368   __Pyx_GOTREF(__pyx_t_1);
13369   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13370   __pyx_r = __pyx_t_1;
13371   __pyx_t_1 = 0;
13372   goto __pyx_L0;
13373 
13374   /* "View.MemoryView":615
13375  *                                                id(self))
13376  *
13377  *     def __str__(self):             # <<<<<<<<<<<<<<
13378  *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
13379  *
13380  */
13381 
13382   /* function exit code */
13383   __pyx_L1_error:;
13384   __Pyx_XDECREF(__pyx_t_1);
13385   __Pyx_XDECREF(__pyx_t_2);
13386   __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13387   __pyx_r = NULL;
13388   __pyx_L0:;
13389   __Pyx_XGIVEREF(__pyx_r);
13390   __Pyx_RefNannyFinishContext();
13391   return __pyx_r;
13392 }
13393 
13394 /* "View.MemoryView":619
13395  *
13396  *
13397  *     def is_c_contig(self):             # <<<<<<<<<<<<<<
13398  *         cdef __Pyx_memviewslice *mslice
13399  *         cdef __Pyx_memviewslice tmp
13400  */
13401 
13402 /* Python wrapper */
13403 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)13404 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13405   PyObject *__pyx_r = 0;
13406   __Pyx_RefNannyDeclarations
13407   __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
13408   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
13409 
13410   /* function exit code */
13411   __Pyx_RefNannyFinishContext();
13412   return __pyx_r;
13413 }
13414 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj * __pyx_v_self)13415 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
13416   __Pyx_memviewslice *__pyx_v_mslice;
13417   __Pyx_memviewslice __pyx_v_tmp;
13418   PyObject *__pyx_r = NULL;
13419   __Pyx_RefNannyDeclarations
13420   __Pyx_memviewslice *__pyx_t_1;
13421   PyObject *__pyx_t_2 = NULL;
13422   int __pyx_lineno = 0;
13423   const char *__pyx_filename = NULL;
13424   int __pyx_clineno = 0;
13425   __Pyx_RefNannySetupContext("is_c_contig", 0);
13426 
13427   /* "View.MemoryView":622
13428  *         cdef __Pyx_memviewslice *mslice
13429  *         cdef __Pyx_memviewslice tmp
13430  *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
13431  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
13432  *
13433  */
13434   __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(1, 622, __pyx_L1_error)
13435   __pyx_v_mslice = __pyx_t_1;
13436 
13437   /* "View.MemoryView":623
13438  *         cdef __Pyx_memviewslice tmp
13439  *         mslice = get_slice_from_memview(self, &tmp)
13440  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)             # <<<<<<<<<<<<<<
13441  *
13442  *     def is_f_contig(self):
13443  */
13444   __Pyx_XDECREF(__pyx_r);
13445   __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(1, 623, __pyx_L1_error)
13446   __Pyx_GOTREF(__pyx_t_2);
13447   __pyx_r = __pyx_t_2;
13448   __pyx_t_2 = 0;
13449   goto __pyx_L0;
13450 
13451   /* "View.MemoryView":619
13452  *
13453  *
13454  *     def is_c_contig(self):             # <<<<<<<<<<<<<<
13455  *         cdef __Pyx_memviewslice *mslice
13456  *         cdef __Pyx_memviewslice tmp
13457  */
13458 
13459   /* function exit code */
13460   __pyx_L1_error:;
13461   __Pyx_XDECREF(__pyx_t_2);
13462   __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
13463   __pyx_r = NULL;
13464   __pyx_L0:;
13465   __Pyx_XGIVEREF(__pyx_r);
13466   __Pyx_RefNannyFinishContext();
13467   return __pyx_r;
13468 }
13469 
13470 /* "View.MemoryView":625
13471  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
13472  *
13473  *     def is_f_contig(self):             # <<<<<<<<<<<<<<
13474  *         cdef __Pyx_memviewslice *mslice
13475  *         cdef __Pyx_memviewslice tmp
13476  */
13477 
13478 /* Python wrapper */
13479 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)13480 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13481   PyObject *__pyx_r = 0;
13482   __Pyx_RefNannyDeclarations
13483   __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
13484   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
13485 
13486   /* function exit code */
13487   __Pyx_RefNannyFinishContext();
13488   return __pyx_r;
13489 }
13490 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj * __pyx_v_self)13491 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
13492   __Pyx_memviewslice *__pyx_v_mslice;
13493   __Pyx_memviewslice __pyx_v_tmp;
13494   PyObject *__pyx_r = NULL;
13495   __Pyx_RefNannyDeclarations
13496   __Pyx_memviewslice *__pyx_t_1;
13497   PyObject *__pyx_t_2 = NULL;
13498   int __pyx_lineno = 0;
13499   const char *__pyx_filename = NULL;
13500   int __pyx_clineno = 0;
13501   __Pyx_RefNannySetupContext("is_f_contig", 0);
13502 
13503   /* "View.MemoryView":628
13504  *         cdef __Pyx_memviewslice *mslice
13505  *         cdef __Pyx_memviewslice tmp
13506  *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
13507  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
13508  *
13509  */
13510   __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(1, 628, __pyx_L1_error)
13511   __pyx_v_mslice = __pyx_t_1;
13512 
13513   /* "View.MemoryView":629
13514  *         cdef __Pyx_memviewslice tmp
13515  *         mslice = get_slice_from_memview(self, &tmp)
13516  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)             # <<<<<<<<<<<<<<
13517  *
13518  *     def copy(self):
13519  */
13520   __Pyx_XDECREF(__pyx_r);
13521   __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(1, 629, __pyx_L1_error)
13522   __Pyx_GOTREF(__pyx_t_2);
13523   __pyx_r = __pyx_t_2;
13524   __pyx_t_2 = 0;
13525   goto __pyx_L0;
13526 
13527   /* "View.MemoryView":625
13528  *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
13529  *
13530  *     def is_f_contig(self):             # <<<<<<<<<<<<<<
13531  *         cdef __Pyx_memviewslice *mslice
13532  *         cdef __Pyx_memviewslice tmp
13533  */
13534 
13535   /* function exit code */
13536   __pyx_L1_error:;
13537   __Pyx_XDECREF(__pyx_t_2);
13538   __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
13539   __pyx_r = NULL;
13540   __pyx_L0:;
13541   __Pyx_XGIVEREF(__pyx_r);
13542   __Pyx_RefNannyFinishContext();
13543   return __pyx_r;
13544 }
13545 
13546 /* "View.MemoryView":631
13547  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
13548  *
13549  *     def copy(self):             # <<<<<<<<<<<<<<
13550  *         cdef __Pyx_memviewslice mslice
13551  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
13552  */
13553 
13554 /* Python wrapper */
13555 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)13556 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13557   PyObject *__pyx_r = 0;
13558   __Pyx_RefNannyDeclarations
13559   __Pyx_RefNannySetupContext("copy (wrapper)", 0);
13560   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));
13561 
13562   /* function exit code */
13563   __Pyx_RefNannyFinishContext();
13564   return __pyx_r;
13565 }
13566 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj * __pyx_v_self)13567 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
13568   __Pyx_memviewslice __pyx_v_mslice;
13569   int __pyx_v_flags;
13570   PyObject *__pyx_r = NULL;
13571   __Pyx_RefNannyDeclarations
13572   __Pyx_memviewslice __pyx_t_1;
13573   PyObject *__pyx_t_2 = NULL;
13574   int __pyx_lineno = 0;
13575   const char *__pyx_filename = NULL;
13576   int __pyx_clineno = 0;
13577   __Pyx_RefNannySetupContext("copy", 0);
13578 
13579   /* "View.MemoryView":633
13580  *     def copy(self):
13581  *         cdef __Pyx_memviewslice mslice
13582  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS             # <<<<<<<<<<<<<<
13583  *
13584  *         slice_copy(self, &mslice)
13585  */
13586   __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
13587 
13588   /* "View.MemoryView":635
13589  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
13590  *
13591  *         slice_copy(self, &mslice)             # <<<<<<<<<<<<<<
13592  *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
13593  *                                    self.view.itemsize,
13594  */
13595   __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
13596 
13597   /* "View.MemoryView":636
13598  *
13599  *         slice_copy(self, &mslice)
13600  *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,             # <<<<<<<<<<<<<<
13601  *                                    self.view.itemsize,
13602  *                                    flags|PyBUF_C_CONTIGUOUS,
13603  */
13604   __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 636, __pyx_L1_error)
13605   __pyx_v_mslice = __pyx_t_1;
13606 
13607   /* "View.MemoryView":641
13608  *                                    self.dtype_is_object)
13609  *
13610  *         return memoryview_copy_from_slice(self, &mslice)             # <<<<<<<<<<<<<<
13611  *
13612  *     def copy_fortran(self):
13613  */
13614   __Pyx_XDECREF(__pyx_r);
13615   __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 641, __pyx_L1_error)
13616   __Pyx_GOTREF(__pyx_t_2);
13617   __pyx_r = __pyx_t_2;
13618   __pyx_t_2 = 0;
13619   goto __pyx_L0;
13620 
13621   /* "View.MemoryView":631
13622  *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
13623  *
13624  *     def copy(self):             # <<<<<<<<<<<<<<
13625  *         cdef __Pyx_memviewslice mslice
13626  *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
13627  */
13628 
13629   /* function exit code */
13630   __pyx_L1_error:;
13631   __Pyx_XDECREF(__pyx_t_2);
13632   __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
13633   __pyx_r = NULL;
13634   __pyx_L0:;
13635   __Pyx_XGIVEREF(__pyx_r);
13636   __Pyx_RefNannyFinishContext();
13637   return __pyx_r;
13638 }
13639 
13640 /* "View.MemoryView":643
13641  *         return memoryview_copy_from_slice(self, &mslice)
13642  *
13643  *     def copy_fortran(self):             # <<<<<<<<<<<<<<
13644  *         cdef __Pyx_memviewslice src, dst
13645  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
13646  */
13647 
13648 /* Python wrapper */
13649 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)13650 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13651   PyObject *__pyx_r = 0;
13652   __Pyx_RefNannyDeclarations
13653   __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
13654   __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));
13655 
13656   /* function exit code */
13657   __Pyx_RefNannyFinishContext();
13658   return __pyx_r;
13659 }
13660 
__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj * __pyx_v_self)13661 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
13662   __Pyx_memviewslice __pyx_v_src;
13663   __Pyx_memviewslice __pyx_v_dst;
13664   int __pyx_v_flags;
13665   PyObject *__pyx_r = NULL;
13666   __Pyx_RefNannyDeclarations
13667   __Pyx_memviewslice __pyx_t_1;
13668   PyObject *__pyx_t_2 = NULL;
13669   int __pyx_lineno = 0;
13670   const char *__pyx_filename = NULL;
13671   int __pyx_clineno = 0;
13672   __Pyx_RefNannySetupContext("copy_fortran", 0);
13673 
13674   /* "View.MemoryView":645
13675  *     def copy_fortran(self):
13676  *         cdef __Pyx_memviewslice src, dst
13677  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS             # <<<<<<<<<<<<<<
13678  *
13679  *         slice_copy(self, &src)
13680  */
13681   __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
13682 
13683   /* "View.MemoryView":647
13684  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
13685  *
13686  *         slice_copy(self, &src)             # <<<<<<<<<<<<<<
13687  *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,
13688  *                                 self.view.itemsize,
13689  */
13690   __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
13691 
13692   /* "View.MemoryView":648
13693  *
13694  *         slice_copy(self, &src)
13695  *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,             # <<<<<<<<<<<<<<
13696  *                                 self.view.itemsize,
13697  *                                 flags|PyBUF_F_CONTIGUOUS,
13698  */
13699   __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 648, __pyx_L1_error)
13700   __pyx_v_dst = __pyx_t_1;
13701 
13702   /* "View.MemoryView":653
13703  *                                 self.dtype_is_object)
13704  *
13705  *         return memoryview_copy_from_slice(self, &dst)             # <<<<<<<<<<<<<<
13706  *
13707  *
13708  */
13709   __Pyx_XDECREF(__pyx_r);
13710   __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 653, __pyx_L1_error)
13711   __Pyx_GOTREF(__pyx_t_2);
13712   __pyx_r = __pyx_t_2;
13713   __pyx_t_2 = 0;
13714   goto __pyx_L0;
13715 
13716   /* "View.MemoryView":643
13717  *         return memoryview_copy_from_slice(self, &mslice)
13718  *
13719  *     def copy_fortran(self):             # <<<<<<<<<<<<<<
13720  *         cdef __Pyx_memviewslice src, dst
13721  *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
13722  */
13723 
13724   /* function exit code */
13725   __pyx_L1_error:;
13726   __Pyx_XDECREF(__pyx_t_2);
13727   __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
13728   __pyx_r = NULL;
13729   __pyx_L0:;
13730   __Pyx_XGIVEREF(__pyx_r);
13731   __Pyx_RefNannyFinishContext();
13732   return __pyx_r;
13733 }
13734 
13735 /* "(tree fragment)":1
13736  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
13737  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13738  * def __setstate_cython__(self, __pyx_state):
13739  */
13740 
13741 /* Python wrapper */
13742 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)13743 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13744   PyObject *__pyx_r = 0;
13745   __Pyx_RefNannyDeclarations
13746   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
13747   __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));
13748 
13749   /* function exit code */
13750   __Pyx_RefNannyFinishContext();
13751   return __pyx_r;
13752 }
13753 
__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj * __pyx_v_self)13754 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
13755   PyObject *__pyx_r = NULL;
13756   __Pyx_RefNannyDeclarations
13757   PyObject *__pyx_t_1 = NULL;
13758   int __pyx_lineno = 0;
13759   const char *__pyx_filename = NULL;
13760   int __pyx_clineno = 0;
13761   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
13762 
13763   /* "(tree fragment)":2
13764  * def __reduce_cython__(self):
13765  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
13766  * def __setstate_cython__(self, __pyx_state):
13767  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13768  */
13769   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
13770   __Pyx_GOTREF(__pyx_t_1);
13771   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
13772   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13773   __PYX_ERR(1, 2, __pyx_L1_error)
13774 
13775   /* "(tree fragment)":1
13776  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
13777  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13778  * def __setstate_cython__(self, __pyx_state):
13779  */
13780 
13781   /* function exit code */
13782   __pyx_L1_error:;
13783   __Pyx_XDECREF(__pyx_t_1);
13784   __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13785   __pyx_r = NULL;
13786   __Pyx_XGIVEREF(__pyx_r);
13787   __Pyx_RefNannyFinishContext();
13788   return __pyx_r;
13789 }
13790 
13791 /* "(tree fragment)":3
13792  * def __reduce_cython__(self):
13793  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13794  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
13795  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13796  */
13797 
13798 /* Python wrapper */
13799 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)13800 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
13801   PyObject *__pyx_r = 0;
13802   __Pyx_RefNannyDeclarations
13803   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
13804   __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
13805 
13806   /* function exit code */
13807   __Pyx_RefNannyFinishContext();
13808   return __pyx_r;
13809 }
13810 
__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)13811 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) {
13812   PyObject *__pyx_r = NULL;
13813   __Pyx_RefNannyDeclarations
13814   PyObject *__pyx_t_1 = NULL;
13815   int __pyx_lineno = 0;
13816   const char *__pyx_filename = NULL;
13817   int __pyx_clineno = 0;
13818   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
13819 
13820   /* "(tree fragment)":4
13821  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13822  * def __setstate_cython__(self, __pyx_state):
13823  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
13824  */
13825   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
13826   __Pyx_GOTREF(__pyx_t_1);
13827   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
13828   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13829   __PYX_ERR(1, 4, __pyx_L1_error)
13830 
13831   /* "(tree fragment)":3
13832  * def __reduce_cython__(self):
13833  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13834  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
13835  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
13836  */
13837 
13838   /* function exit code */
13839   __pyx_L1_error:;
13840   __Pyx_XDECREF(__pyx_t_1);
13841   __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13842   __pyx_r = NULL;
13843   __Pyx_XGIVEREF(__pyx_r);
13844   __Pyx_RefNannyFinishContext();
13845   return __pyx_r;
13846 }
13847 
13848 /* "View.MemoryView":657
13849  *
13850  * @cname('__pyx_memoryview_new')
13851  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
13852  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
13853  *     result.typeinfo = typeinfo
13854  */
13855 
__pyx_memoryview_new(PyObject * __pyx_v_o,int __pyx_v_flags,int __pyx_v_dtype_is_object,__Pyx_TypeInfo * __pyx_v_typeinfo)13856 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
13857   struct __pyx_memoryview_obj *__pyx_v_result = 0;
13858   PyObject *__pyx_r = NULL;
13859   __Pyx_RefNannyDeclarations
13860   PyObject *__pyx_t_1 = NULL;
13861   PyObject *__pyx_t_2 = NULL;
13862   PyObject *__pyx_t_3 = NULL;
13863   int __pyx_lineno = 0;
13864   const char *__pyx_filename = NULL;
13865   int __pyx_clineno = 0;
13866   __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);
13867 
13868   /* "View.MemoryView":658
13869  * @cname('__pyx_memoryview_new')
13870  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
13871  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)             # <<<<<<<<<<<<<<
13872  *     result.typeinfo = typeinfo
13873  *     return result
13874  */
13875   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 658, __pyx_L1_error)
13876   __Pyx_GOTREF(__pyx_t_1);
13877   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error)
13878   __Pyx_GOTREF(__pyx_t_2);
13879   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 658, __pyx_L1_error)
13880   __Pyx_GOTREF(__pyx_t_3);
13881   __Pyx_INCREF(__pyx_v_o);
13882   __Pyx_GIVEREF(__pyx_v_o);
13883   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
13884   __Pyx_GIVEREF(__pyx_t_1);
13885   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
13886   __Pyx_GIVEREF(__pyx_t_2);
13887   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
13888   __pyx_t_1 = 0;
13889   __pyx_t_2 = 0;
13890   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error)
13891   __Pyx_GOTREF(__pyx_t_2);
13892   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13893   __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
13894   __pyx_t_2 = 0;
13895 
13896   /* "View.MemoryView":659
13897  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
13898  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
13899  *     result.typeinfo = typeinfo             # <<<<<<<<<<<<<<
13900  *     return result
13901  *
13902  */
13903   __pyx_v_result->typeinfo = __pyx_v_typeinfo;
13904 
13905   /* "View.MemoryView":660
13906  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
13907  *     result.typeinfo = typeinfo
13908  *     return result             # <<<<<<<<<<<<<<
13909  *
13910  * @cname('__pyx_memoryview_check')
13911  */
13912   __Pyx_XDECREF(__pyx_r);
13913   __Pyx_INCREF(((PyObject *)__pyx_v_result));
13914   __pyx_r = ((PyObject *)__pyx_v_result);
13915   goto __pyx_L0;
13916 
13917   /* "View.MemoryView":657
13918  *
13919  * @cname('__pyx_memoryview_new')
13920  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
13921  *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
13922  *     result.typeinfo = typeinfo
13923  */
13924 
13925   /* function exit code */
13926   __pyx_L1_error:;
13927   __Pyx_XDECREF(__pyx_t_1);
13928   __Pyx_XDECREF(__pyx_t_2);
13929   __Pyx_XDECREF(__pyx_t_3);
13930   __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
13931   __pyx_r = 0;
13932   __pyx_L0:;
13933   __Pyx_XDECREF((PyObject *)__pyx_v_result);
13934   __Pyx_XGIVEREF(__pyx_r);
13935   __Pyx_RefNannyFinishContext();
13936   return __pyx_r;
13937 }
13938 
13939 /* "View.MemoryView":663
13940  *
13941  * @cname('__pyx_memoryview_check')
13942  * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
13943  *     return isinstance(o, memoryview)
13944  *
13945  */
13946 
__pyx_memoryview_check(PyObject * __pyx_v_o)13947 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
13948   int __pyx_r;
13949   __Pyx_RefNannyDeclarations
13950   int __pyx_t_1;
13951   __Pyx_RefNannySetupContext("memoryview_check", 0);
13952 
13953   /* "View.MemoryView":664
13954  * @cname('__pyx_memoryview_check')
13955  * cdef inline bint memoryview_check(object o):
13956  *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
13957  *
13958  * cdef tuple _unellipsify(object index, int ndim):
13959  */
13960   __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
13961   __pyx_r = __pyx_t_1;
13962   goto __pyx_L0;
13963 
13964   /* "View.MemoryView":663
13965  *
13966  * @cname('__pyx_memoryview_check')
13967  * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
13968  *     return isinstance(o, memoryview)
13969  *
13970  */
13971 
13972   /* function exit code */
13973   __pyx_L0:;
13974   __Pyx_RefNannyFinishContext();
13975   return __pyx_r;
13976 }
13977 
13978 /* "View.MemoryView":666
13979  *     return isinstance(o, memoryview)
13980  *
13981  * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
13982  *     """
13983  *     Replace all ellipses with full slices and fill incomplete indices with
13984  */
13985 
_unellipsify(PyObject * __pyx_v_index,int __pyx_v_ndim)13986 static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
13987   PyObject *__pyx_v_tup = NULL;
13988   PyObject *__pyx_v_result = NULL;
13989   int __pyx_v_have_slices;
13990   int __pyx_v_seen_ellipsis;
13991   CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
13992   PyObject *__pyx_v_item = NULL;
13993   Py_ssize_t __pyx_v_nslices;
13994   PyObject *__pyx_r = NULL;
13995   __Pyx_RefNannyDeclarations
13996   int __pyx_t_1;
13997   int __pyx_t_2;
13998   PyObject *__pyx_t_3 = NULL;
13999   PyObject *__pyx_t_4 = NULL;
14000   Py_ssize_t __pyx_t_5;
14001   PyObject *(*__pyx_t_6)(PyObject *);
14002   PyObject *__pyx_t_7 = NULL;
14003   Py_ssize_t __pyx_t_8;
14004   int __pyx_t_9;
14005   int __pyx_t_10;
14006   PyObject *__pyx_t_11 = NULL;
14007   int __pyx_lineno = 0;
14008   const char *__pyx_filename = NULL;
14009   int __pyx_clineno = 0;
14010   __Pyx_RefNannySetupContext("_unellipsify", 0);
14011 
14012   /* "View.MemoryView":671
14013  *     full slices.
14014  *     """
14015  *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
14016  *         tup = (index,)
14017  *     else:
14018  */
14019   __pyx_t_1 = PyTuple_Check(__pyx_v_index);
14020   __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
14021   if (__pyx_t_2) {
14022 
14023     /* "View.MemoryView":672
14024  *     """
14025  *     if not isinstance(index, tuple):
14026  *         tup = (index,)             # <<<<<<<<<<<<<<
14027  *     else:
14028  *         tup = index
14029  */
14030     __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 672, __pyx_L1_error)
14031     __Pyx_GOTREF(__pyx_t_3);
14032     __Pyx_INCREF(__pyx_v_index);
14033     __Pyx_GIVEREF(__pyx_v_index);
14034     PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
14035     __pyx_v_tup = __pyx_t_3;
14036     __pyx_t_3 = 0;
14037 
14038     /* "View.MemoryView":671
14039  *     full slices.
14040  *     """
14041  *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
14042  *         tup = (index,)
14043  *     else:
14044  */
14045     goto __pyx_L3;
14046   }
14047 
14048   /* "View.MemoryView":674
14049  *         tup = (index,)
14050  *     else:
14051  *         tup = index             # <<<<<<<<<<<<<<
14052  *
14053  *     result = []
14054  */
14055   /*else*/ {
14056     __Pyx_INCREF(__pyx_v_index);
14057     __pyx_v_tup = __pyx_v_index;
14058   }
14059   __pyx_L3:;
14060 
14061   /* "View.MemoryView":676
14062  *         tup = index
14063  *
14064  *     result = []             # <<<<<<<<<<<<<<
14065  *     have_slices = False
14066  *     seen_ellipsis = False
14067  */
14068   __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 676, __pyx_L1_error)
14069   __Pyx_GOTREF(__pyx_t_3);
14070   __pyx_v_result = ((PyObject*)__pyx_t_3);
14071   __pyx_t_3 = 0;
14072 
14073   /* "View.MemoryView":677
14074  *
14075  *     result = []
14076  *     have_slices = False             # <<<<<<<<<<<<<<
14077  *     seen_ellipsis = False
14078  *     for idx, item in enumerate(tup):
14079  */
14080   __pyx_v_have_slices = 0;
14081 
14082   /* "View.MemoryView":678
14083  *     result = []
14084  *     have_slices = False
14085  *     seen_ellipsis = False             # <<<<<<<<<<<<<<
14086  *     for idx, item in enumerate(tup):
14087  *         if item is Ellipsis:
14088  */
14089   __pyx_v_seen_ellipsis = 0;
14090 
14091   /* "View.MemoryView":679
14092  *     have_slices = False
14093  *     seen_ellipsis = False
14094  *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
14095  *         if item is Ellipsis:
14096  *             if not seen_ellipsis:
14097  */
14098   __Pyx_INCREF(__pyx_int_0);
14099   __pyx_t_3 = __pyx_int_0;
14100   if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
14101     __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
14102     __pyx_t_6 = NULL;
14103   } else {
14104     __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 679, __pyx_L1_error)
14105     __Pyx_GOTREF(__pyx_t_4);
14106     __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 679, __pyx_L1_error)
14107   }
14108   for (;;) {
14109     if (likely(!__pyx_t_6)) {
14110       if (likely(PyList_CheckExact(__pyx_t_4))) {
14111         if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
14112         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14113         __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(1, 679, __pyx_L1_error)
14114         #else
14115         __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
14116         __Pyx_GOTREF(__pyx_t_7);
14117         #endif
14118       } else {
14119         if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
14120         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14121         __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(1, 679, __pyx_L1_error)
14122         #else
14123         __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
14124         __Pyx_GOTREF(__pyx_t_7);
14125         #endif
14126       }
14127     } else {
14128       __pyx_t_7 = __pyx_t_6(__pyx_t_4);
14129       if (unlikely(!__pyx_t_7)) {
14130         PyObject* exc_type = PyErr_Occurred();
14131         if (exc_type) {
14132           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
14133           else __PYX_ERR(1, 679, __pyx_L1_error)
14134         }
14135         break;
14136       }
14137       __Pyx_GOTREF(__pyx_t_7);
14138     }
14139     __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
14140     __pyx_t_7 = 0;
14141     __Pyx_INCREF(__pyx_t_3);
14142     __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
14143     __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
14144     __Pyx_GOTREF(__pyx_t_7);
14145     __Pyx_DECREF(__pyx_t_3);
14146     __pyx_t_3 = __pyx_t_7;
14147     __pyx_t_7 = 0;
14148 
14149     /* "View.MemoryView":680
14150  *     seen_ellipsis = False
14151  *     for idx, item in enumerate(tup):
14152  *         if item is Ellipsis:             # <<<<<<<<<<<<<<
14153  *             if not seen_ellipsis:
14154  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
14155  */
14156     __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
14157     __pyx_t_1 = (__pyx_t_2 != 0);
14158     if (__pyx_t_1) {
14159 
14160       /* "View.MemoryView":681
14161  *     for idx, item in enumerate(tup):
14162  *         if item is Ellipsis:
14163  *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
14164  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
14165  *                 seen_ellipsis = True
14166  */
14167       __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
14168       if (__pyx_t_1) {
14169 
14170         /* "View.MemoryView":682
14171  *         if item is Ellipsis:
14172  *             if not seen_ellipsis:
14173  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
14174  *                 seen_ellipsis = True
14175  *             else:
14176  */
14177         __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 682, __pyx_L1_error)
14178         __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 682, __pyx_L1_error)
14179         __Pyx_GOTREF(__pyx_t_7);
14180         { Py_ssize_t __pyx_temp;
14181           for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
14182             __Pyx_INCREF(__pyx_slice__17);
14183             __Pyx_GIVEREF(__pyx_slice__17);
14184             PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__17);
14185           }
14186         }
14187         __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 682, __pyx_L1_error)
14188         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14189 
14190         /* "View.MemoryView":683
14191  *             if not seen_ellipsis:
14192  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
14193  *                 seen_ellipsis = True             # <<<<<<<<<<<<<<
14194  *             else:
14195  *                 result.append(slice(None))
14196  */
14197         __pyx_v_seen_ellipsis = 1;
14198 
14199         /* "View.MemoryView":681
14200  *     for idx, item in enumerate(tup):
14201  *         if item is Ellipsis:
14202  *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
14203  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
14204  *                 seen_ellipsis = True
14205  */
14206         goto __pyx_L7;
14207       }
14208 
14209       /* "View.MemoryView":685
14210  *                 seen_ellipsis = True
14211  *             else:
14212  *                 result.append(slice(None))             # <<<<<<<<<<<<<<
14213  *             have_slices = True
14214  *         else:
14215  */
14216       /*else*/ {
14217         __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__17); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 685, __pyx_L1_error)
14218       }
14219       __pyx_L7:;
14220 
14221       /* "View.MemoryView":686
14222  *             else:
14223  *                 result.append(slice(None))
14224  *             have_slices = True             # <<<<<<<<<<<<<<
14225  *         else:
14226  *             if not isinstance(item, slice) and not PyIndex_Check(item):
14227  */
14228       __pyx_v_have_slices = 1;
14229 
14230       /* "View.MemoryView":680
14231  *     seen_ellipsis = False
14232  *     for idx, item in enumerate(tup):
14233  *         if item is Ellipsis:             # <<<<<<<<<<<<<<
14234  *             if not seen_ellipsis:
14235  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
14236  */
14237       goto __pyx_L6;
14238     }
14239 
14240     /* "View.MemoryView":688
14241  *             have_slices = True
14242  *         else:
14243  *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
14244  *                 raise TypeError("Cannot index with type '%s'" % type(item))
14245  *
14246  */
14247     /*else*/ {
14248       __pyx_t_2 = PySlice_Check(__pyx_v_item);
14249       __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
14250       if (__pyx_t_10) {
14251       } else {
14252         __pyx_t_1 = __pyx_t_10;
14253         goto __pyx_L9_bool_binop_done;
14254       }
14255       __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
14256       __pyx_t_1 = __pyx_t_10;
14257       __pyx_L9_bool_binop_done:;
14258       if (unlikely(__pyx_t_1)) {
14259 
14260         /* "View.MemoryView":689
14261  *         else:
14262  *             if not isinstance(item, slice) and not PyIndex_Check(item):
14263  *                 raise TypeError("Cannot index with type '%s'" % type(item))             # <<<<<<<<<<<<<<
14264  *
14265  *             have_slices = have_slices or isinstance(item, slice)
14266  */
14267         __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 689, __pyx_L1_error)
14268         __Pyx_GOTREF(__pyx_t_7);
14269         __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 689, __pyx_L1_error)
14270         __Pyx_GOTREF(__pyx_t_11);
14271         __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14272         __Pyx_Raise(__pyx_t_11, 0, 0, 0);
14273         __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
14274         __PYX_ERR(1, 689, __pyx_L1_error)
14275 
14276         /* "View.MemoryView":688
14277  *             have_slices = True
14278  *         else:
14279  *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
14280  *                 raise TypeError("Cannot index with type '%s'" % type(item))
14281  *
14282  */
14283       }
14284 
14285       /* "View.MemoryView":691
14286  *                 raise TypeError("Cannot index with type '%s'" % type(item))
14287  *
14288  *             have_slices = have_slices or isinstance(item, slice)             # <<<<<<<<<<<<<<
14289  *             result.append(item)
14290  *
14291  */
14292       __pyx_t_10 = (__pyx_v_have_slices != 0);
14293       if (!__pyx_t_10) {
14294       } else {
14295         __pyx_t_1 = __pyx_t_10;
14296         goto __pyx_L11_bool_binop_done;
14297       }
14298       __pyx_t_10 = PySlice_Check(__pyx_v_item);
14299       __pyx_t_2 = (__pyx_t_10 != 0);
14300       __pyx_t_1 = __pyx_t_2;
14301       __pyx_L11_bool_binop_done:;
14302       __pyx_v_have_slices = __pyx_t_1;
14303 
14304       /* "View.MemoryView":692
14305  *
14306  *             have_slices = have_slices or isinstance(item, slice)
14307  *             result.append(item)             # <<<<<<<<<<<<<<
14308  *
14309  *     nslices = ndim - len(result)
14310  */
14311       __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 692, __pyx_L1_error)
14312     }
14313     __pyx_L6:;
14314 
14315     /* "View.MemoryView":679
14316  *     have_slices = False
14317  *     seen_ellipsis = False
14318  *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
14319  *         if item is Ellipsis:
14320  *             if not seen_ellipsis:
14321  */
14322   }
14323   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14324   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14325 
14326   /* "View.MemoryView":694
14327  *             result.append(item)
14328  *
14329  *     nslices = ndim - len(result)             # <<<<<<<<<<<<<<
14330  *     if nslices:
14331  *         result.extend([slice(None)] * nslices)
14332  */
14333   __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 694, __pyx_L1_error)
14334   __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
14335 
14336   /* "View.MemoryView":695
14337  *
14338  *     nslices = ndim - len(result)
14339  *     if nslices:             # <<<<<<<<<<<<<<
14340  *         result.extend([slice(None)] * nslices)
14341  *
14342  */
14343   __pyx_t_1 = (__pyx_v_nslices != 0);
14344   if (__pyx_t_1) {
14345 
14346     /* "View.MemoryView":696
14347  *     nslices = ndim - len(result)
14348  *     if nslices:
14349  *         result.extend([slice(None)] * nslices)             # <<<<<<<<<<<<<<
14350  *
14351  *     return have_slices or nslices, tuple(result)
14352  */
14353     __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 696, __pyx_L1_error)
14354     __Pyx_GOTREF(__pyx_t_3);
14355     { Py_ssize_t __pyx_temp;
14356       for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
14357         __Pyx_INCREF(__pyx_slice__17);
14358         __Pyx_GIVEREF(__pyx_slice__17);
14359         PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__17);
14360       }
14361     }
14362     __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 696, __pyx_L1_error)
14363     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14364 
14365     /* "View.MemoryView":695
14366  *
14367  *     nslices = ndim - len(result)
14368  *     if nslices:             # <<<<<<<<<<<<<<
14369  *         result.extend([slice(None)] * nslices)
14370  *
14371  */
14372   }
14373 
14374   /* "View.MemoryView":698
14375  *         result.extend([slice(None)] * nslices)
14376  *
14377  *     return have_slices or nslices, tuple(result)             # <<<<<<<<<<<<<<
14378  *
14379  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
14380  */
14381   __Pyx_XDECREF(__pyx_r);
14382   if (!__pyx_v_have_slices) {
14383   } else {
14384     __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
14385     __Pyx_GOTREF(__pyx_t_4);
14386     __pyx_t_3 = __pyx_t_4;
14387     __pyx_t_4 = 0;
14388     goto __pyx_L14_bool_binop_done;
14389   }
14390   __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
14391   __Pyx_GOTREF(__pyx_t_4);
14392   __pyx_t_3 = __pyx_t_4;
14393   __pyx_t_4 = 0;
14394   __pyx_L14_bool_binop_done:;
14395   __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
14396   __Pyx_GOTREF(__pyx_t_4);
14397   __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 698, __pyx_L1_error)
14398   __Pyx_GOTREF(__pyx_t_11);
14399   __Pyx_GIVEREF(__pyx_t_3);
14400   PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
14401   __Pyx_GIVEREF(__pyx_t_4);
14402   PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
14403   __pyx_t_3 = 0;
14404   __pyx_t_4 = 0;
14405   __pyx_r = ((PyObject*)__pyx_t_11);
14406   __pyx_t_11 = 0;
14407   goto __pyx_L0;
14408 
14409   /* "View.MemoryView":666
14410  *     return isinstance(o, memoryview)
14411  *
14412  * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
14413  *     """
14414  *     Replace all ellipses with full slices and fill incomplete indices with
14415  */
14416 
14417   /* function exit code */
14418   __pyx_L1_error:;
14419   __Pyx_XDECREF(__pyx_t_3);
14420   __Pyx_XDECREF(__pyx_t_4);
14421   __Pyx_XDECREF(__pyx_t_7);
14422   __Pyx_XDECREF(__pyx_t_11);
14423   __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
14424   __pyx_r = 0;
14425   __pyx_L0:;
14426   __Pyx_XDECREF(__pyx_v_tup);
14427   __Pyx_XDECREF(__pyx_v_result);
14428   __Pyx_XDECREF(__pyx_v_idx);
14429   __Pyx_XDECREF(__pyx_v_item);
14430   __Pyx_XGIVEREF(__pyx_r);
14431   __Pyx_RefNannyFinishContext();
14432   return __pyx_r;
14433 }
14434 
14435 /* "View.MemoryView":700
14436  *     return have_slices or nslices, tuple(result)
14437  *
14438  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
14439  *     for suboffset in suboffsets[:ndim]:
14440  *         if suboffset >= 0:
14441  */
14442 
assert_direct_dimensions(Py_ssize_t * __pyx_v_suboffsets,int __pyx_v_ndim)14443 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
14444   Py_ssize_t __pyx_v_suboffset;
14445   PyObject *__pyx_r = NULL;
14446   __Pyx_RefNannyDeclarations
14447   Py_ssize_t *__pyx_t_1;
14448   Py_ssize_t *__pyx_t_2;
14449   Py_ssize_t *__pyx_t_3;
14450   int __pyx_t_4;
14451   PyObject *__pyx_t_5 = NULL;
14452   int __pyx_lineno = 0;
14453   const char *__pyx_filename = NULL;
14454   int __pyx_clineno = 0;
14455   __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);
14456 
14457   /* "View.MemoryView":701
14458  *
14459  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
14460  *     for suboffset in suboffsets[:ndim]:             # <<<<<<<<<<<<<<
14461  *         if suboffset >= 0:
14462  *             raise ValueError("Indirect dimensions not supported")
14463  */
14464   __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
14465   for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
14466     __pyx_t_1 = __pyx_t_3;
14467     __pyx_v_suboffset = (__pyx_t_1[0]);
14468 
14469     /* "View.MemoryView":702
14470  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
14471  *     for suboffset in suboffsets[:ndim]:
14472  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
14473  *             raise ValueError("Indirect dimensions not supported")
14474  *
14475  */
14476     __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
14477     if (unlikely(__pyx_t_4)) {
14478 
14479       /* "View.MemoryView":703
14480  *     for suboffset in suboffsets[:ndim]:
14481  *         if suboffset >= 0:
14482  *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
14483  *
14484  *
14485  */
14486       __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 703, __pyx_L1_error)
14487       __Pyx_GOTREF(__pyx_t_5);
14488       __Pyx_Raise(__pyx_t_5, 0, 0, 0);
14489       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14490       __PYX_ERR(1, 703, __pyx_L1_error)
14491 
14492       /* "View.MemoryView":702
14493  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
14494  *     for suboffset in suboffsets[:ndim]:
14495  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
14496  *             raise ValueError("Indirect dimensions not supported")
14497  *
14498  */
14499     }
14500   }
14501 
14502   /* "View.MemoryView":700
14503  *     return have_slices or nslices, tuple(result)
14504  *
14505  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
14506  *     for suboffset in suboffsets[:ndim]:
14507  *         if suboffset >= 0:
14508  */
14509 
14510   /* function exit code */
14511   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14512   goto __pyx_L0;
14513   __pyx_L1_error:;
14514   __Pyx_XDECREF(__pyx_t_5);
14515   __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
14516   __pyx_r = 0;
14517   __pyx_L0:;
14518   __Pyx_XGIVEREF(__pyx_r);
14519   __Pyx_RefNannyFinishContext();
14520   return __pyx_r;
14521 }
14522 
14523 /* "View.MemoryView":710
14524  *
14525  * @cname('__pyx_memview_slice')
14526  * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
14527  *     cdef int new_ndim = 0, suboffset_dim = -1, dim
14528  *     cdef bint negative_step
14529  */
14530 
__pyx_memview_slice(struct __pyx_memoryview_obj * __pyx_v_memview,PyObject * __pyx_v_indices)14531 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
14532   int __pyx_v_new_ndim;
14533   int __pyx_v_suboffset_dim;
14534   int __pyx_v_dim;
14535   __Pyx_memviewslice __pyx_v_src;
14536   __Pyx_memviewslice __pyx_v_dst;
14537   __Pyx_memviewslice *__pyx_v_p_src;
14538   struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
14539   __Pyx_memviewslice *__pyx_v_p_dst;
14540   int *__pyx_v_p_suboffset_dim;
14541   Py_ssize_t __pyx_v_start;
14542   Py_ssize_t __pyx_v_stop;
14543   Py_ssize_t __pyx_v_step;
14544   int __pyx_v_have_start;
14545   int __pyx_v_have_stop;
14546   int __pyx_v_have_step;
14547   PyObject *__pyx_v_index = NULL;
14548   struct __pyx_memoryview_obj *__pyx_r = NULL;
14549   __Pyx_RefNannyDeclarations
14550   int __pyx_t_1;
14551   int __pyx_t_2;
14552   PyObject *__pyx_t_3 = NULL;
14553   struct __pyx_memoryview_obj *__pyx_t_4;
14554   char *__pyx_t_5;
14555   int __pyx_t_6;
14556   Py_ssize_t __pyx_t_7;
14557   PyObject *(*__pyx_t_8)(PyObject *);
14558   PyObject *__pyx_t_9 = NULL;
14559   Py_ssize_t __pyx_t_10;
14560   int __pyx_t_11;
14561   Py_ssize_t __pyx_t_12;
14562   int __pyx_lineno = 0;
14563   const char *__pyx_filename = NULL;
14564   int __pyx_clineno = 0;
14565   __Pyx_RefNannySetupContext("memview_slice", 0);
14566 
14567   /* "View.MemoryView":711
14568  * @cname('__pyx_memview_slice')
14569  * cdef memoryview memview_slice(memoryview memview, object indices):
14570  *     cdef int new_ndim = 0, suboffset_dim = -1, dim             # <<<<<<<<<<<<<<
14571  *     cdef bint negative_step
14572  *     cdef __Pyx_memviewslice src, dst
14573  */
14574   __pyx_v_new_ndim = 0;
14575   __pyx_v_suboffset_dim = -1;
14576 
14577   /* "View.MemoryView":718
14578  *
14579  *
14580  *     memset(&dst, 0, sizeof(dst))             # <<<<<<<<<<<<<<
14581  *
14582  *     cdef _memoryviewslice memviewsliceobj
14583  */
14584   (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));
14585 
14586   /* "View.MemoryView":722
14587  *     cdef _memoryviewslice memviewsliceobj
14588  *
14589  *     assert memview.view.ndim > 0             # <<<<<<<<<<<<<<
14590  *
14591  *     if isinstance(memview, _memoryviewslice):
14592  */
14593   #ifndef CYTHON_WITHOUT_ASSERTIONS
14594   if (unlikely(!Py_OptimizeFlag)) {
14595     if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
14596       PyErr_SetNone(PyExc_AssertionError);
14597       __PYX_ERR(1, 722, __pyx_L1_error)
14598     }
14599   }
14600   #endif
14601 
14602   /* "View.MemoryView":724
14603  *     assert memview.view.ndim > 0
14604  *
14605  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
14606  *         memviewsliceobj = memview
14607  *         p_src = &memviewsliceobj.from_slice
14608  */
14609   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
14610   __pyx_t_2 = (__pyx_t_1 != 0);
14611   if (__pyx_t_2) {
14612 
14613     /* "View.MemoryView":725
14614  *
14615  *     if isinstance(memview, _memoryviewslice):
14616  *         memviewsliceobj = memview             # <<<<<<<<<<<<<<
14617  *         p_src = &memviewsliceobj.from_slice
14618  *     else:
14619  */
14620     if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 725, __pyx_L1_error)
14621     __pyx_t_3 = ((PyObject *)__pyx_v_memview);
14622     __Pyx_INCREF(__pyx_t_3);
14623     __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
14624     __pyx_t_3 = 0;
14625 
14626     /* "View.MemoryView":726
14627  *     if isinstance(memview, _memoryviewslice):
14628  *         memviewsliceobj = memview
14629  *         p_src = &memviewsliceobj.from_slice             # <<<<<<<<<<<<<<
14630  *     else:
14631  *         slice_copy(memview, &src)
14632  */
14633     __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
14634 
14635     /* "View.MemoryView":724
14636  *     assert memview.view.ndim > 0
14637  *
14638  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
14639  *         memviewsliceobj = memview
14640  *         p_src = &memviewsliceobj.from_slice
14641  */
14642     goto __pyx_L3;
14643   }
14644 
14645   /* "View.MemoryView":728
14646  *         p_src = &memviewsliceobj.from_slice
14647  *     else:
14648  *         slice_copy(memview, &src)             # <<<<<<<<<<<<<<
14649  *         p_src = &src
14650  *
14651  */
14652   /*else*/ {
14653     __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
14654 
14655     /* "View.MemoryView":729
14656  *     else:
14657  *         slice_copy(memview, &src)
14658  *         p_src = &src             # <<<<<<<<<<<<<<
14659  *
14660  *
14661  */
14662     __pyx_v_p_src = (&__pyx_v_src);
14663   }
14664   __pyx_L3:;
14665 
14666   /* "View.MemoryView":735
14667  *
14668  *
14669  *     dst.memview = p_src.memview             # <<<<<<<<<<<<<<
14670  *     dst.data = p_src.data
14671  *
14672  */
14673   __pyx_t_4 = __pyx_v_p_src->memview;
14674   __pyx_v_dst.memview = __pyx_t_4;
14675 
14676   /* "View.MemoryView":736
14677  *
14678  *     dst.memview = p_src.memview
14679  *     dst.data = p_src.data             # <<<<<<<<<<<<<<
14680  *
14681  *
14682  */
14683   __pyx_t_5 = __pyx_v_p_src->data;
14684   __pyx_v_dst.data = __pyx_t_5;
14685 
14686   /* "View.MemoryView":741
14687  *
14688  *
14689  *     cdef __Pyx_memviewslice *p_dst = &dst             # <<<<<<<<<<<<<<
14690  *     cdef int *p_suboffset_dim = &suboffset_dim
14691  *     cdef Py_ssize_t start, stop, step
14692  */
14693   __pyx_v_p_dst = (&__pyx_v_dst);
14694 
14695   /* "View.MemoryView":742
14696  *
14697  *     cdef __Pyx_memviewslice *p_dst = &dst
14698  *     cdef int *p_suboffset_dim = &suboffset_dim             # <<<<<<<<<<<<<<
14699  *     cdef Py_ssize_t start, stop, step
14700  *     cdef bint have_start, have_stop, have_step
14701  */
14702   __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
14703 
14704   /* "View.MemoryView":746
14705  *     cdef bint have_start, have_stop, have_step
14706  *
14707  *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
14708  *         if PyIndex_Check(index):
14709  *             slice_memviewslice(
14710  */
14711   __pyx_t_6 = 0;
14712   if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
14713     __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
14714     __pyx_t_8 = NULL;
14715   } else {
14716     __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 746, __pyx_L1_error)
14717     __Pyx_GOTREF(__pyx_t_3);
14718     __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 746, __pyx_L1_error)
14719   }
14720   for (;;) {
14721     if (likely(!__pyx_t_8)) {
14722       if (likely(PyList_CheckExact(__pyx_t_3))) {
14723         if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
14724         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14725         __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(1, 746, __pyx_L1_error)
14726         #else
14727         __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 746, __pyx_L1_error)
14728         __Pyx_GOTREF(__pyx_t_9);
14729         #endif
14730       } else {
14731         if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
14732         #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14733         __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(1, 746, __pyx_L1_error)
14734         #else
14735         __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 746, __pyx_L1_error)
14736         __Pyx_GOTREF(__pyx_t_9);
14737         #endif
14738       }
14739     } else {
14740       __pyx_t_9 = __pyx_t_8(__pyx_t_3);
14741       if (unlikely(!__pyx_t_9)) {
14742         PyObject* exc_type = PyErr_Occurred();
14743         if (exc_type) {
14744           if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
14745           else __PYX_ERR(1, 746, __pyx_L1_error)
14746         }
14747         break;
14748       }
14749       __Pyx_GOTREF(__pyx_t_9);
14750     }
14751     __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
14752     __pyx_t_9 = 0;
14753     __pyx_v_dim = __pyx_t_6;
14754     __pyx_t_6 = (__pyx_t_6 + 1);
14755 
14756     /* "View.MemoryView":747
14757  *
14758  *     for dim, index in enumerate(indices):
14759  *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
14760  *             slice_memviewslice(
14761  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
14762  */
14763     __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
14764     if (__pyx_t_2) {
14765 
14766       /* "View.MemoryView":751
14767  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
14768  *                 dim, new_ndim, p_suboffset_dim,
14769  *                 index, 0, 0, # start, stop, step             # <<<<<<<<<<<<<<
14770  *                 0, 0, 0, # have_{start,stop,step}
14771  *                 False)
14772  */
14773       __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 751, __pyx_L1_error)
14774 
14775       /* "View.MemoryView":748
14776  *     for dim, index in enumerate(indices):
14777  *         if PyIndex_Check(index):
14778  *             slice_memviewslice(             # <<<<<<<<<<<<<<
14779  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
14780  *                 dim, new_ndim, p_suboffset_dim,
14781  */
14782       __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(1, 748, __pyx_L1_error)
14783 
14784       /* "View.MemoryView":747
14785  *
14786  *     for dim, index in enumerate(indices):
14787  *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
14788  *             slice_memviewslice(
14789  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
14790  */
14791       goto __pyx_L6;
14792     }
14793 
14794     /* "View.MemoryView":754
14795  *                 0, 0, 0, # have_{start,stop,step}
14796  *                 False)
14797  *         elif index is None:             # <<<<<<<<<<<<<<
14798  *             p_dst.shape[new_ndim] = 1
14799  *             p_dst.strides[new_ndim] = 0
14800  */
14801     __pyx_t_2 = (__pyx_v_index == Py_None);
14802     __pyx_t_1 = (__pyx_t_2 != 0);
14803     if (__pyx_t_1) {
14804 
14805       /* "View.MemoryView":755
14806  *                 False)
14807  *         elif index is None:
14808  *             p_dst.shape[new_ndim] = 1             # <<<<<<<<<<<<<<
14809  *             p_dst.strides[new_ndim] = 0
14810  *             p_dst.suboffsets[new_ndim] = -1
14811  */
14812       (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
14813 
14814       /* "View.MemoryView":756
14815  *         elif index is None:
14816  *             p_dst.shape[new_ndim] = 1
14817  *             p_dst.strides[new_ndim] = 0             # <<<<<<<<<<<<<<
14818  *             p_dst.suboffsets[new_ndim] = -1
14819  *             new_ndim += 1
14820  */
14821       (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
14822 
14823       /* "View.MemoryView":757
14824  *             p_dst.shape[new_ndim] = 1
14825  *             p_dst.strides[new_ndim] = 0
14826  *             p_dst.suboffsets[new_ndim] = -1             # <<<<<<<<<<<<<<
14827  *             new_ndim += 1
14828  *         else:
14829  */
14830       (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
14831 
14832       /* "View.MemoryView":758
14833  *             p_dst.strides[new_ndim] = 0
14834  *             p_dst.suboffsets[new_ndim] = -1
14835  *             new_ndim += 1             # <<<<<<<<<<<<<<
14836  *         else:
14837  *             start = index.start or 0
14838  */
14839       __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
14840 
14841       /* "View.MemoryView":754
14842  *                 0, 0, 0, # have_{start,stop,step}
14843  *                 False)
14844  *         elif index is None:             # <<<<<<<<<<<<<<
14845  *             p_dst.shape[new_ndim] = 1
14846  *             p_dst.strides[new_ndim] = 0
14847  */
14848       goto __pyx_L6;
14849     }
14850 
14851     /* "View.MemoryView":760
14852  *             new_ndim += 1
14853  *         else:
14854  *             start = index.start or 0             # <<<<<<<<<<<<<<
14855  *             stop = index.stop or 0
14856  *             step = index.step or 0
14857  */
14858     /*else*/ {
14859       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 760, __pyx_L1_error)
14860       __Pyx_GOTREF(__pyx_t_9);
14861       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 760, __pyx_L1_error)
14862       if (!__pyx_t_1) {
14863         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14864       } else {
14865         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 760, __pyx_L1_error)
14866         __pyx_t_10 = __pyx_t_12;
14867         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14868         goto __pyx_L7_bool_binop_done;
14869       }
14870       __pyx_t_10 = 0;
14871       __pyx_L7_bool_binop_done:;
14872       __pyx_v_start = __pyx_t_10;
14873 
14874       /* "View.MemoryView":761
14875  *         else:
14876  *             start = index.start or 0
14877  *             stop = index.stop or 0             # <<<<<<<<<<<<<<
14878  *             step = index.step or 0
14879  *
14880  */
14881       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 761, __pyx_L1_error)
14882       __Pyx_GOTREF(__pyx_t_9);
14883       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 761, __pyx_L1_error)
14884       if (!__pyx_t_1) {
14885         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14886       } else {
14887         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 761, __pyx_L1_error)
14888         __pyx_t_10 = __pyx_t_12;
14889         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14890         goto __pyx_L9_bool_binop_done;
14891       }
14892       __pyx_t_10 = 0;
14893       __pyx_L9_bool_binop_done:;
14894       __pyx_v_stop = __pyx_t_10;
14895 
14896       /* "View.MemoryView":762
14897  *             start = index.start or 0
14898  *             stop = index.stop or 0
14899  *             step = index.step or 0             # <<<<<<<<<<<<<<
14900  *
14901  *             have_start = index.start is not None
14902  */
14903       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 762, __pyx_L1_error)
14904       __Pyx_GOTREF(__pyx_t_9);
14905       __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 762, __pyx_L1_error)
14906       if (!__pyx_t_1) {
14907         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14908       } else {
14909         __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 762, __pyx_L1_error)
14910         __pyx_t_10 = __pyx_t_12;
14911         __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14912         goto __pyx_L11_bool_binop_done;
14913       }
14914       __pyx_t_10 = 0;
14915       __pyx_L11_bool_binop_done:;
14916       __pyx_v_step = __pyx_t_10;
14917 
14918       /* "View.MemoryView":764
14919  *             step = index.step or 0
14920  *
14921  *             have_start = index.start is not None             # <<<<<<<<<<<<<<
14922  *             have_stop = index.stop is not None
14923  *             have_step = index.step is not None
14924  */
14925       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 764, __pyx_L1_error)
14926       __Pyx_GOTREF(__pyx_t_9);
14927       __pyx_t_1 = (__pyx_t_9 != Py_None);
14928       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14929       __pyx_v_have_start = __pyx_t_1;
14930 
14931       /* "View.MemoryView":765
14932  *
14933  *             have_start = index.start is not None
14934  *             have_stop = index.stop is not None             # <<<<<<<<<<<<<<
14935  *             have_step = index.step is not None
14936  *
14937  */
14938       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 765, __pyx_L1_error)
14939       __Pyx_GOTREF(__pyx_t_9);
14940       __pyx_t_1 = (__pyx_t_9 != Py_None);
14941       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14942       __pyx_v_have_stop = __pyx_t_1;
14943 
14944       /* "View.MemoryView":766
14945  *             have_start = index.start is not None
14946  *             have_stop = index.stop is not None
14947  *             have_step = index.step is not None             # <<<<<<<<<<<<<<
14948  *
14949  *             slice_memviewslice(
14950  */
14951       __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 766, __pyx_L1_error)
14952       __Pyx_GOTREF(__pyx_t_9);
14953       __pyx_t_1 = (__pyx_t_9 != Py_None);
14954       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14955       __pyx_v_have_step = __pyx_t_1;
14956 
14957       /* "View.MemoryView":768
14958  *             have_step = index.step is not None
14959  *
14960  *             slice_memviewslice(             # <<<<<<<<<<<<<<
14961  *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
14962  *                 dim, new_ndim, p_suboffset_dim,
14963  */
14964       __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(1, 768, __pyx_L1_error)
14965 
14966       /* "View.MemoryView":774
14967  *                 have_start, have_stop, have_step,
14968  *                 True)
14969  *             new_ndim += 1             # <<<<<<<<<<<<<<
14970  *
14971  *     if isinstance(memview, _memoryviewslice):
14972  */
14973       __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
14974     }
14975     __pyx_L6:;
14976 
14977     /* "View.MemoryView":746
14978  *     cdef bint have_start, have_stop, have_step
14979  *
14980  *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
14981  *         if PyIndex_Check(index):
14982  *             slice_memviewslice(
14983  */
14984   }
14985   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14986 
14987   /* "View.MemoryView":776
14988  *             new_ndim += 1
14989  *
14990  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
14991  *         return memoryview_fromslice(dst, new_ndim,
14992  *                                     memviewsliceobj.to_object_func,
14993  */
14994   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
14995   __pyx_t_2 = (__pyx_t_1 != 0);
14996   if (__pyx_t_2) {
14997 
14998     /* "View.MemoryView":777
14999  *
15000  *     if isinstance(memview, _memoryviewslice):
15001  *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
15002  *                                     memviewsliceobj.to_object_func,
15003  *                                     memviewsliceobj.to_dtype_func,
15004  */
15005     __Pyx_XDECREF(((PyObject *)__pyx_r));
15006 
15007     /* "View.MemoryView":778
15008  *     if isinstance(memview, _memoryviewslice):
15009  *         return memoryview_fromslice(dst, new_ndim,
15010  *                                     memviewsliceobj.to_object_func,             # <<<<<<<<<<<<<<
15011  *                                     memviewsliceobj.to_dtype_func,
15012  *                                     memview.dtype_is_object)
15013  */
15014     if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 778, __pyx_L1_error) }
15015 
15016     /* "View.MemoryView":779
15017  *         return memoryview_fromslice(dst, new_ndim,
15018  *                                     memviewsliceobj.to_object_func,
15019  *                                     memviewsliceobj.to_dtype_func,             # <<<<<<<<<<<<<<
15020  *                                     memview.dtype_is_object)
15021  *     else:
15022  */
15023     if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 779, __pyx_L1_error) }
15024 
15025     /* "View.MemoryView":777
15026  *
15027  *     if isinstance(memview, _memoryviewslice):
15028  *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
15029  *                                     memviewsliceobj.to_object_func,
15030  *                                     memviewsliceobj.to_dtype_func,
15031  */
15032     __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 777, __pyx_L1_error)
15033     __Pyx_GOTREF(__pyx_t_3);
15034     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 777, __pyx_L1_error)
15035     __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
15036     __pyx_t_3 = 0;
15037     goto __pyx_L0;
15038 
15039     /* "View.MemoryView":776
15040  *             new_ndim += 1
15041  *
15042  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
15043  *         return memoryview_fromslice(dst, new_ndim,
15044  *                                     memviewsliceobj.to_object_func,
15045  */
15046   }
15047 
15048   /* "View.MemoryView":782
15049  *                                     memview.dtype_is_object)
15050  *     else:
15051  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
15052  *                                     memview.dtype_is_object)
15053  *
15054  */
15055   /*else*/ {
15056     __Pyx_XDECREF(((PyObject *)__pyx_r));
15057 
15058     /* "View.MemoryView":783
15059  *     else:
15060  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
15061  *                                     memview.dtype_is_object)             # <<<<<<<<<<<<<<
15062  *
15063  *
15064  */
15065     __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 782, __pyx_L1_error)
15066     __Pyx_GOTREF(__pyx_t_3);
15067 
15068     /* "View.MemoryView":782
15069  *                                     memview.dtype_is_object)
15070  *     else:
15071  *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
15072  *                                     memview.dtype_is_object)
15073  *
15074  */
15075     if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 782, __pyx_L1_error)
15076     __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
15077     __pyx_t_3 = 0;
15078     goto __pyx_L0;
15079   }
15080 
15081   /* "View.MemoryView":710
15082  *
15083  * @cname('__pyx_memview_slice')
15084  * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
15085  *     cdef int new_ndim = 0, suboffset_dim = -1, dim
15086  *     cdef bint negative_step
15087  */
15088 
15089   /* function exit code */
15090   __pyx_L1_error:;
15091   __Pyx_XDECREF(__pyx_t_3);
15092   __Pyx_XDECREF(__pyx_t_9);
15093   __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
15094   __pyx_r = 0;
15095   __pyx_L0:;
15096   __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
15097   __Pyx_XDECREF(__pyx_v_index);
15098   __Pyx_XGIVEREF((PyObject *)__pyx_r);
15099   __Pyx_RefNannyFinishContext();
15100   return __pyx_r;
15101 }
15102 
15103 /* "View.MemoryView":807
15104  *
15105  * @cname('__pyx_memoryview_slice_memviewslice')
15106  * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
15107  *         __Pyx_memviewslice *dst,
15108  *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
15109  */
15110 
__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)15111 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) {
15112   Py_ssize_t __pyx_v_new_shape;
15113   int __pyx_v_negative_step;
15114   int __pyx_r;
15115   int __pyx_t_1;
15116   int __pyx_t_2;
15117   int __pyx_t_3;
15118   int __pyx_lineno = 0;
15119   const char *__pyx_filename = NULL;
15120   int __pyx_clineno = 0;
15121 
15122   /* "View.MemoryView":827
15123  *     cdef bint negative_step
15124  *
15125  *     if not is_slice:             # <<<<<<<<<<<<<<
15126  *
15127  *         if start < 0:
15128  */
15129   __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
15130   if (__pyx_t_1) {
15131 
15132     /* "View.MemoryView":829
15133  *     if not is_slice:
15134  *
15135  *         if start < 0:             # <<<<<<<<<<<<<<
15136  *             start += shape
15137  *         if not 0 <= start < shape:
15138  */
15139     __pyx_t_1 = ((__pyx_v_start < 0) != 0);
15140     if (__pyx_t_1) {
15141 
15142       /* "View.MemoryView":830
15143  *
15144  *         if start < 0:
15145  *             start += shape             # <<<<<<<<<<<<<<
15146  *         if not 0 <= start < shape:
15147  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
15148  */
15149       __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
15150 
15151       /* "View.MemoryView":829
15152  *     if not is_slice:
15153  *
15154  *         if start < 0:             # <<<<<<<<<<<<<<
15155  *             start += shape
15156  *         if not 0 <= start < shape:
15157  */
15158     }
15159 
15160     /* "View.MemoryView":831
15161  *         if start < 0:
15162  *             start += shape
15163  *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
15164  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
15165  *     else:
15166  */
15167     __pyx_t_1 = (0 <= __pyx_v_start);
15168     if (__pyx_t_1) {
15169       __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
15170     }
15171     __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
15172     if (__pyx_t_2) {
15173 
15174       /* "View.MemoryView":832
15175  *             start += shape
15176  *         if not 0 <= start < shape:
15177  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)             # <<<<<<<<<<<<<<
15178  *     else:
15179  *
15180  */
15181       __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 832, __pyx_L1_error)
15182 
15183       /* "View.MemoryView":831
15184  *         if start < 0:
15185  *             start += shape
15186  *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
15187  *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
15188  *     else:
15189  */
15190     }
15191 
15192     /* "View.MemoryView":827
15193  *     cdef bint negative_step
15194  *
15195  *     if not is_slice:             # <<<<<<<<<<<<<<
15196  *
15197  *         if start < 0:
15198  */
15199     goto __pyx_L3;
15200   }
15201 
15202   /* "View.MemoryView":835
15203  *     else:
15204  *
15205  *         negative_step = have_step != 0 and step < 0             # <<<<<<<<<<<<<<
15206  *
15207  *         if have_step and step == 0:
15208  */
15209   /*else*/ {
15210     __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
15211     if (__pyx_t_1) {
15212     } else {
15213       __pyx_t_2 = __pyx_t_1;
15214       goto __pyx_L6_bool_binop_done;
15215     }
15216     __pyx_t_1 = ((__pyx_v_step < 0) != 0);
15217     __pyx_t_2 = __pyx_t_1;
15218     __pyx_L6_bool_binop_done:;
15219     __pyx_v_negative_step = __pyx_t_2;
15220 
15221     /* "View.MemoryView":837
15222  *         negative_step = have_step != 0 and step < 0
15223  *
15224  *         if have_step and step == 0:             # <<<<<<<<<<<<<<
15225  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
15226  *
15227  */
15228     __pyx_t_1 = (__pyx_v_have_step != 0);
15229     if (__pyx_t_1) {
15230     } else {
15231       __pyx_t_2 = __pyx_t_1;
15232       goto __pyx_L9_bool_binop_done;
15233     }
15234     __pyx_t_1 = ((__pyx_v_step == 0) != 0);
15235     __pyx_t_2 = __pyx_t_1;
15236     __pyx_L9_bool_binop_done:;
15237     if (__pyx_t_2) {
15238 
15239       /* "View.MemoryView":838
15240  *
15241  *         if have_step and step == 0:
15242  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)             # <<<<<<<<<<<<<<
15243  *
15244  *
15245  */
15246       __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 838, __pyx_L1_error)
15247 
15248       /* "View.MemoryView":837
15249  *         negative_step = have_step != 0 and step < 0
15250  *
15251  *         if have_step and step == 0:             # <<<<<<<<<<<<<<
15252  *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
15253  *
15254  */
15255     }
15256 
15257     /* "View.MemoryView":841
15258  *
15259  *
15260  *         if have_start:             # <<<<<<<<<<<<<<
15261  *             if start < 0:
15262  *                 start += shape
15263  */
15264     __pyx_t_2 = (__pyx_v_have_start != 0);
15265     if (__pyx_t_2) {
15266 
15267       /* "View.MemoryView":842
15268  *
15269  *         if have_start:
15270  *             if start < 0:             # <<<<<<<<<<<<<<
15271  *                 start += shape
15272  *                 if start < 0:
15273  */
15274       __pyx_t_2 = ((__pyx_v_start < 0) != 0);
15275       if (__pyx_t_2) {
15276 
15277         /* "View.MemoryView":843
15278  *         if have_start:
15279  *             if start < 0:
15280  *                 start += shape             # <<<<<<<<<<<<<<
15281  *                 if start < 0:
15282  *                     start = 0
15283  */
15284         __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
15285 
15286         /* "View.MemoryView":844
15287  *             if start < 0:
15288  *                 start += shape
15289  *                 if start < 0:             # <<<<<<<<<<<<<<
15290  *                     start = 0
15291  *             elif start >= shape:
15292  */
15293         __pyx_t_2 = ((__pyx_v_start < 0) != 0);
15294         if (__pyx_t_2) {
15295 
15296           /* "View.MemoryView":845
15297  *                 start += shape
15298  *                 if start < 0:
15299  *                     start = 0             # <<<<<<<<<<<<<<
15300  *             elif start >= shape:
15301  *                 if negative_step:
15302  */
15303           __pyx_v_start = 0;
15304 
15305           /* "View.MemoryView":844
15306  *             if start < 0:
15307  *                 start += shape
15308  *                 if start < 0:             # <<<<<<<<<<<<<<
15309  *                     start = 0
15310  *             elif start >= shape:
15311  */
15312         }
15313 
15314         /* "View.MemoryView":842
15315  *
15316  *         if have_start:
15317  *             if start < 0:             # <<<<<<<<<<<<<<
15318  *                 start += shape
15319  *                 if start < 0:
15320  */
15321         goto __pyx_L12;
15322       }
15323 
15324       /* "View.MemoryView":846
15325  *                 if start < 0:
15326  *                     start = 0
15327  *             elif start >= shape:             # <<<<<<<<<<<<<<
15328  *                 if negative_step:
15329  *                     start = shape - 1
15330  */
15331       __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
15332       if (__pyx_t_2) {
15333 
15334         /* "View.MemoryView":847
15335  *                     start = 0
15336  *             elif start >= shape:
15337  *                 if negative_step:             # <<<<<<<<<<<<<<
15338  *                     start = shape - 1
15339  *                 else:
15340  */
15341         __pyx_t_2 = (__pyx_v_negative_step != 0);
15342         if (__pyx_t_2) {
15343 
15344           /* "View.MemoryView":848
15345  *             elif start >= shape:
15346  *                 if negative_step:
15347  *                     start = shape - 1             # <<<<<<<<<<<<<<
15348  *                 else:
15349  *                     start = shape
15350  */
15351           __pyx_v_start = (__pyx_v_shape - 1);
15352 
15353           /* "View.MemoryView":847
15354  *                     start = 0
15355  *             elif start >= shape:
15356  *                 if negative_step:             # <<<<<<<<<<<<<<
15357  *                     start = shape - 1
15358  *                 else:
15359  */
15360           goto __pyx_L14;
15361         }
15362 
15363         /* "View.MemoryView":850
15364  *                     start = shape - 1
15365  *                 else:
15366  *                     start = shape             # <<<<<<<<<<<<<<
15367  *         else:
15368  *             if negative_step:
15369  */
15370         /*else*/ {
15371           __pyx_v_start = __pyx_v_shape;
15372         }
15373         __pyx_L14:;
15374 
15375         /* "View.MemoryView":846
15376  *                 if start < 0:
15377  *                     start = 0
15378  *             elif start >= shape:             # <<<<<<<<<<<<<<
15379  *                 if negative_step:
15380  *                     start = shape - 1
15381  */
15382       }
15383       __pyx_L12:;
15384 
15385       /* "View.MemoryView":841
15386  *
15387  *
15388  *         if have_start:             # <<<<<<<<<<<<<<
15389  *             if start < 0:
15390  *                 start += shape
15391  */
15392       goto __pyx_L11;
15393     }
15394 
15395     /* "View.MemoryView":852
15396  *                     start = shape
15397  *         else:
15398  *             if negative_step:             # <<<<<<<<<<<<<<
15399  *                 start = shape - 1
15400  *             else:
15401  */
15402     /*else*/ {
15403       __pyx_t_2 = (__pyx_v_negative_step != 0);
15404       if (__pyx_t_2) {
15405 
15406         /* "View.MemoryView":853
15407  *         else:
15408  *             if negative_step:
15409  *                 start = shape - 1             # <<<<<<<<<<<<<<
15410  *             else:
15411  *                 start = 0
15412  */
15413         __pyx_v_start = (__pyx_v_shape - 1);
15414 
15415         /* "View.MemoryView":852
15416  *                     start = shape
15417  *         else:
15418  *             if negative_step:             # <<<<<<<<<<<<<<
15419  *                 start = shape - 1
15420  *             else:
15421  */
15422         goto __pyx_L15;
15423       }
15424 
15425       /* "View.MemoryView":855
15426  *                 start = shape - 1
15427  *             else:
15428  *                 start = 0             # <<<<<<<<<<<<<<
15429  *
15430  *         if have_stop:
15431  */
15432       /*else*/ {
15433         __pyx_v_start = 0;
15434       }
15435       __pyx_L15:;
15436     }
15437     __pyx_L11:;
15438 
15439     /* "View.MemoryView":857
15440  *                 start = 0
15441  *
15442  *         if have_stop:             # <<<<<<<<<<<<<<
15443  *             if stop < 0:
15444  *                 stop += shape
15445  */
15446     __pyx_t_2 = (__pyx_v_have_stop != 0);
15447     if (__pyx_t_2) {
15448 
15449       /* "View.MemoryView":858
15450  *
15451  *         if have_stop:
15452  *             if stop < 0:             # <<<<<<<<<<<<<<
15453  *                 stop += shape
15454  *                 if stop < 0:
15455  */
15456       __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
15457       if (__pyx_t_2) {
15458 
15459         /* "View.MemoryView":859
15460  *         if have_stop:
15461  *             if stop < 0:
15462  *                 stop += shape             # <<<<<<<<<<<<<<
15463  *                 if stop < 0:
15464  *                     stop = 0
15465  */
15466         __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
15467 
15468         /* "View.MemoryView":860
15469  *             if stop < 0:
15470  *                 stop += shape
15471  *                 if stop < 0:             # <<<<<<<<<<<<<<
15472  *                     stop = 0
15473  *             elif stop > shape:
15474  */
15475         __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
15476         if (__pyx_t_2) {
15477 
15478           /* "View.MemoryView":861
15479  *                 stop += shape
15480  *                 if stop < 0:
15481  *                     stop = 0             # <<<<<<<<<<<<<<
15482  *             elif stop > shape:
15483  *                 stop = shape
15484  */
15485           __pyx_v_stop = 0;
15486 
15487           /* "View.MemoryView":860
15488  *             if stop < 0:
15489  *                 stop += shape
15490  *                 if stop < 0:             # <<<<<<<<<<<<<<
15491  *                     stop = 0
15492  *             elif stop > shape:
15493  */
15494         }
15495 
15496         /* "View.MemoryView":858
15497  *
15498  *         if have_stop:
15499  *             if stop < 0:             # <<<<<<<<<<<<<<
15500  *                 stop += shape
15501  *                 if stop < 0:
15502  */
15503         goto __pyx_L17;
15504       }
15505 
15506       /* "View.MemoryView":862
15507  *                 if stop < 0:
15508  *                     stop = 0
15509  *             elif stop > shape:             # <<<<<<<<<<<<<<
15510  *                 stop = shape
15511  *         else:
15512  */
15513       __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
15514       if (__pyx_t_2) {
15515 
15516         /* "View.MemoryView":863
15517  *                     stop = 0
15518  *             elif stop > shape:
15519  *                 stop = shape             # <<<<<<<<<<<<<<
15520  *         else:
15521  *             if negative_step:
15522  */
15523         __pyx_v_stop = __pyx_v_shape;
15524 
15525         /* "View.MemoryView":862
15526  *                 if stop < 0:
15527  *                     stop = 0
15528  *             elif stop > shape:             # <<<<<<<<<<<<<<
15529  *                 stop = shape
15530  *         else:
15531  */
15532       }
15533       __pyx_L17:;
15534 
15535       /* "View.MemoryView":857
15536  *                 start = 0
15537  *
15538  *         if have_stop:             # <<<<<<<<<<<<<<
15539  *             if stop < 0:
15540  *                 stop += shape
15541  */
15542       goto __pyx_L16;
15543     }
15544 
15545     /* "View.MemoryView":865
15546  *                 stop = shape
15547  *         else:
15548  *             if negative_step:             # <<<<<<<<<<<<<<
15549  *                 stop = -1
15550  *             else:
15551  */
15552     /*else*/ {
15553       __pyx_t_2 = (__pyx_v_negative_step != 0);
15554       if (__pyx_t_2) {
15555 
15556         /* "View.MemoryView":866
15557  *         else:
15558  *             if negative_step:
15559  *                 stop = -1             # <<<<<<<<<<<<<<
15560  *             else:
15561  *                 stop = shape
15562  */
15563         __pyx_v_stop = -1L;
15564 
15565         /* "View.MemoryView":865
15566  *                 stop = shape
15567  *         else:
15568  *             if negative_step:             # <<<<<<<<<<<<<<
15569  *                 stop = -1
15570  *             else:
15571  */
15572         goto __pyx_L19;
15573       }
15574 
15575       /* "View.MemoryView":868
15576  *                 stop = -1
15577  *             else:
15578  *                 stop = shape             # <<<<<<<<<<<<<<
15579  *
15580  *         if not have_step:
15581  */
15582       /*else*/ {
15583         __pyx_v_stop = __pyx_v_shape;
15584       }
15585       __pyx_L19:;
15586     }
15587     __pyx_L16:;
15588 
15589     /* "View.MemoryView":870
15590  *                 stop = shape
15591  *
15592  *         if not have_step:             # <<<<<<<<<<<<<<
15593  *             step = 1
15594  *
15595  */
15596     __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
15597     if (__pyx_t_2) {
15598 
15599       /* "View.MemoryView":871
15600  *
15601  *         if not have_step:
15602  *             step = 1             # <<<<<<<<<<<<<<
15603  *
15604  *
15605  */
15606       __pyx_v_step = 1;
15607 
15608       /* "View.MemoryView":870
15609  *                 stop = shape
15610  *
15611  *         if not have_step:             # <<<<<<<<<<<<<<
15612  *             step = 1
15613  *
15614  */
15615     }
15616 
15617     /* "View.MemoryView":875
15618  *
15619  *         with cython.cdivision(True):
15620  *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
15621  *
15622  *             if (stop - start) - step * new_shape:
15623  */
15624     __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
15625 
15626     /* "View.MemoryView":877
15627  *             new_shape = (stop - start) // step
15628  *
15629  *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
15630  *                 new_shape += 1
15631  *
15632  */
15633     __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
15634     if (__pyx_t_2) {
15635 
15636       /* "View.MemoryView":878
15637  *
15638  *             if (stop - start) - step * new_shape:
15639  *                 new_shape += 1             # <<<<<<<<<<<<<<
15640  *
15641  *         if new_shape < 0:
15642  */
15643       __pyx_v_new_shape = (__pyx_v_new_shape + 1);
15644 
15645       /* "View.MemoryView":877
15646  *             new_shape = (stop - start) // step
15647  *
15648  *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
15649  *                 new_shape += 1
15650  *
15651  */
15652     }
15653 
15654     /* "View.MemoryView":880
15655  *                 new_shape += 1
15656  *
15657  *         if new_shape < 0:             # <<<<<<<<<<<<<<
15658  *             new_shape = 0
15659  *
15660  */
15661     __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
15662     if (__pyx_t_2) {
15663 
15664       /* "View.MemoryView":881
15665  *
15666  *         if new_shape < 0:
15667  *             new_shape = 0             # <<<<<<<<<<<<<<
15668  *
15669  *
15670  */
15671       __pyx_v_new_shape = 0;
15672 
15673       /* "View.MemoryView":880
15674  *                 new_shape += 1
15675  *
15676  *         if new_shape < 0:             # <<<<<<<<<<<<<<
15677  *             new_shape = 0
15678  *
15679  */
15680     }
15681 
15682     /* "View.MemoryView":884
15683  *
15684  *
15685  *         dst.strides[new_ndim] = stride * step             # <<<<<<<<<<<<<<
15686  *         dst.shape[new_ndim] = new_shape
15687  *         dst.suboffsets[new_ndim] = suboffset
15688  */
15689     (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
15690 
15691     /* "View.MemoryView":885
15692  *
15693  *         dst.strides[new_ndim] = stride * step
15694  *         dst.shape[new_ndim] = new_shape             # <<<<<<<<<<<<<<
15695  *         dst.suboffsets[new_ndim] = suboffset
15696  *
15697  */
15698     (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
15699 
15700     /* "View.MemoryView":886
15701  *         dst.strides[new_ndim] = stride * step
15702  *         dst.shape[new_ndim] = new_shape
15703  *         dst.suboffsets[new_ndim] = suboffset             # <<<<<<<<<<<<<<
15704  *
15705  *
15706  */
15707     (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
15708   }
15709   __pyx_L3:;
15710 
15711   /* "View.MemoryView":889
15712  *
15713  *
15714  *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
15715  *         dst.data += start * stride
15716  *     else:
15717  */
15718   __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
15719   if (__pyx_t_2) {
15720 
15721     /* "View.MemoryView":890
15722  *
15723  *     if suboffset_dim[0] < 0:
15724  *         dst.data += start * stride             # <<<<<<<<<<<<<<
15725  *     else:
15726  *         dst.suboffsets[suboffset_dim[0]] += start * stride
15727  */
15728     __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
15729 
15730     /* "View.MemoryView":889
15731  *
15732  *
15733  *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
15734  *         dst.data += start * stride
15735  *     else:
15736  */
15737     goto __pyx_L23;
15738   }
15739 
15740   /* "View.MemoryView":892
15741  *         dst.data += start * stride
15742  *     else:
15743  *         dst.suboffsets[suboffset_dim[0]] += start * stride             # <<<<<<<<<<<<<<
15744  *
15745  *     if suboffset >= 0:
15746  */
15747   /*else*/ {
15748     __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
15749     (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
15750   }
15751   __pyx_L23:;
15752 
15753   /* "View.MemoryView":894
15754  *         dst.suboffsets[suboffset_dim[0]] += start * stride
15755  *
15756  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
15757  *         if not is_slice:
15758  *             if new_ndim == 0:
15759  */
15760   __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
15761   if (__pyx_t_2) {
15762 
15763     /* "View.MemoryView":895
15764  *
15765  *     if suboffset >= 0:
15766  *         if not is_slice:             # <<<<<<<<<<<<<<
15767  *             if new_ndim == 0:
15768  *                 dst.data = (<char **> dst.data)[0] + suboffset
15769  */
15770     __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
15771     if (__pyx_t_2) {
15772 
15773       /* "View.MemoryView":896
15774  *     if suboffset >= 0:
15775  *         if not is_slice:
15776  *             if new_ndim == 0:             # <<<<<<<<<<<<<<
15777  *                 dst.data = (<char **> dst.data)[0] + suboffset
15778  *             else:
15779  */
15780       __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
15781       if (__pyx_t_2) {
15782 
15783         /* "View.MemoryView":897
15784  *         if not is_slice:
15785  *             if new_ndim == 0:
15786  *                 dst.data = (<char **> dst.data)[0] + suboffset             # <<<<<<<<<<<<<<
15787  *             else:
15788  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
15789  */
15790         __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
15791 
15792         /* "View.MemoryView":896
15793  *     if suboffset >= 0:
15794  *         if not is_slice:
15795  *             if new_ndim == 0:             # <<<<<<<<<<<<<<
15796  *                 dst.data = (<char **> dst.data)[0] + suboffset
15797  *             else:
15798  */
15799         goto __pyx_L26;
15800       }
15801 
15802       /* "View.MemoryView":899
15803  *                 dst.data = (<char **> dst.data)[0] + suboffset
15804  *             else:
15805  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "             # <<<<<<<<<<<<<<
15806  *                                      "must be indexed and not sliced", dim)
15807  *         else:
15808  */
15809       /*else*/ {
15810 
15811         /* "View.MemoryView":900
15812  *             else:
15813  *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
15814  *                                      "must be indexed and not sliced", dim)             # <<<<<<<<<<<<<<
15815  *         else:
15816  *             suboffset_dim[0] = new_ndim
15817  */
15818         __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 899, __pyx_L1_error)
15819       }
15820       __pyx_L26:;
15821 
15822       /* "View.MemoryView":895
15823  *
15824  *     if suboffset >= 0:
15825  *         if not is_slice:             # <<<<<<<<<<<<<<
15826  *             if new_ndim == 0:
15827  *                 dst.data = (<char **> dst.data)[0] + suboffset
15828  */
15829       goto __pyx_L25;
15830     }
15831 
15832     /* "View.MemoryView":902
15833  *                                      "must be indexed and not sliced", dim)
15834  *         else:
15835  *             suboffset_dim[0] = new_ndim             # <<<<<<<<<<<<<<
15836  *
15837  *     return 0
15838  */
15839     /*else*/ {
15840       (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
15841     }
15842     __pyx_L25:;
15843 
15844     /* "View.MemoryView":894
15845  *         dst.suboffsets[suboffset_dim[0]] += start * stride
15846  *
15847  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
15848  *         if not is_slice:
15849  *             if new_ndim == 0:
15850  */
15851   }
15852 
15853   /* "View.MemoryView":904
15854  *             suboffset_dim[0] = new_ndim
15855  *
15856  *     return 0             # <<<<<<<<<<<<<<
15857  *
15858  *
15859  */
15860   __pyx_r = 0;
15861   goto __pyx_L0;
15862 
15863   /* "View.MemoryView":807
15864  *
15865  * @cname('__pyx_memoryview_slice_memviewslice')
15866  * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
15867  *         __Pyx_memviewslice *dst,
15868  *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
15869  */
15870 
15871   /* function exit code */
15872   __pyx_L1_error:;
15873   {
15874     #ifdef WITH_THREAD
15875     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
15876     #endif
15877     __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
15878     #ifdef WITH_THREAD
15879     __Pyx_PyGILState_Release(__pyx_gilstate_save);
15880     #endif
15881   }
15882   __pyx_r = -1;
15883   __pyx_L0:;
15884   return __pyx_r;
15885 }
15886 
15887 /* "View.MemoryView":910
15888  *
15889  * @cname('__pyx_pybuffer_index')
15890  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
15891  *                           Py_ssize_t dim) except NULL:
15892  *     cdef Py_ssize_t shape, stride, suboffset = -1
15893  */
15894 
__pyx_pybuffer_index(Py_buffer * __pyx_v_view,char * __pyx_v_bufp,Py_ssize_t __pyx_v_index,Py_ssize_t __pyx_v_dim)15895 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) {
15896   Py_ssize_t __pyx_v_shape;
15897   Py_ssize_t __pyx_v_stride;
15898   Py_ssize_t __pyx_v_suboffset;
15899   Py_ssize_t __pyx_v_itemsize;
15900   char *__pyx_v_resultp;
15901   char *__pyx_r;
15902   __Pyx_RefNannyDeclarations
15903   Py_ssize_t __pyx_t_1;
15904   int __pyx_t_2;
15905   PyObject *__pyx_t_3 = NULL;
15906   PyObject *__pyx_t_4 = NULL;
15907   int __pyx_lineno = 0;
15908   const char *__pyx_filename = NULL;
15909   int __pyx_clineno = 0;
15910   __Pyx_RefNannySetupContext("pybuffer_index", 0);
15911 
15912   /* "View.MemoryView":912
15913  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
15914  *                           Py_ssize_t dim) except NULL:
15915  *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
15916  *     cdef Py_ssize_t itemsize = view.itemsize
15917  *     cdef char *resultp
15918  */
15919   __pyx_v_suboffset = -1L;
15920 
15921   /* "View.MemoryView":913
15922  *                           Py_ssize_t dim) except NULL:
15923  *     cdef Py_ssize_t shape, stride, suboffset = -1
15924  *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
15925  *     cdef char *resultp
15926  *
15927  */
15928   __pyx_t_1 = __pyx_v_view->itemsize;
15929   __pyx_v_itemsize = __pyx_t_1;
15930 
15931   /* "View.MemoryView":916
15932  *     cdef char *resultp
15933  *
15934  *     if view.ndim == 0:             # <<<<<<<<<<<<<<
15935  *         shape = view.len / itemsize
15936  *         stride = itemsize
15937  */
15938   __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
15939   if (__pyx_t_2) {
15940 
15941     /* "View.MemoryView":917
15942  *
15943  *     if view.ndim == 0:
15944  *         shape = view.len / itemsize             # <<<<<<<<<<<<<<
15945  *         stride = itemsize
15946  *     else:
15947  */
15948     if (unlikely(__pyx_v_itemsize == 0)) {
15949       PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
15950       __PYX_ERR(1, 917, __pyx_L1_error)
15951     }
15952     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))) {
15953       PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
15954       __PYX_ERR(1, 917, __pyx_L1_error)
15955     }
15956     __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
15957 
15958     /* "View.MemoryView":918
15959  *     if view.ndim == 0:
15960  *         shape = view.len / itemsize
15961  *         stride = itemsize             # <<<<<<<<<<<<<<
15962  *     else:
15963  *         shape = view.shape[dim]
15964  */
15965     __pyx_v_stride = __pyx_v_itemsize;
15966 
15967     /* "View.MemoryView":916
15968  *     cdef char *resultp
15969  *
15970  *     if view.ndim == 0:             # <<<<<<<<<<<<<<
15971  *         shape = view.len / itemsize
15972  *         stride = itemsize
15973  */
15974     goto __pyx_L3;
15975   }
15976 
15977   /* "View.MemoryView":920
15978  *         stride = itemsize
15979  *     else:
15980  *         shape = view.shape[dim]             # <<<<<<<<<<<<<<
15981  *         stride = view.strides[dim]
15982  *         if view.suboffsets != NULL:
15983  */
15984   /*else*/ {
15985     __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
15986 
15987     /* "View.MemoryView":921
15988  *     else:
15989  *         shape = view.shape[dim]
15990  *         stride = view.strides[dim]             # <<<<<<<<<<<<<<
15991  *         if view.suboffsets != NULL:
15992  *             suboffset = view.suboffsets[dim]
15993  */
15994     __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
15995 
15996     /* "View.MemoryView":922
15997  *         shape = view.shape[dim]
15998  *         stride = view.strides[dim]
15999  *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
16000  *             suboffset = view.suboffsets[dim]
16001  *
16002  */
16003     __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
16004     if (__pyx_t_2) {
16005 
16006       /* "View.MemoryView":923
16007  *         stride = view.strides[dim]
16008  *         if view.suboffsets != NULL:
16009  *             suboffset = view.suboffsets[dim]             # <<<<<<<<<<<<<<
16010  *
16011  *     if index < 0:
16012  */
16013       __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
16014 
16015       /* "View.MemoryView":922
16016  *         shape = view.shape[dim]
16017  *         stride = view.strides[dim]
16018  *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
16019  *             suboffset = view.suboffsets[dim]
16020  *
16021  */
16022     }
16023   }
16024   __pyx_L3:;
16025 
16026   /* "View.MemoryView":925
16027  *             suboffset = view.suboffsets[dim]
16028  *
16029  *     if index < 0:             # <<<<<<<<<<<<<<
16030  *         index += view.shape[dim]
16031  *         if index < 0:
16032  */
16033   __pyx_t_2 = ((__pyx_v_index < 0) != 0);
16034   if (__pyx_t_2) {
16035 
16036     /* "View.MemoryView":926
16037  *
16038  *     if index < 0:
16039  *         index += view.shape[dim]             # <<<<<<<<<<<<<<
16040  *         if index < 0:
16041  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
16042  */
16043     __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
16044 
16045     /* "View.MemoryView":927
16046  *     if index < 0:
16047  *         index += view.shape[dim]
16048  *         if index < 0:             # <<<<<<<<<<<<<<
16049  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
16050  *
16051  */
16052     __pyx_t_2 = ((__pyx_v_index < 0) != 0);
16053     if (unlikely(__pyx_t_2)) {
16054 
16055       /* "View.MemoryView":928
16056  *         index += view.shape[dim]
16057  *         if index < 0:
16058  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
16059  *
16060  *     if index >= shape:
16061  */
16062       __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 928, __pyx_L1_error)
16063       __Pyx_GOTREF(__pyx_t_3);
16064       __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 928, __pyx_L1_error)
16065       __Pyx_GOTREF(__pyx_t_4);
16066       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16067       __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 928, __pyx_L1_error)
16068       __Pyx_GOTREF(__pyx_t_3);
16069       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16070       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
16071       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16072       __PYX_ERR(1, 928, __pyx_L1_error)
16073 
16074       /* "View.MemoryView":927
16075  *     if index < 0:
16076  *         index += view.shape[dim]
16077  *         if index < 0:             # <<<<<<<<<<<<<<
16078  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
16079  *
16080  */
16081     }
16082 
16083     /* "View.MemoryView":925
16084  *             suboffset = view.suboffsets[dim]
16085  *
16086  *     if index < 0:             # <<<<<<<<<<<<<<
16087  *         index += view.shape[dim]
16088  *         if index < 0:
16089  */
16090   }
16091 
16092   /* "View.MemoryView":930
16093  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
16094  *
16095  *     if index >= shape:             # <<<<<<<<<<<<<<
16096  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
16097  *
16098  */
16099   __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
16100   if (unlikely(__pyx_t_2)) {
16101 
16102     /* "View.MemoryView":931
16103  *
16104  *     if index >= shape:
16105  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
16106  *
16107  *     resultp = bufp + index * stride
16108  */
16109     __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 931, __pyx_L1_error)
16110     __Pyx_GOTREF(__pyx_t_3);
16111     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 931, __pyx_L1_error)
16112     __Pyx_GOTREF(__pyx_t_4);
16113     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16114     __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 931, __pyx_L1_error)
16115     __Pyx_GOTREF(__pyx_t_3);
16116     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16117     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
16118     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16119     __PYX_ERR(1, 931, __pyx_L1_error)
16120 
16121     /* "View.MemoryView":930
16122  *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
16123  *
16124  *     if index >= shape:             # <<<<<<<<<<<<<<
16125  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
16126  *
16127  */
16128   }
16129 
16130   /* "View.MemoryView":933
16131  *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
16132  *
16133  *     resultp = bufp + index * stride             # <<<<<<<<<<<<<<
16134  *     if suboffset >= 0:
16135  *         resultp = (<char **> resultp)[0] + suboffset
16136  */
16137   __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
16138 
16139   /* "View.MemoryView":934
16140  *
16141  *     resultp = bufp + index * stride
16142  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
16143  *         resultp = (<char **> resultp)[0] + suboffset
16144  *
16145  */
16146   __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
16147   if (__pyx_t_2) {
16148 
16149     /* "View.MemoryView":935
16150  *     resultp = bufp + index * stride
16151  *     if suboffset >= 0:
16152  *         resultp = (<char **> resultp)[0] + suboffset             # <<<<<<<<<<<<<<
16153  *
16154  *     return resultp
16155  */
16156     __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
16157 
16158     /* "View.MemoryView":934
16159  *
16160  *     resultp = bufp + index * stride
16161  *     if suboffset >= 0:             # <<<<<<<<<<<<<<
16162  *         resultp = (<char **> resultp)[0] + suboffset
16163  *
16164  */
16165   }
16166 
16167   /* "View.MemoryView":937
16168  *         resultp = (<char **> resultp)[0] + suboffset
16169  *
16170  *     return resultp             # <<<<<<<<<<<<<<
16171  *
16172  *
16173  */
16174   __pyx_r = __pyx_v_resultp;
16175   goto __pyx_L0;
16176 
16177   /* "View.MemoryView":910
16178  *
16179  * @cname('__pyx_pybuffer_index')
16180  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
16181  *                           Py_ssize_t dim) except NULL:
16182  *     cdef Py_ssize_t shape, stride, suboffset = -1
16183  */
16184 
16185   /* function exit code */
16186   __pyx_L1_error:;
16187   __Pyx_XDECREF(__pyx_t_3);
16188   __Pyx_XDECREF(__pyx_t_4);
16189   __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
16190   __pyx_r = NULL;
16191   __pyx_L0:;
16192   __Pyx_RefNannyFinishContext();
16193   return __pyx_r;
16194 }
16195 
16196 /* "View.MemoryView":943
16197  *
16198  * @cname('__pyx_memslice_transpose')
16199  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
16200  *     cdef int ndim = memslice.memview.view.ndim
16201  *
16202  */
16203 
__pyx_memslice_transpose(__Pyx_memviewslice * __pyx_v_memslice)16204 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
16205   int __pyx_v_ndim;
16206   Py_ssize_t *__pyx_v_shape;
16207   Py_ssize_t *__pyx_v_strides;
16208   int __pyx_v_i;
16209   int __pyx_v_j;
16210   int __pyx_r;
16211   int __pyx_t_1;
16212   Py_ssize_t *__pyx_t_2;
16213   long __pyx_t_3;
16214   long __pyx_t_4;
16215   Py_ssize_t __pyx_t_5;
16216   Py_ssize_t __pyx_t_6;
16217   int __pyx_t_7;
16218   int __pyx_t_8;
16219   int __pyx_t_9;
16220   int __pyx_lineno = 0;
16221   const char *__pyx_filename = NULL;
16222   int __pyx_clineno = 0;
16223 
16224   /* "View.MemoryView":944
16225  * @cname('__pyx_memslice_transpose')
16226  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
16227  *     cdef int ndim = memslice.memview.view.ndim             # <<<<<<<<<<<<<<
16228  *
16229  *     cdef Py_ssize_t *shape = memslice.shape
16230  */
16231   __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
16232   __pyx_v_ndim = __pyx_t_1;
16233 
16234   /* "View.MemoryView":946
16235  *     cdef int ndim = memslice.memview.view.ndim
16236  *
16237  *     cdef Py_ssize_t *shape = memslice.shape             # <<<<<<<<<<<<<<
16238  *     cdef Py_ssize_t *strides = memslice.strides
16239  *
16240  */
16241   __pyx_t_2 = __pyx_v_memslice->shape;
16242   __pyx_v_shape = __pyx_t_2;
16243 
16244   /* "View.MemoryView":947
16245  *
16246  *     cdef Py_ssize_t *shape = memslice.shape
16247  *     cdef Py_ssize_t *strides = memslice.strides             # <<<<<<<<<<<<<<
16248  *
16249  *
16250  */
16251   __pyx_t_2 = __pyx_v_memslice->strides;
16252   __pyx_v_strides = __pyx_t_2;
16253 
16254   /* "View.MemoryView":951
16255  *
16256  *     cdef int i, j
16257  *     for i in range(ndim / 2):             # <<<<<<<<<<<<<<
16258  *         j = ndim - 1 - i
16259  *         strides[i], strides[j] = strides[j], strides[i]
16260  */
16261   __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
16262   __pyx_t_4 = __pyx_t_3;
16263   for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
16264     __pyx_v_i = __pyx_t_1;
16265 
16266     /* "View.MemoryView":952
16267  *     cdef int i, j
16268  *     for i in range(ndim / 2):
16269  *         j = ndim - 1 - i             # <<<<<<<<<<<<<<
16270  *         strides[i], strides[j] = strides[j], strides[i]
16271  *         shape[i], shape[j] = shape[j], shape[i]
16272  */
16273     __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
16274 
16275     /* "View.MemoryView":953
16276  *     for i in range(ndim / 2):
16277  *         j = ndim - 1 - i
16278  *         strides[i], strides[j] = strides[j], strides[i]             # <<<<<<<<<<<<<<
16279  *         shape[i], shape[j] = shape[j], shape[i]
16280  *
16281  */
16282     __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
16283     __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
16284     (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
16285     (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
16286 
16287     /* "View.MemoryView":954
16288  *         j = ndim - 1 - i
16289  *         strides[i], strides[j] = strides[j], strides[i]
16290  *         shape[i], shape[j] = shape[j], shape[i]             # <<<<<<<<<<<<<<
16291  *
16292  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
16293  */
16294     __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
16295     __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
16296     (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
16297     (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
16298 
16299     /* "View.MemoryView":956
16300  *         shape[i], shape[j] = shape[j], shape[i]
16301  *
16302  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
16303  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
16304  *
16305  */
16306     __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
16307     if (!__pyx_t_8) {
16308     } else {
16309       __pyx_t_7 = __pyx_t_8;
16310       goto __pyx_L6_bool_binop_done;
16311     }
16312     __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
16313     __pyx_t_7 = __pyx_t_8;
16314     __pyx_L6_bool_binop_done:;
16315     if (__pyx_t_7) {
16316 
16317       /* "View.MemoryView":957
16318  *
16319  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
16320  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")             # <<<<<<<<<<<<<<
16321  *
16322  *     return 1
16323  */
16324       __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 957, __pyx_L1_error)
16325 
16326       /* "View.MemoryView":956
16327  *         shape[i], shape[j] = shape[j], shape[i]
16328  *
16329  *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
16330  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
16331  *
16332  */
16333     }
16334   }
16335 
16336   /* "View.MemoryView":959
16337  *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
16338  *
16339  *     return 1             # <<<<<<<<<<<<<<
16340  *
16341  *
16342  */
16343   __pyx_r = 1;
16344   goto __pyx_L0;
16345 
16346   /* "View.MemoryView":943
16347  *
16348  * @cname('__pyx_memslice_transpose')
16349  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
16350  *     cdef int ndim = memslice.memview.view.ndim
16351  *
16352  */
16353 
16354   /* function exit code */
16355   __pyx_L1_error:;
16356   {
16357     #ifdef WITH_THREAD
16358     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16359     #endif
16360     __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
16361     #ifdef WITH_THREAD
16362     __Pyx_PyGILState_Release(__pyx_gilstate_save);
16363     #endif
16364   }
16365   __pyx_r = 0;
16366   __pyx_L0:;
16367   return __pyx_r;
16368 }
16369 
16370 /* "View.MemoryView":976
16371  *     cdef int (*to_dtype_func)(char *, object) except 0
16372  *
16373  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
16374  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
16375  *
16376  */
16377 
16378 /* Python wrapper */
16379 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_memoryviewslice___dealloc__(PyObject * __pyx_v_self)16380 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
16381   __Pyx_RefNannyDeclarations
16382   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
16383   __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
16384 
16385   /* function exit code */
16386   __Pyx_RefNannyFinishContext();
16387 }
16388 
__pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj * __pyx_v_self)16389 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
16390   __Pyx_RefNannyDeclarations
16391   __Pyx_RefNannySetupContext("__dealloc__", 0);
16392 
16393   /* "View.MemoryView":977
16394  *
16395  *     def __dealloc__(self):
16396  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)             # <<<<<<<<<<<<<<
16397  *
16398  *     cdef convert_item_to_object(self, char *itemp):
16399  */
16400   __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
16401 
16402   /* "View.MemoryView":976
16403  *     cdef int (*to_dtype_func)(char *, object) except 0
16404  *
16405  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
16406  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
16407  *
16408  */
16409 
16410   /* function exit code */
16411   __Pyx_RefNannyFinishContext();
16412 }
16413 
16414 /* "View.MemoryView":979
16415  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
16416  *
16417  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
16418  *         if self.to_object_func != NULL:
16419  *             return self.to_object_func(itemp)
16420  */
16421 
__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj * __pyx_v_self,char * __pyx_v_itemp)16422 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
16423   PyObject *__pyx_r = NULL;
16424   __Pyx_RefNannyDeclarations
16425   int __pyx_t_1;
16426   PyObject *__pyx_t_2 = NULL;
16427   int __pyx_lineno = 0;
16428   const char *__pyx_filename = NULL;
16429   int __pyx_clineno = 0;
16430   __Pyx_RefNannySetupContext("convert_item_to_object", 0);
16431 
16432   /* "View.MemoryView":980
16433  *
16434  *     cdef convert_item_to_object(self, char *itemp):
16435  *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
16436  *             return self.to_object_func(itemp)
16437  *         else:
16438  */
16439   __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
16440   if (__pyx_t_1) {
16441 
16442     /* "View.MemoryView":981
16443  *     cdef convert_item_to_object(self, char *itemp):
16444  *         if self.to_object_func != NULL:
16445  *             return self.to_object_func(itemp)             # <<<<<<<<<<<<<<
16446  *         else:
16447  *             return memoryview.convert_item_to_object(self, itemp)
16448  */
16449     __Pyx_XDECREF(__pyx_r);
16450     __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 981, __pyx_L1_error)
16451     __Pyx_GOTREF(__pyx_t_2);
16452     __pyx_r = __pyx_t_2;
16453     __pyx_t_2 = 0;
16454     goto __pyx_L0;
16455 
16456     /* "View.MemoryView":980
16457  *
16458  *     cdef convert_item_to_object(self, char *itemp):
16459  *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
16460  *             return self.to_object_func(itemp)
16461  *         else:
16462  */
16463   }
16464 
16465   /* "View.MemoryView":983
16466  *             return self.to_object_func(itemp)
16467  *         else:
16468  *             return memoryview.convert_item_to_object(self, itemp)             # <<<<<<<<<<<<<<
16469  *
16470  *     cdef assign_item_from_object(self, char *itemp, object value):
16471  */
16472   /*else*/ {
16473     __Pyx_XDECREF(__pyx_r);
16474     __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 983, __pyx_L1_error)
16475     __Pyx_GOTREF(__pyx_t_2);
16476     __pyx_r = __pyx_t_2;
16477     __pyx_t_2 = 0;
16478     goto __pyx_L0;
16479   }
16480 
16481   /* "View.MemoryView":979
16482  *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
16483  *
16484  *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
16485  *         if self.to_object_func != NULL:
16486  *             return self.to_object_func(itemp)
16487  */
16488 
16489   /* function exit code */
16490   __pyx_L1_error:;
16491   __Pyx_XDECREF(__pyx_t_2);
16492   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
16493   __pyx_r = 0;
16494   __pyx_L0:;
16495   __Pyx_XGIVEREF(__pyx_r);
16496   __Pyx_RefNannyFinishContext();
16497   return __pyx_r;
16498 }
16499 
16500 /* "View.MemoryView":985
16501  *             return memoryview.convert_item_to_object(self, itemp)
16502  *
16503  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
16504  *         if self.to_dtype_func != NULL:
16505  *             self.to_dtype_func(itemp, value)
16506  */
16507 
__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj * __pyx_v_self,char * __pyx_v_itemp,PyObject * __pyx_v_value)16508 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
16509   PyObject *__pyx_r = NULL;
16510   __Pyx_RefNannyDeclarations
16511   int __pyx_t_1;
16512   int __pyx_t_2;
16513   PyObject *__pyx_t_3 = NULL;
16514   int __pyx_lineno = 0;
16515   const char *__pyx_filename = NULL;
16516   int __pyx_clineno = 0;
16517   __Pyx_RefNannySetupContext("assign_item_from_object", 0);
16518 
16519   /* "View.MemoryView":986
16520  *
16521  *     cdef assign_item_from_object(self, char *itemp, object value):
16522  *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
16523  *             self.to_dtype_func(itemp, value)
16524  *         else:
16525  */
16526   __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
16527   if (__pyx_t_1) {
16528 
16529     /* "View.MemoryView":987
16530  *     cdef assign_item_from_object(self, char *itemp, object value):
16531  *         if self.to_dtype_func != NULL:
16532  *             self.to_dtype_func(itemp, value)             # <<<<<<<<<<<<<<
16533  *         else:
16534  *             memoryview.assign_item_from_object(self, itemp, value)
16535  */
16536     __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 987, __pyx_L1_error)
16537 
16538     /* "View.MemoryView":986
16539  *
16540  *     cdef assign_item_from_object(self, char *itemp, object value):
16541  *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
16542  *             self.to_dtype_func(itemp, value)
16543  *         else:
16544  */
16545     goto __pyx_L3;
16546   }
16547 
16548   /* "View.MemoryView":989
16549  *             self.to_dtype_func(itemp, value)
16550  *         else:
16551  *             memoryview.assign_item_from_object(self, itemp, value)             # <<<<<<<<<<<<<<
16552  *
16553  *     @property
16554  */
16555   /*else*/ {
16556     __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 989, __pyx_L1_error)
16557     __Pyx_GOTREF(__pyx_t_3);
16558     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16559   }
16560   __pyx_L3:;
16561 
16562   /* "View.MemoryView":985
16563  *             return memoryview.convert_item_to_object(self, itemp)
16564  *
16565  *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
16566  *         if self.to_dtype_func != NULL:
16567  *             self.to_dtype_func(itemp, value)
16568  */
16569 
16570   /* function exit code */
16571   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16572   goto __pyx_L0;
16573   __pyx_L1_error:;
16574   __Pyx_XDECREF(__pyx_t_3);
16575   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
16576   __pyx_r = 0;
16577   __pyx_L0:;
16578   __Pyx_XGIVEREF(__pyx_r);
16579   __Pyx_RefNannyFinishContext();
16580   return __pyx_r;
16581 }
16582 
16583 /* "View.MemoryView":992
16584  *
16585  *     @property
16586  *     def base(self):             # <<<<<<<<<<<<<<
16587  *         return self.from_object
16588  *
16589  */
16590 
16591 /* Python wrapper */
16592 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)16593 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
16594   PyObject *__pyx_r = 0;
16595   __Pyx_RefNannyDeclarations
16596   __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
16597   __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
16598 
16599   /* function exit code */
16600   __Pyx_RefNannyFinishContext();
16601   return __pyx_r;
16602 }
16603 
__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj * __pyx_v_self)16604 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
16605   PyObject *__pyx_r = NULL;
16606   __Pyx_RefNannyDeclarations
16607   __Pyx_RefNannySetupContext("__get__", 0);
16608 
16609   /* "View.MemoryView":993
16610  *     @property
16611  *     def base(self):
16612  *         return self.from_object             # <<<<<<<<<<<<<<
16613  *
16614  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
16615  */
16616   __Pyx_XDECREF(__pyx_r);
16617   __Pyx_INCREF(__pyx_v_self->from_object);
16618   __pyx_r = __pyx_v_self->from_object;
16619   goto __pyx_L0;
16620 
16621   /* "View.MemoryView":992
16622  *
16623  *     @property
16624  *     def base(self):             # <<<<<<<<<<<<<<
16625  *         return self.from_object
16626  *
16627  */
16628 
16629   /* function exit code */
16630   __pyx_L0:;
16631   __Pyx_XGIVEREF(__pyx_r);
16632   __Pyx_RefNannyFinishContext();
16633   return __pyx_r;
16634 }
16635 
16636 /* "(tree fragment)":1
16637  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
16638  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16639  * def __setstate_cython__(self, __pyx_state):
16640  */
16641 
16642 /* Python wrapper */
16643 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)16644 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
16645   PyObject *__pyx_r = 0;
16646   __Pyx_RefNannyDeclarations
16647   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
16648   __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
16649 
16650   /* function exit code */
16651   __Pyx_RefNannyFinishContext();
16652   return __pyx_r;
16653 }
16654 
__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj * __pyx_v_self)16655 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
16656   PyObject *__pyx_r = NULL;
16657   __Pyx_RefNannyDeclarations
16658   PyObject *__pyx_t_1 = NULL;
16659   int __pyx_lineno = 0;
16660   const char *__pyx_filename = NULL;
16661   int __pyx_clineno = 0;
16662   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
16663 
16664   /* "(tree fragment)":2
16665  * def __reduce_cython__(self):
16666  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
16667  * def __setstate_cython__(self, __pyx_state):
16668  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16669  */
16670   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
16671   __Pyx_GOTREF(__pyx_t_1);
16672   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16673   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16674   __PYX_ERR(1, 2, __pyx_L1_error)
16675 
16676   /* "(tree fragment)":1
16677  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
16678  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16679  * def __setstate_cython__(self, __pyx_state):
16680  */
16681 
16682   /* function exit code */
16683   __pyx_L1_error:;
16684   __Pyx_XDECREF(__pyx_t_1);
16685   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16686   __pyx_r = NULL;
16687   __Pyx_XGIVEREF(__pyx_r);
16688   __Pyx_RefNannyFinishContext();
16689   return __pyx_r;
16690 }
16691 
16692 /* "(tree fragment)":3
16693  * def __reduce_cython__(self):
16694  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16695  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
16696  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16697  */
16698 
16699 /* Python wrapper */
16700 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)16701 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
16702   PyObject *__pyx_r = 0;
16703   __Pyx_RefNannyDeclarations
16704   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
16705   __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
16706 
16707   /* function exit code */
16708   __Pyx_RefNannyFinishContext();
16709   return __pyx_r;
16710 }
16711 
__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)16712 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) {
16713   PyObject *__pyx_r = NULL;
16714   __Pyx_RefNannyDeclarations
16715   PyObject *__pyx_t_1 = NULL;
16716   int __pyx_lineno = 0;
16717   const char *__pyx_filename = NULL;
16718   int __pyx_clineno = 0;
16719   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
16720 
16721   /* "(tree fragment)":4
16722  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16723  * def __setstate_cython__(self, __pyx_state):
16724  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
16725  */
16726   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
16727   __Pyx_GOTREF(__pyx_t_1);
16728   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16729   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16730   __PYX_ERR(1, 4, __pyx_L1_error)
16731 
16732   /* "(tree fragment)":3
16733  * def __reduce_cython__(self):
16734  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16735  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
16736  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16737  */
16738 
16739   /* function exit code */
16740   __pyx_L1_error:;
16741   __Pyx_XDECREF(__pyx_t_1);
16742   __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16743   __pyx_r = NULL;
16744   __Pyx_XGIVEREF(__pyx_r);
16745   __Pyx_RefNannyFinishContext();
16746   return __pyx_r;
16747 }
16748 
16749 /* "View.MemoryView":999
16750  *
16751  * @cname('__pyx_memoryview_fromslice')
16752  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
16753  *                           int ndim,
16754  *                           object (*to_object_func)(char *),
16755  */
16756 
__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)16757 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) {
16758   struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
16759   Py_ssize_t __pyx_v_suboffset;
16760   PyObject *__pyx_v_length = NULL;
16761   PyObject *__pyx_r = NULL;
16762   __Pyx_RefNannyDeclarations
16763   int __pyx_t_1;
16764   PyObject *__pyx_t_2 = NULL;
16765   PyObject *__pyx_t_3 = NULL;
16766   __Pyx_TypeInfo *__pyx_t_4;
16767   Py_buffer __pyx_t_5;
16768   Py_ssize_t *__pyx_t_6;
16769   Py_ssize_t *__pyx_t_7;
16770   Py_ssize_t *__pyx_t_8;
16771   Py_ssize_t __pyx_t_9;
16772   int __pyx_lineno = 0;
16773   const char *__pyx_filename = NULL;
16774   int __pyx_clineno = 0;
16775   __Pyx_RefNannySetupContext("memoryview_fromslice", 0);
16776 
16777   /* "View.MemoryView":1007
16778  *     cdef _memoryviewslice result
16779  *
16780  *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
16781  *         return None
16782  *
16783  */
16784   __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
16785   if (__pyx_t_1) {
16786 
16787     /* "View.MemoryView":1008
16788  *
16789  *     if <PyObject *> memviewslice.memview == Py_None:
16790  *         return None             # <<<<<<<<<<<<<<
16791  *
16792  *
16793  */
16794     __Pyx_XDECREF(__pyx_r);
16795     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16796     goto __pyx_L0;
16797 
16798     /* "View.MemoryView":1007
16799  *     cdef _memoryviewslice result
16800  *
16801  *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
16802  *         return None
16803  *
16804  */
16805   }
16806 
16807   /* "View.MemoryView":1013
16808  *
16809  *
16810  *     result = _memoryviewslice(None, 0, dtype_is_object)             # <<<<<<<<<<<<<<
16811  *
16812  *     result.from_slice = memviewslice
16813  */
16814   __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error)
16815   __Pyx_GOTREF(__pyx_t_2);
16816   __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1013, __pyx_L1_error)
16817   __Pyx_GOTREF(__pyx_t_3);
16818   __Pyx_INCREF(Py_None);
16819   __Pyx_GIVEREF(Py_None);
16820   PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
16821   __Pyx_INCREF(__pyx_int_0);
16822   __Pyx_GIVEREF(__pyx_int_0);
16823   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
16824   __Pyx_GIVEREF(__pyx_t_2);
16825   PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
16826   __pyx_t_2 = 0;
16827   __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error)
16828   __Pyx_GOTREF(__pyx_t_2);
16829   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16830   __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
16831   __pyx_t_2 = 0;
16832 
16833   /* "View.MemoryView":1015
16834  *     result = _memoryviewslice(None, 0, dtype_is_object)
16835  *
16836  *     result.from_slice = memviewslice             # <<<<<<<<<<<<<<
16837  *     __PYX_INC_MEMVIEW(&memviewslice, 1)
16838  *
16839  */
16840   __pyx_v_result->from_slice = __pyx_v_memviewslice;
16841 
16842   /* "View.MemoryView":1016
16843  *
16844  *     result.from_slice = memviewslice
16845  *     __PYX_INC_MEMVIEW(&memviewslice, 1)             # <<<<<<<<<<<<<<
16846  *
16847  *     result.from_object = (<memoryview> memviewslice.memview).base
16848  */
16849   __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
16850 
16851   /* "View.MemoryView":1018
16852  *     __PYX_INC_MEMVIEW(&memviewslice, 1)
16853  *
16854  *     result.from_object = (<memoryview> memviewslice.memview).base             # <<<<<<<<<<<<<<
16855  *     result.typeinfo = memviewslice.memview.typeinfo
16856  *
16857  */
16858   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1018, __pyx_L1_error)
16859   __Pyx_GOTREF(__pyx_t_2);
16860   __Pyx_GIVEREF(__pyx_t_2);
16861   __Pyx_GOTREF(__pyx_v_result->from_object);
16862   __Pyx_DECREF(__pyx_v_result->from_object);
16863   __pyx_v_result->from_object = __pyx_t_2;
16864   __pyx_t_2 = 0;
16865 
16866   /* "View.MemoryView":1019
16867  *
16868  *     result.from_object = (<memoryview> memviewslice.memview).base
16869  *     result.typeinfo = memviewslice.memview.typeinfo             # <<<<<<<<<<<<<<
16870  *
16871  *     result.view = memviewslice.memview.view
16872  */
16873   __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
16874   __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
16875 
16876   /* "View.MemoryView":1021
16877  *     result.typeinfo = memviewslice.memview.typeinfo
16878  *
16879  *     result.view = memviewslice.memview.view             # <<<<<<<<<<<<<<
16880  *     result.view.buf = <void *> memviewslice.data
16881  *     result.view.ndim = ndim
16882  */
16883   __pyx_t_5 = __pyx_v_memviewslice.memview->view;
16884   __pyx_v_result->__pyx_base.view = __pyx_t_5;
16885 
16886   /* "View.MemoryView":1022
16887  *
16888  *     result.view = memviewslice.memview.view
16889  *     result.view.buf = <void *> memviewslice.data             # <<<<<<<<<<<<<<
16890  *     result.view.ndim = ndim
16891  *     (<__pyx_buffer *> &result.view).obj = Py_None
16892  */
16893   __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
16894 
16895   /* "View.MemoryView":1023
16896  *     result.view = memviewslice.memview.view
16897  *     result.view.buf = <void *> memviewslice.data
16898  *     result.view.ndim = ndim             # <<<<<<<<<<<<<<
16899  *     (<__pyx_buffer *> &result.view).obj = Py_None
16900  *     Py_INCREF(Py_None)
16901  */
16902   __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
16903 
16904   /* "View.MemoryView":1024
16905  *     result.view.buf = <void *> memviewslice.data
16906  *     result.view.ndim = ndim
16907  *     (<__pyx_buffer *> &result.view).obj = Py_None             # <<<<<<<<<<<<<<
16908  *     Py_INCREF(Py_None)
16909  *
16910  */
16911   ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
16912 
16913   /* "View.MemoryView":1025
16914  *     result.view.ndim = ndim
16915  *     (<__pyx_buffer *> &result.view).obj = Py_None
16916  *     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
16917  *
16918  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
16919  */
16920   Py_INCREF(Py_None);
16921 
16922   /* "View.MemoryView":1027
16923  *     Py_INCREF(Py_None)
16924  *
16925  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
16926  *         result.flags = PyBUF_RECORDS
16927  *     else:
16928  */
16929   __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
16930   if (__pyx_t_1) {
16931 
16932     /* "View.MemoryView":1028
16933  *
16934  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
16935  *         result.flags = PyBUF_RECORDS             # <<<<<<<<<<<<<<
16936  *     else:
16937  *         result.flags = PyBUF_RECORDS_RO
16938  */
16939     __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
16940 
16941     /* "View.MemoryView":1027
16942  *     Py_INCREF(Py_None)
16943  *
16944  *     if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:             # <<<<<<<<<<<<<<
16945  *         result.flags = PyBUF_RECORDS
16946  *     else:
16947  */
16948     goto __pyx_L4;
16949   }
16950 
16951   /* "View.MemoryView":1030
16952  *         result.flags = PyBUF_RECORDS
16953  *     else:
16954  *         result.flags = PyBUF_RECORDS_RO             # <<<<<<<<<<<<<<
16955  *
16956  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
16957  */
16958   /*else*/ {
16959     __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
16960   }
16961   __pyx_L4:;
16962 
16963   /* "View.MemoryView":1032
16964  *         result.flags = PyBUF_RECORDS_RO
16965  *
16966  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape             # <<<<<<<<<<<<<<
16967  *     result.view.strides = <Py_ssize_t *> result.from_slice.strides
16968  *
16969  */
16970   __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
16971 
16972   /* "View.MemoryView":1033
16973  *
16974  *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
16975  *     result.view.strides = <Py_ssize_t *> result.from_slice.strides             # <<<<<<<<<<<<<<
16976  *
16977  *
16978  */
16979   __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
16980 
16981   /* "View.MemoryView":1036
16982  *
16983  *
16984  *     result.view.suboffsets = NULL             # <<<<<<<<<<<<<<
16985  *     for suboffset in result.from_slice.suboffsets[:ndim]:
16986  *         if suboffset >= 0:
16987  */
16988   __pyx_v_result->__pyx_base.view.suboffsets = NULL;
16989 
16990   /* "View.MemoryView":1037
16991  *
16992  *     result.view.suboffsets = NULL
16993  *     for suboffset in result.from_slice.suboffsets[:ndim]:             # <<<<<<<<<<<<<<
16994  *         if suboffset >= 0:
16995  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
16996  */
16997   __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
16998   for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
16999     __pyx_t_6 = __pyx_t_8;
17000     __pyx_v_suboffset = (__pyx_t_6[0]);
17001 
17002     /* "View.MemoryView":1038
17003  *     result.view.suboffsets = NULL
17004  *     for suboffset in result.from_slice.suboffsets[:ndim]:
17005  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
17006  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
17007  *             break
17008  */
17009     __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
17010     if (__pyx_t_1) {
17011 
17012       /* "View.MemoryView":1039
17013  *     for suboffset in result.from_slice.suboffsets[:ndim]:
17014  *         if suboffset >= 0:
17015  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets             # <<<<<<<<<<<<<<
17016  *             break
17017  *
17018  */
17019       __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
17020 
17021       /* "View.MemoryView":1040
17022  *         if suboffset >= 0:
17023  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
17024  *             break             # <<<<<<<<<<<<<<
17025  *
17026  *     result.view.len = result.view.itemsize
17027  */
17028       goto __pyx_L6_break;
17029 
17030       /* "View.MemoryView":1038
17031  *     result.view.suboffsets = NULL
17032  *     for suboffset in result.from_slice.suboffsets[:ndim]:
17033  *         if suboffset >= 0:             # <<<<<<<<<<<<<<
17034  *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
17035  *             break
17036  */
17037     }
17038   }
17039   __pyx_L6_break:;
17040 
17041   /* "View.MemoryView":1042
17042  *             break
17043  *
17044  *     result.view.len = result.view.itemsize             # <<<<<<<<<<<<<<
17045  *     for length in result.view.shape[:ndim]:
17046  *         result.view.len *= length
17047  */
17048   __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
17049   __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
17050 
17051   /* "View.MemoryView":1043
17052  *
17053  *     result.view.len = result.view.itemsize
17054  *     for length in result.view.shape[:ndim]:             # <<<<<<<<<<<<<<
17055  *         result.view.len *= length
17056  *
17057  */
17058   __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
17059   for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
17060     __pyx_t_6 = __pyx_t_8;
17061     __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1043, __pyx_L1_error)
17062     __Pyx_GOTREF(__pyx_t_2);
17063     __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
17064     __pyx_t_2 = 0;
17065 
17066     /* "View.MemoryView":1044
17067  *     result.view.len = result.view.itemsize
17068  *     for length in result.view.shape[:ndim]:
17069  *         result.view.len *= length             # <<<<<<<<<<<<<<
17070  *
17071  *     result.to_object_func = to_object_func
17072  */
17073     __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error)
17074     __Pyx_GOTREF(__pyx_t_2);
17075     __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1044, __pyx_L1_error)
17076     __Pyx_GOTREF(__pyx_t_3);
17077     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17078     __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1044, __pyx_L1_error)
17079     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17080     __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
17081   }
17082 
17083   /* "View.MemoryView":1046
17084  *         result.view.len *= length
17085  *
17086  *     result.to_object_func = to_object_func             # <<<<<<<<<<<<<<
17087  *     result.to_dtype_func = to_dtype_func
17088  *
17089  */
17090   __pyx_v_result->to_object_func = __pyx_v_to_object_func;
17091 
17092   /* "View.MemoryView":1047
17093  *
17094  *     result.to_object_func = to_object_func
17095  *     result.to_dtype_func = to_dtype_func             # <<<<<<<<<<<<<<
17096  *
17097  *     return result
17098  */
17099   __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
17100 
17101   /* "View.MemoryView":1049
17102  *     result.to_dtype_func = to_dtype_func
17103  *
17104  *     return result             # <<<<<<<<<<<<<<
17105  *
17106  * @cname('__pyx_memoryview_get_slice_from_memoryview')
17107  */
17108   __Pyx_XDECREF(__pyx_r);
17109   __Pyx_INCREF(((PyObject *)__pyx_v_result));
17110   __pyx_r = ((PyObject *)__pyx_v_result);
17111   goto __pyx_L0;
17112 
17113   /* "View.MemoryView":999
17114  *
17115  * @cname('__pyx_memoryview_fromslice')
17116  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
17117  *                           int ndim,
17118  *                           object (*to_object_func)(char *),
17119  */
17120 
17121   /* function exit code */
17122   __pyx_L1_error:;
17123   __Pyx_XDECREF(__pyx_t_2);
17124   __Pyx_XDECREF(__pyx_t_3);
17125   __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
17126   __pyx_r = 0;
17127   __pyx_L0:;
17128   __Pyx_XDECREF((PyObject *)__pyx_v_result);
17129   __Pyx_XDECREF(__pyx_v_length);
17130   __Pyx_XGIVEREF(__pyx_r);
17131   __Pyx_RefNannyFinishContext();
17132   return __pyx_r;
17133 }
17134 
17135 /* "View.MemoryView":1052
17136  *
17137  * @cname('__pyx_memoryview_get_slice_from_memoryview')
17138  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
17139  *                                                    __Pyx_memviewslice *mslice) except NULL:
17140  *     cdef _memoryviewslice obj
17141  */
17142 
__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_mslice)17143 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
17144   struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
17145   __Pyx_memviewslice *__pyx_r;
17146   __Pyx_RefNannyDeclarations
17147   int __pyx_t_1;
17148   int __pyx_t_2;
17149   PyObject *__pyx_t_3 = NULL;
17150   int __pyx_lineno = 0;
17151   const char *__pyx_filename = NULL;
17152   int __pyx_clineno = 0;
17153   __Pyx_RefNannySetupContext("get_slice_from_memview", 0);
17154 
17155   /* "View.MemoryView":1055
17156  *                                                    __Pyx_memviewslice *mslice) except NULL:
17157  *     cdef _memoryviewslice obj
17158  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
17159  *         obj = memview
17160  *         return &obj.from_slice
17161  */
17162   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
17163   __pyx_t_2 = (__pyx_t_1 != 0);
17164   if (__pyx_t_2) {
17165 
17166     /* "View.MemoryView":1056
17167  *     cdef _memoryviewslice obj
17168  *     if isinstance(memview, _memoryviewslice):
17169  *         obj = memview             # <<<<<<<<<<<<<<
17170  *         return &obj.from_slice
17171  *     else:
17172  */
17173     if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 1056, __pyx_L1_error)
17174     __pyx_t_3 = ((PyObject *)__pyx_v_memview);
17175     __Pyx_INCREF(__pyx_t_3);
17176     __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
17177     __pyx_t_3 = 0;
17178 
17179     /* "View.MemoryView":1057
17180  *     if isinstance(memview, _memoryviewslice):
17181  *         obj = memview
17182  *         return &obj.from_slice             # <<<<<<<<<<<<<<
17183  *     else:
17184  *         slice_copy(memview, mslice)
17185  */
17186     __pyx_r = (&__pyx_v_obj->from_slice);
17187     goto __pyx_L0;
17188 
17189     /* "View.MemoryView":1055
17190  *                                                    __Pyx_memviewslice *mslice) except NULL:
17191  *     cdef _memoryviewslice obj
17192  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
17193  *         obj = memview
17194  *         return &obj.from_slice
17195  */
17196   }
17197 
17198   /* "View.MemoryView":1059
17199  *         return &obj.from_slice
17200  *     else:
17201  *         slice_copy(memview, mslice)             # <<<<<<<<<<<<<<
17202  *         return mslice
17203  *
17204  */
17205   /*else*/ {
17206     __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
17207 
17208     /* "View.MemoryView":1060
17209  *     else:
17210  *         slice_copy(memview, mslice)
17211  *         return mslice             # <<<<<<<<<<<<<<
17212  *
17213  * @cname('__pyx_memoryview_slice_copy')
17214  */
17215     __pyx_r = __pyx_v_mslice;
17216     goto __pyx_L0;
17217   }
17218 
17219   /* "View.MemoryView":1052
17220  *
17221  * @cname('__pyx_memoryview_get_slice_from_memoryview')
17222  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
17223  *                                                    __Pyx_memviewslice *mslice) except NULL:
17224  *     cdef _memoryviewslice obj
17225  */
17226 
17227   /* function exit code */
17228   __pyx_L1_error:;
17229   __Pyx_XDECREF(__pyx_t_3);
17230   __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
17231   __pyx_r = NULL;
17232   __pyx_L0:;
17233   __Pyx_XDECREF((PyObject *)__pyx_v_obj);
17234   __Pyx_RefNannyFinishContext();
17235   return __pyx_r;
17236 }
17237 
17238 /* "View.MemoryView":1063
17239  *
17240  * @cname('__pyx_memoryview_slice_copy')
17241  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
17242  *     cdef int dim
17243  *     cdef (Py_ssize_t*) shape, strides, suboffsets
17244  */
17245 
__pyx_memoryview_slice_copy(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_dst)17246 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
17247   int __pyx_v_dim;
17248   Py_ssize_t *__pyx_v_shape;
17249   Py_ssize_t *__pyx_v_strides;
17250   Py_ssize_t *__pyx_v_suboffsets;
17251   __Pyx_RefNannyDeclarations
17252   Py_ssize_t *__pyx_t_1;
17253   int __pyx_t_2;
17254   int __pyx_t_3;
17255   int __pyx_t_4;
17256   Py_ssize_t __pyx_t_5;
17257   __Pyx_RefNannySetupContext("slice_copy", 0);
17258 
17259   /* "View.MemoryView":1067
17260  *     cdef (Py_ssize_t*) shape, strides, suboffsets
17261  *
17262  *     shape = memview.view.shape             # <<<<<<<<<<<<<<
17263  *     strides = memview.view.strides
17264  *     suboffsets = memview.view.suboffsets
17265  */
17266   __pyx_t_1 = __pyx_v_memview->view.shape;
17267   __pyx_v_shape = __pyx_t_1;
17268 
17269   /* "View.MemoryView":1068
17270  *
17271  *     shape = memview.view.shape
17272  *     strides = memview.view.strides             # <<<<<<<<<<<<<<
17273  *     suboffsets = memview.view.suboffsets
17274  *
17275  */
17276   __pyx_t_1 = __pyx_v_memview->view.strides;
17277   __pyx_v_strides = __pyx_t_1;
17278 
17279   /* "View.MemoryView":1069
17280  *     shape = memview.view.shape
17281  *     strides = memview.view.strides
17282  *     suboffsets = memview.view.suboffsets             # <<<<<<<<<<<<<<
17283  *
17284  *     dst.memview = <__pyx_memoryview *> memview
17285  */
17286   __pyx_t_1 = __pyx_v_memview->view.suboffsets;
17287   __pyx_v_suboffsets = __pyx_t_1;
17288 
17289   /* "View.MemoryView":1071
17290  *     suboffsets = memview.view.suboffsets
17291  *
17292  *     dst.memview = <__pyx_memoryview *> memview             # <<<<<<<<<<<<<<
17293  *     dst.data = <char *> memview.view.buf
17294  *
17295  */
17296   __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);
17297 
17298   /* "View.MemoryView":1072
17299  *
17300  *     dst.memview = <__pyx_memoryview *> memview
17301  *     dst.data = <char *> memview.view.buf             # <<<<<<<<<<<<<<
17302  *
17303  *     for dim in range(memview.view.ndim):
17304  */
17305   __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);
17306 
17307   /* "View.MemoryView":1074
17308  *     dst.data = <char *> memview.view.buf
17309  *
17310  *     for dim in range(memview.view.ndim):             # <<<<<<<<<<<<<<
17311  *         dst.shape[dim] = shape[dim]
17312  *         dst.strides[dim] = strides[dim]
17313  */
17314   __pyx_t_2 = __pyx_v_memview->view.ndim;
17315   __pyx_t_3 = __pyx_t_2;
17316   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17317     __pyx_v_dim = __pyx_t_4;
17318 
17319     /* "View.MemoryView":1075
17320  *
17321  *     for dim in range(memview.view.ndim):
17322  *         dst.shape[dim] = shape[dim]             # <<<<<<<<<<<<<<
17323  *         dst.strides[dim] = strides[dim]
17324  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
17325  */
17326     (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
17327 
17328     /* "View.MemoryView":1076
17329  *     for dim in range(memview.view.ndim):
17330  *         dst.shape[dim] = shape[dim]
17331  *         dst.strides[dim] = strides[dim]             # <<<<<<<<<<<<<<
17332  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
17333  *
17334  */
17335     (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
17336 
17337     /* "View.MemoryView":1077
17338  *         dst.shape[dim] = shape[dim]
17339  *         dst.strides[dim] = strides[dim]
17340  *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1             # <<<<<<<<<<<<<<
17341  *
17342  * @cname('__pyx_memoryview_copy_object')
17343  */
17344     if ((__pyx_v_suboffsets != 0)) {
17345       __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
17346     } else {
17347       __pyx_t_5 = -1L;
17348     }
17349     (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
17350   }
17351 
17352   /* "View.MemoryView":1063
17353  *
17354  * @cname('__pyx_memoryview_slice_copy')
17355  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
17356  *     cdef int dim
17357  *     cdef (Py_ssize_t*) shape, strides, suboffsets
17358  */
17359 
17360   /* function exit code */
17361   __Pyx_RefNannyFinishContext();
17362 }
17363 
17364 /* "View.MemoryView":1080
17365  *
17366  * @cname('__pyx_memoryview_copy_object')
17367  * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
17368  *     "Create a new memoryview object"
17369  *     cdef __Pyx_memviewslice memviewslice
17370  */
17371 
__pyx_memoryview_copy_object(struct __pyx_memoryview_obj * __pyx_v_memview)17372 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
17373   __Pyx_memviewslice __pyx_v_memviewslice;
17374   PyObject *__pyx_r = NULL;
17375   __Pyx_RefNannyDeclarations
17376   PyObject *__pyx_t_1 = NULL;
17377   int __pyx_lineno = 0;
17378   const char *__pyx_filename = NULL;
17379   int __pyx_clineno = 0;
17380   __Pyx_RefNannySetupContext("memoryview_copy", 0);
17381 
17382   /* "View.MemoryView":1083
17383  *     "Create a new memoryview object"
17384  *     cdef __Pyx_memviewslice memviewslice
17385  *     slice_copy(memview, &memviewslice)             # <<<<<<<<<<<<<<
17386  *     return memoryview_copy_from_slice(memview, &memviewslice)
17387  *
17388  */
17389   __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
17390 
17391   /* "View.MemoryView":1084
17392  *     cdef __Pyx_memviewslice memviewslice
17393  *     slice_copy(memview, &memviewslice)
17394  *     return memoryview_copy_from_slice(memview, &memviewslice)             # <<<<<<<<<<<<<<
17395  *
17396  * @cname('__pyx_memoryview_copy_object_from_slice')
17397  */
17398   __Pyx_XDECREF(__pyx_r);
17399   __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1084, __pyx_L1_error)
17400   __Pyx_GOTREF(__pyx_t_1);
17401   __pyx_r = __pyx_t_1;
17402   __pyx_t_1 = 0;
17403   goto __pyx_L0;
17404 
17405   /* "View.MemoryView":1080
17406  *
17407  * @cname('__pyx_memoryview_copy_object')
17408  * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
17409  *     "Create a new memoryview object"
17410  *     cdef __Pyx_memviewslice memviewslice
17411  */
17412 
17413   /* function exit code */
17414   __pyx_L1_error:;
17415   __Pyx_XDECREF(__pyx_t_1);
17416   __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
17417   __pyx_r = 0;
17418   __pyx_L0:;
17419   __Pyx_XGIVEREF(__pyx_r);
17420   __Pyx_RefNannyFinishContext();
17421   return __pyx_r;
17422 }
17423 
17424 /* "View.MemoryView":1087
17425  *
17426  * @cname('__pyx_memoryview_copy_object_from_slice')
17427  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
17428  *     """
17429  *     Create a new memoryview object from a given memoryview object and slice.
17430  */
17431 
__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj * __pyx_v_memview,__Pyx_memviewslice * __pyx_v_memviewslice)17432 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
17433   PyObject *(*__pyx_v_to_object_func)(char *);
17434   int (*__pyx_v_to_dtype_func)(char *, PyObject *);
17435   PyObject *__pyx_r = NULL;
17436   __Pyx_RefNannyDeclarations
17437   int __pyx_t_1;
17438   int __pyx_t_2;
17439   PyObject *(*__pyx_t_3)(char *);
17440   int (*__pyx_t_4)(char *, PyObject *);
17441   PyObject *__pyx_t_5 = NULL;
17442   int __pyx_lineno = 0;
17443   const char *__pyx_filename = NULL;
17444   int __pyx_clineno = 0;
17445   __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);
17446 
17447   /* "View.MemoryView":1094
17448  *     cdef int (*to_dtype_func)(char *, object) except 0
17449  *
17450  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
17451  *         to_object_func = (<_memoryviewslice> memview).to_object_func
17452  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
17453  */
17454   __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
17455   __pyx_t_2 = (__pyx_t_1 != 0);
17456   if (__pyx_t_2) {
17457 
17458     /* "View.MemoryView":1095
17459  *
17460  *     if isinstance(memview, _memoryviewslice):
17461  *         to_object_func = (<_memoryviewslice> memview).to_object_func             # <<<<<<<<<<<<<<
17462  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
17463  *     else:
17464  */
17465     __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
17466     __pyx_v_to_object_func = __pyx_t_3;
17467 
17468     /* "View.MemoryView":1096
17469  *     if isinstance(memview, _memoryviewslice):
17470  *         to_object_func = (<_memoryviewslice> memview).to_object_func
17471  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func             # <<<<<<<<<<<<<<
17472  *     else:
17473  *         to_object_func = NULL
17474  */
17475     __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
17476     __pyx_v_to_dtype_func = __pyx_t_4;
17477 
17478     /* "View.MemoryView":1094
17479  *     cdef int (*to_dtype_func)(char *, object) except 0
17480  *
17481  *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
17482  *         to_object_func = (<_memoryviewslice> memview).to_object_func
17483  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
17484  */
17485     goto __pyx_L3;
17486   }
17487 
17488   /* "View.MemoryView":1098
17489  *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
17490  *     else:
17491  *         to_object_func = NULL             # <<<<<<<<<<<<<<
17492  *         to_dtype_func = NULL
17493  *
17494  */
17495   /*else*/ {
17496     __pyx_v_to_object_func = NULL;
17497 
17498     /* "View.MemoryView":1099
17499  *     else:
17500  *         to_object_func = NULL
17501  *         to_dtype_func = NULL             # <<<<<<<<<<<<<<
17502  *
17503  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
17504  */
17505     __pyx_v_to_dtype_func = NULL;
17506   }
17507   __pyx_L3:;
17508 
17509   /* "View.MemoryView":1101
17510  *         to_dtype_func = NULL
17511  *
17512  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,             # <<<<<<<<<<<<<<
17513  *                                 to_object_func, to_dtype_func,
17514  *                                 memview.dtype_is_object)
17515  */
17516   __Pyx_XDECREF(__pyx_r);
17517 
17518   /* "View.MemoryView":1103
17519  *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
17520  *                                 to_object_func, to_dtype_func,
17521  *                                 memview.dtype_is_object)             # <<<<<<<<<<<<<<
17522  *
17523  *
17524  */
17525   __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1101, __pyx_L1_error)
17526   __Pyx_GOTREF(__pyx_t_5);
17527   __pyx_r = __pyx_t_5;
17528   __pyx_t_5 = 0;
17529   goto __pyx_L0;
17530 
17531   /* "View.MemoryView":1087
17532  *
17533  * @cname('__pyx_memoryview_copy_object_from_slice')
17534  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
17535  *     """
17536  *     Create a new memoryview object from a given memoryview object and slice.
17537  */
17538 
17539   /* function exit code */
17540   __pyx_L1_error:;
17541   __Pyx_XDECREF(__pyx_t_5);
17542   __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
17543   __pyx_r = 0;
17544   __pyx_L0:;
17545   __Pyx_XGIVEREF(__pyx_r);
17546   __Pyx_RefNannyFinishContext();
17547   return __pyx_r;
17548 }
17549 
17550 /* "View.MemoryView":1109
17551  *
17552  *
17553  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
17554  *     if arg < 0:
17555  *         return -arg
17556  */
17557 
abs_py_ssize_t(Py_ssize_t __pyx_v_arg)17558 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
17559   Py_ssize_t __pyx_r;
17560   int __pyx_t_1;
17561 
17562   /* "View.MemoryView":1110
17563  *
17564  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
17565  *     if arg < 0:             # <<<<<<<<<<<<<<
17566  *         return -arg
17567  *     else:
17568  */
17569   __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
17570   if (__pyx_t_1) {
17571 
17572     /* "View.MemoryView":1111
17573  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
17574  *     if arg < 0:
17575  *         return -arg             # <<<<<<<<<<<<<<
17576  *     else:
17577  *         return arg
17578  */
17579     __pyx_r = (-__pyx_v_arg);
17580     goto __pyx_L0;
17581 
17582     /* "View.MemoryView":1110
17583  *
17584  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
17585  *     if arg < 0:             # <<<<<<<<<<<<<<
17586  *         return -arg
17587  *     else:
17588  */
17589   }
17590 
17591   /* "View.MemoryView":1113
17592  *         return -arg
17593  *     else:
17594  *         return arg             # <<<<<<<<<<<<<<
17595  *
17596  * @cname('__pyx_get_best_slice_order')
17597  */
17598   /*else*/ {
17599     __pyx_r = __pyx_v_arg;
17600     goto __pyx_L0;
17601   }
17602 
17603   /* "View.MemoryView":1109
17604  *
17605  *
17606  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
17607  *     if arg < 0:
17608  *         return -arg
17609  */
17610 
17611   /* function exit code */
17612   __pyx_L0:;
17613   return __pyx_r;
17614 }
17615 
17616 /* "View.MemoryView":1116
17617  *
17618  * @cname('__pyx_get_best_slice_order')
17619  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
17620  *     """
17621  *     Figure out the best memory access order for a given slice.
17622  */
17623 
__pyx_get_best_slice_order(__Pyx_memviewslice * __pyx_v_mslice,int __pyx_v_ndim)17624 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
17625   int __pyx_v_i;
17626   Py_ssize_t __pyx_v_c_stride;
17627   Py_ssize_t __pyx_v_f_stride;
17628   char __pyx_r;
17629   int __pyx_t_1;
17630   int __pyx_t_2;
17631   int __pyx_t_3;
17632   int __pyx_t_4;
17633 
17634   /* "View.MemoryView":1121
17635  *     """
17636  *     cdef int i
17637  *     cdef Py_ssize_t c_stride = 0             # <<<<<<<<<<<<<<
17638  *     cdef Py_ssize_t f_stride = 0
17639  *
17640  */
17641   __pyx_v_c_stride = 0;
17642 
17643   /* "View.MemoryView":1122
17644  *     cdef int i
17645  *     cdef Py_ssize_t c_stride = 0
17646  *     cdef Py_ssize_t f_stride = 0             # <<<<<<<<<<<<<<
17647  *
17648  *     for i in range(ndim - 1, -1, -1):
17649  */
17650   __pyx_v_f_stride = 0;
17651 
17652   /* "View.MemoryView":1124
17653  *     cdef Py_ssize_t f_stride = 0
17654  *
17655  *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
17656  *         if mslice.shape[i] > 1:
17657  *             c_stride = mslice.strides[i]
17658  */
17659   for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
17660     __pyx_v_i = __pyx_t_1;
17661 
17662     /* "View.MemoryView":1125
17663  *
17664  *     for i in range(ndim - 1, -1, -1):
17665  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
17666  *             c_stride = mslice.strides[i]
17667  *             break
17668  */
17669     __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
17670     if (__pyx_t_2) {
17671 
17672       /* "View.MemoryView":1126
17673  *     for i in range(ndim - 1, -1, -1):
17674  *         if mslice.shape[i] > 1:
17675  *             c_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
17676  *             break
17677  *
17678  */
17679       __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
17680 
17681       /* "View.MemoryView":1127
17682  *         if mslice.shape[i] > 1:
17683  *             c_stride = mslice.strides[i]
17684  *             break             # <<<<<<<<<<<<<<
17685  *
17686  *     for i in range(ndim):
17687  */
17688       goto __pyx_L4_break;
17689 
17690       /* "View.MemoryView":1125
17691  *
17692  *     for i in range(ndim - 1, -1, -1):
17693  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
17694  *             c_stride = mslice.strides[i]
17695  *             break
17696  */
17697     }
17698   }
17699   __pyx_L4_break:;
17700 
17701   /* "View.MemoryView":1129
17702  *             break
17703  *
17704  *     for i in range(ndim):             # <<<<<<<<<<<<<<
17705  *         if mslice.shape[i] > 1:
17706  *             f_stride = mslice.strides[i]
17707  */
17708   __pyx_t_1 = __pyx_v_ndim;
17709   __pyx_t_3 = __pyx_t_1;
17710   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17711     __pyx_v_i = __pyx_t_4;
17712 
17713     /* "View.MemoryView":1130
17714  *
17715  *     for i in range(ndim):
17716  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
17717  *             f_stride = mslice.strides[i]
17718  *             break
17719  */
17720     __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
17721     if (__pyx_t_2) {
17722 
17723       /* "View.MemoryView":1131
17724  *     for i in range(ndim):
17725  *         if mslice.shape[i] > 1:
17726  *             f_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
17727  *             break
17728  *
17729  */
17730       __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
17731 
17732       /* "View.MemoryView":1132
17733  *         if mslice.shape[i] > 1:
17734  *             f_stride = mslice.strides[i]
17735  *             break             # <<<<<<<<<<<<<<
17736  *
17737  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
17738  */
17739       goto __pyx_L7_break;
17740 
17741       /* "View.MemoryView":1130
17742  *
17743  *     for i in range(ndim):
17744  *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
17745  *             f_stride = mslice.strides[i]
17746  *             break
17747  */
17748     }
17749   }
17750   __pyx_L7_break:;
17751 
17752   /* "View.MemoryView":1134
17753  *             break
17754  *
17755  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
17756  *         return 'C'
17757  *     else:
17758  */
17759   __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
17760   if (__pyx_t_2) {
17761 
17762     /* "View.MemoryView":1135
17763  *
17764  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
17765  *         return 'C'             # <<<<<<<<<<<<<<
17766  *     else:
17767  *         return 'F'
17768  */
17769     __pyx_r = 'C';
17770     goto __pyx_L0;
17771 
17772     /* "View.MemoryView":1134
17773  *             break
17774  *
17775  *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
17776  *         return 'C'
17777  *     else:
17778  */
17779   }
17780 
17781   /* "View.MemoryView":1137
17782  *         return 'C'
17783  *     else:
17784  *         return 'F'             # <<<<<<<<<<<<<<
17785  *
17786  * @cython.cdivision(True)
17787  */
17788   /*else*/ {
17789     __pyx_r = 'F';
17790     goto __pyx_L0;
17791   }
17792 
17793   /* "View.MemoryView":1116
17794  *
17795  * @cname('__pyx_get_best_slice_order')
17796  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
17797  *     """
17798  *     Figure out the best memory access order for a given slice.
17799  */
17800 
17801   /* function exit code */
17802   __pyx_L0:;
17803   return __pyx_r;
17804 }
17805 
17806 /* "View.MemoryView":1140
17807  *
17808  * @cython.cdivision(True)
17809  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
17810  *                                    char *dst_data, Py_ssize_t *dst_strides,
17811  *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
17812  */
17813 
_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)17814 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) {
17815   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
17816   CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
17817   Py_ssize_t __pyx_v_dst_extent;
17818   Py_ssize_t __pyx_v_src_stride;
17819   Py_ssize_t __pyx_v_dst_stride;
17820   int __pyx_t_1;
17821   int __pyx_t_2;
17822   int __pyx_t_3;
17823   Py_ssize_t __pyx_t_4;
17824   Py_ssize_t __pyx_t_5;
17825   Py_ssize_t __pyx_t_6;
17826 
17827   /* "View.MemoryView":1147
17828  *
17829  *     cdef Py_ssize_t i
17830  *     cdef Py_ssize_t src_extent = src_shape[0]             # <<<<<<<<<<<<<<
17831  *     cdef Py_ssize_t dst_extent = dst_shape[0]
17832  *     cdef Py_ssize_t src_stride = src_strides[0]
17833  */
17834   __pyx_v_src_extent = (__pyx_v_src_shape[0]);
17835 
17836   /* "View.MemoryView":1148
17837  *     cdef Py_ssize_t i
17838  *     cdef Py_ssize_t src_extent = src_shape[0]
17839  *     cdef Py_ssize_t dst_extent = dst_shape[0]             # <<<<<<<<<<<<<<
17840  *     cdef Py_ssize_t src_stride = src_strides[0]
17841  *     cdef Py_ssize_t dst_stride = dst_strides[0]
17842  */
17843   __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
17844 
17845   /* "View.MemoryView":1149
17846  *     cdef Py_ssize_t src_extent = src_shape[0]
17847  *     cdef Py_ssize_t dst_extent = dst_shape[0]
17848  *     cdef Py_ssize_t src_stride = src_strides[0]             # <<<<<<<<<<<<<<
17849  *     cdef Py_ssize_t dst_stride = dst_strides[0]
17850  *
17851  */
17852   __pyx_v_src_stride = (__pyx_v_src_strides[0]);
17853 
17854   /* "View.MemoryView":1150
17855  *     cdef Py_ssize_t dst_extent = dst_shape[0]
17856  *     cdef Py_ssize_t src_stride = src_strides[0]
17857  *     cdef Py_ssize_t dst_stride = dst_strides[0]             # <<<<<<<<<<<<<<
17858  *
17859  *     if ndim == 1:
17860  */
17861   __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
17862 
17863   /* "View.MemoryView":1152
17864  *     cdef Py_ssize_t dst_stride = dst_strides[0]
17865  *
17866  *     if ndim == 1:             # <<<<<<<<<<<<<<
17867  *        if (src_stride > 0 and dst_stride > 0 and
17868  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17869  */
17870   __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
17871   if (__pyx_t_1) {
17872 
17873     /* "View.MemoryView":1153
17874  *
17875  *     if ndim == 1:
17876  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
17877  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17878  *            memcpy(dst_data, src_data, itemsize * dst_extent)
17879  */
17880     __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
17881     if (__pyx_t_2) {
17882     } else {
17883       __pyx_t_1 = __pyx_t_2;
17884       goto __pyx_L5_bool_binop_done;
17885     }
17886     __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
17887     if (__pyx_t_2) {
17888     } else {
17889       __pyx_t_1 = __pyx_t_2;
17890       goto __pyx_L5_bool_binop_done;
17891     }
17892 
17893     /* "View.MemoryView":1154
17894  *     if ndim == 1:
17895  *        if (src_stride > 0 and dst_stride > 0 and
17896  *            <size_t> src_stride == itemsize == <size_t> dst_stride):             # <<<<<<<<<<<<<<
17897  *            memcpy(dst_data, src_data, itemsize * dst_extent)
17898  *        else:
17899  */
17900     __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
17901     if (__pyx_t_2) {
17902       __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
17903     }
17904     __pyx_t_3 = (__pyx_t_2 != 0);
17905     __pyx_t_1 = __pyx_t_3;
17906     __pyx_L5_bool_binop_done:;
17907 
17908     /* "View.MemoryView":1153
17909  *
17910  *     if ndim == 1:
17911  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
17912  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17913  *            memcpy(dst_data, src_data, itemsize * dst_extent)
17914  */
17915     if (__pyx_t_1) {
17916 
17917       /* "View.MemoryView":1155
17918  *        if (src_stride > 0 and dst_stride > 0 and
17919  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17920  *            memcpy(dst_data, src_data, itemsize * dst_extent)             # <<<<<<<<<<<<<<
17921  *        else:
17922  *            for i in range(dst_extent):
17923  */
17924       (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
17925 
17926       /* "View.MemoryView":1153
17927  *
17928  *     if ndim == 1:
17929  *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
17930  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17931  *            memcpy(dst_data, src_data, itemsize * dst_extent)
17932  */
17933       goto __pyx_L4;
17934     }
17935 
17936     /* "View.MemoryView":1157
17937  *            memcpy(dst_data, src_data, itemsize * dst_extent)
17938  *        else:
17939  *            for i in range(dst_extent):             # <<<<<<<<<<<<<<
17940  *                memcpy(dst_data, src_data, itemsize)
17941  *                src_data += src_stride
17942  */
17943     /*else*/ {
17944       __pyx_t_4 = __pyx_v_dst_extent;
17945       __pyx_t_5 = __pyx_t_4;
17946       for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
17947         __pyx_v_i = __pyx_t_6;
17948 
17949         /* "View.MemoryView":1158
17950  *        else:
17951  *            for i in range(dst_extent):
17952  *                memcpy(dst_data, src_data, itemsize)             # <<<<<<<<<<<<<<
17953  *                src_data += src_stride
17954  *                dst_data += dst_stride
17955  */
17956         (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
17957 
17958         /* "View.MemoryView":1159
17959  *            for i in range(dst_extent):
17960  *                memcpy(dst_data, src_data, itemsize)
17961  *                src_data += src_stride             # <<<<<<<<<<<<<<
17962  *                dst_data += dst_stride
17963  *     else:
17964  */
17965         __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
17966 
17967         /* "View.MemoryView":1160
17968  *                memcpy(dst_data, src_data, itemsize)
17969  *                src_data += src_stride
17970  *                dst_data += dst_stride             # <<<<<<<<<<<<<<
17971  *     else:
17972  *         for i in range(dst_extent):
17973  */
17974         __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
17975       }
17976     }
17977     __pyx_L4:;
17978 
17979     /* "View.MemoryView":1152
17980  *     cdef Py_ssize_t dst_stride = dst_strides[0]
17981  *
17982  *     if ndim == 1:             # <<<<<<<<<<<<<<
17983  *        if (src_stride > 0 and dst_stride > 0 and
17984  *            <size_t> src_stride == itemsize == <size_t> dst_stride):
17985  */
17986     goto __pyx_L3;
17987   }
17988 
17989   /* "View.MemoryView":1162
17990  *                dst_data += dst_stride
17991  *     else:
17992  *         for i in range(dst_extent):             # <<<<<<<<<<<<<<
17993  *             _copy_strided_to_strided(src_data, src_strides + 1,
17994  *                                      dst_data, dst_strides + 1,
17995  */
17996   /*else*/ {
17997     __pyx_t_4 = __pyx_v_dst_extent;
17998     __pyx_t_5 = __pyx_t_4;
17999     for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18000       __pyx_v_i = __pyx_t_6;
18001 
18002       /* "View.MemoryView":1163
18003  *     else:
18004  *         for i in range(dst_extent):
18005  *             _copy_strided_to_strided(src_data, src_strides + 1,             # <<<<<<<<<<<<<<
18006  *                                      dst_data, dst_strides + 1,
18007  *                                      src_shape + 1, dst_shape + 1,
18008  */
18009       _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);
18010 
18011       /* "View.MemoryView":1167
18012  *                                      src_shape + 1, dst_shape + 1,
18013  *                                      ndim - 1, itemsize)
18014  *             src_data += src_stride             # <<<<<<<<<<<<<<
18015  *             dst_data += dst_stride
18016  *
18017  */
18018       __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
18019 
18020       /* "View.MemoryView":1168
18021  *                                      ndim - 1, itemsize)
18022  *             src_data += src_stride
18023  *             dst_data += dst_stride             # <<<<<<<<<<<<<<
18024  *
18025  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
18026  */
18027       __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
18028     }
18029   }
18030   __pyx_L3:;
18031 
18032   /* "View.MemoryView":1140
18033  *
18034  * @cython.cdivision(True)
18035  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
18036  *                                    char *dst_data, Py_ssize_t *dst_strides,
18037  *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
18038  */
18039 
18040   /* function exit code */
18041 }
18042 
18043 /* "View.MemoryView":1170
18044  *             dst_data += dst_stride
18045  *
18046  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
18047  *                                   __Pyx_memviewslice *dst,
18048  *                                   int ndim, size_t itemsize) nogil:
18049  */
18050 
copy_strided_to_strided(__Pyx_memviewslice * __pyx_v_src,__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_ndim,size_t __pyx_v_itemsize)18051 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) {
18052 
18053   /* "View.MemoryView":1173
18054  *                                   __Pyx_memviewslice *dst,
18055  *                                   int ndim, size_t itemsize) nogil:
18056  *     _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides,             # <<<<<<<<<<<<<<
18057  *                              src.shape, dst.shape, ndim, itemsize)
18058  *
18059  */
18060   _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);
18061 
18062   /* "View.MemoryView":1170
18063  *             dst_data += dst_stride
18064  *
18065  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
18066  *                                   __Pyx_memviewslice *dst,
18067  *                                   int ndim, size_t itemsize) nogil:
18068  */
18069 
18070   /* function exit code */
18071 }
18072 
18073 /* "View.MemoryView":1177
18074  *
18075  * @cname('__pyx_memoryview_slice_get_size')
18076  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
18077  *     "Return the size of the memory occupied by the slice in number of bytes"
18078  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
18079  */
18080 
__pyx_memoryview_slice_get_size(__Pyx_memviewslice * __pyx_v_src,int __pyx_v_ndim)18081 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
18082   Py_ssize_t __pyx_v_shape;
18083   Py_ssize_t __pyx_v_size;
18084   Py_ssize_t __pyx_r;
18085   Py_ssize_t __pyx_t_1;
18086   Py_ssize_t *__pyx_t_2;
18087   Py_ssize_t *__pyx_t_3;
18088   Py_ssize_t *__pyx_t_4;
18089 
18090   /* "View.MemoryView":1179
18091  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:
18092  *     "Return the size of the memory occupied by the slice in number of bytes"
18093  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize             # <<<<<<<<<<<<<<
18094  *
18095  *     for shape in src.shape[:ndim]:
18096  */
18097   __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
18098   __pyx_v_size = __pyx_t_1;
18099 
18100   /* "View.MemoryView":1181
18101  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
18102  *
18103  *     for shape in src.shape[:ndim]:             # <<<<<<<<<<<<<<
18104  *         size *= shape
18105  *
18106  */
18107   __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
18108   for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
18109     __pyx_t_2 = __pyx_t_4;
18110     __pyx_v_shape = (__pyx_t_2[0]);
18111 
18112     /* "View.MemoryView":1182
18113  *
18114  *     for shape in src.shape[:ndim]:
18115  *         size *= shape             # <<<<<<<<<<<<<<
18116  *
18117  *     return size
18118  */
18119     __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
18120   }
18121 
18122   /* "View.MemoryView":1184
18123  *         size *= shape
18124  *
18125  *     return size             # <<<<<<<<<<<<<<
18126  *
18127  * @cname('__pyx_fill_contig_strides_array')
18128  */
18129   __pyx_r = __pyx_v_size;
18130   goto __pyx_L0;
18131 
18132   /* "View.MemoryView":1177
18133  *
18134  * @cname('__pyx_memoryview_slice_get_size')
18135  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
18136  *     "Return the size of the memory occupied by the slice in number of bytes"
18137  *     cdef Py_ssize_t shape, size = src.memview.view.itemsize
18138  */
18139 
18140   /* function exit code */
18141   __pyx_L0:;
18142   return __pyx_r;
18143 }
18144 
18145 /* "View.MemoryView":1187
18146  *
18147  * @cname('__pyx_fill_contig_strides_array')
18148  * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
18149  *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
18150  *                 int ndim, char order) nogil:
18151  */
18152 
__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)18153 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) {
18154   int __pyx_v_idx;
18155   Py_ssize_t __pyx_r;
18156   int __pyx_t_1;
18157   int __pyx_t_2;
18158   int __pyx_t_3;
18159   int __pyx_t_4;
18160 
18161   /* "View.MemoryView":1196
18162  *     cdef int idx
18163  *
18164  *     if order == 'F':             # <<<<<<<<<<<<<<
18165  *         for idx in range(ndim):
18166  *             strides[idx] = stride
18167  */
18168   __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
18169   if (__pyx_t_1) {
18170 
18171     /* "View.MemoryView":1197
18172  *
18173  *     if order == 'F':
18174  *         for idx in range(ndim):             # <<<<<<<<<<<<<<
18175  *             strides[idx] = stride
18176  *             stride *= shape[idx]
18177  */
18178     __pyx_t_2 = __pyx_v_ndim;
18179     __pyx_t_3 = __pyx_t_2;
18180     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18181       __pyx_v_idx = __pyx_t_4;
18182 
18183       /* "View.MemoryView":1198
18184  *     if order == 'F':
18185  *         for idx in range(ndim):
18186  *             strides[idx] = stride             # <<<<<<<<<<<<<<
18187  *             stride *= shape[idx]
18188  *     else:
18189  */
18190       (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
18191 
18192       /* "View.MemoryView":1199
18193  *         for idx in range(ndim):
18194  *             strides[idx] = stride
18195  *             stride *= shape[idx]             # <<<<<<<<<<<<<<
18196  *     else:
18197  *         for idx in range(ndim - 1, -1, -1):
18198  */
18199       __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
18200     }
18201 
18202     /* "View.MemoryView":1196
18203  *     cdef int idx
18204  *
18205  *     if order == 'F':             # <<<<<<<<<<<<<<
18206  *         for idx in range(ndim):
18207  *             strides[idx] = stride
18208  */
18209     goto __pyx_L3;
18210   }
18211 
18212   /* "View.MemoryView":1201
18213  *             stride *= shape[idx]
18214  *     else:
18215  *         for idx in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
18216  *             strides[idx] = stride
18217  *             stride *= shape[idx]
18218  */
18219   /*else*/ {
18220     for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
18221       __pyx_v_idx = __pyx_t_2;
18222 
18223       /* "View.MemoryView":1202
18224  *     else:
18225  *         for idx in range(ndim - 1, -1, -1):
18226  *             strides[idx] = stride             # <<<<<<<<<<<<<<
18227  *             stride *= shape[idx]
18228  *
18229  */
18230       (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
18231 
18232       /* "View.MemoryView":1203
18233  *         for idx in range(ndim - 1, -1, -1):
18234  *             strides[idx] = stride
18235  *             stride *= shape[idx]             # <<<<<<<<<<<<<<
18236  *
18237  *     return stride
18238  */
18239       __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
18240     }
18241   }
18242   __pyx_L3:;
18243 
18244   /* "View.MemoryView":1205
18245  *             stride *= shape[idx]
18246  *
18247  *     return stride             # <<<<<<<<<<<<<<
18248  *
18249  * @cname('__pyx_memoryview_copy_data_to_temp')
18250  */
18251   __pyx_r = __pyx_v_stride;
18252   goto __pyx_L0;
18253 
18254   /* "View.MemoryView":1187
18255  *
18256  * @cname('__pyx_fill_contig_strides_array')
18257  * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
18258  *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
18259  *                 int ndim, char order) nogil:
18260  */
18261 
18262   /* function exit code */
18263   __pyx_L0:;
18264   return __pyx_r;
18265 }
18266 
18267 /* "View.MemoryView":1208
18268  *
18269  * @cname('__pyx_memoryview_copy_data_to_temp')
18270  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
18271  *                              __Pyx_memviewslice *tmpslice,
18272  *                              char order,
18273  */
18274 
__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice * __pyx_v_src,__Pyx_memviewslice * __pyx_v_tmpslice,char __pyx_v_order,int __pyx_v_ndim)18275 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) {
18276   int __pyx_v_i;
18277   void *__pyx_v_result;
18278   size_t __pyx_v_itemsize;
18279   size_t __pyx_v_size;
18280   void *__pyx_r;
18281   Py_ssize_t __pyx_t_1;
18282   int __pyx_t_2;
18283   int __pyx_t_3;
18284   struct __pyx_memoryview_obj *__pyx_t_4;
18285   int __pyx_t_5;
18286   int __pyx_t_6;
18287   int __pyx_lineno = 0;
18288   const char *__pyx_filename = NULL;
18289   int __pyx_clineno = 0;
18290 
18291   /* "View.MemoryView":1219
18292  *     cdef void *result
18293  *
18294  *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
18295  *     cdef size_t size = slice_get_size(src, ndim)
18296  *
18297  */
18298   __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
18299   __pyx_v_itemsize = __pyx_t_1;
18300 
18301   /* "View.MemoryView":1220
18302  *
18303  *     cdef size_t itemsize = src.memview.view.itemsize
18304  *     cdef size_t size = slice_get_size(src, ndim)             # <<<<<<<<<<<<<<
18305  *
18306  *     result = malloc(size)
18307  */
18308   __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
18309 
18310   /* "View.MemoryView":1222
18311  *     cdef size_t size = slice_get_size(src, ndim)
18312  *
18313  *     result = malloc(size)             # <<<<<<<<<<<<<<
18314  *     if not result:
18315  *         _err(MemoryError, NULL)
18316  */
18317   __pyx_v_result = malloc(__pyx_v_size);
18318 
18319   /* "View.MemoryView":1223
18320  *
18321  *     result = malloc(size)
18322  *     if not result:             # <<<<<<<<<<<<<<
18323  *         _err(MemoryError, NULL)
18324  *
18325  */
18326   __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
18327   if (__pyx_t_2) {
18328 
18329     /* "View.MemoryView":1224
18330  *     result = malloc(size)
18331  *     if not result:
18332  *         _err(MemoryError, NULL)             # <<<<<<<<<<<<<<
18333  *
18334  *
18335  */
18336     __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1224, __pyx_L1_error)
18337 
18338     /* "View.MemoryView":1223
18339  *
18340  *     result = malloc(size)
18341  *     if not result:             # <<<<<<<<<<<<<<
18342  *         _err(MemoryError, NULL)
18343  *
18344  */
18345   }
18346 
18347   /* "View.MemoryView":1227
18348  *
18349  *
18350  *     tmpslice.data = <char *> result             # <<<<<<<<<<<<<<
18351  *     tmpslice.memview = src.memview
18352  *     for i in range(ndim):
18353  */
18354   __pyx_v_tmpslice->data = ((char *)__pyx_v_result);
18355 
18356   /* "View.MemoryView":1228
18357  *
18358  *     tmpslice.data = <char *> result
18359  *     tmpslice.memview = src.memview             # <<<<<<<<<<<<<<
18360  *     for i in range(ndim):
18361  *         tmpslice.shape[i] = src.shape[i]
18362  */
18363   __pyx_t_4 = __pyx_v_src->memview;
18364   __pyx_v_tmpslice->memview = __pyx_t_4;
18365 
18366   /* "View.MemoryView":1229
18367  *     tmpslice.data = <char *> result
18368  *     tmpslice.memview = src.memview
18369  *     for i in range(ndim):             # <<<<<<<<<<<<<<
18370  *         tmpslice.shape[i] = src.shape[i]
18371  *         tmpslice.suboffsets[i] = -1
18372  */
18373   __pyx_t_3 = __pyx_v_ndim;
18374   __pyx_t_5 = __pyx_t_3;
18375   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18376     __pyx_v_i = __pyx_t_6;
18377 
18378     /* "View.MemoryView":1230
18379  *     tmpslice.memview = src.memview
18380  *     for i in range(ndim):
18381  *         tmpslice.shape[i] = src.shape[i]             # <<<<<<<<<<<<<<
18382  *         tmpslice.suboffsets[i] = -1
18383  *
18384  */
18385     (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
18386 
18387     /* "View.MemoryView":1231
18388  *     for i in range(ndim):
18389  *         tmpslice.shape[i] = src.shape[i]
18390  *         tmpslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
18391  *
18392  *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
18393  */
18394     (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
18395   }
18396 
18397   /* "View.MemoryView":1233
18398  *         tmpslice.suboffsets[i] = -1
18399  *
18400  *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,             # <<<<<<<<<<<<<<
18401  *                               ndim, order)
18402  *
18403  */
18404   (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));
18405 
18406   /* "View.MemoryView":1237
18407  *
18408  *
18409  *     for i in range(ndim):             # <<<<<<<<<<<<<<
18410  *         if tmpslice.shape[i] == 1:
18411  *             tmpslice.strides[i] = 0
18412  */
18413   __pyx_t_3 = __pyx_v_ndim;
18414   __pyx_t_5 = __pyx_t_3;
18415   for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18416     __pyx_v_i = __pyx_t_6;
18417 
18418     /* "View.MemoryView":1238
18419  *
18420  *     for i in range(ndim):
18421  *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
18422  *             tmpslice.strides[i] = 0
18423  *
18424  */
18425     __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
18426     if (__pyx_t_2) {
18427 
18428       /* "View.MemoryView":1239
18429  *     for i in range(ndim):
18430  *         if tmpslice.shape[i] == 1:
18431  *             tmpslice.strides[i] = 0             # <<<<<<<<<<<<<<
18432  *
18433  *     if slice_is_contig(src[0], order, ndim):
18434  */
18435       (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
18436 
18437       /* "View.MemoryView":1238
18438  *
18439  *     for i in range(ndim):
18440  *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
18441  *             tmpslice.strides[i] = 0
18442  *
18443  */
18444     }
18445   }
18446 
18447   /* "View.MemoryView":1241
18448  *             tmpslice.strides[i] = 0
18449  *
18450  *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
18451  *         memcpy(result, src.data, size)
18452  *     else:
18453  */
18454   __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
18455   if (__pyx_t_2) {
18456 
18457     /* "View.MemoryView":1242
18458  *
18459  *     if slice_is_contig(src[0], order, ndim):
18460  *         memcpy(result, src.data, size)             # <<<<<<<<<<<<<<
18461  *     else:
18462  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
18463  */
18464     (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
18465 
18466     /* "View.MemoryView":1241
18467  *             tmpslice.strides[i] = 0
18468  *
18469  *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
18470  *         memcpy(result, src.data, size)
18471  *     else:
18472  */
18473     goto __pyx_L9;
18474   }
18475 
18476   /* "View.MemoryView":1244
18477  *         memcpy(result, src.data, size)
18478  *     else:
18479  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)             # <<<<<<<<<<<<<<
18480  *
18481  *     return result
18482  */
18483   /*else*/ {
18484     copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
18485   }
18486   __pyx_L9:;
18487 
18488   /* "View.MemoryView":1246
18489  *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
18490  *
18491  *     return result             # <<<<<<<<<<<<<<
18492  *
18493  *
18494  */
18495   __pyx_r = __pyx_v_result;
18496   goto __pyx_L0;
18497 
18498   /* "View.MemoryView":1208
18499  *
18500  * @cname('__pyx_memoryview_copy_data_to_temp')
18501  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
18502  *                              __Pyx_memviewslice *tmpslice,
18503  *                              char order,
18504  */
18505 
18506   /* function exit code */
18507   __pyx_L1_error:;
18508   {
18509     #ifdef WITH_THREAD
18510     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18511     #endif
18512     __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
18513     #ifdef WITH_THREAD
18514     __Pyx_PyGILState_Release(__pyx_gilstate_save);
18515     #endif
18516   }
18517   __pyx_r = NULL;
18518   __pyx_L0:;
18519   return __pyx_r;
18520 }
18521 
18522 /* "View.MemoryView":1251
18523  *
18524  * @cname('__pyx_memoryview_err_extents')
18525  * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
18526  *                              Py_ssize_t extent2) except -1 with gil:
18527  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
18528  */
18529 
__pyx_memoryview_err_extents(int __pyx_v_i,Py_ssize_t __pyx_v_extent1,Py_ssize_t __pyx_v_extent2)18530 static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
18531   int __pyx_r;
18532   __Pyx_RefNannyDeclarations
18533   PyObject *__pyx_t_1 = NULL;
18534   PyObject *__pyx_t_2 = NULL;
18535   PyObject *__pyx_t_3 = NULL;
18536   PyObject *__pyx_t_4 = NULL;
18537   int __pyx_lineno = 0;
18538   const char *__pyx_filename = NULL;
18539   int __pyx_clineno = 0;
18540   #ifdef WITH_THREAD
18541   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18542   #endif
18543   __Pyx_RefNannySetupContext("_err_extents", 0);
18544 
18545   /* "View.MemoryView":1254
18546  *                              Py_ssize_t extent2) except -1 with gil:
18547  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
18548  *                                                         (i, extent1, extent2))             # <<<<<<<<<<<<<<
18549  *
18550  * @cname('__pyx_memoryview_err_dim')
18551  */
18552   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1254, __pyx_L1_error)
18553   __Pyx_GOTREF(__pyx_t_1);
18554   __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1254, __pyx_L1_error)
18555   __Pyx_GOTREF(__pyx_t_2);
18556   __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1254, __pyx_L1_error)
18557   __Pyx_GOTREF(__pyx_t_3);
18558   __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1254, __pyx_L1_error)
18559   __Pyx_GOTREF(__pyx_t_4);
18560   __Pyx_GIVEREF(__pyx_t_1);
18561   PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
18562   __Pyx_GIVEREF(__pyx_t_2);
18563   PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
18564   __Pyx_GIVEREF(__pyx_t_3);
18565   PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
18566   __pyx_t_1 = 0;
18567   __pyx_t_2 = 0;
18568   __pyx_t_3 = 0;
18569 
18570   /* "View.MemoryView":1253
18571  * cdef int _err_extents(int i, Py_ssize_t extent1,
18572  *                              Py_ssize_t extent2) except -1 with gil:
18573  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %             # <<<<<<<<<<<<<<
18574  *                                                         (i, extent1, extent2))
18575  *
18576  */
18577   __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1253, __pyx_L1_error)
18578   __Pyx_GOTREF(__pyx_t_3);
18579   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18580   __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1253, __pyx_L1_error)
18581   __Pyx_GOTREF(__pyx_t_4);
18582   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18583   __Pyx_Raise(__pyx_t_4, 0, 0, 0);
18584   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18585   __PYX_ERR(1, 1253, __pyx_L1_error)
18586 
18587   /* "View.MemoryView":1251
18588  *
18589  * @cname('__pyx_memoryview_err_extents')
18590  * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
18591  *                              Py_ssize_t extent2) except -1 with gil:
18592  *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
18593  */
18594 
18595   /* function exit code */
18596   __pyx_L1_error:;
18597   __Pyx_XDECREF(__pyx_t_1);
18598   __Pyx_XDECREF(__pyx_t_2);
18599   __Pyx_XDECREF(__pyx_t_3);
18600   __Pyx_XDECREF(__pyx_t_4);
18601   __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
18602   __pyx_r = -1;
18603   __Pyx_RefNannyFinishContext();
18604   #ifdef WITH_THREAD
18605   __Pyx_PyGILState_Release(__pyx_gilstate_save);
18606   #endif
18607   return __pyx_r;
18608 }
18609 
18610 /* "View.MemoryView":1257
18611  *
18612  * @cname('__pyx_memoryview_err_dim')
18613  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
18614  *     raise error(msg.decode('ascii') % dim)
18615  *
18616  */
18617 
__pyx_memoryview_err_dim(PyObject * __pyx_v_error,char * __pyx_v_msg,int __pyx_v_dim)18618 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
18619   int __pyx_r;
18620   __Pyx_RefNannyDeclarations
18621   PyObject *__pyx_t_1 = NULL;
18622   PyObject *__pyx_t_2 = NULL;
18623   PyObject *__pyx_t_3 = NULL;
18624   PyObject *__pyx_t_4 = NULL;
18625   int __pyx_lineno = 0;
18626   const char *__pyx_filename = NULL;
18627   int __pyx_clineno = 0;
18628   #ifdef WITH_THREAD
18629   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18630   #endif
18631   __Pyx_RefNannySetupContext("_err_dim", 0);
18632   __Pyx_INCREF(__pyx_v_error);
18633 
18634   /* "View.MemoryView":1258
18635  * @cname('__pyx_memoryview_err_dim')
18636  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
18637  *     raise error(msg.decode('ascii') % dim)             # <<<<<<<<<<<<<<
18638  *
18639  * @cname('__pyx_memoryview_err')
18640  */
18641   __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1258, __pyx_L1_error)
18642   __Pyx_GOTREF(__pyx_t_2);
18643   __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1258, __pyx_L1_error)
18644   __Pyx_GOTREF(__pyx_t_3);
18645   __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1258, __pyx_L1_error)
18646   __Pyx_GOTREF(__pyx_t_4);
18647   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18648   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18649   __Pyx_INCREF(__pyx_v_error);
18650   __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
18651   if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
18652     __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
18653     if (likely(__pyx_t_2)) {
18654       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
18655       __Pyx_INCREF(__pyx_t_2);
18656       __Pyx_INCREF(function);
18657       __Pyx_DECREF_SET(__pyx_t_3, function);
18658     }
18659   }
18660   __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);
18661   __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
18662   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18663   if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1258, __pyx_L1_error)
18664   __Pyx_GOTREF(__pyx_t_1);
18665   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18666   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
18667   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18668   __PYX_ERR(1, 1258, __pyx_L1_error)
18669 
18670   /* "View.MemoryView":1257
18671  *
18672  * @cname('__pyx_memoryview_err_dim')
18673  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
18674  *     raise error(msg.decode('ascii') % dim)
18675  *
18676  */
18677 
18678   /* function exit code */
18679   __pyx_L1_error:;
18680   __Pyx_XDECREF(__pyx_t_1);
18681   __Pyx_XDECREF(__pyx_t_2);
18682   __Pyx_XDECREF(__pyx_t_3);
18683   __Pyx_XDECREF(__pyx_t_4);
18684   __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
18685   __pyx_r = -1;
18686   __Pyx_XDECREF(__pyx_v_error);
18687   __Pyx_RefNannyFinishContext();
18688   #ifdef WITH_THREAD
18689   __Pyx_PyGILState_Release(__pyx_gilstate_save);
18690   #endif
18691   return __pyx_r;
18692 }
18693 
18694 /* "View.MemoryView":1261
18695  *
18696  * @cname('__pyx_memoryview_err')
18697  * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
18698  *     if msg != NULL:
18699  *         raise error(msg.decode('ascii'))
18700  */
18701 
__pyx_memoryview_err(PyObject * __pyx_v_error,char * __pyx_v_msg)18702 static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
18703   int __pyx_r;
18704   __Pyx_RefNannyDeclarations
18705   int __pyx_t_1;
18706   PyObject *__pyx_t_2 = NULL;
18707   PyObject *__pyx_t_3 = NULL;
18708   PyObject *__pyx_t_4 = NULL;
18709   PyObject *__pyx_t_5 = NULL;
18710   int __pyx_lineno = 0;
18711   const char *__pyx_filename = NULL;
18712   int __pyx_clineno = 0;
18713   #ifdef WITH_THREAD
18714   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18715   #endif
18716   __Pyx_RefNannySetupContext("_err", 0);
18717   __Pyx_INCREF(__pyx_v_error);
18718 
18719   /* "View.MemoryView":1262
18720  * @cname('__pyx_memoryview_err')
18721  * cdef int _err(object error, char *msg) except -1 with gil:
18722  *     if msg != NULL:             # <<<<<<<<<<<<<<
18723  *         raise error(msg.decode('ascii'))
18724  *     else:
18725  */
18726   __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
18727   if (unlikely(__pyx_t_1)) {
18728 
18729     /* "View.MemoryView":1263
18730  * cdef int _err(object error, char *msg) except -1 with gil:
18731  *     if msg != NULL:
18732  *         raise error(msg.decode('ascii'))             # <<<<<<<<<<<<<<
18733  *     else:
18734  *         raise error
18735  */
18736     __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1263, __pyx_L1_error)
18737     __Pyx_GOTREF(__pyx_t_3);
18738     __Pyx_INCREF(__pyx_v_error);
18739     __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
18740     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
18741       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
18742       if (likely(__pyx_t_5)) {
18743         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
18744         __Pyx_INCREF(__pyx_t_5);
18745         __Pyx_INCREF(function);
18746         __Pyx_DECREF_SET(__pyx_t_4, function);
18747       }
18748     }
18749     __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);
18750     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
18751     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18752     if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1263, __pyx_L1_error)
18753     __Pyx_GOTREF(__pyx_t_2);
18754     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18755     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
18756     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18757     __PYX_ERR(1, 1263, __pyx_L1_error)
18758 
18759     /* "View.MemoryView":1262
18760  * @cname('__pyx_memoryview_err')
18761  * cdef int _err(object error, char *msg) except -1 with gil:
18762  *     if msg != NULL:             # <<<<<<<<<<<<<<
18763  *         raise error(msg.decode('ascii'))
18764  *     else:
18765  */
18766   }
18767 
18768   /* "View.MemoryView":1265
18769  *         raise error(msg.decode('ascii'))
18770  *     else:
18771  *         raise error             # <<<<<<<<<<<<<<
18772  *
18773  * @cname('__pyx_memoryview_copy_contents')
18774  */
18775   /*else*/ {
18776     __Pyx_Raise(__pyx_v_error, 0, 0, 0);
18777     __PYX_ERR(1, 1265, __pyx_L1_error)
18778   }
18779 
18780   /* "View.MemoryView":1261
18781  *
18782  * @cname('__pyx_memoryview_err')
18783  * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
18784  *     if msg != NULL:
18785  *         raise error(msg.decode('ascii'))
18786  */
18787 
18788   /* function exit code */
18789   __pyx_L1_error:;
18790   __Pyx_XDECREF(__pyx_t_2);
18791   __Pyx_XDECREF(__pyx_t_3);
18792   __Pyx_XDECREF(__pyx_t_4);
18793   __Pyx_XDECREF(__pyx_t_5);
18794   __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
18795   __pyx_r = -1;
18796   __Pyx_XDECREF(__pyx_v_error);
18797   __Pyx_RefNannyFinishContext();
18798   #ifdef WITH_THREAD
18799   __Pyx_PyGILState_Release(__pyx_gilstate_save);
18800   #endif
18801   return __pyx_r;
18802 }
18803 
18804 /* "View.MemoryView":1268
18805  *
18806  * @cname('__pyx_memoryview_copy_contents')
18807  * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
18808  *                                   __Pyx_memviewslice dst,
18809  *                                   int src_ndim, int dst_ndim,
18810  */
18811 
__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)18812 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) {
18813   void *__pyx_v_tmpdata;
18814   size_t __pyx_v_itemsize;
18815   int __pyx_v_i;
18816   char __pyx_v_order;
18817   int __pyx_v_broadcasting;
18818   int __pyx_v_direct_copy;
18819   __Pyx_memviewslice __pyx_v_tmp;
18820   int __pyx_v_ndim;
18821   int __pyx_r;
18822   Py_ssize_t __pyx_t_1;
18823   int __pyx_t_2;
18824   int __pyx_t_3;
18825   int __pyx_t_4;
18826   int __pyx_t_5;
18827   int __pyx_t_6;
18828   void *__pyx_t_7;
18829   int __pyx_t_8;
18830   int __pyx_lineno = 0;
18831   const char *__pyx_filename = NULL;
18832   int __pyx_clineno = 0;
18833 
18834   /* "View.MemoryView":1276
18835  *     Check for overlapping memory and verify the shapes.
18836  *     """
18837  *     cdef void *tmpdata = NULL             # <<<<<<<<<<<<<<
18838  *     cdef size_t itemsize = src.memview.view.itemsize
18839  *     cdef int i
18840  */
18841   __pyx_v_tmpdata = NULL;
18842 
18843   /* "View.MemoryView":1277
18844  *     """
18845  *     cdef void *tmpdata = NULL
18846  *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
18847  *     cdef int i
18848  *     cdef char order = get_best_order(&src, src_ndim)
18849  */
18850   __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
18851   __pyx_v_itemsize = __pyx_t_1;
18852 
18853   /* "View.MemoryView":1279
18854  *     cdef size_t itemsize = src.memview.view.itemsize
18855  *     cdef int i
18856  *     cdef char order = get_best_order(&src, src_ndim)             # <<<<<<<<<<<<<<
18857  *     cdef bint broadcasting = False
18858  *     cdef bint direct_copy = False
18859  */
18860   __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
18861 
18862   /* "View.MemoryView":1280
18863  *     cdef int i
18864  *     cdef char order = get_best_order(&src, src_ndim)
18865  *     cdef bint broadcasting = False             # <<<<<<<<<<<<<<
18866  *     cdef bint direct_copy = False
18867  *     cdef __Pyx_memviewslice tmp
18868  */
18869   __pyx_v_broadcasting = 0;
18870 
18871   /* "View.MemoryView":1281
18872  *     cdef char order = get_best_order(&src, src_ndim)
18873  *     cdef bint broadcasting = False
18874  *     cdef bint direct_copy = False             # <<<<<<<<<<<<<<
18875  *     cdef __Pyx_memviewslice tmp
18876  *
18877  */
18878   __pyx_v_direct_copy = 0;
18879 
18880   /* "View.MemoryView":1284
18881  *     cdef __Pyx_memviewslice tmp
18882  *
18883  *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
18884  *         broadcast_leading(&src, src_ndim, dst_ndim)
18885  *     elif dst_ndim < src_ndim:
18886  */
18887   __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
18888   if (__pyx_t_2) {
18889 
18890     /* "View.MemoryView":1285
18891  *
18892  *     if src_ndim < dst_ndim:
18893  *         broadcast_leading(&src, src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
18894  *     elif dst_ndim < src_ndim:
18895  *         broadcast_leading(&dst, dst_ndim, src_ndim)
18896  */
18897     __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
18898 
18899     /* "View.MemoryView":1284
18900  *     cdef __Pyx_memviewslice tmp
18901  *
18902  *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
18903  *         broadcast_leading(&src, src_ndim, dst_ndim)
18904  *     elif dst_ndim < src_ndim:
18905  */
18906     goto __pyx_L3;
18907   }
18908 
18909   /* "View.MemoryView":1286
18910  *     if src_ndim < dst_ndim:
18911  *         broadcast_leading(&src, src_ndim, dst_ndim)
18912  *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
18913  *         broadcast_leading(&dst, dst_ndim, src_ndim)
18914  *
18915  */
18916   __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
18917   if (__pyx_t_2) {
18918 
18919     /* "View.MemoryView":1287
18920  *         broadcast_leading(&src, src_ndim, dst_ndim)
18921  *     elif dst_ndim < src_ndim:
18922  *         broadcast_leading(&dst, dst_ndim, src_ndim)             # <<<<<<<<<<<<<<
18923  *
18924  *     cdef int ndim = max(src_ndim, dst_ndim)
18925  */
18926     __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
18927 
18928     /* "View.MemoryView":1286
18929  *     if src_ndim < dst_ndim:
18930  *         broadcast_leading(&src, src_ndim, dst_ndim)
18931  *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
18932  *         broadcast_leading(&dst, dst_ndim, src_ndim)
18933  *
18934  */
18935   }
18936   __pyx_L3:;
18937 
18938   /* "View.MemoryView":1289
18939  *         broadcast_leading(&dst, dst_ndim, src_ndim)
18940  *
18941  *     cdef int ndim = max(src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
18942  *
18943  *     for i in range(ndim):
18944  */
18945   __pyx_t_3 = __pyx_v_dst_ndim;
18946   __pyx_t_4 = __pyx_v_src_ndim;
18947   if (((__pyx_t_3 > __pyx_t_4) != 0)) {
18948     __pyx_t_5 = __pyx_t_3;
18949   } else {
18950     __pyx_t_5 = __pyx_t_4;
18951   }
18952   __pyx_v_ndim = __pyx_t_5;
18953 
18954   /* "View.MemoryView":1291
18955  *     cdef int ndim = max(src_ndim, dst_ndim)
18956  *
18957  *     for i in range(ndim):             # <<<<<<<<<<<<<<
18958  *         if src.shape[i] != dst.shape[i]:
18959  *             if src.shape[i] == 1:
18960  */
18961   __pyx_t_5 = __pyx_v_ndim;
18962   __pyx_t_3 = __pyx_t_5;
18963   for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18964     __pyx_v_i = __pyx_t_4;
18965 
18966     /* "View.MemoryView":1292
18967  *
18968  *     for i in range(ndim):
18969  *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
18970  *             if src.shape[i] == 1:
18971  *                 broadcasting = True
18972  */
18973     __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
18974     if (__pyx_t_2) {
18975 
18976       /* "View.MemoryView":1293
18977  *     for i in range(ndim):
18978  *         if src.shape[i] != dst.shape[i]:
18979  *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
18980  *                 broadcasting = True
18981  *                 src.strides[i] = 0
18982  */
18983       __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
18984       if (__pyx_t_2) {
18985 
18986         /* "View.MemoryView":1294
18987  *         if src.shape[i] != dst.shape[i]:
18988  *             if src.shape[i] == 1:
18989  *                 broadcasting = True             # <<<<<<<<<<<<<<
18990  *                 src.strides[i] = 0
18991  *             else:
18992  */
18993         __pyx_v_broadcasting = 1;
18994 
18995         /* "View.MemoryView":1295
18996  *             if src.shape[i] == 1:
18997  *                 broadcasting = True
18998  *                 src.strides[i] = 0             # <<<<<<<<<<<<<<
18999  *             else:
19000  *                 _err_extents(i, dst.shape[i], src.shape[i])
19001  */
19002         (__pyx_v_src.strides[__pyx_v_i]) = 0;
19003 
19004         /* "View.MemoryView":1293
19005  *     for i in range(ndim):
19006  *         if src.shape[i] != dst.shape[i]:
19007  *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
19008  *                 broadcasting = True
19009  *                 src.strides[i] = 0
19010  */
19011         goto __pyx_L7;
19012       }
19013 
19014       /* "View.MemoryView":1297
19015  *                 src.strides[i] = 0
19016  *             else:
19017  *                 _err_extents(i, dst.shape[i], src.shape[i])             # <<<<<<<<<<<<<<
19018  *
19019  *         if src.suboffsets[i] >= 0:
19020  */
19021       /*else*/ {
19022         __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1297, __pyx_L1_error)
19023       }
19024       __pyx_L7:;
19025 
19026       /* "View.MemoryView":1292
19027  *
19028  *     for i in range(ndim):
19029  *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
19030  *             if src.shape[i] == 1:
19031  *                 broadcasting = True
19032  */
19033     }
19034 
19035     /* "View.MemoryView":1299
19036  *                 _err_extents(i, dst.shape[i], src.shape[i])
19037  *
19038  *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
19039  *             _err_dim(ValueError, "Dimension %d is not direct", i)
19040  *
19041  */
19042     __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
19043     if (__pyx_t_2) {
19044 
19045       /* "View.MemoryView":1300
19046  *
19047  *         if src.suboffsets[i] >= 0:
19048  *             _err_dim(ValueError, "Dimension %d is not direct", i)             # <<<<<<<<<<<<<<
19049  *
19050  *     if slices_overlap(&src, &dst, ndim, itemsize):
19051  */
19052       __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1300, __pyx_L1_error)
19053 
19054       /* "View.MemoryView":1299
19055  *                 _err_extents(i, dst.shape[i], src.shape[i])
19056  *
19057  *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
19058  *             _err_dim(ValueError, "Dimension %d is not direct", i)
19059  *
19060  */
19061     }
19062   }
19063 
19064   /* "View.MemoryView":1302
19065  *             _err_dim(ValueError, "Dimension %d is not direct", i)
19066  *
19067  *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
19068  *
19069  *         if not slice_is_contig(src, order, ndim):
19070  */
19071   __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
19072   if (__pyx_t_2) {
19073 
19074     /* "View.MemoryView":1304
19075  *     if slices_overlap(&src, &dst, ndim, itemsize):
19076  *
19077  *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
19078  *             order = get_best_order(&dst, ndim)
19079  *
19080  */
19081     __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
19082     if (__pyx_t_2) {
19083 
19084       /* "View.MemoryView":1305
19085  *
19086  *         if not slice_is_contig(src, order, ndim):
19087  *             order = get_best_order(&dst, ndim)             # <<<<<<<<<<<<<<
19088  *
19089  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
19090  */
19091       __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
19092 
19093       /* "View.MemoryView":1304
19094  *     if slices_overlap(&src, &dst, ndim, itemsize):
19095  *
19096  *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
19097  *             order = get_best_order(&dst, ndim)
19098  *
19099  */
19100     }
19101 
19102     /* "View.MemoryView":1307
19103  *             order = get_best_order(&dst, ndim)
19104  *
19105  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)             # <<<<<<<<<<<<<<
19106  *         src = tmp
19107  *
19108  */
19109     __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1307, __pyx_L1_error)
19110     __pyx_v_tmpdata = __pyx_t_7;
19111 
19112     /* "View.MemoryView":1308
19113  *
19114  *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
19115  *         src = tmp             # <<<<<<<<<<<<<<
19116  *
19117  *     if not broadcasting:
19118  */
19119     __pyx_v_src = __pyx_v_tmp;
19120 
19121     /* "View.MemoryView":1302
19122  *             _err_dim(ValueError, "Dimension %d is not direct", i)
19123  *
19124  *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
19125  *
19126  *         if not slice_is_contig(src, order, ndim):
19127  */
19128   }
19129 
19130   /* "View.MemoryView":1310
19131  *         src = tmp
19132  *
19133  *     if not broadcasting:             # <<<<<<<<<<<<<<
19134  *
19135  *
19136  */
19137   __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
19138   if (__pyx_t_2) {
19139 
19140     /* "View.MemoryView":1313
19141  *
19142  *
19143  *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
19144  *             direct_copy = slice_is_contig(dst, 'C', ndim)
19145  *         elif slice_is_contig(src, 'F', ndim):
19146  */
19147     __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
19148     if (__pyx_t_2) {
19149 
19150       /* "View.MemoryView":1314
19151  *
19152  *         if slice_is_contig(src, 'C', ndim):
19153  *             direct_copy = slice_is_contig(dst, 'C', ndim)             # <<<<<<<<<<<<<<
19154  *         elif slice_is_contig(src, 'F', ndim):
19155  *             direct_copy = slice_is_contig(dst, 'F', ndim)
19156  */
19157       __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);
19158 
19159       /* "View.MemoryView":1313
19160  *
19161  *
19162  *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
19163  *             direct_copy = slice_is_contig(dst, 'C', ndim)
19164  *         elif slice_is_contig(src, 'F', ndim):
19165  */
19166       goto __pyx_L12;
19167     }
19168 
19169     /* "View.MemoryView":1315
19170  *         if slice_is_contig(src, 'C', ndim):
19171  *             direct_copy = slice_is_contig(dst, 'C', ndim)
19172  *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
19173  *             direct_copy = slice_is_contig(dst, 'F', ndim)
19174  *
19175  */
19176     __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
19177     if (__pyx_t_2) {
19178 
19179       /* "View.MemoryView":1316
19180  *             direct_copy = slice_is_contig(dst, 'C', ndim)
19181  *         elif slice_is_contig(src, 'F', ndim):
19182  *             direct_copy = slice_is_contig(dst, 'F', ndim)             # <<<<<<<<<<<<<<
19183  *
19184  *         if direct_copy:
19185  */
19186       __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);
19187 
19188       /* "View.MemoryView":1315
19189  *         if slice_is_contig(src, 'C', ndim):
19190  *             direct_copy = slice_is_contig(dst, 'C', ndim)
19191  *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
19192  *             direct_copy = slice_is_contig(dst, 'F', ndim)
19193  *
19194  */
19195     }
19196     __pyx_L12:;
19197 
19198     /* "View.MemoryView":1318
19199  *             direct_copy = slice_is_contig(dst, 'F', ndim)
19200  *
19201  *         if direct_copy:             # <<<<<<<<<<<<<<
19202  *
19203  *             refcount_copying(&dst, dtype_is_object, ndim, False)
19204  */
19205     __pyx_t_2 = (__pyx_v_direct_copy != 0);
19206     if (__pyx_t_2) {
19207 
19208       /* "View.MemoryView":1320
19209  *         if direct_copy:
19210  *
19211  *             refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
19212  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
19213  *             refcount_copying(&dst, dtype_is_object, ndim, True)
19214  */
19215       __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
19216 
19217       /* "View.MemoryView":1321
19218  *
19219  *             refcount_copying(&dst, dtype_is_object, ndim, False)
19220  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))             # <<<<<<<<<<<<<<
19221  *             refcount_copying(&dst, dtype_is_object, ndim, True)
19222  *             free(tmpdata)
19223  */
19224       (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
19225 
19226       /* "View.MemoryView":1322
19227  *             refcount_copying(&dst, dtype_is_object, ndim, False)
19228  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
19229  *             refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
19230  *             free(tmpdata)
19231  *             return 0
19232  */
19233       __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
19234 
19235       /* "View.MemoryView":1323
19236  *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
19237  *             refcount_copying(&dst, dtype_is_object, ndim, True)
19238  *             free(tmpdata)             # <<<<<<<<<<<<<<
19239  *             return 0
19240  *
19241  */
19242       free(__pyx_v_tmpdata);
19243 
19244       /* "View.MemoryView":1324
19245  *             refcount_copying(&dst, dtype_is_object, ndim, True)
19246  *             free(tmpdata)
19247  *             return 0             # <<<<<<<<<<<<<<
19248  *
19249  *     if order == 'F' == get_best_order(&dst, ndim):
19250  */
19251       __pyx_r = 0;
19252       goto __pyx_L0;
19253 
19254       /* "View.MemoryView":1318
19255  *             direct_copy = slice_is_contig(dst, 'F', ndim)
19256  *
19257  *         if direct_copy:             # <<<<<<<<<<<<<<
19258  *
19259  *             refcount_copying(&dst, dtype_is_object, ndim, False)
19260  */
19261     }
19262 
19263     /* "View.MemoryView":1310
19264  *         src = tmp
19265  *
19266  *     if not broadcasting:             # <<<<<<<<<<<<<<
19267  *
19268  *
19269  */
19270   }
19271 
19272   /* "View.MemoryView":1326
19273  *             return 0
19274  *
19275  *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
19276  *
19277  *
19278  */
19279   __pyx_t_2 = (__pyx_v_order == 'F');
19280   if (__pyx_t_2) {
19281     __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
19282   }
19283   __pyx_t_8 = (__pyx_t_2 != 0);
19284   if (__pyx_t_8) {
19285 
19286     /* "View.MemoryView":1329
19287  *
19288  *
19289  *         transpose_memslice(&src)             # <<<<<<<<<<<<<<
19290  *         transpose_memslice(&dst)
19291  *
19292  */
19293     __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(1, 1329, __pyx_L1_error)
19294 
19295     /* "View.MemoryView":1330
19296  *
19297  *         transpose_memslice(&src)
19298  *         transpose_memslice(&dst)             # <<<<<<<<<<<<<<
19299  *
19300  *     refcount_copying(&dst, dtype_is_object, ndim, False)
19301  */
19302     __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(1, 1330, __pyx_L1_error)
19303 
19304     /* "View.MemoryView":1326
19305  *             return 0
19306  *
19307  *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
19308  *
19309  *
19310  */
19311   }
19312 
19313   /* "View.MemoryView":1332
19314  *         transpose_memslice(&dst)
19315  *
19316  *     refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
19317  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
19318  *     refcount_copying(&dst, dtype_is_object, ndim, True)
19319  */
19320   __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
19321 
19322   /* "View.MemoryView":1333
19323  *
19324  *     refcount_copying(&dst, dtype_is_object, ndim, False)
19325  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)             # <<<<<<<<<<<<<<
19326  *     refcount_copying(&dst, dtype_is_object, ndim, True)
19327  *
19328  */
19329   copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
19330 
19331   /* "View.MemoryView":1334
19332  *     refcount_copying(&dst, dtype_is_object, ndim, False)
19333  *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
19334  *     refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
19335  *
19336  *     free(tmpdata)
19337  */
19338   __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
19339 
19340   /* "View.MemoryView":1336
19341  *     refcount_copying(&dst, dtype_is_object, ndim, True)
19342  *
19343  *     free(tmpdata)             # <<<<<<<<<<<<<<
19344  *     return 0
19345  *
19346  */
19347   free(__pyx_v_tmpdata);
19348 
19349   /* "View.MemoryView":1337
19350  *
19351  *     free(tmpdata)
19352  *     return 0             # <<<<<<<<<<<<<<
19353  *
19354  * @cname('__pyx_memoryview_broadcast_leading')
19355  */
19356   __pyx_r = 0;
19357   goto __pyx_L0;
19358 
19359   /* "View.MemoryView":1268
19360  *
19361  * @cname('__pyx_memoryview_copy_contents')
19362  * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
19363  *                                   __Pyx_memviewslice dst,
19364  *                                   int src_ndim, int dst_ndim,
19365  */
19366 
19367   /* function exit code */
19368   __pyx_L1_error:;
19369   {
19370     #ifdef WITH_THREAD
19371     PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19372     #endif
19373     __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
19374     #ifdef WITH_THREAD
19375     __Pyx_PyGILState_Release(__pyx_gilstate_save);
19376     #endif
19377   }
19378   __pyx_r = -1;
19379   __pyx_L0:;
19380   return __pyx_r;
19381 }
19382 
19383 /* "View.MemoryView":1340
19384  *
19385  * @cname('__pyx_memoryview_broadcast_leading')
19386  * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
19387  *                             int ndim,
19388  *                             int ndim_other) nogil:
19389  */
19390 
__pyx_memoryview_broadcast_leading(__Pyx_memviewslice * __pyx_v_mslice,int __pyx_v_ndim,int __pyx_v_ndim_other)19391 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
19392   int __pyx_v_i;
19393   int __pyx_v_offset;
19394   int __pyx_t_1;
19395   int __pyx_t_2;
19396   int __pyx_t_3;
19397 
19398   /* "View.MemoryView":1344
19399  *                             int ndim_other) nogil:
19400  *     cdef int i
19401  *     cdef int offset = ndim_other - ndim             # <<<<<<<<<<<<<<
19402  *
19403  *     for i in range(ndim - 1, -1, -1):
19404  */
19405   __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
19406 
19407   /* "View.MemoryView":1346
19408  *     cdef int offset = ndim_other - ndim
19409  *
19410  *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
19411  *         mslice.shape[i + offset] = mslice.shape[i]
19412  *         mslice.strides[i + offset] = mslice.strides[i]
19413  */
19414   for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
19415     __pyx_v_i = __pyx_t_1;
19416 
19417     /* "View.MemoryView":1347
19418  *
19419  *     for i in range(ndim - 1, -1, -1):
19420  *         mslice.shape[i + offset] = mslice.shape[i]             # <<<<<<<<<<<<<<
19421  *         mslice.strides[i + offset] = mslice.strides[i]
19422  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
19423  */
19424     (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
19425 
19426     /* "View.MemoryView":1348
19427  *     for i in range(ndim - 1, -1, -1):
19428  *         mslice.shape[i + offset] = mslice.shape[i]
19429  *         mslice.strides[i + offset] = mslice.strides[i]             # <<<<<<<<<<<<<<
19430  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
19431  *
19432  */
19433     (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
19434 
19435     /* "View.MemoryView":1349
19436  *         mslice.shape[i + offset] = mslice.shape[i]
19437  *         mslice.strides[i + offset] = mslice.strides[i]
19438  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]             # <<<<<<<<<<<<<<
19439  *
19440  *     for i in range(offset):
19441  */
19442     (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
19443   }
19444 
19445   /* "View.MemoryView":1351
19446  *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
19447  *
19448  *     for i in range(offset):             # <<<<<<<<<<<<<<
19449  *         mslice.shape[i] = 1
19450  *         mslice.strides[i] = mslice.strides[0]
19451  */
19452   __pyx_t_1 = __pyx_v_offset;
19453   __pyx_t_2 = __pyx_t_1;
19454   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
19455     __pyx_v_i = __pyx_t_3;
19456 
19457     /* "View.MemoryView":1352
19458  *
19459  *     for i in range(offset):
19460  *         mslice.shape[i] = 1             # <<<<<<<<<<<<<<
19461  *         mslice.strides[i] = mslice.strides[0]
19462  *         mslice.suboffsets[i] = -1
19463  */
19464     (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
19465 
19466     /* "View.MemoryView":1353
19467  *     for i in range(offset):
19468  *         mslice.shape[i] = 1
19469  *         mslice.strides[i] = mslice.strides[0]             # <<<<<<<<<<<<<<
19470  *         mslice.suboffsets[i] = -1
19471  *
19472  */
19473     (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
19474 
19475     /* "View.MemoryView":1354
19476  *         mslice.shape[i] = 1
19477  *         mslice.strides[i] = mslice.strides[0]
19478  *         mslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
19479  *
19480  *
19481  */
19482     (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
19483   }
19484 
19485   /* "View.MemoryView":1340
19486  *
19487  * @cname('__pyx_memoryview_broadcast_leading')
19488  * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
19489  *                             int ndim,
19490  *                             int ndim_other) nogil:
19491  */
19492 
19493   /* function exit code */
19494 }
19495 
19496 /* "View.MemoryView":1362
19497  *
19498  * @cname('__pyx_memoryview_refcount_copying')
19499  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
19500  *                            int ndim, bint inc) nogil:
19501  *
19502  */
19503 
__pyx_memoryview_refcount_copying(__Pyx_memviewslice * __pyx_v_dst,int __pyx_v_dtype_is_object,int __pyx_v_ndim,int __pyx_v_inc)19504 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) {
19505   int __pyx_t_1;
19506 
19507   /* "View.MemoryView":1366
19508  *
19509  *
19510  *     if dtype_is_object:             # <<<<<<<<<<<<<<
19511  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
19512  *                                            dst.strides, ndim, inc)
19513  */
19514   __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
19515   if (__pyx_t_1) {
19516 
19517     /* "View.MemoryView":1367
19518  *
19519  *     if dtype_is_object:
19520  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,             # <<<<<<<<<<<<<<
19521  *                                            dst.strides, ndim, inc)
19522  *
19523  */
19524     __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);
19525 
19526     /* "View.MemoryView":1366
19527  *
19528  *
19529  *     if dtype_is_object:             # <<<<<<<<<<<<<<
19530  *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
19531  *                                            dst.strides, ndim, inc)
19532  */
19533   }
19534 
19535   /* "View.MemoryView":1362
19536  *
19537  * @cname('__pyx_memoryview_refcount_copying')
19538  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
19539  *                            int ndim, bint inc) nogil:
19540  *
19541  */
19542 
19543   /* function exit code */
19544 }
19545 
19546 /* "View.MemoryView":1371
19547  *
19548  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
19549  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
19550  *                                              Py_ssize_t *strides, int ndim,
19551  *                                              bint inc) with gil:
19552  */
19553 
__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)19554 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) {
19555   __Pyx_RefNannyDeclarations
19556   #ifdef WITH_THREAD
19557   PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19558   #endif
19559   __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);
19560 
19561   /* "View.MemoryView":1374
19562  *                                              Py_ssize_t *strides, int ndim,
19563  *                                              bint inc) with gil:
19564  *     refcount_objects_in_slice(data, shape, strides, ndim, inc)             # <<<<<<<<<<<<<<
19565  *
19566  * @cname('__pyx_memoryview_refcount_objects_in_slice')
19567  */
19568   __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
19569 
19570   /* "View.MemoryView":1371
19571  *
19572  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
19573  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
19574  *                                              Py_ssize_t *strides, int ndim,
19575  *                                              bint inc) with gil:
19576  */
19577 
19578   /* function exit code */
19579   __Pyx_RefNannyFinishContext();
19580   #ifdef WITH_THREAD
19581   __Pyx_PyGILState_Release(__pyx_gilstate_save);
19582   #endif
19583 }
19584 
19585 /* "View.MemoryView":1377
19586  *
19587  * @cname('__pyx_memoryview_refcount_objects_in_slice')
19588  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
19589  *                                     Py_ssize_t *strides, int ndim, bint inc):
19590  *     cdef Py_ssize_t i
19591  */
19592 
__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)19593 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) {
19594   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
19595   __Pyx_RefNannyDeclarations
19596   Py_ssize_t __pyx_t_1;
19597   Py_ssize_t __pyx_t_2;
19598   Py_ssize_t __pyx_t_3;
19599   int __pyx_t_4;
19600   __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);
19601 
19602   /* "View.MemoryView":1381
19603  *     cdef Py_ssize_t i
19604  *
19605  *     for i in range(shape[0]):             # <<<<<<<<<<<<<<
19606  *         if ndim == 1:
19607  *             if inc:
19608  */
19609   __pyx_t_1 = (__pyx_v_shape[0]);
19610   __pyx_t_2 = __pyx_t_1;
19611   for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
19612     __pyx_v_i = __pyx_t_3;
19613 
19614     /* "View.MemoryView":1382
19615  *
19616  *     for i in range(shape[0]):
19617  *         if ndim == 1:             # <<<<<<<<<<<<<<
19618  *             if inc:
19619  *                 Py_INCREF((<PyObject **> data)[0])
19620  */
19621     __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
19622     if (__pyx_t_4) {
19623 
19624       /* "View.MemoryView":1383
19625  *     for i in range(shape[0]):
19626  *         if ndim == 1:
19627  *             if inc:             # <<<<<<<<<<<<<<
19628  *                 Py_INCREF((<PyObject **> data)[0])
19629  *             else:
19630  */
19631       __pyx_t_4 = (__pyx_v_inc != 0);
19632       if (__pyx_t_4) {
19633 
19634         /* "View.MemoryView":1384
19635  *         if ndim == 1:
19636  *             if inc:
19637  *                 Py_INCREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
19638  *             else:
19639  *                 Py_DECREF((<PyObject **> data)[0])
19640  */
19641         Py_INCREF((((PyObject **)__pyx_v_data)[0]));
19642 
19643         /* "View.MemoryView":1383
19644  *     for i in range(shape[0]):
19645  *         if ndim == 1:
19646  *             if inc:             # <<<<<<<<<<<<<<
19647  *                 Py_INCREF((<PyObject **> data)[0])
19648  *             else:
19649  */
19650         goto __pyx_L6;
19651       }
19652 
19653       /* "View.MemoryView":1386
19654  *                 Py_INCREF((<PyObject **> data)[0])
19655  *             else:
19656  *                 Py_DECREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
19657  *         else:
19658  *             refcount_objects_in_slice(data, shape + 1, strides + 1,
19659  */
19660       /*else*/ {
19661         Py_DECREF((((PyObject **)__pyx_v_data)[0]));
19662       }
19663       __pyx_L6:;
19664 
19665       /* "View.MemoryView":1382
19666  *
19667  *     for i in range(shape[0]):
19668  *         if ndim == 1:             # <<<<<<<<<<<<<<
19669  *             if inc:
19670  *                 Py_INCREF((<PyObject **> data)[0])
19671  */
19672       goto __pyx_L5;
19673     }
19674 
19675     /* "View.MemoryView":1388
19676  *                 Py_DECREF((<PyObject **> data)[0])
19677  *         else:
19678  *             refcount_objects_in_slice(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
19679  *                                       ndim - 1, inc)
19680  *
19681  */
19682     /*else*/ {
19683 
19684       /* "View.MemoryView":1389
19685  *         else:
19686  *             refcount_objects_in_slice(data, shape + 1, strides + 1,
19687  *                                       ndim - 1, inc)             # <<<<<<<<<<<<<<
19688  *
19689  *         data += strides[0]
19690  */
19691       __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
19692     }
19693     __pyx_L5:;
19694 
19695     /* "View.MemoryView":1391
19696  *                                       ndim - 1, inc)
19697  *
19698  *         data += strides[0]             # <<<<<<<<<<<<<<
19699  *
19700  *
19701  */
19702     __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
19703   }
19704 
19705   /* "View.MemoryView":1377
19706  *
19707  * @cname('__pyx_memoryview_refcount_objects_in_slice')
19708  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
19709  *                                     Py_ssize_t *strides, int ndim, bint inc):
19710  *     cdef Py_ssize_t i
19711  */
19712 
19713   /* function exit code */
19714   __Pyx_RefNannyFinishContext();
19715 }
19716 
19717 /* "View.MemoryView":1397
19718  *
19719  * @cname('__pyx_memoryview_slice_assign_scalar')
19720  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
19721  *                               size_t itemsize, void *item,
19722  *                               bint dtype_is_object) nogil:
19723  */
19724 
__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)19725 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) {
19726 
19727   /* "View.MemoryView":1400
19728  *                               size_t itemsize, void *item,
19729  *                               bint dtype_is_object) nogil:
19730  *     refcount_copying(dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
19731  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
19732  *                          itemsize, item)
19733  */
19734   __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
19735 
19736   /* "View.MemoryView":1401
19737  *                               bint dtype_is_object) nogil:
19738  *     refcount_copying(dst, dtype_is_object, ndim, False)
19739  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,             # <<<<<<<<<<<<<<
19740  *                          itemsize, item)
19741  *     refcount_copying(dst, dtype_is_object, ndim, True)
19742  */
19743   __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);
19744 
19745   /* "View.MemoryView":1403
19746  *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
19747  *                          itemsize, item)
19748  *     refcount_copying(dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
19749  *
19750  *
19751  */
19752   __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
19753 
19754   /* "View.MemoryView":1397
19755  *
19756  * @cname('__pyx_memoryview_slice_assign_scalar')
19757  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
19758  *                               size_t itemsize, void *item,
19759  *                               bint dtype_is_object) nogil:
19760  */
19761 
19762   /* function exit code */
19763 }
19764 
19765 /* "View.MemoryView":1407
19766  *
19767  * @cname('__pyx_memoryview__slice_assign_scalar')
19768  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
19769  *                               Py_ssize_t *strides, int ndim,
19770  *                               size_t itemsize, void *item) nogil:
19771  */
19772 
__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)19773 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) {
19774   CYTHON_UNUSED Py_ssize_t __pyx_v_i;
19775   Py_ssize_t __pyx_v_stride;
19776   Py_ssize_t __pyx_v_extent;
19777   int __pyx_t_1;
19778   Py_ssize_t __pyx_t_2;
19779   Py_ssize_t __pyx_t_3;
19780   Py_ssize_t __pyx_t_4;
19781 
19782   /* "View.MemoryView":1411
19783  *                               size_t itemsize, void *item) nogil:
19784  *     cdef Py_ssize_t i
19785  *     cdef Py_ssize_t stride = strides[0]             # <<<<<<<<<<<<<<
19786  *     cdef Py_ssize_t extent = shape[0]
19787  *
19788  */
19789   __pyx_v_stride = (__pyx_v_strides[0]);
19790 
19791   /* "View.MemoryView":1412
19792  *     cdef Py_ssize_t i
19793  *     cdef Py_ssize_t stride = strides[0]
19794  *     cdef Py_ssize_t extent = shape[0]             # <<<<<<<<<<<<<<
19795  *
19796  *     if ndim == 1:
19797  */
19798   __pyx_v_extent = (__pyx_v_shape[0]);
19799 
19800   /* "View.MemoryView":1414
19801  *     cdef Py_ssize_t extent = shape[0]
19802  *
19803  *     if ndim == 1:             # <<<<<<<<<<<<<<
19804  *         for i in range(extent):
19805  *             memcpy(data, item, itemsize)
19806  */
19807   __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
19808   if (__pyx_t_1) {
19809 
19810     /* "View.MemoryView":1415
19811  *
19812  *     if ndim == 1:
19813  *         for i in range(extent):             # <<<<<<<<<<<<<<
19814  *             memcpy(data, item, itemsize)
19815  *             data += stride
19816  */
19817     __pyx_t_2 = __pyx_v_extent;
19818     __pyx_t_3 = __pyx_t_2;
19819     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19820       __pyx_v_i = __pyx_t_4;
19821 
19822       /* "View.MemoryView":1416
19823  *     if ndim == 1:
19824  *         for i in range(extent):
19825  *             memcpy(data, item, itemsize)             # <<<<<<<<<<<<<<
19826  *             data += stride
19827  *     else:
19828  */
19829       (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
19830 
19831       /* "View.MemoryView":1417
19832  *         for i in range(extent):
19833  *             memcpy(data, item, itemsize)
19834  *             data += stride             # <<<<<<<<<<<<<<
19835  *     else:
19836  *         for i in range(extent):
19837  */
19838       __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
19839     }
19840 
19841     /* "View.MemoryView":1414
19842  *     cdef Py_ssize_t extent = shape[0]
19843  *
19844  *     if ndim == 1:             # <<<<<<<<<<<<<<
19845  *         for i in range(extent):
19846  *             memcpy(data, item, itemsize)
19847  */
19848     goto __pyx_L3;
19849   }
19850 
19851   /* "View.MemoryView":1419
19852  *             data += stride
19853  *     else:
19854  *         for i in range(extent):             # <<<<<<<<<<<<<<
19855  *             _slice_assign_scalar(data, shape + 1, strides + 1,
19856  *                                 ndim - 1, itemsize, item)
19857  */
19858   /*else*/ {
19859     __pyx_t_2 = __pyx_v_extent;
19860     __pyx_t_3 = __pyx_t_2;
19861     for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19862       __pyx_v_i = __pyx_t_4;
19863 
19864       /* "View.MemoryView":1420
19865  *     else:
19866  *         for i in range(extent):
19867  *             _slice_assign_scalar(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
19868  *                                 ndim - 1, itemsize, item)
19869  *             data += stride
19870  */
19871       __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);
19872 
19873       /* "View.MemoryView":1422
19874  *             _slice_assign_scalar(data, shape + 1, strides + 1,
19875  *                                 ndim - 1, itemsize, item)
19876  *             data += stride             # <<<<<<<<<<<<<<
19877  *
19878  *
19879  */
19880       __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
19881     }
19882   }
19883   __pyx_L3:;
19884 
19885   /* "View.MemoryView":1407
19886  *
19887  * @cname('__pyx_memoryview__slice_assign_scalar')
19888  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
19889  *                               Py_ssize_t *strides, int ndim,
19890  *                               size_t itemsize, void *item) nogil:
19891  */
19892 
19893   /* function exit code */
19894 }
19895 
19896 /* "(tree fragment)":1
19897  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
19898  *     cdef object __pyx_PickleError
19899  *     cdef object __pyx_result
19900  */
19901 
19902 /* Python wrapper */
19903 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
19904 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)19905 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
19906   PyObject *__pyx_v___pyx_type = 0;
19907   long __pyx_v___pyx_checksum;
19908   PyObject *__pyx_v___pyx_state = 0;
19909   int __pyx_lineno = 0;
19910   const char *__pyx_filename = NULL;
19911   int __pyx_clineno = 0;
19912   PyObject *__pyx_r = 0;
19913   __Pyx_RefNannyDeclarations
19914   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
19915   {
19916     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
19917     PyObject* values[3] = {0,0,0};
19918     if (unlikely(__pyx_kwds)) {
19919       Py_ssize_t kw_args;
19920       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19921       switch (pos_args) {
19922         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19923         CYTHON_FALLTHROUGH;
19924         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19925         CYTHON_FALLTHROUGH;
19926         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19927         CYTHON_FALLTHROUGH;
19928         case  0: break;
19929         default: goto __pyx_L5_argtuple_error;
19930       }
19931       kw_args = PyDict_Size(__pyx_kwds);
19932       switch (pos_args) {
19933         case  0:
19934         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
19935         else goto __pyx_L5_argtuple_error;
19936         CYTHON_FALLTHROUGH;
19937         case  1:
19938         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
19939         else {
19940           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
19941         }
19942         CYTHON_FALLTHROUGH;
19943         case  2:
19944         if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
19945         else {
19946           __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
19947         }
19948       }
19949       if (unlikely(kw_args > 0)) {
19950         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
19951       }
19952     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
19953       goto __pyx_L5_argtuple_error;
19954     } else {
19955       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19956       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19957       values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19958     }
19959     __pyx_v___pyx_type = values[0];
19960     __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
19961     __pyx_v___pyx_state = values[2];
19962   }
19963   goto __pyx_L4_argument_unpacking_done;
19964   __pyx_L5_argtuple_error:;
19965   __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
19966   __pyx_L3_error:;
19967   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
19968   __Pyx_RefNannyFinishContext();
19969   return NULL;
19970   __pyx_L4_argument_unpacking_done:;
19971   __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
19972 
19973   /* function exit code */
19974   __Pyx_RefNannyFinishContext();
19975   return __pyx_r;
19976 }
19977 
__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)19978 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) {
19979   PyObject *__pyx_v___pyx_PickleError = 0;
19980   PyObject *__pyx_v___pyx_result = 0;
19981   PyObject *__pyx_r = NULL;
19982   __Pyx_RefNannyDeclarations
19983   int __pyx_t_1;
19984   PyObject *__pyx_t_2 = NULL;
19985   PyObject *__pyx_t_3 = NULL;
19986   PyObject *__pyx_t_4 = NULL;
19987   PyObject *__pyx_t_5 = NULL;
19988   int __pyx_t_6;
19989   int __pyx_lineno = 0;
19990   const char *__pyx_filename = NULL;
19991   int __pyx_clineno = 0;
19992   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);
19993 
19994   /* "(tree fragment)":4
19995  *     cdef object __pyx_PickleError
19996  *     cdef object __pyx_result
19997  *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
19998  *         from pickle import PickleError as __pyx_PickleError
19999  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
20000  */
20001   __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
20002   if (__pyx_t_1) {
20003 
20004     /* "(tree fragment)":5
20005  *     cdef object __pyx_result
20006  *     if __pyx_checksum != 0xb068931:
20007  *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
20008  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
20009  *     __pyx_result = Enum.__new__(__pyx_type)
20010  */
20011     __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
20012     __Pyx_GOTREF(__pyx_t_2);
20013     __Pyx_INCREF(__pyx_n_s_PickleError);
20014     __Pyx_GIVEREF(__pyx_n_s_PickleError);
20015     PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
20016     __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
20017     __Pyx_GOTREF(__pyx_t_3);
20018     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20019     __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
20020     __Pyx_GOTREF(__pyx_t_2);
20021     __Pyx_INCREF(__pyx_t_2);
20022     __pyx_v___pyx_PickleError = __pyx_t_2;
20023     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20024     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20025 
20026     /* "(tree fragment)":6
20027  *     if __pyx_checksum != 0xb068931:
20028  *         from pickle import PickleError as __pyx_PickleError
20029  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)             # <<<<<<<<<<<<<<
20030  *     __pyx_result = Enum.__new__(__pyx_type)
20031  *     if __pyx_state is not None:
20032  */
20033     __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
20034     __Pyx_GOTREF(__pyx_t_2);
20035     __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
20036     __Pyx_GOTREF(__pyx_t_4);
20037     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20038     __Pyx_INCREF(__pyx_v___pyx_PickleError);
20039     __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
20040     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
20041       __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
20042       if (likely(__pyx_t_5)) {
20043         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
20044         __Pyx_INCREF(__pyx_t_5);
20045         __Pyx_INCREF(function);
20046         __Pyx_DECREF_SET(__pyx_t_2, function);
20047       }
20048     }
20049     __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);
20050     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
20051     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20052     if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
20053     __Pyx_GOTREF(__pyx_t_3);
20054     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20055     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
20056     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20057     __PYX_ERR(1, 6, __pyx_L1_error)
20058 
20059     /* "(tree fragment)":4
20060  *     cdef object __pyx_PickleError
20061  *     cdef object __pyx_result
20062  *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
20063  *         from pickle import PickleError as __pyx_PickleError
20064  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
20065  */
20066   }
20067 
20068   /* "(tree fragment)":7
20069  *         from pickle import PickleError as __pyx_PickleError
20070  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
20071  *     __pyx_result = Enum.__new__(__pyx_type)             # <<<<<<<<<<<<<<
20072  *     if __pyx_state is not None:
20073  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
20074  */
20075   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
20076   __Pyx_GOTREF(__pyx_t_2);
20077   __pyx_t_4 = NULL;
20078   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
20079     __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
20080     if (likely(__pyx_t_4)) {
20081       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
20082       __Pyx_INCREF(__pyx_t_4);
20083       __Pyx_INCREF(function);
20084       __Pyx_DECREF_SET(__pyx_t_2, function);
20085     }
20086   }
20087   __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);
20088   __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
20089   if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
20090   __Pyx_GOTREF(__pyx_t_3);
20091   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20092   __pyx_v___pyx_result = __pyx_t_3;
20093   __pyx_t_3 = 0;
20094 
20095   /* "(tree fragment)":8
20096  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
20097  *     __pyx_result = Enum.__new__(__pyx_type)
20098  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
20099  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
20100  *     return __pyx_result
20101  */
20102   __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
20103   __pyx_t_6 = (__pyx_t_1 != 0);
20104   if (__pyx_t_6) {
20105 
20106     /* "(tree fragment)":9
20107  *     __pyx_result = Enum.__new__(__pyx_type)
20108  *     if __pyx_state is not None:
20109  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
20110  *     return __pyx_result
20111  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
20112  */
20113     if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
20114     __pyx_t_3 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
20115     __Pyx_GOTREF(__pyx_t_3);
20116     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20117 
20118     /* "(tree fragment)":8
20119  *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
20120  *     __pyx_result = Enum.__new__(__pyx_type)
20121  *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
20122  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
20123  *     return __pyx_result
20124  */
20125   }
20126 
20127   /* "(tree fragment)":10
20128  *     if __pyx_state is not None:
20129  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
20130  *     return __pyx_result             # <<<<<<<<<<<<<<
20131  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
20132  *     __pyx_result.name = __pyx_state[0]
20133  */
20134   __Pyx_XDECREF(__pyx_r);
20135   __Pyx_INCREF(__pyx_v___pyx_result);
20136   __pyx_r = __pyx_v___pyx_result;
20137   goto __pyx_L0;
20138 
20139   /* "(tree fragment)":1
20140  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
20141  *     cdef object __pyx_PickleError
20142  *     cdef object __pyx_result
20143  */
20144 
20145   /* function exit code */
20146   __pyx_L1_error:;
20147   __Pyx_XDECREF(__pyx_t_2);
20148   __Pyx_XDECREF(__pyx_t_3);
20149   __Pyx_XDECREF(__pyx_t_4);
20150   __Pyx_XDECREF(__pyx_t_5);
20151   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
20152   __pyx_r = NULL;
20153   __pyx_L0:;
20154   __Pyx_XDECREF(__pyx_v___pyx_PickleError);
20155   __Pyx_XDECREF(__pyx_v___pyx_result);
20156   __Pyx_XGIVEREF(__pyx_r);
20157   __Pyx_RefNannyFinishContext();
20158   return __pyx_r;
20159 }
20160 
20161 /* "(tree fragment)":11
20162  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
20163  *     return __pyx_result
20164  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
20165  *     __pyx_result.name = __pyx_state[0]
20166  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
20167  */
20168 
__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj * __pyx_v___pyx_result,PyObject * __pyx_v___pyx_state)20169 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
20170   PyObject *__pyx_r = NULL;
20171   __Pyx_RefNannyDeclarations
20172   PyObject *__pyx_t_1 = NULL;
20173   int __pyx_t_2;
20174   Py_ssize_t __pyx_t_3;
20175   int __pyx_t_4;
20176   int __pyx_t_5;
20177   PyObject *__pyx_t_6 = NULL;
20178   PyObject *__pyx_t_7 = NULL;
20179   PyObject *__pyx_t_8 = NULL;
20180   int __pyx_lineno = 0;
20181   const char *__pyx_filename = NULL;
20182   int __pyx_clineno = 0;
20183   __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);
20184 
20185   /* "(tree fragment)":12
20186  *     return __pyx_result
20187  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
20188  *     __pyx_result.name = __pyx_state[0]             # <<<<<<<<<<<<<<
20189  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
20190  *         __pyx_result.__dict__.update(__pyx_state[1])
20191  */
20192   if (unlikely(__pyx_v___pyx_state == Py_None)) {
20193     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
20194     __PYX_ERR(1, 12, __pyx_L1_error)
20195   }
20196   __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
20197   __Pyx_GOTREF(__pyx_t_1);
20198   __Pyx_GIVEREF(__pyx_t_1);
20199   __Pyx_GOTREF(__pyx_v___pyx_result->name);
20200   __Pyx_DECREF(__pyx_v___pyx_result->name);
20201   __pyx_v___pyx_result->name = __pyx_t_1;
20202   __pyx_t_1 = 0;
20203 
20204   /* "(tree fragment)":13
20205  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
20206  *     __pyx_result.name = __pyx_state[0]
20207  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
20208  *         __pyx_result.__dict__.update(__pyx_state[1])
20209  */
20210   if (unlikely(__pyx_v___pyx_state == Py_None)) {
20211     PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
20212     __PYX_ERR(1, 13, __pyx_L1_error)
20213   }
20214   __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
20215   __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
20216   if (__pyx_t_4) {
20217   } else {
20218     __pyx_t_2 = __pyx_t_4;
20219     goto __pyx_L4_bool_binop_done;
20220   }
20221   __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
20222   __pyx_t_5 = (__pyx_t_4 != 0);
20223   __pyx_t_2 = __pyx_t_5;
20224   __pyx_L4_bool_binop_done:;
20225   if (__pyx_t_2) {
20226 
20227     /* "(tree fragment)":14
20228  *     __pyx_result.name = __pyx_state[0]
20229  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
20230  *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
20231  */
20232     __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
20233     __Pyx_GOTREF(__pyx_t_6);
20234     __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
20235     __Pyx_GOTREF(__pyx_t_7);
20236     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20237     if (unlikely(__pyx_v___pyx_state == Py_None)) {
20238       PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
20239       __PYX_ERR(1, 14, __pyx_L1_error)
20240     }
20241     __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
20242     __Pyx_GOTREF(__pyx_t_6);
20243     __pyx_t_8 = NULL;
20244     if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
20245       __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
20246       if (likely(__pyx_t_8)) {
20247         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
20248         __Pyx_INCREF(__pyx_t_8);
20249         __Pyx_INCREF(function);
20250         __Pyx_DECREF_SET(__pyx_t_7, function);
20251       }
20252     }
20253     __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);
20254     __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
20255     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20256     if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
20257     __Pyx_GOTREF(__pyx_t_1);
20258     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20259     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20260 
20261     /* "(tree fragment)":13
20262  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
20263  *     __pyx_result.name = __pyx_state[0]
20264  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
20265  *         __pyx_result.__dict__.update(__pyx_state[1])
20266  */
20267   }
20268 
20269   /* "(tree fragment)":11
20270  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
20271  *     return __pyx_result
20272  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
20273  *     __pyx_result.name = __pyx_state[0]
20274  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
20275  */
20276 
20277   /* function exit code */
20278   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20279   goto __pyx_L0;
20280   __pyx_L1_error:;
20281   __Pyx_XDECREF(__pyx_t_1);
20282   __Pyx_XDECREF(__pyx_t_6);
20283   __Pyx_XDECREF(__pyx_t_7);
20284   __Pyx_XDECREF(__pyx_t_8);
20285   __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
20286   __pyx_r = 0;
20287   __pyx_L0:;
20288   __Pyx_XGIVEREF(__pyx_r);
20289   __Pyx_RefNannyFinishContext();
20290   return __pyx_r;
20291 }
20292 static struct __pyx_vtabstruct_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter __pyx_vtable_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter;
20293 
__pyx_tp_new_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter(PyTypeObject * t,PyObject * a,PyObject * k)20294 static PyObject *__pyx_tp_new_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter(PyTypeObject *t, PyObject *a, PyObject *k) {
20295   struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *p;
20296   PyObject *o = __pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter->tp_new(t, a, k);
20297   if (unlikely(!o)) return 0;
20298   p = ((struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *)o);
20299   p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4dipy_8tracking_16direction_getter_DirectionGetter*)__pyx_vtabptr_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter;
20300   p->_adj_matrix = ((PyObject*)Py_None); Py_INCREF(Py_None);
20301   p->vertices.data = NULL;
20302   p->vertices.memview = NULL;
20303   return o;
20304 }
20305 
__pyx_tp_dealloc_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter(PyObject * o)20306 static void __pyx_tp_dealloc_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter(PyObject *o) {
20307   struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *p = (struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *)o;
20308   #if CYTHON_USE_TP_FINALIZE
20309   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
20310     if (PyObject_CallFinalizerFromDealloc(o)) return;
20311   }
20312   #endif
20313   PyObject_GC_UnTrack(o);
20314   Py_CLEAR(p->_adj_matrix);
20315   __PYX_XDEC_MEMVIEW(&p->vertices, 1);
20316   PyObject_GC_Track(o);
20317   if (likely(__pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter)) __pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter->tp_dealloc(o); else __Pyx_call_next_tp_dealloc(o, __pyx_tp_dealloc_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter);
20318 }
20319 
__pyx_tp_traverse_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter(PyObject * o,visitproc v,void * a)20320 static int __pyx_tp_traverse_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter(PyObject *o, visitproc v, void *a) {
20321   int e;
20322   struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *p = (struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *)o;
20323   e = ((likely(__pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter)) ? ((__pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter->tp_traverse) ? __pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter)); if (e) return e;
20324   if (p->_adj_matrix) {
20325     e = (*v)(p->_adj_matrix, a); if (e) return e;
20326   }
20327   return 0;
20328 }
20329 
__pyx_tp_clear_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter(PyObject * o)20330 static int __pyx_tp_clear_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter(PyObject *o) {
20331   PyObject* tmp;
20332   struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *p = (struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter *)o;
20333   if (likely(__pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter)) { if (__pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter->tp_clear) __pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter);
20334   tmp = ((PyObject*)p->_adj_matrix);
20335   p->_adj_matrix = ((PyObject*)Py_None); Py_INCREF(Py_None);
20336   Py_XDECREF(tmp);
20337   return 0;
20338 }
20339 
20340 static PyMethodDef __pyx_methods_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter[] = {
20341   {"_set_adjacency_matrix", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_3_set_adjacency_matrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_2_set_adjacency_matrix},
20342   {"__reduce_cython__", (PyCFunction)__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_5__reduce_cython__, METH_NOARGS, 0},
20343   {"__setstate_cython__", (PyCFunction)__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_7__setstate_cython__, METH_O, 0},
20344   {0, 0, 0, 0}
20345 };
20346 
20347 static PyTypeObject __pyx_type_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter = {
20348   PyVarObject_HEAD_INIT(0, 0)
20349   "dipy.direction.probabilistic_direction_getter.ProbabilisticDirectionGetter", /*tp_name*/
20350   sizeof(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter), /*tp_basicsize*/
20351   0, /*tp_itemsize*/
20352   __pyx_tp_dealloc_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter, /*tp_dealloc*/
20353   #if PY_VERSION_HEX < 0x030800b4
20354   0, /*tp_print*/
20355   #endif
20356   #if PY_VERSION_HEX >= 0x030800b4
20357   0, /*tp_vectorcall_offset*/
20358   #endif
20359   0, /*tp_getattr*/
20360   0, /*tp_setattr*/
20361   #if PY_MAJOR_VERSION < 3
20362   0, /*tp_compare*/
20363   #endif
20364   #if PY_MAJOR_VERSION >= 3
20365   0, /*tp_as_async*/
20366   #endif
20367   0, /*tp_repr*/
20368   0, /*tp_as_number*/
20369   0, /*tp_as_sequence*/
20370   0, /*tp_as_mapping*/
20371   0, /*tp_hash*/
20372   0, /*tp_call*/
20373   0, /*tp_str*/
20374   0, /*tp_getattro*/
20375   0, /*tp_setattro*/
20376   0, /*tp_as_buffer*/
20377   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
20378   "Randomly samples direction of a sphere based on probability mass\n    function (pmf).\n\n    The main constructors for this class are current from_pmf and from_shcoeff.\n    The pmf gives the probability that each direction on the sphere should be\n    chosen as the next direction. To get the true pmf from the \"raw pmf\"\n    directions more than ``max_angle`` degrees from the incoming direction are\n    set to 0 and the result is normalized.\n    ", /*tp_doc*/
20379   __pyx_tp_traverse_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter, /*tp_traverse*/
20380   __pyx_tp_clear_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter, /*tp_clear*/
20381   0, /*tp_richcompare*/
20382   0, /*tp_weaklistoffset*/
20383   0, /*tp_iter*/
20384   0, /*tp_iternext*/
20385   __pyx_methods_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter, /*tp_methods*/
20386   0, /*tp_members*/
20387   0, /*tp_getset*/
20388   0, /*tp_base*/
20389   0, /*tp_dict*/
20390   0, /*tp_descr_get*/
20391   0, /*tp_descr_set*/
20392   0, /*tp_dictoffset*/
20393   __pyx_pw_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_1__init__, /*tp_init*/
20394   0, /*tp_alloc*/
20395   __pyx_tp_new_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter, /*tp_new*/
20396   0, /*tp_free*/
20397   0, /*tp_is_gc*/
20398   0, /*tp_bases*/
20399   0, /*tp_mro*/
20400   0, /*tp_cache*/
20401   0, /*tp_subclasses*/
20402   0, /*tp_weaklist*/
20403   0, /*tp_del*/
20404   0, /*tp_version_tag*/
20405   #if PY_VERSION_HEX >= 0x030400a1
20406   0, /*tp_finalize*/
20407   #endif
20408   #if PY_VERSION_HEX >= 0x030800b1
20409   0, /*tp_vectorcall*/
20410   #endif
20411   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20412   0, /*tp_print*/
20413   #endif
20414 };
20415 static struct __pyx_vtabstruct_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter __pyx_vtable_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter;
20416 
__pyx_tp_new_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter(PyTypeObject * t,PyObject * a,PyObject * k)20417 static PyObject *__pyx_tp_new_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter(PyTypeObject *t, PyObject *a, PyObject *k) {
20418   struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter *p;
20419   PyObject *o = __pyx_tp_new_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter(t, a, k);
20420   if (unlikely(!o)) return 0;
20421   p = ((struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter *)o);
20422   p->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_4dipy_8tracking_16direction_getter_DirectionGetter*)__pyx_vtabptr_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter;
20423   return o;
20424 }
20425 
20426 static PyMethodDef __pyx_methods_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter[] = {
20427   {"__reduce_cython__", (PyCFunction)__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_3__reduce_cython__, METH_NOARGS, 0},
20428   {"__setstate_cython__", (PyCFunction)__pyx_pw_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_5__setstate_cython__, METH_O, 0},
20429   {0, 0, 0, 0}
20430 };
20431 
20432 static PyTypeObject __pyx_type_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter = {
20433   PyVarObject_HEAD_INIT(0, 0)
20434   "dipy.direction.probabilistic_direction_getter.DeterministicMaximumDirectionGetter", /*tp_name*/
20435   sizeof(struct __pyx_obj_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter), /*tp_basicsize*/
20436   0, /*tp_itemsize*/
20437   __pyx_tp_dealloc_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter, /*tp_dealloc*/
20438   #if PY_VERSION_HEX < 0x030800b4
20439   0, /*tp_print*/
20440   #endif
20441   #if PY_VERSION_HEX >= 0x030800b4
20442   0, /*tp_vectorcall_offset*/
20443   #endif
20444   0, /*tp_getattr*/
20445   0, /*tp_setattr*/
20446   #if PY_MAJOR_VERSION < 3
20447   0, /*tp_compare*/
20448   #endif
20449   #if PY_MAJOR_VERSION >= 3
20450   0, /*tp_as_async*/
20451   #endif
20452   0, /*tp_repr*/
20453   0, /*tp_as_number*/
20454   0, /*tp_as_sequence*/
20455   0, /*tp_as_mapping*/
20456   0, /*tp_hash*/
20457   0, /*tp_call*/
20458   0, /*tp_str*/
20459   0, /*tp_getattro*/
20460   0, /*tp_setattro*/
20461   0, /*tp_as_buffer*/
20462   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
20463   "Return direction of a sphere with the highest probability mass\n    function (pmf).\n    ", /*tp_doc*/
20464   __pyx_tp_traverse_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter, /*tp_traverse*/
20465   __pyx_tp_clear_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter, /*tp_clear*/
20466   0, /*tp_richcompare*/
20467   0, /*tp_weaklistoffset*/
20468   0, /*tp_iter*/
20469   0, /*tp_iternext*/
20470   __pyx_methods_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter, /*tp_methods*/
20471   0, /*tp_members*/
20472   0, /*tp_getset*/
20473   0, /*tp_base*/
20474   0, /*tp_dict*/
20475   0, /*tp_descr_get*/
20476   0, /*tp_descr_set*/
20477   0, /*tp_dictoffset*/
20478   __pyx_pw_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_1__init__, /*tp_init*/
20479   0, /*tp_alloc*/
20480   __pyx_tp_new_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter, /*tp_new*/
20481   0, /*tp_free*/
20482   0, /*tp_is_gc*/
20483   0, /*tp_bases*/
20484   0, /*tp_mro*/
20485   0, /*tp_cache*/
20486   0, /*tp_subclasses*/
20487   0, /*tp_weaklist*/
20488   0, /*tp_del*/
20489   0, /*tp_version_tag*/
20490   #if PY_VERSION_HEX >= 0x030400a1
20491   0, /*tp_finalize*/
20492   #endif
20493   #if PY_VERSION_HEX >= 0x030800b1
20494   0, /*tp_vectorcall*/
20495   #endif
20496   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20497   0, /*tp_print*/
20498   #endif
20499 };
20500 static struct __pyx_vtabstruct_array __pyx_vtable_array;
20501 
__pyx_tp_new_array(PyTypeObject * t,PyObject * a,PyObject * k)20502 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
20503   struct __pyx_array_obj *p;
20504   PyObject *o;
20505   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20506     o = (*t->tp_alloc)(t, 0);
20507   } else {
20508     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20509   }
20510   if (unlikely(!o)) return 0;
20511   p = ((struct __pyx_array_obj *)o);
20512   p->__pyx_vtab = __pyx_vtabptr_array;
20513   p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
20514   p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
20515   if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
20516   return o;
20517   bad:
20518   Py_DECREF(o); o = 0;
20519   return NULL;
20520 }
20521 
__pyx_tp_dealloc_array(PyObject * o)20522 static void __pyx_tp_dealloc_array(PyObject *o) {
20523   struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
20524   #if CYTHON_USE_TP_FINALIZE
20525   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))) {
20526     if (PyObject_CallFinalizerFromDealloc(o)) return;
20527   }
20528   #endif
20529   {
20530     PyObject *etype, *eval, *etb;
20531     PyErr_Fetch(&etype, &eval, &etb);
20532     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
20533     __pyx_array___dealloc__(o);
20534     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
20535     PyErr_Restore(etype, eval, etb);
20536   }
20537   Py_CLEAR(p->mode);
20538   Py_CLEAR(p->_format);
20539   (*Py_TYPE(o)->tp_free)(o);
20540 }
__pyx_sq_item_array(PyObject * o,Py_ssize_t i)20541 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
20542   PyObject *r;
20543   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
20544   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
20545   Py_DECREF(x);
20546   return r;
20547 }
20548 
__pyx_mp_ass_subscript_array(PyObject * o,PyObject * i,PyObject * v)20549 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
20550   if (v) {
20551     return __pyx_array___setitem__(o, i, v);
20552   }
20553   else {
20554     PyErr_Format(PyExc_NotImplementedError,
20555       "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
20556     return -1;
20557   }
20558 }
20559 
__pyx_tp_getattro_array(PyObject * o,PyObject * n)20560 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
20561   PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
20562   if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
20563     PyErr_Clear();
20564     v = __pyx_array___getattr__(o, n);
20565   }
20566   return v;
20567 }
20568 
__pyx_getprop___pyx_array_memview(PyObject * o,CYTHON_UNUSED void * x)20569 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
20570   return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
20571 }
20572 
20573 static PyMethodDef __pyx_methods_array[] = {
20574   {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
20575   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
20576   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
20577   {0, 0, 0, 0}
20578 };
20579 
20580 static struct PyGetSetDef __pyx_getsets_array[] = {
20581   {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
20582   {0, 0, 0, 0, 0}
20583 };
20584 
20585 static PySequenceMethods __pyx_tp_as_sequence_array = {
20586   __pyx_array___len__, /*sq_length*/
20587   0, /*sq_concat*/
20588   0, /*sq_repeat*/
20589   __pyx_sq_item_array, /*sq_item*/
20590   0, /*sq_slice*/
20591   0, /*sq_ass_item*/
20592   0, /*sq_ass_slice*/
20593   0, /*sq_contains*/
20594   0, /*sq_inplace_concat*/
20595   0, /*sq_inplace_repeat*/
20596 };
20597 
20598 static PyMappingMethods __pyx_tp_as_mapping_array = {
20599   __pyx_array___len__, /*mp_length*/
20600   __pyx_array___getitem__, /*mp_subscript*/
20601   __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
20602 };
20603 
20604 static PyBufferProcs __pyx_tp_as_buffer_array = {
20605   #if PY_MAJOR_VERSION < 3
20606   0, /*bf_getreadbuffer*/
20607   #endif
20608   #if PY_MAJOR_VERSION < 3
20609   0, /*bf_getwritebuffer*/
20610   #endif
20611   #if PY_MAJOR_VERSION < 3
20612   0, /*bf_getsegcount*/
20613   #endif
20614   #if PY_MAJOR_VERSION < 3
20615   0, /*bf_getcharbuffer*/
20616   #endif
20617   __pyx_array_getbuffer, /*bf_getbuffer*/
20618   0, /*bf_releasebuffer*/
20619 };
20620 
20621 static PyTypeObject __pyx_type___pyx_array = {
20622   PyVarObject_HEAD_INIT(0, 0)
20623   "dipy.direction.probabilistic_direction_getter.array", /*tp_name*/
20624   sizeof(struct __pyx_array_obj), /*tp_basicsize*/
20625   0, /*tp_itemsize*/
20626   __pyx_tp_dealloc_array, /*tp_dealloc*/
20627   #if PY_VERSION_HEX < 0x030800b4
20628   0, /*tp_print*/
20629   #endif
20630   #if PY_VERSION_HEX >= 0x030800b4
20631   0, /*tp_vectorcall_offset*/
20632   #endif
20633   0, /*tp_getattr*/
20634   0, /*tp_setattr*/
20635   #if PY_MAJOR_VERSION < 3
20636   0, /*tp_compare*/
20637   #endif
20638   #if PY_MAJOR_VERSION >= 3
20639   0, /*tp_as_async*/
20640   #endif
20641   0, /*tp_repr*/
20642   0, /*tp_as_number*/
20643   &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
20644   &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
20645   0, /*tp_hash*/
20646   0, /*tp_call*/
20647   0, /*tp_str*/
20648   __pyx_tp_getattro_array, /*tp_getattro*/
20649   0, /*tp_setattro*/
20650   &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
20651   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
20652   0, /*tp_doc*/
20653   0, /*tp_traverse*/
20654   0, /*tp_clear*/
20655   0, /*tp_richcompare*/
20656   0, /*tp_weaklistoffset*/
20657   0, /*tp_iter*/
20658   0, /*tp_iternext*/
20659   __pyx_methods_array, /*tp_methods*/
20660   0, /*tp_members*/
20661   __pyx_getsets_array, /*tp_getset*/
20662   0, /*tp_base*/
20663   0, /*tp_dict*/
20664   0, /*tp_descr_get*/
20665   0, /*tp_descr_set*/
20666   0, /*tp_dictoffset*/
20667   0, /*tp_init*/
20668   0, /*tp_alloc*/
20669   __pyx_tp_new_array, /*tp_new*/
20670   0, /*tp_free*/
20671   0, /*tp_is_gc*/
20672   0, /*tp_bases*/
20673   0, /*tp_mro*/
20674   0, /*tp_cache*/
20675   0, /*tp_subclasses*/
20676   0, /*tp_weaklist*/
20677   0, /*tp_del*/
20678   0, /*tp_version_tag*/
20679   #if PY_VERSION_HEX >= 0x030400a1
20680   0, /*tp_finalize*/
20681   #endif
20682   #if PY_VERSION_HEX >= 0x030800b1
20683   0, /*tp_vectorcall*/
20684   #endif
20685   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20686   0, /*tp_print*/
20687   #endif
20688 };
20689 
__pyx_tp_new_Enum(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)20690 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
20691   struct __pyx_MemviewEnum_obj *p;
20692   PyObject *o;
20693   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20694     o = (*t->tp_alloc)(t, 0);
20695   } else {
20696     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20697   }
20698   if (unlikely(!o)) return 0;
20699   p = ((struct __pyx_MemviewEnum_obj *)o);
20700   p->name = Py_None; Py_INCREF(Py_None);
20701   return o;
20702 }
20703 
__pyx_tp_dealloc_Enum(PyObject * o)20704 static void __pyx_tp_dealloc_Enum(PyObject *o) {
20705   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
20706   #if CYTHON_USE_TP_FINALIZE
20707   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
20708     if (PyObject_CallFinalizerFromDealloc(o)) return;
20709   }
20710   #endif
20711   PyObject_GC_UnTrack(o);
20712   Py_CLEAR(p->name);
20713   (*Py_TYPE(o)->tp_free)(o);
20714 }
20715 
__pyx_tp_traverse_Enum(PyObject * o,visitproc v,void * a)20716 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
20717   int e;
20718   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
20719   if (p->name) {
20720     e = (*v)(p->name, a); if (e) return e;
20721   }
20722   return 0;
20723 }
20724 
__pyx_tp_clear_Enum(PyObject * o)20725 static int __pyx_tp_clear_Enum(PyObject *o) {
20726   PyObject* tmp;
20727   struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
20728   tmp = ((PyObject*)p->name);
20729   p->name = Py_None; Py_INCREF(Py_None);
20730   Py_XDECREF(tmp);
20731   return 0;
20732 }
20733 
20734 static PyMethodDef __pyx_methods_Enum[] = {
20735   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
20736   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
20737   {0, 0, 0, 0}
20738 };
20739 
20740 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
20741   PyVarObject_HEAD_INIT(0, 0)
20742   "dipy.direction.probabilistic_direction_getter.Enum", /*tp_name*/
20743   sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
20744   0, /*tp_itemsize*/
20745   __pyx_tp_dealloc_Enum, /*tp_dealloc*/
20746   #if PY_VERSION_HEX < 0x030800b4
20747   0, /*tp_print*/
20748   #endif
20749   #if PY_VERSION_HEX >= 0x030800b4
20750   0, /*tp_vectorcall_offset*/
20751   #endif
20752   0, /*tp_getattr*/
20753   0, /*tp_setattr*/
20754   #if PY_MAJOR_VERSION < 3
20755   0, /*tp_compare*/
20756   #endif
20757   #if PY_MAJOR_VERSION >= 3
20758   0, /*tp_as_async*/
20759   #endif
20760   __pyx_MemviewEnum___repr__, /*tp_repr*/
20761   0, /*tp_as_number*/
20762   0, /*tp_as_sequence*/
20763   0, /*tp_as_mapping*/
20764   0, /*tp_hash*/
20765   0, /*tp_call*/
20766   0, /*tp_str*/
20767   0, /*tp_getattro*/
20768   0, /*tp_setattro*/
20769   0, /*tp_as_buffer*/
20770   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
20771   0, /*tp_doc*/
20772   __pyx_tp_traverse_Enum, /*tp_traverse*/
20773   __pyx_tp_clear_Enum, /*tp_clear*/
20774   0, /*tp_richcompare*/
20775   0, /*tp_weaklistoffset*/
20776   0, /*tp_iter*/
20777   0, /*tp_iternext*/
20778   __pyx_methods_Enum, /*tp_methods*/
20779   0, /*tp_members*/
20780   0, /*tp_getset*/
20781   0, /*tp_base*/
20782   0, /*tp_dict*/
20783   0, /*tp_descr_get*/
20784   0, /*tp_descr_set*/
20785   0, /*tp_dictoffset*/
20786   __pyx_MemviewEnum___init__, /*tp_init*/
20787   0, /*tp_alloc*/
20788   __pyx_tp_new_Enum, /*tp_new*/
20789   0, /*tp_free*/
20790   0, /*tp_is_gc*/
20791   0, /*tp_bases*/
20792   0, /*tp_mro*/
20793   0, /*tp_cache*/
20794   0, /*tp_subclasses*/
20795   0, /*tp_weaklist*/
20796   0, /*tp_del*/
20797   0, /*tp_version_tag*/
20798   #if PY_VERSION_HEX >= 0x030400a1
20799   0, /*tp_finalize*/
20800   #endif
20801   #if PY_VERSION_HEX >= 0x030800b1
20802   0, /*tp_vectorcall*/
20803   #endif
20804   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20805   0, /*tp_print*/
20806   #endif
20807 };
20808 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
20809 
__pyx_tp_new_memoryview(PyTypeObject * t,PyObject * a,PyObject * k)20810 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
20811   struct __pyx_memoryview_obj *p;
20812   PyObject *o;
20813   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20814     o = (*t->tp_alloc)(t, 0);
20815   } else {
20816     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20817   }
20818   if (unlikely(!o)) return 0;
20819   p = ((struct __pyx_memoryview_obj *)o);
20820   p->__pyx_vtab = __pyx_vtabptr_memoryview;
20821   p->obj = Py_None; Py_INCREF(Py_None);
20822   p->_size = Py_None; Py_INCREF(Py_None);
20823   p->_array_interface = Py_None; Py_INCREF(Py_None);
20824   p->view.obj = NULL;
20825   if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
20826   return o;
20827   bad:
20828   Py_DECREF(o); o = 0;
20829   return NULL;
20830 }
20831 
__pyx_tp_dealloc_memoryview(PyObject * o)20832 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
20833   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
20834   #if CYTHON_USE_TP_FINALIZE
20835   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
20836     if (PyObject_CallFinalizerFromDealloc(o)) return;
20837   }
20838   #endif
20839   PyObject_GC_UnTrack(o);
20840   {
20841     PyObject *etype, *eval, *etb;
20842     PyErr_Fetch(&etype, &eval, &etb);
20843     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
20844     __pyx_memoryview___dealloc__(o);
20845     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
20846     PyErr_Restore(etype, eval, etb);
20847   }
20848   Py_CLEAR(p->obj);
20849   Py_CLEAR(p->_size);
20850   Py_CLEAR(p->_array_interface);
20851   (*Py_TYPE(o)->tp_free)(o);
20852 }
20853 
__pyx_tp_traverse_memoryview(PyObject * o,visitproc v,void * a)20854 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
20855   int e;
20856   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
20857   if (p->obj) {
20858     e = (*v)(p->obj, a); if (e) return e;
20859   }
20860   if (p->_size) {
20861     e = (*v)(p->_size, a); if (e) return e;
20862   }
20863   if (p->_array_interface) {
20864     e = (*v)(p->_array_interface, a); if (e) return e;
20865   }
20866   if (p->view.obj) {
20867     e = (*v)(p->view.obj, a); if (e) return e;
20868   }
20869   return 0;
20870 }
20871 
__pyx_tp_clear_memoryview(PyObject * o)20872 static int __pyx_tp_clear_memoryview(PyObject *o) {
20873   PyObject* tmp;
20874   struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
20875   tmp = ((PyObject*)p->obj);
20876   p->obj = Py_None; Py_INCREF(Py_None);
20877   Py_XDECREF(tmp);
20878   tmp = ((PyObject*)p->_size);
20879   p->_size = Py_None; Py_INCREF(Py_None);
20880   Py_XDECREF(tmp);
20881   tmp = ((PyObject*)p->_array_interface);
20882   p->_array_interface = Py_None; Py_INCREF(Py_None);
20883   Py_XDECREF(tmp);
20884   Py_CLEAR(p->view.obj);
20885   return 0;
20886 }
__pyx_sq_item_memoryview(PyObject * o,Py_ssize_t i)20887 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
20888   PyObject *r;
20889   PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
20890   r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
20891   Py_DECREF(x);
20892   return r;
20893 }
20894 
__pyx_mp_ass_subscript_memoryview(PyObject * o,PyObject * i,PyObject * v)20895 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
20896   if (v) {
20897     return __pyx_memoryview___setitem__(o, i, v);
20898   }
20899   else {
20900     PyErr_Format(PyExc_NotImplementedError,
20901       "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
20902     return -1;
20903   }
20904 }
20905 
__pyx_getprop___pyx_memoryview_T(PyObject * o,CYTHON_UNUSED void * x)20906 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
20907   return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
20908 }
20909 
__pyx_getprop___pyx_memoryview_base(PyObject * o,CYTHON_UNUSED void * x)20910 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
20911   return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
20912 }
20913 
__pyx_getprop___pyx_memoryview_shape(PyObject * o,CYTHON_UNUSED void * x)20914 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
20915   return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
20916 }
20917 
__pyx_getprop___pyx_memoryview_strides(PyObject * o,CYTHON_UNUSED void * x)20918 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
20919   return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
20920 }
20921 
__pyx_getprop___pyx_memoryview_suboffsets(PyObject * o,CYTHON_UNUSED void * x)20922 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
20923   return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
20924 }
20925 
__pyx_getprop___pyx_memoryview_ndim(PyObject * o,CYTHON_UNUSED void * x)20926 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
20927   return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
20928 }
20929 
__pyx_getprop___pyx_memoryview_itemsize(PyObject * o,CYTHON_UNUSED void * x)20930 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
20931   return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
20932 }
20933 
__pyx_getprop___pyx_memoryview_nbytes(PyObject * o,CYTHON_UNUSED void * x)20934 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
20935   return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
20936 }
20937 
__pyx_getprop___pyx_memoryview_size(PyObject * o,CYTHON_UNUSED void * x)20938 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
20939   return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
20940 }
20941 
20942 static PyMethodDef __pyx_methods_memoryview[] = {
20943   {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
20944   {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
20945   {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
20946   {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
20947   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
20948   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
20949   {0, 0, 0, 0}
20950 };
20951 
20952 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
20953   {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
20954   {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
20955   {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
20956   {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
20957   {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
20958   {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
20959   {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
20960   {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
20961   {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
20962   {0, 0, 0, 0, 0}
20963 };
20964 
20965 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
20966   __pyx_memoryview___len__, /*sq_length*/
20967   0, /*sq_concat*/
20968   0, /*sq_repeat*/
20969   __pyx_sq_item_memoryview, /*sq_item*/
20970   0, /*sq_slice*/
20971   0, /*sq_ass_item*/
20972   0, /*sq_ass_slice*/
20973   0, /*sq_contains*/
20974   0, /*sq_inplace_concat*/
20975   0, /*sq_inplace_repeat*/
20976 };
20977 
20978 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
20979   __pyx_memoryview___len__, /*mp_length*/
20980   __pyx_memoryview___getitem__, /*mp_subscript*/
20981   __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
20982 };
20983 
20984 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
20985   #if PY_MAJOR_VERSION < 3
20986   0, /*bf_getreadbuffer*/
20987   #endif
20988   #if PY_MAJOR_VERSION < 3
20989   0, /*bf_getwritebuffer*/
20990   #endif
20991   #if PY_MAJOR_VERSION < 3
20992   0, /*bf_getsegcount*/
20993   #endif
20994   #if PY_MAJOR_VERSION < 3
20995   0, /*bf_getcharbuffer*/
20996   #endif
20997   __pyx_memoryview_getbuffer, /*bf_getbuffer*/
20998   0, /*bf_releasebuffer*/
20999 };
21000 
21001 static PyTypeObject __pyx_type___pyx_memoryview = {
21002   PyVarObject_HEAD_INIT(0, 0)
21003   "dipy.direction.probabilistic_direction_getter.memoryview", /*tp_name*/
21004   sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
21005   0, /*tp_itemsize*/
21006   __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
21007   #if PY_VERSION_HEX < 0x030800b4
21008   0, /*tp_print*/
21009   #endif
21010   #if PY_VERSION_HEX >= 0x030800b4
21011   0, /*tp_vectorcall_offset*/
21012   #endif
21013   0, /*tp_getattr*/
21014   0, /*tp_setattr*/
21015   #if PY_MAJOR_VERSION < 3
21016   0, /*tp_compare*/
21017   #endif
21018   #if PY_MAJOR_VERSION >= 3
21019   0, /*tp_as_async*/
21020   #endif
21021   __pyx_memoryview___repr__, /*tp_repr*/
21022   0, /*tp_as_number*/
21023   &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
21024   &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
21025   0, /*tp_hash*/
21026   0, /*tp_call*/
21027   __pyx_memoryview___str__, /*tp_str*/
21028   0, /*tp_getattro*/
21029   0, /*tp_setattro*/
21030   &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
21031   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
21032   0, /*tp_doc*/
21033   __pyx_tp_traverse_memoryview, /*tp_traverse*/
21034   __pyx_tp_clear_memoryview, /*tp_clear*/
21035   0, /*tp_richcompare*/
21036   0, /*tp_weaklistoffset*/
21037   0, /*tp_iter*/
21038   0, /*tp_iternext*/
21039   __pyx_methods_memoryview, /*tp_methods*/
21040   0, /*tp_members*/
21041   __pyx_getsets_memoryview, /*tp_getset*/
21042   0, /*tp_base*/
21043   0, /*tp_dict*/
21044   0, /*tp_descr_get*/
21045   0, /*tp_descr_set*/
21046   0, /*tp_dictoffset*/
21047   0, /*tp_init*/
21048   0, /*tp_alloc*/
21049   __pyx_tp_new_memoryview, /*tp_new*/
21050   0, /*tp_free*/
21051   0, /*tp_is_gc*/
21052   0, /*tp_bases*/
21053   0, /*tp_mro*/
21054   0, /*tp_cache*/
21055   0, /*tp_subclasses*/
21056   0, /*tp_weaklist*/
21057   0, /*tp_del*/
21058   0, /*tp_version_tag*/
21059   #if PY_VERSION_HEX >= 0x030400a1
21060   0, /*tp_finalize*/
21061   #endif
21062   #if PY_VERSION_HEX >= 0x030800b1
21063   0, /*tp_vectorcall*/
21064   #endif
21065   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
21066   0, /*tp_print*/
21067   #endif
21068 };
21069 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
21070 
__pyx_tp_new__memoryviewslice(PyTypeObject * t,PyObject * a,PyObject * k)21071 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
21072   struct __pyx_memoryviewslice_obj *p;
21073   PyObject *o = __pyx_tp_new_memoryview(t, a, k);
21074   if (unlikely(!o)) return 0;
21075   p = ((struct __pyx_memoryviewslice_obj *)o);
21076   p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
21077   p->from_object = Py_None; Py_INCREF(Py_None);
21078   p->from_slice.memview = NULL;
21079   return o;
21080 }
21081 
__pyx_tp_dealloc__memoryviewslice(PyObject * o)21082 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
21083   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
21084   #if CYTHON_USE_TP_FINALIZE
21085   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
21086     if (PyObject_CallFinalizerFromDealloc(o)) return;
21087   }
21088   #endif
21089   PyObject_GC_UnTrack(o);
21090   {
21091     PyObject *etype, *eval, *etb;
21092     PyErr_Fetch(&etype, &eval, &etb);
21093     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
21094     __pyx_memoryviewslice___dealloc__(o);
21095     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
21096     PyErr_Restore(etype, eval, etb);
21097   }
21098   Py_CLEAR(p->from_object);
21099   PyObject_GC_Track(o);
21100   __pyx_tp_dealloc_memoryview(o);
21101 }
21102 
__pyx_tp_traverse__memoryviewslice(PyObject * o,visitproc v,void * a)21103 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
21104   int e;
21105   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
21106   e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
21107   if (p->from_object) {
21108     e = (*v)(p->from_object, a); if (e) return e;
21109   }
21110   return 0;
21111 }
21112 
__pyx_tp_clear__memoryviewslice(PyObject * o)21113 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
21114   PyObject* tmp;
21115   struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
21116   __pyx_tp_clear_memoryview(o);
21117   tmp = ((PyObject*)p->from_object);
21118   p->from_object = Py_None; Py_INCREF(Py_None);
21119   Py_XDECREF(tmp);
21120   __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
21121   return 0;
21122 }
21123 
__pyx_getprop___pyx_memoryviewslice_base(PyObject * o,CYTHON_UNUSED void * x)21124 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
21125   return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
21126 }
21127 
21128 static PyMethodDef __pyx_methods__memoryviewslice[] = {
21129   {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
21130   {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
21131   {0, 0, 0, 0}
21132 };
21133 
21134 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
21135   {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
21136   {0, 0, 0, 0, 0}
21137 };
21138 
21139 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
21140   PyVarObject_HEAD_INIT(0, 0)
21141   "dipy.direction.probabilistic_direction_getter._memoryviewslice", /*tp_name*/
21142   sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
21143   0, /*tp_itemsize*/
21144   __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
21145   #if PY_VERSION_HEX < 0x030800b4
21146   0, /*tp_print*/
21147   #endif
21148   #if PY_VERSION_HEX >= 0x030800b4
21149   0, /*tp_vectorcall_offset*/
21150   #endif
21151   0, /*tp_getattr*/
21152   0, /*tp_setattr*/
21153   #if PY_MAJOR_VERSION < 3
21154   0, /*tp_compare*/
21155   #endif
21156   #if PY_MAJOR_VERSION >= 3
21157   0, /*tp_as_async*/
21158   #endif
21159   #if CYTHON_COMPILING_IN_PYPY
21160   __pyx_memoryview___repr__, /*tp_repr*/
21161   #else
21162   0, /*tp_repr*/
21163   #endif
21164   0, /*tp_as_number*/
21165   0, /*tp_as_sequence*/
21166   0, /*tp_as_mapping*/
21167   0, /*tp_hash*/
21168   0, /*tp_call*/
21169   #if CYTHON_COMPILING_IN_PYPY
21170   __pyx_memoryview___str__, /*tp_str*/
21171   #else
21172   0, /*tp_str*/
21173   #endif
21174   0, /*tp_getattro*/
21175   0, /*tp_setattro*/
21176   0, /*tp_as_buffer*/
21177   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
21178   "Internal class for passing memoryview slices to Python", /*tp_doc*/
21179   __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
21180   __pyx_tp_clear__memoryviewslice, /*tp_clear*/
21181   0, /*tp_richcompare*/
21182   0, /*tp_weaklistoffset*/
21183   0, /*tp_iter*/
21184   0, /*tp_iternext*/
21185   __pyx_methods__memoryviewslice, /*tp_methods*/
21186   0, /*tp_members*/
21187   __pyx_getsets__memoryviewslice, /*tp_getset*/
21188   0, /*tp_base*/
21189   0, /*tp_dict*/
21190   0, /*tp_descr_get*/
21191   0, /*tp_descr_set*/
21192   0, /*tp_dictoffset*/
21193   0, /*tp_init*/
21194   0, /*tp_alloc*/
21195   __pyx_tp_new__memoryviewslice, /*tp_new*/
21196   0, /*tp_free*/
21197   0, /*tp_is_gc*/
21198   0, /*tp_bases*/
21199   0, /*tp_mro*/
21200   0, /*tp_cache*/
21201   0, /*tp_subclasses*/
21202   0, /*tp_weaklist*/
21203   0, /*tp_del*/
21204   0, /*tp_version_tag*/
21205   #if PY_VERSION_HEX >= 0x030400a1
21206   0, /*tp_finalize*/
21207   #endif
21208   #if PY_VERSION_HEX >= 0x030800b1
21209   0, /*tp_vectorcall*/
21210   #endif
21211   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
21212   0, /*tp_print*/
21213   #endif
21214 };
21215 
21216 static PyMethodDef __pyx_methods[] = {
21217   {0, 0, 0, 0}
21218 };
21219 
21220 #if PY_MAJOR_VERSION >= 3
21221 #if CYTHON_PEP489_MULTI_PHASE_INIT
21222 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
21223 static int __pyx_pymod_exec_probabilistic_direction_getter(PyObject* module); /*proto*/
21224 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
21225   {Py_mod_create, (void*)__pyx_pymod_create},
21226   {Py_mod_exec, (void*)__pyx_pymod_exec_probabilistic_direction_getter},
21227   {0, NULL}
21228 };
21229 #endif
21230 
21231 static struct PyModuleDef __pyx_moduledef = {
21232     PyModuleDef_HEAD_INIT,
21233     "probabilistic_direction_getter",
21234     __pyx_k_Implementation_of_a_probabilist, /* m_doc */
21235   #if CYTHON_PEP489_MULTI_PHASE_INIT
21236     0, /* m_size */
21237   #else
21238     -1, /* m_size */
21239   #endif
21240     __pyx_methods /* m_methods */,
21241   #if CYTHON_PEP489_MULTI_PHASE_INIT
21242     __pyx_moduledef_slots, /* m_slots */
21243   #else
21244     NULL, /* m_reload */
21245   #endif
21246     NULL, /* m_traverse */
21247     NULL, /* m_clear */
21248     NULL /* m_free */
21249 };
21250 #endif
21251 #ifndef CYTHON_SMALL_CODE
21252 #if defined(__clang__)
21253     #define CYTHON_SMALL_CODE
21254 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
21255     #define CYTHON_SMALL_CODE __attribute__((cold))
21256 #else
21257     #define CYTHON_SMALL_CODE
21258 #endif
21259 #endif
21260 
21261 static __Pyx_StringTabEntry __pyx_string_tab[] = {
21262   {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
21263   {&__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},
21264   {&__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},
21265   {&__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},
21266   {&__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},
21267   {&__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},
21268   {&__pyx_n_s_DeterministicMaximumDirectionGet, __pyx_k_DeterministicMaximumDirectionGet, sizeof(__pyx_k_DeterministicMaximumDirectionGet), 0, 0, 1, 1},
21269   {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
21270   {&__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},
21271   {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
21272   {&__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},
21273   {&__pyx_kp_s_Incompatible_checksums_s_vs_0xd8, __pyx_k_Incompatible_checksums_s_vs_0xd8, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xd8), 0, 0, 1, 0},
21274   {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
21275   {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
21276   {&__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},
21277   {&__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},
21278   {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
21279   {&__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},
21280   {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
21281   {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
21282   {&__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},
21283   {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
21284   {&__pyx_n_s_ProbabilisticDirectionGetter, __pyx_k_ProbabilisticDirectionGetter, sizeof(__pyx_k_ProbabilisticDirectionGetter), 0, 0, 1, 1},
21285   {&__pyx_n_s_T, __pyx_k_T, sizeof(__pyx_k_T), 0, 0, 1, 1},
21286   {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
21287   {&__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},
21288   {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
21289   {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
21290   {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
21291   {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1},
21292   {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
21293   {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
21294   {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
21295   {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
21296   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
21297   {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
21298   {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
21299   {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
21300   {&__pyx_n_s_cos_similarity, __pyx_k_cos_similarity, sizeof(__pyx_k_cos_similarity), 0, 0, 1, 1},
21301   {&__pyx_n_s_default_sphere, __pyx_k_default_sphere, sizeof(__pyx_k_default_sphere), 0, 0, 1, 1},
21302   {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
21303   {&__pyx_n_s_dipy_direction_peaks, __pyx_k_dipy_direction_peaks, sizeof(__pyx_k_dipy_direction_peaks), 0, 0, 1, 1},
21304   {&__pyx_n_s_dipy_direction_probabilistic_dir, __pyx_k_dipy_direction_probabilistic_dir, sizeof(__pyx_k_dipy_direction_probabilistic_dir), 0, 0, 1, 1},
21305   {&__pyx_n_s_dot, __pyx_k_dot, sizeof(__pyx_k_dot), 0, 0, 1, 1},
21306   {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
21307   {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
21308   {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
21309   {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
21310   {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
21311   {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
21312   {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
21313   {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
21314   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
21315   {&__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},
21316   {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
21317   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
21318   {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
21319   {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
21320   {&__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},
21321   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
21322   {&__pyx_n_s_max_angle, __pyx_k_max_angle, sizeof(__pyx_k_max_angle), 0, 0, 1, 1},
21323   {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
21324   {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
21325   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
21326   {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
21327   {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
21328   {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
21329   {&__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},
21330   {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
21331   {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
21332   {&__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},
21333   {&__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},
21334   {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
21335   {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
21336   {&__pyx_n_s_peak_directions, __pyx_k_peak_directions, sizeof(__pyx_k_peak_directions), 0, 0, 1, 1},
21337   {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
21338   {&__pyx_n_s_pmf_gen, __pyx_k_pmf_gen, sizeof(__pyx_k_pmf_gen), 0, 0, 1, 1},
21339   {&__pyx_n_s_pmf_threshold, __pyx_k_pmf_threshold, sizeof(__pyx_k_pmf_threshold), 0, 0, 1, 1},
21340   {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
21341   {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
21342   {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
21343   {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
21344   {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
21345   {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
21346   {&__pyx_n_s_pyx_unpickle_DeterministicMaxi, __pyx_k_pyx_unpickle_DeterministicMaxi, sizeof(__pyx_k_pyx_unpickle_DeterministicMaxi), 0, 0, 1, 1},
21347   {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
21348   {&__pyx_n_s_pyx_unpickle_ProbabilisticDire, __pyx_k_pyx_unpickle_ProbabilisticDire, sizeof(__pyx_k_pyx_unpickle_ProbabilisticDire), 0, 0, 1, 1},
21349   {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
21350   {&__pyx_n_s_random, __pyx_k_random, sizeof(__pyx_k_random), 0, 0, 1, 1},
21351   {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
21352   {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
21353   {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
21354   {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
21355   {&__pyx_n_s_set_adjacency_matrix, __pyx_k_set_adjacency_matrix, sizeof(__pyx_k_set_adjacency_matrix), 0, 0, 1, 1},
21356   {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
21357   {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
21358   {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
21359   {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
21360   {&__pyx_n_s_sphere, __pyx_k_sphere, sizeof(__pyx_k_sphere), 0, 0, 1, 1},
21361   {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
21362   {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
21363   {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
21364   {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
21365   {&__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},
21366   {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
21367   {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
21368   {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
21369   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
21370   {&__pyx_n_u_uint8, __pyx_k_uint8, sizeof(__pyx_k_uint8), 0, 1, 0, 1},
21371   {&__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},
21372   {&__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},
21373   {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
21374   {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
21375   {&__pyx_n_s_vertices, __pyx_k_vertices, sizeof(__pyx_k_vertices), 0, 0, 1, 1},
21376   {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1},
21377   {0, 0, 0, 0, 0, 0, 0}
21378 };
__Pyx_InitCachedBuiltins(void)21379 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
21380   __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 77, __pyx_L1_error)
21381   __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 111, __pyx_L1_error)
21382   __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(2, 947, __pyx_L1_error)
21383   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 133, __pyx_L1_error)
21384   __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 148, __pyx_L1_error)
21385   __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 151, __pyx_L1_error)
21386   __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
21387   __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 404, __pyx_L1_error)
21388   __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(1, 613, __pyx_L1_error)
21389   __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(1, 832, __pyx_L1_error)
21390   return 0;
21391   __pyx_L1_error:;
21392   return -1;
21393 }
21394 
__Pyx_InitCachedConstants(void)21395 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
21396   __Pyx_RefNannyDeclarations
21397   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
21398 
21399   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":947
21400  *         __pyx_import_array()
21401  *     except Exception:
21402  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
21403  *
21404  * cdef inline int import_umath() except -1:
21405  */
21406   __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple_)) __PYX_ERR(2, 947, __pyx_L1_error)
21407   __Pyx_GOTREF(__pyx_tuple_);
21408   __Pyx_GIVEREF(__pyx_tuple_);
21409 
21410   /* "../../miniconda3/envs/dipy-env-37/lib/python3.7/site-packages/numpy/__init__.pxd":953
21411  *         _import_umath()
21412  *     except Exception:
21413  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
21414  *
21415  * cdef inline int import_ufunc() except -1:
21416  */
21417   __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(2, 953, __pyx_L1_error)
21418   __Pyx_GOTREF(__pyx_tuple__2);
21419   __Pyx_GIVEREF(__pyx_tuple__2);
21420 
21421   /* "View.MemoryView":133
21422  *
21423  *         if not self.ndim:
21424  *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
21425  *
21426  *         if itemsize <= 0:
21427  */
21428   __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 133, __pyx_L1_error)
21429   __Pyx_GOTREF(__pyx_tuple__3);
21430   __Pyx_GIVEREF(__pyx_tuple__3);
21431 
21432   /* "View.MemoryView":136
21433  *
21434  *         if itemsize <= 0:
21435  *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
21436  *
21437  *         if not isinstance(format, bytes):
21438  */
21439   __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 136, __pyx_L1_error)
21440   __Pyx_GOTREF(__pyx_tuple__4);
21441   __Pyx_GIVEREF(__pyx_tuple__4);
21442 
21443   /* "View.MemoryView":148
21444  *
21445  *         if not self._shape:
21446  *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
21447  *
21448  *
21449  */
21450   __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 148, __pyx_L1_error)
21451   __Pyx_GOTREF(__pyx_tuple__5);
21452   __Pyx_GIVEREF(__pyx_tuple__5);
21453 
21454   /* "View.MemoryView":176
21455  *             self.data = <char *>malloc(self.len)
21456  *             if not self.data:
21457  *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
21458  *
21459  *             if self.dtype_is_object:
21460  */
21461   __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 176, __pyx_L1_error)
21462   __Pyx_GOTREF(__pyx_tuple__6);
21463   __Pyx_GIVEREF(__pyx_tuple__6);
21464 
21465   /* "View.MemoryView":192
21466  *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
21467  *         if not (flags & bufmode):
21468  *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
21469  *         info.buf = self.data
21470  *         info.len = self.len
21471  */
21472   __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 192, __pyx_L1_error)
21473   __Pyx_GOTREF(__pyx_tuple__7);
21474   __Pyx_GIVEREF(__pyx_tuple__7);
21475 
21476   /* "(tree fragment)":2
21477  * def __reduce_cython__(self):
21478  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
21479  * def __setstate_cython__(self, __pyx_state):
21480  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21481  */
21482   __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 2, __pyx_L1_error)
21483   __Pyx_GOTREF(__pyx_tuple__8);
21484   __Pyx_GIVEREF(__pyx_tuple__8);
21485 
21486   /* "(tree fragment)":4
21487  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21488  * def __setstate_cython__(self, __pyx_state):
21489  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
21490  */
21491   __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 4, __pyx_L1_error)
21492   __Pyx_GOTREF(__pyx_tuple__9);
21493   __Pyx_GIVEREF(__pyx_tuple__9);
21494 
21495   /* "View.MemoryView":418
21496  *     def __setitem__(memoryview self, object index, object value):
21497  *         if self.view.readonly:
21498  *             raise TypeError("Cannot assign to read-only memoryview")             # <<<<<<<<<<<<<<
21499  *
21500  *         have_slices, index = _unellipsify(index, self.view.ndim)
21501  */
21502   __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 418, __pyx_L1_error)
21503   __Pyx_GOTREF(__pyx_tuple__10);
21504   __Pyx_GIVEREF(__pyx_tuple__10);
21505 
21506   /* "View.MemoryView":495
21507  *             result = struct.unpack(self.view.format, bytesitem)
21508  *         except struct.error:
21509  *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
21510  *         else:
21511  *             if len(self.view.format) == 1:
21512  */
21513   __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 495, __pyx_L1_error)
21514   __Pyx_GOTREF(__pyx_tuple__11);
21515   __Pyx_GIVEREF(__pyx_tuple__11);
21516 
21517   /* "View.MemoryView":520
21518  *     def __getbuffer__(self, Py_buffer *info, int flags):
21519  *         if flags & PyBUF_WRITABLE and self.view.readonly:
21520  *             raise ValueError("Cannot create writable memory view from read-only memoryview")             # <<<<<<<<<<<<<<
21521  *
21522  *         if flags & PyBUF_ND:
21523  */
21524   __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 520, __pyx_L1_error)
21525   __Pyx_GOTREF(__pyx_tuple__12);
21526   __Pyx_GIVEREF(__pyx_tuple__12);
21527 
21528   /* "View.MemoryView":570
21529  *         if self.view.strides == NULL:
21530  *
21531  *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
21532  *
21533  *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
21534  */
21535   __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 570, __pyx_L1_error)
21536   __Pyx_GOTREF(__pyx_tuple__13);
21537   __Pyx_GIVEREF(__pyx_tuple__13);
21538 
21539   /* "View.MemoryView":577
21540  *     def suboffsets(self):
21541  *         if self.view.suboffsets == NULL:
21542  *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
21543  *
21544  *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
21545  */
21546   __pyx_tuple__14 = PyTuple_New(1); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 577, __pyx_L1_error)
21547   __Pyx_GOTREF(__pyx_tuple__14);
21548   __Pyx_INCREF(__pyx_int_neg_1);
21549   __Pyx_GIVEREF(__pyx_int_neg_1);
21550   PyTuple_SET_ITEM(__pyx_tuple__14, 0, __pyx_int_neg_1);
21551   __Pyx_GIVEREF(__pyx_tuple__14);
21552 
21553   /* "(tree fragment)":2
21554  * def __reduce_cython__(self):
21555  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
21556  * def __setstate_cython__(self, __pyx_state):
21557  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21558  */
21559   __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 2, __pyx_L1_error)
21560   __Pyx_GOTREF(__pyx_tuple__15);
21561   __Pyx_GIVEREF(__pyx_tuple__15);
21562 
21563   /* "(tree fragment)":4
21564  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21565  * def __setstate_cython__(self, __pyx_state):
21566  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
21567  */
21568   __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 4, __pyx_L1_error)
21569   __Pyx_GOTREF(__pyx_tuple__16);
21570   __Pyx_GIVEREF(__pyx_tuple__16);
21571 
21572   /* "View.MemoryView":682
21573  *         if item is Ellipsis:
21574  *             if not seen_ellipsis:
21575  *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
21576  *                 seen_ellipsis = True
21577  *             else:
21578  */
21579   __pyx_slice__17 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__17)) __PYX_ERR(1, 682, __pyx_L1_error)
21580   __Pyx_GOTREF(__pyx_slice__17);
21581   __Pyx_GIVEREF(__pyx_slice__17);
21582 
21583   /* "View.MemoryView":703
21584  *     for suboffset in suboffsets[:ndim]:
21585  *         if suboffset >= 0:
21586  *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
21587  *
21588  *
21589  */
21590   __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 703, __pyx_L1_error)
21591   __Pyx_GOTREF(__pyx_tuple__18);
21592   __Pyx_GIVEREF(__pyx_tuple__18);
21593 
21594   /* "(tree fragment)":2
21595  * def __reduce_cython__(self):
21596  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
21597  * def __setstate_cython__(self, __pyx_state):
21598  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21599  */
21600   __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 2, __pyx_L1_error)
21601   __Pyx_GOTREF(__pyx_tuple__19);
21602   __Pyx_GIVEREF(__pyx_tuple__19);
21603 
21604   /* "(tree fragment)":4
21605  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
21606  * def __setstate_cython__(self, __pyx_state):
21607  *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
21608  */
21609   __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 4, __pyx_L1_error)
21610   __Pyx_GOTREF(__pyx_tuple__20);
21611   __Pyx_GIVEREF(__pyx_tuple__20);
21612 
21613   /* "(tree fragment)":1
21614  * def __pyx_unpickle_ProbabilisticDirectionGetter(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
21615  *     cdef object __pyx_PickleError
21616  *     cdef object __pyx_result
21617  */
21618   __pyx_tuple__21 = 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__21)) __PYX_ERR(1, 1, __pyx_L1_error)
21619   __Pyx_GOTREF(__pyx_tuple__21);
21620   __Pyx_GIVEREF(__pyx_tuple__21);
21621   __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_ProbabilisticDire, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(1, 1, __pyx_L1_error)
21622   __pyx_tuple__23 = 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__23)) __PYX_ERR(1, 1, __pyx_L1_error)
21623   __Pyx_GOTREF(__pyx_tuple__23);
21624   __Pyx_GIVEREF(__pyx_tuple__23);
21625   __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_DeterministicMaxi, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(1, 1, __pyx_L1_error)
21626 
21627   /* "View.MemoryView":286
21628  *         return self.name
21629  *
21630  * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
21631  * cdef strided = Enum("<strided and direct>") # default
21632  * cdef indirect = Enum("<strided and indirect>")
21633  */
21634   __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 286, __pyx_L1_error)
21635   __Pyx_GOTREF(__pyx_tuple__25);
21636   __Pyx_GIVEREF(__pyx_tuple__25);
21637 
21638   /* "View.MemoryView":287
21639  *
21640  * cdef generic = Enum("<strided and direct or indirect>")
21641  * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
21642  * cdef indirect = Enum("<strided and indirect>")
21643  *
21644  */
21645   __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 287, __pyx_L1_error)
21646   __Pyx_GOTREF(__pyx_tuple__26);
21647   __Pyx_GIVEREF(__pyx_tuple__26);
21648 
21649   /* "View.MemoryView":288
21650  * cdef generic = Enum("<strided and direct or indirect>")
21651  * cdef strided = Enum("<strided and direct>") # default
21652  * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
21653  *
21654  *
21655  */
21656   __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 288, __pyx_L1_error)
21657   __Pyx_GOTREF(__pyx_tuple__27);
21658   __Pyx_GIVEREF(__pyx_tuple__27);
21659 
21660   /* "View.MemoryView":291
21661  *
21662  *
21663  * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
21664  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
21665  *
21666  */
21667   __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 291, __pyx_L1_error)
21668   __Pyx_GOTREF(__pyx_tuple__28);
21669   __Pyx_GIVEREF(__pyx_tuple__28);
21670 
21671   /* "View.MemoryView":292
21672  *
21673  * cdef contiguous = Enum("<contiguous and direct>")
21674  * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
21675  *
21676  *
21677  */
21678   __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 292, __pyx_L1_error)
21679   __Pyx_GOTREF(__pyx_tuple__29);
21680   __Pyx_GIVEREF(__pyx_tuple__29);
21681 
21682   /* "(tree fragment)":1
21683  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
21684  *     cdef object __pyx_PickleError
21685  *     cdef object __pyx_result
21686  */
21687   __pyx_tuple__30 = 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__30)) __PYX_ERR(1, 1, __pyx_L1_error)
21688   __Pyx_GOTREF(__pyx_tuple__30);
21689   __Pyx_GIVEREF(__pyx_tuple__30);
21690   __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(1, 1, __pyx_L1_error)
21691   __Pyx_RefNannyFinishContext();
21692   return 0;
21693   __pyx_L1_error:;
21694   __Pyx_RefNannyFinishContext();
21695   return -1;
21696 }
21697 
__Pyx_InitGlobals(void)21698 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
21699   __pyx_umethod_PyDict_Type_update.type = (PyObject*)&PyDict_Type;
21700   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
21701   __pyx_float_0_1 = PyFloat_FromDouble(0.1); if (unlikely(!__pyx_float_0_1)) __PYX_ERR(0, 1, __pyx_L1_error)
21702   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
21703   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
21704   __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
21705   __pyx_int_226936259 = PyInt_FromLong(226936259L); if (unlikely(!__pyx_int_226936259)) __PYX_ERR(0, 1, __pyx_L1_error)
21706   __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
21707   return 0;
21708   __pyx_L1_error:;
21709   return -1;
21710 }
21711 
21712 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
21713 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
21714 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
21715 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
21716 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
21717 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
21718 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
21719 
__Pyx_modinit_global_init_code(void)21720 static int __Pyx_modinit_global_init_code(void) {
21721   __Pyx_RefNannyDeclarations
21722   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
21723   /*--- Global init code ---*/
21724   generic = Py_None; Py_INCREF(Py_None);
21725   strided = Py_None; Py_INCREF(Py_None);
21726   indirect = Py_None; Py_INCREF(Py_None);
21727   contiguous = Py_None; Py_INCREF(Py_None);
21728   indirect_contiguous = Py_None; Py_INCREF(Py_None);
21729   __Pyx_RefNannyFinishContext();
21730   return 0;
21731 }
21732 
__Pyx_modinit_variable_export_code(void)21733 static int __Pyx_modinit_variable_export_code(void) {
21734   __Pyx_RefNannyDeclarations
21735   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
21736   /*--- Variable export code ---*/
21737   __Pyx_RefNannyFinishContext();
21738   return 0;
21739 }
21740 
__Pyx_modinit_function_export_code(void)21741 static int __Pyx_modinit_function_export_code(void) {
21742   __Pyx_RefNannyDeclarations
21743   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
21744   /*--- Function export code ---*/
21745   __Pyx_RefNannyFinishContext();
21746   return 0;
21747 }
21748 
__Pyx_modinit_type_init_code(void)21749 static int __Pyx_modinit_type_init_code(void) {
21750   __Pyx_RefNannyDeclarations
21751   PyObject *__pyx_t_1 = NULL;
21752   int __pyx_lineno = 0;
21753   const char *__pyx_filename = NULL;
21754   int __pyx_clineno = 0;
21755   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
21756   /*--- Type init code ---*/
21757   __pyx_t_1 = PyImport_ImportModule("dipy.direction.closest_peak_direction_getter"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
21758   __Pyx_GOTREF(__pyx_t_1);
21759   __pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter = __Pyx_ImportType(__pyx_t_1, "dipy.direction.closest_peak_direction_getter", "PmfGenDirectionGetter", sizeof(struct __pyx_obj_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter), __Pyx_ImportType_CheckSize_Warn);
21760    if (!__pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter) __PYX_ERR(0, 1, __pyx_L1_error)
21761   __pyx_vtabptr_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter = (struct __pyx_vtabstruct_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter*)__Pyx_GetVtable(__pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter->tp_dict); if (unlikely(!__pyx_vtabptr_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter)) __PYX_ERR(0, 1, __pyx_L1_error)
21762   __pyx_vtabptr_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter = &__pyx_vtable_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter;
21763   __pyx_vtable_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter.__pyx_base = *__pyx_vtabptr_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter;
21764   __pyx_vtable_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter.__pyx_base.__pyx_base.__pyx_base.get_direction_c = (int (*)(struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter *, double *, double *))__pyx_f_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter_get_direction_c;
21765   __pyx_type_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter.tp_base = __pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_PmfGenDirectionGetter;
21766   if (PyType_Ready(&__pyx_type_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter) < 0) __PYX_ERR(0, 21, __pyx_L1_error)
21767   #if PY_VERSION_HEX < 0x030800B1
21768   __pyx_type_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter.tp_print = 0;
21769   #endif
21770   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter.tp_dictoffset && __pyx_type_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter.tp_getattro == PyObject_GenericGetAttr)) {
21771     __pyx_type_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21772   }
21773   #if CYTHON_COMPILING_IN_CPYTHON
21774   {
21775     PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 21, __pyx_L1_error)
21776     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
21777       __pyx_wrapperbase_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
21778       __pyx_wrapperbase_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter___init__.doc = __pyx_doc_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter___init__;
21779       ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4dipy_9direction_30probabilistic_direction_getter_28ProbabilisticDirectionGetter___init__;
21780     }
21781   }
21782   #endif
21783   if (__Pyx_SetVtable(__pyx_type_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter.tp_dict, __pyx_vtabptr_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter) < 0) __PYX_ERR(0, 21, __pyx_L1_error)
21784   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ProbabilisticDirectionGetter, (PyObject *)&__pyx_type_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter) < 0) __PYX_ERR(0, 21, __pyx_L1_error)
21785   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter) < 0) __PYX_ERR(0, 21, __pyx_L1_error)
21786   __pyx_ptype_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter = &__pyx_type_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter;
21787   __pyx_vtabptr_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter = &__pyx_vtable_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter;
21788   __pyx_vtable_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter.__pyx_base = *__pyx_vtabptr_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter;
21789   __pyx_vtable_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter.__pyx_base.__pyx_base.__pyx_base.__pyx_base.get_direction_c = (int (*)(struct __pyx_obj_4dipy_8tracking_16direction_getter_DirectionGetter *, double *, double *))__pyx_f_4dipy_9direction_30probabilistic_direction_getter_35DeterministicMaximumDirectionGetter_get_direction_c;
21790   __pyx_type_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter.tp_base = __pyx_ptype_4dipy_9direction_30probabilistic_direction_getter_ProbabilisticDirectionGetter;
21791   if (PyType_Ready(&__pyx_type_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
21792   #if PY_VERSION_HEX < 0x030800B1
21793   __pyx_type_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter.tp_print = 0;
21794   #endif
21795   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter.tp_dictoffset && __pyx_type_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter.tp_getattro == PyObject_GenericGetAttr)) {
21796     __pyx_type_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21797   }
21798   if (__Pyx_SetVtable(__pyx_type_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter.tp_dict, __pyx_vtabptr_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
21799   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_DeterministicMaximumDirectionGet, (PyObject *)&__pyx_type_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
21800   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
21801   __pyx_ptype_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter = &__pyx_type_4dipy_9direction_30probabilistic_direction_getter_DeterministicMaximumDirectionGetter;
21802   __pyx_vtabptr_array = &__pyx_vtable_array;
21803   __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
21804   if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
21805   #if PY_VERSION_HEX < 0x030800B1
21806   __pyx_type___pyx_array.tp_print = 0;
21807   #endif
21808   if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
21809   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
21810   __pyx_array_type = &__pyx_type___pyx_array;
21811   if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 279, __pyx_L1_error)
21812   #if PY_VERSION_HEX < 0x030800B1
21813   __pyx_type___pyx_MemviewEnum.tp_print = 0;
21814   #endif
21815   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
21816     __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21817   }
21818   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 279, __pyx_L1_error)
21819   __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
21820   __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
21821   __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
21822   __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
21823   __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
21824   __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
21825   __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
21826   __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
21827   __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
21828   if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
21829   #if PY_VERSION_HEX < 0x030800B1
21830   __pyx_type___pyx_memoryview.tp_print = 0;
21831   #endif
21832   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
21833     __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21834   }
21835   if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
21836   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
21837   __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
21838   __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
21839   __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
21840   __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
21841   __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
21842   __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
21843   if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
21844   #if PY_VERSION_HEX < 0x030800B1
21845   __pyx_type___pyx_memoryviewslice.tp_print = 0;
21846   #endif
21847   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
21848     __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21849   }
21850   if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
21851   if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
21852   __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
21853   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21854   __Pyx_RefNannyFinishContext();
21855   return 0;
21856   __pyx_L1_error:;
21857   __Pyx_XDECREF(__pyx_t_1);
21858   __Pyx_RefNannyFinishContext();
21859   return -1;
21860 }
21861 
__Pyx_modinit_type_import_code(void)21862 static int __Pyx_modinit_type_import_code(void) {
21863   __Pyx_RefNannyDeclarations
21864   PyObject *__pyx_t_1 = NULL;
21865   int __pyx_lineno = 0;
21866   const char *__pyx_filename = NULL;
21867   int __pyx_clineno = 0;
21868   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
21869   /*--- Type import code ---*/
21870   __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
21871   __Pyx_GOTREF(__pyx_t_1);
21872   __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
21873   #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
21874   sizeof(PyTypeObject),
21875   #else
21876   sizeof(PyHeapTypeObject),
21877   #endif
21878   __Pyx_ImportType_CheckSize_Warn);
21879    if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
21880   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21881   __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 200, __pyx_L1_error)
21882   __Pyx_GOTREF(__pyx_t_1);
21883   __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
21884    if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 200, __pyx_L1_error)
21885   __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
21886    if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 223, __pyx_L1_error)
21887   __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
21888    if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 227, __pyx_L1_error)
21889   __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
21890    if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 239, __pyx_L1_error)
21891   __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21892    if (!__pyx_ptype_5numpy_generic) __PYX_ERR(2, 771, __pyx_L1_error)
21893   __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21894    if (!__pyx_ptype_5numpy_number) __PYX_ERR(2, 773, __pyx_L1_error)
21895   __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21896    if (!__pyx_ptype_5numpy_integer) __PYX_ERR(2, 775, __pyx_L1_error)
21897   __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21898    if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(2, 777, __pyx_L1_error)
21899   __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21900    if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(2, 779, __pyx_L1_error)
21901   __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21902    if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(2, 781, __pyx_L1_error)
21903   __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21904    if (!__pyx_ptype_5numpy_floating) __PYX_ERR(2, 783, __pyx_L1_error)
21905   __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21906    if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(2, 785, __pyx_L1_error)
21907   __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21908    if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(2, 787, __pyx_L1_error)
21909   __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
21910    if (!__pyx_ptype_5numpy_character) __PYX_ERR(2, 789, __pyx_L1_error)
21911   __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
21912    if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 827, __pyx_L1_error)
21913   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21914   __pyx_t_1 = PyImport_ImportModule("dipy.direction.pmf"); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3, __pyx_L1_error)
21915   __Pyx_GOTREF(__pyx_t_1);
21916   __pyx_ptype_4dipy_9direction_3pmf_PmfGen = __Pyx_ImportType(__pyx_t_1, "dipy.direction.pmf", "PmfGen", sizeof(struct __pyx_obj_4dipy_9direction_3pmf_PmfGen), __Pyx_ImportType_CheckSize_Warn);
21917    if (!__pyx_ptype_4dipy_9direction_3pmf_PmfGen) __PYX_ERR(4, 3, __pyx_L1_error)
21918   __pyx_vtabptr_4dipy_9direction_3pmf_PmfGen = (struct __pyx_vtabstruct_4dipy_9direction_3pmf_PmfGen*)__Pyx_GetVtable(__pyx_ptype_4dipy_9direction_3pmf_PmfGen->tp_dict); if (unlikely(!__pyx_vtabptr_4dipy_9direction_3pmf_PmfGen)) __PYX_ERR(4, 3, __pyx_L1_error)
21919   __pyx_ptype_4dipy_9direction_3pmf_SimplePmfGen = __Pyx_ImportType(__pyx_t_1, "dipy.direction.pmf", "SimplePmfGen", sizeof(struct __pyx_obj_4dipy_9direction_3pmf_SimplePmfGen), __Pyx_ImportType_CheckSize_Warn);
21920    if (!__pyx_ptype_4dipy_9direction_3pmf_SimplePmfGen) __PYX_ERR(4, 14, __pyx_L1_error)
21921   __pyx_vtabptr_4dipy_9direction_3pmf_SimplePmfGen = (struct __pyx_vtabstruct_4dipy_9direction_3pmf_SimplePmfGen*)__Pyx_GetVtable(__pyx_ptype_4dipy_9direction_3pmf_SimplePmfGen->tp_dict); if (unlikely(!__pyx_vtabptr_4dipy_9direction_3pmf_SimplePmfGen)) __PYX_ERR(4, 14, __pyx_L1_error)
21922   __pyx_ptype_4dipy_9direction_3pmf_SHCoeffPmfGen = __Pyx_ImportType(__pyx_t_1, "dipy.direction.pmf", "SHCoeffPmfGen", sizeof(struct __pyx_obj_4dipy_9direction_3pmf_SHCoeffPmfGen), __Pyx_ImportType_CheckSize_Warn);
21923    if (!__pyx_ptype_4dipy_9direction_3pmf_SHCoeffPmfGen) __PYX_ERR(4, 18, __pyx_L1_error)
21924   __pyx_vtabptr_4dipy_9direction_3pmf_SHCoeffPmfGen = (struct __pyx_vtabstruct_4dipy_9direction_3pmf_SHCoeffPmfGen*)__Pyx_GetVtable(__pyx_ptype_4dipy_9direction_3pmf_SHCoeffPmfGen->tp_dict); if (unlikely(!__pyx_vtabptr_4dipy_9direction_3pmf_SHCoeffPmfGen)) __PYX_ERR(4, 18, __pyx_L1_error)
21925   __pyx_ptype_4dipy_9direction_3pmf_BootPmfGen = __Pyx_ImportType(__pyx_t_1, "dipy.direction.pmf", "BootPmfGen", sizeof(struct __pyx_obj_4dipy_9direction_3pmf_BootPmfGen), __Pyx_ImportType_CheckSize_Warn);
21926    if (!__pyx_ptype_4dipy_9direction_3pmf_BootPmfGen) __PYX_ERR(4, 26, __pyx_L1_error)
21927   __pyx_vtabptr_4dipy_9direction_3pmf_BootPmfGen = (struct __pyx_vtabstruct_4dipy_9direction_3pmf_BootPmfGen*)__Pyx_GetVtable(__pyx_ptype_4dipy_9direction_3pmf_BootPmfGen->tp_dict); if (unlikely(!__pyx_vtabptr_4dipy_9direction_3pmf_BootPmfGen)) __PYX_ERR(4, 26, __pyx_L1_error)
21928   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21929   __pyx_t_1 = PyImport_ImportModule("dipy.tracking.direction_getter"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 4, __pyx_L1_error)
21930   __Pyx_GOTREF(__pyx_t_1);
21931   __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);
21932    if (!__pyx_ptype_4dipy_8tracking_16direction_getter_DirectionGetter) __PYX_ERR(5, 4, __pyx_L1_error)
21933   __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(5, 4, __pyx_L1_error)
21934   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21935   __pyx_t_1 = PyImport_ImportModule("dipy.direction.closest_peak_direction_getter"); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 10, __pyx_L1_error)
21936   __Pyx_GOTREF(__pyx_t_1);
21937   __pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_BasePmfDirectionGetter = __Pyx_ImportType(__pyx_t_1, "dipy.direction.closest_peak_direction_getter", "BasePmfDirectionGetter", sizeof(struct __pyx_obj_4dipy_9direction_29closest_peak_direction_getter_BasePmfDirectionGetter), __Pyx_ImportType_CheckSize_Warn);
21938    if (!__pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_BasePmfDirectionGetter) __PYX_ERR(6, 10, __pyx_L1_error)
21939   __pyx_vtabptr_4dipy_9direction_29closest_peak_direction_getter_BasePmfDirectionGetter = (struct __pyx_vtabstruct_4dipy_9direction_29closest_peak_direction_getter_BasePmfDirectionGetter*)__Pyx_GetVtable(__pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_BasePmfDirectionGetter->tp_dict); if (unlikely(!__pyx_vtabptr_4dipy_9direction_29closest_peak_direction_getter_BasePmfDirectionGetter)) __PYX_ERR(6, 10, __pyx_L1_error)
21940   __pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_BaseDirectionGetter = __Pyx_ImportType(__pyx_t_1, "dipy.direction.closest_peak_direction_getter", "BaseDirectionGetter", sizeof(struct __pyx_obj_4dipy_9direction_29closest_peak_direction_getter_BaseDirectionGetter), __Pyx_ImportType_CheckSize_Warn);
21941    if (!__pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_BaseDirectionGetter) __PYX_ERR(6, 37, __pyx_L1_error)
21942   __pyx_vtabptr_4dipy_9direction_29closest_peak_direction_getter_BaseDirectionGetter = (struct __pyx_vtabstruct_4dipy_9direction_29closest_peak_direction_getter_BaseDirectionGetter*)__Pyx_GetVtable(__pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_BaseDirectionGetter->tp_dict); if (unlikely(!__pyx_vtabptr_4dipy_9direction_29closest_peak_direction_getter_BaseDirectionGetter)) __PYX_ERR(6, 37, __pyx_L1_error)
21943   __pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_ClosestPeakDirectionGetter = __Pyx_ImportType(__pyx_t_1, "dipy.direction.closest_peak_direction_getter", "ClosestPeakDirectionGetter", sizeof(struct __pyx_obj_4dipy_9direction_29closest_peak_direction_getter_ClosestPeakDirectionGetter), __Pyx_ImportType_CheckSize_Warn);
21944    if (!__pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_ClosestPeakDirectionGetter) __PYX_ERR(6, 46, __pyx_L1_error)
21945   __pyx_vtabptr_4dipy_9direction_29closest_peak_direction_getter_ClosestPeakDirectionGetter = (struct __pyx_vtabstruct_4dipy_9direction_29closest_peak_direction_getter_ClosestPeakDirectionGetter*)__Pyx_GetVtable(__pyx_ptype_4dipy_9direction_29closest_peak_direction_getter_ClosestPeakDirectionGetter->tp_dict); if (unlikely(!__pyx_vtabptr_4dipy_9direction_29closest_peak_direction_getter_ClosestPeakDirectionGetter)) __PYX_ERR(6, 46, __pyx_L1_error)
21946   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21947   __Pyx_RefNannyFinishContext();
21948   return 0;
21949   __pyx_L1_error:;
21950   __Pyx_XDECREF(__pyx_t_1);
21951   __Pyx_RefNannyFinishContext();
21952   return -1;
21953 }
21954 
__Pyx_modinit_variable_import_code(void)21955 static int __Pyx_modinit_variable_import_code(void) {
21956   __Pyx_RefNannyDeclarations
21957   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
21958   /*--- Variable import code ---*/
21959   __Pyx_RefNannyFinishContext();
21960   return 0;
21961 }
21962 
__Pyx_modinit_function_import_code(void)21963 static int __Pyx_modinit_function_import_code(void) {
21964   __Pyx_RefNannyDeclarations
21965   PyObject *__pyx_t_1 = NULL;
21966   int __pyx_lineno = 0;
21967   const char *__pyx_filename = NULL;
21968   int __pyx_clineno = 0;
21969   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
21970   /*--- Function import code ---*/
21971   __pyx_t_1 = PyImport_ImportModule("dipy.utils.fast_numpy"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
21972   __Pyx_GOTREF(__pyx_t_1);
21973   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, 1, __pyx_L1_error)
21974   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, 1, __pyx_L1_error)
21975   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21976   __Pyx_RefNannyFinishContext();
21977   return 0;
21978   __pyx_L1_error:;
21979   __Pyx_XDECREF(__pyx_t_1);
21980   __Pyx_RefNannyFinishContext();
21981   return -1;
21982 }
21983 
21984 
21985 #ifndef CYTHON_NO_PYINIT_EXPORT
21986 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
21987 #elif PY_MAJOR_VERSION < 3
21988 #ifdef __cplusplus
21989 #define __Pyx_PyMODINIT_FUNC extern "C" void
21990 #else
21991 #define __Pyx_PyMODINIT_FUNC void
21992 #endif
21993 #else
21994 #ifdef __cplusplus
21995 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
21996 #else
21997 #define __Pyx_PyMODINIT_FUNC PyObject *
21998 #endif
21999 #endif
22000 
22001 
22002 #if PY_MAJOR_VERSION < 3
22003 __Pyx_PyMODINIT_FUNC initprobabilistic_direction_getter(void) CYTHON_SMALL_CODE; /*proto*/
initprobabilistic_direction_getter(void)22004 __Pyx_PyMODINIT_FUNC initprobabilistic_direction_getter(void)
22005 #else
22006 __Pyx_PyMODINIT_FUNC PyInit_probabilistic_direction_getter(void) CYTHON_SMALL_CODE; /*proto*/
22007 __Pyx_PyMODINIT_FUNC PyInit_probabilistic_direction_getter(void)
22008 #if CYTHON_PEP489_MULTI_PHASE_INIT
22009 {
22010   return PyModuleDef_Init(&__pyx_moduledef);
22011 }
22012 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
22013     #if PY_VERSION_HEX >= 0x030700A1
22014     static PY_INT64_T main_interpreter_id = -1;
22015     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
22016     if (main_interpreter_id == -1) {
22017         main_interpreter_id = current_id;
22018         return (unlikely(current_id == -1)) ? -1 : 0;
22019     } else if (unlikely(main_interpreter_id != current_id))
22020     #else
22021     static PyInterpreterState *main_interpreter = NULL;
22022     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
22023     if (!main_interpreter) {
22024         main_interpreter = current_interpreter;
22025     } else if (unlikely(main_interpreter != current_interpreter))
22026     #endif
22027     {
22028         PyErr_SetString(
22029             PyExc_ImportError,
22030             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
22031         return -1;
22032     }
22033     return 0;
22034 }
22035 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) {
22036     PyObject *value = PyObject_GetAttrString(spec, from_name);
22037     int result = 0;
22038     if (likely(value)) {
22039         if (allow_none || value != Py_None) {
22040             result = PyDict_SetItemString(moddict, to_name, value);
22041         }
22042         Py_DECREF(value);
22043     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
22044         PyErr_Clear();
22045     } else {
22046         result = -1;
22047     }
22048     return result;
22049 }
22050 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
22051     PyObject *module = NULL, *moddict, *modname;
22052     if (__Pyx_check_single_interpreter())
22053         return NULL;
22054     if (__pyx_m)
22055         return __Pyx_NewRef(__pyx_m);
22056     modname = PyObject_GetAttrString(spec, "name");
22057     if (unlikely(!modname)) goto bad;
22058     module = PyModule_NewObject(modname);
22059     Py_DECREF(modname);
22060     if (unlikely(!module)) goto bad;
22061     moddict = PyModule_GetDict(module);
22062     if (unlikely(!moddict)) goto bad;
22063     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
22064     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
22065     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
22066     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
22067     return module;
22068 bad:
22069     Py_XDECREF(module);
22070     return NULL;
22071 }
22072 
22073 
22074 static CYTHON_SMALL_CODE int __pyx_pymod_exec_probabilistic_direction_getter(PyObject *__pyx_pyinit_module)
22075 #endif
22076 #endif
22077 {
22078   PyObject *__pyx_t_1 = NULL;
22079   PyObject *__pyx_t_2 = NULL;
22080   static PyThread_type_lock __pyx_t_3[8];
22081   int __pyx_lineno = 0;
22082   const char *__pyx_filename = NULL;
22083   int __pyx_clineno = 0;
22084   __Pyx_RefNannyDeclarations
22085   #if CYTHON_PEP489_MULTI_PHASE_INIT
22086   if (__pyx_m) {
22087     if (__pyx_m == __pyx_pyinit_module) return 0;
22088     PyErr_SetString(PyExc_RuntimeError, "Module 'probabilistic_direction_getter' has already been imported. Re-initialisation is not supported.");
22089     return -1;
22090   }
22091   #elif PY_MAJOR_VERSION >= 3
22092   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
22093   #endif
22094   #if CYTHON_REFNANNY
22095 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
22096 if (!__Pyx_RefNanny) {
22097   PyErr_Clear();
22098   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
22099   if (!__Pyx_RefNanny)
22100       Py_FatalError("failed to import 'refnanny' module");
22101 }
22102 #endif
22103   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_probabilistic_direction_getter(void)", 0);
22104   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22105   #ifdef __Pxy_PyFrame_Initialize_Offsets
22106   __Pxy_PyFrame_Initialize_Offsets();
22107   #endif
22108   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
22109   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
22110   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
22111   #ifdef __Pyx_CyFunction_USED
22112   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22113   #endif
22114   #ifdef __Pyx_FusedFunction_USED
22115   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22116   #endif
22117   #ifdef __Pyx_Coroutine_USED
22118   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22119   #endif
22120   #ifdef __Pyx_Generator_USED
22121   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22122   #endif
22123   #ifdef __Pyx_AsyncGen_USED
22124   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22125   #endif
22126   #ifdef __Pyx_StopAsyncIteration_USED
22127   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22128   #endif
22129   /*--- Library function declarations ---*/
22130   /*--- Threads initialization code ---*/
22131   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
22132   #ifdef WITH_THREAD /* Python build with threading support? */
22133   PyEval_InitThreads();
22134   #endif
22135   #endif
22136   /*--- Module creation code ---*/
22137   #if CYTHON_PEP489_MULTI_PHASE_INIT
22138   __pyx_m = __pyx_pyinit_module;
22139   Py_INCREF(__pyx_m);
22140   #else
22141   #if PY_MAJOR_VERSION < 3
22142   __pyx_m = Py_InitModule4("probabilistic_direction_getter", __pyx_methods, __pyx_k_Implementation_of_a_probabilist, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
22143   #else
22144   __pyx_m = PyModule_Create(&__pyx_moduledef);
22145   #endif
22146   if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
22147   #endif
22148   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
22149   Py_INCREF(__pyx_d);
22150   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
22151   Py_INCREF(__pyx_b);
22152   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
22153   Py_INCREF(__pyx_cython_runtime);
22154   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
22155   /*--- Initialize various global constants etc. ---*/
22156   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22157   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
22158   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22159   #endif
22160   if (__pyx_module_is_main_dipy__direction__probabilistic_direction_getter) {
22161     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22162   }
22163   #if PY_MAJOR_VERSION >= 3
22164   {
22165     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
22166     if (!PyDict_GetItemString(modules, "dipy.direction.probabilistic_direction_getter")) {
22167       if (unlikely(PyDict_SetItemString(modules, "dipy.direction.probabilistic_direction_getter", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
22168     }
22169   }
22170   #endif
22171   /*--- Builtin init code ---*/
22172   if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22173   /*--- Constants init code ---*/
22174   if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22175   /*--- Global type/function init code ---*/
22176   (void)__Pyx_modinit_global_init_code();
22177   (void)__Pyx_modinit_variable_export_code();
22178   (void)__Pyx_modinit_function_export_code();
22179   if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
22180   if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
22181   (void)__Pyx_modinit_variable_import_code();
22182   if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
22183   /*--- Execution code ---*/
22184   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
22185   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22186   #endif
22187 
22188   /* "dipy/direction/probabilistic_direction_getter.pyx":10
22189  * """
22190  *
22191  * from random import random             # <<<<<<<<<<<<<<
22192  *
22193  * import numpy as np
22194  */
22195   __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
22196   __Pyx_GOTREF(__pyx_t_1);
22197   __Pyx_INCREF(__pyx_n_s_random);
22198   __Pyx_GIVEREF(__pyx_n_s_random);
22199   PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_random);
22200   __pyx_t_2 = __Pyx_Import(__pyx_n_s_random, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error)
22201   __Pyx_GOTREF(__pyx_t_2);
22202   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22203   __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_random); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
22204   __Pyx_GOTREF(__pyx_t_1);
22205   if (PyDict_SetItem(__pyx_d, __pyx_n_s_random, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
22206   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22207   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22208 
22209   /* "dipy/direction/probabilistic_direction_getter.pyx":12
22210  * from random import random
22211  *
22212  * import numpy as np             # <<<<<<<<<<<<<<
22213  * cimport numpy as cnp
22214  *
22215  */
22216   __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error)
22217   __Pyx_GOTREF(__pyx_t_2);
22218   if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_2) < 0) __PYX_ERR(0, 12, __pyx_L1_error)
22219   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22220 
22221   /* "dipy/direction/probabilistic_direction_getter.pyx":16
22222  *
22223  * from dipy.direction.closest_peak_direction_getter cimport PmfGenDirectionGetter
22224  * from dipy.direction.peaks import peak_directions, default_sphere             # <<<<<<<<<<<<<<
22225  * from dipy.direction.pmf cimport PmfGen, SimplePmfGen, SHCoeffPmfGen
22226  * from dipy.utils.fast_numpy cimport cumsum, where_to_insert
22227  */
22228   __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
22229   __Pyx_GOTREF(__pyx_t_2);
22230   __Pyx_INCREF(__pyx_n_s_peak_directions);
22231   __Pyx_GIVEREF(__pyx_n_s_peak_directions);
22232   PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_peak_directions);
22233   __Pyx_INCREF(__pyx_n_s_default_sphere);
22234   __Pyx_GIVEREF(__pyx_n_s_default_sphere);
22235   PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_default_sphere);
22236   __pyx_t_1 = __Pyx_Import(__pyx_n_s_dipy_direction_peaks, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
22237   __Pyx_GOTREF(__pyx_t_1);
22238   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22239   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_peak_directions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
22240   __Pyx_GOTREF(__pyx_t_2);
22241   if (PyDict_SetItem(__pyx_d, __pyx_n_s_peak_directions, __pyx_t_2) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
22242   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22243   __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_default_sphere); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
22244   __Pyx_GOTREF(__pyx_t_2);
22245   if (PyDict_SetItem(__pyx_d, __pyx_n_s_default_sphere, __pyx_t_2) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
22246   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22247   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22248 
22249   /* "(tree fragment)":1
22250  * def __pyx_unpickle_ProbabilisticDirectionGetter(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
22251  *     cdef object __pyx_PickleError
22252  *     cdef object __pyx_result
22253  */
22254   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4dipy_9direction_30probabilistic_direction_getter_1__pyx_unpickle_ProbabilisticDirectionGetter, NULL, __pyx_n_s_dipy_direction_probabilistic_dir); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
22255   __Pyx_GOTREF(__pyx_t_1);
22256   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_ProbabilisticDire, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
22257   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22258 
22259   /* "(tree fragment)":11
22260  *         __pyx_unpickle_ProbabilisticDirectionGetter__set_state(<ProbabilisticDirectionGetter> __pyx_result, __pyx_state)
22261  *     return __pyx_result
22262  * cdef __pyx_unpickle_ProbabilisticDirectionGetter__set_state(ProbabilisticDirectionGetter __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
22263  *     __pyx_result._adj_matrix = __pyx_state[0]; __pyx_result._pf_kwargs = __pyx_state[1]; __pyx_result.cos_similarity = __pyx_state[2]; __pyx_result.pmf_gen = __pyx_state[3]; __pyx_result.pmf_threshold = __pyx_state[4]; __pyx_result.sphere = __pyx_state[5]; __pyx_result.vertices = __pyx_state[6]
22264  *     if len(__pyx_state) > 7 and hasattr(__pyx_result, '__dict__'):
22265  */
22266   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4dipy_9direction_30probabilistic_direction_getter_3__pyx_unpickle_DeterministicMaximumDirectionGetter, NULL, __pyx_n_s_dipy_direction_probabilistic_dir); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
22267   __Pyx_GOTREF(__pyx_t_1);
22268   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_DeterministicMaxi, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
22269   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22270 
22271   /* "dipy/direction/probabilistic_direction_getter.pyx":1
22272  * # cython: boundscheck=False             # <<<<<<<<<<<<<<
22273  * # cython: initializedcheck=False
22274  * # cython: wraparound=False
22275  */
22276   __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
22277   __Pyx_GOTREF(__pyx_t_1);
22278   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22279   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22280 
22281   /* "View.MemoryView":209
22282  *         info.obj = self
22283  *
22284  *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
22285  *
22286  *     def __dealloc__(array self):
22287  */
22288   __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 209, __pyx_L1_error)
22289   __Pyx_GOTREF(__pyx_t_1);
22290   if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 209, __pyx_L1_error)
22291   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22292   PyType_Modified(__pyx_array_type);
22293 
22294   /* "View.MemoryView":286
22295  *         return self.name
22296  *
22297  * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
22298  * cdef strided = Enum("<strided and direct>") # default
22299  * cdef indirect = Enum("<strided and indirect>")
22300  */
22301   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 286, __pyx_L1_error)
22302   __Pyx_GOTREF(__pyx_t_1);
22303   __Pyx_XGOTREF(generic);
22304   __Pyx_DECREF_SET(generic, __pyx_t_1);
22305   __Pyx_GIVEREF(__pyx_t_1);
22306   __pyx_t_1 = 0;
22307 
22308   /* "View.MemoryView":287
22309  *
22310  * cdef generic = Enum("<strided and direct or indirect>")
22311  * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
22312  * cdef indirect = Enum("<strided and indirect>")
22313  *
22314  */
22315   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 287, __pyx_L1_error)
22316   __Pyx_GOTREF(__pyx_t_1);
22317   __Pyx_XGOTREF(strided);
22318   __Pyx_DECREF_SET(strided, __pyx_t_1);
22319   __Pyx_GIVEREF(__pyx_t_1);
22320   __pyx_t_1 = 0;
22321 
22322   /* "View.MemoryView":288
22323  * cdef generic = Enum("<strided and direct or indirect>")
22324  * cdef strided = Enum("<strided and direct>") # default
22325  * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
22326  *
22327  *
22328  */
22329   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 288, __pyx_L1_error)
22330   __Pyx_GOTREF(__pyx_t_1);
22331   __Pyx_XGOTREF(indirect);
22332   __Pyx_DECREF_SET(indirect, __pyx_t_1);
22333   __Pyx_GIVEREF(__pyx_t_1);
22334   __pyx_t_1 = 0;
22335 
22336   /* "View.MemoryView":291
22337  *
22338  *
22339  * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
22340  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
22341  *
22342  */
22343   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 291, __pyx_L1_error)
22344   __Pyx_GOTREF(__pyx_t_1);
22345   __Pyx_XGOTREF(contiguous);
22346   __Pyx_DECREF_SET(contiguous, __pyx_t_1);
22347   __Pyx_GIVEREF(__pyx_t_1);
22348   __pyx_t_1 = 0;
22349 
22350   /* "View.MemoryView":292
22351  *
22352  * cdef contiguous = Enum("<contiguous and direct>")
22353  * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
22354  *
22355  *
22356  */
22357   __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 292, __pyx_L1_error)
22358   __Pyx_GOTREF(__pyx_t_1);
22359   __Pyx_XGOTREF(indirect_contiguous);
22360   __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
22361   __Pyx_GIVEREF(__pyx_t_1);
22362   __pyx_t_1 = 0;
22363 
22364   /* "View.MemoryView":316
22365  *
22366  * DEF THREAD_LOCKS_PREALLOCATED = 8
22367  * cdef int __pyx_memoryview_thread_locks_used = 0             # <<<<<<<<<<<<<<
22368  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
22369  *     PyThread_allocate_lock(),
22370  */
22371   __pyx_memoryview_thread_locks_used = 0;
22372 
22373   /* "View.MemoryView":317
22374  * DEF THREAD_LOCKS_PREALLOCATED = 8
22375  * cdef int __pyx_memoryview_thread_locks_used = 0
22376  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [             # <<<<<<<<<<<<<<
22377  *     PyThread_allocate_lock(),
22378  *     PyThread_allocate_lock(),
22379  */
22380   __pyx_t_3[0] = PyThread_allocate_lock();
22381   __pyx_t_3[1] = PyThread_allocate_lock();
22382   __pyx_t_3[2] = PyThread_allocate_lock();
22383   __pyx_t_3[3] = PyThread_allocate_lock();
22384   __pyx_t_3[4] = PyThread_allocate_lock();
22385   __pyx_t_3[5] = PyThread_allocate_lock();
22386   __pyx_t_3[6] = PyThread_allocate_lock();
22387   __pyx_t_3[7] = PyThread_allocate_lock();
22388   memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_3, sizeof(__pyx_memoryview_thread_locks[0]) * (8));
22389 
22390   /* "View.MemoryView":549
22391  *         info.obj = self
22392  *
22393  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
22394  *
22395  *
22396  */
22397   __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 549, __pyx_L1_error)
22398   __Pyx_GOTREF(__pyx_t_1);
22399   if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 549, __pyx_L1_error)
22400   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22401   PyType_Modified(__pyx_memoryview_type);
22402 
22403   /* "View.MemoryView":995
22404  *         return self.from_object
22405  *
22406  *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
22407  *
22408  *
22409  */
22410   __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 995, __pyx_L1_error)
22411   __Pyx_GOTREF(__pyx_t_1);
22412   if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 995, __pyx_L1_error)
22413   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22414   PyType_Modified(__pyx_memoryviewslice_type);
22415 
22416   /* "(tree fragment)":1
22417  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
22418  *     cdef object __pyx_PickleError
22419  *     cdef object __pyx_result
22420  */
22421   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
22422   __Pyx_GOTREF(__pyx_t_1);
22423   if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
22424   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22425 
22426   /* "(tree fragment)":11
22427  *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
22428  *     return __pyx_result
22429  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
22430  *     __pyx_result.name = __pyx_state[0]
22431  *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
22432  */
22433 
22434   /*--- Wrapped vars code ---*/
22435 
22436   goto __pyx_L0;
22437   __pyx_L1_error:;
22438   __Pyx_XDECREF(__pyx_t_1);
22439   __Pyx_XDECREF(__pyx_t_2);
22440   if (__pyx_m) {
22441     if (__pyx_d) {
22442       __Pyx_AddTraceback("init dipy.direction.probabilistic_direction_getter", __pyx_clineno, __pyx_lineno, __pyx_filename);
22443     }
22444     Py_CLEAR(__pyx_m);
22445   } else if (!PyErr_Occurred()) {
22446     PyErr_SetString(PyExc_ImportError, "init dipy.direction.probabilistic_direction_getter");
22447   }
22448   __pyx_L0:;
22449   __Pyx_RefNannyFinishContext();
22450   #if CYTHON_PEP489_MULTI_PHASE_INIT
22451   return (__pyx_m != NULL) ? 0 : -1;
22452   #elif PY_MAJOR_VERSION >= 3
22453   return __pyx_m;
22454   #else
22455   return;
22456   #endif
22457 }
22458 
22459 /* --- Runtime support code --- */
22460 /* Refnanny */
22461 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)22462 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
22463     PyObject *m = NULL, *p = NULL;
22464     void *r = NULL;
22465     m = PyImport_ImportModule(modname);
22466     if (!m) goto end;
22467     p = PyObject_GetAttrString(m, "RefNannyAPI");
22468     if (!p) goto end;
22469     r = PyLong_AsVoidPtr(p);
22470 end:
22471     Py_XDECREF(p);
22472     Py_XDECREF(m);
22473     return (__Pyx_RefNannyAPIStruct *)r;
22474 }
22475 #endif
22476 
22477 /* PyObjectGetAttrStr */
22478 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)22479 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
22480     PyTypeObject* tp = Py_TYPE(obj);
22481     if (likely(tp->tp_getattro))
22482         return tp->tp_getattro(obj, attr_name);
22483 #if PY_MAJOR_VERSION < 3
22484     if (likely(tp->tp_getattr))
22485         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
22486 #endif
22487     return PyObject_GetAttr(obj, attr_name);
22488 }
22489 #endif
22490 
22491 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)22492 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
22493     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
22494     if (unlikely(!result)) {
22495         PyErr_Format(PyExc_NameError,
22496 #if PY_MAJOR_VERSION >= 3
22497             "name '%U' is not defined", name);
22498 #else
22499             "name '%.200s' is not defined", PyString_AS_STRING(name));
22500 #endif
22501     }
22502     return result;
22503 }
22504 
22505 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)22506 static void __Pyx_RaiseArgtupleInvalid(
22507     const char* func_name,
22508     int exact,
22509     Py_ssize_t num_min,
22510     Py_ssize_t num_max,
22511     Py_ssize_t num_found)
22512 {
22513     Py_ssize_t num_expected;
22514     const char *more_or_less;
22515     if (num_found < num_min) {
22516         num_expected = num_min;
22517         more_or_less = "at least";
22518     } else {
22519         num_expected = num_max;
22520         more_or_less = "at most";
22521     }
22522     if (exact) {
22523         more_or_less = "exactly";
22524     }
22525     PyErr_Format(PyExc_TypeError,
22526                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
22527                  func_name, more_or_less, num_expected,
22528                  (num_expected == 1) ? "" : "s", num_found);
22529 }
22530 
22531 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)22532 static void __Pyx_RaiseDoubleKeywordsError(
22533     const char* func_name,
22534     PyObject* kw_name)
22535 {
22536     PyErr_Format(PyExc_TypeError,
22537         #if PY_MAJOR_VERSION >= 3
22538         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
22539         #else
22540         "%s() got multiple values for keyword argument '%s'", func_name,
22541         PyString_AsString(kw_name));
22542         #endif
22543 }
22544 
22545 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)22546 static int __Pyx_ParseOptionalKeywords(
22547     PyObject *kwds,
22548     PyObject **argnames[],
22549     PyObject *kwds2,
22550     PyObject *values[],
22551     Py_ssize_t num_pos_args,
22552     const char* function_name)
22553 {
22554     PyObject *key = 0, *value = 0;
22555     Py_ssize_t pos = 0;
22556     PyObject*** name;
22557     PyObject*** first_kw_arg = argnames + num_pos_args;
22558     while (PyDict_Next(kwds, &pos, &key, &value)) {
22559         name = first_kw_arg;
22560         while (*name && (**name != key)) name++;
22561         if (*name) {
22562             values[name-argnames] = value;
22563             continue;
22564         }
22565         name = first_kw_arg;
22566         #if PY_MAJOR_VERSION < 3
22567         if (likely(PyString_Check(key))) {
22568             while (*name) {
22569                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
22570                         && _PyString_Eq(**name, key)) {
22571                     values[name-argnames] = value;
22572                     break;
22573                 }
22574                 name++;
22575             }
22576             if (*name) continue;
22577             else {
22578                 PyObject*** argname = argnames;
22579                 while (argname != first_kw_arg) {
22580                     if ((**argname == key) || (
22581                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
22582                              && _PyString_Eq(**argname, key))) {
22583                         goto arg_passed_twice;
22584                     }
22585                     argname++;
22586                 }
22587             }
22588         } else
22589         #endif
22590         if (likely(PyUnicode_Check(key))) {
22591             while (*name) {
22592                 int cmp = (**name == key) ? 0 :
22593                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
22594                     (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
22595                 #endif
22596                     PyUnicode_Compare(**name, key);
22597                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
22598                 if (cmp == 0) {
22599                     values[name-argnames] = value;
22600                     break;
22601                 }
22602                 name++;
22603             }
22604             if (*name) continue;
22605             else {
22606                 PyObject*** argname = argnames;
22607                 while (argname != first_kw_arg) {
22608                     int cmp = (**argname == key) ? 0 :
22609                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
22610                         (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
22611                     #endif
22612                         PyUnicode_Compare(**argname, key);
22613                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
22614                     if (cmp == 0) goto arg_passed_twice;
22615                     argname++;
22616                 }
22617             }
22618         } else
22619             goto invalid_keyword_type;
22620         if (kwds2) {
22621             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
22622         } else {
22623             goto invalid_keyword;
22624         }
22625     }
22626     return 0;
22627 arg_passed_twice:
22628     __Pyx_RaiseDoubleKeywordsError(function_name, key);
22629     goto bad;
22630 invalid_keyword_type:
22631     PyErr_Format(PyExc_TypeError,
22632         "%.200s() keywords must be strings", function_name);
22633     goto bad;
22634 invalid_keyword:
22635     PyErr_Format(PyExc_TypeError,
22636     #if PY_MAJOR_VERSION < 3
22637         "%.200s() got an unexpected keyword argument '%.200s'",
22638         function_name, PyString_AsString(key));
22639     #else
22640         "%s() got an unexpected keyword argument '%U'",
22641         function_name, key);
22642     #endif
22643 bad:
22644     return -1;
22645 }
22646 
22647 /* PyObjectCall */
22648 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)22649 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
22650     PyObject *result;
22651     ternaryfunc call = func->ob_type->tp_call;
22652     if (unlikely(!call))
22653         return PyObject_Call(func, arg, kw);
22654     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
22655         return NULL;
22656     result = (*call)(func, arg, kw);
22657     Py_LeaveRecursiveCall();
22658     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
22659         PyErr_SetString(
22660             PyExc_SystemError,
22661             "NULL result without error in PyObject_Call");
22662     }
22663     return result;
22664 }
22665 #endif
22666 
22667 /* PyFunctionFastCall */
22668 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)22669 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
22670                                                PyObject *globals) {
22671     PyFrameObject *f;
22672     PyThreadState *tstate = __Pyx_PyThreadState_Current;
22673     PyObject **fastlocals;
22674     Py_ssize_t i;
22675     PyObject *result;
22676     assert(globals != NULL);
22677     /* XXX Perhaps we should create a specialized
22678        PyFrame_New() that doesn't take locals, but does
22679        take builtins without sanity checking them.
22680        */
22681     assert(tstate != NULL);
22682     f = PyFrame_New(tstate, co, globals, NULL);
22683     if (f == NULL) {
22684         return NULL;
22685     }
22686     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
22687     for (i = 0; i < na; i++) {
22688         Py_INCREF(*args);
22689         fastlocals[i] = *args++;
22690     }
22691     result = PyEval_EvalFrameEx(f,0);
22692     ++tstate->recursion_depth;
22693     Py_DECREF(f);
22694     --tstate->recursion_depth;
22695     return result;
22696 }
22697 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)22698 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
22699     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
22700     PyObject *globals = PyFunction_GET_GLOBALS(func);
22701     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
22702     PyObject *closure;
22703 #if PY_MAJOR_VERSION >= 3
22704     PyObject *kwdefs;
22705 #endif
22706     PyObject *kwtuple, **k;
22707     PyObject **d;
22708     Py_ssize_t nd;
22709     Py_ssize_t nk;
22710     PyObject *result;
22711     assert(kwargs == NULL || PyDict_Check(kwargs));
22712     nk = kwargs ? PyDict_Size(kwargs) : 0;
22713     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
22714         return NULL;
22715     }
22716     if (
22717 #if PY_MAJOR_VERSION >= 3
22718             co->co_kwonlyargcount == 0 &&
22719 #endif
22720             likely(kwargs == NULL || nk == 0) &&
22721             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
22722         if (argdefs == NULL && co->co_argcount == nargs) {
22723             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
22724             goto done;
22725         }
22726         else if (nargs == 0 && argdefs != NULL
22727                  && co->co_argcount == Py_SIZE(argdefs)) {
22728             /* function called with no arguments, but all parameters have
22729                a default value: use default values as arguments .*/
22730             args = &PyTuple_GET_ITEM(argdefs, 0);
22731             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
22732             goto done;
22733         }
22734     }
22735     if (kwargs != NULL) {
22736         Py_ssize_t pos, i;
22737         kwtuple = PyTuple_New(2 * nk);
22738         if (kwtuple == NULL) {
22739             result = NULL;
22740             goto done;
22741         }
22742         k = &PyTuple_GET_ITEM(kwtuple, 0);
22743         pos = i = 0;
22744         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
22745             Py_INCREF(k[i]);
22746             Py_INCREF(k[i+1]);
22747             i += 2;
22748         }
22749         nk = i / 2;
22750     }
22751     else {
22752         kwtuple = NULL;
22753         k = NULL;
22754     }
22755     closure = PyFunction_GET_CLOSURE(func);
22756 #if PY_MAJOR_VERSION >= 3
22757     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
22758 #endif
22759     if (argdefs != NULL) {
22760         d = &PyTuple_GET_ITEM(argdefs, 0);
22761         nd = Py_SIZE(argdefs);
22762     }
22763     else {
22764         d = NULL;
22765         nd = 0;
22766     }
22767 #if PY_MAJOR_VERSION >= 3
22768     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
22769                                args, (int)nargs,
22770                                k, (int)nk,
22771                                d, (int)nd, kwdefs, closure);
22772 #else
22773     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
22774                                args, (int)nargs,
22775                                k, (int)nk,
22776                                d, (int)nd, closure);
22777 #endif
22778     Py_XDECREF(kwtuple);
22779 done:
22780     Py_LeaveRecursiveCall();
22781     return result;
22782 }
22783 #endif
22784 #endif
22785 
22786 /* PyObjectCallMethO */
22787 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)22788 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
22789     PyObject *self, *result;
22790     PyCFunction cfunc;
22791     cfunc = PyCFunction_GET_FUNCTION(func);
22792     self = PyCFunction_GET_SELF(func);
22793     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
22794         return NULL;
22795     result = cfunc(self, arg);
22796     Py_LeaveRecursiveCall();
22797     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
22798         PyErr_SetString(
22799             PyExc_SystemError,
22800             "NULL result without error in PyObject_Call");
22801     }
22802     return result;
22803 }
22804 #endif
22805 
22806 /* PyObjectCallNoArg */
22807 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallNoArg(PyObject * func)22808 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
22809 #if CYTHON_FAST_PYCALL
22810     if (PyFunction_Check(func)) {
22811         return __Pyx_PyFunction_FastCall(func, NULL, 0);
22812     }
22813 #endif
22814 #ifdef __Pyx_CyFunction_USED
22815     if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
22816 #else
22817     if (likely(PyCFunction_Check(func)))
22818 #endif
22819     {
22820         if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
22821             return __Pyx_PyObject_CallMethO(func, NULL);
22822         }
22823     }
22824     return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
22825 }
22826 #endif
22827 
22828 /* PyCFunctionFastCall */
22829 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)22830 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
22831     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
22832     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
22833     PyObject *self = PyCFunction_GET_SELF(func);
22834     int flags = PyCFunction_GET_FLAGS(func);
22835     assert(PyCFunction_Check(func));
22836     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
22837     assert(nargs >= 0);
22838     assert(nargs == 0 || args != NULL);
22839     /* _PyCFunction_FastCallDict() must not be called with an exception set,
22840        because it may clear it (directly or indirectly) and so the
22841        caller loses its exception */
22842     assert(!PyErr_Occurred());
22843     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
22844         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
22845     } else {
22846         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
22847     }
22848 }
22849 #endif
22850 
22851 /* PyObjectCallOneArg */
22852 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)22853 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
22854     PyObject *result;
22855     PyObject *args = PyTuple_New(1);
22856     if (unlikely(!args)) return NULL;
22857     Py_INCREF(arg);
22858     PyTuple_SET_ITEM(args, 0, arg);
22859     result = __Pyx_PyObject_Call(func, args, NULL);
22860     Py_DECREF(args);
22861     return result;
22862 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)22863 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
22864 #if CYTHON_FAST_PYCALL
22865     if (PyFunction_Check(func)) {
22866         return __Pyx_PyFunction_FastCall(func, &arg, 1);
22867     }
22868 #endif
22869     if (likely(PyCFunction_Check(func))) {
22870         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
22871             return __Pyx_PyObject_CallMethO(func, arg);
22872 #if CYTHON_FAST_PYCCALL
22873         } else if (__Pyx_PyFastCFunction_Check(func)) {
22874             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
22875 #endif
22876         }
22877     }
22878     return __Pyx__PyObject_CallOneArg(func, arg);
22879 }
22880 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)22881 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
22882     PyObject *result;
22883     PyObject *args = PyTuple_Pack(1, arg);
22884     if (unlikely(!args)) return NULL;
22885     result = __Pyx_PyObject_Call(func, args, NULL);
22886     Py_DECREF(args);
22887     return result;
22888 }
22889 #endif
22890 
22891 /* MemviewSliceInit */
22892 static int
__Pyx_init_memviewslice(struct __pyx_memoryview_obj * memview,int ndim,__Pyx_memviewslice * memviewslice,int memview_is_new_reference)22893 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
22894                         int ndim,
22895                         __Pyx_memviewslice *memviewslice,
22896                         int memview_is_new_reference)
22897 {
22898     __Pyx_RefNannyDeclarations
22899     int i, retval=-1;
22900     Py_buffer *buf = &memview->view;
22901     __Pyx_RefNannySetupContext("init_memviewslice", 0);
22902     if (unlikely(memviewslice->memview || memviewslice->data)) {
22903         PyErr_SetString(PyExc_ValueError,
22904             "memviewslice is already initialized!");
22905         goto fail;
22906     }
22907     if (buf->strides) {
22908         for (i = 0; i < ndim; i++) {
22909             memviewslice->strides[i] = buf->strides[i];
22910         }
22911     } else {
22912         Py_ssize_t stride = buf->itemsize;
22913         for (i = ndim - 1; i >= 0; i--) {
22914             memviewslice->strides[i] = stride;
22915             stride *= buf->shape[i];
22916         }
22917     }
22918     for (i = 0; i < ndim; i++) {
22919         memviewslice->shape[i]   = buf->shape[i];
22920         if (buf->suboffsets) {
22921             memviewslice->suboffsets[i] = buf->suboffsets[i];
22922         } else {
22923             memviewslice->suboffsets[i] = -1;
22924         }
22925     }
22926     memviewslice->memview = memview;
22927     memviewslice->data = (char *)buf->buf;
22928     if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
22929         Py_INCREF(memview);
22930     }
22931     retval = 0;
22932     goto no_fail;
22933 fail:
22934     memviewslice->memview = 0;
22935     memviewslice->data = 0;
22936     retval = -1;
22937 no_fail:
22938     __Pyx_RefNannyFinishContext();
22939     return retval;
22940 }
22941 #ifndef Py_NO_RETURN
22942 #define Py_NO_RETURN
22943 #endif
__pyx_fatalerror(const char * fmt,...)22944 static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
22945     va_list vargs;
22946     char msg[200];
22947 #ifdef HAVE_STDARG_PROTOTYPES
22948     va_start(vargs, fmt);
22949 #else
22950     va_start(vargs);
22951 #endif
22952     vsnprintf(msg, 200, fmt, vargs);
22953     va_end(vargs);
22954     Py_FatalError(msg);
22955 }
22956 static CYTHON_INLINE int
__pyx_add_acquisition_count_locked(__pyx_atomic_int * acquisition_count,PyThread_type_lock lock)22957 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
22958                                    PyThread_type_lock lock)
22959 {
22960     int result;
22961     PyThread_acquire_lock(lock, 1);
22962     result = (*acquisition_count)++;
22963     PyThread_release_lock(lock);
22964     return result;
22965 }
22966 static CYTHON_INLINE int
__pyx_sub_acquisition_count_locked(__pyx_atomic_int * acquisition_count,PyThread_type_lock lock)22967 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
22968                                    PyThread_type_lock lock)
22969 {
22970     int result;
22971     PyThread_acquire_lock(lock, 1);
22972     result = (*acquisition_count)--;
22973     PyThread_release_lock(lock);
22974     return result;
22975 }
22976 static CYTHON_INLINE void
__Pyx_INC_MEMVIEW(__Pyx_memviewslice * memslice,int have_gil,int lineno)22977 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
22978 {
22979     int first_time;
22980     struct __pyx_memoryview_obj *memview = memslice->memview;
22981     if (unlikely(!memview || (PyObject *) memview == Py_None))
22982         return;
22983     if (unlikely(__pyx_get_slice_count(memview) < 0))
22984         __pyx_fatalerror("Acquisition count is %d (line %d)",
22985                          __pyx_get_slice_count(memview), lineno);
22986     first_time = __pyx_add_acquisition_count(memview) == 0;
22987     if (unlikely(first_time)) {
22988         if (have_gil) {
22989             Py_INCREF((PyObject *) memview);
22990         } else {
22991             PyGILState_STATE _gilstate = PyGILState_Ensure();
22992             Py_INCREF((PyObject *) memview);
22993             PyGILState_Release(_gilstate);
22994         }
22995     }
22996 }
__Pyx_XDEC_MEMVIEW(__Pyx_memviewslice * memslice,int have_gil,int lineno)22997 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
22998                                              int have_gil, int lineno) {
22999     int last_time;
23000     struct __pyx_memoryview_obj *memview = memslice->memview;
23001     if (unlikely(!memview || (PyObject *) memview == Py_None)) {
23002         memslice->memview = NULL;
23003         return;
23004     }
23005     if (unlikely(__pyx_get_slice_count(memview) <= 0))
23006         __pyx_fatalerror("Acquisition count is %d (line %d)",
23007                          __pyx_get_slice_count(memview), lineno);
23008     last_time = __pyx_sub_acquisition_count(memview) == 1;
23009     memslice->data = NULL;
23010     if (unlikely(last_time)) {
23011         if (have_gil) {
23012             Py_CLEAR(memslice->memview);
23013         } else {
23014             PyGILState_STATE _gilstate = PyGILState_Ensure();
23015             Py_CLEAR(memslice->memview);
23016             PyGILState_Release(_gilstate);
23017         }
23018     } else {
23019         memslice->memview = NULL;
23020     }
23021 }
23022 
23023 /* PyDictVersioning */
23024 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)23025 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
23026     PyObject *dict = Py_TYPE(obj)->tp_dict;
23027     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
23028 }
__Pyx_get_object_dict_version(PyObject * obj)23029 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
23030     PyObject **dictptr = NULL;
23031     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
23032     if (offset) {
23033 #if CYTHON_COMPILING_IN_CPYTHON
23034         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
23035 #else
23036         dictptr = _PyObject_GetDictPtr(obj);
23037 #endif
23038     }
23039     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
23040 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)23041 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
23042     PyObject *dict = Py_TYPE(obj)->tp_dict;
23043     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
23044         return 0;
23045     return obj_dict_version == __Pyx_get_object_dict_version(obj);
23046 }
23047 #endif
23048 
23049 /* GetModuleGlobalName */
23050 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)23051 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
23052 #else
23053 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
23054 #endif
23055 {
23056     PyObject *result;
23057 #if !CYTHON_AVOID_BORROWED_REFS
23058 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
23059     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
23060     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
23061     if (likely(result)) {
23062         return __Pyx_NewRef(result);
23063     } else if (unlikely(PyErr_Occurred())) {
23064         return NULL;
23065     }
23066 #else
23067     result = PyDict_GetItem(__pyx_d, name);
23068     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
23069     if (likely(result)) {
23070         return __Pyx_NewRef(result);
23071     }
23072 #endif
23073 #else
23074     result = PyObject_GetItem(__pyx_d, name);
23075     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
23076     if (likely(result)) {
23077         return __Pyx_NewRef(result);
23078     }
23079     PyErr_Clear();
23080 #endif
23081     return __Pyx_GetBuiltinName(name);
23082 }
23083 
23084 /* py_abs */
23085 #if CYTHON_USE_PYLONG_INTERNALS
__Pyx_PyLong_AbsNeg(PyObject * n)23086 static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
23087     if (likely(Py_SIZE(n) == -1)) {
23088         return PyLong_FromLong(((PyLongObject*)n)->ob_digit[0]);
23089     }
23090 #if CYTHON_COMPILING_IN_CPYTHON
23091     {
23092         PyObject *copy = _PyLong_Copy((PyLongObject*)n);
23093         if (likely(copy)) {
23094             __Pyx_SET_SIZE(copy, -Py_SIZE(copy));
23095         }
23096         return copy;
23097     }
23098 #else
23099     return PyNumber_Negative(n);
23100 #endif
23101 }
23102 #endif
23103 
23104 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)23105 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
23106     PyObject *args, *result = NULL;
23107     #if CYTHON_FAST_PYCALL
23108     if (PyFunction_Check(function)) {
23109         PyObject *args[2] = {arg1, arg2};
23110         return __Pyx_PyFunction_FastCall(function, args, 2);
23111     }
23112     #endif
23113     #if CYTHON_FAST_PYCCALL
23114     if (__Pyx_PyFastCFunction_Check(function)) {
23115         PyObject *args[2] = {arg1, arg2};
23116         return __Pyx_PyCFunction_FastCall(function, args, 2);
23117     }
23118     #endif
23119     args = PyTuple_New(2);
23120     if (unlikely(!args)) goto done;
23121     Py_INCREF(arg1);
23122     PyTuple_SET_ITEM(args, 0, arg1);
23123     Py_INCREF(arg2);
23124     PyTuple_SET_ITEM(args, 1, arg2);
23125     Py_INCREF(function);
23126     result = __Pyx_PyObject_Call(function, args, NULL);
23127     Py_DECREF(args);
23128     Py_DECREF(function);
23129 done:
23130     return result;
23131 }
23132 
23133 /* UnpackUnboundCMethod */
__Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction * target)23134 static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
23135     PyObject *method;
23136     method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
23137     if (unlikely(!method))
23138         return -1;
23139     target->method = method;
23140 #if CYTHON_COMPILING_IN_CPYTHON
23141     #if PY_MAJOR_VERSION >= 3
23142     if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
23143     #endif
23144     {
23145         PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
23146         target->func = descr->d_method->ml_meth;
23147         target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
23148     }
23149 #endif
23150     return 0;
23151 }
23152 
23153 /* CallUnboundCMethod1 */
23154 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction * cfunc,PyObject * self,PyObject * arg)23155 static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
23156     if (likely(cfunc->func)) {
23157         int flag = cfunc->flag;
23158         if (flag == METH_O) {
23159             return (*(cfunc->func))(self, arg);
23160         } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) {
23161             if (PY_VERSION_HEX >= 0x030700A0) {
23162                 return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1);
23163             } else {
23164                 return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
23165             }
23166         } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
23167             return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
23168         }
23169     }
23170     return __Pyx__CallUnboundCMethod1(cfunc, self, arg);
23171 }
23172 #endif
__Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction * cfunc,PyObject * self,PyObject * arg)23173 static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
23174     PyObject *args, *result = NULL;
23175     if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
23176 #if CYTHON_COMPILING_IN_CPYTHON
23177     if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
23178         args = PyTuple_New(1);
23179         if (unlikely(!args)) goto bad;
23180         Py_INCREF(arg);
23181         PyTuple_SET_ITEM(args, 0, arg);
23182         if (cfunc->flag & METH_KEYWORDS)
23183             result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
23184         else
23185             result = (*cfunc->func)(self, args);
23186     } else {
23187         args = PyTuple_New(2);
23188         if (unlikely(!args)) goto bad;
23189         Py_INCREF(self);
23190         PyTuple_SET_ITEM(args, 0, self);
23191         Py_INCREF(arg);
23192         PyTuple_SET_ITEM(args, 1, arg);
23193         result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
23194     }
23195 #else
23196     args = PyTuple_Pack(2, self, arg);
23197     if (unlikely(!args)) goto bad;
23198     result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
23199 #endif
23200 bad:
23201     Py_XDECREF(args);
23202     return result;
23203 }
23204 
23205 /* DictGetItem */
23206 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
__Pyx_PyDict_GetItem(PyObject * d,PyObject * key)23207 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
23208     PyObject *value;
23209     value = PyDict_GetItemWithError(d, key);
23210     if (unlikely(!value)) {
23211         if (!PyErr_Occurred()) {
23212             if (unlikely(PyTuple_Check(key))) {
23213                 PyObject* args = PyTuple_Pack(1, key);
23214                 if (likely(args)) {
23215                     PyErr_SetObject(PyExc_KeyError, args);
23216                     Py_DECREF(args);
23217                 }
23218             } else {
23219                 PyErr_SetObject(PyExc_KeyError, key);
23220             }
23221         }
23222         return NULL;
23223     }
23224     Py_INCREF(value);
23225     return value;
23226 }
23227 #endif
23228 
23229 /* PyErrFetchRestore */
23230 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)23231 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
23232     PyObject *tmp_type, *tmp_value, *tmp_tb;
23233     tmp_type = tstate->curexc_type;
23234     tmp_value = tstate->curexc_value;
23235     tmp_tb = tstate->curexc_traceback;
23236     tstate->curexc_type = type;
23237     tstate->curexc_value = value;
23238     tstate->curexc_traceback = tb;
23239     Py_XDECREF(tmp_type);
23240     Py_XDECREF(tmp_value);
23241     Py_XDECREF(tmp_tb);
23242 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)23243 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
23244     *type = tstate->curexc_type;
23245     *value = tstate->curexc_value;
23246     *tb = tstate->curexc_traceback;
23247     tstate->curexc_type = 0;
23248     tstate->curexc_value = 0;
23249     tstate->curexc_traceback = 0;
23250 }
23251 #endif
23252 
23253 /* WriteUnraisableException */
__Pyx_WriteUnraisable(const char * name,CYTHON_UNUSED int clineno,CYTHON_UNUSED int lineno,CYTHON_UNUSED const char * filename,int full_traceback,CYTHON_UNUSED int nogil)23254 static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
23255                                   CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
23256                                   int full_traceback, CYTHON_UNUSED int nogil) {
23257     PyObject *old_exc, *old_val, *old_tb;
23258     PyObject *ctx;
23259     __Pyx_PyThreadState_declare
23260 #ifdef WITH_THREAD
23261     PyGILState_STATE state;
23262     if (nogil)
23263         state = PyGILState_Ensure();
23264 #ifdef _MSC_VER
23265     else state = (PyGILState_STATE)-1;
23266 #endif
23267 #endif
23268     __Pyx_PyThreadState_assign
23269     __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
23270     if (full_traceback) {
23271         Py_XINCREF(old_exc);
23272         Py_XINCREF(old_val);
23273         Py_XINCREF(old_tb);
23274         __Pyx_ErrRestore(old_exc, old_val, old_tb);
23275         PyErr_PrintEx(1);
23276     }
23277     #if PY_MAJOR_VERSION < 3
23278     ctx = PyString_FromString(name);
23279     #else
23280     ctx = PyUnicode_FromString(name);
23281     #endif
23282     __Pyx_ErrRestore(old_exc, old_val, old_tb);
23283     if (!ctx) {
23284         PyErr_WriteUnraisable(Py_None);
23285     } else {
23286         PyErr_WriteUnraisable(ctx);
23287         Py_DECREF(ctx);
23288     }
23289 #ifdef WITH_THREAD
23290     if (nogil)
23291         PyGILState_Release(state);
23292 #endif
23293 }
23294 
23295 /* PyErrExceptionMatches */
23296 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)23297 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
23298     Py_ssize_t i, n;
23299     n = PyTuple_GET_SIZE(tuple);
23300 #if PY_MAJOR_VERSION >= 3
23301     for (i=0; i<n; i++) {
23302         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
23303     }
23304 #endif
23305     for (i=0; i<n; i++) {
23306         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
23307     }
23308     return 0;
23309 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)23310 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
23311     PyObject *exc_type = tstate->curexc_type;
23312     if (exc_type == err) return 1;
23313     if (unlikely(!exc_type)) return 0;
23314     if (unlikely(PyTuple_Check(err)))
23315         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
23316     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
23317 }
23318 #endif
23319 
23320 /* GetAttr */
__Pyx_GetAttr(PyObject * o,PyObject * n)23321 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
23322 #if CYTHON_USE_TYPE_SLOTS
23323 #if PY_MAJOR_VERSION >= 3
23324     if (likely(PyUnicode_Check(n)))
23325 #else
23326     if (likely(PyString_Check(n)))
23327 #endif
23328         return __Pyx_PyObject_GetAttrStr(o, n);
23329 #endif
23330     return PyObject_GetAttr(o, n);
23331 }
23332 
23333 /* GetAttr3 */
__Pyx_GetAttr3Default(PyObject * d)23334 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
23335     __Pyx_PyThreadState_declare
23336     __Pyx_PyThreadState_assign
23337     if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
23338         return NULL;
23339     __Pyx_PyErr_Clear();
23340     Py_INCREF(d);
23341     return d;
23342 }
__Pyx_GetAttr3(PyObject * o,PyObject * n,PyObject * d)23343 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
23344     PyObject *r = __Pyx_GetAttr(o, n);
23345     return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
23346 }
23347 
23348 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)23349 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
23350     PyObject *empty_list = 0;
23351     PyObject *module = 0;
23352     PyObject *global_dict = 0;
23353     PyObject *empty_dict = 0;
23354     PyObject *list;
23355     #if PY_MAJOR_VERSION < 3
23356     PyObject *py_import;
23357     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
23358     if (!py_import)
23359         goto bad;
23360     #endif
23361     if (from_list)
23362         list = from_list;
23363     else {
23364         empty_list = PyList_New(0);
23365         if (!empty_list)
23366             goto bad;
23367         list = empty_list;
23368     }
23369     global_dict = PyModule_GetDict(__pyx_m);
23370     if (!global_dict)
23371         goto bad;
23372     empty_dict = PyDict_New();
23373     if (!empty_dict)
23374         goto bad;
23375     {
23376         #if PY_MAJOR_VERSION >= 3
23377         if (level == -1) {
23378             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
23379                 module = PyImport_ImportModuleLevelObject(
23380                     name, global_dict, empty_dict, list, 1);
23381                 if (!module) {
23382                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
23383                         goto bad;
23384                     PyErr_Clear();
23385                 }
23386             }
23387             level = 0;
23388         }
23389         #endif
23390         if (!module) {
23391             #if PY_MAJOR_VERSION < 3
23392             PyObject *py_level = PyInt_FromLong(level);
23393             if (!py_level)
23394                 goto bad;
23395             module = PyObject_CallFunctionObjArgs(py_import,
23396                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
23397             Py_DECREF(py_level);
23398             #else
23399             module = PyImport_ImportModuleLevelObject(
23400                 name, global_dict, empty_dict, list, level);
23401             #endif
23402         }
23403     }
23404 bad:
23405     #if PY_MAJOR_VERSION < 3
23406     Py_XDECREF(py_import);
23407     #endif
23408     Py_XDECREF(empty_list);
23409     Py_XDECREF(empty_dict);
23410     return module;
23411 }
23412 
23413 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)23414 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
23415     PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
23416     if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
23417         PyErr_Format(PyExc_ImportError,
23418         #if PY_MAJOR_VERSION < 3
23419             "cannot import name %.230s", PyString_AS_STRING(name));
23420         #else
23421             "cannot import name %S", name);
23422         #endif
23423     }
23424     return value;
23425 }
23426 
23427 /* RaiseException */
23428 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)23429 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
23430                         CYTHON_UNUSED PyObject *cause) {
23431     __Pyx_PyThreadState_declare
23432     Py_XINCREF(type);
23433     if (!value || value == Py_None)
23434         value = NULL;
23435     else
23436         Py_INCREF(value);
23437     if (!tb || tb == Py_None)
23438         tb = NULL;
23439     else {
23440         Py_INCREF(tb);
23441         if (!PyTraceBack_Check(tb)) {
23442             PyErr_SetString(PyExc_TypeError,
23443                 "raise: arg 3 must be a traceback or None");
23444             goto raise_error;
23445         }
23446     }
23447     if (PyType_Check(type)) {
23448 #if CYTHON_COMPILING_IN_PYPY
23449         if (!value) {
23450             Py_INCREF(Py_None);
23451             value = Py_None;
23452         }
23453 #endif
23454         PyErr_NormalizeException(&type, &value, &tb);
23455     } else {
23456         if (value) {
23457             PyErr_SetString(PyExc_TypeError,
23458                 "instance exception may not have a separate value");
23459             goto raise_error;
23460         }
23461         value = type;
23462         type = (PyObject*) Py_TYPE(type);
23463         Py_INCREF(type);
23464         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
23465             PyErr_SetString(PyExc_TypeError,
23466                 "raise: exception class must be a subclass of BaseException");
23467             goto raise_error;
23468         }
23469     }
23470     __Pyx_PyThreadState_assign
23471     __Pyx_ErrRestore(type, value, tb);
23472     return;
23473 raise_error:
23474     Py_XDECREF(value);
23475     Py_XDECREF(type);
23476     Py_XDECREF(tb);
23477     return;
23478 }
23479 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)23480 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
23481     PyObject* owned_instance = NULL;
23482     if (tb == Py_None) {
23483         tb = 0;
23484     } else if (tb && !PyTraceBack_Check(tb)) {
23485         PyErr_SetString(PyExc_TypeError,
23486             "raise: arg 3 must be a traceback or None");
23487         goto bad;
23488     }
23489     if (value == Py_None)
23490         value = 0;
23491     if (PyExceptionInstance_Check(type)) {
23492         if (value) {
23493             PyErr_SetString(PyExc_TypeError,
23494                 "instance exception may not have a separate value");
23495             goto bad;
23496         }
23497         value = type;
23498         type = (PyObject*) Py_TYPE(value);
23499     } else if (PyExceptionClass_Check(type)) {
23500         PyObject *instance_class = NULL;
23501         if (value && PyExceptionInstance_Check(value)) {
23502             instance_class = (PyObject*) Py_TYPE(value);
23503             if (instance_class != type) {
23504                 int is_subclass = PyObject_IsSubclass(instance_class, type);
23505                 if (!is_subclass) {
23506                     instance_class = NULL;
23507                 } else if (unlikely(is_subclass == -1)) {
23508                     goto bad;
23509                 } else {
23510                     type = instance_class;
23511                 }
23512             }
23513         }
23514         if (!instance_class) {
23515             PyObject *args;
23516             if (!value)
23517                 args = PyTuple_New(0);
23518             else if (PyTuple_Check(value)) {
23519                 Py_INCREF(value);
23520                 args = value;
23521             } else
23522                 args = PyTuple_Pack(1, value);
23523             if (!args)
23524                 goto bad;
23525             owned_instance = PyObject_Call(type, args, NULL);
23526             Py_DECREF(args);
23527             if (!owned_instance)
23528                 goto bad;
23529             value = owned_instance;
23530             if (!PyExceptionInstance_Check(value)) {
23531                 PyErr_Format(PyExc_TypeError,
23532                              "calling %R should have returned an instance of "
23533                              "BaseException, not %R",
23534                              type, Py_TYPE(value));
23535                 goto bad;
23536             }
23537         }
23538     } else {
23539         PyErr_SetString(PyExc_TypeError,
23540             "raise: exception class must be a subclass of BaseException");
23541         goto bad;
23542     }
23543     if (cause) {
23544         PyObject *fixed_cause;
23545         if (cause == Py_None) {
23546             fixed_cause = NULL;
23547         } else if (PyExceptionClass_Check(cause)) {
23548             fixed_cause = PyObject_CallObject(cause, NULL);
23549             if (fixed_cause == NULL)
23550                 goto bad;
23551         } else if (PyExceptionInstance_Check(cause)) {
23552             fixed_cause = cause;
23553             Py_INCREF(fixed_cause);
23554         } else {
23555             PyErr_SetString(PyExc_TypeError,
23556                             "exception causes must derive from "
23557                             "BaseException");
23558             goto bad;
23559         }
23560         PyException_SetCause(value, fixed_cause);
23561     }
23562     PyErr_SetObject(type, value);
23563     if (tb) {
23564 #if CYTHON_COMPILING_IN_PYPY
23565         PyObject *tmp_type, *tmp_value, *tmp_tb;
23566         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
23567         Py_INCREF(tb);
23568         PyErr_Restore(tmp_type, tmp_value, tb);
23569         Py_XDECREF(tmp_tb);
23570 #else
23571         PyThreadState *tstate = __Pyx_PyThreadState_Current;
23572         PyObject* tmp_tb = tstate->curexc_traceback;
23573         if (tb != tmp_tb) {
23574             Py_INCREF(tb);
23575             tstate->curexc_traceback = tb;
23576             Py_XDECREF(tmp_tb);
23577         }
23578 #endif
23579     }
23580 bad:
23581     Py_XDECREF(owned_instance);
23582     return;
23583 }
23584 #endif
23585 
23586 /* ExtTypeTest */
__Pyx_TypeTest(PyObject * obj,PyTypeObject * type)23587 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
23588     if (unlikely(!type)) {
23589         PyErr_SetString(PyExc_SystemError, "Missing type object");
23590         return 0;
23591     }
23592     if (likely(__Pyx_TypeCheck(obj, type)))
23593         return 1;
23594     PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
23595                  Py_TYPE(obj)->tp_name, type->tp_name);
23596     return 0;
23597 }
23598 
23599 /* HasAttr */
__Pyx_HasAttr(PyObject * o,PyObject * n)23600 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
23601     PyObject *r;
23602     if (unlikely(!__Pyx_PyBaseString_Check(n))) {
23603         PyErr_SetString(PyExc_TypeError,
23604                         "hasattr(): attribute name must be string");
23605         return -1;
23606     }
23607     r = __Pyx_GetAttr(o, n);
23608     if (unlikely(!r)) {
23609         PyErr_Clear();
23610         return 0;
23611     } else {
23612         Py_DECREF(r);
23613         return 1;
23614     }
23615 }
23616 
23617 /* GetTopmostException */
23618 #if CYTHON_USE_EXC_INFO_STACK
23619 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)23620 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
23621 {
23622     _PyErr_StackItem *exc_info = tstate->exc_info;
23623     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
23624            exc_info->previous_item != NULL)
23625     {
23626         exc_info = exc_info->previous_item;
23627     }
23628     return exc_info;
23629 }
23630 #endif
23631 
23632 /* SaveResetException */
23633 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)23634 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
23635     #if CYTHON_USE_EXC_INFO_STACK
23636     _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
23637     *type = exc_info->exc_type;
23638     *value = exc_info->exc_value;
23639     *tb = exc_info->exc_traceback;
23640     #else
23641     *type = tstate->exc_type;
23642     *value = tstate->exc_value;
23643     *tb = tstate->exc_traceback;
23644     #endif
23645     Py_XINCREF(*type);
23646     Py_XINCREF(*value);
23647     Py_XINCREF(*tb);
23648 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)23649 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
23650     PyObject *tmp_type, *tmp_value, *tmp_tb;
23651     #if CYTHON_USE_EXC_INFO_STACK
23652     _PyErr_StackItem *exc_info = tstate->exc_info;
23653     tmp_type = exc_info->exc_type;
23654     tmp_value = exc_info->exc_value;
23655     tmp_tb = exc_info->exc_traceback;
23656     exc_info->exc_type = type;
23657     exc_info->exc_value = value;
23658     exc_info->exc_traceback = tb;
23659     #else
23660     tmp_type = tstate->exc_type;
23661     tmp_value = tstate->exc_value;
23662     tmp_tb = tstate->exc_traceback;
23663     tstate->exc_type = type;
23664     tstate->exc_value = value;
23665     tstate->exc_traceback = tb;
23666     #endif
23667     Py_XDECREF(tmp_type);
23668     Py_XDECREF(tmp_value);
23669     Py_XDECREF(tmp_tb);
23670 }
23671 #endif
23672 
23673 /* GetException */
23674 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)23675 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
23676 #else
23677 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
23678 #endif
23679 {
23680     PyObject *local_type, *local_value, *local_tb;
23681 #if CYTHON_FAST_THREAD_STATE
23682     PyObject *tmp_type, *tmp_value, *tmp_tb;
23683     local_type = tstate->curexc_type;
23684     local_value = tstate->curexc_value;
23685     local_tb = tstate->curexc_traceback;
23686     tstate->curexc_type = 0;
23687     tstate->curexc_value = 0;
23688     tstate->curexc_traceback = 0;
23689 #else
23690     PyErr_Fetch(&local_type, &local_value, &local_tb);
23691 #endif
23692     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
23693 #if CYTHON_FAST_THREAD_STATE
23694     if (unlikely(tstate->curexc_type))
23695 #else
23696     if (unlikely(PyErr_Occurred()))
23697 #endif
23698         goto bad;
23699     #if PY_MAJOR_VERSION >= 3
23700     if (local_tb) {
23701         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
23702             goto bad;
23703     }
23704     #endif
23705     Py_XINCREF(local_tb);
23706     Py_XINCREF(local_type);
23707     Py_XINCREF(local_value);
23708     *type = local_type;
23709     *value = local_value;
23710     *tb = local_tb;
23711 #if CYTHON_FAST_THREAD_STATE
23712     #if CYTHON_USE_EXC_INFO_STACK
23713     {
23714         _PyErr_StackItem *exc_info = tstate->exc_info;
23715         tmp_type = exc_info->exc_type;
23716         tmp_value = exc_info->exc_value;
23717         tmp_tb = exc_info->exc_traceback;
23718         exc_info->exc_type = local_type;
23719         exc_info->exc_value = local_value;
23720         exc_info->exc_traceback = local_tb;
23721     }
23722     #else
23723     tmp_type = tstate->exc_type;
23724     tmp_value = tstate->exc_value;
23725     tmp_tb = tstate->exc_traceback;
23726     tstate->exc_type = local_type;
23727     tstate->exc_value = local_value;
23728     tstate->exc_traceback = local_tb;
23729     #endif
23730     Py_XDECREF(tmp_type);
23731     Py_XDECREF(tmp_value);
23732     Py_XDECREF(tmp_tb);
23733 #else
23734     PyErr_SetExcInfo(local_type, local_value, local_tb);
23735 #endif
23736     return 0;
23737 bad:
23738     *type = 0;
23739     *value = 0;
23740     *tb = 0;
23741     Py_XDECREF(local_type);
23742     Py_XDECREF(local_value);
23743     Py_XDECREF(local_tb);
23744     return -1;
23745 }
23746 
23747 /* ArgTypeTest */
__Pyx__ArgTypeTest(PyObject * obj,PyTypeObject * type,const char * name,int exact)23748 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
23749 {
23750     if (unlikely(!type)) {
23751         PyErr_SetString(PyExc_SystemError, "Missing type object");
23752         return 0;
23753     }
23754     else if (exact) {
23755         #if PY_MAJOR_VERSION == 2
23756         if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
23757         #endif
23758     }
23759     else {
23760         if (likely(__Pyx_TypeCheck(obj, type))) return 1;
23761     }
23762     PyErr_Format(PyExc_TypeError,
23763         "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
23764         name, type->tp_name, Py_TYPE(obj)->tp_name);
23765     return 0;
23766 }
23767 
23768 /* BytesEquals */
__Pyx_PyBytes_Equals(PyObject * s1,PyObject * s2,int equals)23769 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
23770 #if CYTHON_COMPILING_IN_PYPY
23771     return PyObject_RichCompareBool(s1, s2, equals);
23772 #else
23773     if (s1 == s2) {
23774         return (equals == Py_EQ);
23775     } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
23776         const char *ps1, *ps2;
23777         Py_ssize_t length = PyBytes_GET_SIZE(s1);
23778         if (length != PyBytes_GET_SIZE(s2))
23779             return (equals == Py_NE);
23780         ps1 = PyBytes_AS_STRING(s1);
23781         ps2 = PyBytes_AS_STRING(s2);
23782         if (ps1[0] != ps2[0]) {
23783             return (equals == Py_NE);
23784         } else if (length == 1) {
23785             return (equals == Py_EQ);
23786         } else {
23787             int result;
23788 #if CYTHON_USE_UNICODE_INTERNALS
23789             Py_hash_t hash1, hash2;
23790             hash1 = ((PyBytesObject*)s1)->ob_shash;
23791             hash2 = ((PyBytesObject*)s2)->ob_shash;
23792             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
23793                 return (equals == Py_NE);
23794             }
23795 #endif
23796             result = memcmp(ps1, ps2, (size_t)length);
23797             return (equals == Py_EQ) ? (result == 0) : (result != 0);
23798         }
23799     } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
23800         return (equals == Py_NE);
23801     } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
23802         return (equals == Py_NE);
23803     } else {
23804         int result;
23805         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
23806         if (!py_result)
23807             return -1;
23808         result = __Pyx_PyObject_IsTrue(py_result);
23809         Py_DECREF(py_result);
23810         return result;
23811     }
23812 #endif
23813 }
23814 
23815 /* UnicodeEquals */
__Pyx_PyUnicode_Equals(PyObject * s1,PyObject * s2,int equals)23816 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
23817 #if CYTHON_COMPILING_IN_PYPY
23818     return PyObject_RichCompareBool(s1, s2, equals);
23819 #else
23820 #if PY_MAJOR_VERSION < 3
23821     PyObject* owned_ref = NULL;
23822 #endif
23823     int s1_is_unicode, s2_is_unicode;
23824     if (s1 == s2) {
23825         goto return_eq;
23826     }
23827     s1_is_unicode = PyUnicode_CheckExact(s1);
23828     s2_is_unicode = PyUnicode_CheckExact(s2);
23829 #if PY_MAJOR_VERSION < 3
23830     if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
23831         owned_ref = PyUnicode_FromObject(s2);
23832         if (unlikely(!owned_ref))
23833             return -1;
23834         s2 = owned_ref;
23835         s2_is_unicode = 1;
23836     } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
23837         owned_ref = PyUnicode_FromObject(s1);
23838         if (unlikely(!owned_ref))
23839             return -1;
23840         s1 = owned_ref;
23841         s1_is_unicode = 1;
23842     } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
23843         return __Pyx_PyBytes_Equals(s1, s2, equals);
23844     }
23845 #endif
23846     if (s1_is_unicode & s2_is_unicode) {
23847         Py_ssize_t length;
23848         int kind;
23849         void *data1, *data2;
23850         if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
23851             return -1;
23852         length = __Pyx_PyUnicode_GET_LENGTH(s1);
23853         if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
23854             goto return_ne;
23855         }
23856 #if CYTHON_USE_UNICODE_INTERNALS
23857         {
23858             Py_hash_t hash1, hash2;
23859         #if CYTHON_PEP393_ENABLED
23860             hash1 = ((PyASCIIObject*)s1)->hash;
23861             hash2 = ((PyASCIIObject*)s2)->hash;
23862         #else
23863             hash1 = ((PyUnicodeObject*)s1)->hash;
23864             hash2 = ((PyUnicodeObject*)s2)->hash;
23865         #endif
23866             if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
23867                 goto return_ne;
23868             }
23869         }
23870 #endif
23871         kind = __Pyx_PyUnicode_KIND(s1);
23872         if (kind != __Pyx_PyUnicode_KIND(s2)) {
23873             goto return_ne;
23874         }
23875         data1 = __Pyx_PyUnicode_DATA(s1);
23876         data2 = __Pyx_PyUnicode_DATA(s2);
23877         if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
23878             goto return_ne;
23879         } else if (length == 1) {
23880             goto return_eq;
23881         } else {
23882             int result = memcmp(data1, data2, (size_t)(length * kind));
23883             #if PY_MAJOR_VERSION < 3
23884             Py_XDECREF(owned_ref);
23885             #endif
23886             return (equals == Py_EQ) ? (result == 0) : (result != 0);
23887         }
23888     } else if ((s1 == Py_None) & s2_is_unicode) {
23889         goto return_ne;
23890     } else if ((s2 == Py_None) & s1_is_unicode) {
23891         goto return_ne;
23892     } else {
23893         int result;
23894         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
23895         #if PY_MAJOR_VERSION < 3
23896         Py_XDECREF(owned_ref);
23897         #endif
23898         if (!py_result)
23899             return -1;
23900         result = __Pyx_PyObject_IsTrue(py_result);
23901         Py_DECREF(py_result);
23902         return result;
23903     }
23904 return_eq:
23905     #if PY_MAJOR_VERSION < 3
23906     Py_XDECREF(owned_ref);
23907     #endif
23908     return (equals == Py_EQ);
23909 return_ne:
23910     #if PY_MAJOR_VERSION < 3
23911     Py_XDECREF(owned_ref);
23912     #endif
23913     return (equals == Py_NE);
23914 #endif
23915 }
23916 
23917 /* None */
__Pyx_div_Py_ssize_t(Py_ssize_t a,Py_ssize_t b)23918 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
23919     Py_ssize_t q = a / b;
23920     Py_ssize_t r = a - q*b;
23921     q -= ((r != 0) & ((r ^ b) < 0));
23922     return q;
23923 }
23924 
23925 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)23926 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
23927     PyObject *r;
23928     if (!j) return NULL;
23929     r = PyObject_GetItem(o, j);
23930     Py_DECREF(j);
23931     return r;
23932 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)23933 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
23934                                                               CYTHON_NCP_UNUSED int wraparound,
23935                                                               CYTHON_NCP_UNUSED int boundscheck) {
23936 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
23937     Py_ssize_t wrapped_i = i;
23938     if (wraparound & unlikely(i < 0)) {
23939         wrapped_i += PyList_GET_SIZE(o);
23940     }
23941     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
23942         PyObject *r = PyList_GET_ITEM(o, wrapped_i);
23943         Py_INCREF(r);
23944         return r;
23945     }
23946     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23947 #else
23948     return PySequence_GetItem(o, i);
23949 #endif
23950 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)23951 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
23952                                                               CYTHON_NCP_UNUSED int wraparound,
23953                                                               CYTHON_NCP_UNUSED int boundscheck) {
23954 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
23955     Py_ssize_t wrapped_i = i;
23956     if (wraparound & unlikely(i < 0)) {
23957         wrapped_i += PyTuple_GET_SIZE(o);
23958     }
23959     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
23960         PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
23961         Py_INCREF(r);
23962         return r;
23963     }
23964     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23965 #else
23966     return PySequence_GetItem(o, i);
23967 #endif
23968 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)23969 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
23970                                                      CYTHON_NCP_UNUSED int wraparound,
23971                                                      CYTHON_NCP_UNUSED int boundscheck) {
23972 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
23973     if (is_list || PyList_CheckExact(o)) {
23974         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
23975         if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
23976             PyObject *r = PyList_GET_ITEM(o, n);
23977             Py_INCREF(r);
23978             return r;
23979         }
23980     }
23981     else if (PyTuple_CheckExact(o)) {
23982         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
23983         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
23984             PyObject *r = PyTuple_GET_ITEM(o, n);
23985             Py_INCREF(r);
23986             return r;
23987         }
23988     } else {
23989         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
23990         if (likely(m && m->sq_item)) {
23991             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
23992                 Py_ssize_t l = m->sq_length(o);
23993                 if (likely(l >= 0)) {
23994                     i += l;
23995                 } else {
23996                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
23997                         return NULL;
23998                     PyErr_Clear();
23999                 }
24000             }
24001             return m->sq_item(o, i);
24002         }
24003     }
24004 #else
24005     if (is_list || PySequence_Check(o)) {
24006         return PySequence_GetItem(o, i);
24007     }
24008 #endif
24009     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
24010 }
24011 
24012 /* ObjectGetItem */
24013 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetIndex(PyObject * obj,PyObject * index)24014 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
24015     PyObject *runerr;
24016     Py_ssize_t key_value;
24017     PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
24018     if (unlikely(!(m && m->sq_item))) {
24019         PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
24020         return NULL;
24021     }
24022     key_value = __Pyx_PyIndex_AsSsize_t(index);
24023     if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
24024         return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
24025     }
24026     if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
24027         PyErr_Clear();
24028         PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
24029     }
24030     return NULL;
24031 }
__Pyx_PyObject_GetItem(PyObject * obj,PyObject * key)24032 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
24033     PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
24034     if (likely(m && m->mp_subscript)) {
24035         return m->mp_subscript(obj, key);
24036     }
24037     return __Pyx_PyObject_GetIndex(obj, key);
24038 }
24039 #endif
24040 
24041 /* 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))24042 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
24043          const char* cstring, Py_ssize_t start, Py_ssize_t stop,
24044          const char* encoding, const char* errors,
24045          PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
24046     Py_ssize_t length;
24047     if (unlikely((start < 0) | (stop < 0))) {
24048         size_t slen = strlen(cstring);
24049         if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
24050             PyErr_SetString(PyExc_OverflowError,
24051                             "c-string too long to convert to Python");
24052             return NULL;
24053         }
24054         length = (Py_ssize_t) slen;
24055         if (start < 0) {
24056             start += length;
24057             if (start < 0)
24058                 start = 0;
24059         }
24060         if (stop < 0)
24061             stop += length;
24062     }
24063     if (unlikely(stop <= start))
24064         return __Pyx_NewRef(__pyx_empty_unicode);
24065     length = stop - start;
24066     cstring += start;
24067     if (decode_func) {
24068         return decode_func(cstring, length, errors);
24069     } else {
24070         return PyUnicode_Decode(cstring, length, encoding, errors);
24071     }
24072 }
24073 
24074 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)24075 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
24076     PyErr_Format(PyExc_ValueError,
24077                  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
24078 }
24079 
24080 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)24081 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
24082     PyErr_Format(PyExc_ValueError,
24083                  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
24084                  index, (index == 1) ? "" : "s");
24085 }
24086 
24087 /* RaiseNoneIterError */
__Pyx_RaiseNoneNotIterableError(void)24088 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
24089     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
24090 }
24091 
24092 /* SwapException */
24093 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSwap(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)24094 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
24095     PyObject *tmp_type, *tmp_value, *tmp_tb;
24096     #if CYTHON_USE_EXC_INFO_STACK
24097     _PyErr_StackItem *exc_info = tstate->exc_info;
24098     tmp_type = exc_info->exc_type;
24099     tmp_value = exc_info->exc_value;
24100     tmp_tb = exc_info->exc_traceback;
24101     exc_info->exc_type = *type;
24102     exc_info->exc_value = *value;
24103     exc_info->exc_traceback = *tb;
24104     #else
24105     tmp_type = tstate->exc_type;
24106     tmp_value = tstate->exc_value;
24107     tmp_tb = tstate->exc_traceback;
24108     tstate->exc_type = *type;
24109     tstate->exc_value = *value;
24110     tstate->exc_traceback = *tb;
24111     #endif
24112     *type = tmp_type;
24113     *value = tmp_value;
24114     *tb = tmp_tb;
24115 }
24116 #else
__Pyx_ExceptionSwap(PyObject ** type,PyObject ** value,PyObject ** tb)24117 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
24118     PyObject *tmp_type, *tmp_value, *tmp_tb;
24119     PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
24120     PyErr_SetExcInfo(*type, *value, *tb);
24121     *type = tmp_type;
24122     *value = tmp_value;
24123     *tb = tmp_tb;
24124 }
24125 #endif
24126 
24127 /* FastTypeChecks */
24128 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)24129 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
24130     while (a) {
24131         a = a->tp_base;
24132         if (a == b)
24133             return 1;
24134     }
24135     return b == &PyBaseObject_Type;
24136 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)24137 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
24138     PyObject *mro;
24139     if (a == b) return 1;
24140     mro = a->tp_mro;
24141     if (likely(mro)) {
24142         Py_ssize_t i, n;
24143         n = PyTuple_GET_SIZE(mro);
24144         for (i = 0; i < n; i++) {
24145             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
24146                 return 1;
24147         }
24148         return 0;
24149     }
24150     return __Pyx_InBases(a, b);
24151 }
24152 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)24153 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
24154     PyObject *exception, *value, *tb;
24155     int res;
24156     __Pyx_PyThreadState_declare
24157     __Pyx_PyThreadState_assign
24158     __Pyx_ErrFetch(&exception, &value, &tb);
24159     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
24160     if (unlikely(res == -1)) {
24161         PyErr_WriteUnraisable(err);
24162         res = 0;
24163     }
24164     if (!res) {
24165         res = PyObject_IsSubclass(err, exc_type2);
24166         if (unlikely(res == -1)) {
24167             PyErr_WriteUnraisable(err);
24168             res = 0;
24169         }
24170     }
24171     __Pyx_ErrRestore(exception, value, tb);
24172     return res;
24173 }
24174 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)24175 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
24176     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
24177     if (!res) {
24178         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
24179     }
24180     return res;
24181 }
24182 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)24183 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
24184     Py_ssize_t i, n;
24185     assert(PyExceptionClass_Check(exc_type));
24186     n = PyTuple_GET_SIZE(tuple);
24187 #if PY_MAJOR_VERSION >= 3
24188     for (i=0; i<n; i++) {
24189         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
24190     }
24191 #endif
24192     for (i=0; i<n; i++) {
24193         PyObject *t = PyTuple_GET_ITEM(tuple, i);
24194         #if PY_MAJOR_VERSION < 3
24195         if (likely(exc_type == t)) return 1;
24196         #endif
24197         if (likely(PyExceptionClass_Check(t))) {
24198             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
24199         } else {
24200         }
24201     }
24202     return 0;
24203 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)24204 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
24205     if (likely(err == exc_type)) return 1;
24206     if (likely(PyExceptionClass_Check(err))) {
24207         if (likely(PyExceptionClass_Check(exc_type))) {
24208             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
24209         } else if (likely(PyTuple_Check(exc_type))) {
24210             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
24211         } else {
24212         }
24213     }
24214     return PyErr_GivenExceptionMatches(err, exc_type);
24215 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)24216 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
24217     assert(PyExceptionClass_Check(exc_type1));
24218     assert(PyExceptionClass_Check(exc_type2));
24219     if (likely(err == exc_type1 || err == exc_type2)) return 1;
24220     if (likely(PyExceptionClass_Check(err))) {
24221         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
24222     }
24223     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
24224 }
24225 #endif
24226 
24227 /* PyIntBinop */
24228 #if !CYTHON_COMPILING_IN_PYPY
__Pyx_PyInt_AddObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,int inplace,int zerodivision_check)24229 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
24230     (void)inplace;
24231     (void)zerodivision_check;
24232     #if PY_MAJOR_VERSION < 3
24233     if (likely(PyInt_CheckExact(op1))) {
24234         const long b = intval;
24235         long x;
24236         long a = PyInt_AS_LONG(op1);
24237             x = (long)((unsigned long)a + b);
24238             if (likely((x^a) >= 0 || (x^b) >= 0))
24239                 return PyInt_FromLong(x);
24240             return PyLong_Type.tp_as_number->nb_add(op1, op2);
24241     }
24242     #endif
24243     #if CYTHON_USE_PYLONG_INTERNALS
24244     if (likely(PyLong_CheckExact(op1))) {
24245         const long b = intval;
24246         long a, x;
24247 #ifdef HAVE_LONG_LONG
24248         const PY_LONG_LONG llb = intval;
24249         PY_LONG_LONG lla, llx;
24250 #endif
24251         const digit* digits = ((PyLongObject*)op1)->ob_digit;
24252         const Py_ssize_t size = Py_SIZE(op1);
24253         if (likely(__Pyx_sst_abs(size) <= 1)) {
24254             a = likely(size) ? digits[0] : 0;
24255             if (size == -1) a = -a;
24256         } else {
24257             switch (size) {
24258                 case -2:
24259                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
24260                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24261                         break;
24262 #ifdef HAVE_LONG_LONG
24263                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
24264                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
24265                         goto long_long;
24266 #endif
24267                     }
24268                     CYTHON_FALLTHROUGH;
24269                 case 2:
24270                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
24271                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24272                         break;
24273 #ifdef HAVE_LONG_LONG
24274                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
24275                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
24276                         goto long_long;
24277 #endif
24278                     }
24279                     CYTHON_FALLTHROUGH;
24280                 case -3:
24281                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
24282                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24283                         break;
24284 #ifdef HAVE_LONG_LONG
24285                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
24286                         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]));
24287                         goto long_long;
24288 #endif
24289                     }
24290                     CYTHON_FALLTHROUGH;
24291                 case 3:
24292                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
24293                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24294                         break;
24295 #ifdef HAVE_LONG_LONG
24296                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
24297                         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]));
24298                         goto long_long;
24299 #endif
24300                     }
24301                     CYTHON_FALLTHROUGH;
24302                 case -4:
24303                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
24304                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24305                         break;
24306 #ifdef HAVE_LONG_LONG
24307                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
24308                         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]));
24309                         goto long_long;
24310 #endif
24311                     }
24312                     CYTHON_FALLTHROUGH;
24313                 case 4:
24314                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
24315                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24316                         break;
24317 #ifdef HAVE_LONG_LONG
24318                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
24319                         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]));
24320                         goto long_long;
24321 #endif
24322                     }
24323                     CYTHON_FALLTHROUGH;
24324                 default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
24325             }
24326         }
24327                 x = a + b;
24328             return PyLong_FromLong(x);
24329 #ifdef HAVE_LONG_LONG
24330         long_long:
24331                 llx = lla + llb;
24332             return PyLong_FromLongLong(llx);
24333 #endif
24334 
24335 
24336     }
24337     #endif
24338     if (PyFloat_CheckExact(op1)) {
24339         const long b = intval;
24340         double a = PyFloat_AS_DOUBLE(op1);
24341             double result;
24342             PyFPE_START_PROTECT("add", return NULL)
24343             result = ((double)a) + (double)b;
24344             PyFPE_END_PROTECT(result)
24345             return PyFloat_FromDouble(result);
24346     }
24347     return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
24348 }
24349 #endif
24350 
24351 /* None */
__Pyx_RaiseUnboundLocalError(const char * varname)24352 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
24353     PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
24354 }
24355 
24356 /* None */
__Pyx_div_long(long a,long b)24357 static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
24358     long q = a / b;
24359     long r = a - q*b;
24360     q -= ((r != 0) & ((r ^ b) < 0));
24361     return q;
24362 }
24363 
24364 /* CallNextTpDealloc */
__Pyx_call_next_tp_dealloc(PyObject * obj,destructor current_tp_dealloc)24365 static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc) {
24366     PyTypeObject* type = Py_TYPE(obj);
24367     while (type && type->tp_dealloc != current_tp_dealloc)
24368         type = type->tp_base;
24369     while (type && type->tp_dealloc == current_tp_dealloc)
24370         type = type->tp_base;
24371     if (type)
24372         type->tp_dealloc(obj);
24373 }
24374 
24375 /* CallNextTpTraverse */
__Pyx_call_next_tp_traverse(PyObject * obj,visitproc v,void * a,traverseproc current_tp_traverse)24376 static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) {
24377     PyTypeObject* type = Py_TYPE(obj);
24378     while (type && type->tp_traverse != current_tp_traverse)
24379         type = type->tp_base;
24380     while (type && type->tp_traverse == current_tp_traverse)
24381         type = type->tp_base;
24382     if (type && type->tp_traverse)
24383         return type->tp_traverse(obj, v, a);
24384     return 0;
24385 }
24386 
24387 /* CallNextTpClear */
__Pyx_call_next_tp_clear(PyObject * obj,inquiry current_tp_clear)24388 static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) {
24389     PyTypeObject* type = Py_TYPE(obj);
24390     while (type && type->tp_clear != current_tp_clear)
24391         type = type->tp_base;
24392     while (type && type->tp_clear == current_tp_clear)
24393         type = type->tp_base;
24394     if (type && type->tp_clear)
24395         type->tp_clear(obj);
24396 }
24397 
24398 /* PyObject_GenericGetAttrNoDict */
24399 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)24400 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
24401     PyErr_Format(PyExc_AttributeError,
24402 #if PY_MAJOR_VERSION >= 3
24403                  "'%.50s' object has no attribute '%U'",
24404                  tp->tp_name, attr_name);
24405 #else
24406                  "'%.50s' object has no attribute '%.400s'",
24407                  tp->tp_name, PyString_AS_STRING(attr_name));
24408 #endif
24409     return NULL;
24410 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)24411 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
24412     PyObject *descr;
24413     PyTypeObject *tp = Py_TYPE(obj);
24414     if (unlikely(!PyString_Check(attr_name))) {
24415         return PyObject_GenericGetAttr(obj, attr_name);
24416     }
24417     assert(!tp->tp_dictoffset);
24418     descr = _PyType_Lookup(tp, attr_name);
24419     if (unlikely(!descr)) {
24420         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
24421     }
24422     Py_INCREF(descr);
24423     #if PY_MAJOR_VERSION < 3
24424     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
24425     #endif
24426     {
24427         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
24428         if (unlikely(f)) {
24429             PyObject *res = f(descr, obj, (PyObject *)tp);
24430             Py_DECREF(descr);
24431             return res;
24432         }
24433     }
24434     return descr;
24435 }
24436 #endif
24437 
24438 /* PyObject_GenericGetAttr */
24439 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)24440 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
24441     if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
24442         return PyObject_GenericGetAttr(obj, attr_name);
24443     }
24444     return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
24445 }
24446 #endif
24447 
24448 /* TypeImport */
24449 #ifndef __PYX_HAVE_RT_ImportType
24450 #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)24451 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
24452     size_t size, enum __Pyx_ImportType_CheckSize check_size)
24453 {
24454     PyObject *result = 0;
24455     char warning[200];
24456     Py_ssize_t basicsize;
24457 #ifdef Py_LIMITED_API
24458     PyObject *py_basicsize;
24459 #endif
24460     result = PyObject_GetAttrString(module, class_name);
24461     if (!result)
24462         goto bad;
24463     if (!PyType_Check(result)) {
24464         PyErr_Format(PyExc_TypeError,
24465             "%.200s.%.200s is not a type object",
24466             module_name, class_name);
24467         goto bad;
24468     }
24469 #ifndef Py_LIMITED_API
24470     basicsize = ((PyTypeObject *)result)->tp_basicsize;
24471 #else
24472     py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
24473     if (!py_basicsize)
24474         goto bad;
24475     basicsize = PyLong_AsSsize_t(py_basicsize);
24476     Py_DECREF(py_basicsize);
24477     py_basicsize = 0;
24478     if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
24479         goto bad;
24480 #endif
24481     if ((size_t)basicsize < size) {
24482         PyErr_Format(PyExc_ValueError,
24483             "%.200s.%.200s size changed, may indicate binary incompatibility. "
24484             "Expected %zd from C header, got %zd from PyObject",
24485             module_name, class_name, size, basicsize);
24486         goto bad;
24487     }
24488     if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
24489         PyErr_Format(PyExc_ValueError,
24490             "%.200s.%.200s size changed, may indicate binary incompatibility. "
24491             "Expected %zd from C header, got %zd from PyObject",
24492             module_name, class_name, size, basicsize);
24493         goto bad;
24494     }
24495     else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
24496         PyOS_snprintf(warning, sizeof(warning),
24497             "%s.%s size changed, may indicate binary incompatibility. "
24498             "Expected %zd from C header, got %zd from PyObject",
24499             module_name, class_name, size, basicsize);
24500         if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
24501     }
24502     return (PyTypeObject *)result;
24503 bad:
24504     Py_XDECREF(result);
24505     return NULL;
24506 }
24507 #endif
24508 
24509 /* GetVTable */
__Pyx_GetVtable(PyObject * dict)24510 static void* __Pyx_GetVtable(PyObject *dict) {
24511     void* ptr;
24512     PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
24513     if (!ob)
24514         goto bad;
24515 #if PY_VERSION_HEX >= 0x02070000
24516     ptr = PyCapsule_GetPointer(ob, 0);
24517 #else
24518     ptr = PyCObject_AsVoidPtr(ob);
24519 #endif
24520     if (!ptr && !PyErr_Occurred())
24521         PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
24522     Py_DECREF(ob);
24523     return ptr;
24524 bad:
24525     Py_XDECREF(ob);
24526     return NULL;
24527 }
24528 
24529 /* SetVTable */
__Pyx_SetVtable(PyObject * dict,void * vtable)24530 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
24531 #if PY_VERSION_HEX >= 0x02070000
24532     PyObject *ob = PyCapsule_New(vtable, 0, 0);
24533 #else
24534     PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
24535 #endif
24536     if (!ob)
24537         goto bad;
24538     if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
24539         goto bad;
24540     Py_DECREF(ob);
24541     return 0;
24542 bad:
24543     Py_XDECREF(ob);
24544     return -1;
24545 }
24546 
24547 /* PyObjectGetAttrStrNoError */
__Pyx_PyObject_GetAttrStr_ClearAttributeError(void)24548 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
24549     __Pyx_PyThreadState_declare
24550     __Pyx_PyThreadState_assign
24551     if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
24552         __Pyx_PyErr_Clear();
24553 }
__Pyx_PyObject_GetAttrStrNoError(PyObject * obj,PyObject * attr_name)24554 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
24555     PyObject *result;
24556 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
24557     PyTypeObject* tp = Py_TYPE(obj);
24558     if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
24559         return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
24560     }
24561 #endif
24562     result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
24563     if (unlikely(!result)) {
24564         __Pyx_PyObject_GetAttrStr_ClearAttributeError();
24565     }
24566     return result;
24567 }
24568 
24569 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)24570 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
24571   int ret;
24572   PyObject *name_attr;
24573   name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
24574   if (likely(name_attr)) {
24575       ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
24576   } else {
24577       ret = -1;
24578   }
24579   if (unlikely(ret < 0)) {
24580       PyErr_Clear();
24581       ret = 0;
24582   }
24583   Py_XDECREF(name_attr);
24584   return ret;
24585 }
__Pyx_setup_reduce(PyObject * type_obj)24586 static int __Pyx_setup_reduce(PyObject* type_obj) {
24587     int ret = 0;
24588     PyObject *object_reduce = NULL;
24589     PyObject *object_reduce_ex = NULL;
24590     PyObject *reduce = NULL;
24591     PyObject *reduce_ex = NULL;
24592     PyObject *reduce_cython = NULL;
24593     PyObject *setstate = NULL;
24594     PyObject *setstate_cython = NULL;
24595 #if CYTHON_USE_PYTYPE_LOOKUP
24596     if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
24597 #else
24598     if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
24599 #endif
24600 #if CYTHON_USE_PYTYPE_LOOKUP
24601     object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
24602 #else
24603     object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
24604 #endif
24605     reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
24606     if (reduce_ex == object_reduce_ex) {
24607 #if CYTHON_USE_PYTYPE_LOOKUP
24608         object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
24609 #else
24610         object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
24611 #endif
24612         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
24613         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
24614             reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
24615             if (likely(reduce_cython)) {
24616                 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
24617                 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
24618             } else if (reduce == object_reduce || PyErr_Occurred()) {
24619                 goto __PYX_BAD;
24620             }
24621             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
24622             if (!setstate) PyErr_Clear();
24623             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
24624                 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
24625                 if (likely(setstate_cython)) {
24626                     ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
24627                     ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
24628                 } else if (!setstate || PyErr_Occurred()) {
24629                     goto __PYX_BAD;
24630                 }
24631             }
24632             PyType_Modified((PyTypeObject*)type_obj);
24633         }
24634     }
24635     goto __PYX_GOOD;
24636 __PYX_BAD:
24637     if (!PyErr_Occurred())
24638         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
24639     ret = -1;
24640 __PYX_GOOD:
24641 #if !CYTHON_USE_PYTYPE_LOOKUP
24642     Py_XDECREF(object_reduce);
24643     Py_XDECREF(object_reduce_ex);
24644 #endif
24645     Py_XDECREF(reduce);
24646     Py_XDECREF(reduce_ex);
24647     Py_XDECREF(reduce_cython);
24648     Py_XDECREF(setstate);
24649     Py_XDECREF(setstate_cython);
24650     return ret;
24651 }
24652 
24653 /* CLineInTraceback */
24654 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)24655 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
24656     PyObject *use_cline;
24657     PyObject *ptype, *pvalue, *ptraceback;
24658 #if CYTHON_COMPILING_IN_CPYTHON
24659     PyObject **cython_runtime_dict;
24660 #endif
24661     if (unlikely(!__pyx_cython_runtime)) {
24662         return c_line;
24663     }
24664     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
24665 #if CYTHON_COMPILING_IN_CPYTHON
24666     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
24667     if (likely(cython_runtime_dict)) {
24668         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
24669             use_cline, *cython_runtime_dict,
24670             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
24671     } else
24672 #endif
24673     {
24674       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
24675       if (use_cline_obj) {
24676         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
24677         Py_DECREF(use_cline_obj);
24678       } else {
24679         PyErr_Clear();
24680         use_cline = NULL;
24681       }
24682     }
24683     if (!use_cline) {
24684         c_line = 0;
24685         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
24686     }
24687     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
24688         c_line = 0;
24689     }
24690     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
24691     return c_line;
24692 }
24693 #endif
24694 
24695 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)24696 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
24697     int start = 0, mid = 0, end = count - 1;
24698     if (end >= 0 && code_line > entries[end].code_line) {
24699         return count;
24700     }
24701     while (start < end) {
24702         mid = start + (end - start) / 2;
24703         if (code_line < entries[mid].code_line) {
24704             end = mid;
24705         } else if (code_line > entries[mid].code_line) {
24706              start = mid + 1;
24707         } else {
24708             return mid;
24709         }
24710     }
24711     if (code_line <= entries[mid].code_line) {
24712         return mid;
24713     } else {
24714         return mid + 1;
24715     }
24716 }
__pyx_find_code_object(int code_line)24717 static PyCodeObject *__pyx_find_code_object(int code_line) {
24718     PyCodeObject* code_object;
24719     int pos;
24720     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
24721         return NULL;
24722     }
24723     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
24724     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
24725         return NULL;
24726     }
24727     code_object = __pyx_code_cache.entries[pos].code_object;
24728     Py_INCREF(code_object);
24729     return code_object;
24730 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)24731 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
24732     int pos, i;
24733     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
24734     if (unlikely(!code_line)) {
24735         return;
24736     }
24737     if (unlikely(!entries)) {
24738         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
24739         if (likely(entries)) {
24740             __pyx_code_cache.entries = entries;
24741             __pyx_code_cache.max_count = 64;
24742             __pyx_code_cache.count = 1;
24743             entries[0].code_line = code_line;
24744             entries[0].code_object = code_object;
24745             Py_INCREF(code_object);
24746         }
24747         return;
24748     }
24749     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
24750     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
24751         PyCodeObject* tmp = entries[pos].code_object;
24752         entries[pos].code_object = code_object;
24753         Py_DECREF(tmp);
24754         return;
24755     }
24756     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
24757         int new_max = __pyx_code_cache.max_count + 64;
24758         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
24759             __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
24760         if (unlikely(!entries)) {
24761             return;
24762         }
24763         __pyx_code_cache.entries = entries;
24764         __pyx_code_cache.max_count = new_max;
24765     }
24766     for (i=__pyx_code_cache.count; i>pos; i--) {
24767         entries[i] = entries[i-1];
24768     }
24769     entries[pos].code_line = code_line;
24770     entries[pos].code_object = code_object;
24771     __pyx_code_cache.count++;
24772     Py_INCREF(code_object);
24773 }
24774 
24775 /* AddTraceback */
24776 #include "compile.h"
24777 #include "frameobject.h"
24778 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)24779 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
24780             const char *funcname, int c_line,
24781             int py_line, const char *filename) {
24782     PyCodeObject *py_code = 0;
24783     PyObject *py_srcfile = 0;
24784     PyObject *py_funcname = 0;
24785     #if PY_MAJOR_VERSION < 3
24786     py_srcfile = PyString_FromString(filename);
24787     #else
24788     py_srcfile = PyUnicode_FromString(filename);
24789     #endif
24790     if (!py_srcfile) goto bad;
24791     if (c_line) {
24792         #if PY_MAJOR_VERSION < 3
24793         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
24794         #else
24795         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
24796         #endif
24797     }
24798     else {
24799         #if PY_MAJOR_VERSION < 3
24800         py_funcname = PyString_FromString(funcname);
24801         #else
24802         py_funcname = PyUnicode_FromString(funcname);
24803         #endif
24804     }
24805     if (!py_funcname) goto bad;
24806     py_code = __Pyx_PyCode_New(
24807         0,
24808         0,
24809         0,
24810         0,
24811         0,
24812         __pyx_empty_bytes, /*PyObject *code,*/
24813         __pyx_empty_tuple, /*PyObject *consts,*/
24814         __pyx_empty_tuple, /*PyObject *names,*/
24815         __pyx_empty_tuple, /*PyObject *varnames,*/
24816         __pyx_empty_tuple, /*PyObject *freevars,*/
24817         __pyx_empty_tuple, /*PyObject *cellvars,*/
24818         py_srcfile,   /*PyObject *filename,*/
24819         py_funcname,  /*PyObject *name,*/
24820         py_line,
24821         __pyx_empty_bytes  /*PyObject *lnotab*/
24822     );
24823     Py_DECREF(py_srcfile);
24824     Py_DECREF(py_funcname);
24825     return py_code;
24826 bad:
24827     Py_XDECREF(py_srcfile);
24828     Py_XDECREF(py_funcname);
24829     return NULL;
24830 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)24831 static void __Pyx_AddTraceback(const char *funcname, int c_line,
24832                                int py_line, const char *filename) {
24833     PyCodeObject *py_code = 0;
24834     PyFrameObject *py_frame = 0;
24835     PyThreadState *tstate = __Pyx_PyThreadState_Current;
24836     if (c_line) {
24837         c_line = __Pyx_CLineForTraceback(tstate, c_line);
24838     }
24839     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
24840     if (!py_code) {
24841         py_code = __Pyx_CreateCodeObjectForTraceback(
24842             funcname, c_line, py_line, filename);
24843         if (!py_code) goto bad;
24844         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
24845     }
24846     py_frame = PyFrame_New(
24847         tstate,            /*PyThreadState *tstate,*/
24848         py_code,           /*PyCodeObject *code,*/
24849         __pyx_d,    /*PyObject *globals,*/
24850         0                  /*PyObject *locals*/
24851     );
24852     if (!py_frame) goto bad;
24853     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
24854     PyTraceBack_Here(py_frame);
24855 bad:
24856     Py_XDECREF(py_code);
24857     Py_XDECREF(py_frame);
24858 }
24859 
24860 #if PY_MAJOR_VERSION < 3
__Pyx_GetBuffer(PyObject * obj,Py_buffer * view,int flags)24861 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
24862     if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
24863         if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
24864         if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
24865     PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
24866     return -1;
24867 }
__Pyx_ReleaseBuffer(Py_buffer * view)24868 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
24869     PyObject *obj = view->obj;
24870     if (!obj) return;
24871     if (PyObject_CheckBuffer(obj)) {
24872         PyBuffer_Release(view);
24873         return;
24874     }
24875     if ((0)) {}
24876     view->obj = NULL;
24877     Py_DECREF(obj);
24878 }
24879 #endif
24880 
24881 
24882 /* MemviewSliceIsContig */
24883 static int
__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs,char order,int ndim)24884 __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
24885 {
24886     int i, index, step, start;
24887     Py_ssize_t itemsize = mvs.memview->view.itemsize;
24888     if (order == 'F') {
24889         step = 1;
24890         start = 0;
24891     } else {
24892         step = -1;
24893         start = ndim - 1;
24894     }
24895     for (i = 0; i < ndim; i++) {
24896         index = start + step * i;
24897         if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
24898             return 0;
24899         itemsize *= mvs.shape[index];
24900     }
24901     return 1;
24902 }
24903 
24904 /* OverlappingSlices */
24905 static void
__pyx_get_array_memory_extents(__Pyx_memviewslice * slice,void ** out_start,void ** out_end,int ndim,size_t itemsize)24906 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
24907                                void **out_start, void **out_end,
24908                                int ndim, size_t itemsize)
24909 {
24910     char *start, *end;
24911     int i;
24912     start = end = slice->data;
24913     for (i = 0; i < ndim; i++) {
24914         Py_ssize_t stride = slice->strides[i];
24915         Py_ssize_t extent = slice->shape[i];
24916         if (extent == 0) {
24917             *out_start = *out_end = start;
24918             return;
24919         } else {
24920             if (stride > 0)
24921                 end += stride * (extent - 1);
24922             else
24923                 start += stride * (extent - 1);
24924         }
24925     }
24926     *out_start = start;
24927     *out_end = end + itemsize;
24928 }
24929 static int
__pyx_slices_overlap(__Pyx_memviewslice * slice1,__Pyx_memviewslice * slice2,int ndim,size_t itemsize)24930 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
24931                      __Pyx_memviewslice *slice2,
24932                      int ndim, size_t itemsize)
24933 {
24934     void *start1, *end1, *start2, *end2;
24935     __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
24936     __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
24937     return (start1 < end2) && (start2 < end1);
24938 }
24939 
24940 /* Capsule */
24941 static CYTHON_INLINE PyObject *
__pyx_capsule_create(void * p,CYTHON_UNUSED const char * sig)24942 __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
24943 {
24944     PyObject *cobj;
24945 #if PY_VERSION_HEX >= 0x02070000
24946     cobj = PyCapsule_New(p, sig, NULL);
24947 #else
24948     cobj = PyCObject_FromVoidPtr(p, NULL);
24949 #endif
24950     return cobj;
24951 }
24952 
24953 /* MemviewDtypeToObject */
__pyx_memview_get_double(const char * itemp)24954 static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp) {
24955     return (PyObject *) PyFloat_FromDouble(*(double *) itemp);
24956 }
__pyx_memview_set_double(const char * itemp,PyObject * obj)24957 static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj) {
24958     double value = __pyx_PyFloat_AsDouble(obj);
24959     if ((value == (double)-1) && PyErr_Occurred())
24960         return 0;
24961     *(double *) itemp = value;
24962     return 1;
24963 }
24964 
24965 /* IsLittleEndian */
__Pyx_Is_Little_Endian(void)24966 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
24967 {
24968   union {
24969     uint32_t u32;
24970     uint8_t u8[4];
24971   } S;
24972   S.u32 = 0x01020304;
24973   return S.u8[0] == 4;
24974 }
24975 
24976 /* BufferFormatCheck */
__Pyx_BufFmt_Init(__Pyx_BufFmt_Context * ctx,__Pyx_BufFmt_StackElem * stack,__Pyx_TypeInfo * type)24977 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
24978                               __Pyx_BufFmt_StackElem* stack,
24979                               __Pyx_TypeInfo* type) {
24980   stack[0].field = &ctx->root;
24981   stack[0].parent_offset = 0;
24982   ctx->root.type = type;
24983   ctx->root.name = "buffer dtype";
24984   ctx->root.offset = 0;
24985   ctx->head = stack;
24986   ctx->head->field = &ctx->root;
24987   ctx->fmt_offset = 0;
24988   ctx->head->parent_offset = 0;
24989   ctx->new_packmode = '@';
24990   ctx->enc_packmode = '@';
24991   ctx->new_count = 1;
24992   ctx->enc_count = 0;
24993   ctx->enc_type = 0;
24994   ctx->is_complex = 0;
24995   ctx->is_valid_array = 0;
24996   ctx->struct_alignment = 0;
24997   while (type->typegroup == 'S') {
24998     ++ctx->head;
24999     ctx->head->field = type->fields;
25000     ctx->head->parent_offset = 0;
25001     type = type->fields->type;
25002   }
25003 }
__Pyx_BufFmt_ParseNumber(const char ** ts)25004 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
25005     int count;
25006     const char* t = *ts;
25007     if (*t < '0' || *t > '9') {
25008       return -1;
25009     } else {
25010         count = *t++ - '0';
25011         while (*t >= '0' && *t <= '9') {
25012             count *= 10;
25013             count += *t++ - '0';
25014         }
25015     }
25016     *ts = t;
25017     return count;
25018 }
__Pyx_BufFmt_ExpectNumber(const char ** ts)25019 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
25020     int number = __Pyx_BufFmt_ParseNumber(ts);
25021     if (number == -1)
25022         PyErr_Format(PyExc_ValueError,\
25023                      "Does not understand character buffer dtype format string ('%c')", **ts);
25024     return number;
25025 }
__Pyx_BufFmt_RaiseUnexpectedChar(char ch)25026 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
25027   PyErr_Format(PyExc_ValueError,
25028                "Unexpected format string character: '%c'", ch);
25029 }
__Pyx_BufFmt_DescribeTypeChar(char ch,int is_complex)25030 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
25031   switch (ch) {
25032     case '?': return "'bool'";
25033     case 'c': return "'char'";
25034     case 'b': return "'signed char'";
25035     case 'B': return "'unsigned char'";
25036     case 'h': return "'short'";
25037     case 'H': return "'unsigned short'";
25038     case 'i': return "'int'";
25039     case 'I': return "'unsigned int'";
25040     case 'l': return "'long'";
25041     case 'L': return "'unsigned long'";
25042     case 'q': return "'long long'";
25043     case 'Q': return "'unsigned long long'";
25044     case 'f': return (is_complex ? "'complex float'" : "'float'");
25045     case 'd': return (is_complex ? "'complex double'" : "'double'");
25046     case 'g': return (is_complex ? "'complex long double'" : "'long double'");
25047     case 'T': return "a struct";
25048     case 'O': return "Python object";
25049     case 'P': return "a pointer";
25050     case 's': case 'p': return "a string";
25051     case 0: return "end";
25052     default: return "unparseable format string";
25053   }
25054 }
__Pyx_BufFmt_TypeCharToStandardSize(char ch,int is_complex)25055 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
25056   switch (ch) {
25057     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
25058     case 'h': case 'H': return 2;
25059     case 'i': case 'I': case 'l': case 'L': return 4;
25060     case 'q': case 'Q': return 8;
25061     case 'f': return (is_complex ? 8 : 4);
25062     case 'd': return (is_complex ? 16 : 8);
25063     case 'g': {
25064       PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
25065       return 0;
25066     }
25067     case 'O': case 'P': return sizeof(void*);
25068     default:
25069       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25070       return 0;
25071     }
25072 }
__Pyx_BufFmt_TypeCharToNativeSize(char ch,int is_complex)25073 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
25074   switch (ch) {
25075     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
25076     case 'h': case 'H': return sizeof(short);
25077     case 'i': case 'I': return sizeof(int);
25078     case 'l': case 'L': return sizeof(long);
25079     #ifdef HAVE_LONG_LONG
25080     case 'q': case 'Q': return sizeof(PY_LONG_LONG);
25081     #endif
25082     case 'f': return sizeof(float) * (is_complex ? 2 : 1);
25083     case 'd': return sizeof(double) * (is_complex ? 2 : 1);
25084     case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
25085     case 'O': case 'P': return sizeof(void*);
25086     default: {
25087       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25088       return 0;
25089     }
25090   }
25091 }
25092 typedef struct { char c; short x; } __Pyx_st_short;
25093 typedef struct { char c; int x; } __Pyx_st_int;
25094 typedef struct { char c; long x; } __Pyx_st_long;
25095 typedef struct { char c; float x; } __Pyx_st_float;
25096 typedef struct { char c; double x; } __Pyx_st_double;
25097 typedef struct { char c; long double x; } __Pyx_st_longdouble;
25098 typedef struct { char c; void *x; } __Pyx_st_void_p;
25099 #ifdef HAVE_LONG_LONG
25100 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
25101 #endif
__Pyx_BufFmt_TypeCharToAlignment(char ch,CYTHON_UNUSED int is_complex)25102 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
25103   switch (ch) {
25104     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
25105     case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
25106     case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
25107     case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
25108 #ifdef HAVE_LONG_LONG
25109     case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
25110 #endif
25111     case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
25112     case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
25113     case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
25114     case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
25115     default:
25116       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25117       return 0;
25118     }
25119 }
25120 /* These are for computing the padding at the end of the struct to align
25121    on the first member of the struct. This will probably the same as above,
25122    but we don't have any guarantees.
25123  */
25124 typedef struct { short x; char c; } __Pyx_pad_short;
25125 typedef struct { int x; char c; } __Pyx_pad_int;
25126 typedef struct { long x; char c; } __Pyx_pad_long;
25127 typedef struct { float x; char c; } __Pyx_pad_float;
25128 typedef struct { double x; char c; } __Pyx_pad_double;
25129 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
25130 typedef struct { void *x; char c; } __Pyx_pad_void_p;
25131 #ifdef HAVE_LONG_LONG
25132 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
25133 #endif
__Pyx_BufFmt_TypeCharToPadding(char ch,CYTHON_UNUSED int is_complex)25134 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
25135   switch (ch) {
25136     case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
25137     case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
25138     case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
25139     case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
25140 #ifdef HAVE_LONG_LONG
25141     case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
25142 #endif
25143     case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
25144     case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
25145     case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
25146     case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
25147     default:
25148       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25149       return 0;
25150     }
25151 }
__Pyx_BufFmt_TypeCharToGroup(char ch,int is_complex)25152 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
25153   switch (ch) {
25154     case 'c':
25155         return 'H';
25156     case 'b': case 'h': case 'i':
25157     case 'l': case 'q': case 's': case 'p':
25158         return 'I';
25159     case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
25160         return 'U';
25161     case 'f': case 'd': case 'g':
25162         return (is_complex ? 'C' : 'R');
25163     case 'O':
25164         return 'O';
25165     case 'P':
25166         return 'P';
25167     default: {
25168       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25169       return 0;
25170     }
25171   }
25172 }
__Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context * ctx)25173 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
25174   if (ctx->head == NULL || ctx->head->field == &ctx->root) {
25175     const char* expected;
25176     const char* quote;
25177     if (ctx->head == NULL) {
25178       expected = "end";
25179       quote = "";
25180     } else {
25181       expected = ctx->head->field->type->name;
25182       quote = "'";
25183     }
25184     PyErr_Format(PyExc_ValueError,
25185                  "Buffer dtype mismatch, expected %s%s%s but got %s",
25186                  quote, expected, quote,
25187                  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
25188   } else {
25189     __Pyx_StructField* field = ctx->head->field;
25190     __Pyx_StructField* parent = (ctx->head - 1)->field;
25191     PyErr_Format(PyExc_ValueError,
25192                  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
25193                  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
25194                  parent->type->name, field->name);
25195   }
25196 }
__Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context * ctx)25197 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
25198   char group;
25199   size_t size, offset, arraysize = 1;
25200   if (ctx->enc_type == 0) return 0;
25201   if (ctx->head->field->type->arraysize[0]) {
25202     int i, ndim = 0;
25203     if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
25204         ctx->is_valid_array = ctx->head->field->type->ndim == 1;
25205         ndim = 1;
25206         if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
25207             PyErr_Format(PyExc_ValueError,
25208                          "Expected a dimension of size %zu, got %zu",
25209                          ctx->head->field->type->arraysize[0], ctx->enc_count);
25210             return -1;
25211         }
25212     }
25213     if (!ctx->is_valid_array) {
25214       PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
25215                    ctx->head->field->type->ndim, ndim);
25216       return -1;
25217     }
25218     for (i = 0; i < ctx->head->field->type->ndim; i++) {
25219       arraysize *= ctx->head->field->type->arraysize[i];
25220     }
25221     ctx->is_valid_array = 0;
25222     ctx->enc_count = 1;
25223   }
25224   group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
25225   do {
25226     __Pyx_StructField* field = ctx->head->field;
25227     __Pyx_TypeInfo* type = field->type;
25228     if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
25229       size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
25230     } else {
25231       size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
25232     }
25233     if (ctx->enc_packmode == '@') {
25234       size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
25235       size_t align_mod_offset;
25236       if (align_at == 0) return -1;
25237       align_mod_offset = ctx->fmt_offset % align_at;
25238       if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
25239       if (ctx->struct_alignment == 0)
25240           ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
25241                                                                  ctx->is_complex);
25242     }
25243     if (type->size != size || type->typegroup != group) {
25244       if (type->typegroup == 'C' && type->fields != NULL) {
25245         size_t parent_offset = ctx->head->parent_offset + field->offset;
25246         ++ctx->head;
25247         ctx->head->field = type->fields;
25248         ctx->head->parent_offset = parent_offset;
25249         continue;
25250       }
25251       if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
25252       } else {
25253           __Pyx_BufFmt_RaiseExpected(ctx);
25254           return -1;
25255       }
25256     }
25257     offset = ctx->head->parent_offset + field->offset;
25258     if (ctx->fmt_offset != offset) {
25259       PyErr_Format(PyExc_ValueError,
25260                    "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
25261                    (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
25262       return -1;
25263     }
25264     ctx->fmt_offset += size;
25265     if (arraysize)
25266       ctx->fmt_offset += (arraysize - 1) * size;
25267     --ctx->enc_count;
25268     while (1) {
25269       if (field == &ctx->root) {
25270         ctx->head = NULL;
25271         if (ctx->enc_count != 0) {
25272           __Pyx_BufFmt_RaiseExpected(ctx);
25273           return -1;
25274         }
25275         break;
25276       }
25277       ctx->head->field = ++field;
25278       if (field->type == NULL) {
25279         --ctx->head;
25280         field = ctx->head->field;
25281         continue;
25282       } else if (field->type->typegroup == 'S') {
25283         size_t parent_offset = ctx->head->parent_offset + field->offset;
25284         if (field->type->fields->type == NULL) continue;
25285         field = field->type->fields;
25286         ++ctx->head;
25287         ctx->head->field = field;
25288         ctx->head->parent_offset = parent_offset;
25289         break;
25290       } else {
25291         break;
25292       }
25293     }
25294   } while (ctx->enc_count);
25295   ctx->enc_type = 0;
25296   ctx->is_complex = 0;
25297   return 0;
25298 }
25299 static PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context * ctx,const char ** tsp)25300 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
25301 {
25302     const char *ts = *tsp;
25303     int i = 0, number, ndim;
25304     ++ts;
25305     if (ctx->new_count != 1) {
25306         PyErr_SetString(PyExc_ValueError,
25307                         "Cannot handle repeated arrays in format string");
25308         return NULL;
25309     }
25310     if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25311     ndim = ctx->head->field->type->ndim;
25312     while (*ts && *ts != ')') {
25313         switch (*ts) {
25314             case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
25315             default:  break;
25316         }
25317         number = __Pyx_BufFmt_ExpectNumber(&ts);
25318         if (number == -1) return NULL;
25319         if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
25320             return PyErr_Format(PyExc_ValueError,
25321                         "Expected a dimension of size %zu, got %d",
25322                         ctx->head->field->type->arraysize[i], number);
25323         if (*ts != ',' && *ts != ')')
25324             return PyErr_Format(PyExc_ValueError,
25325                                 "Expected a comma in format string, got '%c'", *ts);
25326         if (*ts == ',') ts++;
25327         i++;
25328     }
25329     if (i != ndim)
25330         return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
25331                             ctx->head->field->type->ndim, i);
25332     if (!*ts) {
25333         PyErr_SetString(PyExc_ValueError,
25334                         "Unexpected end of format string, expected ')'");
25335         return NULL;
25336     }
25337     ctx->is_valid_array = 1;
25338     ctx->new_count = 1;
25339     *tsp = ++ts;
25340     return Py_None;
25341 }
__Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context * ctx,const char * ts)25342 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
25343   int got_Z = 0;
25344   while (1) {
25345     switch(*ts) {
25346       case 0:
25347         if (ctx->enc_type != 0 && ctx->head == NULL) {
25348           __Pyx_BufFmt_RaiseExpected(ctx);
25349           return NULL;
25350         }
25351         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25352         if (ctx->head != NULL) {
25353           __Pyx_BufFmt_RaiseExpected(ctx);
25354           return NULL;
25355         }
25356         return ts;
25357       case ' ':
25358       case '\r':
25359       case '\n':
25360         ++ts;
25361         break;
25362       case '<':
25363         if (!__Pyx_Is_Little_Endian()) {
25364           PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
25365           return NULL;
25366         }
25367         ctx->new_packmode = '=';
25368         ++ts;
25369         break;
25370       case '>':
25371       case '!':
25372         if (__Pyx_Is_Little_Endian()) {
25373           PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
25374           return NULL;
25375         }
25376         ctx->new_packmode = '=';
25377         ++ts;
25378         break;
25379       case '=':
25380       case '@':
25381       case '^':
25382         ctx->new_packmode = *ts++;
25383         break;
25384       case 'T':
25385         {
25386           const char* ts_after_sub;
25387           size_t i, struct_count = ctx->new_count;
25388           size_t struct_alignment = ctx->struct_alignment;
25389           ctx->new_count = 1;
25390           ++ts;
25391           if (*ts != '{') {
25392             PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
25393             return NULL;
25394           }
25395           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25396           ctx->enc_type = 0;
25397           ctx->enc_count = 0;
25398           ctx->struct_alignment = 0;
25399           ++ts;
25400           ts_after_sub = ts;
25401           for (i = 0; i != struct_count; ++i) {
25402             ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
25403             if (!ts_after_sub) return NULL;
25404           }
25405           ts = ts_after_sub;
25406           if (struct_alignment) ctx->struct_alignment = struct_alignment;
25407         }
25408         break;
25409       case '}':
25410         {
25411           size_t alignment = ctx->struct_alignment;
25412           ++ts;
25413           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25414           ctx->enc_type = 0;
25415           if (alignment && ctx->fmt_offset % alignment) {
25416             ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
25417           }
25418         }
25419         return ts;
25420       case 'x':
25421         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25422         ctx->fmt_offset += ctx->new_count;
25423         ctx->new_count = 1;
25424         ctx->enc_count = 0;
25425         ctx->enc_type = 0;
25426         ctx->enc_packmode = ctx->new_packmode;
25427         ++ts;
25428         break;
25429       case 'Z':
25430         got_Z = 1;
25431         ++ts;
25432         if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
25433           __Pyx_BufFmt_RaiseUnexpectedChar('Z');
25434           return NULL;
25435         }
25436         CYTHON_FALLTHROUGH;
25437       case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
25438       case 'l': case 'L': case 'q': case 'Q':
25439       case 'f': case 'd': case 'g':
25440       case 'O': case 'p':
25441         if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
25442             (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
25443           ctx->enc_count += ctx->new_count;
25444           ctx->new_count = 1;
25445           got_Z = 0;
25446           ++ts;
25447           break;
25448         }
25449         CYTHON_FALLTHROUGH;
25450       case 's':
25451         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
25452         ctx->enc_count = ctx->new_count;
25453         ctx->enc_packmode = ctx->new_packmode;
25454         ctx->enc_type = *ts;
25455         ctx->is_complex = got_Z;
25456         ++ts;
25457         ctx->new_count = 1;
25458         got_Z = 0;
25459         break;
25460       case ':':
25461         ++ts;
25462         while(*ts != ':') ++ts;
25463         ++ts;
25464         break;
25465       case '(':
25466         if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
25467         break;
25468       default:
25469         {
25470           int number = __Pyx_BufFmt_ExpectNumber(&ts);
25471           if (number == -1) return NULL;
25472           ctx->new_count = (size_t)number;
25473         }
25474     }
25475   }
25476 }
25477 
25478 /* TypeInfoCompare */
25479   static int
__pyx_typeinfo_cmp(__Pyx_TypeInfo * a,__Pyx_TypeInfo * b)25480 __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
25481 {
25482     int i;
25483     if (!a || !b)
25484         return 0;
25485     if (a == b)
25486         return 1;
25487     if (a->size != b->size || a->typegroup != b->typegroup ||
25488             a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
25489         if (a->typegroup == 'H' || b->typegroup == 'H') {
25490             return a->size == b->size;
25491         } else {
25492             return 0;
25493         }
25494     }
25495     if (a->ndim) {
25496         for (i = 0; i < a->ndim; i++)
25497             if (a->arraysize[i] != b->arraysize[i])
25498                 return 0;
25499     }
25500     if (a->typegroup == 'S') {
25501         if (a->flags != b->flags)
25502             return 0;
25503         if (a->fields || b->fields) {
25504             if (!(a->fields && b->fields))
25505                 return 0;
25506             for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
25507                 __Pyx_StructField *field_a = a->fields + i;
25508                 __Pyx_StructField *field_b = b->fields + i;
25509                 if (field_a->offset != field_b->offset ||
25510                     !__pyx_typeinfo_cmp(field_a->type, field_b->type))
25511                     return 0;
25512             }
25513             return !a->fields[i].type && !b->fields[i].type;
25514         }
25515     }
25516     return 1;
25517 }
25518 
25519 /* MemviewSliceValidateAndInit */
25520   static int
__pyx_check_strides(Py_buffer * buf,int dim,int ndim,int spec)25521 __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
25522 {
25523     if (buf->shape[dim] <= 1)
25524         return 1;
25525     if (buf->strides) {
25526         if (spec & __Pyx_MEMVIEW_CONTIG) {
25527             if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
25528                 if (unlikely(buf->strides[dim] != sizeof(void *))) {
25529                     PyErr_Format(PyExc_ValueError,
25530                                  "Buffer is not indirectly contiguous "
25531                                  "in dimension %d.", dim);
25532                     goto fail;
25533                 }
25534             } else if (unlikely(buf->strides[dim] != buf->itemsize)) {
25535                 PyErr_SetString(PyExc_ValueError,
25536                                 "Buffer and memoryview are not contiguous "
25537                                 "in the same dimension.");
25538                 goto fail;
25539             }
25540         }
25541         if (spec & __Pyx_MEMVIEW_FOLLOW) {
25542             Py_ssize_t stride = buf->strides[dim];
25543             if (stride < 0)
25544                 stride = -stride;
25545             if (unlikely(stride < buf->itemsize)) {
25546                 PyErr_SetString(PyExc_ValueError,
25547                                 "Buffer and memoryview are not contiguous "
25548                                 "in the same dimension.");
25549                 goto fail;
25550             }
25551         }
25552     } else {
25553         if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) {
25554             PyErr_Format(PyExc_ValueError,
25555                          "C-contiguous buffer is not contiguous in "
25556                          "dimension %d", dim);
25557             goto fail;
25558         } else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) {
25559             PyErr_Format(PyExc_ValueError,
25560                          "C-contiguous buffer is not indirect in "
25561                          "dimension %d", dim);
25562             goto fail;
25563         } else if (unlikely(buf->suboffsets)) {
25564             PyErr_SetString(PyExc_ValueError,
25565                             "Buffer exposes suboffsets but no strides");
25566             goto fail;
25567         }
25568     }
25569     return 1;
25570 fail:
25571     return 0;
25572 }
25573 static int
__pyx_check_suboffsets(Py_buffer * buf,int dim,CYTHON_UNUSED int ndim,int spec)25574 __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
25575 {
25576     if (spec & __Pyx_MEMVIEW_DIRECT) {
25577         if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) {
25578             PyErr_Format(PyExc_ValueError,
25579                          "Buffer not compatible with direct access "
25580                          "in dimension %d.", dim);
25581             goto fail;
25582         }
25583     }
25584     if (spec & __Pyx_MEMVIEW_PTR) {
25585         if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) {
25586             PyErr_Format(PyExc_ValueError,
25587                          "Buffer is not indirectly accessible "
25588                          "in dimension %d.", dim);
25589             goto fail;
25590         }
25591     }
25592     return 1;
25593 fail:
25594     return 0;
25595 }
25596 static int
__pyx_verify_contig(Py_buffer * buf,int ndim,int c_or_f_flag)25597 __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
25598 {
25599     int i;
25600     if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
25601         Py_ssize_t stride = 1;
25602         for (i = 0; i < ndim; i++) {
25603             if (unlikely(stride * buf->itemsize != buf->strides[i]  &&  buf->shape[i] > 1)) {
25604                 PyErr_SetString(PyExc_ValueError,
25605                     "Buffer not fortran contiguous.");
25606                 goto fail;
25607             }
25608             stride = stride * buf->shape[i];
25609         }
25610     } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
25611         Py_ssize_t stride = 1;
25612         for (i = ndim - 1; i >- 1; i--) {
25613             if (unlikely(stride * buf->itemsize != buf->strides[i]  &&  buf->shape[i] > 1)) {
25614                 PyErr_SetString(PyExc_ValueError,
25615                     "Buffer not C contiguous.");
25616                 goto fail;
25617             }
25618             stride = stride * buf->shape[i];
25619         }
25620     }
25621     return 1;
25622 fail:
25623     return 0;
25624 }
__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)25625 static int __Pyx_ValidateAndInit_memviewslice(
25626                 int *axes_specs,
25627                 int c_or_f_flag,
25628                 int buf_flags,
25629                 int ndim,
25630                 __Pyx_TypeInfo *dtype,
25631                 __Pyx_BufFmt_StackElem stack[],
25632                 __Pyx_memviewslice *memviewslice,
25633                 PyObject *original_obj)
25634 {
25635     struct __pyx_memoryview_obj *memview, *new_memview;
25636     __Pyx_RefNannyDeclarations
25637     Py_buffer *buf;
25638     int i, spec = 0, retval = -1;
25639     __Pyx_BufFmt_Context ctx;
25640     int from_memoryview = __pyx_memoryview_check(original_obj);
25641     __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
25642     if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
25643                                                             original_obj)->typeinfo)) {
25644         memview = (struct __pyx_memoryview_obj *) original_obj;
25645         new_memview = NULL;
25646     } else {
25647         memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
25648                                             original_obj, buf_flags, 0, dtype);
25649         new_memview = memview;
25650         if (unlikely(!memview))
25651             goto fail;
25652     }
25653     buf = &memview->view;
25654     if (unlikely(buf->ndim != ndim)) {
25655         PyErr_Format(PyExc_ValueError,
25656                 "Buffer has wrong number of dimensions (expected %d, got %d)",
25657                 ndim, buf->ndim);
25658         goto fail;
25659     }
25660     if (new_memview) {
25661         __Pyx_BufFmt_Init(&ctx, stack, dtype);
25662         if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format))) goto fail;
25663     }
25664     if (unlikely((unsigned) buf->itemsize != dtype->size)) {
25665         PyErr_Format(PyExc_ValueError,
25666                      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
25667                      "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
25668                      buf->itemsize,
25669                      (buf->itemsize > 1) ? "s" : "",
25670                      dtype->name,
25671                      dtype->size,
25672                      (dtype->size > 1) ? "s" : "");
25673         goto fail;
25674     }
25675     if (buf->len > 0) {
25676         for (i = 0; i < ndim; i++) {
25677             spec = axes_specs[i];
25678             if (unlikely(!__pyx_check_strides(buf, i, ndim, spec)))
25679                 goto fail;
25680             if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
25681                 goto fail;
25682         }
25683         if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
25684             goto fail;
25685     }
25686     if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
25687                                          new_memview != NULL) == -1)) {
25688         goto fail;
25689     }
25690     retval = 0;
25691     goto no_fail;
25692 fail:
25693     Py_XDECREF(new_memview);
25694     retval = -1;
25695 no_fail:
25696     __Pyx_RefNannyFinishContext();
25697     return retval;
25698 }
25699 
25700 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_dsds_double(PyObject * obj,int writable_flag)25701   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_double(PyObject *obj, int writable_flag) {
25702     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
25703     __Pyx_BufFmt_StackElem stack[1];
25704     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
25705     int retcode;
25706     if (obj == Py_None) {
25707         result.memview = (struct __pyx_memoryview_obj *) Py_None;
25708         return result;
25709     }
25710     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
25711                                                  PyBUF_RECORDS_RO | writable_flag, 2,
25712                                                  &__Pyx_TypeInfo_double, stack,
25713                                                  &result, obj);
25714     if (unlikely(retcode == -1))
25715         goto __pyx_fail;
25716     return result;
25717 __pyx_fail:
25718     result.memview = NULL;
25719     result.data = NULL;
25720     return result;
25721 }
25722 
25723 /* CIntFromPyVerify */
25724   #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
25725     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
25726 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
25727     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
25728 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
25729     {\
25730         func_type value = func_value;\
25731         if (sizeof(target_type) < sizeof(func_type)) {\
25732             if (unlikely(value != (func_type) (target_type) value)) {\
25733                 func_type zero = 0;\
25734                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
25735                     return (target_type) -1;\
25736                 if (is_unsigned && unlikely(value < zero))\
25737                     goto raise_neg_overflow;\
25738                 else\
25739                     goto raise_overflow;\
25740             }\
25741         }\
25742         return (target_type) value;\
25743     }
25744 
25745 /* Declarations */
25746   #if CYTHON_CCOMPLEX
25747   #ifdef __cplusplus
__pyx_t_float_complex_from_parts(float x,float y)25748     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
25749       return ::std::complex< float >(x, y);
25750     }
25751   #else
__pyx_t_float_complex_from_parts(float x,float y)25752     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
25753       return x + y*(__pyx_t_float_complex)_Complex_I;
25754     }
25755   #endif
25756 #else
__pyx_t_float_complex_from_parts(float x,float y)25757     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
25758       __pyx_t_float_complex z;
25759       z.real = x;
25760       z.imag = y;
25761       return z;
25762     }
25763 #endif
25764 
25765 /* Arithmetic */
25766   #if CYTHON_CCOMPLEX
25767 #else
__Pyx_c_eq_float(__pyx_t_float_complex a,__pyx_t_float_complex b)25768     static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25769        return (a.real == b.real) && (a.imag == b.imag);
25770     }
__Pyx_c_sum_float(__pyx_t_float_complex a,__pyx_t_float_complex b)25771     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25772         __pyx_t_float_complex z;
25773         z.real = a.real + b.real;
25774         z.imag = a.imag + b.imag;
25775         return z;
25776     }
__Pyx_c_diff_float(__pyx_t_float_complex a,__pyx_t_float_complex b)25777     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25778         __pyx_t_float_complex z;
25779         z.real = a.real - b.real;
25780         z.imag = a.imag - b.imag;
25781         return z;
25782     }
__Pyx_c_prod_float(__pyx_t_float_complex a,__pyx_t_float_complex b)25783     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25784         __pyx_t_float_complex z;
25785         z.real = a.real * b.real - a.imag * b.imag;
25786         z.imag = a.real * b.imag + a.imag * b.real;
25787         return z;
25788     }
25789     #if 1
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)25790     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25791         if (b.imag == 0) {
25792             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
25793         } else if (fabsf(b.real) >= fabsf(b.imag)) {
25794             if (b.real == 0 && b.imag == 0) {
25795                 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
25796             } else {
25797                 float r = b.imag / b.real;
25798                 float s = (float)(1.0) / (b.real + b.imag * r);
25799                 return __pyx_t_float_complex_from_parts(
25800                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
25801             }
25802         } else {
25803             float r = b.real / b.imag;
25804             float s = (float)(1.0) / (b.imag + b.real * r);
25805             return __pyx_t_float_complex_from_parts(
25806                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
25807         }
25808     }
25809     #else
__Pyx_c_quot_float(__pyx_t_float_complex a,__pyx_t_float_complex b)25810     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25811         if (b.imag == 0) {
25812             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
25813         } else {
25814             float denom = b.real * b.real + b.imag * b.imag;
25815             return __pyx_t_float_complex_from_parts(
25816                 (a.real * b.real + a.imag * b.imag) / denom,
25817                 (a.imag * b.real - a.real * b.imag) / denom);
25818         }
25819     }
25820     #endif
__Pyx_c_neg_float(__pyx_t_float_complex a)25821     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
25822         __pyx_t_float_complex z;
25823         z.real = -a.real;
25824         z.imag = -a.imag;
25825         return z;
25826     }
__Pyx_c_is_zero_float(__pyx_t_float_complex a)25827     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
25828        return (a.real == 0) && (a.imag == 0);
25829     }
__Pyx_c_conj_float(__pyx_t_float_complex a)25830     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
25831         __pyx_t_float_complex z;
25832         z.real =  a.real;
25833         z.imag = -a.imag;
25834         return z;
25835     }
25836     #if 1
__Pyx_c_abs_float(__pyx_t_float_complex z)25837         static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
25838           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
25839             return sqrtf(z.real*z.real + z.imag*z.imag);
25840           #else
25841             return hypotf(z.real, z.imag);
25842           #endif
25843         }
__Pyx_c_pow_float(__pyx_t_float_complex a,__pyx_t_float_complex b)25844         static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
25845             __pyx_t_float_complex z;
25846             float r, lnr, theta, z_r, z_theta;
25847             if (b.imag == 0 && b.real == (int)b.real) {
25848                 if (b.real < 0) {
25849                     float denom = a.real * a.real + a.imag * a.imag;
25850                     a.real = a.real / denom;
25851                     a.imag = -a.imag / denom;
25852                     b.real = -b.real;
25853                 }
25854                 switch ((int)b.real) {
25855                     case 0:
25856                         z.real = 1;
25857                         z.imag = 0;
25858                         return z;
25859                     case 1:
25860                         return a;
25861                     case 2:
25862                         return __Pyx_c_prod_float(a, a);
25863                     case 3:
25864                         z = __Pyx_c_prod_float(a, a);
25865                         return __Pyx_c_prod_float(z, a);
25866                     case 4:
25867                         z = __Pyx_c_prod_float(a, a);
25868                         return __Pyx_c_prod_float(z, z);
25869                 }
25870             }
25871             if (a.imag == 0) {
25872                 if (a.real == 0) {
25873                     return a;
25874                 } else if (b.imag == 0) {
25875                     z.real = powf(a.real, b.real);
25876                     z.imag = 0;
25877                     return z;
25878                 } else if (a.real > 0) {
25879                     r = a.real;
25880                     theta = 0;
25881                 } else {
25882                     r = -a.real;
25883                     theta = atan2f(0.0, -1.0);
25884                 }
25885             } else {
25886                 r = __Pyx_c_abs_float(a);
25887                 theta = atan2f(a.imag, a.real);
25888             }
25889             lnr = logf(r);
25890             z_r = expf(lnr * b.real - theta * b.imag);
25891             z_theta = theta * b.real + lnr * b.imag;
25892             z.real = z_r * cosf(z_theta);
25893             z.imag = z_r * sinf(z_theta);
25894             return z;
25895         }
25896     #endif
25897 #endif
25898 
25899 /* Declarations */
25900   #if CYTHON_CCOMPLEX
25901   #ifdef __cplusplus
__pyx_t_double_complex_from_parts(double x,double y)25902     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
25903       return ::std::complex< double >(x, y);
25904     }
25905   #else
__pyx_t_double_complex_from_parts(double x,double y)25906     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
25907       return x + y*(__pyx_t_double_complex)_Complex_I;
25908     }
25909   #endif
25910 #else
__pyx_t_double_complex_from_parts(double x,double y)25911     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
25912       __pyx_t_double_complex z;
25913       z.real = x;
25914       z.imag = y;
25915       return z;
25916     }
25917 #endif
25918 
25919 /* Arithmetic */
25920   #if CYTHON_CCOMPLEX
25921 #else
__Pyx_c_eq_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25922     static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25923        return (a.real == b.real) && (a.imag == b.imag);
25924     }
__Pyx_c_sum_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25925     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25926         __pyx_t_double_complex z;
25927         z.real = a.real + b.real;
25928         z.imag = a.imag + b.imag;
25929         return z;
25930     }
__Pyx_c_diff_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25931     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25932         __pyx_t_double_complex z;
25933         z.real = a.real - b.real;
25934         z.imag = a.imag - b.imag;
25935         return z;
25936     }
__Pyx_c_prod_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25937     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25938         __pyx_t_double_complex z;
25939         z.real = a.real * b.real - a.imag * b.imag;
25940         z.imag = a.real * b.imag + a.imag * b.real;
25941         return z;
25942     }
25943     #if 1
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25944     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25945         if (b.imag == 0) {
25946             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
25947         } else if (fabs(b.real) >= fabs(b.imag)) {
25948             if (b.real == 0 && b.imag == 0) {
25949                 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
25950             } else {
25951                 double r = b.imag / b.real;
25952                 double s = (double)(1.0) / (b.real + b.imag * r);
25953                 return __pyx_t_double_complex_from_parts(
25954                     (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
25955             }
25956         } else {
25957             double r = b.real / b.imag;
25958             double s = (double)(1.0) / (b.imag + b.real * r);
25959             return __pyx_t_double_complex_from_parts(
25960                 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
25961         }
25962     }
25963     #else
__Pyx_c_quot_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25964     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25965         if (b.imag == 0) {
25966             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
25967         } else {
25968             double denom = b.real * b.real + b.imag * b.imag;
25969             return __pyx_t_double_complex_from_parts(
25970                 (a.real * b.real + a.imag * b.imag) / denom,
25971                 (a.imag * b.real - a.real * b.imag) / denom);
25972         }
25973     }
25974     #endif
__Pyx_c_neg_double(__pyx_t_double_complex a)25975     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
25976         __pyx_t_double_complex z;
25977         z.real = -a.real;
25978         z.imag = -a.imag;
25979         return z;
25980     }
__Pyx_c_is_zero_double(__pyx_t_double_complex a)25981     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
25982        return (a.real == 0) && (a.imag == 0);
25983     }
__Pyx_c_conj_double(__pyx_t_double_complex a)25984     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
25985         __pyx_t_double_complex z;
25986         z.real =  a.real;
25987         z.imag = -a.imag;
25988         return z;
25989     }
25990     #if 1
__Pyx_c_abs_double(__pyx_t_double_complex z)25991         static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
25992           #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
25993             return sqrt(z.real*z.real + z.imag*z.imag);
25994           #else
25995             return hypot(z.real, z.imag);
25996           #endif
25997         }
__Pyx_c_pow_double(__pyx_t_double_complex a,__pyx_t_double_complex b)25998         static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
25999             __pyx_t_double_complex z;
26000             double r, lnr, theta, z_r, z_theta;
26001             if (b.imag == 0 && b.real == (int)b.real) {
26002                 if (b.real < 0) {
26003                     double denom = a.real * a.real + a.imag * a.imag;
26004                     a.real = a.real / denom;
26005                     a.imag = -a.imag / denom;
26006                     b.real = -b.real;
26007                 }
26008                 switch ((int)b.real) {
26009                     case 0:
26010                         z.real = 1;
26011                         z.imag = 0;
26012                         return z;
26013                     case 1:
26014                         return a;
26015                     case 2:
26016                         return __Pyx_c_prod_double(a, a);
26017                     case 3:
26018                         z = __Pyx_c_prod_double(a, a);
26019                         return __Pyx_c_prod_double(z, a);
26020                     case 4:
26021                         z = __Pyx_c_prod_double(a, a);
26022                         return __Pyx_c_prod_double(z, z);
26023                 }
26024             }
26025             if (a.imag == 0) {
26026                 if (a.real == 0) {
26027                     return a;
26028                 } else if (b.imag == 0) {
26029                     z.real = pow(a.real, b.real);
26030                     z.imag = 0;
26031                     return z;
26032                 } else if (a.real > 0) {
26033                     r = a.real;
26034                     theta = 0;
26035                 } else {
26036                     r = -a.real;
26037                     theta = atan2(0.0, -1.0);
26038                 }
26039             } else {
26040                 r = __Pyx_c_abs_double(a);
26041                 theta = atan2(a.imag, a.real);
26042             }
26043             lnr = log(r);
26044             z_r = exp(lnr * b.real - theta * b.imag);
26045             z_theta = theta * b.real + lnr * b.imag;
26046             z.real = z_r * cos(z_theta);
26047             z.imag = z_r * sin(z_theta);
26048             return z;
26049         }
26050     #endif
26051 #endif
26052 
26053 /* MemviewSliceCopyTemplate */
26054   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)26055 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
26056                                  const char *mode, int ndim,
26057                                  size_t sizeof_dtype, int contig_flag,
26058                                  int dtype_is_object)
26059 {
26060     __Pyx_RefNannyDeclarations
26061     int i;
26062     __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
26063     struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
26064     Py_buffer *buf = &from_memview->view;
26065     PyObject *shape_tuple = NULL;
26066     PyObject *temp_int = NULL;
26067     struct __pyx_array_obj *array_obj = NULL;
26068     struct __pyx_memoryview_obj *memview_obj = NULL;
26069     __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
26070     for (i = 0; i < ndim; i++) {
26071         if (unlikely(from_mvs->suboffsets[i] >= 0)) {
26072             PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
26073                                            "indirect dimensions (axis %d)", i);
26074             goto fail;
26075         }
26076     }
26077     shape_tuple = PyTuple_New(ndim);
26078     if (unlikely(!shape_tuple)) {
26079         goto fail;
26080     }
26081     __Pyx_GOTREF(shape_tuple);
26082     for(i = 0; i < ndim; i++) {
26083         temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
26084         if(unlikely(!temp_int)) {
26085             goto fail;
26086         } else {
26087             PyTuple_SET_ITEM(shape_tuple, i, temp_int);
26088             temp_int = NULL;
26089         }
26090     }
26091     array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
26092     if (unlikely(!array_obj)) {
26093         goto fail;
26094     }
26095     __Pyx_GOTREF(array_obj);
26096     memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
26097                                     (PyObject *) array_obj, contig_flag,
26098                                     dtype_is_object,
26099                                     from_mvs->memview->typeinfo);
26100     if (unlikely(!memview_obj))
26101         goto fail;
26102     if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
26103         goto fail;
26104     if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
26105                                                 dtype_is_object) < 0))
26106         goto fail;
26107     goto no_fail;
26108 fail:
26109     __Pyx_XDECREF(new_mvs.memview);
26110     new_mvs.memview = NULL;
26111     new_mvs.data = NULL;
26112 no_fail:
26113     __Pyx_XDECREF(shape_tuple);
26114     __Pyx_XDECREF(temp_int);
26115     __Pyx_XDECREF(array_obj);
26116     __Pyx_RefNannyFinishContext();
26117     return new_mvs;
26118 }
26119 
26120 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)26121   static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
26122 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26123 #pragma GCC diagnostic push
26124 #pragma GCC diagnostic ignored "-Wconversion"
26125 #endif
26126     const long neg_one = (long) -1, const_zero = (long) 0;
26127 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26128 #pragma GCC diagnostic pop
26129 #endif
26130     const int is_unsigned = neg_one > const_zero;
26131 #if PY_MAJOR_VERSION < 3
26132     if (likely(PyInt_Check(x))) {
26133         if (sizeof(long) < sizeof(long)) {
26134             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
26135         } else {
26136             long val = PyInt_AS_LONG(x);
26137             if (is_unsigned && unlikely(val < 0)) {
26138                 goto raise_neg_overflow;
26139             }
26140             return (long) val;
26141         }
26142     } else
26143 #endif
26144     if (likely(PyLong_Check(x))) {
26145         if (is_unsigned) {
26146 #if CYTHON_USE_PYLONG_INTERNALS
26147             const digit* digits = ((PyLongObject*)x)->ob_digit;
26148             switch (Py_SIZE(x)) {
26149                 case  0: return (long) 0;
26150                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
26151                 case 2:
26152                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
26153                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26154                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26155                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
26156                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
26157                         }
26158                     }
26159                     break;
26160                 case 3:
26161                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
26162                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26163                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26164                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
26165                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
26166                         }
26167                     }
26168                     break;
26169                 case 4:
26170                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
26171                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26172                             __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])))
26173                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
26174                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
26175                         }
26176                     }
26177                     break;
26178             }
26179 #endif
26180 #if CYTHON_COMPILING_IN_CPYTHON
26181             if (unlikely(Py_SIZE(x) < 0)) {
26182                 goto raise_neg_overflow;
26183             }
26184 #else
26185             {
26186                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
26187                 if (unlikely(result < 0))
26188                     return (long) -1;
26189                 if (unlikely(result == 1))
26190                     goto raise_neg_overflow;
26191             }
26192 #endif
26193             if (sizeof(long) <= sizeof(unsigned long)) {
26194                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
26195 #ifdef HAVE_LONG_LONG
26196             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
26197                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
26198 #endif
26199             }
26200         } else {
26201 #if CYTHON_USE_PYLONG_INTERNALS
26202             const digit* digits = ((PyLongObject*)x)->ob_digit;
26203             switch (Py_SIZE(x)) {
26204                 case  0: return (long) 0;
26205                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
26206                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
26207                 case -2:
26208                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
26209                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26210                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26211                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
26212                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26213                         }
26214                     }
26215                     break;
26216                 case 2:
26217                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
26218                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26219                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26220                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
26221                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26222                         }
26223                     }
26224                     break;
26225                 case -3:
26226                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
26227                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26228                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26229                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
26230                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26231                         }
26232                     }
26233                     break;
26234                 case 3:
26235                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
26236                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26237                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26238                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
26239                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26240                         }
26241                     }
26242                     break;
26243                 case -4:
26244                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
26245                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26246                             __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])))
26247                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
26248                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26249                         }
26250                     }
26251                     break;
26252                 case 4:
26253                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
26254                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26255                             __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])))
26256                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
26257                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
26258                         }
26259                     }
26260                     break;
26261             }
26262 #endif
26263             if (sizeof(long) <= sizeof(long)) {
26264                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
26265 #ifdef HAVE_LONG_LONG
26266             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
26267                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
26268 #endif
26269             }
26270         }
26271         {
26272 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
26273             PyErr_SetString(PyExc_RuntimeError,
26274                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
26275 #else
26276             long val;
26277             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
26278  #if PY_MAJOR_VERSION < 3
26279             if (likely(v) && !PyLong_Check(v)) {
26280                 PyObject *tmp = v;
26281                 v = PyNumber_Long(tmp);
26282                 Py_DECREF(tmp);
26283             }
26284  #endif
26285             if (likely(v)) {
26286                 int one = 1; int is_little = (int)*(unsigned char *)&one;
26287                 unsigned char *bytes = (unsigned char *)&val;
26288                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
26289                                               bytes, sizeof(val),
26290                                               is_little, !is_unsigned);
26291                 Py_DECREF(v);
26292                 if (likely(!ret))
26293                     return val;
26294             }
26295 #endif
26296             return (long) -1;
26297         }
26298     } else {
26299         long val;
26300         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
26301         if (!tmp) return (long) -1;
26302         val = __Pyx_PyInt_As_long(tmp);
26303         Py_DECREF(tmp);
26304         return val;
26305     }
26306 raise_overflow:
26307     PyErr_SetString(PyExc_OverflowError,
26308         "value too large to convert to long");
26309     return (long) -1;
26310 raise_neg_overflow:
26311     PyErr_SetString(PyExc_OverflowError,
26312         "can't convert negative value to long");
26313     return (long) -1;
26314 }
26315 
26316 /* CIntFromPy */
__Pyx_PyInt_As_Py_intptr_t(PyObject * x)26317   static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *x) {
26318 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26319 #pragma GCC diagnostic push
26320 #pragma GCC diagnostic ignored "-Wconversion"
26321 #endif
26322     const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0;
26323 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26324 #pragma GCC diagnostic pop
26325 #endif
26326     const int is_unsigned = neg_one > const_zero;
26327 #if PY_MAJOR_VERSION < 3
26328     if (likely(PyInt_Check(x))) {
26329         if (sizeof(Py_intptr_t) < sizeof(long)) {
26330             __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, PyInt_AS_LONG(x))
26331         } else {
26332             long val = PyInt_AS_LONG(x);
26333             if (is_unsigned && unlikely(val < 0)) {
26334                 goto raise_neg_overflow;
26335             }
26336             return (Py_intptr_t) val;
26337         }
26338     } else
26339 #endif
26340     if (likely(PyLong_Check(x))) {
26341         if (is_unsigned) {
26342 #if CYTHON_USE_PYLONG_INTERNALS
26343             const digit* digits = ((PyLongObject*)x)->ob_digit;
26344             switch (Py_SIZE(x)) {
26345                 case  0: return (Py_intptr_t) 0;
26346                 case  1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, digit, digits[0])
26347                 case 2:
26348                     if (8 * sizeof(Py_intptr_t) > 1 * PyLong_SHIFT) {
26349                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26350                             __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26351                         } else if (8 * sizeof(Py_intptr_t) >= 2 * PyLong_SHIFT) {
26352                             return (Py_intptr_t) (((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
26353                         }
26354                     }
26355                     break;
26356                 case 3:
26357                     if (8 * sizeof(Py_intptr_t) > 2 * PyLong_SHIFT) {
26358                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26359                             __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])))
26360                         } else if (8 * sizeof(Py_intptr_t) >= 3 * PyLong_SHIFT) {
26361                             return (Py_intptr_t) (((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
26362                         }
26363                     }
26364                     break;
26365                 case 4:
26366                     if (8 * sizeof(Py_intptr_t) > 3 * PyLong_SHIFT) {
26367                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26368                             __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])))
26369                         } else if (8 * sizeof(Py_intptr_t) >= 4 * PyLong_SHIFT) {
26370                             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]));
26371                         }
26372                     }
26373                     break;
26374             }
26375 #endif
26376 #if CYTHON_COMPILING_IN_CPYTHON
26377             if (unlikely(Py_SIZE(x) < 0)) {
26378                 goto raise_neg_overflow;
26379             }
26380 #else
26381             {
26382                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
26383                 if (unlikely(result < 0))
26384                     return (Py_intptr_t) -1;
26385                 if (unlikely(result == 1))
26386                     goto raise_neg_overflow;
26387             }
26388 #endif
26389             if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
26390                 __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, unsigned long, PyLong_AsUnsignedLong(x))
26391 #ifdef HAVE_LONG_LONG
26392             } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
26393                 __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
26394 #endif
26395             }
26396         } else {
26397 #if CYTHON_USE_PYLONG_INTERNALS
26398             const digit* digits = ((PyLongObject*)x)->ob_digit;
26399             switch (Py_SIZE(x)) {
26400                 case  0: return (Py_intptr_t) 0;
26401                 case -1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, sdigit, (sdigit) (-(sdigit)digits[0]))
26402                 case  1: __PYX_VERIFY_RETURN_INT(Py_intptr_t,  digit, +digits[0])
26403                 case -2:
26404                     if (8 * sizeof(Py_intptr_t) - 1 > 1 * PyLong_SHIFT) {
26405                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26406                             __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26407                         } else if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
26408                             return (Py_intptr_t) (((Py_intptr_t)-1)*(((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26409                         }
26410                     }
26411                     break;
26412                 case 2:
26413                     if (8 * sizeof(Py_intptr_t) > 1 * PyLong_SHIFT) {
26414                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26415                             __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26416                         } else if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
26417                             return (Py_intptr_t) ((((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26418                         }
26419                     }
26420                     break;
26421                 case -3:
26422                     if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
26423                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26424                             __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])))
26425                         } else if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
26426                             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])));
26427                         }
26428                     }
26429                     break;
26430                 case 3:
26431                     if (8 * sizeof(Py_intptr_t) > 2 * PyLong_SHIFT) {
26432                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26433                             __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])))
26434                         } else if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
26435                             return (Py_intptr_t) ((((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26436                         }
26437                     }
26438                     break;
26439                 case -4:
26440                     if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
26441                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26442                             __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])))
26443                         } else if (8 * sizeof(Py_intptr_t) - 1 > 4 * PyLong_SHIFT) {
26444                             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])));
26445                         }
26446                     }
26447                     break;
26448                 case 4:
26449                     if (8 * sizeof(Py_intptr_t) > 3 * PyLong_SHIFT) {
26450                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26451                             __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])))
26452                         } else if (8 * sizeof(Py_intptr_t) - 1 > 4 * PyLong_SHIFT) {
26453                             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])));
26454                         }
26455                     }
26456                     break;
26457             }
26458 #endif
26459             if (sizeof(Py_intptr_t) <= sizeof(long)) {
26460                 __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, long, PyLong_AsLong(x))
26461 #ifdef HAVE_LONG_LONG
26462             } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
26463                 __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, PY_LONG_LONG, PyLong_AsLongLong(x))
26464 #endif
26465             }
26466         }
26467         {
26468 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
26469             PyErr_SetString(PyExc_RuntimeError,
26470                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
26471 #else
26472             Py_intptr_t val;
26473             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
26474  #if PY_MAJOR_VERSION < 3
26475             if (likely(v) && !PyLong_Check(v)) {
26476                 PyObject *tmp = v;
26477                 v = PyNumber_Long(tmp);
26478                 Py_DECREF(tmp);
26479             }
26480  #endif
26481             if (likely(v)) {
26482                 int one = 1; int is_little = (int)*(unsigned char *)&one;
26483                 unsigned char *bytes = (unsigned char *)&val;
26484                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
26485                                               bytes, sizeof(val),
26486                                               is_little, !is_unsigned);
26487                 Py_DECREF(v);
26488                 if (likely(!ret))
26489                     return val;
26490             }
26491 #endif
26492             return (Py_intptr_t) -1;
26493         }
26494     } else {
26495         Py_intptr_t val;
26496         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
26497         if (!tmp) return (Py_intptr_t) -1;
26498         val = __Pyx_PyInt_As_Py_intptr_t(tmp);
26499         Py_DECREF(tmp);
26500         return val;
26501     }
26502 raise_overflow:
26503     PyErr_SetString(PyExc_OverflowError,
26504         "value too large to convert to Py_intptr_t");
26505     return (Py_intptr_t) -1;
26506 raise_neg_overflow:
26507     PyErr_SetString(PyExc_OverflowError,
26508         "can't convert negative value to Py_intptr_t");
26509     return (Py_intptr_t) -1;
26510 }
26511 
26512 /* CIntToPy */
__Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value)26513   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
26514 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26515 #pragma GCC diagnostic push
26516 #pragma GCC diagnostic ignored "-Wconversion"
26517 #endif
26518     const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0;
26519 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26520 #pragma GCC diagnostic pop
26521 #endif
26522     const int is_unsigned = neg_one > const_zero;
26523     if (is_unsigned) {
26524         if (sizeof(Py_intptr_t) < sizeof(long)) {
26525             return PyInt_FromLong((long) value);
26526         } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
26527             return PyLong_FromUnsignedLong((unsigned long) value);
26528 #ifdef HAVE_LONG_LONG
26529         } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
26530             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26531 #endif
26532         }
26533     } else {
26534         if (sizeof(Py_intptr_t) <= sizeof(long)) {
26535             return PyInt_FromLong((long) value);
26536 #ifdef HAVE_LONG_LONG
26537         } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
26538             return PyLong_FromLongLong((PY_LONG_LONG) value);
26539 #endif
26540         }
26541     }
26542     {
26543         int one = 1; int little = (int)*(unsigned char *)&one;
26544         unsigned char *bytes = (unsigned char *)&value;
26545         return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
26546                                      little, !is_unsigned);
26547     }
26548 }
26549 
26550 /* CIntToPy */
__Pyx_PyInt_From_long(long value)26551   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
26552 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26553 #pragma GCC diagnostic push
26554 #pragma GCC diagnostic ignored "-Wconversion"
26555 #endif
26556     const long neg_one = (long) -1, const_zero = (long) 0;
26557 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26558 #pragma GCC diagnostic pop
26559 #endif
26560     const int is_unsigned = neg_one > const_zero;
26561     if (is_unsigned) {
26562         if (sizeof(long) < sizeof(long)) {
26563             return PyInt_FromLong((long) value);
26564         } else if (sizeof(long) <= sizeof(unsigned long)) {
26565             return PyLong_FromUnsignedLong((unsigned long) value);
26566 #ifdef HAVE_LONG_LONG
26567         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
26568             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26569 #endif
26570         }
26571     } else {
26572         if (sizeof(long) <= sizeof(long)) {
26573             return PyInt_FromLong((long) value);
26574 #ifdef HAVE_LONG_LONG
26575         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
26576             return PyLong_FromLongLong((PY_LONG_LONG) value);
26577 #endif
26578         }
26579     }
26580     {
26581         int one = 1; int little = (int)*(unsigned char *)&one;
26582         unsigned char *bytes = (unsigned char *)&value;
26583         return _PyLong_FromByteArray(bytes, sizeof(long),
26584                                      little, !is_unsigned);
26585     }
26586 }
26587 
26588 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)26589   static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
26590 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26591 #pragma GCC diagnostic push
26592 #pragma GCC diagnostic ignored "-Wconversion"
26593 #endif
26594     const int neg_one = (int) -1, const_zero = (int) 0;
26595 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26596 #pragma GCC diagnostic pop
26597 #endif
26598     const int is_unsigned = neg_one > const_zero;
26599 #if PY_MAJOR_VERSION < 3
26600     if (likely(PyInt_Check(x))) {
26601         if (sizeof(int) < sizeof(long)) {
26602             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
26603         } else {
26604             long val = PyInt_AS_LONG(x);
26605             if (is_unsigned && unlikely(val < 0)) {
26606                 goto raise_neg_overflow;
26607             }
26608             return (int) val;
26609         }
26610     } else
26611 #endif
26612     if (likely(PyLong_Check(x))) {
26613         if (is_unsigned) {
26614 #if CYTHON_USE_PYLONG_INTERNALS
26615             const digit* digits = ((PyLongObject*)x)->ob_digit;
26616             switch (Py_SIZE(x)) {
26617                 case  0: return (int) 0;
26618                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
26619                 case 2:
26620                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
26621                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26622                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26623                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
26624                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
26625                         }
26626                     }
26627                     break;
26628                 case 3:
26629                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
26630                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26631                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26632                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
26633                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
26634                         }
26635                     }
26636                     break;
26637                 case 4:
26638                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
26639                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26640                             __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])))
26641                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
26642                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
26643                         }
26644                     }
26645                     break;
26646             }
26647 #endif
26648 #if CYTHON_COMPILING_IN_CPYTHON
26649             if (unlikely(Py_SIZE(x) < 0)) {
26650                 goto raise_neg_overflow;
26651             }
26652 #else
26653             {
26654                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
26655                 if (unlikely(result < 0))
26656                     return (int) -1;
26657                 if (unlikely(result == 1))
26658                     goto raise_neg_overflow;
26659             }
26660 #endif
26661             if (sizeof(int) <= sizeof(unsigned long)) {
26662                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
26663 #ifdef HAVE_LONG_LONG
26664             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
26665                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
26666 #endif
26667             }
26668         } else {
26669 #if CYTHON_USE_PYLONG_INTERNALS
26670             const digit* digits = ((PyLongObject*)x)->ob_digit;
26671             switch (Py_SIZE(x)) {
26672                 case  0: return (int) 0;
26673                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
26674                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
26675                 case -2:
26676                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
26677                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26678                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26679                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
26680                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26681                         }
26682                     }
26683                     break;
26684                 case 2:
26685                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
26686                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26687                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26688                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
26689                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26690                         }
26691                     }
26692                     break;
26693                 case -3:
26694                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
26695                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26696                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26697                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
26698                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26699                         }
26700                     }
26701                     break;
26702                 case 3:
26703                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
26704                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26705                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26706                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
26707                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26708                         }
26709                     }
26710                     break;
26711                 case -4:
26712                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
26713                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26714                             __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])))
26715                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
26716                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26717                         }
26718                     }
26719                     break;
26720                 case 4:
26721                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
26722                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26723                             __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])))
26724                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
26725                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26726                         }
26727                     }
26728                     break;
26729             }
26730 #endif
26731             if (sizeof(int) <= sizeof(long)) {
26732                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
26733 #ifdef HAVE_LONG_LONG
26734             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
26735                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
26736 #endif
26737             }
26738         }
26739         {
26740 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
26741             PyErr_SetString(PyExc_RuntimeError,
26742                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
26743 #else
26744             int val;
26745             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
26746  #if PY_MAJOR_VERSION < 3
26747             if (likely(v) && !PyLong_Check(v)) {
26748                 PyObject *tmp = v;
26749                 v = PyNumber_Long(tmp);
26750                 Py_DECREF(tmp);
26751             }
26752  #endif
26753             if (likely(v)) {
26754                 int one = 1; int is_little = (int)*(unsigned char *)&one;
26755                 unsigned char *bytes = (unsigned char *)&val;
26756                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
26757                                               bytes, sizeof(val),
26758                                               is_little, !is_unsigned);
26759                 Py_DECREF(v);
26760                 if (likely(!ret))
26761                     return val;
26762             }
26763 #endif
26764             return (int) -1;
26765         }
26766     } else {
26767         int val;
26768         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
26769         if (!tmp) return (int) -1;
26770         val = __Pyx_PyInt_As_int(tmp);
26771         Py_DECREF(tmp);
26772         return val;
26773     }
26774 raise_overflow:
26775     PyErr_SetString(PyExc_OverflowError,
26776         "value too large to convert to int");
26777     return (int) -1;
26778 raise_neg_overflow:
26779     PyErr_SetString(PyExc_OverflowError,
26780         "can't convert negative value to int");
26781     return (int) -1;
26782 }
26783 
26784 /* CIntToPy */
__Pyx_PyInt_From_int(int value)26785   static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
26786 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26787 #pragma GCC diagnostic push
26788 #pragma GCC diagnostic ignored "-Wconversion"
26789 #endif
26790     const int neg_one = (int) -1, const_zero = (int) 0;
26791 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26792 #pragma GCC diagnostic pop
26793 #endif
26794     const int is_unsigned = neg_one > const_zero;
26795     if (is_unsigned) {
26796         if (sizeof(int) < sizeof(long)) {
26797             return PyInt_FromLong((long) value);
26798         } else if (sizeof(int) <= sizeof(unsigned long)) {
26799             return PyLong_FromUnsignedLong((unsigned long) value);
26800 #ifdef HAVE_LONG_LONG
26801         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
26802             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26803 #endif
26804         }
26805     } else {
26806         if (sizeof(int) <= sizeof(long)) {
26807             return PyInt_FromLong((long) value);
26808 #ifdef HAVE_LONG_LONG
26809         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
26810             return PyLong_FromLongLong((PY_LONG_LONG) value);
26811 #endif
26812         }
26813     }
26814     {
26815         int one = 1; int little = (int)*(unsigned char *)&one;
26816         unsigned char *bytes = (unsigned char *)&value;
26817         return _PyLong_FromByteArray(bytes, sizeof(int),
26818                                      little, !is_unsigned);
26819     }
26820 }
26821 
26822 /* CIntFromPy */
__Pyx_PyInt_As_char(PyObject * x)26823   static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
26824 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26825 #pragma GCC diagnostic push
26826 #pragma GCC diagnostic ignored "-Wconversion"
26827 #endif
26828     const char neg_one = (char) -1, const_zero = (char) 0;
26829 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26830 #pragma GCC diagnostic pop
26831 #endif
26832     const int is_unsigned = neg_one > const_zero;
26833 #if PY_MAJOR_VERSION < 3
26834     if (likely(PyInt_Check(x))) {
26835         if (sizeof(char) < sizeof(long)) {
26836             __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
26837         } else {
26838             long val = PyInt_AS_LONG(x);
26839             if (is_unsigned && unlikely(val < 0)) {
26840                 goto raise_neg_overflow;
26841             }
26842             return (char) val;
26843         }
26844     } else
26845 #endif
26846     if (likely(PyLong_Check(x))) {
26847         if (is_unsigned) {
26848 #if CYTHON_USE_PYLONG_INTERNALS
26849             const digit* digits = ((PyLongObject*)x)->ob_digit;
26850             switch (Py_SIZE(x)) {
26851                 case  0: return (char) 0;
26852                 case  1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
26853                 case 2:
26854                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
26855                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26856                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26857                         } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
26858                             return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
26859                         }
26860                     }
26861                     break;
26862                 case 3:
26863                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
26864                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26865                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26866                         } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
26867                             return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
26868                         }
26869                     }
26870                     break;
26871                 case 4:
26872                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
26873                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26874                             __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])))
26875                         } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
26876                             return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
26877                         }
26878                     }
26879                     break;
26880             }
26881 #endif
26882 #if CYTHON_COMPILING_IN_CPYTHON
26883             if (unlikely(Py_SIZE(x) < 0)) {
26884                 goto raise_neg_overflow;
26885             }
26886 #else
26887             {
26888                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
26889                 if (unlikely(result < 0))
26890                     return (char) -1;
26891                 if (unlikely(result == 1))
26892                     goto raise_neg_overflow;
26893             }
26894 #endif
26895             if (sizeof(char) <= sizeof(unsigned long)) {
26896                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
26897 #ifdef HAVE_LONG_LONG
26898             } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
26899                 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
26900 #endif
26901             }
26902         } else {
26903 #if CYTHON_USE_PYLONG_INTERNALS
26904             const digit* digits = ((PyLongObject*)x)->ob_digit;
26905             switch (Py_SIZE(x)) {
26906                 case  0: return (char) 0;
26907                 case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
26908                 case  1: __PYX_VERIFY_RETURN_INT(char,  digit, +digits[0])
26909                 case -2:
26910                     if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
26911                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26912                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26913                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
26914                             return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
26915                         }
26916                     }
26917                     break;
26918                 case 2:
26919                     if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
26920                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26921                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26922                         } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
26923                             return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
26924                         }
26925                     }
26926                     break;
26927                 case -3:
26928                     if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
26929                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26930                             __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26931                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
26932                             return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
26933                         }
26934                     }
26935                     break;
26936                 case 3:
26937                     if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
26938                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26939                             __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26940                         } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
26941                             return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
26942                         }
26943                     }
26944                     break;
26945                 case -4:
26946                     if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
26947                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26948                             __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])))
26949                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
26950                             return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
26951                         }
26952                     }
26953                     break;
26954                 case 4:
26955                     if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
26956                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26957                             __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])))
26958                         } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
26959                             return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
26960                         }
26961                     }
26962                     break;
26963             }
26964 #endif
26965             if (sizeof(char) <= sizeof(long)) {
26966                 __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
26967 #ifdef HAVE_LONG_LONG
26968             } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
26969                 __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
26970 #endif
26971             }
26972         }
26973         {
26974 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
26975             PyErr_SetString(PyExc_RuntimeError,
26976                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
26977 #else
26978             char val;
26979             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
26980  #if PY_MAJOR_VERSION < 3
26981             if (likely(v) && !PyLong_Check(v)) {
26982                 PyObject *tmp = v;
26983                 v = PyNumber_Long(tmp);
26984                 Py_DECREF(tmp);
26985             }
26986  #endif
26987             if (likely(v)) {
26988                 int one = 1; int is_little = (int)*(unsigned char *)&one;
26989                 unsigned char *bytes = (unsigned char *)&val;
26990                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
26991                                               bytes, sizeof(val),
26992                                               is_little, !is_unsigned);
26993                 Py_DECREF(v);
26994                 if (likely(!ret))
26995                     return val;
26996             }
26997 #endif
26998             return (char) -1;
26999         }
27000     } else {
27001         char val;
27002         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27003         if (!tmp) return (char) -1;
27004         val = __Pyx_PyInt_As_char(tmp);
27005         Py_DECREF(tmp);
27006         return val;
27007     }
27008 raise_overflow:
27009     PyErr_SetString(PyExc_OverflowError,
27010         "value too large to convert to char");
27011     return (char) -1;
27012 raise_neg_overflow:
27013     PyErr_SetString(PyExc_OverflowError,
27014         "can't convert negative value to char");
27015     return (char) -1;
27016 }
27017 
27018 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject * obj,int writable_flag)27019   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *obj, int writable_flag) {
27020     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
27021     __Pyx_BufFmt_StackElem stack[1];
27022     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
27023     int retcode;
27024     if (obj == Py_None) {
27025         result.memview = (struct __pyx_memoryview_obj *) Py_None;
27026         return result;
27027     }
27028     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
27029                                                  PyBUF_RECORDS_RO | writable_flag, 1,
27030                                                  &__Pyx_TypeInfo_double, stack,
27031                                                  &result, obj);
27032     if (unlikely(retcode == -1))
27033         goto __pyx_fail;
27034     return result;
27035 __pyx_fail:
27036     result.memview = NULL;
27037     result.data = NULL;
27038     return result;
27039 }
27040 
27041 /* ObjectToMemviewSlice */
__Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_uint8_t(PyObject * obj,int writable_flag)27042   static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_nn___pyx_t_5numpy_uint8_t(PyObject *obj, int writable_flag) {
27043     __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
27044     __Pyx_BufFmt_StackElem stack[1];
27045     int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
27046     int retcode;
27047     if (obj == Py_None) {
27048         result.memview = (struct __pyx_memoryview_obj *) Py_None;
27049         return result;
27050     }
27051     retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
27052                                                  PyBUF_RECORDS_RO | writable_flag, 1,
27053                                                  &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, stack,
27054                                                  &result, obj);
27055     if (unlikely(retcode == -1))
27056         goto __pyx_fail;
27057     return result;
27058 __pyx_fail:
27059     result.memview = NULL;
27060     result.data = NULL;
27061     return result;
27062 }
27063 
27064 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)27065   static int __Pyx_check_binary_version(void) {
27066     char ctversion[4], rtversion[4];
27067     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
27068     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
27069     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
27070         char message[200];
27071         PyOS_snprintf(message, sizeof(message),
27072                       "compiletime version %s of module '%.100s' "
27073                       "does not match runtime version %s",
27074                       ctversion, __Pyx_MODULE_NAME, rtversion);
27075         return PyErr_WarnEx(NULL, message, 1);
27076     }
27077     return 0;
27078 }
27079 
27080 /* FunctionImport */
27081   #ifndef __PYX_HAVE_RT_ImportFunction
27082 #define __PYX_HAVE_RT_ImportFunction
__Pyx_ImportFunction(PyObject * module,const char * funcname,void (** f)(void),const char * sig)27083 static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
27084     PyObject *d = 0;
27085     PyObject *cobj = 0;
27086     union {
27087         void (*fp)(void);
27088         void *p;
27089     } tmp;
27090     d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
27091     if (!d)
27092         goto bad;
27093     cobj = PyDict_GetItemString(d, funcname);
27094     if (!cobj) {
27095         PyErr_Format(PyExc_ImportError,
27096             "%.200s does not export expected C function %.200s",
27097                 PyModule_GetName(module), funcname);
27098         goto bad;
27099     }
27100 #if PY_VERSION_HEX >= 0x02070000
27101     if (!PyCapsule_IsValid(cobj, sig)) {
27102         PyErr_Format(PyExc_TypeError,
27103             "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
27104              PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
27105         goto bad;
27106     }
27107     tmp.p = PyCapsule_GetPointer(cobj, sig);
27108 #else
27109     {const char *desc, *s1, *s2;
27110     desc = (const char *)PyCObject_GetDesc(cobj);
27111     if (!desc)
27112         goto bad;
27113     s1 = desc; s2 = sig;
27114     while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
27115     if (*s1 != *s2) {
27116         PyErr_Format(PyExc_TypeError,
27117             "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
27118              PyModule_GetName(module), funcname, sig, desc);
27119         goto bad;
27120     }
27121     tmp.p = PyCObject_AsVoidPtr(cobj);}
27122 #endif
27123     *f = tmp.fp;
27124     if (!(*f))
27125         goto bad;
27126     Py_DECREF(d);
27127     return 0;
27128 bad:
27129     Py_XDECREF(d);
27130     return -1;
27131 }
27132 #endif
27133 
27134 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)27135   static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
27136     while (t->p) {
27137         #if PY_MAJOR_VERSION < 3
27138         if (t->is_unicode) {
27139             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
27140         } else if (t->intern) {
27141             *t->p = PyString_InternFromString(t->s);
27142         } else {
27143             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
27144         }
27145         #else
27146         if (t->is_unicode | t->is_str) {
27147             if (t->intern) {
27148                 *t->p = PyUnicode_InternFromString(t->s);
27149             } else if (t->encoding) {
27150                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
27151             } else {
27152                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
27153             }
27154         } else {
27155             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
27156         }
27157         #endif
27158         if (!*t->p)
27159             return -1;
27160         if (PyObject_Hash(*t->p) == -1)
27161             return -1;
27162         ++t;
27163     }
27164     return 0;
27165 }
27166 
__Pyx_PyUnicode_FromString(const char * c_str)27167 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
27168     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
27169 }
__Pyx_PyObject_AsString(PyObject * o)27170 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
27171     Py_ssize_t ignore;
27172     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
27173 }
27174 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
27175 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)27176 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
27177     char* defenc_c;
27178     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
27179     if (!defenc) return NULL;
27180     defenc_c = PyBytes_AS_STRING(defenc);
27181 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27182     {
27183         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
27184         char* c;
27185         for (c = defenc_c; c < end; c++) {
27186             if ((unsigned char) (*c) >= 128) {
27187                 PyUnicode_AsASCIIString(o);
27188                 return NULL;
27189             }
27190         }
27191     }
27192 #endif
27193     *length = PyBytes_GET_SIZE(defenc);
27194     return defenc_c;
27195 }
27196 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)27197 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
27198     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
27199 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27200     if (likely(PyUnicode_IS_ASCII(o))) {
27201         *length = PyUnicode_GET_LENGTH(o);
27202         return PyUnicode_AsUTF8(o);
27203     } else {
27204         PyUnicode_AsASCIIString(o);
27205         return NULL;
27206     }
27207 #else
27208     return PyUnicode_AsUTF8AndSize(o, length);
27209 #endif
27210 }
27211 #endif
27212 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)27213 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
27214 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
27215     if (
27216 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27217             __Pyx_sys_getdefaultencoding_not_ascii &&
27218 #endif
27219             PyUnicode_Check(o)) {
27220         return __Pyx_PyUnicode_AsStringAndSize(o, length);
27221     } else
27222 #endif
27223 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
27224     if (PyByteArray_Check(o)) {
27225         *length = PyByteArray_GET_SIZE(o);
27226         return PyByteArray_AS_STRING(o);
27227     } else
27228 #endif
27229     {
27230         char* result;
27231         int r = PyBytes_AsStringAndSize(o, &result, length);
27232         if (unlikely(r < 0)) {
27233             return NULL;
27234         } else {
27235             return result;
27236         }
27237     }
27238 }
__Pyx_PyObject_IsTrue(PyObject * x)27239 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
27240    int is_true = x == Py_True;
27241    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
27242    else return PyObject_IsTrue(x);
27243 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)27244 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
27245     int retval;
27246     if (unlikely(!x)) return -1;
27247     retval = __Pyx_PyObject_IsTrue(x);
27248     Py_DECREF(x);
27249     return retval;
27250 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)27251 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
27252 #if PY_MAJOR_VERSION >= 3
27253     if (PyLong_Check(result)) {
27254         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
27255                 "__int__ returned non-int (type %.200s).  "
27256                 "The ability to return an instance of a strict subclass of int "
27257                 "is deprecated, and may be removed in a future version of Python.",
27258                 Py_TYPE(result)->tp_name)) {
27259             Py_DECREF(result);
27260             return NULL;
27261         }
27262         return result;
27263     }
27264 #endif
27265     PyErr_Format(PyExc_TypeError,
27266                  "__%.4s__ returned non-%.4s (type %.200s)",
27267                  type_name, type_name, Py_TYPE(result)->tp_name);
27268     Py_DECREF(result);
27269     return NULL;
27270 }
__Pyx_PyNumber_IntOrLong(PyObject * x)27271 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
27272 #if CYTHON_USE_TYPE_SLOTS
27273   PyNumberMethods *m;
27274 #endif
27275   const char *name = NULL;
27276   PyObject *res = NULL;
27277 #if PY_MAJOR_VERSION < 3
27278   if (likely(PyInt_Check(x) || PyLong_Check(x)))
27279 #else
27280   if (likely(PyLong_Check(x)))
27281 #endif
27282     return __Pyx_NewRef(x);
27283 #if CYTHON_USE_TYPE_SLOTS
27284   m = Py_TYPE(x)->tp_as_number;
27285   #if PY_MAJOR_VERSION < 3
27286   if (m && m->nb_int) {
27287     name = "int";
27288     res = m->nb_int(x);
27289   }
27290   else if (m && m->nb_long) {
27291     name = "long";
27292     res = m->nb_long(x);
27293   }
27294   #else
27295   if (likely(m && m->nb_int)) {
27296     name = "int";
27297     res = m->nb_int(x);
27298   }
27299   #endif
27300 #else
27301   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
27302     res = PyNumber_Int(x);
27303   }
27304 #endif
27305   if (likely(res)) {
27306 #if PY_MAJOR_VERSION < 3
27307     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
27308 #else
27309     if (unlikely(!PyLong_CheckExact(res))) {
27310 #endif
27311         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
27312     }
27313   }
27314   else if (!PyErr_Occurred()) {
27315     PyErr_SetString(PyExc_TypeError,
27316                     "an integer is required");
27317   }
27318   return res;
27319 }
27320 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
27321   Py_ssize_t ival;
27322   PyObject *x;
27323 #if PY_MAJOR_VERSION < 3
27324   if (likely(PyInt_CheckExact(b))) {
27325     if (sizeof(Py_ssize_t) >= sizeof(long))
27326         return PyInt_AS_LONG(b);
27327     else
27328         return PyInt_AsSsize_t(b);
27329   }
27330 #endif
27331   if (likely(PyLong_CheckExact(b))) {
27332     #if CYTHON_USE_PYLONG_INTERNALS
27333     const digit* digits = ((PyLongObject*)b)->ob_digit;
27334     const Py_ssize_t size = Py_SIZE(b);
27335     if (likely(__Pyx_sst_abs(size) <= 1)) {
27336         ival = likely(size) ? digits[0] : 0;
27337         if (size == -1) ival = -ival;
27338         return ival;
27339     } else {
27340       switch (size) {
27341          case 2:
27342            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
27343              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27344            }
27345            break;
27346          case -2:
27347            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
27348              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27349            }
27350            break;
27351          case 3:
27352            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
27353              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27354            }
27355            break;
27356          case -3:
27357            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
27358              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27359            }
27360            break;
27361          case 4:
27362            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
27363              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]));
27364            }
27365            break;
27366          case -4:
27367            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
27368              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]));
27369            }
27370            break;
27371       }
27372     }
27373     #endif
27374     return PyLong_AsSsize_t(b);
27375   }
27376   x = PyNumber_Index(b);
27377   if (!x) return -1;
27378   ival = PyInt_AsSsize_t(x);
27379   Py_DECREF(x);
27380   return ival;
27381 }
27382 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
27383   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
27384 }
27385 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
27386     return PyInt_FromSize_t(ival);
27387 }
27388 
27389 
27390 #endif /* Py_PYTHON_H */
27391